[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
`sprcal3d' is a 3D mesh that can perform skeletal animation using the Cal3D library.
@@@ WRITE ME: Please cover more topics.
You can add morph target meshes to each mesh. Remember that morph target meshes need to have the same number of vertices and they need to be in the same order. (Do not use the progressive mesh export option!).
<mesh file="..." name="..." material="..."> <morphtarget file="..." name="..."/> <morphtarget .../> ... </mesh> |
Each of the morph target meshes need to be assigned to a `morphanimnation'. Do not add a `morphtargetmesh' to more than one `morphanimation', since the library is not designed for this, and it would cause problems.
<morphanimation name="..."> <morphtarget mesh="meshname" morph="morphname"/> <morphtarget .../> ... </morphanimation> |
You can test a morphanimation if you load the Cal3D file in the `viewmesh' example program.
You can use morph animations programmatically as follows.
In this example, `cal3dfactorystate' is the Cal3D factory state object. Using the state object, find the `morphanimationid' with the givven name.
int morphanimationid = cal3dfactorystate->FindMorphAnimationName(morphanimationname); |
In this example, cal3dstate is the Cal3D state object. We instruct it to fully blend (1.0f) the morph animation, over a period of (10.0f) ten seconds.
cal3dstate->BlendMorphTarget(morphanimationid, 1.0f, 10.0f); |
This example completely clears a morph animation, over a period of ten seconds (10.0f).
cal3dstate->ClearMorphTarget(morphanimationid, 10.0f); |
Sockets enable you to attach any mesh object to a triangle. The attached mesh object then follows the triangle. Adding a socket to a Cal3D file (following the mesh tags) can be done as shown here. `i', `j', and `k' should be numbers. They are all indices. The loading order of meshes is maintained, so you can deduce which mesh you are using.
<socket name="..." mesh="i" submesh="j" triangle="k"/> |
You can test a socket if you load the Cal3D file in the `viewmesh' example program.
You can use sockets programmatically as follows.
In this example, `cal3dstate' is the Cal3D state object. Here we find a socket with a given name.
iSpriteCal3DSocket* socket = cal3dstate->FindSocket(name); |
For this example, `sprite' is the `iMeshWrapper' of the Cal3D sprite, and `meshwrap' is the `iMeshWrapper' of the mesh object you want to add. This adds the `meshwrap' as a hierarchical child of `sprite'.
sprite->GetChildren()->Add(meshwrap); |
Here is how you would set a socket's mesh wrapper.
socket->SetMeshWrapper(meshwrap); |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |