DigitalSpaces::DIOGREMesh Struct Reference
[Ogre]

#include <OGREInterfaces.h>

Inherits DigitalSpaces::DIObjectBase.


Public Member Functions

DIOGRESubMeshCreateSubMesh (void)
 Creates a new DIOGRESubMesh.
DIOGRESubMeshCreateSubMesh (const char *name)
 Creates a new DIOGRESubMesh and gives it a name.
void NameSubMesh (const char *name, unsigned short index)
 Gives a name to a DIOGRESubMesh.
unsigned short _GetSubMeshIndex (const char *name)
 Gets the index of a submesh with a given name.
unsigned short GetNumSubMeshes (void)
 Gets the number of sub meshes which comprise this mesh.
DIOGRESubMeshGetSubMesh (unsigned short index)
 Gets a pointer to the submesh indicated by the index.
DIOGRESubMeshGetSubMesh (const char *name)
 Gets a DIOGRESubMesh by name.
DIOGREMeshClone (const char *newName)
 Makes a copy of this mesh object and gives it a new name.
DIOGREMeshClone (const char *newName, const char *newGroup)
DIOGREAxisAlignedBoxGetBounds (void)
 Get the axis-aligned bounding box for this mesh.
float GetBoundingSphereRadius (void)
 Gets the radius of the bounding sphere surrounding this mesh.
void _SetBounds (DIOGREAxisAlignedBox *bounds)
 Manually set the bounding box for this Mesh.
void _SetBounds (DIOGREAxisAlignedBox *bounds, bool pad)
void _SetBoundingSphereRadius (float radius)
 Manually set the bounding radius.
void SetSkeletonName (const char *skelName)
 Sets the name of the skeleton this Mesh uses for animation.
bool HasSkeleton (void)
 Returns true if this Mesh has a linked Skeleton.
const DIOGRESkeletonGetSkeleton (void)
 Gets a pointer to any linked Skeleton.
const char * GetSkeletonName (void)
 Gets the name of any linked Skeleton.
void AddBoneAssignment (OGREVertexBoneAssignment *vertBoneAssign)
 Assigns a vertex to a bone with a given weight, for skeletal animation.
void ClearBoneAssignments (void)
 Removes all bone assignments for this mesh.
unsigned short GetNumLodLevels (void)
 Gets an iterator for access all bone assignments.
void GetLodLevel (unsigned short index, OGREMeshLodUsage *outMeshLODUsage)
 Gets details of the numbered level of detail entry.
void CreateManualLodLevel (float fromDepth, const char *meshName)
 Adds a new manual level-of-detail entry to this Mesh.
void UpdateManualLodLevel (unsigned short index, const char *meshName)
 Changes the alternate mesh to use as a manual LOD at the given index.
unsigned short GetLodIndex (float depth)
 Retrieves the level of detail index for the given depth value.
unsigned short GetLodIndexSquaredDepth (float squaredDepth)
 Retrieves the level of detail index for the given squared depth value.
bool IsLodManual (void)
 Returns true if this mesh is using manual LOD.
void RemoveLodLevels (void)
 Removes all LOD data from this Mesh.
void SetVertexBufferPolicy (OGREHardwareBufferUsage usage)
 Sets the policy for the vertex buffers to be used when loading this Mesh.
void SetVertexBufferPolicy (OGREHardwareBufferUsage usage, bool shadowBuffer)
void SetIndexBufferPolicy (OGREHardwareBufferUsage usage)
 Sets the policy for the index buffers to be used when loading this Mesh.
void SetIndexBufferPolicy (OGREHardwareBufferUsage usage, bool shadowBuffer)
OGREHardwareBufferUsage GetVertexBufferUsage (void)
 Gets the usage setting for this meshes vertex buffers.
OGREHardwareBufferUsage GetIndexBufferUsage (void)
 Gets the usage setting for this meshes index buffers.
bool IsVertexBufferShadowed (void)
 Gets whether or not this meshes vertex buffers are shadowed.
bool IsIndexBufferShadowed (void)
 Gets whether or not this meshes index buffers are shadowed.
void BuildTangentVectors (void)
 Rationalises the passed in bone assignment list.
void BuildTangentVectors (unsigned short sourceTexCoordSet, unsigned short destTexCoordSet)
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.
bool IsPreparedForShadowVolumes (void)
 Return the edge list for this mesh, building it if required.
bool IsEdgeListBuilt (void)
 Returns whether this mesh has an attached edge list.
void SetAutoBuildEdgeLists (bool autobuild)
 Gets a reference to the optional name assignments of the SubMeshes.
bool GetAutoBuildEdgeLists (void)
 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.

Member Function Documentation

DIOGRESubMesh* DigitalSpaces::DIOGREMesh::CreateSubMesh ( void   ) 

Creates a new DIOGRESubMesh.

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.

DIOGRESubMesh* DigitalSpaces::DIOGREMesh::CreateSubMesh ( const char *  name  ) 

Creates a new DIOGRESubMesh and gives it a name.

void DigitalSpaces::DIOGREMesh::NameSubMesh ( const char *  name,
unsigned short  index 
)

Gives a name to a DIOGRESubMesh.

unsigned short DigitalSpaces::DIOGREMesh::_GetSubMeshIndex ( const char *  name  ) 

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.

unsigned short DigitalSpaces::DIOGREMesh::GetNumSubMeshes ( void   ) 

Gets the number of sub meshes which comprise this mesh.

DIOGRESubMesh* DigitalSpaces::DIOGREMesh::GetSubMesh ( unsigned short  index  ) 

Gets a pointer to the submesh indicated by the index.

