OGRE  1.11.6
Object-Oriented Graphics Rendering Engine
Ogre::Mesh Class Reference

Resource holding data about 3D mesh. More...

#include <OgreMesh.h>

+ Inheritance diagram for Ogre::Mesh:

Public Types

typedef MapIterator< VertexBoneAssignmentListBoneAssignmentIterator
 
typedef ConstVectorIterator< PoseListConstPoseIterator
 
typedef std::vector< unsigned short > IndexMap
 
enum  LoadingFlags {
  LF_DEFAULT = 0, LF_INCLUDE_NON_RELOADABLE = 1, LF_ONLY_UNREFERENCED = 2, LF_ONLY_UNREFERENCED_INCLUDE_NON_RELOADABLE = 3,
  LF_PRESERVE_STATE = 4
}
 Enum that allow to choose subset of unloaded/reloaded resources and to adjust reloading behavior. More...
 
enum  LoadingState {
  LOADSTATE_UNLOADED, LOADSTATE_LOADING, LOADSTATE_LOADED, LOADSTATE_UNLOADING,
  LOADSTATE_PREPARED, LOADSTATE_PREPARING
}
 Enum identifying the loading state of the resource. More...
 
typedef std::vector< RealLodValueList
 
typedef std::vector< MeshLodUsageMeshLodUsageList
 
typedef VectorIterator< PoseListPoseIterator
 
typedef VectorIterator< SubMeshListSubMeshIterator
 
typedef std::vector< SubMesh * > SubMeshList
 
typedef std::unordered_map< String, ushortSubMeshNameMap
 A hashmap used to store optional SubMesh names. More...
 
typedef std::multimap< size_t, VertexBoneAssignmentVertexBoneAssignmentList
 Multimap of vertex bone assignments (orders by vertex index). More...
 

Public Member Functions

 Mesh (ResourceManager *creator, const String &name, ResourceHandle handle, const String &group, bool isManual=false, ManualResourceLoader *loader=0)
 Default constructor - used by MeshManager. More...
 
 ~Mesh ()
 
void _calcBoundsFromVertexBuffer (VertexData *vertexData, AxisAlignedBox &outAABB, Real &outRadius, bool updateOnly=false)
 Calculates. More...
 
void _compileBoneAssignments (void)
 Internal method, be called once to compile bone assignments into geometry buffer. More...
 
void _computeBoneBoundingRadius ()
 Compute the bone bounding radius by looking at the vertices, vertex-bone-assignments, and skeleton bind pose. More...
 
void _determineAnimationTypes (void) const
 Internal method which, if animation types have not been determined, scans any vertex animations and determines the type for each set of vertex data (cannot have 2 different types). More...
 
virtual void _dirtyState ()
 Manually mark the state of this resource as having been changed. More...
 
void _fireLoadingComplete (bool wasBackgroundLoaded)
 Firing of loading complete event. More...
 
void _firePreparingComplete (bool wasBackgroundLoaded)
 Firing of preparing complete event. More...
 
void _fireUnloadingComplete (void)
 Firing of unloading complete event. More...
 
virtual Animation_getAnimationImpl (const String &name) const
 Internal access to the named vertex Animation object - returns null if it does not exist. More...
 
bool _getAnimationTypesDirty (void) const
 Are the derived animation types out of date? More...
 
ushort _getSubMeshIndex (const String &name) const
 Gets the index of a submesh with a given name. More...
 
void _initAnimationState (AnimationStateSet *animSet)
 Initialise an animation set suitable for use with this mesh. More...
 
bool _isManualLodLevel (unsigned short level) const
 Internal methods for loading LOD, do not use. More...
 
void _notifyOrigin (const String &origin)
 Notify this resource of it's origin. More...
 
void _notifySkeleton (SkeletonPtr &pSkel)
 Internal notification, used to tell the Mesh which Skeleton to use without loading it. More...
 
unsigned short _rationaliseBoneAssignments (size_t vertexCount, VertexBoneAssignmentList &assignments)
 Rationalises the passed in bone assignment list. More...
 
void _refreshAnimationState (AnimationStateSet *animSet)
 Refresh an animation set suitable for use with this mesh. More...
 
void _setBoneBoundingRadius (Real radius)
 Manually set the bone bounding radius. More...
 
void _setBoundingSphereRadius (Real radius)
 Manually set the bounding radius. More...
 
void _setBounds (const AxisAlignedBox &bounds, bool pad=true)
 Manually set the bounding box for this Mesh. More...
 
void _setLodInfo (unsigned short numLevels)
 Internal methods for loading LOD, do not use. More...
 
void _setLodUsage (unsigned short level, const MeshLodUsage &usage)
 Internal methods for loading LOD, do not use. More...
 
void _setSubMeshLodFaceList (unsigned short subIdx, unsigned short level, IndexData *facedata)
 Internal methods for loading LOD, do not use. More...
 
void _updateBoundsFromVertexBuffers (bool pad=false)
 Automatically update the bounding radius and bounding box for this Mesh. More...
 
void _updateCompiledBoneAssignments (void)
 Internal method, be called once to update the compiled bone assignments. More...
 
void addBoneAssignment (const VertexBoneAssignment &vertBoneAssign)
 Assigns a vertex to a bone with a given weight, for skeletal animation. More...
 
virtual void addListener (Listener *lis)
 Register a listener on this resource. More...
 
void buildEdgeList (void)
 Builds an edge list for this mesh, which can be used for generating a shadow volume among other things. More...
 
void buildTangentVectors (VertexElementSemantic targetSemantic=VES_TANGENT, unsigned short sourceTexCoordSet=0, unsigned short index=0, bool splitMirrored=false, bool splitRotated=false, bool storeParityInW=false)
 This method builds a set of tangent vectors for a given mesh into a 3D texture coordinate buffer. More...
 
virtual void changeGroupOwnership (const String &newGroup)
 Change the resource group ownership of a Resource. More...
 
void clearBoneAssignments (void)
 Removes all bone assignments for this mesh. More...
 
MeshPtr clone (const String &newName, const String &newGroup=BLANKSTRING)
 Makes a copy of this mesh object and gives it a new name. More...
 
void copyParametersTo (StringInterface *dest) const
 Method for copying this object's parameters to another object. More...
 
virtual AnimationcreateAnimation (const String &name, Real length)
 Creates a new Animation object for vertex animating this mesh. More...
 
PosecreatePose (ushort target, const String &name=BLANKSTRING)
 Create a new Pose for this mesh or one of its submeshes. More...
 
SubMeshcreateSubMesh (void)
 Creates a new SubMesh. More...
 
SubMeshcreateSubMesh (const String &name)
 Creates a new SubMesh and gives it a name. More...
 
void destroySubMesh (unsigned short index)
 Destroy a SubMesh with the given index. More...
 
void destroySubMesh (const String &name)
 Destroy a SubMesh with the given name. More...
 
virtual void escalateLoading ()
 Escalates the loading of a background loaded resource. More...
 
void freeEdgeList (void)
 Destroys and frees the edge lists this mesh has built. More...
 
virtual AnimationgetAnimation (const String &name) const
 Returns the named vertex Animation object. More...
 
virtual AnimationgetAnimation (unsigned short index) const
 Gets a single morph animation by index. More...
 
bool getAutoBuildEdgeLists (void) const
 Sets whether or not this Mesh should automatically build edge lists when asked for them, or whether it should never build them if they are not already provided. More...
 
BoneAssignmentIterator getBoneAssignmentIterator (void)
 Gets an iterator for access all bone assignments. More...
 
const VertexBoneAssignmentListgetBoneAssignments () const
 Gets a const reference to the list of bone assignments. More...
 
Real getBoneBoundingRadius () const
 Gets the radius used to inflate the bounding box around the bones. More...
 
Real getBoundingSphereRadius (void) const
 Gets the radius of the bounding sphere surrounding this mesh. More...
 
const AxisAlignedBoxgetBounds (void) const
 Get the axis-aligned bounding box for this mesh. More...
 
ResourceManagergetCreator (void)
 Gets the manager which created this resource. More...
 
EdgeDatagetEdgeList (unsigned short lodIndex=0)
 Return the edge list for this mesh, building it if required. More...
 
const EdgeDatagetEdgeList (unsigned short lodIndex=0) const
 Return the edge list for this mesh, building it if required. More...
 
virtual const StringgetGroup (void) const
 Gets the group which this resource is a member of. More...
 
virtual ResourceHandle getHandle (void) const
 
HardwareBufferManagerBasegetHardwareBufferManager ()
 
HardwareBuffer::Usage getIndexBufferUsage (void) const
 Gets the usage setting for this meshes index buffers. More...
 
