Struct gfx_maths::mat4::Mat4 [−][src]
Expand description
A struct representing a 4x4 matrix.
It’s values are stored in column-major order by default,
as expected by OpenGL and accepted by all other APIs.
To change this, use feature mat-row-major
Fields
values: [f32; 16]Implementations
Creates a 3D rotation matrix.
Creates a 3D local-to-world/object-to-world matrix.
When multiplying this matrix by a vector, it will be
- scaled by
s - rotated by
r - translated by
t
in this order.
Creates a 3D world-to-local/world-to-object matrix.
This matrix does the opposite of local_to_world()
Creates an orthographic projection matrix with z mapped to [0; 1], as expected by Vulkan.
Creates an inverse orthographics projection matrix with z mapped to [0; 1], as expected by Vulkan.
The world position of a uv/depth pair can be reconstructed with the same code as shown
in inverse_perspective_vulkan()
Creates a perspective projection matrix with z mapped to [0; 1], as expected by Vulkan.
Creates an inverse perspective matrix with z mapped to [0; 1], as expected by Vulkan.
This matrix can be used to reconstruct the world position from a uv/depth pair in a shader. This pseudo code can be used:
vec4 clipPos = vec4(uv.xy, depth, 1.0); vec4 worldPos = invProjection * clipPos; worldPos /= worldPos.w;
Returns a value indexed by column and row
Sets the value indexed by column and row to val
Returns a transposed copy of self.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Mat4
impl UnwindSafe for Mat4
Blanket Implementations
Mutably borrows from an owned value. Read more