I have the following C ++ matrix class:
I I am using coupled with a renderer, for which there is an OpenLog and DirectX implementation.
I have a test example where within the window the coordinates of the mouse are used in the graphic position under the cursor. This works as expected under OpenGL.
Because the DirectX line head and OpenGell columns are the main, I reverse the matrix in the following way and pass it to the DirectX before rendering:
if ( O-> Tree) {CObjectTransform * t = o- & gt; Tree-> gatetransform (O-> transgenied); D3d Matrix D; Float * M = (Float *) & amp; D; For (int u = 0; u & lt; 4; u ++) {for (int v = 0; v <4; v ++) {m [u + v * 4] = t-> ; Worldtransform.matrix [v + u * 4]; }} Pd3dDevice-> SetTransform (D3DTS_WORLD, & amp; d); }
The result of this is nothing shown in the area visible from the graphics, here I have placed my cursor.
Like this:
- Is my change class correctly implemented?
- How do I work with DirectX? Edit:
The following code setup was:
float * m = (float *) & amp; D; For (int u = 0; u & lt; 4; u ++) {for (int v = 0; v <4; v ++) {m [u + v * 4] = t-> ; Worldtransform.matrix [v + u * 4]; }} Float test [16] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 , 0,0}}; Memcpy (test, & amp; d, sizeof (d));
Matrix class values:
1,0,0,0 - 0,1,0,0 - 0,0,1, 0
47 , -30,0,1Values of Swap Matrix:
1,0,0,47 = 0,1,0, -30
0,1,1 0,0,0,1Then the matrix is being swaped around. Owing to the problem, swapping out the round code.
No comments:
Post a Comment