Jelajahi Sumber

Examples: Remove remaining linter issues. (#25195)

Michael Herzog 2 tahun lalu
induk
melakukan
049026e558

+ 1 - 1
examples/jsm/nodes/accessors/CubeTextureNode.js

@@ -24,7 +24,7 @@ class CubeTextureNode extends TextureNode {
 
 	getDefaultUV() {
 
-		return defaultUV || ( defaultUV = new ReflectVectorNode() );;
+		return defaultUV || ( defaultUV = new ReflectVectorNode() );
 
 	}
 

+ 1 - 0
examples/jsm/nodes/accessors/ExtendedMaterialNode.js

@@ -25,6 +25,7 @@ class ExtendedMaterialNode extends MaterialNode {
 		}
 
 		return type || super.getNodeType( builder );
+
 	}
 
 	construct( builder ) {

+ 1 - 1
examples/jsm/nodes/accessors/MaterialNode.js

@@ -162,7 +162,7 @@ class MaterialNode extends Node {
 			// uv repeat and offset setting priorities
 
 			let uvNode;
-			let uvScaleMap = 
+			let uvScaleMap =
 				material.map ||
 				material.specularMap ||
 				material.displacementMap ||

+ 1 - 1
examples/jsm/nodes/functions/BSDF/DFGApprox.js

@@ -16,7 +16,7 @@ const DFGApprox = new ShaderNode( ( inputs ) => {
 
 	const r = roughness.mul( c0 ).add( c1 );
 
-	const a004 = min( mul( r.x, r.x ), dotNV.mul( -9.28 ).exp2() ).mul( r.x ).add( r.y );
+	const a004 = min( mul( r.x, r.x ), dotNV.mul( - 9.28 ).exp2() ).mul( r.x ).add( r.y );
 
 	const fab = vec2( - 1.04, 1.04 ).mul( a004 ).add( r.zw );
 

+ 1 - 1
examples/jsm/nodes/materials/MeshStandardNodeMaterial.js

@@ -53,7 +53,7 @@ export default class MeshStandardNodeMaterial extends NodeMaterial {
 
 		// METALNESS
 
-		let metalnessNode = this.metalnessNode ? float( this.metalnessNode ) : materialMetalness;
+		const metalnessNode = this.metalnessNode ? float( this.metalnessNode ) : materialMetalness;
 
 		stack.assign( metalness, metalnessNode );
 		stack.assign( diffuseColor, vec4( diffuseColor.rgb.mul( metalnessNode.invert() ), diffuseColor.a ) );

+ 1 - 1
examples/jsm/nodes/shadernode/ShaderNodeBaseElements.js

@@ -249,7 +249,7 @@ export const modelViewProjection = nodeProxy( ModelViewProjectionNode );
 export const normalGeometry = nodeImmutable( NormalNode, NormalNode.GEOMETRY );
 export const normalLocal = nodeImmutable( NormalNode, NormalNode.LOCAL );
 export const normalView = nodeImmutable( NormalNode, NormalNode.VIEW );
-export const normalWorld = nodeImmutable( NormalNode, NormalNode.WORLD );;
+export const normalWorld = nodeImmutable( NormalNode, NormalNode.WORLD );
 export const transformedNormalView = nodeImmutable( PropertyNode, 'vec3', 'TransformedNormalView' );
 export const transformedNormalWorld = normalize( transformDirection( transformedNormalView, cameraViewMatrix ) );
 

+ 59 - 51
examples/webgl_loader_texture_ktx2.html

@@ -34,72 +34,82 @@
 			import { KTX2Loader } from 'three/addons/loaders/KTX2Loader.js';
 			import { OrbitControls } from 'three/addons/controls/OrbitControls.js';
 
-			const width = window.innerWidth;
-			const height = window.innerHeight;
+			let camera, scene, renderer, controls;
 
-			const renderer = new THREE.WebGLRenderer( { antialias: true } );
-			renderer.setSize( width, height );
-			renderer.outputEncoding = THREE.sRGBEncoding;
-			document.body.appendChild( renderer.domElement );
+			init().then( animate );
 
-			const scene = new THREE.Scene();
-			scene.background = new THREE.Color( 0x202020 );
+			async function init() {
 
-			const camera = new THREE.PerspectiveCamera( 60, width / height, 0.1, 100 );
-			camera.position.set( 2, 1.5, 1 );
-			camera.lookAt( scene.position );
-			scene.add( camera );
+				const width = window.innerWidth;
+				const height = window.innerHeight;
+
+				renderer = new THREE.WebGLRenderer( { antialias: true } );
+				renderer.setSize( width, height );
+				renderer.outputEncoding = THREE.sRGBEncoding;
+				document.body.appendChild( renderer.domElement );
+
+				window.addEventListener( 'resize', onWindowResize );
+
+				scene = new THREE.Scene();
+				scene.background = new THREE.Color( 0x202020 );
 
-			const controls = new OrbitControls( camera, renderer.domElement );
-			controls.autoRotate = true;
+				camera = new THREE.PerspectiveCamera( 60, width / height, 0.1, 100 );
+				camera.position.set( 2, 1.5, 1 );
+				camera.lookAt( scene.position );
+				scene.add( camera );
 
-			// PlaneGeometry UVs assume flipY=true, which compressed textures don't support.
-			const geometry = flipY( new THREE.PlaneGeometry() );
-			const material = new THREE.MeshBasicMaterial( {
-				color: 0xFFFFFF,
-				side: THREE.DoubleSide
-			} );
-			const mesh = new THREE.Mesh( geometry, material );
-			scene.add( mesh );
+				controls = new OrbitControls( camera, renderer.domElement );
+				controls.autoRotate = true;
 
-			const formatStrings = {
-				[ THREE.RGBAFormat ]: 'RGBA32',
-				[ THREE.RGBA_BPTC_Format ]: 'RGBA_BPTC',
-				[ THREE.RGBA_ASTC_4x4_Format ]: 'RGBA_ASTC_4x4',
-				[ THREE.RGB_S3TC_DXT1_Format ]: 'RGB_S3TC_DXT1',
-				[ THREE.RGBA_S3TC_DXT5_Format ]: 'RGBA_S3TC_DXT5',
-				[ THREE.RGB_PVRTC_4BPPV1_Format ]: 'RGB_PVRTC_4BPPV1',
-				[ THREE.RGBA_PVRTC_4BPPV1_Format ]: 'RGBA_PVRTC_4BPPV1',
-				[ THREE.RGB_ETC1_Format ]: 'RGB_ETC1',
-				[ THREE.RGB_ETC2_Format ]: 'RGB_ETC2',
-				[ THREE.RGBA_ETC2_EAC_Format ]: 'RGB_ETC2_EAC',
-			};
+				// PlaneGeometry UVs assume flipY=true, which compressed textures don't support.
+				const geometry = flipY( new THREE.PlaneGeometry() );
+				const material = new THREE.MeshBasicMaterial( {
+					color: 0xFFFFFF,
+					side: THREE.DoubleSide
+				} );
+				const mesh = new THREE.Mesh( geometry, material );
+				scene.add( mesh );
 
-			// Samples: sample_etc1s.ktx2, sample_uastc.ktx2, sample_uastc_zstd.ktx2
-			const loader = new KTX2Loader()
-				.setTranscoderPath( 'jsm/libs/basis/' )
-				.detectSupport( renderer );
+				const formatStrings = {
+					[ THREE.RGBAFormat ]: 'RGBA32',
+					[ THREE.RGBA_BPTC_Format ]: 'RGBA_BPTC',
+					[ THREE.RGBA_ASTC_4x4_Format ]: 'RGBA_ASTC_4x4',
+					[ THREE.RGB_S3TC_DXT1_Format ]: 'RGB_S3TC_DXT1',
+					[ THREE.RGBA_S3TC_DXT5_Format ]: 'RGBA_S3TC_DXT5',
+					[ THREE.RGB_PVRTC_4BPPV1_Format ]: 'RGB_PVRTC_4BPPV1',
+					[ THREE.RGBA_PVRTC_4BPPV1_Format ]: 'RGBA_PVRTC_4BPPV1',
+					[ THREE.RGB_ETC1_Format ]: 'RGB_ETC1',
+					[ THREE.RGB_ETC2_Format ]: 'RGB_ETC2',
+					[ THREE.RGBA_ETC2_EAC_Format ]: 'RGB_ETC2_EAC',
+				};
 
-			animate();
+				// Samples: sample_etc1s.ktx2, sample_uastc.ktx2, sample_uastc_zstd.ktx2
+				const loader = new KTX2Loader()
+					.setTranscoderPath( 'jsm/libs/basis/' )
+					.detectSupport( renderer );
 
-			try {
 
-				const texture = await loader.loadAsync( './textures/compressed/sample_uastc_zstd.ktx2' );
+				try {
 
-				console.info( `transcoded to ${formatStrings[ texture.format ]}` );
+					const texture = await loader.loadAsync( './textures/compressed/sample_uastc_zstd.ktx2' );
 
-				material.map = texture;
-				material.transparent = true;
+					console.info( `transcoded to ${formatStrings[ texture.format ]}` );
 
-				material.needsUpdate = true;
+					material.map = texture;
+					material.transparent = true;
 
-			} catch ( e ) {
+					material.needsUpdate = true;
 
-				console.error( e );
+				} catch ( e ) {
 
-			} finally {
+					console.error( e );
+
+				} finally {
+
+					loader.dispose();
+
+				}
 
-				loader.dispose();
 
 			}
 
@@ -113,8 +123,6 @@
 
 			}
 
-			window.addEventListener( 'resize', onWindowResize );
-
 			function onWindowResize() {
 
 				const width = window.innerWidth;

+ 1 - 2
examples/webgl_materials_lightmap.html

@@ -37,8 +37,7 @@
 			let container, stats;
 			let camera, scene, renderer;
 
-			await init();
-			animate();
+			init().then( animate );
 
 			async function init() {
 

+ 1 - 1
examples/webgpu_audio_processing.html

@@ -51,7 +51,7 @@
 			const analyserBuffer = new Uint8Array( 1024 );
 			let analyserTexture;
 
-			await init();
+			init();
 
 			async function playAudioBuffer() {
 

+ 0 - 4
package.json

@@ -75,10 +75,6 @@
       "no-throw-literal": [
         "error"
       ],
-      "import/extensions": [
-        "error",
-        "always"
-      ],
       "quotes": [
         "error",
         "single"