pex-gl / pex-renderer

Physically based renderer (PBR) and scene graph for PEX.
https://pex-gl.github.io/pex-renderer/examples/index.html
MIT License
237 stars 16 forks source link

Setting directional light property castShadow : false gives error "Trying to dispose undefined resource" #223

Closed simonharrisco closed 1 year ago

simonharrisco commented 5 years ago

Setting directional light property castShadow : false gives error "Trying to dispose undefined resource"

eg in 'blocks' example addition at L178 like so:

const sunLight = renderer.directionalLight({
  color: [1, 1, 1, 1],
  intensity: 2,
  castShadows: true,
  bias: 0.01
})
sunLight.set({castShadows:false})

Causes full black screen with error. Full error:

Uncaught (in promise) 
AssertionError {name: "AssertionError", actual: false, expected: true, operator: "==", message: "Trying to dispose undefined resource", …}
actual: false
expected: true
generatedMessage: false
message: "Trying to dispose undefined resource"
name: "AssertionError"
operator: "=="
stack: "AssertionError: Trying to dispose undefined resource↵    at Object.dispose (webpack:///./node_modules/pex-context/index.js?:991:7)↵    at DirectionalLight.disposeResources (webpack:///../directional-light.js?:104:7)↵    at DirectionalLight.set (webpack:///../directional-light.js?:52:30)↵    at eval (webpack:///./blocks.js?:178:10)↵    at Object../blocks.js (http://localhost:8080/build/main.js:1660:1)↵    at __webpack_require__ (http://localhost:8080/build/main.js:64:30)↵    at Function.__webpack_require__.t (http://localhost:8080/build/main.js:159:33)↵    at eval (webpack:///._lazy_^\.\/.*\.js$_exclude:_scripts$_namespace_object?:84:30)"
__proto__: Error
dmnsgn commented 1 year ago

v4: not anymore