Skip to content

Commit

Permalink
Simplify a bit and set visibility via the rendering API
Browse files Browse the repository at this point in the history
  • Loading branch information
fenomas committed Apr 28, 2023
1 parent 5bdb9e4 commit 239898b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/components/shadow.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,14 @@ export default function (noa, distance = 10) {
var disc = CreateDisc('shadow', { radius: 0.75, tessellation: 30 }, scene)
disc.rotation.x = Math.PI / 2
var mat = noa.rendering.makeStandardMaterial('shadow_component_mat')
mat.diffuseColor = Color3.Black()
mat.ambientColor = Color3.Black()
mat.diffuseColor.set(0, 0, 0)
mat.ambientColor.set(0, 0, 0)
mat.alpha = 0.5
disc.material = mat
disc.setEnabled(false)
mat.freeze()

// source mesh needn't be in the scene graph
scene.removeMesh(disc)
noa.rendering.setMeshVisibility(disc, false)


return {
Expand All @@ -49,6 +48,7 @@ export default function (noa, distance = 10) {

onRemove: function (eid, state) {
state._mesh.dispose()
state._mesh = null
},


Expand Down

0 comments on commit 239898b

Please sign in to comment.