Stellarium 0.12.2
List of all members | Public Member Functions | Protected Member Functions | Protected Attributes
StelIndexBuffer Class Referenceabstract

Generic index buffer interface usable with all Renderer backends. More...

#include <StelIndexBuffer.hpp>

Public Member Functions

virtual ~StelIndexBuffer ()
 Virtual destructor. More...
 
void addIndex (const uint index)
 Add a new index to the end of the buffer. More...
 
uint getIndex (const int which) const
 Return index at specified position in the buffer. More...
 
void setIndex (const int which, const uint index)
 Set specified index in the buffer. More...
 
void clear ()
 Clear the buffer, removing all indices. More...
 
void lock ()
 Lock the buffer. Must be called before drawing. More...
 
void unlock ()
 Unlock the buffer. Must be called to modify the buffer after drawing. More...
 
bool locked () const
 Is this buffer locked? More...
 
IndexType indexType () const
 Get type of indices (16bit or 32bit) More...
 
int length () const
 Returns the number of indices in the buffer. More...
 

Protected Member Functions

 StelIndexBuffer (IndexType indexType)
 Initialize data common for all index buffer implementations. More...
 
virtual void addIndex_ (const uint index)=0
 Implementation of addIndex. More...
 
virtual uint getIndex_ (const int which) const =0
 Implementation of getIndex. More...
 
virtual void setIndex_ (const int which, const uint index)=0
 Implementation of setIndex. More...
 
virtual void clear_ ()=0
 Implementation of clear. More...
 
virtual void lock_ ()=0
 Implementation of lock. More...
 
virtual void unlock_ ()=0
 Implementation of unlock. More...
 

Protected Attributes

const IndexType indexType_
 Index type used (16 or 32 bit) More...
 

Detailed Description

Generic index buffer interface usable with all Renderer backends.

Used to specify order in which vertices from a vertex buffer are drawn (allowing to e.g. draw the same vertex in multiple triangles without duplicating it, saving memory and RAM-VRAM bandwidth).

Definition at line 45 of file StelIndexBuffer.hpp.

Constructor & Destructor Documentation

virtual StelIndexBuffer::~StelIndexBuffer ( )
inlinevirtual

Virtual destructor.

Definition at line 49 of file StelIndexBuffer.hpp.

StelIndexBuffer::StelIndexBuffer ( IndexType  indexType)
inlineprotected

Initialize data common for all index buffer implementations.

Definition at line 150 of file StelIndexBuffer.hpp.

Member Function Documentation

void StelIndexBuffer::addIndex ( const uint  index)
inline

Add a new index to the end of the buffer.

The buffer must not be locked.

Parameters
indexIndex to add.

Definition at line 56 of file StelIndexBuffer.hpp.

virtual void StelIndexBuffer::addIndex_ ( const uint  index)
protectedpure virtual

Implementation of addIndex.

See Also
addIndex

Implemented in StelQGLIndexBuffer.

void StelIndexBuffer::clear ( )
inline

Clear the buffer, removing all indices.

Can only be called when unlocked.

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

Definition at line 106 of file StelIndexBuffer.hpp.

virtual void StelIndexBuffer::clear_ ( )
protectedpure virtual

Implementation of clear.

See Also
clear

Implemented in StelQGLIndexBuffer.

uint StelIndexBuffer::getIndex ( const int  which) const
inline

Return index at specified position in the buffer.

The buffer must not be locked.

Parameters
whichPosition of the index to get.
Returns
Index at specified position.

Definition at line 73 of file StelIndexBuffer.hpp.

virtual uint StelIndexBuffer::getIndex_ ( const int  which) const
protectedpure virtual

Implementation of getIndex.

See Also
getIndex

Implemented in StelQGLIndexBuffer.

IndexType StelIndexBuffer::indexType ( ) const
inline

Get type of indices (16bit or 32bit)

Definition at line 134 of file StelIndexBuffer.hpp.

int StelIndexBuffer::length ( ) const
inline

Returns the number of indices in the buffer.

Definition at line 140 of file StelIndexBuffer.hpp.

void StelIndexBuffer::lock ( )
inline

Lock the buffer. Must be called before drawing.

Definition at line 114 of file StelIndexBuffer.hpp.

virtual void StelIndexBuffer::lock_ ( )
protectedpure virtual

Implementation of lock.

See Also
lock

Implemented in StelQGLIndexBuffer.

bool StelIndexBuffer::locked ( ) const
inline

Is this buffer locked?

Definition at line 128 of file StelIndexBuffer.hpp.

void StelIndexBuffer::setIndex ( const int  which,
const uint  index 
)
inline

Set specified index in the buffer.

The buffer must not be locked.

Parameters
whichPosition of the index to set.
indexValue to set the index to.

Definition at line 88 of file StelIndexBuffer.hpp.

virtual void StelIndexBuffer::setIndex_ ( const int  which,
const uint  index 
)
protectedpure virtual

Implementation of setIndex.

See Also
setIndex

Implemented in StelQGLIndexBuffer.

void StelIndexBuffer::unlock ( )
inline

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

Definition at line 121 of file StelIndexBuffer.hpp.

virtual void StelIndexBuffer::unlock_ ( )
protectedpure virtual

Implementation of unlock.

See Also
unlock

Implemented in StelQGLIndexBuffer.

Member Data Documentation

const IndexType StelIndexBuffer::indexType_
protected

Index type used (16 or 32 bit)

Definition at line 147 of file StelIndexBuffer.hpp.


The documentation for this class was generated from the following file: