From ee1b7fd3bc66501b252ce9e3e5ba89ac9aa54632 Mon Sep 17 00:00:00 2001 From: omniscient <17525998+omnisci3nce@users.noreply.github.com> Date: Sat, 10 Aug 2024 23:18:22 +1000 Subject: more work on bindings and ral --- bindgen/rust/celeritas-sys/src/lib.rs | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'bindgen/rust/celeritas-sys/src') 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, + } + } +} -- cgit v1.2.3-70-g09d2