2
0
Эх сурвалжийг харах

Examples: Added shadows to new webxr hand examples.

Mr.doob 4 жил өмнө
parent
commit
4926b07554

+ 3 - 0
examples/webxr_vr_handinput_pointerclick.html

@@ -273,6 +273,8 @@
 			const geometry = new THREE.BoxGeometry( x, y, z );
 			const geometry = new THREE.BoxGeometry( x, y, z );
 			const material = new THREE.MeshPhongMaterial( { color: color } );
 			const material = new THREE.MeshPhongMaterial( { color: color } );
 			const buttonMesh = new THREE.Mesh( geometry, material );
 			const buttonMesh = new THREE.Mesh( geometry, material );
+			buttonMesh.castShadow = true;
+			buttonMesh.receiveShadow = true;
 			return buttonMesh;
 			return buttonMesh;
 
 
 		}
 		}
@@ -348,6 +350,7 @@
 			const floorMaterial = new THREE.MeshPhongMaterial( { color: 0x222222 } );
 			const floorMaterial = new THREE.MeshPhongMaterial( { color: 0x222222 } );
 			const floor = new THREE.Mesh( floorGeometry, floorMaterial );
 			const floor = new THREE.Mesh( floorGeometry, floorMaterial );
 			floor.rotation.x = - Math.PI / 2;
 			floor.rotation.x = - Math.PI / 2;
+			floor.receiveShadow = true;
 			scene.add( floor );
 			scene.add( floor );
 
 
 			const menuGeometry = new THREE.PlaneGeometry( 0.24, 0.5 );
 			const menuGeometry = new THREE.PlaneGeometry( 0.24, 0.5 );

+ 1 - 0
examples/webxr_vr_handinput_pointerdrag.html

@@ -454,6 +454,7 @@
 			const floorMaterial = new THREE.MeshPhongMaterial( { color: 0x222222 } );
 			const floorMaterial = new THREE.MeshPhongMaterial( { color: 0x222222 } );
 			const floor = new THREE.Mesh( floorGeometry, floorMaterial );
 			const floor = new THREE.Mesh( floorGeometry, floorMaterial );
 			floor.rotation.x = - Math.PI / 2;
 			floor.rotation.x = - Math.PI / 2;
+			floor.receiveShadow = true;
 			scene.add( floor );
 			scene.add( floor );
 
 
 			const menuGeometry = new THREE.PlaneGeometry( 0.24, 0.5 );
 			const menuGeometry = new THREE.PlaneGeometry( 0.24, 0.5 );

+ 5 - 0
examples/webxr_vr_handinput_pressbutton.html

@@ -333,6 +333,8 @@
 			const geometry = new THREE.BoxGeometry( x, y, z );
 			const geometry = new THREE.BoxGeometry( x, y, z );
 			const material = new THREE.MeshPhongMaterial( { color: color } );
 			const material = new THREE.MeshPhongMaterial( { color: color } );
 			const buttonMesh = new THREE.Mesh( geometry, material );
 			const buttonMesh = new THREE.Mesh( geometry, material );
+			buttonMesh.castShadow = true;
+			buttonMesh.receiveShadow = true;
 			return buttonMesh;
 			return buttonMesh;
 
 
 		}
 		}
@@ -406,12 +408,15 @@
 			const floorMaterial = new THREE.MeshPhongMaterial( { color: 0x222222 } );
 			const floorMaterial = new THREE.MeshPhongMaterial( { color: 0x222222 } );
 			const floor = new THREE.Mesh( floorGeometry, floorMaterial );
 			const floor = new THREE.Mesh( floorGeometry, floorMaterial );
 			floor.rotation.x = - Math.PI / 2;
 			floor.rotation.x = - Math.PI / 2;
+			floor.receiveShadow = true;
 			scene.add( floor );
 			scene.add( floor );
 
 
 			const consoleGeometry = new THREE.BoxGeometry( 0.5, 0.12, 0.15 );
 			const consoleGeometry = new THREE.BoxGeometry( 0.5, 0.12, 0.15 );
 			const consoleMaterial = new THREE.MeshPhongMaterial( { color: 0x595959 } );
 			const consoleMaterial = new THREE.MeshPhongMaterial( { color: 0x595959 } );
 			const consoleMesh = new THREE.Mesh( consoleGeometry, consoleMaterial );
 			const consoleMesh = new THREE.Mesh( consoleGeometry, consoleMaterial );
 			consoleMesh.position.set( 0, 1, - 0.3 );
 			consoleMesh.position.set( 0, 1, - 0.3 );
+			consoleMesh.castShadow = true;
+			consoleMesh.receiveShadow = true;
 			scene.add( consoleMesh );
 			scene.add( consoleMesh );
 
 
 			const orangeButton = makeButtonMesh( 0.08, 0.1, 0.08, 0xffd3b5 );
 			const orangeButton = makeButtonMesh( 0.08, 0.1, 0.08, 0xffd3b5 );