1

I've mostly seen examples where a Matrix3D object is passed as a vertex constant register in AS3 to the Context3D object. But never seen a matrix in any other types of registers (temporary or attribute).

Would there be any way to copy a Matrix vertex constant to a temporary register, and then manipulate individual fields of that Matrix temporary register (ex:for the rotation), with other supplied values (vertex attributes or other constants)?

Could a simple mov dest, source operation do the trick?

J. Holmes
  • 18,466
  • 5
  • 47
  • 52
chamberlainpi
  • 4,854
  • 8
  • 32
  • 63

2 Answers2

2

Yes, that works (take it from the Mole :)). Just make sure to copy enough (3 or 4) registers. Also a good way to think about matrix operations is that they are just a shortcut for 3 or 4 dot product instructions. There is really nothing typed in AGAL, a matrix is just a few consecutive registers. The matrix upload functions are only convenience for uploading to 4 registers in one call. And in the shader

m44 dest, src, srcmatrix

is the exact same as:

dp4 dest.x srx, srcmatrix  
dp4 dest.y srx, srcmatrix+1  
dp4 dest.z srx, srcmatrix+2  
dp4 dest.w srx, srcmatrix+3

The +1 etc here means register number +1 etc.

J. Holmes
  • 18,466
  • 5
  • 47
  • 52
starmole
  • 4,974
  • 1
  • 28
  • 48
0

I'm almost certain temporary registers also contain Matrices and that your request is possible, but you may get your best answer from someone like Marco Scabia:

http://iflash3d.com/

He's very approachable and knowledgeable of AGAL.

Ross Smith
  • 747
  • 4
  • 5