فهرست منبع

self -> scope

WestLangley 5 سال پیش
والد
کامیت
10125d6a72

+ 5 - 5
examples/js/animation/CCDIKSolver.js

@@ -392,7 +392,7 @@ THREE.CCDIKSolver = ( function () {
 
 		_init: function () {
 
-			var self = this;
+			var scope = this;
 			var iks = this.iks;
 
 			function createLineGeometry( ik ) {
@@ -407,25 +407,25 @@ THREE.CCDIKSolver = ( function () {
 
 			function createTargetMesh() {
 
-				return new THREE.Mesh( self.sphereGeometry, self.targetSphereMaterial );
+				return new THREE.Mesh( scope.sphereGeometry, scope.targetSphereMaterial );
 
 			}
 
 			function createEffectorMesh() {
 
-				return new THREE.Mesh( self.sphereGeometry, self.effectorSphereMaterial );
+				return new THREE.Mesh( scope.sphereGeometry, scope.effectorSphereMaterial );
 
 			}
 
 			function createLinkMesh() {
 
-				return new THREE.Mesh( self.sphereGeometry, self.linkSphereMaterial );
+				return new THREE.Mesh( scope.sphereGeometry, scope.linkSphereMaterial );
 
 			}
 
 			function createLine( ik ) {
 
-				return new THREE.Line( createLineGeometry( ik ), self.lineMaterial );
+				return new THREE.Line( createLineGeometry( ik ), scope.lineMaterial );
 
 			}
 

+ 34 - 34
examples/js/loaders/FBXLoader.js

@@ -37,19 +37,19 @@ THREE.FBXLoader = ( function () {
 
 		load: function ( url, onLoad, onProgress, onError ) {
 
-			var self = this;
+			var scope = this;
 
-			var path = ( self.path === '' ) ? THREE.LoaderUtils.extractUrlBase( url ) : self.path;
+			var path = ( scope.path === '' ) ? THREE.LoaderUtils.extractUrlBase( url ) : scope.path;
 
 			var loader = new THREE.FileLoader( this.manager );
-			loader.setPath( self.path );
+			loader.setPath( scope.path );
 			loader.setResponseType( 'arraybuffer' );
 
 			loader.load( url, function ( buffer ) {
 
 				try {
 
-					onLoad( self.parse( buffer, path ) );
+					onLoad( scope.parse( buffer, path ) );
 
 				} catch ( error ) {
 
@@ -57,7 +57,7 @@ THREE.FBXLoader = ( function () {
 
 						if ( onError ) onError( error );
 
-						self.manager.itemError( url );
+						scope.manager.itemError( url );
 
 					}, 0 );
 
@@ -557,7 +557,7 @@ THREE.FBXLoader = ( function () {
 
 			}
 
-			var self = this;
+			var scope = this;
 			connections.get( ID ).children.forEach( function ( child ) {
 
 				var type = child.relationship;
@@ -565,46 +565,46 @@ THREE.FBXLoader = ( function () {
 				switch ( type ) {
 
 					case 'Bump':
-						parameters.bumpMap = self.getTexture( textureMap, child.ID );
+						parameters.bumpMap = scope.getTexture( textureMap, child.ID );
 						break;
 
 					case 'Maya|TEX_ao_map':
-						parameters.aoMap = self.getTexture( textureMap, child.ID );
+						parameters.aoMap = scope.getTexture( textureMap, child.ID );
 						break;
 
 					case 'DiffuseColor':
 					case 'Maya|TEX_color_map':
-						parameters.map = self.getTexture( textureMap, child.ID );
+						parameters.map = scope.getTexture( textureMap, child.ID );
 						parameters.map.encoding = THREE.sRGBEncoding;
 						break;
 
 					case 'DisplacementColor':
-						parameters.displacementMap = self.getTexture( textureMap, child.ID );
+						parameters.displacementMap = scope.getTexture( textureMap, child.ID );
 						break;
 
 					case 'EmissiveColor':
-						parameters.emissiveMap = self.getTexture( textureMap, child.ID );
+						parameters.emissiveMap = scope.getTexture( textureMap, child.ID );
 						parameters.emissiveMap.encoding = THREE.sRGBEncoding;
 						break;
 
 					case 'NormalMap':
 					case 'Maya|TEX_normal_map':
-						parameters.normalMap = self.getTexture( textureMap, child.ID );
+						parameters.normalMap = scope.getTexture( textureMap, child.ID );
 						break;
 
 					case 'ReflectionColor':
-						parameters.envMap = self.getTexture( textureMap, child.ID );
+						parameters.envMap = scope.getTexture( textureMap, child.ID );
 						parameters.envMap.mapping = THREE.EquirectangularReflectionMapping;
 						parameters.envMap.encoding = THREE.sRGBEncoding;
 						break;
 
 					case 'SpecularColor':
-						parameters.specularMap = self.getTexture( textureMap, child.ID );
+						parameters.specularMap = scope.getTexture( textureMap, child.ID );
 						parameters.specularMap.encoding = THREE.sRGBEncoding;
 						break;
 
 					case 'TransparentColor':
-						parameters.alphaMap = self.getTexture( textureMap, child.ID );
+						parameters.alphaMap = scope.getTexture( textureMap, child.ID );
 						parameters.transparent = true;
 						break;
 
@@ -784,11 +784,11 @@ THREE.FBXLoader = ( function () {
 
 			var modelNodes = fbxTree.Objects.Model;
 
-			var self = this;
+			var scope = this;
 			modelMap.forEach( function ( model ) {
 
 				var modelNode = modelNodes[ model.ID ];
-				self.setLookAtProperties( model, modelNode );
+				scope.setLookAtProperties( model, modelNode );
 
 				var parentConnections = connections.get( model.ID ).parents;
 
@@ -1409,7 +1409,7 @@ THREE.FBXLoader = ( function () {
 
 		setupMorphMaterials: function () {
 
-			var self = this;
+			var scope = this;
 			sceneGraph.traverse( function ( child ) {
 
 				if ( child.isMesh ) {
@@ -1420,13 +1420,13 @@ THREE.FBXLoader = ( function () {
 
 							child.material.forEach( function ( material, i ) {
 
-								self.setupMorphMaterial( child, material, i );
+								scope.setupMorphMaterial( child, material, i );
 
 							} );
 
 						} else {
 
-							self.setupMorphMaterial( child, child.material );
+							scope.setupMorphMaterial( child, child.material );
 
 						}
 
@@ -1780,7 +1780,7 @@ THREE.FBXLoader = ( function () {
 			var faceWeights = [];
 			var faceWeightIndices = [];
 
-			var self = this;
+			var scope = this;
 			geoInfo.vertexIndices.forEach( function ( vertexIndex, polygonVertexIndex ) {
 
 				var endOfFace = false;
@@ -1919,7 +1919,7 @@ THREE.FBXLoader = ( function () {
 
 				if ( endOfFace ) {
 
-					self.genFace( buffers, geoInfo, facePositionIndexes, materialIndex, faceNormals, faceColors, faceUVs, faceWeights, faceWeightIndices, faceLength );
+					scope.genFace( buffers, geoInfo, facePositionIndexes, materialIndex, faceNormals, faceColors, faceUVs, faceWeights, faceWeightIndices, faceLength );
 
 					polygonIndex ++;
 					faceLength = 0;
@@ -2063,7 +2063,7 @@ THREE.FBXLoader = ( function () {
 			parentGeo.morphAttributes.position = [];
 			// parentGeo.morphAttributes.normal = []; // not implemented
 
-			var self = this;
+			var scope = this;
 			morphTargets.forEach( function ( morphTarget ) {
 
 				morphTarget.rawTargets.forEach( function ( rawTarget ) {
@@ -2072,7 +2072,7 @@ THREE.FBXLoader = ( function () {
 
 					if ( morphGeoNode !== undefined ) {
 
-						self.genMorphGeometry( parentGeo, parentGeoNode, morphGeoNode, preTransform, rawTarget.name );
+						scope.genMorphGeometry( parentGeo, parentGeoNode, morphGeoNode, preTransform, rawTarget.name );
 
 					}
 
@@ -2614,10 +2614,10 @@ THREE.FBXLoader = ( function () {
 
 			var tracks = [];
 
-			var self = this;
+			var scope = this;
 			rawClip.layer.forEach( function ( rawTracks ) {
 
-				tracks = tracks.concat( self.generateTracks( rawTracks ) );
+				tracks = tracks.concat( scope.generateTracks( rawTracks ) );
 
 			} );
 
@@ -2950,7 +2950,7 @@ THREE.FBXLoader = ( function () {
 			this.currentProp = [];
 			this.currentPropName = '';
 
-			var self = this;
+			var scope = this;
 
 			var split = text.split( /[\r\n]+/ );
 
@@ -2961,27 +2961,27 @@ THREE.FBXLoader = ( function () {
 
 				if ( matchComment || matchEmpty ) return;
 
-				var matchBeginning = line.match( '^\\t{' + self.currentIndent + '}(\\w+):(.*){', '' );
-				var matchProperty = line.match( '^\\t{' + ( self.currentIndent ) + '}(\\w+):[\\s\\t\\r\\n](.*)' );
-				var matchEnd = line.match( '^\\t{' + ( self.currentIndent - 1 ) + '}}' );
+				var matchBeginning = line.match( '^\\t{' + scope.currentIndent + '}(\\w+):(.*){', '' );
+				var matchProperty = line.match( '^\\t{' + ( scope.currentIndent ) + '}(\\w+):[\\s\\t\\r\\n](.*)' );
+				var matchEnd = line.match( '^\\t{' + ( scope.currentIndent - 1 ) + '}}' );
 
 				if ( matchBeginning ) {
 
-					self.parseNodeBegin( line, matchBeginning );
+					scope.parseNodeBegin( line, matchBeginning );
 
 				} else if ( matchProperty ) {
 
-					self.parseNodeProperty( line, matchProperty, split[ ++ i ] );
+					scope.parseNodeProperty( line, matchProperty, split[ ++ i ] );
 
 				} else if ( matchEnd ) {
 
-					self.popStack();
+					scope.popStack();
 
 				} else if ( line.match( /^[^\s\t}]/ ) ) {
 
 					// large arrays are split over multiple lines terminated with a ',' character
 					// if this is encountered the line needs to be joined to the previous line
-					self.parseNodePropertyContinued( line );
+					scope.parseNodePropertyContinued( line );
 
 				}
 

+ 4 - 4
examples/js/loaders/GCodeLoader.js

@@ -23,13 +23,13 @@ THREE.GCodeLoader.prototype = Object.assign( Object.create( THREE.Loader.prototy
 
 	load: function ( url, onLoad, onProgress, onError ) {
 
-		var self = this;
+		var scope = this;
 
-		var loader = new THREE.FileLoader( self.manager );
-		loader.setPath( self.path );
+		var loader = new THREE.FileLoader( scope.manager );
+		loader.setPath( scope.path );
 		loader.load( url, function ( text ) {
 
-			onLoad( self.parse( text ) );
+			onLoad( scope.parse( text ) );
 
 		}, onProgress, onError );
 

+ 11 - 11
examples/js/loaders/LWOLoader.js

@@ -2035,21 +2035,21 @@ THREE.LWOLoader.prototype = Object.assign( Object.create( THREE.Loader.prototype
 
 	load: function ( url, onLoad, onProgress, onError ) {
 
-		var self = this;
+		var scope = this;
 
-		var path = ( self.path === '' ) ? extractParentUrl( url, 'Objects' ) : self.path;
+		var path = ( scope.path === '' ) ? extractParentUrl( url, 'Objects' ) : scope.path;
 
 		// give the mesh a default name based on the filename
 		var modelName = url.split( path ).pop().split( '.' )[ 0 ];
 
 		var loader = new THREE.FileLoader( this.manager );
-		loader.setPath( self.path );
+		loader.setPath( scope.path );
 		loader.setResponseType( 'arraybuffer' );
 
 		loader.load( url, function ( buffer ) {
 
 			// console.time( 'Total parsing: ' );
-			onLoad( self.parse( buffer, path, modelName ) );
+			onLoad( scope.parse( buffer, path, modelName ) );
 			// console.timeEnd( 'Total parsing: ' );
 
 		}, onProgress, onError );
@@ -2105,12 +2105,12 @@ LWOTreeParser.prototype = {
 
 		var geometryParser = new GeometryParser();
 
-		var self = this;
+		var scope = this;
 		lwoTree.layers.forEach( function ( layer ) {
 
 			var geometry = geometryParser.parse( layer.geometry, layer );
 
-			var mesh = self.parseMesh( geometry, layer );
+			var mesh = scope.parseMesh( geometry, layer );
 
 			meshes[ layer.number ] = mesh;
 
@@ -2180,11 +2180,11 @@ LWOTreeParser.prototype = {
 
 		var materials = [];
 
-		var self = this;
+		var scope = this;
 
 		namesArray.forEach( function ( name, i ) {
 
-			materials[ i ] = self.getMaterialByName( name );
+			materials[ i ] = scope.getMaterialByName( name );
 
 		} );
 
@@ -2369,12 +2369,12 @@ MaterialParser.prototype = {
 		var inputNodeName = connections.inputNodeName;
 		var nodeName = connections.nodeName;
 
-		var self = this;
+		var scope = this;
 		inputName.forEach( function ( name, index ) {
 
 			if ( name === 'Material' ) {
 
-				var matNode = self.getNodeByRefName( inputNodeName[ index ], nodes );
+				var matNode = scope.getNodeByRefName( inputNodeName[ index ], nodes );
 				materialConnections.attributes = matNode.attributes;
 				materialConnections.envMap = matNode.fileName;
 				materialConnections.name = inputNodeName[ index ];
@@ -2387,7 +2387,7 @@ MaterialParser.prototype = {
 
 			if ( name === materialConnections.name ) {
 
-				materialConnections.maps[ inputName[ index ] ] = self.getNodeByRefName( inputNodeName[ index ], nodes );
+				materialConnections.maps[ inputName[ index ] ] = scope.getNodeByRefName( inputNodeName[ index ], nodes );
 
 			}
 

+ 4 - 4
examples/js/utils/TypedArrayUtils.js

@@ -184,7 +184,7 @@ THREE.TypedArrayUtils.quicksortIP = function ( arr, eleSize, orderElement ) {
 
 THREE.TypedArrayUtils.Kdtree = function ( points, metric, eleSize ) {
 
-	var self = this;
+	var scope = this;
 
 	var maxDepth = 0;
 
@@ -206,7 +206,7 @@ THREE.TypedArrayUtils.Kdtree = function ( points, metric, eleSize ) {
 		if ( plength === 0 ) return null;
 		if ( plength === 1 ) {
 
-			return new self.Node( getPointSet( points, 0 ), depth, parent, pos );
+			return new scope.Node( getPointSet( points, 0 ), depth, parent, pos );
 
 		}
 
@@ -214,7 +214,7 @@ THREE.TypedArrayUtils.Kdtree = function ( points, metric, eleSize ) {
 
 		median = Math.floor( plength / 2 );
 
-		node = new self.Node( getPointSet( points, median ), depth, parent, median + pos );
+		node = new scope.Node( getPointSet( points, median ), depth, parent, median + pos );
 		node.left = buildTree( points.subarray( 0, median * eleSize ), depth + 1, node, pos );
 		node.right = buildTree( points.subarray( ( median + 1 ) * eleSize, points.length ), depth + 1, node, pos + median + 1 );
 
@@ -370,7 +370,7 @@ THREE.TypedArrayUtils.Kdtree = function ( points, metric, eleSize ) {
 
 		}
 
-		nearestSearch( self.root );
+		nearestSearch( scope.root );
 
 		result = [];
 

+ 5 - 5
examples/jsm/animation/CCDIKSolver.js

@@ -407,7 +407,7 @@ var CCDIKSolver = ( function () {
 
 		_init: function () {
 
-			var self = this;
+			var scope = this;
 			var iks = this.iks;
 
 			function createLineGeometry( ik ) {
@@ -422,25 +422,25 @@ var CCDIKSolver = ( function () {
 
 			function createTargetMesh() {
 
-				return new Mesh( self.sphereGeometry, self.targetSphereMaterial );
+				return new Mesh( scope.sphereGeometry, scope.targetSphereMaterial );
 
 			}
 
 			function createEffectorMesh() {
 
-				return new Mesh( self.sphereGeometry, self.effectorSphereMaterial );
+				return new Mesh( scope.sphereGeometry, scope.effectorSphereMaterial );
 
 			}
 
 			function createLinkMesh() {
 
-				return new Mesh( self.sphereGeometry, self.linkSphereMaterial );
+				return new Mesh( scope.sphereGeometry, scope.linkSphereMaterial );
 
 			}
 
 			function createLine( ik ) {
 
-				return new Line( createLineGeometry( ik ), self.lineMaterial );
+				return new Line( createLineGeometry( ik ), scope.lineMaterial );
 
 			}
 

+ 4 - 4
examples/jsm/csm/CSM.js

@@ -261,16 +261,16 @@ export class CSM {
 		}
 
 		const breaksVec2 = [];
-		const self = this;
+		const scope = this;
 		const shaders = this.shaders;
 
 		material.onBeforeCompile = function ( shader ) {
 
-			const far = Math.min( self.camera.far, self.maxFar );
-			self.getExtendedBreaks( breaksVec2 );
+			const far = Math.min( scope.camera.far, scope.maxFar );
+			scope.getExtendedBreaks( breaksVec2 );
 
 			shader.uniforms.CSM_cascades = { value: breaksVec2 };
-			shader.uniforms.cameraNear = { value: self.camera.near };
+			shader.uniforms.cameraNear = { value: scope.camera.near };
 			shader.uniforms.shadowFar = { value: far };
 
 			shaders.set( material, shader );

+ 34 - 34
examples/jsm/loaders/FBXLoader.js

@@ -84,19 +84,19 @@ var FBXLoader = ( function () {
 
 		load: function ( url, onLoad, onProgress, onError ) {
 
-			var self = this;
+			var scope = this;
 
-			var path = ( self.path === '' ) ? LoaderUtils.extractUrlBase( url ) : self.path;
+			var path = ( scope.path === '' ) ? LoaderUtils.extractUrlBase( url ) : scope.path;
 
 			var loader = new FileLoader( this.manager );
-			loader.setPath( self.path );
+			loader.setPath( scope.path );
 			loader.setResponseType( 'arraybuffer' );
 
 			loader.load( url, function ( buffer ) {
 
 				try {
 
-					onLoad( self.parse( buffer, path ) );
+					onLoad( scope.parse( buffer, path ) );
 
 				} catch ( error ) {
 
@@ -104,7 +104,7 @@ var FBXLoader = ( function () {
 
 						if ( onError ) onError( error );
 
-						self.manager.itemError( url );
+						scope.manager.itemError( url );
 
 					}, 0 );
 
@@ -604,7 +604,7 @@ var FBXLoader = ( function () {
 
 			}
 
-			var self = this;
+			var scope = this;
 			connections.get( ID ).children.forEach( function ( child ) {
 
 				var type = child.relationship;
@@ -612,46 +612,46 @@ var FBXLoader = ( function () {
 				switch ( type ) {
 
 					case 'Bump':
-						parameters.bumpMap = self.getTexture( textureMap, child.ID );
+						parameters.bumpMap = scope.getTexture( textureMap, child.ID );
 						break;
 
 					case 'Maya|TEX_ao_map':
-						parameters.aoMap = self.getTexture( textureMap, child.ID );
+						parameters.aoMap = scope.getTexture( textureMap, child.ID );
 						break;
 
 					case 'DiffuseColor':
 					case 'Maya|TEX_color_map':
-						parameters.map = self.getTexture( textureMap, child.ID );
+						parameters.map = scope.getTexture( textureMap, child.ID );
 						parameters.map.encoding = sRGBEncoding;
 						break;
 
 					case 'DisplacementColor':
-						parameters.displacementMap = self.getTexture( textureMap, child.ID );
+						parameters.displacementMap = scope.getTexture( textureMap, child.ID );
 						break;
 
 					case 'EmissiveColor':
-						parameters.emissiveMap = self.getTexture( textureMap, child.ID );
+						parameters.emissiveMap = scope.getTexture( textureMap, child.ID );
 						parameters.emissiveMap.encoding = sRGBEncoding;
 						break;
 
 					case 'NormalMap':
 					case 'Maya|TEX_normal_map':
-						parameters.normalMap = self.getTexture( textureMap, child.ID );
+						parameters.normalMap = scope.getTexture( textureMap, child.ID );
 						break;
 
 					case 'ReflectionColor':
-						parameters.envMap = self.getTexture( textureMap, child.ID );
+						parameters.envMap = scope.getTexture( textureMap, child.ID );
 						parameters.envMap.mapping = EquirectangularReflectionMapping;
 						parameters.envMap.encoding = sRGBEncoding;
 						break;
 
 					case 'SpecularColor':
-						parameters.specularMap = self.getTexture( textureMap, child.ID );
+						parameters.specularMap = scope.getTexture( textureMap, child.ID );
 						parameters.specularMap.encoding = sRGBEncoding;
 						break;
 
 					case 'TransparentColor':
-						parameters.alphaMap = self.getTexture( textureMap, child.ID );
+						parameters.alphaMap = scope.getTexture( textureMap, child.ID );
 						parameters.transparent = true;
 						break;
 
@@ -831,11 +831,11 @@ var FBXLoader = ( function () {
 
 			var modelNodes = fbxTree.Objects.Model;
 
-			var self = this;
+			var scope = this;
 			modelMap.forEach( function ( model ) {
 
 				var modelNode = modelNodes[ model.ID ];
-				self.setLookAtProperties( model, modelNode );
+				scope.setLookAtProperties( model, modelNode );
 
 				var parentConnections = connections.get( model.ID ).parents;
 
@@ -1456,7 +1456,7 @@ var FBXLoader = ( function () {
 
 		setupMorphMaterials: function () {
 
-			var self = this;
+			var scope = this;
 			sceneGraph.traverse( function ( child ) {
 
 				if ( child.isMesh ) {
@@ -1467,13 +1467,13 @@ var FBXLoader = ( function () {
 
 							child.material.forEach( function ( material, i ) {
 
-								self.setupMorphMaterial( child, material, i );
+								scope.setupMorphMaterial( child, material, i );
 
 							} );
 
 						} else {
 
-							self.setupMorphMaterial( child, child.material );
+							scope.setupMorphMaterial( child, child.material );
 
 						}
 
@@ -1827,7 +1827,7 @@ var FBXLoader = ( function () {
 			var faceWeights = [];
 			var faceWeightIndices = [];
 
-			var self = this;
+			var scope = this;
 			geoInfo.vertexIndices.forEach( function ( vertexIndex, polygonVertexIndex ) {
 
 				var endOfFace = false;
@@ -1966,7 +1966,7 @@ var FBXLoader = ( function () {
 
 				if ( endOfFace ) {
 
-					self.genFace( buffers, geoInfo, facePositionIndexes, materialIndex, faceNormals, faceColors, faceUVs, faceWeights, faceWeightIndices, faceLength );
+					scope.genFace( buffers, geoInfo, facePositionIndexes, materialIndex, faceNormals, faceColors, faceUVs, faceWeights, faceWeightIndices, faceLength );
 
 					polygonIndex ++;
 					faceLength = 0;
@@ -2110,7 +2110,7 @@ var FBXLoader = ( function () {
 			parentGeo.morphAttributes.position = [];
 			// parentGeo.morphAttributes.normal = []; // not implemented
 
-			var self = this;
+			var scope = this;
 			morphTargets.forEach( function ( morphTarget ) {
 
 				morphTarget.rawTargets.forEach( function ( rawTarget ) {
@@ -2119,7 +2119,7 @@ var FBXLoader = ( function () {
 
 					if ( morphGeoNode !== undefined ) {
 
-						self.genMorphGeometry( parentGeo, parentGeoNode, morphGeoNode, preTransform, rawTarget.name );
+						scope.genMorphGeometry( parentGeo, parentGeoNode, morphGeoNode, preTransform, rawTarget.name );
 
 					}
 
@@ -2661,10 +2661,10 @@ var FBXLoader = ( function () {
 
 			var tracks = [];
 
-			var self = this;
+			var scope = this;
 			rawClip.layer.forEach( function ( rawTracks ) {
 
-				tracks = tracks.concat( self.generateTracks( rawTracks ) );
+				tracks = tracks.concat( scope.generateTracks( rawTracks ) );
 
 			} );
 
@@ -2997,7 +2997,7 @@ var FBXLoader = ( function () {
 			this.currentProp = [];
 			this.currentPropName = '';
 
-			var self = this;
+			var scope = this;
 
 			var split = text.split( /[\r\n]+/ );
 
@@ -3008,27 +3008,27 @@ var FBXLoader = ( function () {
 
 				if ( matchComment || matchEmpty ) return;
 
-				var matchBeginning = line.match( '^\\t{' + self.currentIndent + '}(\\w+):(.*){', '' );
-				var matchProperty = line.match( '^\\t{' + ( self.currentIndent ) + '}(\\w+):[\\s\\t\\r\\n](.*)' );
-				var matchEnd = line.match( '^\\t{' + ( self.currentIndent - 1 ) + '}}' );
+				var matchBeginning = line.match( '^\\t{' + scope.currentIndent + '}(\\w+):(.*){', '' );
+				var matchProperty = line.match( '^\\t{' + ( scope.currentIndent ) + '}(\\w+):[\\s\\t\\r\\n](.*)' );
+				var matchEnd = line.match( '^\\t{' + ( scope.currentIndent - 1 ) + '}}' );
 
 				if ( matchBeginning ) {
 
-					self.parseNodeBegin( line, matchBeginning );
+					scope.parseNodeBegin( line, matchBeginning );
 
 				} else if ( matchProperty ) {
 
-					self.parseNodeProperty( line, matchProperty, split[ ++ i ] );
+					scope.parseNodeProperty( line, matchProperty, split[ ++ i ] );
 
 				} else if ( matchEnd ) {
 
-					self.popStack();
+					scope.popStack();
 
 				} else if ( line.match( /^[^\s\t}]/ ) ) {
 
 					// large arrays are split over multiple lines terminated with a ',' character
 					// if this is encountered the line needs to be joined to the previous line
-					self.parseNodePropertyContinued( line );
+					scope.parseNodePropertyContinued( line );
 
 				}
 

+ 4 - 4
examples/jsm/loaders/GCodeLoader.js

@@ -34,13 +34,13 @@ GCodeLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
 
 	load: function ( url, onLoad, onProgress, onError ) {
 
-		var self = this;
+		var scope = this;
 
-		var loader = new FileLoader( self.manager );
-		loader.setPath( self.path );
+		var loader = new FileLoader( scope.manager );
+		loader.setPath( scope.path );
 		loader.load( url, function ( text ) {
 
-			onLoad( self.parse( text ) );
+			onLoad( scope.parse( text ) );
 
 		}, onProgress, onError );
 

+ 11 - 11
examples/jsm/loaders/LWOLoader.js

@@ -2064,21 +2064,21 @@ LWOLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
 
 	load: function ( url, onLoad, onProgress, onError ) {
 
-		var self = this;
+		var scope = this;
 
-		var path = ( self.path === '' ) ? extractParentUrl( url, 'Objects' ) : self.path;
+		var path = ( scope.path === '' ) ? extractParentUrl( url, 'Objects' ) : scope.path;
 
 		// give the mesh a default name based on the filename
 		var modelName = url.split( path ).pop().split( '.' )[ 0 ];
 
 		var loader = new FileLoader( this.manager );
-		loader.setPath( self.path );
+		loader.setPath( scope.path );
 		loader.setResponseType( 'arraybuffer' );
 
 		loader.load( url, function ( buffer ) {
 
 			// console.time( 'Total parsing: ' );
-			onLoad( self.parse( buffer, path, modelName ) );
+			onLoad( scope.parse( buffer, path, modelName ) );
 			// console.timeEnd( 'Total parsing: ' );
 
 		}, onProgress, onError );
@@ -2134,12 +2134,12 @@ LWOTreeParser.prototype = {
 
 		var geometryParser = new GeometryParser();
 
-		var self = this;
+		var scope = this;
 		lwoTree.layers.forEach( function ( layer ) {
 
 			var geometry = geometryParser.parse( layer.geometry, layer );
 
-			var mesh = self.parseMesh( geometry, layer );
+			var mesh = scope.parseMesh( geometry, layer );
 
 			meshes[ layer.number ] = mesh;
 
@@ -2209,11 +2209,11 @@ LWOTreeParser.prototype = {
 
 		var materials = [];
 
-		var self = this;
+		var scope = this;
 
 		namesArray.forEach( function ( name, i ) {
 
-			materials[ i ] = self.getMaterialByName( name );
+			materials[ i ] = scope.getMaterialByName( name );
 
 		} );
 
@@ -2398,12 +2398,12 @@ MaterialParser.prototype = {
 		var inputNodeName = connections.inputNodeName;
 		var nodeName = connections.nodeName;
 
-		var self = this;
+		var scope = this;
 		inputName.forEach( function ( name, index ) {
 
 			if ( name === 'Material' ) {
 
-				var matNode = self.getNodeByRefName( inputNodeName[ index ], nodes );
+				var matNode = scope.getNodeByRefName( inputNodeName[ index ], nodes );
 				materialConnections.attributes = matNode.attributes;
 				materialConnections.envMap = matNode.fileName;
 				materialConnections.name = inputNodeName[ index ];
@@ -2416,7 +2416,7 @@ MaterialParser.prototype = {
 
 			if ( name === materialConnections.name ) {
 
-				materialConnections.maps[ inputName[ index ] ] = self.getNodeByRefName( inputNodeName[ index ], nodes );
+				materialConnections.maps[ inputName[ index ] ] = scope.getNodeByRefName( inputNodeName[ index ], nodes );
 
 			}
 

+ 2 - 2
examples/jsm/nodes/materials/NodeMaterial.js

@@ -19,7 +19,7 @@ function NodeMaterial( vertex, fragment ) {
 
 	ShaderMaterial.call( this );
 
-	var self = this;
+	var scope = this;
 
 	this.vertex = vertex || new RawNode( new PositionNode( PositionNode.PROJECTION ) );
 	this.fragment = fragment || new RawNode( new ColorNode( 0xFF0000 ) );
@@ -48,7 +48,7 @@ function NodeMaterial( vertex, fragment ) {
 
 	this.onBeforeCompile.toString = function () {
 
-		return self.needsCompile;
+		return scope.needsCompile;
 
 	};
 

+ 4 - 4
examples/jsm/utils/TypedArrayUtils.js

@@ -184,7 +184,7 @@ TypedArrayUtils.quicksortIP = function ( arr, eleSize, orderElement ) {
 
 TypedArrayUtils.Kdtree = function ( points, metric, eleSize ) {
 
-	var self = this;
+	var scope = this;
 
 	var maxDepth = 0;
 
@@ -206,7 +206,7 @@ TypedArrayUtils.Kdtree = function ( points, metric, eleSize ) {
 		if ( plength === 0 ) return null;
 		if ( plength === 1 ) {
 
-			return new self.Node( getPointSet( points, 0 ), depth, parent, pos );
+			return new scope.Node( getPointSet( points, 0 ), depth, parent, pos );
 
 		}
 
@@ -214,7 +214,7 @@ TypedArrayUtils.Kdtree = function ( points, metric, eleSize ) {
 
 		median = Math.floor( plength / 2 );
 
-		node = new self.Node( getPointSet( points, median ), depth, parent, median + pos );
+		node = new scope.Node( getPointSet( points, median ), depth, parent, median + pos );
 		node.left = buildTree( points.subarray( 0, median * eleSize ), depth + 1, node, pos );
 		node.right = buildTree( points.subarray( ( median + 1 ) * eleSize, points.length ), depth + 1, node, pos + median + 1 );
 
@@ -370,7 +370,7 @@ TypedArrayUtils.Kdtree = function ( points, metric, eleSize ) {
 
 		}
 
-		nearestSearch( self.root );
+		nearestSearch( scope.root );
 
 		result = [];