virtual LoadingState getLoadingState () const
 Returns the current loading state. More...
 
ushort getLodIndex (Real value) const
 Retrieves the level of detail index for the given LOD value. More...
 
const MeshLodUsagegetLodLevel (ushort index) const
 Gets details of the numbered level of detail entry. More...
 
const LodStrategygetLodStrategy () const
 Get LOD strategy used by this mesh. More...
 
virtual const StringgetName (void) const
 Gets resource name. More...
 
virtual unsigned short getNumAnimations (void) const
 Gets the number of morph animations in this mesh. More...
 
ushort getNumLodLevels (void) const
 Returns the number of levels of detail that this mesh supports. More...
 
size_t getNumSubMeshes (void) const
 Gets the number of sub meshes which comprise this mesh. More...
 
const StringgetOrigin (void) const
 Get the origin of this resource, e.g. More...
 
ParamDictionarygetParamDictionary (void)
 Retrieves the parameter dictionary for this class. More...
 
const ParamDictionarygetParamDictionary (void) const
 
String getParameter (const String &name) const
 Generic parameter retrieval method. More...
 
const ParameterListgetParameters (void) const
 Retrieves a list of parameters valid for this object. More...
 
PosegetPose (ushort index)
 Retrieve an existing Pose by index. More...
 
PosegetPose (const String &name)
 Retrieve an existing Pose by name. More...
 
size_t getPoseCount (void) const
 Get the number of poses. More...
 
PoseIterator getPoseIterator (void)
 Get an iterator over all the poses defined. More...
 
ConstPoseIterator getPoseIterator (void) const
 Get an iterator over all the poses defined. More...
 
const PoseListgetPoseList (void) const
 Get pose list. More...
 
bool getSharedVertexDataAnimationIncludesNormals () const
 Returns whether animation on shared vertex data includes normals. More...
 
virtual VertexAnimationType getSharedVertexDataAnimationType (void) const
 Gets the type of vertex animation the shared vertex data of this mesh supports. More...
 
virtual size_t getSize (void) const
 Retrieves info about the size of the resource. More...
 
const SkeletonPtrgetSkeleton (void) const
 Gets a pointer to any linked Skeleton. More...
 
const StringgetSkeletonName (void) const
 Gets the name of any linked Skeleton. More...
 
virtual size_t getStateCount () const
 Returns the number of times this resource has changed state, which generally means the number of times it has been loaded. More...
 
SubMeshgetSubMesh (size_t index) const
 Gets a pointer to the submesh indicated by the index. More...
 
SubMeshgetSubMesh (const String &name) const
 Gets a SubMesh by name. More...
 
const SubMeshListgetSubMeshes () const
 Gets the available submeshes. More...
 
SubMeshIterator getSubMeshIterator (void)
 Gets an iterator over the available submeshes. More...
 
const SubMeshNameMapgetSubMeshNameMap (void) const
 Gets a reference to the optional name assignments of the SubMeshes. More...
 
HardwareBuffer::Usage getVertexBufferUsage (void) const
 Gets the usage setting for this meshes vertex buffers. More...
 
VertexDatagetVertexDataByTrackHandle (unsigned short handle)
 Gets a pointer to a vertex data element based on a morph animation track handle. More...
 
virtual bool hasAnimation (const String &name) const
 Returns whether this mesh contains the named vertex animation. More...
 
bool hasManualLodLevel (void) const
 Returns true if this mesh has a manual LOD level. More...
 
bool hasSkeleton (void) const
 Returns true if this Mesh has a linked Skeleton. More...
 
bool hasVertexAnimation (void) const
 Returns whether or not this mesh has some kind of vertex animation. More...
 
virtual bool isBackgroundLoaded (void) const
 Returns whether this Resource has been earmarked for background loading. More...
 
bool isEdgeListBuilt (void) const
 Returns whether this mesh has an attached edge list. More...
 
bool isIndexBufferShadowed (void) const
 Gets whether or not this meshes index buffers are shadowed. More...
 
virtual bool isLoaded (void) const
 Returns true if the Resource has been loaded, false otherwise. More...
 
virtual bool isLoading () const
 Returns whether the resource is currently in the process of background loading. More...
 
virtual bool isManuallyLoaded (void) const
 Is this resource manually loaded? More...
 
virtual bool isPrepared (void) const
 Returns true if the Resource has been prepared, false otherwise. More...
 
bool isPreparedForShadowVolumes (void) const
 Returns whether this mesh has already had it's geometry prepared for use in rendering shadow volumes. More...
 
virtual bool isReloadable (void) const
 Returns true if the Resource is reloadable, false otherwise. More...
 
bool isVertexBufferShadowed (void) const
 Gets whether or not this meshes vertex buffers are shadowed. More...
 
virtual void load (bool backgroundThread=false)
 Loads the resource, if it is not already. More...
 
void mergeAdjacentTexcoords (unsigned short finalTexCoordSet, unsigned short texCoordSetToDestroy)
 This method collapses two texcoords into one for all submeshes where this is possible. More...
 
void nameSubMesh (const String &name, ushort index)
 Gives a name to a SubMesh. More...
 
virtual void prepare (bool backgroundThread=false)
 Prepares the resource for load, if it is not already. More...
 
void prepareForShadowVolume (void)
 This method prepares the mesh for generating a renderable shadow volume. More...
 
void reload (LoadingFlags flags=LF_DEFAULT)
 Reloads the resource, if it is already loaded. More...
 
virtual void removeAllAnimations (void)
 Removes all morph Animations from this mesh. More...
 
void removeAllPoses (void)
 Destroy all poses. More...
 
virtual void removeAnimation (const String &name)
 Removes vertex Animation from this mesh. More...
 
virtual void removeListener (Listener *lis)
 Remove a listener on this resource. More...
 
void removeLodLevels (void)
 Removes all LOD data from this Mesh. More...
 
void removePose (ushort index)
 Destroy a pose by index. More...
 
void removePose (const String &name)
 Destroy a pose by name. More...
 
void setAutoBuildEdgeLists (bool autobuild)
 Sets whether or not this Mesh should automatically build edge lists when asked for them, or whether it should never build them if they are not already provided. More...
 
virtual void setBackgroundLoaded (bool bl)
 Tells the resource whether it is background loaded or not. More...
 
void setHardwareBufferManager (HardwareBufferManagerBase *bufferManager)
 Sets the manager for the vertex and index buffers to be used when loading this Mesh. More...
 
void setIndexBufferPolicy (HardwareBuffer::Usage usage, bool shadowBuffer=false)
 Sets the policy for the index buffers to be used when loading this Mesh. More...
 
void setLodStrategy (LodStrategy *lodStrategy)
 Set the lod strategy used by this mesh. More...
 
bool setParameter (const String &name, const String &value)
 Generic parameter setting method. More...
 
void setParameterList (const NameValuePairList &paramList)
 Generic multiple parameter setting method. More...
 
void setSkeletonName (const String &skelName)
 Sets the name of the skeleton this Mesh uses for animation. More...
 
void setVertexBufferPolicy (HardwareBuffer::Usage usage, bool shadowBuffer=false)
 Sets the policy for the vertex buffers to be used when loading this Mesh. More...
 
bool suggestTangentVectorBuildParams (VertexElementSemantic targetSemantic, unsigned short &outSourceCoordSet, unsigned short &outIndex)
 Ask the mesh to suggest parameters to a future buildTangentVectors call, should you wish to use texture coordinates to store the tangents. More...
 
virtual void touch (void)
 'Touches' the resource to indicate it has been used. More...
 
virtual void unload (void)
 Unloads the resource; this is not permanent, the resource can be reloaded later if required. More...
 
void unnameSubMesh (const String &name)
 Removes a name from a SubMesh. More...
 
void updateManualLodLevel (ushort index, const String &meshName)
 Changes the alternate mesh to use as a manual LOD at the given index. More...
 
void updateMaterialForAllSubMeshes (void)
 Iterates through all submeshes and requests them to apply their texture aliases to the material they use. More...
 

Static Public Member Functions

