Skip to content

Commit 8e30d0d

Browse files
CGMossainodentry
authored andcommitted
Updated glam to 0.21. (bevyengine#5142)
Removed `const_vec2`/`const_vec3` and replaced with equivalent `.from_array`. # Objective Fixes bevyengine#5112 ## Solution - `encase` needs to update to `glam` as well. See teoxoy/encase#4 on progress on that. - `hexasphere` also needs to be updated, see OptimisticPeach/hexasphere#12.
1 parent 8c2dcc7 commit 8e30d0d

File tree

25 files changed

+71
-82
lines changed

25 files changed

+71
-82
lines changed

benches/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ publish = false
77
license = "MIT OR Apache-2.0"
88

99
[dev-dependencies]
10-
glam = "0.20"
10+
glam = "0.21"
1111
rand = "0.8"
1212
rand_chacha = "0.3"
1313
criterion = { version = "0.3", features = ["html_reports"] }

crates/bevy_encase_derive/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@ proc-macro = true
1313

1414
[dependencies]
1515
bevy_macro_utils = { path = "../bevy_macro_utils", version = "0.8.0-dev" }
16-
encase_derive_impl = "0.2"
16+
encase_derive_impl = "0.3.0"

crates/bevy_input/src/touch.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -350,11 +350,11 @@ mod test {
350350

351351
let touch_event = Touch {
352352
id: 4,
353-
start_position: Vec2::new(0.0, 0.0),
353+
start_position: Vec2::ZERO,
354354
start_force: None,
355-
previous_position: Vec2::new(0.0, 0.0),
355+
previous_position: Vec2::ZERO,
356356
previous_force: None,
357-
position: Vec2::new(0.0, 0.0),
357+
position: Vec2::ZERO,
358358
force: None,
359359
};
360360

@@ -383,7 +383,7 @@ mod test {
383383

384384
let touch_event = TouchInput {
385385
phase: TouchPhase::Started,
386-
position: Vec2::new(4.0, 4.0),
386+
position: Vec2::splat(4.0),
387387
force: None,
388388
id: 4,
389389
};
@@ -398,7 +398,7 @@ mod test {
398398

399399
let moved_touch_event = TouchInput {
400400
phase: TouchPhase::Moved,
401-
position: Vec2::new(5.0, 5.0),
401+
position: Vec2::splat(5.0),
402402
force: None,
403403
id: touch_event.id,
404404
};
@@ -419,7 +419,7 @@ mod test {
419419

420420
let cancel_touch_event = TouchInput {
421421
phase: TouchPhase::Cancelled,
422-
position: Vec2::new(1.0, 1.0),
422+
position: Vec2::ONE,
423423
force: None,
424424
id: touch_event.id,
425425
};
@@ -434,7 +434,7 @@ mod test {
434434

435435
let end_touch_event = TouchInput {
436436
phase: TouchPhase::Ended,
437-
position: Vec2::new(4.0, 4.0),
437+
position: Vec2::splat(4.0),
438438
force: None,
439439
id: 4,
440440
};
@@ -456,7 +456,7 @@ mod test {
456456

457457
let touch_event = TouchInput {
458458
phase: TouchPhase::Started,
459-
position: Vec2::new(4.0, 4.0),
459+
position: Vec2::splat(4.0),
460460
force: None,
461461
id: 4,
462462
};
@@ -478,7 +478,7 @@ mod test {
478478

479479
let touch_event = TouchInput {
480480
phase: TouchPhase::Ended,
481-
position: Vec2::new(4.0, 4.0),
481+
position: Vec2::splat(4.0),
482482
force: None,
483483
id: 4,
484484
};
@@ -500,7 +500,7 @@ mod test {
500500

501501
let touch_event = TouchInput {
502502
phase: TouchPhase::Cancelled,
503-
position: Vec2::new(4.0, 4.0),
503+
position: Vec2::splat(4.0),
504504
force: None,
505505
id: 4,
506506
};

crates/bevy_math/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ license = "MIT OR Apache-2.0"
99
keywords = ["bevy"]
1010

1111
[dependencies]
12-
glam = { version = "0.20.0", features = ["serde", "bytemuck"] }
12+
glam = { version = "0.21", features = ["serde", "bytemuck"] }

crates/bevy_mikktspace/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ license = "Zlib AND (MIT OR Apache-2.0)"
1111
keywords = ["bevy", "3D", "graphics", "algorithm", "tangent"]
1212

1313
[dependencies]
14-
glam = "0.20.0"
14+
glam = "0.21"
1515

1616
[[example]]
1717
name = "generate"

crates/bevy_pbr/src/light.rs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
use std::collections::HashSet;
22

33
use bevy_ecs::prelude::*;
4-
use bevy_math::{
5-
const_vec2, Mat4, UVec2, UVec3, Vec2, Vec3, Vec3A, Vec3Swizzles, Vec4, Vec4Swizzles,
6-
};
4+
use bevy_math::{Mat4, UVec2, UVec3, Vec2, Vec3, Vec3A, Vec3Swizzles, Vec4, Vec4Swizzles};
75
use bevy_reflect::prelude::*;
86
use bevy_render::{
97
camera::{Camera, CameraProjection, OrthographicProjection},
@@ -497,8 +495,8 @@ fn ndc_position_to_cluster(
497495
.clamp(UVec3::ZERO, cluster_dimensions - UVec3::ONE)
498496
}
499497

500-
const VEC2_HALF: Vec2 = const_vec2!([0.5, 0.5]);
501-
const VEC2_HALF_NEGATIVE_Y: Vec2 = const_vec2!([0.5, -0.5]);
498+
const VEC2_HALF: Vec2 = Vec2::splat(0.5);
499+
const VEC2_HALF_NEGATIVE_Y: Vec2 = Vec2::new(0.5, -0.5);
502500

503501
// Calculate bounds for the light using a view space aabb.
504502
// Returns a (Vec3, Vec3) containing min and max with
@@ -587,8 +585,8 @@ fn cluster_space_light_aabb(
587585
)
588586
}
589587

590-
const NDC_MIN: Vec2 = const_vec2!([-1.0, -1.0]);
591-
const NDC_MAX: Vec2 = const_vec2!([1.0, 1.0]);
588+
const NDC_MIN: Vec2 = Vec2::NEG_ONE;
589+
const NDC_MAX: Vec2 = Vec2::ONE;
592590

593591
// Sort point lights with shadows enabled first, then by a stable key so that the index
594592
// can be used to limit the number of point light shadows to render based on the device and

crates/bevy_pbr/src/render/light.rs

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use bevy_ecs::{
99
prelude::*,
1010
system::{lifetimeless::*, SystemParamItem},
1111
};
12-
use bevy_math::{const_vec3, Mat4, UVec2, UVec3, UVec4, Vec2, Vec3, Vec4, Vec4Swizzles};
12+
use bevy_math::{Mat4, UVec2, UVec3, UVec4, Vec2, Vec3, Vec4, Vec4Swizzles};
1313
use bevy_render::{
1414
camera::{Camera, CameraProjection},
1515
color::Color,
@@ -501,11 +501,6 @@ pub fn extract_lights(
501501

502502
pub(crate) const POINT_LIGHT_NEAR_Z: f32 = 0.1f32;
503503

504-
// Can't do `Vec3::Y * -1.0` because mul isn't const
505-
const NEGATIVE_X: Vec3 = const_vec3!([-1.0, 0.0, 0.0]);
506-
const NEGATIVE_Y: Vec3 = const_vec3!([0.0, -1.0, 0.0]);
507-
const NEGATIVE_Z: Vec3 = const_vec3!([0.0, 0.0, -1.0]);
508-
509504
pub(crate) struct CubeMapFace {
510505
pub(crate) target: Vec3,
511506
pub(crate) up: Vec3,
@@ -515,33 +510,33 @@ pub(crate) struct CubeMapFace {
515510
pub(crate) const CUBE_MAP_FACES: [CubeMapFace; 6] = [
516511
// 0 GL_TEXTURE_CUBE_MAP_POSITIVE_X
517512
CubeMapFace {
518-
target: NEGATIVE_X,
519-
up: NEGATIVE_Y,
513+
target: Vec3::NEG_X,
514+
up: Vec3::NEG_Y,
520515
},
521516
// 1 GL_TEXTURE_CUBE_MAP_NEGATIVE_X
522517
CubeMapFace {
523518
target: Vec3::X,
524-
up: NEGATIVE_Y,
519+
up: Vec3::NEG_Y,
525520
},
526521
// 2 GL_TEXTURE_CUBE_MAP_POSITIVE_Y
527522
CubeMapFace {
528-
target: NEGATIVE_Y,
523+
target: Vec3::NEG_Y,
529524
up: Vec3::Z,
530525
},
531526
// 3 GL_TEXTURE_CUBE_MAP_NEGATIVE_Y
532527
CubeMapFace {
533528
target: Vec3::Y,
534-
up: NEGATIVE_Z,
529+
up: Vec3::NEG_Z,
535530
},
536531
// 4 GL_TEXTURE_CUBE_MAP_POSITIVE_Z
537532
CubeMapFace {
538-
target: NEGATIVE_Z,
539-
up: NEGATIVE_Y,
533+
target: Vec3::NEG_Z,
534+
up: Vec3::NEG_Y,
540535
},
541536
// 5 GL_TEXTURE_CUBE_MAP_NEGATIVE_Z
542537
CubeMapFace {
543538
target: Vec3::Z,
544-
up: NEGATIVE_Y,
539+
up: Vec3::NEG_Y,
545540
},
546541
];
547542

@@ -1016,7 +1011,7 @@ struct GpuClusterLightIndexListsUniform {
10161011

10171012
// NOTE: Assert at compile time that GpuClusterLightIndexListsUniform
10181013
// fits within the maximum uniform buffer binding size
1019-
const _: () = assert!(GpuClusterLightIndexListsUniform::SIZE.get() <= 16384);
1014+
const _: () = assert!(GpuClusterLightIndexListsUniform::SHADER_SIZE.get() <= 16384);
10201015

10211016
impl Default for GpuClusterLightIndexListsUniform {
10221017
fn default() -> Self {

crates/bevy_reflect/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ thiserror = "1.0"
2525
once_cell = "1.11"
2626
serde = "1"
2727
smallvec = { version = "1.6", features = ["serde", "union", "const_generics"], optional = true }
28-
glam = { version = "0.20.0", features = ["serde"], optional = true }
28+
glam = { version = "0.21", features = ["serde"], optional = true }
2929

3030
[dev-dependencies]
3131
ron = "0.7.0"

crates/bevy_reflect/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -922,7 +922,7 @@ bevy_reflect::tests::should_reflect_debug::Test {
922922

923923
assert_eq!(
924924
result,
925-
r#"{"type":"glam::vec3::Vec3","struct":{"x":{"type":"f32","value":12.0},"y":{"type":"f32","value":3.0},"z":{"type":"f32","value":-6.9}}}"#
925+
r#"{"type":"glam::f32::vec3::Vec3","struct":{"x":{"type":"f32","value":12.0},"y":{"type":"f32","value":3.0},"z":{"type":"f32","value":-6.9}}}"#
926926
);
927927
}
928928

crates/bevy_render/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ thiserror = "1.0"
5959
futures-lite = "1.4.0"
6060
anyhow = "1.0"
6161
hex = "0.4.2"
62-
hexasphere = "7.0.0"
62+
hexasphere = "7.2"
6363
parking_lot = "0.11.0"
6464
regex = "1.5"
6565
copyless = "0.1.5"
@@ -70,4 +70,4 @@ flate2 = { version = "1.0.22", optional = true }
7070
ruzstd = { version = "0.2.4", optional = true }
7171
# For transcoding of UASTC/ETC1S universal formats, and for .basis file support
7272
basis-universal = { version = "0.2.0", optional = true }
73-
encase = { version = "0.2", features = ["glam"] }
73+
encase = { version = "0.3", features = ["glam"] }

0 commit comments

Comments
 (0)