OGRE-Next  3.0.0
Object-Oriented Graphics Rendering Engine
Ogre::v1::VertexData Class Reference

Summary class collecting together vertex source information. More...

#include <OgreVertexIndexData.h>

+ Inheritance diagram for Ogre::v1::VertexData:

Classes

struct  HardwareAnimationData
 Struct used to hold hardware morph / pose vertex data information. More...
 
struct  ReadRequests
 

Public Types

typedef vector< HardwareAnimationData >::type HardwareAnimationDataList
 
typedef FastArray< ReadRequestsReadRequestsArray
 

Public Member Functions

 VertexData (HardwareBufferManagerBase *mgr)
 Constructor. More...
 
 VertexData (VertexDeclaration *dcl, VertexBufferBinding *bind)
 Constructor. More...
 
 ~VertexData ()
 
HardwareBufferManagerBase_getHardwareBufferManager () const
 
ushort allocateHardwareAnimationElements (ushort count, bool animateNormals)
 Allocate elements to serve a holder of morph / pose target data for hardware morphing / pose blending. More...
 
VertexDataclone (bool copyData=true, HardwareBufferManagerBase *mgr=0) const
 Clones this vertex data, potentially including replicating any vertex buffers. More...
 
void closeGapsInBindings ()
 Remove any gaps in the vertex buffer bindings. More...
 
void convertPackedColour (VertexElementType srcType, VertexElementType destType)
 Convert all packed colour values (VET_COLOUR_*) in buffers used to another type. More...
 
void lockMultipleElements (ReadRequestsArray &requests, HardwareBuffer::LockOptions lockOptions)
 Utility to get multiple pointers & read specific elements of the vertex, even if they're in separate buffers. More...
 
void prepareForShadowVolume ()
 Modifies the vertex data to be suitable for use for rendering shadow geometry. More...
 
void removeUnusedBuffers ()
 Remove all vertex buffers that never used by the vertex declaration. More...
 
void reorganiseBuffers (VertexDeclaration *newDeclaration, const BufferUsageList &bufferUsage, HardwareBufferManagerBase *mgr=0)
 Reorganises the data in the vertex buffers according to the new vertex declaration passed in. More...
 
void reorganiseBuffers (VertexDeclaration *newDeclaration, HardwareBufferManagerBase *mgr=0)
 Reorganises the data in the vertex buffers according to the new vertex declaration passed in. More...
 
void unlockMultipleElements (ReadRequestsArray &requests)
 

Public Attributes

HardwareVertexBufferSharedPtr hardwareShadowVolWBuffer
 Additional shadow volume vertex buffer storage. More...
 
HardwareAnimationDataList hwAnimationDataList
 VertexElements used for hardware morph / pose animation. More...
 
size_t hwAnimDataItemsUsed
 Number of hardware animation data items used. More...
 
bool mDeleteDclBinding
 Whether this class should delete the declaration and binding. More...
 
VertexBufferBindingvertexBufferBinding
 The vertex buffer bindings to be used. More...
 
size_t vertexCount
 The number of vertices used in this operation. More...
 
VertexDeclarationvertexDeclaration
 Declaration of the vertex to be used in this operation. More...
 
size_t vertexStart
 The base vertex index to start from. More...
 

Detailed Description

Summary class collecting together vertex source information.

Member Typedef Documentation

◆ HardwareAnimationDataList

◆ ReadRequestsArray

Constructor & Destructor Documentation

◆ VertexData() [1/2]

Ogre::v1::VertexData::VertexData ( HardwareBufferManagerBase mgr)

Constructor.

Note
This constructor creates the VertexDeclaration and VertexBufferBinding automatically, and arranges for their deletion afterwards.
Parameters
mgrOptional HardwareBufferManager from which to create resources

◆ VertexData() [2/2]

Ogre::v1::VertexData::VertexData ( VertexDeclaration dcl,
VertexBufferBinding bind 
)

Constructor.

Note
This constructor receives the VertexDeclaration and VertexBufferBinding from the caller, and as such does not arrange for their deletion afterwards, the caller remains responsible for that.
Parameters
dclThe VertexDeclaration to use
bindThe VertexBufferBinding to use

◆ ~VertexData()

Ogre::v1::VertexData::~VertexData ( )

Member Function Documentation

◆ _getHardwareBufferManager()

HardwareBufferManagerBase* Ogre::v1::VertexData::_getHardwareBufferManager ( ) const
inline

◆ allocateHardwareAnimationElements()

