# Matrix calculations

Calculations
with 4x4 transformation matrices are used
for shaders. A matrix is just an array of 16
float variables:
float my_matrix[16]; // lite-C
var my_matrix[16]; // C-Script

The elements of the matrix can be accessed through the array indices
[0]..[15], as usual. However, unlike normal variable arrays, a
transformation matrix contains values in a special format, the IEEE
32 bit floating point format. Thus, under C-Script matrix elements can not be
written to or read from like normal variables; they have to
be converted to and from the **float** format, like this:

my_matrix[0] = floatv(my_value);
my_value = fixed(my_matrix[0]);

Under lite-C, var/float conversion is handled automatically and the above conversion functions are not required.

Handling matrix operations requires some mathematical knowledge. They
are not intended for beginners to games programming, and are not
necessary unless for advanced shader programming.

### See also:

predefined matrices, mat_identity, mat_scale, mat_set, mat_inverse, mat_transpose, mat_multiply
► latest
version online