Skip to content

Commit

Permalink
Use constant.
Browse files Browse the repository at this point in the history
  • Loading branch information
tim-blackbird committed Jul 16, 2022
1 parent b3d2bee commit 19b6639
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 18 deletions.
4 changes: 2 additions & 2 deletions crates/bevy_gltf/src/loader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,7 @@ async fn load_gltf<'a, 'b>(

world
.spawn()
.insert_bundle(TransformBundle::identity())
.insert_bundle(TransformBundle::IDENTITY)
.insert_bundle(VisibilityBundle::default())
.with_children(|parent| {
for node in scene.nodes() {
Expand Down Expand Up @@ -1170,7 +1170,7 @@ mod test {
GltfNode {
children: vec![],
mesh: None,
transform: bevy_transform::prelude::Transform::identity(),
transform: bevy_transform::prelude::Transform::IDENTITY,
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_pbr/src/light.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1447,7 +1447,7 @@ pub fn update_point_light_frusta(
Mat4::perspective_infinite_reverse_rh(std::f32::consts::FRAC_PI_2, 1.0, POINT_LIGHT_NEAR_Z);
let view_rotations = CUBE_MAP_FACES
.iter()
.map(|CubeMapFace { target, up }| Transform::identity().looking_at(*target, *up))
.map(|CubeMapFace { target, up }| Transform::IDENTITY.looking_at(*target, *up))
.collect::<Vec<_>>();

for (entity, transform, point_light, mut cubemap_frusta) in &mut views {
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_pbr/src/render/light.rs
Original file line number Diff line number Diff line change
Expand Up @@ -779,7 +779,7 @@ pub fn prepare_lights(
Mat4::perspective_infinite_reverse_rh(std::f32::consts::FRAC_PI_2, 1.0, POINT_LIGHT_NEAR_Z);
let cube_face_rotations = CUBE_MAP_FACES
.iter()
.map(|CubeMapFace { target, up }| Transform::identity().looking_at(*target, *up))
.map(|CubeMapFace { target, up }| Transform::IDENTITY.looking_at(*target, *up))
.collect::<Vec<_>>();

global_light_meta.entity_to_index.clear();
Expand Down
14 changes: 6 additions & 8 deletions crates/bevy_transform/src/systems.rs
Original file line number Diff line number Diff line change
Expand Up @@ -297,14 +297,12 @@ mod test {
.world
.spawn()
.insert(Transform::from_translation(translation))
.insert(GlobalTransform::default())
.insert(GlobalTransform::IDENTITY)
.with_children(|builder| {
child = builder
.spawn_bundle((Transform::identity(), GlobalTransform::default()))
.spawn_bundle(TransformBundle::IDENTITY)
.with_children(|builder| {
grandchild = builder
.spawn_bundle((Transform::identity(), GlobalTransform::default()))
.id();
grandchild = builder.spawn_bundle(TransformBundle::IDENTITY).id();
})
.id();
})
Expand Down Expand Up @@ -338,11 +336,11 @@ mod test {
let mut grandchild = Entity::from_raw(0);
let child = world
.spawn()
.insert_bundle((Transform::identity(), GlobalTransform::default()))
.insert_bundle(TransformBundle::IDENTITY)
.with_children(|builder| {
grandchild = builder
.spawn()
.insert_bundle((Transform::identity(), GlobalTransform::default()))
.insert_bundle(TransformBundle::IDENTITY)
.id();
})
.id();
Expand All @@ -357,7 +355,7 @@ mod test {

app.world
.spawn()
.insert_bundle((Transform::default(), GlobalTransform::default()))
.insert_bundle(TransformBundle::IDENTITY)
.push_children(&[child]);
std::mem::swap(
&mut *app.world.get_mut::<Parent>(child).unwrap(),
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_ui/src/update.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ mod tests {
struct Label(&'static str);

fn node_with_transform(name: &'static str) -> (Label, Node, Transform) {
(Label(name), Node::default(), Transform::identity())
(Label(name), Node::default(), Transform::IDENTITY)
}

fn node_without_transform(name: &'static str) -> (Label, Node) {
Expand Down
6 changes: 3 additions & 3 deletions examples/animation/custom_skinned_mesh.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,14 +123,14 @@ fn setup(
let joint_0 = commands
.spawn_bundle((
Transform::from_xyz(i as f32 * 1.5, 0.0, 0.0),
GlobalTransform::identity(),
GlobalTransform::IDENTITY,
))
.id();
let joint_1 = commands
.spawn_bundle((
AnimatedJoint,
Transform::identity(),
GlobalTransform::identity(),
Transform::IDENTITY,
GlobalTransform::IDENTITY,
))
.id();

Expand Down
2 changes: 1 addition & 1 deletion examples/ecs/component_change_detection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ struct MyComponent(f64);

fn setup(mut commands: Commands) {
commands.spawn().insert(MyComponent(0.));
commands.spawn().insert(Transform::identity());
commands.spawn().insert(Transform::IDENTITY);
}

fn change_component(time: Res<Time>, mut query: Query<(Entity, &mut MyComponent)>) {
Expand Down
2 changes: 1 addition & 1 deletion examples/scene/scene.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ fn save_scene_system(world: &mut World) {
scene_world.spawn().insert_bundle((
component_b,
ComponentA { x: 1.0, y: 2.0 },
Transform::identity(),
Transform::IDENTITY,
));
scene_world
.spawn()
Expand Down

0 comments on commit 19b6639

Please sign in to comment.