Fix - Crash in `Mesh::draw`
* function now returns if the determinant of `self.current_transformation`
is float zero.
@@ -98,13 +98,16 @@ impl Mesh {
}
fn draw(&self, program: &Program, render_states: RenderStates, camera: &Camera) {
+ if let Some(inverse) = self.current_transformation.invert() {
+ program.use_uniform_if_required("normalMatrix", inverse.transpose());
+ } else {
+ // determinant is float zero
+ return;
+ }
+
program.use_uniform("viewProjection", camera.projection() * camera.view());
program.use_uniform("modelMatrix", self.current_transformation);
program.use_uniform_if_required("textureTransform", self.texture_transform);
- program.use_uniform_if_required(
- "normalMatrix",
- self.current_transformation.invert().unwrap().transpose(),
- );
for attribute_name in ["position", "normal", "tangent", "color", "uv_coordinates"] {
if program.requires_attribute(attribute_name) {
