From a77c6d76f0733edd94041fd2f3ada2462caa1cef Mon Sep 17 00:00:00 2001 From: mitchellhansen Date: Fri, 24 Dec 2021 00:40:50 -0800 Subject: [PATCH] . --- conf/entity_spawns.toml | 23 +++++++++++++++++++++++ src/main.rs | 5 ++--- src/physics/system.rs | 8 +++++--- src/runtime/state.rs | 4 +--- 4 files changed, 31 insertions(+), 9 deletions(-) diff --git a/conf/entity_spawns.toml b/conf/entity_spawns.toml index 4243422..ff81ff6 100644 --- a/conf/entity_spawns.toml +++ b/conf/entity_spawns.toml @@ -3,6 +3,29 @@ name = "terrain.1" type = "StaticMesh" mesh = "test-textured.obj" +[[entities]] +name = "ball.1" +type = "PhysicsEntity" +mesh = "ball.obj" + + [entities.position] + x = 15.0 + y = 15.0 + z = 15.0 + + [entities.position.rotation] + x = 0.0 + y = 0.0 + z = 0.0 + + [entities.physics] + body_status = "static" + + [entities.physics.cuboid] + x = 1.0 + y = 1.0 + z = 1.0 + [[entities]] name = "tile.1" type = "Sprite" diff --git a/src/main.rs b/src/main.rs index 2c46a6d..981762f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -99,10 +99,9 @@ ECS entities & behaviours (got the entities!) scripting! - Todo: Load scene imgui interface w/ toml files - FPS graph port from voxel raycaster + This means a scene graph better imgui interface with components & systems Figure out eventing, GameInput, passing all events, etc. + texturing @@ -158,7 +157,7 @@ fn main() { let mut render_schedule = Schedule::builder() .add_system(render::system::render_imgui_system()) - //.add_system(render::system::render_test_system()) + .add_system(render::system::render_function_system()) .add_system(render::system::render_performance_flag_system()) .build(); diff --git a/src/physics/system.rs b/src/physics/system.rs index babf2c1..ae68ac5 100644 --- a/src/physics/system.rs +++ b/src/physics/system.rs @@ -38,10 +38,10 @@ pub fn run_physics( Some(handle) => handle, }; if collider.collider_handle == None { - let handle = physics_state.colliders.insert( + let handle = physics_state.colliders.insert_with_parent( collider.collider.clone(), - //rigid_body_handle, - //&mut physics_state.bodies, + rigid_body_handle, + &mut physics_state.bodies, ); collider.collider_handle = Some(handle); } @@ -106,6 +106,8 @@ pub fn update_models( ) { // Make sure all the entities we care about are added to the system + // TODO add scenegraph component to compare against + // allows per node rotation, better logging let mut query = <(&mut Collider, &mut Physics, &mut Mesh, &mut Position)>::query(); for (collider, physics, mesh, position) in query.iter_mut(world) { let pos = physics_state diff --git a/src/runtime/state.rs b/src/runtime/state.rs index 7e95acb..b9efbc1 100644 --- a/src/runtime/state.rs +++ b/src/runtime/state.rs @@ -114,7 +114,7 @@ impl RuntimeState { self.mesh_cache.get(mesh) } - pub fn get_entities(&mut self) -> Vec { + pub fn p(&mut self) -> Vec { self.config_db.entities.clone() } @@ -132,7 +132,5 @@ impl RuntimeState { self.mesh_cache.insert(filename, mesh); } } - - //panic!("nah"); } }