XNA to D3D9

Started by
0 comments, last by MJP 13 years, 4 months ago
Hi! I moved to D3D9 because the limitations of C# and XNA, so far so good.

But now I hit to wall. I don't know how to make this in Cplusplus using D3D9 libraries.

[SOURCE] public Vector3 Direction        {            get { return worldMatrix.Forward; } // Looking forward how to get this with D3D9 libraries            set             {                Vector3 position = worldMatrix.Translation; // Looking forward how to get this too                Vector3 forward = value;                 if (forward == Vector3.Up || forward == Vector3.Down)                {                    Vector3 right = Vector3.Right;                    Vector3.Cross(ref right, ref forward, out up); //D3DXVec3Cross                }                //And for this too               Matrix.CreateWorld(ref position, ref forward, ref up, out worldMatrix);            }       }[/SOURCE]
[/source]
Advertisement
Your typical row-major transformation matrix is laid out like this:
X = local X-axisY = local Y-axisZ = local Z-axisT = translation[Xx] [Xy] [Xz] [0][Yx] [Yy] [Yz] [0][Zx] [Zy] [Zz] [0][Tx] [Ty] [Tz] [1]


So for "Forward" you just want the local Z-axis, which is in the _31, _32, and _33 elements of a D3DXMATRIX. For Translation you want the 4th row.

This topic is closed to new replies.

Advertisement