OGRE 14.3
Object-Oriented Graphics Rendering Engine
|
Resource holding data about 3D mesh. More...
#include <OgreMesh.h>
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 | _calcBoundsFromVertexBuffer (VertexData *vertexData, AxisAlignedBox &outAABB, Real &outRadius, bool updateOnly=false) |
Calculates. | |
void | _compileBoneAssignments (void) |
Internal method, be called once to compile bone assignments into geometry buffer. | |
void | _computeBoneBoundingRadius () |
Compute the bone bounding radius by looking at the vertices, vertex-bone-assignments, and skeleton bind pose. | |
void | _convertVertexElement (VertexElementSemantic semantic, VertexElementType dstType) |
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). | |
virtual Animation * | _getAnimationImpl (const String &name) const |
Internal access to the named vertex Animation object - returns null if it does not exist. | |
bool | _getAnimationTypesDirty (void) const |
Are the derived animation types out of date? | |
ushort | _getSubMeshIndex (const String &name) const |
Gets the index of a submesh with a given name. | |
void | _initAnimationState (AnimationStateSet *animSet) |
Initialise an animation set suitable for use with this mesh. | |
bool | _isManualLodLevel (unsigned short level) const |
Internal methods for loading LOD, do not use. | |
void | _notifySkeleton (const SkeletonPtr &pSkel) |
Internal notification, used to tell the Mesh which Skeleton to use without loading it. | |
unsigned short | _rationaliseBoneAssignments (size_t vertexCount, VertexBoneAssignmentList &assignments) |
Rationalises the passed in bone assignment list. | |
void | _refreshAnimationState (AnimationStateSet *animSet) |
Refresh an animation set suitable for use with this mesh. | |
void | _setBoneBoundingRadius (Real radius) |
Manually set the bone bounding radius. | |
void | _setBoundingSphereRadius (Real radius) |
Manually set the bounding radius. | |
void | _setBounds (const AxisAlignedBox &bounds, bool pad=true) |
Manually set the bounding box for this Mesh. | |
void | _setLodInfo (unsigned short numLevels) |
Internal methods for loading LOD, do not use. | |
void | _setLodUsage (unsigned short level, const 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 | _updateBoundsFromVertexBuffers (bool pad=false) |
Automatically update the bounding radius and bounding box for this Mesh. | |
void | _updateCompiledBoneAssignments (void) |
Internal method, be called once to update the compiled bone assignments. | |
void | addBoneAssignment (const VertexBoneAssignment &vertBoneAssign) |
Assigns a vertex to a bone with a given weight, for skeletal animation. | |
void | buildEdgeList (void) |
Builds an edge list for this mesh, which can be used for generating a shadow volume among other things. | |
void | buildTangentVectors (unsigned short sourceTexCoordSet=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. | |
void | buildTangentVectors (VertexElementSemantic targetSemantic, unsigned short sourceTexCoordSet=0, unsigned short index=0, bool splitMirrored=false, bool splitRotated=false, bool storeParityInW=false) |
void | clearBoneAssignments (void) |
Removes all bone assignments for this mesh. | |
MeshPtr | clone (const String &newName, const String &newGroup=BLANKSTRING) |
Makes a copy of this mesh object and gives it a new name. | |
Animation * | createAnimation (const String &name, Real length) override |
Create a new animation with a given length owned by this container. | |
Pose * | createPose (ushort target, const String &name=BLANKSTRING) |
Create a new Pose for this mesh or one of its submeshes. | |
SubMesh * | createSubMesh (const String &name) |
Creates a new SubMesh and gives it a name. | |
SubMesh * | createSubMesh (void) |
Creates a new SubMesh. | |
void | createVertexData (HardwareBufferManagerBase *mgr=nullptr) |
Creates a new shared vertex data object. | |
void | destroySubMesh (const String &name) |
Destroy a SubMesh with the given name. | |
void | destroySubMesh (unsigned short index) |
Destroy a SubMesh with the given index. | |
void | freeEdgeList (void) |
Destroys and frees the edge lists this mesh has built. | |
Animation * | getAnimation (const String &name) const override |
Looks up an Animation object previously created with createAnimation. | |
Animation * | getAnimation (unsigned short index) const override |
Retrieve an animation by index. | |
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. | |
BoneAssignmentIterator | getBoneAssignmentIterator (void) |
const VertexBoneAssignmentList & | getBoneAssignments () const |
Gets a const reference to the list of bone assignments. | |
Real | getBoneBoundingRadius () const |
Gets the radius used to inflate the bounding box around the bones. | |
Real | getBoundingSphereRadius (void) const |
Gets the radius of the bounding sphere surrounding this mesh. | |
const AxisAlignedBox & | getBounds (void) const |
Get the axis-aligned bounding box for this mesh. | |
EdgeData * | getEdgeList (unsigned short lodIndex=0) |
Return the edge list for this mesh, building it if required. | |
const EdgeData * | getEdgeList (unsigned short lodIndex=0) const |
Return the edge list for this mesh, building it if required. | |
HardwareBufferManagerBase * | getHardwareBufferManager () |
HardwareBufferUsage | getIndexBufferUsage (void) const |
Gets the usage setting for this meshes index buffers. | |
ushort | getLodIndex (Real value) const |
Retrieves the level of detail index for the given LOD value. | |
const MeshLodUsage & | getLodLevel (ushort index) const |
Gets details of the numbered level of detail entry. | |
const LodStrategy * | getLodStrategy () const |
Get LOD strategy used by this mesh. | |
unsigned short | getNumAnimations (void) const override |
Gets the number of animations in this container. | |
ushort | getNumLodLevels (void) const |
Returns the number of levels of detail that this mesh supports. | |
size_t | getNumSubMeshes (void) const |
Gets the number of sub meshes which comprise this mesh. | |
Pose * | getPose (const String &name) const |
Retrieve an existing Pose by name. | |
Pose * | getPose (size_t index) const |
Retrieve an existing Pose by index. | |
size_t | getPoseCount (void) const |
Get the number of poses. | |
PoseIterator | getPoseIterator (void) |
Get an iterator over all the poses defined. | |
ConstPoseIterator | getPoseIterator (void) const |
Get an iterator over all the poses defined. | |
const PoseList & | getPoseList (void) const |
Get pose list. | |
bool | getSharedVertexDataAnimationIncludesNormals () const |
Returns whether animation on shared vertex data includes normals. | |
virtual VertexAnimationType | getSharedVertexDataAnimationType (void) const |
Gets the type of vertex animation the shared vertex data of this mesh supports. | |
const SkeletonPtr & | getSkeleton (void) const |
Gets a pointer to any linked Skeleton. | |
const String & | getSkeletonName (void) const |
Gets the name of any linked Skeleton. | |
SubMesh * | getSubMesh (const String &name) const |
Gets a SubMesh by name. | |
SubMesh * | getSubMesh (size_t index) const |
Gets a pointer to the submesh indicated by the index. | |
const SubMeshList & | getSubMeshes () const |
Gets the available submeshes. | |
SubMeshIterator | getSubMeshIterator (void) |
Gets an iterator over the available submeshes. | |
const SubMeshNameMap & | getSubMeshNameMap (void) const |
Gets a reference to the optional name assignments of the SubMeshes. | |
UserObjectBindings & | getUserObjectBindings () |
Class that provides convenient interface to establish a linkage between custom user application objects and Ogre core classes. | |
const UserObjectBindings & | getUserObjectBindings () const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
HardwareBufferUsage | getVertexBufferUsage (void) const |
Gets the usage setting for this meshes vertex buffers. | |
VertexData * | getVertexDataByTrackHandle (unsigned short handle) |
Gets a pointer to a vertex data element based on a morph animation track handle. | |
bool | hasAnimation (const String &name) const override |
Returns whether this object contains the named animation. | |
bool | hasManualLodLevel (void) const |
Returns true if this mesh has a manual LOD level. | |
bool | hasSkeleton (void) const |
Returns true if this Mesh has a linked Skeleton. | |
bool | hasVertexAnimation (void) const |
Returns whether or not this mesh has some kind of vertex animation. | |
bool | isEdgeListBuilt (void) const |
Returns whether this mesh has an attached edge list. | |
bool | isIndexBufferShadowed (void) const |
Gets whether or not this meshes index buffers are shadowed. | |
bool | isPreparedForShadowVolumes (void) const |
Returns whether this mesh has already had it's geometry prepared for use in rendering shadow volumes. | |
bool | isVertexBufferShadowed (void) const |
Gets whether or not this meshes vertex buffers are shadowed. | |
void | mergeAdjacentTexcoords (unsigned short finalTexCoordSet, unsigned short texCoordSetToDestroy) |
This method collapses two texcoords into one for all submeshes where this is possible. | |
void | nameSubMesh (const String &name, ushort index) |
Gives a name to a SubMesh. | |
void | prepareForShadowVolume (void) |
Modifies the vertex data to be suitable for use for rendering shadow geometry as in [10]. | |
void | reload (LoadingFlags flags=LF_DEFAULT) override |
Reloads the resource, if it is already loaded. | |
virtual void | removeAllAnimations (void) |
Removes all morph Animations from this mesh. | |
void | removeAllPoses (void) |
Destroy all poses. | |
void | removeAnimation (const String &name) override |
Remove & destroy an Animation from this container. | |
void | removeLodLevels (void) |
Removes all LOD data from this Mesh. | |
void | removePose (const String &name) |
Destroy a pose by name. | |
void | removePose (ushort index) |
Destroy a pose by index. | |
void | resetVertexData (VertexData *data=nullptr) |
replace the shared vertex data with a new one | |
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. | |
void | setHardwareBufferManager (HardwareBufferManagerBase *bufferManager) |
Sets the manager for the vertex and index 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. | |
void | setLodStrategy (LodStrategy *lodStrategy) |
Set the lod strategy used by this mesh. | |
void | setSkeletonName (const String &skelName) |
Sets the name of the skeleton this Mesh uses for animation. | |
void | setVertexBufferPolicy (HardwareBuffer::Usage usage, bool shadowBuffer=false) |
Sets the policy for the vertex buffers to be used when loading this Mesh. | |
bool | suggestTangentVectorBuildParams (unsigned short &outSourceCoordSet) |
Ask the mesh to suggest a source texture coordinate set to a future buildTangentVectors call. | |
bool | suggestTangentVectorBuildParams (VertexElementSemantic targetSemantic, unsigned short &outSourceCoordSet, unsigned short &outIndex) |
void | unnameSubMesh (const String &name) |
Removes a name from a SubMesh. | |
void | updateManualLodLevel (ushort index, const String &meshName) |
Changes the alternate mesh to use as a manual LOD at the given index. | |
Public Member Functions inherited from Ogre::Resource | |
Resource (ResourceManager *creator, const String &name, ResourceHandle handle, const String &group, bool isManual=false, ManualResourceLoader *loader=0) | |
Standard constructor. | |
virtual | ~Resource () |
Virtual destructor. | |
virtual void | _dirtyState () |
Manually mark the state of this resource as having been changed. | |
void | _fireLoadingComplete (bool unused=false) |
Firing of loading complete event. | |
void | _firePreparingComplete (bool unused=false) |
Firing of preparing complete event. | |
void | _fireUnloadingComplete (void) |
Firing of unloading complete event. | |
void | _notifyOrigin (const String &origin) |
Notify this resource of it's origin. | |
virtual void | addListener (Listener *lis) |
Register a listener on this resource. | |
virtual void | changeGroupOwnership (const String &newGroup) |
Change the resource group ownership of a Resource. | |
virtual void | escalateLoading () |
Escalates the loading of a background loaded resource. | |
ResourceManager * | getCreator (void) |
Gets the manager which created this resource. | |
const String & | getGroup (void) const |
Gets the group which this resource is a member of. | |
ResourceHandle | getHandle (void) const |
LoadingState | getLoadingState () const |
Returns the current loading state. | |
const String & | getName (void) const |
Gets resource name. | |
const String & | getOrigin (void) const |
Get the origin of this resource, e.g. | |
size_t | getSize (void) const |
Retrieves info about the size of the resource. | |
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. | |
bool | isBackgroundLoaded (void) const |
Returns whether this Resource has been earmarked for background loading. | |
bool | isLoaded (void) const |
Returns true if the Resource has been loaded, false otherwise. | |
bool | isLoading () const |
Returns whether the resource is currently in the process of background loading. | |
bool | isManuallyLoaded (void) const |
Is this resource manually loaded? | |
bool | isPrepared (void) const |
Returns true if the Resource has been prepared, false otherwise. | |
bool | isReloadable (void) const |
Returns true if the Resource is reloadable, false otherwise. | |
virtual void | load (bool backgroundThread=false) |
Loads the resource, if it is not already. | |
virtual void | prepare (bool backgroundThread=false) |
Prepares the resource for load, if it is not already. | |
virtual void | removeListener (Listener *lis) |
Remove a listener on this resource. | |
void | setBackgroundLoaded (bool bl) |
Tells the resource whether it is background loaded or not. | |
virtual void | touch (void) |
'Touches' the resource to indicate it has been used. | |
virtual void | unload (void) |
Unloads the resource; this is not permanent, the resource can be reloaded later if required. | |
Public Member Functions inherited from Ogre::StringInterface | |
StringInterface () | |
virtual | ~StringInterface () |
Virtual destructor, see Effective C++. | |
void | copyParametersTo (StringInterface *dest) const |
Method for copying this object's parameters to another object. | |
ParamDictionary * | getParamDictionary (void) |
Retrieves the parameter dictionary for this class. | |
const ParamDictionary * | getParamDictionary (void) const |
String | getParameter (const String &name) const |
Generic parameter retrieval method. | |
const ParameterList & | getParameters (void) const |
Retrieves a list of parameters valid for this object. | |
bool | setParameter (const String &name, const String &value) |
Generic parameter setting method. | |
void | setParameterList (const NameValuePairList ¶mList) |
Generic multiple parameter setting method. | |
Public Member Functions inherited from Ogre::AnimationContainer | |
virtual | ~AnimationContainer () |
Static Public Member Functions | |
static void | prepareMatricesForVertexBlend (const Affine3 **blendMatrices, const Affine3 *boneMatrices, const IndexMap &indexMap) |
Prepare matrices for software indexed vertex blend. | |
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. | |
static void | softwareVertexMorph (float 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. | |
static void | softwareVertexPoseBlend (float weight, const std::map< uint32, Vector3f > &vertexOffsetMap, const std::map< uint32, Vector3f > &normalsMap, VertexData *targetVertexData) |
Performs a software vertex pose blend, of the kind used for morph animation although it can be used for other purposes. | |
Static Public Member Functions inherited from Ogre::StringInterface | |
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. | |
Public Attributes | |
IndexMap | sharedBlendIndexToBoneIndexMap |
Shared index map for translating blend index to bone index. | |
VertexData * | sharedVertexData |
Shared vertex data. | |
Resource holding data about 3D mesh.
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.
typedef std::vector<Real> Ogre::Mesh::LodValueList |
typedef std::vector<MeshLodUsage> Ogre::Mesh::MeshLodUsageList |
typedef std::multimap<size_t, VertexBoneAssignment> Ogre::Mesh::VertexBoneAssignmentList |
Multimap of vertex bone assignments (orders by vertex index).
typedef std::vector<SubMesh*> Ogre::Mesh::SubMeshList |
typedef std::vector<unsigned short> Ogre::Mesh::IndexMap |
typedef std::unordered_map<String, ushort> Ogre::Mesh::SubMeshNameMap |
Ogre::Mesh::Mesh | ( | ResourceManager * | creator, |
const String & | name, | ||
ResourceHandle | handle, | ||
const String & | group, | ||
bool | isManual = false , |
||
ManualResourceLoader * | loader = 0 |
||
) |
Default constructor - used by MeshManager.
Ogre::Mesh::~Mesh | ( | ) |
Creates a new SubMesh.
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.
Creates a new SubMesh and gives it a name.
Gets the index of a submesh with a given name.
Useful if you identify the SubMeshes by name (using nameSubMesh) but wish to have faster repeat access.
Gets the number of sub meshes which comprise this mesh.
Referenced by Ogre::Lod0Stripifier::StripLod0Vertices().
Gets a pointer to the submesh indicated by the index.
Referenced by Ogre::Lod0Stripifier::StripLod0Vertices().
|
inline |
Gets an iterator over the available submeshes.
|
inline |
Gets the available submeshes.
|
inline |
replace the shared vertex data with a new one
|
inline |
Creates a new shared vertex data object.
Makes a copy of this mesh object and gives it a new name.
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.
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. |
|
overridevirtual |
Reloads the resource, if it is already loaded.
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.
const AxisAlignedBox & Ogre::Mesh::getBounds | ( | void | ) | const |
Get the axis-aligned bounding box for this mesh.
Gets the radius of the bounding sphere surrounding this mesh.
Real Ogre::Mesh::getBoneBoundingRadius | ( | ) | const |
Gets the radius used to inflate the bounding box around the bones.
void Ogre::Mesh::_setBounds | ( | const AxisAlignedBox & | bounds, |
bool | pad = true |
||
) |
Manually set the bounding box for this Mesh.
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).
bounds | The axis-aligned bounding box for this mesh |
pad | If true, a certain padding will be added to the bounding box to separate it from the mesh |
Manually set the bounding radius.
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).
Manually set the bone bounding radius.
This value is normally computed automatically, however it can be overridden with this method.
void Ogre::Mesh::_computeBoneBoundingRadius | ( | ) |
Compute the bone bounding radius by looking at the vertices, vertex-bone-assignments, and skeleton bind pose.
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).
Automatically update the bounding radius and bounding box for this Mesh.
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!
pad | If true, a certain padding will be added to the bounding box to separate it from the mesh |
void Ogre::Mesh::_calcBoundsFromVertexBuffer | ( | VertexData * | vertexData, |
AxisAlignedBox & | outAABB, | ||
Real & | outRadius, | ||
bool | updateOnly = false |
||
) |
Calculates.
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!
Sets the name of the skeleton this Mesh uses for animation.
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).
skelName | The name of the .skeleton file to use, or an empty string to use no skeleton |
Returns whether or not this mesh has some kind of vertex animation.
|
inline |
Gets a pointer to any linked Skeleton.
void Ogre::Mesh::_initAnimationState | ( | AnimationStateSet * | animSet | ) |
Initialise an animation set suitable for use with this mesh.
Only recommended for use inside the engine, not by applications.
void Ogre::Mesh::_refreshAnimationState | ( | AnimationStateSet * | animSet | ) |
Refresh an animation set suitable for use with this mesh.
Only recommended for use inside the engine, not by applications.
void Ogre::Mesh::addBoneAssignment | ( | const VertexBoneAssignment & | vertBoneAssign | ) |
Assigns a vertex to a bone with a given weight, for skeletal animation.
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.
void Ogre::Mesh::_notifySkeleton | ( | const SkeletonPtr & | pSkel | ) |
BoneAssignmentIterator Ogre::Mesh::getBoneAssignmentIterator | ( | void | ) |
|
inline |
Gets a const reference to the list of bone assignments.
Returns the number of levels of detail that this mesh supports.
This number includes the original model.
Referenced by Ogre::Lod0Stripifier::StripLod0Vertices().
const MeshLodUsage & Ogre::Mesh::getLodLevel | ( | ushort | index | ) | const |
Gets details of the numbered level of detail entry.
Referenced by Ogre::Lod0Stripifier::StripLod0Vertices().
Retrieves the level of detail index for the given LOD value.
Returns true if this mesh has a manual LOD level.
A mesh can either use automatically generated LOD, or it can use alternative meshes as provided by an artist.
Referenced by Ogre::Lod0Stripifier::StripLod0Vertices().
Changes the alternate mesh to use as a manual LOD at the given index.
Note that the index of a LOD may change if you insert other LODs. If in doubt, use getLodIndex().
index | The index of the level to be changed. |
meshName | The name of the mesh which will be the lower level detail version. |
Internal methods for loading LOD, do not use.
Referenced by Ogre::Lod0Stripifier::StripLod0Vertices().
void Ogre::Mesh::_setLodUsage | ( | unsigned short | level, |
const MeshLodUsage & | usage | ||
) |
Internal methods for loading LOD, do not use.
Referenced by Ogre::Lod0Stripifier::StripLod0Vertices().
void Ogre::Mesh::_setSubMeshLodFaceList | ( | unsigned short | subIdx, |
unsigned short | level, | ||
IndexData * | facedata | ||
) |
Internal methods for loading LOD, do not use.
Internal methods for loading LOD, do not use.
|
inline |
Sets the manager for the vertex and index buffers to be used when loading this Mesh.
bufferManager | If 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. |
HardwareBufferManagerBase * Ogre::Mesh::getHardwareBufferManager | ( | ) |
Referenced by Ogre::Lod0Stripifier::StripLod0Vertices().
void Ogre::Mesh::setVertexBufferPolicy | ( | HardwareBuffer::Usage | usage, |
bool | shadowBuffer = false |
||
) |
Sets the policy for the vertex buffers to be used when loading this Mesh.
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.
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.
usage | The usage flag, which by default is HBU_GPU_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 |
void Ogre::Mesh::setIndexBufferPolicy | ( | HardwareBuffer::Usage | usage, |
bool | shadowBuffer = false |
||
) |
Sets the policy for the index buffers to be used when loading this Mesh.
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.
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.
usage | The usage flag, which by default is HBU_GPU_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 |
|
inline |
Gets the usage setting for this meshes vertex buffers.
|
inline |
Gets the usage setting for this meshes index buffers.
Gets whether or not this meshes vertex buffers are shadowed.
Gets whether or not this meshes index buffers are shadowed.
unsigned short Ogre::Mesh::_rationaliseBoneAssignments | ( | size_t | vertexCount, |
VertexBoneAssignmentList & | assignments | ||
) |
Rationalises the passed in bone assignment list.
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.
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. |
Internal method, be called once to compile bone assignments into geometry buffer.
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.
Internal method, be called once to update the compiled bone assignments.
The OGRE engine calls this method automatically. It updates the compiled bone assignments if requested.
void Ogre::Mesh::mergeAdjacentTexcoords | ( | unsigned short | finalTexCoordSet, |
unsigned short | texCoordSetToDestroy | ||
) |
This method collapses two texcoords into one for all submeshes where this is possible.
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.
finalTexCoordSet | The tex. coord index to merge to. Should have enough space to actually work. |
texCoordSetToDestroy | The texture coordinate index that will disappear on successful merges. |
void Ogre::Mesh::buildTangentVectors | ( | unsigned short | sourceTexCoordSet = 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.
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.
sourceTexCoordSet | The texture coordinate index which should be used as the source of 2D texture coordinates, with which to calculate the tangents. |
splitMirrored | Sets whether or not to split vertices when a mirrored tangent space transition is detected (matrix parity differs). TangentSpaceCalc::setSplitMirrored |
splitRotated | Sets whether or not to split vertices when a rotated tangent space is detected. TangentSpaceCalc::setSplitRotated |
storeParityInW | If true , store tangents as a 4-vector and include parity in w. |
|
inline |
References OgreAssert, and Ogre::VES_TANGENT.
Ask the mesh to suggest a source texture coordinate set to a future buildTangentVectors call.
It will detect when there are inappropriate conditions (such as multiple geometry sets which don't agree).
outSourceCoordSet | Reference to a source texture coordinate set which will be used. |
true
if it detects that tangents may have been prepared already.
|
inline |
References OgreAssert, and Ogre::VES_TANGENT.
Builds an edge list for this mesh, which can be used for generating a shadow volume among other things.
Referenced by Ogre::Lod0Stripifier::StripLod0Vertices().
Destroys and frees the edge lists this mesh has built.
Referenced by Ogre::Lod0Stripifier::StripLod0Vertices().
Modifies the vertex data to be suitable for use for rendering shadow geometry as in [10].
Preparing vertex data to generate a shadow volume involves firstly ensuring that the vertex buffer containing the positions is a standalone vertex buffer, with no other components in it. This method will therefore break apart any existing vertex buffers 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. The vertex count used to render 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.
It's important to appreciate that this method can fundamentally change the structure of your vertex buffers, although in reality they will be new buffers. As it happens, if other objects are using the original buffers then they will be unaffected because the reference counting will keep them intact. However, if you have made any assumptions about the structure of the vertex data in the buffers of this object, you may have to rethink them.
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.
Return the edge list for this mesh, building it if required.
You must ensure that the Mesh as been prepared for shadow volume rendering if you intend to use this information for that purpose.
lodIndex | The LOD at which to get the edge list, 0 being the highest. |
Return the edge list for this mesh, building it if required.
You must ensure that the Mesh as been prepared for shadow volume rendering if you intend to use this information for that purpose.
lodIndex | The LOD at which to get the edge list, 0 being the highest. |
Returns whether this mesh has already had it's geometry prepared for use in rendering shadow volumes.
Returns whether this mesh has an attached edge list.
Referenced by Ogre::Lod0Stripifier::StripLod0Vertices().
|
static |
Prepare matrices for software indexed vertex blend.
This function organise bone indexed matrices to blend indexed matrices, so software vertex blending can access to the matrix via blend index directly.
blendMatrices | Pointer to an array of matrix pointers to store prepared results, which indexed by blend index. |
boneMatrices | Pointer to an array of matrices to be used to blend, which indexed by bone index. |
indexMap | The index map used to translate blend index to bone index. |
|
static |
Performs a software indexed vertex blend, of the kind used for skeletal animation although it can be used for other purposes.
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.
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 |
blendMatrices | Pointer to an array of matrix pointers to be used to blend, indexed by blend indices in the sourceVertexData |
numMatrices | Number of matrices in the blendMatrices, it might be used as a hint for optimisation. |
blendNormals | If true , normals are blended as well as positions. |
|
static |
Performs a software vertex morph, of the kind used for morph animation although it can be used for other purposes.
This function will linearly interpolate positions between two source buffers, into a third buffer.
t | Parametric distance between the start and end buffer positions. |
b1 | Vertex buffer containing VET_FLOAT3 entries for the start positions. |
b2 | Vertex buffer containing VET_FLOAT3 entries for the end positions. |
targetVertexData | VertexData destination; assumed to have a separate position buffer already bound, and the number of vertices must agree with the number in start and end |
|
static |
Performs a software vertex pose blend, of the kind used for morph animation although it can be used for other purposes.
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).
weight | Parametric weight to scale the offsets by. |
vertexOffsetMap | Potentially sparse map of vertex index -> offset. |
normalsMap | Potentially sparse map of vertex index -> normal. |
targetVertexData | VertexData destination; assumed to have a separate position buffer already bound, and the number of vertices must agree with the number in start and end. |
|
inline |
Gets a reference to the optional name assignments of the SubMeshes.
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.
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.
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 |
Gets the type of vertex animation the shared vertex data of this mesh supports.
|
inline |
Returns whether animation on shared vertex data includes normals.
Create a new animation with a given length owned by this container.
name | The name of the animation, must be unique within this container. |
length | The length of the animation in seconds |
Implements Ogre::AnimationContainer.
Looks up an Animation object previously created with createAnimation.
name | The name of the animation. |
Implements Ogre::AnimationContainer.
Referenced by Ogre::Lod0Stripifier::StripLod0Vertices().
Internal access to the named vertex Animation object - returns null if it does not exist.
name | The name of the animation. |
Returns whether this object contains the named animation.
Implements Ogre::AnimationContainer.
Remove & destroy an Animation from this container.
Implements Ogre::AnimationContainer.
Gets the number of animations in this container.
Implements Ogre::AnimationContainer.
Referenced by Ogre::Lod0Stripifier::StripLod0Vertices().
Removes all morph Animations from this mesh.
VertexData * Ogre::Mesh::getVertexDataByTrackHandle | ( | unsigned short | handle | ) |
Gets a pointer to a vertex data element based on a morph animation track handle.
0 means the shared vertex data, 1+ means a submesh vertex data (index+1)
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).
Are the derived animation types out of date?
Pose * Ogre::Mesh::createPose | ( | ushort | target, |
const String & | name = BLANKSTRING |
||
) |
Destroy a pose by index.
Destroy a pose by name.
PoseIterator Ogre::Mesh::getPoseIterator | ( | void | ) |
Get an iterator over all the poses defined.
ConstPoseIterator Ogre::Mesh::getPoseIterator | ( | void | ) | const |
Get an iterator over all the poses defined.
Get pose list.
Referenced by Ogre::Lod0Stripifier::StripLod0Vertices().
const LodStrategy * Ogre::Mesh::getLodStrategy | ( | ) | const |
Get LOD strategy used by this mesh.
void Ogre::Mesh::setLodStrategy | ( | LodStrategy * | lodStrategy | ) |
Set the lod strategy used by this mesh.
void Ogre::Mesh::_convertVertexElement | ( | VertexElementSemantic | semantic, |
VertexElementType | dstType | ||
) |
|
inline |
Class that provides convenient interface to establish a linkage between custom user application objects and Ogre core classes.
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
VertexData* Ogre::Mesh::sharedVertexData |
Shared vertex data.
This vertex data can be shared among multiple submeshes. SubMeshes may not have their own VertexData, they may share this one.
Referenced by Ogre::Lod0Stripifier::StripLod0Vertices().
IndexMap Ogre::Mesh::sharedBlendIndexToBoneIndexMap |
Shared index map for translating blend index to bone index.
This index map can be shared among multiple submeshes. SubMeshes might not have their own IndexMap, they might share this one.