OGRE-Next  2.3
Object-Oriented Graphics Rendering Engine
Ogre::Mesh Class Referencefinal

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

#include <OgreMesh2.h>

+ Inheritance diagram for Ogre::Mesh:

Public Types

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 , LF_MARKED_FOR_RELOAD = 8
}
 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 , LOADSTATE_UNLOADED_MARKED_FOR_RELOAD
}
 Enum identifying the loading state of the resource. More...
 
typedef FastArray< RealLodValueArray
 
typedef vector< SubMesh * >::type SubMeshVec
 

Public Member Functions

 Mesh (ResourceManager *creator, const String &name, ResourceHandle handle, const String &group, VaoManager *vaoManager, bool isManual=false, ManualResourceLoader *loader=0)
 Default constructor - used by MeshManager. More...
 
 ~Mesh () override
 
virtual void _dirtyState ()
 Manually mark the state of this resource as having been changed. More...
 
virtual void _fireLoadingComplete (bool wasBackgroundLoaded)
 Firing of loading complete event. More...
 
virtual void _firePreparingComplete (bool wasBackgroundLoaded)
 Firing of preparing complete event. More...
 
virtual void _fireUnloadingComplete ()
 Firing of unloading complete event. More...
 
const LodValueArray_getLodValueArray () const
 
VaoManager_getVaoManager () const
 will return the vao manager that this mesh will use for creating and destroying array objects More...
 
virtual void _notifyOrigin (const String &origin)
 Notify this resource of it's origin. More...
 
void _notifySkeleton (v1::SkeletonPtr &pSkel)
 Internal notification, used to tell the Mesh which Skeleton to use without loading it. More...
 
void _setBoundingSphereRadius (Real radius)
 Manually set the bounding radius. More...
 
void _setBounds (const Aabb &bounds, bool pad=true)
 Manually set the bounding box for this Mesh. More...
 
void _setHashForCaches (const uint64 hash[2])
 Explicitly set a hash for caches. See Mesh::getHashForCaches. More...
 
void _setLodInfo (unsigned short numLevels)
 Internal methods for loading LOD, do not use. More...
 
void _setVaoManager (VaoManager *vaoManager)
 will manually set the vao manager the mesh will use when it loads. More...
 
void _updateBoundsFromVertexBuffers (bool pad=false)
 Automatically update the bounding radius and bounding box for this Mesh. 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 arrangeEfficient (bool halfPos, bool halfTexCoords, bool qTangents)
 Converts this SubMesh to an efficient arrangement. More...
 
virtual void changeGroupOwnership (const String &newGroup)
 Change the resource group ownership of a Resource. More...
 
void clearBoneAssignments ()
 Removes all bone assignments for this mesh. More...
 
MeshPtr clone (const String &newName, const String &newGroup=BLANKSTRING, int vertexBufferType=-1, int indexBufferType=-1)
 Makes a copy of this mesh object and gives it a new name. More...
 
void copy (const MeshPtr &destination, int vertexBufferType=-1, int indexBufferType=-1)
 Will copy this mesh into the destination mesh. More...
 
virtual void copyParametersTo (StringInterface *dest) const
 Method for copying this object's parameters to another object. More...
 
SubMeshcreateSubMesh (size_t index=~0u)
 Creates a new SubMesh. More...
 
void dearrangeToInefficient ()
 Reverts the effects from arrangeEfficient by converting all 16-bit half float back to 32-bit float; and QTangents to Normal, Tangent + Reflection representation, which are more compatible for doing certain operations vertex operations in the CPU. More...
 
void destroySubMesh (unsigned index)
 Destroy a SubMesh with the given index. More...
 
virtual void escalateLoading ()
 Escalates the loading of a background loaded resource. More...
 
const AabbgetAabb () const
 Get the axis-aligned bounding box for this mesh. More...
 
Real getBoundingSphereRadius () const
 Gets the radius of the bounding sphere surrounding this mesh. More...
 
virtual ResourceManagergetCreator ()
 Gets the manager which created this resource. More...
 
virtual const StringgetGroup () const
 Gets the group which this resource is a member of. More...
 
virtual ResourceHandle getHandle () const
 
const uint64getHashForCaches () const
 Returns an array of [2] containing a hash for use in caches. More...
 
BufferType getIndexBufferDefaultType () const
 Gets the usage setting for this meshes index buffers. More...
 
