summaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs33
1 files changed, 10 insertions, 23 deletions
diff --git a/src/main.rs b/src/main.rs
index faf38b3..b289332 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -23,16 +23,13 @@ use engine::ecs::query::term::With;
use engine::ecs::sole::Single;
use engine::ecs::system::initializable::Initializable;
use engine::ecs::system::Into;
-use engine::ecs::{Query, pair};
+use engine::ecs::{pair, Query};
use engine::image::{Format as ImageFormat, Image};
use engine::input::keyboard::Keyboard;
use engine::input::Extension as InputExtension;
use engine::lighting::{AttenuationParams, PointLight};
use engine::material::{Flags as MaterialFlags, Material};
-use engine::mesh::cube::{
- create as cube_mesh_create,
- CreationSpec as CubeMeshCreationSpec,
-};
+use engine::mesh::Mesh;
use engine::model::{Materials as ModelMaterials, Model, Spec as ModelSpec};
use engine::rendering::{
Extension as RenderingExtension,
@@ -136,10 +133,7 @@ fn init(mut assets: Single<Assets>, mut actions: Actions) -> Result<(), EngineEr
),
);
- let scene_ent_id = actions.spawn_named(
- "Scene",
- (Scene, ActiveScene)
- );
+ let scene_ent_id = actions.spawn_named("Scene", (Scene, ActiveScene));
actions.spawn_named(
"Main camera",
@@ -150,7 +144,7 @@ fn init(mut assets: Single<Assets>, mut actions: Actions) -> Result<(), EngineEr
},
ActiveCamera,
FlyCamera::default(),
- pair!(ChildOf, { scene_ent_id })
+ pair!(ChildOf, { scene_ent_id }),
),
);
@@ -168,16 +162,10 @@ fn init(mut assets: Single<Assets>, mut actions: Actions) -> Result<(), EngineEr
WorldPosition::from(Vec3 { x: -6.0, y: 3.0, z: 3.0 }),
Model::new(assets.store_with_name_with("light_cube", |assets| {
ModelSpec::builder()
- .mesh(
- assets.store_with_name(
- "light_cube_mesh",
- cube_mesh_create(
- CubeMeshCreationSpec::builder()
- .dimens(Dimens3::from(2.0))
- .build(),
- ),
- ),
- )
+ .mesh(assets.store_with_name(
+ "light_cube_mesh",
+ Mesh::cube(Dimens3::from(2.0)),
+ ))
.materials(ModelMaterials::direct([(
"surface",
assets.store_with_name(
@@ -189,7 +177,7 @@ fn init(mut assets: Single<Assets>, mut actions: Actions) -> Result<(), EngineEr
.build()
})),
MaterialFlags::builder().use_ambient_color(true).build(),
- pair!(ChildOf, { scene_ent_id })
+ pair!(ChildOf, { scene_ent_id }),
),
);
@@ -200,7 +188,7 @@ fn init(mut assets: Single<Assets>, mut actions: Actions) -> Result<(), EngineEr
assets.load::<ModelSpec>(Path::new(RESOURCE_DIR).join("teapot.obj")),
),
WorldPosition::from(Vec3 { x: 1.6, y: 0.0, z: 0.0 }),
- pair!(ChildOf, { scene_ent_id })
+ pair!(ChildOf, { scene_ent_id }),
),
);
@@ -270,4 +258,3 @@ fn toggle_ui(
Ok(())
}
-