how to scale world space -1 in z direction !?

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
Ghus
Posts: 13
Joined: Wed May 12, 2010 5:42 pm

how to scale world space -1 in z direction !?

Post by Ghus »

hi all

I need to change the view matrix to scale world space by -1 in the z-direction.
To do this, i need to flip the sign of the _31, _32, _33, and _34 member of the D3DMATRIX structure of view matrix.

i think i need to do something like this

core::matrix4 viewMatrix = driver->getTransform(video::ETS_VIEW);

viewMatrix[2] = viewMatrix[2] * -1;
viewMatrix[6] = viewMatrix[6] * -1;
viewMatrix[10] = viewMatrix[10] * -1;
viewMatrix[14] = viewMatrix[14] * -1;
or
viewMatrix[8] = viewMatrix[8] * -1;
viewMatrix[9] = viewMatrix[9] * -1;
viewMatrix[10] = viewMatrix[10] * -1;
viewMatrix[11] = viewMatrix[11] * -1;

driver->setTransform(video::ETS_VIEW,viewMatrix);

but I am not sure that is the correspondence in the irrlicht matrix to the D3D matrix, the first (2,6,10,14) or (8,9,10,11)

if some one can help me with this

thanks in advance =)
Ghus
Posts: 13
Joined: Wed May 12, 2010 5:42 pm

Re: how to scale world space -1 in z direction !?

Post by Ghus »

to make it simple can some tell me how the matrix4 is build

0 1 2 3
4 5 6 7
8 9 10 11
12 13 14 15

0 4 8 12
1 5 9 13
2 6 10 14
3 7 11 15

I need this so I can access the 3º Row

ty
Mel
Competition winner
Posts: 2292
Joined: Wed May 07, 2008 11:40 am
Location: Granada, Spain

Re: how to scale world space -1 in z direction !?

Post by Mel »

Irrlicht uses row major matrices, which means that their layout in memory is:

0 1 2 3
4 5 6 7
8 9 10 11
12 13 14 15

so your third row is the range from 8 to 11. The Irrlicht matrices are compatible with DirectX.
"There is nothing truly useless, it always serves as a bad example". Arthur A. Schmitt
Post Reply