camera: Fix Y inverted
Some checks failed
Build legacy Nix package on Ubuntu / build (push) Has been cancelled
Some checks failed
Build legacy Nix package on Ubuntu / build (push) Has been cancelled
This commit is contained in:
parent
8b16def890
commit
3a562fb6eb
2 changed files with 10 additions and 2 deletions
|
@ -11,6 +11,14 @@ use crate::core::{input::InputManager, timer::Timer};
|
||||||
|
|
||||||
use super::mvp::MVP;
|
use super::mvp::MVP;
|
||||||
|
|
||||||
|
// See docs/OPENGL_VULKAN_DIFF.md
|
||||||
|
const OPENGL_TO_VULKAN_Y_AXIS_FLIP: Mat4 = Mat4 {
|
||||||
|
x_axis: Vec4::new(1.0, 0.0, 0.0, 0.0),
|
||||||
|
y_axis: Vec4::new(0.0, -1.0, 0.0, 0.0),
|
||||||
|
z_axis: Vec4::new(0.0, 0.0, 1.0, 0.0),
|
||||||
|
w_axis: Vec4::new(0.0, 0.0, 0.0, 1.0),
|
||||||
|
};
|
||||||
|
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
pub struct Camera {
|
pub struct Camera {
|
||||||
projection: Mat4,
|
projection: Mat4,
|
||||||
|
@ -90,7 +98,7 @@ impl Camera {
|
||||||
);
|
);
|
||||||
|
|
||||||
MVP {
|
MVP {
|
||||||
model: Mat4::IDENTITY.to_cols_array_2d(),
|
model: OPENGL_TO_VULKAN_Y_AXIS_FLIP.to_cols_array_2d(),
|
||||||
view: view_matrix.to_cols_array_2d(),
|
view: view_matrix.to_cols_array_2d(),
|
||||||
projection: self.projection.to_cols_array_2d(),
|
projection: self.projection.to_cols_array_2d(),
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,7 +43,7 @@ impl Scene for MainScene {
|
||||||
scene_context.swapchain_format,
|
scene_context.swapchain_format,
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
let camera = Camera::new(Mat4::perspective_rh_gl(
|
let camera = Camera::new(Mat4::perspective_rh(
|
||||||
std::f32::consts::FRAC_PI_2,
|
std::f32::consts::FRAC_PI_2,
|
||||||
scene_context.aspect_ratio,
|
scene_context.aspect_ratio,
|
||||||
0.01,
|
0.01,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue