From f8d2f7c3f1f1847bb80c0545cf6d6fcff76d2160 Mon Sep 17 00:00:00 2001 From: SeanOMik Date: Sun, 14 May 2023 23:21:47 -0400 Subject: [PATCH] Move Transform to math module --- src/ecs/components/transform.rs | 2 +- src/game.rs | 19 ------------------- src/math/mod.rs | 5 ++++- src/{render => math}/transform.rs | 0 src/render/mod.rs | 3 +-- src/render/render_job.rs | 4 +++- src/render/renderer.rs | 2 +- 7 files changed, 10 insertions(+), 25 deletions(-) rename src/{render => math}/transform.rs (100%) diff --git a/src/ecs/components/transform.rs b/src/ecs/components/transform.rs index ed69a85..585c62c 100755 --- a/src/ecs/components/transform.rs +++ b/src/ecs/components/transform.rs @@ -1,6 +1,6 @@ use specs::{Component, DenseVecStorage}; -use crate::render::transform::Transform; +use crate::math::Transform; #[derive(Component, Clone)] pub struct TransformComponent { diff --git a/src/game.rs b/src/game.rs index 035d6c4..04da05e 100755 --- a/src/game.rs +++ b/src/game.rs @@ -120,25 +120,6 @@ impl GameLoop { // Update the world self.update().await; - - // Collect models from the ecs world - /* let mut jobs = vec![]; - let world = self.world.lock().await; - let model2d_storage = world.read_storage::(); - - for model in model2d_storage.join() { - let job = RenderJob::new(&model.mesh); - jobs.push(job); - } - - // drop some stuff for the borrow checker - drop(model2d_storage); - drop(world); - - for job in jobs.iter() { - println!("job"); - } */ - let mut world = self.world.lock().await; for (ent, (transform,)) in world.query_mut::<(&mut TransformComponent,)>() { diff --git a/src/math/mod.rs b/src/math/mod.rs index 3de8448..1b7e551 100755 --- a/src/math/mod.rs +++ b/src/math/mod.rs @@ -2,4 +2,7 @@ pub use glam::*; pub mod angle; -pub use angle::*; \ No newline at end of file +pub use angle::*; + +pub mod transform; +pub use transform::*; \ No newline at end of file diff --git a/src/render/transform.rs b/src/math/transform.rs similarity index 100% rename from src/render/transform.rs rename to src/math/transform.rs diff --git a/src/render/mod.rs b/src/render/mod.rs index 130b3bd..02da5a3 100755 --- a/src/render/mod.rs +++ b/src/render/mod.rs @@ -7,5 +7,4 @@ pub mod render_job; pub mod mesh; pub mod texture; pub mod shader_loader; -pub mod material; -pub mod transform; \ No newline at end of file +pub mod material; \ No newline at end of file diff --git a/src/render/render_job.rs b/src/render/render_job.rs index 852695b..6b30e70 100755 --- a/src/render/render_job.rs +++ b/src/render/render_job.rs @@ -1,6 +1,8 @@ use hecs::Entity; -use super::{mesh::Mesh, material::Material, transform::Transform}; +use crate::math::Transform; + +use super::{mesh::Mesh, material::Material}; pub struct RenderJob { mesh: Mesh, diff --git a/src/render/renderer.rs b/src/render/renderer.rs index 51b0dd3..5ed6a52 100755 --- a/src/render/renderer.rs +++ b/src/render/renderer.rs @@ -15,11 +15,11 @@ use hecs::{World, Entity}; use crate::ecs::components::model_2d::Model2dComponent; use crate::ecs::components::transform::TransformComponent; +use crate::math::Transform; use crate::resources; use super::desc_buf_lay::DescVertexBufferLayout; use super::texture::RenderTexture; -use super::transform::Transform; use super::{render_pipeline::FullRenderPipeline, vertex::{VERTICES}, render_buffer::BufferStorage, render_job::RenderJob, mesh::Mesh}; #[async_trait]