linalg_glsl_math.odin 3.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. package math_linalg_glsl
  2. import "core:math"
  3. cos_f32 :: proc "c" (x: f32) -> f32 { return math.cos(x) }
  4. sin_f32 :: proc "c" (x: f32) -> f32 { return math.sin(x) }
  5. tan_f32 :: proc "c" (x: f32) -> f32 { return math.tan(x) }
  6. acos_f32 :: proc "c" (x: f32) -> f32 { return math.acos(x) }
  7. asin_f32 :: proc "c" (x: f32) -> f32 { return math.asin(x) }
  8. atan_f32 :: proc "c" (x: f32) -> f32 { return math.atan(x) }
  9. atan2_f32 :: proc "c" (y, x: f32) -> f32 { return math.atan2(y, x) }
  10. cosh_f32 :: proc "c" (x: f32) -> f32 { return math.cosh(x) }
  11. sinh_f32 :: proc "c" (x: f32) -> f32 { return math.sinh(x) }
  12. tanh_f32 :: proc "c" (x: f32) -> f32 { return math.tanh(x) }
  13. acosh_f32 :: proc "c" (x: f32) -> f32 { return math.acosh(x) }
  14. asinh_f32 :: proc "c" (x: f32) -> f32 { return math.asinh(x) }
  15. atanh_f32 :: proc "c" (x: f32) -> f32 { return math.atanh(x) }
  16. sqrt_f32 :: proc "c" (x: f32) -> f32 { return math.sqrt(x) }
  17. inversesqrt_f32 :: proc "c" (x: f32) -> f32 { return 1.0/math.sqrt(x) }
  18. pow_f32 :: proc "c" (x, y: f32) -> f32 { return math.pow(x, y) }
  19. exp_f32 :: proc "c" (x: f32) -> f32 { return math.exp(x) }
  20. log_f32 :: proc "c" (x: f32) -> f32 { return math.ln(x) }
  21. exp2_f32 :: proc "c" (x: f32) -> f32 { return math.pow(f32(2), x) }
  22. sign_f32 :: proc "c" (x: f32) -> f32 { return math.sign(x) }
  23. floor_f32 :: proc "c" (x: f32) -> f32 { return math.floor(x) }
  24. round_f32 :: proc "c" (x: f32) -> f32 { return math.round(x) }
  25. ceil_f32 :: proc "c" (x: f32) -> f32 { return math.ceil(x) }
  26. mod_f32 :: proc "c" (x, y: f32) -> f32 { return math.mod(x, y) }
  27. fract_f32 :: proc "c" (x: f32) -> f32 {
  28. if x >= 0 {
  29. return x - math.trunc(x)
  30. }
  31. return math.trunc(-x) + x
  32. }
  33. cos_f64 :: proc "c" (x: f64) -> f64 { return math.cos(x) }
  34. sin_f64 :: proc "c" (x: f64) -> f64 { return math.sin(x) }
  35. tan_f64 :: proc "c" (x: f64) -> f64 { return math.tan(x) }
  36. acos_f64 :: proc "c" (x: f64) -> f64 { return math.acos(x) }
  37. asin_f64 :: proc "c" (x: f64) -> f64 { return math.asin(x) }
  38. atan_f64 :: proc "c" (x: f64) -> f64 { return math.atan(x) }
  39. atan2_f64 :: proc "c" (y, x: f64) -> f64 { return math.atan2(y, x) }
  40. cosh_f64 :: proc "c" (x: f64) -> f64 { return math.cosh(x) }
  41. sinh_f64 :: proc "c" (x: f64) -> f64 { return math.sinh(x) }
  42. tanh_f64 :: proc "c" (x: f64) -> f64 { return math.tanh(x) }
  43. acosh_f64 :: proc "c" (x: f64) -> f64 { return math.acosh(x) }
  44. asinh_f64 :: proc "c" (x: f64) -> f64 { return math.asinh(x) }
  45. atanh_f64 :: proc "c" (x: f64) -> f64 { return math.atanh(x) }
  46. sqrt_f64 :: proc "c" (x: f64) -> f64 { return math.sqrt(x) }
  47. inversesqrt_f64 :: proc "c" (x: f64) -> f64 { return 1.0/math.sqrt(x) }
  48. pow_f64 :: proc "c" (x, y: f64) -> f64 { return math.pow(x, y) }
  49. exp_f64 :: proc "c" (x: f64) -> f64 { return math.exp(x) }
  50. log_f64 :: proc "c" (x: f64) -> f64 { return math.ln(x) }
  51. exp2_f64 :: proc "c" (x: f64) -> f64 { return math.pow(f64(2), x) }
  52. sign_f64 :: proc "c" (x: f64) -> f64 { return math.sign(x) }
  53. floor_f64 :: proc "c" (x: f64) -> f64 { return math.floor(x) }
  54. round_f64 :: proc "c" (x: f64) -> f64 { return math.round(x) }
  55. ceil_f64 :: proc "c" (x: f64) -> f64 { return math.ceil(x) }
  56. mod_f64 :: proc "c" (x, y: f64) -> f64 { return math.mod(x, y) }
  57. fract_f64 :: proc "c" (x: f64) -> f64 {
  58. if x >= 0 {
  59. return x - math.trunc(x)
  60. }
  61. return math.trunc(-x) + x
  62. }