From ca4c92f7b74ebbfc80bd24630cd0ad3def6c20fc Mon Sep 17 00:00:00 2001 From: omniscient <17525998+omnisci3nce@users.noreply.github.com> Date: Sat, 27 Jul 2024 22:38:25 +1000 Subject: serialize transform --- bindgen/rust/celeritas-sys/build.rs | 1 + bindgen/rust/src/lib.rs | 16 +++++++++++++--- 2 files changed, 14 insertions(+), 3 deletions(-) (limited to 'bindgen') diff --git a/bindgen/rust/celeritas-sys/build.rs b/bindgen/rust/celeritas-sys/build.rs index 9eaa44f..e2c240b 100644 --- a/bindgen/rust/celeritas-sys/build.rs +++ b/bindgen/rust/celeritas-sys/build.rs @@ -9,6 +9,7 @@ const SERIALIZABLE_TYPES: &[&'static str] = &[ "Vec4", "Mat4", "Quat", + "Transform", "DirectionalLight", "PointLight", ]; diff --git a/bindgen/rust/src/lib.rs b/bindgen/rust/src/lib.rs index 6f25752..c86e2d6 100644 --- a/bindgen/rust/src/lib.rs +++ b/bindgen/rust/src/lib.rs @@ -3,6 +3,9 @@ #![warn(missing_docs)] #![cfg_attr(docsrs, feature(doc_cfg))] +pub use celeritas_sys as ffi; + +/// Commonly used types pub mod prelude; use std::{ @@ -11,8 +14,7 @@ use std::{ path::Path, }; -pub use celeritas_sys as ffi; -use celeritas_sys::{DirectionalLight, PointLight, Vec3}; +use celeritas_sys::{DirectionalLight, PointLight, Transform, Vec3}; use serde::{Deserialize, Serialize}; /// Wrapper around a string that is the path to a gltf model **relative** to the configured @@ -20,13 +22,21 @@ use serde::{Deserialize, Serialize}; #[derive(Debug, Serialize, Deserialize)] pub struct ModelPath(String); +/// +#[derive(Debug, Serialize, Deserialize)] +pub struct ModelNode { + model_path: ModelPath, + transform: Transform +} + /// Scene that can be saved and loaded from disk #[derive(Debug, Serialize, Deserialize)] pub struct SerializableScene { + /// main light pub sun: DirectionalLight, pub point_lights: [Option; 4], pub camera_orientation: (Vec3, Vec3), - pub models: Vec, + pub models: Vec, } // Runtime Scene <-> Serialized Scene -- cgit v1.2.3-70-g09d2