Skip to content

Commit

Permalink
Merge branch 'development' into box
Browse files Browse the repository at this point in the history
  • Loading branch information
pushfoo committed Jan 9, 2025
2 parents cee4aed + e85971b commit 5e998f2
Show file tree
Hide file tree
Showing 33 changed files with 1,451 additions and 165 deletions.
8 changes: 4 additions & 4 deletions arcade/camera/camera_2d.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,8 +262,8 @@ def use(self) -> None:
_projection = generate_orthographic_matrix(self.projection_data, self.zoom)
_view = generate_view_matrix(self.view_data)

self._window.ctx.viewport = self.viewport.viewport
self._window.ctx.scissor = None if not self.scissor else self.scissor.viewport
self._window.ctx.viewport = self.viewport.lbwh_int
self._window.ctx.scissor = None if not self.scissor else self.scissor.lbwh_int
self._window.projection = _projection
self._window.view = _view

Expand Down Expand Up @@ -295,7 +295,7 @@ def project(self, world_coordinate: Point) -> Vec2:

return project_orthographic(
world_coordinate,
self.viewport.viewport,
self.viewport.lbwh_int,
_view,
_projection,
)
Expand All @@ -318,7 +318,7 @@ def unproject(self, screen_coordinate: Point) -> Vec3:

_projection = generate_orthographic_matrix(self.projection_data, self.zoom)
_view = generate_view_matrix(self.view_data)
return unproject_orthographic(screen_coordinate, self.viewport.viewport, _view, _projection)
return unproject_orthographic(screen_coordinate, self.viewport.lbwh_int, _view, _projection)

def equalise(self) -> None:
"""
Expand Down
4 changes: 2 additions & 2 deletions arcade/camera/default.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def use(self) -> None:
"""
self._ctx.current_camera = self

self._ctx.viewport = self.viewport.viewport # get the integer 4-tuple LBWH
self._ctx.viewport = self.viewport.lbwh_int # get the integer 4-tuple LBWH

self._ctx.view_matrix = Mat4()
self._ctx.projection_matrix = self._projection_matrix
Expand Down Expand Up @@ -121,7 +121,7 @@ def use(self) -> None:
cache's the window viewport to determine the projection matrix.
"""

viewport = self.viewport.viewport
viewport = self.viewport.lbwh_int
# If the viewport is correct and the default camera is in use,
# then don't waste time resetting the view and projection matrices
if self._ctx.viewport == viewport and self._ctx.current_camera == self:
Expand Down
8 changes: 4 additions & 4 deletions arcade/camera/orthographic.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,8 @@ def use(self) -> None:
_projection = generate_orthographic_matrix(self._projection, self._view.zoom)
_view = generate_view_matrix(self._view)

self._window.ctx.viewport = self.viewport.viewport
self._window.ctx.scissor = None if not self.scissor else self.scissor.viewport
self._window.ctx.viewport = self.viewport.lbwh_int
self._window.ctx.scissor = None if not self.scissor else self.scissor.lbwh_int
self._window.projection = _projection
self._window.view = _view

Expand Down Expand Up @@ -165,7 +165,7 @@ def project(self, world_coordinate: Point) -> Vec2:

return project_orthographic(
world_coordinate,
self.viewport.viewport,
self.viewport.lbwh_int,
_view,
_projection,
)
Expand All @@ -188,4 +188,4 @@ def unproject(self, screen_coordinate: Point) -> Vec3:

_projection = generate_orthographic_matrix(self._projection, self._view.zoom)
_view = generate_view_matrix(self._view)
return unproject_orthographic(screen_coordinate, self.viewport.viewport, _view, _projection)
return unproject_orthographic(screen_coordinate, self.viewport.lbwh_int, _view, _projection)
8 changes: 4 additions & 4 deletions arcade/camera/perspective.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,8 @@ def use(self) -> None:
_projection = generate_perspective_matrix(self._projection, self._view.zoom)
_view = generate_view_matrix(self._view)

self._window.ctx.viewport = self.viewport.viewport
self._window.ctx.scissor = None if not self.scissor else self.scissor.viewport
self._window.ctx.viewport = self.viewport.lbwh_int
self._window.ctx.scissor = None if not self.scissor else self.scissor.lbwh_int
self._window.projection = _projection
self._window.view = _view

Expand Down Expand Up @@ -196,7 +196,7 @@ def project(self, world_coordinate: Point) -> Vec2:
_projection = generate_perspective_matrix(self._projection, self._view.zoom)
_view = generate_view_matrix(self._view)

pos = project_perspective(Vec3(x, y, z), self.viewport.viewport, _view, _projection)
pos = project_perspective(Vec3(x, y, z), self.viewport.lbwh_int, _view, _projection)

return pos

Expand Down Expand Up @@ -228,5 +228,5 @@ def unproject(self, screen_coordinate: Point) -> Vec3:
_projection = generate_perspective_matrix(self._projection, self._view.zoom)
_view = generate_view_matrix(self._view)

pos = unproject_perspective(Vec3(x, y, z), self.viewport.viewport, _view, _projection)
pos = unproject_perspective(Vec3(x, y, z), self.viewport.lbwh_int, _view, _projection)
return pos
Loading

0 comments on commit 5e998f2

Please sign in to comment.