Start moving towards a generic voxel renderer implementation
This commit is contained in:
parent
e5c06fa365
commit
8a4909dced
|
@ -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> {
|
||||
|
|
|
@ -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},
|
||||
};
|
||||
|
|
|
@ -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<()>;
|
||||
}
|
|
@ -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
|
||||
|
|
|
@ -1,2 +1,5 @@
|
|||
pub mod brickmap;
|
||||
mod renderer;
|
||||
pub mod world;
|
||||
|
||||
pub use renderer::VoxelRenderer;
|
||||
|
|
|
@ -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<()>;
|
||||
}
|
Loading…
Reference in New Issue