|
VisuTwin Canvas
C++ 3D Engine — Metal Backend
|
4x4 column-major transformation matrix with SIMD acceleration. More...
#include <core/math/matrix4.h>
Public Member Functions | |
| Vector4 | getColumn (int col) const |
| float | getElement (const int col, int row) const |
| Vector3 | getPosition () const |
| Quaternion | getRotation () const |
| Vector3 | getScale () const |
| Vector3 | getTranslation () const |
| Matrix4 | inverse () const |
| Matrix4 () | |
| Matrix4 (const Vector4 &col0, const Vector4 &col1, const Vector4 &col2, const Vector4 &col3) | |
| Matrix4 | mulAffine (const Matrix4 &rhs) const |
| Matrix4 | operator* (const Matrix4 &rhs) const |
| Vector3 | operator* (const Vector3 &v) const |
| Vector4 | operator* (const Vector4 &v) const |
| Matrix4 & | operator= (const Matrix4 &other) |
| void | print () const |
| void | setColumn (int col, const Vector4 &v) |
| void | setElement (const int col, int row, const float value) |
| Vector3 | transformPoint (const Vector3 &v) const |
| Matrix4 | transpose () const |
Static Public Member Functions | |
| static Matrix4 | frustum (float left, float right, float bottom, float top, float zNear, float zFar) |
| static Matrix4 | identity () |
| static Matrix4 | lookToLH (const Vector3 &eye, const Vector3 &dir, const Vector3 &up) |
| static Matrix4 | ortho (float left, float right, float bottom, float top, float near, float far) |
| static Matrix4 | orthographicLHReverseZ (const float viewWidth, const float viewHeight, const float nearZ, const float farZ) |
| static Matrix4 | perspective (float fov, float aspect, float zNear, float zFar, bool fovIsHorizontal=false) |
| static Matrix4 | perspectiveFovLHReverseZ (const float fovY, const float aspect, const float zNear, const float zFar) |
| static Matrix4 | reflection (float nx, float ny, float nz, float distance) |
| static Matrix4 | translation (float x, float y, float z) |
| static Matrix4 | trs (const Vector3 &t, const Quaternion &r, const Vector3 &s) |
Public Attributes | |
| union { | |
| float m [4][4] | |
| }; | |
4x4 column-major transformation matrix with SIMD acceleration.
Matrix4 stores 16 floats in column-major order for direct GPU upload. Supports model, view, projection, and MVP composition. SIMD backends accelerate multiply and inverse operations.
|
inline |
Definition at line 47 of file matrix4.h.
References m.
Referenced by frustum(), identity(), inverse(), lookToLH(), mulAffine(), operator*(), operator=(), ortho(), orthographicLHReverseZ(), perspective(), perspectiveFovLHReverseZ(), reflection(), translation(), transpose(), and trs().
|
explicit |
References m.
|
static |
References Matrix4().
|
nodiscard |
|
inlinenodiscard |
Definition at line 355 of file matrix4.h.
References m.
Referenced by visutwin::canvas::GlbParser::parse(), visutwin::canvas::BoundingBox::setFromTransformedAabb(), visutwin::canvas::MetalUniformBinder::setTransformUniforms(), and visutwin::canvas::metal::toSimdMatrix().
|
nodiscard |
|
nodiscard |
| Vector3 visutwin::canvas::Matrix4::getScale | ( | ) | const |
Extracts the scale component from the specified 4x4 matrix
|
nodiscard |
Referenced by visutwin::canvas::GraphNode::position().
|
inlinestatic |
Definition at line 108 of file matrix4.h.
References Matrix4().
Referenced by visutwin::canvas::ShadowRendererDirectional::cull(), visutwin::canvas::ShadowRendererLocal::cullLocalLights(), visutwin::canvas::RenderPassShadowDirectional::execute(), visutwin::canvas::RenderPassShadowLocalNonClustered::execute(), visutwin::canvas::GlbParser::parse(), and visutwin::canvas::Renderer::renderForwardLayer().
|
nodiscard |
References Matrix4().
Referenced by visutwin::canvas::ShadowRendererDirectional::cull(), visutwin::canvas::RenderPassShadowLocalNonClustered::execute(), visutwin::canvas::isVisibleInCameraFrustum(), visutwin::canvas::GraphNode::setPosition(), visutwin::canvas::OrientedBox::setWorldTransform(), and visutwin::canvas::Camera::storeShaderMatrices().
|
static |
References Matrix4().
Multiplies the specified 4x4 matrices together and stores the result in the current instance. This function assumes the matrices are affine transformation matrices, where the upper left 3x3 elements are a rotation matrix, and the bottom left 3 elements are translation. The rightmost column is assumed to be [0, 0, 0, 1]. The parameters are not verified to be in the expected format.
References Matrix4().
|
static |
References Matrix4().
|
inlinestatic |
|
static |
References Matrix4().
|
inlinestatic |
|
inline |
|
inlinestatic |
Creates a reflection matrix for mirroring across a plane defined by a normal and distance. Mat4.setReflection(normal, distance). Uses the Householder reflection formula: R = I - 2nn^T, T = -2d*n.
| normal | - The unit normal of the reflection plane. |
| distance | - The signed distance from the origin to the plane (d = -dot(normal, pointOnPlane)). |
Definition at line 438 of file matrix4.h.
References Matrix4(), and setElement().
| void visutwin::canvas::Matrix4::setColumn | ( | int | col, |
| const Vector4 & | v ) |
|
inline |
Definition at line 376 of file matrix4.h.
References m.
Referenced by visutwin::canvas::ShadowRendererDirectional::cull(), visutwin::canvas::ShadowRendererLocal::cullLocalLights(), visutwin::canvas::GlbParser::parse(), reflection(), and visutwin::canvas::Renderer::renderForwardLayer().
Transforms a 3-dimensional point by a 4x4 matrix
Referenced by visutwin::canvas::ShadowRendererDirectional::cull(), visutwin::canvas::GlbParser::parse(), and visutwin::canvas::GraphNode::setPosition().
|
inlinestatic |
|
inlinenodiscard |
Definition at line 170 of file matrix4.h.
Referenced by visutwin::canvas::Frustum::create().
|
static |
Sets the specified matrix to the concatenation of a translation, a quaternion rotation and a scale
| t | |
| r | |
| s |
References Matrix4().
Referenced by visutwin::canvas::ShadowRendererDirectional::cull().
| union { ... } visutwin::canvas::Matrix4 |
| float visutwin::canvas::Matrix4::m[4][4] |
Definition at line 42 of file matrix4.h.
Referenced by getElement(), Matrix4(), Matrix4(), operator=(), orthographicLHReverseZ(), perspectiveFovLHReverseZ(), print(), setElement(), translation(), and transpose().