diff options
author | omniscient <17525998+omnisci3nce@users.noreply.github.com> | 2024-07-27 22:38:25 +1000 |
---|---|---|
committer | omniscient <17525998+omnisci3nce@users.noreply.github.com> | 2024-07-27 22:38:25 +1000 |
commit | ca4c92f7b74ebbfc80bd24630cd0ad3def6c20fc (patch) | |
tree | 97add3d530402670068a114fc803658d562993e1 /bindgen | |
parent | f37e974a19fca37d0e7999c7ffc49dcbcd50b081 (diff) |
serialize transform
Diffstat (limited to 'bindgen')
-rw-r--r-- | bindgen/rust/celeritas-sys/build.rs | 1 | ||||
-rw-r--r-- | bindgen/rust/src/lib.rs | 16 |
2 files changed, 14 insertions, 3 deletions
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<PointLight>; 4], pub camera_orientation: (Vec3, Vec3), - pub models: Vec<ModelPath>, + pub models: Vec<ModelNode>, } // Runtime Scene <-> Serialized Scene |