Clean up code to be better suited to be used as a library

This commit is contained in:
SeanOMik 2023-09-08 00:46:27 -04:00
parent 0ff78cf6d6
commit 31e6af7015
Signed by: SeanOMik
GPG Key ID: 568F326C7EB33ACB
4 changed files with 12 additions and 24 deletions

View File

@ -5,6 +5,8 @@ use tracing::warn;
use crate::game::Controls;
pub use edict::*;
pub mod components;
pub mod events;
pub use events::*;

View File

@ -1,8 +1,8 @@
mod game;
mod render;
mod input_event;
mod resources;
mod ecs;
mod math;
mod input;
mod castable_any;
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;

View File

@ -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);

View File

@ -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 {