VertexDataProvider Class Reference


Detailed Description

This interface can be used to provide additional vertex data for the rendering.

When an object with this type is added as a child to a Mesh object in the scene graph, the renderer uses that object to obtain additional vertex data for the rendering (like vertex color, bone indices and weights). This interface is important when you want to use your own custom shader for rendering, which needs more data than the usual vertex data (position, normal, etc.).

Definition at line 209 of file renderer.h.

#include <renderer.h>

Inheritance diagram for VertexDataProvider:
Inheritance graph
[legend]

List of all members.

Classes

struct   ComponentDescription
  This structure carries information about a component. More...
struct   DirtyVertex
  This structure describes a dirty vertex. More...

Public Member Functions

virtual int  ComponentCount (void) const
  Returns the number of different vertex components this object has data for.
virtual ComponentDescription  Component (int iIndex) const
  Returns the description of a given component.
virtual const void *  VertexData (unsigned int iVertexIndex, int iComponentIndex) const
  Returns the data for a given vertex and component.
virtual void  SetVertexData (unsigned int iVertexIndex, int iComponentIndex, unsigned int iDimensionIndex, const void *pValue)
  Sets the data for a given vertex, component, and dimension.
virtual QVector< DirtyVertex > &  DirtyVertexList (void)
  This function must return an array of vertex indices whose data has been changed since the last call to this function.

Member Function Documentation

virtual int ComponentCount ( void  ) const [virtual]

Returns the number of different vertex components this object has data for.

virtual ComponentDescription Component ( int  iIndex ) const [virtual]

Returns the description of a given component.

Parameters:
[in] iIndex Index of the component.
virtual const void* VertexData ( unsigned int  iVertexIndex,
int  iComponentIndex 
) const [virtual]

Returns the data for a given vertex and component.

Parameters:
[in] iVertexIndex Index of the vertex.
[in] iComponentIndex Index of the component.
virtual void SetVertexData ( unsigned int  iVertexIndex,
int  iComponentIndex,
unsigned int  iDimensionIndex,
const void *  pValue 
) [virtual]

Sets the data for a given vertex, component, and dimension.

For example, to set the 2nd element of the 1st component, for the 0th vertex: VertexDataProvider::ComponentDescription d = Component(1); if( d.m_eType == eFloat && d.m_iDimension >= 3 ) { float fNewValue = 1.0f;; SetVertexData( 0, 1, 2, (const void*)&fNewValue); }

Parameters:
[in] iVertexIndex Index of the vertex.
[in] iComponentIndex Index of the component.
[in] iDimensionIndex Index of the dimension.
[in] pValue an element of type m_eType.
virtual QVector<DirtyVertex>& DirtyVertexList ( void  ) [virtual]

This function must return an array of vertex indices whose data has been changed since the last call to this function.

There are two ways to update the buffers in the renderer object:

  • When most or all of the vertices need to update, the VertexDataProvider object can instruct the renderer to do a global update on all the vertices by calling ContentChanged() on itself. This way the renderer will know about the change, and refresh every vertex buffer which contains data from this object.
  • If only subset of the vertices are changed, the VertexDataProvider can collect the indices of the changed vertices to an array, and pass that array to the renderer when this function is called. The renderer will update the specified vertices, and clear the array. The VertexDataProvider can continue storing dirty vertex indices into the array after the call.

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

VertexDataProvider VertexDataProvider VertexDataProvider VertexDataProvider VertexDataProvider VertexDataProvider VertexDataProvider VertexDataProvider VertexDataProvider VertexDataProvider
VertexDataProvider VertexDataProvider VertexDataProvider VertexDataProvider VertexDataProvider VertexDataProvider VertexDataProvider VertexDataProvider VertexDataProvider VertexDataProvider