Fix render pass viewport in custom_shader example

This commit is contained in:
Joonas Satka 2025-01-21 09:38:13 +02:00 committed by Héctor Ramón Jiménez
parent 5195a59e20
commit 56bb4ce721
No known key found for this signature in database
GPG key ID: 7CC46565708259A7
2 changed files with 18 additions and 16 deletions

View file

@ -33,9 +33,7 @@ pub const OPENGL_TO_WGPU_MATRIX: glam::Mat4 = mat4(
impl Camera {
pub fn build_view_proj_matrix(&self, bounds: Rectangle) -> glam::Mat4 {
//TODO looks distorted without padding; base on surface texture size instead?
let aspect_ratio = bounds.width / (bounds.height + 150.0);
let aspect_ratio = bounds.width / bounds.height;
let view = glam::Mat4::look_at_rh(self.eye, self.target, self.up);
let proj = glam::Mat4::perspective_rh(
self.fov_y,