From b1dd816f7c25b84c7bf2a31de50fd83b809084eb Mon Sep 17 00:00:00 2001 From: Mugen87 Date: Sun, 3 Jun 2018 16:51:40 +0200 Subject: [PATCH] GLTFLoader: Clean up --- examples/js/loaders/GLTFLoader.js | 46 +++++++++++++++---------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/examples/js/loaders/GLTFLoader.js b/examples/js/loaders/GLTFLoader.js index 0d5516c42110f8..b0353d1954ab62 100644 --- a/examples/js/loaders/GLTFLoader.js +++ b/examples/js/loaders/GLTFLoader.js @@ -246,9 +246,9 @@ THREE.GLTFLoader = ( function () { /** * DDS Texture Extension * - * Specification: + * Specification: * https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Vendor/MSFT_texture_dds - * + * */ function GLTFTextureDDSExtension() { @@ -455,7 +455,7 @@ THREE.GLTFLoader = ( function () { * * Specification: https://github.com/KhronosGroup/glTF/pull/874 */ - function GLTFDracoMeshCompressionExtension ( json, dracoLoader ) { + function GLTFDracoMeshCompressionExtension( json, dracoLoader ) { if ( ! dracoLoader ) { @@ -481,7 +481,7 @@ THREE.GLTFLoader = ( function () { for ( var attributeName in gltfAttributeMap ) { - if ( !( attributeName in ATTRIBUTES ) ) continue; + if ( ! ( attributeName in ATTRIBUTES ) ) continue; threeAttributeMap[ ATTRIBUTES[ attributeName ] ] = gltfAttributeMap[ attributeName ]; @@ -494,7 +494,7 @@ THREE.GLTFLoader = ( function () { var accessorDef = json.accessors[ primitive.attributes[ attributeName ] ]; var componentType = WEBGL_COMPONENT_TYPES[ accessorDef.componentType ]; - attributeTypeMap[ ATTRIBUTES[ attributeName ] ] = componentType; + attributeTypeMap[ ATTRIBUTES[ attributeName ] ] = componentType; attributeNormalizedMap[ ATTRIBUTES[ attributeName ] ] = accessorDef.normalized === true; } @@ -934,7 +934,7 @@ THREE.GLTFLoader = ( function () { THREE.Interpolant.call( this, parameterPositions, sampleValues, sampleSize, resultBuffer ); - }; + } GLTFCubicSplineInterpolant.prototype = Object.create( THREE.Interpolant.prototype ); GLTFCubicSplineInterpolant.prototype.constructor = GLTFCubicSplineInterpolant; @@ -966,10 +966,10 @@ THREE.GLTFLoader = ( function () { // [ inTangent_1, splineVertex_1, outTangent_1, inTangent_2, splineVertex_2, ... ] for ( var i = 0; i !== stride; i ++ ) { - var p0 = values[ offset0 + i + stride ]; // splineVertex_k - var m0 = values[ offset0 + i + stride2 ] * td; // outTangent_k * (t_k+1 - t_k) - var p1 = values[ offset1 + i + stride ]; // splineVertex_k+1 - var m1 = values[ offset1 + i ] * td; // inTangent_k+1 * (t_k+1 - t_k) + var p0 = values[ offset0 + i + stride ]; // splineVertex_k + var m0 = values[ offset0 + i + stride2 ] * td; // outTangent_k * (t_k+1 - t_k) + var p1 = values[ offset1 + i + stride ]; // splineVertex_k+1 + var m1 = values[ offset1 + i ] * td; // inTangent_k+1 * (t_k+1 - t_k) result[ i ] = s0 * p0 + s1 * m0 + s2 * p1 + s3 * m1; @@ -1123,7 +1123,7 @@ THREE.GLTFLoader = ( function () { WEIGHT: 'skinWeight', // deprecated JOINTS_0: 'skinIndex', JOINT: 'skinIndex' // deprecated - } + }; var PATH_PROPERTIES = { scale: 'scale', @@ -1214,7 +1214,7 @@ THREE.GLTFLoader = ( function () { /** * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#morph-targets * - * @param {THREE.Geometry} geometry + * @param {THREE.BufferGeometry} geometry * @param {Array} targets * @param {Array} accessors */ @@ -1533,7 +1533,7 @@ THREE.GLTFLoader = ( function () { // BufferGeometry caching this.primitiveCache = []; this.multiplePrimitivesCache = []; - this.multiPassGeometryCache = [] + this.multiPassGeometryCache = []; this.textureLoader = new THREE.TextureLoader( this.options.manager ); this.textureLoader.setCrossOrigin( this.options.crossOrigin ); @@ -2178,7 +2178,7 @@ THREE.GLTFLoader = ( function () { } - if ( materialDef.normalTexture !== undefined && materialType !== THREE.MeshBasicMaterial) { + if ( materialDef.normalTexture !== undefined && materialType !== THREE.MeshBasicMaterial ) { pending.push( parser.assignTexture( materialParams, 'normalMap', materialDef.normalTexture.index ) ); @@ -2192,7 +2192,7 @@ THREE.GLTFLoader = ( function () { } - if ( materialDef.occlusionTexture !== undefined && materialType !== THREE.MeshBasicMaterial) { + if ( materialDef.occlusionTexture !== undefined && materialType !== THREE.MeshBasicMaterial ) { pending.push( parser.assignTexture( materialParams, 'aoMap', materialDef.occlusionTexture.index ) ); @@ -2204,13 +2204,13 @@ THREE.GLTFLoader = ( function () { } - if ( materialDef.emissiveFactor !== undefined && materialType !== THREE.MeshBasicMaterial) { + if ( materialDef.emissiveFactor !== undefined && materialType !== THREE.MeshBasicMaterial ) { materialParams.emissive = new THREE.Color().fromArray( materialDef.emissiveFactor ); } - if ( materialDef.emissiveTexture !== undefined && materialType !== THREE.MeshBasicMaterial) { + if ( materialDef.emissiveTexture !== undefined && materialType !== THREE.MeshBasicMaterial ) { pending.push( parser.assignTexture( materialParams, 'emissiveMap', materialDef.emissiveTexture.index ) ); @@ -2270,7 +2270,7 @@ THREE.GLTFLoader = ( function () { var bufferAttribute = accessors[ attributes[ gltfAttributeName ] ]; // Skip attributes already provided by e.g. Draco extension. - if ( !threeAttributeName ) continue; + if ( ! threeAttributeName ) continue; if ( threeAttributeName in geometry.attributes ) continue; geometry.addAttribute( threeAttributeName, bufferAttribute ); @@ -2508,7 +2508,7 @@ THREE.GLTFLoader = ( function () { var mesh; - var material = isMultiMaterial ? originalMaterials : originalMaterials[ i ] + var material = isMultiMaterial ? originalMaterials : originalMaterials[ i ]; if ( primitive.mode === WEBGL_CONSTANTS.TRIANGLES || primitive.mode === WEBGL_CONSTANTS.TRIANGLE_STRIP || @@ -2592,7 +2592,7 @@ THREE.GLTFLoader = ( function () { THREE.Material.prototype.copy.call( pointsMaterial, material ); pointsMaterial.color.copy( material.color ); pointsMaterial.map = material.map; - pointsMaterial.lights = false; // PointsMaterial doesn't support lights yet + pointsMaterial.lights = false; // PointsMaterial doesn't support lights yet scope.cache.add( cacheKey, pointsMaterial ); @@ -2611,7 +2611,7 @@ THREE.GLTFLoader = ( function () { lineMaterial = new THREE.LineBasicMaterial(); THREE.Material.prototype.copy.call( lineMaterial, material ); lineMaterial.color.copy( material.color ); - lineMaterial.lights = false; // LineBasicMaterial doesn't support lights yet + lineMaterial.lights = false; // LineBasicMaterial doesn't support lights yet scope.cache.add( cacheKey, lineMaterial ); @@ -2638,8 +2638,8 @@ THREE.GLTFLoader = ( function () { if ( ! cachedMaterial ) { cachedMaterial = material.isGLTFSpecularGlossinessMaterial - ? extensions[ EXTENSIONS.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS ].cloneMaterial( material ) - : material.clone(); + ? extensions[ EXTENSIONS.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS ].cloneMaterial( material ) + : material.clone(); if ( useSkinning ) cachedMaterial.skinning = true; if ( useVertexColors ) cachedMaterial.vertexColors = THREE.VertexColors;