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

# Ogre::VertexElement Class Reference

This class declares the usage of a single vertex buffer as a component of a complete VertexDeclaration. More...

`#include <OgreHardwareVertexBuffer.h>`

List of all members.

## Public Methods

| VertexElement (unsigned short source, size_t offset, VertexElementType theType, VertexElementSemantic semantic, unsigned short index=0)
| Constructor, should not be called directly, call VertexDeclaration::addElement.
unsigned short | getSource (void) const
| Gets the vertex buffer index from where this element draws it's values.
size_t | getOffset (void) const
| Gets the offset into the buffer where this element starts.
VertexElementType | getType (void) const
| Gets the data format of this element.
VertexElementSemantic | getSemantic (void) const
| Gets the meaning of this element.
unsigned short | getIndex (void) const
| Gets the index of this element, only applicable for repeating elements.
size_t | getSize (void) const
| Gets the size of this element in bytes.
bool | operator== (const VertexElement &rhs) const
void | baseVertexPointerToElement (void *pBase, void **pElem) const
| Adjusts a pointer to the base of a vertex to point at this element.
void | baseVertexPointerToElement (void *pBase, Real **pElem) const
| Adjusts a pointer to the base of a vertex to point at this element.
void | baseVertexPointerToElement (void *pBase, RGBA **pElem) const
| Adjusts a pointer to the base of a vertex to point at this element.
void | baseVertexPointerToElement (void *pBase, unsigned char **pElem) const
| Adjusts a pointer to the base of a vertex to point at this element.
void | baseVertexPointerToElement (void *pBase, unsigned short **pElem) const
| Adjusts a pointer to the base of a vertex to point at this element.

## Static Public Methods

size_t | getTypeSize (VertexElementType etype)
| Utility method for helping to calculate offsets.
unsigned short | getTypeCount (VertexElementType etype)
| Utility method which returns the count of values in a given type.
VertexElementType | multiplyTypeCount (VertexElementType baseType, unsigned short count)
| Simple converter function which will turn a single-value type into a multi-value type based on a parameter.
VertexElementType | getBaseType (VertexElementType multiType)
| Simple converter function which will a type into it's single-value equivalent - makes switches on type easier.

## Protected Attributes

unsigned short | mSource
| The source vertex buffer, as bound to an index using VertexBufferBinding.
size_t | mOffset
| The offset in the buffer that this element starts at.
VertexElementType | mType
| The type of element.
VertexElementSemantic | mSemantic
| The meaning of the element.
unsigned short | mIndex
| Index of the item, only applicable for some elements like texture coords.

## Detailed Description

This class declares the usage of a single vertex buffer as a component of a complete VertexDeclaration.

Remarks:
  Several vertex buffers can be used to supply the input geometry for a rendering operation, and in each case a vertex buffer can be used in different ways for different operations; the buffer itself does not define the semantics (position, normal etc), the VertexElement class does.

Definition at line 116 of file OgreHardwareVertexBuffer.h.

## Constructor & Destructor Documentation

Ogre::VertexElement::VertexElement | ( | unsigned short | source,
|  | size_t | offset,
|  | VertexElementType | theType,
|  | VertexElementSemantic | semantic,
|  | unsigned short | index = 0
| ) |

| Constructor, should not be called directly, call VertexDeclaration::addElement. Definition at line 63 of file OgreHardwareVertexBuffer.cpp. References Ogre::VertexElementSemantic, and Ogre::VertexElementType.

## Member Function Documentation

void Ogre::VertexElement::baseVertexPointerToElement | ( | void * | pBase,
|  | unsigned short ** | pElem
| ) | const

Adjusts a pointer to the base of a vertex to point at this element.

Remarks:
  This variant is for ushort pointers, passed as a parameter because we can't rely on covariant return types.

Parameters:

  pBase | Pointer to the start of a vertex in this buffer.
  pElem | Pointer to a pointer which will be set to the start of this element.

Definition at line 233 of file OgreHardwareVertexBuffer.h.

void Ogre::VertexElement::baseVertexPointerToElement | ( | void * | pBase,
|  | unsigned char ** | pElem
| ) | const

Adjusts a pointer to the base of a vertex to point at this element.

Remarks:
  This variant is for char pointers, passed as a parameter because we can't rely on covariant return types.

Parameters:

  pBase | Pointer to the start of a vertex in this buffer.
  pElem | Pointer to a pointer which will be set to the start of this element.

Definition at line 221 of file OgreHardwareVertexBuffer.h.

void Ogre::VertexElement::baseVertexPointerToElement | ( | void * | pBase,
|  | RGBA ** | pElem
| ) | const

Adjusts a pointer to the base of a vertex to point at this element.

Remarks:
  This variant is for RGBA pointers, passed as a parameter because we can't rely on covariant return types.

