minimal logging

This commit is contained in:
2021-02-19 22:11:24 -08:00
parent 85376e5b17
commit d0a2893056
5 changed files with 47 additions and 26 deletions

View File

@@ -148,8 +148,9 @@ impl RenderState {
}
pub fn load_mesh_to_buffer(&self, filepath: &str, color: Option<wgpu::Color>) -> Mesh {
let raw_mesh = load_obj(filepath);
pub fn load_mesh_to_buffer(&self, filepath: &str, color: Option<wgpu::Color>) -> Result<Mesh, String> {
let raw_mesh = load_obj(filepath)?;
let index_count = raw_mesh.indices.len() * 3; // TODO bad bad bad bad!
let (vertex_buf, index_buf) = RenderState::create_buffer(&self.device, raw_mesh);
@@ -176,7 +177,7 @@ impl RenderState {
}],
}));
Mesh {
Ok(Mesh {
index_buffer: index_buf,
index_count: index_count,
// TODO: This is hardcoded by tobj, maybe think about doing something a little more clever?
@@ -185,7 +186,7 @@ impl RenderState {
uniform_buffer: uniform_buf,
bind_group: bind_group,
color: color.unwrap_or(wgpu::Color::RED),
}
})
}
/// When creating a light we have to give it a target view to render to