Skip to content

Commit 560349d

Browse files
committed
add toggle to disable shader
1 parent f816699 commit 560349d

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

src/main.ts

+17
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,9 @@ debugGroup.add(targetBall)
8686

8787
debugGroup.visible = false
8888

89+
const shaderlessLight = new THREE.DirectionalLight(0xffffff, 1)
90+
shaderlessLight.position.set(0, 100, 0)
91+
8992
// --------------------------------------------------------------------------------
9093
// Postprocessing
9194

@@ -133,6 +136,20 @@ guiMeshFog
133136
scene.background = canUni.fogColorFar.value
134137
})
135138

139+
guiMeshFog
140+
.add({ disableShader: false }, "disableShader")
141+
.onChange((disable) => {
142+
if (canyonMesh?.material) {
143+
if (disable) {
144+
canyonMesh.material = new THREE.MeshStandardMaterial()
145+
scene.add(shaderlessLight)
146+
} else {
147+
canyonMesh.material = canyonMaterial
148+
scene.remove(shaderlessLight)
149+
}
150+
}
151+
})
152+
136153
// --------------------------------------------------------------------------------
137154
// Animation
138155

0 commit comments

Comments
 (0)