Skip to content

Commit f61e44d

Browse files
bitshifterCameron Hart
andcommitted
Update glam to 0.13.0. (#1550)
See https://github.com/bitshifter/glam-rs/blob/master/CHANGELOG.md for details on changes. Co-authored-by: Cameron Hart <c_hart@wargaming.net>
1 parent 0eba5f3 commit f61e44d

29 files changed

+43
-60
lines changed

crates/bevy_core/src/bytes.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,6 @@ mod tests {
231231

232232
#[test]
233233
fn test_mat4_round_trip() {
234-
test_round_trip(Mat4::identity());
234+
test_round_trip(Mat4::IDENTITY);
235235
}
236236
}

crates/bevy_math/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,5 @@ license = "MIT"
1313
keywords = ["bevy"]
1414

1515
[dependencies]
16-
glam = { version = "0.12.0", features = ["serde"] }
16+
glam = { version = "0.13.0", features = ["serde"] }
1717
bevy_reflect = { path = "../bevy_reflect", version = "0.4.0", features = ["bevy"] }

crates/bevy_reflect/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ parking_lot = "0.11.0"
2828
thiserror = "1.0"
2929
serde = "1"
3030
smallvec = { version = "1.4", features = ["serde"], optional = true }
31-
glam = { version = "0.12.0", features = ["serde"], optional = true }
31+
glam = { version = "0.13.0", features = ["serde"], optional = true }
3232

3333
[dev-dependencies]
3434
ron = "0.6.2"

crates/bevy_render/src/camera/camera.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,13 @@ impl Camera {
5252
// Build a transform to convert from world to NDC using camera data
5353
let world_to_ndc: Mat4 =
5454
self.projection_matrix * camera_transform.compute_matrix().inverse();
55-
let ndc_space_coords: Vec3 = world_to_ndc.transform_point3(world_position);
55+
let ndc_space_coords: Vec3 = world_to_ndc.project_point3(world_position);
5656
// NDC z-values outside of 0 < z < 1 are behind the camera and are thus not in screen space
5757
if ndc_space_coords.z < 0.0 || ndc_space_coords.z > 1.0 {
5858
return None;
5959
}
6060
// Once in NDC space, we can discard the z element and rescale x/y to fit the screen
61-
let screen_space_coords = (ndc_space_coords.truncate() + Vec2::one()) / 2.0 * window_size;
61+
let screen_space_coords = (ndc_space_coords.truncate() + Vec2::ONE) / 2.0 * window_size;
6262
Some(screen_space_coords)
6363
}
6464
}

crates/bevy_render/src/mesh/shape/torus.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ impl From<Torus> for Mesh {
4848
let z = theta.sin() * (torus.radius + torus.ring_radius * phi.cos());
4949
let y = torus.ring_radius * phi.sin();
5050

51-
let normal = segment_pos.cross(Vec3::unit_y()).normalize();
51+
let normal = segment_pos.cross(Vec3::Y).normalize();
5252

5353
positions.push([x, y, z]);
5454
normals.push(normal.into());

crates/bevy_text/src/text2d.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,14 +96,14 @@ pub fn draw_text2d_system(
9696
if let Some(text_glyphs) = text_pipeline.get_glyphs(&entity) {
9797
let position = global_transform.translation
9898
+ match text.alignment.vertical {
99-
VerticalAlign::Top => Vec3::zero(),
99+
VerticalAlign::Top => Vec3::ZERO,
100100
VerticalAlign::Center => Vec3::new(0.0, -height * 0.5, 0.0),
101101
VerticalAlign::Bottom => Vec3::new(0.0, -height, 0.0),
102102
}
103103
+ match text.alignment.horizontal {
104104
HorizontalAlign::Left => Vec3::new(-width, 0.0, 0.0),
105105
HorizontalAlign::Center => Vec3::new(-width * 0.5, 0.0, 0.0),
106-
HorizontalAlign::Right => Vec3::zero(),
106+
HorizontalAlign::Right => Vec3::ZERO,
107107
};
108108

109109
let mut drawable_text = DrawableText {

crates/bevy_transform/src/components/global_transform.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ impl GlobalTransform {
2222
#[inline]
2323
pub fn identity() -> Self {
2424
GlobalTransform {
25-
translation: Vec3::zero(),
26-
rotation: Quat::identity(),
27-
scale: Vec3::one(),
25+
translation: Vec3::ZERO,
26+
rotation: Quat::IDENTITY,
27+
scale: Vec3::ONE,
2828
}
2929
}
3030

@@ -78,19 +78,19 @@ impl GlobalTransform {
7878
#[inline]
7979
/// Get the unit vector in the local x direction
8080
pub fn local_x(&self) -> Vec3 {
81-
self.rotation * Vec3::unit_x()
81+
self.rotation * Vec3::X
8282
}
8383

8484
#[inline]
8585
/// Get the unit vector in the local y direction
8686
pub fn local_y(&self) -> Vec3 {
87-
self.rotation * Vec3::unit_y()
87+
self.rotation * Vec3::Y
8888
}
8989

9090
#[inline]
9191
/// Get the unit vector in the local z direction
9292
pub fn local_z(&self) -> Vec3 {
93-
self.rotation * Vec3::unit_z()
93+
self.rotation * Vec3::Z
9494
}
9595

9696
#[inline]

crates/bevy_transform/src/components/transform.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ impl Transform {
2222
#[inline]
2323
pub fn identity() -> Self {
2424
Transform {
25-
translation: Vec3::zero(),
26-
rotation: Quat::identity(),
27-
scale: Vec3::one(),
25+
translation: Vec3::ZERO,
26+
rotation: Quat::IDENTITY,
27+
scale: Vec3::ONE,
2828
}
2929
}
3030

@@ -78,19 +78,19 @@ impl Transform {
7878
#[inline]
7979
/// Get the unit vector in the local x direction
8080
pub fn local_x(&self) -> Vec3 {
81-
self.rotation * Vec3::unit_x()
81+
self.rotation * Vec3::X
8282
}
8383

8484
#[inline]
8585
/// Get the unit vector in the local y direction
8686
pub fn local_y(&self) -> Vec3 {
87-
self.rotation * Vec3::unit_y()
87+
self.rotation * Vec3::Y
8888
}
8989

9090
#[inline]
9191
/// Get the unit vector in the local z direction
9292
pub fn local_z(&self) -> Vec3 {
93-
self.rotation * Vec3::unit_z()
93+
self.rotation * Vec3::Z
9494
}
9595

9696
#[inline]

examples/3d/3d_scene.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,7 @@ fn setup(
3636
})
3737
// camera
3838
.spawn(PerspectiveCameraBundle {
39-
transform: Transform::from_xyz(-2.0, 2.5, 5.0)
40-
.looking_at(Vec3::default(), Vec3::unit_y()),
39+
transform: Transform::from_xyz(-2.0, 2.5, 5.0).looking_at(Vec3::default(), Vec3::Y),
4140
..Default::default()
4241
});
4342
}

examples/3d/load_gltf.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
1717
})
1818
.spawn(PerspectiveCameraBundle {
1919
transform: Transform::from_xyz(0.7, 0.7, 1.0)
20-
.looking_at(Vec3::new(0.0, 0.3, 0.0), Vec3::unit_y()),
20+
.looking_at(Vec3::new(0.0, 0.3, 0.0), Vec3::Y),
2121
..Default::default()
2222
});
2323
}

0 commit comments

Comments
 (0)