diff options
author | tcmal <me@aria.rip> | 2024-08-25 17:44:22 +0100 |
---|---|---|
committer | tcmal <me@aria.rip> | 2024-08-25 17:44:22 +0100 |
commit | 8004132c918a52af3b2e7b32b4fc72c65fde9e3c (patch) | |
tree | 9e57c80762cfbb50f98bacfb745bbb988acc22a7 /examples | |
parent | 8c1406f7a42822d1b020cc672ed99d02eb34d22f (diff) |
feat(draw): attach camera position/settings to entity
Diffstat (limited to 'examples')
-rw-r--r-- | examples/render-bsp/src/main.rs | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/examples/render-bsp/src/main.rs b/examples/render-bsp/src/main.rs index 96d5e42..cea34cd 100644 --- a/examples/render-bsp/src/main.rs +++ b/examples/render-bsp/src/main.rs @@ -17,6 +17,7 @@ //! Renders ./example.bsp +use std::f32::consts::PI; use stockton_input::{Axis, InputManager}; #[macro_use] extern crate stockton_input_codegen; @@ -25,9 +26,11 @@ use winit::{event::Event, event_loop::EventLoop, window::WindowBuilder}; use stockton_levels::{prelude::*, q3::Q3BSPFile}; use stockton_render::{ - do_render_system, window::process_window_events_system, Renderer, WindowEvent, + do_render_system, draw::calc_vp_matrix_system, window::process_window_events_system, Renderer, + WindowEvent, }; -use stockton_types::Session; +use stockton_types::components::{CameraSettings, Transform}; +use stockton_types::{Session, Vector3}; #[derive(InputManager, Default, Clone, Debug)] struct MovementInputs { @@ -88,10 +91,24 @@ fn main() { move |schedule| { schedule .add_system(process_window_events_system::<MovementInputsManager>()) + .add_system(calc_vp_matrix_system()) .add_thread_local(do_render_system::<Q3BSPFile<VulkanSystem>>()); }, ); + // Add our player entity + let _player = session.world.push(( + Transform { + position: Vector3::new(0.0, 0.0, 0.0), + rotation: Vector3::new(0.0, PI / 2.0, 0.0), + }, + CameraSettings { + far: 1024.0, + fov: 90.0, + near: 0.1, + }, + )); + // Done loading - This is our main loop. // It just communicates events to the session and continuously ticks event_loop.run(move |event, _, flow| { |