ushort Ogre::v1::VertexData::allocateHardwareAnimationElements ( ushort  count,
bool  animateNormals 
)

Allocate elements to serve a holder of morph / pose target data for hardware morphing / pose blending.

Remarks
This method will allocate the given number of 3D texture coordinate sets for use as a morph target or target pose offset (3D position). These elements will be saved in hwAnimationDataList. It will also assume that the source of these new elements will be new buffers which are not bound at this time, so will start the sources to 1 higher than the current highest binding source. The caller is expected to bind these new buffers when appropriate. For morph animation the original position buffer will be the 'from' keyframe data, whilst for pose animation it will be the original vertex data. If normals are animated, then twice the number of 3D texture coordinates are required
Returns
The number of sets that were supported

◆ clone()

VertexData* Ogre::v1::VertexData::clone ( bool  copyData = true,
HardwareBufferManagerBase mgr = 0 
) const

Clones this vertex data, potentially including replicating any vertex buffers.

Parameters
copyDataWhether to create new vertex buffers too or just reference the existing ones
mgrIf supplied, the buffer manager through which copies should be made
Remarks
The caller is expected to delete the returned pointer when ready

◆ closeGapsInBindings()

void Ogre::v1::VertexData::closeGapsInBindings ( )

Remove any gaps in the vertex buffer bindings.

Remarks
This is useful if you've removed elements and buffers from this vertex data and want to remove any gaps in the vertex buffer bindings. This method is mainly useful when reorganising vertex data manually.
Note
This will cause binding index of the elements in the vertex declaration to be altered to new binding index.

◆ convertPackedColour()

void Ogre::v1::VertexData::convertPackedColour ( VertexElementType  srcType,
VertexElementType  destType 
)

Convert all packed colour values (VET_COLOUR_*) in buffers used to another type.

Parameters
srcTypeThe source colour type to assume if the ambiguous VET_COLOUR is encountered.
destTypeThe destination colour type, must be VET_COLOUR_ABGR or VET_COLOUR_ARGB.

◆ lockMultipleElements()

void Ogre::v1::VertexData::lockMultipleElements ( ReadRequestsArray requests,
HardwareBuffer::LockOptions  lockOptions 
)

Utility to get multiple pointers & read specific elements of the vertex, even if they're in separate buffers.

When two elements share the same buffer, the buffer is locked once.

Example usage: VertexData::ReadRequestsArray requests; requests.push_back( VertexData::ReadRequests( VES_POSITION ) ); requests.push_back( VertexData::ReadRequests( VES_NORMALS ) ); vao->lockMultipleElements( requests );

for( size_t i=0; i<numVertices; ++i ) { float const position = reinterpret_cast<const float>( requests[0].data ); float const normals = reinterpret_cast<const float>( requests[1].data );

requests[0].data += requests[0].vertexBuffer->getVertexSize(); requests[1].data += requests[1].vertexBuffer->getVertexSize(); }

vao->unlockMultipleElements( requests );

Remarks
Throws if an element couldn't be found. See VertexArrayObject::readRequests
Parameters
requests[in/out] Array filled with the semantic.

◆ prepareForShadowVolume()

void Ogre::v1::VertexData::prepareForShadowVolume ( )

Modifies the vertex data to be suitable for use for rendering shadow geometry.

Remarks
Preparing vertex data to generate a shadow volume involves firstly ensuring that the vertex buffer containing the positions is a standalone vertex buffer, with no other components in it. This method will therefore break apart any existing vertex buffers if position is sharing a vertex buffer. Secondly, it will double the size of this vertex buffer so that there are 2 copies of the position data for the mesh. The first half is used for the original, and the second half is used for the 'extruded' version. The vertex count used to render will remain the same though, so as not to add any overhead to regular rendering of the object. Both copies of the position are required in one buffer because shadow volumes stretch from the original mesh to the extruded version.
It's important to appreciate that this method can fundamentally change the structure of your vertex buffers, although in reality they will be new buffers. As it happens, if other objects are using the original buffers then they will be unaffected because the reference counting will keep them intact. However, if you have made any assumptions about the structure of the vertex data in the buffers of this object, you may have to rethink them.

◆ removeUnusedBuffers()

void Ogre::v1::VertexData::removeUnusedBuffers ( )

Remove all vertex buffers that never used by the vertex declaration.

Remarks
This is useful if you've removed elements from the vertex declaration and want to unreference buffers that never used any more. This method is mainly useful when reorganising vertex data manually.
Note
This also remove any gaps in the vertex buffer bindings.

