diff options
author | omniscient <17525998+omnisci3nce@users.noreply.github.com> | 2024-07-21 16:17:26 +1000 |
---|---|---|
committer | omniscient <17525998+omnisci3nce@users.noreply.github.com> | 2024-07-21 16:18:15 +1000 |
commit | 774fc54355abe70a1ba045ade99649ba0e98c930 (patch) | |
tree | e8c4f07b18d9b716446347797e3bc59c2d66bec2 /bindgen/rust/examples | |
parent | 47465948f2a5a85d0882ff116fce095f401d69c1 (diff) |
start adding rust bindgen
Diffstat (limited to 'bindgen/rust/examples')
-rw-r--r-- | bindgen/rust/examples/main_loop.rs | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/bindgen/rust/examples/main_loop.rs b/bindgen/rust/examples/main_loop.rs new file mode 100644 index 0000000..a74e11c --- /dev/null +++ b/bindgen/rust/examples/main_loop.rs @@ -0,0 +1,39 @@ +use celeritas::*; + +unsafe fn run_game() { + // init + Core_Bringup(); + + // let mut cube_geo = Geo_CreateCuboid(Vec3 { x: 1.0, y: 1.0, z: 1.0 }); + // let cube = Mesh_Create(&mut cube_geo, false); + + let camera_pos = Vec3 { x: 0.0, y: 2.0, z: -3.0 }; + let pos_y = Vec3 { x: 0., y: 1.0, z: 0. }; + let camera = Camera_Create(camera_pos, vec3_normalise(vec3_negate(camera_pos)), pos_y, 45.0); + SetCamera(camera); + // let camera = Camera_Create(camera_pos, vec3_normalise(vec3_negate(camera_pos)), VEC3_Y, 45.0); + // SetCamera(cam); // update the camera in RenderScene + + let whatever = Vec3 { x: 1.0, y: 1.0, z: 1.0 }; + let sun = DirectionalLight { direction: whatever, ambient: whatever, diffuse: whatever, specular: whatever }; + SetMainLight(sun); + + // Skybox skybox = Skybox_Create(faces, 6); + let skybox = Skybox_Create(face_paths, 6); + + while !ShouldExit() { + Frame_Begin(); + + + + Frame_End(); + } +} + +fn main() { + println!("Running from Rust!"); + + unsafe { + run_game(); + } +} |