From 31e6af7015998cdfa55f66ab6aee1ad33ed591e9 Mon Sep 17 00:00:00 2001 From: SeanOMik Date: Fri, 8 Sep 2023 00:46:27 -0400 Subject: [PATCH] Clean up code to be better suited to be used as a library --- src/ecs/mod.rs | 2 ++ src/lib.rs | 16 ++++++++-------- src/render/renderer.rs | 2 +- src/render/vertex.rs | 16 +--------------- 4 files changed, 12 insertions(+), 24 deletions(-) diff --git a/src/ecs/mod.rs b/src/ecs/mod.rs index ee6333b..7ea540e 100755 --- a/src/ecs/mod.rs +++ b/src/ecs/mod.rs @@ -5,6 +5,8 @@ use tracing::warn; use crate::game::Controls; +pub use edict::*; + pub mod components; pub mod events; pub use events::*; diff --git a/src/lib.rs b/src/lib.rs index c3c5e87..4540345 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,8 +1,8 @@ -mod game; -mod render; -mod input_event; -mod resources; -mod ecs; -mod math; -mod input; -mod castable_any; \ No newline at end of file +pub mod game; +pub mod render; +pub mod input_event; +pub mod resources; +pub mod ecs; +pub mod math; +pub mod input; +pub mod castable_any; \ No newline at end of file diff --git a/src/render/renderer.rs b/src/render/renderer.rs index 5b9b281..bd2f117 100755 --- a/src/render/renderer.rs +++ b/src/render/renderer.rs @@ -28,7 +28,7 @@ use super::camera::RenderCamera; use super::desc_buf_lay::DescVertexBufferLayout; use super::texture::RenderTexture; use super::vertex::Vertex; -use super::{render_pipeline::FullRenderPipeline, vertex::{VERTICES}, render_buffer::BufferStorage, render_job::RenderJob, mesh::Mesh}; +use super::{render_pipeline::FullRenderPipeline, render_buffer::BufferStorage, render_job::RenderJob, mesh::Mesh}; pub trait Renderer { fn prepare(&mut self, main_world: &mut edict::World); diff --git a/src/render/vertex.rs b/src/render/vertex.rs index 7f395ac..12ac319 100755 --- a/src/render/vertex.rs +++ b/src/render/vertex.rs @@ -5,23 +5,9 @@ use super::desc_buf_lay::DescVertexBufferLayout; pub struct Vertex { pub position: [f32; 3], //pub color: [f32; 3], // TODO: add color again - tex_coords: [f32; 2] + pub tex_coords: [f32; 2] } -pub const VERTICES: &[Vertex] = &[ - Vertex { position: [-0.0868241, 0.49240386, 0.0], tex_coords: [0.4131759, 0.00759614], }, // A - Vertex { position: [-0.49513406, 0.06958647, 0.0], tex_coords: [0.0048659444, 0.43041354], }, // B - Vertex { position: [-0.21918549, -0.44939706, 0.0], tex_coords: [0.28081453, 0.949397], }, // C - Vertex { position: [0.35966998, -0.3473291, 0.0], tex_coords: [0.85967, 0.84732914], }, // D - Vertex { position: [0.44147372, 0.2347359, 0.0], tex_coords: [0.9414737, 0.2652641], }, // E -]; - -pub const INDICES: &[u16] = &[ - 0, 1, 4, - 1, 2, 4, - 2, 3, 4, -]; - impl DescVertexBufferLayout for Vertex { fn desc<'a>() -> wgpu::VertexBufferLayout<'a> { wgpu::VertexBufferLayout {