Parameters:

  pBase | Pointer to the start of a vertex in this buffer.
  pElem | Pointer to a pointer which will be set to the start of this element.

Definition at line 208 of file OgreHardwareVertexBuffer.h.

References Ogre::RGBA.

void Ogre::VertexElement::baseVertexPointerToElement | ( | void * | pBase,
|  | Real ** | pElem
| ) | const

Adjusts a pointer to the base of a vertex to point at this element.

Remarks:
  This variant is for Real pointers, passed as a parameter because we can't rely on covariant return types.

Parameters:

  pBase | Pointer to the start of a vertex in this buffer.
  pElem | Pointer to a pointer which will be set to the start of this element.

Definition at line 191 of file OgreHardwareVertexBuffer.h.

References Ogre::Real.

void Ogre::VertexElement::baseVertexPointerToElement | ( | void * | pBase,
|  | void ** | pElem
| ) | const

Adjusts a pointer to the base of a vertex to point at this element.

Remarks:
  This variant is for void pointers, passed as a parameter because we can't rely on covariant return types.

Parameters:

  pBase | Pointer to the start of a vertex in this buffer.
  pElem | Pointer to a pointer which will be set to the start of this element.

Definition at line 177 of file OgreHardwareVertexBuffer.h.

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

VertexElementType Ogre::VertexElement::getBaseType | ( | VertexElementType | multiType | ) | `[static]`

| Simple converter function which will a type into it's single-value equivalent - makes switches on type easier. Definition at line 174 of file OgreHardwareVertexBuffer.cpp. References Ogre::VertexElementType, Ogre::VET_COLOUR, Ogre::VET_FLOAT1, Ogre::VET_FLOAT2, Ogre::VET_FLOAT3, Ogre::VET_FLOAT4, Ogre::VET_SHORT1, Ogre::VET_SHORT2, Ogre::VET_SHORT3, Ogre::VET_SHORT4, and Ogre::VET_UBYTE4.

unsigned short Ogre::VertexElement::getIndex | ( | void |  | ) | const

Gets the index of this element, only applicable for repeating elements.

Definition at line 142 of file OgreHardwareVertexBuffer.h.

Referenced by Ogre::D3DRenderSystem::_render(), Ogre::VertexDeclaration::closeGapsInSource(), Ogre::VertexDeclaration::getAutoOrganisedDeclaration(), Ogre::VertexData::reorganiseBuffers(), Ogre::Mesh::suggestTangentVectorBuildParams(), Ogre::VertexDeclaration::vertexElementLess(), and Ogre::MeshSerializerImpl::writeGeometry().

size_t Ogre::VertexElement::getOffset | ( | void |  | ) | const

| Gets the offset into the buffer where this element starts. Definition at line 136 of file OgreHardwareVertexBuffer.h. Referenced by Ogre::TerrainRenderable::_generateVertexLighting(), Ogre::D3DRenderSystem::_render(), Ogre::VertexDeclaration::closeGapsInSource(), Ogre::VertexData::prepareForShadowVolume(), Ogre::Mesh::softwareVertexBlend(), and Ogre::MeshSerializerImpl::writeGeometry().

VertexElementSemantic Ogre::VertexElement::getSemantic | ( | void |  | ) | const

Gets the meaning of this element.

Definition at line 140 of file OgreHardwareVertexBuffer.h.

References Ogre::VertexElementSemantic.

Referenced by Ogre::D3DRenderSystem::_render(), Ogre::VertexDeclaration::closeGapsInSource(), Ogre::Mesh::compileBoneAssignments(), Ogre::VertexDeclaration::getAutoOrganisedDeclaration(), Ogre::VertexData::reorganiseBuffers(), Ogre::VertexDeclaration::vertexElementLess(), and Ogre::MeshSerializerImpl::writeGeometry().

size_t Ogre::VertexElement::getSize | ( | void |  | ) | const

| Gets the size of this element in bytes. Definition at line 70 of file OgreHardwareVertexBuffer.cpp. References getTypeSize(), and mType. Referenced by Ogre::VertexDeclaration::getAutoOrganisedDeclaration(), Ogre::VertexData::prepareForShadowVolume(), Ogre::VertexData::reorganiseBuffers(), and Ogre::Mesh::softwareVertexBlend().

unsigned short Ogre::VertexElement::getSource | ( | void |  | ) | const

Gets the vertex buffer index from where this element draws it's values.

Definition at line 134 of file OgreHardwareVertexBuffer.h.

