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

Ogre::Mesh Class Reference

#include <OgreMesh.h>

Inheritance diagram for Ogre::Mesh:

Ogre::Resource Ogre::StringInterface Ogre::PatchMesh List of all members.

Public Types

typedef std::vector< RealLodDistanceList
typedef std::multimap< size_t,
VertexBoneAssignment
VertexBoneAssignmentList
 Multimap of vertex bone assignments (orders by vertex index).

typedef MapIterator< VertexBoneAssignmentListBoneAssignmentIterator
typedef std::vector< SubMesh * > SubMeshList
typedef HashMap< String, ushortSubMeshNameMap
 A hashmap used to store optional SubMesh names.

typedef VectorIterator< SubMeshListSubMeshIterator

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.

 ~Mesh ()
void load (void)
 
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


SubMeshcreateSubMesh (void)
 Creates a new SubMesh.

SubMeshcreateSubMesh (const String &name)
 Creates a new SubMesh and gives it a name.

void nameSubMesh (const String &name, ushort index)
 Gives a name to a SubMesh.

ushort _getSubMeshIndex (const String &name) const
 Gets the index of a submesh with a given name.

unsigned short getNumSubMeshes (void) const
 Gets the number of sub meshes which comprise this mesh.

SubMeshgetSubMesh (unsigned short index) const
 Gets a pointer to the submesh indicated by the index.

SubMeshgetSubMesh (const String &name) const
 Gets a SubMesh by name.

SubMeshIterator getSubMeshIterator (void)
 Gets an iterator over the available submeshes.

MeshPtr clone (const String &newName, const String &newGroup=StringUtil::BLANK)
 Makes a copy of this mesh object and gives it a new name.

const AxisAlignedBoxgetBounds (void) const
 Get the axis-aligned bounding box for this mesh.

Real getBoundingSphereRadius (void) const
 Gets the radius of the bounding sphere surrounding this mesh.

void _setBounds (const AxisAlignedBox &bounds, bool pad=true)
 Manually set the bounding box for this Mesh.

void _setBoundingSphereRadius (Real radius)
 Manually set the bounding radius.

void setSkeletonName (const String &skelName)
 Sets the name of the skeleton this Mesh uses for animation.

bool hasSkeleton (void) const
 Returns true if this Mesh has a linked Skeleton.

const SkeletonPtrgetSkeleton (void) const
 Gets a pointer to any linked Skeleton.

const StringgetSkeletonName (void) const
 Gets the name of any linked Skeleton.

void _initAnimationState (AnimationStateSet *animSet)
 Initialise an animation set suitable for use with this mesh.

void addBoneAssignment (const VertexBoneAssignment &vertBoneAssign)
 Assigns a vertex to a bone with a given weight, for skeletal animation.

void clearBoneAssignments (void)
 Removes all bone assignments for this mesh.

void _notifySkeleton (SkeletonPtr &pSkel)
 Internal notification, used to tell the Mesh which Skeleton to use without loading it.

BoneAssignmentIterator getBoneAssignmentIterator (void)
 Gets an iterator for access all bone assignments.

void generateLodLevels (const LodDistanceList &lodDistances, ProgressiveMesh::VertexReductionQuota reductionMethod, Real reductionValue)
 Automatically generates lower level of detail versions of this mesh for use when a simpler version of the model is acceptable for rendering.

ushort getNumLodLevels (void) const
 Returns the number of levels of detail that this mesh supports.

const MeshLodUsagegetLodLevel (ushort index) const
 Gets details of the numbered level of detail entry.

void createManualLodLevel (Real fromDepth, const String &meshName)
 Adds a new manual level-of-detail entry to this Mesh.

void updateManualLodLevel (ushort index, const String &meshName)
 Changes the alternate mesh to use as a manual LOD at the given index.

ushort getLodIndex (Real depth) const
 Retrieves the level of detail index for the given depth value.

ushort getLodIndexSquaredDepth (Real squaredDepth) const
 Retrieves the level of detail index for the given squared depth value.

bool isLodManual (void) const
 Returns true if this mesh is using manual LOD.

void _setLodInfo (unsigned short numLevels, bool isManual)
 Internal methods for loading LOD, do not use.

void _setLodUsage (unsigned short level, MeshLodUsage &usage)
 Internal methods for loading LOD, do not use.

void _setSubMeshLodFaceList (unsigned short subIdx, unsigned short level, IndexData *facedata)
 Internal methods for loading LOD, do not use.