virtual LoadingState getLoadingState () const
 Returns the current loading state. More...
 
uint16 getLodIndex (Real value) const
 Retrieves the level of detail index for the given LOD value. More...
 
const StringgetLodStrategyName () const
 Returns the name of the Lod strategy the user lod values have been calibrated for. More...
 
virtual const StringgetName () const
 Gets resource name. More...
 
uint16 getNumLodLevels () const
 Returns the number of levels of detail that this mesh supports. More...
 
unsigned getNumSubMeshes () const
 Gets the number of sub meshes which comprise this mesh. More...
 
virtual const StringgetOrigin () const
 Get the origin of this resource, e.g. More...
 
ParamDictionarygetParamDictionary ()
 Retrieves the parameter dictionary for this class. More...
 
const ParamDictionarygetParamDictionary () const
 
virtual String getParameter (const String &name) const
 Generic parameter retrieval method. More...
 
const ParameterListgetParameters () const
 Retrieves a list of parameters valid for this object. More...
 
virtual size_t getSize () const
 Retrieves info about the size of the resource. More...
 
const SkeletonDefPtrgetSkeleton () const
 Gets a pointer to any linked Skeleton. More...
 
const StringgetSkeletonName () 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 (unsigned index) const
 Gets a pointer to the submesh indicated by the index. More...
 
const SubMeshVecgetSubMeshes () const
 Gets an iterator over the available submeshes. More...
 
const SubMeshNameMap & getSubMeshNameMap () const
 Gets a reference to the optional name assignments of the SubMeshes. More...
 
BufferType getVertexBufferDefaultType () const
 Gets the usage setting for this meshes vertex buffers. More...
 
bool hasIndependentShadowMappingVaos () const
 Returns true if the shadow mapping buffers do not just reference the real buffers, but are rather their own separate set of optimized geometry. More...
 
bool hasSkeleton () const
 Returns true if this Mesh has a linked Skeleton. More...
 
bool hasValidShadowMappingVaos () const
 Returns true if the mesh is ready for rendering with valid shadow mapping Vaos Otherwise prepareForShadowMapping must be called on this mesh. More...
 
void importV1 (v1::Mesh *mesh, bool halfPos, bool halfTexCoords, bool qTangents, bool halfPose=true)
 Imports a v1 mesh to this mesh, with optional optimization conversions. More...
 
virtual bool isBackgroundLoaded () const
 Returns whether this Resource has been earmarked for background loading. More...
 
bool isIndexBufferShadowed () const
 Gets whether or not this meshes index buffers are shadowed. More...
 
virtual bool isLoaded () 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 () const
 Is this resource manually loaded? More...
 
virtual bool isPrepared () const
 Returns true if the Resource has been prepared, false otherwise. More...
 
virtual bool isReloadable () const
 Returns true if the Resource is reloadable, false otherwise. More...
 
bool isVertexBufferShadowed () 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...
 
bool markForReload ()
 
void nameSubMesh (const String &name, unsigned index)
 Gives a name to a SubMesh. Note, only first 65536 submeshes could be named. More...
 
void operator delete (void *ptr)
 
void operator delete (void *ptr, const char *, int, const char *)
 
void operator delete (void *ptr, void *)
 
void operator delete[] (void *ptr)
 
void operator delete[] (void *ptr, const char *, int, const char *)
 
void * operator new (size_t sz)
 
void * operator new (size_t sz, const char *file, int line, const char *func)
 operator new, with debug line info More...
 
void * operator new (size_t sz, void *ptr)
 placement operator new More...
 
void * operator new[] (size_t sz)
 
void * operator new[] (size_t sz, const char *file, int line, const char *func)
 array operator new, with debug line info More...
 
virtual void prepare (bool backgroundThread=false)
 Prepares the resource for load, if it is not already. More...
 
void prepareForShadowMapping (bool forceSameBuffers)
 
virtual void reload (LoadingFlags flags=LF_DEFAULT)
 Reloads the resource, if it is already loaded. More...
 
virtual void removeListener (Listener *lis)
 Remove a listener on this resource. More...
 
void removeLodLevels ()
 Internal methods for loading LOD, do not use. More...
 
virtual void setBackgroundLoaded (bool bl)
 Tells the resource whether it is background loaded or not. More...
 
void setIndexBufferPolicy (BufferType bufferType, bool shadowBuffer=false)
 Sets the policy for the index buffers to be used when loading this Mesh. More...
 
