Skip to content

Commit

Permalink
Extend the default render range of the camera (#29)
Browse files Browse the repository at this point in the history
Done in order to match similar change in Bevy's camera (see
bevyengine/bevy#9310)
  • Loading branch information
drakmaniso committed Sep 8, 2023
1 parent 17b2f6c commit 96c8800
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
15 changes: 12 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "bevy_pixel_camera"
version = "0.5.0"
version = "0.5.1"
authors = ["drakmaniso <moussault.laurent@gmail.com>"]
edition = "2021"
description = "A simple pixel-perfect camera plugin for Bevy, suitable for pixel-art"
Expand All @@ -12,10 +12,19 @@ exclude = ["assets/**", ".vscode/**"]
license = "MIT OR Apache-2.0"

[dependencies]
bevy = { version = "0.11", default-features = false, features = ["bevy_core_pipeline", "bevy_render", "bevy_sprite"] }
bevy = { version = "0.11", default-features = false, features = [
"bevy_core_pipeline",
"bevy_render",
"bevy_sprite",
] }

[dev-dependencies]
bevy = { version = "0.11", default-features = false, features = ["bevy_winit", "bevy_asset", "png", "x11"] }
bevy = { version = "0.11", default-features = false, features = [
"bevy_winit",
"bevy_asset",
"png",
"x11",
] }

[[example]]
name = "flappin"
Expand Down
5 changes: 2 additions & 3 deletions src/pixel_camera.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ pub struct PixelCameraBundle {
impl PixelCameraBundle {
/// Create a component bundle for a camera with the specified projection.
pub fn new(pixel_projection: PixelProjection) -> Self {
let far = pixel_projection.far;
let transform = Transform::from_xyz(0.0, 0.0, far - 0.1);
let transform = Transform::from_xyz(0.0, 0.0, 0.0);
let view_projection =
pixel_projection.get_projection_matrix() * transform.compute_matrix().inverse();
let frustum = Frustum::from_view_projection_custom_far(
Expand Down Expand Up @@ -203,7 +202,7 @@ impl Default for PixelProjection {
right: 1.0,
bottom: -1.0,
top: 1.0,
near: 0.0,
near: -1000.0,
far: 1000.0,
desired_width: None,
desired_height: None,
Expand Down

0 comments on commit 96c8800

Please sign in to comment.