Ogre::SubMesh Class Reference
Core » Resources

Defines a part of a complete mesh. More...

`#include <OgreSubMesh.h>`

Inheritance diagram for Ogre::SubMesh:
[legend]

## Public Types

typedef ConstMapIterator< AliasTextureNamePairList > | AliasTextureIterator
typedef MapIterator< VertexBoneAssignmentList > | BoneAssignmentIterator
typedef vector< unsigned short >::type | IndexMap
| Dedicated index map for translate blend index to bone index (only valid if useSharedVertices = false). More...
typedef vector< IndexData * >::type | LODFaceList
typedef multimap< size_t, VertexBoneAssignment >::type | VertexBoneAssignmentList
| Multimap of verex bone assignments (orders by vertex index) More...

## Public Member Functions

| SubMesh ()
| ~SubMesh ()
void | _compileBoneAssignments (void)
| Must be called once to compile bone assignments into geometry buffer. More...
void | _getRenderOperation (RenderOperation &rend, ushort lodIndex=0)
| Returns a RenderOperation structure required to render this mesh. More...
void | addBoneAssignment (const VertexBoneAssignment &vertBoneAssign)
| Assigns a vertex to a bone with a given weight, for skeletal animation. More...
void | addTextureAlias (const String &aliasName, const String &textureName)
| Adds the alias or replaces an existing one and associates the texture name to it. More...
void | clearBoneAssignments (void)
| Removes all bone assignments for this mesh. More...
SubMesh * | clone (const String &newName, Mesh *parentMesh=0)
| Makes a copy of this submesh object and gives it a new name. More...
void | generateExtremes (size_t count)
| Generate the submesh extremes (. More...
AliasTextureIterator | getAliasTextureIterator (void) const
| Gets an constant iterator to access all texture alias names assigned to this submesh. More...
BoneAssignmentIterator | getBoneAssignmentIterator (void)
| Gets an iterator for access all bone assignments. More...
const VertexBoneAssignmentList & | getBoneAssignments ()
| Gets a const reference to the list of bone assignments. More...
const String & | getMaterialName (void) const
size_t | getTextureAliasCount (void) const
| Gets the number of texture aliases assigned to the sub mesh. More...
bool | getVertexAnimationIncludesNormals () const
| Returns whether animation on dedicated vertex data includes normals. More...
VertexAnimationType | getVertexAnimationType (void) const
| Get the type of any vertex animation used by dedicated geometry. More...
bool | hasTextureAliases (void) const
| returns true if the sub mesh has texture aliases More...
bool | isBuildEdgesEnabled (void) const
| Returns true(by default) if the submesh should be included in the mesh EdgeList, otherwise returns false. More...
bool | isMatInitialised (void) const
| Returns true if a material has been assigned to the submesh, otherwise returns false. More...
void | operator delete (void *ptr)
void | operator delete (void *ptr, void *)
void | operator delete (void *ptr, const char *, int, const char *)
void | operator delete[] (void *ptr)
void | operator delete[] (void *ptr, const char *, int, const char *)
void * | operator new (size_t sz, const char *file, int line, const char *func)
| operator new, with debug line info More...
void * | operator new (size_t sz)
void * | operator new (size_t sz, void *ptr)
| placement operator new More...
void * | operator new[] (size_t sz, const char *file, int line, const char *func)
| array operator new, with debug line info More...
void * | operator new[] (size_t sz)
void | removeAllTextureAliases (void)
| removes all texture aliases from the sub mesh More...
void | removeTextureAlias (const String &aliasName)
| Remove a specific texture alias name from the sub mesh. More...
void | setBuildEdgesEnabled (bool b)
void | setMaterialName (const String &matName, const String &groupName=ResourceGroupManager::AUTODETECT_RESOURCE_GROUP_NAME)
| Sets the name of the Material which this SubMesh will use. More...
bool | updateMaterialUsingTextureAliases (void)
| The current material used by the submesh is copied into a new material and the submesh's texture aliases are applied if the current texture alias names match those found in the original material. More...

## Public Attributes

IndexMap | blendIndexToBoneIndexMap
vector< Vector3 >::type | extremityPoints
| A list of extreme points on the submesh (optional). More...
IndexData * | indexData
| Face index data. More...
LODFaceList | mLodFaceList
RenderOperation::OperationType | operationType
| The render operation type used to render this submesh. More...
Mesh * | parent
| Reference to parent Mesh (not a smart pointer so child does not keep parent alive). More...
bool | useSharedVertices
| Indicates if this submesh shares vertex data with other meshes or whether it has it's own vertices. More...
VertexData * | vertexData
| Dedicated vertex data (only valid if useSharedVertices = false). More...

## Protected Member Functions

void | removeLodLevels (void)
| Internal method for removing LOD data. More...

## Protected Attributes

VertexBoneAssignmentList | mBoneAssignments
bool | mBoneAssignmentsOutOfDate
| Flag indicating that bone assignments need to be recompiled. More...
bool | mBuildEdgesEnabled
| Is Build Edges Enabled. More...
String | mMaterialName
| Name of the material this SubMesh uses. More...
bool | mMatInitialised
| Is there a material yet? More...
AliasTextureNamePairList | mTextureAliases
| paired list of texture aliases and texture names More...
bool | mVertexAnimationIncludesNormals
| Whether normals are included in vertex animation keyframes. More...
VertexAnimationType | mVertexAnimationType
| Type of vertex animation for dedicated vertex data (populated by Mesh) More...

## Friends

class | Mesh
class | MeshSerializerImpl
class | MeshSerializerImpl_v1_1
class | MeshSerializerImpl_v1_2

## Detailed Description

Defines a part of a complete mesh.

Remarks
  Meshes which make up the definition of a discrete 3D object are made up of potentially multiple parts. This is because different parts of the mesh may use different materials or use different vertex formats, such that a rendering state change is required between them.

  Like the Mesh class, instantiations of 3D objects in the scene share the SubMesh instances, and have the option of overriding their material differences on a per-object basis if required. See the SubEntity class for more information.

Definition at line 62 of file OgreSubMesh.h.

## Member Typedef Documentation

## AliasTextureIterator

typedef ConstMapIterator<AliasTextureNamePairList> Ogre::SubMesh::AliasTextureIterator

Definition at line 195 of file OgreSubMesh.h.

## BoneAssignmentIterator

typedef MapIterator<VertexBoneAssignmentList> Ogre::SubMesh::BoneAssignmentIterator

Definition at line 179 of file OgreSubMesh.h.

## IndexMap

typedef vector<unsigned short>::type Ogre::SubMesh::IndexMap

Dedicated index map for translate blend index to bone index (only valid if useSharedVertices = false).

Remarks
  This data is completely owned by this submesh.

  We collect actually used bones of all bone assignments, and build the blend index in 'packed' form, then the range of the blend index in vertex data VES_BLEND_INDICES element is continuous, with no gaps. Thus, by minimising the world matrix array constants passing to GPU, we can support more bones for a mesh when hardware skinning is used. The hardware skinning support limit is applied to each set of vertex data in the mesh, in other words, the hardware skinning support limit is applied only to the actually used bones of each SubMeshes, not all bones across the entire Mesh.

  Because the blend index is different to the bone index, therefore, we use the index map to translate the blend index to bone index.

  The use of shared or non-shared index map is determined when model data is converted to the OGRE .mesh format.

Definition at line 110 of file OgreSubMesh.h.

## LODFaceList

typedef vector<IndexData*>::type Ogre::SubMesh::LODFaceList

Definition at line 113 of file OgreSubMesh.h.

## VertexBoneAssignmentList

typedef multimap<size_t, VertexBoneAssignment>::type Ogre::SubMesh::VertexBoneAssignmentList

Multimap of verex bone assignments (orders by vertex index)

Definition at line 178 of file OgreSubMesh.h.

## Constructor & Destructor Documentation

## SubMesh()

Ogre::SubMesh::SubMesh | ( |  | ) |

## ~SubMesh()

Ogre::SubMesh::~SubMesh | ( |  | ) |

## Member Function Documentation

## _compileBoneAssignments()

void Ogre::SubMesh::_compileBoneAssignments | ( | void |  | ) |

Must be called once to compile bone assignments into geometry buffer.

## _getRenderOperation()

void Ogre::SubMesh::_getRenderOperation | ( | RenderOperation & | rend,
|  | ushort | lodIndex = `0`
| ) |  |

Returns a RenderOperation structure required to render this mesh.

Parameters

  rend | Reference to a RenderOperation structure to populate.
  lodIndex | The index of the LOD to use.

## addBoneAssignment()

void Ogre::SubMesh::addBoneAssignment | ( | const VertexBoneAssignment & | vertBoneAssign | ) |

Assigns a vertex to a bone with a given weight, for skeletal animation.

Remarks
  This method is only valid after calling setSkeletonName. Since this is a one-off process there exists only 'addBoneAssignment' and 'clearBoneAssignments' methods, no 'editBoneAssignment'. You should not need to modify bone assignments during rendering (only the positions of bones) and OGRE reserves the right to do some internal data reformatting of this information, depending on render system requirements.

  This method is for assigning weights to the dedicated geometry of the SubMesh. To assign weights to the shared Mesh geometry, see the equivalent methods on Mesh.

## addTextureAlias()

void Ogre::SubMesh::addTextureAlias | ( | const String & | aliasName,
|  | const String & | textureName
| ) |  |

Adds the alias or replaces an existing one and associates the texture name to it.

Remarks
  The submesh uses the texture alias to replace textures used in the material applied to the submesh.

Parameters

  aliasName | is the name of the alias.
  textureName | is the name of the texture to be associated with the alias

## clearBoneAssignments()

void Ogre::SubMesh::clearBoneAssignments | ( | void |  | ) |

Removes all bone assignments for this mesh.

  This method is for assigning weights to the dedicated geometry of the SubMesh. To assign weights to the shared Mesh geometry, see the equivalent methods on Mesh.

## clone()

SubMesh* Ogre::SubMesh::clone | ( | const String & | newName,
|  | Mesh * | parentMesh = `0`
| ) |  |

Makes a copy of this submesh object and gives it a new name.

Parameters

  newName | The name to give the clone.
  parentMesh | Optional mesh to make the parent of the newly created clone. If you leave this blank, the clone will be parented to the same Mesh as the original.

## generateExtremes()

void Ogre::SubMesh::generateExtremes | ( | size_t | count | ) |

Generate the submesh extremes (.

See also
  extremityPoints).

Parameters

  count | Number of extreme points to compute for the submesh.

## getAliasTextureIterator()

AliasTextureIterator Ogre::SubMesh::getAliasTextureIterator | ( | void |  | ) | const

Gets an constant iterator to access all texture alias names assigned to this submesh.

## getBoneAssignmentIterator()

BoneAssignmentIterator Ogre::SubMesh::getBoneAssignmentIterator | ( | void |  | ) |

Gets an iterator for access all bone assignments.

Remarks
  Only valid if this SubMesh has dedicated geometry.

## getBoneAssignments()

const VertexBoneAssignmentList& Ogre::SubMesh::getBoneAssignments | ( |  | ) |

Gets a const reference to the list of bone assignments.

Definition at line 189 of file OgreSubMesh.h.

## getMaterialName()

const String& Ogre::SubMesh::getMaterialName | ( | void |  | ) | const

## getTextureAliasCount()

size_t Ogre::SubMesh::getTextureAliasCount | ( | void |  | ) | const

Gets the number of texture aliases assigned to the sub mesh.

Definition at line 225 of file OgreSubMesh.h.

## getVertexAnimationIncludesNormals()

bool Ogre::SubMesh::getVertexAnimationIncludesNormals | ( |  | ) | const

Returns whether animation on dedicated vertex data includes normals.

Definition at line 244 of file OgreSubMesh.h.

## getVertexAnimationType()

VertexAnimationType Ogre::SubMesh::getVertexAnimationType | ( | void |  | ) | const

Get the type of any vertex animation used by dedicated geometry.

## hasTextureAliases()

bool Ogre::SubMesh::hasTextureAliases | ( | void |  | ) | const

returns true if the sub mesh has texture aliases

Definition at line 222 of file OgreSubMesh.h.

## isBuildEdgesEnabled()

bool Ogre::SubMesh::isBuildEdgesEnabled | ( | void |  | ) | const

Returns true(by default) if the submesh should be included in the mesh EdgeList, otherwise returns false.

Definition at line 255 of file OgreSubMesh.h.

## isMatInitialised()

bool Ogre::SubMesh::isMatInitialised | ( | void |  | ) | const

Returns true if a material has been assigned to the submesh, otherwise returns false.

## operator delete() [1/3]

template<class Alloc >

void Ogre::AllocatedObject< Alloc >::operator delete | ( | void * | ptr | ) |

inherited

Definition at line 96 of file OgreMemoryAllocatedObject.h.

## operator delete() [2/3]

template<class Alloc >

void Ogre::AllocatedObject< Alloc >::operator delete | ( | void * | ptr,
|  | void * |
| ) |  |

inherited

Definition at line 102 of file OgreMemoryAllocatedObject.h.

## operator delete() [3/3]

template<class Alloc >

void Ogre::AllocatedObject< Alloc >::operator delete | ( | void * | ptr,
|  | const char * | ,
|  | int | ,
|  | const char * |
| ) |  |

inherited

Definition at line 108 of file OgreMemoryAllocatedObject.h.

## operator delete[]() [1/2]

template<class Alloc >

void Ogre::AllocatedObject< Alloc >::operator delete[] | ( | void * | ptr | ) |

inherited

Definition at line 113 of file OgreMemoryAllocatedObject.h.

## operator delete[]() [2/2]

template<class Alloc >

void Ogre::AllocatedObject< Alloc >::operator delete[] | ( | void * | ptr,
|  | const char * | ,
|  | int | ,
|  | const char * |
| ) |  |

inherited

Definition at line 119 of file OgreMemoryAllocatedObject.h.

## operator new() [1/3]

template<class Alloc >

void* Ogre::AllocatedObject< Alloc >::operator new | ( | size_t | sz,
|  | const char * | file,
|  | int | line,
|  | const char * | func
| ) |  |

inherited

operator new, with debug line info

Definition at line 68 of file OgreMemoryAllocatedObject.h.

## operator new() [2/3]

template<class Alloc >

void* Ogre::AllocatedObject< Alloc >::operator new | ( | size_t | sz | ) |

inherited

Definition at line 73 of file OgreMemoryAllocatedObject.h.

## operator new() [3/3]

template<class Alloc >

void* Ogre::AllocatedObject< Alloc >::operator new | ( | size_t | sz,
|  | void * | ptr
| ) |  |

inherited

placement operator new

Definition at line 79 of file OgreMemoryAllocatedObject.h.

## operator new[]() [1/2]

template<class Alloc >

void* Ogre::AllocatedObject< Alloc >::operator new[] | ( | size_t | sz,
|  | const char * | file,
|  | int | line,
|  | const char * | func
| ) |  |

inherited

array operator new, with debug line info

Definition at line 86 of file OgreMemoryAllocatedObject.h.

## operator new[]() [2/2]

template<class Alloc >

void* Ogre::AllocatedObject< Alloc >::operator new[] | ( | size_t | sz | ) |

inherited

Definition at line 91 of file OgreMemoryAllocatedObject.h.

## removeAllTextureAliases()

void Ogre::SubMesh::removeAllTextureAliases | ( | void |  | ) |

removes all texture aliases from the sub mesh

## removeLodLevels()

void Ogre::SubMesh::removeLodLevels | ( | void |  | ) |

protected

Internal method for removing LOD data.

## removeTextureAlias()

void Ogre::SubMesh::removeTextureAlias | ( | const String & | aliasName | ) |

Remove a specific texture alias name from the sub mesh.

Parameters

  aliasName | is the name of the alias to be removed. If it is not found then it is ignored.

## setBuildEdgesEnabled()

void Ogre::SubMesh::setBuildEdgesEnabled | ( | bool | b | ) |

## setMaterialName()

void Ogre::SubMesh::setMaterialName | ( | const String & | matName,
|  | const String & | groupName = `ResourceGroupManager::AUTODETECT_RESOURCE_GROUP_NAME`
| ) |  |

Sets the name of the Material which this SubMesh will use.

## updateMaterialUsingTextureAliases()

bool Ogre::SubMesh::updateMaterialUsingTextureAliases | ( | void |  | ) |

The current material used by the submesh is copied into a new material and the submesh's texture aliases are applied if the current texture alias names match those found in the original material.

Remarks
  The submesh's texture aliases must be setup prior to calling this method. If a new material has to be created, the subMesh autogenerates the new name. The new name is the old name + "_" + number.

Returns
  True if texture aliases were applied and a new material was created.

## Friends And Related Function Documentation

## Mesh

friend class Mesh

friend

Definition at line 64 of file OgreSubMesh.h.

## MeshSerializerImpl

friend class MeshSerializerImpl

friend

Definition at line 65 of file OgreSubMesh.h.

## MeshSerializerImpl_v1_1

friend class MeshSerializerImpl_v1_1

friend

Definition at line 67 of file OgreSubMesh.h.

## MeshSerializerImpl_v1_2

friend class MeshSerializerImpl_v1_2

friend

Definition at line 66 of file OgreSubMesh.h.

## Member Data Documentation

## blendIndexToBoneIndexMap

IndexMap Ogre::SubMesh::blendIndexToBoneIndexMap

Definition at line 111 of file OgreSubMesh.h.

## extremityPoints

vector<Vector3>::type Ogre::SubMesh::extremityPoints

A list of extreme points on the submesh (optional).

Remarks
  These points are some arbitrary points on the mesh that are used by engine to better sort submeshes by depth. This doesn't matter much for non-transparent submeshes, as Z-buffer takes care of invisible surface culling anyway, but is pretty useful for semi-transparent submeshes because the order in which transparent submeshes must be rendered cannot be always correctly deduced from entity position.

  These points are intelligently chosen from the points that make up the submesh, the criteria for choosing them should be that these points somewhat characterize the submesh outline, e.g. they should not be close to each other, and they should be on the outer hull of the submesh. They can be stored in the .mesh file, or generated at runtime (see generateExtremes ()).

  If this array is empty, submesh sorting is done like in older versions - by comparing the positions of the owning entity.

Definition at line 135 of file OgreSubMesh.h.

## indexData

IndexData* Ogre::SubMesh::indexData

Face index data.

Definition at line 89 of file OgreSubMesh.h.

## mBoneAssignments

VertexBoneAssignmentList Ogre::SubMesh::mBoneAssignments

protected

Definition at line 277 of file OgreSubMesh.h.

## mBoneAssignmentsOutOfDate

bool Ogre::SubMesh::mBoneAssignmentsOutOfDate

protected

Flag indicating that bone assignments need to be recompiled.

Definition at line 280 of file OgreSubMesh.h.

## mBuildEdgesEnabled

bool Ogre::SubMesh::mBuildEdgesEnabled

protected

Is Build Edges Enabled.

Definition at line 289 of file OgreSubMesh.h.

## mLodFaceList

LODFaceList Ogre::SubMesh::mLodFaceList

Definition at line 114 of file OgreSubMesh.h.

## mMaterialName

String Ogre::SubMesh::mMaterialName

protected

Name of the material this SubMesh uses.

Definition at line 269 of file OgreSubMesh.h.

## mMatInitialised

bool Ogre::SubMesh::mMatInitialised

protected

Is there a material yet?

Definition at line 272 of file OgreSubMesh.h.

## mTextureAliases

AliasTextureNamePairList Ogre::SubMesh::mTextureAliases

protected

paired list of texture aliases and texture names

Definition at line 275 of file OgreSubMesh.h.

## mVertexAnimationIncludesNormals

bool Ogre::SubMesh::mVertexAnimationIncludesNormals

mutable protected

Whether normals are included in vertex animation keyframes.

Definition at line 286 of file OgreSubMesh.h.

## mVertexAnimationType

VertexAnimationType Ogre::SubMesh::mVertexAnimationType

mutable protected

Type of vertex animation for dedicated vertex data (populated by Mesh)

Definition at line 283 of file OgreSubMesh.h.

## operationType

RenderOperation::OperationType Ogre::SubMesh::operationType

The render operation type used to render this submesh.

Definition at line 77 of file OgreSubMesh.h.

## parent

Mesh* Ogre::SubMesh::parent

Reference to parent Mesh (not a smart pointer so child does not keep parent alive).

Definition at line 138 of file OgreSubMesh.h.

## useSharedVertices

bool Ogre::SubMesh::useSharedVertices

Indicates if this submesh shares vertex data with other meshes or whether it has it's own vertices.

Definition at line 74 of file OgreSubMesh.h.

## vertexData

VertexData* Ogre::SubMesh::vertexData

Dedicated vertex data (only valid if useSharedVertices = false).

Remarks
  This data is completely owned by this submesh.

  The use of shared or non-shared buffers is determined when model data is converted to the OGRE .mesh format.

Definition at line 86 of file OgreSubMesh.h.

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

- OgreSubMesh.h

Copyright © 2012 Torus Knot Software Ltd
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.