TRendererIndexBuffer Class Reference

This class represents index buffer with 16-bit indices (32-bits indices are not supported thus maximum vertex index is 2^16==65536). More...

#include <RendererTypes.h>

List of all members.

Public Member Functions

virtual void Duplicate (TRendererIndexBuffer **dest)=0
 Duplicate pointer to this object to another one and increase number of references to it.
virtual DWORD GetRefs (void) const =0
 Returns number of references to this VB.
virtual DWORD AddRefs (void)=0
 Increases number of references and returns result.
virtual DWORD Release (void)=0
 Decreases number of references to this IB and return result.
virtual DWORD GetCapacity (void) const =0
 Returns number of indices that can be stored in this vertex buffer.
virtual DWORD GetSize (void) const =0
 Returns size of entire index bufer in bytes.
virtual DWORD GetIndexSize (void) const =0
 This method always returns 2, because all indices are 16-bits (sizeof(short)==2).
virtual DWORD GetIndicesCount (void) const =0
 Returns number of actually valid indices in buffer.
virtual DWORD GetFreeCapacity (void) const =0
 Returns number of unused indices in index buffer.
virtual BOOL IsDynamic (void) const =0
 Determines whether this index buffer is dynamic.
virtual BOOL UpdateIndexBuffer (const void *data, DWORD startIndex, DWORD indices)=0
 Updates index buffer.
virtual BOOL DisardDynamicIndexBuffer (const void *data, DWORD startIndex, DWORD indices)=0
 This method update dynamic index buffer thus cannot be used for static index buffers.
virtual BOOL AddToDynamicIndexBuffer (const void *data, DWORD indices)=0
 This method updates dynamic index buffer thus cannot be used for static index buffer.


Detailed Description

This class represents index buffer with 16-bit indices (32-bits indices are not supported thus maximum vertex index is 2^16==65536).

Index buffer can be static or dynamic, but always have write-only access. All index buffers are instable, thus you must re-create all index buffers after device was lost. All indices are stored in VIDEO memory and all are renderable.

Index buffer object can be create only by renderer class and released via Release() method.

Index buffer may be filled with special renderer methods. See TRenderer class.

Definition at line 1433 of file RendererTypes.h.


Member Function Documentation

virtual DWORD TRendererIndexBuffer::AddRefs void   )  [pure virtual]
 

Increases number of references and returns result.

virtual BOOL TRendererIndexBuffer::AddToDynamicIndexBuffer const void *  data,
DWORD  indices
[pure virtual]
 

This method updates dynamic index buffer thus cannot be used for static index buffer.

This method directly calls TRenderer::AddToDynamicIndexBuffer() method. Method adds data after last valid index in IB, but there must be enough space (see TRendererIndexBuffer::GetFreeCapacity()). If there isn't enough space for vertices then FASLE is returned. In this case you should add data to index buffer via calling TRendererIndexBuffer::DiscardDynamicIndexBuffer(), but be carefull, this method destroys previous data in index buffer!!!

Parameters:
data [in] pointer to new vertex data
indices [in] number of indices to store - see TRendererIndexBuffer::GetIndexSize() for information about index size.

virtual BOOL TRendererIndexBuffer::DisardDynamicIndexBuffer const void *  data,
DWORD  startIndex,
DWORD  indices
[pure virtual]
 

This method update dynamic index buffer thus cannot be used for static index buffers.

This method directly calls TRenderer::DisardDynamicIndexBuffer() method. After calling this method previous data in buffer are destroyed, but this method doesnt wait for device, thus device can render from previous index buffer and method copy data to new allocated buffer, which replace old buffer after rendering operation. It's good idea set STARTINDEX to 0 and INDICES to TRendererIndexxBuffer::GetCapacity(), but at this moment DATA must contain enough data bytes. If STARTINDEX or INDICES parameter do not cover entire buffer then there will be undefined areas in index buffer. Last valid index (method TRendererIndexBuffer::GetIndicesCount()) is set always to (startIndexx+indices).

Parameters:
data [in] pointer to new index data
startIndex [in] zero-based index of first index where data will be stored - see TRendererVertexBuffer::GetIndexSize() for information about index size.
indices [in] number of indices to store - see TRendererIndexBuffer::GetIndexSize() for information about index size.

virtual void TRendererIndexBuffer::Duplicate TRendererIndexBuffer **  dest  )  [pure virtual]
 

Duplicate pointer to this object to another one and increase number of references to it.

This method does the same as copying two pointers and increasing number of references with calling AddRefs().

Parameters:
dest [out] adress of pointer to store result

virtual DWORD TRendererIndexBuffer::GetCapacity void   )  const [pure virtual]
 

Returns number of indices that can be stored in this vertex buffer.

virtual DWORD TRendererIndexBuffer::GetFreeCapacity void   )  const [pure virtual]
 

Returns number of unused indices in index buffer.

This method is important only for dynamic IB, for static IB it returns always 0.

virtual DWORD TRendererIndexBuffer::GetIndexSize void   )  const [pure virtual]
 

This method always returns 2, because all indices are 16-bits (sizeof(short)==2).

virtual DWORD TRendererIndexBuffer::GetIndicesCount void   )  const [pure virtual]
 

Returns number of actually valid indices in buffer.

This method is important only for dynamic IB, for static IB it returns index buffer capacity as GetCapacity() method.

virtual DWORD TRendererIndexBuffer::GetRefs void   )  const [pure virtual]
 

Returns number of references to this VB.

virtual DWORD TRendererIndexBuffer::GetSize void   )  const [pure virtual]
 

Returns size of entire index bufer in bytes.

virtual BOOL TRendererIndexBuffer::IsDynamic void   )  const [pure virtual]
 

Determines whether this index buffer is dynamic.

virtual DWORD TRendererIndexBuffer::Release void   )  [pure virtual]
 

Decreases number of references to this IB and return result.

If number of references count zero then IB is destroyed via operator delete. After calling this method pointer is invalid and MUST be set to NULL.

virtual BOOL TRendererIndexBuffer::UpdateIndexBuffer const void *  data,
DWORD  startIndex,
DWORD  indices
[pure virtual]
 

Updates index buffer.

Index buffer may be static or dynamic. This method directly calls TRenderer::UpdateIndexBuffer() method. ITS RECOMMNEDED USE THIS METHOD ONLY FOR STATIC INDEX BUFFER, THERE ARE SPECIAL METHODS FOR DYNAMIC INDEX BUFFERS. In static buffer method check whether desired interval for indices <indexBuffer,indexBuffer+indices-1> is valid and then update this indices. In dynamic buffer method does the same and moreover it change information about number of valid indices in buffer (method TRendererIndexBuffer::GetIndicesCount()). New interval of valid indices is set as <0,startIndex+indices-1> (method TRendererVertexBuffer::GetIndicesCount() returns startIndex+indices) if original interval was less than new interval. In other case (original interval was higher) new interval is set to original interval - thus no change. Indices outside changed interval are staying unchanged. This method is only way how to change static index buffer, for dynamic buffer is its efficiency low, its better idea use specialized method for changing dynamic index buffers.

Parameters:
data [in] pointer to new index data
startIndex [in] zero-based index of first index where data will be stored - see TRendererIndexBuffer::GetIndexSize() for information about index size.
indices [in] number of vertices to store - see TRendererVertexBuffer::GetIndexSize() for information about index size.


The documentation for this class was generated from the following file:
Generated on Wed Nov 28 22:43:42 2007 for Joy4D by  doxygen 1.4.6-NO