-During the creation of the first batch, create 1 skeleton instance per InstancedObject.
so Each InstancedObject has 1 skeleton Instance, 1 mBoneMatrices Matrix 4 array, containing the positions of the bones in the local space, 1mWorldBoneMatrices, containing the same thing but in world space(to send it to the vertex shader), and one animation state.
-After that, provide an acess method to the animation state to do the right things.
-In private method, basically a "simple" method retrieving the bone position according to the animation state:
Code: Select all
mSkeletonInstance->setAnimationState(*mAnimationState);
mSkeletonInstance->_getBoneMatrices(mBoneMatrices);
(maybe I'm totally wrong with the meaning of this code, extract form OgreEntity, but it seems to be the good one)
This will be an "updateAnimation" method called in the _updateRenderQueue() method.
If I'm not wrong, stencils need to be software animated. But this is not possible to do with instancing.
Same thing with the vertex animation. Hardly possible to do I think.
So: questions? remarks?