CS::Mesh::iAnimatedMeshFactory Struct Reference
[Mesh plugins]
State of an animated mesh object factory. More...
#include <imesh/animesh.h>
Public Member Functions | |
virtual void | Invalidate ()=0 |
Update the mesh after modifying its geometry. | |
Subsets | |
virtual size_t | AddSubset ()=0 |
Create a new user-defined subset and return its index. | |
virtual void | AddSubsetVertex (const size_t subset, const size_t vertexIndex)=0 |
Add a vertex to a subset. | |
virtual void | ClearSubsets ()=0 |
Remove all subsets from this factory and rebuild the original (unoptimized) morph targets. | |
virtual size_t | GetSubsetCount () const =0 |
Get the number of subsets associated with this factory. | |
virtual size_t | GetSubsetVertex (const size_t subset, const size_t vertexIndex) const =0 |
Get the index of a vertex in a specified subset. | |
virtual size_t | GetSubsetVertexCount (const size_t subset) const =0 |
Get the number of vertices belonging to a subset. | |
Morph targets | |
virtual void | ClearMorphTargets ()=0 |
Remove all morph targets. | |
virtual iAnimatedMeshMorphTarget * | CreateMorphTarget (const char *name)=0 |
Create a new morph target. | |
virtual uint | FindMorphTarget (const char *name) const =0 |
Find the index of the morph target with the given name (or (uint)~0 if no target with that name exists). | |
virtual iAnimatedMeshMorphTarget * | GetMorphTarget (uint target)=0 |
Get a specific morph target. | |
virtual uint | GetMorphTargetCount () const =0 |
Get number of morph targets. | |
Vertex data definition and handling | |
virtual void | ComputeTangents ()=0 |
Compute the tangents and binormals from the current vertices, normals and texels. | |
virtual iRenderBuffer * | GetBinormals ()=0 |
Get a pointer to the buffer specifying the vertex binormals. | |
virtual iRenderBuffer * | GetColors ()=0 |
Get a pointer to the buffer specifying the vertex color. | |
virtual iRenderBuffer * | GetNormals ()=0 |
Get a pointer to the buffer specifying the vertex normals. | |
virtual iRenderBuffer * | GetTangents ()=0 |
Get a pointer to the buffer specifying the vertex tangents. | |
virtual iRenderBuffer * | GetTexCoords ()=0 |
Get a pointer to the buffer specifying the texture coordinates. | |
virtual uint | GetVertexCount () const =0 |
Get the number of vertices in the mesh. | |
virtual iRenderBuffer * | GetVertices ()=0 |
Get a pointer to the buffer specifying the vertices. | |
virtual bool | SetBinormals (iRenderBuffer *renderBuffer)=0 |
Set the render buffer to use for the binormals. | |
virtual bool | SetColors (iRenderBuffer *renderBuffer)=0 |
Set the render buffer to use for the vertex color. | |
virtual bool | SetNormals (iRenderBuffer *renderBuffer)=0 |
Set the render buffer to use for the normals. | |
virtual bool | SetTangents (iRenderBuffer *renderBuffer)=0 |
Set the render buffer to use for the tangents. | |
virtual bool | SetTexCoords (iRenderBuffer *renderBuffer)=0 |
Set the render buffer to use for the texture coordinates. | |
virtual bool | SetVertices (iRenderBuffer *renderBuffer)=0 |
Set the render buffer to use for the vertices. | |
Socket | |
virtual void | CreateSocket (CS::Animation::BoneID bone, const csReversibleTransform &transform, const char *name)=0 |
Create a new socket. | |
virtual uint | FindSocket (const char *name) const =0 |
Find the index of the socket with the given name (or (uint)~0 if no socket with that name exists). | |
virtual iAnimatedMeshSocketFactory * | GetSocket (size_t index) const =0 |
Get a specific socket instance. | |
virtual size_t | GetSocketCount () const =0 |
Get the number of sockets in this factory. | |
SubMesh handling | |
virtual iAnimatedMeshSubMeshFactory * | CreateSubMesh (const csArray< iRenderBuffer * > &indices, const csArray< csArray< unsigned int > > &boneIndices, const char *name, bool visible)=0 |
Create a new submesh. | |
virtual iAnimatedMeshSubMeshFactory * | CreateSubMesh (iRenderBuffer *indices, const char *name, bool visible)=0 |
Create a new submesh. | |
virtual void | DeleteSubMesh (iAnimatedMeshSubMeshFactory *mesh)=0 |
Remove a submesh from this factory. | |
virtual size_t | FindSubMesh (const char *name) const =0 |
Find a submesh index by name, returns (size_t)-1 if not found. | |
virtual iAnimatedMeshSubMeshFactory * | GetSubMesh (size_t index) const =0 |
Get a submesh by index. | |
virtual size_t | GetSubMeshCount () const =0 |
Get the total number of submeshes. | |
Bounding boxes | |
virtual const csBox3 & | GetBoneBoundingBox (CS::Animation::BoneID bone) const =0 |
Get the bounding box of the bone with the given ID. | |
virtual void | SetBoneBoundingBox (CS::Animation::BoneID bone, const csBox3 &box)=0 |
Set the bounding box of the given bone. | |
Bone influences | |
virtual AnimatedMeshBoneInfluence * | GetBoneInfluences ()=0 |
Get the bone influences. | |
virtual uint | GetBoneInfluencesPerVertex () const =0 |
Get the number of bone influences per vertex. | |
virtual void | SetBoneInfluencesPerVertex (uint num)=0 |
Set the requested number of bone influences per vertex. | |
Skeleton | |
virtual CS::Animation::iSkeletonFactory * | GetSkeletonFactory () const =0 |
Get the skeleton factory associated with the mesh factory. | |
virtual void | SetSkeletonFactory (CS::Animation::iSkeletonFactory *skeletonFactory)=0 |
Set the skeleton factory to associate with the mesh factory. |
Detailed Description
State of an animated mesh object factory.
These meshes are animated by the skeletal animation system (see CS::Animation::iSkeletonFactory) and by morphing (see CS::Mesh::iAnimatedMeshMorphTarget).
Definition at line 178 of file animesh.h.
Member Function Documentation
virtual size_t CS::Mesh::iAnimatedMeshFactory::AddSubset | ( | ) | [pure virtual] |
Create a new user-defined subset and return its index.
To improve the morphing process, mesh factories are segmented into subsets. All vertices of a subset are influenced by the same morph targets (i.e. the offsets corresponding to these vertices in the morph targets are non-zero). All null entries of a morph target are removed from the offset buffer. Thus, segmentation into subsets improves memory usage and computational resources since morph targets are only applied to a vertex when they contain deformations.
The first subset (with index 0) regroups the vertices of the mesh object which are not influenced by any morph target, i.e. all corresponding offsets are null.
virtual void CS::Mesh::iAnimatedMeshFactory::AddSubsetVertex | ( | const size_t | subset, | |
const size_t | vertexIndex | |||
) | [pure virtual] |
Add a vertex to a subset.
All vertices of a subset must be influenced by the same morph targets: their corresponding offsets in these morph targets are non-zero.
- Parameters:
-
subset The index of the subset vertexIndex The index of the vertex to be added
virtual void CS::Mesh::iAnimatedMeshFactory::ClearMorphTargets | ( | ) | [pure virtual] |
Remove all morph targets.
You must call ClearSubsets() after clearing the morph targets.
virtual void CS::Mesh::iAnimatedMeshFactory::ClearSubsets | ( | ) | [pure virtual] |
Remove all subsets from this factory and rebuild the original (unoptimized) morph targets.
You must call Invalidate() after clearing the subsets.
virtual void CS::Mesh::iAnimatedMeshFactory::ComputeTangents | ( | ) | [pure virtual] |
Compute the tangents and binormals from the current vertices, normals and texels.
The current content of the tangent and binormal buffers will be overwritten.
virtual iAnimatedMeshMorphTarget* CS::Mesh::iAnimatedMeshFactory::CreateMorphTarget | ( | const char * | name | ) | [pure virtual] |
Create a new morph target.
- Parameters:
-
name Identifier of the morph target. Can be 0 or non-unique, but setting a unique name usually helps with finding a morph target later on.
- Warning:
- You must call Invalidate() once all morph targets are created on the animated mesh factory.
virtual void CS::Mesh::iAnimatedMeshFactory::CreateSocket | ( | CS::Animation::BoneID | bone, | |
const csReversibleTransform & | transform, | |||
const char * | name | |||
) | [pure virtual] |
Create a new socket.
- Parameters:
-
bone ID of the bone to connect the socket transform Initial transform of the socket, in 'bone to socket' coordinate name Name of the socket, optional
virtual iAnimatedMeshSubMeshFactory* CS::Mesh::iAnimatedMeshFactory::CreateSubMesh | ( | const csArray< iRenderBuffer * > & | indices, | |
const csArray< csArray< unsigned int > > & | boneIndices, | |||
const char * | name, | |||
bool | visible | |||
) | [pure virtual] |
Create a new submesh.
This creates a submesh which have several 'triangle sets<->bone' mapping pairs. Such a submesh is useful when you want to limit the number of bones per batch rendered.
- Parameters:
-
indices Array of index buffers to use per part boneIndices Array of indices of bones to use for bone mappings
virtual iAnimatedMeshSubMeshFactory* CS::Mesh::iAnimatedMeshFactory::CreateSubMesh | ( | iRenderBuffer * | indices, | |
const char * | name, | |||
bool | visible | |||
) | [pure virtual] |
Create a new submesh.
This creates a submesh that use the normal per-vertex bone influence mappings. The newly created submesh will use all bones.
- Parameters:
-
indices Index buffer to use for the newly created submesh.
virtual void CS::Mesh::iAnimatedMeshFactory::DeleteSubMesh | ( | iAnimatedMeshSubMeshFactory * | mesh | ) | [pure virtual] |
Remove a submesh from this factory.
virtual uint CS::Mesh::iAnimatedMeshFactory::FindMorphTarget | ( | const char * | name | ) | const [pure virtual] |
Find the index of the morph target with the given name (or (uint)~0 if no target with that name exists).
virtual uint CS::Mesh::iAnimatedMeshFactory::FindSocket | ( | const char * | name | ) | const [pure virtual] |
Find the index of the socket with the given name (or (uint)~0 if no socket with that name exists).
virtual size_t CS::Mesh::iAnimatedMeshFactory::FindSubMesh | ( | const char * | name | ) | const [pure virtual] |
Find a submesh index by name, returns (size_t)-1 if not found.
virtual iRenderBuffer* CS::Mesh::iAnimatedMeshFactory::GetBinormals | ( | ) | [pure virtual] |
Get a pointer to the buffer specifying the vertex binormals.
The buffer hass at least as many entries as specified by the vertex count. You must call Invalidate() after modifying it.
virtual const csBox3& CS::Mesh::iAnimatedMeshFactory::GetBoneBoundingBox | ( | CS::Animation::BoneID | bone | ) | const [pure virtual] |
Get the bounding box of the bone with the given ID.
The corners of the box are expressed in bone space.
It is valid to use CS::Animation::InvalidBoneID as a parameter, in this case it will return the bounding box of the vertices that aren't influenced by any bone.
virtual AnimatedMeshBoneInfluence* CS::Mesh::iAnimatedMeshFactory::GetBoneInfluences | ( | ) | [pure virtual] |
Get the bone influences.
You must call Invalidate() after modifying it.
virtual uint CS::Mesh::iAnimatedMeshFactory::GetBoneInfluencesPerVertex | ( | ) | const [pure virtual] |
Get the number of bone influences per vertex.
virtual iRenderBuffer* CS::Mesh::iAnimatedMeshFactory::GetColors | ( | ) | [pure virtual] |
Get a pointer to the buffer specifying the vertex color.
The buffer hass at least as many entries as specified by the vertex count. You must call Invalidate() after modifying it.
virtual iAnimatedMeshMorphTarget* CS::Mesh::iAnimatedMeshFactory::GetMorphTarget | ( | uint | target | ) | [pure virtual] |
Get a specific morph target.
virtual uint CS::Mesh::iAnimatedMeshFactory::GetMorphTargetCount | ( | ) | const [pure virtual] |
Get number of morph targets.
virtual iRenderBuffer* CS::Mesh::iAnimatedMeshFactory::GetNormals | ( | ) | [pure virtual] |
Get a pointer to the buffer specifying the vertex normals.
The buffer has at least as many entries as specified by the vertex count. You must call Invalidate() after modifying it.
virtual CS::Animation::iSkeletonFactory* CS::Mesh::iAnimatedMeshFactory::GetSkeletonFactory | ( | ) | const [pure virtual] |
Get the skeleton factory associated with the mesh factory.
virtual iAnimatedMeshSocketFactory* CS::Mesh::iAnimatedMeshFactory::GetSocket | ( | size_t | index | ) | const [pure virtual] |
Get a specific socket instance.
virtual size_t CS::Mesh::iAnimatedMeshFactory::GetSocketCount | ( | ) | const [pure virtual] |
Get the number of sockets in this factory.
virtual iAnimatedMeshSubMeshFactory* CS::Mesh::iAnimatedMeshFactory::GetSubMesh | ( | size_t | index | ) | const [pure virtual] |
Get a submesh by index.
virtual size_t CS::Mesh::iAnimatedMeshFactory::GetSubMeshCount | ( | ) | const [pure virtual] |
Get the total number of submeshes.
virtual size_t CS::Mesh::iAnimatedMeshFactory::GetSubsetCount | ( | ) | const [pure virtual] |
Get the number of subsets associated with this factory.
virtual size_t CS::Mesh::iAnimatedMeshFactory::GetSubsetVertex | ( | const size_t | subset, | |
const size_t | vertexIndex | |||
) | const [pure virtual] |
Get the index of a vertex in a specified subset.
- Parameters:
-
subset The index of the subset vertexIndex The index of the subset vertex
- Returns:
- the index of this vertex in the vertex buffer
virtual size_t CS::Mesh::iAnimatedMeshFactory::GetSubsetVertexCount | ( | const size_t | subset | ) | const [pure virtual] |
Get the number of vertices belonging to a subset.
virtual iRenderBuffer* CS::Mesh::iAnimatedMeshFactory::GetTangents | ( | ) | [pure virtual] |
Get a pointer to the buffer specifying the vertex tangents.
The buffer has at least as many entries as specified by the vertex count. You must call Invalidate() after modifying it.
virtual iRenderBuffer* CS::Mesh::iAnimatedMeshFactory::GetTexCoords | ( | ) | [pure virtual] |
Get a pointer to the buffer specifying the texture coordinates.
The buffer hass at least as many entries as specified by the vertex count. You must call Invalidate() after modifying it.
virtual uint CS::Mesh::iAnimatedMeshFactory::GetVertexCount | ( | ) | const [pure virtual] |
Get the number of vertices in the mesh.
virtual iRenderBuffer* CS::Mesh::iAnimatedMeshFactory::GetVertices | ( | ) | [pure virtual] |
Get a pointer to the buffer specifying the vertices.
The buffer has at least as many entries as specified by the vertex count. You must call Invalidate() after modifying it.
virtual void CS::Mesh::iAnimatedMeshFactory::Invalidate | ( | ) | [pure virtual] |
Update the mesh after modifying its geometry.
Many internal data is updated or pre-computed during that process, such as the bone bounding boxes and the mesh subsets.
- Warning:
- You must call this method whenever you changed the bone mapping, the size of the vertex buffers, the subsets, the bone bounding boxes or the list of morph targets.
virtual bool CS::Mesh::iAnimatedMeshFactory::SetBinormals | ( | iRenderBuffer * | renderBuffer | ) | [pure virtual] |
Set the render buffer to use for the binormals.
It must hold at least as many elements as the vertex buffer.
- Returns:
- false if the buffer doesn't follow required specifications
virtual void CS::Mesh::iAnimatedMeshFactory::SetBoneBoundingBox | ( | CS::Animation::BoneID | bone, | |
const csBox3 & | box | |||
) | [pure virtual] |
Set the bounding box of the given bone.
Bone bounding boxes are used to update the global bounding box of the animated mesh, and to speed up hitbeam tests. Each bounding box should enclose all the vertices that are influenced by the given bone, even when the morph targets are active.
If you don't specify any bounding boxes, then they will be generated automatically by taking all the vertices that have a bone influence bigger than zero.
If you specify at least one bounding box, then no other boxes will be used at all. You should therefore either declare no boxes at all, or all the boxes that might be needed, not partial definition.
- Warning:
- You must call Invalidate() after modifying it in order to recompute the global bounding box of the factory..
- Parameters:
-
bone The ID of the bone. It is valid to use CS::Animation::InvalidBoneID as a parameter, in this case it will refer to the bounding box of the vertices that aren't influenced by any bone. box The bounding box of the given bone. The corners of the box are expressed in bone space.
virtual void CS::Mesh::iAnimatedMeshFactory::SetBoneInfluencesPerVertex | ( | uint | num | ) | [pure virtual] |
Set the requested number of bone influences per vertex.
The mesh might not support as many and/or round it, so check the real amount with GetBoneInfluencesPerVertex ().
virtual bool CS::Mesh::iAnimatedMeshFactory::SetColors | ( | iRenderBuffer * | renderBuffer | ) | [pure virtual] |
Set the render buffer to use for the vertex color.
It must hold at least as many elements as the vertex buffer.
- Returns:
- false if the buffer doesn't follow required specifications
virtual bool CS::Mesh::iAnimatedMeshFactory::SetNormals | ( | iRenderBuffer * | renderBuffer | ) | [pure virtual] |
Set the render buffer to use for the normals.
It must hold at least as many elements as the vertex buffer.
- Returns:
- false if the buffer doesn't follow required specifications
virtual void CS::Mesh::iAnimatedMeshFactory::SetSkeletonFactory | ( | CS::Animation::iSkeletonFactory * | skeletonFactory | ) | [pure virtual] |
Set the skeleton factory to associate with the mesh factory.
When a mesh is instanced it will by default get a skeleton from this skeleton factory.
virtual bool CS::Mesh::iAnimatedMeshFactory::SetTangents | ( | iRenderBuffer * | renderBuffer | ) | [pure virtual] |
Set the render buffer to use for the tangents.
It must hold at least as many elements as the vertex buffer.
- Returns:
- false if the buffer doesn't follow required specifications
virtual bool CS::Mesh::iAnimatedMeshFactory::SetTexCoords | ( | iRenderBuffer * | renderBuffer | ) | [pure virtual] |
Set the render buffer to use for the texture coordinates.
It must hold at least as many elements as the vertex buffer.
- Returns:
- false if the buffer doesn't follow required specifications
virtual bool CS::Mesh::iAnimatedMeshFactory::SetVertices | ( | iRenderBuffer * | renderBuffer | ) | [pure virtual] |
Set the render buffer to use for the vertices.
The buffer must contain at least three components per elements and its length will specify the number of vertices within the mesh.
- Returns:
- false if the buffer doesn't follow required specifications
The documentation for this struct was generated from the following file:
- imesh/animesh.h
Generated for Crystal Space 2.0 by doxygen 1.6.1