Merge pull request #278 from hecrj/fix/canvas-empty-mesh

Stop generating empty `Mesh2D` in `canvas::Frame`
This commit is contained in:
Héctor Ramón 2020-04-10 01:18:19 +02:00 committed by GitHub
commit 867dad62fa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -262,13 +262,15 @@ impl Frame {
///
/// [`Frame`]: struct.Frame.html
pub fn into_primitive(mut self) -> Primitive {
self.primitives.push(Primitive::Mesh2D {
origin: Point::ORIGIN,
buffers: triangle::Mesh2D {
vertices: self.buffers.vertices,
indices: self.buffers.indices,
},
});
if !self.buffers.indices.is_empty() {
self.primitives.push(Primitive::Mesh2D {
origin: Point::ORIGIN,
buffers: triangle::Mesh2D {
vertices: self.buffers.vertices,
indices: self.buffers.indices,
},
});
}
Primitive::Group {
primitives: self.primitives,