clone_without_buffers

This commit is contained in:
2019-09-17 13:27:24 +02:00
parent fdaf28ebf2
commit 13dedc1b27
3 changed files with 27 additions and 1 deletions
+24
View File
@@ -82,6 +82,16 @@ impl Part {
&self.faces
}
/// Clones a part but without the vertex buffers.
pub fn clone_without_buffer(&self) -> Part {
Part {
material_name: self.material_name.clone(),
faces: self.faces.clone(),
vertex_buffer: None,
needs_update: true,
}
}
}
@@ -139,6 +149,20 @@ impl Model {
}
}
/// Clones the model but without the vertex buffers.
pub fn clone_without_buffers(&self) -> Model {
Model {
vertices: self.vertices.clone(),
texture_coordinates: self.texture_coordinates.clone(),
normals: self.normals.clone(),
faces: self.faces.clone(),
materials: self.materials.clone(),
textures: self.textures.clone(),
parts: self.parts.iter().map(Part::clone_without_buffer).collect(),
current_part_index: self.current_part_index.clone(),
}
}
/// Copies the materials and textures from the other model into self.
pub fn merge_material_and_textures(&mut self, other: &Model) {
// Merge the materials