static void cleanupDictionary ()
 Cleans up the static 'msDictionary' required to reset Ogre, otherwise the containers are left with invalid pointers, which will lead to a crash as soon as one of the ResourceManager implementers (e.g. More...
 
static void prepareMatricesForVertexBlend (const Affine3 **blendMatrices, const Affine3 *boneMatrices, const IndexMap &indexMap)
 Prepare matrices for software indexed vertex blend. More...
 
static void softwareVertexBlend (const VertexData *sourceVertexData, const VertexData *targetVertexData, const Affine3 *const *blendMatrices, size_t numMatrices, bool blendNormals)
 Performs a software indexed vertex blend, of the kind used for skeletal animation although it can be used for other purposes. More...
 
static void softwareVertexMorph (Real t, const HardwareVertexBufferSharedPtr &b1, const HardwareVertexBufferSharedPtr &b2, VertexData *targetVertexData)
 Performs a software vertex morph, of the kind used for morph animation although it can be used for other purposes. More...
 
static void softwareVertexPoseBlend (Real weight, const std::map< size_t, Vector3 > &vertexOffsetMap, const std::map< size_t, Vector3 > &normalsMap, VertexData *targetVertexData)
 Performs a software vertex pose blend, of the kind used for morph animation although it can be used for other purposes. More...
 

Public Attributes

 OGRE_AUTO_MUTEX
 
IndexMap sharedBlendIndexToBoneIndexMap
 Shared index map for translating blend index to bone index. More...
 
VertexDatasharedVertexData
 Shared vertex data. More...
 

Friends

class MeshSerializerImpl
 
class MeshSerializerImpl_v1_1
 
class MeshSerializerImpl_v1_2
 
class MeshSerializerImpl_v1_3
 
class MeshSerializerImpl_v1_4
 
class MeshSerializerImpl_v1_8
 
class SubMesh
 

Detailed Description

Resource holding data about 3D mesh.

Remarks
This class holds the data used to represent a discrete 3-dimensional object. Mesh data usually contains more than just vertices and triangle information; it also includes references to materials (and the faces which use them), level-of-detail reduction information, convex hull definition, skeleton/bones information, keyframe animation etc. However, it is important to note the emphasis on the word 'discrete' here. This class does not cover the large-scale sprawling geometry found in level / landscape data.
Multiple world objects can (indeed should) be created from a single mesh object - see the Entity class for more info. The mesh object will have it's own default material properties, but potentially each world instance may wish to customise the materials from the original. When the object is instantiated into a scene node, the mesh material properties will be taken by default but may be changed. These properties are actually held at the SubMesh level since a single mesh may have parts with different materials.
As described above, because the mesh may have sections of differing material properties, a mesh is inherently a compound construct, consisting of one or more SubMesh objects. However, it strongly 'owns' it's SubMeshes such that they are loaded / unloaded at the same time. This is contrary to the approach taken to hierarchically related (but loosely owned) scene nodes, where data is loaded / unloaded separately. Note also that mesh sub-sections (when used in an instantiated object) share the same scene node as the parent.

Member Typedef Documentation

◆ LodValueList

typedef std::vector<Real> Ogre::Mesh::LodValueList

◆ MeshLodUsageList

◆ VertexBoneAssignmentList

Multimap of vertex bone assignments (orders by vertex index).

◆ BoneAssignmentIterator

◆ SubMeshList

typedef std::vector<SubMesh*> Ogre::Mesh::SubMeshList

◆ IndexMap

typedef std::vector<unsigned short> Ogre::Mesh::IndexMap

◆ SubMeshNameMap

typedef std::unordered_map<String, ushort> Ogre::Mesh::SubMeshNameMap

A hashmap used to store optional SubMesh names.

Translates a name into SubMesh index.

◆ SubMeshIterator

◆ PoseIterator

◆ ConstPoseIterator

Member Enumeration Documentation

◆ LoadingState

Enum identifying the loading state of the resource.

Enumerator
LOADSTATE_UNLOADED 

Not loaded.

LOADSTATE_LOADING 

Loading is in progress.

LOADSTATE_LOADED 

Fully loaded.

LOADSTATE_UNLOADING 

Currently unloading.

LOADSTATE_PREPARED 

Fully prepared.

LOADSTATE_PREPARING 

Preparing is in progress.

◆ LoadingFlags

Enum that allow to choose subset of unloaded/reloaded resources and to adjust reloading behavior.

Enumerator
LF_DEFAULT 

Only reloadable resources are processed, reload restores initial state.

LF_INCLUDE_NON_RELOADABLE 

Process non-reloadable resources too.

LF_ONLY_UNREFERENCED 

Process only resources which are not referenced by any other object. Usefull to reduce resource consumption.

LF_ONLY_UNREFERENCED_INCLUDE_NON_RELOADABLE 

Combination of LF_ONLY_UNREFERENCED and LF_INCLUDE_NON_RELOADABLE.

LF_PRESERVE_STATE 

Preserve some states during reloading, for example stencil shadows prepareness for Meshes.

Constructor & Destructor Documentation

◆ Mesh()

Ogre::Mesh::Mesh ( ResourceManager creator,
const String name,
ResourceHandle  handle,
const String group,
bool  isManual = false,
ManualResourceLoader loader = 0 
)

Default constructor - used by MeshManager.

Warning
Do not call this method directly.

◆ ~Mesh()

Ogre::Mesh::~Mesh ( )

Member Function Documentation

◆ createSubMesh() [1/2]

SubMesh* Ogre::Mesh::createSubMesh ( void  )

Creates a new SubMesh.

Remarks
Method for manually creating geometry for the mesh. Note - use with extreme caution - you must be sure that you have set up the geometry properly.

◆ createSubMesh() [2/2]

SubMesh* Ogre::Mesh::createSubMesh ( const String name)

Creates a new SubMesh and gives it a name.

◆ nameSubMesh()

void Ogre::Mesh::nameSubMesh ( const String name,
ushort  index 
)

Gives a name to a SubMesh.

◆ unnameSubMesh()

void Ogre::Mesh::unnameSubMesh ( const String name)

Removes a name from a SubMesh.

◆ _getSubMeshIndex()

ushort Ogre::Mesh::_getSubMeshIndex ( const String name) const

Gets the index of a submesh with a given name.

Remarks
Useful if you identify the SubMeshes by name (using nameSubMesh) but wish to have faster repeat access.

◆ getNumSubMeshes()

size_t Ogre::Mesh::getNumSubMeshes ( void  ) const
inline

Gets the number of sub meshes which comprise this mesh.

Deprecated:
use getSubMeshes() instead

Referenced by Ogre::Lod0Stripifier::StripLod0Vertices(), and Ogre::Lod0Stripifier::~Lod0Stripifier().

◆ getSubMesh() [1/2]

SubMesh* Ogre::Mesh::getSubMesh ( size_t  index) const
inline

Gets a pointer to the submesh indicated by the index.

Deprecated:
use getSubMeshes() instead

Referenced by Ogre::Lod0Stripifier::StripLod0Vertices(), and Ogre::Lod0Stripifier::~Lod0Stripifier().

◆ getSubMesh() [2/2]

SubMesh* Ogre::Mesh::getSubMesh ( const String name) const

Gets a SubMesh by name.

◆ destroySubMesh() [1/2]

void Ogre::Mesh::destroySubMesh ( unsigned short  index)

Destroy a SubMesh with the given index.

Note
This will invalidate the contents of any existing Entity, or any other object that is referring to the SubMesh list. Entity will detect this and reinitialise, but it is still a disruptive action.

◆ destroySubMesh() [2/2]

void Ogre::Mesh::destroySubMesh ( const String name)

Destroy a SubMesh with the given name.

Note
This will invalidate the contents of any existing Entity, or any other object that is referring to the SubMesh list. Entity will detect this and reinitialise, but it is still a disruptive action.

◆ getSubMeshIterator()

SubMeshIterator Ogre::Mesh::getSubMeshIterator ( void  )
inline

Gets an iterator over the available submeshes.

Deprecated:
use getSubMeshes() instead

◆ getSubMeshes()

const SubMeshList& Ogre::Mesh::getSubMeshes ( ) const
inline

Gets the available submeshes.

◆ clone()

MeshPtr Ogre::Mesh::clone ( const String newName,
const String newGroup = BLANKSTRING 
)

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

Remarks
This is useful if you want to tweak an existing mesh without affecting the original one. The newly cloned mesh is registered with the MeshManager under the new name.
Parameters
newNameThe name to give the clone.
newGroupOptional name of the new group to assign the clone to; if you leave this blank, the clone will be assigned to the same group as this Mesh.

◆ reload()

void Ogre::Mesh::reload ( LoadingFlags  flags = LF_DEFAULT)
virtual

Reloads the resource, if it is already loaded.

Remarks
Calls unload() and then load() again, if the resource is already loaded. If it is not loaded already, then nothing happens.

Reimplemented from Ogre::Resource.

◆ getBounds()

const AxisAlignedBox& Ogre::Mesh::getBounds ( void  ) const

Get the axis-aligned bounding box for this mesh.

◆ getBoundingSphereRadius()

Real Ogre::Mesh::getBoundingSphereRadius ( void  ) const

Gets the radius of the bounding sphere surrounding this mesh.

◆ getBoneBoundingRadius()

Real Ogre::Mesh::getBoneBoundingRadius ( ) const

Gets the radius used to inflate the bounding box around the bones.

◆ _setBounds()

void Ogre::Mesh::_setBounds ( const AxisAlignedBox bounds,
bool  pad = true 
)

Manually set the bounding box for this Mesh.

Remarks
Calling this method is required when building manual meshes now, because OGRE can no longer update the bounds for you, because it cannot necessarily read vertex data back from the vertex buffers which this mesh uses (they very well might be write-only, and even if they are not, reading data from a hardware buffer is a bottleneck).
Parameters
padIf true, a certain padding will be added to the bounding box to separate it from the mesh

◆ _setBoundingSphereRadius()

void Ogre::Mesh::_setBoundingSphereRadius ( Real  radius)

Manually set the bounding radius.

Remarks
Calling this method is required when building manual meshes now, because OGRE can no longer update the bounds for you, because it cannot necessarily read vertex data back from the vertex buffers which this mesh uses (they very well might be write-only, and even if they are not, reading data from a hardware buffer is a bottleneck).

◆ _setBoneBoundingRadius()

void Ogre::Mesh::_setBoneBoundingRadius ( Real  radius)

Manually set the bone bounding radius.

Remarks
This value is normally computed automatically, however it can be overriden with this method.

◆ _computeBoneBoundingRadius()

void Ogre::Mesh::_computeBoneBoundingRadius ( )

Compute the bone bounding radius by looking at the vertices, vertex-bone-assignments, and skeleton bind pose.

Remarks
This is automatically called by Entity if necessary. Only does something if the boneBoundingRadius is zero to begin with. Only works if vertex data is readable (i.e. not WRITE_ONLY).

◆ _updateBoundsFromVertexBuffers()

void Ogre::Mesh::_updateBoundsFromVertexBuffers ( bool  pad = false)

Automatically update the bounding radius and bounding box for this Mesh.

Remarks
Calling this method is required when building manual meshes. However it is recommended to use _setBounds and _setBoundingSphereRadius instead, because the vertex buffer may not have a shadow copy in the memory. Reading back the buffer from video memory is very slow!
Parameters
padIf true, a certain padding will be added to the bounding box to separate it from the mesh

◆ _calcBoundsFromVertexBuffer()

void Ogre::Mesh::_calcBoundsFromVertexBuffer ( VertexData vertexData,
AxisAlignedBox outAABB,
Real outRadius,
bool  updateOnly = false 
)

Calculates.

Remarks
Calling this method is required when building manual meshes. However it is recommended to use _setBounds and _setBoundingSphereRadius instead, because the vertex buffer may not have a shadow copy in the memory. Reading back the buffer from video memory is very slow!

◆ setSkeletonName()

void Ogre::Mesh::setSkeletonName ( const String skelName)

Sets the name of the skeleton this Mesh uses for animation.

Remarks
Meshes can optionally be assigned a skeleton which can be used to animate the mesh through bone assignments. The default is for the Mesh to use no skeleton. Calling this method with a valid skeleton filename will cause the skeleton to be loaded if it is not already (a single skeleton can be shared by many Mesh objects).
Parameters
skelNameThe name of the .skeleton file to use, or an empty string to use no skeleton

◆ hasSkeleton()

bool Ogre::Mesh::hasSkeleton ( void  ) const

Returns true if this Mesh has a linked Skeleton.

◆ hasVertexAnimation()

bool Ogre::Mesh::hasVertexAnimation ( void  ) const

Returns whether or not this mesh has some kind of vertex animation.

◆ getSkeleton()

const SkeletonPtr& Ogre::Mesh::getSkeleton ( void  ) const

Gets a pointer to any linked Skeleton.

Returns
Weak reference to the skeleton - copy this if you want to hold a strong pointer.

◆ getSkeletonName()

const String& Ogre::Mesh::getSkeletonName ( void  ) const

Gets the name of any linked Skeleton.

◆ _initAnimationState()

void Ogre::Mesh::_initAnimationState ( AnimationStateSet animSet)

Initialise an animation set suitable for use with this mesh.

Remarks
Only recommended for use inside the engine, not by applications.

◆ _refreshAnimationState()

void Ogre::Mesh::_refreshAnimationState ( AnimationStateSet animSet)

Refresh an animation set suitable for use with this mesh.

Remarks
Only recommended for use inside the engine, not by applications.

◆ addBoneAssignment()

void Ogre::Mesh::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 shared geometry of the Mesh. To assign weights to the per-SubMesh geometry, see the equivalent methods on SubMesh.

◆ clearBoneAssignments()

void Ogre::Mesh::clearBoneAssignments ( void  )

Removes all bone assignments for this mesh.

Remarks
This method is for modifying weights to the shared geometry of the Mesh. To assign weights to the per-SubMesh geometry, see the equivalent methods on SubMesh.

◆ _notifySkeleton()

void Ogre::Mesh::_notifySkeleton ( SkeletonPtr pSkel)

Internal notification, used to tell the Mesh which Skeleton to use without loading it.

Remarks
This is only here for unusual situation where you want to manually set up a Skeleton. Best to let OGRE deal with this, don't call it yourself unless you really know what you're doing.

◆ getBoneAssignmentIterator()

BoneAssignmentIterator Ogre::Mesh::getBoneAssignmentIterator ( void  )

Gets an iterator for access all bone assignments.

◆ getBoneAssignments()

const VertexBoneAssignmentList& Ogre::Mesh::getBoneAssignments ( ) const
inline

Gets a const reference to the list of bone assignments.

◆ getNumLodLevels()

ushort Ogre::Mesh::getNumLodLevels ( void  ) const

Returns the number of levels of detail that this mesh supports.

Remarks
This number includes the original model.

Referenced by Ogre::Lod0Stripifier::StripLod0Vertices(), and Ogre::Lod0Stripifier::~Lod0Stripifier().

◆ getLodLevel()

const MeshLodUsage& Ogre::Mesh::getLodLevel ( ushort  index) const

Gets details of the numbered level of detail entry.

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

◆ getLodIndex()

ushort Ogre::Mesh::getLodIndex ( Real  value) const

Retrieves the level of detail index for the given LOD value.

Note
The value passed in is the 'transformed' value. If you are dealing with an original source value (e.g. distance), use LodStrategy::transformUserValue to turn this into a lookup value.

◆ hasManualLodLevel()

bool Ogre::Mesh::hasManualLodLevel ( void  ) const
inline

Returns true if this mesh has a manual LOD level.

Remarks
A mesh can either use automatically generated LOD, or it can use alternative meshes as provided by an artist.

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

◆ updateManualLodLevel()

void Ogre::Mesh::updateManualLodLevel ( ushort  index,
const String meshName 
)

Changes the alternate mesh to use as a manual LOD at the given index.

Remarks
Note that the index of a LOD may change if you insert other LODs. If in doubt, use getLodIndex().
Parameters
indexThe index of the level to be changed.
meshNameThe name of the mesh which will be the lower level detail version.

◆ _setLodInfo()

void Ogre::Mesh::_setLodInfo ( unsigned short  numLevels)

Internal methods for loading LOD, do not use.

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

◆ _setLodUsage()

void Ogre::Mesh::_setLodUsage ( unsigned short  level,
const MeshLodUsage usage 
)

Internal methods for loading LOD, do not use.

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

◆ _setSubMeshLodFaceList()

void Ogre::Mesh::_setSubMeshLodFaceList ( unsigned short  subIdx,
unsigned short  level,
IndexData facedata 
)

Internal methods for loading LOD, do not use.

◆ _isManualLodLevel()

bool Ogre::Mesh::_isManualLodLevel ( unsigned short  level) const

Internal methods for loading LOD, do not use.

◆ removeLodLevels()

void Ogre::Mesh::removeLodLevels ( void  )

Removes all LOD data from this Mesh.

◆ setHardwareBufferManager()

void Ogre::Mesh::setHardwareBufferManager ( HardwareBufferManagerBase bufferManager)
inline

Sets the manager for the vertex and index buffers to be used when loading this Mesh.

Remarks
By default, when loading the Mesh, static, write-only vertex and index buffers will be used where possible in order to improve rendering performance. However, such buffers cannot be manipulated on the fly by CPU code (although shader code can). If you wish to use the CPU to modify these buffers and will never use it with GPU, you should call this method. Note, however, that it only takes effect after the Mesh has been reloaded. Note that you still have the option of manually repacing the buffers in this mesh with your own if you see fit too, in which case you don't need to call this method since it only affects buffers created by the mesh itself.
You can define the approach to a Mesh by changing the default parameters to MeshManager::load if you wish; this means the Mesh is loaded with those options the first time instead of you having to reload the mesh after changing these options.
Parameters
bufferManagerIf set to DefaultHardwareBufferManager, the buffers will be created in system memory only, without hardware counterparts. Such mesh could not be rendered, but LODs could be generated for such mesh, it could be cloned, transformed and serialized.

◆ getHardwareBufferManager()

HardwareBufferManagerBase* Ogre::Mesh::getHardwareBufferManager ( )

◆ setVertexBufferPolicy()

void Ogre::Mesh::setVertexBufferPolicy ( HardwareBuffer::Usage  usage,
bool  shadowBuffer = false 
)

Sets the policy for the vertex buffers to be used when loading this Mesh.

Remarks
By default, when loading the Mesh, static, write-only vertex and index buffers will be used where possible in order to improve rendering performance. However, such buffers cannot be manipulated on the fly by CPU code (although shader code can). If you wish to use the CPU to modify these buffers, you should call this method. Note, however, that it only takes effect after the Mesh has been reloaded. Note that you still have the option of manually repacing the buffers in this mesh with your own if you see fit too, in which case you don't need to call this method since it only affects buffers created by the mesh itself.
You can define the approach to a Mesh by changing the default parameters to MeshManager::load if you wish; this means the Mesh is loaded with those options the first time instead of you having to reload the mesh after changing these options.
Parameters
usageThe usage flags, which by default are HardwareBuffer::HBU_STATIC_WRITE_ONLY
shadowBufferIf set to true, the vertex buffers will be created with a system memory shadow buffer. You should set this if you want to be able to read from the buffer, because reading from a hardware buffer is a no-no.

◆ setIndexBufferPolicy()

void Ogre::Mesh::setIndexBufferPolicy ( HardwareBuffer::Usage  usage,
bool  shadowBuffer = false 
)

Sets the policy for the index buffers to be used when loading this Mesh.

Remarks
By default, when loading the Mesh, static, write-only vertex and index buffers will be used where possible in order to improve rendering performance. However, such buffers cannot be manipulated on the fly by CPU code (although shader code can). If you wish to use the CPU to modify these buffers, you should call this method. Note, however, that it only takes effect after the Mesh has been reloaded. Note that you still have the option of manually repacing the buffers in this mesh with your own if you see fit too, in which case you don't need to call this method since it only affects buffers created by the mesh itself.
You can define the approach to a Mesh by changing the default parameters to MeshManager::load if you wish; this means the Mesh is loaded with those options the first time instead of you having to reload the mesh after changing these options.
Parameters
usageThe usage flags, which by default are HardwareBuffer::HBU_STATIC_WRITE_ONLY
shadowBufferIf set to true, the index buffers will be created with a system memory shadow buffer. You should set this if you want to be able to read from the buffer, because reading from a hardware buffer is a no-no.

◆ getVertexBufferUsage()

HardwareBuffer::Usage Ogre::Mesh::getVertexBufferUsage ( void  ) const
inline

Gets the usage setting for this meshes vertex buffers.

◆ getIndexBufferUsage()

HardwareBuffer::Usage Ogre::Mesh::getIndexBufferUsage ( void  ) const
inline

Gets the usage setting for this meshes index buffers.

◆ isVertexBufferShadowed()

bool Ogre::Mesh::isVertexBufferShadowed ( void  ) const
inline

Gets whether or not this meshes vertex buffers are shadowed.

◆ isIndexBufferShadowed()

bool Ogre::Mesh::isIndexBufferShadowed ( void  ) const
inline

Gets whether or not this meshes index buffers are shadowed.

References Ogre::VES_TANGENT.

◆ _rationaliseBoneAssignments()

unsigned short Ogre::Mesh::_rationaliseBoneAssignments ( size_t  vertexCount,
VertexBoneAssignmentList assignments 
)

Rationalises the passed in bone assignment list.

Remarks
OGRE supports up to 4 bone assignments per vertex. The reason for this limit is that this is the maximum number of assignments that can be passed into a hardware-assisted blending algorithm. This method identifies where there are more than 4 bone assignments for a given vertex, and eliminates the bone assignments with the lowest weights to reduce to this limit. The remaining weights are then re-balanced to ensure that they sum to 1.0.
Parameters
vertexCountThe number of vertices.
assignmentsThe bone assignment list to rationalise. This list will be modified and entries will be removed where the limits are exceeded.
Returns
The maximum number of bone assignments per vertex found, clamped to [1-4]

◆ _compileBoneAssignments()

void Ogre::Mesh::_compileBoneAssignments ( void  )

Internal method, be called once to compile bone assignments into geometry buffer.

Remarks
The OGRE engine calls this method automatically. It compiles the information submitted as bone assignments into a format usable in realtime. It also eliminates excessive bone assignments (max is OGRE_MAX_BLEND_WEIGHTS) and re-normalises the remaining assignments.

◆ _updateCompiledBoneAssignments()

void Ogre::Mesh::_updateCompiledBoneAssignments ( void  )

Internal method, be called once to update the compiled bone assignments.

Remarks
The OGRE engine calls this method automatically. It updates the compiled bone assignments if requested.

◆ mergeAdjacentTexcoords()

void Ogre::Mesh::mergeAdjacentTexcoords ( unsigned short  finalTexCoordSet,
unsigned short  texCoordSetToDestroy 
)

This method collapses two texcoords into one for all submeshes where this is possible.

Remarks
Often a submesh can have two tex. coords. (i.e. TEXCOORD0 & TEXCOORD1), being both composed of two floats. There are many practical reasons why it would be more convenient to merge both of them into one TEXCOORD0 of 4 floats. This function does exactly that The finalTexCoordSet must have enough space for the merge, or else the submesh will be skipped. (i.e. you can't merge a tex. coord with 3 floats with one having 2 floats)

finalTexCoordSet & texCoordSetToDestroy must be in the same buffer source, and must be adjacent.

Parameters
finalTexCoordSetThe tex. coord index to merge to. Should have enough space to actually work.
texCoordSetToDestroyThe texture coordinate index that will disappear on successful merges.

◆ buildTangentVectors()

void Ogre::Mesh::buildTangentVectors ( VertexElementSemantic  targetSemantic = VES_TANGENT,
unsigned short  sourceTexCoordSet = 0,
unsigned short  index = 0,
bool  splitMirrored = false,
bool  splitRotated = false,
bool  storeParityInW = false 
)

This method builds a set of tangent vectors for a given mesh into a 3D texture coordinate buffer.

Remarks
Tangent vectors are vectors representing the local 'X' axis for a given vertex based on the orientation of the 2D texture on the geometry. They are built from a combination of existing normals, and from the 2D texture coordinates already baked into the model. They can be used for a number of things, but most of all they are useful for vertex and fragment programs, when you wish to arrive at a common space for doing per-pixel calculations.
The prerequisites for calling this method include that the vertex data used by every SubMesh has both vertex normals and 2D texture coordinates.
Parameters
targetSemanticThe semantic to store the tangents in. Defaults to the explicit tangent binding, but note that this is only usable on more modern hardware (Shader Model 2), so if you need portability with older cards you should change this to a texture coordinate binding instead.
sourceTexCoordSetThe texture coordinate index which should be used as the source of 2D texture coordinates, with which to calculate the tangents.
indexThe element index, ie the texture coordinate set which should be used to store the 3D coordinates representing a tangent vector per vertex, if targetSemantic is VES_TEXTURE_COORDINATES. If this already exists, it will be overwritten.
splitMirroredSets whether or not to split vertices when a mirrored tangent space transition is detected (matrix parity differs).
See also
TangentSpaceCalc::setSplitMirrored
Parameters
splitRotatedSets whether or not to split vertices when a rotated tangent space is detected.
See also
TangentSpaceCalc::setSplitRotated
Parameters
storeParityInWIf true, store tangents as a 4-vector and include parity in w.

◆ suggestTangentVectorBuildParams()

bool Ogre::Mesh::suggestTangentVectorBuildParams ( VertexElementSemantic  targetSemantic,
unsigned short &  outSourceCoordSet,
unsigned short &  outIndex 
)

Ask the mesh to suggest parameters to a future buildTangentVectors call, should you wish to use texture coordinates to store the tangents.

Remarks
This helper method will suggest source and destination texture coordinate sets for a call to buildTangentVectors. It will detect when there are inappropriate conditions (such as multiple geometry sets which don't agree). Moreover, it will return 'true' if it detects that there are aleady 3D coordinates in the mesh, and therefore tangents may have been prepared already.
Parameters
targetSemanticThe semantic you intend to use to store the tangents if they are not already present; most likely options are VES_TEXTURE_COORDINATES or VES_TANGENT; you should use texture coordinates if you want compatibility with older, pre-SM2 graphics cards, and the tangent binding otherwise.
outSourceCoordSetReference to a source texture coordinate set which will be populated.
outIndexReference to a destination element index (e.g. texture coord set) which will be populated

◆ buildEdgeList()

void Ogre::Mesh::buildEdgeList ( void  )

Builds an edge list for this mesh, which can be used for generating a shadow volume among other things.

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

◆ freeEdgeList()

void Ogre::Mesh::freeEdgeList ( void  )

Destroys and frees the edge lists this mesh has built.

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

◆ prepareForShadowVolume()

void Ogre::Mesh::prepareForShadowVolume ( void  )

This method prepares the mesh for generating a renderable shadow volume.

Remarks
Preparing a mesh to generate a shadow volume involves firstly ensuring that the vertex buffer containing the positions for the mesh is a standalone vertex buffer, with no other components in it. This method will therefore break apart any existing vertex buffers this mesh holds if position is sharing a vertex buffer. Secondly, it will double the size of this vertex buffer so that there are 2 copies of the position data for the mesh. The first half is used for the original, and the second half is used for the 'extruded' version of the mesh. The vertex count of the main VertexData used to render the mesh will remain the same though, so as not to add any overhead to regular rendering of the object. Both copies of the position are required in one buffer because shadow volumes stretch from the original mesh to the extruded version.
Because shadow volumes are rendered in turn, no additional index buffer space is allocated by this method, a shared index buffer allocated by the shadow rendering algorithm is used for addressing this extended vertex buffer.

◆ getEdgeList() [1/2]

EdgeData* Ogre::Mesh::getEdgeList ( unsigned short  lodIndex = 0)

Return the edge list for this mesh, building it if required.

Remarks
You must ensure that the Mesh as been prepared for shadow volume rendering if you intend to use this information for that purpose.
Parameters
lodIndexThe LOD at which to get the edge list, 0 being the highest.

◆ getEdgeList() [2/2]

const EdgeData* Ogre::Mesh::getEdgeList ( unsigned short  lodIndex = 0) const

Return the edge list for this mesh, building it if required.

Remarks
You must ensure that the Mesh as been prepared for shadow volume rendering if you intend to use this information for that purpose.
Parameters
lodIndexThe LOD at which to get the edge list, 0 being the highest.

◆ isPreparedForShadowVolumes()

bool Ogre::Mesh::isPreparedForShadowVolumes ( void  ) const
inline

Returns whether this mesh has already had it's geometry prepared for use in rendering shadow volumes.

◆ isEdgeListBuilt()

bool Ogre::Mesh::isEdgeListBuilt ( void  ) const
inline

Returns whether this mesh has an attached edge list.

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

◆ prepareMatricesForVertexBlend()

static void Ogre::Mesh::prepareMatricesForVertexBlend ( const Affine3 **  blendMatrices,
const Affine3 boneMatrices,
const IndexMap indexMap 
)
static

Prepare matrices for software indexed vertex blend.

Remarks
This function organise bone indexed matrices to blend indexed matrices, so software vertex blending can access to the matrix via blend index directly.
Parameters
blendMatricesPointer to an array of matrix pointers to store prepared results, which indexed by blend index.
boneMatricesPointer to an array of matrices to be used to blend, which indexed by bone index.
indexMapThe index map used to translate blend index to bone index.

◆ softwareVertexBlend()

static void Ogre::Mesh::softwareVertexBlend ( const VertexData sourceVertexData,
const VertexData targetVertexData,
const Affine3 *const *  blendMatrices,
size_t  numMatrices,
bool  blendNormals 
)
static

Performs a software indexed vertex blend, of the kind used for skeletal animation although it can be used for other purposes.

Remarks
This function is supplied to update vertex data with blends done in software, either because no hardware support is available, or that you need the results of the blend for some other CPU operations.
Parameters
sourceVertexDataVertexData class containing positions, normals, blend indices and blend weights.
targetVertexDataVertexData class containing target position and normal buffers which will be updated with the blended versions. Note that the layout of the source and target position / normal buffers must be identical, ie they must use the same buffer indexes
blendMatricesPointer to an array of matrix pointers to be used to blend, indexed by blend indices in the sourceVertexData
numMatricesNumber of matrices in the blendMatrices, it might be used as a hint for optimisation.
blendNormalsIf true, normals are blended as well as positions.

◆ softwareVertexMorph()

static void Ogre::Mesh::softwareVertexMorph ( Real  t,
const HardwareVertexBufferSharedPtr b1,
const HardwareVertexBufferSharedPtr b2,
VertexData targetVertexData 
)
static

Performs a software vertex morph, of the kind used for morph animation although it can be used for other purposes.

Remarks
This function will linearly interpolate positions between two source buffers, into a third buffer.
Parameters
tParametric distance between the start and end buffer positions.
b1Vertex buffer containing VET_FLOAT3 entries for the start positions.
b2Vertex buffer containing VET_FLOAT3 entries for the end positions.
targetVertexDataVertexData destination; assumed to have a separate position buffer already bound, and the number of vertices must agree with the number in start and end

◆ softwareVertexPoseBlend()

static void Ogre::Mesh::softwareVertexPoseBlend ( Real  weight,
const std::map< size_t, Vector3 > &  vertexOffsetMap,
const std::map< size_t, Vector3 > &  normalsMap,
VertexData targetVertexData 
)
static

Performs a software vertex pose blend, of the kind used for morph animation although it can be used for other purposes.

Remarks
This function will apply a weighted offset to the positions in the incoming vertex data (therefore this is a read/write operation, and if you expect to call it more than once with the same data, then you would be best to suppress hardware uploads of the position buffer for the duration).
Parameters
weightParametric weight to scale the offsets by.
vertexOffsetMapPotentially sparse map of vertex index -> offset.
normalsMapPotentially sparse map of vertex index -> normal.
targetVertexDataVertexData destination; assumed to have a separate position buffer already bound, and the number of vertices must agree with the number in start and end.

◆ getSubMeshNameMap()

const SubMeshNameMap& Ogre::Mesh::getSubMeshNameMap ( void  ) const
inline

Gets a reference to the optional name assignments of the SubMeshes.

◆ setAutoBuildEdgeLists()

void Ogre::Mesh::setAutoBuildEdgeLists ( bool  autobuild)
inline

Sets whether or not this Mesh should automatically build edge lists when asked for them, or whether it should never build them if they are not already provided.

Remarks
This allows you to create meshes which do not have edge lists calculated, because you never want to use them. This value defaults to 'true' for mesh formats which did not include edge data, and 'false' for newer formats, where edge lists are expected to have been generated in advance.

◆ getAutoBuildEdgeLists()

bool Ogre::Mesh::getAutoBuildEdgeLists ( void  ) const
inline

Sets whether or not this Mesh should automatically build edge lists when asked for them, or whether it should never build them if they are not already provided.

◆ getSharedVertexDataAnimationType()

virtual VertexAnimationType Ogre::Mesh::getSharedVertexDataAnimationType ( void  ) const
virtual

Gets the type of vertex animation the shared vertex data of this mesh supports.

◆ getSharedVertexDataAnimationIncludesNormals()

bool Ogre::Mesh::getSharedVertexDataAnimationIncludesNormals ( ) const
inline

Returns whether animation on shared vertex data includes normals.

◆ createAnimation()

virtual Animation* Ogre::Mesh::createAnimation ( const String name,
Real  length 
)
virtual

Creates a new Animation object for vertex animating this mesh.

Parameters
nameThe name of this animation.
lengthThe length of the animation in seconds.

Implements Ogre::AnimationContainer.

◆ getAnimation() [1/2]

virtual Animation* Ogre::Mesh::getAnimation ( const String name) const
virtual

Returns the named vertex Animation object.

Parameters
nameThe name of the animation.

Implements Ogre::AnimationContainer.

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

◆ _getAnimationImpl()

virtual Animation* Ogre::Mesh::_getAnimationImpl ( const String name) const
virtual

Internal access to the named vertex Animation object - returns null if it does not exist.

Parameters
nameThe name of the animation.

◆ hasAnimation()

virtual bool Ogre::Mesh::hasAnimation ( const String name) const
virtual

Returns whether this mesh contains the named vertex animation.

Implements Ogre::AnimationContainer.

◆ removeAnimation()

virtual void Ogre::Mesh::removeAnimation ( const String name)
virtual

Removes vertex Animation from this mesh.

Implements Ogre::AnimationContainer.

◆ getNumAnimations()

virtual unsigned short Ogre::Mesh::getNumAnimations ( void  ) const
virtual

Gets the number of morph animations in this mesh.

Implements Ogre::AnimationContainer.

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

◆ getAnimation() [2/2]

virtual Animation* Ogre::Mesh::getAnimation ( unsigned short  index) const
virtual

Gets a single morph animation by index.

Implements Ogre::AnimationContainer.

◆ removeAllAnimations()

virtual void Ogre::Mesh::removeAllAnimations ( void  )
virtual

Removes all morph Animations from this mesh.

◆ getVertexDataByTrackHandle()

VertexData* Ogre::Mesh::getVertexDataByTrackHandle ( unsigned short  handle)

Gets a pointer to a vertex data element based on a morph animation track handle.

Remarks
0 means the shared vertex data, 1+ means a submesh vertex data (index+1)

◆ updateMaterialForAllSubMeshes()

void Ogre::Mesh::updateMaterialForAllSubMeshes ( void  )

Iterates through all submeshes and requests them to apply their texture aliases to the material they use.

Remarks
The submesh will only apply texture aliases to the material if matching texture alias names are found in the material. If a match is found, the submesh will automatically clone the original material and then apply its texture to the new material.
This method is normally called by the protected method loadImpl when a mesh if first loaded.

◆ _determineAnimationTypes()

void Ogre::Mesh::_determineAnimationTypes ( void  ) const

Internal method which, if animation types have not been determined, scans any vertex animations and determines the type for each set of vertex data (cannot have 2 different types).

◆ _getAnimationTypesDirty()

bool Ogre::Mesh::_getAnimationTypesDirty ( void  ) const
inline

Are the derived animation types out of date?

References Ogre::BLANKSTRING.

◆ createPose()

Pose* Ogre::Mesh::createPose ( ushort  target,
const String name = BLANKSTRING 
)

Create a new Pose for this mesh or one of its submeshes.

Parameters
targetThe target geometry index; 0 is the shared Mesh geometry, 1+ is the dedicated SubMesh geometry belonging to submesh index + 1.
nameName to give the pose, which is optional.
Returns
A new Pose ready for population.

◆ getPoseCount()

size_t Ogre::Mesh::getPoseCount ( void  ) const
inline

Get the number of poses.

Deprecated:
use getPoseList()

◆ getPose() [1/2]

Pose* Ogre::Mesh::getPose ( ushort  index)

Retrieve an existing Pose by index.

Deprecated:
use getPoseList()

◆ getPose() [2/2]

Pose* Ogre::Mesh::getPose ( const String name)

Retrieve an existing Pose by name.

◆ removePose() [1/2]

void Ogre::Mesh::removePose ( ushort  index)

Destroy a pose by index.

Note
This will invalidate any animation tracks referring to this pose or those after it.

◆ removePose() [2/2]

void Ogre::Mesh::removePose ( const String name)

Destroy a pose by name.

Note
This will invalidate any animation tracks referring to this pose or those after it.

◆ removeAllPoses()

void Ogre::Mesh::removeAllPoses ( void  )

Destroy all poses.

◆ getPoseIterator() [1/2]

PoseIterator Ogre::Mesh::getPoseIterator ( void  )

Get an iterator over all the poses defined.

Deprecated:
use getPoseList()

◆ getPoseIterator() [2/2]

ConstPoseIterator Ogre::Mesh::getPoseIterator ( void  ) const

Get an iterator over all the poses defined.

Deprecated:
use getPoseList()

◆ getPoseList()

const PoseList& Ogre::Mesh::getPoseList ( void  ) const

Get pose list.

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

◆ getLodStrategy()

const LodStrategy* Ogre::Mesh::getLodStrategy ( ) const

Get LOD strategy used by this mesh.

◆ setLodStrategy()

void Ogre::Mesh::setLodStrategy ( LodStrategy lodStrategy)

Set the lod strategy used by this mesh.

◆ prepare()

virtual void Ogre::Resource::prepare ( bool  backgroundThread = false)
virtualinherited

Prepares the resource for load, if it is not already.

One can call prepare() before load(), but this is not required as load() will call prepare() itself, if needed. When OGRE_THREAD_SUPPORT==1 both load() and prepare() are thread-safe. When OGRE_THREAD_SUPPORT==2 however, only prepare() is thread-safe. The reason for this function is to allow a background thread to do some of the loading work, without requiring the whole render system to be thread-safe. The background thread would call prepare() while the main render loop would later call load(). So long as prepare() remains thread-safe, subclasses can arbitrarily split the work of loading a resource between load() and prepare(). It is best to try and do as much work in prepare(), however, since this will leave less work for the main render thread to do and thus increase FPS.

Parameters
backgroundThreadWhether this is occurring in a background thread

◆ load()

virtual void Ogre::Resource::load ( bool  backgroundThread = false)
virtualinherited

Loads the resource, if it is not already.

Remarks
If the resource is loaded from a file, loading is automatic. If not, if for example this resource gained it's data from procedural calls rather than loading from a file, then this resource will not reload on it's own.
Parameters
backgroundThreadIndicates whether the caller of this method is the background resource loading thread.

Reimplemented in Ogre::UnifiedHighLevelGpuProgram.

◆ isReloadable()

virtual bool Ogre::Resource::isReloadable ( void  ) const
inlinevirtualinherited

Returns true if the Resource is reloadable, false otherwise.

Reimplemented in Ogre::UnifiedHighLevelGpuProgram.

◆ isManuallyLoaded()

virtual bool Ogre::Resource::isManuallyLoaded ( void  ) const
inlinevirtualinherited

Is this resource manually loaded?

◆ unload()

virtual void Ogre::Resource::unload ( void  )
virtualinherited

Unloads the resource; this is not permanent, the resource can be reloaded later if required.

Reimplemented in Ogre::UnifiedHighLevelGpuProgram.

◆ getSize()

virtual size_t Ogre::Resource::getSize ( void  ) const
inlinevirtualinherited

Retrieves info about the size of the resource.

Reimplemented in Ogre::CgProgram, and Ogre::UnifiedHighLevelGpuProgram.

◆ touch()

virtual void Ogre::Resource::touch ( void  )
virtualinherited

'Touches' the resource to indicate it has been used.

Reimplemented in Ogre::Material, Ogre::CgProgram, and Ogre::UnifiedHighLevelGpuProgram.

Referenced by Ogre::Material::touch().

◆ getName()

virtual const String& Ogre::Resource::getName ( void  ) const
inlinevirtualinherited

◆ getHandle()

virtual ResourceHandle Ogre::Resource::getHandle ( void  ) const
inlinevirtualinherited

Reimplemented in Ogre::SkeletonInstance.

◆ isPrepared()

virtual bool Ogre::Resource::isPrepared ( void  ) const
inlinevirtualinherited

Returns true if the Resource has been prepared, false otherwise.

◆ isLoaded()

virtual bool Ogre::Resource::isLoaded ( void  ) const
inlinevirtualinherited

Returns true if the Resource has been loaded, false otherwise.

Reimplemented in Ogre::UnifiedHighLevelGpuProgram.

◆ isLoading()

virtual bool Ogre::Resource::isLoading ( ) const
inlinevirtualinherited

Returns whether the resource is currently in the process of background loading.

Reimplemented in Ogre::UnifiedHighLevelGpuProgram.

◆ getLoadingState()

virtual LoadingState Ogre::Resource::getLoadingState ( ) const
inlinevirtualinherited

Returns the current loading state.

Reimplemented in Ogre::UnifiedHighLevelGpuProgram.

◆ isBackgroundLoaded()

virtual bool Ogre::Resource::isBackgroundLoaded ( void  ) const
inlinevirtualinherited

Returns whether this Resource has been earmarked for background loading.

Remarks
This option only makes sense when you have built Ogre with thread support (OGRE_THREAD_SUPPORT). If a resource has been marked for background loading, then it won't load on demand like normal when load() is called. Instead, it will ignore request to load() except if the caller indicates it is the background loader. Any other users of this resource should check isLoaded(), and if that returns false, don't use the resource and come back later.

Reimplemented in Ogre::UnifiedHighLevelGpuProgram.

◆ setBackgroundLoaded()

virtual void Ogre::Resource::setBackgroundLoaded ( bool  bl)
inlinevirtualinherited

Tells the resource whether it is background loaded or not.

See also
Resource::isBackgroundLoaded. Note that calling this only defers the normal on-demand loading behaviour of a resource, it does not actually set up a thread to make sure the resource gets loaded in the background. You should use ResourceBackgroundLoadingQueue to manage the actual loading (which will call this method itself).

Reimplemented in Ogre::UnifiedHighLevelGpuProgram.

◆ escalateLoading()

virtual void Ogre::Resource::escalateLoading ( )
virtualinherited

Escalates the loading of a background loaded resource.

Remarks
If a resource is set to load in the background, but something needs it before it's been loaded, there could be a problem. If the user of this resource really can't wait, they can escalate the loading which basically pulls the loading into the current thread immediately. If the resource is already being loaded but just hasn't quite finished then this method will simply wait until the background load is complete.

Reimplemented in Ogre::UnifiedHighLevelGpuProgram.

◆ addListener()

virtual void Ogre::Resource::addListener ( Listener lis)
virtualinherited

Register a listener on this resource.

See also
Resource::Listener

Reimplemented in Ogre::UnifiedHighLevelGpuProgram.

◆ removeListener()

virtual void Ogre::Resource::removeListener ( Listener lis)
virtualinherited

Remove a listener on this resource.

See also
Resource::Listener

Reimplemented in Ogre::UnifiedHighLevelGpuProgram.

◆ getGroup()

virtual const String& Ogre::Resource::getGroup ( void  ) const
inlinevirtualinherited

Gets the group which this resource is a member of.

Reimplemented in Ogre::SkeletonInstance.

◆ changeGroupOwnership()

virtual void Ogre::Resource::changeGroupOwnership ( const String newGroup)
virtualinherited

Change the resource group ownership of a Resource.

Remarks
This method is generally reserved for internal use, although if you really know what you're doing you can use it to move this resource from one group to another.
Parameters
newGroupName of the new group

◆ getCreator()

ResourceManager* Ogre::Resource::getCreator ( void  )
inlineinherited

Gets the manager which created this resource.

◆ getOrigin()

const String& Ogre::Resource::getOrigin ( void  ) const
inlineinherited

Get the origin of this resource, e.g.

a script file name.

Remarks
This property will only contain something if the creator of this resource chose to populate it. Script loaders are advised to populate it.

◆ _notifyOrigin()

void Ogre::Resource::_notifyOrigin ( const String origin)
inlineinherited

Notify this resource of it's origin.

◆ getStateCount()

virtual size_t Ogre::Resource::getStateCount ( ) const
inlinevirtualinherited

Returns the number of times this resource has changed state, which generally means the number of times it has been loaded.

Objects that build derived data based on the resource can check this value against a copy they kept last time they built this derived data, in order to know whether it needs rebuilding. This is a nice way of monitoring changes without having a tightly-bound callback.

◆ _dirtyState()

virtual void Ogre::Resource::_dirtyState ( )
virtualinherited

Manually mark the state of this resource as having been changed.

Remarks
You only need to call this from outside if you explicitly want derived objects to think this object has changed.
See also
getStateCount.

◆ _fireLoadingComplete()

void Ogre::Resource::_fireLoadingComplete ( bool  wasBackgroundLoaded)
inherited

Firing of loading complete event.

Remarks
You should call this from the thread that runs the main frame loop to avoid having to make the receivers of this event thread-safe. If you use Ogre's built in frame loop you don't need to call this yourself.
Parameters
wasBackgroundLoadedWhether this was a background loaded event

◆ _firePreparingComplete()

void Ogre::Resource::_firePreparingComplete ( bool  wasBackgroundLoaded)
inherited

Firing of preparing complete event.

Remarks
You should call this from the thread that runs the main frame loop to avoid having to make the receivers of this event thread-safe. If you use Ogre's built in frame loop you don't need to call this yourself.
Parameters
wasBackgroundLoadedWhether this was a background loaded event

◆ _fireUnloadingComplete()

void Ogre::Resource::_fireUnloadingComplete ( void  )
inherited

Firing of unloading complete event.

Remarks
You should call this from the thread that runs the main frame loop to avoid having to make the receivers of this event thread-safe. If you use Ogre's built in frame loop you don't need to call this yourself.

◆ getParamDictionary() [1/2]

ParamDictionary* Ogre::StringInterface::getParamDictionary ( void  )
inlineinherited

Retrieves the parameter dictionary for this class.

Remarks
Only valid to call this after createParamDictionary.
Returns
Pointer to ParamDictionary shared by all instances of this class which you can add parameters to, retrieve parameters etc.

◆ getParamDictionary() [2/2]

const ParamDictionary* Ogre::StringInterface::getParamDictionary ( void  ) const
inlineinherited

◆ getParameters()

const ParameterList& Ogre::StringInterface::getParameters ( void  ) const
inherited

Retrieves a list of parameters valid for this object.

Returns
A reference to a static list of ParameterDef objects.

◆ setParameter()

bool Ogre::StringInterface::setParameter ( const String name,
const String value 
)
inherited

Generic parameter setting method.

Remarks
Call this method with the name of a parameter and a string version of the value to set. The implementor will convert the string to a native type internally. If in doubt, check the parameter definition in the list returned from StringInterface::getParameters.
Parameters
nameThe name of the parameter to set
valueString value. Must be in the right format for the type specified in the parameter definition. See the StringConverter class for more information.
Returns
true if set was successful, false otherwise (NB no exceptions thrown - tolerant method)

Referenced by Ogre::StringInterface::copyParametersTo().

◆ setParameterList()

void Ogre::StringInterface::setParameterList ( const NameValuePairList paramList)
inherited

Generic multiple parameter setting method.

Remarks
Call this method with a list of name / value pairs to set. The implementor will convert the string to a native type internally. If in doubt, check the parameter definition in the list returned from StringInterface::getParameters.
Parameters
paramListName/value pair list

◆ getParameter()

String Ogre::StringInterface::getParameter ( const String name) const
inlineinherited

Generic parameter retrieval method.

Remarks
Call this method with the name of a parameter to retrieve a string-format value of the parameter in question. If in doubt, check the parameter definition in the list returned from getParameters for the type of this parameter. If you like you can use StringConverter to convert this string back into a native type.
Parameters
nameThe name of the parameter to get
Returns
String value of parameter, blank if not found

References Ogre::ParamCommand::doGet().

◆ copyParametersTo()

void Ogre::StringInterface::copyParametersTo ( StringInterface dest) const
inlineinherited

Method for copying this object's parameters to another object.

Remarks
This method takes the values of all the object's parameters and tries to set the same values on the destination object. This provides a completely type independent way to copy parameters to other objects. Note that because of the String manipulation involved, this should not be regarded as an efficient process and should be saved for times outside of the rendering loop.
Any unrecognised parameters will be ignored as with setParameter method.
Parameters
destPointer to object to have it's parameters set the same as this object.

References Ogre::StringInterface::setParameter().

◆ cleanupDictionary()

static void Ogre::StringInterface::cleanupDictionary ( )
staticinherited

Cleans up the static 'msDictionary' required to reset Ogre, otherwise the containers are left with invalid pointers, which will lead to a crash as soon as one of the ResourceManager implementers (e.g.

MaterialManager) initializes.

Friends And Related Function Documentation

◆ SubMesh

friend class SubMesh
friend

◆ MeshSerializerImpl

friend class MeshSerializerImpl
friend

◆ MeshSerializerImpl_v1_8

friend class MeshSerializerImpl_v1_8
friend

◆ MeshSerializerImpl_v1_4

friend class MeshSerializerImpl_v1_4
friend

◆ MeshSerializerImpl_v1_3

friend class MeshSerializerImpl_v1_3
friend

◆ MeshSerializerImpl_v1_2

friend class MeshSerializerImpl_v1_2
friend

◆ MeshSerializerImpl_v1_1

friend class MeshSerializerImpl_v1_1
friend

Member Data Documentation

◆ sharedVertexData

VertexData* Ogre::Mesh::sharedVertexData

Shared vertex data.

Remarks
This vertex data can be shared among multiple submeshes. SubMeshes may not have their own VertexData, they may share this one.
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(), and Ogre::Lod0Stripifier::~Lod0Stripifier().

◆ sharedBlendIndexToBoneIndexMap

IndexMap Ogre::Mesh::sharedBlendIndexToBoneIndexMap

Shared index map for translating blend index to bone index.

Remarks
This index map can be shared among multiple submeshes. SubMeshes might not have their own IndexMap, they might share this one.
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.

◆ OGRE_AUTO_MUTEX

Ogre::Resource::OGRE_AUTO_MUTEX
inherited

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