math: simplify imports

This commit is contained in:
Carter Anderson 2020-07-16 19:23:47 -07:00
parent 9f26a453c6
commit e2d2b41c67
4 changed files with 12 additions and 8 deletions

View File

@ -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};
}

View File

@ -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);
}
}

View File

@ -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),
),
@ -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),
),
@ -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),
),
@ -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),
),
@ -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),
),
@ -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),
),

View File

@ -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::*,