How can I set the world matrix from an array of floats in D3D9?

I have objects that hold their own transform matrix (calculated every frame by the physics system) held in a linear array of floats as follows:

[m0, m1,  m2,  m3]
[m4, m5,  m6,  m7]
[m8, m9, m10, m11]


How can I assign this matrix to D3D's world matrix for use in rendering the objects?

• Basically, you make the matrix available to your vertex shader through shader variables and then transform every vertex via multiplication. – user13213 May 5 '12 at 4:20
• isn't there some way that I can just override the values of a world matrix with the values of the array without having to go through shaders. it just seems a little convoluted to just set a matrix to specific values. – gardian06 May 5 '12 at 15:47
• That really depends if you are working with the fixed function pipeline or not. I only have experience with the programmable pipeline. – user13213 May 5 '12 at 17:15
• "know the last four elements by default so they are not stored no scaling, or skewing will be taking place" The last four elements of the matrix have nothing to do with scaling or skewing. At least, not in the usual meaning of those terms. – Nicol Bolas May 6 '12 at 21:51

If you are using the effect interface, you'll need to obtain a D3DXHANDLE to your world matrix variable (for example, by calling GetParameterBySemantic on the effect.
You can then either convert your matrix to a D3DXMATRIX and use the matrix-setting call or leave the value in its raw form and call the raw value setter. Note that to do the latter you'll need to extend your array anyway, to include the missing elements, otherwise they may be unspecified values.
If you're not using the effect framework, convert your matrix to a D3DMATRIX use the SetTransform method on your device using D3DTS_WORLD as the matrix type.