You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import{Model}from'@luma.gl/engine';import{picking}from'@luma.gl/shadertools';constmodel=newModel(device,{ ... ,modules: [picking]});model.updateModuleSettings({pickingActive: 1});// avaliable.model.updateModuleSettings({pickingActive: true});// avaliable.model.updateModuleSettings({pickingActive: [1]});// avaliable.model.updateModuleSettings({pickingActive: [true]});// avaliable.model.draw();model.updateModuleSettings({pickingActive: 0});// not avaliable.model.updateModuleSettings({pickingActive: false});// not avaliable.model.updateModuleSettings({pickingActive: [0]});// not avaliable.model.updateModuleSettings({pickingActive: [false]});// not avaliable.model.draw();// `picking_uActive` still have `true` value.
// picking.ts
...
functiongetUniforms(opts=DEFAULT_MODULE_OPTIONS): Record<string,any>{constuniforms: Record<string,any>={};if(opts.pickingSelectedColor!==undefined){if(!opts.pickingSelectedColor){uniforms.picking_uSelectedColorValid=0;// -> set 0}else{constselectedColor=opts.pickingSelectedColor.slice(0,3);uniforms.picking_uSelectedColorValid=1;uniforms.picking_uSelectedColor=selectedColor;}}if(opts.pickingHighlightColor){constcolor=Array.from(opts.pickingHighlightColor,(x)=>x/255);if(!Number.isFinite(color[3])){color[3]=1;}uniforms.picking_uHighlightColor=color;}if(opts.pickingActive!==undefined){uniforms.picking_uActive=Boolean(opts.pickingActive);// -> set falseuniforms.picking_uAttribute=Boolean(opts.pickingAttribute);// -> set false}returnuniforms;}...
// @luma.gl/webgl// src/adapter/resources/webgl-render-pipline.ts
...
_applyUniforms(){for(constuniformLayoutofthis.layout.uniforms||[]){const{name, location, type, textureUnit}=uniformLayout;constvalue=this.uniforms[name]||textureUnit;// when uniform value `0` or `false` the value is avaliable but result is can be `undefined` when textureUnit is `undefined`.if(value!==undefined){setUniform(this.device.gl,location,type,value);}}}
...
Expected Result
If the value of the uniform is not set, it is possible that the value set in the previous frame will be used.
So, uniform value when 0 or false should be set.
Reproduce Steps
To Do List
Add label and assign to milestone
Coding
Test
Background
To Do List
Add label and assign to milestone
Coding
Doc update
Whats new update
Test
The text was updated successfully, but these errors were encountered:
Seungup
changed the title
uniform value when 0 or false cann version 9.0.0-alpha.15
uniform value when 0 or false cannt set on version 9.0.0-alpha.15
Apr 21, 2023
Seungup
changed the title
uniform value when 0 or false cannt set on version 9.0.0-alpha.15
Cannot set a value of false, or 0 for uniform on version 9.0.0-alpha.15
Apr 21, 2023
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
Actual Result
Expected Result
If the value of the uniform is not set, it is possible that the value set in the previous frame will be used.
So, uniform value when
0
orfalse
should be set.Reproduce Steps
To Do List
Background
To Do List
The text was updated successfully, but these errors were encountered: