MATRIX2X2 Variables  (Animation Script)

MATRIX2X2
Local variable
Used to scale and rotate UV values from a pattern/refraction map associated with a named surface variable

Note: Only used for surfaces that have pattern/refraction map enabled, see Surface Functions


Operators
( . ) Invoke function

Declaration
At beginning of script, one or more per line

MATRIX2X2 MatrixName1
MATRIX2X2 MatrixName2, MatrixName3

MATRIX2X2 Functions

Function Parameters

MATRIX2X2 variable type
Constant or VERTEX variable components specified by (.x/.y/.z)


Parameter Modifiers
( - ) Invert matrix

Notations
MATRIX2X2 - Declared MATRIX2X2 variable
float - Scalar floating point constant or VERTEX variable component (.x/.y/.z)
Dest - Destination MATRIX2X2 variable

Functions Description and parameter type variations
SetScalar Sets scalar matrix

SetScalar(float ScaleX, float ScaleY)
   Set scalar matrix using X/Y scale parameters
   Dest M00 = ScaleX
   Dest M01 = 0
   Dest M10 = 0
   Dest M11 = ScaleY

SetRotational

Sets rotation matrix in degrees

SetRotational(float Angle)
   Set rotational matrix from Angle parameter
   Dest M00 = cos(Angle)
   Dest M01 = sin(Angle)
   Dest M10 = -sin(Angle)
   Dest M11 = cos(Angle)

Concat Concatenate (multiply) two matrices together

Concat(MATRIX2X2 M)
   Multiply by MATRIX2X2 M parameter
   Dest = Dest x M

Concat(MATRIX2X2 M1, MATRIX2X2 M2)
   Multiply MATRIX2X2 M1 and M2 parameter
   Dest = M1 x M2

Transpose Transpose matrix

Transpose()
   Transpose MATRIX2X2 variable
    Dest = Transpose of Dest
Examples

Named Surface in example, RectTop

MATRIX2X2 Scalar, Rotational, UVTransform
FRAMETIME FrameTime

Scalar.SetSclar(0.5, -0.35)
Repeat()
{
    GetElaspedTime(FrameTime)
    //Rotate 1 degree per frame
    Rotational.SetRotational(FrameTime.FrameCount)
    UVTransform.Concat(Scalar, Rotational)
    //Set UV matrix for the surface and wait 1 frame
    RectTop.SetUVMatrix(UVTransform);
}