Referenced by Ogre::D3DRenderSystem::_render(), Ogre::ProgressiveMesh::addWorkingData(), Ogre::Mesh::buildTangentVectors(), Ogre::EdgeListBuilder::buildTrianglesEdges(), Ogre::Entity::cloneVertexDataRemoveBlendInfo(), Ogre::VertexDeclaration::closeGapsInSource(), Ogre::Mesh::compileBoneAssignments(), Ogre::Entity::EntityShadowRenderable::EntityShadowRenderable(), Ogre::Entity::extractTempBufferInfo(), Ogre::EdgeListBuilder::log(), Ogre::Mesh::organiseTangentsBuffer(), Ogre::VertexData::prepareForShadowVolume(), Ogre::VertexData::reorganiseBuffers(), Ogre::Mesh::softwareVertexBlend(), Ogre::VertexDeclaration::vertexElementLess(), and Ogre::MeshSerializerImpl::writeGeometry().

VertexElementType Ogre::VertexElement::getType | ( | void |  | ) | const

Gets the data format of this element.

Definition at line 138 of file OgreHardwareVertexBuffer.h.

References Ogre::VertexElementType.

Referenced by Ogre::D3DRenderSystem::_render(), Ogre::Mesh::buildTangentVectors(), Ogre::MeshSerializerImpl::calcGeometrySize(), Ogre::VertexDeclaration::closeGapsInSource(), Ogre::PatchSurface::distributeControlPoints(), Ogre::VertexDeclaration::getAutoOrganisedDeclaration(), Ogre::PatchSurface::interpolateVertexData(), Ogre::Mesh::organiseTangentsBuffer(), Ogre::Mesh::softwareVertexBlend(), Ogre::Mesh::suggestTangentVectorBuildParams(), and Ogre::MeshSerializerImpl::writeGeometry().

unsigned short Ogre::VertexElement::getTypeCount | ( | VertexElementType | etype | ) | `[static]`

| Utility method which returns the count of values in a given type. Definition at line 103 of file OgreHardwareVertexBuffer.cpp. References Except, Ogre::VertexElementType, Ogre::VET_COLOUR, Ogre::VET_FLOAT1, Ogre::VET_FLOAT2, Ogre::VET_FLOAT3, Ogre::VET_FLOAT4, Ogre::VET_SHORT1, Ogre::VET_SHORT2, Ogre::VET_SHORT3, Ogre::VET_SHORT4, and Ogre::VET_UBYTE4.

size_t Ogre::VertexElement::getTypeSize | ( | VertexElementType | etype | ) | `[static]`

| Utility method for helping to calculate offsets. Definition at line 75 of file OgreHardwareVertexBuffer.cpp. References Ogre::VertexElementType, Ogre::VET_COLOUR, Ogre::VET_FLOAT1, Ogre::VET_FLOAT2, Ogre::VET_FLOAT3, Ogre::VET_FLOAT4, Ogre::VET_SHORT1, Ogre::VET_SHORT2, Ogre::VET_SHORT3, Ogre::VET_SHORT4, and Ogre::VET_UBYTE4. Referenced by getSize().

VertexElementType Ogre::VertexElement::multiplyTypeCount | ( | VertexElementType | baseType,
|  | unsigned short | count
| ) | `[static]`

| Simple converter function which will turn a single-value type into a multi-value type based on a parameter. Definition at line 132 of file OgreHardwareVertexBuffer.cpp. References Except, Ogre::VertexElementType, Ogre::VET_FLOAT1, Ogre::VET_FLOAT2, Ogre::VET_FLOAT3, Ogre::VET_FLOAT4, Ogre::VET_SHORT1, Ogre::VET_SHORT2, Ogre::VET_SHORT3, and Ogre::VET_SHORT4.

bool Ogre::VertexElement::operator== | ( | const VertexElement & | rhs | ) | const

| Definition at line 158 of file OgreHardwareVertexBuffer.h. References mIndex, mOffset, mSemantic, mSource, and mType.

## Member Data Documentation

unsigned short Ogre::VertexElement::mIndex`[protected]`

| Index of the item, only applicable for some elements like texture coords. Definition at line 128 of file OgreHardwareVertexBuffer.h. Referenced by operator==().

size_t Ogre::VertexElement::mOffset`[protected]`

| The offset in the buffer that this element starts at. Definition at line 122 of file OgreHardwareVertexBuffer.h. Referenced by operator==().

VertexElementSemantic Ogre::VertexElement::mSemantic`[protected]`

| The meaning of the element. Definition at line 126 of file OgreHardwareVertexBuffer.h. Referenced by operator==().

unsigned short Ogre::VertexElement::mSource`[protected]`

| The source vertex buffer, as bound to an index using VertexBufferBinding. Definition at line 120 of file OgreHardwareVertexBuffer.h. Referenced by operator==().

VertexElementType Ogre::VertexElement::mType`[protected]`

| The type of element. Definition at line 124 of file OgreHardwareVertexBuffer.h. Referenced by getSize(), and operator==().

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

- OgreHardwareVertexBuffer.h
- OgreHardwareVertexBuffer.cpp

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