OGRE  1.11.6
Object-Oriented Graphics Rendering Engine
Ogre::D3D11VertexDeclaration Class Reference

Specialisation of VertexDeclaration for D3D11. More...

#include <OgreD3D11VertexDeclaration.h>

+ Inheritance diagram for Ogre::D3D11VertexDeclaration:

Public Types

typedef std::list< VertexElementVertexElementList
 Defines the list of vertex elements that makes up this declaration. More...
 

Public Member Functions

 D3D11VertexDeclaration (D3D11Device &device)
 
 ~D3D11VertexDeclaration ()
 
const VertexElementaddElement (unsigned short source, size_t offset, VertexElementType theType, VertexElementSemantic semantic, unsigned short index=0)
 Adds a new VertexElement to this declaration. More...
 
void bindToShader (D3D11HLSLProgram *boundVertexProgram, VertexBufferBinding *binding)
 
VertexDeclarationclone (HardwareBufferManagerBase *mgr=0) const OGRE_NODISCARD
 Clones this declaration. More...
 
void closeGapsInSource (void)
 Remove any gaps in the source buffer list used by this declaration. More...
 
const VertexElementfindElementBySemantic (VertexElementSemantic sem, unsigned short index=0) const
 Finds a VertexElement with the given semantic, and index if there is more than one element with the same semantic. More...
 
VertexElementList findElementsBySource (unsigned short source) const
 Based on the current elements, gets the size of the vertex for a given buffer source. More...
 
VertexDeclarationgetAutoOrganisedDeclaration (bool skeletalAnimation, bool vertexAnimation, bool vertexAnimationNormals) const
 Generates a new VertexDeclaration for optimal usage based on the current vertex declaration, which can be used with VertexData::reorganiseBuffers later if you wish, or simply used as a template. More...
 
const VertexElementgetElement (unsigned short index) const
 Get a single element. More...
 
size_t getElementCount (void) const
 Get the number of elements in the declaration. More...
 
const VertexElementListgetElements (void) const
 Gets read-only access to the list of vertex elements. More...
 
unsigned short getMaxSource (void) const
 Gets the index of the highest source value referenced by this declaration. More...
 
unsigned short getNextFreeTextureCoordinate () const
 Return the index of the next free texture coordinate set which may be added to this declaration. More...
 
size_t getVertexSize (unsigned short source) const
 Gets the vertex size defined by this declaration for a given source. More...
 
const VertexElementinsertElement (unsigned short atPosition, unsigned short source, size_t offset, VertexElementType theType, VertexElementSemantic semantic, unsigned short index=0)
 Inserts a new VertexElement at a given position in this declaration. More...
 
void modifyElement (unsigned short elem_index, unsigned short source, size_t offset, VertexElementType theType, VertexElementSemantic semantic, unsigned short index=0)
 Modify an element in-place, params as addElement. More...
 
bool operator!= (const VertexDeclaration &rhs) const
 
bool operator== (const VertexDeclaration &rhs) const
 
void removeAllElements (void)
 Remove all elements. More...
 
void removeElement (unsigned short elem_index)
 Remove the element at the given index from this declaration. More...
 
void removeElement (VertexElementSemantic semantic, unsigned short index=0)
 Remove the element with the given semantic and usage index. More...
 
void sort (void)
 Sorts the elements in this list to be compatible with the maximum number of rendering APIs / graphics cards. More...
 

Static Public Member Functions

static bool vertexElementLess (const VertexElement &e1, const VertexElement &e2)
 Sort routine for vertex elements. More...
 

Detailed Description

Specialisation of VertexDeclaration for D3D11.

Member Typedef Documentation

◆ VertexElementList

Defines the list of vertex elements that makes up this declaration.

Constructor & Destructor Documentation

◆ D3D11VertexDeclaration()

Ogre::D3D11VertexDeclaration::D3D11VertexDeclaration ( D3D11Device device)

◆ ~D3D11VertexDeclaration()

Ogre::D3D11VertexDeclaration::~D3D11VertexDeclaration ( )

Member Function Documentation

◆ bindToShader()

void Ogre::D3D11VertexDeclaration::bindToShader ( D3D11HLSLProgram boundVertexProgram,
VertexBufferBinding binding 
)

◆ vertexElementLess()

static bool Ogre::VertexDeclaration::vertexElementLess ( const VertexElement e1,
const VertexElement e2 
)
staticinherited

Sort routine for vertex elements.

◆ getElementCount()

size_t Ogre::VertexDeclaration::getElementCount ( void  ) const
inlineinherited

Get the number of elements in the declaration.

References OGRE_NODISCARD.

◆ getElements()

const VertexElementList& Ogre::VertexDeclaration::getElements ( void  ) const
inherited

Gets read-only access to the list of vertex elements.

◆ getElement()

const VertexElement* Ogre::VertexDeclaration::getElement ( unsigned short  index) const
inherited

Get a single element.

◆ sort()

void Ogre::VertexDeclaration::sort ( void  )
inherited

Sorts the elements in this list to be compatible with the maximum number of rendering APIs / graphics cards.

Remarks
Older graphics cards require vertex data to be presented in a more rigid way, as defined in the main documentation for this class. As well as the ordering being important, where shared source buffers are used, the declaration must list all the elements for each source in turn.

◆ closeGapsInSource()

void Ogre::VertexDeclaration::closeGapsInSource ( void  )
inherited

Remove any gaps in the source buffer list used by this declaration.

