Skip to content

Commit

Permalink
Change scaling mode to FixedHorizontal
Browse files Browse the repository at this point in the history
  • Loading branch information
kirusfg committed Apr 8, 2022
1 parent 024d984 commit bd2b6b0
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions crates/bevy_gltf/src/loader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ use bevy_pbr::{
};
use bevy_render::{
camera::{
Camera, Camera2d, Camera3d, CameraProjection, OrthographicProjection, PerspectiveProjection,
Camera, Camera3d, CameraProjection, OrthographicProjection, PerspectiveProjection,
ScalingMode,
},
color::Color,
mesh::{Indices, Mesh, VertexAttributeValues},
Expand Down Expand Up @@ -604,22 +605,23 @@ fn load_node(
match camera.projection() {
gltf::camera::Projection::Orthographic(orthographic) => {
let xmag = orthographic.xmag();
let ymag = orthographic.ymag();
let _ymag = orthographic.ymag();
let orthographic_projection: OrthographicProjection = OrthographicProjection {
left: -xmag,
right: xmag,
top: ymag,
bottom: -ymag,
far: orthographic.zfar(),
near: orthographic.znear(),
scaling_mode: ScalingMode::FixedHorizontal,
scale: xmag / 2.0,
..Default::default()
};

node.insert(Camera {
projection_matrix: orthographic_projection.get_projection_matrix(),
near: orthographic_projection.near,
far: orthographic_projection.far,
..Default::default()
});
node.insert(orthographic_projection).insert(Camera2d);
node.insert(orthographic_projection);
node.insert(Camera3d);
}
gltf::camera::Projection::Perspective(perspective) => {
let mut perspective_projection: PerspectiveProjection = PerspectiveProjection {
Expand Down

0 comments on commit bd2b6b0

Please sign in to comment.