diff options
author | omniscient <17525998+omnisci3nce@users.noreply.github.com> | 2024-08-10 23:18:22 +1000 |
---|---|---|
committer | omniscient <17525998+omnisci3nce@users.noreply.github.com> | 2024-08-10 23:18:22 +1000 |
commit | ee1b7fd3bc66501b252ce9e3e5ba89ac9aa54632 (patch) | |
tree | 47b9b1916933d76bfcc327ad2f39370833bd3712 /bindgen/rust/celeritas-sys/src/lib.rs | |
parent | 8dc076e714fad6ee6fb493360e094c4002b1584a (diff) |
more work on bindings and ral
Diffstat (limited to 'bindgen/rust/celeritas-sys/src/lib.rs')
-rw-r--r-- | bindgen/rust/celeritas-sys/src/lib.rs | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/bindgen/rust/celeritas-sys/src/lib.rs b/bindgen/rust/celeritas-sys/src/lib.rs index 780ceff..90a5914 100644 --- a/bindgen/rust/celeritas-sys/src/lib.rs +++ b/bindgen/rust/celeritas-sys/src/lib.rs @@ -87,6 +87,19 @@ impl Transform { } } +impl Vec3 { + pub const ZERO: Self = Vec3 { + x: 0., + y: 0., + z: 0., + }; + pub const ONE: Self = Vec3 { + x: 1., + y: 1., + z: 1., + }; +} + impl Default for ShaderBinding { fn default() -> Self { Self { @@ -139,3 +152,16 @@ impl Default for Camera { camera } } + +// -- fat pointer string type + +impl Str8 { + pub fn from_str(s: &str) -> Self { + let s = s.to_owned(); + let s = s.leak(); // TODO: a better way than just leaking string memory :P + Self { + buf: s.as_mut_ptr(), + len: 0, + } + } +} |