jAyTeA wrote:hello,
i want to use the texture transfomation matrix to move it on mesh. I use following code:
Code: Select all
matrix4* matTexMap = &texMap->getTransformation();
matTexMap->setTranslation( vector3df(0.2f,0.2f,0) );
matTexMap->setScale( vector3df( 0.5f, 0.5f, 0 ) );
matTexMap->setRotationRadians( vector3df(0,0,PI) );
The scaling and the rotation are working without problems, but the texture doesn't move.
What is wrong with this code?
Concatenate the translation/scale/rotation into a single matrix:
matrix4 *matScale, *matTrans, *matRot, *matFinal;
matTrans->setTranslation( vector3df(0.2f,0.2f,0) );
matScale->setScale( vector3df( 0.5f, 0.5f, 0 ) );
matRot->setRotationRadians( vector3df(0,0,PI) );
matFinal = matScale * matRot * matTrans;
Note: Be careful of the order of operations when computing matFinal!