void removeLodLevels (void)
 Removes all LOD data from this Mesh.

void setVertexBufferPolicy (HardwareBuffer::Usage usage, bool shadowBuffer=false)
 Sets the policy for the vertex buffers to be used when loading this Mesh.

void setIndexBufferPolicy (HardwareBuffer::Usage usage, bool shadowBuffer=false)
 Sets the policy for the index buffers to be used when loading this Mesh.

HardwareBuffer::Usage getVertexBufferUsage (void) const
 Gets the usage setting for this meshes vertex buffers.

HardwareBuffer::Usage getIndexBufferUsage (void) const
 Gets the usage setting for this meshes index buffers.

bool isVertexBufferShadowed (void) const
 Gets whether or not this meshes vertex buffers are shadowed.

bool isIndexBufferShadowed (void) const
 Gets whether or not this meshes index buffers are shadowed.

unsigned short _rationaliseBoneAssignments (size_t vertexCount, VertexBoneAssignmentList &assignments)
 Rationalises the passed in bone assignment list.

void _compileBoneAssignments (void)
 Internal method, be called once to compile bone assignments into geometry buffer.

void buildTangentVectors (unsigned short sourceTexCoordSet=0, unsigned short destTexCoordSet=1)
 This method builds a set of tangent vectors for a given mesh into a 3D texture coordinate buffer.

bool suggestTangentVectorBuildParams (unsigned short &outSourceCoordSet, unsigned short &outDestCoordSet)
 Ask the mesh to suggest parameters to a future buildTangentVectors call.

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

void freeEdgeList (void)
 Destroys and frees the edge lists this mesh has built.

void prepareForShadowVolume (void)
 This method prepares the mesh for generating a renderable shadow volume.

EdgeDatagetEdgeList (unsigned int lodIndex=0)
 Return the edge list for this mesh, building it if required.

const EdgeDatagetEdgeList (unsigned int lodIndex=0) const
 Return the edge list for this mesh, building it if required.

bool isPreparedForShadowVolumes (void) const
 Returns whether this mesh has already had it's geometry prepared for use in rendering shadow volumes.

bool isEdgeListBuilt (void) const
 Returns whether this mesh has an attached edge list.

const SubMeshNameMapgetSubMeshNameMap (void) const
 Gets a reference to the optional name assignments of the SubMeshes.

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.

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.

virtual void reload (void)
 Reloads the resource, if it is already loaded.

bool isReloadable (void) const
 Returns true if the Resource is reloadable, false otherwise.

bool isManuallyLoaded (void) const
 Is this resource manually loaded?

virtual void unload (void)
 Unloads the resource; this is not permanent, the resource can be reloaded later if required.

size_t getSize (void) const
 Retrieves info about the size of the resource.

virtual void touch (void)
 'Touches' the resource to indicate it has been used.

const StringgetName (void) const
 Gets resource name.

ResourceHandle getHandle (void) const
bool isLoaded (void) const
 Returns true if the Resource has been loaded, false otherwise.

const StringgetGroup (void)
 Gets the group which this resource is a member of.

ResourceManagergetCreator (void)
 Gets the manager which created this resource.

const StringgetOrigin (void) const
 Get the origin of this resource, e.g.

void _notifyOrigin (const String &origin)
 Notify this resource of it's origin.

ParamDictionarygetParamDictionary (void)
 Retrieves the parameter dictionary for this class.

const ParamDictionarygetParamDictionary (void) const
const ParameterListgetParameters (void) const
 Retrieves a list of parameters valid for this object.

virtual bool setParameter (const String &name, const String &value)
 Generic parameter setting method.

virtual void setParameterList (const NameValuePairList &paramList)
 Generic multiple parameter setting method.

virtual String getParameter (const String &name) const
 Generic parameter retrieval method.

virtual void copyParametersTo (StringInterface *dest) const
 Method for copying this object's parameters to another object.


Static Public Member Functions

void softwareVertexBlend (const VertexData *sourceVertexData, const VertexData *targetVertexData, const Matrix4 *pMatrices, bool blendNormals)
 Performs a software indexed vertex blend, of the kind used for skeletal animation although it can be used for other purposes.

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.


Public Attributes

VertexDatasharedVertexData
 Shared vertex data.


Protected Types

typedef std::vector< MeshLodUsageMeshLodUsageList

Protected Member Functions

