GLM

#import "extra/glm"

3D math tools.

glm.v2

v2 :: struct {
    x: f32;
    y: f32;
}

File: glm.bl

glm.v2_one

v2_one :: 

File: glm.bl

glm.v2_zero

v2_zero :: 

File: glm.bl

glm.v3

v3 :: struct {
    x: f32;
    y: f32;
    z: f32;
}

File: glm.bl

glm.v3_right

v3_right :: 

File: glm.bl

glm.v3_up

v3_up :: 

File: glm.bl

glm.v3_forward

v3_forward :: 

File: glm.bl

glm.v3_one

v3_one :: 

File: glm.bl

glm.v3_zero

v3_zero :: 

File: glm.bl

glm.v4

v4 :: struct {
    x: f32;
    y: f32;
    z: f32;
    w: f32;
}

File: glm.bl

glm.v4_one

v4_one :: 

File: glm.bl

glm.v4_zero

v4_zero :: 

File: glm.bl

glm.color_white

color_white :: 

File: glm.bl

glm.color_black

color_black :: 

File: glm.bl

glm.color_red

color_red :: 

File: glm.bl

glm.color_green

color_green :: 

File: glm.bl

glm.color_blue

color_blue :: 

File: glm.bl

glm.color_yellow

color_yellow :: 

File: glm.bl

glm.iv2

iv2 :: struct {
    x: s32;
    y: s32;
}

File: glm.bl

glm.iv3

iv3 :: struct {
    x: s32;
    y: s32;
    z: s32;
}

File: glm.bl

glm.mat4

mat4 :: 

File: glm.bl

glm.quat

quat :: v4

File: glm.bl

glm.QUAT_IDENTITY

QUAT_IDENTITY :: 

File: glm.bl

glm.MAT4_IDENTITY

MAT4_IDENTITY :: 

File: glm.bl

glm.sub

sub :: fn { 
    v2_sub; 
    v2_sub_s; 
    v3_sub; 
    v3_sub_s; 
    v4_sub; 
    v4_sub_s; 
}

File: glm.bl

glm.add

add :: fn { 
    v2_add; 
    v2_add_s; 
    v3_add; 
    v3_add_s; 
    v4_add; 
    v4_add_s; 
}

File: glm.bl

glm.mul

mul :: fn { 
    v2_mul; 
    v2_mul_s; 
    v3_mul; 
    v3_mul_s; 
    v4_mul; 
    v4_mul_s; 
}

File: glm.bl

glm.div

div :: fn { 
    v2_div; 
    v2_div_s; 
    v3_div; 
    v3_div_s; 
    v4_div; 
    v4_div_s; 
}

File: glm.bl

glm.length

length :: fn { 
    v2_length; 
    v3_length; 
    v4_length; 
}

File: glm.bl

glm.sqr_length

sqr_length :: fn { 
    v2_sqr_length; 
    v3_sqr_length; 
    v4_sqr_length; 
}

File: glm.bl

glm.dot

dot :: fn { 
    v2_dot; 
    v3_dot; 
    v4_dot; 
}

File: glm.bl

glm.normalize

normalize :: fn { 
    v2_normalize; 
    v3_normalize; 
    v4_normalize; 
}

File: glm.bl

glm.compare

compare :: fn { 
    v2_compare; 
    v3_compare; 
    v4_compare; 
}

File: glm.bl

glm.negate

negate :: fn { 
    v2_negate; 
    v3_negate; 
    v4_negate; 
}

File: glm.bl

glm.cross

cross :: fn { 
    v3_cross; 
}

File: glm.bl

glm.round

round :: fn { 
    v2_round; 
    v3_round; 
    v4_round; 
}

File: glm.bl

glm.floor

floor :: fn { 
    v2_floor; 
    v3_floor; 
    v4_floor; 
}

File: glm.bl

glm.ceil

ceil :: fn { 
    v2_ceil; 
    v3_ceil; 
    v4_ceil; 
}

File: glm.bl

glm.mat4_init

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

glm.mat4_identity

mat4_identity :: fn (m: *mat4)  #inline

File: glm.bl

glm.mat4_zero

mat4_zero :: fn (m: *mat4)  #inline

