Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

Ogre::D3D9VertexDeclaration Class Reference

Specialisation of VertexDeclaration for D3D9. More...

#include <OgreD3D9VertexDeclaration.h>

Inheritance diagram for Ogre::D3D9VertexDeclaration:

Inheritance graph
[legend]
List of all members.

Public Types

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


Public Methods

 D3D9VertexDeclaration (LPDIRECT3DDEVICE9 device)
 ~D3D9VertexDeclaration ()
const VertexElementaddElement (unsigned short source, size_t offset, VertexElementType theType, VertexElementSemantic semantic, unsigned short index=0)
 See VertexDeclaration.

const VertexElementinsertElement (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 VertexElementListgetElements (void) const
 Gets read-only access to the list of vertex elements.

const VertexElementgetElement (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.

VertexDeclarationgetAutoOrganisedDeclaration (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 VertexElementfindElementBySemantic (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 VertexDeclarationclone (void)
 Clones this declaration.

bool operator== (const VertexDeclaration &rhs) const
bool operator!= (const VertexDeclaration &rhs) const

Static Public Methods

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.

Referenced by Ogre::VertexDeclaration::findElementsBySource().


Constructor & Destructor Documentation

Ogre::D3D9VertexDeclaration::D3D9VertexDeclaration LPDIRECT3DDEVICE9    device
 

Definition at line 33 of file OgreD3D9VertexDeclaration.cpp.

Ogre::D3D9VertexDeclaration::~D3D9VertexDeclaration  
 

Definition at line 38 of file OgreD3D9VertexDeclaration.cpp.

References mlpD3DDecl, and SAFE_RELEASE.


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.

Definition at line 43 of file OgreD3D9VertexDeclaration.cpp.

References mNeedsRebuild, Ogre::VertexElementSemantic, and Ogre::VertexElementType.

VertexDeclaration * Ogre::VertexDeclaration::clone void    [virtual, inherited]
 

Clones this declaration.

Definition at line 337 of file OgreHardwareVertexBuffer.cpp.

References Ogre::VertexDeclaration::addElement(), and Ogre::VertexDeclaration::mElementList.

Referenced by Ogre::VertexDeclaration::getAutoOrganisedDeclaration(), and Ogre::PatchMesh::PatchMesh().

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.

Definition at line 381 of file OgreHardwareVertexBuffer.cpp.

References Ogre::VertexDeclaration::getElement(), Ogre::VertexElement::getIndex(), Ogre::VertexElement::getOffset(), Ogre::VertexElement::getSemantic(), Ogre::VertexElement::getSource(), Ogre::VertexElement::getType(), Ogre::VertexDeclaration::mElementList, Ogre::VertexDeclaration::modifyElement(), and Ogre::VertexDeclaration::sort().

Referenced by Ogre::VertexData::reorganiseBuffers().

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.

Definition at line 284 of file OgreHardwareVertexBuffer.cpp.

References Ogre::VertexDeclaration::mElementList, and Ogre::VertexElementSemantic.

Referenced by Ogre::TerrainRenderable::_calculateNormals(), Ogre::TerrainRenderable::_generateVertexLighting(), Ogre::ProgressiveMesh::addWorkingData(), Ogre::Mesh::buildTangentVectors(), Ogre::EdgeListBuilder::buildTrianglesEdges(), Ogre::Entity::cloneVertexDataRemoveBlendInfo(), Ogre::Mesh::compileBoneAssignments(), Ogre::PatchSurface::defineSurface(), Ogre::PatchSurface::distributeControlPoints(), Ogre::Entity::EntityShadowRenderable::EntityShadowRenderable(), Ogre::Entity::extractTempBufferInfo(), Ogre::TerrainRenderable::initialise(), Ogre::PatchSurface::interpolateVertexData(), Ogre::EdgeListBuilder::log(), Ogre::Mesh::organiseTangentsBuffer(), Ogre::VertexData::prepareForShadowVolume(), Ogre::VertexData::reorganiseBuffers(), Ogre::Mesh::softwareVertexBlend(), and Ogre::Mesh::suggestTangentVectorBuildParams().

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

Definition at line 302 of file OgreHardwareVertexBuffer.cpp.

References Ogre::VertexDeclaration::mElementList, and Ogre::VertexDeclaration::VertexElementList.

Referenced by Ogre::MeshSerializerImpl::readGeometryVertexBuffer(), Ogre::VertexData::reorganiseBuffers(), and Ogre::MeshSerializerImpl::writeGeometry().

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.

Definition at line 412 of file OgreHardwareVertexBuffer.cpp.

References Ogre::VertexDeclaration::clone(), Ogre::VertexDeclaration::getElements(), Ogre::VertexElement::getIndex(), Ogre::VertexElement::getSemantic(), Ogre::VertexElement::getSize(), Ogre::VertexElement::getType(), Ogre::VertexDeclaration::modifyElement(), Ogre::VertexDeclaration::sort(), Ogre::VES_NORMAL, and Ogre::VES_POSITION.

LPDIRECT3DVERTEXDECLARATION9 Ogre::D3D9VertexDeclaration::getD3DVertexDeclaration void   
 

Gets the D3D9-specific vertex declaration.

Definition at line 73 of file OgreD3D9VertexDeclaration.cpp.

References Except, Ogre::VertexDeclaration::mElementList, mlpD3DDecl, mlpD3DDevice, mNeedsRebuild, SAFE_RELEASE, Ogre::VES_DIFFUSE, and Ogre::VES_SPECULAR.

Referenced by Ogre::D3D9RenderSystem::setVertexDeclaration().

const VertexElement * Ogre::VertexDeclaration::getElement unsigned short    index [inherited]
 

Get a single element.

Definition at line 239 of file OgreHardwareVertexBuffer.cpp.

References Ogre::VertexDeclaration::mElementList.

Referenced by Ogre::VertexDeclaration::closeGapsInSource(), and Ogre::Mesh::compileBoneAssignments().

size_t Ogre::VertexDeclaration::getElementCount void    [inherited]
 

Get the number of elements in the declaration.

Definition at line 277 of file OgreHardwareVertexBuffer.h.

Referenced by Ogre::Mesh::compileBoneAssignments().

const VertexDeclaration::VertexElementList & Ogre::VertexDeclaration::getElements void    const [inherited]
 

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

Definition at line 205 of file OgreHardwareVertexBuffer.cpp.

References Ogre::VertexDeclaration::mElementList.

Referenced by Ogre::GLRenderSystem::_render(), Ogre::D3DRenderSystem::_render(), Ogre::MeshSerializerImpl::calcGeometrySize(), Ogre::VertexData::clone(), Ogre::VertexDeclaration::getAutoOrganisedDeclaration(), Ogre::VertexData::prepareForShadowVolume(), Ogre::VertexData::reorganiseBuffers(), and Ogre::MeshSerializerImpl::writeGeometry().

unsigned short Ogre::VertexDeclaration::getMaxSource void    const [inherited]
 

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

Definition at line 452 of file OgreHardwareVertexBuffer.cpp.

References Ogre::VertexDeclaration::mElementList.

Referenced by Ogre::VertexData::reorganiseBuffers().

size_t Ogre::VertexDeclaration::getVertexSize unsigned short    source [virtual, inherited]
 

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

Definition at line 320 of file OgreHardwareVertexBuffer.cpp.

References Ogre::VertexDeclaration::mElementList.

Referenced by Ogre::BillboardSet::_createBuffers(), Ogre::D3DRenderSystem::_render(), Ogre::PatchSurface::build(), Ogre::TTYGuiElement::checkMemoryAllocation(), Ogre::TextAreaGuiElement::checkMemoryAllocation(), Ogre::MeshManager::createCurvedIllusionPlane(), Ogre::MeshManager::createPlane(), Ogre::PatchSurface::defineSurface(), Ogre::PatchSurface::distributeControlPoints(), Ogre::TerrainRenderable::initialise(), Ogre::PanelGuiElement::initialise(), Ogre::BorderPanelGuiElement::initialise(), Ogre::PatchSurface::interpolateVertexData(), Ogre::PatchMesh::load(), Ogre::MeshSerializerImpl_v1_2::readGeometryColours(), Ogre::MeshSerializerImpl_v1_2::readGeometryNormals(), Ogre::MeshSerializerImpl_v1_2::readGeometryPositions(), Ogre::MeshSerializerImpl_v1_1::readGeometryTexCoords(), Ogre::MeshSerializerImpl_v1_2::readGeometryTexCoords(), Ogre::MeshSerializerImpl::readGeometryVertexBuffer(), Ogre::Rectangle2D::Rectangle2D(), Ogre::VertexData::reorganiseBuffers(), Ogre::PanelGuiElement::updateTextureGeometry(), and Ogre::WireBoundingBox::WireBoundingBox().

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.

Definition at line 51 of file OgreD3D9VertexDeclaration.cpp.

References mNeedsRebuild, Ogre::VertexElementSemantic, and Ogre::VertexElementType.

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.

Definition at line 65 of file OgreD3D9VertexDeclaration.cpp.

References mNeedsRebuild, Ogre::VertexElementSemantic, and Ogre::VertexElementType.

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.

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.

Definition at line 260 of file OgreHardwareVertexBuffer.cpp.

References Ogre::VertexDeclaration::mElementList, and Ogre::VertexElementSemantic.

void Ogre::D3D9VertexDeclaration::removeElement unsigned short    elem_index [virtual]
 

See VertexDeclaration.

Reimplemented from Ogre::VertexDeclaration.

Definition at line 59 of file OgreD3D9VertexDeclaration.cpp.

References mNeedsRebuild.

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.

Definition at line 376 of file OgreHardwareVertexBuffer.cpp.

References Ogre::VertexDeclaration::mElementList.

Referenced by Ogre::VertexDeclaration::closeGapsInSource(), and Ogre::VertexDeclaration::getAutoOrganisedDeclaration().

bool Ogre::VertexDeclaration::vertexElementLess const VertexElement   e1,
const VertexElement   e2
[static, inherited]
 

Sort routine for vertex elements.

Definition at line 351 of file OgreHardwareVertexBuffer.cpp.

References Ogre::VertexElement::getIndex(), Ogre::VertexElement::getSemantic(), and Ogre::VertexElement::getSource().


Member Data Documentation

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

Definition at line 270 of file OgreHardwareVertexBuffer.h.

Referenced by Ogre::VertexDeclaration::addElement(), Ogre::VertexDeclaration::clone(), Ogre::VertexDeclaration::closeGapsInSource(), Ogre::VertexDeclaration::findElementBySemantic(), Ogre::VertexDeclaration::findElementsBySource(), getD3DVertexDeclaration(), Ogre::VertexDeclaration::getElement(), Ogre::VertexDeclaration::getElements(), Ogre::VertexDeclaration::getMaxSource(), Ogre::VertexDeclaration::getVertexSize(), Ogre::VertexDeclaration::insertElement(), Ogre::VertexDeclaration::modifyElement(), Ogre::VertexDeclaration::operator==(), Ogre::VertexDeclaration::removeElement(), and Ogre::VertexDeclaration::sort().

LPDIRECT3DVERTEXDECLARATION9 Ogre::D3D9VertexDeclaration::mlpD3DDecl [protected]
 

Definition at line 38 of file OgreD3D9VertexDeclaration.h.

Referenced by getD3DVertexDeclaration(), and ~D3D9VertexDeclaration().

LPDIRECT3DDEVICE9 Ogre::D3D9VertexDeclaration::mlpD3DDevice [protected]
 

Definition at line 37 of file OgreD3D9VertexDeclaration.h.

Referenced by getD3DVertexDeclaration().

bool Ogre::D3D9VertexDeclaration::mNeedsRebuild [protected]
 

Definition at line 39 of file OgreD3D9VertexDeclaration.h.

Referenced by addElement(), getD3DVertexDeclaration(), insertElement(), modifyElement(), and removeElement().


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

Copyright © 2002-2003 by The OGRE Team
Last modified Sun Nov 28 19:49:29 2004