void organiseTangentsBuffer (VertexData *vertexData, unsigned short destCoordSet)
 Internal method for making the space for a 3D texture coord buffer to hold tangents.

void compileBoneAssignments (const VertexBoneAssignmentList &boneAssignments, unsigned short numBlendWeightsPerVertex, VertexData *targetVertexData)
 Compile bone assignments into blend index and weight buffers.

void compileBoneAssignmentsSoftware (const VertexBoneAssignmentList &boneAssignments, unsigned short numBlendWeightsPerVertex, VertexData *targetVertexData)
 Software blending oriented bone assignment compilation.

void loadImpl (void)
 

void unloadImpl (void)
 

size_t calculateSize (void) const
 

bool createParamDictionary (const String &className)
 Internal method for creating a parameter dictionary for the class, if it does not already exist.


Protected Attributes

SubMeshList mSubMeshList
 A list of submeshes which make up this mesh.

SubMeshNameMap mSubMeshNameMap
AxisAlignedBox mAABB
 Local bounding box volume.

Real mBoundRadius
 Local bounding sphere radius (centered on object).

String mSkeletonName
 Optional linked skeleton.

SkeletonPtr mSkeleton
VertexBoneAssignmentList mBoneAssignments
bool mBoneAssignmentsOutOfDate
 Flag indicating that bone assignments need to be recompiled.

bool mIsLodManual
ushort mNumLods
MeshLodUsageList mMeshLodUsageList
HardwareBuffer::Usage mVertexBufferUsage
HardwareBuffer::Usage mIndexBufferUsage
bool mVertexBufferShadowBuffer
bool mIndexBufferShadowBuffer
bool mPreparedForShadowVolumes
bool mEdgeListsBuilt
bool mAutoBuildEdgeLists
ResourceManagermCreator
 Creator.

String mName
 Unique name of the resource.

String mGroup
 The name of the resource group.

ResourceHandle mHandle
 Numeric handle for more efficient look up than name.

bool mIsLoaded
 Is the resource currently loaded?

size_t mSize
 The size of the resource in bytes.

bool mIsManual
 Is this file manually loaded?

String mOrigin
 Origin of this resource (e.g. script name) - optional.

ManualResourceLoadermLoader
 Optional manual loader; if provided, data is loaded from here instead of a file.

String mParamDictName
 Class name for this instance to be used as a lookup (must be initialised by subclasses).


Static Protected Attributes

ParamDictionaryMap msDictionary
 Dictionary of parameters.


Friends

class SubMesh
class MeshSerializerImpl
class MeshSerializerImpl_v1_2
class MeshSerializerImpl_v1_1

Member Typedef Documentation

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

Definition at line 91 of file OgreMesh.h.

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

Definition at line 88 of file OgreMesh.h.

typedef std::vector<MeshLodUsage> Ogre::Mesh::MeshLodUsageList [protected]
 

Definition at line 140 of file OgreMesh.h.

typedef VectorIterator<SubMeshList> Ogre::Mesh::SubMeshIterator
 

Definition at line 210 of file OgreMesh.h.

Referenced by getSubMeshIterator().

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

Definition at line 92 of file OgreMesh.h.

typedef HashMap<String, ushort> Ogre::Mesh::SubMeshNameMap
 

A hashmap used to store optional SubMesh names.

Translates a name into SubMesh index

Definition at line 110 of file OgreMesh.h.

Referenced by getSubMeshNameMap().

typedef std::multimap<size_t, VertexBoneAssignment> Ogre::Mesh::VertexBoneAssignmentList
 

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

Definition at line 90 of file OgreMesh.h.


Constructor & Destructor Documentation

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.

Ogre::Mesh::~Mesh  ) 
 


Member Function Documentation

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.

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.

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.

void Ogre::Resource::_notifyOrigin const String origin  )  [inherited]
 

Notify this resource of it's origin.

Definition at line 214 of file OgreResource.h.

References Ogre::String.

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.

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:
vertexCount The number of vertices.
assignments The 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]

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

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:
pad If true, a certain padding will be added to the bounding box to separate it from the mesh

void Ogre::Mesh::_setLodInfo unsigned short  numLevels,
bool  isManual
 

Internal methods for loading LOD, do not use.

void Ogre::Mesh::_setLodUsage unsigned short  level,
MeshLodUsage usage
 

Internal methods for loading LOD, do not use.

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

Internal methods for loading LOD, do not use.

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.

