diff --git a/src/core/app.rs b/src/core/app.rs index f26f357..0c5e04e 100644 --- a/src/core/app.rs +++ b/src/core/app.rs @@ -9,8 +9,8 @@ use winit::{ use super::camera; use crate::{ - gfx::{self, Renderer}, - voxel::{self, brickmap::BrickmapRenderer}, + gfx, + voxel::{self, brickmap::BrickmapRenderer, VoxelRenderer}, }; pub struct App<'window> { diff --git a/src/gfx/mod.rs b/src/gfx/mod.rs index f6507eb..1022979 100644 --- a/src/gfx/mod.rs +++ b/src/gfx/mod.rs @@ -1,13 +1,11 @@ mod bind_group; mod buffer; mod context; -mod renderer; mod texture; pub use self::{ bind_group::{BindGroupBuilder, BindGroupLayoutBuilder}, buffer::{BufferExt, BulkBufferBuilder}, context::Context, - renderer::Renderer, texture::{Texture, TextureBuilder}, }; diff --git a/src/gfx/renderer.rs b/src/gfx/renderer.rs deleted file mode 100644 index 1329c23..0000000 --- a/src/gfx/renderer.rs +++ /dev/null @@ -1,8 +0,0 @@ -use std::time::Duration; - -use anyhow::Result; - -pub trait Renderer { - fn update(&mut self, dt: &Duration, context: &super::Context) -> Result<()>; - fn render(&self, context: &super::Context) -> Result<()>; -} diff --git a/src/voxel/brickmap/renderer.rs b/src/voxel/brickmap/renderer.rs index 4eeced9..ce622a0 100644 --- a/src/voxel/brickmap/renderer.rs +++ b/src/voxel/brickmap/renderer.rs @@ -2,7 +2,10 @@ use std::time::Duration; use anyhow::Result; -use crate::{core, gfx, voxel::world::WorldManager}; +use crate::{ + core, gfx, + voxel::{renderer::VoxelRenderer, world::WorldManager}, +}; use super::BrickmapManager; @@ -189,7 +192,7 @@ impl BrickmapRenderer { } } -impl gfx::Renderer for BrickmapRenderer { +impl VoxelRenderer for BrickmapRenderer { fn render(&self, context: &gfx::Context) -> Result<()> { let frame = context.surface.get_current_texture()?; let view = frame diff --git a/src/voxel/mod.rs b/src/voxel/mod.rs index 8701cbe..03df015 100644 --- a/src/voxel/mod.rs +++ b/src/voxel/mod.rs @@ -1,2 +1,5 @@ pub mod brickmap; +mod renderer; pub mod world; + +pub use renderer::VoxelRenderer; diff --git a/src/voxel/renderer.rs b/src/voxel/renderer.rs new file mode 100644 index 0000000..f66ff00 --- /dev/null +++ b/src/voxel/renderer.rs @@ -0,0 +1,10 @@ +use std::time::Duration; + +use anyhow::Result; + +use crate::gfx::Context; + +pub trait VoxelRenderer { + fn update(&mut self, dt: &Duration, context: &Context) -> Result<()>; + fn render(&self, context: &Context) -> Result<()>; +}