Skip to content

Commit ce10529

Browse files
committed
Remove OrthographicProjection.scale
1 parent 05b0026 commit ce10529

File tree

5 files changed

+9
-18
lines changed

5 files changed

+9
-18
lines changed

crates/bevy_gltf/src/loader.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -935,8 +935,7 @@ fn load_node(
935935
let orthographic_projection = OrthographicProjection {
936936
near: orthographic.znear(),
937937
far: orthographic.zfar(),
938-
scaling_mode: ScalingMode::FixedHorizontal(1.0),
939-
scale: xmag,
938+
scaling_mode: ScalingMode::FixedHorizontal(xmag),
940939
..Default::default()
941940
};
942941

crates/bevy_render/src/camera/projection.rs

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -255,12 +255,6 @@ pub struct OrthographicProjection {
255255
///
256256
/// Defaults to `ScalingMode::WindowSize(1.0)`
257257
pub scaling_mode: ScalingMode,
258-
/// Scales the projection in world units.
259-
///
260-
/// As scale increases, the apparent size of objects decreases, and vice versa.
261-
///
262-
/// Defaults to `1.0`
263-
pub scale: f32,
264258
/// The area that the projection covers relative to `viewport_origin`.
265259
///
266260
/// Bevy's [`camera_system`](crate::camera::camera_system) automatically
@@ -325,10 +319,10 @@ impl CameraProjection for OrthographicProjection {
325319
let origin_y = projection_height * self.viewport_origin.y;
326320

327321
self.area = Rect::new(
328-
self.scale * -origin_x,
329-
self.scale * -origin_y,
330-
self.scale * (projection_width - origin_x),
331-
self.scale * (projection_height - origin_y),
322+
-origin_x,
323+
-origin_y,
324+
projection_width - origin_x,
325+
projection_height - origin_y,
332326
);
333327
}
334328

@@ -355,7 +349,6 @@ impl CameraProjection for OrthographicProjection {
355349
impl Default for OrthographicProjection {
356350
fn default() -> Self {
357351
OrthographicProjection {
358-
scale: 1.0,
359352
near: 0.0,
360353
far: 1000.0,
361354
viewport_origin: Vec2::new(0.5, 0.5),

examples/3d/orthographic.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@ fn setup(
1818
// camera
1919
commands.spawn(Camera3dBundle {
2020
projection: OrthographicProjection {
21-
scale: 3.0,
22-
scaling_mode: ScalingMode::FixedVertical(2.0),
21+
scaling_mode: ScalingMode::FixedVertical(6.0),
2322
..default()
2423
}
2524
.into(),

examples/3d/pbr.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
//! This example shows how to configure Physically Based Rendering (PBR) parameters.
22
33
use bevy::{asset::LoadState, prelude::*};
4+
use bevy_internal::render::camera::ScalingMode;
45

56
fn main() {
67
App::new()
@@ -129,7 +130,7 @@ fn setup(
129130
Camera3dBundle {
130131
transform: Transform::from_xyz(0.0, 0.0, 8.0).looking_at(Vec3::default(), Vec3::Y),
131132
projection: OrthographicProjection {
132-
scale: 0.01,
133+
scaling_mode: ScalingMode::WindowSize(100.0),
133134
..default()
134135
}
135136
.into(),

examples/stress_tests/many_lights.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,7 @@ fn setup(
9090
match std::env::args().nth(1).as_deref() {
9191
Some("orthographic") => commands.spawn(Camera3dBundle {
9292
projection: OrthographicProjection {
93-
scale: 20.0,
94-
scaling_mode: ScalingMode::FixedHorizontal(1.0),
93+
scaling_mode: ScalingMode::FixedHorizontal(20.0),
9594
..default()
9695
}
9796
.into(),

0 commit comments

Comments
 (0)