From c4cb2f237881d077c5da2a1be66f81a233d4613b Mon Sep 17 00:00:00 2001 From: gingerBill Date: Mon, 22 May 2023 12:07:37 +0100 Subject: [PATCH] Add "contextless" to `core:math/linalg` procedures --- core/math/linalg/extended.odin | 130 +++--- core/math/linalg/general.odin | 76 ++-- core/math/linalg/specific.odin | 370 +++++++++--------- .../linalg/specific_euler_angles_f16.odin | 200 +++++----- .../linalg/specific_euler_angles_f32.odin | 200 +++++----- .../linalg/specific_euler_angles_f64.odin | 200 +++++----- core/math/linalg/swizzle.odin | 64 +-- 7 files changed, 620 insertions(+), 620 deletions(-) diff --git a/core/math/linalg/extended.odin b/core/math/linalg/extended.odin index f0be35aa1..b6e05a2c2 100644 --- a/core/math/linalg/extended.odin +++ b/core/math/linalg/extended.odin @@ -4,7 +4,7 @@ import "core:builtin" import "core:math" @(require_results) -to_radians :: proc(degrees: $T) -> (out: T) where IS_NUMERIC(ELEM_TYPE(T)) { +to_radians :: proc "contextless" (degrees: $T) -> (out: T) where IS_NUMERIC(ELEM_TYPE(T)) { when IS_ARRAY(T) { for i in 0.. (out: T) where IS_NUMERIC(ELEM_TYPE(T)) { } @(require_results) -to_degrees :: proc(radians: $T) -> (out: T) where IS_NUMERIC(ELEM_TYPE(T)) { +to_degrees :: proc "contextless" (radians: $T) -> (out: T) where IS_NUMERIC(ELEM_TYPE(T)) { when IS_ARRAY(T) { for i in 0.. (out: T) where IS_NUMERIC(ELEM_TYPE(T)) { } @(require_results) -min_double :: proc(a, b: $T) -> (out: T) where IS_NUMERIC(ELEM_TYPE(T)) { +min_double :: proc "contextless" (a, b: $T) -> (out: T) where IS_NUMERIC(ELEM_TYPE(T)) { when IS_ARRAY(T) { for i in 0.. (out: T) where IS_NUMERIC(ELEM_TYPE(T)) { } @(require_results) -min_single :: proc(a: $T) -> (out: ELEM_TYPE(T)) where IS_NUMERIC(ELEM_TYPE(T)) { +min_single :: proc "contextless" (a: $T) -> (out: ELEM_TYPE(T)) where IS_NUMERIC(ELEM_TYPE(T)) { when IS_ARRAY(T) { N :: len(T) @@ -61,14 +61,14 @@ min_single :: proc(a: $T) -> (out: ELEM_TYPE(T)) where IS_NUMERIC(ELEM_TYPE(T)) } @(require_results) -min_triple :: proc(a, b, c: $T) -> T where IS_NUMERIC(ELEM_TYPE(T)) { +min_triple :: proc "contextless" (a, b, c: $T) -> T where IS_NUMERIC(ELEM_TYPE(T)) { return min_double(a, min_double(b, c)) } min :: proc{min_single, min_double, min_triple} @(require_results) -max_double :: proc(a, b: $T) -> (out: T) where IS_NUMERIC(ELEM_TYPE(T)) { +max_double :: proc "contextless" (a, b: $T) -> (out: T) where IS_NUMERIC(ELEM_TYPE(T)) { when IS_ARRAY(T) { for i in 0.. (out: T) where IS_NUMERIC(ELEM_TYPE(T)) { } @(require_results) -max_single :: proc(a: $T) -> (out: ELEM_TYPE(T)) where IS_NUMERIC(ELEM_TYPE(T)) { +max_single :: proc "contextless" (a: $T) -> (out: ELEM_TYPE(T)) where IS_NUMERIC(ELEM_TYPE(T)) { when IS_ARRAY(T) { N :: len(T) @@ -103,14 +103,14 @@ max_single :: proc(a: $T) -> (out: ELEM_TYPE(T)) where IS_NUMERIC(ELEM_TYPE(T)) } @(require_results) -max_triple :: proc(a, b, c: $T) -> T where IS_NUMERIC(ELEM_TYPE(T)) { +max_triple :: proc "contextless" (a, b, c: $T) -> T where IS_NUMERIC(ELEM_TYPE(T)) { return max_double(a, max_double(b, c)) } max :: proc{max_single, max_double, max_triple} @(require_results) -abs :: proc(a: $T) -> (out: T) where IS_NUMERIC(ELEM_TYPE(T)) { +abs :: proc "contextless" (a: $T) -> (out: T) where IS_NUMERIC(ELEM_TYPE(T)) { when IS_ARRAY(T) { for i in 0.. (out: T) where IS_NUMERIC(ELEM_TYPE(T)) { } @(require_results) -sign :: proc(a: $T) -> (out: T) where IS_NUMERIC(ELEM_TYPE(T)) { +sign :: proc "contextless" (a: $T) -> (out: T) where IS_NUMERIC(ELEM_TYPE(T)) { when IS_ARRAY(T) { for i in 0.. (out: T) where IS_NUMERIC(ELEM_TYPE(T)) { } @(require_results) -clamp :: proc(x, a, b: $T) -> (out: T) where IS_NUMERIC(ELEM_TYPE(T)) { +clamp :: proc "contextless" (x, a, b: $T) -> (out: T) where IS_NUMERIC(ELEM_TYPE(T)) { when IS_ARRAY(T) { for i in 0.. (out: T) where IS_NUMERIC(ELEM_TYPE(T)) { @(require_results) -saturate :: proc(x: $T) -> T where IS_FLOAT(ELEM_TYPE(T)) { +saturate :: proc "contextless" (x: $T) -> T where IS_FLOAT(ELEM_TYPE(T)) { return clamp(x, 0.0, 1.0) } @(require_results) -lerp :: proc(a, b, t: $T) -> (out: T) where IS_FLOAT(ELEM_TYPE(T)) { +lerp :: proc "contextless" (a, b, t: $T) -> (out: T) where IS_FLOAT(ELEM_TYPE(T)) { when IS_ARRAY(T) { for i in 0.. (out: T) where IS_FLOAT(ELEM_TYPE(T)) { return } @(require_results) -mix :: proc(a, b, t: $T) -> (out: T) where IS_FLOAT(ELEM_TYPE(T)) { +mix :: proc "contextless" (a, b, t: $T) -> (out: T) where IS_FLOAT(ELEM_TYPE(T)) { when IS_ARRAY(T) { for i in 0.. (out: T) where IS_FLOAT(ELEM_TYPE(T)) { } @(require_results) -unlerp :: proc(a, b, x: $T) -> T where IS_FLOAT(ELEM_TYPE(T)) { +unlerp :: proc "contextless" (a, b, x: $T) -> T where IS_FLOAT(ELEM_TYPE(T)) { return (x - a) / (b - a) } @(require_results) -step :: proc(e, x: $T) -> (out: T) where IS_FLOAT(ELEM_TYPE(T)) { +step :: proc "contextless" (e, x: $T) -> (out: T) where IS_FLOAT(ELEM_TYPE(T)) { when IS_ARRAY(T) { for i in 0.. (out: T) where IS_FLOAT(ELEM_TYPE(T)) { } @(require_results) -smoothstep :: proc(e0, e1, x: $T) -> T where IS_FLOAT(ELEM_TYPE(T)) { +smoothstep :: proc "contextless" (e0, e1, x: $T) -> T where IS_FLOAT(ELEM_TYPE(T)) { t := saturate(unlerp(e0, e1, x)) return t * t * (3.0 - 2.0 * t) } @(require_results) -smootherstep :: proc(e0, e1, x: $T) -> T where IS_FLOAT(ELEM_TYPE(T)) { +smootherstep :: proc "contextless" (e0, e1, x: $T) -> T where IS_FLOAT(ELEM_TYPE(T)) { t := saturate(unlerp(e0, e1, x)) return t * t * t * (t * (6*t - 15) + 10) } @(require_results) -sqrt :: proc(x: $T) -> (out: T) where IS_FLOAT(ELEM_TYPE(T)) { +sqrt :: proc "contextless" (x: $T) -> (out: T) where IS_FLOAT(ELEM_TYPE(T)) { when IS_ARRAY(T) { for i in 0.. (out: T) where IS_FLOAT(ELEM_TYPE(T)) { } @(require_results) -inverse_sqrt :: proc(x: $T) -> (out: T) where IS_FLOAT(ELEM_TYPE(T)) { +inverse_sqrt :: proc "contextless" (x: $T) -> (out: T) where IS_FLOAT(ELEM_TYPE(T)) { when IS_ARRAY(T) { for i in 0.. (out: T) where IS_FLOAT(ELEM_TYPE(T)) { } @(require_results) -cos :: proc(x: $T) -> (out: T) where IS_FLOAT(ELEM_TYPE(T)) { +cos :: proc "contextless" (x: $T) -> (out: T) where IS_FLOAT(ELEM_TYPE(T)) { when IS_ARRAY(T) { for i in 0.. (out: T) where IS_FLOAT(ELEM_TYPE(T)) { } @(require_results) -sin :: proc(x: $T) -> (out: T) where IS_FLOAT(ELEM_TYPE(T)) { +sin :: proc "contextless" (x: $T) -> (out: T) where IS_FLOAT(ELEM_TYPE(T)) { when IS_ARRAY(T) { for i in 0.. (out: T) where IS_FLOAT(ELEM_TYPE(T)) { } @(require_results) -tan :: proc(x: $T) -> (out: T) where IS_FLOAT(ELEM_TYPE(T)) { +tan :: proc "contextless" (x: $T) -> (out: T) where IS_FLOAT(ELEM_TYPE(T)) { when IS_ARRAY(T) { for i in 0.. (out: T) where IS_FLOAT(ELEM_TYPE(T)) { } @(require_results) -acos :: proc(x: $T) -> (out: T) where IS_FLOAT(ELEM_TYPE(T)) { +acos :: proc "contextless" (x: $T) -> (out: T) where IS_FLOAT(ELEM_TYPE(T)) { when IS_ARRAY(T) { for i in 0.. (out: T) where IS_FLOAT(ELEM_TYPE(T)) { } @(require_results) -asin :: proc(x: $T) -> (out: T) where IS_FLOAT(ELEM_TYPE(T)) { +asin :: proc "contextless" (x: $T) -> (out: T) where IS_FLOAT(ELEM_TYPE(T)) { when IS_ARRAY(T) { for i in 0.. (out: T) where IS_FLOAT(ELEM_TYPE(T)) { } @(require_results) -atan :: proc(x: $T) -> (out: T) where IS_FLOAT(ELEM_TYPE(T)) { +atan :: proc "contextless" (x: $T) -> (out: T) where IS_FLOAT(ELEM_TYPE(T)) { when IS_ARRAY(T) { for i in 0.. (out: T) where IS_FLOAT(ELEM_TYPE(T)) { return } @(require_results) -atan2 :: proc(y, x: $T) -> (out: T) where IS_FLOAT(ELEM_TYPE(T)) { +atan2 :: proc "contextless" (y, x: $T) -> (out: T) where IS_FLOAT(ELEM_TYPE(T)) { when IS_ARRAY(T) { for i in 0.. (out: T) where IS_FLOAT(ELEM_TYPE(T)) { @(require_results) -ln :: proc(x: $T) -> (out: T) where IS_FLOAT(ELEM_TYPE(T)) { +ln :: proc "contextless" (x: $T) -> (out: T) where IS_FLOAT(ELEM_TYPE(T)) { when IS_ARRAY(T) { for i in 0.. (out: T) where IS_FLOAT(ELEM_TYPE(T)) { } @(require_results) -log2 :: proc(x: $T) -> (out: T) where IS_FLOAT(ELEM_TYPE(T)) { +log2 :: proc "contextless" (x: $T) -> (out: T) where IS_FLOAT(ELEM_TYPE(T)) { when IS_ARRAY(T) { for i in 0.. (out: T) where IS_FLOAT(ELEM_TYPE(T)) { } @(require_results) -log10 :: proc(x: $T) -> (out: T) where IS_FLOAT(ELEM_TYPE(T)) { +log10 :: proc "contextless" (x: $T) -> (out: T) where IS_FLOAT(ELEM_TYPE(T)) { when IS_ARRAY(T) { for i in 0.. (out: T) where IS_FLOAT(ELEM_TYPE(T)) { } @(require_results) -log :: proc(x, b: $T) -> (out: T) where IS_FLOAT(ELEM_TYPE(T)) { +log :: proc "contextless" (x, b: $T) -> (out: T) where IS_FLOAT(ELEM_TYPE(T)) { when IS_ARRAY(T) { for i in 0.. (out: T) where IS_FLOAT(ELEM_TYPE(T)) { } @(require_results) -exp :: proc(x: $T) -> (out: T) where IS_FLOAT(ELEM_TYPE(T)) { +exp :: proc "contextless" (x: $T) -> (out: T) where IS_FLOAT(ELEM_TYPE(T)) { when IS_ARRAY(T) { for i in 0.. (out: T) where IS_FLOAT(ELEM_TYPE(T)) { } @(require_results) -exp2 :: proc(x: $T) -> (out: T) where IS_FLOAT(ELEM_TYPE(T)) { +exp2 :: proc "contextless" (x: $T) -> (out: T) where IS_FLOAT(ELEM_TYPE(T)) { when IS_ARRAY(T) { for i in 0.. (out: T) where IS_FLOAT(ELEM_TYPE(T)) { } @(require_results) -exp10 :: proc(x: $T) -> (out: T) where IS_FLOAT(ELEM_TYPE(T)) { +exp10 :: proc "contextless" (x: $T) -> (out: T) where IS_FLOAT(ELEM_TYPE(T)) { when IS_ARRAY(T) { for i in 0.. (out: T) where IS_FLOAT(ELEM_TYPE(T)) { } @(require_results) -pow :: proc(x, e: $T) -> (out: T) where IS_FLOAT(ELEM_TYPE(T)) { +pow :: proc "contextless" (x, e: $T) -> (out: T) where IS_FLOAT(ELEM_TYPE(T)) { when IS_ARRAY(T) { for i in 0.. (out: T) where IS_FLOAT(ELEM_TYPE(T)) { @(require_results) -ceil :: proc(x: $T) -> (out: T) where IS_FLOAT(ELEM_TYPE(T)) { +ceil :: proc "contextless" (x: $T) -> (out: T) where IS_FLOAT(ELEM_TYPE(T)) { when IS_ARRAY(T) { for i in 0.. (out: T) where IS_FLOAT(ELEM_TYPE(T)) { } @(require_results) -floor :: proc(x: $T) -> (out: T) where IS_FLOAT(ELEM_TYPE(T)) { +floor :: proc "contextless" (x: $T) -> (out: T) where IS_FLOAT(ELEM_TYPE(T)) { when IS_ARRAY(T) { for i in 0.. (out: T) where IS_FLOAT(ELEM_TYPE(T)) { } @(require_results) -round :: proc(x: $T) -> (out: T) where IS_FLOAT(ELEM_TYPE(T)) { +round :: proc "contextless" (x: $T) -> (out: T) where IS_FLOAT(ELEM_TYPE(T)) { when IS_ARRAY(T) { for i in 0.. (out: T) where IS_FLOAT(ELEM_TYPE(T)) { } @(require_results) -fract :: proc(x: $T) -> T where IS_FLOAT(ELEM_TYPE(T)) { +fract :: proc "contextless" (x: $T) -> T where IS_FLOAT(ELEM_TYPE(T)) { f := #force_inline floor(x) return x - f } @(require_results) -mod :: proc(x, m: $T) -> T where IS_FLOAT(ELEM_TYPE(T)) { +mod :: proc "contextless" (x, m: $T) -> T where IS_FLOAT(ELEM_TYPE(T)) { f := #force_inline floor(x / m) return x - f * m } @(require_results) -face_forward :: proc(N, I, N_ref: $T) -> (out: T) where IS_ARRAY(T), IS_FLOAT(ELEM_TYPE(T)) { +face_forward :: proc "contextless" (N, I, N_ref: $T) -> (out: T) where IS_ARRAY(T), IS_FLOAT(ELEM_TYPE(T)) { return dot(N_ref, I) < 0 ? N : -N } @(require_results) -distance :: proc(p0, p1: $V/[$N]$E) -> E where IS_NUMERIC(E) { +distance :: proc "contextless" (p0, p1: $V/[$N]$E) -> E where IS_NUMERIC(E) { return length(p1 - p0) } @(require_results) -reflect :: proc(I, N: $T) -> (out: T) where IS_ARRAY(T), IS_FLOAT(ELEM_TYPE(T)) { +reflect :: proc "contextless" (I, N: $T) -> (out: T) where IS_ARRAY(T), IS_FLOAT(ELEM_TYPE(T)) { b := N * (2 * dot(N, I)) return I - b } @(require_results) -refract :: proc(I, Normal: $V/[$N]$E, eta: E) -> (out: V) where IS_ARRAY(V), IS_FLOAT(ELEM_TYPE(V)) { +refract :: proc "contextless" (I, Normal: $V/[$N]$E, eta: E) -> (out: V) where IS_ARRAY(V), IS_FLOAT(ELEM_TYPE(V)) { dv := dot(Normal, I) k := 1 - eta*eta * (1 - dv*dv) a := I * eta @@ -486,12 +486,12 @@ refract :: proc(I, Normal: $V/[$N]$E, eta: E) -> (out: V) where IS_ARRAY(V), IS_ @(require_results) -is_nan_single :: proc(x: $T) -> bool where IS_FLOAT(T) { +is_nan_single :: proc "contextless" (x: $T) -> bool where IS_FLOAT(T) { return #force_inline math.is_nan(x) } @(require_results) -is_nan_array :: proc(x: $A/[$N]$T) -> (out: [N]bool) where IS_FLOAT(T) { +is_nan_array :: proc "contextless" (x: $A/[$N]$T) -> (out: [N]bool) where IS_FLOAT(T) { for i in 0.. (out: [N]bool) where IS_FLOAT(T) { } @(require_results) -is_inf_single :: proc(x: $T) -> bool where IS_FLOAT(T) { +is_inf_single :: proc "contextless" (x: $T) -> bool where IS_FLOAT(T) { return #force_inline math.is_inf(x) } @(require_results) -is_inf_array :: proc(x: $A/[$N]$T) -> (out: [N]bool) where IS_FLOAT(T) { +is_inf_array :: proc "contextless" (x: $A/[$N]$T) -> (out: [N]bool) where IS_FLOAT(T) { for i in 0.. (out: [N]bool) where IS_FLOAT(T) { } @(require_results) -classify_single :: proc(x: $T) -> math.Float_Class where IS_FLOAT(T) { +classify_single :: proc "contextless" (x: $T) -> math.Float_Class where IS_FLOAT(T) { return #force_inline math.classify(x) } @(require_results) -classify_array :: proc(x: $A/[$N]$T) -> (out: [N]math.Float_Class) where IS_FLOAT(T) { +classify_array :: proc "contextless" (x: $A/[$N]$T) -> (out: [N]math.Float_Class) where IS_FLOAT(T) { for i in 0.. (out: bool) where !IS_ARRAY(T), IS_FLOAT(T) { return x < y } -@(require_results) less_than_equal_single :: proc(x, y: $T) -> (out: bool) where !IS_ARRAY(T), IS_FLOAT(T) { return x <= y } -@(require_results) greater_than_single :: proc(x, y: $T) -> (out: bool) where !IS_ARRAY(T), IS_FLOAT(T) { return x > y } -@(require_results) greater_than_equal_single :: proc(x, y: $T) -> (out: bool) where !IS_ARRAY(T), IS_FLOAT(T) { return x >= y } -@(require_results) equal_single :: proc(x, y: $T) -> (out: bool) where !IS_ARRAY(T), IS_FLOAT(T) { return x == y } -@(require_results) not_equal_single :: proc(x, y: $T) -> (out: bool) where !IS_ARRAY(T), IS_FLOAT(T) { return x != y } +@(require_results) less_than_single :: proc "contextless" (x, y: $T) -> (out: bool) where !IS_ARRAY(T), IS_FLOAT(T) { return x < y } +@(require_results) less_than_equal_single :: proc "contextless" (x, y: $T) -> (out: bool) where !IS_ARRAY(T), IS_FLOAT(T) { return x <= y } +@(require_results) greater_than_single :: proc "contextless" (x, y: $T) -> (out: bool) where !IS_ARRAY(T), IS_FLOAT(T) { return x > y } +@(require_results) greater_than_equal_single :: proc "contextless" (x, y: $T) -> (out: bool) where !IS_ARRAY(T), IS_FLOAT(T) { return x >= y } +@(require_results) equal_single :: proc "contextless" (x, y: $T) -> (out: bool) where !IS_ARRAY(T), IS_FLOAT(T) { return x == y } +@(require_results) not_equal_single :: proc "contextless" (x, y: $T) -> (out: bool) where !IS_ARRAY(T), IS_FLOAT(T) { return x != y } @(require_results) -less_than_array :: proc(x, y: $A/[$N]$T) -> (out: [N]bool) where IS_ARRAY(A), IS_FLOAT(ELEM_TYPE(A)) { +less_than_array :: proc "contextless" (x, y: $A/[$N]$T) -> (out: [N]bool) where IS_ARRAY(A), IS_FLOAT(ELEM_TYPE(A)) { for i in 0.. (out: [N]bool) where IS_ARRAY(A), IS_FLOAT(ELEM_TYPE(A)) { +less_than_equal_array :: proc "contextless" (x, y: $A/[$N]$T) -> (out: [N]bool) where IS_ARRAY(A), IS_FLOAT(ELEM_TYPE(A)) { for i in 0.. (out: [N]bool) where IS_ARRAY(A), IS_FLOAT(ELEM_TYPE(A)) { +greater_than_array :: proc "contextless" (x, y: $A/[$N]$T) -> (out: [N]bool) where IS_ARRAY(A), IS_FLOAT(ELEM_TYPE(A)) { for i in 0.. y[i] } return } @(require_results) -greater_than_equal_array :: proc(x, y: $A/[$N]$T) -> (out: [N]bool) where IS_ARRAY(A), IS_FLOAT(ELEM_TYPE(A)) { +greater_than_equal_array :: proc "contextless" (x, y: $A/[$N]$T) -> (out: [N]bool) where IS_ARRAY(A), IS_FLOAT(ELEM_TYPE(A)) { for i in 0..= y[i] } return } @(require_results) -equal_array :: proc(x, y: $A/[$N]$T) -> (out: [N]bool) where IS_ARRAY(A), IS_FLOAT(ELEM_TYPE(A)) { +equal_array :: proc "contextless" (x, y: $A/[$N]$T) -> (out: [N]bool) where IS_ARRAY(A), IS_FLOAT(ELEM_TYPE(A)) { for i in 0.. (out: [N]bool) where IS_ARRAY(A), IS_FLOAT(ELEM_TYPE(A)) { +not_equal_array :: proc "contextless" (x, y: $A/[$N]$T) -> (out: [N]bool) where IS_ARRAY(A), IS_FLOAT(ELEM_TYPE(A)) { for i in 0.. (out: bool) { +any :: proc "contextless" (x: $A/[$N]bool) -> (out: bool) { for e in x { if e { return true @@ -596,7 +596,7 @@ any :: proc(x: $A/[$N]bool) -> (out: bool) { return false } @(require_results) -all :: proc(x: $A/[$N]bool) -> (out: bool) { +all :: proc "contextless" (x: $A/[$N]bool) -> (out: bool) { for e in x { if !e { return false @@ -605,7 +605,7 @@ all :: proc(x: $A/[$N]bool) -> (out: bool) { return true } @(require_results) -not :: proc(x: $A/[$N]bool) -> (out: A) { +not :: proc "contextless" (x: $A/[$N]bool) -> (out: A) { for e, i in x { out[i] = !e } diff --git a/core/math/linalg/general.odin b/core/math/linalg/general.odin index dca3cf5d5..b58305c63 100644 --- a/core/math/linalg/general.odin +++ b/core/math/linalg/general.odin @@ -39,27 +39,27 @@ DEG_PER_RAD :: 360.0/TAU @(require_results) -scalar_dot :: proc(a, b: $T) -> T where IS_FLOAT(T), !IS_ARRAY(T) { +scalar_dot :: proc "contextless" (a, b: $T) -> T where IS_FLOAT(T), !IS_ARRAY(T) { return a * b } @(require_results) -vector_dot :: proc(a, b: $T/[$N]$E) -> (c: E) where IS_NUMERIC(E) #no_bounds_check { +vector_dot :: proc "contextless" (a, b: $T/[$N]$E) -> (c: E) where IS_NUMERIC(E) #no_bounds_check { for i in 0.. (c: f16) { +quaternion64_dot :: proc "contextless" (a, b: $T/quaternion64) -> (c: f16) { return a.w*a.w + a.x*b.x + a.y*b.y + a.z*b.z } @(require_results) -quaternion128_dot :: proc(a, b: $T/quaternion128) -> (c: f32) { +quaternion128_dot :: proc "contextless" (a, b: $T/quaternion128) -> (c: f32) { return a.w*a.w + a.x*b.x + a.y*b.y + a.z*b.z } @(require_results) -quaternion256_dot :: proc(a, b: $T/quaternion256) -> (c: f64) { +quaternion256_dot :: proc "contextless" (a, b: $T/quaternion256) -> (c: f64) { return a.w*a.w + a.x*b.x + a.y*b.y + a.z*b.z } @@ -69,23 +69,23 @@ inner_product :: dot outer_product :: builtin.outer_product @(require_results) -quaternion_inverse :: proc(q: $Q) -> Q where IS_QUATERNION(Q) { +quaternion_inverse :: proc "contextless" (q: $Q) -> Q where IS_QUATERNION(Q) { return conj(q) * quaternion(1.0/dot(q, q), 0, 0, 0) } @(require_results) -scalar_cross :: proc(a, b: $T) -> T where IS_FLOAT(T), !IS_ARRAY(T) { +scalar_cross :: proc "contextless" (a, b: $T) -> T where IS_FLOAT(T), !IS_ARRAY(T) { return a * b } @(require_results) -vector_cross2 :: proc(a, b: $T/[2]$E) -> E where IS_NUMERIC(E) { +vector_cross2 :: proc "contextless" (a, b: $T/[2]$E) -> E where IS_NUMERIC(E) { return a[0]*b[1] - b[0]*a[1] } @(require_results) -vector_cross3 :: proc(a, b: $T/[3]$E) -> (c: T) where IS_NUMERIC(E) { +vector_cross3 :: proc "contextless" (a, b: $T/[3]$E) -> (c: T) where IS_NUMERIC(E) { c[0] = a[1]*b[2] - b[1]*a[2] c[1] = a[2]*b[0] - b[2]*a[0] c[2] = a[0]*b[1] - b[0]*a[1] @@ -93,7 +93,7 @@ vector_cross3 :: proc(a, b: $T/[3]$E) -> (c: T) where IS_NUMERIC(E) { } @(require_results) -quaternion_cross :: proc(q1, q2: $Q) -> (q3: Q) where IS_QUATERNION(Q) { +quaternion_cross :: proc "contextless" (q1, q2: $Q) -> (q3: Q) where IS_QUATERNION(Q) { q3.x = q1.w * q2.x + q1.x * q2.w + q1.y * q2.z - q1.z * q2.y q3.y = q1.w * q2.y + q1.y * q2.w + q1.z * q2.x - q1.x * q2.z q3.z = q1.w * q2.z + q1.z * q2.w + q1.x * q2.y - q1.y * q2.x @@ -105,22 +105,22 @@ vector_cross :: proc{scalar_cross, vector_cross2, vector_cross3} cross :: proc{scalar_cross, vector_cross2, vector_cross3, quaternion_cross} @(require_results) -vector_normalize :: proc(v: $T/[$N]$E) -> T where IS_FLOAT(E) { +vector_normalize :: proc "contextless" (v: $T/[$N]$E) -> T where IS_FLOAT(E) { return v / length(v) } @(require_results) -quaternion_normalize :: proc(q: $Q) -> Q where IS_QUATERNION(Q) { +quaternion_normalize :: proc "contextless" (q: $Q) -> Q where IS_QUATERNION(Q) { return q/abs(q) } normalize :: proc{vector_normalize, quaternion_normalize} @(require_results) -vector_normalize0 :: proc(v: $T/[$N]$E) -> T where IS_FLOAT(E) { +vector_normalize0 :: proc "contextless" (v: $T/[$N]$E) -> T where IS_FLOAT(E) { m := length(v) return 0 if m == 0 else v/m } @(require_results) -quaternion_normalize0 :: proc(q: $Q) -> Q where IS_QUATERNION(Q) { +quaternion_normalize0 :: proc "contextless" (q: $Q) -> Q where IS_QUATERNION(Q) { m := abs(q) return 0 if m == 0 else q/m } @@ -128,27 +128,27 @@ normalize0 :: proc{vector_normalize0, quaternion_normalize0} @(require_results) -vector_length :: proc(v: $T/[$N]$E) -> E where IS_FLOAT(E) { +vector_length :: proc "contextless" (v: $T/[$N]$E) -> E where IS_FLOAT(E) { return math.sqrt(dot(v, v)) } @(require_results) -vector_length2 :: proc(v: $T/[$N]$E) -> E where IS_NUMERIC(E) { +vector_length2 :: proc "contextless" (v: $T/[$N]$E) -> E where IS_NUMERIC(E) { return dot(v, v) } @(require_results) -quaternion_length :: proc(q: $Q) -> Q where IS_QUATERNION(Q) { +quaternion_length :: proc "contextless" (q: $Q) -> Q where IS_QUATERNION(Q) { return abs(q) } @(require_results) -quaternion_length2 :: proc(q: $Q) -> Q where IS_QUATERNION(Q) { +quaternion_length2 :: proc "contextless" (q: $Q) -> Q where IS_QUATERNION(Q) { return dot(q, q) } @(require_results) -scalar_triple_product :: proc(a, b, c: $T/[$N]$E) -> E where IS_NUMERIC(E) { +scalar_triple_product :: proc "contextless" (a, b, c: $T/[$N]$E) -> E where IS_NUMERIC(E) { // a . (b x c) // b . (c x a) // c . (a x b) @@ -156,7 +156,7 @@ scalar_triple_product :: proc(a, b, c: $T/[$N]$E) -> E where IS_NUMERIC(E) { } @(require_results) -vector_triple_product :: proc(a, b, c: $T/[$N]$E) -> T where IS_NUMERIC(E) { +vector_triple_product :: proc "contextless" (a, b, c: $T/[$N]$E) -> T where IS_NUMERIC(E) { // a x (b x c) // (a . c)b - (a . b)c return cross(a, cross(b, c)) @@ -167,12 +167,12 @@ length :: proc{vector_length, quaternion_length} length2 :: proc{vector_length2, quaternion_length2} @(require_results) -projection :: proc(x, normal: $T/[$N]$E) -> T where IS_NUMERIC(E) { +projection :: proc "contextless" (x, normal: $T/[$N]$E) -> T where IS_NUMERIC(E) { return dot(x, normal) / dot(normal, normal) * normal } @(require_results) -identity :: proc($T: typeid/[$N][N]$E) -> (m: T) #no_bounds_check { +identity :: proc "contextless" ($T: typeid/[$N][N]$E) -> (m: T) #no_bounds_check { for i in 0.. (c: M) +matrix_mul :: proc "contextless" (a, b: $M/matrix[$N, N]$E) -> (c: M) where !IS_ARRAY(E), IS_NUMERIC(E) #no_bounds_check { return a * b } @(require_results) -matrix_comp_mul :: proc(a, b: $M/matrix[$I, $J]$E) -> (c: M) +matrix_comp_mul :: proc "contextless" (a, b: $M/matrix[$I, $J]$E) -> (c: M) where !IS_ARRAY(E), IS_NUMERIC(E) #no_bounds_check { return hadamard_product(a, b) } @(require_results) -matrix_mul_differ :: proc(a: $A/matrix[$I, $J]$E, b: $B/matrix[J, $K]E) -> (c: matrix[I, K]E) +matrix_mul_differ :: proc "contextless" (a: $A/matrix[$I, $J]$E, b: $B/matrix[J, $K]E) -> (c: matrix[I, K]E) where !IS_ARRAY(E), IS_NUMERIC(E), I != K #no_bounds_check { return a * b } @(require_results) -matrix_mul_vector :: proc(a: $A/matrix[$I, $J]$E, b: $B/[J]E) -> (c: B) +matrix_mul_vector :: proc "contextless" (a: $A/matrix[$I, $J]$E, b: $B/[J]E) -> (c: B) where !IS_ARRAY(E), IS_NUMERIC(E) #no_bounds_check { return a * b } @(require_results) -quaternion_mul_quaternion :: proc(q1, q2: $Q) -> Q where IS_QUATERNION(Q) { +quaternion_mul_quaternion :: proc "contextless" (q1, q2: $Q) -> Q where IS_QUATERNION(Q) { return q1 * q2 } @(require_results) -quaternion64_mul_vector3 :: proc(q: $Q/quaternion64, v: $V/[3]$F/f16) -> V { +quaternion64_mul_vector3 :: proc "contextless" (q: $Q/quaternion64, v: $V/[3]$F/f16) -> V { Raw_Quaternion :: struct {xyz: [3]f16, r: f16} q := transmute(Raw_Quaternion)q @@ -223,7 +223,7 @@ quaternion64_mul_vector3 :: proc(q: $Q/quaternion64, v: $V/[3]$F/f16) -> V { return V(v + q.r*t + cross(q.xyz, t)) } @(require_results) -quaternion128_mul_vector3 :: proc(q: $Q/quaternion128, v: $V/[3]$F/f32) -> V { +quaternion128_mul_vector3 :: proc "contextless" (q: $Q/quaternion128, v: $V/[3]$F/f32) -> V { Raw_Quaternion :: struct {xyz: [3]f32, r: f32} q := transmute(Raw_Quaternion)q @@ -233,7 +233,7 @@ quaternion128_mul_vector3 :: proc(q: $Q/quaternion128, v: $V/[3]$F/f32) -> V { return V(v + q.r*t + cross(q.xyz, t)) } @(require_results) -quaternion256_mul_vector3 :: proc(q: $Q/quaternion256, v: $V/[3]$F/f64) -> V { +quaternion256_mul_vector3 :: proc "contextless" (q: $Q/quaternion256, v: $V/[3]$F/f64) -> V { Raw_Quaternion :: struct {xyz: [3]f64, r: f64} q := transmute(Raw_Quaternion)q @@ -255,11 +255,11 @@ mul :: proc{ } @(require_results) -vector_to_ptr :: proc(v: ^$V/[$N]$E) -> ^E where IS_NUMERIC(E), N > 0 #no_bounds_check { +vector_to_ptr :: proc "contextless" (v: ^$V/[$N]$E) -> ^E where IS_NUMERIC(E), N > 0 #no_bounds_check { return &v[0] } @(require_results) -matrix_to_ptr :: proc(m: ^$A/matrix[$I, $J]$E) -> ^E where IS_NUMERIC(E), I > 0, J > 0 #no_bounds_check { +matrix_to_ptr :: proc "contextless" (m: ^$A/matrix[$I, $J]$E) -> ^E where IS_NUMERIC(E), I > 0, J > 0 #no_bounds_check { return &m[0, 0] } @@ -272,7 +272,7 @@ to_ptr :: proc{vector_to_ptr, matrix_to_ptr} // Splines @(require_results) -vector_slerp :: proc(x, y: $T/[$N]$E, a: E) -> T { +vector_slerp :: proc "contextless" (x, y: $T/[$N]$E, a: E) -> T { cos_alpha := dot(x, y) alpha := math.acos(cos_alpha) sin_alpha := math.sin(alpha) @@ -284,7 +284,7 @@ vector_slerp :: proc(x, y: $T/[$N]$E, a: E) -> T { } @(require_results) -catmull_rom :: proc(v1, v2, v3, v4: $T/[$N]$E, s: E) -> T { +catmull_rom :: proc "contextless" (v1, v2, v3, v4: $T/[$N]$E, s: E) -> T { s2 := s*s s3 := s2*s @@ -297,7 +297,7 @@ catmull_rom :: proc(v1, v2, v3, v4: $T/[$N]$E, s: E) -> T { } @(require_results) -hermite :: proc(v1, t1, v2, t2: $T/[$N]$E, s: E) -> T { +hermite :: proc "contextless" (v1, t1, v2, t2: $T/[$N]$E, s: E) -> T { s2 := s*s s3 := s2*s @@ -310,14 +310,14 @@ hermite :: proc(v1, t1, v2, t2: $T/[$N]$E, s: E) -> T { } @(require_results) -cubic :: proc(v1, v2, v3, v4: $T/[$N]$E, s: E) -> T { +cubic :: proc "contextless" (v1, v2, v3, v4: $T/[$N]$E, s: E) -> T { return ((v1 * s + v2) * s + v3) * s + v4 } @(require_results) -array_cast :: proc(v: $A/[$N]$T, $Elem_Type: typeid) -> (w: [N]Elem_Type) #no_bounds_check { +array_cast :: proc "contextless" (v: $A/[$N]$T, $Elem_Type: typeid) -> (w: [N]Elem_Type) #no_bounds_check { for i in 0.. (w: [N]Elem_Type) #no_bo } @(require_results) -matrix_cast :: proc(v: $A/matrix[$M, $N]$T, $Elem_Type: typeid) -> (w: matrix[M, N]Elem_Type) #no_bounds_check { +matrix_cast :: proc "contextless" (v: $A/matrix[$M, $N]$T, $Elem_Type: typeid) -> (w: matrix[M, N]Elem_Type) #no_bounds_check { for j in 0.. V where !IS_ARRAY(E), IS_FLOAT(E) { +vector2_orthogonal :: proc "contextless" (v: $V/[2]$E) -> V where !IS_ARRAY(E), IS_FLOAT(E) { return {-v.y, v.x} } @(require_results) -vector3_orthogonal :: proc(v: $V/[3]$E) -> V where !IS_ARRAY(E), IS_FLOAT(E) { +vector3_orthogonal :: proc "contextless" (v: $V/[3]$E) -> V where !IS_ARRAY(E), IS_FLOAT(E) { x := abs(v.x) y := abs(v.y) z := abs(v.z) @@ -163,7 +163,7 @@ orthogonal :: proc{vector2_orthogonal, vector3_orthogonal} @(require_results) -vector4_srgb_to_linear_f16 :: proc(col: Vector4f16) -> Vector4f16 { +vector4_srgb_to_linear_f16 :: proc "contextless" (col: Vector4f16) -> Vector4f16 { r := math.pow(col.x, 2.2) g := math.pow(col.y, 2.2) b := math.pow(col.z, 2.2) @@ -171,7 +171,7 @@ vector4_srgb_to_linear_f16 :: proc(col: Vector4f16) -> Vector4f16 { return {r, g, b, a} } @(require_results) -vector4_srgb_to_linear_f32 :: proc(col: Vector4f32) -> Vector4f32 { +vector4_srgb_to_linear_f32 :: proc "contextless" (col: Vector4f32) -> Vector4f32 { r := math.pow(col.x, 2.2) g := math.pow(col.y, 2.2) b := math.pow(col.z, 2.2) @@ -179,7 +179,7 @@ vector4_srgb_to_linear_f32 :: proc(col: Vector4f32) -> Vector4f32 { return {r, g, b, a} } @(require_results) -vector4_srgb_to_linear_f64 :: proc(col: Vector4f64) -> Vector4f64 { +vector4_srgb_to_linear_f64 :: proc "contextless" (col: Vector4f64) -> Vector4f64 { r := math.pow(col.x, 2.2) g := math.pow(col.y, 2.2) b := math.pow(col.z, 2.2) @@ -194,7 +194,7 @@ vector4_srgb_to_linear :: proc{ @(require_results) -vector4_linear_to_srgb_f16 :: proc(col: Vector4f16) -> Vector4f16 { +vector4_linear_to_srgb_f16 :: proc "contextless" (col: Vector4f16) -> Vector4f16 { a :: 2.51 b :: 0.03 c :: 2.43 @@ -216,7 +216,7 @@ vector4_linear_to_srgb_f16 :: proc(col: Vector4f16) -> Vector4f16 { return {x, y, z, col.w} } @(require_results) -vector4_linear_to_srgb_f32 :: proc(col: Vector4f32) -> Vector4f32 { +vector4_linear_to_srgb_f32 :: proc "contextless" (col: Vector4f32) -> Vector4f32 { a :: 2.51 b :: 0.03 c :: 2.43 @@ -238,7 +238,7 @@ vector4_linear_to_srgb_f32 :: proc(col: Vector4f32) -> Vector4f32 { return {x, y, z, col.w} } @(require_results) -vector4_linear_to_srgb_f64 :: proc(col: Vector4f64) -> Vector4f64 { +vector4_linear_to_srgb_f64 :: proc "contextless" (col: Vector4f64) -> Vector4f64 { a :: 2.51 b :: 0.03 c :: 2.43 @@ -267,9 +267,9 @@ vector4_linear_to_srgb :: proc{ @(require_results) -vector4_hsl_to_rgb_f16 :: proc(h, s, l: f16, a: f16 = 1) -> Vector4f16 { +vector4_hsl_to_rgb_f16 :: proc "contextless" (h, s, l: f16, a: f16 = 1) -> Vector4f16 { @(require_results) - hue_to_rgb :: proc(p, q, t: f16) -> f16 { + hue_to_rgb :: proc "contextless" (p, q, t: f16) -> f16 { t := t if t < 0 { t += 1 } if t > 1 { t -= 1 } @@ -296,9 +296,9 @@ vector4_hsl_to_rgb_f16 :: proc(h, s, l: f16, a: f16 = 1) -> Vector4f16 { return {r, g, b, a} } @(require_results) -vector4_hsl_to_rgb_f32 :: proc(h, s, l: f32, a: f32 = 1) -> Vector4f32 { +vector4_hsl_to_rgb_f32 :: proc "contextless" (h, s, l: f32, a: f32 = 1) -> Vector4f32 { @(require_results) - hue_to_rgb :: proc(p, q, t: f32) -> f32 { + hue_to_rgb :: proc "contextless" (p, q, t: f32) -> f32 { t := t if t < 0 { t += 1 } if t > 1 { t -= 1 } @@ -325,9 +325,9 @@ vector4_hsl_to_rgb_f32 :: proc(h, s, l: f32, a: f32 = 1) -> Vector4f32 { return {r, g, b, a} } @(require_results) -vector4_hsl_to_rgb_f64 :: proc(h, s, l: f64, a: f64 = 1) -> Vector4f64 { +vector4_hsl_to_rgb_f64 :: proc "contextless" (h, s, l: f64, a: f64 = 1) -> Vector4f64 { @(require_results) - hue_to_rgb :: proc(p, q, t: f64) -> f64 { + hue_to_rgb :: proc "contextless" (p, q, t: f64) -> f64 { t := t if t < 0 { t += 1 } if t > 1 { t -= 1 } @@ -361,7 +361,7 @@ vector4_hsl_to_rgb :: proc{ @(require_results) -vector4_rgb_to_hsl_f16 :: proc(col: Vector4f16) -> Vector4f16 { +vector4_rgb_to_hsl_f16 :: proc "contextless" (col: Vector4f16) -> Vector4f16 { r := col.x g := col.y b := col.z @@ -391,7 +391,7 @@ vector4_rgb_to_hsl_f16 :: proc(col: Vector4f16) -> Vector4f16 { return {h, s, l, a} } @(require_results) -vector4_rgb_to_hsl_f32 :: proc(col: Vector4f32) -> Vector4f32 { +vector4_rgb_to_hsl_f32 :: proc "contextless" (col: Vector4f32) -> Vector4f32 { r := col.x g := col.y b := col.z @@ -421,7 +421,7 @@ vector4_rgb_to_hsl_f32 :: proc(col: Vector4f32) -> Vector4f32 { return {h, s, l, a} } @(require_results) -vector4_rgb_to_hsl_f64 :: proc(col: Vector4f64) -> Vector4f64 { +vector4_rgb_to_hsl_f64 :: proc "contextless" (col: Vector4f64) -> Vector4f64 { r := col.x g := col.y b := col.z @@ -459,7 +459,7 @@ vector4_rgb_to_hsl :: proc{ @(require_results) -quaternion_angle_axis_f16 :: proc(angle_radians: f16, axis: Vector3f16) -> (q: Quaternionf16) { +quaternion_angle_axis_f16 :: proc "contextless" (angle_radians: f16, axis: Vector3f16) -> (q: Quaternionf16) { t := angle_radians*0.5 v := normalize(axis) * math.sin(t) q.x = v.x @@ -469,7 +469,7 @@ quaternion_angle_axis_f16 :: proc(angle_radians: f16, axis: Vector3f16) -> (q: Q return } @(require_results) -quaternion_angle_axis_f32 :: proc(angle_radians: f32, axis: Vector3f32) -> (q: Quaternionf32) { +quaternion_angle_axis_f32 :: proc "contextless" (angle_radians: f32, axis: Vector3f32) -> (q: Quaternionf32) { t := angle_radians*0.5 v := normalize(axis) * math.sin(t) q.x = v.x @@ -479,7 +479,7 @@ quaternion_angle_axis_f32 :: proc(angle_radians: f32, axis: Vector3f32) -> (q: Q return } @(require_results) -quaternion_angle_axis_f64 :: proc(angle_radians: f64, axis: Vector3f64) -> (q: Quaternionf64) { +quaternion_angle_axis_f64 :: proc "contextless" (angle_radians: f64, axis: Vector3f64) -> (q: Quaternionf64) { t := angle_radians*0.5 v := normalize(axis) * math.sin(t) q.x = v.x @@ -495,7 +495,7 @@ quaternion_angle_axis :: proc{ } @(require_results) -angle_from_quaternion_f16 :: proc(q: Quaternionf16) -> f16 { +angle_from_quaternion_f16 :: proc "contextless" (q: Quaternionf16) -> f16 { if abs(q.w) > math.SQRT_THREE*0.5 { return math.asin(math.sqrt(q.x*q.x + q.y*q.y + q.z*q.z)) * 2 } @@ -503,7 +503,7 @@ angle_from_quaternion_f16 :: proc(q: Quaternionf16) -> f16 { return math.acos(q.w) * 2 } @(require_results) -angle_from_quaternion_f32 :: proc(q: Quaternionf32) -> f32 { +angle_from_quaternion_f32 :: proc "contextless" (q: Quaternionf32) -> f32 { if abs(q.w) > math.SQRT_THREE*0.5 { return math.asin(math.sqrt(q.x*q.x + q.y*q.y + q.z*q.z)) * 2 } @@ -511,7 +511,7 @@ angle_from_quaternion_f32 :: proc(q: Quaternionf32) -> f32 { return math.acos(q.w) * 2 } @(require_results) -angle_from_quaternion_f64 :: proc(q: Quaternionf64) -> f64 { +angle_from_quaternion_f64 :: proc "contextless" (q: Quaternionf64) -> f64 { if abs(q.w) > math.SQRT_THREE*0.5 { return math.asin(math.sqrt(q.x*q.x + q.y*q.y + q.z*q.z)) * 2 } @@ -525,7 +525,7 @@ angle_from_quaternion :: proc{ } @(require_results) -axis_from_quaternion_f16 :: proc(q: Quaternionf16) -> Vector3f16 { +axis_from_quaternion_f16 :: proc "contextless" (q: Quaternionf16) -> Vector3f16 { t1 := 1 - q.w*q.w if t1 < 0 { return {0, 0, 1} @@ -534,7 +534,7 @@ axis_from_quaternion_f16 :: proc(q: Quaternionf16) -> Vector3f16 { return {q.x*t2, q.y*t2, q.z*t2} } @(require_results) -axis_from_quaternion_f32 :: proc(q: Quaternionf32) -> Vector3f32 { +axis_from_quaternion_f32 :: proc "contextless" (q: Quaternionf32) -> Vector3f32 { t1 := 1 - q.w*q.w if t1 < 0 { return {0, 0, 1} @@ -543,7 +543,7 @@ axis_from_quaternion_f32 :: proc(q: Quaternionf32) -> Vector3f32 { return {q.x*t2, q.y*t2, q.z*t2} } @(require_results) -axis_from_quaternion_f64 :: proc(q: Quaternionf64) -> Vector3f64 { +axis_from_quaternion_f64 :: proc "contextless" (q: Quaternionf64) -> Vector3f64 { t1 := 1 - q.w*q.w if t1 < 0 { return {0, 0, 1} @@ -559,19 +559,19 @@ axis_from_quaternion :: proc{ @(require_results) -angle_axis_from_quaternion_f16 :: proc(q: Quaternionf16) -> (angle: f16, axis: Vector3f16) { +angle_axis_from_quaternion_f16 :: proc "contextless" (q: Quaternionf16) -> (angle: f16, axis: Vector3f16) { angle = angle_from_quaternion(q) axis = axis_from_quaternion(q) return } @(require_results) -angle_axis_from_quaternion_f32 :: proc(q: Quaternionf32) -> (angle: f32, axis: Vector3f32) { +angle_axis_from_quaternion_f32 :: proc "contextless" (q: Quaternionf32) -> (angle: f32, axis: Vector3f32) { angle = angle_from_quaternion(q) axis = axis_from_quaternion(q) return } @(require_results) -angle_axis_from_quaternion_f64 :: proc(q: Quaternionf64) -> (angle: f64, axis: Vector3f64) { +angle_axis_from_quaternion_f64 :: proc "contextless" (q: Quaternionf64) -> (angle: f64, axis: Vector3f64) { angle = angle_from_quaternion(q) axis = axis_from_quaternion(q) return @@ -584,7 +584,7 @@ angle_axis_from_quaternion :: proc { @(require_results) -quaternion_from_forward_and_up_f16 :: proc(forward, up: Vector3f16) -> Quaternionf16 { +quaternion_from_forward_and_up_f16 :: proc "contextless" (forward, up: Vector3f16) -> Quaternionf16 { f := normalize(forward) s := normalize(cross(f, up)) u := cross(s, f) @@ -628,7 +628,7 @@ quaternion_from_forward_and_up_f16 :: proc(forward, up: Vector3f16) -> Quaternio return normalize(q) } @(require_results) -quaternion_from_forward_and_up_f32 :: proc(forward, up: Vector3f32) -> Quaternionf32 { +quaternion_from_forward_and_up_f32 :: proc "contextless" (forward, up: Vector3f32) -> Quaternionf32 { f := normalize(forward) s := normalize(cross(f, up)) u := cross(s, f) @@ -672,7 +672,7 @@ quaternion_from_forward_and_up_f32 :: proc(forward, up: Vector3f32) -> Quaternio return normalize(q) } @(require_results) -quaternion_from_forward_and_up_f64 :: proc(forward, up: Vector3f64) -> Quaternionf64 { +quaternion_from_forward_and_up_f64 :: proc "contextless" (forward, up: Vector3f64) -> Quaternionf64 { f := normalize(forward) s := normalize(cross(f, up)) u := cross(s, f) @@ -722,15 +722,15 @@ quaternion_from_forward_and_up :: proc{ } @(require_results) -quaternion_look_at_f16 :: proc(eye, centre: Vector3f16, up: Vector3f16) -> Quaternionf16 { +quaternion_look_at_f16 :: proc "contextless" (eye, centre: Vector3f16, up: Vector3f16) -> Quaternionf16 { return quaternion_from_matrix3(matrix3_look_at(eye, centre, up)) } @(require_results) -quaternion_look_at_f32 :: proc(eye, centre: Vector3f32, up: Vector3f32) -> Quaternionf32 { +quaternion_look_at_f32 :: proc "contextless" (eye, centre: Vector3f32, up: Vector3f32) -> Quaternionf32 { return quaternion_from_matrix3(matrix3_look_at(eye, centre, up)) } @(require_results) -quaternion_look_at_f64 :: proc(eye, centre: Vector3f64, up: Vector3f64) -> Quaternionf64 { +quaternion_look_at_f64 :: proc "contextless" (eye, centre: Vector3f64, up: Vector3f64) -> Quaternionf64 { return quaternion_from_matrix3(matrix3_look_at(eye, centre, up)) } quaternion_look_at :: proc{ @@ -742,7 +742,7 @@ quaternion_look_at :: proc{ @(require_results) -quaternion_nlerp_f16 :: proc(a, b: Quaternionf16, t: f16) -> (c: Quaternionf16) { +quaternion_nlerp_f16 :: proc "contextless" (a, b: Quaternionf16, t: f16) -> (c: Quaternionf16) { c.x = a.x + (b.x-a.x)*t c.y = a.y + (b.y-a.y)*t c.z = a.z + (b.z-a.z)*t @@ -750,7 +750,7 @@ quaternion_nlerp_f16 :: proc(a, b: Quaternionf16, t: f16) -> (c: Quaternionf16) return normalize(c) } @(require_results) -quaternion_nlerp_f32 :: proc(a, b: Quaternionf32, t: f32) -> (c: Quaternionf32) { +quaternion_nlerp_f32 :: proc "contextless" (a, b: Quaternionf32, t: f32) -> (c: Quaternionf32) { c.x = a.x + (b.x-a.x)*t c.y = a.y + (b.y-a.y)*t c.z = a.z + (b.z-a.z)*t @@ -758,7 +758,7 @@ quaternion_nlerp_f32 :: proc(a, b: Quaternionf32, t: f32) -> (c: Quaternionf32) return normalize(c) } @(require_results) -quaternion_nlerp_f64 :: proc(a, b: Quaternionf64, t: f64) -> (c: Quaternionf64) { +quaternion_nlerp_f64 :: proc "contextless" (a, b: Quaternionf64, t: f64) -> (c: Quaternionf64) { c.x = a.x + (b.x-a.x)*t c.y = a.y + (b.y-a.y)*t c.z = a.z + (b.z-a.z)*t @@ -773,7 +773,7 @@ quaternion_nlerp :: proc{ @(require_results) -quaternion_slerp_f16 :: proc(x, y: Quaternionf16, t: f16) -> (q: Quaternionf16) { +quaternion_slerp_f16 :: proc "contextless" (x, y: Quaternionf16, t: f16) -> (q: Quaternionf16) { a, b := x, y cos_angle := dot(a, b) if cos_angle < 0 { @@ -801,7 +801,7 @@ quaternion_slerp_f16 :: proc(x, y: Quaternionf16, t: f16) -> (q: Quaternionf16) return } @(require_results) -quaternion_slerp_f32 :: proc(x, y: Quaternionf32, t: f32) -> (q: Quaternionf32) { +quaternion_slerp_f32 :: proc "contextless" (x, y: Quaternionf32, t: f32) -> (q: Quaternionf32) { a, b := x, y cos_angle := dot(a, b) if cos_angle < 0 { @@ -829,7 +829,7 @@ quaternion_slerp_f32 :: proc(x, y: Quaternionf32, t: f32) -> (q: Quaternionf32) return } @(require_results) -quaternion_slerp_f64 :: proc(x, y: Quaternionf64, t: f64) -> (q: Quaternionf64) { +quaternion_slerp_f64 :: proc "contextless" (x, y: Quaternionf64, t: f64) -> (q: Quaternionf64) { a, b := x, y cos_angle := dot(a, b) if cos_angle < 0 { @@ -864,17 +864,17 @@ quaternion_slerp :: proc{ @(require_results) -quaternion_squad_f16 :: proc(q1, q2, s1, s2: Quaternionf16, h: f16) -> Quaternionf16 { +quaternion_squad_f16 :: proc "contextless" (q1, q2, s1, s2: Quaternionf16, h: f16) -> Quaternionf16 { slerp :: quaternion_slerp return slerp(slerp(q1, q2, h), slerp(s1, s2, h), 2 * (1 - h) * h) } @(require_results) -quaternion_squad_f32 :: proc(q1, q2, s1, s2: Quaternionf32, h: f32) -> Quaternionf32 { +quaternion_squad_f32 :: proc "contextless" (q1, q2, s1, s2: Quaternionf32, h: f32) -> Quaternionf32 { slerp :: quaternion_slerp return slerp(slerp(q1, q2, h), slerp(s1, s2, h), 2 * (1 - h) * h) } @(require_results) -quaternion_squad_f64 :: proc(q1, q2, s1, s2: Quaternionf64, h: f64) -> Quaternionf64 { +quaternion_squad_f64 :: proc "contextless" (q1, q2, s1, s2: Quaternionf64, h: f64) -> Quaternionf64 { slerp :: quaternion_slerp return slerp(slerp(q1, q2, h), slerp(s1, s2, h), 2 * (1 - h) * h) } @@ -886,7 +886,7 @@ quaternion_squad :: proc{ @(require_results) -quaternion_from_matrix4_f16 :: proc(m: Matrix4f16) -> (q: Quaternionf16) { +quaternion_from_matrix4_f16 :: proc "contextless" (m: Matrix4f16) -> (q: Quaternionf16) { m3: Matrix3f16 = --- m3[0, 0], m3[1, 0], m3[2, 0] = m[0, 0], m[1, 0], m[2, 0] m3[0, 1], m3[1, 1], m3[2, 1] = m[0, 1], m[1, 1], m[2, 1] @@ -894,7 +894,7 @@ quaternion_from_matrix4_f16 :: proc(m: Matrix4f16) -> (q: Quaternionf16) { return quaternion_from_matrix3(m3) } @(require_results) -quaternion_from_matrix4_f32 :: proc(m: Matrix4f32) -> (q: Quaternionf32) { +quaternion_from_matrix4_f32 :: proc "contextless" (m: Matrix4f32) -> (q: Quaternionf32) { m3: Matrix3f32 = --- m3[0, 0], m3[1, 0], m3[2, 0] = m[0, 0], m[1, 0], m[2, 0] m3[0, 1], m3[1, 1], m3[2, 1] = m[0, 1], m[1, 1], m[2, 1] @@ -902,7 +902,7 @@ quaternion_from_matrix4_f32 :: proc(m: Matrix4f32) -> (q: Quaternionf32) { return quaternion_from_matrix3(m3) } @(require_results) -quaternion_from_matrix4_f64 :: proc(m: Matrix4f64) -> (q: Quaternionf64) { +quaternion_from_matrix4_f64 :: proc "contextless" (m: Matrix4f64) -> (q: Quaternionf64) { m3: Matrix3f64 = --- m3[0, 0], m3[1, 0], m3[2, 0] = m[0, 0], m[1, 0], m[2, 0] m3[0, 1], m3[1, 1], m3[2, 1] = m[0, 1], m[1, 1], m[2, 1] @@ -917,7 +917,7 @@ quaternion_from_matrix4 :: proc{ @(require_results) -quaternion_from_matrix3_f16 :: proc(m: Matrix3f16) -> (q: Quaternionf16) { +quaternion_from_matrix3_f16 :: proc "contextless" (m: Matrix3f16) -> (q: Quaternionf16) { four_x_squared_minus_1 := m[0, 0] - m[1, 1] - m[2, 2] four_y_squared_minus_1 := m[1, 1] - m[0, 0] - m[2, 2] four_z_squared_minus_1 := m[2, 2] - m[0, 0] - m[1, 1] @@ -967,7 +967,7 @@ quaternion_from_matrix3_f16 :: proc(m: Matrix3f16) -> (q: Quaternionf16) { return } @(require_results) -quaternion_from_matrix3_f32 :: proc(m: Matrix3f32) -> (q: Quaternionf32) { +quaternion_from_matrix3_f32 :: proc "contextless" (m: Matrix3f32) -> (q: Quaternionf32) { four_x_squared_minus_1 := m[0, 0] - m[1, 1] - m[2, 2] four_y_squared_minus_1 := m[1, 1] - m[0, 0] - m[2, 2] four_z_squared_minus_1 := m[2, 2] - m[0, 0] - m[1, 1] @@ -1017,7 +1017,7 @@ quaternion_from_matrix3_f32 :: proc(m: Matrix3f32) -> (q: Quaternionf32) { return } @(require_results) -quaternion_from_matrix3_f64 :: proc(m: Matrix3f64) -> (q: Quaternionf64) { +quaternion_from_matrix3_f64 :: proc "contextless" (m: Matrix3f64) -> (q: Quaternionf64) { four_x_squared_minus_1 := m[0, 0] - m[1, 1] - m[2, 2] four_y_squared_minus_1 := m[1, 1] - m[0, 0] - m[2, 2] four_z_squared_minus_1 := m[2, 2] - m[0, 0] - m[1, 1] @@ -1074,7 +1074,7 @@ quaternion_from_matrix3 :: proc{ @(require_results) -quaternion_between_two_vector3_f16 :: proc(from, to: Vector3f16) -> (q: Quaternionf16) { +quaternion_between_two_vector3_f16 :: proc "contextless" (from, to: Vector3f16) -> (q: Quaternionf16) { x := normalize(from) y := normalize(to) @@ -1096,7 +1096,7 @@ quaternion_between_two_vector3_f16 :: proc(from, to: Vector3f16) -> (q: Quaterni return normalize(q) } @(require_results) -quaternion_between_two_vector3_f32 :: proc(from, to: Vector3f32) -> (q: Quaternionf32) { +quaternion_between_two_vector3_f32 :: proc "contextless" (from, to: Vector3f32) -> (q: Quaternionf32) { x := normalize(from) y := normalize(to) @@ -1118,7 +1118,7 @@ quaternion_between_two_vector3_f32 :: proc(from, to: Vector3f32) -> (q: Quaterni return normalize(q) } @(require_results) -quaternion_between_two_vector3_f64 :: proc(from, to: Vector3f64) -> (q: Quaternionf64) { +quaternion_between_two_vector3_f64 :: proc "contextless" (from, to: Vector3f64) -> (q: Quaternionf64) { x := normalize(from) y := normalize(to) @@ -1147,7 +1147,7 @@ quaternion_between_two_vector3 :: proc{ @(require_results) -matrix2_inverse_transpose_f16 :: proc(m: Matrix2f16) -> (c: Matrix2f16) { +matrix2_inverse_transpose_f16 :: proc "contextless" (m: Matrix2f16) -> (c: Matrix2f16) { d := m[0, 0]*m[1, 1] - m[0, 1]*m[1, 0] id := 1.0/d c[0, 0] = +m[1, 1] * id @@ -1157,7 +1157,7 @@ matrix2_inverse_transpose_f16 :: proc(m: Matrix2f16) -> (c: Matrix2f16) { return c } @(require_results) -matrix2_inverse_transpose_f32 :: proc(m: Matrix2f32) -> (c: Matrix2f32) { +matrix2_inverse_transpose_f32 :: proc "contextless" (m: Matrix2f32) -> (c: Matrix2f32) { d := m[0, 0]*m[1, 1] - m[0, 1]*m[1, 0] id := 1.0/d c[0, 0] = +m[1, 1] * id @@ -1167,7 +1167,7 @@ matrix2_inverse_transpose_f32 :: proc(m: Matrix2f32) -> (c: Matrix2f32) { return c } @(require_results) -matrix2_inverse_transpose_f64 :: proc(m: Matrix2f64) -> (c: Matrix2f64) { +matrix2_inverse_transpose_f64 :: proc "contextless" (m: Matrix2f64) -> (c: Matrix2f64) { d := m[0, 0]*m[1, 1] - m[0, 1]*m[1, 0] id := 1.0/d c[0, 0] = +m[1, 1] * id @@ -1184,15 +1184,15 @@ matrix2_inverse_transpose :: proc{ @(require_results) -matrix2_determinant_f16 :: proc(m: Matrix2f16) -> f16 { +matrix2_determinant_f16 :: proc "contextless" (m: Matrix2f16) -> f16 { return m[0, 0]*m[1, 1] - m[0, 1]*m[1, 0] } @(require_results) -matrix2_determinant_f32 :: proc(m: Matrix2f32) -> f32 { +matrix2_determinant_f32 :: proc "contextless" (m: Matrix2f32) -> f32 { return m[0, 0]*m[1, 1] - m[0, 1]*m[1, 0] } @(require_results) -matrix2_determinant_f64 :: proc(m: Matrix2f64) -> f64 { +matrix2_determinant_f64 :: proc "contextless" (m: Matrix2f64) -> f64 { return m[0, 0]*m[1, 1] - m[0, 1]*m[1, 0] } matrix2_determinant :: proc{ @@ -1203,7 +1203,7 @@ matrix2_determinant :: proc{ @(require_results) -matrix2_inverse_f16 :: proc(m: Matrix2f16) -> (c: Matrix2f16) { +matrix2_inverse_f16 :: proc "contextless" (m: Matrix2f16) -> (c: Matrix2f16) { d := m[0, 0]*m[1, 1] - m[0, 1]*m[1, 0] id := 1.0/d c[0, 0] = +m[1, 1] * id @@ -1213,7 +1213,7 @@ matrix2_inverse_f16 :: proc(m: Matrix2f16) -> (c: Matrix2f16) { return c } @(require_results) -matrix2_inverse_f32 :: proc(m: Matrix2f32) -> (c: Matrix2f32) { +matrix2_inverse_f32 :: proc "contextless" (m: Matrix2f32) -> (c: Matrix2f32) { d := m[0, 0]*m[1, 1] - m[0, 1]*m[1, 0] id := 1.0/d c[0, 0] = +m[1, 1] * id @@ -1223,7 +1223,7 @@ matrix2_inverse_f32 :: proc(m: Matrix2f32) -> (c: Matrix2f32) { return c } @(require_results) -matrix2_inverse_f64 :: proc(m: Matrix2f64) -> (c: Matrix2f64) { +matrix2_inverse_f64 :: proc "contextless" (m: Matrix2f64) -> (c: Matrix2f64) { d := m[0, 0]*m[1, 1] - m[0, 1]*m[1, 0] id := 1.0/d c[0, 0] = +m[1, 1] * id @@ -1240,7 +1240,7 @@ matrix2_inverse :: proc{ @(require_results) -matrix2_adjoint_f16 :: proc(m: Matrix2f16) -> (c: Matrix2f16) { +matrix2_adjoint_f16 :: proc "contextless" (m: Matrix2f16) -> (c: Matrix2f16) { c[0, 0] = +m[1, 1] c[1, 0] = -m[0, 1] c[0, 1] = -m[1, 0] @@ -1248,7 +1248,7 @@ matrix2_adjoint_f16 :: proc(m: Matrix2f16) -> (c: Matrix2f16) { return c } @(require_results) -matrix2_adjoint_f32 :: proc(m: Matrix2f32) -> (c: Matrix2f32) { +matrix2_adjoint_f32 :: proc "contextless" (m: Matrix2f32) -> (c: Matrix2f32) { c[0, 0] = +m[1, 1] c[1, 0] = -m[0, 1] c[0, 1] = -m[1, 0] @@ -1256,7 +1256,7 @@ matrix2_adjoint_f32 :: proc(m: Matrix2f32) -> (c: Matrix2f32) { return c } @(require_results) -matrix2_adjoint_f64 :: proc(m: Matrix2f64) -> (c: Matrix2f64) { +matrix2_adjoint_f64 :: proc "contextless" (m: Matrix2f64) -> (c: Matrix2f64) { c[0, 0] = +m[1, 1] c[1, 0] = -m[0, 1] c[0, 1] = -m[1, 0] @@ -1271,7 +1271,7 @@ matrix2_adjoint :: proc{ @(require_results) -matrix3_from_quaternion_f16 :: proc(q: Quaternionf16) -> (m: Matrix3f16) { +matrix3_from_quaternion_f16 :: proc "contextless" (q: Quaternionf16) -> (m: Matrix3f16) { qxx := q.x * q.x qyy := q.y * q.y qzz := q.z * q.z @@ -1296,7 +1296,7 @@ matrix3_from_quaternion_f16 :: proc(q: Quaternionf16) -> (m: Matrix3f16) { return m } @(require_results) -matrix3_from_quaternion_f32 :: proc(q: Quaternionf32) -> (m: Matrix3f32) { +matrix3_from_quaternion_f32 :: proc "contextless" (q: Quaternionf32) -> (m: Matrix3f32) { qxx := q.x * q.x qyy := q.y * q.y qzz := q.z * q.z @@ -1321,7 +1321,7 @@ matrix3_from_quaternion_f32 :: proc(q: Quaternionf32) -> (m: Matrix3f32) { return m } @(require_results) -matrix3_from_quaternion_f64 :: proc(q: Quaternionf64) -> (m: Matrix3f64) { +matrix3_from_quaternion_f64 :: proc "contextless" (q: Quaternionf64) -> (m: Matrix3f64) { qxx := q.x * q.x qyy := q.y * q.y qzz := q.z * q.z @@ -1353,15 +1353,15 @@ matrix3_from_quaternion :: proc{ @(require_results) -matrix3_inverse_f16 :: proc(m: Matrix3f16) -> Matrix3f16 { +matrix3_inverse_f16 :: proc "contextless" (m: Matrix3f16) -> Matrix3f16 { return transpose(matrix3_inverse_transpose(m)) } @(require_results) -matrix3_inverse_f32 :: proc(m: Matrix3f32) -> Matrix3f32 { +matrix3_inverse_f32 :: proc "contextless" (m: Matrix3f32) -> Matrix3f32 { return transpose(matrix3_inverse_transpose(m)) } @(require_results) -matrix3_inverse_f64 :: proc(m: Matrix3f64) -> Matrix3f64 { +matrix3_inverse_f64 :: proc "contextless" (m: Matrix3f64) -> Matrix3f64 { return transpose(matrix3_inverse_transpose(m)) } matrix3_inverse :: proc{ @@ -1372,21 +1372,21 @@ matrix3_inverse :: proc{ @(require_results) -matrix3_determinant_f16 :: proc(m: Matrix3f16) -> f16 { +matrix3_determinant_f16 :: proc "contextless" (m: Matrix3f16) -> f16 { a := +m[0, 0] * (m[1, 1] * m[2, 2] - m[1, 2] * m[2, 1]) b := -m[0, 1] * (m[1, 0] * m[2, 2] - m[1, 2] * m[2, 0]) c := +m[0, 2] * (m[1, 0] * m[2, 1] - m[1, 1] * m[2, 0]) return a + b + c } @(require_results) -matrix3_determinant_f32 :: proc(m: Matrix3f32) -> f32 { +matrix3_determinant_f32 :: proc "contextless" (m: Matrix3f32) -> f32 { a := +m[0, 0] * (m[1, 1] * m[2, 2] - m[1, 2] * m[2, 1]) b := -m[0, 1] * (m[1, 0] * m[2, 2] - m[1, 2] * m[2, 0]) c := +m[0, 2] * (m[1, 0] * m[2, 1] - m[1, 1] * m[2, 0]) return a + b + c } @(require_results) -matrix3_determinant_f64 :: proc(m: Matrix3f64) -> f64 { +matrix3_determinant_f64 :: proc "contextless" (m: Matrix3f64) -> f64 { a := +m[0, 0] * (m[1, 1] * m[2, 2] - m[1, 2] * m[2, 1]) b := -m[0, 1] * (m[1, 0] * m[2, 2] - m[1, 2] * m[2, 0]) c := +m[0, 2] * (m[1, 0] * m[2, 1] - m[1, 1] * m[2, 0]) @@ -1400,7 +1400,7 @@ matrix3_determinant :: proc{ @(require_results) -matrix3_adjoint_f16 :: proc(m: Matrix3f16) -> (adjoint: Matrix3f16) { +matrix3_adjoint_f16 :: proc "contextless" (m: Matrix3f16) -> (adjoint: Matrix3f16) { adjoint[0, 0] = +(m[1, 1] * m[2, 2] - m[2, 1] * m[1, 2]) adjoint[0, 1] = -(m[1, 0] * m[2, 2] - m[2, 0] * m[1, 2]) adjoint[0, 2] = +(m[1, 0] * m[2, 1] - m[2, 0] * m[1, 1]) @@ -1413,7 +1413,7 @@ matrix3_adjoint_f16 :: proc(m: Matrix3f16) -> (adjoint: Matrix3f16) { return adjoint } @(require_results) -matrix3_adjoint_f32 :: proc(m: Matrix3f32) -> (adjoint: Matrix3f32) { +matrix3_adjoint_f32 :: proc "contextless" (m: Matrix3f32) -> (adjoint: Matrix3f32) { adjoint[0, 0] = +(m[1, 1] * m[2, 2] - m[2, 1] * m[1, 2]) adjoint[0, 1] = -(m[1, 0] * m[2, 2] - m[2, 0] * m[1, 2]) adjoint[0, 2] = +(m[1, 0] * m[2, 1] - m[2, 0] * m[1, 1]) @@ -1426,7 +1426,7 @@ matrix3_adjoint_f32 :: proc(m: Matrix3f32) -> (adjoint: Matrix3f32) { return adjoint } @(require_results) -matrix3_adjoint_f64 :: proc(m: Matrix3f64) -> (adjoint: Matrix3f64) { +matrix3_adjoint_f64 :: proc "contextless" (m: Matrix3f64) -> (adjoint: Matrix3f64) { adjoint[0, 0] = +(m[1, 1] * m[2, 2] - m[2, 1] * m[1, 2]) adjoint[0, 1] = -(m[1, 0] * m[2, 2] - m[2, 0] * m[1, 2]) adjoint[0, 2] = +(m[1, 0] * m[2, 1] - m[2, 0] * m[1, 1]) @@ -1447,15 +1447,15 @@ matrix3_adjoint :: proc{ @(require_results) -matrix3_inverse_transpose_f16 :: proc(m: Matrix3f16) -> (inverse_transpose: Matrix3f16) { +matrix3_inverse_transpose_f16 :: proc "contextless" (m: Matrix3f16) -> (inverse_transpose: Matrix3f16) { return builtin.inverse_transpose(m) } @(require_results) -matrix3_inverse_transpose_f32 :: proc(m: Matrix3f32) -> (inverse_transpose: Matrix3f32) { +matrix3_inverse_transpose_f32 :: proc "contextless" (m: Matrix3f32) -> (inverse_transpose: Matrix3f32) { return builtin.inverse_transpose(m) } @(require_results) -matrix3_inverse_transpose_f64 :: proc(m: Matrix3f64) -> (inverse_transpose: Matrix3f64) { +matrix3_inverse_transpose_f64 :: proc "contextless" (m: Matrix3f64) -> (inverse_transpose: Matrix3f64) { return builtin.inverse_transpose(m) } matrix3_inverse_transpose :: proc{ @@ -1466,21 +1466,21 @@ matrix3_inverse_transpose :: proc{ @(require_results) -matrix3_scale_f16 :: proc(s: Vector3f16) -> (m: Matrix3f16) { +matrix3_scale_f16 :: proc "contextless" (s: Vector3f16) -> (m: Matrix3f16) { m[0, 0] = s[0] m[1, 1] = s[1] m[2, 2] = s[2] return m } @(require_results) -matrix3_scale_f32 :: proc(s: Vector3f32) -> (m: Matrix3f32) { +matrix3_scale_f32 :: proc "contextless" (s: Vector3f32) -> (m: Matrix3f32) { m[0, 0] = s[0] m[1, 1] = s[1] m[2, 2] = s[2] return m } @(require_results) -matrix3_scale_f64 :: proc(s: Vector3f64) -> (m: Matrix3f64) { +matrix3_scale_f64 :: proc "contextless" (s: Vector3f64) -> (m: Matrix3f64) { m[0, 0] = s[0] m[1, 1] = s[1] m[2, 2] = s[2] @@ -1494,7 +1494,7 @@ matrix3_scale :: proc{ @(require_results) -matrix3_rotate_f16 :: proc(angle_radians: f16, v: Vector3f16) -> (rot: Matrix3f16) { +matrix3_rotate_f16 :: proc "contextless" (angle_radians: f16, v: Vector3f16) -> (rot: Matrix3f16) { c := math.cos(angle_radians) s := math.sin(angle_radians) @@ -1516,7 +1516,7 @@ matrix3_rotate_f16 :: proc(angle_radians: f16, v: Vector3f16) -> (rot: Matrix3f1 return rot } @(require_results) -matrix3_rotate_f32 :: proc(angle_radians: f32, v: Vector3f32) -> (rot: Matrix3f32) { +matrix3_rotate_f32 :: proc "contextless" (angle_radians: f32, v: Vector3f32) -> (rot: Matrix3f32) { c := math.cos(angle_radians) s := math.sin(angle_radians) @@ -1538,7 +1538,7 @@ matrix3_rotate_f32 :: proc(angle_radians: f32, v: Vector3f32) -> (rot: Matrix3f3 return rot } @(require_results) -matrix3_rotate_f64 :: proc(angle_radians: f64, v: Vector3f64) -> (rot: Matrix3f64) { +matrix3_rotate_f64 :: proc "contextless" (angle_radians: f64, v: Vector3f64) -> (rot: Matrix3f64) { c := math.cos(angle_radians) s := math.sin(angle_radians) @@ -1567,7 +1567,7 @@ matrix3_rotate :: proc{ @(require_results) -matrix3_look_at_f16 :: proc(eye, centre, up: Vector3f16) -> Matrix3f16 { +matrix3_look_at_f16 :: proc "contextless" (eye, centre, up: Vector3f16) -> Matrix3f16 { f := normalize(centre - eye) s := normalize(cross(f, up)) u := cross(s, f) @@ -1578,7 +1578,7 @@ matrix3_look_at_f16 :: proc(eye, centre, up: Vector3f16) -> Matrix3f16 { } } @(require_results) -matrix3_look_at_f32 :: proc(eye, centre, up: Vector3f32) -> Matrix3f32 { +matrix3_look_at_f32 :: proc "contextless" (eye, centre, up: Vector3f32) -> Matrix3f32 { f := normalize(centre - eye) s := normalize(cross(f, up)) u := cross(s, f) @@ -1589,7 +1589,7 @@ matrix3_look_at_f32 :: proc(eye, centre, up: Vector3f32) -> Matrix3f32 { } } @(require_results) -matrix3_look_at_f64 :: proc(eye, centre, up: Vector3f64) -> Matrix3f64 { +matrix3_look_at_f64 :: proc "contextless" (eye, centre, up: Vector3f64) -> Matrix3f64 { f := normalize(centre - eye) s := normalize(cross(f, up)) u := cross(s, f) @@ -1607,7 +1607,7 @@ matrix3_look_at :: proc{ @(require_results) -matrix4_from_quaternion_f16 :: proc(q: Quaternionf16) -> (m: Matrix4f16) { +matrix4_from_quaternion_f16 :: proc "contextless" (q: Quaternionf16) -> (m: Matrix4f16) { qxx := q.x * q.x qyy := q.y * q.y qzz := q.z * q.z @@ -1635,7 +1635,7 @@ matrix4_from_quaternion_f16 :: proc(q: Quaternionf16) -> (m: Matrix4f16) { return m } @(require_results) -matrix4_from_quaternion_f32 :: proc(q: Quaternionf32) -> (m: Matrix4f32) { +matrix4_from_quaternion_f32 :: proc "contextless" (q: Quaternionf32) -> (m: Matrix4f32) { qxx := q.x * q.x qyy := q.y * q.y qzz := q.z * q.z @@ -1663,7 +1663,7 @@ matrix4_from_quaternion_f32 :: proc(q: Quaternionf32) -> (m: Matrix4f32) { return m } @(require_results) -matrix4_from_quaternion_f64 :: proc(q: Quaternionf64) -> (m: Matrix4f64) { +matrix4_from_quaternion_f64 :: proc "contextless" (q: Quaternionf64) -> (m: Matrix4f64) { qxx := q.x * q.x qyy := q.y * q.y qzz := q.z * q.z @@ -1698,21 +1698,21 @@ matrix4_from_quaternion :: proc{ @(require_results) -matrix4_from_trs_f16 :: proc(t: Vector3f16, r: Quaternionf16, s: Vector3f16) -> Matrix4f16 { +matrix4_from_trs_f16 :: proc "contextless" (t: Vector3f16, r: Quaternionf16, s: Vector3f16) -> Matrix4f16 { translation := matrix4_translate(t) rotation := matrix4_from_quaternion(r) scale := matrix4_scale(s) return mul(translation, mul(rotation, scale)) } @(require_results) -matrix4_from_trs_f32 :: proc(t: Vector3f32, r: Quaternionf32, s: Vector3f32) -> Matrix4f32 { +matrix4_from_trs_f32 :: proc "contextless" (t: Vector3f32, r: Quaternionf32, s: Vector3f32) -> Matrix4f32 { translation := matrix4_translate(t) rotation := matrix4_from_quaternion(r) scale := matrix4_scale(s) return mul(translation, mul(rotation, scale)) } @(require_results) -matrix4_from_trs_f64 :: proc(t: Vector3f64, r: Quaternionf64, s: Vector3f64) -> Matrix4f64 { +matrix4_from_trs_f64 :: proc "contextless" (t: Vector3f64, r: Quaternionf64, s: Vector3f64) -> Matrix4f64 { translation := matrix4_translate(t) rotation := matrix4_from_quaternion(r) scale := matrix4_scale(s) @@ -1727,15 +1727,15 @@ matrix4_from_trs :: proc{ @(require_results) -matrix4_inverse_f16 :: proc(m: Matrix4f16) -> Matrix4f16 { +matrix4_inverse_f16 :: proc "contextless" (m: Matrix4f16) -> Matrix4f16 { return transpose(matrix4_inverse_transpose(m)) } @(require_results) -matrix4_inverse_f32 :: proc(m: Matrix4f32) -> Matrix4f32 { +matrix4_inverse_f32 :: proc "contextless" (m: Matrix4f32) -> Matrix4f32 { return transpose(matrix4_inverse_transpose(m)) } @(require_results) -matrix4_inverse_f64 :: proc(m: Matrix4f64) -> Matrix4f64 { +matrix4_inverse_f64 :: proc "contextless" (m: Matrix4f64) -> Matrix4f64 { return transpose(matrix4_inverse_transpose(m)) } matrix4_inverse :: proc{ @@ -1746,7 +1746,7 @@ matrix4_inverse :: proc{ @(require_results) -matrix4_minor_f16 :: proc(m: Matrix4f16, c, r: int) -> f16 { +matrix4_minor_f16 :: proc "contextless" (m: Matrix4f16, c, r: int) -> f16 { cut_down: Matrix3f16 for i in 0..<3 { col := i if i < c else i+1 @@ -1758,7 +1758,7 @@ matrix4_minor_f16 :: proc(m: Matrix4f16, c, r: int) -> f16 { return matrix3_determinant(cut_down) } @(require_results) -matrix4_minor_f32 :: proc(m: Matrix4f32, c, r: int) -> f32 { +matrix4_minor_f32 :: proc "contextless" (m: Matrix4f32, c, r: int) -> f32 { cut_down: Matrix3f32 for i in 0..<3 { col := i if i < c else i+1 @@ -1770,7 +1770,7 @@ matrix4_minor_f32 :: proc(m: Matrix4f32, c, r: int) -> f32 { return matrix3_determinant(cut_down) } @(require_results) -matrix4_minor_f64 :: proc(m: Matrix4f64, c, r: int) -> f64 { +matrix4_minor_f64 :: proc "contextless" (m: Matrix4f64, c, r: int) -> f64 { cut_down: Matrix3f64 for i in 0..<3 { col := i if i < c else i+1 @@ -1789,21 +1789,21 @@ matrix4_minor :: proc{ @(require_results) -matrix4_cofactor_f16 :: proc(m: Matrix4f16, c, r: int) -> f16 { +matrix4_cofactor_f16 :: proc "contextless" (m: Matrix4f16, c, r: int) -> f16 { sign, minor: f16 sign = 1 if (c + r) % 2 == 0 else -1 minor = matrix4_minor(m, c, r) return sign * minor } @(require_results) -matrix4_cofactor_f32 :: proc(m: Matrix4f32, c, r: int) -> f32 { +matrix4_cofactor_f32 :: proc "contextless" (m: Matrix4f32, c, r: int) -> f32 { sign, minor: f32 sign = 1 if (c + r) % 2 == 0 else -1 minor = matrix4_minor(m, c, r) return sign * minor } @(require_results) -matrix4_cofactor_f64 :: proc(m: Matrix4f64, c, r: int) -> f64 { +matrix4_cofactor_f64 :: proc "contextless" (m: Matrix4f64, c, r: int) -> f64 { sign, minor: f64 sign = 1 if (c + r) % 2 == 0 else -1 minor = matrix4_minor(m, c, r) @@ -1817,7 +1817,7 @@ matrix4_cofactor :: proc{ @(require_results) -matrix4_adjoint_f16 :: proc(m: Matrix4f16) -> (adjoint: Matrix4f16) { +matrix4_adjoint_f16 :: proc "contextless" (m: Matrix4f16) -> (adjoint: Matrix4f16) { for i in 0..<4 { for j in 0..<4 { adjoint[i][j] = matrix4_cofactor(m, i, j) @@ -1826,7 +1826,7 @@ matrix4_adjoint_f16 :: proc(m: Matrix4f16) -> (adjoint: Matrix4f16) { return } @(require_results) -matrix4_adjoint_f32 :: proc(m: Matrix4f32) -> (adjoint: Matrix4f32) { +matrix4_adjoint_f32 :: proc "contextless" (m: Matrix4f32) -> (adjoint: Matrix4f32) { for i in 0..<4 { for j in 0..<4 { adjoint[i][j] = matrix4_cofactor(m, i, j) @@ -1835,7 +1835,7 @@ matrix4_adjoint_f32 :: proc(m: Matrix4f32) -> (adjoint: Matrix4f32) { return } @(require_results) -matrix4_adjoint_f64 :: proc(m: Matrix4f64) -> (adjoint: Matrix4f64) { +matrix4_adjoint_f64 :: proc "contextless" (m: Matrix4f64) -> (adjoint: Matrix4f64) { for i in 0..<4 { for j in 0..<4 { adjoint[i][j] = matrix4_cofactor(m, i, j) @@ -1851,7 +1851,7 @@ matrix4_adjoint :: proc{ @(require_results) -matrix4_determinant_f16 :: proc(m: Matrix4f16) -> (determinant: f16) { +matrix4_determinant_f16 :: proc "contextless" (m: Matrix4f16) -> (determinant: f16) { adjoint := matrix4_adjoint(m) for i in 0..<4 { determinant += m[i][0] * adjoint[i][0] @@ -1859,7 +1859,7 @@ matrix4_determinant_f16 :: proc(m: Matrix4f16) -> (determinant: f16) { return } @(require_results) -matrix4_determinant_f32 :: proc(m: Matrix4f32) -> (determinant: f32) { +matrix4_determinant_f32 :: proc "contextless" (m: Matrix4f32) -> (determinant: f32) { adjoint := matrix4_adjoint(m) for i in 0..<4 { determinant += m[i][0] * adjoint[i][0] @@ -1867,7 +1867,7 @@ matrix4_determinant_f32 :: proc(m: Matrix4f32) -> (determinant: f32) { return } @(require_results) -matrix4_determinant_f64 :: proc(m: Matrix4f64) -> (determinant: f64) { +matrix4_determinant_f64 :: proc "contextless" (m: Matrix4f64) -> (determinant: f64) { adjoint := matrix4_adjoint(m) for i in 0..<4 { determinant += m[i][0] * adjoint[i][0] @@ -1882,7 +1882,7 @@ matrix4_determinant :: proc{ @(require_results) -matrix4_inverse_transpose_f16 :: proc(m: Matrix4f16) -> (inverse_transpose: Matrix4f16) { +matrix4_inverse_transpose_f16 :: proc "contextless" (m: Matrix4f16) -> (inverse_transpose: Matrix4f16) { adjoint := matrix4_adjoint(m) determinant: f16 = 0 for i in 0..<4 { @@ -1897,7 +1897,7 @@ matrix4_inverse_transpose_f16 :: proc(m: Matrix4f16) -> (inverse_transpose: Matr return } @(require_results) -matrix4_inverse_transpose_f32 :: proc(m: Matrix4f32) -> (inverse_transpose: Matrix4f32) { +matrix4_inverse_transpose_f32 :: proc "contextless" (m: Matrix4f32) -> (inverse_transpose: Matrix4f32) { adjoint := matrix4_adjoint(m) determinant: f32 = 0 for i in 0..<4 { @@ -1912,7 +1912,7 @@ matrix4_inverse_transpose_f32 :: proc(m: Matrix4f32) -> (inverse_transpose: Matr return } @(require_results) -matrix4_inverse_transpose_f64 :: proc(m: Matrix4f64) -> (inverse_transpose: Matrix4f64) { +matrix4_inverse_transpose_f64 :: proc "contextless" (m: Matrix4f64) -> (inverse_transpose: Matrix4f64) { adjoint := matrix4_adjoint(m) determinant: f64 = 0 for i in 0..<4 { @@ -1934,7 +1934,7 @@ matrix4_inverse_transpose :: proc{ @(require_results) -matrix4_translate_f16 :: proc(v: Vector3f16) -> Matrix4f16 { +matrix4_translate_f16 :: proc "contextless" (v: Vector3f16) -> Matrix4f16 { m := MATRIX4F16_IDENTITY m[3][0] = v[0] m[3][1] = v[1] @@ -1942,7 +1942,7 @@ matrix4_translate_f16 :: proc(v: Vector3f16) -> Matrix4f16 { return m } @(require_results) -matrix4_translate_f32 :: proc(v: Vector3f32) -> Matrix4f32 { +matrix4_translate_f32 :: proc "contextless" (v: Vector3f32) -> Matrix4f32 { m := MATRIX4F32_IDENTITY m[3][0] = v[0] m[3][1] = v[1] @@ -1950,7 +1950,7 @@ matrix4_translate_f32 :: proc(v: Vector3f32) -> Matrix4f32 { return m } @(require_results) -matrix4_translate_f64 :: proc(v: Vector3f64) -> Matrix4f64 { +matrix4_translate_f64 :: proc "contextless" (v: Vector3f64) -> Matrix4f64 { m := MATRIX4F64_IDENTITY m[3][0] = v[0] m[3][1] = v[1] @@ -1965,7 +1965,7 @@ matrix4_translate :: proc{ @(require_results) -matrix4_rotate_f16 :: proc(angle_radians: f16, v: Vector3f16) -> Matrix4f16 { +matrix4_rotate_f16 :: proc "contextless" (angle_radians: f16, v: Vector3f16) -> Matrix4f16 { c := math.cos(angle_radians) s := math.sin(angle_radians) @@ -1992,7 +1992,7 @@ matrix4_rotate_f16 :: proc(angle_radians: f16, v: Vector3f16) -> Matrix4f16 { return rot } @(require_results) -matrix4_rotate_f32 :: proc(angle_radians: f32, v: Vector3f32) -> Matrix4f32 { +matrix4_rotate_f32 :: proc "contextless" (angle_radians: f32, v: Vector3f32) -> Matrix4f32 { c := math.cos(angle_radians) s := math.sin(angle_radians) @@ -2019,7 +2019,7 @@ matrix4_rotate_f32 :: proc(angle_radians: f32, v: Vector3f32) -> Matrix4f32 { return rot } @(require_results) -matrix4_rotate_f64 :: proc(angle_radians: f64, v: Vector3f64) -> Matrix4f64 { +matrix4_rotate_f64 :: proc "contextless" (angle_radians: f64, v: Vector3f64) -> Matrix4f64 { c := math.cos(angle_radians) s := math.sin(angle_radians) @@ -2053,7 +2053,7 @@ matrix4_rotate :: proc{ @(require_results) -matrix4_scale_f16 :: proc(v: Vector3f16) -> (m: Matrix4f16) { +matrix4_scale_f16 :: proc "contextless" (v: Vector3f16) -> (m: Matrix4f16) { m[0][0] = v[0] m[1][1] = v[1] m[2][2] = v[2] @@ -2061,7 +2061,7 @@ matrix4_scale_f16 :: proc(v: Vector3f16) -> (m: Matrix4f16) { return } @(require_results) -matrix4_scale_f32 :: proc(v: Vector3f32) -> (m: Matrix4f32) { +matrix4_scale_f32 :: proc "contextless" (v: Vector3f32) -> (m: Matrix4f32) { m[0][0] = v[0] m[1][1] = v[1] m[2][2] = v[2] @@ -2069,7 +2069,7 @@ matrix4_scale_f32 :: proc(v: Vector3f32) -> (m: Matrix4f32) { return } @(require_results) -matrix4_scale_f64 :: proc(v: Vector3f64) -> (m: Matrix4f64) { +matrix4_scale_f64 :: proc "contextless" (v: Vector3f64) -> (m: Matrix4f64) { m[0][0] = v[0] m[1][1] = v[1] m[2][2] = v[2] @@ -2084,7 +2084,7 @@ matrix4_scale :: proc{ @(require_results) -matrix4_look_at_f16 :: proc(eye, centre, up: Vector3f16, flip_z_axis := true) -> (m: Matrix4f16) { +matrix4_look_at_f16 :: proc "contextless" (eye, centre, up: Vector3f16, flip_z_axis := true) -> (m: Matrix4f16) { f := normalize(centre - eye) s := normalize(cross(f, up)) u := cross(s, f) @@ -2099,7 +2099,7 @@ matrix4_look_at_f16 :: proc(eye, centre, up: Vector3f16, flip_z_axis := true) -> } } @(require_results) -matrix4_look_at_f32 :: proc(eye, centre, up: Vector3f32, flip_z_axis := true) -> (m: Matrix4f32) { +matrix4_look_at_f32 :: proc "contextless" (eye, centre, up: Vector3f32, flip_z_axis := true) -> (m: Matrix4f32) { f := normalize(centre - eye) s := normalize(cross(f, up)) u := cross(s, f) @@ -2114,7 +2114,7 @@ matrix4_look_at_f32 :: proc(eye, centre, up: Vector3f32, flip_z_axis := true) -> } } @(require_results) -matrix4_look_at_f64 :: proc(eye, centre, up: Vector3f64, flip_z_axis := true) -> (m: Matrix4f64) { +matrix4_look_at_f64 :: proc "contextless" (eye, centre, up: Vector3f64, flip_z_axis := true) -> (m: Matrix4f64) { f := normalize(centre - eye) s := normalize(cross(f, up)) u := cross(s, f) @@ -2136,7 +2136,7 @@ matrix4_look_at :: proc{ @(require_results) -matrix4_look_at_from_fru_f16 :: proc(eye, f, r, u: Vector3f16, flip_z_axis := true) -> (m: Matrix4f16) { +matrix4_look_at_from_fru_f16 :: proc "contextless" (eye, f, r, u: Vector3f16, flip_z_axis := true) -> (m: Matrix4f16) { f, s, u := f, r, u f = normalize(f) s = normalize(s) @@ -2151,7 +2151,7 @@ matrix4_look_at_from_fru_f16 :: proc(eye, f, r, u: Vector3f16, flip_z_axis := tr } } @(require_results) -matrix4_look_at_from_fru_f32 :: proc(eye, f, r, u: Vector3f32, flip_z_axis := true) -> (m: Matrix4f32) { +matrix4_look_at_from_fru_f32 :: proc "contextless" (eye, f, r, u: Vector3f32, flip_z_axis := true) -> (m: Matrix4f32) { f, s, u := f, r, u f = normalize(f) s = normalize(s) @@ -2166,7 +2166,7 @@ matrix4_look_at_from_fru_f32 :: proc(eye, f, r, u: Vector3f32, flip_z_axis := tr } } @(require_results) -matrix4_look_at_from_fru_f64 :: proc(eye, f, r, u: Vector3f64, flip_z_axis := true) -> (m: Matrix4f64) { +matrix4_look_at_from_fru_f64 :: proc "contextless" (eye, f, r, u: Vector3f64, flip_z_axis := true) -> (m: Matrix4f64) { f, s, u := f, r, u f = normalize(f) s = normalize(s) @@ -2188,7 +2188,7 @@ matrix4_look_at_from_fru :: proc{ @(require_results) -matrix4_perspective_f16 :: proc(fovy, aspect, near, far: f16, flip_z_axis := true) -> (m: Matrix4f16) { +matrix4_perspective_f16 :: proc "contextless" (fovy, aspect, near, far: f16, flip_z_axis := true) -> (m: Matrix4f16) { tan_half_fovy := math.tan(0.5 * fovy) m[0, 0] = 1 / (aspect*tan_half_fovy) m[1, 1] = 1 / (tan_half_fovy) @@ -2203,7 +2203,7 @@ matrix4_perspective_f16 :: proc(fovy, aspect, near, far: f16, flip_z_axis := tru return } @(require_results) -matrix4_perspective_f32 :: proc(fovy, aspect, near, far: f32, flip_z_axis := true) -> (m: Matrix4f32) { +matrix4_perspective_f32 :: proc "contextless" (fovy, aspect, near, far: f32, flip_z_axis := true) -> (m: Matrix4f32) { tan_half_fovy := math.tan(0.5 * fovy) m[0, 0] = 1 / (aspect*tan_half_fovy) m[1, 1] = 1 / (tan_half_fovy) @@ -2218,7 +2218,7 @@ matrix4_perspective_f32 :: proc(fovy, aspect, near, far: f32, flip_z_axis := tru return } @(require_results) -matrix4_perspective_f64 :: proc(fovy, aspect, near, far: f64, flip_z_axis := true) -> (m: Matrix4f64) { +matrix4_perspective_f64 :: proc "contextless" (fovy, aspect, near, far: f64, flip_z_axis := true) -> (m: Matrix4f64) { tan_half_fovy := math.tan(0.5 * fovy) m[0, 0] = 1 / (aspect*tan_half_fovy) m[1, 1] = 1 / (tan_half_fovy) @@ -2241,7 +2241,7 @@ matrix4_perspective :: proc{ @(require_results) -matrix_ortho3d_f16 :: proc(left, right, bottom, top, near, far: f16, flip_z_axis := true) -> (m: Matrix4f16) { +matrix_ortho3d_f16 :: proc "contextless" (left, right, bottom, top, near, far: f16, flip_z_axis := true) -> (m: Matrix4f16) { m[0, 0] = +2 / (right - left) m[1, 1] = +2 / (top - bottom) m[2, 2] = +2 / (far - near) @@ -2257,7 +2257,7 @@ matrix_ortho3d_f16 :: proc(left, right, bottom, top, near, far: f16, flip_z_axis return } @(require_results) -matrix_ortho3d_f32 :: proc(left, right, bottom, top, near, far: f32, flip_z_axis := true) -> (m: Matrix4f32) { +matrix_ortho3d_f32 :: proc "contextless" (left, right, bottom, top, near, far: f32, flip_z_axis := true) -> (m: Matrix4f32) { m[0, 0] = +2 / (right - left) m[1, 1] = +2 / (top - bottom) m[2, 2] = +2 / (far - near) @@ -2273,7 +2273,7 @@ matrix_ortho3d_f32 :: proc(left, right, bottom, top, near, far: f32, flip_z_axis return } @(require_results) -matrix_ortho3d_f64 :: proc(left, right, bottom, top, near, far: f64, flip_z_axis := true) -> (m: Matrix4f64) { +matrix_ortho3d_f64 :: proc "contextless" (left, right, bottom, top, near, far: f64, flip_z_axis := true) -> (m: Matrix4f64) { m[0, 0] = +2 / (right - left) m[1, 1] = +2 / (top - bottom) m[2, 2] = +2 / (far - near) @@ -2297,7 +2297,7 @@ matrix_ortho3d :: proc{ @(require_results) -matrix4_infinite_perspective_f16 :: proc(fovy, aspect, near: f16, flip_z_axis := true) -> (m: Matrix4f16) { +matrix4_infinite_perspective_f16 :: proc "contextless" (fovy, aspect, near: f16, flip_z_axis := true) -> (m: Matrix4f16) { tan_half_fovy := math.tan(0.5 * fovy) m[0, 0] = 1 / (aspect*tan_half_fovy) m[1, 1] = 1 / (tan_half_fovy) @@ -2312,7 +2312,7 @@ matrix4_infinite_perspective_f16 :: proc(fovy, aspect, near: f16, flip_z_axis := return } @(require_results) -matrix4_infinite_perspective_f32 :: proc(fovy, aspect, near: f32, flip_z_axis := true) -> (m: Matrix4f32) { +matrix4_infinite_perspective_f32 :: proc "contextless" (fovy, aspect, near: f32, flip_z_axis := true) -> (m: Matrix4f32) { tan_half_fovy := math.tan(0.5 * fovy) m[0, 0] = 1 / (aspect*tan_half_fovy) m[1, 1] = 1 / (tan_half_fovy) @@ -2327,7 +2327,7 @@ matrix4_infinite_perspective_f32 :: proc(fovy, aspect, near: f32, flip_z_axis := return } @(require_results) -matrix4_infinite_perspective_f64 :: proc(fovy, aspect, near: f64, flip_z_axis := true) -> (m: Matrix4f64) { +matrix4_infinite_perspective_f64 :: proc "contextless" (fovy, aspect, near: f64, flip_z_axis := true) -> (m: Matrix4f64) { tan_half_fovy := math.tan(0.5 * fovy) m[0, 0] = 1 / (aspect*tan_half_fovy) m[1, 1] = 1 / (tan_half_fovy) @@ -2350,19 +2350,19 @@ matrix4_infinite_perspective :: proc{ @(require_results) -matrix2_from_scalar_f16 :: proc(f: f16) -> (m: Matrix2f16) { +matrix2_from_scalar_f16 :: proc "contextless" (f: f16) -> (m: Matrix2f16) { m[0, 0], m[1, 0] = f, 0 m[0, 1], m[1, 1] = 0, f return } @(require_results) -matrix2_from_scalar_f32 :: proc(f: f32) -> (m: Matrix2f32) { +matrix2_from_scalar_f32 :: proc "contextless" (f: f32) -> (m: Matrix2f32) { m[0, 0], m[1, 0] = f, 0 m[0, 1], m[1, 1] = 0, f return } @(require_results) -matrix2_from_scalar_f64 :: proc(f: f64) -> (m: Matrix2f64) { +matrix2_from_scalar_f64 :: proc "contextless" (f: f64) -> (m: Matrix2f64) { m[0, 0], m[1, 0] = f, 0 m[0, 1], m[1, 1] = 0, f return @@ -2375,21 +2375,21 @@ matrix2_from_scalar :: proc{ @(require_results) -matrix3_from_scalar_f16 :: proc(f: f16) -> (m: Matrix3f16) { +matrix3_from_scalar_f16 :: proc "contextless" (f: f16) -> (m: Matrix3f16) { m[0, 0], m[1, 0], m[2, 0] = f, 0, 0 m[0, 1], m[1, 1], m[2, 1] = 0, f, 0 m[0, 2], m[1, 2], m[2, 2] = 0, 0, f return } @(require_results) -matrix3_from_scalar_f32 :: proc(f: f32) -> (m: Matrix3f32) { +matrix3_from_scalar_f32 :: proc "contextless" (f: f32) -> (m: Matrix3f32) { m[0, 0], m[1, 0], m[2, 0] = f, 0, 0 m[0, 1], m[1, 1], m[2, 1] = 0, f, 0 m[0, 2], m[1, 2], m[2, 2] = 0, 0, f return } @(require_results) -matrix3_from_scalar_f64 :: proc(f: f64) -> (m: Matrix3f64) { +matrix3_from_scalar_f64 :: proc "contextless" (f: f64) -> (m: Matrix3f64) { m[0, 0], m[1, 0], m[2, 0] = f, 0, 0 m[0, 1], m[1, 1], m[2, 1] = 0, f, 0 m[0, 2], m[1, 2], m[2, 2] = 0, 0, f @@ -2403,7 +2403,7 @@ matrix3_from_scalar :: proc{ @(require_results) -matrix4_from_scalar_f16 :: proc(f: f16) -> (m: Matrix4f16) { +matrix4_from_scalar_f16 :: proc "contextless" (f: f16) -> (m: Matrix4f16) { m[0, 0], m[1, 0], m[2, 0], m[3, 0] = f, 0, 0, 0 m[0, 1], m[1, 1], m[2, 1], m[3, 1] = 0, f, 0, 0 m[0, 2], m[1, 2], m[2, 2], m[3, 2] = 0, 0, f, 0 @@ -2411,7 +2411,7 @@ matrix4_from_scalar_f16 :: proc(f: f16) -> (m: Matrix4f16) { return } @(require_results) -matrix4_from_scalar_f32 :: proc(f: f32) -> (m: Matrix4f32) { +matrix4_from_scalar_f32 :: proc "contextless" (f: f32) -> (m: Matrix4f32) { m[0, 0], m[1, 0], m[2, 0], m[3, 0] = f, 0, 0, 0 m[0, 1], m[1, 1], m[2, 1], m[3, 1] = 0, f, 0, 0 m[0, 2], m[1, 2], m[2, 2], m[3, 2] = 0, 0, f, 0 @@ -2419,7 +2419,7 @@ matrix4_from_scalar_f32 :: proc(f: f32) -> (m: Matrix4f32) { return } @(require_results) -matrix4_from_scalar_f64 :: proc(f: f64) -> (m: Matrix4f64) { +matrix4_from_scalar_f64 :: proc "contextless" (f: f64) -> (m: Matrix4f64) { m[0, 0], m[1, 0], m[2, 0], m[3, 0] = f, 0, 0, 0 m[0, 1], m[1, 1], m[2, 1], m[3, 1] = 0, f, 0, 0 m[0, 2], m[1, 2], m[2, 2], m[3, 2] = 0, 0, f, 0 @@ -2434,19 +2434,19 @@ matrix4_from_scalar :: proc{ @(require_results) -matrix2_from_matrix3_f16 :: proc(m: Matrix3f16) -> (r: Matrix2f16) { +matrix2_from_matrix3_f16 :: proc "contextless" (m: Matrix3f16) -> (r: Matrix2f16) { r[0, 0], r[1, 0] = m[0, 0], m[1, 0] r[0, 1], r[1, 1] = m[0, 1], m[1, 1] return } @(require_results) -matrix2_from_matrix3_f32 :: proc(m: Matrix3f32) -> (r: Matrix2f32) { +matrix2_from_matrix3_f32 :: proc "contextless" (m: Matrix3f32) -> (r: Matrix2f32) { r[0, 0], r[1, 0] = m[0, 0], m[1, 0] r[0, 1], r[1, 1] = m[0, 1], m[1, 1] return } @(require_results) -matrix2_from_matrix3_f64 :: proc(m: Matrix3f64) -> (r: Matrix2f64) { +matrix2_from_matrix3_f64 :: proc "contextless" (m: Matrix3f64) -> (r: Matrix2f64) { r[0, 0], r[1, 0] = m[0, 0], m[1, 0] r[0, 1], r[1, 1] = m[0, 1], m[1, 1] return @@ -2459,19 +2459,19 @@ matrix2_from_matrix3 :: proc{ @(require_results) -matrix2_from_matrix4_f16 :: proc(m: Matrix4f16) -> (r: Matrix2f16) { +matrix2_from_matrix4_f16 :: proc "contextless" (m: Matrix4f16) -> (r: Matrix2f16) { r[0, 0], r[1, 0] = m[0, 0], m[1, 0] r[0, 1], r[1, 1] = m[0, 1], m[1, 1] return } @(require_results) -matrix2_from_matrix4_f32 :: proc(m: Matrix4f32) -> (r: Matrix2f32) { +matrix2_from_matrix4_f32 :: proc "contextless" (m: Matrix4f32) -> (r: Matrix2f32) { r[0, 0], r[1, 0] = m[0, 0], m[1, 0] r[0, 1], r[1, 1] = m[0, 1], m[1, 1] return } @(require_results) -matrix2_from_matrix4_f64 :: proc(m: Matrix4f64) -> (r: Matrix2f64) { +matrix2_from_matrix4_f64 :: proc "contextless" (m: Matrix4f64) -> (r: Matrix2f64) { r[0, 0], r[1, 0] = m[0, 0], m[1, 0] r[0, 1], r[1, 1] = m[0, 1], m[1, 1] return @@ -2484,21 +2484,21 @@ matrix2_from_matrix4 :: proc{ @(require_results) -matrix3_from_matrix2_f16 :: proc(m: Matrix2f16) -> (r: Matrix3f16) { +matrix3_from_matrix2_f16 :: proc "contextless" (m: Matrix2f16) -> (r: Matrix3f16) { r[0, 0], r[1, 0], r[2, 0] = m[0, 0], m[1, 0], 0 r[0, 1], r[1, 1], r[2, 1] = m[0, 1], m[1, 1], 0 r[0, 2], r[1, 2], r[2, 2] = 0, 0, 1 return } @(require_results) -matrix3_from_matrix2_f32 :: proc(m: Matrix2f32) -> (r: Matrix3f32) { +matrix3_from_matrix2_f32 :: proc "contextless" (m: Matrix2f32) -> (r: Matrix3f32) { r[0, 0], r[1, 0], r[2, 0] = m[0, 0], m[1, 0], 0 r[0, 1], r[1, 1], r[2, 1] = m[0, 1], m[1, 1], 0 r[0, 2], r[1, 2], r[2, 2] = 0, 0, 1 return } @(require_results) -matrix3_from_matrix2_f64 :: proc(m: Matrix2f64) -> (r: Matrix3f64) { +matrix3_from_matrix2_f64 :: proc "contextless" (m: Matrix2f64) -> (r: Matrix3f64) { r[0, 0], r[1, 0], r[2, 0] = m[0, 0], m[1, 0], 0 r[0, 1], r[1, 1], r[2, 1] = m[0, 1], m[1, 1], 0 r[0, 2], r[1, 2], r[2, 2] = 0, 0, 1 @@ -2512,21 +2512,21 @@ matrix3_from_matrix2 :: proc{ @(require_results) -matrix3_from_matrix4_f16 :: proc(m: Matrix4f16) -> (r: Matrix3f16) { +matrix3_from_matrix4_f16 :: proc "contextless" (m: Matrix4f16) -> (r: Matrix3f16) { r[0, 0], r[1, 0], r[2, 0] = m[0, 0], m[1, 0], m[2, 0] r[0, 1], r[1, 1], r[2, 1] = m[0, 1], m[1, 1], m[2, 1] r[0, 2], r[1, 2], r[2, 2] = m[0, 2], m[1, 2], m[2, 2] return } @(require_results) -matrix3_from_matrix4_f32 :: proc(m: Matrix4f32) -> (r: Matrix3f32) { +matrix3_from_matrix4_f32 :: proc "contextless" (m: Matrix4f32) -> (r: Matrix3f32) { r[0, 0], r[1, 0], r[2, 0] = m[0, 0], m[1, 0], m[2, 0] r[0, 1], r[1, 1], r[2, 1] = m[0, 1], m[1, 1], m[2, 1] r[0, 2], r[1, 2], r[2, 2] = m[0, 2], m[1, 2], m[2, 2] return } @(require_results) -matrix3_from_matrix4_f64 :: proc(m: Matrix4f64) -> (r: Matrix3f64) { +matrix3_from_matrix4_f64 :: proc "contextless" (m: Matrix4f64) -> (r: Matrix3f64) { r[0, 0], r[1, 0], r[2, 0] = m[0, 0], m[1, 0], m[2, 0] r[0, 1], r[1, 1], r[2, 1] = m[0, 1], m[1, 1], m[2, 1] r[0, 2], r[1, 2], r[2, 2] = m[0, 2], m[1, 2], m[2, 2] @@ -2540,7 +2540,7 @@ matrix3_from_matrix4 :: proc{ @(require_results) -matrix4_from_matrix2_f16 :: proc(m: Matrix2f16) -> (r: Matrix4f16) { +matrix4_from_matrix2_f16 :: proc "contextless" (m: Matrix2f16) -> (r: Matrix4f16) { r[0, 0], r[1, 0], r[2, 0], r[3, 0] = m[0, 0], m[1, 0], 0, 0 r[0, 1], r[1, 1], r[2, 1], r[3, 1] = m[0, 1], m[1, 1], 0, 0 r[0, 2], r[1, 2], r[2, 2], r[3, 2] = 0, 0, 1, 0 @@ -2548,7 +2548,7 @@ matrix4_from_matrix2_f16 :: proc(m: Matrix2f16) -> (r: Matrix4f16) { return } @(require_results) -matrix4_from_matrix2_f32 :: proc(m: Matrix2f32) -> (r: Matrix4f32) { +matrix4_from_matrix2_f32 :: proc "contextless" (m: Matrix2f32) -> (r: Matrix4f32) { r[0, 0], r[1, 0], r[2, 0], r[3, 0] = m[0, 0], m[1, 0], 0, 0 r[0, 1], r[1, 1], r[2, 1], r[3, 1] = m[0, 1], m[1, 1], 0, 0 r[0, 2], r[1, 2], r[2, 2], r[3, 2] = 0, 0, 1, 0 @@ -2556,7 +2556,7 @@ matrix4_from_matrix2_f32 :: proc(m: Matrix2f32) -> (r: Matrix4f32) { return } @(require_results) -matrix4_from_matrix2_f64 :: proc(m: Matrix2f64) -> (r: Matrix4f64) { +matrix4_from_matrix2_f64 :: proc "contextless" (m: Matrix2f64) -> (r: Matrix4f64) { r[0, 0], r[1, 0], r[2, 0], r[3, 0] = m[0, 0], m[1, 0], 0, 0 r[0, 1], r[1, 1], r[2, 1], r[3, 1] = m[0, 1], m[1, 1], 0, 0 r[0, 2], r[1, 2], r[2, 2], r[3, 2] = 0, 0, 1, 0 @@ -2571,7 +2571,7 @@ matrix4_from_matrix2 :: proc{ @(require_results) -matrix4_from_matrix3_f16 :: proc(m: Matrix3f16) -> (r: Matrix4f16) { +matrix4_from_matrix3_f16 :: proc "contextless" (m: Matrix3f16) -> (r: Matrix4f16) { r[0, 0], r[1, 0], r[2, 0], r[3, 0] = m[0, 0], m[1, 0], m[2, 0], 0 r[0, 1], r[1, 1], r[2, 1], r[3, 1] = m[0, 1], m[1, 1], m[2, 1], 0 r[0, 2], r[1, 2], r[2, 2], r[3, 2] = m[0, 2], m[1, 2], m[2, 2], 0 @@ -2579,7 +2579,7 @@ matrix4_from_matrix3_f16 :: proc(m: Matrix3f16) -> (r: Matrix4f16) { return } @(require_results) -matrix4_from_matrix3_f32 :: proc(m: Matrix3f32) -> (r: Matrix4f32) { +matrix4_from_matrix3_f32 :: proc "contextless" (m: Matrix3f32) -> (r: Matrix4f32) { r[0, 0], r[1, 0], r[2, 0], r[3, 0] = m[0, 0], m[1, 0], m[2, 0], 0 r[0, 1], r[1, 1], r[2, 1], r[3, 1] = m[0, 1], m[1, 1], m[2, 1], 0 r[0, 2], r[1, 2], r[2, 2], r[3, 2] = m[0, 2], m[1, 2], m[2, 2], 0 @@ -2587,7 +2587,7 @@ matrix4_from_matrix3_f32 :: proc(m: Matrix3f32) -> (r: Matrix4f32) { return } @(require_results) -matrix4_from_matrix3_f64 :: proc(m: Matrix3f64) -> (r: Matrix4f64) { +matrix4_from_matrix3_f64 :: proc "contextless" (m: Matrix3f64) -> (r: Matrix4f64) { r[0, 0], r[1, 0], r[2, 0], r[3, 0] = m[0, 0], m[1, 0], m[2, 0], 0 r[0, 1], r[1, 1], r[2, 1], r[3, 1] = m[0, 1], m[1, 1], m[2, 1], 0 r[0, 2], r[1, 2], r[2, 2], r[3, 2] = m[0, 2], m[1, 2], m[2, 2], 0 @@ -2602,17 +2602,17 @@ matrix4_from_matrix3 :: proc{ @(require_results) -quaternion_from_scalar_f16 :: proc(f: f16) -> (q: Quaternionf16) { +quaternion_from_scalar_f16 :: proc "contextless" (f: f16) -> (q: Quaternionf16) { q.w = f return } @(require_results) -quaternion_from_scalar_f32 :: proc(f: f32) -> (q: Quaternionf32) { +quaternion_from_scalar_f32 :: proc "contextless" (f: f32) -> (q: Quaternionf32) { q.w = f return } @(require_results) -quaternion_from_scalar_f64 :: proc(f: f64) -> (q: Quaternionf64) { +quaternion_from_scalar_f64 :: proc "contextless" (f: f64) -> (q: Quaternionf64) { q.w = f return } @@ -2673,7 +2673,7 @@ to_quaternion :: proc{ @(require_results) -matrix2_orthonormalize_f16 :: proc(m: Matrix2f16) -> (r: Matrix2f16) { +matrix2_orthonormalize_f16 :: proc "contextless" (m: Matrix2f16) -> (r: Matrix2f16) { r[0] = normalize(m[0]) d0 := dot(r[0], r[1]) @@ -2683,7 +2683,7 @@ matrix2_orthonormalize_f16 :: proc(m: Matrix2f16) -> (r: Matrix2f16) { return } @(require_results) -matrix2_orthonormalize_f32 :: proc(m: Matrix2f32) -> (r: Matrix2f32) { +matrix2_orthonormalize_f32 :: proc "contextless" (m: Matrix2f32) -> (r: Matrix2f32) { r[0] = normalize(m[0]) d0 := dot(r[0], r[1]) @@ -2693,7 +2693,7 @@ matrix2_orthonormalize_f32 :: proc(m: Matrix2f32) -> (r: Matrix2f32) { return } @(require_results) -matrix2_orthonormalize_f64 :: proc(m: Matrix2f64) -> (r: Matrix2f64) { +matrix2_orthonormalize_f64 :: proc "contextless" (m: Matrix2f64) -> (r: Matrix2f64) { r[0] = normalize(m[0]) d0 := dot(r[0], r[1]) @@ -2710,7 +2710,7 @@ matrix2_orthonormalize :: proc{ @(require_results) -matrix3_orthonormalize_f16 :: proc(m: Matrix3f16) -> (r: Matrix3f16) { +matrix3_orthonormalize_f16 :: proc "contextless" (m: Matrix3f16) -> (r: Matrix3f16) { r[0] = normalize(m[0]) d0 := dot(r[0], r[1]) @@ -2725,7 +2725,7 @@ matrix3_orthonormalize_f16 :: proc(m: Matrix3f16) -> (r: Matrix3f16) { return } @(require_results) -matrix3_orthonormalize_f32 :: proc(m: Matrix3f32) -> (r: Matrix3f32) { +matrix3_orthonormalize_f32 :: proc "contextless" (m: Matrix3f32) -> (r: Matrix3f32) { r[0] = normalize(m[0]) d0 := dot(r[0], r[1]) @@ -2740,7 +2740,7 @@ matrix3_orthonormalize_f32 :: proc(m: Matrix3f32) -> (r: Matrix3f32) { return } @(require_results) -matrix3_orthonormalize_f64 :: proc(m: Matrix3f64) -> (r: Matrix3f64) { +matrix3_orthonormalize_f64 :: proc "contextless" (m: Matrix3f64) -> (r: Matrix3f64) { r[0] = normalize(m[0]) d0 := dot(r[0], r[1]) @@ -2762,15 +2762,15 @@ matrix3_orthonormalize :: proc{ @(require_results) -vector3_orthonormalize_f16 :: proc(x, y: Vector3f16) -> (z: Vector3f16) { +vector3_orthonormalize_f16 :: proc "contextless" (x, y: Vector3f16) -> (z: Vector3f16) { return normalize(x - y * dot(y, x)) } @(require_results) -vector3_orthonormalize_f32 :: proc(x, y: Vector3f32) -> (z: Vector3f32) { +vector3_orthonormalize_f32 :: proc "contextless" (x, y: Vector3f32) -> (z: Vector3f32) { return normalize(x - y * dot(y, x)) } @(require_results) -vector3_orthonormalize_f64 :: proc(x, y: Vector3f64) -> (z: Vector3f64) { +vector3_orthonormalize_f64 :: proc "contextless" (x, y: Vector3f64) -> (z: Vector3f64) { return normalize(x - y * dot(y, x)) } vector3_orthonormalize :: proc{ @@ -2788,7 +2788,7 @@ orthonormalize :: proc{ @(require_results) -matrix4_orientation_f16 :: proc(normal, up: Vector3f16) -> Matrix4f16 { +matrix4_orientation_f16 :: proc "contextless" (normal, up: Vector3f16) -> Matrix4f16 { if all(equal(normal, up)) { return MATRIX4F16_IDENTITY } @@ -2799,7 +2799,7 @@ matrix4_orientation_f16 :: proc(normal, up: Vector3f16) -> Matrix4f16 { return matrix4_rotate(angle, rotation_axis) } @(require_results) -matrix4_orientation_f32 :: proc(normal, up: Vector3f32) -> Matrix4f32 { +matrix4_orientation_f32 :: proc "contextless" (normal, up: Vector3f32) -> Matrix4f32 { if all(equal(normal, up)) { return MATRIX4F32_IDENTITY } @@ -2810,7 +2810,7 @@ matrix4_orientation_f32 :: proc(normal, up: Vector3f32) -> Matrix4f32 { return matrix4_rotate(angle, rotation_axis) } @(require_results) -matrix4_orientation_f64 :: proc(normal, up: Vector3f64) -> Matrix4f64 { +matrix4_orientation_f64 :: proc "contextless" (normal, up: Vector3f64) -> Matrix4f64 { if all(equal(normal, up)) { return MATRIX4F64_IDENTITY } @@ -2828,7 +2828,7 @@ matrix4_orientation :: proc{ @(require_results) -euclidean_from_polar_f16 :: proc(polar: Vector2f16) -> Vector3f16 { +euclidean_from_polar_f16 :: proc "contextless" (polar: Vector2f16) -> Vector3f16 { latitude, longitude := polar.x, polar.y cx, sx := math.cos(latitude), math.sin(latitude) cy, sy := math.cos(longitude), math.sin(longitude) @@ -2840,7 +2840,7 @@ euclidean_from_polar_f16 :: proc(polar: Vector2f16) -> Vector3f16 { } } @(require_results) -euclidean_from_polar_f32 :: proc(polar: Vector2f32) -> Vector3f32 { +euclidean_from_polar_f32 :: proc "contextless" (polar: Vector2f32) -> Vector3f32 { latitude, longitude := polar.x, polar.y cx, sx := math.cos(latitude), math.sin(latitude) cy, sy := math.cos(longitude), math.sin(longitude) @@ -2852,7 +2852,7 @@ euclidean_from_polar_f32 :: proc(polar: Vector2f32) -> Vector3f32 { } } @(require_results) -euclidean_from_polar_f64 :: proc(polar: Vector2f64) -> Vector3f64 { +euclidean_from_polar_f64 :: proc "contextless" (polar: Vector2f64) -> Vector3f64 { latitude, longitude := polar.x, polar.y cx, sx := math.cos(latitude), math.sin(latitude) cy, sy := math.cos(longitude), math.sin(longitude) @@ -2871,7 +2871,7 @@ euclidean_from_polar :: proc{ @(require_results) -polar_from_euclidean_f16 :: proc(euclidean: Vector3f16) -> Vector3f16 { +polar_from_euclidean_f16 :: proc "contextless" (euclidean: Vector3f16) -> Vector3f16 { n := length(euclidean) tmp := euclidean / n @@ -2884,7 +2884,7 @@ polar_from_euclidean_f16 :: proc(euclidean: Vector3f16) -> Vector3f16 { } } @(require_results) -polar_from_euclidean_f32 :: proc(euclidean: Vector3f32) -> Vector3f32 { +polar_from_euclidean_f32 :: proc "contextless" (euclidean: Vector3f32) -> Vector3f32 { n := length(euclidean) tmp := euclidean / n @@ -2897,7 +2897,7 @@ polar_from_euclidean_f32 :: proc(euclidean: Vector3f32) -> Vector3f32 { } } @(require_results) -polar_from_euclidean_f64 :: proc(euclidean: Vector3f64) -> Vector3f64 { +polar_from_euclidean_f64 :: proc "contextless" (euclidean: Vector3f64) -> Vector3f64 { n := length(euclidean) tmp := euclidean / n diff --git a/core/math/linalg/specific_euler_angles_f16.odin b/core/math/linalg/specific_euler_angles_f16.odin index e26860882..bacda163e 100644 --- a/core/math/linalg/specific_euler_angles_f16.odin +++ b/core/math/linalg/specific_euler_angles_f16.odin @@ -3,7 +3,7 @@ package linalg import "core:math" @(require_results) -euler_angles_from_matrix3_f16 :: proc(m: Matrix3f16, order: Euler_Angle_Order) -> (t1, t2, t3: f16) { +euler_angles_from_matrix3_f16 :: proc "contextless" (m: Matrix3f16, order: Euler_Angle_Order) -> (t1, t2, t3: f16) { switch order { case .XYZ: t1, t2, t3 = euler_angles_xyz_from_matrix3(m) case .XZY: t1, t2, t3 = euler_angles_xzy_from_matrix3(m) @@ -21,7 +21,7 @@ euler_angles_from_matrix3_f16 :: proc(m: Matrix3f16, order: Euler_Angle_Order) - return } @(require_results) -euler_angles_from_matrix4_f16 :: proc(m: Matrix4f16, order: Euler_Angle_Order) -> (t1, t2, t3: f16) { +euler_angles_from_matrix4_f16 :: proc "contextless" (m: Matrix4f16, order: Euler_Angle_Order) -> (t1, t2, t3: f16) { switch order { case .XYZ: t1, t2, t3 = euler_angles_xyz_from_matrix4(m) case .XZY: t1, t2, t3 = euler_angles_xzy_from_matrix4(m) @@ -39,7 +39,7 @@ euler_angles_from_matrix4_f16 :: proc(m: Matrix4f16, order: Euler_Angle_Order) - return } @(require_results) -euler_angles_from_quaternion_f16 :: proc(m: Quaternionf16, order: Euler_Angle_Order) -> (t1, t2, t3: f16) { +euler_angles_from_quaternion_f16 :: proc "contextless" (m: Quaternionf16, order: Euler_Angle_Order) -> (t1, t2, t3: f16) { switch order { case .XYZ: t1, t2, t3 = euler_angles_xyz_from_quaternion(m) case .XZY: t1, t2, t3 = euler_angles_xzy_from_quaternion(m) @@ -58,7 +58,7 @@ euler_angles_from_quaternion_f16 :: proc(m: Quaternionf16, order: Euler_Angle_Or } @(require_results) -matrix3_from_euler_angles_f16 :: proc(t1, t2, t3: f16, order: Euler_Angle_Order) -> (m: Matrix3f16) { +matrix3_from_euler_angles_f16 :: proc "contextless" (t1, t2, t3: f16, order: Euler_Angle_Order) -> (m: Matrix3f16) { switch order { case .XYZ: return matrix3_from_euler_angles_xyz(t1, t2, t3) // m1, m2, m3 = X(t1), Y(t2), Z(t3); case .XZY: return matrix3_from_euler_angles_xzy(t1, t2, t3) // m1, m2, m3 = X(t1), Z(t2), Y(t3); @@ -76,7 +76,7 @@ matrix3_from_euler_angles_f16 :: proc(t1, t2, t3: f16, order: Euler_Angle_Order) return } @(require_results) -matrix4_from_euler_angles_f16 :: proc(t1, t2, t3: f16, order: Euler_Angle_Order) -> (m: Matrix4f16) { +matrix4_from_euler_angles_f16 :: proc "contextless" (t1, t2, t3: f16, order: Euler_Angle_Order) -> (m: Matrix4f16) { switch order { case .XYZ: return matrix4_from_euler_angles_xyz(t1, t2, t3) // m1, m2, m3 = X(t1), Y(t2), Z(t3); case .XZY: return matrix4_from_euler_angles_xzy(t1, t2, t3) // m1, m2, m3 = X(t1), Z(t2), Y(t3); @@ -95,7 +95,7 @@ matrix4_from_euler_angles_f16 :: proc(t1, t2, t3: f16, order: Euler_Angle_Order) } @(require_results) -quaternion_from_euler_angles_f16 :: proc(t1, t2, t3: f16, order: Euler_Angle_Order) -> Quaternionf16 { +quaternion_from_euler_angles_f16 :: proc "contextless" (t1, t2, t3: f16, order: Euler_Angle_Order) -> Quaternionf16 { X :: quaternion_from_euler_angle_x Y :: quaternion_from_euler_angle_y Z :: quaternion_from_euler_angle_z @@ -124,20 +124,20 @@ quaternion_from_euler_angles_f16 :: proc(t1, t2, t3: f16, order: Euler_Angle_Ord // Quaternionf16s @(require_results) -quaternion_from_euler_angle_x_f16 :: proc(angle_x: f16) -> (q: Quaternionf16) { +quaternion_from_euler_angle_x_f16 :: proc "contextless" (angle_x: f16) -> (q: Quaternionf16) { return quaternion_angle_axis_f16(angle_x, {1, 0, 0}) } @(require_results) -quaternion_from_euler_angle_y_f16 :: proc(angle_y: f16) -> (q: Quaternionf16) { +quaternion_from_euler_angle_y_f16 :: proc "contextless" (angle_y: f16) -> (q: Quaternionf16) { return quaternion_angle_axis_f16(angle_y, {0, 1, 0}) } @(require_results) -quaternion_from_euler_angle_z_f16 :: proc(angle_z: f16) -> (q: Quaternionf16) { +quaternion_from_euler_angle_z_f16 :: proc "contextless" (angle_z: f16) -> (q: Quaternionf16) { return quaternion_angle_axis_f16(angle_z, {0, 0, 1}) } @(require_results) -quaternion_from_pitch_yaw_roll_f16 :: proc(pitch, yaw, roll: f16) -> Quaternionf16 { +quaternion_from_pitch_yaw_roll_f16 :: proc "contextless" (pitch, yaw, roll: f16) -> Quaternionf16 { a, b, c := pitch, yaw, roll ca, sa := math.cos(a*0.5), math.sin(a*0.5) @@ -153,12 +153,12 @@ quaternion_from_pitch_yaw_roll_f16 :: proc(pitch, yaw, roll: f16) -> Quaternionf } @(require_results) -roll_from_quaternion_f16 :: proc(q: Quaternionf16) -> f16 { +roll_from_quaternion_f16 :: proc "contextless" (q: Quaternionf16) -> f16 { return math.atan2(2 * q.x*q.y + q.w*q.z, q.w*q.w + q.x*q.x - q.y*q.y - q.z*q.z) } @(require_results) -pitch_from_quaternion_f16 :: proc(q: Quaternionf16) -> f16 { +pitch_from_quaternion_f16 :: proc "contextless" (q: Quaternionf16) -> f16 { y := 2 * (q.y*q.z + q.w*q.w) x := q.w*q.w - q.x*q.x - q.y*q.y + q.z*q.z @@ -170,13 +170,13 @@ pitch_from_quaternion_f16 :: proc(q: Quaternionf16) -> f16 { } @(require_results) -yaw_from_quaternion_f16 :: proc(q: Quaternionf16) -> f16 { +yaw_from_quaternion_f16 :: proc "contextless" (q: Quaternionf16) -> f16 { return math.asin(clamp(-2 * (q.x*q.z - q.w*q.y), -1, 1)) } @(require_results) -pitch_yaw_roll_from_quaternion_f16 :: proc(q: Quaternionf16) -> (pitch, yaw, roll: f16) { +pitch_yaw_roll_from_quaternion_f16 :: proc "contextless" (q: Quaternionf16) -> (pitch, yaw, roll: f16) { pitch = pitch_from_quaternion(q) yaw = yaw_from_quaternion(q) roll = roll_from_quaternion(q) @@ -184,51 +184,51 @@ pitch_yaw_roll_from_quaternion_f16 :: proc(q: Quaternionf16) -> (pitch, yaw, rol } @(require_results) -euler_angles_xyz_from_quaternion_f16 :: proc(q: Quaternionf16) -> (t1, t2, t3: f16) { +euler_angles_xyz_from_quaternion_f16 :: proc "contextless" (q: Quaternionf16) -> (t1, t2, t3: f16) { return euler_angles_xyz_from_matrix4(matrix4_from_quaternion(q)) } @(require_results) -euler_angles_yxz_from_quaternion_f16 :: proc(q: Quaternionf16) -> (t1, t2, t3: f16) { +euler_angles_yxz_from_quaternion_f16 :: proc "contextless" (q: Quaternionf16) -> (t1, t2, t3: f16) { return euler_angles_yxz_from_matrix4(matrix4_from_quaternion(q)) } @(require_results) -euler_angles_xzx_from_quaternion_f16 :: proc(q: Quaternionf16) -> (t1, t2, t3: f16) { +euler_angles_xzx_from_quaternion_f16 :: proc "contextless" (q: Quaternionf16) -> (t1, t2, t3: f16) { return euler_angles_xzx_from_matrix4(matrix4_from_quaternion(q)) } @(require_results) -euler_angles_xyx_from_quaternion_f16 :: proc(q: Quaternionf16) -> (t1, t2, t3: f16) { +euler_angles_xyx_from_quaternion_f16 :: proc "contextless" (q: Quaternionf16) -> (t1, t2, t3: f16) { return euler_angles_xyx_from_matrix4(matrix4_from_quaternion(q)) } @(require_results) -euler_angles_yxy_from_quaternion_f16 :: proc(q: Quaternionf16) -> (t1, t2, t3: f16) { +euler_angles_yxy_from_quaternion_f16 :: proc "contextless" (q: Quaternionf16) -> (t1, t2, t3: f16) { return euler_angles_yxy_from_matrix4(matrix4_from_quaternion(q)) } @(require_results) -euler_angles_yzy_from_quaternion_f16 :: proc(q: Quaternionf16) -> (t1, t2, t3: f16) { +euler_angles_yzy_from_quaternion_f16 :: proc "contextless" (q: Quaternionf16) -> (t1, t2, t3: f16) { return euler_angles_yzy_from_matrix4(matrix4_from_quaternion(q)) } @(require_results) -euler_angles_zyz_from_quaternion_f16 :: proc(q: Quaternionf16) -> (t1, t2, t3: f16) { +euler_angles_zyz_from_quaternion_f16 :: proc "contextless" (q: Quaternionf16) -> (t1, t2, t3: f16) { return euler_angles_zyz_from_matrix4(matrix4_from_quaternion(q)) } @(require_results) -euler_angles_zxz_from_quaternion_f16 :: proc(q: Quaternionf16) -> (t1, t2, t3: f16) { +euler_angles_zxz_from_quaternion_f16 :: proc "contextless" (q: Quaternionf16) -> (t1, t2, t3: f16) { return euler_angles_zxz_from_matrix4(matrix4_from_quaternion(q)) } @(require_results) -euler_angles_xzy_from_quaternion_f16 :: proc(q: Quaternionf16) -> (t1, t2, t3: f16) { +euler_angles_xzy_from_quaternion_f16 :: proc "contextless" (q: Quaternionf16) -> (t1, t2, t3: f16) { return euler_angles_xzy_from_matrix4(matrix4_from_quaternion(q)) } @(require_results) -euler_angles_yzx_from_quaternion_f16 :: proc(q: Quaternionf16) -> (t1, t2, t3: f16) { +euler_angles_yzx_from_quaternion_f16 :: proc "contextless" (q: Quaternionf16) -> (t1, t2, t3: f16) { return euler_angles_yzx_from_matrix4(matrix4_from_quaternion(q)) } @(require_results) -euler_angles_zyx_from_quaternion_f16 :: proc(q: Quaternionf16) -> (t1, t2, t3: f16) { +euler_angles_zyx_from_quaternion_f16 :: proc "contextless" (q: Quaternionf16) -> (t1, t2, t3: f16) { return euler_angles_zyx_from_matrix4(matrix4_from_quaternion(q)) } @(require_results) -euler_angles_zxy_from_quaternion_f16 :: proc(q: Quaternionf16) -> (t1, t2, t3: f16) { +euler_angles_zxy_from_quaternion_f16 :: proc "contextless" (q: Quaternionf16) -> (t1, t2, t3: f16) { return euler_angles_zxy_from_matrix4(matrix4_from_quaternion(q)) } @@ -237,7 +237,7 @@ euler_angles_zxy_from_quaternion_f16 :: proc(q: Quaternionf16) -> (t1, t2, t3: f @(require_results) -matrix3_from_euler_angle_x_f16 :: proc(angle_x: f16) -> (m: Matrix3f16) { +matrix3_from_euler_angle_x_f16 :: proc "contextless" (angle_x: f16) -> (m: Matrix3f16) { cos_x, sin_x := math.cos(angle_x), math.sin(angle_x) m[0, 0] = 1 m[1, 1] = +cos_x @@ -247,7 +247,7 @@ matrix3_from_euler_angle_x_f16 :: proc(angle_x: f16) -> (m: Matrix3f16) { return } @(require_results) -matrix3_from_euler_angle_y_f16 :: proc(angle_y: f16) -> (m: Matrix3f16) { +matrix3_from_euler_angle_y_f16 :: proc "contextless" (angle_y: f16) -> (m: Matrix3f16) { cos_y, sin_y := math.cos(angle_y), math.sin(angle_y) m[0, 0] = +cos_y m[0, 2] = -sin_y @@ -257,7 +257,7 @@ matrix3_from_euler_angle_y_f16 :: proc(angle_y: f16) -> (m: Matrix3f16) { return } @(require_results) -matrix3_from_euler_angle_z_f16 :: proc(angle_z: f16) -> (m: Matrix3f16) { +matrix3_from_euler_angle_z_f16 :: proc "contextless" (angle_z: f16) -> (m: Matrix3f16) { cos_z, sin_z := math.cos(angle_z), math.sin(angle_z) m[0, 0] = +cos_z m[0, 1] = +sin_z @@ -269,7 +269,7 @@ matrix3_from_euler_angle_z_f16 :: proc(angle_z: f16) -> (m: Matrix3f16) { @(require_results) -matrix3_from_derived_euler_angle_x_f16 :: proc(angle_x: f16, angular_velocity_x: f16) -> (m: Matrix3f16) { +matrix3_from_derived_euler_angle_x_f16 :: proc "contextless" (angle_x: f16, angular_velocity_x: f16) -> (m: Matrix3f16) { cos_x := math.cos(angle_x) * angular_velocity_x sin_x := math.sin(angle_x) * angular_velocity_x m[0, 0] = 1 @@ -280,7 +280,7 @@ matrix3_from_derived_euler_angle_x_f16 :: proc(angle_x: f16, angular_velocity_x: return } @(require_results) -matrix3_from_derived_euler_angle_y_f16 :: proc(angle_y: f16, angular_velocity_y: f16) -> (m: Matrix3f16) { +matrix3_from_derived_euler_angle_y_f16 :: proc "contextless" (angle_y: f16, angular_velocity_y: f16) -> (m: Matrix3f16) { cos_y := math.cos(angle_y) * angular_velocity_y sin_y := math.sin(angle_y) * angular_velocity_y m[0, 0] = +cos_y @@ -291,7 +291,7 @@ matrix3_from_derived_euler_angle_y_f16 :: proc(angle_y: f16, angular_velocity_y: return } @(require_results) -matrix3_from_derived_euler_angle_z_f16 :: proc(angle_z: f16, angular_velocity_z: f16) -> (m: Matrix3f16) { +matrix3_from_derived_euler_angle_z_f16 :: proc "contextless" (angle_z: f16, angular_velocity_z: f16) -> (m: Matrix3f16) { cos_z := math.cos(angle_z) * angular_velocity_z sin_z := math.sin(angle_z) * angular_velocity_z m[0, 0] = +cos_z @@ -304,7 +304,7 @@ matrix3_from_derived_euler_angle_z_f16 :: proc(angle_z: f16, angular_velocity_z: @(require_results) -matrix3_from_euler_angles_xy_f16 :: proc(angle_x, angle_y: f16) -> (m: Matrix3f16) { +matrix3_from_euler_angles_xy_f16 :: proc "contextless" (angle_x, angle_y: f16) -> (m: Matrix3f16) { cos_x, sin_x := math.cos(angle_x), math.sin(angle_x) cos_y, sin_y := math.cos(angle_y), math.sin(angle_y) m[0, 0] = cos_y @@ -320,7 +320,7 @@ matrix3_from_euler_angles_xy_f16 :: proc(angle_x, angle_y: f16) -> (m: Matrix3f1 @(require_results) -matrix3_from_euler_angles_yx_f16 :: proc(angle_y, angle_x: f16) -> (m: Matrix3f16) { +matrix3_from_euler_angles_yx_f16 :: proc "contextless" (angle_y, angle_x: f16) -> (m: Matrix3f16) { cos_x, sin_x := math.cos(angle_x), math.sin(angle_x) cos_y, sin_y := math.cos(angle_y), math.sin(angle_y) m[0, 0] = cos_y @@ -335,25 +335,25 @@ matrix3_from_euler_angles_yx_f16 :: proc(angle_y, angle_x: f16) -> (m: Matrix3f1 } @(require_results) -matrix3_from_euler_angles_xz_f16 :: proc(angle_x, angle_z: f16) -> (m: Matrix3f16) { +matrix3_from_euler_angles_xz_f16 :: proc "contextless" (angle_x, angle_z: f16) -> (m: Matrix3f16) { return mul(matrix3_from_euler_angle_x(angle_x), matrix3_from_euler_angle_z(angle_z)) } @(require_results) -matrix3_from_euler_angles_zx_f16 :: proc(angle_z, angle_x: f16) -> (m: Matrix3f16) { +matrix3_from_euler_angles_zx_f16 :: proc "contextless" (angle_z, angle_x: f16) -> (m: Matrix3f16) { return mul(matrix3_from_euler_angle_z(angle_z), matrix3_from_euler_angle_x(angle_x)) } @(require_results) -matrix3_from_euler_angles_yz_f16 :: proc(angle_y, angle_z: f16) -> (m: Matrix3f16) { +matrix3_from_euler_angles_yz_f16 :: proc "contextless" (angle_y, angle_z: f16) -> (m: Matrix3f16) { return mul(matrix3_from_euler_angle_y(angle_y), matrix3_from_euler_angle_z(angle_z)) } @(require_results) -matrix3_from_euler_angles_zy_f16 :: proc(angle_z, angle_y: f16) -> (m: Matrix3f16) { +matrix3_from_euler_angles_zy_f16 :: proc "contextless" (angle_z, angle_y: f16) -> (m: Matrix3f16) { return mul(matrix3_from_euler_angle_z(angle_z), matrix3_from_euler_angle_y(angle_y)) } @(require_results) -matrix3_from_euler_angles_xyz_f16 :: proc(t1, t2, t3: f16) -> (m: Matrix3f16) { +matrix3_from_euler_angles_xyz_f16 :: proc "contextless" (t1, t2, t3: f16) -> (m: Matrix3f16) { c1 := math.cos(-t1) c2 := math.cos(-t2) c3 := math.cos(-t3) @@ -374,7 +374,7 @@ matrix3_from_euler_angles_xyz_f16 :: proc(t1, t2, t3: f16) -> (m: Matrix3f16) { } @(require_results) -matrix3_from_euler_angles_yxz_f16 :: proc(yaw, pitch, roll: f16) -> (m: Matrix3f16) { +matrix3_from_euler_angles_yxz_f16 :: proc "contextless" (yaw, pitch, roll: f16) -> (m: Matrix3f16) { ch := math.cos(yaw) sh := math.sin(yaw) cp := math.cos(pitch) @@ -395,7 +395,7 @@ matrix3_from_euler_angles_yxz_f16 :: proc(yaw, pitch, roll: f16) -> (m: Matrix3f } @(require_results) -matrix3_from_euler_angles_xzx_f16 :: proc(t1, t2, t3: f16) -> (m: Matrix3f16) { +matrix3_from_euler_angles_xzx_f16 :: proc "contextless" (t1, t2, t3: f16) -> (m: Matrix3f16) { c1 := math.cos(t1) s1 := math.sin(t1) c2 := math.cos(t2) @@ -416,7 +416,7 @@ matrix3_from_euler_angles_xzx_f16 :: proc(t1, t2, t3: f16) -> (m: Matrix3f16) { } @(require_results) -matrix3_from_euler_angles_xyx_f16 :: proc(t1, t2, t3: f16) -> (m: Matrix3f16) { +matrix3_from_euler_angles_xyx_f16 :: proc "contextless" (t1, t2, t3: f16) -> (m: Matrix3f16) { c1 := math.cos(t1) s1 := math.sin(t1) c2 := math.cos(t2) @@ -437,7 +437,7 @@ matrix3_from_euler_angles_xyx_f16 :: proc(t1, t2, t3: f16) -> (m: Matrix3f16) { } @(require_results) -matrix3_from_euler_angles_yxy_f16 :: proc(t1, t2, t3: f16) -> (m: Matrix3f16) { +matrix3_from_euler_angles_yxy_f16 :: proc "contextless" (t1, t2, t3: f16) -> (m: Matrix3f16) { c1 := math.cos(t1) s1 := math.sin(t1) c2 := math.cos(t2) @@ -458,7 +458,7 @@ matrix3_from_euler_angles_yxy_f16 :: proc(t1, t2, t3: f16) -> (m: Matrix3f16) { } @(require_results) -matrix3_from_euler_angles_yzy_f16 :: proc(t1, t2, t3: f16) -> (m: Matrix3f16) { +matrix3_from_euler_angles_yzy_f16 :: proc "contextless" (t1, t2, t3: f16) -> (m: Matrix3f16) { c1 := math.cos(t1) s1 := math.sin(t1) c2 := math.cos(t2) @@ -479,7 +479,7 @@ matrix3_from_euler_angles_yzy_f16 :: proc(t1, t2, t3: f16) -> (m: Matrix3f16) { } @(require_results) -matrix3_from_euler_angles_zyz_f16 :: proc(t1, t2, t3: f16) -> (m: Matrix3f16) { +matrix3_from_euler_angles_zyz_f16 :: proc "contextless" (t1, t2, t3: f16) -> (m: Matrix3f16) { c1 := math.cos(t1) s1 := math.sin(t1) c2 := math.cos(t2) @@ -500,7 +500,7 @@ matrix3_from_euler_angles_zyz_f16 :: proc(t1, t2, t3: f16) -> (m: Matrix3f16) { } @(require_results) -matrix3_from_euler_angles_zxz_f16 :: proc(t1, t2, t3: f16) -> (m: Matrix3f16) { +matrix3_from_euler_angles_zxz_f16 :: proc "contextless" (t1, t2, t3: f16) -> (m: Matrix3f16) { c1 := math.cos(t1) s1 := math.sin(t1) c2 := math.cos(t2) @@ -522,7 +522,7 @@ matrix3_from_euler_angles_zxz_f16 :: proc(t1, t2, t3: f16) -> (m: Matrix3f16) { @(require_results) -matrix3_from_euler_angles_xzy_f16 :: proc(t1, t2, t3: f16) -> (m: Matrix3f16) { +matrix3_from_euler_angles_xzy_f16 :: proc "contextless" (t1, t2, t3: f16) -> (m: Matrix3f16) { c1 := math.cos(t1) s1 := math.sin(t1) c2 := math.cos(t2) @@ -543,7 +543,7 @@ matrix3_from_euler_angles_xzy_f16 :: proc(t1, t2, t3: f16) -> (m: Matrix3f16) { } @(require_results) -matrix3_from_euler_angles_yzx_f16 :: proc(t1, t2, t3: f16) -> (m: Matrix3f16) { +matrix3_from_euler_angles_yzx_f16 :: proc "contextless" (t1, t2, t3: f16) -> (m: Matrix3f16) { c1 := math.cos(t1) s1 := math.sin(t1) c2 := math.cos(t2) @@ -564,7 +564,7 @@ matrix3_from_euler_angles_yzx_f16 :: proc(t1, t2, t3: f16) -> (m: Matrix3f16) { } @(require_results) -matrix3_from_euler_angles_zyx_f16 :: proc(t1, t2, t3: f16) -> (m: Matrix3f16) { +matrix3_from_euler_angles_zyx_f16 :: proc "contextless" (t1, t2, t3: f16) -> (m: Matrix3f16) { c1 := math.cos(t1) s1 := math.sin(t1) c2 := math.cos(t2) @@ -585,7 +585,7 @@ matrix3_from_euler_angles_zyx_f16 :: proc(t1, t2, t3: f16) -> (m: Matrix3f16) { } @(require_results) -matrix3_from_euler_angles_zxy_f16 :: proc(t1, t2, t3: f16) -> (m: Matrix3f16) { +matrix3_from_euler_angles_zxy_f16 :: proc "contextless" (t1, t2, t3: f16) -> (m: Matrix3f16) { c1 := math.cos(t1) s1 := math.sin(t1) c2 := math.cos(t2) @@ -607,7 +607,7 @@ matrix3_from_euler_angles_zxy_f16 :: proc(t1, t2, t3: f16) -> (m: Matrix3f16) { @(require_results) -matrix3_from_yaw_pitch_roll_f16 :: proc(yaw, pitch, roll: f16) -> (m: Matrix3f16) { +matrix3_from_yaw_pitch_roll_f16 :: proc "contextless" (yaw, pitch, roll: f16) -> (m: Matrix3f16) { ch := math.cos(yaw) sh := math.sin(yaw) cp := math.cos(pitch) @@ -628,7 +628,7 @@ matrix3_from_yaw_pitch_roll_f16 :: proc(yaw, pitch, roll: f16) -> (m: Matrix3f16 } @(require_results) -euler_angles_xyz_from_matrix3_f16 :: proc(m: Matrix3f16) -> (t1, t2, t3: f16) { +euler_angles_xyz_from_matrix3_f16 :: proc "contextless" (m: Matrix3f16) -> (t1, t2, t3: f16) { T1 := math.atan2(m[1, 2], m[2, 2]) C2 := math.sqrt(m[0, 0]*m[0, 0] + m[0, 1]*m[0, 1]) T2 := math.atan2(-m[0, 2], C2) @@ -642,7 +642,7 @@ euler_angles_xyz_from_matrix3_f16 :: proc(m: Matrix3f16) -> (t1, t2, t3: f16) { } @(require_results) -euler_angles_yxz_from_matrix3_f16 :: proc(m: Matrix3f16) -> (t1, t2, t3: f16) { +euler_angles_yxz_from_matrix3_f16 :: proc "contextless" (m: Matrix3f16) -> (t1, t2, t3: f16) { T1 := math.atan2(m[0, 2], m[2, 2]) C2 := math.sqrt(m[1, 0]*m[1, 0] + m[1, 1]*m[1, 1]) T2 := math.atan2(-m[1, 2], C2) @@ -656,7 +656,7 @@ euler_angles_yxz_from_matrix3_f16 :: proc(m: Matrix3f16) -> (t1, t2, t3: f16) { } @(require_results) -euler_angles_xzx_from_matrix3_f16 :: proc(m: Matrix3f16) -> (t1, t2, t3: f16) { +euler_angles_xzx_from_matrix3_f16 :: proc "contextless" (m: Matrix3f16) -> (t1, t2, t3: f16) { T1 := math.atan2(m[2, 0], m[1, 0]) S2 := math.sqrt(m[0, 1]*m[0, 1] + m[0, 2]*m[0, 2]) T2 := math.atan2(S2, m[0, 0]) @@ -670,7 +670,7 @@ euler_angles_xzx_from_matrix3_f16 :: proc(m: Matrix3f16) -> (t1, t2, t3: f16) { } @(require_results) -euler_angles_xyx_from_matrix3_f16 :: proc(m: Matrix3f16) -> (t1, t2, t3: f16) { +euler_angles_xyx_from_matrix3_f16 :: proc "contextless" (m: Matrix3f16) -> (t1, t2, t3: f16) { T1 := math.atan2(m[1, 0], -m[2, 0]) S2 := math.sqrt(m[0, 1]*m[0, 1] + m[0, 2]*m[0, 2]) T2 := math.atan2(S2, m[0, 0]) @@ -684,7 +684,7 @@ euler_angles_xyx_from_matrix3_f16 :: proc(m: Matrix3f16) -> (t1, t2, t3: f16) { } @(require_results) -euler_angles_yxy_from_matrix3_f16 :: proc(m: Matrix3f16) -> (t1, t2, t3: f16) { +euler_angles_yxy_from_matrix3_f16 :: proc "contextless" (m: Matrix3f16) -> (t1, t2, t3: f16) { T1 := math.atan2(m[0, 1], m[2, 1]) S2 := math.sqrt(m[1, 0]*m[1, 0] + m[1, 2]*m[1, 2]) T2 := math.atan2(S2, m[1, 1]) @@ -698,7 +698,7 @@ euler_angles_yxy_from_matrix3_f16 :: proc(m: Matrix3f16) -> (t1, t2, t3: f16) { } @(require_results) -euler_angles_yzy_from_matrix3_f16 :: proc(m: Matrix3f16) -> (t1, t2, t3: f16) { +euler_angles_yzy_from_matrix3_f16 :: proc "contextless" (m: Matrix3f16) -> (t1, t2, t3: f16) { T1 := math.atan2(m[2, 1], -m[0, 1]) S2 := math.sqrt(m[1, 0]*m[1, 0] + m[1, 2]*m[1, 2]) T2 := math.atan2(S2, m[1, 1]) @@ -711,7 +711,7 @@ euler_angles_yzy_from_matrix3_f16 :: proc(m: Matrix3f16) -> (t1, t2, t3: f16) { return } @(require_results) -euler_angles_zyz_from_matrix3_f16 :: proc(m: Matrix3f16) -> (t1, t2, t3: f16) { +euler_angles_zyz_from_matrix3_f16 :: proc "contextless" (m: Matrix3f16) -> (t1, t2, t3: f16) { T1 := math.atan2(m[1, 2], m[0, 2]) S2 := math.sqrt(m[2, 0]*m[2, 0] + m[2, 1]*m[2, 1]) T2 := math.atan2(S2, m[2, 2]) @@ -725,7 +725,7 @@ euler_angles_zyz_from_matrix3_f16 :: proc(m: Matrix3f16) -> (t1, t2, t3: f16) { } @(require_results) -euler_angles_zxz_from_matrix3_f16 :: proc(m: Matrix3f16) -> (t1, t2, t3: f16) { +euler_angles_zxz_from_matrix3_f16 :: proc "contextless" (m: Matrix3f16) -> (t1, t2, t3: f16) { T1 := math.atan2(m[0, 2], -m[1, 2]) S2 := math.sqrt(m[2, 0]*m[2, 0] + m[2, 1]*m[2, 1]) T2 := math.atan2(S2, m[2, 2]) @@ -739,7 +739,7 @@ euler_angles_zxz_from_matrix3_f16 :: proc(m: Matrix3f16) -> (t1, t2, t3: f16) { } @(require_results) -euler_angles_xzy_from_matrix3_f16 :: proc(m: Matrix3f16) -> (t1, t2, t3: f16) { +euler_angles_xzy_from_matrix3_f16 :: proc "contextless" (m: Matrix3f16) -> (t1, t2, t3: f16) { T1 := math.atan2(m[2, 1], m[1, 1]) C2 := math.sqrt(m[0, 0]*m[0, 0] + m[0, 2]*m[0, 2]) T2 := math.atan2(-m[0, 1], C2) @@ -753,7 +753,7 @@ euler_angles_xzy_from_matrix3_f16 :: proc(m: Matrix3f16) -> (t1, t2, t3: f16) { } @(require_results) -euler_angles_yzx_from_matrix3_f16 :: proc(m: Matrix3f16) -> (t1, t2, t3: f16) { +euler_angles_yzx_from_matrix3_f16 :: proc "contextless" (m: Matrix3f16) -> (t1, t2, t3: f16) { T1 := math.atan2(-m[2, 0], m[0, 0]) C2 := math.sqrt(m[1, 1]*m[1, 1] + m[1, 2]*m[1, 2]) T2 := math.atan2(m[1, 0], C2) @@ -767,7 +767,7 @@ euler_angles_yzx_from_matrix3_f16 :: proc(m: Matrix3f16) -> (t1, t2, t3: f16) { } @(require_results) -euler_angles_zyx_from_matrix3_f16 :: proc(m: Matrix3f16) -> (t1, t2, t3: f16) { +euler_angles_zyx_from_matrix3_f16 :: proc "contextless" (m: Matrix3f16) -> (t1, t2, t3: f16) { T1 := math.atan2(m[1, 0], m[0, 0]) C2 := math.sqrt(m[2, 1]*m[2, 1] + m[2, 2]*m[2, 2]) T2 := math.atan2(-m[2, 0], C2) @@ -781,7 +781,7 @@ euler_angles_zyx_from_matrix3_f16 :: proc(m: Matrix3f16) -> (t1, t2, t3: f16) { } @(require_results) -euler_angles_zxy_from_matrix3_f16 :: proc(m: Matrix3f16) -> (t1, t2, t3: f16) { +euler_angles_zxy_from_matrix3_f16 :: proc "contextless" (m: Matrix3f16) -> (t1, t2, t3: f16) { T1 := math.atan2(-m[0, 1], m[1, 1]) C2 := math.sqrt(m[2, 0]*m[2, 0] + m[2, 2]*m[2, 2]) T2 := math.atan2(m[2, 1], C2) @@ -799,7 +799,7 @@ euler_angles_zxy_from_matrix3_f16 :: proc(m: Matrix3f16) -> (t1, t2, t3: f16) { @(require_results) -matrix4_from_euler_angle_x_f16 :: proc(angle_x: f16) -> (m: Matrix4f16) { +matrix4_from_euler_angle_x_f16 :: proc "contextless" (angle_x: f16) -> (m: Matrix4f16) { cos_x, sin_x := math.cos(angle_x), math.sin(angle_x) m[0, 0] = 1 m[1, 1] = +cos_x @@ -810,7 +810,7 @@ matrix4_from_euler_angle_x_f16 :: proc(angle_x: f16) -> (m: Matrix4f16) { return } @(require_results) -matrix4_from_euler_angle_y_f16 :: proc(angle_y: f16) -> (m: Matrix4f16) { +matrix4_from_euler_angle_y_f16 :: proc "contextless" (angle_y: f16) -> (m: Matrix4f16) { cos_y, sin_y := math.cos(angle_y), math.sin(angle_y) m[0, 0] = +cos_y m[0, 2] = -sin_y @@ -821,7 +821,7 @@ matrix4_from_euler_angle_y_f16 :: proc(angle_y: f16) -> (m: Matrix4f16) { return } @(require_results) -matrix4_from_euler_angle_z_f16 :: proc(angle_z: f16) -> (m: Matrix4f16) { +matrix4_from_euler_angle_z_f16 :: proc "contextless" (angle_z: f16) -> (m: Matrix4f16) { cos_z, sin_z := math.cos(angle_z), math.sin(angle_z) m[0, 0] = +cos_z m[0, 1] = +sin_z @@ -834,7 +834,7 @@ matrix4_from_euler_angle_z_f16 :: proc(angle_z: f16) -> (m: Matrix4f16) { @(require_results) -matrix4_from_derived_euler_angle_x_f16 :: proc(angle_x: f16, angular_velocity_x: f16) -> (m: Matrix4f16) { +matrix4_from_derived_euler_angle_x_f16 :: proc "contextless" (angle_x: f16, angular_velocity_x: f16) -> (m: Matrix4f16) { cos_x := math.cos(angle_x) * angular_velocity_x sin_x := math.sin(angle_x) * angular_velocity_x m[0, 0] = 1 @@ -846,7 +846,7 @@ matrix4_from_derived_euler_angle_x_f16 :: proc(angle_x: f16, angular_velocity_x: return } @(require_results) -matrix4_from_derived_euler_angle_y_f16 :: proc(angle_y: f16, angular_velocity_y: f16) -> (m: Matrix4f16) { +matrix4_from_derived_euler_angle_y_f16 :: proc "contextless" (angle_y: f16, angular_velocity_y: f16) -> (m: Matrix4f16) { cos_y := math.cos(angle_y) * angular_velocity_y sin_y := math.sin(angle_y) * angular_velocity_y m[0, 0] = +cos_y @@ -858,7 +858,7 @@ matrix4_from_derived_euler_angle_y_f16 :: proc(angle_y: f16, angular_velocity_y: return } @(require_results) -matrix4_from_derived_euler_angle_z_f16 :: proc(angle_z: f16, angular_velocity_z: f16) -> (m: Matrix4f16) { +matrix4_from_derived_euler_angle_z_f16 :: proc "contextless" (angle_z: f16, angular_velocity_z: f16) -> (m: Matrix4f16) { cos_z := math.cos(angle_z) * angular_velocity_z sin_z := math.sin(angle_z) * angular_velocity_z m[0, 0] = +cos_z @@ -872,7 +872,7 @@ matrix4_from_derived_euler_angle_z_f16 :: proc(angle_z: f16, angular_velocity_z: @(require_results) -matrix4_from_euler_angles_xy_f16 :: proc(angle_x, angle_y: f16) -> (m: Matrix4f16) { +matrix4_from_euler_angles_xy_f16 :: proc "contextless" (angle_x, angle_y: f16) -> (m: Matrix4f16) { cos_x, sin_x := math.cos(angle_x), math.sin(angle_x) cos_y, sin_y := math.cos(angle_y), math.sin(angle_y) m[0, 0] = cos_y @@ -889,7 +889,7 @@ matrix4_from_euler_angles_xy_f16 :: proc(angle_x, angle_y: f16) -> (m: Matrix4f1 @(require_results) -matrix4_from_euler_angles_yx_f16 :: proc(angle_y, angle_x: f16) -> (m: Matrix4f16) { +matrix4_from_euler_angles_yx_f16 :: proc "contextless" (angle_y, angle_x: f16) -> (m: Matrix4f16) { cos_x, sin_x := math.cos(angle_x), math.sin(angle_x) cos_y, sin_y := math.cos(angle_y), math.sin(angle_y) m[0, 0] = cos_y @@ -905,25 +905,25 @@ matrix4_from_euler_angles_yx_f16 :: proc(angle_y, angle_x: f16) -> (m: Matrix4f1 } @(require_results) -matrix4_from_euler_angles_xz_f16 :: proc(angle_x, angle_z: f16) -> (m: Matrix4f16) { +matrix4_from_euler_angles_xz_f16 :: proc "contextless" (angle_x, angle_z: f16) -> (m: Matrix4f16) { return mul(matrix4_from_euler_angle_x(angle_x), matrix4_from_euler_angle_z(angle_z)) } @(require_results) -matrix4_from_euler_angles_zx_f16 :: proc(angle_z, angle_x: f16) -> (m: Matrix4f16) { +matrix4_from_euler_angles_zx_f16 :: proc "contextless" (angle_z, angle_x: f16) -> (m: Matrix4f16) { return mul(matrix4_from_euler_angle_z(angle_z), matrix4_from_euler_angle_x(angle_x)) } @(require_results) -matrix4_from_euler_angles_yz_f16 :: proc(angle_y, angle_z: f16) -> (m: Matrix4f16) { +matrix4_from_euler_angles_yz_f16 :: proc "contextless" (angle_y, angle_z: f16) -> (m: Matrix4f16) { return mul(matrix4_from_euler_angle_y(angle_y), matrix4_from_euler_angle_z(angle_z)) } @(require_results) -matrix4_from_euler_angles_zy_f16 :: proc(angle_z, angle_y: f16) -> (m: Matrix4f16) { +matrix4_from_euler_angles_zy_f16 :: proc "contextless" (angle_z, angle_y: f16) -> (m: Matrix4f16) { return mul(matrix4_from_euler_angle_z(angle_z), matrix4_from_euler_angle_y(angle_y)) } @(require_results) -matrix4_from_euler_angles_xyz_f16 :: proc(t1, t2, t3: f16) -> (m: Matrix4f16) { +matrix4_from_euler_angles_xyz_f16 :: proc "contextless" (t1, t2, t3: f16) -> (m: Matrix4f16) { c1 := math.cos(-t1) c2 := math.cos(-t2) c3 := math.cos(-t3) @@ -951,7 +951,7 @@ matrix4_from_euler_angles_xyz_f16 :: proc(t1, t2, t3: f16) -> (m: Matrix4f16) { } @(require_results) -matrix4_from_euler_angles_yxz_f16 :: proc(yaw, pitch, roll: f16) -> (m: Matrix4f16) { +matrix4_from_euler_angles_yxz_f16 :: proc "contextless" (yaw, pitch, roll: f16) -> (m: Matrix4f16) { ch := math.cos(yaw) sh := math.sin(yaw) cp := math.cos(pitch) @@ -979,7 +979,7 @@ matrix4_from_euler_angles_yxz_f16 :: proc(yaw, pitch, roll: f16) -> (m: Matrix4f } @(require_results) -matrix4_from_euler_angles_xzx_f16 :: proc(t1, t2, t3: f16) -> (m: Matrix4f16) { +matrix4_from_euler_angles_xzx_f16 :: proc "contextless" (t1, t2, t3: f16) -> (m: Matrix4f16) { c1 := math.cos(t1) s1 := math.sin(t1) c2 := math.cos(t2) @@ -1007,7 +1007,7 @@ matrix4_from_euler_angles_xzx_f16 :: proc(t1, t2, t3: f16) -> (m: Matrix4f16) { } @(require_results) -matrix4_from_euler_angles_xyx_f16 :: proc(t1, t2, t3: f16) -> (m: Matrix4f16) { +matrix4_from_euler_angles_xyx_f16 :: proc "contextless" (t1, t2, t3: f16) -> (m: Matrix4f16) { c1 := math.cos(t1) s1 := math.sin(t1) c2 := math.cos(t2) @@ -1035,7 +1035,7 @@ matrix4_from_euler_angles_xyx_f16 :: proc(t1, t2, t3: f16) -> (m: Matrix4f16) { } @(require_results) -matrix4_from_euler_angles_yxy_f16 :: proc(t1, t2, t3: f16) -> (m: Matrix4f16) { +matrix4_from_euler_angles_yxy_f16 :: proc "contextless" (t1, t2, t3: f16) -> (m: Matrix4f16) { c1 := math.cos(t1) s1 := math.sin(t1) c2 := math.cos(t2) @@ -1063,7 +1063,7 @@ matrix4_from_euler_angles_yxy_f16 :: proc(t1, t2, t3: f16) -> (m: Matrix4f16) { } @(require_results) -matrix4_from_euler_angles_yzy_f16 :: proc(t1, t2, t3: f16) -> (m: Matrix4f16) { +matrix4_from_euler_angles_yzy_f16 :: proc "contextless" (t1, t2, t3: f16) -> (m: Matrix4f16) { c1 := math.cos(t1) s1 := math.sin(t1) c2 := math.cos(t2) @@ -1091,7 +1091,7 @@ matrix4_from_euler_angles_yzy_f16 :: proc(t1, t2, t3: f16) -> (m: Matrix4f16) { } @(require_results) -matrix4_from_euler_angles_zyz_f16 :: proc(t1, t2, t3: f16) -> (m: Matrix4f16) { +matrix4_from_euler_angles_zyz_f16 :: proc "contextless" (t1, t2, t3: f16) -> (m: Matrix4f16) { c1 := math.cos(t1) s1 := math.sin(t1) c2 := math.cos(t2) @@ -1119,7 +1119,7 @@ matrix4_from_euler_angles_zyz_f16 :: proc(t1, t2, t3: f16) -> (m: Matrix4f16) { } @(require_results) -matrix4_from_euler_angles_zxz_f16 :: proc(t1, t2, t3: f16) -> (m: Matrix4f16) { +matrix4_from_euler_angles_zxz_f16 :: proc "contextless" (t1, t2, t3: f16) -> (m: Matrix4f16) { c1 := math.cos(t1) s1 := math.sin(t1) c2 := math.cos(t2) @@ -1148,7 +1148,7 @@ matrix4_from_euler_angles_zxz_f16 :: proc(t1, t2, t3: f16) -> (m: Matrix4f16) { @(require_results) -matrix4_from_euler_angles_xzy_f16 :: proc(t1, t2, t3: f16) -> (m: Matrix4f16) { +matrix4_from_euler_angles_xzy_f16 :: proc "contextless" (t1, t2, t3: f16) -> (m: Matrix4f16) { c1 := math.cos(t1) s1 := math.sin(t1) c2 := math.cos(t2) @@ -1176,7 +1176,7 @@ matrix4_from_euler_angles_xzy_f16 :: proc(t1, t2, t3: f16) -> (m: Matrix4f16) { } @(require_results) -matrix4_from_euler_angles_yzx_f16 :: proc(t1, t2, t3: f16) -> (m: Matrix4f16) { +matrix4_from_euler_angles_yzx_f16 :: proc "contextless" (t1, t2, t3: f16) -> (m: Matrix4f16) { c1 := math.cos(t1) s1 := math.sin(t1) c2 := math.cos(t2) @@ -1204,7 +1204,7 @@ matrix4_from_euler_angles_yzx_f16 :: proc(t1, t2, t3: f16) -> (m: Matrix4f16) { } @(require_results) -matrix4_from_euler_angles_zyx_f16 :: proc(t1, t2, t3: f16) -> (m: Matrix4f16) { +matrix4_from_euler_angles_zyx_f16 :: proc "contextless" (t1, t2, t3: f16) -> (m: Matrix4f16) { c1 := math.cos(t1) s1 := math.sin(t1) c2 := math.cos(t2) @@ -1232,7 +1232,7 @@ matrix4_from_euler_angles_zyx_f16 :: proc(t1, t2, t3: f16) -> (m: Matrix4f16) { } @(require_results) -matrix4_from_euler_angles_zxy_f16 :: proc(t1, t2, t3: f16) -> (m: Matrix4f16) { +matrix4_from_euler_angles_zxy_f16 :: proc "contextless" (t1, t2, t3: f16) -> (m: Matrix4f16) { c1 := math.cos(t1) s1 := math.sin(t1) c2 := math.cos(t2) @@ -1261,7 +1261,7 @@ matrix4_from_euler_angles_zxy_f16 :: proc(t1, t2, t3: f16) -> (m: Matrix4f16) { @(require_results) -matrix4_from_yaw_pitch_roll_f16 :: proc(yaw, pitch, roll: f16) -> (m: Matrix4f16) { +matrix4_from_yaw_pitch_roll_f16 :: proc "contextless" (yaw, pitch, roll: f16) -> (m: Matrix4f16) { ch := math.cos(yaw) sh := math.sin(yaw) cp := math.cos(pitch) @@ -1289,7 +1289,7 @@ matrix4_from_yaw_pitch_roll_f16 :: proc(yaw, pitch, roll: f16) -> (m: Matrix4f16 } @(require_results) -euler_angles_xyz_from_matrix4_f16 :: proc(m: Matrix4f16) -> (t1, t2, t3: f16) { +euler_angles_xyz_from_matrix4_f16 :: proc "contextless" (m: Matrix4f16) -> (t1, t2, t3: f16) { T1 := math.atan2(m[1, 2], m[2, 2]) C2 := math.sqrt(m[0, 0]*m[0, 0] + m[0, 1]*m[0, 1]) T2 := math.atan2(-m[0, 2], C2) @@ -1303,7 +1303,7 @@ euler_angles_xyz_from_matrix4_f16 :: proc(m: Matrix4f16) -> (t1, t2, t3: f16) { } @(require_results) -euler_angles_yxz_from_matrix4_f16 :: proc(m: Matrix4f16) -> (t1, t2, t3: f16) { +euler_angles_yxz_from_matrix4_f16 :: proc "contextless" (m: Matrix4f16) -> (t1, t2, t3: f16) { T1 := math.atan2(m[0, 2], m[2, 2]) C2 := math.sqrt(m[1, 0]*m[1, 0] + m[1, 1]*m[1, 1]) T2 := math.atan2(-m[1, 2], C2) @@ -1317,7 +1317,7 @@ euler_angles_yxz_from_matrix4_f16 :: proc(m: Matrix4f16) -> (t1, t2, t3: f16) { } @(require_results) -euler_angles_xzx_from_matrix4_f16 :: proc(m: Matrix4f16) -> (t1, t2, t3: f16) { +euler_angles_xzx_from_matrix4_f16 :: proc "contextless" (m: Matrix4f16) -> (t1, t2, t3: f16) { T1 := math.atan2(m[2, 0], m[1, 0]) S2 := math.sqrt(m[0, 1]*m[0, 1] + m[0, 2]*m[0, 2]) T2 := math.atan2(S2, m[0, 0]) @@ -1331,7 +1331,7 @@ euler_angles_xzx_from_matrix4_f16 :: proc(m: Matrix4f16) -> (t1, t2, t3: f16) { } @(require_results) -euler_angles_xyx_from_matrix4_f16 :: proc(m: Matrix4f16) -> (t1, t2, t3: f16) { +euler_angles_xyx_from_matrix4_f16 :: proc "contextless" (m: Matrix4f16) -> (t1, t2, t3: f16) { T1 := math.atan2(m[1, 0], -m[2, 0]) S2 := math.sqrt(m[0, 1]*m[0, 1] + m[0, 2]*m[0, 2]) T2 := math.atan2(S2, m[0, 0]) @@ -1345,7 +1345,7 @@ euler_angles_xyx_from_matrix4_f16 :: proc(m: Matrix4f16) -> (t1, t2, t3: f16) { } @(require_results) -euler_angles_yxy_from_matrix4_f16 :: proc(m: Matrix4f16) -> (t1, t2, t3: f16) { +euler_angles_yxy_from_matrix4_f16 :: proc "contextless" (m: Matrix4f16) -> (t1, t2, t3: f16) { T1 := math.atan2(m[0, 1], m[2, 1]) S2 := math.sqrt(m[1, 0]*m[1, 0] + m[1, 2]*m[1, 2]) T2 := math.atan2(S2, m[1, 1]) @@ -1359,7 +1359,7 @@ euler_angles_yxy_from_matrix4_f16 :: proc(m: Matrix4f16) -> (t1, t2, t3: f16) { } @(require_results) -euler_angles_yzy_from_matrix4_f16 :: proc(m: Matrix4f16) -> (t1, t2, t3: f16) { +euler_angles_yzy_from_matrix4_f16 :: proc "contextless" (m: Matrix4f16) -> (t1, t2, t3: f16) { T1 := math.atan2(m[2, 1], -m[0, 1]) S2 := math.sqrt(m[1, 0]*m[1, 0] + m[1, 2]*m[1, 2]) T2 := math.atan2(S2, m[1, 1]) @@ -1372,7 +1372,7 @@ euler_angles_yzy_from_matrix4_f16 :: proc(m: Matrix4f16) -> (t1, t2, t3: f16) { return } @(require_results) -euler_angles_zyz_from_matrix4_f16 :: proc(m: Matrix4f16) -> (t1, t2, t3: f16) { +euler_angles_zyz_from_matrix4_f16 :: proc "contextless" (m: Matrix4f16) -> (t1, t2, t3: f16) { T1 := math.atan2(m[1, 2], m[0, 2]) S2 := math.sqrt(m[2, 0]*m[2, 0] + m[2, 1]*m[2, 1]) T2 := math.atan2(S2, m[2, 2]) @@ -1386,7 +1386,7 @@ euler_angles_zyz_from_matrix4_f16 :: proc(m: Matrix4f16) -> (t1, t2, t3: f16) { } @(require_results) -euler_angles_zxz_from_matrix4_f16 :: proc(m: Matrix4f16) -> (t1, t2, t3: f16) { +euler_angles_zxz_from_matrix4_f16 :: proc "contextless" (m: Matrix4f16) -> (t1, t2, t3: f16) { T1 := math.atan2(m[0, 2], -m[1, 2]) S2 := math.sqrt(m[2, 0]*m[2, 0] + m[2, 1]*m[2, 1]) T2 := math.atan2(S2, m[2, 2]) @@ -1400,7 +1400,7 @@ euler_angles_zxz_from_matrix4_f16 :: proc(m: Matrix4f16) -> (t1, t2, t3: f16) { } @(require_results) -euler_angles_xzy_from_matrix4_f16 :: proc(m: Matrix4f16) -> (t1, t2, t3: f16) { +euler_angles_xzy_from_matrix4_f16 :: proc "contextless" (m: Matrix4f16) -> (t1, t2, t3: f16) { T1 := math.atan2(m[2, 1], m[1, 1]) C2 := math.sqrt(m[0, 0]*m[0, 0] + m[0, 2]*m[0, 2]) T2 := math.atan2(-m[0, 1], C2) @@ -1414,7 +1414,7 @@ euler_angles_xzy_from_matrix4_f16 :: proc(m: Matrix4f16) -> (t1, t2, t3: f16) { } @(require_results) -euler_angles_yzx_from_matrix4_f16 :: proc(m: Matrix4f16) -> (t1, t2, t3: f16) { +euler_angles_yzx_from_matrix4_f16 :: proc "contextless" (m: Matrix4f16) -> (t1, t2, t3: f16) { T1 := math.atan2(-m[2, 0], m[0, 0]) C2 := math.sqrt(m[1, 1]*m[1, 1] + m[1, 2]*m[1, 2]) T2 := math.atan2(m[1, 0], C2) @@ -1428,7 +1428,7 @@ euler_angles_yzx_from_matrix4_f16 :: proc(m: Matrix4f16) -> (t1, t2, t3: f16) { } @(require_results) -euler_angles_zyx_from_matrix4_f16 :: proc(m: Matrix4f16) -> (t1, t2, t3: f16) { +euler_angles_zyx_from_matrix4_f16 :: proc "contextless" (m: Matrix4f16) -> (t1, t2, t3: f16) { T1 := math.atan2(m[1, 0], m[0, 0]) C2 := math.sqrt(m[2, 1]*m[2, 1] + m[2, 2]*m[2, 2]) T2 := math.atan2(-m[2, 0], C2) @@ -1442,7 +1442,7 @@ euler_angles_zyx_from_matrix4_f16 :: proc(m: Matrix4f16) -> (t1, t2, t3: f16) { } @(require_results) -euler_angles_zxy_from_matrix4_f16 :: proc(m: Matrix4f16) -> (t1, t2, t3: f16) { +euler_angles_zxy_from_matrix4_f16 :: proc "contextless" (m: Matrix4f16) -> (t1, t2, t3: f16) { T1 := math.atan2(-m[0, 1], m[1, 1]) C2 := math.sqrt(m[2, 0]*m[2, 0] + m[2, 2]*m[2, 2]) T2 := math.atan2(m[2, 1], C2) diff --git a/core/math/linalg/specific_euler_angles_f32.odin b/core/math/linalg/specific_euler_angles_f32.odin index 3cd076f0b..b9957034f 100644 --- a/core/math/linalg/specific_euler_angles_f32.odin +++ b/core/math/linalg/specific_euler_angles_f32.odin @@ -3,7 +3,7 @@ package linalg import "core:math" @(require_results) -euler_angles_from_matrix3_f32 :: proc(m: Matrix3f32, order: Euler_Angle_Order) -> (t1, t2, t3: f32) { +euler_angles_from_matrix3_f32 :: proc "contextless" (m: Matrix3f32, order: Euler_Angle_Order) -> (t1, t2, t3: f32) { switch order { case .XYZ: t1, t2, t3 = euler_angles_xyz_from_matrix3(m) case .XZY: t1, t2, t3 = euler_angles_xzy_from_matrix3(m) @@ -21,7 +21,7 @@ euler_angles_from_matrix3_f32 :: proc(m: Matrix3f32, order: Euler_Angle_Order) - return } @(require_results) -euler_angles_from_matrix4_f32 :: proc(m: Matrix4f32, order: Euler_Angle_Order) -> (t1, t2, t3: f32) { +euler_angles_from_matrix4_f32 :: proc "contextless" (m: Matrix4f32, order: Euler_Angle_Order) -> (t1, t2, t3: f32) { switch order { case .XYZ: t1, t2, t3 = euler_angles_xyz_from_matrix4(m) case .XZY: t1, t2, t3 = euler_angles_xzy_from_matrix4(m) @@ -39,7 +39,7 @@ euler_angles_from_matrix4_f32 :: proc(m: Matrix4f32, order: Euler_Angle_Order) - return } @(require_results) -euler_angles_from_quaternion_f32 :: proc(m: Quaternionf32, order: Euler_Angle_Order) -> (t1, t2, t3: f32) { +euler_angles_from_quaternion_f32 :: proc "contextless" (m: Quaternionf32, order: Euler_Angle_Order) -> (t1, t2, t3: f32) { switch order { case .XYZ: t1, t2, t3 = euler_angles_xyz_from_quaternion(m) case .XZY: t1, t2, t3 = euler_angles_xzy_from_quaternion(m) @@ -58,7 +58,7 @@ euler_angles_from_quaternion_f32 :: proc(m: Quaternionf32, order: Euler_Angle_Or } @(require_results) -matrix3_from_euler_angles_f32 :: proc(t1, t2, t3: f32, order: Euler_Angle_Order) -> (m: Matrix3f32) { +matrix3_from_euler_angles_f32 :: proc "contextless" (t1, t2, t3: f32, order: Euler_Angle_Order) -> (m: Matrix3f32) { switch order { case .XYZ: return matrix3_from_euler_angles_xyz(t1, t2, t3) // m1, m2, m3 = X(t1), Y(t2), Z(t3); case .XZY: return matrix3_from_euler_angles_xzy(t1, t2, t3) // m1, m2, m3 = X(t1), Z(t2), Y(t3); @@ -76,7 +76,7 @@ matrix3_from_euler_angles_f32 :: proc(t1, t2, t3: f32, order: Euler_Angle_Order) return } @(require_results) -matrix4_from_euler_angles_f32 :: proc(t1, t2, t3: f32, order: Euler_Angle_Order) -> (m: Matrix4f32) { +matrix4_from_euler_angles_f32 :: proc "contextless" (t1, t2, t3: f32, order: Euler_Angle_Order) -> (m: Matrix4f32) { switch order { case .XYZ: return matrix4_from_euler_angles_xyz(t1, t2, t3) // m1, m2, m3 = X(t1), Y(t2), Z(t3); case .XZY: return matrix4_from_euler_angles_xzy(t1, t2, t3) // m1, m2, m3 = X(t1), Z(t2), Y(t3); @@ -95,7 +95,7 @@ matrix4_from_euler_angles_f32 :: proc(t1, t2, t3: f32, order: Euler_Angle_Order) } @(require_results) -quaternion_from_euler_angles_f32 :: proc(t1, t2, t3: f32, order: Euler_Angle_Order) -> Quaternionf32 { +quaternion_from_euler_angles_f32 :: proc "contextless" (t1, t2, t3: f32, order: Euler_Angle_Order) -> Quaternionf32 { X :: quaternion_from_euler_angle_x Y :: quaternion_from_euler_angle_y Z :: quaternion_from_euler_angle_z @@ -124,20 +124,20 @@ quaternion_from_euler_angles_f32 :: proc(t1, t2, t3: f32, order: Euler_Angle_Ord // Quaternionf32s @(require_results) -quaternion_from_euler_angle_x_f32 :: proc(angle_x: f32) -> (q: Quaternionf32) { +quaternion_from_euler_angle_x_f32 :: proc "contextless" (angle_x: f32) -> (q: Quaternionf32) { return quaternion_angle_axis_f32(angle_x, {1, 0, 0}) } @(require_results) -quaternion_from_euler_angle_y_f32 :: proc(angle_y: f32) -> (q: Quaternionf32) { +quaternion_from_euler_angle_y_f32 :: proc "contextless" (angle_y: f32) -> (q: Quaternionf32) { return quaternion_angle_axis_f32(angle_y, {0, 1, 0}) } @(require_results) -quaternion_from_euler_angle_z_f32 :: proc(angle_z: f32) -> (q: Quaternionf32) { +quaternion_from_euler_angle_z_f32 :: proc "contextless" (angle_z: f32) -> (q: Quaternionf32) { return quaternion_angle_axis_f32(angle_z, {0, 0, 1}) } @(require_results) -quaternion_from_pitch_yaw_roll_f32 :: proc(pitch, yaw, roll: f32) -> Quaternionf32 { +quaternion_from_pitch_yaw_roll_f32 :: proc "contextless" (pitch, yaw, roll: f32) -> Quaternionf32 { a, b, c := pitch, yaw, roll ca, sa := math.cos(a*0.5), math.sin(a*0.5) @@ -153,12 +153,12 @@ quaternion_from_pitch_yaw_roll_f32 :: proc(pitch, yaw, roll: f32) -> Quaternionf } @(require_results) -roll_from_quaternion_f32 :: proc(q: Quaternionf32) -> f32 { +roll_from_quaternion_f32 :: proc "contextless" (q: Quaternionf32) -> f32 { return math.atan2(2 * q.x*q.y + q.w*q.z, q.w*q.w + q.x*q.x - q.y*q.y - q.z*q.z) } @(require_results) -pitch_from_quaternion_f32 :: proc(q: Quaternionf32) -> f32 { +pitch_from_quaternion_f32 :: proc "contextless" (q: Quaternionf32) -> f32 { y := 2 * (q.y*q.z + q.w*q.w) x := q.w*q.w - q.x*q.x - q.y*q.y + q.z*q.z @@ -170,13 +170,13 @@ pitch_from_quaternion_f32 :: proc(q: Quaternionf32) -> f32 { } @(require_results) -yaw_from_quaternion_f32 :: proc(q: Quaternionf32) -> f32 { +yaw_from_quaternion_f32 :: proc "contextless" (q: Quaternionf32) -> f32 { return math.asin(clamp(-2 * (q.x*q.z - q.w*q.y), -1, 1)) } @(require_results) -pitch_yaw_roll_from_quaternion_f32 :: proc(q: Quaternionf32) -> (pitch, yaw, roll: f32) { +pitch_yaw_roll_from_quaternion_f32 :: proc "contextless" (q: Quaternionf32) -> (pitch, yaw, roll: f32) { pitch = pitch_from_quaternion(q) yaw = yaw_from_quaternion(q) roll = roll_from_quaternion(q) @@ -184,51 +184,51 @@ pitch_yaw_roll_from_quaternion_f32 :: proc(q: Quaternionf32) -> (pitch, yaw, rol } @(require_results) -euler_angles_xyz_from_quaternion_f32 :: proc(q: Quaternionf32) -> (t1, t2, t3: f32) { +euler_angles_xyz_from_quaternion_f32 :: proc "contextless" (q: Quaternionf32) -> (t1, t2, t3: f32) { return euler_angles_xyz_from_matrix4(matrix4_from_quaternion(q)) } @(require_results) -euler_angles_yxz_from_quaternion_f32 :: proc(q: Quaternionf32) -> (t1, t2, t3: f32) { +euler_angles_yxz_from_quaternion_f32 :: proc "contextless" (q: Quaternionf32) -> (t1, t2, t3: f32) { return euler_angles_yxz_from_matrix4(matrix4_from_quaternion(q)) } @(require_results) -euler_angles_xzx_from_quaternion_f32 :: proc(q: Quaternionf32) -> (t1, t2, t3: f32) { +euler_angles_xzx_from_quaternion_f32 :: proc "contextless" (q: Quaternionf32) -> (t1, t2, t3: f32) { return euler_angles_xzx_from_matrix4(matrix4_from_quaternion(q)) } @(require_results) -euler_angles_xyx_from_quaternion_f32 :: proc(q: Quaternionf32) -> (t1, t2, t3: f32) { +euler_angles_xyx_from_quaternion_f32 :: proc "contextless" (q: Quaternionf32) -> (t1, t2, t3: f32) { return euler_angles_xyx_from_matrix4(matrix4_from_quaternion(q)) } @(require_results) -euler_angles_yxy_from_quaternion_f32 :: proc(q: Quaternionf32) -> (t1, t2, t3: f32) { +euler_angles_yxy_from_quaternion_f32 :: proc "contextless" (q: Quaternionf32) -> (t1, t2, t3: f32) { return euler_angles_yxy_from_matrix4(matrix4_from_quaternion(q)) } @(require_results) -euler_angles_yzy_from_quaternion_f32 :: proc(q: Quaternionf32) -> (t1, t2, t3: f32) { +euler_angles_yzy_from_quaternion_f32 :: proc "contextless" (q: Quaternionf32) -> (t1, t2, t3: f32) { return euler_angles_yzy_from_matrix4(matrix4_from_quaternion(q)) } @(require_results) -euler_angles_zyz_from_quaternion_f32 :: proc(q: Quaternionf32) -> (t1, t2, t3: f32) { +euler_angles_zyz_from_quaternion_f32 :: proc "contextless" (q: Quaternionf32) -> (t1, t2, t3: f32) { return euler_angles_zyz_from_matrix4(matrix4_from_quaternion(q)) } @(require_results) -euler_angles_zxz_from_quaternion_f32 :: proc(q: Quaternionf32) -> (t1, t2, t3: f32) { +euler_angles_zxz_from_quaternion_f32 :: proc "contextless" (q: Quaternionf32) -> (t1, t2, t3: f32) { return euler_angles_zxz_from_matrix4(matrix4_from_quaternion(q)) } @(require_results) -euler_angles_xzy_from_quaternion_f32 :: proc(q: Quaternionf32) -> (t1, t2, t3: f32) { +euler_angles_xzy_from_quaternion_f32 :: proc "contextless" (q: Quaternionf32) -> (t1, t2, t3: f32) { return euler_angles_xzy_from_matrix4(matrix4_from_quaternion(q)) } @(require_results) -euler_angles_yzx_from_quaternion_f32 :: proc(q: Quaternionf32) -> (t1, t2, t3: f32) { +euler_angles_yzx_from_quaternion_f32 :: proc "contextless" (q: Quaternionf32) -> (t1, t2, t3: f32) { return euler_angles_yzx_from_matrix4(matrix4_from_quaternion(q)) } @(require_results) -euler_angles_zyx_from_quaternion_f32 :: proc(q: Quaternionf32) -> (t1, t2, t3: f32) { +euler_angles_zyx_from_quaternion_f32 :: proc "contextless" (q: Quaternionf32) -> (t1, t2, t3: f32) { return euler_angles_zyx_from_matrix4(matrix4_from_quaternion(q)) } @(require_results) -euler_angles_zxy_from_quaternion_f32 :: proc(q: Quaternionf32) -> (t1, t2, t3: f32) { +euler_angles_zxy_from_quaternion_f32 :: proc "contextless" (q: Quaternionf32) -> (t1, t2, t3: f32) { return euler_angles_zxy_from_matrix4(matrix4_from_quaternion(q)) } @@ -237,7 +237,7 @@ euler_angles_zxy_from_quaternion_f32 :: proc(q: Quaternionf32) -> (t1, t2, t3: f @(require_results) -matrix3_from_euler_angle_x_f32 :: proc(angle_x: f32) -> (m: Matrix3f32) { +matrix3_from_euler_angle_x_f32 :: proc "contextless" (angle_x: f32) -> (m: Matrix3f32) { cos_x, sin_x := math.cos(angle_x), math.sin(angle_x) m[0, 0] = 1 m[1, 1] = +cos_x @@ -247,7 +247,7 @@ matrix3_from_euler_angle_x_f32 :: proc(angle_x: f32) -> (m: Matrix3f32) { return } @(require_results) -matrix3_from_euler_angle_y_f32 :: proc(angle_y: f32) -> (m: Matrix3f32) { +matrix3_from_euler_angle_y_f32 :: proc "contextless" (angle_y: f32) -> (m: Matrix3f32) { cos_y, sin_y := math.cos(angle_y), math.sin(angle_y) m[0, 0] = +cos_y m[0, 2] = -sin_y @@ -257,7 +257,7 @@ matrix3_from_euler_angle_y_f32 :: proc(angle_y: f32) -> (m: Matrix3f32) { return } @(require_results) -matrix3_from_euler_angle_z_f32 :: proc(angle_z: f32) -> (m: Matrix3f32) { +matrix3_from_euler_angle_z_f32 :: proc "contextless" (angle_z: f32) -> (m: Matrix3f32) { cos_z, sin_z := math.cos(angle_z), math.sin(angle_z) m[0, 0] = +cos_z m[0, 1] = +sin_z @@ -269,7 +269,7 @@ matrix3_from_euler_angle_z_f32 :: proc(angle_z: f32) -> (m: Matrix3f32) { @(require_results) -matrix3_from_derived_euler_angle_x_f32 :: proc(angle_x: f32, angular_velocity_x: f32) -> (m: Matrix3f32) { +matrix3_from_derived_euler_angle_x_f32 :: proc "contextless" (angle_x: f32, angular_velocity_x: f32) -> (m: Matrix3f32) { cos_x := math.cos(angle_x) * angular_velocity_x sin_x := math.sin(angle_x) * angular_velocity_x m[0, 0] = 1 @@ -280,7 +280,7 @@ matrix3_from_derived_euler_angle_x_f32 :: proc(angle_x: f32, angular_velocity_x: return } @(require_results) -matrix3_from_derived_euler_angle_y_f32 :: proc(angle_y: f32, angular_velocity_y: f32) -> (m: Matrix3f32) { +matrix3_from_derived_euler_angle_y_f32 :: proc "contextless" (angle_y: f32, angular_velocity_y: f32) -> (m: Matrix3f32) { cos_y := math.cos(angle_y) * angular_velocity_y sin_y := math.sin(angle_y) * angular_velocity_y m[0, 0] = +cos_y @@ -291,7 +291,7 @@ matrix3_from_derived_euler_angle_y_f32 :: proc(angle_y: f32, angular_velocity_y: return } @(require_results) -matrix3_from_derived_euler_angle_z_f32 :: proc(angle_z: f32, angular_velocity_z: f32) -> (m: Matrix3f32) { +matrix3_from_derived_euler_angle_z_f32 :: proc "contextless" (angle_z: f32, angular_velocity_z: f32) -> (m: Matrix3f32) { cos_z := math.cos(angle_z) * angular_velocity_z sin_z := math.sin(angle_z) * angular_velocity_z m[0, 0] = +cos_z @@ -304,7 +304,7 @@ matrix3_from_derived_euler_angle_z_f32 :: proc(angle_z: f32, angular_velocity_z: @(require_results) -matrix3_from_euler_angles_xy_f32 :: proc(angle_x, angle_y: f32) -> (m: Matrix3f32) { +matrix3_from_euler_angles_xy_f32 :: proc "contextless" (angle_x, angle_y: f32) -> (m: Matrix3f32) { cos_x, sin_x := math.cos(angle_x), math.sin(angle_x) cos_y, sin_y := math.cos(angle_y), math.sin(angle_y) m[0, 0] = cos_y @@ -320,7 +320,7 @@ matrix3_from_euler_angles_xy_f32 :: proc(angle_x, angle_y: f32) -> (m: Matrix3f3 @(require_results) -matrix3_from_euler_angles_yx_f32 :: proc(angle_y, angle_x: f32) -> (m: Matrix3f32) { +matrix3_from_euler_angles_yx_f32 :: proc "contextless" (angle_y, angle_x: f32) -> (m: Matrix3f32) { cos_x, sin_x := math.cos(angle_x), math.sin(angle_x) cos_y, sin_y := math.cos(angle_y), math.sin(angle_y) m[0, 0] = cos_y @@ -335,25 +335,25 @@ matrix3_from_euler_angles_yx_f32 :: proc(angle_y, angle_x: f32) -> (m: Matrix3f3 } @(require_results) -matrix3_from_euler_angles_xz_f32 :: proc(angle_x, angle_z: f32) -> (m: Matrix3f32) { +matrix3_from_euler_angles_xz_f32 :: proc "contextless" (angle_x, angle_z: f32) -> (m: Matrix3f32) { return mul(matrix3_from_euler_angle_x(angle_x), matrix3_from_euler_angle_z(angle_z)) } @(require_results) -matrix3_from_euler_angles_zx_f32 :: proc(angle_z, angle_x: f32) -> (m: Matrix3f32) { +matrix3_from_euler_angles_zx_f32 :: proc "contextless" (angle_z, angle_x: f32) -> (m: Matrix3f32) { return mul(matrix3_from_euler_angle_z(angle_z), matrix3_from_euler_angle_x(angle_x)) } @(require_results) -matrix3_from_euler_angles_yz_f32 :: proc(angle_y, angle_z: f32) -> (m: Matrix3f32) { +matrix3_from_euler_angles_yz_f32 :: proc "contextless" (angle_y, angle_z: f32) -> (m: Matrix3f32) { return mul(matrix3_from_euler_angle_y(angle_y), matrix3_from_euler_angle_z(angle_z)) } @(require_results) -matrix3_from_euler_angles_zy_f32 :: proc(angle_z, angle_y: f32) -> (m: Matrix3f32) { +matrix3_from_euler_angles_zy_f32 :: proc "contextless" (angle_z, angle_y: f32) -> (m: Matrix3f32) { return mul(matrix3_from_euler_angle_z(angle_z), matrix3_from_euler_angle_y(angle_y)) } @(require_results) -matrix3_from_euler_angles_xyz_f32 :: proc(t1, t2, t3: f32) -> (m: Matrix3f32) { +matrix3_from_euler_angles_xyz_f32 :: proc "contextless" (t1, t2, t3: f32) -> (m: Matrix3f32) { c1 := math.cos(-t1) c2 := math.cos(-t2) c3 := math.cos(-t3) @@ -374,7 +374,7 @@ matrix3_from_euler_angles_xyz_f32 :: proc(t1, t2, t3: f32) -> (m: Matrix3f32) { } @(require_results) -matrix3_from_euler_angles_yxz_f32 :: proc(yaw, pitch, roll: f32) -> (m: Matrix3f32) { +matrix3_from_euler_angles_yxz_f32 :: proc "contextless" (yaw, pitch, roll: f32) -> (m: Matrix3f32) { ch := math.cos(yaw) sh := math.sin(yaw) cp := math.cos(pitch) @@ -395,7 +395,7 @@ matrix3_from_euler_angles_yxz_f32 :: proc(yaw, pitch, roll: f32) -> (m: Matrix3f } @(require_results) -matrix3_from_euler_angles_xzx_f32 :: proc(t1, t2, t3: f32) -> (m: Matrix3f32) { +matrix3_from_euler_angles_xzx_f32 :: proc "contextless" (t1, t2, t3: f32) -> (m: Matrix3f32) { c1 := math.cos(t1) s1 := math.sin(t1) c2 := math.cos(t2) @@ -416,7 +416,7 @@ matrix3_from_euler_angles_xzx_f32 :: proc(t1, t2, t3: f32) -> (m: Matrix3f32) { } @(require_results) -matrix3_from_euler_angles_xyx_f32 :: proc(t1, t2, t3: f32) -> (m: Matrix3f32) { +matrix3_from_euler_angles_xyx_f32 :: proc "contextless" (t1, t2, t3: f32) -> (m: Matrix3f32) { c1 := math.cos(t1) s1 := math.sin(t1) c2 := math.cos(t2) @@ -437,7 +437,7 @@ matrix3_from_euler_angles_xyx_f32 :: proc(t1, t2, t3: f32) -> (m: Matrix3f32) { } @(require_results) -matrix3_from_euler_angles_yxy_f32 :: proc(t1, t2, t3: f32) -> (m: Matrix3f32) { +matrix3_from_euler_angles_yxy_f32 :: proc "contextless" (t1, t2, t3: f32) -> (m: Matrix3f32) { c1 := math.cos(t1) s1 := math.sin(t1) c2 := math.cos(t2) @@ -458,7 +458,7 @@ matrix3_from_euler_angles_yxy_f32 :: proc(t1, t2, t3: f32) -> (m: Matrix3f32) { } @(require_results) -matrix3_from_euler_angles_yzy_f32 :: proc(t1, t2, t3: f32) -> (m: Matrix3f32) { +matrix3_from_euler_angles_yzy_f32 :: proc "contextless" (t1, t2, t3: f32) -> (m: Matrix3f32) { c1 := math.cos(t1) s1 := math.sin(t1) c2 := math.cos(t2) @@ -479,7 +479,7 @@ matrix3_from_euler_angles_yzy_f32 :: proc(t1, t2, t3: f32) -> (m: Matrix3f32) { } @(require_results) -matrix3_from_euler_angles_zyz_f32 :: proc(t1, t2, t3: f32) -> (m: Matrix3f32) { +matrix3_from_euler_angles_zyz_f32 :: proc "contextless" (t1, t2, t3: f32) -> (m: Matrix3f32) { c1 := math.cos(t1) s1 := math.sin(t1) c2 := math.cos(t2) @@ -500,7 +500,7 @@ matrix3_from_euler_angles_zyz_f32 :: proc(t1, t2, t3: f32) -> (m: Matrix3f32) { } @(require_results) -matrix3_from_euler_angles_zxz_f32 :: proc(t1, t2, t3: f32) -> (m: Matrix3f32) { +matrix3_from_euler_angles_zxz_f32 :: proc "contextless" (t1, t2, t3: f32) -> (m: Matrix3f32) { c1 := math.cos(t1) s1 := math.sin(t1) c2 := math.cos(t2) @@ -522,7 +522,7 @@ matrix3_from_euler_angles_zxz_f32 :: proc(t1, t2, t3: f32) -> (m: Matrix3f32) { @(require_results) -matrix3_from_euler_angles_xzy_f32 :: proc(t1, t2, t3: f32) -> (m: Matrix3f32) { +matrix3_from_euler_angles_xzy_f32 :: proc "contextless" (t1, t2, t3: f32) -> (m: Matrix3f32) { c1 := math.cos(t1) s1 := math.sin(t1) c2 := math.cos(t2) @@ -543,7 +543,7 @@ matrix3_from_euler_angles_xzy_f32 :: proc(t1, t2, t3: f32) -> (m: Matrix3f32) { } @(require_results) -matrix3_from_euler_angles_yzx_f32 :: proc(t1, t2, t3: f32) -> (m: Matrix3f32) { +matrix3_from_euler_angles_yzx_f32 :: proc "contextless" (t1, t2, t3: f32) -> (m: Matrix3f32) { c1 := math.cos(t1) s1 := math.sin(t1) c2 := math.cos(t2) @@ -564,7 +564,7 @@ matrix3_from_euler_angles_yzx_f32 :: proc(t1, t2, t3: f32) -> (m: Matrix3f32) { } @(require_results) -matrix3_from_euler_angles_zyx_f32 :: proc(t1, t2, t3: f32) -> (m: Matrix3f32) { +matrix3_from_euler_angles_zyx_f32 :: proc "contextless" (t1, t2, t3: f32) -> (m: Matrix3f32) { c1 := math.cos(t1) s1 := math.sin(t1) c2 := math.cos(t2) @@ -585,7 +585,7 @@ matrix3_from_euler_angles_zyx_f32 :: proc(t1, t2, t3: f32) -> (m: Matrix3f32) { } @(require_results) -matrix3_from_euler_angles_zxy_f32 :: proc(t1, t2, t3: f32) -> (m: Matrix3f32) { +matrix3_from_euler_angles_zxy_f32 :: proc "contextless" (t1, t2, t3: f32) -> (m: Matrix3f32) { c1 := math.cos(t1) s1 := math.sin(t1) c2 := math.cos(t2) @@ -607,7 +607,7 @@ matrix3_from_euler_angles_zxy_f32 :: proc(t1, t2, t3: f32) -> (m: Matrix3f32) { @(require_results) -matrix3_from_yaw_pitch_roll_f32 :: proc(yaw, pitch, roll: f32) -> (m: Matrix3f32) { +matrix3_from_yaw_pitch_roll_f32 :: proc "contextless" (yaw, pitch, roll: f32) -> (m: Matrix3f32) { ch := math.cos(yaw) sh := math.sin(yaw) cp := math.cos(pitch) @@ -628,7 +628,7 @@ matrix3_from_yaw_pitch_roll_f32 :: proc(yaw, pitch, roll: f32) -> (m: Matrix3f32 } @(require_results) -euler_angles_xyz_from_matrix3_f32 :: proc(m: Matrix3f32) -> (t1, t2, t3: f32) { +euler_angles_xyz_from_matrix3_f32 :: proc "contextless" (m: Matrix3f32) -> (t1, t2, t3: f32) { T1 := math.atan2(m[1, 2], m[2, 2]) C2 := math.sqrt(m[0, 0]*m[0, 0] + m[0, 1]*m[0, 1]) T2 := math.atan2(-m[0, 2], C2) @@ -642,7 +642,7 @@ euler_angles_xyz_from_matrix3_f32 :: proc(m: Matrix3f32) -> (t1, t2, t3: f32) { } @(require_results) -euler_angles_yxz_from_matrix3_f32 :: proc(m: Matrix3f32) -> (t1, t2, t3: f32) { +euler_angles_yxz_from_matrix3_f32 :: proc "contextless" (m: Matrix3f32) -> (t1, t2, t3: f32) { T1 := math.atan2(m[0, 2], m[2, 2]) C2 := math.sqrt(m[1, 0]*m[1, 0] + m[1, 1]*m[1, 1]) T2 := math.atan2(-m[1, 2], C2) @@ -656,7 +656,7 @@ euler_angles_yxz_from_matrix3_f32 :: proc(m: Matrix3f32) -> (t1, t2, t3: f32) { } @(require_results) -euler_angles_xzx_from_matrix3_f32 :: proc(m: Matrix3f32) -> (t1, t2, t3: f32) { +euler_angles_xzx_from_matrix3_f32 :: proc "contextless" (m: Matrix3f32) -> (t1, t2, t3: f32) { T1 := math.atan2(m[2, 0], m[1, 0]) S2 := math.sqrt(m[0, 1]*m[0, 1] + m[0, 2]*m[0, 2]) T2 := math.atan2(S2, m[0, 0]) @@ -670,7 +670,7 @@ euler_angles_xzx_from_matrix3_f32 :: proc(m: Matrix3f32) -> (t1, t2, t3: f32) { } @(require_results) -euler_angles_xyx_from_matrix3_f32 :: proc(m: Matrix3f32) -> (t1, t2, t3: f32) { +euler_angles_xyx_from_matrix3_f32 :: proc "contextless" (m: Matrix3f32) -> (t1, t2, t3: f32) { T1 := math.atan2(m[1, 0], -m[2, 0]) S2 := math.sqrt(m[0, 1]*m[0, 1] + m[0, 2]*m[0, 2]) T2 := math.atan2(S2, m[0, 0]) @@ -684,7 +684,7 @@ euler_angles_xyx_from_matrix3_f32 :: proc(m: Matrix3f32) -> (t1, t2, t3: f32) { } @(require_results) -euler_angles_yxy_from_matrix3_f32 :: proc(m: Matrix3f32) -> (t1, t2, t3: f32) { +euler_angles_yxy_from_matrix3_f32 :: proc "contextless" (m: Matrix3f32) -> (t1, t2, t3: f32) { T1 := math.atan2(m[0, 1], m[2, 1]) S2 := math.sqrt(m[1, 0]*m[1, 0] + m[1, 2]*m[1, 2]) T2 := math.atan2(S2, m[1, 1]) @@ -698,7 +698,7 @@ euler_angles_yxy_from_matrix3_f32 :: proc(m: Matrix3f32) -> (t1, t2, t3: f32) { } @(require_results) -euler_angles_yzy_from_matrix3_f32 :: proc(m: Matrix3f32) -> (t1, t2, t3: f32) { +euler_angles_yzy_from_matrix3_f32 :: proc "contextless" (m: Matrix3f32) -> (t1, t2, t3: f32) { T1 := math.atan2(m[2, 1], -m[0, 1]) S2 := math.sqrt(m[1, 0]*m[1, 0] + m[1, 2]*m[1, 2]) T2 := math.atan2(S2, m[1, 1]) @@ -711,7 +711,7 @@ euler_angles_yzy_from_matrix3_f32 :: proc(m: Matrix3f32) -> (t1, t2, t3: f32) { return } @(require_results) -euler_angles_zyz_from_matrix3_f32 :: proc(m: Matrix3f32) -> (t1, t2, t3: f32) { +euler_angles_zyz_from_matrix3_f32 :: proc "contextless" (m: Matrix3f32) -> (t1, t2, t3: f32) { T1 := math.atan2(m[1, 2], m[0, 2]) S2 := math.sqrt(m[2, 0]*m[2, 0] + m[2, 1]*m[2, 1]) T2 := math.atan2(S2, m[2, 2]) @@ -725,7 +725,7 @@ euler_angles_zyz_from_matrix3_f32 :: proc(m: Matrix3f32) -> (t1, t2, t3: f32) { } @(require_results) -euler_angles_zxz_from_matrix3_f32 :: proc(m: Matrix3f32) -> (t1, t2, t3: f32) { +euler_angles_zxz_from_matrix3_f32 :: proc "contextless" (m: Matrix3f32) -> (t1, t2, t3: f32) { T1 := math.atan2(m[0, 2], -m[1, 2]) S2 := math.sqrt(m[2, 0]*m[2, 0] + m[2, 1]*m[2, 1]) T2 := math.atan2(S2, m[2, 2]) @@ -739,7 +739,7 @@ euler_angles_zxz_from_matrix3_f32 :: proc(m: Matrix3f32) -> (t1, t2, t3: f32) { } @(require_results) -euler_angles_xzy_from_matrix3_f32 :: proc(m: Matrix3f32) -> (t1, t2, t3: f32) { +euler_angles_xzy_from_matrix3_f32 :: proc "contextless" (m: Matrix3f32) -> (t1, t2, t3: f32) { T1 := math.atan2(m[2, 1], m[1, 1]) C2 := math.sqrt(m[0, 0]*m[0, 0] + m[0, 2]*m[0, 2]) T2 := math.atan2(-m[0, 1], C2) @@ -753,7 +753,7 @@ euler_angles_xzy_from_matrix3_f32 :: proc(m: Matrix3f32) -> (t1, t2, t3: f32) { } @(require_results) -euler_angles_yzx_from_matrix3_f32 :: proc(m: Matrix3f32) -> (t1, t2, t3: f32) { +euler_angles_yzx_from_matrix3_f32 :: proc "contextless" (m: Matrix3f32) -> (t1, t2, t3: f32) { T1 := math.atan2(-m[2, 0], m[0, 0]) C2 := math.sqrt(m[1, 1]*m[1, 1] + m[1, 2]*m[1, 2]) T2 := math.atan2(m[1, 0], C2) @@ -767,7 +767,7 @@ euler_angles_yzx_from_matrix3_f32 :: proc(m: Matrix3f32) -> (t1, t2, t3: f32) { } @(require_results) -euler_angles_zyx_from_matrix3_f32 :: proc(m: Matrix3f32) -> (t1, t2, t3: f32) { +euler_angles_zyx_from_matrix3_f32 :: proc "contextless" (m: Matrix3f32) -> (t1, t2, t3: f32) { T1 := math.atan2(m[1, 0], m[0, 0]) C2 := math.sqrt(m[2, 1]*m[2, 1] + m[2, 2]*m[2, 2]) T2 := math.atan2(-m[2, 0], C2) @@ -781,7 +781,7 @@ euler_angles_zyx_from_matrix3_f32 :: proc(m: Matrix3f32) -> (t1, t2, t3: f32) { } @(require_results) -euler_angles_zxy_from_matrix3_f32 :: proc(m: Matrix3f32) -> (t1, t2, t3: f32) { +euler_angles_zxy_from_matrix3_f32 :: proc "contextless" (m: Matrix3f32) -> (t1, t2, t3: f32) { T1 := math.atan2(-m[0, 1], m[1, 1]) C2 := math.sqrt(m[2, 0]*m[2, 0] + m[2, 2]*m[2, 2]) T2 := math.atan2(m[2, 1], C2) @@ -799,7 +799,7 @@ euler_angles_zxy_from_matrix3_f32 :: proc(m: Matrix3f32) -> (t1, t2, t3: f32) { @(require_results) -matrix4_from_euler_angle_x_f32 :: proc(angle_x: f32) -> (m: Matrix4f32) { +matrix4_from_euler_angle_x_f32 :: proc "contextless" (angle_x: f32) -> (m: Matrix4f32) { cos_x, sin_x := math.cos(angle_x), math.sin(angle_x) m[0, 0] = 1 m[1, 1] = +cos_x @@ -810,7 +810,7 @@ matrix4_from_euler_angle_x_f32 :: proc(angle_x: f32) -> (m: Matrix4f32) { return } @(require_results) -matrix4_from_euler_angle_y_f32 :: proc(angle_y: f32) -> (m: Matrix4f32) { +matrix4_from_euler_angle_y_f32 :: proc "contextless" (angle_y: f32) -> (m: Matrix4f32) { cos_y, sin_y := math.cos(angle_y), math.sin(angle_y) m[0, 0] = +cos_y m[0, 2] = -sin_y @@ -821,7 +821,7 @@ matrix4_from_euler_angle_y_f32 :: proc(angle_y: f32) -> (m: Matrix4f32) { return } @(require_results) -matrix4_from_euler_angle_z_f32 :: proc(angle_z: f32) -> (m: Matrix4f32) { +matrix4_from_euler_angle_z_f32 :: proc "contextless" (angle_z: f32) -> (m: Matrix4f32) { cos_z, sin_z := math.cos(angle_z), math.sin(angle_z) m[0, 0] = +cos_z m[0, 1] = +sin_z @@ -834,7 +834,7 @@ matrix4_from_euler_angle_z_f32 :: proc(angle_z: f32) -> (m: Matrix4f32) { @(require_results) -matrix4_from_derived_euler_angle_x_f32 :: proc(angle_x: f32, angular_velocity_x: f32) -> (m: Matrix4f32) { +matrix4_from_derived_euler_angle_x_f32 :: proc "contextless" (angle_x: f32, angular_velocity_x: f32) -> (m: Matrix4f32) { cos_x := math.cos(angle_x) * angular_velocity_x sin_x := math.sin(angle_x) * angular_velocity_x m[0, 0] = 1 @@ -846,7 +846,7 @@ matrix4_from_derived_euler_angle_x_f32 :: proc(angle_x: f32, angular_velocity_x: return } @(require_results) -matrix4_from_derived_euler_angle_y_f32 :: proc(angle_y: f32, angular_velocity_y: f32) -> (m: Matrix4f32) { +matrix4_from_derived_euler_angle_y_f32 :: proc "contextless" (angle_y: f32, angular_velocity_y: f32) -> (m: Matrix4f32) { cos_y := math.cos(angle_y) * angular_velocity_y sin_y := math.sin(angle_y) * angular_velocity_y m[0, 0] = +cos_y @@ -858,7 +858,7 @@ matrix4_from_derived_euler_angle_y_f32 :: proc(angle_y: f32, angular_velocity_y: return } @(require_results) -matrix4_from_derived_euler_angle_z_f32 :: proc(angle_z: f32, angular_velocity_z: f32) -> (m: Matrix4f32) { +matrix4_from_derived_euler_angle_z_f32 :: proc "contextless" (angle_z: f32, angular_velocity_z: f32) -> (m: Matrix4f32) { cos_z := math.cos(angle_z) * angular_velocity_z sin_z := math.sin(angle_z) * angular_velocity_z m[0, 0] = +cos_z @@ -872,7 +872,7 @@ matrix4_from_derived_euler_angle_z_f32 :: proc(angle_z: f32, angular_velocity_z: @(require_results) -matrix4_from_euler_angles_xy_f32 :: proc(angle_x, angle_y: f32) -> (m: Matrix4f32) { +matrix4_from_euler_angles_xy_f32 :: proc "contextless" (angle_x, angle_y: f32) -> (m: Matrix4f32) { cos_x, sin_x := math.cos(angle_x), math.sin(angle_x) cos_y, sin_y := math.cos(angle_y), math.sin(angle_y) m[0, 0] = cos_y @@ -889,7 +889,7 @@ matrix4_from_euler_angles_xy_f32 :: proc(angle_x, angle_y: f32) -> (m: Matrix4f3 @(require_results) -matrix4_from_euler_angles_yx_f32 :: proc(angle_y, angle_x: f32) -> (m: Matrix4f32) { +matrix4_from_euler_angles_yx_f32 :: proc "contextless" (angle_y, angle_x: f32) -> (m: Matrix4f32) { cos_x, sin_x := math.cos(angle_x), math.sin(angle_x) cos_y, sin_y := math.cos(angle_y), math.sin(angle_y) m[0, 0] = cos_y @@ -905,25 +905,25 @@ matrix4_from_euler_angles_yx_f32 :: proc(angle_y, angle_x: f32) -> (m: Matrix4f3 } @(require_results) -matrix4_from_euler_angles_xz_f32 :: proc(angle_x, angle_z: f32) -> (m: Matrix4f32) { +matrix4_from_euler_angles_xz_f32 :: proc "contextless" (angle_x, angle_z: f32) -> (m: Matrix4f32) { return mul(matrix4_from_euler_angle_x(angle_x), matrix4_from_euler_angle_z(angle_z)) } @(require_results) -matrix4_from_euler_angles_zx_f32 :: proc(angle_z, angle_x: f32) -> (m: Matrix4f32) { +matrix4_from_euler_angles_zx_f32 :: proc "contextless" (angle_z, angle_x: f32) -> (m: Matrix4f32) { return mul(matrix4_from_euler_angle_z(angle_z), matrix4_from_euler_angle_x(angle_x)) } @(require_results) -matrix4_from_euler_angles_yz_f32 :: proc(angle_y, angle_z: f32) -> (m: Matrix4f32) { +matrix4_from_euler_angles_yz_f32 :: proc "contextless" (angle_y, angle_z: f32) -> (m: Matrix4f32) { return mul(matrix4_from_euler_angle_y(angle_y), matrix4_from_euler_angle_z(angle_z)) } @(require_results) -matrix4_from_euler_angles_zy_f32 :: proc(angle_z, angle_y: f32) -> (m: Matrix4f32) { +matrix4_from_euler_angles_zy_f32 :: proc "contextless" (angle_z, angle_y: f32) -> (m: Matrix4f32) { return mul(matrix4_from_euler_angle_z(angle_z), matrix4_from_euler_angle_y(angle_y)) } @(require_results) -matrix4_from_euler_angles_xyz_f32 :: proc(t1, t2, t3: f32) -> (m: Matrix4f32) { +matrix4_from_euler_angles_xyz_f32 :: proc "contextless" (t1, t2, t3: f32) -> (m: Matrix4f32) { c1 := math.cos(-t1) c2 := math.cos(-t2) c3 := math.cos(-t3) @@ -951,7 +951,7 @@ matrix4_from_euler_angles_xyz_f32 :: proc(t1, t2, t3: f32) -> (m: Matrix4f32) { } @(require_results) -matrix4_from_euler_angles_yxz_f32 :: proc(yaw, pitch, roll: f32) -> (m: Matrix4f32) { +matrix4_from_euler_angles_yxz_f32 :: proc "contextless" (yaw, pitch, roll: f32) -> (m: Matrix4f32) { ch := math.cos(yaw) sh := math.sin(yaw) cp := math.cos(pitch) @@ -979,7 +979,7 @@ matrix4_from_euler_angles_yxz_f32 :: proc(yaw, pitch, roll: f32) -> (m: Matrix4f } @(require_results) -matrix4_from_euler_angles_xzx_f32 :: proc(t1, t2, t3: f32) -> (m: Matrix4f32) { +matrix4_from_euler_angles_xzx_f32 :: proc "contextless" (t1, t2, t3: f32) -> (m: Matrix4f32) { c1 := math.cos(t1) s1 := math.sin(t1) c2 := math.cos(t2) @@ -1007,7 +1007,7 @@ matrix4_from_euler_angles_xzx_f32 :: proc(t1, t2, t3: f32) -> (m: Matrix4f32) { } @(require_results) -matrix4_from_euler_angles_xyx_f32 :: proc(t1, t2, t3: f32) -> (m: Matrix4f32) { +matrix4_from_euler_angles_xyx_f32 :: proc "contextless" (t1, t2, t3: f32) -> (m: Matrix4f32) { c1 := math.cos(t1) s1 := math.sin(t1) c2 := math.cos(t2) @@ -1035,7 +1035,7 @@ matrix4_from_euler_angles_xyx_f32 :: proc(t1, t2, t3: f32) -> (m: Matrix4f32) { } @(require_results) -matrix4_from_euler_angles_yxy_f32 :: proc(t1, t2, t3: f32) -> (m: Matrix4f32) { +matrix4_from_euler_angles_yxy_f32 :: proc "contextless" (t1, t2, t3: f32) -> (m: Matrix4f32) { c1 := math.cos(t1) s1 := math.sin(t1) c2 := math.cos(t2) @@ -1063,7 +1063,7 @@ matrix4_from_euler_angles_yxy_f32 :: proc(t1, t2, t3: f32) -> (m: Matrix4f32) { } @(require_results) -matrix4_from_euler_angles_yzy_f32 :: proc(t1, t2, t3: f32) -> (m: Matrix4f32) { +matrix4_from_euler_angles_yzy_f32 :: proc "contextless" (t1, t2, t3: f32) -> (m: Matrix4f32) { c1 := math.cos(t1) s1 := math.sin(t1) c2 := math.cos(t2) @@ -1091,7 +1091,7 @@ matrix4_from_euler_angles_yzy_f32 :: proc(t1, t2, t3: f32) -> (m: Matrix4f32) { } @(require_results) -matrix4_from_euler_angles_zyz_f32 :: proc(t1, t2, t3: f32) -> (m: Matrix4f32) { +matrix4_from_euler_angles_zyz_f32 :: proc "contextless" (t1, t2, t3: f32) -> (m: Matrix4f32) { c1 := math.cos(t1) s1 := math.sin(t1) c2 := math.cos(t2) @@ -1119,7 +1119,7 @@ matrix4_from_euler_angles_zyz_f32 :: proc(t1, t2, t3: f32) -> (m: Matrix4f32) { } @(require_results) -matrix4_from_euler_angles_zxz_f32 :: proc(t1, t2, t3: f32) -> (m: Matrix4f32) { +matrix4_from_euler_angles_zxz_f32 :: proc "contextless" (t1, t2, t3: f32) -> (m: Matrix4f32) { c1 := math.cos(t1) s1 := math.sin(t1) c2 := math.cos(t2) @@ -1148,7 +1148,7 @@ matrix4_from_euler_angles_zxz_f32 :: proc(t1, t2, t3: f32) -> (m: Matrix4f32) { @(require_results) -matrix4_from_euler_angles_xzy_f32 :: proc(t1, t2, t3: f32) -> (m: Matrix4f32) { +matrix4_from_euler_angles_xzy_f32 :: proc "contextless" (t1, t2, t3: f32) -> (m: Matrix4f32) { c1 := math.cos(t1) s1 := math.sin(t1) c2 := math.cos(t2) @@ -1176,7 +1176,7 @@ matrix4_from_euler_angles_xzy_f32 :: proc(t1, t2, t3: f32) -> (m: Matrix4f32) { } @(require_results) -matrix4_from_euler_angles_yzx_f32 :: proc(t1, t2, t3: f32) -> (m: Matrix4f32) { +matrix4_from_euler_angles_yzx_f32 :: proc "contextless" (t1, t2, t3: f32) -> (m: Matrix4f32) { c1 := math.cos(t1) s1 := math.sin(t1) c2 := math.cos(t2) @@ -1204,7 +1204,7 @@ matrix4_from_euler_angles_yzx_f32 :: proc(t1, t2, t3: f32) -> (m: Matrix4f32) { } @(require_results) -matrix4_from_euler_angles_zyx_f32 :: proc(t1, t2, t3: f32) -> (m: Matrix4f32) { +matrix4_from_euler_angles_zyx_f32 :: proc "contextless" (t1, t2, t3: f32) -> (m: Matrix4f32) { c1 := math.cos(t1) s1 := math.sin(t1) c2 := math.cos(t2) @@ -1232,7 +1232,7 @@ matrix4_from_euler_angles_zyx_f32 :: proc(t1, t2, t3: f32) -> (m: Matrix4f32) { } @(require_results) -matrix4_from_euler_angles_zxy_f32 :: proc(t1, t2, t3: f32) -> (m: Matrix4f32) { +matrix4_from_euler_angles_zxy_f32 :: proc "contextless" (t1, t2, t3: f32) -> (m: Matrix4f32) { c1 := math.cos(t1) s1 := math.sin(t1) c2 := math.cos(t2) @@ -1261,7 +1261,7 @@ matrix4_from_euler_angles_zxy_f32 :: proc(t1, t2, t3: f32) -> (m: Matrix4f32) { @(require_results) -matrix4_from_yaw_pitch_roll_f32 :: proc(yaw, pitch, roll: f32) -> (m: Matrix4f32) { +matrix4_from_yaw_pitch_roll_f32 :: proc "contextless" (yaw, pitch, roll: f32) -> (m: Matrix4f32) { ch := math.cos(yaw) sh := math.sin(yaw) cp := math.cos(pitch) @@ -1289,7 +1289,7 @@ matrix4_from_yaw_pitch_roll_f32 :: proc(yaw, pitch, roll: f32) -> (m: Matrix4f32 } @(require_results) -euler_angles_xyz_from_matrix4_f32 :: proc(m: Matrix4f32) -> (t1, t2, t3: f32) { +euler_angles_xyz_from_matrix4_f32 :: proc "contextless" (m: Matrix4f32) -> (t1, t2, t3: f32) { T1 := math.atan2(m[1, 2], m[2, 2]) C2 := math.sqrt(m[0, 0]*m[0, 0] + m[0, 1]*m[0, 1]) T2 := math.atan2(-m[0, 2], C2) @@ -1303,7 +1303,7 @@ euler_angles_xyz_from_matrix4_f32 :: proc(m: Matrix4f32) -> (t1, t2, t3: f32) { } @(require_results) -euler_angles_yxz_from_matrix4_f32 :: proc(m: Matrix4f32) -> (t1, t2, t3: f32) { +euler_angles_yxz_from_matrix4_f32 :: proc "contextless" (m: Matrix4f32) -> (t1, t2, t3: f32) { T1 := math.atan2(m[0, 2], m[2, 2]) C2 := math.sqrt(m[1, 0]*m[1, 0] + m[1, 1]*m[1, 1]) T2 := math.atan2(-m[1, 2], C2) @@ -1317,7 +1317,7 @@ euler_angles_yxz_from_matrix4_f32 :: proc(m: Matrix4f32) -> (t1, t2, t3: f32) { } @(require_results) -euler_angles_xzx_from_matrix4_f32 :: proc(m: Matrix4f32) -> (t1, t2, t3: f32) { +euler_angles_xzx_from_matrix4_f32 :: proc "contextless" (m: Matrix4f32) -> (t1, t2, t3: f32) { T1 := math.atan2(m[2, 0], m[1, 0]) S2 := math.sqrt(m[0, 1]*m[0, 1] + m[0, 2]*m[0, 2]) T2 := math.atan2(S2, m[0, 0]) @@ -1331,7 +1331,7 @@ euler_angles_xzx_from_matrix4_f32 :: proc(m: Matrix4f32) -> (t1, t2, t3: f32) { } @(require_results) -euler_angles_xyx_from_matrix4_f32 :: proc(m: Matrix4f32) -> (t1, t2, t3: f32) { +euler_angles_xyx_from_matrix4_f32 :: proc "contextless" (m: Matrix4f32) -> (t1, t2, t3: f32) { T1 := math.atan2(m[1, 0], -m[2, 0]) S2 := math.sqrt(m[0, 1]*m[0, 1] + m[0, 2]*m[0, 2]) T2 := math.atan2(S2, m[0, 0]) @@ -1345,7 +1345,7 @@ euler_angles_xyx_from_matrix4_f32 :: proc(m: Matrix4f32) -> (t1, t2, t3: f32) { } @(require_results) -euler_angles_yxy_from_matrix4_f32 :: proc(m: Matrix4f32) -> (t1, t2, t3: f32) { +euler_angles_yxy_from_matrix4_f32 :: proc "contextless" (m: Matrix4f32) -> (t1, t2, t3: f32) { T1 := math.atan2(m[0, 1], m[2, 1]) S2 := math.sqrt(m[1, 0]*m[1, 0] + m[1, 2]*m[1, 2]) T2 := math.atan2(S2, m[1, 1]) @@ -1359,7 +1359,7 @@ euler_angles_yxy_from_matrix4_f32 :: proc(m: Matrix4f32) -> (t1, t2, t3: f32) { } @(require_results) -euler_angles_yzy_from_matrix4_f32 :: proc(m: Matrix4f32) -> (t1, t2, t3: f32) { +euler_angles_yzy_from_matrix4_f32 :: proc "contextless" (m: Matrix4f32) -> (t1, t2, t3: f32) { T1 := math.atan2(m[2, 1], -m[0, 1]) S2 := math.sqrt(m[1, 0]*m[1, 0] + m[1, 2]*m[1, 2]) T2 := math.atan2(S2, m[1, 1]) @@ -1372,7 +1372,7 @@ euler_angles_yzy_from_matrix4_f32 :: proc(m: Matrix4f32) -> (t1, t2, t3: f32) { return } @(require_results) -euler_angles_zyz_from_matrix4_f32 :: proc(m: Matrix4f32) -> (t1, t2, t3: f32) { +euler_angles_zyz_from_matrix4_f32 :: proc "contextless" (m: Matrix4f32) -> (t1, t2, t3: f32) { T1 := math.atan2(m[1, 2], m[0, 2]) S2 := math.sqrt(m[2, 0]*m[2, 0] + m[2, 1]*m[2, 1]) T2 := math.atan2(S2, m[2, 2]) @@ -1386,7 +1386,7 @@ euler_angles_zyz_from_matrix4_f32 :: proc(m: Matrix4f32) -> (t1, t2, t3: f32) { } @(require_results) -euler_angles_zxz_from_matrix4_f32 :: proc(m: Matrix4f32) -> (t1, t2, t3: f32) { +euler_angles_zxz_from_matrix4_f32 :: proc "contextless" (m: Matrix4f32) -> (t1, t2, t3: f32) { T1 := math.atan2(m[0, 2], -m[1, 2]) S2 := math.sqrt(m[2, 0]*m[2, 0] + m[2, 1]*m[2, 1]) T2 := math.atan2(S2, m[2, 2]) @@ -1400,7 +1400,7 @@ euler_angles_zxz_from_matrix4_f32 :: proc(m: Matrix4f32) -> (t1, t2, t3: f32) { } @(require_results) -euler_angles_xzy_from_matrix4_f32 :: proc(m: Matrix4f32) -> (t1, t2, t3: f32) { +euler_angles_xzy_from_matrix4_f32 :: proc "contextless" (m: Matrix4f32) -> (t1, t2, t3: f32) { T1 := math.atan2(m[2, 1], m[1, 1]) C2 := math.sqrt(m[0, 0]*m[0, 0] + m[0, 2]*m[0, 2]) T2 := math.atan2(-m[0, 1], C2) @@ -1414,7 +1414,7 @@ euler_angles_xzy_from_matrix4_f32 :: proc(m: Matrix4f32) -> (t1, t2, t3: f32) { } @(require_results) -euler_angles_yzx_from_matrix4_f32 :: proc(m: Matrix4f32) -> (t1, t2, t3: f32) { +euler_angles_yzx_from_matrix4_f32 :: proc "contextless" (m: Matrix4f32) -> (t1, t2, t3: f32) { T1 := math.atan2(-m[2, 0], m[0, 0]) C2 := math.sqrt(m[1, 1]*m[1, 1] + m[1, 2]*m[1, 2]) T2 := math.atan2(m[1, 0], C2) @@ -1428,7 +1428,7 @@ euler_angles_yzx_from_matrix4_f32 :: proc(m: Matrix4f32) -> (t1, t2, t3: f32) { } @(require_results) -euler_angles_zyx_from_matrix4_f32 :: proc(m: Matrix4f32) -> (t1, t2, t3: f32) { +euler_angles_zyx_from_matrix4_f32 :: proc "contextless" (m: Matrix4f32) -> (t1, t2, t3: f32) { T1 := math.atan2(m[1, 0], m[0, 0]) C2 := math.sqrt(m[2, 1]*m[2, 1] + m[2, 2]*m[2, 2]) T2 := math.atan2(-m[2, 0], C2) @@ -1442,7 +1442,7 @@ euler_angles_zyx_from_matrix4_f32 :: proc(m: Matrix4f32) -> (t1, t2, t3: f32) { } @(require_results) -euler_angles_zxy_from_matrix4_f32 :: proc(m: Matrix4f32) -> (t1, t2, t3: f32) { +euler_angles_zxy_from_matrix4_f32 :: proc "contextless" (m: Matrix4f32) -> (t1, t2, t3: f32) { T1 := math.atan2(-m[0, 1], m[1, 1]) C2 := math.sqrt(m[2, 0]*m[2, 0] + m[2, 2]*m[2, 2]) T2 := math.atan2(m[2, 1], C2) diff --git a/core/math/linalg/specific_euler_angles_f64.odin b/core/math/linalg/specific_euler_angles_f64.odin index a97f1757d..8001d080a 100644 --- a/core/math/linalg/specific_euler_angles_f64.odin +++ b/core/math/linalg/specific_euler_angles_f64.odin @@ -3,7 +3,7 @@ package linalg import "core:math" @(require_results) -euler_angles_from_matrix3_f64 :: proc(m: Matrix3f64, order: Euler_Angle_Order) -> (t1, t2, t3: f64) { +euler_angles_from_matrix3_f64 :: proc "contextless" (m: Matrix3f64, order: Euler_Angle_Order) -> (t1, t2, t3: f64) { switch order { case .XYZ: t1, t2, t3 = euler_angles_xyz_from_matrix3(m) case .XZY: t1, t2, t3 = euler_angles_xzy_from_matrix3(m) @@ -21,7 +21,7 @@ euler_angles_from_matrix3_f64 :: proc(m: Matrix3f64, order: Euler_Angle_Order) - return } @(require_results) -euler_angles_from_matrix4_f64 :: proc(m: Matrix4f64, order: Euler_Angle_Order) -> (t1, t2, t3: f64) { +euler_angles_from_matrix4_f64 :: proc "contextless" (m: Matrix4f64, order: Euler_Angle_Order) -> (t1, t2, t3: f64) { switch order { case .XYZ: t1, t2, t3 = euler_angles_xyz_from_matrix4(m) case .XZY: t1, t2, t3 = euler_angles_xzy_from_matrix4(m) @@ -39,7 +39,7 @@ euler_angles_from_matrix4_f64 :: proc(m: Matrix4f64, order: Euler_Angle_Order) - return } @(require_results) -euler_angles_from_quaternion_f64 :: proc(m: Quaternionf64, order: Euler_Angle_Order) -> (t1, t2, t3: f64) { +euler_angles_from_quaternion_f64 :: proc "contextless" (m: Quaternionf64, order: Euler_Angle_Order) -> (t1, t2, t3: f64) { switch order { case .XYZ: t1, t2, t3 = euler_angles_xyz_from_quaternion(m) case .XZY: t1, t2, t3 = euler_angles_xzy_from_quaternion(m) @@ -58,7 +58,7 @@ euler_angles_from_quaternion_f64 :: proc(m: Quaternionf64, order: Euler_Angle_Or } @(require_results) -matrix3_from_euler_angles_f64 :: proc(t1, t2, t3: f64, order: Euler_Angle_Order) -> (m: Matrix3f64) { +matrix3_from_euler_angles_f64 :: proc "contextless" (t1, t2, t3: f64, order: Euler_Angle_Order) -> (m: Matrix3f64) { switch order { case .XYZ: return matrix3_from_euler_angles_xyz(t1, t2, t3) // m1, m2, m3 = X(t1), Y(t2), Z(t3); case .XZY: return matrix3_from_euler_angles_xzy(t1, t2, t3) // m1, m2, m3 = X(t1), Z(t2), Y(t3); @@ -76,7 +76,7 @@ matrix3_from_euler_angles_f64 :: proc(t1, t2, t3: f64, order: Euler_Angle_Order) return } @(require_results) -matrix4_from_euler_angles_f64 :: proc(t1, t2, t3: f64, order: Euler_Angle_Order) -> (m: Matrix4f64) { +matrix4_from_euler_angles_f64 :: proc "contextless" (t1, t2, t3: f64, order: Euler_Angle_Order) -> (m: Matrix4f64) { switch order { case .XYZ: return matrix4_from_euler_angles_xyz(t1, t2, t3) // m1, m2, m3 = X(t1), Y(t2), Z(t3); case .XZY: return matrix4_from_euler_angles_xzy(t1, t2, t3) // m1, m2, m3 = X(t1), Z(t2), Y(t3); @@ -95,7 +95,7 @@ matrix4_from_euler_angles_f64 :: proc(t1, t2, t3: f64, order: Euler_Angle_Order) } @(require_results) -quaternion_from_euler_angles_f64 :: proc(t1, t2, t3: f64, order: Euler_Angle_Order) -> Quaternionf64 { +quaternion_from_euler_angles_f64 :: proc "contextless" (t1, t2, t3: f64, order: Euler_Angle_Order) -> Quaternionf64 { X :: quaternion_from_euler_angle_x Y :: quaternion_from_euler_angle_y Z :: quaternion_from_euler_angle_z @@ -124,20 +124,20 @@ quaternion_from_euler_angles_f64 :: proc(t1, t2, t3: f64, order: Euler_Angle_Ord // Quaternionf64s @(require_results) -quaternion_from_euler_angle_x_f64 :: proc(angle_x: f64) -> (q: Quaternionf64) { +quaternion_from_euler_angle_x_f64 :: proc "contextless" (angle_x: f64) -> (q: Quaternionf64) { return quaternion_angle_axis_f64(angle_x, {1, 0, 0}) } @(require_results) -quaternion_from_euler_angle_y_f64 :: proc(angle_y: f64) -> (q: Quaternionf64) { +quaternion_from_euler_angle_y_f64 :: proc "contextless" (angle_y: f64) -> (q: Quaternionf64) { return quaternion_angle_axis_f64(angle_y, {0, 1, 0}) } @(require_results) -quaternion_from_euler_angle_z_f64 :: proc(angle_z: f64) -> (q: Quaternionf64) { +quaternion_from_euler_angle_z_f64 :: proc "contextless" (angle_z: f64) -> (q: Quaternionf64) { return quaternion_angle_axis_f64(angle_z, {0, 0, 1}) } @(require_results) -quaternion_from_pitch_yaw_roll_f64 :: proc(pitch, yaw, roll: f64) -> Quaternionf64 { +quaternion_from_pitch_yaw_roll_f64 :: proc "contextless" (pitch, yaw, roll: f64) -> Quaternionf64 { a, b, c := pitch, yaw, roll ca, sa := math.cos(a*0.5), math.sin(a*0.5) @@ -153,12 +153,12 @@ quaternion_from_pitch_yaw_roll_f64 :: proc(pitch, yaw, roll: f64) -> Quaternionf } @(require_results) -roll_from_quaternion_f64 :: proc(q: Quaternionf64) -> f64 { +roll_from_quaternion_f64 :: proc "contextless" (q: Quaternionf64) -> f64 { return math.atan2(2 * q.x*q.y + q.w*q.z, q.w*q.w + q.x*q.x - q.y*q.y - q.z*q.z) } @(require_results) -pitch_from_quaternion_f64 :: proc(q: Quaternionf64) -> f64 { +pitch_from_quaternion_f64 :: proc "contextless" (q: Quaternionf64) -> f64 { y := 2 * (q.y*q.z + q.w*q.w) x := q.w*q.w - q.x*q.x - q.y*q.y + q.z*q.z @@ -170,13 +170,13 @@ pitch_from_quaternion_f64 :: proc(q: Quaternionf64) -> f64 { } @(require_results) -yaw_from_quaternion_f64 :: proc(q: Quaternionf64) -> f64 { +yaw_from_quaternion_f64 :: proc "contextless" (q: Quaternionf64) -> f64 { return math.asin(clamp(-2 * (q.x*q.z - q.w*q.y), -1, 1)) } @(require_results) -pitch_yaw_roll_from_quaternion_f64 :: proc(q: Quaternionf64) -> (pitch, yaw, roll: f64) { +pitch_yaw_roll_from_quaternion_f64 :: proc "contextless" (q: Quaternionf64) -> (pitch, yaw, roll: f64) { pitch = pitch_from_quaternion(q) yaw = yaw_from_quaternion(q) roll = roll_from_quaternion(q) @@ -184,51 +184,51 @@ pitch_yaw_roll_from_quaternion_f64 :: proc(q: Quaternionf64) -> (pitch, yaw, rol } @(require_results) -euler_angles_xyz_from_quaternion_f64 :: proc(q: Quaternionf64) -> (t1, t2, t3: f64) { +euler_angles_xyz_from_quaternion_f64 :: proc "contextless" (q: Quaternionf64) -> (t1, t2, t3: f64) { return euler_angles_xyz_from_matrix4(matrix4_from_quaternion(q)) } @(require_results) -euler_angles_yxz_from_quaternion_f64 :: proc(q: Quaternionf64) -> (t1, t2, t3: f64) { +euler_angles_yxz_from_quaternion_f64 :: proc "contextless" (q: Quaternionf64) -> (t1, t2, t3: f64) { return euler_angles_yxz_from_matrix4(matrix4_from_quaternion(q)) } @(require_results) -euler_angles_xzx_from_quaternion_f64 :: proc(q: Quaternionf64) -> (t1, t2, t3: f64) { +euler_angles_xzx_from_quaternion_f64 :: proc "contextless" (q: Quaternionf64) -> (t1, t2, t3: f64) { return euler_angles_xzx_from_matrix4(matrix4_from_quaternion(q)) } @(require_results) -euler_angles_xyx_from_quaternion_f64 :: proc(q: Quaternionf64) -> (t1, t2, t3: f64) { +euler_angles_xyx_from_quaternion_f64 :: proc "contextless" (q: Quaternionf64) -> (t1, t2, t3: f64) { return euler_angles_xyx_from_matrix4(matrix4_from_quaternion(q)) } @(require_results) -euler_angles_yxy_from_quaternion_f64 :: proc(q: Quaternionf64) -> (t1, t2, t3: f64) { +euler_angles_yxy_from_quaternion_f64 :: proc "contextless" (q: Quaternionf64) -> (t1, t2, t3: f64) { return euler_angles_yxy_from_matrix4(matrix4_from_quaternion(q)) } @(require_results) -euler_angles_yzy_from_quaternion_f64 :: proc(q: Quaternionf64) -> (t1, t2, t3: f64) { +euler_angles_yzy_from_quaternion_f64 :: proc "contextless" (q: Quaternionf64) -> (t1, t2, t3: f64) { return euler_angles_yzy_from_matrix4(matrix4_from_quaternion(q)) } @(require_results) -euler_angles_zyz_from_quaternion_f64 :: proc(q: Quaternionf64) -> (t1, t2, t3: f64) { +euler_angles_zyz_from_quaternion_f64 :: proc "contextless" (q: Quaternionf64) -> (t1, t2, t3: f64) { return euler_angles_zyz_from_matrix4(matrix4_from_quaternion(q)) } @(require_results) -euler_angles_zxz_from_quaternion_f64 :: proc(q: Quaternionf64) -> (t1, t2, t3: f64) { +euler_angles_zxz_from_quaternion_f64 :: proc "contextless" (q: Quaternionf64) -> (t1, t2, t3: f64) { return euler_angles_zxz_from_matrix4(matrix4_from_quaternion(q)) } @(require_results) -euler_angles_xzy_from_quaternion_f64 :: proc(q: Quaternionf64) -> (t1, t2, t3: f64) { +euler_angles_xzy_from_quaternion_f64 :: proc "contextless" (q: Quaternionf64) -> (t1, t2, t3: f64) { return euler_angles_xzy_from_matrix4(matrix4_from_quaternion(q)) } @(require_results) -euler_angles_yzx_from_quaternion_f64 :: proc(q: Quaternionf64) -> (t1, t2, t3: f64) { +euler_angles_yzx_from_quaternion_f64 :: proc "contextless" (q: Quaternionf64) -> (t1, t2, t3: f64) { return euler_angles_yzx_from_matrix4(matrix4_from_quaternion(q)) } @(require_results) -euler_angles_zyx_from_quaternion_f64 :: proc(q: Quaternionf64) -> (t1, t2, t3: f64) { +euler_angles_zyx_from_quaternion_f64 :: proc "contextless" (q: Quaternionf64) -> (t1, t2, t3: f64) { return euler_angles_zyx_from_matrix4(matrix4_from_quaternion(q)) } @(require_results) -euler_angles_zxy_from_quaternion_f64 :: proc(q: Quaternionf64) -> (t1, t2, t3: f64) { +euler_angles_zxy_from_quaternion_f64 :: proc "contextless" (q: Quaternionf64) -> (t1, t2, t3: f64) { return euler_angles_zxy_from_matrix4(matrix4_from_quaternion(q)) } @@ -237,7 +237,7 @@ euler_angles_zxy_from_quaternion_f64 :: proc(q: Quaternionf64) -> (t1, t2, t3: f @(require_results) -matrix3_from_euler_angle_x_f64 :: proc(angle_x: f64) -> (m: Matrix3f64) { +matrix3_from_euler_angle_x_f64 :: proc "contextless" (angle_x: f64) -> (m: Matrix3f64) { cos_x, sin_x := math.cos(angle_x), math.sin(angle_x) m[0, 0] = 1 m[1, 1] = +cos_x @@ -247,7 +247,7 @@ matrix3_from_euler_angle_x_f64 :: proc(angle_x: f64) -> (m: Matrix3f64) { return } @(require_results) -matrix3_from_euler_angle_y_f64 :: proc(angle_y: f64) -> (m: Matrix3f64) { +matrix3_from_euler_angle_y_f64 :: proc "contextless" (angle_y: f64) -> (m: Matrix3f64) { cos_y, sin_y := math.cos(angle_y), math.sin(angle_y) m[0, 0] = +cos_y m[0, 2] = -sin_y @@ -257,7 +257,7 @@ matrix3_from_euler_angle_y_f64 :: proc(angle_y: f64) -> (m: Matrix3f64) { return } @(require_results) -matrix3_from_euler_angle_z_f64 :: proc(angle_z: f64) -> (m: Matrix3f64) { +matrix3_from_euler_angle_z_f64 :: proc "contextless" (angle_z: f64) -> (m: Matrix3f64) { cos_z, sin_z := math.cos(angle_z), math.sin(angle_z) m[0, 0] = +cos_z m[0, 1] = +sin_z @@ -269,7 +269,7 @@ matrix3_from_euler_angle_z_f64 :: proc(angle_z: f64) -> (m: Matrix3f64) { @(require_results) -matrix3_from_derived_euler_angle_x_f64 :: proc(angle_x: f64, angular_velocity_x: f64) -> (m: Matrix3f64) { +matrix3_from_derived_euler_angle_x_f64 :: proc "contextless" (angle_x: f64, angular_velocity_x: f64) -> (m: Matrix3f64) { cos_x := math.cos(angle_x) * angular_velocity_x sin_x := math.sin(angle_x) * angular_velocity_x m[0, 0] = 1 @@ -280,7 +280,7 @@ matrix3_from_derived_euler_angle_x_f64 :: proc(angle_x: f64, angular_velocity_x: return } @(require_results) -matrix3_from_derived_euler_angle_y_f64 :: proc(angle_y: f64, angular_velocity_y: f64) -> (m: Matrix3f64) { +matrix3_from_derived_euler_angle_y_f64 :: proc "contextless" (angle_y: f64, angular_velocity_y: f64) -> (m: Matrix3f64) { cos_y := math.cos(angle_y) * angular_velocity_y sin_y := math.sin(angle_y) * angular_velocity_y m[0, 0] = +cos_y @@ -291,7 +291,7 @@ matrix3_from_derived_euler_angle_y_f64 :: proc(angle_y: f64, angular_velocity_y: return } @(require_results) -matrix3_from_derived_euler_angle_z_f64 :: proc(angle_z: f64, angular_velocity_z: f64) -> (m: Matrix3f64) { +matrix3_from_derived_euler_angle_z_f64 :: proc "contextless" (angle_z: f64, angular_velocity_z: f64) -> (m: Matrix3f64) { cos_z := math.cos(angle_z) * angular_velocity_z sin_z := math.sin(angle_z) * angular_velocity_z m[0, 0] = +cos_z @@ -304,7 +304,7 @@ matrix3_from_derived_euler_angle_z_f64 :: proc(angle_z: f64, angular_velocity_z: @(require_results) -matrix3_from_euler_angles_xy_f64 :: proc(angle_x, angle_y: f64) -> (m: Matrix3f64) { +matrix3_from_euler_angles_xy_f64 :: proc "contextless" (angle_x, angle_y: f64) -> (m: Matrix3f64) { cos_x, sin_x := math.cos(angle_x), math.sin(angle_x) cos_y, sin_y := math.cos(angle_y), math.sin(angle_y) m[0, 0] = cos_y @@ -320,7 +320,7 @@ matrix3_from_euler_angles_xy_f64 :: proc(angle_x, angle_y: f64) -> (m: Matrix3f6 @(require_results) -matrix3_from_euler_angles_yx_f64 :: proc(angle_y, angle_x: f64) -> (m: Matrix3f64) { +matrix3_from_euler_angles_yx_f64 :: proc "contextless" (angle_y, angle_x: f64) -> (m: Matrix3f64) { cos_x, sin_x := math.cos(angle_x), math.sin(angle_x) cos_y, sin_y := math.cos(angle_y), math.sin(angle_y) m[0, 0] = cos_y @@ -335,25 +335,25 @@ matrix3_from_euler_angles_yx_f64 :: proc(angle_y, angle_x: f64) -> (m: Matrix3f6 } @(require_results) -matrix3_from_euler_angles_xz_f64 :: proc(angle_x, angle_z: f64) -> (m: Matrix3f64) { +matrix3_from_euler_angles_xz_f64 :: proc "contextless" (angle_x, angle_z: f64) -> (m: Matrix3f64) { return mul(matrix3_from_euler_angle_x(angle_x), matrix3_from_euler_angle_z(angle_z)) } @(require_results) -matrix3_from_euler_angles_zx_f64 :: proc(angle_z, angle_x: f64) -> (m: Matrix3f64) { +matrix3_from_euler_angles_zx_f64 :: proc "contextless" (angle_z, angle_x: f64) -> (m: Matrix3f64) { return mul(matrix3_from_euler_angle_z(angle_z), matrix3_from_euler_angle_x(angle_x)) } @(require_results) -matrix3_from_euler_angles_yz_f64 :: proc(angle_y, angle_z: f64) -> (m: Matrix3f64) { +matrix3_from_euler_angles_yz_f64 :: proc "contextless" (angle_y, angle_z: f64) -> (m: Matrix3f64) { return mul(matrix3_from_euler_angle_y(angle_y), matrix3_from_euler_angle_z(angle_z)) } @(require_results) -matrix3_from_euler_angles_zy_f64 :: proc(angle_z, angle_y: f64) -> (m: Matrix3f64) { +matrix3_from_euler_angles_zy_f64 :: proc "contextless" (angle_z, angle_y: f64) -> (m: Matrix3f64) { return mul(matrix3_from_euler_angle_z(angle_z), matrix3_from_euler_angle_y(angle_y)) } @(require_results) -matrix3_from_euler_angles_xyz_f64 :: proc(t1, t2, t3: f64) -> (m: Matrix3f64) { +matrix3_from_euler_angles_xyz_f64 :: proc "contextless" (t1, t2, t3: f64) -> (m: Matrix3f64) { c1 := math.cos(-t1) c2 := math.cos(-t2) c3 := math.cos(-t3) @@ -374,7 +374,7 @@ matrix3_from_euler_angles_xyz_f64 :: proc(t1, t2, t3: f64) -> (m: Matrix3f64) { } @(require_results) -matrix3_from_euler_angles_yxz_f64 :: proc(yaw, pitch, roll: f64) -> (m: Matrix3f64) { +matrix3_from_euler_angles_yxz_f64 :: proc "contextless" (yaw, pitch, roll: f64) -> (m: Matrix3f64) { ch := math.cos(yaw) sh := math.sin(yaw) cp := math.cos(pitch) @@ -395,7 +395,7 @@ matrix3_from_euler_angles_yxz_f64 :: proc(yaw, pitch, roll: f64) -> (m: Matrix3f } @(require_results) -matrix3_from_euler_angles_xzx_f64 :: proc(t1, t2, t3: f64) -> (m: Matrix3f64) { +matrix3_from_euler_angles_xzx_f64 :: proc "contextless" (t1, t2, t3: f64) -> (m: Matrix3f64) { c1 := math.cos(t1) s1 := math.sin(t1) c2 := math.cos(t2) @@ -416,7 +416,7 @@ matrix3_from_euler_angles_xzx_f64 :: proc(t1, t2, t3: f64) -> (m: Matrix3f64) { } @(require_results) -matrix3_from_euler_angles_xyx_f64 :: proc(t1, t2, t3: f64) -> (m: Matrix3f64) { +matrix3_from_euler_angles_xyx_f64 :: proc "contextless" (t1, t2, t3: f64) -> (m: Matrix3f64) { c1 := math.cos(t1) s1 := math.sin(t1) c2 := math.cos(t2) @@ -437,7 +437,7 @@ matrix3_from_euler_angles_xyx_f64 :: proc(t1, t2, t3: f64) -> (m: Matrix3f64) { } @(require_results) -matrix3_from_euler_angles_yxy_f64 :: proc(t1, t2, t3: f64) -> (m: Matrix3f64) { +matrix3_from_euler_angles_yxy_f64 :: proc "contextless" (t1, t2, t3: f64) -> (m: Matrix3f64) { c1 := math.cos(t1) s1 := math.sin(t1) c2 := math.cos(t2) @@ -458,7 +458,7 @@ matrix3_from_euler_angles_yxy_f64 :: proc(t1, t2, t3: f64) -> (m: Matrix3f64) { } @(require_results) -matrix3_from_euler_angles_yzy_f64 :: proc(t1, t2, t3: f64) -> (m: Matrix3f64) { +matrix3_from_euler_angles_yzy_f64 :: proc "contextless" (t1, t2, t3: f64) -> (m: Matrix3f64) { c1 := math.cos(t1) s1 := math.sin(t1) c2 := math.cos(t2) @@ -479,7 +479,7 @@ matrix3_from_euler_angles_yzy_f64 :: proc(t1, t2, t3: f64) -> (m: Matrix3f64) { } @(require_results) -matrix3_from_euler_angles_zyz_f64 :: proc(t1, t2, t3: f64) -> (m: Matrix3f64) { +matrix3_from_euler_angles_zyz_f64 :: proc "contextless" (t1, t2, t3: f64) -> (m: Matrix3f64) { c1 := math.cos(t1) s1 := math.sin(t1) c2 := math.cos(t2) @@ -500,7 +500,7 @@ matrix3_from_euler_angles_zyz_f64 :: proc(t1, t2, t3: f64) -> (m: Matrix3f64) { } @(require_results) -matrix3_from_euler_angles_zxz_f64 :: proc(t1, t2, t3: f64) -> (m: Matrix3f64) { +matrix3_from_euler_angles_zxz_f64 :: proc "contextless" (t1, t2, t3: f64) -> (m: Matrix3f64) { c1 := math.cos(t1) s1 := math.sin(t1) c2 := math.cos(t2) @@ -522,7 +522,7 @@ matrix3_from_euler_angles_zxz_f64 :: proc(t1, t2, t3: f64) -> (m: Matrix3f64) { @(require_results) -matrix3_from_euler_angles_xzy_f64 :: proc(t1, t2, t3: f64) -> (m: Matrix3f64) { +matrix3_from_euler_angles_xzy_f64 :: proc "contextless" (t1, t2, t3: f64) -> (m: Matrix3f64) { c1 := math.cos(t1) s1 := math.sin(t1) c2 := math.cos(t2) @@ -543,7 +543,7 @@ matrix3_from_euler_angles_xzy_f64 :: proc(t1, t2, t3: f64) -> (m: Matrix3f64) { } @(require_results) -matrix3_from_euler_angles_yzx_f64 :: proc(t1, t2, t3: f64) -> (m: Matrix3f64) { +matrix3_from_euler_angles_yzx_f64 :: proc "contextless" (t1, t2, t3: f64) -> (m: Matrix3f64) { c1 := math.cos(t1) s1 := math.sin(t1) c2 := math.cos(t2) @@ -564,7 +564,7 @@ matrix3_from_euler_angles_yzx_f64 :: proc(t1, t2, t3: f64) -> (m: Matrix3f64) { } @(require_results) -matrix3_from_euler_angles_zyx_f64 :: proc(t1, t2, t3: f64) -> (m: Matrix3f64) { +matrix3_from_euler_angles_zyx_f64 :: proc "contextless" (t1, t2, t3: f64) -> (m: Matrix3f64) { c1 := math.cos(t1) s1 := math.sin(t1) c2 := math.cos(t2) @@ -585,7 +585,7 @@ matrix3_from_euler_angles_zyx_f64 :: proc(t1, t2, t3: f64) -> (m: Matrix3f64) { } @(require_results) -matrix3_from_euler_angles_zxy_f64 :: proc(t1, t2, t3: f64) -> (m: Matrix3f64) { +matrix3_from_euler_angles_zxy_f64 :: proc "contextless" (t1, t2, t3: f64) -> (m: Matrix3f64) { c1 := math.cos(t1) s1 := math.sin(t1) c2 := math.cos(t2) @@ -607,7 +607,7 @@ matrix3_from_euler_angles_zxy_f64 :: proc(t1, t2, t3: f64) -> (m: Matrix3f64) { @(require_results) -matrix3_from_yaw_pitch_roll_f64 :: proc(yaw, pitch, roll: f64) -> (m: Matrix3f64) { +matrix3_from_yaw_pitch_roll_f64 :: proc "contextless" (yaw, pitch, roll: f64) -> (m: Matrix3f64) { ch := math.cos(yaw) sh := math.sin(yaw) cp := math.cos(pitch) @@ -628,7 +628,7 @@ matrix3_from_yaw_pitch_roll_f64 :: proc(yaw, pitch, roll: f64) -> (m: Matrix3f64 } @(require_results) -euler_angles_xyz_from_matrix3_f64 :: proc(m: Matrix3f64) -> (t1, t2, t3: f64) { +euler_angles_xyz_from_matrix3_f64 :: proc "contextless" (m: Matrix3f64) -> (t1, t2, t3: f64) { T1 := math.atan2(m[1, 2], m[2, 2]) C2 := math.sqrt(m[0, 0]*m[0, 0] + m[0, 1]*m[0, 1]) T2 := math.atan2(-m[0, 2], C2) @@ -642,7 +642,7 @@ euler_angles_xyz_from_matrix3_f64 :: proc(m: Matrix3f64) -> (t1, t2, t3: f64) { } @(require_results) -euler_angles_yxz_from_matrix3_f64 :: proc(m: Matrix3f64) -> (t1, t2, t3: f64) { +euler_angles_yxz_from_matrix3_f64 :: proc "contextless" (m: Matrix3f64) -> (t1, t2, t3: f64) { T1 := math.atan2(m[0, 2], m[2, 2]) C2 := math.sqrt(m[1, 0]*m[1, 0] + m[1, 1]*m[1, 1]) T2 := math.atan2(-m[1, 2], C2) @@ -656,7 +656,7 @@ euler_angles_yxz_from_matrix3_f64 :: proc(m: Matrix3f64) -> (t1, t2, t3: f64) { } @(require_results) -euler_angles_xzx_from_matrix3_f64 :: proc(m: Matrix3f64) -> (t1, t2, t3: f64) { +euler_angles_xzx_from_matrix3_f64 :: proc "contextless" (m: Matrix3f64) -> (t1, t2, t3: f64) { T1 := math.atan2(m[2, 0], m[1, 0]) S2 := math.sqrt(m[0, 1]*m[0, 1] + m[0, 2]*m[0, 2]) T2 := math.atan2(S2, m[0, 0]) @@ -670,7 +670,7 @@ euler_angles_xzx_from_matrix3_f64 :: proc(m: Matrix3f64) -> (t1, t2, t3: f64) { } @(require_results) -euler_angles_xyx_from_matrix3_f64 :: proc(m: Matrix3f64) -> (t1, t2, t3: f64) { +euler_angles_xyx_from_matrix3_f64 :: proc "contextless" (m: Matrix3f64) -> (t1, t2, t3: f64) { T1 := math.atan2(m[1, 0], -m[2, 0]) S2 := math.sqrt(m[0, 1]*m[0, 1] + m[0, 2]*m[0, 2]) T2 := math.atan2(S2, m[0, 0]) @@ -684,7 +684,7 @@ euler_angles_xyx_from_matrix3_f64 :: proc(m: Matrix3f64) -> (t1, t2, t3: f64) { } @(require_results) -euler_angles_yxy_from_matrix3_f64 :: proc(m: Matrix3f64) -> (t1, t2, t3: f64) { +euler_angles_yxy_from_matrix3_f64 :: proc "contextless" (m: Matrix3f64) -> (t1, t2, t3: f64) { T1 := math.atan2(m[0, 1], m[2, 1]) S2 := math.sqrt(m[1, 0]*m[1, 0] + m[1, 2]*m[1, 2]) T2 := math.atan2(S2, m[1, 1]) @@ -698,7 +698,7 @@ euler_angles_yxy_from_matrix3_f64 :: proc(m: Matrix3f64) -> (t1, t2, t3: f64) { } @(require_results) -euler_angles_yzy_from_matrix3_f64 :: proc(m: Matrix3f64) -> (t1, t2, t3: f64) { +euler_angles_yzy_from_matrix3_f64 :: proc "contextless" (m: Matrix3f64) -> (t1, t2, t3: f64) { T1 := math.atan2(m[2, 1], -m[0, 1]) S2 := math.sqrt(m[1, 0]*m[1, 0] + m[1, 2]*m[1, 2]) T2 := math.atan2(S2, m[1, 1]) @@ -711,7 +711,7 @@ euler_angles_yzy_from_matrix3_f64 :: proc(m: Matrix3f64) -> (t1, t2, t3: f64) { return } @(require_results) -euler_angles_zyz_from_matrix3_f64 :: proc(m: Matrix3f64) -> (t1, t2, t3: f64) { +euler_angles_zyz_from_matrix3_f64 :: proc "contextless" (m: Matrix3f64) -> (t1, t2, t3: f64) { T1 := math.atan2(m[1, 2], m[0, 2]) S2 := math.sqrt(m[2, 0]*m[2, 0] + m[2, 1]*m[2, 1]) T2 := math.atan2(S2, m[2, 2]) @@ -725,7 +725,7 @@ euler_angles_zyz_from_matrix3_f64 :: proc(m: Matrix3f64) -> (t1, t2, t3: f64) { } @(require_results) -euler_angles_zxz_from_matrix3_f64 :: proc(m: Matrix3f64) -> (t1, t2, t3: f64) { +euler_angles_zxz_from_matrix3_f64 :: proc "contextless" (m: Matrix3f64) -> (t1, t2, t3: f64) { T1 := math.atan2(m[0, 2], -m[1, 2]) S2 := math.sqrt(m[2, 0]*m[2, 0] + m[2, 1]*m[2, 1]) T2 := math.atan2(S2, m[2, 2]) @@ -739,7 +739,7 @@ euler_angles_zxz_from_matrix3_f64 :: proc(m: Matrix3f64) -> (t1, t2, t3: f64) { } @(require_results) -euler_angles_xzy_from_matrix3_f64 :: proc(m: Matrix3f64) -> (t1, t2, t3: f64) { +euler_angles_xzy_from_matrix3_f64 :: proc "contextless" (m: Matrix3f64) -> (t1, t2, t3: f64) { T1 := math.atan2(m[2, 1], m[1, 1]) C2 := math.sqrt(m[0, 0]*m[0, 0] + m[0, 2]*m[0, 2]) T2 := math.atan2(-m[0, 1], C2) @@ -753,7 +753,7 @@ euler_angles_xzy_from_matrix3_f64 :: proc(m: Matrix3f64) -> (t1, t2, t3: f64) { } @(require_results) -euler_angles_yzx_from_matrix3_f64 :: proc(m: Matrix3f64) -> (t1, t2, t3: f64) { +euler_angles_yzx_from_matrix3_f64 :: proc "contextless" (m: Matrix3f64) -> (t1, t2, t3: f64) { T1 := math.atan2(-m[2, 0], m[0, 0]) C2 := math.sqrt(m[1, 1]*m[1, 1] + m[1, 2]*m[1, 2]) T2 := math.atan2(m[1, 0], C2) @@ -767,7 +767,7 @@ euler_angles_yzx_from_matrix3_f64 :: proc(m: Matrix3f64) -> (t1, t2, t3: f64) { } @(require_results) -euler_angles_zyx_from_matrix3_f64 :: proc(m: Matrix3f64) -> (t1, t2, t3: f64) { +euler_angles_zyx_from_matrix3_f64 :: proc "contextless" (m: Matrix3f64) -> (t1, t2, t3: f64) { T1 := math.atan2(m[1, 0], m[0, 0]) C2 := math.sqrt(m[2, 1]*m[2, 1] + m[2, 2]*m[2, 2]) T2 := math.atan2(-m[2, 0], C2) @@ -781,7 +781,7 @@ euler_angles_zyx_from_matrix3_f64 :: proc(m: Matrix3f64) -> (t1, t2, t3: f64) { } @(require_results) -euler_angles_zxy_from_matrix3_f64 :: proc(m: Matrix3f64) -> (t1, t2, t3: f64) { +euler_angles_zxy_from_matrix3_f64 :: proc "contextless" (m: Matrix3f64) -> (t1, t2, t3: f64) { T1 := math.atan2(-m[0, 1], m[1, 1]) C2 := math.sqrt(m[2, 0]*m[2, 0] + m[2, 2]*m[2, 2]) T2 := math.atan2(m[2, 1], C2) @@ -799,7 +799,7 @@ euler_angles_zxy_from_matrix3_f64 :: proc(m: Matrix3f64) -> (t1, t2, t3: f64) { @(require_results) -matrix4_from_euler_angle_x_f64 :: proc(angle_x: f64) -> (m: Matrix4f64) { +matrix4_from_euler_angle_x_f64 :: proc "contextless" (angle_x: f64) -> (m: Matrix4f64) { cos_x, sin_x := math.cos(angle_x), math.sin(angle_x) m[0, 0] = 1 m[1, 1] = +cos_x @@ -810,7 +810,7 @@ matrix4_from_euler_angle_x_f64 :: proc(angle_x: f64) -> (m: Matrix4f64) { return } @(require_results) -matrix4_from_euler_angle_y_f64 :: proc(angle_y: f64) -> (m: Matrix4f64) { +matrix4_from_euler_angle_y_f64 :: proc "contextless" (angle_y: f64) -> (m: Matrix4f64) { cos_y, sin_y := math.cos(angle_y), math.sin(angle_y) m[0, 0] = +cos_y m[0, 2] = -sin_y @@ -821,7 +821,7 @@ matrix4_from_euler_angle_y_f64 :: proc(angle_y: f64) -> (m: Matrix4f64) { return } @(require_results) -matrix4_from_euler_angle_z_f64 :: proc(angle_z: f64) -> (m: Matrix4f64) { +matrix4_from_euler_angle_z_f64 :: proc "contextless" (angle_z: f64) -> (m: Matrix4f64) { cos_z, sin_z := math.cos(angle_z), math.sin(angle_z) m[0, 0] = +cos_z m[0, 1] = +sin_z @@ -834,7 +834,7 @@ matrix4_from_euler_angle_z_f64 :: proc(angle_z: f64) -> (m: Matrix4f64) { @(require_results) -matrix4_from_derived_euler_angle_x_f64 :: proc(angle_x: f64, angular_velocity_x: f64) -> (m: Matrix4f64) { +matrix4_from_derived_euler_angle_x_f64 :: proc "contextless" (angle_x: f64, angular_velocity_x: f64) -> (m: Matrix4f64) { cos_x := math.cos(angle_x) * angular_velocity_x sin_x := math.sin(angle_x) * angular_velocity_x m[0, 0] = 1 @@ -846,7 +846,7 @@ matrix4_from_derived_euler_angle_x_f64 :: proc(angle_x: f64, angular_velocity_x: return } @(require_results) -matrix4_from_derived_euler_angle_y_f64 :: proc(angle_y: f64, angular_velocity_y: f64) -> (m: Matrix4f64) { +matrix4_from_derived_euler_angle_y_f64 :: proc "contextless" (angle_y: f64, angular_velocity_y: f64) -> (m: Matrix4f64) { cos_y := math.cos(angle_y) * angular_velocity_y sin_y := math.sin(angle_y) * angular_velocity_y m[0, 0] = +cos_y @@ -858,7 +858,7 @@ matrix4_from_derived_euler_angle_y_f64 :: proc(angle_y: f64, angular_velocity_y: return } @(require_results) -matrix4_from_derived_euler_angle_z_f64 :: proc(angle_z: f64, angular_velocity_z: f64) -> (m: Matrix4f64) { +matrix4_from_derived_euler_angle_z_f64 :: proc "contextless" (angle_z: f64, angular_velocity_z: f64) -> (m: Matrix4f64) { cos_z := math.cos(angle_z) * angular_velocity_z sin_z := math.sin(angle_z) * angular_velocity_z m[0, 0] = +cos_z @@ -872,7 +872,7 @@ matrix4_from_derived_euler_angle_z_f64 :: proc(angle_z: f64, angular_velocity_z: @(require_results) -matrix4_from_euler_angles_xy_f64 :: proc(angle_x, angle_y: f64) -> (m: Matrix4f64) { +matrix4_from_euler_angles_xy_f64 :: proc "contextless" (angle_x, angle_y: f64) -> (m: Matrix4f64) { cos_x, sin_x := math.cos(angle_x), math.sin(angle_x) cos_y, sin_y := math.cos(angle_y), math.sin(angle_y) m[0, 0] = cos_y @@ -889,7 +889,7 @@ matrix4_from_euler_angles_xy_f64 :: proc(angle_x, angle_y: f64) -> (m: Matrix4f6 @(require_results) -matrix4_from_euler_angles_yx_f64 :: proc(angle_y, angle_x: f64) -> (m: Matrix4f64) { +matrix4_from_euler_angles_yx_f64 :: proc "contextless" (angle_y, angle_x: f64) -> (m: Matrix4f64) { cos_x, sin_x := math.cos(angle_x), math.sin(angle_x) cos_y, sin_y := math.cos(angle_y), math.sin(angle_y) m[0, 0] = cos_y @@ -905,25 +905,25 @@ matrix4_from_euler_angles_yx_f64 :: proc(angle_y, angle_x: f64) -> (m: Matrix4f6 } @(require_results) -matrix4_from_euler_angles_xz_f64 :: proc(angle_x, angle_z: f64) -> (m: Matrix4f64) { +matrix4_from_euler_angles_xz_f64 :: proc "contextless" (angle_x, angle_z: f64) -> (m: Matrix4f64) { return mul(matrix4_from_euler_angle_x(angle_x), matrix4_from_euler_angle_z(angle_z)) } @(require_results) -matrix4_from_euler_angles_zx_f64 :: proc(angle_z, angle_x: f64) -> (m: Matrix4f64) { +matrix4_from_euler_angles_zx_f64 :: proc "contextless" (angle_z, angle_x: f64) -> (m: Matrix4f64) { return mul(matrix4_from_euler_angle_z(angle_z), matrix4_from_euler_angle_x(angle_x)) } @(require_results) -matrix4_from_euler_angles_yz_f64 :: proc(angle_y, angle_z: f64) -> (m: Matrix4f64) { +matrix4_from_euler_angles_yz_f64 :: proc "contextless" (angle_y, angle_z: f64) -> (m: Matrix4f64) { return mul(matrix4_from_euler_angle_y(angle_y), matrix4_from_euler_angle_z(angle_z)) } @(require_results) -matrix4_from_euler_angles_zy_f64 :: proc(angle_z, angle_y: f64) -> (m: Matrix4f64) { +matrix4_from_euler_angles_zy_f64 :: proc "contextless" (angle_z, angle_y: f64) -> (m: Matrix4f64) { return mul(matrix4_from_euler_angle_z(angle_z), matrix4_from_euler_angle_y(angle_y)) } @(require_results) -matrix4_from_euler_angles_xyz_f64 :: proc(t1, t2, t3: f64) -> (m: Matrix4f64) { +matrix4_from_euler_angles_xyz_f64 :: proc "contextless" (t1, t2, t3: f64) -> (m: Matrix4f64) { c1 := math.cos(-t1) c2 := math.cos(-t2) c3 := math.cos(-t3) @@ -951,7 +951,7 @@ matrix4_from_euler_angles_xyz_f64 :: proc(t1, t2, t3: f64) -> (m: Matrix4f64) { } @(require_results) -matrix4_from_euler_angles_yxz_f64 :: proc(yaw, pitch, roll: f64) -> (m: Matrix4f64) { +matrix4_from_euler_angles_yxz_f64 :: proc "contextless" (yaw, pitch, roll: f64) -> (m: Matrix4f64) { ch := math.cos(yaw) sh := math.sin(yaw) cp := math.cos(pitch) @@ -979,7 +979,7 @@ matrix4_from_euler_angles_yxz_f64 :: proc(yaw, pitch, roll: f64) -> (m: Matrix4f } @(require_results) -matrix4_from_euler_angles_xzx_f64 :: proc(t1, t2, t3: f64) -> (m: Matrix4f64) { +matrix4_from_euler_angles_xzx_f64 :: proc "contextless" (t1, t2, t3: f64) -> (m: Matrix4f64) { c1 := math.cos(t1) s1 := math.sin(t1) c2 := math.cos(t2) @@ -1007,7 +1007,7 @@ matrix4_from_euler_angles_xzx_f64 :: proc(t1, t2, t3: f64) -> (m: Matrix4f64) { } @(require_results) -matrix4_from_euler_angles_xyx_f64 :: proc(t1, t2, t3: f64) -> (m: Matrix4f64) { +matrix4_from_euler_angles_xyx_f64 :: proc "contextless" (t1, t2, t3: f64) -> (m: Matrix4f64) { c1 := math.cos(t1) s1 := math.sin(t1) c2 := math.cos(t2) @@ -1035,7 +1035,7 @@ matrix4_from_euler_angles_xyx_f64 :: proc(t1, t2, t3: f64) -> (m: Matrix4f64) { } @(require_results) -matrix4_from_euler_angles_yxy_f64 :: proc(t1, t2, t3: f64) -> (m: Matrix4f64) { +matrix4_from_euler_angles_yxy_f64 :: proc "contextless" (t1, t2, t3: f64) -> (m: Matrix4f64) { c1 := math.cos(t1) s1 := math.sin(t1) c2 := math.cos(t2) @@ -1063,7 +1063,7 @@ matrix4_from_euler_angles_yxy_f64 :: proc(t1, t2, t3: f64) -> (m: Matrix4f64) { } @(require_results) -matrix4_from_euler_angles_yzy_f64 :: proc(t1, t2, t3: f64) -> (m: Matrix4f64) { +matrix4_from_euler_angles_yzy_f64 :: proc "contextless" (t1, t2, t3: f64) -> (m: Matrix4f64) { c1 := math.cos(t1) s1 := math.sin(t1) c2 := math.cos(t2) @@ -1091,7 +1091,7 @@ matrix4_from_euler_angles_yzy_f64 :: proc(t1, t2, t3: f64) -> (m: Matrix4f64) { } @(require_results) -matrix4_from_euler_angles_zyz_f64 :: proc(t1, t2, t3: f64) -> (m: Matrix4f64) { +matrix4_from_euler_angles_zyz_f64 :: proc "contextless" (t1, t2, t3: f64) -> (m: Matrix4f64) { c1 := math.cos(t1) s1 := math.sin(t1) c2 := math.cos(t2) @@ -1119,7 +1119,7 @@ matrix4_from_euler_angles_zyz_f64 :: proc(t1, t2, t3: f64) -> (m: Matrix4f64) { } @(require_results) -matrix4_from_euler_angles_zxz_f64 :: proc(t1, t2, t3: f64) -> (m: Matrix4f64) { +matrix4_from_euler_angles_zxz_f64 :: proc "contextless" (t1, t2, t3: f64) -> (m: Matrix4f64) { c1 := math.cos(t1) s1 := math.sin(t1) c2 := math.cos(t2) @@ -1148,7 +1148,7 @@ matrix4_from_euler_angles_zxz_f64 :: proc(t1, t2, t3: f64) -> (m: Matrix4f64) { @(require_results) -matrix4_from_euler_angles_xzy_f64 :: proc(t1, t2, t3: f64) -> (m: Matrix4f64) { +matrix4_from_euler_angles_xzy_f64 :: proc "contextless" (t1, t2, t3: f64) -> (m: Matrix4f64) { c1 := math.cos(t1) s1 := math.sin(t1) c2 := math.cos(t2) @@ -1176,7 +1176,7 @@ matrix4_from_euler_angles_xzy_f64 :: proc(t1, t2, t3: f64) -> (m: Matrix4f64) { } @(require_results) -matrix4_from_euler_angles_yzx_f64 :: proc(t1, t2, t3: f64) -> (m: Matrix4f64) { +matrix4_from_euler_angles_yzx_f64 :: proc "contextless" (t1, t2, t3: f64) -> (m: Matrix4f64) { c1 := math.cos(t1) s1 := math.sin(t1) c2 := math.cos(t2) @@ -1204,7 +1204,7 @@ matrix4_from_euler_angles_yzx_f64 :: proc(t1, t2, t3: f64) -> (m: Matrix4f64) { } @(require_results) -matrix4_from_euler_angles_zyx_f64 :: proc(t1, t2, t3: f64) -> (m: Matrix4f64) { +matrix4_from_euler_angles_zyx_f64 :: proc "contextless" (t1, t2, t3: f64) -> (m: Matrix4f64) { c1 := math.cos(t1) s1 := math.sin(t1) c2 := math.cos(t2) @@ -1232,7 +1232,7 @@ matrix4_from_euler_angles_zyx_f64 :: proc(t1, t2, t3: f64) -> (m: Matrix4f64) { } @(require_results) -matrix4_from_euler_angles_zxy_f64 :: proc(t1, t2, t3: f64) -> (m: Matrix4f64) { +matrix4_from_euler_angles_zxy_f64 :: proc "contextless" (t1, t2, t3: f64) -> (m: Matrix4f64) { c1 := math.cos(t1) s1 := math.sin(t1) c2 := math.cos(t2) @@ -1261,7 +1261,7 @@ matrix4_from_euler_angles_zxy_f64 :: proc(t1, t2, t3: f64) -> (m: Matrix4f64) { @(require_results) -matrix4_from_yaw_pitch_roll_f64 :: proc(yaw, pitch, roll: f64) -> (m: Matrix4f64) { +matrix4_from_yaw_pitch_roll_f64 :: proc "contextless" (yaw, pitch, roll: f64) -> (m: Matrix4f64) { ch := math.cos(yaw) sh := math.sin(yaw) cp := math.cos(pitch) @@ -1289,7 +1289,7 @@ matrix4_from_yaw_pitch_roll_f64 :: proc(yaw, pitch, roll: f64) -> (m: Matrix4f64 } @(require_results) -euler_angles_xyz_from_matrix4_f64 :: proc(m: Matrix4f64) -> (t1, t2, t3: f64) { +euler_angles_xyz_from_matrix4_f64 :: proc "contextless" (m: Matrix4f64) -> (t1, t2, t3: f64) { T1 := math.atan2(m[1, 2], m[2, 2]) C2 := math.sqrt(m[0, 0]*m[0, 0] + m[0, 1]*m[0, 1]) T2 := math.atan2(-m[0, 2], C2) @@ -1303,7 +1303,7 @@ euler_angles_xyz_from_matrix4_f64 :: proc(m: Matrix4f64) -> (t1, t2, t3: f64) { } @(require_results) -euler_angles_yxz_from_matrix4_f64 :: proc(m: Matrix4f64) -> (t1, t2, t3: f64) { +euler_angles_yxz_from_matrix4_f64 :: proc "contextless" (m: Matrix4f64) -> (t1, t2, t3: f64) { T1 := math.atan2(m[0, 2], m[2, 2]) C2 := math.sqrt(m[1, 0]*m[1, 0] + m[1, 1]*m[1, 1]) T2 := math.atan2(-m[1, 2], C2) @@ -1317,7 +1317,7 @@ euler_angles_yxz_from_matrix4_f64 :: proc(m: Matrix4f64) -> (t1, t2, t3: f64) { } @(require_results) -euler_angles_xzx_from_matrix4_f64 :: proc(m: Matrix4f64) -> (t1, t2, t3: f64) { +euler_angles_xzx_from_matrix4_f64 :: proc "contextless" (m: Matrix4f64) -> (t1, t2, t3: f64) { T1 := math.atan2(m[2, 0], m[1, 0]) S2 := math.sqrt(m[0, 1]*m[0, 1] + m[0, 2]*m[0, 2]) T2 := math.atan2(S2, m[0, 0]) @@ -1331,7 +1331,7 @@ euler_angles_xzx_from_matrix4_f64 :: proc(m: Matrix4f64) -> (t1, t2, t3: f64) { } @(require_results) -euler_angles_xyx_from_matrix4_f64 :: proc(m: Matrix4f64) -> (t1, t2, t3: f64) { +euler_angles_xyx_from_matrix4_f64 :: proc "contextless" (m: Matrix4f64) -> (t1, t2, t3: f64) { T1 := math.atan2(m[1, 0], -m[2, 0]) S2 := math.sqrt(m[0, 1]*m[0, 1] + m[0, 2]*m[0, 2]) T2 := math.atan2(S2, m[0, 0]) @@ -1345,7 +1345,7 @@ euler_angles_xyx_from_matrix4_f64 :: proc(m: Matrix4f64) -> (t1, t2, t3: f64) { } @(require_results) -euler_angles_yxy_from_matrix4_f64 :: proc(m: Matrix4f64) -> (t1, t2, t3: f64) { +euler_angles_yxy_from_matrix4_f64 :: proc "contextless" (m: Matrix4f64) -> (t1, t2, t3: f64) { T1 := math.atan2(m[0, 1], m[2, 1]) S2 := math.sqrt(m[1, 0]*m[1, 0] + m[1, 2]*m[1, 2]) T2 := math.atan2(S2, m[1, 1]) @@ -1359,7 +1359,7 @@ euler_angles_yxy_from_matrix4_f64 :: proc(m: Matrix4f64) -> (t1, t2, t3: f64) { } @(require_results) -euler_angles_yzy_from_matrix4_f64 :: proc(m: Matrix4f64) -> (t1, t2, t3: f64) { +euler_angles_yzy_from_matrix4_f64 :: proc "contextless" (m: Matrix4f64) -> (t1, t2, t3: f64) { T1 := math.atan2(m[2, 1], -m[0, 1]) S2 := math.sqrt(m[1, 0]*m[1, 0] + m[1, 2]*m[1, 2]) T2 := math.atan2(S2, m[1, 1]) @@ -1372,7 +1372,7 @@ euler_angles_yzy_from_matrix4_f64 :: proc(m: Matrix4f64) -> (t1, t2, t3: f64) { return } @(require_results) -euler_angles_zyz_from_matrix4_f64 :: proc(m: Matrix4f64) -> (t1, t2, t3: f64) { +euler_angles_zyz_from_matrix4_f64 :: proc "contextless" (m: Matrix4f64) -> (t1, t2, t3: f64) { T1 := math.atan2(m[1, 2], m[0, 2]) S2 := math.sqrt(m[2, 0]*m[2, 0] + m[2, 1]*m[2, 1]) T2 := math.atan2(S2, m[2, 2]) @@ -1386,7 +1386,7 @@ euler_angles_zyz_from_matrix4_f64 :: proc(m: Matrix4f64) -> (t1, t2, t3: f64) { } @(require_results) -euler_angles_zxz_from_matrix4_f64 :: proc(m: Matrix4f64) -> (t1, t2, t3: f64) { +euler_angles_zxz_from_matrix4_f64 :: proc "contextless" (m: Matrix4f64) -> (t1, t2, t3: f64) { T1 := math.atan2(m[0, 2], -m[1, 2]) S2 := math.sqrt(m[2, 0]*m[2, 0] + m[2, 1]*m[2, 1]) T2 := math.atan2(S2, m[2, 2]) @@ -1400,7 +1400,7 @@ euler_angles_zxz_from_matrix4_f64 :: proc(m: Matrix4f64) -> (t1, t2, t3: f64) { } @(require_results) -euler_angles_xzy_from_matrix4_f64 :: proc(m: Matrix4f64) -> (t1, t2, t3: f64) { +euler_angles_xzy_from_matrix4_f64 :: proc "contextless" (m: Matrix4f64) -> (t1, t2, t3: f64) { T1 := math.atan2(m[2, 1], m[1, 1]) C2 := math.sqrt(m[0, 0]*m[0, 0] + m[0, 2]*m[0, 2]) T2 := math.atan2(-m[0, 1], C2) @@ -1414,7 +1414,7 @@ euler_angles_xzy_from_matrix4_f64 :: proc(m: Matrix4f64) -> (t1, t2, t3: f64) { } @(require_results) -euler_angles_yzx_from_matrix4_f64 :: proc(m: Matrix4f64) -> (t1, t2, t3: f64) { +euler_angles_yzx_from_matrix4_f64 :: proc "contextless" (m: Matrix4f64) -> (t1, t2, t3: f64) { T1 := math.atan2(-m[2, 0], m[0, 0]) C2 := math.sqrt(m[1, 1]*m[1, 1] + m[1, 2]*m[1, 2]) T2 := math.atan2(m[1, 0], C2) @@ -1428,7 +1428,7 @@ euler_angles_yzx_from_matrix4_f64 :: proc(m: Matrix4f64) -> (t1, t2, t3: f64) { } @(require_results) -euler_angles_zyx_from_matrix4_f64 :: proc(m: Matrix4f64) -> (t1, t2, t3: f64) { +euler_angles_zyx_from_matrix4_f64 :: proc "contextless" (m: Matrix4f64) -> (t1, t2, t3: f64) { T1 := math.atan2(m[1, 0], m[0, 0]) C2 := math.sqrt(m[2, 1]*m[2, 1] + m[2, 2]*m[2, 2]) T2 := math.atan2(-m[2, 0], C2) @@ -1442,7 +1442,7 @@ euler_angles_zyx_from_matrix4_f64 :: proc(m: Matrix4f64) -> (t1, t2, t3: f64) { } @(require_results) -euler_angles_zxy_from_matrix4_f64 :: proc(m: Matrix4f64) -> (t1, t2, t3: f64) { +euler_angles_zxy_from_matrix4_f64 :: proc "contextless" (m: Matrix4f64) -> (t1, t2, t3: f64) { T1 := math.atan2(-m[0, 1], m[1, 1]) C2 := math.sqrt(m[2, 0]*m[2, 0] + m[2, 2]*m[2, 2]) T2 := math.atan2(m[2, 1], C2) diff --git a/core/math/linalg/swizzle.odin b/core/math/linalg/swizzle.odin index 8c2072193..f1dafbeca 100644 --- a/core/math/linalg/swizzle.odin +++ b/core/math/linalg/swizzle.odin @@ -38,141 +38,141 @@ Vector4_Components :: enum u8 { } @(require_results) -scalar_f32_swizzle1 :: proc(f: f32, c0: Scalar_Components) -> f32 { +scalar_f32_swizzle1 :: proc "contextless" (f: f32, c0: Scalar_Components) -> f32 { return f } @(require_results) -scalar_f32_swizzle2 :: proc(f: f32, c0, c1: Scalar_Components) -> Vector2f32 { +scalar_f32_swizzle2 :: proc "contextless" (f: f32, c0, c1: Scalar_Components) -> Vector2f32 { return {f, f} } @(require_results) -scalar_f32_swizzle3 :: proc(f: f32, c0, c1, c2: Scalar_Components) -> Vector3f32 { +scalar_f32_swizzle3 :: proc "contextless" (f: f32, c0, c1, c2: Scalar_Components) -> Vector3f32 { return {f, f, f} } @(require_results) -scalar_f32_swizzle4 :: proc(f: f32, c0, c1, c2, c3: Scalar_Components) -> Vector4f32 { +scalar_f32_swizzle4 :: proc "contextless" (f: f32, c0, c1, c2, c3: Scalar_Components) -> Vector4f32 { return {f, f, f, f} } @(require_results) -vector2f32_swizzle1 :: proc(v: Vector2f32, c0: Vector2_Components) -> f32 { +vector2f32_swizzle1 :: proc "contextless" (v: Vector2f32, c0: Vector2_Components) -> f32 { return v[c0] } @(require_results) -vector2f32_swizzle2 :: proc(v: Vector2f32, c0, c1: Vector2_Components) -> Vector2f32 { +vector2f32_swizzle2 :: proc "contextless" (v: Vector2f32, c0, c1: Vector2_Components) -> Vector2f32 { return {v[c0], v[c1]} } @(require_results) -vector2f32_swizzle3 :: proc(v: Vector2f32, c0, c1, c2: Vector2_Components) -> Vector3f32 { +vector2f32_swizzle3 :: proc "contextless" (v: Vector2f32, c0, c1, c2: Vector2_Components) -> Vector3f32 { return {v[c0], v[c1], v[c2]} } @(require_results) -vector2f32_swizzle4 :: proc(v: Vector2f32, c0, c1, c2, c3: Vector2_Components) -> Vector4f32 { +vector2f32_swizzle4 :: proc "contextless" (v: Vector2f32, c0, c1, c2, c3: Vector2_Components) -> Vector4f32 { return {v[c0], v[c1], v[c2], v[c3]} } @(require_results) -vector3f32_swizzle1 :: proc(v: Vector3f32, c0: Vector3_Components) -> f32 { +vector3f32_swizzle1 :: proc "contextless" (v: Vector3f32, c0: Vector3_Components) -> f32 { return v[c0] } @(require_results) -vector3f32_swizzle2 :: proc(v: Vector3f32, c0, c1: Vector3_Components) -> Vector2f32 { +vector3f32_swizzle2 :: proc "contextless" (v: Vector3f32, c0, c1: Vector3_Components) -> Vector2f32 { return {v[c0], v[c1]} } @(require_results) -vector3f32_swizzle3 :: proc(v: Vector3f32, c0, c1, c2: Vector3_Components) -> Vector3f32 { +vector3f32_swizzle3 :: proc "contextless" (v: Vector3f32, c0, c1, c2: Vector3_Components) -> Vector3f32 { return {v[c0], v[c1], v[c2]} } @(require_results) -vector3f32_swizzle4 :: proc(v: Vector3f32, c0, c1, c2, c3: Vector3_Components) -> Vector4f32 { +vector3f32_swizzle4 :: proc "contextless" (v: Vector3f32, c0, c1, c2, c3: Vector3_Components) -> Vector4f32 { return {v[c0], v[c1], v[c2], v[c3]} } @(require_results) -vector4f32_swizzle1 :: proc(v: Vector4f32, c0: Vector4_Components) -> f32 { +vector4f32_swizzle1 :: proc "contextless" (v: Vector4f32, c0: Vector4_Components) -> f32 { return v[c0] } @(require_results) -vector4f32_swizzle2 :: proc(v: Vector4f32, c0, c1: Vector4_Components) -> Vector2f32 { +vector4f32_swizzle2 :: proc "contextless" (v: Vector4f32, c0, c1: Vector4_Components) -> Vector2f32 { return {v[c0], v[c1]} } @(require_results) -vector4f32_swizzle3 :: proc(v: Vector4f32, c0, c1, c2: Vector4_Components) -> Vector3f32 { +vector4f32_swizzle3 :: proc "contextless" (v: Vector4f32, c0, c1, c2: Vector4_Components) -> Vector3f32 { return {v[c0], v[c1], v[c2]} } @(require_results) -vector4f32_swizzle4 :: proc(v: Vector4f32, c0, c1, c2, c3: Vector4_Components) -> Vector4f32 { +vector4f32_swizzle4 :: proc "contextless" (v: Vector4f32, c0, c1, c2, c3: Vector4_Components) -> Vector4f32 { return {v[c0], v[c1], v[c2], v[c3]} } @(require_results) -scalar_f64_swizzle1 :: proc(f: f64, c0: Scalar_Components) -> f64 { +scalar_f64_swizzle1 :: proc "contextless" (f: f64, c0: Scalar_Components) -> f64 { return f } @(require_results) -scalar_f64_swizzle2 :: proc(f: f64, c0, c1: Scalar_Components) -> Vector2f64 { +scalar_f64_swizzle2 :: proc "contextless" (f: f64, c0, c1: Scalar_Components) -> Vector2f64 { return {f, f} } @(require_results) -scalar_f64_swizzle3 :: proc(f: f64, c0, c1, c2: Scalar_Components) -> Vector3f64 { +scalar_f64_swizzle3 :: proc "contextless" (f: f64, c0, c1, c2: Scalar_Components) -> Vector3f64 { return {f, f, f} } @(require_results) -scalar_f64_swizzle4 :: proc(f: f64, c0, c1, c2, c3: Scalar_Components) -> Vector4f64 { +scalar_f64_swizzle4 :: proc "contextless" (f: f64, c0, c1, c2, c3: Scalar_Components) -> Vector4f64 { return {f, f, f, f} } @(require_results) -vector2f64_swizzle1 :: proc(v: Vector2f64, c0: Vector2_Components) -> f64 { +vector2f64_swizzle1 :: proc "contextless" (v: Vector2f64, c0: Vector2_Components) -> f64 { return v[c0] } @(require_results) -vector2f64_swizzle2 :: proc(v: Vector2f64, c0, c1: Vector2_Components) -> Vector2f64 { +vector2f64_swizzle2 :: proc "contextless" (v: Vector2f64, c0, c1: Vector2_Components) -> Vector2f64 { return {v[c0], v[c1]} } @(require_results) -vector2f64_swizzle3 :: proc(v: Vector2f64, c0, c1, c2: Vector2_Components) -> Vector3f64 { +vector2f64_swizzle3 :: proc "contextless" (v: Vector2f64, c0, c1, c2: Vector2_Components) -> Vector3f64 { return {v[c0], v[c1], v[c2]} } @(require_results) -vector2f64_swizzle4 :: proc(v: Vector2f64, c0, c1, c2, c3: Vector2_Components) -> Vector4f64 { +vector2f64_swizzle4 :: proc "contextless" (v: Vector2f64, c0, c1, c2, c3: Vector2_Components) -> Vector4f64 { return {v[c0], v[c1], v[c2], v[c3]} } @(require_results) -vector3f64_swizzle1 :: proc(v: Vector3f64, c0: Vector3_Components) -> f64 { +vector3f64_swizzle1 :: proc "contextless" (v: Vector3f64, c0: Vector3_Components) -> f64 { return v[c0] } @(require_results) -vector3f64_swizzle2 :: proc(v: Vector3f64, c0, c1: Vector3_Components) -> Vector2f64 { +vector3f64_swizzle2 :: proc "contextless" (v: Vector3f64, c0, c1: Vector3_Components) -> Vector2f64 { return {v[c0], v[c1]} } @(require_results) -vector3f64_swizzle3 :: proc(v: Vector3f64, c0, c1, c2: Vector3_Components) -> Vector3f64 { +vector3f64_swizzle3 :: proc "contextless" (v: Vector3f64, c0, c1, c2: Vector3_Components) -> Vector3f64 { return {v[c0], v[c1], v[c2]} } @(require_results) -vector3f64_swizzle4 :: proc(v: Vector3f64, c0, c1, c2, c3: Vector3_Components) -> Vector4f64 { +vector3f64_swizzle4 :: proc "contextless" (v: Vector3f64, c0, c1, c2, c3: Vector3_Components) -> Vector4f64 { return {v[c0], v[c1], v[c2], v[c3]} } @(require_results) -vector4f64_swizzle1 :: proc(v: Vector4f64, c0: Vector4_Components) -> f64 { +vector4f64_swizzle1 :: proc "contextless" (v: Vector4f64, c0: Vector4_Components) -> f64 { return v[c0] } @(require_results) -vector4f64_swizzle2 :: proc(v: Vector4f64, c0, c1: Vector4_Components) -> Vector2f64 { +vector4f64_swizzle2 :: proc "contextless" (v: Vector4f64, c0, c1: Vector4_Components) -> Vector2f64 { return {v[c0], v[c1]} } @(require_results) -vector4f64_swizzle3 :: proc(v: Vector4f64, c0, c1, c2: Vector4_Components) -> Vector3f64 { +vector4f64_swizzle3 :: proc "contextless" (v: Vector4f64, c0, c1, c2: Vector4_Components) -> Vector3f64 { return {v[c0], v[c1], v[c2]} } @(require_results) -vector4f64_swizzle4 :: proc(v: Vector4f64, c0, c1, c2, c3: Vector4_Components) -> Vector4f64 { +vector4f64_swizzle4 :: proc "contextless" (v: Vector4f64, c0, c1, c2, c3: Vector4_Components) -> Vector4f64 { return {v[c0], v[c1], v[c2], v[c3]} }