void Ogre::Mesh::buildEdgeList void   ) 
 

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

void Ogre::Mesh::buildTangentVectors unsigned short  sourceTexCoordSet = 0,
unsigned short  destTexCoordSet = 1
 

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:
sourceTexCoordSet The texture coordinate index which should be used as the source of 2D texture coordinates, with which to calculate the tangents.
destTexCoordSet The texture coordinate set which should be used to store the 3D coordinates representing a tangent vector per vertex. If this already exists, it will be overwritten.

size_t Ogre::Mesh::calculateSize void   )  const [protected, virtual]
 

Implements Ogre::Resource.

void Ogre::StringInterface::cleanupDictionary  )  [static, inherited]
 

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.

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.

MeshPtr Ogre::Mesh::clone const String newName,
const String newGroup = StringUtil::BLANK
 

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:
newName The name to give the clone
newGroup Optional 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.

void Ogre::Mesh::compileBoneAssignments const VertexBoneAssignmentList boneAssignments,
unsigned short  numBlendWeightsPerVertex,
VertexData targetVertexData
[protected]
 

Compile bone assignments into blend index and weight buffers.

void Ogre::Mesh::compileBoneAssignmentsSoftware const VertexBoneAssignmentList boneAssignments,
unsigned short  numBlendWeightsPerVertex,
VertexData targetVertexData
[protected]
 

Software blending oriented bone assignment compilation.

virtual void Ogre::StringInterface::copyParametersTo StringInterface dest  )  const [virtual, inherited]
 

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:
dest Pointer to object to have it's parameters set the same as this object.

Definition at line 296 of file OgreStringInterface.h.

References Ogre::ParamDictionary::mParamDefs, and Ogre::StringInterface::setParameter().

void Ogre::Mesh::createManualLodLevel Real  fromDepth,
const String meshName
 

Adds a new manual level-of-detail entry to this Mesh.

Remarks:
As an alternative to generating lower level of detail versions of a mesh, you can use your own manually modelled meshes as lower level versions. This lets you have complete control over the LOD, and in addition lets you scale down other aspects of the model which cannot be done using the generated method; for example, you could use less detailed materials and / or use less bones in the skeleton if this is an animated mesh. Therefore for complex models you are likely to be better off modelling your LODs yourself and using this method, whilst for models with fairly simple materials and no animation you can just use the generateLodLevels method.
Parameters:
fromDepth The z value from which this Lod will apply.
meshName The name of the mesh which will be the lower level detail version.

bool Ogre::StringInterface::createParamDictionary const String className  )  [protected, inherited]
 

Internal method for creating a parameter dictionary for the class, if it does not already exist.

Remarks:
This method will check to see if a parameter dictionary exist for this class yet, and if not will create one. NB you must supply the name of the class (RTTI is not used or performance).
Parameters:
className the name of the class using the dictionary
Returns:
true if a new dictionary was created, false if it was already there

Definition at line 172 of file OgreStringInterface.h.

References Ogre::String.

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

Creates a new SubMesh and gives it a name.

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.

void Ogre::Mesh::freeEdgeList void   ) 
 

Destroys and frees the edge lists this mesh has built.

void Ogre::Mesh::generateLodLevels const LodDistanceList lodDistances,
ProgressiveMesh::VertexReductionQuota  reductionMethod,
Real  reductionValue
 

Automatically generates lower level of detail versions of this mesh for use when a simpler version of the model is acceptable for rendering.

Remarks:
There are 2 ways that you can create level-of-detail (LOD) versions of a mesh; the first is to call this method, which does fairly extensive calculations to work out how to simplify the mesh whilst having the minimum affect on the model. The alternative is to actually create simpler versions of the mesh yourself in a modelling tool, and having exported them, tell the 'master' mesh to use these alternative meshes for lower detail versions; this is done by calling the createManualLodLevel method.
As well as creating the lower detail versions of the mesh, this method will also associate them with depth values. As soon as an object is at least as far away from the camera as the depth value associated with it's LOD, it will drop to that level of detail.
I recommend calling this method before mesh export, not at runtime.
Parameters:
lodDistances A list of depth values indicating the distances at which new lods should be generated.
reductionMethod The way to determine the number of vertices collapsed per LOD
reductionValue Meaning depends on reductionMethod, typically either the proportion of remaining vertices to collapse or a fixed number of vertices.

bool Ogre::Mesh::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.

