GpuMat4¶
Import: import system.gpu;
This reference lists the public declarations for this part of the library. See Reading API signatures for parameter and result notation. Shader-only declarations can be used only inside shader entry points and helpers reached from them; using them elsewhere is a compile error.
GpuMat4¶
A 4x4 float matrix stored as four columns, laid out like a GPU float4x4, for transforms and cameras. m * v transforms the column vector v, and a * b applies b first, then a. The projection helpers use a right-handed view space where the camera looks down negative z, and map depth to 0.0 (near) through 1.0 (far), the range every GpuBackend expects. Use it on the CPU and in shaders alike.
c0¶
The first column.
c1¶
The second column.
c2¶
The third column.
c3¶
The fourth column, which holds the translation of an affine transform.
constructor¶
Creates a matrix from its four columns.
identity¶
The identity matrix, which leaves vectors unchanged.
translation¶
A transform that moves points by offset.
scaling¶
A transform that scales each axis by the matching component of factors.
rotation¶
A rotation by radians around axis, counter-clockwise when looking from the tip of the axis toward the origin. axis need not have length 1.
perspective¶
A perspective projection with a vertical field of view of fov_y_radians, a width-to-height aspect ratio, and clipping planes at distances near and far in front of the camera. Both distances must be positive and near below far.
public static fun perspective(
fov_y_radians: float,
aspect: float,
near: float,
far: float
): GpuMat4
look_at¶
A camera transform for an eye at eye looking at target, with up giving the upward direction. up must not point along the viewing direction.
row¶
The row at index (0 to 3) as a vector.
transpose¶
The matrix with rows and columns swapped.