Преглед изворни кода

Examples: Clean up. (#30419)

* Examples: Clean up.

* GLSLNodeBuilder: Remove log.
Michael Herzog пре 11 месеци
родитељ
комит
0b79d6f41a

+ 8 - 9
examples/webgpu_compute_sort_bitonic.html

@@ -122,6 +122,14 @@
 			
 			} );
 
+			if ( WebGPU.isAvailable() === false ) {
+
+				document.body.appendChild( WebGPU.getErrorMessage() );
+
+				throw new Error( 'No WebGPU support' );
+
+			}
+
 			// Allow Workgroup Array Swaps
 			init();
 
@@ -132,15 +140,6 @@
 			// When forceGlobalSwap is true, force all valid local swaps to be global swaps.
 			async function init( forceGlobalSwap = false ) {
 
-
-				if ( WebGPU.isAvailable() === false ) {
-
-					document.body.appendChild( WebGPU.getErrorMessage() );
-
-					throw new Error( 'No WebGPU support' );
-
-				}
-
 				let currentStep = 0;
 				let nextStepGlobal = false;
 

+ 9 - 0
examples/webgpu_materials.html

@@ -31,6 +31,7 @@
 			import { Fn, wgslFn, positionLocal, scriptable, positionWorld, normalLocal, normalWorld, normalView, color, texture, uv, float, vec2, vec3, vec4, oscSine, triplanarTexture, screenUV, js, string, Loop, cameraProjectionMatrix, ScriptableNodeResources } from 'three/tsl';
 
 			import { TeapotGeometry } from 'three/addons/geometries/TeapotGeometry.js';
+			import WebGPU from 'three/addons/capabilities/WebGPU.js';
 
 			import Stats from 'three/addons/libs/stats.module.js';
 
@@ -44,6 +45,14 @@
 
 			function init() {
 
+				if ( WebGPU.isAvailable() === false ) {
+
+					document.body.appendChild( WebGPU.getErrorMessage() );
+
+					throw new Error( 'No WebGPU support' );
+
+				}
+
 				const container = document.createElement( 'div' );
 				document.body.appendChild( container );
 

+ 9 - 0
examples/webgpu_particles.html

@@ -28,6 +28,7 @@
 			import { range, texture, mix, uv, color, rotateUV, positionLocal, time, uniform } from 'three/tsl';
 
 			import { GUI } from 'three/addons/libs/lil-gui.module.min.js';
+			import WebGPU from 'three/addons/capabilities/WebGPU.js';
 
 			import { OrbitControls } from 'three/addons/controls/OrbitControls.js';
 
@@ -38,6 +39,14 @@
 
 			function init() {
 
+				if ( WebGPU.isAvailable() === false ) {
+
+					document.body.appendChild( WebGPU.getErrorMessage() );
+
+					throw new Error( 'No WebGPU support' );
+
+				}
+
 				const { innerWidth, innerHeight } = window;
 
 				camera = new THREE.PerspectiveCamera( 60, innerWidth / innerHeight, 1, 5000 );

+ 10 - 0
examples/webgpu_struct_drawindirect.html

@@ -29,6 +29,16 @@
 			import { struct, storage, wgslFn, instanceIndex, time, varyingProperty, attribute } from 'three/tsl';
 
 			import { OrbitControls } from 'three/addons/controls/OrbitControls.js';
+			import WebGPU from 'three/addons/capabilities/WebGPU.js';
+
+			if ( WebGPU.isAvailable() === false ) {
+
+				document.body.appendChild( WebGPU.getErrorMessage() );
+
+				throw new Error( 'No WebGPU support' );
+
+			}
+
 
 			const renderer = new THREE.WebGPURenderer( { antialias: true } );
 			renderer.outputColorSpace = THREE.SRGBColorSpace;

+ 0 - 1
src/renderers/webgl-fallback/nodes/GLSLNodeBuilder.js

@@ -1256,7 +1256,6 @@ void main() {
 
 			this.vertexShader = this._getGLSLVertexCode( shadersData.vertex );
 			this.fragmentShader = this._getGLSLFragmentCode( shadersData.fragment );
-			console.log( this.fragmentShader );
 
 		} else {
 

粤ICP备19079148号