- IAnimatedMeshMD2: Interface exists only to get the MD2 specific animations. Could be removed if IAnimatedMesh had named animations
IAnimatedMeshMD3: Similar, but exposes joint (MD3 tag) information too. If IAnimatedMesh had joints then we might be able to remove this too.
ISkinnedMesh: Exposes joints and skinning options, yet mostly serves as a builder class for skinned meshes. Could reworked into a mesh creator only.
- IAnimatedMesh::getAnimationCount()
IAnimatedMesh::getAnimationName(index)
IAnimatedMesh::findAnimation(name) // maybe some other name?
IAnimatedMeshSceneNode::setAnimation(index)
IAnimatedMeshSceneNode::setAnimation(name)
- Name
Start and end frames of the entire range
The type of loop, (none, cycle, ping-pong, play X times)
The looping part of the animation (pick yourself up, then stand normally)
The relative frames per second of this animation compared to others
1. Complete IAttributes
Animation data is passed directly to the animated mesh type to build a frame
pros: Flexible, easy to serialize, unlimited number of input and output parameters, can easily edit internal animations using IAttributes
cons: Slow as IAttributes are used each frame, potential caching issues.
API change:
- IAttributes* IAnimatedMesh::getAnimationData(index)
IAnimatedMesh::getMesh(IAttributes *animationData, timeSinceStart)
IAnimatedMeshSceneNode::setAnimation(IAttributes* animationData)
Animation data is passed in via IAttributes, but mesh types hold this internally in their own implementation-specific format.
pros: Still quite flexible, fast access to mesh data, cacheable.
cons: Requires write access to IAnimatedMesh, harder to serialize.
API change:
- IAttributes* IAnimatedMesh::getAnimationData(index)
IAnimatedMesh::getMesh(animationIndex, detailLevel, timeSinceStart)
s32 IAnimatedMesh::addAnimation(IAttributes *animationData)
Animation data struct containing all possible members.
pros: Fast, self-documenting, cacheable
cons: Impossible to extend from outside the engine, bloats API over time as more members are added
API change:
- struct IAnimatedMesh::SAnimationData { startFrame, endFrame, relativeFPS, loopMode, etc }
SAnimationData& IAnimatedMesh::getAnimationData(index)
IAnimatedMesh::getMesh(SAnimationData data, detailLevel, timeSinceStart)
IAnimatedMeshSceneNode::setAnimation(SAnimationData data)
So, which way do you think is best, or can you think of a better way? Are there any problems I've missed?