Skip to content

Commit

Permalink
fix: 🐛 Fix issue with setting 0 or false values
Browse files Browse the repository at this point in the history
The change involves replacing the logical OR operator (`||`) with the
nullish coalescing operator (`??`) in the `_applyUniforms()` method.
This modification addresses a specific issue where 0 or false values
were not being correctly assigned. By using the nullish coalescing
operator, the code ensures that if the value of `this.uniforms[name]` is
either 0 or false, it will be properly assigned as the value for
`value`. This change enhances the accuracy and reliability of the code
by handling these specific cases effectively.

✅ Closes: #1741
  • Loading branch information
Seungup committed Jul 15, 2023
1 parent 5e4a304 commit 050ff5a
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ export class WEBGLRenderPipeline extends RenderPipeline {
_applyUniforms() {
for (const uniformLayout of this.layout.uniforms || []) {
const {name, location, type, textureUnit} = uniformLayout;
const value = this.uniforms[name] || textureUnit;
const value = this.uniforms[name] ?? textureUnit;
if (value !== undefined) {
setUniform(this.device.gl, location, type, value);
}
Expand Down

0 comments on commit 050ff5a

Please sign in to comment.