Definition at line 612 of file OgreMesh.h.

BoneAssignmentIterator Ogre::Mesh::getBoneAssignmentIterator void   ) 
 

Gets an iterator for access all bone assignments.

Real Ogre::Mesh::getBoundingSphereRadius void   )  const
 

Gets the radius of the bounding sphere surrounding this mesh.

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

Get the axis-aligned bounding box for this mesh.

ResourceManager* Ogre::Resource::getCreator void   )  [inherited]
 

Gets the manager which created this resource.

Definition at line 205 of file OgreResource.h.

const EdgeData* Ogre::Mesh::getEdgeList unsigned int  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. The LOD at which to get the edge list, 0 being the highest.

EdgeData* Ogre::Mesh::getEdgeList unsigned int  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. The LOD at which to get the edge list, 0 being the highest.

const String& Ogre::Resource::getGroup void   )  [inherited]
 

Gets the group which this resource is a member of.

Definition at line 202 of file OgreResource.h.

References Ogre::String.

ResourceHandle Ogre::Resource::getHandle void   )  const [inherited]
 

Definition at line 188 of file OgreResource.h.

References Ogre::ResourceHandle.

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

Gets the usage setting for this meshes index buffers.

Definition at line 461 of file OgreMesh.h.

ushort Ogre::Mesh::getLodIndex Real  depth  )  const
 

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

ushort Ogre::Mesh::getLodIndexSquaredDepth Real  squaredDepth  )  const
 

Retrieves the level of detail index for the given squared depth value.

Remarks:
Internally the lods are stored at squared depths to avoid having to perform square roots when determining the lod. This method allows you to provide a squared length depth value to avoid having to do your own square roots.

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

Gets details of the numbered level of detail entry.

const String& Ogre::Resource::getName void   )  const [inherited]
 

Gets resource name.

Definition at line 183 of file OgreResource.h.

References Ogre::String.

ushort Ogre::Mesh::getNumLodLevels void   )  const
 

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

Remarks:
This number includes the original model.

unsigned short Ogre::Mesh::getNumSubMeshes void   )  const
 

Gets the number of sub meshes which comprise this mesh.

const String& Ogre::Resource::getOrigin void   )  const [inherited]
 

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.

Definition at line 212 of file OgreResource.h.

References Ogre::String.

const ParamDictionary* Ogre::StringInterface::getParamDictionary void   )  const [inherited]
 

Definition at line 209 of file OgreStringInterface.h.

ParamDictionary* Ogre::StringInterface::getParamDictionary void   )  [inherited]
 

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.

Definition at line 196 of file OgreStringInterface.h.

virtual String Ogre::StringInterface::getParameter const String name  )  const [virtual, inherited]
 

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:
name The name of the parameter to get
Returns:
String value of parameter, blank if not found

Definition at line 265 of file OgreStringInterface.h.

References Ogre::ParamCommand::doGet(), Ogre::ParamDictionary::getParamCommand(), and Ogre::String.

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.

size_t Ogre::Resource::getSize void   )  const [inherited]
 

Retrieves info about the size of the resource.

Definition at line 172 of file OgreResource.h.

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.

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

Gets the name of any linked Skeleton.

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

Gets a SubMesh by name.

SubMesh* Ogre::Mesh::getSubMesh unsigned short  index  )  const
 

Gets a pointer to the submesh indicated by the index.

SubMeshIterator Ogre::Mesh::getSubMeshIterator void   ) 
 

Gets an iterator over the available submeshes.

Definition at line 212 of file OgreMesh.h.

References SubMeshIterator.

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

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

Definition at line 595 of file OgreMesh.h.

References SubMeshNameMap.

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

Gets the usage setting for this meshes vertex buffers.

Definition at line 459 of file OgreMesh.h.

bool Ogre::Mesh::hasSkeleton void   )  const
 

Returns true if this Mesh has a linked Skeleton.

bool Ogre::Mesh::isEdgeListBuilt void   )  const
 

Returns whether this mesh has an attached edge list.

Definition at line 573 of file OgreMesh.h.

bool Ogre::Mesh::isIndexBufferShadowed void   )  const
 

Gets whether or not this meshes index buffers are shadowed.

Definition at line 465 of file OgreMesh.h.

bool Ogre::Resource::isLoaded void   )  const [inherited]
 

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

Definition at line 195 of file OgreResource.h.

References OGRE_LOCK_AUTO_MUTEX.

