Some commit

This commit is contained in:
2018-04-24 11:08:32 +02:00
parent 598365f913
commit 9349c45431
4 changed files with 41 additions and 15 deletions
+19
View File
@@ -374,6 +374,20 @@ impl Model {
}
}
/// Creates only non-existant vertex buffers, doesn't update the old ones.
pub fn build_new_vertex_buffers(&mut self, renderer: &Renderer) {
for part in &mut self.parts {
if part.vertex_buffer.is_none() {
Model::build_vertex_buffer_for_part(
&self.vertices,
&self.texture_coordinates,
&self.normals,
part,
renderer);
}
}
}
/// Creates a vertex buffer that can be rendered for a part of the model.
pub fn build_vertex_buffer_for_part(
vertices: &Vec<Vector3<f64>>,
@@ -429,4 +443,9 @@ impl Model {
pub fn get_texture_by_name(&self, name: &str) -> Option<&SrgbTexture2d> {
self.textures[name].as_ref()
}
/// Returns a ref mut to the table of textures.
pub fn textures_mut(&mut self) -> &mut HashMap<String, Option<SrgbTexture2d>> {
&mut self.textures
}
}