2015-06-02 10:29:49 +00:00
|
|
|
## Mat3
|
|
|
|
3x3 floating point matrix
|
|
|
|
|
|
|
|
### Declaration
|
|
|
|
```glsl
|
|
|
|
mat3 aMat3 = mat3(1.0, 0.0, 0.0, // 1. column
|
|
|
|
0.0, 1.0, 0.0, // 2. column
|
|
|
|
0.0, 0.0, 1.0); // 3. column
|
|
|
|
mat3 bMat3 = mat3(1.0);
|
|
|
|
|
|
|
|
mat3 cMat3 = mat3(aVec3, bVec3, cVec3);
|
|
|
|
mat3 dMat3 = mat3(aVec4, aVec3, bVec4, aFloat);
|
|
|
|
```
|
|
|
|
|
|
|
|
### Description
|
2015-06-09 11:15:40 +00:00
|
|
|
```mat3``` data type is compose for a 3x3 matrix of floating point. As you can see above, can be initialize in different ways:
|
2015-06-02 10:29:49 +00:00
|
|
|
|
2015-06-09 11:15:40 +00:00
|
|
|
- Providing a value for each component column by column.
|
2015-06-02 10:29:49 +00:00
|
|
|
|
2015-06-09 11:15:40 +00:00
|
|
|
- Providing one value that is used for the components on the main diagonal.
|
2015-06-02 10:29:49 +00:00
|
|
|
|
2015-06-09 11:15:40 +00:00
|
|
|
- Providing a combination of vectors and scalars.
|
|
|
|
|
|
|
|
In the same way data can be accessed component-wise or column by column:
|
2015-06-02 10:29:49 +00:00
|
|
|
|
|
|
|
|
|
|
|
```glsl
|
|
|
|
mat3 aMat3;
|
|
|
|
aMat3[2][2] = 1.0;
|
|
|
|
float aFloat = aMat3[2][2];
|
|
|
|
|
|
|
|
aMat3[0] = vec3(1.0);
|
|
|
|
vec3 aVec3 = aMat3[0];
|
|
|
|
```
|
|
|
|
|
|
|
|
### See Also
|
|
|
|
[mat2](index.html#mat2.md), [mat4](index.html#mat4.md), [matrixCompMult()](index.html#matrixCompMult.md)
|