Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Merged by Bors] - Change scaling mode to FixedHorizontal #4055

Closed
wants to merge 2 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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();
kirusfg marked this conversation as resolved.
Show resolved Hide resolved
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