Browse Source

Examples: minor inline script updates (#25425)

* Update webgl2_rendertarget_texture2darray.html

Consistent es6 syntax in inline scripts.

* Update webgl2_volume_instancing.html

Consistent es6 syntax in inline scripts.

* Update webgl_custom_attributes_points3.html

Consistent es6 syntax in inline scripts.

* Update webgl_lines_colors.html

Consistent es6 syntax in inline scripts.

* Update webgl_performance_shader.html

Consistent es6 syntax in inline scripts.
Ed Preston 2 years ago
parent
commit
d45acc1dad

+ 9 - 9
examples/webgl2_rendertarget_texture2darray.html

@@ -152,18 +152,18 @@
 				fragmentShader: document.getElementById( 'fragment-postprocess' ).textContent.trim()
 			} );
 
-			var depthStep = 0.4;
+			let depthStep = 0.4;
 
-			var camera, scene, mesh, renderer, stats;
+			let camera, scene, mesh, renderer, stats;
 
-			var planeWidth = 50;
-			var planeHeight = 50;
+			const planeWidth = 50;
+			const planeHeight = 50;
 
 			init();
 
 			function init() {
 
-				var container = document.createElement( 'div' );
+				const container = document.createElement( 'div' );
 				document.body.appendChild( container );
 
 				camera = new THREE.PerspectiveCamera( 45, window.innerWidth / window.innerHeight, 0.1, 2000 );
@@ -200,14 +200,14 @@
 					.setResponseType( 'arraybuffer' )
 					.load( 'textures/3d/head256x256x109.zip', function ( data ) {
 
-						var zip = unzipSync( new Uint8Array( data ) );
+						const zip = unzipSync( new Uint8Array( data ) );
 						const array = new Uint8Array( zip[ 'head256x256x109' ].buffer );
 
 						const texture = new THREE.DataArrayTexture( array, DIMENSIONS.width, DIMENSIONS.height, DIMENSIONS.depth );
 						texture.format = THREE.RedFormat;
 						texture.needsUpdate = true;
 
-						var material = new THREE.ShaderMaterial( {
+						const material = new THREE.ShaderMaterial( {
 							uniforms: {
 								diffuse: { value: renderTarget.texture },
 								depth: { value: 55 },
@@ -217,7 +217,7 @@
 							fragmentShader: document.getElementById( 'fs' ).textContent.trim()
 						} );
 
-						var geometry = new THREE.PlaneGeometry( planeWidth, planeHeight );
+						const geometry = new THREE.PlaneGeometry( planeWidth, planeHeight );
 
 						mesh = new THREE.Mesh( geometry, material );
 
@@ -244,7 +244,7 @@
 
 				requestAnimationFrame( animate );
 
-				var value = mesh.material.uniforms[ 'depth' ].value;
+				let value = mesh.material.uniforms[ 'depth' ].value;
 
 				value += depthStep;
 

+ 2 - 2
examples/webgl2_volume_instancing.html

@@ -172,10 +172,10 @@
 					}
 				`;
 
-				var loader = new VOXLoader();
+				const loader = new VOXLoader();
 				loader.load( 'models/vox/menger.vox', function ( chunks ) {
 
-					for ( var i = 0; i < chunks.length; i ++ ) {
+					for ( let i = 0; i < chunks.length; i ++ ) {
 
 						const chunk = chunks[ i ];
 

+ 1 - 1
examples/webgl_custom_attributes_points3.html

@@ -145,7 +145,7 @@
 
 					const positionAttribute = geo.getAttribute( 'position' );
 
-					for ( var i = 0, l = positionAttribute.count; i < l; i ++ ) {
+					for ( let i = 0, l = positionAttribute.count; i < l; i ++ ) {
 
 						vertex.fromBufferAttribute( positionAttribute, i );
 						vertex.applyMatrix4( matrix );

+ 1 - 1
examples/webgl_lines_colors.html

@@ -138,7 +138,7 @@
 
 				// Create lines and add to scene
 
-				var	material = new THREE.LineBasicMaterial( { color: 0xffffff, vertexColors: true } );
+				const material = new THREE.LineBasicMaterial( { color: 0xffffff, vertexColors: true } );
 
 				let line, p;
 				const scale = 0.3, d = 225;

+ 1 - 1
examples/webgl_performance_shader.html

@@ -158,7 +158,7 @@
 
 			function removeAllMeshes() {
 
-				for ( var i = scene.children.length - 1; i >= 0; i -- ) {
+				for ( let i = scene.children.length - 1; i >= 0; i -- ) {
 
 					const obj = scene.children[ i ];
 					scene.remove( obj );