diff options
author | omniscient <17525998+omnisci3nce@users.noreply.github.com> | 2024-08-10 13:25:53 +1000 |
---|---|---|
committer | omniscient <17525998+omnisci3nce@users.noreply.github.com> | 2024-08-10 13:25:53 +1000 |
commit | 071a635e63536e50abfad7d5aeca1208dba58025 (patch) | |
tree | e96c10f24f0accc4276ccf7d426a263fb8a14ffd | |
parent | dcb9f65b25e59edb21c9c3cac7b32d70ca19eb72 (diff) |
impl Default for Camera
-rw-r--r-- | bindgen/rust/celeritas-sys/src/lib.rs | 28 | ||||
-rw-r--r-- | bindgen/rust/src/lib.rs | 3 | ||||
-rw-r--r-- | scripts/gen_amalgamation.py | 24 |
3 files changed, 30 insertions, 25 deletions
diff --git a/bindgen/rust/celeritas-sys/src/lib.rs b/bindgen/rust/celeritas-sys/src/lib.rs index e6f62ad..780ceff 100644 --- a/bindgen/rust/celeritas-sys/src/lib.rs +++ b/bindgen/rust/celeritas-sys/src/lib.rs @@ -111,3 +111,31 @@ impl Default for ShaderDataLayout { } } } + +impl Default for Camera { + fn default() -> Self { + let camera_pos = Vec3 { + x: 18.9, + y: 10.6, + z: 11.6, + }; + let camera_front = Vec3 { + x: -0.6, + y: -0.2, + z: -0.7, + }; + let camera = unsafe { + Camera_Create( + camera_pos, + camera_front, + Vec3 { + x: 0.0, + y: 1.0, + z: 0.0, + }, + 45.0, + ) + }; + camera + } +} diff --git a/bindgen/rust/src/lib.rs b/bindgen/rust/src/lib.rs index a20a9e8..f2e177f 100644 --- a/bindgen/rust/src/lib.rs +++ b/bindgen/rust/src/lib.rs @@ -20,7 +20,8 @@ use std::{ }; use celeritas_sys::{ - Core_Bringup, Core_Shutdown, DirectionalLight, PointLight, RenderEnt, Transform, Vec3, + Camera, Camera_Create, Core_Bringup, Core_Shutdown, DirectionalLight, PointLight, RenderEnt, + Transform, Vec3, }; use serde::{Deserialize, Serialize}; diff --git a/scripts/gen_amalgamation.py b/scripts/gen_amalgamation.py deleted file mode 100644 index 45a1c21..0000000 --- a/scripts/gen_amalgamation.py +++ /dev/null @@ -1,24 +0,0 @@ -# Generates a single amalgamation C header file that includes all public types and functions. -# -# This makes including and linking Celeritas very easy. -import re -import sys - -def find_pub_functions(filepath): - pattern = r'PUB\s+(\w+\s+)*(\w+)\s+(\w+)\s*\((.*?)\)' - - with open(filepath, 'r') as file: - content = file.read() - - matches = re.finditer(pattern, content, re.MULTILINE) - - for match in matches: - print(match.group(0)) - -if __name__ == "__main__": - if len(sys.argv) != 2: - print("Usage: python script.py <path_to_c_file>") - sys.exit(1) - - file_path = sys.argv[1] - find_pub_functions(file_path) |