瀏覽代碼

Examples: Clean up. (#21704)

Michael Herzog 4 年之前
父節點
當前提交
4edc1a0551

+ 6 - 6
examples/jsm/renderers/nodes/functions/MathFunctions.js

@@ -23,13 +23,13 @@ vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {
 
 }` );
 
-export const pow2 = new FunctionNode( `float pow2( const in float x ) { return x*x; }` );
-export const pow3 = new FunctionNode( `float pow3( const in float x ) { return x*x*x; }` );
-export const pow4 = new FunctionNode( `float pow4( const in float x ) { float x2 = x*x; return x2*x2; }` );
+export const pow2 = new FunctionNode( 'float pow2( const in float x ) { return x*x; }' );
+export const pow3 = new FunctionNode( 'float pow3( const in float x ) { return x*x*x; }' );
+export const pow4 = new FunctionNode( 'float pow4( const in float x ) { float x2 = x*x; return x2*x2; }' );
 
-export const average = new FunctionNode( `float average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }` );
+export const average = new FunctionNode( 'float average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }' );
 
-export const max3 = new FunctionNode( `float max3( vec3 v ) { return max( max( v.x, v.y ), v.z ); }` );
+export const max3 = new FunctionNode( 'float max3( vec3 v ) { return max( max( v.x, v.y ), v.z ); }' );
 
 // expects values in the range of [0,1]x[0,1], returns values in the [0,1] range.
 // do not collapse into a single function per: http://byteblacksmith.com/improvements-to-the-canonical-one-liner-glsl-rand-for-opengl-es-2-0/
@@ -44,4 +44,4 @@ highp float rand( const in vec2 uv ) {
 
 }` ).setIncludes( [ PI ] );
 
-export const precisionSafeLength = new FunctionNode( `float precisionSafeLength( vec3 v ) { return length( v ); }` );
+export const precisionSafeLength = new FunctionNode( 'float precisionSafeLength( vec3 v ) { return length( v ); }' );

+ 2 - 2
examples/jsm/renderers/nodes/lights/LightContextNode.js

@@ -38,8 +38,8 @@ class LightContextNode extends ContextNode {
 
 		}
 
-		const resetTotalLight = `Irradiance = vec3( 0.0 ); ReflectedLightDirectDiffuse = vec3( 0.0 ); ReflectedLightDirectSpecular = vec3( 0.0 );`;
-		const resultTotalLight = `ReflectedLightDirectDiffuse + ReflectedLightDirectSpecular`;
+		const resetTotalLight = 'Irradiance = vec3( 0.0 ); ReflectedLightDirectDiffuse = vec3( 0.0 ); ReflectedLightDirectSpecular = vec3( 0.0 );';
+		const resultTotalLight = 'ReflectedLightDirectDiffuse + ReflectedLightDirectSpecular';
 
 		// include keywords
 

+ 1 - 1
examples/jsm/renderers/nodes/lights/LightNode.js

@@ -44,7 +44,7 @@ class LightNode extends Node {
 
 	}
 
-	update( frame ) {
+	update( /* frame */ ) {
 
 		this.color.value.copy( this.light.color ).multiplyScalar( this.light.intensity );
 		this.lightCutoffDistance.value = this.light.distance;

+ 1 - 1
examples/jsm/renderers/nodes/lights/LightsNode.js

@@ -21,7 +21,7 @@ class LightsNode extends Node {
 
 		}
 
-		return builder.format( 'vec3( 0.0 )',  this.getType( builder ), output );
+		return builder.format( 'vec3( 0.0 )', this.getType( builder ), output );
 
 	}
 

+ 1 - 1
examples/webgpu_instance_uniform.html

@@ -8,7 +8,7 @@
 	</head>
 	<body>
 		<div id="info">
-			<a href="https://threejs.org" target="_blank" rel="noopener">three.js</a> - WebGPU Instance Uniform<br/>(Chrome Canary with flag: --enable-unsafe-webgpu)
+			<a href="https://threejs.org" target="_blank" rel="noopener">three.js</a> - WebGPU - Instance Uniform<br/>(Chrome Canary with flag: --enable-unsafe-webgpu)
 		</div>
 
 		<script type="importmap">

+ 4 - 3
examples/webgpu_lights_selective.html

@@ -1,7 +1,7 @@
 <!DOCTYPE html>
 <html lang="en">
 	<head>
-		<title>three.js webgpu - selective lights</title>
+		<title>three.js - WebGPU - Selective Lights</title>
 		<meta charset="utf-8">
 		<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
 		<link type="text/css" rel="stylesheet" href="main.css">
@@ -9,7 +9,8 @@
 	<body>
 
 		<div id="info">
-			<a href="https://threejs.org" target="_blank" rel="noopener">three.js</a> - selective lights WebGPU demo.<br />
+			<a href="https://threejs.org" target="_blank" rel="noopener">three.js</a> - WebGPU - Selective Lights<br />
+			(Chrome Canary with flag: --enable-unsafe-webgpu)<br />
 			<b style="color:red">Left: Red lights</b> - <b>Center: All lights</b> - <b style="color:blue">Right: blue light</b>
 		</div>
 
@@ -102,7 +103,7 @@
 				leftObject.material.shininess = centerObject.material.shininess = rightObject.material.shininess = 70;
 
 				leftObject.rotation.y = centerObject.rotation.y = rightObject.rotation.y = Math.PI * - 0.5;
-				leftObject.position.y = centerObject.position.y = rightObject.position.y =  - 10;
+				leftObject.position.y = centerObject.position.y = rightObject.position.y = - 10;
 
 				//renderer