void setLodStrategyName (const String &name)
 
virtual void setManuallyLoaded (bool isManual)
 Set "Is this resource manually loaded?". More...
 
virtual bool setParameter (const String &name, const String &value)
 Generic parameter setting method. More...
 
virtual void setParameterList (const NameValuePairList &paramList)
 Generic multiple parameter setting method. More...
 
void setSkeletonName (const String &skelName)
 Calculates. More...
 
virtual void setToLoaded ()
 Change the Resource loading state to loaded. More...
 
void setVertexBufferPolicy (BufferType bufferType, bool shadowBuffer=false)
 Sets the policy for the vertex buffers to be used when loading this Mesh. More...
 
virtual void touch ()
 'Touches' the resource to indicate it has been used. More...
 
virtual void unload ()
 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...
 

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

Public Attributes

 OGRE_AUTO_MUTEX
 

Static Public Attributes

static bool msOptimizeForShadowMapping
 When this bool is false, prepareForShadowMapping will use the same Vaos for both regular and shadow mapping rendering. More...
 
static bool msUseTimestampAsHash
 If a mesh file didn't save hash information (see Mesh::getHashForCaches) and msUseTimestampAsHash == true; then we use the file last modified timestamp as hash (it's better than nothing). More...
 

Friends

class MeshSerializerImpl
 
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

◆ LodValueArray

◆ SubMeshVec

typedef vector<SubMesh*>::type Ogre::Mesh::SubMeshVec

Member Enumeration Documentation

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

LF_MARKED_FOR_RELOAD 

Resources are marked for reload on unloading, and only marked ones are processed on reloading.

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

LOADSTATE_UNLOADED_MARKED_FOR_RELOAD 

Unloaded and marked for reload.

Constructor & Destructor Documentation

◆ Mesh()

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

Default constructor - used by MeshManager.

Warning
Do not call this method directly.

◆ ~Mesh()

Ogre::Mesh::~Mesh ( )
override

Member Function Documentation

◆ _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()

virtual void Ogre::Resource::_fireLoadingComplete ( bool  wasBackgroundLoaded)
virtualinherited

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

virtual void Ogre::Resource::_firePreparingComplete ( bool  wasBackgroundLoaded)
virtualinherited

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

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

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.

◆ _getLodValueArray()

const LodValueArray* Ogre::Mesh::_getLodValueArray ( ) const
inline

◆ _getVaoManager()

VaoManager* Ogre::Mesh::_getVaoManager ( ) const
inline

will return the vao manager that this mesh will use for creating and destroying array objects

◆ _notifyOrigin()

virtual void Ogre::Resource::_notifyOrigin ( const String origin)
inlinevirtualinherited

Notify this resource of it's origin.

◆ _notifySkeleton()

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

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

◆ _setBounds()

