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

StelIndexBuffer Class Reference

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

#include <StelIndexBuffer.hpp>

List of all members.

Public Member Functions

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

Protected Member Functions

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

Protected Attributes

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

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 (  )  [inline, virtual]

Virtual destructor.

Definition at line 49 of file StelIndexBuffer.hpp.

StelIndexBuffer::StelIndexBuffer ( IndexType  indexType  )  [inline, protected]

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:
index Index to add.

Definition at line 56 of file StelIndexBuffer.hpp.

virtual void StelIndexBuffer::addIndex_ ( const uint  index  )  [protected, pure 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_ (  )  [protected, pure 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:
which Position 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 [protected, pure 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_ (  )  [protected, pure 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:
which Position of the index to set.
index Value to set the index to.

Definition at line 88 of file StelIndexBuffer.hpp.

virtual void StelIndexBuffer::setIndex_ ( const int  which,
const uint  index 
) [protected, pure 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_ (  )  [protected, pure 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:
Generated on Thu Jan 31 14:05:45 2013 for Stellarium by  doxygen 1.6.3