Browse Source

Examples: Clean up. (#28540)

* Examples: Clean up.

* remove useless code
林炳权 1 year ago
parent
commit
c94a3c64a0
1 changed files with 11 additions and 13 deletions
  1. 11 13
      examples/webxr_xr_dragging_custom_depth.html

+ 11 - 13
examples/webxr_xr_dragging_custom_depth.html

@@ -92,9 +92,9 @@
 				for ( let i = 0; i < 50; i ++ ) {
 				for ( let i = 0; i < 50; i ++ ) {
 
 
 					const geometry = geometries[ Math.floor( Math.random() * geometries.length ) ];
 					const geometry = geometries[ Math.floor( Math.random() * geometries.length ) ];
-					const material = new THREE.ShaderMaterial({
+					const material = new THREE.ShaderMaterial( {
 
 
-						vertexShader: `
+						vertexShader: /* glsl */`
 							varying vec3 vNormal;
 							varying vec3 vNormal;
 							varying vec2 vUv;
 							varying vec2 vUv;
 							void main() {
 							void main() {
@@ -104,7 +104,7 @@
 							}
 							}
 						`,
 						`,
 
 
-						fragmentShader: `
+						fragmentShader: /* glsl */`
 							uniform vec3 diffuseColor;
 							uniform vec3 diffuseColor;
 							uniform float roughness;
 							uniform float roughness;
 							uniform float metalness;
 							uniform float metalness;
@@ -223,7 +223,7 @@
 
 
 						uniforms: {
 						uniforms: {
 
 
-							diffuseColor: { value: new THREE.Color( Math.random() * 0xffffff) },
+							diffuseColor: { value: new THREE.Color( Math.random() * 0xffffff ) },
 							roughness: { value: 0.7 },
 							roughness: { value: 0.7 },
 							metalness: { value: 0.0 },
 							metalness: { value: 0.0 },
 							emissive: { value: 0.0 },
 							emissive: { value: 0.0 },
@@ -233,7 +233,7 @@
 
 
 						}
 						}
 
 
-					});
+					} );
 
 
 					const object = new THREE.Mesh( geometry, material );
 					const object = new THREE.Mesh( geometry, material );
 
 
@@ -418,30 +418,28 @@
 
 
 			function render() {
 			function render() {
 
 
-				if (renderer.xr.hasDepthSensing() && ! isDepthSupplied) {
+				if ( renderer.xr.hasDepthSensing() && ! isDepthSupplied ) {
 
 
-					group.children.forEach(child => {
+					group.children.forEach( child => {
 
 
 						child.material.uniforms.depthColor.value = renderer.xr.getDepthTexture();
 						child.material.uniforms.depthColor.value = renderer.xr.getDepthTexture();
 						child.material.uniforms.depthWidth.value = 1680;
 						child.material.uniforms.depthWidth.value = 1680;
 						child.material.uniforms.depthHeight.value = 1760;
 						child.material.uniforms.depthHeight.value = 1760;
-						child.material.uniforms.NeedUpdate = true;
 
 
 						isDepthSupplied = true;
 						isDepthSupplied = true;
 
 
-					});
+					} );
 
 
-				} else if (! renderer.xr.hasDepthSensing() && isDepthSupplied) {
+				} else if ( ! renderer.xr.hasDepthSensing() && isDepthSupplied ) {
 
 
-					group.children.forEach(child => {
+					group.children.forEach( child => {
 
 
 						child.material.uniforms.depthWidth.value = 0;
 						child.material.uniforms.depthWidth.value = 0;
 						child.material.uniforms.depthHeight.value = 0;
 						child.material.uniforms.depthHeight.value = 0;
-						child.material.uniforms.NeedUpdate = true;
 
 
 						isDepthSupplied = false;
 						isDepthSupplied = false;
 
 
-					});
+					} );
 
 
 				}
 				}