OGRE
2.2.4
Object-Oriented Graphics Rendering Engine
|
Vertex array objects (Vaos) are immutable objects that describe a combination of vertex buffers and index buffer with a given operation type. More...
#include <OgreVertexArrayObject.h>
Classes | |
struct | ReadRequests |
Public Types | |
typedef FastArray< ReadRequests > | ReadRequestsArray |
Public Member Functions | |
VertexArrayObject (uint32 vaoName, uint32 renderQueueId, uint16 inputLayoutId, const VertexBufferPackedVec &vertexBuffers, IndexBufferPacked *indexBuffer, OperationType operationType) | |
VertexArrayObject * | clone (VaoManager *vaoManager, SharedVertexBufferMap *sharedBuffers, int vertexBufferType=-1, int indexBufferType=-1) const |
Clones the vertex & index buffers and creates a new VertexArrayObject. More... | |
const VertexElement2 * | findBySemantic (VertexElementSemantic semantic, size_t &outIndex, size_t &outOffset, size_t repeat=0) const |
Returns the entire VertexElement2 descriptor in the vertex buffers. More... | |
VertexBufferPacked * | getBaseVertexBuffer (void) const |
IndexBufferPacked * | getIndexBuffer (void) const |
uint16 | getInputLayoutId (void) const |
OperationType | getOperationType (void) const |
uint32 | getPrimitiveCount (void) const |
uint32 | getPrimitiveStart (void) const |
uint32 | getRenderQueueId (void) const |
uint32 | getVaoName (void) const |
const VertexBufferPackedVec & | getVertexBuffers (void) const |
VertexElement2VecVec | getVertexDeclaration (void) const |
Gets the combined vertex declaration of all the vertex buffers. More... | |
void | operator delete (void *ptr) |
void | operator delete (void *ptr, void *) |
void | operator delete (void *ptr, const char *, int, const char *) |
void | operator delete[] (void *ptr) |
void | operator delete[] (void *ptr, const char *, int, const char *) |
void * | operator new (size_t sz, const char *file, int line, const char *func) |
operator new, with debug line info More... | |
void * | operator new (size_t sz) |
void * | operator new (size_t sz, void *ptr) |
placement operator new More... | |
void * | operator new[] (size_t sz, const char *file, int line, const char *func) |
array operator new, with debug line info More... | |
void * | operator new[] (size_t sz) |
void | readRequests (ReadRequestsArray &requests, size_t elementStart=0, size_t elementCount=0, bool skipRequestIfBufferHasShadowCopy=false) |
Utility to get multiple pointers & read specific elements of the vertex, even if they're in separate buffers. More... | |
void | setPrimitiveRange (uint32 primStart, uint32 primCount) |
Limits the range of triangle primitives that is rendered. More... | |
Static Public Member Functions | |
static VertexElement2VecVec | getVertexDeclaration (const VertexBufferPackedVec &vertexBuffers) |
static void | mapAsyncTickets (ReadRequestsArray &tickets) |
Maps the buffers requested via. More... | |
static void | unmapAsyncTickets (ReadRequestsArray &tickets) |
Unmaps the buffers mapped via. More... | |
Static Public Attributes | |
static VertexBufferPacked | msDummyVertexBuffer |
When a Vao doesn't have a vertex buffer, a dummy one is assigned for performance reasons (avoid checking if pointer is null, avoid crashing inside Ogre) More... | |
Friends | |
class | D3D11RenderSystem |
class | GL3PlusRenderSystem |
class | GLES2RenderSystem |
class | MetalRenderSystem |
class | RenderQueue |
class | RenderSystem |
Vertex array objects (Vaos) are immutable objects that describe a combination of vertex buffers and index buffer with a given operation type.
Once created, they can't be modified. You have to destroy them and create a new one.
Ogre::VertexArrayObject::VertexArrayObject | ( | uint32 | vaoName, |
uint32 | renderQueueId, | ||
uint16 | inputLayoutId, | ||
const VertexBufferPackedVec & | vertexBuffers, | ||
IndexBufferPacked * | indexBuffer, | ||
OperationType | operationType | ||
) |
VertexArrayObject* Ogre::VertexArrayObject::clone | ( | VaoManager * | vaoManager, |
SharedVertexBufferMap * | sharedBuffers, | ||
int | vertexBufferType = -1 , |
||
int | indexBufferType = -1 |
||
) | const |
Clones the vertex & index buffers and creates a new VertexArrayObject.
The only exception is when one of the vertex buffers is already in sharedBuffers, in which case the buffer in sharedBuffers.find(vertexBuffer)->second will be used without cloning (useful for cloning LODs).
vaoManager | The VaoManager needed to create the structures |
sharedBuffers | [in/out] Maps old vertex buffers to new vertex buffers so that we can reuse them. Optional. Use a null pointer to disable this feature. |
vertexBufferType | See BufferType. Must be set to a valid BufferType. Pass a negative value to keep the same type of the original buffer being cloned. |
indexBufferType | See BufferType. Must be set to a valid BufferType. Pass a negative value to keep the same type of the original buffer being cloned. |
const VertexElement2* Ogre::VertexArrayObject::findBySemantic | ( | VertexElementSemantic | semantic, |
size_t & | outIndex, | ||
size_t & | outOffset, | ||
size_t | repeat = 0 |
||
) | const |
Returns the entire VertexElement2 descriptor in the vertex buffers.
semantic | Semantic to look for. |
outIndex | The index to mVertexBuffers[index] if it's found. Otherwise the value is left untouched. |
outIndex | The offset in bytes to retrieve the element in the vertex data. If the semantic isn't found, the value is left untouched. |
repeat | The number of times to skip a semantic before returning the hit. Useful when you have more than one VES_TEXTURE_COORDINATES for example. Set repeat = 0 to retrieve the first set of VES_TEXTURE_COORDINATES Set repeat = 1 to retrieve the second set of VES_TEXTURE_COORDINATES etc. |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
VertexElement2VecVec Ogre::VertexArrayObject::getVertexDeclaration | ( | void | ) | const |
Gets the combined vertex declaration of all the vertex buffers.
Note that we iterate through all of them and allocate the vector. You should cache the result rather than calling this function frequently.
|
static |
|
static |
Maps the buffers requested via.
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
operator new, with debug line info
|
inlineinherited |
|
inlineinherited |
placement operator new
|
inlineinherited |
array operator new, with debug line info
|
inlineinherited |
void Ogre::VertexArrayObject::readRequests | ( | ReadRequestsArray & | requests, |
size_t | elementStart = 0 , |
||
size_t | elementCount = 0 , |
||
bool | skipRequestIfBufferHasShadowCopy = false |
||
) |
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, only one ticket is created.
Example usage: VertexArrayObject::ReadRequestsArray requests; requests.push_back( VertexArrayObject::ReadRequests( VES_POSITION ) ); requests.push_back( VertexArrayObject::ReadRequests( VES_NORMALS ) ); vao->readRequests( requests ); vao->mapAsyncTickets( 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->getBytesPerElement(); requests[1].data += requests[1].vertexBuffer->getBytesPerElement(); }
vao->unmapAsyncTickets( requests );
requests | [in/out] Array filled with the semantic. |
skipRequestIfBufferHasShadowCopy | Avoid generating the AsyncTicket if the buffer has a shadow copy. Useful if you want to read directly from the shadow copy instead of downloading from the GPU. The 'data' variable will be filled immediately if there's a shadow copy available, and mapAsyncTickets can be safely called even if skipRequestIfBufferHasShadowCopy=true |
Limits the range of triangle primitives that is rendered.
For VAOs with index buffers, this controls the index start & count, akin to indexStart & indexCount from the v1 objects.
|
static |
Unmaps the buffers mapped via.
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
static |
When a Vao doesn't have a vertex buffer, a dummy one is assigned for performance reasons (avoid checking if pointer is null, avoid crashing inside Ogre)