File: glm.bl

glm.mat4_init_perspective

mat4_init_perspective :: fn (m: *mat4, fov_rad: f32, aspect: f32, near: f32, far: f32)  #inline

File: glm.bl

glm.mat4_init_ortho

mat4_init_ortho :: fn (m: *mat4, left: f32, right: f32, bottom: f32, top: f32, near: f32, far: f32) 

File: glm.bl

glm.mat4_init_look_at

mat4_init_look_at :: fn (m: *mat4, eye: v3, target: v3, up: v3)  #inline

File: glm.bl

glm.mat4_init_look

mat4_init_look :: fn (m: *mat4, eye: v3, direction: v3, up: v3) 

File: glm.bl

glm.mat4_mul

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

glm.mat4_inverse

mat4_inverse :: fn (m: *mat4, result: *mat4)  #inline

File: glm.bl

glm.mat4_scale_s

mat4_scale_s :: fn (m: *mat4, s: f32)  #inline

File: glm.bl

glm.mat4_mul_v4

mat4_mul_v4 :: fn (mat: *mat4, v: v4) v4 #inline

File: glm.bl

glm.mat4_mul_v3

mat4_mul_v3 :: fn (mat: *mat4, v: v3) v3 #inline

File: glm.bl

glm.mat4_init_translation

mat4_init_translation :: fn (m: *mat4, v: v3)  #inline

Initialize m matrix as translation matrix.

File: glm.bl

glm.mat4_translate

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

glm.mat4_get_translation

mat4_get_translation :: fn (m: *mat4) v3 #inline

Gets the translation vector from the m matrix.

File: glm.bl

glm.mat4_init_scale

mat4_init_scale :: fn (m: *mat4, s: v3)  #inline

Initialize m matrix as scale matrix.

File: glm.bl

glm.mat4_scale

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

glm.mat4_get_scale

mat4_get_scale :: fn (m: *mat4) v3

Gets the scale from the m matrix.

File: glm.bl

glm.mat4_init_rotation_quat

mat4_init_rotation_quat :: fn (m: *mat4, q: quat)  #inline

Initialize rotation matrix m from quaternion q.

File: glm.bl

glm.mat4_init_rotation_euler

mat4_init_rotation_euler :: fn (m: *mat4, euler: v3)  #inline

Initialize rotation matrix m from euler angles euler (in radians).

File: glm.bl

glm.mat4_rotate_quat

mat4_rotate_quat :: fn (m: *mat4, q: quat)  #inline

Rotate the m matrix by quaternion q.

File: glm.bl

glm.mat4_rotate_euler

mat4_rotate_euler :: fn (mat: *mat4, euler: v3)  #inline

Rotate the m matrix by euler angles euler (in radians).

File: glm.bl

glm.mat4_get_quat

mat4_get_quat :: fn (m: *mat4) quat

Gets quaternion rotation from m matrix.

File: glm.bl

glm.quat_normalize

quat_normalize :: fn (q: quat) quat #inline

File: glm.bl

glm.quat_axis_angle

quat_axis_angle :: fn (axis: v3, angle_rad: f32) quat

File: glm.bl

glm.quat_to_euler

quat_to_euler :: fn (q1: quat) v3

File: glm.bl

glm.euler_to_quat

euler_to_quat :: fn (euler: v3) quat #inline

File: glm.bl

glm.quat_imag

quat_imag :: fn (q: quat) v3 #inline

File: glm.bl

glm.quat_real

quat_real :: fn (q: quat) f32 #inline

File: glm.bl

glm.quat_mul

quat_mul :: fn (q1: quat, q2: quat) quat

File: glm.bl

glm.quat_rotate_v3

quat_rotate_v3 :: fn (q: quat, v: v3) v3

File: glm.bl

glm.quat_forward

quat_forward :: fn (q: quat) v3

File: glm.bl

glm.lerp

lerp :: fn (a: ?T, b: T, t: f32) T #inline

File: glm.bl

glm.distance

distance :: fn (a: ?T, b: T) f32 #inline

File: glm.bl

glm.sqr_distance

sqr_distance :: fn (a: ?T, b: T) f32 #inline

File: glm.bl