Home > decentraland-ecs > Matrix
Class used to store matrix data (4x4)
Property | Access Modifier | Type | Description |
---|---|---|---|
IdentityReadOnly |
Readonly<Matrix> |
Gets an identity matrix that must not be updated | |
m |
Readonly<FloatArray> |
Gets the internal data of the matrix | |
updateFlag |
number |
Gets the update flag of the matrix which is an unique number for the matrix. It will be incremented every time the matrix data change. You can use it to speed the comparison between two versions of the same matrix. |
Method | Access Modifier | Returns | Description |
---|---|---|---|
constructor() |
Creates an empty matrix (filled with zeros) | ||
add(other) |
Matrix |
Adds the current matrix with a second one | |
addAtIndex(index, value) |
Matrix |
add a value at the specified position in the current Matrix | |
addToRef(other, result) |
Matrix |
Sets the given matrix "result" to the addition of the current matrix and the given one | |
addToSelf(other) |
Matrix |
Adds in place the given matrix to the current matrix | |
asArray() |
Readonly<FloatArray> |
Returns the matrix as a FloatArray | |
clone() |
Matrix |
Clone the current matrix | |
Compose(scale, rotation, translation) |
Matrix |
Creates a new matrix composed by merging scale (vector3), rotation (quaternion) and translation (vector3) | |
ComposeToRef(scale, rotation, translation, result) |
void |
Sets a matrix to a value composed by merging scale (vector3), rotation (quaternion) and translation (vector3) | |
copyFrom(other) |
Matrix |
Copy the current matrix from the given one | |
copyToArray(array, offset) |
Matrix |
Populates the given array from the starting index with the current matrix values | |
decompose(scale, rotation, translation) |
boolean |
Decomposes the current Matrix into a translation, rotation and scaling components | |
DecomposeLerp(startValue, endValue, gradient) |
Matrix |
Builds a new matrix whose values are computed by: * decomposing the the "startValue" and "endValue" matrices into their respective scale, rotation and translation matrices * interpolating for "gradient" (float) the values between each of these decomposed matrices between the start and the end * recomposing a new matrix from these 3 interpolated scale, rotation and translation matrices | |
DecomposeLerpToRef(startValue, endValue, gradient, result) |
void |
Update a matrix to values which are computed by: * decomposing the the "startValue" and "endValue" matrices into their respective scale, rotation and translation matrices * interpolating for "gradient" (float) the values between each of these decomposed matrices between the start and the end * recomposing a new matrix from these 3 interpolated scale, rotation and translation matrices | |
determinant() |
number |
Gets the determinant of the matrix | |
equals(value) |
boolean |
Check equality between this matrix and a second one | |
FromArray(array, offset) |
Matrix |
Creates a matrix from an array | |
FromArrayToRef(array, offset, result) |
void |
Copy the content of an array into a given matrix | |
FromFloatArrayToRefScaled(array, offset, scale, result) |
void |
Stores an array into a matrix after having multiplied each component by a given factor | |
FromQuaternionToRef(quat, result) |
void |
Creates a rotation matrix from a quaternion and stores it in a target matrix | |
FromValues(initialM11, initialM12, initialM13, initialM14, initialM21, initialM22, initialM23, initialM24, initialM31, initialM32, initialM33, initialM34, initialM41, initialM42, initialM43, initialM44) |
Matrix |
Creates new matrix from a list of values (16) | |
FromValuesToRef(initialM11, initialM12, initialM13, initialM14, initialM21, initialM22, initialM23, initialM24, initialM31, initialM32, initialM33, initialM34, initialM41, initialM42, initialM43, initialM44, result) |
void |
Stores a list of values (16) inside a given matrix | |
FromXYZAxesToRef(xaxis, yaxis, zaxis, result) |
void |
Sets the given matrix as a rotation matrix composed from the 3 left handed axes | |
GetAsMatrix2x2(matrix) |
FloatArray |
Extracts a 2x2 matrix from a given matrix and store the result in a FloatArray | |
GetAsMatrix3x3(matrix) |
FloatArray |
Extracts a 3x3 matrix from a given matrix and store the result in a FloatArray | |
getClassName() |
string |
Returns the name of the current matrix class | |
getHashCode() |
number |
Gets the hash code of the current matrix | |
getRotationMatrix() |
Matrix |
Gets only rotation part of the current matrix | |
getRotationMatrixToRef(result) |
Matrix |
Extracts the rotation matrix from the current one and sets it as the given "result" | |
getRow(index) |
Nullable<Vector4> |
Gets specific row of the matrix | |
getTranslation() |
Vector3 |
Gets the translation value of the current matrix | |
getTranslationToRef(result) |
Matrix |
Fill a Vector3 with the extracted translation from the matrix | |
Identity() |
Matrix |
Creates a new identity matrix | |
IdentityToRef(result) |
void |
Creates a new identity matrix and stores the result in a given matrix | |
invert() |
Matrix |
Inverts the current matrix in place | |
Invert(source) |
Matrix |
Creates a new matrix as the invert of a given matrix | |
invertToRef(other) |
Matrix |
Sets the given matrix to the current inverted Matrix | |
isIdentity() |
boolean |
Check if the current matrix is identity | |
isIdentityAs3x2() |
boolean |
Check if the current matrix is identity as a texture matrix (3x2 store in 4x4) | |
Lerp(startValue, endValue, gradient) |
Matrix |
Returns a new Matrix whose values are the interpolated values for "gradient" (float) between the ones of the matrices "startValue" and "endValue". | |
LerpToRef(startValue, endValue, gradient, result) |
void |
Set the given matrix "result" as the interpolated values for "gradient" (float) between the ones of the matrices "startValue" and "endValue". | |
LookAtLH(eye, target, up) |
Matrix |
Gets a new rotation matrix used to rotate an entity so as it looks at the target vector3, from the eye vector3 position, the up vector3 being oriented like "up" This function works in left handed mode | |
LookAtLHToRef(eye, target, up, result) |
void |
Sets the given "result" Matrix to a rotation matrix used to rotate an entity so that it looks at the target vector3, from the eye vector3 position, the up vector3 being oriented like "up". This function works in left handed mode | |
LookAtRH(eye, target, up) |
Matrix |
Gets a new rotation matrix used to rotate an entity so as it looks at the target vector3, from the eye vector3 position, the up vector3 being oriented like "up" This function works in right handed mode | |
LookAtRHToRef(eye, target, up, result) |
void |
Sets the given "result" Matrix to a rotation matrix used to rotate an entity so that it looks at the target vector3, from the eye vector3 position, the up vector3 being oriented like "up". This function works in right handed mode | |
multiply(other) |
Matrix |
Multiply two matrices | |
multiplyAtIndex(index, value) |
Matrix |
mutiply the specified position in the current Matrix by a value | |
multiplyToArray(other, result, offset) |
Matrix |
Sets the FloatArray "result" from the given index "offset" with the multiplication of the current matrix and the given one | |
multiplyToRef(other, result) |
Matrix |
Sets the given matrix "result" with the multiplication result of the current Matrix and the given one | |
OrthoLH(width, height, znear, zfar) |
Matrix |
Create a left-handed orthographic projection matrix | |
OrthoLHToRef(width, height, znear, zfar, result) |
void |
Store a left-handed orthographic projection to a given matrix | |
OrthoOffCenterLH(left, right, bottom, top, znear, zfar) |
Matrix |
Create a left-handed orthographic projection matrix | |
OrthoOffCenterLHToRef(left, right, bottom, top, znear, zfar, result) |
void |
Stores a left-handed orthographic projection into a given matrix | |
OrthoOffCenterRH(left, right, bottom, top, znear, zfar) |
Matrix |
Creates a right-handed orthographic projection matrix | |
OrthoOffCenterRHToRef(left, right, bottom, top, znear, zfar, result) |
void |
Stores a right-handed orthographic projection into a given matrix | |
PerspectiveFovLH(fov, aspect, znear, zfar) |
Matrix |
Creates a left-handed perspective projection matrix | |
PerspectiveFovLHToRef(fov, aspect, znear, zfar, result, isVerticalFovFixed) |
void |
Stores a left-handed perspective projection into a given matrix | |
PerspectiveFovRH(fov, aspect, znear, zfar) |
Matrix |
Creates a right-handed perspective projection matrix | |
PerspectiveFovRHToRef(fov, aspect, znear, zfar, result, isVerticalFovFixed) |
void |
Stores a right-handed perspective projection into a given matrix | |
PerspectiveFovWebVRToRef(fov, znear, zfar, result, rightHanded) |
void |
Stores a perspective projection for WebVR info a given matrix | |
PerspectiveLH(width, height, znear, zfar) |
Matrix |
Creates a left-handed perspective projection matrix | |
Reflection(plane) |
Matrix |
Computes a reflection matrix from a plane | |
ReflectionToRef(plane, result) |
void |
Computes a reflection matrix from a plane | |
removeRotationAndScaling() |
Matrix |
Remove rotation and scaling part from the matrix | |
reset() |
Matrix |
Sets all the matrix elements to zero | |
RotationAxis(axis, angle) |
Matrix |
Creates a new rotation matrix for "angle" radians around the given axis | |
RotationAxisToRef(axis, angle, result) |
void |
Creates a new rotation matrix for "angle" radians around the given axis and stores it in a given matrix | |
RotationX(angle) |
Matrix |
Creates a new rotation matrix for "angle" radians around the X axis | |
RotationXToRef(angle, result) |
void |
Creates a new rotation matrix for "angle" radians around the X axis and stores it in a given matrix | |
RotationY(angle) |
Matrix |
Creates a new rotation matrix for "angle" radians around the Y axis | |
RotationYawPitchRoll(yaw, pitch, roll) |
Matrix |
Creates a rotation matrix | |
RotationYawPitchRollToRef(yaw, pitch, roll, result) |
void |
Creates a rotation matrix and stores it in a given matrix | |
RotationYToRef(angle, result) |
void |
Creates a new rotation matrix for "angle" radians around the Y axis and stores it in a given matrix | |
RotationZ(angle) |
Matrix |
Creates a new rotation matrix for "angle" radians around the Z axis | |
RotationZToRef(angle, result) |
void |
Creates a new rotation matrix for "angle" radians around the Z axis and stores it in a given matrix | |
scale(scale) |
Matrix |
Compute a new matrix set with the current matrix values multiplied by scale (float) | |
scaleAndAddToRef(scale, result) |
Matrix |
Scale the current matrix values by a factor and add the result to a given matrix | |
scaleToRef(scale, result) |
Matrix |
Scale the current matrix values by a factor to a given result matrix | |
Scaling(x, y, z) |
Matrix |
Creates a scaling matrix | |
ScalingToRef(x, y, z, result) |
void |
Creates a scaling matrix and stores it in a given matrix | |
setRow(index, row) |
Matrix |
Sets the index-th row of the current matrix to the vector4 values | |
setRowFromFloats(index, x, y, z, w) |
Matrix |
Sets the index-th row of the current matrix with the given 4 x float values | |
setTranslation(vector3) |
Matrix |
Inserts the translation vector in the current matrix | |
setTranslationFromFloats(x, y, z) |
Matrix |
Inserts the translation vector (using 3 floats) in the current matrix | |
toArray() |
Readonly<FloatArray> |
Returns the matrix as a FloatArray | |
toggleModelMatrixHandInPlace() |
void |
Toggles model matrix from being right handed to left handed in place and vice versa | |
toggleProjectionMatrixHandInPlace() |
void |
Toggles projection matrix from being right handed to left handed in place and vice versa | |
toNormalMatrix(ref) |
void |
Writes to the given matrix a normal matrix, computed from this one (using values from identity matrix for fourth row and column). | |
Translation(x, y, z) |
Matrix |
Creates a translation matrix | |
TranslationToRef(x, y, z, result) |
void |
Creates a translation matrix and stores it in a given matrix | |
transpose() |
Matrix |
Compute the transpose of the matrix | |
Transpose(matrix) |
Matrix |
Compute the transpose of a given matrix | |
transposeToRef(result) |
Matrix |
Compute the transpose of the matrix and store it in a given matrix | |
TransposeToRef(matrix, result) |
void |
Compute the transpose of a matrix and store it in a target matrix | |
Zero() |
Matrix |
Creates a new zero matrix |