OGRE-Next: Ogre::v1::SubMesh Class Reference

| OGRE-Next 3.0.0 Object-Oriented Graphics Rendering Engine

Loading...
Searching...
No Matches
Public Types | Public Member Functions | Public Attributes | List of all members
Ogre::v1::SubMesh Class Reference
Core » Resources

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

`#include <OgreSubMesh.h>`

Inheritance diagram for Ogre::v1::SubMesh:
[legend]

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

## Public Member Functions
| SubMesh ()
| ~SubMesh ()
void | _compileBoneAssignments ()
| Must be called once to compile bone assignments into geometry buffer.
void | _getRenderOperation (RenderOperation &rend, ushort lodIndex, bool casterPass)
| Returns a RenderOperation structure required to render this mesh.
void | addBoneAssignment (const VertexBoneAssignment &vertBoneAssign)
| Assigns a vertex to a bone with a given weight, for skeletal animation.
void | addTextureAlias (const String &aliasName, const String &textureName)
| Adds the alias or replaces an existing one and associates the texture name to it.
void | arrangeEfficient (bool halfPos, bool halfTexCoords, bool qTangents)
void | clearBoneAssignments ()
| Removes all bone assignments for this mesh.
SubMesh * | clone (const String &newName, Mesh *parentMesh=0)
| Makes a copy of this submesh object and gives it a new name.
void | dearrangeToInefficient ()
void | generateExtremes (size_t count)
| Generate the submesh extremes (.
AliasTextureIterator | getAliasTextureIterator () const
| Gets an constant iterator to access all texture alias names assigned to this submesh.
BoneAssignmentIterator | getBoneAssignmentIterator ()
| Gets an iterator for access all bone assignments.
const VertexBoneAssignmentList & | getBoneAssignments ()
| Gets a const reference to the list of bone assignments.
const String & | getMaterialName () const
size_t | getTextureAliasCount () const
| Gets the number of texture aliases assigned to the sub mesh.
bool | getVertexAnimationIncludesNormals () const
| Returns whether animation on dedicated vertex data includes normals.
VertexAnimationType | getVertexAnimationType () const
| Get the type of any vertex animation used by dedicated geometry.
bool | hasTextureAliases () const
| returns true if the sub mesh has texture aliases
void | importFromV2 (Ogre::SubMesh *subMesh)
| Imports a v2 SubMesh.
bool | isBuildEdgesEnabled () const
| Returns true(by default) if the submesh should be included in the mesh EdgeList, otherwise returns false.
bool | isMatInitialised () const
| Returns true if a material has been assigned to the submesh, otherwise returns false.
void | removeAllTextureAliases ()
| removes all texture aliases from the sub mesh
void | removeTextureAlias (const String &aliasName)
| Remove a specific texture alias name from the sub mesh.
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.
bool | updateMaterialUsingTextureAliases ()
| 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.

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

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

## Member Typedef Documentation

## ◆ AliasTextureIterator

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

## ◆ BoneAssignmentIterator

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

## ◆ IndexMap

typedef FastArray<unsigned short> Ogre::v1::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.

## ◆ LODFaceList

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

## ◆ VertexBoneAssignmentList

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

Multimap of verex bone assignments (orders by vertex index)

## Constructor & Destructor Documentation

## ◆ SubMesh()

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

Referenced by clone().

## ◆ ~SubMesh()

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

## Member Function Documentation

## ◆ _compileBoneAssignments()

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

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

## ◆ _getRenderOperation()

void Ogre::v1::SubMesh::_getRenderOperation | ( | RenderOperation & | rend,
|  | ushort | lodIndex,
|  | bool | casterPass )

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

Referenced by Ogre::VerticesRemapInfo::performBoneAssignmentRemap().

## ◆ addTextureAlias()

void Ogre::v1::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

## ◆ arrangeEfficient()

void Ogre::v1::SubMesh::arrangeEfficient | ( | bool | halfPos,
|  | bool | halfTexCoords,
|  | bool | qTangents )

Referenced by dearrangeToInefficient().

## ◆ clearBoneAssignments()

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

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

References SubMesh(), and Mesh.

## ◆ dearrangeToInefficient()

void Ogre::v1::SubMesh::dearrangeToInefficient | ( |  | ) |

References arrangeEfficient().

## ◆ generateExtremes()

void Ogre::v1::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::v1::SubMesh::getAliasTextureIterator | ( |  | ) | const

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

## ◆ getBoneAssignmentIterator()

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

Gets an iterator for access all bone assignments.

Remarks
  Only valid if this SubMesh has dedicated geometry.

## ◆ getBoneAssignments()

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

Gets a const reference to the list of bone assignments.

## ◆ getMaterialName()

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

## ◆ getTextureAliasCount()

size_t Ogre::v1::SubMesh::getTextureAliasCount | ( |  | ) | const
| inline

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

## ◆ getVertexAnimationIncludesNormals()

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

Returns whether animation on dedicated vertex data includes normals.

## ◆ getVertexAnimationType()

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

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

## ◆ hasTextureAliases()

bool Ogre::v1::SubMesh::hasTextureAliases | ( |  | ) | const
| inline

returns true if the sub mesh has texture aliases

## ◆ importFromV2()

void Ogre::v1::SubMesh::importFromV2 | ( | Ogre::SubMesh * | subMesh | ) |

Imports a v2 SubMesh.

See also
  Mesh::importV2.

## ◆ isBuildEdgesEnabled()

bool Ogre::v1::SubMesh::isBuildEdgesEnabled | ( |  | ) | const
| inline

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

## ◆ isMatInitialised()

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

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

## ◆ removeAllTextureAliases()

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

removes all texture aliases from the sub mesh

## ◆ removeTextureAlias()

void Ogre::v1::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::v1::SubMesh::setBuildEdgesEnabled | ( | bool | b | ) |

## ◆ setMaterialName()

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

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

References Ogre::ResourceGroupManager::AUTODETECT_RESOURCE_GROUP_NAME.

## ◆ updateMaterialUsingTextureAliases()

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

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.

## Member Data Documentation

## ◆ blendIndexToBoneIndexMap

IndexMap Ogre::v1::SubMesh::blendIndexToBoneIndexMap

## ◆ extremityPoints

vector<Vector3>::type Ogre::v1::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.

## ◆ indexData

IndexData* Ogre::v1::SubMesh::indexData[NumVertexPass]

Face index data.

Referenced by Ogre::Lod0Stripifier::StripLod0Vertices().

## ◆ mLodFaceList

LODFaceList Ogre::v1::SubMesh::mLodFaceList[NumVertexPass]

Referenced by Ogre::Lod0Stripifier::StripLod0Vertices().

## ◆ operationType

OperationType Ogre::v1::SubMesh::operationType

The render operation type used to render this submesh.

## ◆ parent

Mesh* Ogre::v1::SubMesh::parent

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

## ◆ renderOpMeshIndex

uint32 Ogre::v1::SubMesh::renderOpMeshIndex

## ◆ useSharedVertices

bool Ogre::v1::SubMesh::useSharedVertices

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

Referenced by Ogre::Lod0Stripifier::StripLod0Vertices().

## ◆ vertexData

VertexData* Ogre::v1::SubMesh::vertexData[NumVertexPass]

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

[0] is for the regular pass, [1] is for the caster. Note that vertexData[0] = vertexData[1] is possible, but if one submesh has vertexData[0] = vertexData[1], then all submeshes in the mesh must have vertexData[0] = vertexData[1] as well for the sake of simplicity.

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.

Referenced by Ogre::Lod0Stripifier::StripLod0Vertices().

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

- OgreSubMesh.h