Make renderer update more useful
This commit is contained in:
parent
8a4909dced
commit
96fe40108b
|
@ -109,8 +109,7 @@ impl<'window> App<'window> {
|
||||||
|
|
||||||
// !Hack: As far as I know I can't propagate errors out of here. So for now just ignore them
|
// !Hack: As far as I know I can't propagate errors out of here. So for now just ignore them
|
||||||
let _ = renderer.render(&self.render_ctx);
|
let _ = renderer.render(&self.render_ctx);
|
||||||
let _ = renderer.update(&dt, &self.render_ctx);
|
let _ = renderer.update(&dt, &self.render_ctx, &mut world);
|
||||||
renderer.update_brickmap(&self.render_ctx, &mut world);
|
|
||||||
|
|
||||||
// Simple framerate tracking
|
// Simple framerate tracking
|
||||||
self.render_ctx.window.set_title(&format!(
|
self.render_ctx.window.set_title(&format!(
|
||||||
|
|
|
@ -185,11 +185,6 @@ impl BrickmapRenderer {
|
||||||
unpack_bind_group,
|
unpack_bind_group,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn update_brickmap(&mut self, context: &gfx::Context, world: &mut WorldManager) {
|
|
||||||
self.brickmap_manager
|
|
||||||
.process_feedback_buffer(context, world);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl VoxelRenderer for BrickmapRenderer {
|
impl VoxelRenderer for BrickmapRenderer {
|
||||||
|
@ -249,7 +244,14 @@ impl VoxelRenderer for BrickmapRenderer {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn update(&mut self, _dt: &Duration, _context: &gfx::Context) -> Result<()> {
|
fn update(
|
||||||
|
&mut self,
|
||||||
|
_dt: &Duration,
|
||||||
|
context: &gfx::Context,
|
||||||
|
world: &mut WorldManager,
|
||||||
|
) -> Result<()> {
|
||||||
|
self.brickmap_manager
|
||||||
|
.process_feedback_buffer(context, world);
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,9 +2,10 @@ use std::time::Duration;
|
||||||
|
|
||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
|
|
||||||
|
use super::world::WorldManager;
|
||||||
use crate::gfx::Context;
|
use crate::gfx::Context;
|
||||||
|
|
||||||
pub trait VoxelRenderer {
|
pub trait VoxelRenderer {
|
||||||
fn update(&mut self, dt: &Duration, context: &Context) -> Result<()>;
|
fn update(&mut self, dt: &Duration, context: &Context, world: &mut WorldManager) -> Result<()>;
|
||||||
fn render(&self, context: &Context) -> Result<()>;
|
fn render(&self, context: &Context) -> Result<()>;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue