Browse Source

Add `f64` variants of all types and procedures

gingerBill 3 years ago
parent
commit
3accf4048e
2 changed files with 463 additions and 18 deletions
  1. 431 16
      core/math/linalg/glsl/linalg_glsl.odin
  2. 32 2
      core/math/linalg/glsl/linalg_glsl_math.odin

File diff suppressed because it is too large
+ 431 - 16
core/math/linalg/glsl/linalg_glsl.odin


+ 32 - 2
core/math/linalg/glsl/linalg_glsl_math.odin

@@ -16,11 +16,11 @@ acosh_f32       :: proc "c" (x: f32) -> f32 { return math.acosh(x) }
 asinh_f32       :: proc "c" (x: f32) -> f32 { return math.asinh(x) }
 asinh_f32       :: proc "c" (x: f32) -> f32 { return math.asinh(x) }
 atanh_f32       :: proc "c" (x: f32) -> f32 { return math.atanh(x) }
 atanh_f32       :: proc "c" (x: f32) -> f32 { return math.atanh(x) }
 sqrt_f32        :: proc "c" (x: f32) -> f32 { return math.sqrt(x) }
 sqrt_f32        :: proc "c" (x: f32) -> f32 { return math.sqrt(x) }
-inversesqrt_f32 :: proc "c" (x: f32) -> f32 { return 1.0/sqrt(x) }
+inversesqrt_f32 :: proc "c" (x: f32) -> f32 { return 1.0/math.sqrt(x) }
 pow_f32         :: proc "c" (x, y: f32) -> f32 { return math.pow(x, y) }
 pow_f32         :: proc "c" (x, y: f32) -> f32 { return math.pow(x, y) }
 exp_f32         :: proc "c" (x: f32) -> f32 { return math.exp(x) }
 exp_f32         :: proc "c" (x: f32) -> f32 { return math.exp(x) }
 log_f32         :: proc "c" (x: f32) -> f32 { return math.ln(x) }
 log_f32         :: proc "c" (x: f32) -> f32 { return math.ln(x) }
-exp2_f32        :: proc "c" (x: f32) -> f32 { return pow(2, x) }
+exp2_f32        :: proc "c" (x: f32) -> f32 { return math.pow(f32(2), x) }
 sign_f32        :: proc "c" (x: f32) -> f32 { return math.sign(x) }
 sign_f32        :: proc "c" (x: f32) -> f32 { return math.sign(x) }
 floor_f32       :: proc "c" (x: f32) -> f32 { return math.floor(x) }
 floor_f32       :: proc "c" (x: f32) -> f32 { return math.floor(x) }
 ceil_f32        :: proc "c" (x: f32) -> f32 { return math.ceil(x) }
 ceil_f32        :: proc "c" (x: f32) -> f32 { return math.ceil(x) }
@@ -31,3 +31,33 @@ fract_f32 :: proc "c" (x: f32) -> f32 {
 	}
 	}
 	return math.trunc(-x) + x
 	return math.trunc(-x) + x
 }
 }
+
+cos_f64         :: proc "c" (x: f64) -> f64 { return math.cos(x) }
+sin_f64         :: proc "c" (x: f64) -> f64 { return math.sin(x) }
+tan_f64         :: proc "c" (x: f64) -> f64 { return math.tan(x) }
+acos_f64        :: proc "c" (x: f64) -> f64 { return math.acos(x) }
+asin_f64        :: proc "c" (x: f64) -> f64 { return math.asin(x) }
+atan_f64        :: proc "c" (x: f64) -> f64 { return math.atan(x) }
+atan2_f64       :: proc "c" (y, x: f64) -> f64 { return math.atan2(y, x) }
+cosh_f64        :: proc "c" (x: f64) -> f64 { return math.cosh(x) }
+sinh_f64        :: proc "c" (x: f64) -> f64 { return math.sinh(x) }
+tanh_f64        :: proc "c" (x: f64) -> f64 { return math.tanh(x) }
+acosh_f64       :: proc "c" (x: f64) -> f64 { return math.acosh(x) }
+asinh_f64       :: proc "c" (x: f64) -> f64 { return math.asinh(x) }
+atanh_f64       :: proc "c" (x: f64) -> f64 { return math.atanh(x) }
+sqrt_f64        :: proc "c" (x: f64) -> f64 { return math.sqrt(x) }
+inversesqrt_f64 :: proc "c" (x: f64) -> f64 { return 1.0/math.sqrt(x) }
+pow_f64         :: proc "c" (x, y: f64) -> f64 { return math.pow(x, y) }
+exp_f64         :: proc "c" (x: f64) -> f64 { return math.exp(x) }
+log_f64         :: proc "c" (x: f64) -> f64 { return math.ln(x) }
+exp2_f64        :: proc "c" (x: f64) -> f64 { return math.pow(f64(2), x) }
+sign_f64        :: proc "c" (x: f64) -> f64 { return math.sign(x) }
+floor_f64       :: proc "c" (x: f64) -> f64 { return math.floor(x) }
+ceil_f64        :: proc "c" (x: f64) -> f64 { return math.ceil(x) }
+mod_f64         :: proc "c" (x, y: f64) -> f64 { return math.mod(x, y) }
+fract_f64 :: proc "c" (x: f64) -> f64 {
+	if x >= 0 {
+		return x - math.trunc(x)
+	}
+	return math.trunc(-x) + x
+}

Some files were not shown because too many files changed in this diff