Home | Namespaces | Hierarchy | Alphabetical List | Class list | Files | Namespace Members | Class members | File members
Public Member Functions | Protected Attributes
render::VertexDeclaration Class Reference

#include <VertexBuffer.h>

List of all members.

Public Member Functions

virtual const VertexElementaddElement (u16 source, u32 offset, VertexElementType theType, VertexElementSemantic semantic, u16 index=0)
virtual const VertexElementfindElementBySemantic (VertexElementSemantic sem, u16 index=0)
 Finds a VertexElement with the given semantic, and index if there is more than.
virtual std::list
< VertexElement * > 
findElementsBySource (u16 source)
 Gets a list of elements which use a given source.
const std::list< VertexElement * > & getElements () const
 Gets read-only access to the list of vertex elements.
virtual u32 getVertexSize (u16 source)
 Gets the vertex size defined by this declaration for a given source.
virtual void modifyElement (u16 elem_index, u16 source, u32 offset, VertexElementType theType, VertexElementSemantic semantic, u16 index=0)
 Modify an element in-place, params as addElement.
bool operator== (const VertexDeclaration &rhs) const
virtual void removeAllElements ()
 Remove all elements.
virtual void removeElement (VertexElementSemantic semantic, u16 index=0)
virtual void removeElement (u16 elem_index)
 Remove the element at the given index from this declaration.
 VertexDeclaration ()
 Standard constructor, not you should use HardwareBufferManager::createVertexDeclaration.
virtual ~VertexDeclaration ()

Protected Attributes

std::list< VertexElement * > mVertexElements

Detailed Description

This class declares the format of a set of vertex inputs, which can be issued to the rendering API.

You should be aware that the ordering and structure of the VertexDeclaration can be very important on DirectX with older cards,so if you want to maintain maximum compatibility with all render systems and all cards you should be careful to follow these rules: VertexElements should be added in the following order, and the order of the elements within a shared buffer should be as follows: position, blending weights, normals, diffuse colors, specular colors, texture coordinates (in order, with no gaps). You must not have unused gaps in your buffers which are not referenced by any VertexElement. You must not cause the buffer & offset settings of 2 VertexElements to overlap.

Whilst GL and more modern graphics cards in D3D will allow you to defy these rules, sticking to them will ensure that your buffers have the maximum compatibility.


Constructor & Destructor Documentation

render::VertexDeclaration::VertexDeclaration ( )

Standard constructor, not you should use HardwareBufferManager::createVertexDeclaration.

render::VertexDeclaration::~VertexDeclaration ( ) [virtual]

References removeAllElements().


Member Function Documentation

const VertexElement * render::VertexDeclaration::addElement ( u16  source,
u32  offset,
VertexElementType  theType,
VertexElementSemantic  semantic,
u16  index = 0 
) [virtual]

Adds a new VertexElement to this declaration.

This method adds a single element (positions, normals etc) to the vertex declaration.

Parameters:
sourceThe binding index of HardwareVertexBuffer which will provide the source for this element.
offsetThe offset in bytes where this element is located in the buffer
theTypeThe data format of the element (3 floats, a color etc)
semanticThe meaning of the data (position, normal, diffuse color etc)
indexOptional index for multi-input elements like texture coordinates
Returns:
A reference to the VertexElement added.

References mVertexElements.

Referenced by render::DebugRenderable::initializeGeometry(), render::TextOverlay::initializeImpl(), and render::PanelOverlay::initializeImpl().

const VertexElement * render::VertexDeclaration::findElementBySemantic ( VertexElementSemantic  sem,
u16  index = 0 
) [virtual]

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

References mVertexElements.

std::list< VertexElement * > render::VertexDeclaration::findElementsBySource ( u16  source) [virtual]

Gets a list of elements which use a given source.

References mVertexElements.

const std::list< VertexElement * > & render::VertexDeclaration::getElements ( ) const

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

References mVertexElements.

u32 render::VertexDeclaration::getVertexSize ( u16  source) [virtual]

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

References mVertexElements.

Referenced by render::TextOverlay::allocateMemory(), render::DebugRenderable::initializeGeometry(), and render::PanelOverlay::initializeImpl().

void render::VertexDeclaration::modifyElement ( u16  elem_index,
u16  source,
u32  offset,
VertexElementType  theType,
VertexElementSemantic  semantic,
u16  index = 0 
) [virtual]

Modify an element in-place, params as addElement.

References mVertexElements.

bool render::VertexDeclaration::operator== ( const VertexDeclaration rhs) const [inline]

References mVertexElements.

void render::VertexDeclaration::removeAllElements ( ) [virtual]

Remove all elements.

References mVertexElements.

Referenced by ~VertexDeclaration().

void render::VertexDeclaration::removeElement ( u16  elem_index) [virtual]

Remove the element at the given index from this declaration.

References mVertexElements.

void render::VertexDeclaration::removeElement ( VertexElementSemantic  semantic,
u16  index = 0 
) [virtual]

Remove the element with the given semantic and usage index.

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

References mVertexElements.


Member Data Documentation


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

The KG Game Engine
The KG Game Engine Documentation © 2006-2011 by Kat'Oun. Generated on Sat Jul 2 2011 00:50:09 by Doxygen (1.7.4)