void Ogre::Mesh::_setBounds ( const Aabb 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

◆ _setHashForCaches()

void Ogre::Mesh::_setHashForCaches ( const uint64  hash[2])

Explicitly set a hash for caches. See Mesh::getHashForCaches.

◆ _setLodInfo()

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

Internal methods for loading LOD, do not use.

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

◆ _setVaoManager()

void Ogre::Mesh::_setVaoManager ( VaoManager vaoManager)
inline

will manually set the vao manager the mesh will use when it loads.

setting this when the mesh is already loaded will cause a crash on unload, use with caution!

◆ _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

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

◆ addListener()

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

Register a listener on this resource.

See also
Resource::Listener

Reimplemented in Ogre::UnifiedHighLevelGpuProgram.

◆ arrangeEfficient()

void Ogre::Mesh::arrangeEfficient ( bool  halfPos,
bool  halfTexCoords,
bool  qTangents 
)

Converts this SubMesh to an efficient arrangement.

@See Mesh::importV1 for an explanation on the parameters.

See also
dearrangeEfficientToInefficient to perform the opposite operation.

◆ 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

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

◆ clearBoneAssignments()

void Ogre::Mesh::clearBoneAssignments ( )

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.

◆ clone()

MeshPtr Ogre::Mesh::clone ( const String newName,
const String newGroup = BLANKSTRING,
int  vertexBufferType = -1,
int  indexBufferType = -1 
)

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.
vertexBufferTypeSee BufferType. Must be set to a valid BufferType. Pass a negative value to keep the same type of the original buffer being cloned.
indexBufferTypeSee BufferType. Must be set to a valid BufferType. Pass a negative value to keep the same type of the original buffer being cloned.

◆ copy()

void Ogre::Mesh::copy ( const MeshPtr destination,
int  vertexBufferType = -1,
int  indexBufferType = -1 
)

Will copy this mesh into the destination mesh.

Remarks
similar to clone however will copy into a mesh you define rather than creating one for you.
Parameters
destinationThe mesh that will be the destination for the copy of *this
vertexBufferTypeSee BufferType. Must be set to a valid BufferType. Pass a negative value to keep the same type of the original buffer being cloned.
indexBufferTypeSee BufferType. Must be set to a valid BufferType. Pass a negative value to keep the same type of the original buffer being cloned.

◆ copyParametersTo()

virtual void Ogre::StringInterface::copyParametersTo ( StringInterface dest) const
inlinevirtualinherited

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

◆ createSubMesh()

SubMesh* Ogre::Mesh::createSubMesh ( size_t  index = ~0u)

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.
Parameters
indexOptional param that will insert the submesh at the specified index. This should be less than getNumSubMeshes(), otherwise it indicates the new submesh will simply be appended to the submesh list.

◆ dearrangeToInefficient()

void Ogre::Mesh::dearrangeToInefficient ( )

Reverts the effects from arrangeEfficient by converting all 16-bit half float back to 32-bit float; and QTangents to Normal, Tangent + Reflection representation, which are more compatible for doing certain operations vertex operations in the CPU.

◆ destroySubMesh()

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

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

◆ getAabb()

const Aabb& Ogre::Mesh::getAabb ( ) const

Get the axis-aligned bounding box for this mesh.

◆ getBoundingSphereRadius()

Real Ogre::Mesh::getBoundingSphereRadius ( ) const

Gets the radius of the bounding sphere surrounding this mesh.

◆ getCreator()

virtual ResourceManager* Ogre::Resource::getCreator ( )
inlinevirtualinherited

Gets the manager which created this resource.

◆ getGroup()

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

Gets the group which this resource is a member of.

Reimplemented in Ogre::v1::OldSkeletonInstance.

◆ getHandle()

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

Reimplemented in Ogre::v1::OldSkeletonInstance.

◆ getHashForCaches()

const uint64* Ogre::Mesh::getHashForCaches ( ) const
inline

Returns an array of [2] containing a hash for use in caches.

A value of { 0, 0 } should be treated as not initialized.

How this cache is calculated is unknown and could just be a filesystem timestamp rather than a checksum.

When callers see that: getCacheHash()[i] != savedHash[i]

they should treat as if the mesh has changed and the cache entry became stale

◆ getIndexBufferDefaultType()

BufferType Ogre::Mesh::getIndexBufferDefaultType ( ) const
inline

Gets the usage setting for this meshes index buffers.

◆ getLoadingState()

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

Returns the current loading state.

Reimplemented in Ogre::UnifiedHighLevelGpuProgram.

References Ogre::AtomicScalar< T >::get().

◆ getLodIndex()

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

◆ getLodStrategyName()

const String& Ogre::Mesh::getLodStrategyName ( ) const
inline

Returns the name of the Lod strategy the user lod values have been calibrated for.

◆ getName()

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

Gets resource name.

Reimplemented in Ogre::v1::OldSkeletonInstance.

Referenced by Ogre::GpuProgramUsage::getProgramName().

◆ getNumLodLevels()

uint16 Ogre::Mesh::getNumLodLevels ( ) const

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

Remarks
This number includes the original model.

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

◆ getNumSubMeshes()

unsigned Ogre::Mesh::getNumSubMeshes ( ) const

Gets the number of sub meshes which comprise this mesh.

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

◆ getOrigin()

virtual const String& Ogre::Resource::getOrigin ( ) const
inlinevirtualinherited

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.

◆ getParamDictionary() [1/2]

ParamDictionary* Ogre::StringInterface::getParamDictionary ( )
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 ( ) const
inlineinherited

◆ getParameter()

virtual String Ogre::StringInterface::getParameter ( const String name) const
inlinevirtualinherited

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

◆ getParameters()

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

Retrieves a list of parameters valid for this object.

Returns
A reference to a static list of ParameterDef objects.

◆ getSize()

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

Retrieves info about the size of the resource.

Reimplemented in Ogre::UnifiedHighLevelGpuProgram.

◆ getSkeleton()

const SkeletonDefPtr& Ogre::Mesh::getSkeleton ( ) const
inline

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 ( ) const

Gets the name of any linked Skeleton.

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

◆ getSubMesh()

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

Gets a pointer to the submesh indicated by the index.

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

◆ getSubMeshes()

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

Gets an iterator over the available submeshes.

◆ getSubMeshNameMap()

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

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

◆ getVertexBufferDefaultType()

BufferType Ogre::Mesh::getVertexBufferDefaultType ( ) const
inline

Gets the usage setting for this meshes vertex buffers.

◆ hasIndependentShadowMappingVaos()

bool Ogre::Mesh::hasIndependentShadowMappingVaos ( ) const

Returns true if the shadow mapping buffers do not just reference the real buffers, but are rather their own separate set of optimized geometry.

◆ hasSkeleton()

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

Returns true if this Mesh has a linked Skeleton.

◆ hasValidShadowMappingVaos()

bool Ogre::Mesh::hasValidShadowMappingVaos ( ) const

Returns true if the mesh is ready for rendering with valid shadow mapping Vaos Otherwise prepareForShadowMapping must be called on this mesh.

◆ importV1()

void Ogre::Mesh::importV1 ( v1::Mesh mesh,
bool  halfPos,
bool  halfTexCoords,
bool  qTangents,
bool  halfPose = true 
)

Imports a v1 mesh to this mesh, with optional optimization conversions.

This mesh must be in unloaded state. Resulting mesh would be non-reloadable, use MeshManager::createByImportingV1 to create mesh that will survive device lost event.

Remarks
The vertex stream will be converted to a single interleaved buffer; i.e. if the original mesh had 3 vertex buffers: [1] = POSITION, POSITION, POSITION, POSITION, ... [2] = NORMALS, NORMALS, NORMALS, NORMALS, ... [3] = UV, UV, UV, UV, ... then the v2 mesh will have only 1 vertex buffer: [1] = POSITION NORMALS UV, POS NORM UV, POS NORM UV, POS NORM UV, ...
Parameters
meshThe source v1 mesh to convert from. You can unload or delete this pointer afterwards.
halfPosTrue if you want to convert the position data to VET_HALF4 format. Recommended on desktop to reduce memory and bandwidth requirements. Rarely the extra precision is needed. Unfortuntately on mobile, not all ES2 devices support VET_HALF4.
halfTexCoordsTrue if you want to convert the position data to VET_HALF2 or VET_HALF4 format. Same recommendations as halfPos.
qTangentsTrue if you want to generate tangent and reflection information (modifying the original v1 mesh) and convert this data to a QTangent, requiring VET_SHORT4_SNORM (8 bytes vs 28 bytes to store normals, tangents and reflection). Needs much less space, trading for more ALU ops in the vertex shader for decoding the QTangent. Highly recommended on both desktop and mobile if you need tangents (i.e. normal mapping).
halfPoseTrue if you want the pose buffer to have pixel format PF_FLOAT16_RGBA which uses significantly less memory. Otherwise it is created with pixel format PF_FLOAT32_RGBA. Rarely the extra precision is needed.

◆ isBackgroundLoaded()

virtual bool Ogre::Resource::isBackgroundLoaded ( ) 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.

◆ isIndexBufferShadowed()

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

Gets whether or not this meshes index buffers are shadowed.

◆ isLoaded()

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

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

Reimplemented in Ogre::UnifiedHighLevelGpuProgram.

References Ogre::AtomicScalar< T >::get().

◆ isLoading()

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

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

Reimplemented in Ogre::UnifiedHighLevelGpuProgram.

References Ogre::AtomicScalar< T >::get().

◆ isManuallyLoaded()

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

Is this resource manually loaded?

◆ isPrepared()

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

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

References Ogre::AtomicScalar< T >::get().

◆ isReloadable()

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

Returns true if the Resource is reloadable, false otherwise.

Reimplemented in Ogre::UnifiedHighLevelGpuProgram.

◆ isVertexBufferShadowed()

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

Gets whether or not this meshes vertex buffers are shadowed.

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

◆ markForReload()

bool Ogre::Resource::markForReload ( )
inlineinherited

◆ nameSubMesh()

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

Gives a name to a SubMesh. Note, only first 65536 submeshes could be named.

◆ operator delete() [1/3]

template<class Alloc >
void Ogre::AllocatedObject< Alloc >::operator delete ( void *  ptr)
inlineinherited

◆ operator delete() [2/3]

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

◆ operator delete() [3/3]

template<class Alloc >
void Ogre::AllocatedObject< Alloc >::operator delete ( void *  ptr,
void *   
)
inlineinherited

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

template<class Alloc >
void Ogre::AllocatedObject< Alloc >::operator delete[] ( void *  ptr)
inlineinherited

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

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

◆ operator new() [1/3]

template<class Alloc >
void* Ogre::AllocatedObject< Alloc >::operator new ( size_t  sz)
inlineinherited

◆ operator new() [2/3]

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

operator new, with debug line info

◆ operator new() [3/3]

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

placement operator new

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

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

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

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

array operator new, with debug line info

◆ 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

◆ prepareForShadowMapping()

void Ogre::Mesh::prepareForShadowMapping ( bool  forceSameBuffers)

◆ reload()

virtual void Ogre::Resource::reload ( LoadingFlags  flags = LF_DEFAULT)
virtualinherited

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 in Ogre::UnifiedHighLevelGpuProgram, and Ogre::v1::Mesh.

◆ removeListener()

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

Remove a listener on this resource.

See also
Resource::Listener

Reimplemented in Ogre::UnifiedHighLevelGpuProgram.

◆ removeLodLevels()

void Ogre::Mesh::removeLodLevels ( )

Internal methods for loading LOD, do not use.

Removes all LOD data from this Mesh.

◆ setBackgroundLoaded()

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

Tells the resource whether it is background loaded or not.

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

◆ setIndexBufferPolicy()

void Ogre::Mesh::setIndexBufferPolicy ( BufferType  bufferType,
bool  shadowBuffer = false 
)

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

See also
setVertexBufferPolicy

◆ setLodStrategyName()

void Ogre::Mesh::setLodStrategyName ( const String name)
inline

◆ setManuallyLoaded()

virtual void Ogre::Resource::setManuallyLoaded ( bool  isManual)
inlinevirtualinherited

Set "Is this resource manually loaded?".

◆ setParameter()

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

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

virtual void Ogre::StringInterface::setParameterList ( const NameValuePairList paramList)
virtualinherited

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

◆ setSkeletonName()

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

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! 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).
Parameters
skelNameThe name of the .skeleton file to use, or an empty string to use no skeleton

