125 lines
2.5 KiB
Text
125 lines
2.5 KiB
Text
#module_parameters(
|
|
STATIC := true,
|
|
SIMD := true,
|
|
UNITS := (enum { radians; degrees; turns; }).radians
|
|
);
|
|
|
|
#scope_export;
|
|
|
|
#if SIMD {
|
|
// @note(judah): When SIMD is enabled, the bindings generator incorrectly outputs these types right now.
|
|
Quat :: union {
|
|
struct {
|
|
union {
|
|
xyz: Vec3;
|
|
struct { x: float; y: float; z: float; }
|
|
}
|
|
w: float;
|
|
}
|
|
|
|
elements: [4]float;
|
|
_: u8 #align 16;
|
|
}
|
|
|
|
Vec4 :: union {
|
|
struct {
|
|
union {
|
|
xyz: Vec3;
|
|
struct { x: float; y: float; z: float; }
|
|
}
|
|
w: float;
|
|
}
|
|
|
|
struct {
|
|
union {
|
|
rgb: Vec3;
|
|
struct { r: float; g: float; b: float; }
|
|
}
|
|
a: float;
|
|
}
|
|
|
|
struct {
|
|
xy: Vec2;
|
|
_: float;
|
|
_: float;
|
|
}
|
|
|
|
struct {
|
|
_: float;
|
|
yz: Vec2;
|
|
_: float;
|
|
}
|
|
|
|
struct {
|
|
_: float;
|
|
_: float;
|
|
zw: Vec2;
|
|
}
|
|
|
|
elements: [4] float;
|
|
_: u8 #align 16;
|
|
}
|
|
|
|
#load "hmm_simd.jai";
|
|
} else {
|
|
#load "hmm_nosimd.jai";
|
|
}
|
|
|
|
#insert #run build_specific_library_directive();
|
|
|
|
|
|
#scope_file;
|
|
|
|
name :: #run -> string {
|
|
b: String_Builder;
|
|
append(*b, "hmm_");
|
|
#if UNITS == {
|
|
case .radians; append(*b, "radians_");
|
|
case .degrees; append(*b, "degrees_");
|
|
case .turns; append(*b, "turns_");
|
|
}
|
|
|
|
#if SIMD {
|
|
append(*b, "simd");
|
|
}
|
|
else {
|
|
append(*b, "nosimd");
|
|
}
|
|
|
|
return builder_to_string(*b);
|
|
};
|
|
|
|
build_specific_library_directive :: () -> string #compile_time {
|
|
b: String_Builder;
|
|
|
|
// @todo(judah): I'm not sure how to override the internal libname used by
|
|
// the bindings generator for #library directives. Because of this,
|
|
// we do a dumb thing and always use hmm_radians as the libname, even though
|
|
// we redirect it to the proper radians/degrees/turns library (based on the module params).
|
|
append(*b, "hmm_radians_");
|
|
#if SIMD {
|
|
append(*b, "simd");
|
|
}
|
|
else {
|
|
append(*b, "nosimd");
|
|
}
|
|
append(*b, " :: ");
|
|
|
|
append(*b, "#library");
|
|
#if STATIC append(*b, ",no_dll,link_always");
|
|
|
|
append(*b, " \"");
|
|
|
|
#if OS == {
|
|
case .WINDOWS; append(*b, "win/");
|
|
case .MACOS; append(*b, "mac/");
|
|
case .LINUX; append(*b, "linux/");
|
|
}
|
|
|
|
append(*b, name);
|
|
append(*b, "\"; ");
|
|
|
|
return builder_to_string(*b);
|
|
}
|
|
|
|
#import "Basic";
|