aboutsummaryrefslogtreecommitdiff
path: root/stockton-render/src/draw/camera.rs
diff options
context:
space:
mode:
authortcmal <me@aria.rip>2024-08-25 17:44:23 +0100
committertcmal <me@aria.rip>2024-08-25 17:44:23 +0100
commitfb996488aa651cb2e7f46abc083c4318b47e77cd (patch)
treed1513d479b6069abca290e271f439cd1ef553383 /stockton-render/src/draw/camera.rs
parenta82e16c92a026b2fbe3a40a21d7e690242e32ba6 (diff)
wip refactor(render): more work on draw passes
Diffstat (limited to 'stockton-render/src/draw/camera.rs')
-rw-r--r--stockton-render/src/draw/camera.rs64
1 files changed, 32 insertions, 32 deletions
diff --git a/stockton-render/src/draw/camera.rs b/stockton-render/src/draw/camera.rs
index a9d10f4..421b661 100644
--- a/stockton-render/src/draw/camera.rs
+++ b/stockton-render/src/draw/camera.rs
@@ -22,35 +22,35 @@ fn euler_to_direction(euler: &Vector3) -> Vector3 {
)
}
-#[system(for_each)]
-#[filter(maybe_changed::<Transform>() | maybe_changed::<CameraSettings>())]
-pub fn calc_vp_matrix<M: 'static + MinRenderFeatures>(
- transform: &Transform,
- settings: &CameraSettings,
- #[resource] renderer: &mut Renderer<M>,
-) {
- let ratio = renderer.context.target_chain.properties.extent.width as f32
- / renderer.context.target_chain.properties.extent.height as f32;
- // Get look direction from euler angles
- let direction = euler_to_direction(&transform.rotation);
-
- // Converts world space to camera space
- let view_matrix = look_at_lh(
- &transform.position,
- &(transform.position + direction),
- &Vector3::new(0.0, 1.0, 0.0),
- );
-
- // Converts camera space to screen space
- let projection_matrix = {
- let mut temp = perspective_lh_zo(ratio, settings.fov, settings.near, settings.far);
-
- // Vulkan's co-ord system is different from OpenGLs
- temp[(1, 1)] *= -1.0;
-
- temp
- };
-
- // Chain them together into a single matrix
- renderer.context.vp_matrix = projection_matrix * view_matrix
-}
+// #[system(for_each)]
+// #[filter(maybe_changed::<Transform>() | maybe_changed::<CameraSettings>())]
+// pub fn calc_vp_matrix<M: 'static + MinRenderFeatures>(
+// transform: &Transform,
+// settings: &CameraSettings,
+// #[resource] renderer: &mut Renderer<M>,
+// ) {
+// let ratio = renderer.context.target_chain.properties.extent.width as f32
+// / renderer.context.target_chain.properties.extent.height as f32;
+// // Get look direction from euler angles
+// let direction = euler_to_direction(&transform.rotation);
+
+// // Converts world space to camera space
+// let view_matrix = look_at_lh(
+// &transform.position,
+// &(transform.position + direction),
+// &Vector3::new(0.0, 1.0, 0.0),
+// );
+
+// // Converts camera space to screen space
+// let projection_matrix = {
+// let mut temp = perspective_lh_zo(ratio, settings.fov, settings.near, settings.far);
+
+// // Vulkan's co-ord system is different from OpenGLs
+// temp[(1, 1)] *= -1.0;
+
+// temp
+// };
+
+// // Chain them together into a single matrix
+// renderer.context.vp_matrix = projection_matrix * view_matrix
+// }