mirror of
https://github.com/lisk77/comet.git
synced 2025-10-25 06:18:49 +00:00
feat: implemented a priority camera system that searches for the Entity with the Camera2D component with the smallest priority
This commit is contained in:
parent
8b439cb0e8
commit
4af65ed961
3 changed files with 49 additions and 10 deletions
|
|
@ -30,10 +30,13 @@ impl Camera {
|
|||
}
|
||||
|
||||
pub fn build_view_projection_matrix(&self) -> cgmath::Matrix4<f32> {
|
||||
OPENGL_TO_WGPU_MATRIX * cgmath::ortho(self.position.x() - self.dimension.x() / 2.0,
|
||||
self.position.x() + self.dimension.x() / 2.0,
|
||||
self.position.y() - self.dimension.y() / 2.0,
|
||||
self.position.y() + self.dimension.y() / 2.0,
|
||||
let zoomed_width = self.dimension.x() / self.zoom;
|
||||
let zoomed_height = self.dimension.y() / self.zoom;
|
||||
|
||||
OPENGL_TO_WGPU_MATRIX * cgmath::ortho(self.position.x() - zoomed_width / 2.0,
|
||||
self.position.x() + zoomed_width / 2.0,
|
||||
self.position.y() - zoomed_height / 2.0,
|
||||
self.position.y() + zoomed_height / 2.0,
|
||||
1.0,
|
||||
0.0)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue