mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-06 15:48:51 +00:00
Merge branch 'master' of github.com:odin-lang/Odin
This commit is contained in:
@@ -470,6 +470,15 @@ Raw_Soa_Pointer :: struct {
|
|||||||
index: int,
|
index: int,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Raw_Complex32 :: struct {real, imag: f16}
|
||||||
|
Raw_Complex64 :: struct {real, imag: f32}
|
||||||
|
Raw_Complex128 :: struct {real, imag: f64}
|
||||||
|
Raw_Quaternion64 :: struct {imag, jmag, kmag: f16, real: f16}
|
||||||
|
Raw_Quaternion128 :: struct {imag, jmag, kmag: f32, real: f32}
|
||||||
|
Raw_Quaternion256 :: struct {imag, jmag, kmag: f64, real: f64}
|
||||||
|
Raw_Quaternion64_Vector_Scalar :: struct {vector: [3]f16, scalar: f16}
|
||||||
|
Raw_Quaternion128_Vector_Scalar :: struct {vector: [3]f32, scalar: f32}
|
||||||
|
Raw_Quaternion256_Vector_Scalar :: struct {vector: [3]f64, scalar: f64}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package linalg
|
|||||||
import "core:math"
|
import "core:math"
|
||||||
import "base:builtin"
|
import "base:builtin"
|
||||||
import "base:intrinsics"
|
import "base:intrinsics"
|
||||||
|
import "base:runtime"
|
||||||
|
|
||||||
// Generic
|
// Generic
|
||||||
|
|
||||||
@@ -223,33 +224,27 @@ quaternion_mul_quaternion :: proc "contextless" (q1, q2: $Q) -> Q where IS_QUATE
|
|||||||
|
|
||||||
@(require_results)
|
@(require_results)
|
||||||
quaternion64_mul_vector3 :: proc "contextless" (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(runtime.Raw_Quaternion64_Vector_Scalar)q
|
||||||
|
|
||||||
q := transmute(Raw_Quaternion)q
|
|
||||||
v := v
|
v := v
|
||||||
|
|
||||||
t := cross(2*q.xyz, v)
|
t := cross(2*q.vector, v)
|
||||||
return V(v + q.r*t + cross(q.xyz, t))
|
return V(v + q.scalar*t + cross(q.vector, t))
|
||||||
}
|
}
|
||||||
@(require_results)
|
@(require_results)
|
||||||
quaternion128_mul_vector3 :: proc "contextless" (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(runtime.Raw_Quaternion128_Vector_Scalar)q
|
||||||
|
|
||||||
q := transmute(Raw_Quaternion)q
|
|
||||||
v := v
|
v := v
|
||||||
|
|
||||||
t := cross(2*q.xyz, v)
|
t := cross(2*q.vector, v)
|
||||||
return V(v + q.r*t + cross(q.xyz, t))
|
return V(v + q.scalar*t + cross(q.vector, t))
|
||||||
}
|
}
|
||||||
@(require_results)
|
@(require_results)
|
||||||
quaternion256_mul_vector3 :: proc "contextless" (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(runtime.Raw_Quaternion256_Vector_Scalar)q
|
||||||
|
|
||||||
q := transmute(Raw_Quaternion)q
|
|
||||||
v := v
|
v := v
|
||||||
|
|
||||||
t := cross(2*q.xyz, v)
|
t := cross(2*q.vector, v)
|
||||||
return V(v + q.r*t + cross(q.xyz, t))
|
return V(v + q.scalar*t + cross(q.vector, t))
|
||||||
}
|
}
|
||||||
quaternion_mul_vector3 :: proc{quaternion64_mul_vector3, quaternion128_mul_vector3, quaternion256_mul_vector3}
|
quaternion_mul_vector3 :: proc{quaternion64_mul_vector3, quaternion128_mul_vector3, quaternion256_mul_vector3}
|
||||||
|
|
||||||
|
|||||||
+9
-6
@@ -11,12 +11,15 @@ Raw_Dynamic_Array :: runtime.Raw_Dynamic_Array
|
|||||||
Raw_Map :: runtime.Raw_Map
|
Raw_Map :: runtime.Raw_Map
|
||||||
Raw_Soa_Pointer :: runtime.Raw_Soa_Pointer
|
Raw_Soa_Pointer :: runtime.Raw_Soa_Pointer
|
||||||
|
|
||||||
Raw_Complex64 :: struct {real, imag: f32}
|
Raw_Complex32 :: runtime.Raw_Complex32
|
||||||
Raw_Complex128 :: struct {real, imag: f64}
|
Raw_Complex64 :: runtime.Raw_Complex64
|
||||||
Raw_Quaternion128 :: struct {imag, jmag, kmag: f32, real: f32}
|
Raw_Complex128 :: runtime.Raw_Complex128
|
||||||
Raw_Quaternion256 :: struct {imag, jmag, kmag: f64, real: f64}
|
Raw_Quaternion64 :: runtime.Raw_Quaternion64
|
||||||
Raw_Quaternion128_Vector_Scalar :: struct {vector: [3]f32, scalar: f32}
|
Raw_Quaternion128 :: runtime.Raw_Quaternion128
|
||||||
Raw_Quaternion256_Vector_Scalar :: struct {vector: [3]f64, scalar: f64}
|
Raw_Quaternion256 :: runtime.Raw_Quaternion256
|
||||||
|
Raw_Quaternion64_Vector_Scalar :: runtime.Raw_Quaternion64_Vector_Scalar
|
||||||
|
Raw_Quaternion128_Vector_Scalar :: runtime.Raw_Quaternion128_Vector_Scalar
|
||||||
|
Raw_Quaternion256_Vector_Scalar :: runtime.Raw_Quaternion256_Vector_Scalar
|
||||||
|
|
||||||
make_any :: proc "contextless" (data: rawptr, id: typeid) -> any {
|
make_any :: proc "contextless" (data: rawptr, id: typeid) -> any {
|
||||||
return transmute(any)Raw_Any{data, id}
|
return transmute(any)Raw_Any{data, id}
|
||||||
|
|||||||
@@ -442,7 +442,7 @@ F_GETPATH :: 50 // return the full path of the fd
|
|||||||
foreign libc {
|
foreign libc {
|
||||||
@(link_name="__error") __error :: proc() -> ^c.int ---
|
@(link_name="__error") __error :: proc() -> ^c.int ---
|
||||||
|
|
||||||
@(link_name="open") _unix_open :: proc(path: cstring, flags: i32, mode: u16) -> Handle ---
|
@(link_name="open") _unix_open :: proc(path: cstring, flags: i32, #c_vararg args: ..any) -> Handle ---
|
||||||
@(link_name="close") _unix_close :: proc(handle: Handle) -> c.int ---
|
@(link_name="close") _unix_close :: proc(handle: Handle) -> c.int ---
|
||||||
@(link_name="read") _unix_read :: proc(handle: Handle, buffer: rawptr, count: c.size_t) -> int ---
|
@(link_name="read") _unix_read :: proc(handle: Handle, buffer: rawptr, count: c.size_t) -> int ---
|
||||||
@(link_name="write") _unix_write :: proc(handle: Handle, buffer: rawptr, count: c.size_t) -> int ---
|
@(link_name="write") _unix_write :: proc(handle: Handle, buffer: rawptr, count: c.size_t) -> int ---
|
||||||
|
|||||||
Vendored
+1
-1
@@ -47,7 +47,7 @@ foreign egl {
|
|||||||
GetDisplay :: proc(display: NativeDisplayType) -> Display ---
|
GetDisplay :: proc(display: NativeDisplayType) -> Display ---
|
||||||
Initialize :: proc(display: Display, major: ^i32, minor: ^i32) -> i32 ---
|
Initialize :: proc(display: Display, major: ^i32, minor: ^i32) -> i32 ---
|
||||||
BindAPI :: proc(api: u32) -> i32 ---
|
BindAPI :: proc(api: u32) -> i32 ---
|
||||||
ChooseConfig :: proc(display: Display, attrib_list: ^i32, configs: ^Context, config_size: i32, num_config: ^i32) -> i32 ---
|
ChooseConfig :: proc(display: Display, attrib_list: ^i32, configs: ^Config, config_size: i32, num_config: ^i32) -> i32 ---
|
||||||
CreateWindowSurface :: proc(display: Display, config: Config, native_window: NativeWindowType, attrib_list: ^i32) -> Surface ---
|
CreateWindowSurface :: proc(display: Display, config: Config, native_window: NativeWindowType, attrib_list: ^i32) -> Surface ---
|
||||||
CreateContext :: proc(display: Display, config: Config, share_context: Context, attrib_list: ^i32) -> Context ---
|
CreateContext :: proc(display: Display, config: Config, share_context: Context, attrib_list: ^i32) -> Context ---
|
||||||
MakeCurrent :: proc(display: Display, draw: Surface, read: Surface, ctx: Context) -> i32 ---
|
MakeCurrent :: proc(display: Display, draw: Surface, read: Surface, ctx: Context) -> i32 ---
|
||||||
|
|||||||
Vendored
+1287
-1279
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user