Skip to content

Commit

Permalink
Fix #404 panic when unnecessary sending normalMatrix uniform
Browse files Browse the repository at this point in the history
  • Loading branch information
asny committed Feb 26, 2024
1 parent 8412146 commit 17b1f13
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/renderer/geometry/instanced_mesh.rs
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ impl Geometry for InstancedMesh {
let instance_buffers = &self.instance_buffers.read().unwrap().0;
if attributes.normal && instance_buffers.contains_key("instance_translation") {
if let Some(inverse) = self.current_transformation.invert() {
program.use_uniform("normalMatrix", inverse.transpose());
program.use_uniform_if_required("normalMatrix", inverse.transpose());
} else {
// determinant is float zero
return;
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/geometry/mesh.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ impl Geometry for Mesh {
) {
if attributes.normal {
if let Some(inverse) = self.current_transformation.invert() {
program.use_uniform("normalMatrix", inverse.transpose());
program.use_uniform_if_required("normalMatrix", inverse.transpose());
} else {
// determinant is float zero
return;
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/geometry/particles.rs
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ impl Geometry for ParticleSystem {
) {
if attributes.normal {
if let Some(inverse) = self.transformation.invert() {
program.use_uniform("normalMatrix", inverse.transpose());
program.use_uniform_if_required("normalMatrix", inverse.transpose());
} else {
// determinant is float zero
return;
Expand Down

0 comments on commit 17b1f13

Please sign in to comment.