I'm trying to understand molehill and would like to multiple a vertex by two matrices, say:
output = theVertex * scaleMatrix * rotationMatrix
Im guessing my vertex shader would look something like:
"m44 vt0, va0, vc0\n" +
"mul op, vt0, vc1\n";
And i would set the matrices with
context3d.setProgramConstantsFromMatrix(Context3DProgramType.VERTEX, 0, scaleMatrix);
context3d.setProgramConstantsFromMatrix(Context3DProgramType.VERTEX, 1, rotationMatrix);
But its not working. What am i doing wrong?
Im aware that i could multiple the matrix before putting on the shader, but i am trying to understand AGAL.
Cheers
A m44
matrix is 4x4 floats, it takes 4 registers as each register is 128bits (4 floats) so you have to load your rotation matrix into vc4 register:
"m44 vt0, va0, vc0\n" +
"mul op, vt0, vc4\n";
context3d.setProgramConstantsFromMatrix(Context3DProgramType.VERTEX, 0, scaleMatrix);
context3d.setProgramConstantsFromMatrix(Context3DProgramType.VERTEX, 4, rotationMatrix);