summaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2026-09-28 22:59:54 +0200
committerHampusM <hampus@hampusmat.com>2026-09-28 22:59:54 +0200
commit6881c2c6ae46e8270ddcdd9c2924fc31ec742424 (patch)
treec43b919b1fbb52bb0e07c21ff345e9f26a3d5084 /src/main.rs
parent36c3860ddf47c1c7c2ccad43512091d20f5a2dff (diff)
refactor: make compile after changes in engine
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs55
1 files changed, 33 insertions, 22 deletions
diff --git a/src/main.rs b/src/main.rs
index 5807b22..6edc1e7 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -2,7 +2,7 @@
use std::io::Cursor;
use std::path::Path;
-use engine::asset::Assets;
+use engine::asset::{Assets, Label as AssetLabel};
use engine::camera::fly::{
Extension as FlyCameraExtension,
Fly as FlyCamera,
@@ -29,7 +29,7 @@ use engine::input::Extension as InputExtension;
use engine::lighting::DirectionalLight;
use engine::material::Material;
use engine::mesh::Mesh;
-use engine::model::{MaterialDescription, Model, Spec as ModelSpec};
+use engine::model::{MaterialDescription, ModelMaterial, ModelMesh};
use engine::rendering::{
Extension as RenderingExtension,
GraphicsProperties,
@@ -186,34 +186,45 @@ fn init(mut assets: Single<Assets>, mut actions: Actions) -> Result<(), EngineEr
"Floor",
(
Transform::default().position(Vec3 { x: 1.6, y: -3.0, z: 0.0 }),
- Model::new(assets.store_with_name_with("floor_model", |assets| {
- ModelSpec::builder()
- .mesh(assets.store_with_name(
- "floor_mesh",
- Mesh::cube(Dimens3 {
- width: 20.0,
- height: 0.5,
- depth: 20.0,
- }),
+ ModelMesh {
+ asset: assets.store_with_name(
+ "floor_mesh",
+ Mesh::cube(Dimens3 {
+ width: 20.0,
+ height: 0.5,
+ depth: 20.0,
+ }),
+ ),
+ },
+ ModelMaterial {
+ asset: assets.store_with_name_with("floor_material", |assets| {
+ MaterialDescription::new(assets.store_with_name(
+ "floor_surface_material",
+ Material::builder().build(),
))
- .materials([MaterialDescription::new(
- assets.store_with_name(
- "floor_material",
- Material::builder().build(),
- ),
- )])
- .build()
- })),
+ }),
+ },
pair!(ChildOf, { scene_ent_id }),
),
);
+ let teapot_model_path = Path::new(RESOURCE_DIR).join("teapot.obj");
+
actions.spawn_named(
"Big teapot",
(
- Model::new(
- assets.load::<ModelSpec>(Path::new(RESOURCE_DIR).join("teapot.obj")),
- ),
+ ModelMesh {
+ asset: assets.load::<Mesh>(AssetLabel {
+ path: teapot_model_path.as_path().into(),
+ name: Some("mesh".into()),
+ }),
+ },
+ ModelMaterial {
+ asset: assets.load::<MaterialDescription>(AssetLabel {
+ path: teapot_model_path.as_path().into(),
+ name: Some("material_FrontColor".into()),
+ }),
+ },
Transform::default().position(Vec3 { x: 1.6, y: 0.0, z: 0.0 }),
pair!(ChildOf, { scene_ent_id }),
),