◆ setToLoaded()

virtual void Ogre::Resource::setToLoaded ( )
inlinevirtualinherited

Change the Resource loading state to loaded.

References Ogre::AtomicScalar< T >::set().

◆ setVertexBufferPolicy()

void Ogre::Mesh::setVertexBufferPolicy ( BufferType  bufferType,
bool  shadowBuffer = false 
)

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

Remarks
By default, when loading the Mesh, immutable 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
bufferTypeThe buffer type flags, which by default is BT_IMMUTABLE
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.

◆ touch()

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

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

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

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

◆ unload()

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

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

Reimplemented in Ogre::UnifiedHighLevelGpuProgram.

◆ unnameSubMesh()

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

Removes a name from a SubMesh.

Friends And Related Function Documentation

◆ MeshSerializerImpl

friend class MeshSerializerImpl
friend

◆ SubMesh

friend class SubMesh
friend

Member Data Documentation

◆ msOptimizeForShadowMapping

bool Ogre::Mesh::msOptimizeForShadowMapping
static

When this bool is false, prepareForShadowMapping will use the same Vaos for both regular and shadow mapping rendering.

When it's true, it will calculate an optimized version to speed up shadow map rendering (uses a bit more GPU VRAM). Large meshes can take long to optimize thus it is recommended to perform this offline and save it into the mesh file. It's off by default.

See also
Ogre::Mesh::msOptimizeForShadowMapping for the v2 version
Ogre::v1::Mesh::msOptimizeForShadowMapping for the v1 version

◆ msUseTimestampAsHash

bool Ogre::Mesh::msUseTimestampAsHash
static

If a mesh file didn't save hash information (see Mesh::getHashForCaches) and msUseTimestampAsHash == true; then we use the file last modified timestamp as hash (it's better than nothing).

By default this is disabled since it's often not needed and can't hurt loading times with unnecessary disk access

◆ OGRE_AUTO_MUTEX

Ogre::Resource::OGRE_AUTO_MUTEX
inherited

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