Original Post
Lets say I want to implement a skinning system. The system should be able to create a matrix palette with some simple function calls. Maybe I want to use this system later in an OpenGL application and even later with DirectX. When I use DirectX I will use the IMesh, ISkinInfo interfaces as well as the mathlib provided with the D3DX COMObject. With OpenGL I probably use my own classes. So internally I use my own math classes like Matrix4, Decomposer, Vector3, etc, but what is the best way to define the interface? Are there common techniques?
What format should the matrix palette be? Maybe I decide that the client passes the palette to a function?
Example:
void UpdateScene(void)
{
pAnimator->AdvanceInTime(dt);
pAnimator->GetMatrixPalette( /* What shall be here? */ );
}
Lets say I pass a Matrix4 array reference. Then to use the palette with the ID3DXSkinInfo interface I have to cast the array to D3DXMATRIX.
How expensive and dangerous is it to cast an array of 64 floats into an array of four matrices or a cast from Matrix4 array to D3DXMATRIX array? Are there any run-time penalties for such a cast? How do you handle type differences between subsystems?
Maybe some of you gurus can give me some deeper inside into what happens behind the scene during a cast? Again references are very welcome!
-Dirk