1)
PHY_IMotionState is used to copy World Matrix to/from Bullet. It is not good. Why not to mantain Common World Matrix for both renderer and Bullet? Instead of PHY_IMotionState Bullet could accept pointer to something like WORLD_MATRIX.
Code: Select all
struct WORLD_MATRIX : public Matrix4x4
{
void Lock();
void Unlock();
some other useful methods...
};
Both Renderer and Bullet want to access World Info directly (without useless conversions and copy operations). Is not it?
2)
It is also good to pack normal and inverse matrices into one matrix4x4. If we put:
matrix4x4 m;
m._14 = -dot(m._line1, m._line4);
m._24 = -dot(m._line2, m._line4);
m._34 = -dot(m._line3, m._line4);
then
mul(m,v) gives us inverse transform of vector v. And we do not need to transpose something...
Keeping all in ONE matrix could increase performance (espesially using SIMD operations).