# Ogre::D3D9VertexDeclaration Class Reference

Specialisation of VertexDeclaration for D3D9. More...

`#include <OgreD3D9VertexDeclaration.h>`

Inheritance diagram for Ogre::D3D9VertexDeclaration:

List of all members.

## Public Types

typedef std::list< VertexElement > | VertexElementList
| Defines the list of vertex elements that makes up this declaration.

## Public Member Functions

| D3D9VertexDeclaration (LPDIRECT3DDEVICE9 device)
| ~D3D9VertexDeclaration ()
const VertexElement & | addElement (unsigned short source, size_t offset, VertexElementType theType, VertexElementSemantic semantic, unsigned short index=0)
| See VertexDeclaration.
const VertexElement & | insertElement (unsigned short atPosition, unsigned short source, size_t offset, VertexElementType theType, VertexElementSemantic semantic, unsigned short index=0)
| See VertexDeclaration.
void | removeElement (unsigned short elem_index)
| See VertexDeclaration.
void | modifyElement (unsigned short elem_index, unsigned short source, size_t offset, VertexElementType theType, VertexElementSemantic semantic, unsigned short index=0)
| See VertexDeclaration.
LPDIRECT3DVERTEXDECLARATION9 | getD3DVertexDeclaration (void)
| Gets the D3D9-specific vertex declaration.
size_t | getElementCount (void)
| Get the number of elements in the declaration.
const VertexElementList & | getElements (void) const
| Gets read-only access to the list of vertex elements.
const VertexElement * | getElement (unsigned short index)
| Get a single element.
void | sort (void)
| Sorts the elements in this list to be compatible with the maximum number of rendering APIs / graphics cards.
void | closeGapsInSource (void)
| Remove any gaps in the source buffer list used by this declaration.
VertexDeclaration * | getAutoOrganisedDeclaration (bool animated)
| 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.
unsigned short | getMaxSource (void) const
| Gets the indeex of the highest source value referenced by this declaration.
virtual void | removeElement (VertexElementSemantic semantic, unsigned short index=0)
| Remove the element with the given semantic and usage index.
virtual const VertexElement * | findElementBySemantic (VertexElementSemantic sem, unsigned short index=0)
| Finds a VertexElement with the given semantic, and index if there is more than one element with the same semantic.
virtual VertexElementList | findElementsBySource (unsigned short source)
| Gets a list of elements which use a given source.
virtual size_t | getVertexSize (unsigned short source)
| Gets the vertex size defined by this declaration for a given source.
virtual VertexDeclaration * | clone (void)
| Clones this declaration.
bool | operator== (const VertexDeclaration &rhs) const
bool | operator!= (const VertexDeclaration &rhs) const

## Static Public Member Functions

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

## Protected Attributes

LPDIRECT3DDEVICE9 | mlpD3DDevice
LPDIRECT3DVERTEXDECLARATION9 | mlpD3DDecl
bool | mNeedsRebuild
VertexElementList | mElementList

## Detailed Description

Specialisation of VertexDeclaration for D3D9.

Definition at line 34 of file OgreD3D9VertexDeclaration.h.

## Member Typedef Documentation

typedef std::list<VertexElement> Ogre::VertexDeclaration::VertexElementList `[inherited]`

| Defines the list of vertex elements that makes up this declaration. Definition at line 266 of file OgreHardwareVertexBuffer.h.

## Constructor & Destructor Documentation

Ogre::D3D9VertexDeclaration::D3D9VertexDeclaration | ( | LPDIRECT3DDEVICE9 | device | ) |

Ogre::D3D9VertexDeclaration::~D3D9VertexDeclaration | ( |  | ) |

## Member Function Documentation

const VertexElement& Ogre::D3D9VertexDeclaration::addElement | ( | unsigned short | source,
|  | size_t | offset,
|  | VertexElementType | theType,
|  | VertexElementSemantic | semantic,
|  | unsigned short | index = 0
| ) | `[virtual]`

| See VertexDeclaration. Reimplemented from Ogre::VertexDeclaration.

virtual VertexDeclaration* Ogre::VertexDeclaration::clone | ( | void |  | ) | `[virtual, inherited]`

| Clones this declaration.

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.

