#import "extra/glm"
3D math tools.
v2 :: struct {
x: f32;
y: f32;
}
File: glm.bl
v2_one ::
File: glm.bl
v2_zero ::
File: glm.bl
v3 :: struct {
x: f32;
y: f32;
z: f32;
}
File: glm.bl
v3_right ::
File: glm.bl
v3_up ::
File: glm.bl
v3_forward ::
File: glm.bl
v3_one ::
File: glm.bl
v3_zero ::
File: glm.bl
v4 :: struct {
x: f32;
y: f32;
z: f32;
w: f32;
}
File: glm.bl
v4_one ::
File: glm.bl
v4_zero ::
File: glm.bl
color_white ::
File: glm.bl
color_black ::
File: glm.bl
color_red ::
File: glm.bl
color_green ::
File: glm.bl
color_blue ::
File: glm.bl
color_yellow ::
File: glm.bl
iv2 :: struct {
x: s32;
y: s32;
}
File: glm.bl
iv3 :: struct {
x: s32;
y: s32;
z: s32;
}
File: glm.bl
mat4 ::
File: glm.bl
quat :: v4
File: glm.bl
QUAT_IDENTITY ::
File: glm.bl
MAT4_IDENTITY ::
File: glm.bl
sub :: fn {
v2_sub;
v2_sub_s;
v3_sub;
v3_sub_s;
v4_sub;
v4_sub_s;
}
File: glm.bl
add :: fn {
v2_add;
v2_add_s;
v3_add;
v3_add_s;
v4_add;
v4_add_s;
}
File: glm.bl
mul :: fn {
v2_mul;
v2_mul_s;
v3_mul;
v3_mul_s;
v4_mul;
v4_mul_s;
}
File: glm.bl
div :: fn {
v2_div;
v2_div_s;
v3_div;
v3_div_s;
v4_div;
v4_div_s;
}
File: glm.bl
length :: fn {
v2_length;
v3_length;
v4_length;
}
File: glm.bl
sqr_length :: fn {
v2_sqr_length;
v3_sqr_length;
v4_sqr_length;
}
File: glm.bl
dot :: fn {
v2_dot;
v3_dot;
v4_dot;
}
File: glm.bl
normalize :: fn {
v2_normalize;
v3_normalize;
v4_normalize;
}
File: glm.bl
compare :: fn {
v2_compare;
v3_compare;
v4_compare;
}
File: glm.bl
negate :: fn {
v2_negate;
v3_negate;
v4_negate;
}
File: glm.bl
cross :: fn {
v3_cross;
}
File: glm.bl
round :: fn {
v2_round;
v3_round;
v4_round;
}
File: glm.bl
floor :: fn {
v2_floor;
v3_floor;
v4_floor;
}
File: glm.bl
ceil :: fn {
v2_ceil;
v3_ceil;
v4_ceil;
}
File: glm.bl
mat4_init :: fn (m: *mat4, m00: f32, m10: f32, m20: f32, m30: f32, m01: f32, m11: f32, m21: f32, m31: f32, m02: f32, m12: f32, m22: f32, m32: f32, m03: f32, m13: f32, m23: f32, m33: f32) #inline
File: glm.bl
mat4_identity :: fn (m: *mat4) #inline
File: glm.bl
mat4_zero :: fn (m: *mat4) #inline
File: glm.bl
mat4_init_perspective :: fn (m: *mat4, fov_rad: f32, aspect: f32, near: f32, far: f32) #inline
File: glm.bl
mat4_init_ortho :: fn (m: *mat4, left: f32, right: f32, bottom: f32, top: f32, near: f32, far: f32)
File: glm.bl
mat4_init_look_at :: fn (m: *mat4, eye: v3, target: v3, up: v3) #inline
File: glm.bl
mat4_init_look :: fn (m: *mat4, eye: v3, direction: v3, up: v3)
File: glm.bl
mat4_mul :: fn (a: *mat4, b: *mat4, result: *mat4)
Multiply matrix a
with matrix b
and writes the result into result
. a
or b
can be used
also as the result
.
File: glm.bl
mat4_inverse :: fn (m: *mat4, result: *mat4) #inline
File: glm.bl
mat4_scale_s :: fn (m: *mat4, s: f32) #inline
File: glm.bl
mat4_mul_v4 :: fn (mat: *mat4, v: v4) v4 #inline
File: glm.bl
mat4_mul_v3 :: fn (mat: *mat4, v: v3) v3 #inline
File: glm.bl
mat4_init_translation :: fn (m: *mat4, v: v3) #inline
Initialize m
matrix as translation matrix.
File: glm.bl
mat4_translate :: fn (m: *mat4, v: v3) #inline
Multiplies the m
matrix with translation matrix for v
and writes the result into the
m
matrix.
File: glm.bl
mat4_get_translation :: fn (m: *mat4) v3 #inline
Gets the translation vector from the m
matrix.
File: glm.bl
mat4_init_scale :: fn (m: *mat4, s: v3) #inline
Initialize m
matrix as scale matrix.
File: glm.bl
mat4_scale :: fn (m: *mat4, v: v3) #inline
Multiplies the m
matrix with scale matrix for v
and writes the result into the
m
matrix.
File: glm.bl
mat4_get_scale :: fn (m: *mat4) v3
Gets the scale from the m
matrix.
File: glm.bl
mat4_init_rotation_quat :: fn (m: *mat4, q: quat) #inline
Initialize rotation matrix m
from quaternion q
.
File: glm.bl
mat4_init_rotation_euler :: fn (m: *mat4, euler: v3) #inline
Initialize rotation matrix m
from euler angles euler
(in radians).
File: glm.bl
mat4_rotate_quat :: fn (m: *mat4, q: quat) #inline
Rotate the m
matrix by quaternion q
.
File: glm.bl
mat4_rotate_euler :: fn (mat: *mat4, euler: v3) #inline
Rotate the m
matrix by euler angles euler
(in radians).
File: glm.bl
mat4_get_quat :: fn (m: *mat4) quat
Gets quaternion rotation from m
matrix.
File: glm.bl
quat_normalize :: fn (q: quat) quat #inline
File: glm.bl
quat_axis_angle :: fn (axis: v3, angle_rad: f32) quat
File: glm.bl
quat_to_euler :: fn (q1: quat) v3
File: glm.bl
euler_to_quat :: fn (euler: v3) quat #inline
File: glm.bl
quat_imag :: fn (q: quat) v3 #inline
File: glm.bl
quat_real :: fn (q: quat) f32 #inline
File: glm.bl
quat_mul :: fn (q1: quat, q2: quat) quat
File: glm.bl
quat_rotate_v3 :: fn (q: quat, v: v3) v3
File: glm.bl
quat_forward :: fn (q: quat) v3
File: glm.bl
lerp :: fn (a: ?T, b: T, t: f32) T #inline
File: glm.bl
distance :: fn (a: ?T, b: T) f32 #inline
File: glm.bl
sqr_distance :: fn (a: ?T, b: T) f32 #inline
File: glm.bl