bool Ogre::Mesh::isLodManual void   )  const
 

Returns true if this mesh is using manual LOD.

Remarks:
A mesh can either use automatically generated LOD, or it can use alternative meshes as provided by an artist. A mesh can only use either all manual LODs or all generated LODs, not a mixture of both.

Definition at line 400 of file OgreMesh.h.

bool Ogre::Resource::isManuallyLoaded void   )  const [inherited]
 

Is this resource manually loaded?

Definition at line 160 of file OgreResource.h.

bool Ogre::Mesh::isPreparedForShadowVolumes void   )  const
 

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

Definition at line 570 of file OgreMesh.h.

bool Ogre::Resource::isReloadable void   )  const [inherited]
 

Returns true if the Resource is reloadable, false otherwise.

Definition at line 153 of file OgreResource.h.

bool Ogre::Mesh::isVertexBufferShadowed void   )  const
 

Gets whether or not this meshes vertex buffers are shadowed.

Definition at line 463 of file OgreMesh.h.

void Ogre::Mesh::load void   )  [virtual]
 

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

Reimplemented from Ogre::Resource.

void Ogre::Mesh::loadImpl void   )  [protected, virtual]
 

Implements Ogre::Resource.

Reimplemented in Ogre::PatchMesh.

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

Gives a name to a SubMesh.

void Ogre::Mesh::organiseTangentsBuffer VertexData vertexData,
unsigned short  destCoordSet
[protected]
 

Internal method for making the space for a 3D texture coord buffer to hold tangents.

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.

virtual void Ogre::Resource::reload void   )  [virtual, inherited]
 

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.

void Ogre::Mesh::removeLodLevels void   ) 
 

Removes all LOD data from this Mesh.

void Ogre::Mesh::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.

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.

Definition at line 607 of file OgreMesh.h.

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:
usage The usage flags, which by default are HardwareBuffer::HBU_STATIC_WRITE_ONLY
shadowBuffer If 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.

virtual bool Ogre::StringInterface::setParameter const String name,
const String value
[virtual, 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:
name The name of the parameter to set
value String 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().

virtual void Ogre::StringInterface::setParameterList const NameValuePairList paramList  )  [virtual, 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:
paramList Name/value pair list

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:
skelName The name of the .skeleton file to use, or an empty string to use no skeleton

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:
usage The usage flags, which by default are HardwareBuffer::HBU_STATIC_WRITE_ONLY
shadowBuffer If 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.

void Ogre::Mesh::softwareVertexBlend const VertexData sourceVertexData,
const VertexData targetVertexData,
const Matrix4 pMatrices,
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:
sourceVertexData VertexData class containing positions, normals, blend indices and blend weights.
targetVertexData VertexData 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
pMatrices Pointer to an array of matrices to be used to blend
blendNormals If true, normals are blended as well as positions

bool Ogre::Mesh::suggestTangentVectorBuildParams unsigned short &  outSourceCoordSet,
unsigned short &  outDestCoordSet
 

Ask the mesh to suggest parameters to a future buildTangentVectors call.

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:
outSourceCoordSet Reference to a source texture coordinate set which will be populated
outDestCoordSet Reference to a destination texture coordinate set which will be populated

virtual void Ogre::Resource::touch void   )  [virtual, inherited]
 

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

Reimplemented in Ogre::Material.

virtual void Ogre::Resource::unload void   )  [virtual, inherited]
 

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

Reimplemented in Ogre::GLSLGpuProgram.

void Ogre::Mesh::unloadImpl void   )  [protected, virtual]
 

Implements Ogre::Resource.

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:
index The index of the level to be changed
meshName The name of the mesh which will be the lower level detail version.


Friends And Related Function Documentation

friend class MeshSerializerImpl [friend]
 

Definition at line 83 of file OgreMesh.h.

friend class MeshSerializerImpl_v1_1 [friend]
 

Definition at line 85 of file OgreMesh.h.

friend class MeshSerializerImpl_v1_2 [friend]
 

Definition at line 84 of file OgreMesh.h.

friend class SubMesh [friend]
 

Definition at line 82 of file OgreMesh.h.


Member Data Documentation

AxisAlignedBox Ogre::Mesh::mAABB [protected]
 

Local bounding box volume.

Definition at line 115 of file OgreMesh.h.

bool Ogre::Mesh::mAutoBuildEdgeLists [protected]
 