virtual const VertexElement* Ogre::VertexDeclaration::findElementBySemantic | ( | VertexElementSemantic | sem,
|  | unsigned short | index = 0
| ) | `[virtual, 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.

virtual VertexElementList Ogre::VertexDeclaration::findElementsBySource | ( | unsigned short | source | ) | `[virtual, inherited]`

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.

VertexDeclaration* Ogre::VertexDeclaration::getAutoOrganisedDeclaration | ( | bool | animated | ) | `[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.

Parameters:

  animated | Whether this vertex data is going to be animated; this affects the choice of both usage and buffer splits.

LPDIRECT3DVERTEXDECLARATION9 Ogre::D3D9VertexDeclaration::getD3DVertexDeclaration | ( | void |  | ) |

| Gets the D3D9-specific vertex declaration.

const VertexElement* Ogre::VertexDeclaration::getElement | ( | unsigned short | index | ) | `[inherited]`

| Get a single element.

size_t Ogre::VertexDeclaration::getElementCount | ( | void |  | ) | `[inherited]`

| Get the number of elements in the declaration. Definition at line 277 of file OgreHardwareVertexBuffer.h.

const VertexElementList& Ogre::VertexDeclaration::getElements | ( | void |  | ) | const`[inherited]`

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

unsigned short Ogre::VertexDeclaration::getMaxSource | ( | void |  | ) | const`[inherited]`

| Gets the indeex of the highest source value referenced by this declaration.

virtual size_t Ogre::VertexDeclaration::getVertexSize | ( | unsigned short | source | ) | `[virtual, inherited]`

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

const VertexElement& Ogre::D3D9VertexDeclaration::insertElement | ( | unsigned short | atPosition,
|  | unsigned short | source,
|  | size_t | offset,
|  | VertexElementType | theType,
|  | VertexElementSemantic | semantic,
|  | unsigned short | index = 0
| ) | `[virtual]`

| See VertexDeclaration. Reimplemented from Ogre::VertexDeclaration.

void Ogre::D3D9VertexDeclaration::modifyElement | ( | unsigned short | elem_index,
|  | unsigned short | source,
|  | size_t | offset,
|  | VertexElementType | theType,
|  | VertexElementSemantic | semantic,
|  | unsigned short | index = 0
| ) | `[virtual]`

| See VertexDeclaration. Reimplemented from Ogre::VertexDeclaration.

bool Ogre::VertexDeclaration::operator!= | ( | const VertexDeclaration & | rhs | ) | const`[inherited]`

| Definition at line 409 of file OgreHardwareVertexBuffer.h.

bool Ogre::VertexDeclaration::operator== | ( | const VertexDeclaration & | rhs | ) | const`[inherited]`

| Definition at line 392 of file OgreHardwareVertexBuffer.h. References Ogre::VertexDeclaration::mElementList.

virtual void Ogre::VertexDeclaration::removeElement | ( | VertexElementSemantic | semantic,
|  | unsigned short | index = 0
| ) | `[virtual, 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.

void Ogre::D3D9VertexDeclaration::removeElement | ( | unsigned short | elem_index | ) | `[virtual]`

| See VertexDeclaration. Reimplemented from Ogre::VertexDeclaration.

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.

bool Ogre::VertexDeclaration::vertexElementLess | ( | const VertexElement & | e1,
|  | const VertexElement & | e2
| ) | `[static, inherited]`

| Sort routine for vertex elements.

## Member Data Documentation

VertexElementList Ogre::VertexDeclaration::mElementList `[protected, inherited]`

| Definition at line 270 of file OgreHardwareVertexBuffer.h. Referenced by Ogre::VertexDeclaration::operator==().

LPDIRECT3DVERTEXDECLARATION9 Ogre::D3D9VertexDeclaration::mlpD3DDecl `[protected]`

| Definition at line 38 of file OgreD3D9VertexDeclaration.h.

LPDIRECT3DDEVICE9 Ogre::D3D9VertexDeclaration::mlpD3DDevice `[protected]`

| Definition at line 37 of file OgreD3D9VertexDeclaration.h.

bool Ogre::D3D9VertexDeclaration::mNeedsRebuild `[protected]`

| Definition at line 39 of file OgreD3D9VertexDeclaration.h.

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

- OgreD3D9VertexDeclaration.h

Copyright © 2000-2005 by The OGRE Team
This work is licensed under a Creative Commons Attribution-ShareAlike 2.5 License.
Last modified Sun Feb 12 13:09:23 2006