diff --git a/year4/semester1/CT404: Graphics & Image Processing/materials/week3/examples/Threejs-22-lights-examples.html b/year4/semester1/CT404: Graphics & Image Processing/materials/week3/examples/Threejs-22-lights-examples.html index 35dda3b4..f5b52495 100644 --- a/year4/semester1/CT404: Graphics & Image Processing/materials/week3/examples/Threejs-22-lights-examples.html +++ b/year4/semester1/CT404: Graphics & Image Processing/materials/week3/examples/Threejs-22-lights-examples.html @@ -1,141 +1,143 @@ -
- - - - + + - + function toggleAmbientLight() { + ambientLightVisible = !ambientLightVisible; + if (ambientLightVisible) + scene.add(ambientLight); + else + scene.remove(ambientLight); + } + + function toggleHemisphereLight() { + hemisphereLightVisible = !hemisphereLightVisible; + if (hemisphereLightVisible) + scene.add(hemisphereLight); + else + scene.remove(hemisphereLight); + } + + function toggleDirectionalLight() { + directionalLightVisible = !directionalLightVisible; + if (directionalLightVisible) + scene.add(directionalLight); + else + scene.remove(directionalLight); + } + + + + + +