◆ reorganiseBuffers() [1/2]

void Ogre::v1::VertexData::reorganiseBuffers ( VertexDeclaration newDeclaration,
const BufferUsageList bufferUsage,
HardwareBufferManagerBase mgr = 0 
)

Reorganises the data in the vertex buffers according to the new vertex declaration passed in.

Note that new vertex buffers are created and written to, so if the buffers being referenced by this vertex data object are also used by others, then the original buffers will not be damaged by this operation. Once this operation has completed, the new declaration passed in will overwrite the current one.

Parameters
newDeclarationThe vertex declaration which will be used for the reorganised buffer state. Note that the new declaration must not include any elements which do not already exist in the current declaration; you can drop elements by excluding them from the declaration if you wish, however.
bufferUsageVector of usage flags which indicate the usage options for each new vertex buffer created. The indexes of the entries must correspond to the buffer binding values referenced in the declaration.
mgrOptional pointer to the manager to use to create new declarations and buffers etc. If not supplied, the HardwareBufferManager singleton will be used

◆ reorganiseBuffers() [2/2]

void Ogre::v1::VertexData::reorganiseBuffers ( VertexDeclaration newDeclaration,
HardwareBufferManagerBase mgr = 0 
)

Reorganises the data in the vertex buffers according to the new vertex declaration passed in.

Note that new vertex buffers are created and written to, so if the buffers being referenced by this vertex data object are also used by others, then the original buffers will not be damaged by this operation. Once this operation has completed, the new declaration passed in will overwrite the current one. This version of the method derives the buffer usages from the existing buffers, by using the 'most flexible' usage from the equivalent sources.

Parameters
newDeclarationThe vertex declaration which will be used for the reorganised buffer state. Note that the new delcaration must not include any elements which do not already exist in the current declaration; you can drop elements by excluding them from the declaration if you wish, however.
mgrOptional pointer to the manager to use to create new declarations and buffers etc. If not supplied, the HardwareBufferManager singleton will be used

◆ unlockMultipleElements()

void Ogre::v1::VertexData::unlockMultipleElements ( ReadRequestsArray requests)

Member Data Documentation

◆ hardwareShadowVolWBuffer

HardwareVertexBufferSharedPtr Ogre::v1::VertexData::hardwareShadowVolWBuffer

Additional shadow volume vertex buffer storage.

Remarks
This additional buffer is only used where we have prepared this VertexData for use in shadow volume construction, and where the current render system supports vertex programs. This buffer contains the 'w' vertex position component which will be used by that program to differentiate between extruded and non-extruded vertices. This 'w' component cannot be included in the original position buffer because DirectX does not allow 4-component positions in the fixed-function pipeline, and the original position buffer must still be usable for fixed-function rendering.
Note that we don't store any vertex declaration or vertex buffer binding here because this can be reused in the shadow algorithm.

Referenced by Ogre::VerticesRemapInfo::performVertexDataRemap().

◆ hwAnimationDataList

HardwareAnimationDataList Ogre::v1::VertexData::hwAnimationDataList

VertexElements used for hardware morph / pose animation.

Referenced by Ogre::VerticesRemapInfo::performVertexDataRemap().

◆ hwAnimDataItemsUsed

size_t Ogre::v1::VertexData::hwAnimDataItemsUsed

Number of hardware animation data items used.

Referenced by Ogre::VerticesRemapInfo::performVertexDataRemap().

◆ mDeleteDclBinding

bool Ogre::v1::VertexData::mDeleteDclBinding

Whether this class should delete the declaration and binding.

◆ vertexBufferBinding

VertexBufferBinding* Ogre::v1::VertexData::vertexBufferBinding

The vertex buffer bindings to be used.

Remarks
Note that this is created for you on construction.

Referenced by Ogre::VerticesRemapInfo::performVertexDataRemap().

◆ vertexCount

size_t Ogre::v1::VertexData::vertexCount

The number of vertices used in this operation.

Referenced by Ogre::VerticesRemapInfo::performVertexDataRemap().

◆ vertexDeclaration

VertexDeclaration* Ogre::v1::VertexData::vertexDeclaration

Declaration of the vertex to be used in this operation.

Remarks
Note that this is created for you on construction.

◆ vertexStart

size_t Ogre::v1::VertexData::vertexStart

The base vertex index to start from.

Referenced by Ogre::VerticesRemapInfo::performVertexDataRemap().


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