Stellarium 0.12.0
Home · All Namespaces · All Classes · Functions · Coding Style · Scripting · Plugins · Renderer · File Structure

StelVertexBufferBackend Class Reference

Base class of all vertex buffer backends. More...

#include <StelVertexBufferBackend.hpp>

List of all members.

Classes

struct  Attributes
 Stores vertex attribute metadata of a buffer.

Public Member Functions

 StelVertexBufferBackend (const QVector< StelVertexAttribute > &attributes)
 Construct a StelVertexBufferBackend, specifying attributes of the vertex type.
virtual ~StelVertexBufferBackend ()
 Required to ensure that derived classes get properly deallocated.
virtual void addVertex (const void *const vertexInPtr)=0
 Add a new vertex to the buffer.
virtual void getVertex (const int index, void *const vertexOutPtr) const =0
 Get a vertex from the buffer.
virtual void setVertex (const int index, const void *const vertexInPtr)=0
 Rewrite a vertex in the buffer.
virtual void lock ()=0
 Lock the buffer. Must be called before drawing.
virtual void unlock ()=0
 Unlock the buffer. Must be called to modify the buffer after drawing.
virtual void clear ()=0
 Clear the buffer, removing all vertices.
void validateVertexType (const int vertexSize)
 Assert that the user-specified (in StelVertexBuffer) vertex type is valid.

Protected Attributes

const Attributes attributes
 Specifies layout of vertex attributes in the vertex type.

Detailed Description

Base class of all vertex buffer backends.

This is where the vertex buffer logic is implemented.

The backend doesn't directly know the vertex type (since templating doesn't mix with virtual inheritance), so it works with raw (void) pointers.

Vertex format is described by the attributes data member. Each item in attributes specifies a vertex attribute (such as a position or normal), and these correspond to the data members of the user-specified vertex struct which is the template parameter of the StelVertexBuffer class.

StelVertexBufferBackend is always owned by a StelVertexBuffer and can't exist separately. Only the StelRenderer backend has direct access to StelVertexBufferBackend's implementation.

When the user asks StelRenderer to create a vertex buffer, the renderer backend first creates its own implementation of the vertex buffer backend, and then wraps it up in a StelVertexBuffer.

See also:
StelVertexBuffer, StelRenderer
Note:
This is an internal class of the Renderer subsystem and should not be used elsewhere.

Definition at line 55 of file StelVertexBufferBackend.hpp.


Constructor & Destructor Documentation

StelVertexBufferBackend::StelVertexBufferBackend ( const QVector< StelVertexAttribute > &  attributes  )  [inline]

Construct a StelVertexBufferBackend, specifying attributes of the vertex type.

Definition at line 87 of file StelVertexBufferBackend.hpp.

virtual StelVertexBufferBackend::~StelVertexBufferBackend (  )  [inline, virtual]

Required to ensure that derived classes get properly deallocated.

Definition at line 93 of file StelVertexBufferBackend.hpp.


Member Function Documentation

virtual void StelVertexBufferBackend::addVertex ( const void *const   vertexInPtr  )  [pure virtual]

Add a new vertex to the buffer.

StelVertexBuffer guarantees that when this is called, buffer is not locked and index is in range.

Parameters:
vertexInPtr Pointer to the beginning of the vertex. Data members of the vertex must match vertex attributes of the buffer.

Implemented in StelQGLArrayVertexBufferBackend, and StelQGLInterleavedArrayVertexBufferBackend.

virtual void StelVertexBufferBackend::clear (  )  [pure virtual]

Clear the buffer, removing all vertices.

The backend implementation might reuse previously allocated storage after clearing, so calling clear() might be more efficient than destroying a buffer and then constructing a new one.

Implemented in StelQGLArrayVertexBufferBackend, and StelQGLInterleavedArrayVertexBufferBackend.

virtual void StelVertexBufferBackend::getVertex ( const int  index,
void *const   vertexOutPtr 
) const [pure virtual]

Get a vertex from the buffer.

StelVertexBuffer guarantees that when this is called, buffer is not locked and index is in range.

Parameters:
index Index of the vertex to read.
vertexOutPtr Pointer to the beginning of the output vertex. Data members of the vertex must match vertex attributes of the buffer.

Implemented in StelQGLArrayVertexBufferBackend, and StelQGLInterleavedArrayVertexBufferBackend.

virtual void StelVertexBufferBackend::lock (  )  [pure virtual]

Lock the buffer. Must be called before drawing.

Implemented in StelQGLArrayVertexBufferBackend, and StelQGLInterleavedArrayVertexBufferBackend.

virtual void StelVertexBufferBackend::setVertex ( const int  index,
const void *const   vertexInPtr 
) [pure virtual]

Rewrite a vertex in the buffer.

StelVertexBuffer guarantees that when this is called, buffer is not locked and index is in range.

Parameters:
index Index of the vertex to set.
vertexInPtr Pointer to the beginning of the vertex that will rewrite the vertex in the buffer. Data members of the vertex must match vertex attributes of the buffer.

Implemented in StelQGLArrayVertexBufferBackend, and StelQGLInterleavedArrayVertexBufferBackend.

virtual void StelVertexBufferBackend::unlock (  )  [pure virtual]

Unlock the buffer. Must be called to modify the buffer after drawing.

Implemented in StelQGLArrayVertexBufferBackend, and StelQGLInterleavedArrayVertexBufferBackend.

void StelVertexBufferBackend::validateVertexType ( const int  vertexSize  )  [inline]

Assert that the user-specified (in StelVertexBuffer) vertex type is valid.

Definition at line 139 of file StelVertexBufferBackend.hpp.


Member Data Documentation

const Attributes StelVertexBufferBackend::attributes [protected]

Specifies layout of vertex attributes in the vertex type.

Definition at line 160 of file StelVertexBufferBackend.hpp.


The documentation for this class was generated from the following file:
Generated on Thu Jan 31 14:05:47 2013 for Stellarium by  doxygen 1.6.3