Matrix
From Crumbled World Wiki
Constructor
| function | description |
|---|---|
| Matrix(float* x) | x is array of length 16 |
| Matrix(Vec3 position) | |
| Matrix(Matrix mat) | |
| Matrix() |
Functions
| return | function | description |
|---|---|---|
| Vec3 | [[1]]() | Returns the Right Vector. |
| Vec3 | [[2]]() | Returns the Up Vector. |
| Vec3 | [[3]]() | Returns the At Vector |
| Vec3 | [[4]]() | Returns the position. |
| Vec3 | [[5]]() | Returns the length of right, up and at vector. |
| Vec3 | [[6]]() | Returns the matrix approximated rotation. |
| [rightVec)|setUpVec](Vec3 rightVec) | Set right Vector. | |
| [upVec)|setUpVec](Vec3 upVec) | Set up Vector. | |
| [atVec)|setAtVec](Vec3 atVec) | Set at Vector. | |
| [position)|setPosition](Vec3 position) | Set position. | |
| [rotation)|setRotation](Vec3 rotation) | Set rotation. | |
| [scale)|setScale](Vec3 scale) | Set scale. | |
| [[7]]() | Set identity. | |
| [at, Vec3 up)|createMatrix](Vec3 at, Vec3 up) | Create matrix from the given at and up. | |
| [right, Vec3 upVec)|createMatrix](Vec3 right, Vec3 up) | Create matrix from the given right and up. | |
| [up, Vec3 right)|createMatrix](Vec3 up, Vec3 right) | Create matrix from the given up and right. | |
| [scale)|scale](Vec3 scale) | Scale the matrix right up and at vec by the given scale. | |
| [value)|scale](float value) | Scale the matrix right up and at vec by the given value. | |
| [value)|scale](float value) | Scale the matrix right up and at vec by the given value. | |
| [vec)|translate](Vec3 vec) | Translate this matrix with the given vector. | |
| [[8]]() | Clear position. | |
| [[9]]() | Inverse Matrix. | |
| Matrix | [[10]]() | Return a inverse Matrix. |
| [[11]]() | Normalize right, up and at vector. | |
| [axis, float degrees)|rotate](Vec3 axis, float rad) | Set fixed rotation around a given axis. |
Operators
| return | function | description |
|---|---|---|
| Matrix | Matrix * Matrix | |
| Vec4 | Matrix * Vec4 | |
| Vec3 | Matrix * Vec3 | equal to Matrix * Vec4(Vec3(), 1.0) |
| Matrix | Matrix * float | |
| bool | Matrix == Matrix |