Skip to content

Commit

Permalink
math: simplify imports
Browse files Browse the repository at this point in the history
  • Loading branch information
cart committed Jul 17, 2020
1 parent 9f26a45 commit e2d2b41
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 8 deletions.
4 changes: 4 additions & 0 deletions crates/bevy_math/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,7 @@ mod face_toward;

pub use face_toward::*;
pub use glam::*;

pub mod prelude {
pub use crate::{FaceToward, Mat3, Mat4, Quat, Vec2, Vec3, Vec4};
}
2 changes: 1 addition & 1 deletion examples/3d/spawner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ fn move_cubes(
) {
for (translation, material_handle) in &mut query.iter() {
let material = materials.get_mut(&material_handle).unwrap();
translation.0 += math::vec3(1.0, 0.0, 0.0) * time.delta_seconds;
translation.0 += Vec3::new(1.0, 0.0, 0.0) * time.delta_seconds;
material.albedo += Color::rgb(-time.delta_seconds, -time.delta_seconds, time.delta_seconds);
}
}
Expand Down
12 changes: 6 additions & 6 deletions examples/ui/ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ fn setup(
// render order test: reddest in the back, whitest in the front
.spawn(UiComponents {
node: Node::positioned(
math::vec2(75.0, 60.0),
Vec2::new(75.0, 60.0),
Anchors::CENTER,
Margins::new(0.0, 100.0, 0.0, 100.0),
),
Expand All @@ -70,7 +70,7 @@ fn setup(
})
.spawn(UiComponents {
node: Node::positioned(
math::vec2(50.0, 35.0),
Vec2::new(50.0, 35.0),
Anchors::CENTER,
Margins::new(0.0, 100.0, 0.0, 100.0),
),
Expand All @@ -79,7 +79,7 @@ fn setup(
})
.spawn(UiComponents {
node: Node::positioned(
math::vec2(100.0, 85.0),
Vec2::new(100.0, 85.0),
Anchors::CENTER,
Margins::new(0.0, 100.0, 0.0, 100.0),
),
Expand All @@ -88,7 +88,7 @@ fn setup(
})
.spawn(UiComponents {
node: Node::positioned(
math::vec2(150.0, 135.0),
Vec2::new(150.0, 135.0),
Anchors::CENTER,
Margins::new(0.0, 100.0, 0.0, 100.0),
),
Expand All @@ -98,7 +98,7 @@ fn setup(
// parenting
.spawn(UiComponents {
node: Node::positioned(
math::vec2(210.0, 0.0),
Vec2::new(210.0, 0.0),
Anchors::BOTTOM_LEFT,
Margins::new(0.0, 200.0, 10.0, 210.0),
),
Expand All @@ -115,7 +115,7 @@ fn setup(
// alpha test
.spawn(UiComponents {
node: Node::positioned(
math::vec2(200.0, 185.0),
Vec2::new(200.0, 185.0),
Anchors::CENTER,
Margins::new(0.0, 100.0, 0.0, 100.0),
),
Expand Down
2 changes: 1 addition & 1 deletion src/prelude.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ pub use crate::{
core::prelude::*,
ecs::prelude::*,
input::{keyboard::KeyCode, mouse::MouseButton, Input},
math::{self, FaceToward, Mat3, Mat4, Quat, Vec2, Vec3, Vec4},
math::prelude::*,
pbr::{entity::*, light::Light, material::StandardMaterial},
property::{DynamicProperties, Properties, PropertiesVal, Property, PropertyVal},
render::prelude::*,
Expand Down

0 comments on commit e2d2b41

Please sign in to comment.