Remarks
This is useful if you've modified a declaration and want to remove any gaps in the list of buffers being used. Note, however, that if this declaration is already being used with a VertexBufferBinding, you will need to alter that too. This method is mainly useful when reorganising buffers based on an altered declaration.
Note
This will cause the vertex declaration to be re-sorted.

◆ getAutoOrganisedDeclaration()

VertexDeclaration* Ogre::VertexDeclaration::getAutoOrganisedDeclaration ( bool  skeletalAnimation,
bool  vertexAnimation,
bool  vertexAnimationNormals 
) const
inherited

Generates a new VertexDeclaration for optimal usage based on the current vertex declaration, which can be used with VertexData::reorganiseBuffers later if you wish, or simply used as a template.

Remarks
Different buffer organisations and buffer usages will be returned depending on the parameters passed to this method.
Parameters
skeletalAnimationWhether this vertex data is going to be skeletally animated
vertexAnimationWhether this vertex data is going to be vertex animated
vertexAnimationNormalsWhether vertex data animation is going to include normals animation

◆ getMaxSource()

unsigned short Ogre::VertexDeclaration::getMaxSource ( void  ) const
inherited

Gets the index of the highest source value referenced by this declaration.

◆ addElement()

const VertexElement& Ogre::VertexDeclaration::addElement ( unsigned short  source,
size_t  offset,
VertexElementType  theType,
VertexElementSemantic  semantic,
unsigned short  index = 0 
)
inherited

Adds a new VertexElement to this declaration.

Remarks
This method adds a single element (positions, normals etc) to the end of the vertex declaration. Please read the information in VertexDeclaration about the importance of ordering and structure for compatibility with older D3D drivers.
Parameters
sourceThe binding index of HardwareVertexBuffer which will provide the source for this element. See VertexBufferBinding for full information.
offsetThe offset in bytes where this element is located in the buffer
theTypeThe data format of the element (3 floats, a colour etc)
semanticThe meaning of the data (position, normal, diffuse colour etc)
indexOptional index for multi-input elements like texture coordinates
Returns
A reference to the VertexElement added.

◆ insertElement()

const VertexElement& Ogre::VertexDeclaration::insertElement ( unsigned short  atPosition,
unsigned short  source,
size_t  offset,
VertexElementType  theType,
VertexElementSemantic  semantic,
unsigned short  index = 0 
)
inherited

Inserts a new VertexElement at a given position in this declaration.

Remarks
This method adds a single element (positions, normals etc) at a given position in this vertex declaration. Please read the information in VertexDeclaration about the importance of ordering and structure for compatibility with older D3D drivers.
Parameters
sourceThe binding index of HardwareVertexBuffer which will provide the source for this element. See VertexBufferBinding for full information.
offsetThe offset in bytes where this element is located in the buffer
theTypeThe data format of the element (3 floats, a colour etc)
semanticThe meaning of the data (position, normal, diffuse colour etc)
indexOptional index for multi-input elements like texture coordinates
Returns
A reference to the VertexElement added.

◆ removeElement() [1/2]

void Ogre::VertexDeclaration::removeElement ( unsigned short  elem_index)
inherited

Remove the element at the given index from this declaration.

◆ removeElement() [2/2]

void Ogre::VertexDeclaration::removeElement ( VertexElementSemantic  semantic,
unsigned short  index = 0 
)
inherited

Remove the element with the given semantic and usage index.

Remarks
In this case 'index' means the usage index for repeating elements such as texture coordinates. For other elements this will always be 0 and does not refer to the index in the vector.

◆ removeAllElements()

void Ogre::VertexDeclaration::removeAllElements ( void  )
inherited

Remove all elements.

◆ modifyElement()

void Ogre::VertexDeclaration::modifyElement ( unsigned short  elem_index,
unsigned short  source,
size_t  offset,
VertexElementType  theType,
VertexElementSemantic  semantic,
unsigned short  index = 0 
)
inherited

Modify an element in-place, params as addElement.

Remarks
Please read the information in VertexDeclaration about the importance of ordering and structure for compatibility with older D3D drivers.

◆ findElementBySemantic()

const VertexElement* Ogre::VertexDeclaration::findElementBySemantic ( VertexElementSemantic  sem,
unsigned short  index = 0 
) const
inherited

Finds a VertexElement with the given semantic, and index if there is more than one element with the same semantic.

Remarks
If the element is not found, this method returns null.

◆ findElementsBySource()

VertexElementList Ogre::VertexDeclaration::findElementsBySource ( unsigned short  source) const
inherited

Based on the current elements, gets the size of the vertex for a given buffer source.

Parameters
sourceThe buffer binding index for which to get the vertex size. Gets a list of elements which use a given source.
Remarks
Note that the list of elements is returned by value therefore is separate from the declaration as soon as this method returns.

◆ getVertexSize()

size_t Ogre::VertexDeclaration::getVertexSize ( unsigned short  source) const
inherited

Gets the vertex size defined by this declaration for a given source.

◆ getNextFreeTextureCoordinate()

unsigned short Ogre::VertexDeclaration::getNextFreeTextureCoordinate ( ) const
inherited

Return the index of the next free texture coordinate set which may be added to this declaration.

◆ clone()

VertexDeclaration* Ogre::VertexDeclaration::clone ( HardwareBufferManagerBase mgr = 0) const
inherited

Clones this declaration.

Parameters
mgrOptional HardwareBufferManager to use for creating the clone (if null, use the current default).

◆ operator==()

bool Ogre::VertexDeclaration::operator== ( const VertexDeclaration rhs) const
inlineinherited

◆ operator!=()

bool Ogre::VertexDeclaration::operator!= ( const VertexDeclaration rhs) const
inlineinherited

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