DIOGRESubMesh* DigitalSpaces::DIOGREMesh::GetSubMesh ( const char *  name  ) 

Gets a DIOGRESubMesh by name.

DIOGREMesh* DigitalSpaces::DIOGREMesh::Clone ( const char *  newName  ) 

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.

DIOGREMesh* DigitalSpaces::DIOGREMesh::Clone ( const char *  newName,
const char *  newGroup 
)

DIOGREAxisAlignedBox* DigitalSpaces::DIOGREMesh::GetBounds ( void   ) 

Get the axis-aligned bounding box for this mesh.

float DigitalSpaces::DIOGREMesh::GetBoundingSphereRadius ( void   ) 

Gets the radius of the bounding sphere surrounding this mesh.

void DigitalSpaces::DIOGREMesh::_SetBounds ( DIOGREAxisAlignedBox bounds  ) 

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 DigitalSpaces::DIOGREMesh::_SetBounds ( DIOGREAxisAlignedBox bounds,
bool  pad 
)

void DigitalSpaces::DIOGREMesh::_SetBoundingSphereRadius ( float  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 DigitalSpaces::DIOGREMesh::SetSkeletonName ( const char *  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

bool DigitalSpaces::DIOGREMesh::HasSkeleton ( void   ) 

Returns true if this Mesh has a linked Skeleton.

const DIOGRESkeleton* DigitalSpaces::DIOGREMesh::GetSkeleton ( void   ) 

Gets a pointer to any linked Skeleton.

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

const char* DigitalSpaces::DIOGREMesh::GetSkeletonName ( void   ) 

Gets the name of any linked Skeleton.

void DigitalSpaces::DIOGREMesh::AddBoneAssignment ( OGREVertexBoneAssignment 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-DIOGRESubMesh geometry, see the equivalent methods on DIOGRESubMesh.

void DigitalSpaces::DIOGREMesh::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-DIOGRESubMesh geometry, see the equivalent methods on DIOGRESubMesh.

unsigned short DigitalSpaces::DIOGREMesh::GetNumLodLevels ( void   ) 

Gets an iterator for access all bone assignments.

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. Returns the number of levels of detail that this mesh supports.
Remarks:
This number includes the original model.

void DigitalSpaces::DIOGREMesh::GetLodLevel ( unsigned short  index,
OGREMeshLodUsage outMeshLODUsage 
)

Gets details of the numbered level of detail entry.

void DigitalSpaces::DIOGREMesh::CreateManualLodLevel ( float  fromDepth,
const char *  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.

void DigitalSpaces::DIOGREMesh::UpdateManualLodLevel ( unsigned short  index,
const char *  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.

unsigned short DigitalSpaces::DIOGREMesh::GetLodIndex ( float  depth  ) 

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

unsigned short DigitalSpaces::DIOGREMesh::GetLodIndexSquaredDepth ( float  squaredDepth  ) 

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.

bool DigitalSpaces::DIOGREMesh::IsLodManual ( void   ) 

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.

void DigitalSpaces::DIOGREMesh::RemoveLodLevels ( void   ) 

Removes all LOD data from this Mesh.

void DigitalSpaces::DIOGREMesh::SetVertexBufferPolicy ( OGREHardwareBufferUsage  usage  ) 

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 DigitalSpaces::DIOGREMesh::SetVertexBufferPolicy ( OGREHardwareBufferUsage  usage,
bool  shadowBuffer 
)

void DigitalSpaces::DIOGREMesh::SetIndexBufferPolicy ( OGREHardwareBufferUsage  usage  ) 

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.

void DigitalSpaces::DIOGREMesh::SetIndexBufferPolicy ( OGREHardwareBufferUsage  usage,
bool  shadowBuffer 
)

OGREHardwareBufferUsage DigitalSpaces::DIOGREMesh::GetVertexBufferUsage ( void   ) 

Gets the usage setting for this meshes vertex buffers.

OGREHardwareBufferUsage DigitalSpaces::DIOGREMesh::GetIndexBufferUsage ( void   ) 

Gets the usage setting for this meshes index buffers.

bool DigitalSpaces::DIOGREMesh::IsVertexBufferShadowed ( void   ) 

Gets whether or not this meshes vertex buffers are shadowed.

bool DigitalSpaces::DIOGREMesh::IsIndexBufferShadowed ( void   ) 

Gets whether or not this meshes index buffers are shadowed.

void DigitalSpaces::DIOGREMesh::BuildTangentVectors ( void   ) 

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

The prerequisites for calling this method include that the vertex data used by every DIOGRESubMesh 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.

void DigitalSpaces::DIOGREMesh::BuildTangentVectors ( unsigned short  sourceTexCoordSet,
unsigned short  destTexCoordSet 
)

bool DigitalSpaces::DIOGREMesh::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

void DigitalSpaces::DIOGREMesh::BuildEdgeList ( void   ) 

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

void DigitalSpaces::DIOGREMesh::FreeEdgeList ( void   ) 

Destroys and frees the edge lists this mesh has built.

void DigitalSpaces::DIOGREMesh::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.

bool DigitalSpaces::DIOGREMesh::IsPreparedForShadowVolumes ( void   ) 

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

bool DigitalSpaces::DIOGREMesh::IsEdgeListBuilt ( void   ) 

Returns whether this mesh has an attached edge list.

void DigitalSpaces::DIOGREMesh::SetAutoBuildEdgeLists ( bool  autobuild  ) 

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.

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.

bool DigitalSpaces::DIOGREMesh::GetAutoBuildEdgeLists ( void   ) 

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.


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

Generated on Sun Aug 31 17:46:31 2008 for Digital Spaces by  doxygen 1.5.6