Definition at line 151 of file OgreMesh.h.

VertexBoneAssignmentList Ogre::Mesh::mBoneAssignments [protected]
 

Definition at line 124 of file OgreMesh.h.

bool Ogre::Mesh::mBoneAssignmentsOutOfDate [protected]
 

Flag indicating that bone assignments need to be recompiled.

Definition at line 127 of file OgreMesh.h.

Real Ogre::Mesh::mBoundRadius [protected]
 

Local bounding sphere radius (centered on object).

Definition at line 117 of file OgreMesh.h.

ResourceManager* Ogre::Resource::mCreator [protected, inherited]
 

Creator.

Definition at line 73 of file OgreResource.h.

bool Ogre::Mesh::mEdgeListsBuilt [protected]
 

Definition at line 150 of file OgreMesh.h.

String Ogre::Resource::mGroup [protected, inherited]
 

The name of the resource group.

Definition at line 77 of file OgreResource.h.

ResourceHandle Ogre::Resource::mHandle [protected, inherited]
 

Numeric handle for more efficient look up than name.

Definition at line 79 of file OgreResource.h.

bool Ogre::Mesh::mIndexBufferShadowBuffer [protected]
 

Definition at line 146 of file OgreMesh.h.

HardwareBuffer::Usage Ogre::Mesh::mIndexBufferUsage [protected]
 

Definition at line 144 of file OgreMesh.h.

bool Ogre::Resource::mIsLoaded [protected, inherited]
 

Is the resource currently loaded?

Definition at line 81 of file OgreResource.h.

bool Ogre::Mesh::mIsLodManual [protected]
 

Definition at line 138 of file OgreMesh.h.

bool Ogre::Resource::mIsManual [protected, inherited]
 

Is this file manually loaded?

Definition at line 85 of file OgreResource.h.

ManualResourceLoader* Ogre::Resource::mLoader [protected, inherited]
 

Optional manual loader; if provided, data is loaded from here instead of a file.

Definition at line 89 of file OgreResource.h.

MeshLodUsageList Ogre::Mesh::mMeshLodUsageList [protected]
 

Definition at line 141 of file OgreMesh.h.

String Ogre::Resource::mName [protected, inherited]
 

Unique name of the resource.

Definition at line 75 of file OgreResource.h.

ushort Ogre::Mesh::mNumLods [protected]
 

Definition at line 139 of file OgreMesh.h.

String Ogre::Resource::mOrigin [protected, inherited]
 

Origin of this resource (e.g. script name) - optional.

Definition at line 87 of file OgreResource.h.

String Ogre::StringInterface::mParamDictName [protected, inherited]
 

Class name for this instance to be used as a lookup (must be initialised by subclasses).

Definition at line 160 of file OgreStringInterface.h.

bool Ogre::Mesh::mPreparedForShadowVolumes [protected]
 

Definition at line 149 of file OgreMesh.h.

ParamDictionaryMap Ogre::StringInterface::msDictionary [static, protected, inherited]
 

Dictionary of parameters.

Definition at line 157 of file OgreStringInterface.h.

size_t Ogre::Resource::mSize [protected, inherited]
 

The size of the resource in bytes.

Definition at line 83 of file OgreResource.h.

SkeletonPtr Ogre::Mesh::mSkeleton [protected]
 

Definition at line 121 of file OgreMesh.h.

String Ogre::Mesh::mSkeletonName [protected]
 

Optional linked skeleton.

Definition at line 120 of file OgreMesh.h.

SubMeshList Ogre::Mesh::mSubMeshList [protected]
 

A list of submeshes which make up this mesh.

Each mesh is made up of 1 or more submeshes, which are each based on a single material and can have their own vertex data (they may not - they can share vertex data from the Mesh, depending on preference).

Definition at line 101 of file OgreMesh.h.

SubMeshNameMap Ogre::Mesh::mSubMeshNameMap [protected]
 

Definition at line 112 of file OgreMesh.h.

bool Ogre::Mesh::mVertexBufferShadowBuffer [protected]
 

Definition at line 145 of file OgreMesh.h.

HardwareBuffer::Usage Ogre::Mesh::mVertexBufferUsage [protected]
 

Definition at line 143 of file OgreMesh.h.

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.

Definition at line 223 of file OgreMesh.h.


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

Copyright © 2000-2005 by The OGRE Team
Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 2.5 License.
Last modified Sun Feb 12 13:01:09 2006