OGRE  2.2.4
Object-Oriented Graphics Rendering Engine
Ogre::GLES2VertexArrayObject Struct Reference

#include <OgreGLES2VertexArrayObject.h>

+ Inheritance diagram for Ogre::GLES2VertexArrayObject:

Public Types

typedef FastArray< ReadRequestsReadRequestsArray
 

Public Member Functions

 GLES2VertexArrayObject (GLuint vaoName, uint32 renderQueueId, const VertexBufferPackedVec &vertexBuffers, IndexBufferPacked *indexBuffer, OperationType opType)
 
VertexArrayObjectclone (VaoManager *vaoManager, SharedVertexBufferMap *sharedBuffers, int vertexBufferType=-1, int indexBufferType=-1) const
 Clones the vertex & index buffers and creates a new VertexArrayObject. More...
 
const VertexElement2findBySemantic (VertexElementSemantic semantic, size_t &outIndex, size_t &outOffset, size_t repeat=0) const
 Returns the entire VertexElement2 descriptor in the vertex buffers. More...
 
VertexBufferPackedgetBaseVertexBuffer (void) const
 
IndexBufferPackedgetIndexBuffer (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 VertexBufferPackedVecgetVertexBuffers (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...
 

Public Attributes

GLint mPrimType [2]
 

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...
 

Member Typedef Documentation

◆ ReadRequestsArray

Constructor & Destructor Documentation

◆ GLES2VertexArrayObject()

Ogre::GLES2VertexArrayObject::GLES2VertexArrayObject ( GLuint  vaoName,
uint32  renderQueueId,
const VertexBufferPackedVec vertexBuffers,
IndexBufferPacked indexBuffer,
OperationType  opType 
)
inline

Member Function Documentation

◆ clone()

VertexArrayObject* Ogre::VertexArrayObject::clone ( VaoManager vaoManager,
SharedVertexBufferMap sharedBuffers,
int  vertexBufferType = -1,
int  indexBufferType = -1 
) const
inherited

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).

Parameters
vaoManagerThe 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.
vertexBufferTypeSee BufferType. Must be set to a valid BufferType. Pass a negative value to keep the same type of the original buffer being cloned.
indexBufferTypeSee BufferType. Must be set to a valid BufferType. Pass a negative value to keep the same type of the original buffer being cloned.
Returns
New cloned Vao.

◆ findBySemantic()

const VertexElement2* Ogre::VertexArrayObject::findBySemantic ( VertexElementSemantic  semantic,
size_t &  outIndex,
size_t &  outOffset,
size_t  repeat = 0 
) const
inherited

Returns the entire VertexElement2 descriptor in the vertex buffers.

Parameters
semanticSemantic to look for.
outIndexThe index to mVertexBuffers[index] if it's found. Otherwise the value is left untouched.
outIndexThe offset in bytes to retrieve the element in the vertex data. If the semantic isn't found, the value is left untouched.
repeatThe 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.
Returns
Null if not found. The returned pointer might be invalidated by future calls (e.g. something happens to the vertex buffer or the Vao) although this is strange since in general these objects are immutable once they've been constructed.

◆ getBaseVertexBuffer()

VertexBufferPacked* Ogre::VertexArrayObject::getBaseVertexBuffer ( void  ) const
inlineinherited

◆ getIndexBuffer()

IndexBufferPacked* Ogre::VertexArrayObject::getIndexBuffer ( void  ) const
inlineinherited

◆ getInputLayoutId()

uint16 Ogre::VertexArrayObject::getInputLayoutId ( void  ) const
inlineinherited

◆ getOperationType()

OperationType Ogre::VertexArrayObject::getOperationType ( void  ) const
inlineinherited

◆ getPrimitiveCount()

uint32 Ogre::VertexArrayObject::getPrimitiveCount ( void  ) const
inlineinherited

◆ getPrimitiveStart()

uint32 Ogre::VertexArrayObject::getPrimitiveStart ( void  ) const
inlineinherited

◆ getRenderQueueId()

uint32 Ogre::VertexArrayObject::getRenderQueueId ( void  ) const
inlineinherited

◆ getVaoName()

uint32 Ogre::VertexArrayObject::getVaoName ( void  ) const
inlineinherited

◆ getVertexBuffers()

const VertexBufferPackedVec& Ogre::VertexArrayObject::getVertexBuffers ( void  ) const
inlineinherited

◆ getVertexDeclaration() [1/2]

VertexElement2VecVec Ogre::VertexArrayObject::getVertexDeclaration ( void  ) const
inherited

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.

◆ getVertexDeclaration() [2/2]

static VertexElement2VecVec Ogre::VertexArrayObject::getVertexDeclaration ( const VertexBufferPackedVec vertexBuffers)
staticinherited

◆ mapAsyncTickets()

static void Ogre::VertexArrayObject::mapAsyncTickets ( ReadRequestsArray tickets)
staticinherited

Maps the buffers requested via.

See also
readRequests

◆ operator delete() [1/3]

template<class Alloc >
void Ogre::AllocatedObject< Alloc >::operator delete ( void *  ptr)
inlineinherited

◆ operator delete() [2/3]

template<class Alloc >
void Ogre::AllocatedObject< Alloc >::operator delete ( void *  ptr,
void *   
)
inlineinherited

◆ operator delete() [3/3]

template<class Alloc >
void Ogre::AllocatedObject< Alloc >::operator delete ( void *  ptr,
const char *  ,
int  ,
const char *   
)
inlineinherited

◆ operator delete[]() [1/2]

template<class Alloc >
void Ogre::AllocatedObject< Alloc >::operator delete[] ( void *  ptr)
inlineinherited

◆ operator delete[]() [2/2]

template<class Alloc >
void Ogre::AllocatedObject< Alloc >::operator delete[] ( void *  ptr,
const char *  ,
int  ,
const char *   
)
inlineinherited

◆ operator new() [1/3]

template<class Alloc >
void* Ogre::AllocatedObject< Alloc >::operator new ( size_t  sz,
const char *  file,
int  line,
const char *  func 
)
inlineinherited

operator new, with debug line info

◆ operator new() [2/3]

template<class Alloc >
void* Ogre::AllocatedObject< Alloc >::operator new ( size_t  sz)
inlineinherited

◆ operator new() [3/3]

template<class Alloc >
void* Ogre::AllocatedObject< Alloc >::operator new ( size_t  sz,
void *  ptr 
)
inlineinherited

placement operator new

◆ operator new[]() [1/2]

template<class Alloc >
void* Ogre::AllocatedObject< Alloc >::operator new[] ( size_t  sz,
const char *  file,
int  line,
const char *  func 
)
inlineinherited

array operator new, with debug line info

◆ operator new[]() [2/2]

template<class Alloc >
void* Ogre::AllocatedObject< Alloc >::operator new[] ( size_t  sz)
inlineinherited

◆ readRequests()

void Ogre::VertexArrayObject::readRequests ( ReadRequestsArray requests,
size_t  elementStart = 0,
size_t  elementCount = 0,
bool  skipRequestIfBufferHasShadowCopy = false 
)
inherited

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 );

Remarks
Throws if an element couldn't be found.
Parameters
requests[in/out] Array filled with the semantic.
skipRequestIfBufferHasShadowCopyAvoid 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

◆ setPrimitiveRange()

void Ogre::VertexArrayObject::setPrimitiveRange ( uint32  primStart,
uint32  primCount 
)
inherited

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.

For VAOs with no index buffers, this controls the vertex start & count, akin to vertexStart & vertexCount from the v1 objects.
Remarks
An exception is thrown if primStart, or primStart + primCount are out of the half open range: [0; mIndexBuffer->getNumElements()) or [0; mVertexBuffers[0]->getNumElements())
Parameters are always in elements (indices or vertices)

◆ unmapAsyncTickets()

static void Ogre::VertexArrayObject::unmapAsyncTickets ( ReadRequestsArray tickets)
staticinherited

Unmaps the buffers mapped via.

See also
mapAsyncTickets

Member Data Documentation

◆ mPrimType

GLint Ogre::GLES2VertexArrayObject::mPrimType[2]

◆ msDummyVertexBuffer

VertexBufferPacked Ogre::VertexArrayObject::msDummyVertexBuffer
staticinherited

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)


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