TRendererVertexBuffer Class Reference

#include <RendererTypes.h>

List of all members.

Public Member Functions

virtual void Duplicate (TRendererVertexBuffer **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 VB and return result.
virtual DWORD GetCapacity (void) const =0
 Returns number of vertices that can be stored in this vertex buffer.
virtual DWORD GetVertexSize (void) const =0
 Returns size of one vertex.
virtual DWORD GetSize (void) const =0
 Returns size of entire vertex bufer in bytes.
virtual DWORD GetVerticesCount (void) const =0
 Returns number of actually valid vertices in buffer.
virtual DWORD GetFreeCapacity (void) const =0
 Returns number of unused vertices in vertex buffer.
virtual BOOL IsDynamic (void) const =0
 Determines whether this vertex buffer is dynamic.
virtual BOOL UpdateVertexBuffer (const void *data, DWORD startVertex, DWORD vertices)=0
 Updates vertex buffer.
virtual BOOL DiscardDynamicVertexBuffer (const void *data, DWORD startVertex, DWORD vertices)=0
 This method update dynamic vertex buffer thus cannot be used for static vertex buffers.
virtual BOOL AddToDynamicVertexBuffer (const void *data, DWORD vertices)=0
 This method updates dynamic vertex buffer thus cannot be used for static vertex buffer.


Detailed Description

Definition at line 1317 of file RendererTypes.h.


Member Function Documentation

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

Increases number of references and returns result.

virtual BOOL TRendererVertexBuffer::AddToDynamicVertexBuffer const void *  data,
DWORD  vertices
[pure virtual]
 

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

Method adds data after last valid vertex in VB, but there must be enough space (see TRendererVertexBuffer::GetFreeCapacity()). If there isn't enough space for vertices then FASLE is returned. In this case you should add data to vertex buffer via calling TRendererVertexBuffer::DiscardDynamicVertexBuffer(), but be carefull, this method destroys previous data in vertex buffer. Method directly calls TRenderer::AddToDynamicVertexBuffer() method.

Parameters:
data [in] pointer to new vertex data
vertices [in] number of vertices to store - see TRendererVertexBuffer::GetVertexSize() for information about vertex size.

virtual BOOL TRendererVertexBuffer::DiscardDynamicVertexBuffer const void *  data,
DWORD  startVertex,
DWORD  vertices
[pure virtual]
 

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

After calling this method previous data in buffer are destroyed, but this method doesnt wait for device, thus device can render from previous vertex buffer and method copy data to new allocated buffer, which replace old buffer after rendering operation. It's good idea set STARTVERTEX to 0 and VERTICES to TRendererVertexBuffer::GetCapacity(), but at this moment DATA must contain enough data bytes. If STARTVERTEX or VERTICES parameter do not cover entire buffer then there will be undefined areas in vertex buffer. Last valid vertex (method TRendererVertexBuffer::GetVerticesCount()) is set always to (startVertex+vertices). Method directly calls TRenderer::DiscardDynamicVertexBuffer() method.

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

virtual void TRendererVertexBuffer::Duplicate TRendererVertexBuffer **  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 TRendererVertexBuffer::GetCapacity void   )  const [pure virtual]
 

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

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

Returns number of unused vertices in vertex buffer.

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

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

Returns number of references to this VB.

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

Returns size of entire vertex bufer in bytes.

virtual DWORD TRendererVertexBuffer::GetVertexSize void   )  const [pure virtual]
 

Returns size of one vertex.

virtual DWORD TRendererVertexBuffer::GetVerticesCount void   )  const [pure virtual]
 

Returns number of actually valid vertices in buffer.

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

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

Determines whether this vertex buffer is dynamic.

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

Decreases number of references to this VB and return result.

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

virtual BOOL TRendererVertexBuffer::UpdateVertexBuffer const void *  data,
DWORD  startVertex,
DWORD  vertices
[pure virtual]
 

Updates vertex buffer.

Vertex buffer may be static or dynamic. ITS RECOMMNEDED USE THIS METHOD ONLY FOR STATIC VERTEX BUFFER, THERE ARE SPECIAL METHODS FOR DYNAMIC VERTEX BUFFERS. In static buffer this method check whether desired interval for vertices <startVertex,startVertex+vertices-1> is valid and then update this vertices. In dynamic buffer method does the same and moreover it change information about number of valid vertices in vertex buffer (method TRendererVertexBuffer::GetVerticesCount()). New interval of valid vertices is set as <0,startVertex+vertices-1> (method TRendererVertexBuffer::GetVerticesCount() returns startVertex+vertices) 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. Vertices outside changed interval are staying unchanged. This method is only way how to change static vertex buffer, for dynamic buffer is its efficiency low, its better idea use specialized method for changing dynamic vertex buffers. Method directly calls TRenderer::UpdateVertexBuffer() method.

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


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