{"version":3,"sources":["webpack:///./src/js/utils/orbitControls.js","webpack:///./src/js/data/config.js","webpack:///./src/js/utils/detector.js","webpack:///./src/js/app/components/renderer.js","webpack:///./src/js/app/components/camera.js","webpack:///./src/js/app/components/light.js","webpack:///./src/js/app/components/controls.js","webpack:///./src/js/app/components/material.js","webpack:///./src/js/app/helpers/stats.js","webpack:///./src/js/app/components/geometry.js","webpack:///./src/js/app/helpers/vertexNormalsHelper.js","webpack:///./src/js/app/helpers/meshHelper.js","webpack:///./src/js/utils/helpers.js","webpack:///./src/js/app/model/texture.js","webpack:///./src/js/utils/bufferGeometryUtils.js","webpack:///./src/js/app/loaders/GLTFLoader.js","webpack:///./src/js/app/model/model.js","webpack:///./src/js/utils/keyboard.js","webpack:///./src/js/app/managers/interaction.js","webpack:///./src/js/app/managers/datGUI.js","webpack:///./src/js/app/main.js","webpack:///./src/js/app.js"],"names":["module","exports","THREE","MOUSE","OrbitConstraint","object","this","target","Vector3","minDistance","maxDistance","Infinity","minZoom","maxZoom","minPolarAngle","maxPolarAngle","Math","PI","minAzimuthAngle","maxAzimuthAngle","enableDamping","dampingFactor","theta","phi","v","offset","quat","quatInverse","lastPosition","lastQuaternion","scope","EPS","phiDelta","thetaDelta","scale","panOffset","zoomChanged","getPolarAngle","getAzimuthalAngle","rotateLeft","angle","rotateUp","panLeft","distance","te","matrix","elements","set","multiplyScalar","add","panUp","pan","deltaX","deltaY","screenWidth","screenHeight","PerspectiveCamera","targetDistance","position","clone","sub","length","tan","fov","OrthographicCamera","right","left","top","bottom","console","warn","dollyIn","dollyScale","zoom","max","min","updateProjectionMatrix","dollyOut","update","Quaternion","setFromUnitVectors","up","inverse","copy","applyQuaternion","atan2","x","z","sqrt","y","radius","sin","cos","lookAt","distanceToSquared","dot","quaternion","OrbitControls","domElement","constraint","undefined","document","Object","defineProperty","get","enabled","center","enableZoom","zoomSpeed","enableRotate","rotateSpeed","enablePan","keyPanSpeed","autoRotate","autoRotateSpeed","enableKeys","keys","LEFT","UP","RIGHT","BOTTOM","mouseButtons","ORBIT","ZOOM","MIDDLE","PAN","rotateStart","Vector2","rotateEnd","rotateDelta","panStart","panEnd","panDelta","dollyStart","dollyEnd","dollyDelta","STATE","state","target0","position0","zoom0","changeEvent","type","startEvent","endEvent","element","body","clientWidth","clientHeight","getZoomScale","pow","onMouseDown","event","preventDefault","button","clientX","clientY","addEventListener","onMouseMove","onMouseUp","dispatchEvent","subVectors","removeEventListener","onMouseWheel","stopPropagation","delta","wheelDelta","detail","onKeyDown","keyCode","touchstart","touches","pageX","pageY","dx","dy","touchmove","touchend","contextmenu","reset","dispose","window","prototype","create","EventDispatcher","constructor","defineProperties","value","noZoom","noRotate","noPan","noKeys","staticMoving","dynamicDampingFactor","isDev","isShowingStats","isLoaded","isTweening","isRotating","isMouseMoving","isMouseOver","maxAnisotropy","dpr","easing","TWEEN","Easing","Quadratic","InOut","duration","model","selected","initialTypes","models","path","texture","imageFiles","name","image","mesh","enableHelper","wireframe","translucent","material","color","emissive","fog","near","camera","far","aspect","posX","posY","posZ","controls","ambientLight","directionalLight","intensity","shadow","helperEnabled","bias","mapWidth","mapHeight","pointLight","hemiLight","groundColor","canvas","CanvasRenderingContext2D","webgl","createElement","WebGLRenderingContext","getContext","e","workers","Worker","fileapi","File","FileReader","FileList","Blob","getWebGLErrorMessage","id","style","fontFamily","fontSize","fontWeight","textAlign","background","padding","width","margin","innerHTML","join","addGetWebGLMessage","parameters","parent","appendChild","Renderer","scene","container","threeRenderer","antialias","setClearColor","setPixelRatio","devicePixelRatio","shadowMap","Config","capabilities","getMaxAnisotropy","updateSize","setSize","offsetWidth","offsetHeight","render","Camera","renderer","height","threeCamera","Light","init","visible","castShadow","mapSize","directionalLightHelper","lightName","Controls","orbitControls","threeControls","Material","basic","side","standard","shading","roughness","metalness","wire","rS","bS","glS","tS","Geometry","geo","widthSegments","heightSegments","rotation","receiveShadow","Stats","start","tick","frame","end","BrowserStats","glStats","threeStats","rStats","CSSPath","userTimingAPI","values","caption","over","average","avgMs","fps","below","calls","raf","rstats","groups","fractions","base","steps","plugins","_v1","_v2","_normalMatrix","Matrix3","_keys","VertexNormalsHelper","size","hex","nNormals","objGeometry","geometry","isGeometry","faces","isBufferGeometry","attributes","normal","count","BufferGeometry","positions","Float32BufferAttribute","setAttribute","LineSegments","call","LineBasicMaterial","toneMapped","matrixAutoUpdate","idx","updateMatrixWorld","getNormalMatrix","matrixWorld","vertices","i","l","face","j","jl","vertexNormals","vertex","applyMatrix4","applyMatrix3","normalize","setXYZ","objPos","objNorm","getX","getY","getZ","needsUpdate","MeshHelper","wireLine","depthTest","opacity","transparent","edges","edgesLine","vertexHelper","boxHelper","remove","Helpers","fn","threshhold","last","deferTimer","context","now","Date","args","arguments","clearTimeout","setTimeout","apply","xhr","lengthComputable","percentComplete","loaded","total","log","round","error","replace","setHex","vertexColors","verticesNeedUpdate","normalsNeedUpdate","colorsNeedUpdate","materialKey","textures","key","Texture","loader","promiseArray","setPath","forEach","imageFile","push","Promise","resolve","reject","load","anisotropy","modelOBJ","logProgress","Error","all","then","reason","BufferGeometryUtils","index","uv","indices","array","normals","uvs","nVertices","tangent","BufferAttribute","Float32Array","tangents","tan1","tan2","vA","vB","vC","uvA","uvB","uvC","sdir","tdir","il","group","handleTriangle","w","t","test","tmp","tmp2","n","n2","handleVertex","a","b","c","fromArray","r","isFinite","addScaledVector","crossVectors","GLTFLoader","manager","Loader","dracoLoader","ddsLoader","GLTFRegistry","objects","removeAll","assign","url","onLoad","onProgress","onError","resourcePath","LoaderUtils","extractUrlBase","itemStart","_onError","itemError","itemEnd","FileLoader","setResponseType","crossOrigin","setWithCredentials","data","parse","gltf","setDRACOLoader","setDDSLoader","content","extensions","decodeText","Uint8Array","BINARY_EXTENSION_HEADER_MAGIC","EXTENSIONS","KHR_BINARY_GLTF","GLTFBinaryExtension","json","JSON","asset","version","extensionsUsed","extensionName","extensionsRequired","KHR_LIGHTS_PUNCTUAL","GLTFLightsExtension","KHR_MATERIALS_CLEARCOAT","GLTFMaterialsClearcoatExtension","KHR_MATERIALS_UNLIT","GLTFMaterialsUnlitExtension","KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS","GLTFMaterialsPbrSpecularGlossinessExtension","KHR_DRACO_MESH_COMPRESSION","GLTFDracoMeshCompressionExtension","MSFT_TEXTURE_DDS","GLTFTextureDDSExtension","KHR_TEXTURE_TRANSFORM","GLTFTextureTransformExtension","KHR_MESH_QUANTIZATION","GLTFMeshQuantizationExtension","indexOf","GLTFParser","extension","lightDefs","lights","loadLight","lightIndex","lightNode","lightDef","Color","range","DirectionalLight","PointLight","SpotLight","spot","innerConeAngle","outerConeAngle","penumbra","decay","getMaterialType","MeshBasicMaterial","extendParams","materialParams","materialDef","parser","pending","metallicRoughness","pbrMetallicRoughness","Array","isArray","baseColorFactor","baseColorTexture","assignTexture","MeshPhysicalMaterial","clearcoatFactor","clearcoat","clearcoatTexture","clearcoatRoughnessFactor","clearcoatRoughness","clearcoatRoughnessTexture","clearcoatNormalTexture","clearcoatNormalScale","BINARY_EXTENSION_CHUNK_TYPES","headerView","DataView","header","magic","slice","getUint32","chunkView","chunkIndex","byteLength","chunkLength","chunkType","contentArray","byteOffset","preload","GLTFMeshStandardSGMaterial","params","MeshStandardMaterial","isGLTFSpecularGlossinessMaterial","specularMapParsFragmentChunk","glossinessMapParsFragmentChunk","specularMapFragmentChunk","glossinessMapFragmentChunk","lightPhysicalFragmentChunk","uniforms","specular","glossiness","specularMap","glossinessMap","_extraUniforms","onBeforeCompile","shader","uniformName","fragmentShader","defines","USE_GLOSSINESSMAP","USE_ROUGHNESSMAP","metalnessMap","roughnessMap","setValues","specularGlossinessParams","pbrSpecularGlossiness","diffuseFactor","diffuseTexture","glossinessFactor","specularFactor","specularGlossinessTexture","specGlossMapDef","createMaterial","map","lightMap","lightMapIntensity","aoMap","aoMapIntensity","emissiveIntensity","emissiveMap","bumpMap","bumpScale","normalMap","normalMapType","TangentSpaceNormalMap","normalScale","displacementMap","displacementScale","displacementBias","alphaMap","envMap","envMapIntensity","refractionRatio","GLTFCubicSplineInterpolant","parameterPositions","sampleValues","sampleSize","resultBuffer","Interpolant","decodePrimitive","primitive","bufferViewIndex","bufferView","gltfAttributeMap","threeAttributeMap","attributeNormalizedMap","attributeTypeMap","attributeName","threeAttributeName","ATTRIBUTES","toLowerCase","accessorDef","accessors","componentType","WEBGL_COMPONENT_TYPES","normalized","getDependency","decodeDracoFile","attribute","extendTexture","transform","repeat","texCoord","source","copySampleValue_","result","valueSize","beforeStart_","afterEnd_","interpolate_","i1","t0","t1","stride","stride2","stride3","td","p","pp","ppp","offset1","offset0","s2","s3","s0","s1","p0","m0","p1","m1","WEBGL_CONSTANTS","5120","Int8Array","5121","5122","Int16Array","5123","Uint16Array","5125","Uint32Array","5126","WEBGL_FILTERS","9728","NearestFilter","9729","LinearFilter","9984","NearestMipmapNearestFilter","9985","LinearMipmapNearestFilter","9986","NearestMipmapLinearFilter","9987","LinearMipmapLinearFilter","WEBGL_WRAPPINGS","33071","ClampToEdgeWrapping","33648","MirroredRepeatWrapping","10497","RepeatWrapping","WEBGL_TYPE_SIZES","SCALAR","VEC2","VEC3","VEC4","MAT2","MAT3","MAT4","POSITION","NORMAL","TANGENT","TEXCOORD_0","TEXCOORD_1","COLOR_0","WEIGHTS_0","JOINTS_0","PATH_PROPERTIES","translation","weights","INTERPOLATION","CUBICSPLINE","LINEAR","InterpolateLinear","STEP","InterpolateDiscrete","ALPHA_MODES","MIME_TYPE_FORMATS","RGBAFormat","RGBFormat","resolveURL","addUnknownExtensionsToUserData","knownExtensions","objectDef","userData","gltfExtensions","assignExtrasToUserData","gltfDef","extras","updateMorphTargets","meshDef","morphTargetInfluences","targetNames","morphTargetDictionary","createAttributesKey","attributesKey","sort","options","cache","primitiveCache","textureLoader","TextureLoader","setCrossOrigin","fileLoader","addPrimitiveAttributes","primitiveDef","assignAttributeAccessor","accessorIndex","accessor","gltfAttributeName","setIndex","box","Box3","targets","maxDisplacement","vector","setX","abs","setY","setZ","expandByVector","boundingBox","sphere","Sphere","getCenter","distanceTo","boundingSphere","computeBounds","hasMorphPosition","hasMorphNormal","pendingPositionAccessors","pendingNormalAccessors","pendingAccessor","morphPositions","morphNormals","morphAttributes","morphTargetsRelative","addMorphTargets","toTrianglesDrawMode","drawMode","getIndex","getAttribute","numberOfTriangles","newIndices","TriangleFanDrawMode","newGeometry","markDefs","getDependencies","dependencies","scenes","animations","cameras","nodeDefs","nodes","skinDefs","skins","meshDefs","meshes","meshReferences","meshUses","skinIndex","skinLength","joints","isBone","nodeIndex","nodeLength","nodeDef","skin","isSkinnedMesh","cacheKey","dependency","loadScene","loadNode","loadMesh","loadAccessor","loadBufferView","loadBuffer","loadMaterial","loadTexture","loadSkin","loadAnimation","loadCamera","defs","def","bufferIndex","bufferDef","buffers","uri","bufferViewDef","bufferViews","buffer","sparse","pendingBufferViews","bufferAttribute","itemSize","TypedArray","elementBytes","BYTES_PER_ELEMENT","itemBytes","byteStride","ibSlice","floor","ibCacheKey","ib","InterleavedBuffer","InterleavedBufferAttribute","itemSizeIndices","TypedArrayIndices","byteOffsetIndices","byteOffsetValues","sparseIndices","sparseValues","setW","textureIndex","URL","self","webkitURL","textureDef","textureExtensions","sourceURI","images","isObjectURL","blob","mimeType","createObjectURL","getHandler","revokeObjectURL","flipY","format","sampler","samplers","magFilter","minFilter","wrapS","wrapT","mapName","mapDef","isCompressedTexture","assignFinalMaterial","useVertexTangents","useVertexColors","useFlatShading","useSkinning","useMorphTargets","useMorphNormals","isPoints","uuid","pointsMaterial","PointsMaterial","sizeAttenuation","isLine","lineMaterial","cachedMaterial","skinning","vertexTangents","flatShading","morphTargets","uv2","materialIndex","materialType","materials","materialExtensions","sgExtension","kmuExtension","metallicFactor","roughnessFactor","metallicRoughnessTexture","doubleSided","DoubleSide","alphaMode","depthWrite","alphaTest","alphaCutoff","normalTexture","occlusionTexture","strength","emissiveFactor","emissiveTexture","clearcoatExtension","encoding","sRGBEncoding","loadGeometries","primitives","createDracoPrimitive","dracoExtension","geometryPromise","mode","cached","promise","meshIndex","FrontSide","results","geometries","SkinnedMesh","Mesh","skinWeight","normalizeSkinWeights","TriangleStripDrawMode","Line","LineLoop","Points","Group","cameraIndex","cameraDef","MathUtils","radToDeg","yfov","aspectRatio","znear","zfar","xmag","ymag","skinDef","skinEntry","inverseBindMatrices","animationIndex","animationDef","pendingNodes","pendingInputAccessors","pendingOutputAccessors","pendingSamplers","pendingTargets","channels","channel","node","input","output","inputAccessors","outputAccessors","tracks","inputAccessor","outputAccessor","TypedKeyframeTrack","updateMatrix","NumberKeyframeTrack","QuaternionKeyframeTrack","VectorKeyframeTrack","targetName","interpolation","traverse","isMesh","outputArray","scaled","track","createInterpolant","times","getValueSize","isInterpolantFactoryMethodGLTFCubicSpline","AnimationClip","instanceNum","o","light","Bone","Object3D","PropertyBinding","sanitizeNodeName","Matrix4","buildNodeHierachy","nodeId","parentObject","pendingJoints","jointNodes","bones","boneInverses","jointNode","mat","bind","Skeleton","children","child","sceneIndex","sceneDef","nodeIds","Model","obj","ref","isLight","logError","UV","ALIAS","Keyboard","keyCodes","onKeyChange","onBlur","prop","keyDesc","split","pressed","toUpperCase","charCodeAt","aliases","aliasKeys","shiftKey","ctrlKey","altKey","metaKey","Interaction","timeout","keyboard","throttle","onMouseLeave","onMouseOver","eventMatches","DatGUI","main","gui","dat","GUI","meshHelper","cameraFolder","addFolder","cameraFOVGui","onChange","onFinishChange","cameraAspectGui","addColor","cameraFogNearGui","density","controlsFolder","controlsAutoRotateSpeedGui","disable","unload","meshFolder","enable","ambientLightFolder","directionalLightFolder","directionalLightIntensityGui","directionalLightPositionXGui","directionalLightPositionYGui","directionalLightPositionZGui","shadowFolder","shadowNearGui","shadowFarGui","shadowTopGui","shadowRightGui","shadowBottomGui","shadowLeftGui","shadowBiasGui","pointLightFolder","pointLightIntensityGui","pointLightDistanceGui","pointLightPositionXGui","pointLightPositionYGui","pointLightPositionZGui","hemiLightFolder","hemiLightIntensityGui","hemiLightPositionXGui","hemiLightPositionYGui","hemiLightPositionZGui","destroy","Main","clock","place","make","stats","setUp","item","querySelector","display","requestAnimationFrame","Detector","getElementById"],"mappings":"2EAAAA,EAAOC,QAAU,SAAUC,GACzB,IAAIC,EAAQD,EAAMC,MAYlB,SAASC,EAAgBC,GACvBC,KAAKD,OAASA,EAIdC,KAAKC,OAAS,IAAIL,EAAMM,QAGxBF,KAAKG,YAAc,EACnBH,KAAKI,YAAcC,IAGnBL,KAAKM,QAAU,EACfN,KAAKO,QAAUF,IAIfL,KAAKQ,cAAgB,EACrBR,KAAKS,cAAgBC,KAAKC,GAI1BX,KAAKY,iBAAmBP,IACxBL,KAAKa,gBAAkBR,IAIvBL,KAAKc,eAAgB,EACrBd,KAAKe,cAAgB,IAKrB,IAKIC,EACAC,EA6BEC,EA0FAC,EAGAC,EACAC,EAEAC,EACAC,EApIFC,EAAQxB,KAERyB,EAAM,KAONC,EAAW,EACXC,EAAa,EACbC,EAAQ,EACRC,EAAY,IAAIjC,EAAMM,QACtB4B,GAAc,EAIlB9B,KAAK+B,cAAgB,WACnB,OAAOd,GAGTjB,KAAKgC,kBAAoB,WACvB,OAAOhB,GAGThB,KAAKiC,WAAa,SAAUC,GAC1BP,GAAcO,GAGhBlC,KAAKmC,SAAW,SAAUD,GACxBR,GAAYQ,GAIdlC,KAAKoC,SACClB,EAAI,IAAItB,EAAMM,QAEX,SAAiBmC,GACtB,IAAIC,EAAKtC,KAAKD,OAAOwC,OAAOC,SAG5BtB,EAAEuB,IAAIH,EAAG,GAAIA,EAAG,GAAIA,EAAG,IACvBpB,EAAEwB,gBAAgBL,GAElBR,EAAUc,IAAIzB,KAKlBlB,KAAK4C,MAAS,WACZ,IAAI1B,EAAI,IAAItB,EAAMM,QAElB,OAAO,SAAemC,GACpB,IAAIC,EAAKtC,KAAKD,OAAOwC,OAAOC,SAG5BtB,EAAEuB,IAAIH,EAAG,GAAIA,EAAG,GAAIA,EAAG,IACvBpB,EAAEwB,eAAeL,GAEjBR,EA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DAKFP,EAAO3F,OAAS2F,EAAO1F,gBACxBkI,EAAMC,QAIRhU,KAAKgS,SAASF,OAAO9R,KAAK+Q,MAAO/Q,KAAK6N,OAAOqE,aAG1CX,EAAO3F,OAAS2F,EAAO1F,gBACxBkI,EAAMI,MAOR7H,IAAM9H,SACNxE,KAAKmO,SAASyE,cAAcpO,SAG5B+jC,sBAAsBvoC,KAAK8R,OAAO4wB,KAAK1iC,Y,wCCzH3C,WAEE,GAAIwoC,EAASv5B,MAEN,CACL,IAAM+B,EAAYjL,SAAS0iC,eAAe,gBAC1C,IAAIX,GAAK92B,QAHTw3B,EAAS93B,sBAOb0B,K","file":"0.app.js","sourcesContent":["module.exports = function (THREE) {\n var MOUSE = THREE.MOUSE;\n if (!MOUSE) MOUSE = { LEFT: 0, MIDDLE: 1, RIGHT: 2 };\n\n /**\n * @author qiao / https://github.com/qiao\n * @author mrdoob / http://mrdoob.com\n * @author alteredq / http://alteredqualia.com/\n * @author WestLangley / http://github.com/WestLangley\n * @author erich666 / http://erichaines.com\n */\n /*global THREE, console */\n\n function OrbitConstraint(object) {\n this.object = object;\n\n // \"target\" sets the location of focus, where the object orbits around\n // and where it pans with respect to.\n this.target = new THREE.Vector3();\n\n // Limits to how far you can dolly in and out ( PerspectiveCamera only )\n this.minDistance = 0;\n this.maxDistance = Infinity;\n\n // Limits to how far you can zoom in and out ( OrthographicCamera only )\n this.minZoom = 0;\n this.maxZoom = Infinity;\n\n // How far you can orbit vertically, upper and lower limits.\n // Range is 0 to Math.PI radians.\n this.minPolarAngle = 0; // radians\n this.maxPolarAngle = Math.PI; // radians\n\n // How far you can orbit horizontally, upper and lower limits.\n // If set, must be a sub-interval of the interval [ - Math.PI, Math.PI ].\n this.minAzimuthAngle = -Infinity; // radians\n this.maxAzimuthAngle = Infinity; // radians\n\n // Set to true to enable damping (inertia)\n // If damping is enabled, you must call controls.update() in your animation loop\n this.enableDamping = false;\n this.dampingFactor = 0.25;\n\n ////////////\n // internals\n\n var scope = this;\n\n var EPS = 0.000001;\n\n // Current position in spherical coordinate system.\n var theta;\n var phi;\n\n // Pending changes\n var phiDelta = 0;\n var thetaDelta = 0;\n var scale = 1;\n var panOffset = new THREE.Vector3();\n var zoomChanged = false;\n\n // API\n\n this.getPolarAngle = function () {\n return phi;\n };\n\n this.getAzimuthalAngle = function () {\n return theta;\n };\n\n this.rotateLeft = function (angle) {\n thetaDelta -= angle;\n };\n\n this.rotateUp = function (angle) {\n phiDelta -= angle;\n };\n\n // pass in distance in world space to move left\n this.panLeft = (function () {\n var v = new THREE.Vector3();\n\n return function panLeft(distance) {\n var te = this.object.matrix.elements;\n\n // get X column of matrix\n v.set(te[0], te[1], te[2]);\n v.multiplyScalar(-distance);\n\n panOffset.add(v);\n };\n })();\n\n // pass in distance in world space to move up\n this.panUp = (function () {\n var v = new THREE.Vector3();\n\n return function panUp(distance) {\n var te = this.object.matrix.elements;\n\n // get Y column of matrix\n v.set(te[4], te[5], te[6]);\n v.multiplyScalar(distance);\n\n panOffset.add(v);\n };\n })();\n\n // pass in x,y of change desired in pixel space,\n // right and down are positive\n this.pan = function (deltaX, deltaY, screenWidth, screenHeight) {\n if (scope.object instanceof THREE.PerspectiveCamera) {\n // perspective\n var position = scope.object.position;\n var offset = position.clone().sub(scope.target);\n var targetDistance = offset.length();\n\n // half of the fov is center to top of screen\n targetDistance *= Math.tan(((scope.object.fov / 2) * Math.PI) / 180.0);\n\n // we actually don't use screenWidth, since perspective camera is fixed to screen height\n scope.panLeft((2 * deltaX * targetDistance) / screenHeight);\n scope.panUp((2 * deltaY * targetDistance) / screenHeight);\n } else if (scope.object instanceof THREE.OrthographicCamera) {\n // orthographic\n scope.panLeft((deltaX * (scope.object.right - scope.object.left)) / screenWidth);\n scope.panUp((deltaY * (scope.object.top - scope.object.bottom)) / screenHeight);\n } else {\n // camera neither orthographic or perspective\n console.warn(\n 'WARNING: OrbitControls.js encountered an unknown camera type - pan disabled.'\n );\n }\n };\n\n this.dollyIn = function (dollyScale) {\n if (scope.object instanceof THREE.PerspectiveCamera) {\n scale /= dollyScale;\n } else if (scope.object instanceof THREE.OrthographicCamera) {\n scope.object.zoom = Math.max(\n this.minZoom,\n Math.min(this.maxZoom, this.object.zoom * dollyScale)\n );\n scope.object.updateProjectionMatrix();\n zoomChanged = true;\n } else {\n console.warn(\n 'WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled.'\n );\n }\n };\n\n this.dollyOut = function (dollyScale) {\n if (scope.object instanceof THREE.PerspectiveCamera) {\n scale *= dollyScale;\n } else if (scope.object instanceof THREE.OrthographicCamera) {\n scope.object.zoom = Math.max(\n this.minZoom,\n Math.min(this.maxZoom, this.object.zoom / dollyScale)\n );\n scope.object.updateProjectionMatrix();\n zoomChanged = true;\n } else {\n console.warn(\n 'WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled.'\n );\n }\n };\n\n this.update = (function () {\n var offset = new THREE.Vector3();\n\n // so camera.up is the orbit axis\n var quat = new THREE.Quaternion().setFromUnitVectors(object.up, new THREE.Vector3(0, 1, 0));\n var quatInverse = quat.clone().inverse();\n\n var lastPosition = new THREE.Vector3();\n var lastQuaternion = new THREE.Quaternion();\n\n return function () {\n var position = this.object.position;\n\n offset.copy(position).sub(this.target);\n\n // rotate offset to \"y-axis-is-up\" space\n offset.applyQuaternion(quat);\n\n // angle from z-axis around y-axis\n\n theta = Math.atan2(offset.x, offset.z);\n\n // angle from y-axis\n\n phi = Math.atan2(Math.sqrt(offset.x * offset.x + offset.z * offset.z), offset.y);\n\n theta += thetaDelta;\n phi += phiDelta;\n\n // restrict theta to be between desired limits\n theta = Math.max(this.minAzimuthAngle, Math.min(this.maxAzimuthAngle, theta));\n\n // restrict phi to be between desired limits\n phi = Math.max(this.minPolarAngle, Math.min(this.maxPolarAngle, phi));\n\n // restrict phi to be betwee EPS and PI-EPS\n phi = Math.max(EPS, Math.min(Math.PI - EPS, phi));\n\n var radius = offset.length() * scale;\n\n // restrict radius to be between desired limits\n radius = Math.max(this.minDistance, Math.min(this.maxDistance, radius));\n\n // move target to panned location\n this.target.add(panOffset);\n\n offset.x = radius * Math.sin(phi) * Math.sin(theta);\n offset.y = radius * Math.cos(phi);\n offset.z = radius * Math.sin(phi) * Math.cos(theta);\n\n // rotate offset back to \"camera-up-vector-is-up\" space\n offset.applyQuaternion(quatInverse);\n\n position.copy(this.target).add(offset);\n\n this.object.lookAt(this.target);\n\n if (this.enableDamping === true) {\n thetaDelta *= 1 - this.dampingFactor;\n phiDelta *= 1 - this.dampingFactor;\n } else {\n thetaDelta = 0;\n phiDelta = 0;\n }\n\n scale = 1;\n panOffset.set(0, 0, 0);\n\n // update condition is:\n // min(camera displacement, camera rotation in radians)^2 > EPS\n // using small-angle approximation cos(x/2) = 1 - x^2 / 8\n\n if (\n zoomChanged ||\n lastPosition.distanceToSquared(this.object.position) > EPS ||\n 8 * (1 - lastQuaternion.dot(this.object.quaternion)) > EPS\n ) {\n lastPosition.copy(this.object.position);\n lastQuaternion.copy(this.object.quaternion);\n zoomChanged = false;\n\n return true;\n }\n\n return false;\n };\n })();\n }\n\n // This set of controls performs orbiting, dollying (zooming), and panning. It maintains\n // the \"up\" direction as +Y, unlike the TrackballControls. Touch on tablet and phones is\n // supported.\n //\n // Orbit - left mouse / touch: one finger move\n // Zoom - middle mouse, or mousewheel / touch: two finger spread or squish\n // Pan - right mouse, or arrow keys / touch: three finter swipe\n\n function OrbitControls(object, domElement) {\n var constraint = new OrbitConstraint(object);\n\n this.domElement = domElement !== undefined ? domElement : document;\n\n // API\n\n Object.defineProperty(this, 'constraint', {\n get: function () {\n return constraint;\n },\n });\n\n this.getPolarAngle = function () {\n return constraint.getPolarAngle();\n };\n\n this.getAzimuthalAngle = function () {\n return constraint.getAzimuthalAngle();\n };\n\n // Set to false to disable this control\n this.enabled = true;\n\n // center is old, deprecated; use \"target\" instead\n this.center = this.target;\n\n // This option actually enables dollying in and out; left as \"zoom\" for\n // backwards compatibility.\n // Set to false to disable zooming\n this.enableZoom = true;\n this.zoomSpeed = 1.0;\n\n // Set to false to disable rotating\n this.enableRotate = true;\n this.rotateSpeed = 1.0;\n\n // Set to false to disable panning\n this.enablePan = true;\n this.keyPanSpeed = 7.0; // pixels moved per arrow key push\n\n // Set to true to automatically rotate around the target\n // If auto-rotate is enabled, you must call controls.update() in your animation loop\n this.autoRotate = false;\n this.autoRotateSpeed = 2.0; // 30 seconds per round when fps is 60\n\n // Set to false to disable use of the keys\n this.enableKeys = true;\n\n // The four arrow keys\n this.keys = { LEFT: 37, UP: 38, RIGHT: 39, BOTTOM: 40 };\n\n // Mouse buttons\n this.mouseButtons = {\n ORBIT: THREE.MOUSE.LEFT,\n ZOOM: THREE.MOUSE.MIDDLE,\n PAN: THREE.MOUSE.RIGHT,\n };\n\n ////////////\n // internals\n\n var scope = this;\n\n var rotateStart = new THREE.Vector2();\n var rotateEnd = new THREE.Vector2();\n var rotateDelta = new THREE.Vector2();\n\n var panStart = new THREE.Vector2();\n var panEnd = new THREE.Vector2();\n var panDelta = new THREE.Vector2();\n\n var dollyStart = new THREE.Vector2();\n var dollyEnd = new THREE.Vector2();\n var dollyDelta = new THREE.Vector2();\n\n var STATE = {\n NONE: -1,\n ROTATE: 0,\n DOLLY: 1,\n PAN: 2,\n TOUCH_ROTATE: 3,\n TOUCH_DOLLY: 4,\n TOUCH_PAN: 5,\n };\n\n var state = STATE.NONE;\n\n // for reset\n\n this.target0 = this.target.clone();\n this.position0 = this.object.position.clone();\n this.zoom0 = this.object.zoom;\n\n // events\n\n var changeEvent = { type: 'change' };\n var startEvent = { type: 'start' };\n var endEvent = { type: 'end' };\n\n // pass in x,y of change desired in pixel space,\n // right and down are positive\n function pan(deltaX, deltaY) {\n var element = scope.domElement === document ? scope.domElement.body : scope.domElement;\n\n constraint.pan(deltaX, deltaY, element.clientWidth, element.clientHeight);\n }\n\n this.update = function () {\n if (this.autoRotate && state === STATE.NONE) {\n constraint.rotateLeft(getAutoRotationAngle());\n }\n\n if (constraint.update() === true) {\n this.dispatchEvent(changeEvent);\n }\n };\n\n this.reset = function () {\n state = STATE.NONE;\n\n this.target.copy(this.target0);\n this.object.position.copy(this.position0);\n this.object.zoom = this.zoom0;\n\n this.object.updateProjectionMatrix();\n this.dispatchEvent(changeEvent);\n\n this.update();\n };\n\n function getAutoRotationAngle() {\n return ((2 * Math.PI) / 60 / 60) * scope.autoRotateSpeed;\n }\n\n function getZoomScale() {\n return Math.pow(0.95, scope.zoomSpeed);\n }\n\n function onMouseDown(event) {\n if (scope.enabled === false) return;\n\n event.preventDefault();\n\n if (event.button === scope.mouseButtons.ORBIT) {\n if (scope.enableRotate === false) return;\n\n state = STATE.ROTATE;\n\n rotateStart.set(event.clientX, event.clientY);\n } else if (event.button === scope.mouseButtons.ZOOM) {\n if (scope.enableZoom === false) return;\n\n state = STATE.DOLLY;\n\n dollyStart.set(event.clientX, event.clientY);\n } else if (event.button === scope.mouseButtons.PAN) {\n if (scope.enablePan === false) return;\n\n state = STATE.PAN;\n\n panStart.set(event.clientX, event.clientY);\n }\n\n if (state !== STATE.NONE) {\n document.addEventListener('mousemove', onMouseMove, false);\n document.addEventListener('mouseup', onMouseUp, false);\n scope.dispatchEvent(startEvent);\n }\n }\n\n function onMouseMove(event) {\n if (scope.enabled === false) return;\n\n event.preventDefault();\n\n var element = scope.domElement === document ? scope.domElement.body : scope.domElement;\n\n if (state === STATE.ROTATE) {\n if (scope.enableRotate === false) return;\n\n rotateEnd.set(event.clientX, event.clientY);\n rotateDelta.subVectors(rotateEnd, rotateStart);\n\n // rotating across whole screen goes 360 degrees around\n constraint.rotateLeft(\n ((2 * Math.PI * rotateDelta.x) / element.clientWidth) * scope.rotateSpeed\n );\n\n // rotating up and down along whole screen attempts to go 360, but limited to 180\n constraint.rotateUp(\n ((2 * Math.PI * rotateDelta.y) / element.clientHeight) * scope.rotateSpeed\n );\n\n rotateStart.copy(rotateEnd);\n } else if (state === STATE.DOLLY) {\n if (scope.enableZoom === false) return;\n\n dollyEnd.set(event.clientX, event.clientY);\n dollyDelta.subVectors(dollyEnd, dollyStart);\n\n if (dollyDelta.y > 0) {\n constraint.dollyIn(getZoomScale());\n } else if (dollyDelta.y < 0) {\n constraint.dollyOut(getZoomScale());\n }\n\n dollyStart.copy(dollyEnd);\n } else if (state === STATE.PAN) {\n if (scope.enablePan === false) return;\n\n panEnd.set(event.clientX, event.clientY);\n panDelta.subVectors(panEnd, panStart);\n\n pan(panDelta.x, panDelta.y);\n\n panStart.copy(panEnd);\n }\n\n if (state !== STATE.NONE) scope.update();\n }\n\n function onMouseUp(/* event */) {\n if (scope.enabled === false) return;\n\n document.removeEventListener('mousemove', onMouseMove, false);\n document.removeEventListener('mouseup', onMouseUp, false);\n scope.dispatchEvent(endEvent);\n state = STATE.NONE;\n }\n\n function onMouseWheel(event) {\n if (scope.enabled === false || scope.enableZoom === false || state !== STATE.NONE) return;\n\n event.preventDefault();\n event.stopPropagation();\n\n var delta = 0;\n\n if (event.wheelDelta !== undefined) {\n // WebKit / Opera / Explorer 9\n\n delta = event.wheelDelta;\n } else if (event.detail !== undefined) {\n // Firefox\n\n delta = -event.detail;\n }\n\n if (delta > 0) {\n constraint.dollyOut(getZoomScale());\n } else if (delta < 0) {\n constraint.dollyIn(getZoomScale());\n }\n\n scope.update();\n scope.dispatchEvent(startEvent);\n scope.dispatchEvent(endEvent);\n }\n\n function onKeyDown(event) {\n if (scope.enabled === false || scope.enableKeys === false || scope.enablePan === false)\n return;\n\n switch (event.keyCode) {\n case scope.keys.UP:\n pan(0, scope.keyPanSpeed);\n scope.update();\n break;\n\n case scope.keys.BOTTOM:\n pan(0, -scope.keyPanSpeed);\n scope.update();\n break;\n\n case scope.keys.LEFT:\n pan(scope.keyPanSpeed, 0);\n scope.update();\n break;\n\n case scope.keys.RIGHT:\n pan(-scope.keyPanSpeed, 0);\n scope.update();\n break;\n }\n }\n\n function touchstart(event) {\n if (scope.enabled === false) return;\n\n switch (event.touches.length) {\n case 1: // one-fingered touch: rotate\n if (scope.enableRotate === false) return;\n\n state = STATE.TOUCH_ROTATE;\n\n rotateStart.set(event.touches[0].pageX, event.touches[0].pageY);\n break;\n\n case 2: // two-fingered touch: dolly\n if (scope.enableZoom === false) return;\n\n state = STATE.TOUCH_DOLLY;\n\n var dx = event.touches[0].pageX - event.touches[1].pageX;\n var dy = event.touches[0].pageY - event.touches[1].pageY;\n var distance = Math.sqrt(dx * dx + dy * dy);\n dollyStart.set(0, distance);\n break;\n\n case 3: // three-fingered touch: pan\n if (scope.enablePan === false) return;\n\n state = STATE.TOUCH_PAN;\n\n panStart.set(event.touches[0].pageX, event.touches[0].pageY);\n break;\n\n default:\n state = STATE.NONE;\n }\n\n if (state !== STATE.NONE) scope.dispatchEvent(startEvent);\n }\n\n function touchmove(event) {\n if (scope.enabled === false) return;\n\n event.preventDefault();\n event.stopPropagation();\n\n var element = scope.domElement === document ? scope.domElement.body : scope.domElement;\n\n switch (event.touches.length) {\n case 1: // one-fingered touch: rotate\n if (scope.enableRotate === false) return;\n if (state !== STATE.TOUCH_ROTATE) return;\n\n rotateEnd.set(event.touches[0].pageX, event.touches[0].pageY);\n rotateDelta.subVectors(rotateEnd, rotateStart);\n\n // rotating across whole screen goes 360 degrees around\n constraint.rotateLeft(\n ((2 * Math.PI * rotateDelta.x) / element.clientWidth) * scope.rotateSpeed\n );\n // rotating up and down along whole screen attempts to go 360, but limited to 180\n constraint.rotateUp(\n ((2 * Math.PI * rotateDelta.y) / element.clientHeight) * scope.rotateSpeed\n );\n\n rotateStart.copy(rotateEnd);\n\n scope.update();\n break;\n\n case 2: // two-fingered touch: dolly\n if (scope.enableZoom === false) return;\n if (state !== STATE.TOUCH_DOLLY) return;\n\n var dx = event.touches[0].pageX - event.touches[1].pageX;\n var dy = event.touches[0].pageY - event.touches[1].pageY;\n var distance = Math.sqrt(dx * dx + dy * dy);\n\n dollyEnd.set(0, distance);\n dollyDelta.subVectors(dollyEnd, dollyStart);\n\n if (dollyDelta.y > 0) {\n constraint.dollyOut(getZoomScale());\n } else if (dollyDelta.y < 0) {\n constraint.dollyIn(getZoomScale());\n }\n\n dollyStart.copy(dollyEnd);\n\n scope.update();\n break;\n\n case 3: // three-fingered touch: pan\n if (scope.enablePan === false) return;\n if (state !== STATE.TOUCH_PAN) return;\n\n panEnd.set(event.touches[0].pageX, event.touches[0].pageY);\n panDelta.subVectors(panEnd, panStart);\n\n pan(panDelta.x, panDelta.y);\n\n panStart.copy(panEnd);\n\n scope.update();\n break;\n\n default:\n state = STATE.NONE;\n }\n }\n\n function touchend(/* event */) {\n if (scope.enabled === false) return;\n\n scope.dispatchEvent(endEvent);\n state = STATE.NONE;\n }\n\n function contextmenu(event) {\n event.preventDefault();\n }\n\n this.dispose = function () {\n this.domElement.removeEventListener('contextmenu', contextmenu, false);\n this.domElement.removeEventListener('mousedown', onMouseDown, false);\n this.domElement.removeEventListener('mousewheel', onMouseWheel, false);\n this.domElement.removeEventListener('MozMousePixelScroll', onMouseWheel, false); // firefox\n\n this.domElement.removeEventListener('touchstart', touchstart, false);\n this.domElement.removeEventListener('touchend', touchend, false);\n this.domElement.removeEventListener('touchmove', touchmove, false);\n\n document.removeEventListener('mousemove', onMouseMove, false);\n document.removeEventListener('mouseup', onMouseUp, false);\n\n window.removeEventListener('keydown', onKeyDown, false);\n };\n\n this.domElement.addEventListener('contextmenu', contextmenu, false);\n\n this.domElement.addEventListener('mousedown', onMouseDown, false);\n this.domElement.addEventListener('mousewheel', onMouseWheel, false);\n this.domElement.addEventListener('MozMousePixelScroll', onMouseWheel, false); // firefox\n\n this.domElement.addEventListener('touchstart', touchstart, false);\n this.domElement.addEventListener('touchend', touchend, false);\n this.domElement.addEventListener('touchmove', touchmove, false);\n\n window.addEventListener('keydown', onKeyDown, false);\n\n // force an update at start\n this.update();\n }\n\n OrbitControls.prototype = Object.create(THREE.EventDispatcher.prototype);\n OrbitControls.prototype.constructor = OrbitControls;\n\n Object.defineProperties(OrbitControls.prototype, {\n object: {\n get: function () {\n return this.constraint.object;\n },\n },\n\n target: {\n get: function () {\n return this.constraint.target;\n },\n\n set: function (value) {\n console.warn('THREE.OrbitControls: target is now immutable. Use target.set() instead.');\n this.constraint.target.copy(value);\n },\n },\n\n minDistance: {\n get: function () {\n return this.constraint.minDistance;\n },\n\n set: function (value) {\n this.constraint.minDistance = value;\n },\n },\n\n maxDistance: {\n get: function () {\n return this.constraint.maxDistance;\n },\n\n set: function (value) {\n this.constraint.maxDistance = value;\n },\n },\n\n minZoom: {\n get: function () {\n return this.constraint.minZoom;\n },\n\n set: function (value) {\n this.constraint.minZoom = value;\n },\n },\n\n maxZoom: {\n get: function () {\n return this.constraint.maxZoom;\n },\n\n set: function (value) {\n this.constraint.maxZoom = value;\n },\n },\n\n minPolarAngle: {\n get: function () {\n return this.constraint.minPolarAngle;\n },\n\n set: function (value) {\n this.constraint.minPolarAngle = value;\n },\n },\n\n maxPolarAngle: {\n get: function () {\n return this.constraint.maxPolarAngle;\n },\n\n set: function (value) {\n this.constraint.maxPolarAngle = value;\n },\n },\n\n minAzimuthAngle: {\n get: function () {\n return this.constraint.minAzimuthAngle;\n },\n\n set: function (value) {\n this.constraint.minAzimuthAngle = value;\n },\n },\n\n maxAzimuthAngle: {\n get: function () {\n return this.constraint.maxAzimuthAngle;\n },\n\n set: function (value) {\n this.constraint.maxAzimuthAngle = value;\n },\n },\n\n enableDamping: {\n get: function () {\n return this.constraint.enableDamping;\n },\n\n set: function (value) {\n this.constraint.enableDamping = value;\n },\n },\n\n dampingFactor: {\n get: function () {\n return this.constraint.dampingFactor;\n },\n\n set: function (value) {\n this.constraint.dampingFactor = value;\n },\n },\n\n // backward compatibility\n\n noZoom: {\n get: function () {\n console.warn('THREE.OrbitControls: .noZoom has been deprecated. Use .enableZoom instead.');\n return !this.enableZoom;\n },\n\n set: function (value) {\n console.warn('THREE.OrbitControls: .noZoom has been deprecated. Use .enableZoom instead.');\n this.enableZoom = !value;\n },\n },\n\n noRotate: {\n get: function () {\n console.warn(\n 'THREE.OrbitControls: .noRotate has been deprecated. Use .enableRotate instead.'\n );\n return !this.enableRotate;\n },\n\n set: function (value) {\n console.warn(\n 'THREE.OrbitControls: .noRotate has been deprecated. Use .enableRotate instead.'\n );\n this.enableRotate = !value;\n },\n },\n\n noPan: {\n get: function () {\n console.warn('THREE.OrbitControls: .noPan has been deprecated. Use .enablePan instead.');\n return !this.enablePan;\n },\n\n set: function (value) {\n console.warn('THREE.OrbitControls: .noPan has been deprecated. Use .enablePan instead.');\n this.enablePan = !value;\n },\n },\n\n noKeys: {\n get: function () {\n console.warn('THREE.OrbitControls: .noKeys has been deprecated. Use .enableKeys instead.');\n return !this.enableKeys;\n },\n\n set: function (value) {\n console.warn('THREE.OrbitControls: .noKeys has been deprecated. Use .enableKeys instead.');\n this.enableKeys = !value;\n },\n },\n\n staticMoving: {\n get: function () {\n console.warn(\n 'THREE.OrbitControls: .staticMoving has been deprecated. Use .enableDamping instead.'\n );\n return !this.constraint.enableDamping;\n },\n\n set: function (value) {\n console.warn(\n 'THREE.OrbitControls: .staticMoving has been deprecated. Use .enableDamping instead.'\n );\n this.constraint.enableDamping = !value;\n },\n },\n\n dynamicDampingFactor: {\n get: function () {\n console.warn(\n 'THREE.OrbitControls: .dynamicDampingFactor has been renamed. Use .dampingFactor instead.'\n );\n return this.constraint.dampingFactor;\n },\n\n set: function (value) {\n console.warn(\n 'THREE.OrbitControls: .dynamicDampingFactor has been renamed. Use .dampingFactor instead.'\n );\n this.constraint.dampingFactor = value;\n },\n },\n });\n\n return OrbitControls;\n};\n","import TWEEN from '@tweenjs/tween.js';\n\n// This object contains the state of the app\nexport default {\n isDev: false,\n isShowingStats: true,\n isLoaded: false,\n isTweening: false,\n isRotating: true,\n isMouseMoving: false,\n isMouseOver: false,\n maxAnisotropy: 1,\n dpr: 1,\n easing: TWEEN.Easing.Quadratic.InOut,\n duration: 500,\n model: {\n selected: 0,\n initialTypes: ['gltf', 'object'],\n type: 'gltf'\n },\n models: [\n {\n path: './assets/models/duck.gltf',\n scale: 20,\n type: 'gltf'\n },\n {\n path: './assets/models/Teapot.json',\n scale: 20,\n type: 'object'\n }\n ],\n texture: {\n path: './assets/textures/',\n imageFiles: [\n { name: 'UV', image: 'UV_Grid_Sm.jpg' }\n ]\n },\n mesh: {\n enableHelper: true,\n wireframe: false,\n translucent: false,\n material: {\n color: 0xffffff,\n emissive: 0xffffff\n }\n },\n fog: {\n color: 0xffffff,\n near: 0.0008\n },\n camera: {\n fov: 40,\n near: 2,\n far: 1000,\n aspect: 1,\n posX: 0,\n posY: 30,\n posZ: 40\n },\n controls: {\n autoRotate: true,\n autoRotateSpeed: -0.5,\n rotateSpeed: 0.5,\n zoomSpeed: 0.8,\n minDistance: 200,\n maxDistance: 600,\n minPolarAngle: Math.PI / 5,\n maxPolarAngle: Math.PI / 2,\n minAzimuthAngle: -Infinity,\n maxAzimuthAngle: Infinity,\n enableDamping: true,\n dampingFactor: 0.5,\n enableZoom: true,\n target: {\n x: 0,\n y: 0,\n z: 0\n }\n },\n ambientLight: {\n enabled: true,\n color: 0x141414\n },\n directionalLight: {\n enabled: true,\n color: 0xf0f0f0,\n intensity: 0.4,\n x: -75,\n y: 280,\n z: 150\n },\n shadow: {\n enabled: true,\n helperEnabled: true,\n bias: 0,\n mapWidth: 2048,\n mapHeight: 2048,\n near: 250,\n far: 400,\n top: 100,\n right: 100,\n bottom: -100,\n left: -100\n },\n pointLight: {\n enabled: true,\n color: 0xffffff,\n intensity: 0.34,\n distance: 115,\n x: 0,\n y: 0,\n z: 0\n },\n hemiLight: {\n enabled: true,\n color: 0xc8c8c8,\n groundColor: 0xffffff,\n intensity: 0.55,\n x: 0,\n y: 0,\n z: 0\n }\n};\n","/**\n * @author alteredq / http://alteredqualia.com/\n * @author mr.doob / http://mrdoob.com/\n */\n\nexport default {\n canvas: !!window.CanvasRenderingContext2D,\n webgl: (function() {\n try {\n var canvas = document.createElement('canvas');\n\n return !!(window.WebGLRenderingContext && (canvas.getContext('webgl') || canvas.getContext('experimental-webgl')));\n } catch(e) {\n return false;\n }\n })(),\n\n workers: !!window.Worker,\n fileapi: window.File && window.FileReader && window.FileList && window.Blob,\n\n getWebGLErrorMessage: function() {\n var element = document.createElement('div');\n element.id = 'webgl-error-message';\n element.style.fontFamily = 'monospace';\n element.style.fontSize = '13px';\n element.style.fontWeight = 'normal';\n element.style.textAlign = 'center';\n element.style.background = '#fff';\n element.style.color = '#000';\n element.style.padding = '1.5em';\n element.style.width = '400px';\n element.style.margin = '5em auto 0';\n\n if(!this.webgl) {\n element.innerHTML = window.WebGLRenderingContext ? [\n 'Your graphics card does not seem to support WebGL.
',\n 'Find out how to get it here.'\n ].join('\\n') : [\n 'Your browser does not seem to support WebGL.
',\n 'Find out how to get it here.'\n ].join('\\n');\n }\n\n return element;\n },\n\n addGetWebGLMessage: function(parameters) {\n var parent, id, element;\n\n parameters = parameters || {};\n\n parent = parameters.parent !== undefined ? parameters.parent : document.body;\n id = parameters.id !== undefined ? parameters.id : 'oldie';\n\n element = this.getWebGLErrorMessage();\n element.id = id;\n\n parent.appendChild(element);\n }\n};\n","import * as THREE from 'three';\n\nimport Config from '../../data/config';\n\n// Main webGL renderer class\nexport default class Renderer {\n constructor(scene, container) {\n // Properties\n this.scene = scene;\n this.container = container;\n\n // Create WebGL renderer and set its antialias\n this.threeRenderer = new THREE.WebGLRenderer({antialias: true});\n\n // Set clear color to fog to enable fog or to hex color for no fog\n this.threeRenderer.setClearColor(scene.fog.color);\n this.threeRenderer.setPixelRatio(window.devicePixelRatio); // For retina\n\n // Appends canvas\n container.appendChild(this.threeRenderer.domElement);\n\n // Shadow map options\n this.threeRenderer.shadowMap.enabled = true;\n this.threeRenderer.shadowMap.type = THREE.PCFSoftShadowMap;\n\n // Get anisotropy for textures\n Config.maxAnisotropy = this.threeRenderer.capabilities.getMaxAnisotropy();\n\n // Initial size update set to canvas container\n this.updateSize();\n\n // Listeners\n document.addEventListener('DOMContentLoaded', () => this.updateSize(), false);\n window.addEventListener('resize', () => this.updateSize(), false);\n }\n\n updateSize() {\n this.threeRenderer.setSize(this.container.offsetWidth, this.container.offsetHeight);\n }\n\n render(scene, camera) {\n // Renders scene to canvas target\n this.threeRenderer.render(scene, camera);\n }\n}\n","import * as THREE from 'three';\n\nimport Config from '../../data/config';\n\n// Class that creates and updates the main camera\nexport default class Camera {\n constructor(renderer) {\n const width = renderer.domElement.width;\n const height = renderer.domElement.height;\n\n // Create and position a Perspective Camera\n this.threeCamera = new THREE.PerspectiveCamera(Config.camera.fov, width / height, Config.camera.near, Config.camera.far);\n this.threeCamera.position.set(Config.camera.posX, Config.camera.posY, Config.camera.posZ);\n\n // Initial sizing\n this.updateSize(renderer);\n \n // Listeners\n window.addEventListener('resize', () => this.updateSize(renderer), false);\n }\n\n updateSize(renderer) {\n // Update camera aspect ratio with window aspect ratio\n this.threeCamera.aspect = renderer.domElement.width / renderer.domElement.height;\n\n // Always call updateProjectionMatrix on camera change\n this.threeCamera.updateProjectionMatrix();\n }\n}\n","import * as THREE from 'three';\n\nimport Config from '../../data/config';\n\n// Sets up and places all lights in scene\nexport default class Light {\n constructor(scene) {\n this.scene = scene;\n\n this.init();\n }\n\n init() {\n // Ambient\n this.ambientLight = new THREE.AmbientLight(Config.ambientLight.color);\n this.ambientLight.visible = Config.ambientLight.enabled;\n\n // Point light\n this.pointLight = new THREE.PointLight(Config.pointLight.color, Config.pointLight.intensity, Config.pointLight.distance);\n this.pointLight.position.set(Config.pointLight.x, Config.pointLight.y, Config.pointLight.z);\n this.pointLight.visible = Config.pointLight.enabled;\n\n // Directional light\n this.directionalLight = new THREE.DirectionalLight(Config.directionalLight.color, Config.directionalLight.intensity);\n this.directionalLight.position.set(Config.directionalLight.x, Config.directionalLight.y, Config.directionalLight.z);\n this.directionalLight.visible = Config.directionalLight.enabled;\n\n // Shadow map\n this.directionalLight.castShadow = Config.shadow.enabled;\n this.directionalLight.shadow.bias = Config.shadow.bias;\n this.directionalLight.shadow.camera.near = Config.shadow.near;\n this.directionalLight.shadow.camera.far = Config.shadow.far;\n this.directionalLight.shadow.camera.left = Config.shadow.left;\n this.directionalLight.shadow.camera.right = Config.shadow.right;\n this.directionalLight.shadow.camera.top = Config.shadow.top;\n this.directionalLight.shadow.camera.bottom = Config.shadow.bottom;\n this.directionalLight.shadow.mapSize.width = Config.shadow.mapWidth;\n this.directionalLight.shadow.mapSize.height = Config.shadow.mapHeight;\n\n // Shadow camera helper\n this.directionalLightHelper = new THREE.CameraHelper(this.directionalLight.shadow.camera);\n this.directionalLightHelper.visible = Config.shadow.helperEnabled;\n\n // Hemisphere light\n this.hemiLight = new THREE.HemisphereLight(Config.hemiLight.color, Config.hemiLight.groundColor, Config.hemiLight.intensity);\n this.hemiLight.position.set(Config.hemiLight.x, Config.hemiLight.y, Config.hemiLight.z);\n this.hemiLight.visible = Config.hemiLight.enabled;\n }\n\n place(lightName) {\n switch(lightName) {\n case 'ambient':\n this.scene.add(this.ambientLight);\n break;\n\n case 'directional':\n this.scene.add(this.directionalLight);\n this.scene.add(this.directionalLightHelper);\n break;\n\n case 'point':\n this.scene.add(this.pointLight);\n break;\n\n case 'hemi':\n this.scene.add(this.hemiLight);\n break;\n }\n }\n}\n","import * as THREE from 'three';\n\nimport OrbitControls from '../../utils/orbitControls';\nimport Config from '../../data/config';\n\n// Controls based on orbit controls\nexport default class Controls {\n constructor(camera, container) {\n // Orbit controls first needs to pass in THREE to constructor\n const orbitControls = new OrbitControls(THREE);\n this.threeControls = new orbitControls(camera, container);\n\n this.init();\n }\n\n init() {\n this.threeControls.target.set(Config.controls.target.x, Config.controls.target.y, Config.controls.target.z);\n this.threeControls.autoRotate = Config.controls.autoRotate;\n this.threeControls.autoRotateSpeed = Config.controls.autoRotateSpeed;\n this.threeControls.rotateSpeed = Config.controls.rotateSpeed;\n this.threeControls.zoomSpeed = Config.controls.zoomSpeed;\n this.threeControls.minDistance = Config.controls.minDistance;\n this.threeControls.maxDistance = Config.controls.maxDistance;\n this.threeControls.minPolarAngle = Config.controls.minPolarAngle;\n this.threeControls.maxPolarAngle = Config.controls.maxPolarAngle;\n this.threeControls.enableDamping = Config.controls.enableDamping;\n this.threeControls.enableZoom = Config.controls.enableZoom;\n this.threeControls.dampingFactor = Config.controls.dampingFactor;\n }\n}\n","import * as THREE from 'three';\n\n// USe this class as a helper to set up some default materials\nexport default class Material {\n constructor(color) {\n this.basic = new THREE.MeshBasicMaterial({\n color,\n side: THREE.DoubleSide\n });\n\n this.standard = new THREE.MeshStandardMaterial({\n color,\n shading: THREE.FlatShading,\n roughness: 1,\n metalness: 0,\n side: THREE.DoubleSide\n });\n\n this.wire = new THREE.MeshBasicMaterial({wireframe: true});\n }\n}\n\n","// Local vars for rStats\nlet rS, bS, glS, tS;\n\nexport default class Stats {\n constructor(renderer) {\n this.renderer = renderer;\n }\n\n setUp() {\n bS = new BrowserStats();\n glS = new glStats();\n tS = new threeStats(this.renderer.threeRenderer);\n\n rS = new rStats({\n CSSPath: './css/',\n userTimingAPI: true,\n values: {\n frame: { caption: 'Total frame time (ms)', over: 16, average: true, avgMs: 100 },\n fps: { caption: 'Framerate (FPS)', below: 30 },\n calls: { caption: 'Calls (three.js)', over: 3000 },\n raf: { caption: 'Time since last rAF (ms)', average: true, avgMs: 100 },\n rstats: { caption: 'rStats update (ms)', average: true, avgMs: 100 },\n texture: { caption: 'GenTex', average: true, avgMs: 100 }\n },\n groups: [\n { caption: 'Framerate', values: ['fps', 'raf'] },\n { caption: 'Frame Budget', values: ['frame', 'texture', 'setup', 'render'] }\n ],\n fractions: [\n { base: 'frame', steps: ['texture', 'setup', 'render'] }\n ],\n plugins: [bS, tS]\n });\n }\n\n static start() {\n rS('frame').start();\n glS.start();\n\n rS('rAF').tick();\n rS('FPS').frame();\n\n rS('render').start();\n }\n\n static end() {\n rS('render').end(); // render finished\n rS('frame').end(); // frame finished\n\n // Local rStats update\n rS('rStats').start();\n rS().update();\n rS('rStats').end();\n }\n}\n","import * as THREE from 'three';\n\nimport Material from './material';\nimport Config from '../../data/config';\n\n// This helper class can be used to create and then place geometry in the scene\nexport default class Geometry {\n constructor(scene) {\n this.scene = scene;\n this.geo = null;\n }\n\n make(type) {\n if(type === 'plane') {\n return (width, height, widthSegments = 1, heightSegments = 1) => {\n this.geo = new THREE.PlaneGeometry(width, height, widthSegments, heightSegments);\n };\n }\n\n if(type === 'sphere') {\n return (radius, widthSegments = 32, heightSegments = 32) => {\n this.geo = new THREE.SphereGeometry(radius, widthSegments, heightSegments);\n };\n }\n }\n\n place(position, rotation) {\n const material = new Material(0xeeeeee).standard;\n const mesh = new THREE.Mesh(this.geo, material);\n\n // Use ES6 spread to set position and rotation from passed in array\n mesh.position.set(...position);\n mesh.rotation.set(...rotation);\n\n if(Config.shadow.enabled) {\n mesh.receiveShadow = true;\n }\n\n this.scene.add(mesh);\n }\n}\n","/**\n * @author mrdoob / http://mrdoob.com/\n * @author WestLangley / http://github.com/WestLangley\n */\n\nimport {\n BufferGeometry,\n Float32BufferAttribute,\n LineSegments,\n LineBasicMaterial,\n Matrix3,\n Vector3,\n} from 'three';\n\nconst _v1 = new Vector3();\nconst _v2 = new Vector3();\nconst _normalMatrix = new Matrix3();\nconst _keys = ['a', 'b', 'c'];\n\nfunction VertexNormalsHelper(object, size, hex) {\n this.object = object;\n this.size = size !== undefined ? size : 0.1;\n\n const color = hex !== undefined ? hex : 0xff0000;\n\n //\n\n let nNormals = 0;\n\n const objGeometry = this.object.geometry;\n\n if (objGeometry && objGeometry.isGeometry) {\n nNormals = objGeometry.faces.length * 3;\n } else if (objGeometry && objGeometry.isBufferGeometry) {\n nNormals = objGeometry.attributes.normal.count;\n }\n\n //\n\n const geometry = new BufferGeometry();\n const positions = new Float32BufferAttribute(nNormals * 2 * 3, 3);\n\n geometry.setAttribute('position', positions);\n\n LineSegments.call(this, geometry, new LineBasicMaterial({ color: color, toneMapped: false }));\n\n this.type = 'VertexNormalsHelper';\n\n //\n\n this.matrixAutoUpdate = false;\n\n this.update();\n}\n\nVertexNormalsHelper.prototype = Object.create(LineSegments.prototype);\nVertexNormalsHelper.prototype.constructor = VertexNormalsHelper;\n\nVertexNormalsHelper.prototype.update = function () {\n let idx;\n this.object.updateMatrixWorld(true);\n\n _normalMatrix.getNormalMatrix(this.object.matrixWorld);\n\n const matrixWorld = this.object.matrixWorld;\n const position = this.geometry.attributes.position;\n\n //\n\n const objGeometry = this.object.geometry;\n\n if (objGeometry && objGeometry.isGeometry) {\n const vertices = objGeometry.vertices;\n\n const faces = objGeometry.faces;\n\n idx = 0;\n\n for (let i = 0, l = faces.length; i < l; i++) {\n const face = faces[i];\n\n for (let j = 0, jl = face.vertexNormals.length; j < jl; j++) {\n const vertex = vertices[face[_keys[j]]];\n const normal = face.vertexNormals[j];\n\n _v1.copy(vertex).applyMatrix4(matrixWorld);\n _v2.copy(normal).applyMatrix3(_normalMatrix).normalize().multiplyScalar(this.size).add(_v1);\n\n position.setXYZ(idx, _v1.x, _v1.y, _v1.z);\n\n idx = idx + 1;\n\n position.setXYZ(idx, _v2.x, _v2.y, _v2.z);\n\n idx = idx + 1;\n }\n }\n } else if (objGeometry && objGeometry.isBufferGeometry) {\n const objPos = objGeometry.attributes.position;\n const objNorm = objGeometry.attributes.normal;\n\n idx = 0;\n\n // for simplicity, ignore index and drawcalls, and render every normal\n\n for (var j = 0, jl = objPos.count; j < jl; j++) {\n _v1.set(objPos.getX(j), objPos.getY(j), objPos.getZ(j)).applyMatrix4(matrixWorld);\n _v2.set(objNorm.getX(j), objNorm.getY(j), objNorm.getZ(j));\n _v2.applyMatrix3(_normalMatrix).normalize().multiplyScalar(this.size).add(_v1);\n\n position.setXYZ(idx, _v1.x, _v1.y, _v1.z);\n\n idx = idx + 1;\n\n position.setXYZ(idx, _v2.x, _v2.y, _v2.z);\n\n idx = idx + 1;\n }\n }\n\n position.needsUpdate = true;\n};\n\nexport { VertexNormalsHelper };\n","import * as THREE from 'three';\nimport { VertexNormalsHelper } from './vertexNormalsHelper';\n\n// Simple mesh helper that shows edges, wireframes, and face and vertex normals\nexport default class MeshHelper {\n constructor(scene, mesh) {\n this.mesh = mesh;\n this.scene = scene;\n\n const wireframe = new THREE.WireframeGeometry(this.mesh.geometry);\n this.wireLine = new THREE.LineSegments(wireframe);\n this.wireLine.material.depthTest = false;\n this.wireLine.material.opacity = 0.25;\n this.wireLine.material.transparent = true;\n\n const edges = new THREE.EdgesGeometry(this.mesh.geometry);\n this.edgesLine = new THREE.LineSegments(edges);\n this.edgesLine.material.depthTest = false;\n this.edgesLine.material.opacity = 0.25;\n this.edgesLine.material.transparent = true;\n\n this.vertexHelper = new VertexNormalsHelper(this.mesh, 2);\n this.boxHelper = new THREE.BoxHelper(this.mesh);\n }\n\n enable() {\n this.mesh.add(this.wireLine);\n this.mesh.add(this.edgesLine);\n\n this.scene.add(this.vertexHelper);\n this.scene.add(this.boxHelper);\n }\n\n disable() {\n this.mesh.remove(this.wireLine);\n this.mesh.remove(this.edgesLine);\n\n this.scene.remove(this.vertexHelper);\n this.scene.remove(this.boxHelper);\n }\n}\n","// Provides simple static functions that are used multiple times in the app\nexport default class Helpers {\n static throttle(fn, threshhold, scope) {\n threshhold || (threshhold = 250);\n let last, deferTimer;\n\n return function() {\n const context = scope || this;\n\n const now = +new Date,\n args = arguments;\n\n if(last && now < last + threshhold) {\n clearTimeout(deferTimer);\n deferTimer = setTimeout(function() {\n last = now;\n fn.apply(context, args);\n }, threshhold);\n }\n else {\n last = now;\n fn.apply(context, args);\n }\n };\n }\n\n static logProgress() {\n return function(xhr) {\n if(xhr.lengthComputable) {\n const percentComplete = xhr.loaded / xhr.total * 100;\n\n console.log(Math.round(percentComplete, 2) + '% downloaded');\n }\n }\n }\n\n static logError() {\n return function(xhr) {\n console.error(xhr);\n }\n }\n\n static handleColorChange(color) {\n return (value) => {\n if(typeof value === 'string') {\n value = value.replace('#', '0x');\n }\n\n color.setHex(value);\n };\n }\n\n static update(mesh) {\n this.needsUpdate(mesh.material, mesh.geometry);\n }\n\n static needsUpdate(material, geometry) {\n return function() {\n material.shading = +material.shading; //Ensure number\n material.vertexColors = +material.vertexColors; //Ensure number\n material.side = +material.side; //Ensure number\n material.needsUpdate = true;\n geometry.verticesNeedUpdate = true;\n geometry.normalsNeedUpdate = true;\n geometry.colorsNeedUpdate = true;\n };\n }\n\n static updateTexture(material, materialKey, textures) {\n return function(key) {\n material[materialKey] = textures[key];\n material.needsUpdate = true;\n };\n }\n}\n","import * as THREE from 'three';\n// Promise polyfill for IE\nimport { Promise } from 'es6-promise';\n\nimport Helpers from '../../utils/helpers';\nimport Config from '../../data/config';\n\n// This class preloads all textures in the imageFiles array in the Config via ES6 Promises.\n// Once all textures are done loading the model itself will be loaded after the Promise .then() callback.\n// Using promises to preload textures prevents issues when applying textures to materials\n// before the textures have loaded.\nexport default class Texture {\n constructor() {\n // Prop that will contain all loaded textures\n this.textures = {};\n }\n\n load() {\n const loader = new THREE.TextureLoader();\n const maxAnisotropy = Config.maxAnisotropy;\n const imageFiles = Config.texture.imageFiles;\n const promiseArray = [];\n\n loader.setPath(Config.texture.path);\n\n imageFiles.forEach(imageFile => {\n // Add an individual Promise for each image in array\n promiseArray.push(new Promise((resolve, reject) => {\n // Each Promise will attempt to load the image file\n loader.load(imageFile.image,\n // This gets called on load with the loaded texture\n texture => {\n texture.anisotropy = maxAnisotropy;\n\n // Resolve Promise with object of texture if it is instance of THREE.Texture\n const modelOBJ = {};\n modelOBJ[imageFile.name] = texture;\n if(modelOBJ[imageFile.name] instanceof THREE.Texture)\n resolve(modelOBJ);\n },\n Helpers.logProgress(),\n xhr => reject(new Error(xhr + 'An error occurred loading while loading ' + imageFile.image))\n )\n }));\n });\n\n // Iterate through all Promises in array and return another Promise when all have resolved or console log reason when any reject\n return Promise.all(promiseArray).then(textures => {\n // Set the textures prop object to have name be the resolved texture\n for(let i = 0; i < textures.length; i++) {\n this.textures[Object.keys(textures[i])[0]] = textures[i][Object.keys(textures[i])[0]];\n }\n }, reason => console.log(reason));\n }\n}\n","/**\n * @author mrdoob / http://mrdoob.com/\n */\n\nimport {\n BufferAttribute,\n BufferGeometry,\n InterleavedBuffer,\n InterleavedBufferAttribute,\n TriangleFanDrawMode,\n TriangleStripDrawMode,\n TrianglesDrawMode,\n Vector2,\n Vector3,\n} from 'three';\n\nvar BufferGeometryUtils = {\n computeTangents: function (geometry) {\n var index = geometry.index;\n var attributes = geometry.attributes;\n\n // based on http://www.terathon.com/code/tangent.html\n // (per vertex tangents)\n\n if (\n index === null ||\n attributes.position === undefined ||\n attributes.normal === undefined ||\n attributes.uv === undefined\n ) {\n console.error(\n 'THREE.BufferGeometryUtils: .computeTangents() failed. Missing required attributes (index, position, normal or uv)'\n );\n return;\n }\n\n var indices = index.array;\n var positions = attributes.position.array;\n var normals = attributes.normal.array;\n var uvs = attributes.uv.array;\n\n var nVertices = positions.length / 3;\n\n if (attributes.tangent === undefined) {\n geometry.setAttribute('tangent', new BufferAttribute(new Float32Array(4 * nVertices), 4));\n }\n\n var tangents = attributes.tangent.array;\n\n var tan1 = [],\n tan2 = [];\n\n for (var i = 0; i < nVertices; i++) {\n tan1[i] = new Vector3();\n tan2[i] = new Vector3();\n }\n\n var vA = new Vector3(),\n vB = new Vector3(),\n vC = new Vector3(),\n uvA = new Vector2(),\n uvB = new Vector2(),\n uvC = new Vector2(),\n sdir = new Vector3(),\n tdir = new Vector3();\n\n function handleTriangle(a, b, c) {\n vA.fromArray(positions, a * 3);\n vB.fromArray(positions, b * 3);\n vC.fromArray(positions, c * 3);\n\n uvA.fromArray(uvs, a * 2);\n uvB.fromArray(uvs, b * 2);\n uvC.fromArray(uvs, c * 2);\n\n vB.sub(vA);\n vC.sub(vA);\n\n uvB.sub(uvA);\n uvC.sub(uvA);\n\n var r = 1.0 / (uvB.x * uvC.y - uvC.x * uvB.y);\n\n // silently ignore degenerate uv triangles having coincident or colinear vertices\n\n if (!isFinite(r)) return;\n\n sdir.copy(vB).multiplyScalar(uvC.y).addScaledVector(vC, -uvB.y).multiplyScalar(r);\n tdir.copy(vC).multiplyScalar(uvB.x).addScaledVector(vB, -uvC.x).multiplyScalar(r);\n\n tan1[a].add(sdir);\n tan1[b].add(sdir);\n tan1[c].add(sdir);\n\n tan2[a].add(tdir);\n tan2[b].add(tdir);\n tan2[c].add(tdir);\n }\n\n var groups = geometry.groups;\n\n if (groups.length === 0) {\n groups = [\n {\n start: 0,\n count: indices.length,\n },\n ];\n }\n\n for (var i = 0, il = groups.length; i < il; ++i) {\n var group = groups[i];\n\n var start = group.start;\n var count = group.count;\n\n for (var j = start, jl = start + count; j < jl; j += 3) {\n handleTriangle(indices[j + 0], indices[j + 1], indices[j + 2]);\n }\n }\n\n var tmp = new Vector3(),\n tmp2 = new Vector3();\n var n = new Vector3(),\n n2 = new Vector3();\n var w, t, test;\n\n function handleVertex(v) {\n n.fromArray(normals, v * 3);\n n2.copy(n);\n\n t = tan1[v];\n\n // Gram-Schmidt orthogonalize\n\n tmp.copy(t);\n tmp.sub(n.multiplyScalar(n.dot(t))).normalize();\n\n // Calculate handedness\n\n tmp2.crossVectors(n2, t);\n test = tmp2.dot(tan2[v]);\n w = test < 0.0 ? -1.0 : 1.0;\n\n tangents[v * 4] = tmp.x;\n tangents[v * 4 + 1] = tmp.y;\n tangents[v * 4 + 2] = tmp.z;\n tangents[v * 4 + 3] = w;\n }\n\n for (var i = 0, il = groups.length; i < il; ++i) {\n var group = groups[i];\n\n var start = group.start;\n var count = group.count;\n\n for (var j = start, jl = start + count; j < jl; j += 3) {\n handleVertex(indices[j + 0]);\n handleVertex(indices[j + 1]);\n handleVertex(indices[j + 2]);\n }\n }\n },\n\n /**\n * @param {Array} geometries\n * @param {Boolean} useGroups\n * @return {BufferGeometry}\n */\n mergeBufferGeometries: function (geometries, useGroups) {\n var isIndexed = geometries[0].index !== null;\n\n var attributesUsed = new Set(Object.keys(geometries[0].attributes));\n var morphAttributesUsed = new Set(Object.keys(geometries[0].morphAttributes));\n\n var attributes = {};\n var morphAttributes = {};\n\n var morphTargetsRelative = geometries[0].morphTargetsRelative;\n\n var mergedGeometry = new BufferGeometry();\n\n var offset = 0;\n\n for (var i = 0; i < geometries.length; ++i) {\n var geometry = geometries[i];\n var attributesCount = 0;\n\n // ensure that all geometries are indexed, or none\n\n if (isIndexed !== (geometry.index !== null)) {\n console.error(\n 'THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index ' +\n i +\n '. All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them.'\n );\n return null;\n }\n\n // gather attributes, exit early if they're different\n\n for (var name in geometry.attributes) {\n if (!attributesUsed.has(name)) {\n console.error(\n 'THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index ' +\n i +\n '. All geometries must have compatible attributes; make sure \"' +\n name +\n '\" attribute exists among all geometries, or in none of them.'\n );\n return null;\n }\n\n if (attributes[name] === undefined) attributes[name] = [];\n\n attributes[name].push(geometry.attributes[name]);\n\n attributesCount++;\n }\n\n // ensure geometries have the same number of attributes\n\n if (attributesCount !== attributesUsed.size) {\n console.error(\n 'THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index ' +\n i +\n '. Make sure all geometries have the same number of attributes.'\n );\n return null;\n }\n\n // gather morph attributes, exit early if they're different\n\n if (morphTargetsRelative !== geometry.morphTargetsRelative) {\n console.error(\n 'THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index ' +\n i +\n '. .morphTargetsRelative must be consistent throughout all geometries.'\n );\n return null;\n }\n\n for (var name in geometry.morphAttributes) {\n if (!morphAttributesUsed.has(name)) {\n console.error(\n 'THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index ' +\n i +\n '. .morphAttributes must be consistent throughout all geometries.'\n );\n return null;\n }\n\n if (morphAttributes[name] === undefined) morphAttributes[name] = [];\n\n morphAttributes[name].push(geometry.morphAttributes[name]);\n }\n\n // gather .userData\n\n mergedGeometry.userData.mergedUserData = mergedGeometry.userData.mergedUserData || [];\n mergedGeometry.userData.mergedUserData.push(geometry.userData);\n\n if (useGroups) {\n var count;\n\n if (isIndexed) {\n count = geometry.index.count;\n } else if (geometry.attributes.position !== undefined) {\n count = geometry.attributes.position.count;\n } else {\n console.error(\n 'THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index ' +\n i +\n '. The geometry must have either an index or a position attribute'\n );\n return null;\n }\n\n mergedGeometry.addGroup(offset, count, i);\n\n offset += count;\n }\n }\n\n // merge indices\n\n if (isIndexed) {\n var indexOffset = 0;\n var mergedIndex = [];\n\n for (var i = 0; i < geometries.length; ++i) {\n var index = geometries[i].index;\n\n for (var j = 0; j < index.count; ++j) {\n mergedIndex.push(index.getX(j) + indexOffset);\n }\n\n indexOffset += geometries[i].attributes.position.count;\n }\n\n mergedGeometry.setIndex(mergedIndex);\n }\n\n // merge attributes\n\n for (var name in attributes) {\n var mergedAttribute = this.mergeBufferAttributes(attributes[name]);\n\n if (!mergedAttribute) {\n console.error(\n 'THREE.BufferGeometryUtils: .mergeBufferGeometries() failed while trying to merge the ' +\n name +\n ' attribute.'\n );\n return null;\n }\n\n mergedGeometry.setAttribute(name, mergedAttribute);\n }\n\n // merge morph attributes\n\n for (var name in morphAttributes) {\n var numMorphTargets = morphAttributes[name][0].length;\n\n if (numMorphTargets === 0) break;\n\n mergedGeometry.morphAttributes = mergedGeometry.morphAttributes || {};\n mergedGeometry.morphAttributes[name] = [];\n\n for (var i = 0; i < numMorphTargets; ++i) {\n var morphAttributesToMerge = [];\n\n for (var j = 0; j < morphAttributes[name].length; ++j) {\n morphAttributesToMerge.push(morphAttributes[name][j][i]);\n }\n\n var mergedMorphAttribute = this.mergeBufferAttributes(morphAttributesToMerge);\n\n if (!mergedMorphAttribute) {\n console.error(\n 'THREE.BufferGeometryUtils: .mergeBufferGeometries() failed while trying to merge the ' +\n name +\n ' morphAttribute.'\n );\n return null;\n }\n\n mergedGeometry.morphAttributes[name].push(mergedMorphAttribute);\n }\n }\n\n return mergedGeometry;\n },\n\n /**\n * @param {Array} attributes\n * @return {BufferAttribute}\n */\n mergeBufferAttributes: function (attributes) {\n var TypedArray;\n var itemSize;\n var normalized;\n var arrayLength = 0;\n\n for (var i = 0; i < attributes.length; ++i) {\n var attribute = attributes[i];\n\n if (attribute.isInterleavedBufferAttribute) {\n console.error(\n 'THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. InterleavedBufferAttributes are not supported.'\n );\n return null;\n }\n\n if (TypedArray === undefined) TypedArray = attribute.array.constructor;\n if (TypedArray !== attribute.array.constructor) {\n console.error(\n 'THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.array must be of consistent array types across matching attributes.'\n );\n return null;\n }\n\n if (itemSize === undefined) itemSize = attribute.itemSize;\n if (itemSize !== attribute.itemSize) {\n console.error(\n 'THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes.'\n );\n return null;\n }\n\n if (normalized === undefined) normalized = attribute.normalized;\n if (normalized !== attribute.normalized) {\n console.error(\n 'THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes.'\n );\n return null;\n }\n\n arrayLength += attribute.array.length;\n }\n\n var array = new TypedArray(arrayLength);\n var offset = 0;\n\n for (var i = 0; i < attributes.length; ++i) {\n array.set(attributes[i].array, offset);\n\n offset += attributes[i].array.length;\n }\n\n return new BufferAttribute(array, itemSize, normalized);\n },\n\n /**\n * @param {Array} attributes\n * @return {Array}\n */\n interleaveAttributes: function (attributes) {\n // Interleaves the provided attributes into an InterleavedBuffer and returns\n // a set of InterleavedBufferAttributes for each attribute\n var TypedArray;\n var arrayLength = 0;\n var stride = 0;\n\n // calculate the the length and type of the interleavedBuffer\n for (var i = 0, l = attributes.length; i < l; ++i) {\n var attribute = attributes[i];\n\n if (TypedArray === undefined) TypedArray = attribute.array.constructor;\n if (TypedArray !== attribute.array.constructor) {\n console.error('AttributeBuffers of different types cannot be interleaved');\n return null;\n }\n\n arrayLength += attribute.array.length;\n stride += attribute.itemSize;\n }\n\n // Create the set of buffer attributes\n var interleavedBuffer = new InterleavedBuffer(new TypedArray(arrayLength), stride);\n var offset = 0;\n var res = [];\n var getters = ['getX', 'getY', 'getZ', 'getW'];\n var setters = ['setX', 'setY', 'setZ', 'setW'];\n\n for (var j = 0, l = attributes.length; j < l; j++) {\n var attribute = attributes[j];\n var itemSize = attribute.itemSize;\n var count = attribute.count;\n var iba = new InterleavedBufferAttribute(\n interleavedBuffer,\n itemSize,\n offset,\n attribute.normalized\n );\n res.push(iba);\n\n offset += itemSize;\n\n // Move the data for each attribute into the new interleavedBuffer\n // at the appropriate offset\n for (var c = 0; c < count; c++) {\n for (var k = 0; k < itemSize; k++) {\n iba[setters[k]](c, attribute[getters[k]](c));\n }\n }\n }\n\n return res;\n },\n\n /**\n * @param {Array} geometry\n * @return {number}\n */\n estimateBytesUsed: function (geometry) {\n // Return the estimated memory used by this geometry in bytes\n // Calculate using itemSize, count, and BYTES_PER_ELEMENT to account\n // for InterleavedBufferAttributes.\n var mem = 0;\n for (var name in geometry.attributes) {\n var attr = geometry.getAttribute(name);\n mem += attr.count * attr.itemSize * attr.array.BYTES_PER_ELEMENT;\n }\n\n var indices = geometry.getIndex();\n mem += indices ? indices.count * indices.itemSize * indices.array.BYTES_PER_ELEMENT : 0;\n return mem;\n },\n\n /**\n * @param {BufferGeometry} geometry\n * @param {number} tolerance\n * @return {BufferGeometry>}\n */\n mergeVertices: function (geometry, tolerance = 1e-4) {\n tolerance = Math.max(tolerance, Number.EPSILON);\n\n // Generate an index buffer if the geometry doesn't have one, or optimize it\n // if it's already available.\n var hashToIndex = {};\n var indices = geometry.getIndex();\n var positions = geometry.getAttribute('position');\n var vertexCount = indices ? indices.count : positions.count;\n\n // next value for triangle indices\n var nextIndex = 0;\n\n // attributes and new attribute arrays\n var attributeNames = Object.keys(geometry.attributes);\n var attrArrays = {};\n var morphAttrsArrays = {};\n var newIndices = [];\n var getters = ['getX', 'getY', 'getZ', 'getW'];\n\n // initialize the arrays\n for (var i = 0, l = attributeNames.length; i < l; i++) {\n var name = attributeNames[i];\n\n attrArrays[name] = [];\n\n var morphAttr = geometry.morphAttributes[name];\n if (morphAttr) {\n morphAttrsArrays[name] = new Array(morphAttr.length).fill().map(() => []);\n }\n }\n\n // convert the error tolerance to an amount of decimal places to truncate to\n var decimalShift = Math.log10(1 / tolerance);\n var shiftMultiplier = Math.pow(10, decimalShift);\n for (var i = 0; i < vertexCount; i++) {\n var index = indices ? indices.getX(i) : i;\n\n // Generate a hash for the vertex attributes at the current index 'i'\n var hash = '';\n for (var j = 0, l = attributeNames.length; j < l; j++) {\n var name = attributeNames[j];\n var attribute = geometry.getAttribute(name);\n var itemSize = attribute.itemSize;\n\n for (var k = 0; k < itemSize; k++) {\n // double tilde truncates the decimal value\n hash += `${~~(attribute[getters[k]](index) * shiftMultiplier)},`;\n }\n }\n\n // Add another reference to the vertex if it's already\n // used by another index\n if (hash in hashToIndex) {\n newIndices.push(hashToIndex[hash]);\n } else {\n // copy data to the new index in the attribute arrays\n for (var j = 0, l = attributeNames.length; j < l; j++) {\n var name = attributeNames[j];\n var attribute = geometry.getAttribute(name);\n var morphAttr = geometry.morphAttributes[name];\n var itemSize = attribute.itemSize;\n var newarray = attrArrays[name];\n var newMorphArrays = morphAttrsArrays[name];\n\n for (var k = 0; k < itemSize; k++) {\n var getterFunc = getters[k];\n newarray.push(attribute[getterFunc](index));\n\n if (morphAttr) {\n for (var m = 0, ml = morphAttr.length; m < ml; m++) {\n newMorphArrays[m].push(morphAttr[m][getterFunc](index));\n }\n }\n }\n }\n\n hashToIndex[hash] = nextIndex;\n newIndices.push(nextIndex);\n nextIndex++;\n }\n }\n\n // Generate typed arrays from new attribute arrays and update\n // the attributeBuffers\n const result = geometry.clone();\n for (var i = 0, l = attributeNames.length; i < l; i++) {\n var name = attributeNames[i];\n var oldAttribute = geometry.getAttribute(name);\n\n var buffer = new oldAttribute.array.constructor(attrArrays[name]);\n var attribute = new BufferAttribute(buffer, oldAttribute.itemSize, oldAttribute.normalized);\n\n result.setAttribute(name, attribute);\n\n // Update the attribute arrays\n if (name in morphAttrsArrays) {\n for (var j = 0; j < morphAttrsArrays[name].length; j++) {\n var oldMorphAttribute = geometry.morphAttributes[name][j];\n\n var buffer = new oldMorphAttribute.array.constructor(morphAttrsArrays[name][j]);\n var morphAttribute = new BufferAttribute(\n buffer,\n oldMorphAttribute.itemSize,\n oldMorphAttribute.normalized\n );\n result.morphAttributes[name][j] = morphAttribute;\n }\n }\n }\n\n // indices\n\n result.setIndex(newIndices);\n\n return result;\n },\n\n /**\n * @param {BufferGeometry} geometry\n * @param {number} drawMode\n * @return {BufferGeometry>}\n */\n toTrianglesDrawMode: function (geometry, drawMode) {\n if (drawMode === TrianglesDrawMode) {\n console.warn(\n 'THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles.'\n );\n return geometry;\n }\n\n if (drawMode === TriangleFanDrawMode || drawMode === TriangleStripDrawMode) {\n var index = geometry.getIndex();\n\n // generate index if not present\n\n if (index === null) {\n var indices = [];\n\n var position = geometry.getAttribute('position');\n\n if (position !== undefined) {\n for (var i = 0; i < position.count; i++) {\n indices.push(i);\n }\n\n geometry.setIndex(indices);\n index = geometry.getIndex();\n } else {\n console.error(\n 'THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible.'\n );\n return geometry;\n }\n }\n\n //\n\n var numberOfTriangles = index.count - 2;\n var newIndices = [];\n\n if (drawMode === TriangleFanDrawMode) {\n // gl.TRIANGLE_FAN\n\n for (var i = 1; i <= numberOfTriangles; i++) {\n newIndices.push(index.getX(0));\n newIndices.push(index.getX(i));\n newIndices.push(index.getX(i + 1));\n }\n } else {\n // gl.TRIANGLE_STRIP\n\n for (var i = 0; i < numberOfTriangles; i++) {\n if (i % 2 === 0) {\n newIndices.push(index.getX(i));\n newIndices.push(index.getX(i + 1));\n newIndices.push(index.getX(i + 2));\n } else {\n newIndices.push(index.getX(i + 2));\n newIndices.push(index.getX(i + 1));\n newIndices.push(index.getX(i));\n }\n }\n }\n\n if (newIndices.length / 3 !== numberOfTriangles) {\n console.error(\n 'THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.'\n );\n }\n\n // build final geometry\n\n var newGeometry = geometry.clone();\n newGeometry.setIndex(newIndices);\n newGeometry.clearGroups();\n\n return newGeometry;\n }\n\n console.error('THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:', drawMode);\n return geometry;\n },\n};\n\nexport { BufferGeometryUtils };\n","/**\n * @author Rich Tibbett / https://github.com/richtr\n * @author mrdoob / http://mrdoob.com/\n * @author Tony Parisi / http://www.tonyparisi.com/\n * @author Takahiro / https://github.com/takahirox\n * @author Don McCurdy / https://www.donmccurdy.com\n */\n\nimport {\n AnimationClip,\n Bone,\n Box3,\n BufferAttribute,\n BufferGeometry,\n ClampToEdgeWrapping,\n Color,\n DirectionalLight,\n DoubleSide,\n FileLoader,\n FrontSide,\n Group,\n InterleavedBuffer,\n InterleavedBufferAttribute,\n Interpolant,\n InterpolateDiscrete,\n InterpolateLinear,\n Line,\n LineBasicMaterial,\n LineLoop,\n LineSegments,\n LinearFilter,\n LinearMipmapLinearFilter,\n LinearMipmapNearestFilter,\n Loader,\n LoaderUtils,\n Material,\n MathUtils,\n Matrix4,\n Mesh,\n MeshBasicMaterial,\n MeshPhysicalMaterial,\n MeshStandardMaterial,\n MirroredRepeatWrapping,\n NearestFilter,\n NearestMipmapLinearFilter,\n NearestMipmapNearestFilter,\n NumberKeyframeTrack,\n Object3D,\n OrthographicCamera,\n PerspectiveCamera,\n PointLight,\n Points,\n PointsMaterial,\n PropertyBinding,\n QuaternionKeyframeTrack,\n RGBAFormat,\n RGBFormat,\n RepeatWrapping,\n Skeleton,\n SkinnedMesh,\n Sphere,\n SpotLight,\n TangentSpaceNormalMap,\n TextureLoader,\n TriangleFanDrawMode,\n TriangleStripDrawMode,\n Vector2,\n Vector3,\n VectorKeyframeTrack,\n sRGBEncoding\n} from 'three';\n\nconst GLTFLoader = (function () {\n function GLTFLoader(manager) {\n Loader.call(this, manager);\n\n this.dracoLoader = null;\n this.ddsLoader = null;\n }\n\n GLTFLoader.prototype = Object.assign(Object.create(Loader.prototype), {\n constructor: GLTFLoader,\n\n load: function (url, onLoad, onProgress, onError) {\n var scope = this;\n\n var resourcePath;\n\n if (this.resourcePath !== '') {\n resourcePath = this.resourcePath;\n } else if (this.path !== '') {\n resourcePath = this.path;\n } else {\n resourcePath = LoaderUtils.extractUrlBase(url);\n }\n\n // Tells the LoadingManager to track an extra item, which resolves after\n // the model is fully loaded. This means the count of items loaded will\n // be incorrect, but ensures manager.onLoad() does not fire early.\n scope.manager.itemStart(url);\n\n var _onError = function (e) {\n if (onError) {\n onError(e);\n } else {\n console.error(e);\n }\n\n scope.manager.itemError(url);\n scope.manager.itemEnd(url);\n };\n\n var loader = new FileLoader(scope.manager);\n\n loader.setPath(this.path);\n loader.setResponseType('arraybuffer');\n\n if (scope.crossOrigin === 'use-credentials') {\n loader.setWithCredentials(true);\n }\n\n loader.load(\n url,\n function (data) {\n try {\n scope.parse(\n data,\n resourcePath,\n function (gltf) {\n onLoad(gltf);\n\n scope.manager.itemEnd(url);\n },\n _onError\n );\n } catch (e) {\n _onError(e);\n }\n },\n onProgress,\n _onError\n );\n },\n\n setDRACOLoader: function (dracoLoader) {\n this.dracoLoader = dracoLoader;\n return this;\n },\n\n setDDSLoader: function (ddsLoader) {\n this.ddsLoader = ddsLoader;\n return this;\n },\n\n parse: function (data, path, onLoad, onError) {\n var content;\n var extensions = {};\n\n if (typeof data === 'string') {\n content = data;\n } else {\n var magic = LoaderUtils.decodeText(new Uint8Array(data, 0, 4));\n\n if (magic === BINARY_EXTENSION_HEADER_MAGIC) {\n try {\n extensions[EXTENSIONS.KHR_BINARY_GLTF] = new GLTFBinaryExtension(data);\n } catch (error) {\n if (onError) onError(error);\n return;\n }\n\n content = extensions[EXTENSIONS.KHR_BINARY_GLTF].content;\n } else {\n content = LoaderUtils.decodeText(new Uint8Array(data));\n }\n }\n\n var json = JSON.parse(content);\n\n if (json.asset === undefined || json.asset.version[0] < 2) {\n if (onError)\n onError(\n new Error('THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported.')\n );\n return;\n }\n\n if (json.extensionsUsed) {\n for (var i = 0; i < json.extensionsUsed.length; ++i) {\n var extensionName = json.extensionsUsed[i];\n var extensionsRequired = json.extensionsRequired || [];\n\n switch (extensionName) {\n case EXTENSIONS.KHR_LIGHTS_PUNCTUAL:\n extensions[extensionName] = new GLTFLightsExtension(json);\n break;\n\n case EXTENSIONS.KHR_MATERIALS_CLEARCOAT:\n extensions[extensionName] = new GLTFMaterialsClearcoatExtension();\n break;\n\n case EXTENSIONS.KHR_MATERIALS_UNLIT:\n extensions[extensionName] = new GLTFMaterialsUnlitExtension();\n break;\n\n case EXTENSIONS.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS:\n extensions[extensionName] = new GLTFMaterialsPbrSpecularGlossinessExtension();\n break;\n\n case EXTENSIONS.KHR_DRACO_MESH_COMPRESSION:\n extensions[extensionName] = new GLTFDracoMeshCompressionExtension(\n json,\n this.dracoLoader\n );\n break;\n\n case EXTENSIONS.MSFT_TEXTURE_DDS:\n extensions[extensionName] = new GLTFTextureDDSExtension(this.ddsLoader);\n break;\n\n case EXTENSIONS.KHR_TEXTURE_TRANSFORM:\n extensions[extensionName] = new GLTFTextureTransformExtension();\n break;\n\n case EXTENSIONS.KHR_MESH_QUANTIZATION:\n extensions[extensionName] = new GLTFMeshQuantizationExtension();\n break;\n\n default:\n if (extensionsRequired.indexOf(extensionName) >= 0) {\n console.warn('THREE.GLTFLoader: Unknown extension \"' + extensionName + '\".');\n }\n }\n }\n }\n\n var parser = new GLTFParser(json, extensions, {\n path: path || this.resourcePath || '',\n crossOrigin: this.crossOrigin,\n manager: this.manager\n });\n\n parser.parse(onLoad, onError);\n },\n });\n\n /* GLTFREGISTRY */\n\n function GLTFRegistry() {\n var objects = {};\n\n return {\n get: function (key) {\n return objects[key];\n },\n\n add: function (key, object) {\n objects[key] = object;\n },\n\n remove: function (key) {\n delete objects[key];\n },\n\n removeAll: function () {\n objects = {};\n },\n };\n }\n\n /*********************************/\n /********** EXTENSIONS ***********/\n /*********************************/\n\n var EXTENSIONS = {\n KHR_BINARY_GLTF: 'KHR_binary_glTF',\n KHR_DRACO_MESH_COMPRESSION: 'KHR_draco_mesh_compression',\n KHR_LIGHTS_PUNCTUAL: 'KHR_lights_punctual',\n KHR_MATERIALS_CLEARCOAT: 'KHR_materials_clearcoat',\n KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS: 'KHR_materials_pbrSpecularGlossiness',\n KHR_MATERIALS_UNLIT: 'KHR_materials_unlit',\n KHR_TEXTURE_TRANSFORM: 'KHR_texture_transform',\n KHR_MESH_QUANTIZATION: 'KHR_mesh_quantization',\n MSFT_TEXTURE_DDS: 'MSFT_texture_dds'\n };\n\n /**\n * DDS Texture Extension\n *\n * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Vendor/MSFT_texture_dds\n *\n */\n function GLTFTextureDDSExtension(ddsLoader) {\n if (!ddsLoader) {\n throw new Error(\n 'THREE.GLTFLoader: Attempting to load .dds texture without importing DDSLoader'\n );\n }\n\n this.name = EXTENSIONS.MSFT_TEXTURE_DDS;\n this.ddsLoader = ddsLoader;\n }\n\n /**\n * Punctual Lights Extension\n *\n * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_lights_punctual\n */\n function GLTFLightsExtension(json) {\n this.name = EXTENSIONS.KHR_LIGHTS_PUNCTUAL;\n\n var extension = (json.extensions && json.extensions[EXTENSIONS.KHR_LIGHTS_PUNCTUAL]) || {};\n this.lightDefs = extension.lights || [];\n }\n\n GLTFLightsExtension.prototype.loadLight = function (lightIndex) {\n var lightDef = this.lightDefs[lightIndex];\n var lightNode;\n\n var color = new Color(0xffffff);\n if (lightDef.color !== undefined) color.fromArray(lightDef.color);\n\n var range = lightDef.range !== undefined ? lightDef.range : 0;\n\n switch (lightDef.type) {\n case 'directional':\n lightNode = new DirectionalLight(color);\n lightNode.target.position.set(0, 0, -1);\n lightNode.add(lightNode.target);\n break;\n\n case 'point':\n lightNode = new PointLight(color);\n lightNode.distance = range;\n break;\n\n case 'spot':\n lightNode = new SpotLight(color);\n lightNode.distance = range;\n // Handle spotlight properties.\n lightDef.spot = lightDef.spot || {};\n lightDef.spot.innerConeAngle =\n lightDef.spot.innerConeAngle !== undefined ? lightDef.spot.innerConeAngle : 0;\n lightDef.spot.outerConeAngle =\n lightDef.spot.outerConeAngle !== undefined ? lightDef.spot.outerConeAngle : Math.PI / 4.0;\n lightNode.angle = lightDef.spot.outerConeAngle;\n lightNode.penumbra = 1.0 - lightDef.spot.innerConeAngle / lightDef.spot.outerConeAngle;\n lightNode.target.position.set(0, 0, -1);\n lightNode.add(lightNode.target);\n break;\n\n default:\n throw new Error('THREE.GLTFLoader: Unexpected light type, \"' + lightDef.type + '\".');\n }\n\n // Some lights (e.g. spot) default to a position other than the origin. Reset the position\n // here, because node-level parsing will only override position if explicitly specified.\n lightNode.position.set(0, 0, 0);\n\n lightNode.decay = 2;\n\n if (lightDef.intensity !== undefined) lightNode.intensity = lightDef.intensity;\n\n lightNode.name = lightDef.name || 'light_' + lightIndex;\n\n return Promise.resolve(lightNode);\n };\n\n /**\n * Unlit Materials Extension\n *\n * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_unlit\n */\n function GLTFMaterialsUnlitExtension() {\n this.name = EXTENSIONS.KHR_MATERIALS_UNLIT;\n }\n\n GLTFMaterialsUnlitExtension.prototype.getMaterialType = function () {\n return MeshBasicMaterial;\n };\n\n GLTFMaterialsUnlitExtension.prototype.extendParams = function (\n materialParams,\n materialDef,\n parser\n ) {\n var pending = [];\n\n materialParams.color = new Color(1.0, 1.0, 1.0);\n materialParams.opacity = 1.0;\n\n var metallicRoughness = materialDef.pbrMetallicRoughness;\n\n if (metallicRoughness) {\n if (Array.isArray(metallicRoughness.baseColorFactor)) {\n var array = metallicRoughness.baseColorFactor;\n\n materialParams.color.fromArray(array);\n materialParams.opacity = array[3];\n }\n\n if (metallicRoughness.baseColorTexture !== undefined) {\n pending.push(\n parser.assignTexture(materialParams, 'map', metallicRoughness.baseColorTexture)\n );\n }\n }\n\n return Promise.all(pending);\n };\n\n /**\n * Clearcoat Materials Extension\n *\n * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_clearcoat\n */\n function GLTFMaterialsClearcoatExtension() {\n this.name = EXTENSIONS.KHR_MATERIALS_CLEARCOAT;\n }\n\n GLTFMaterialsClearcoatExtension.prototype.getMaterialType = function () {\n return MeshPhysicalMaterial;\n };\n\n GLTFMaterialsClearcoatExtension.prototype.extendParams = function (\n materialParams,\n materialDef,\n parser\n ) {\n var pending = [];\n\n var extension = materialDef.extensions[this.name];\n\n if (extension.clearcoatFactor !== undefined) {\n materialParams.clearcoat = extension.clearcoatFactor;\n }\n\n if (extension.clearcoatTexture !== undefined) {\n pending.push(\n parser.assignTexture(materialParams, 'clearcoatMap', extension.clearcoatTexture)\n );\n }\n\n if (extension.clearcoatRoughnessFactor !== undefined) {\n materialParams.clearcoatRoughness = extension.clearcoatRoughnessFactor;\n }\n\n if (extension.clearcoatRoughnessTexture !== undefined) {\n pending.push(\n parser.assignTexture(\n materialParams,\n 'clearcoatRoughnessMap',\n extension.clearcoatRoughnessTexture\n )\n );\n }\n\n if (extension.clearcoatNormalTexture !== undefined) {\n pending.push(\n parser.assignTexture(\n materialParams,\n 'clearcoatNormalMap',\n extension.clearcoatNormalTexture\n )\n );\n\n if (extension.clearcoatNormalTexture.scale !== undefined) {\n var scale = extension.clearcoatNormalTexture.scale;\n\n materialParams.clearcoatNormalScale = new Vector2(scale, scale);\n }\n }\n\n return Promise.all(pending);\n };\n\n /* BINARY EXTENSION */\n var BINARY_EXTENSION_HEADER_MAGIC = 'glTF';\n var BINARY_EXTENSION_HEADER_LENGTH = 12;\n var BINARY_EXTENSION_CHUNK_TYPES = { JSON: 0x4e4f534a, BIN: 0x004e4942 };\n\n function GLTFBinaryExtension(data) {\n this.name = EXTENSIONS.KHR_BINARY_GLTF;\n this.content = null;\n this.body = null;\n\n var headerView = new DataView(data, 0, BINARY_EXTENSION_HEADER_LENGTH);\n\n this.header = {\n magic: LoaderUtils.decodeText(new Uint8Array(data.slice(0, 4))),\n version: headerView.getUint32(4, true),\n length: headerView.getUint32(8, true)\n };\n\n if (this.header.magic !== BINARY_EXTENSION_HEADER_MAGIC) {\n throw new Error('THREE.GLTFLoader: Unsupported glTF-Binary header.');\n } else if (this.header.version < 2.0) {\n throw new Error('THREE.GLTFLoader: Legacy binary file detected.');\n }\n\n var chunkView = new DataView(data, BINARY_EXTENSION_HEADER_LENGTH);\n var chunkIndex = 0;\n\n while (chunkIndex < chunkView.byteLength) {\n var chunkLength = chunkView.getUint32(chunkIndex, true);\n chunkIndex += 4;\n\n var chunkType = chunkView.getUint32(chunkIndex, true);\n chunkIndex += 4;\n\n if (chunkType === BINARY_EXTENSION_CHUNK_TYPES.JSON) {\n var contentArray = new Uint8Array(\n data,\n BINARY_EXTENSION_HEADER_LENGTH + chunkIndex,\n chunkLength\n );\n this.content = LoaderUtils.decodeText(contentArray);\n } else if (chunkType === BINARY_EXTENSION_CHUNK_TYPES.BIN) {\n var byteOffset = BINARY_EXTENSION_HEADER_LENGTH + chunkIndex;\n this.body = data.slice(byteOffset, byteOffset + chunkLength);\n }\n\n // Clients must ignore chunks with unknown types.\n\n chunkIndex += chunkLength;\n }\n\n if (this.content === null) {\n throw new Error('THREE.GLTFLoader: JSON content not found.');\n }\n }\n\n /**\n * DRACO Mesh Compression Extension\n *\n * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_draco_mesh_compression\n */\n function GLTFDracoMeshCompressionExtension(json, dracoLoader) {\n if (!dracoLoader) {\n throw new Error('THREE.GLTFLoader: No DRACOLoader instance provided.');\n }\n\n this.name = EXTENSIONS.KHR_DRACO_MESH_COMPRESSION;\n this.json = json;\n this.dracoLoader = dracoLoader;\n this.dracoLoader.preload();\n }\n\n GLTFDracoMeshCompressionExtension.prototype.decodePrimitive = function (primitive, parser) {\n var json = this.json;\n var dracoLoader = this.dracoLoader;\n var bufferViewIndex = primitive.extensions[this.name].bufferView;\n var gltfAttributeMap = primitive.extensions[this.name].attributes;\n var threeAttributeMap = {};\n var attributeNormalizedMap = {};\n var attributeTypeMap = {};\n\n for (var attributeName in gltfAttributeMap) {\n var threeAttributeName = ATTRIBUTES[attributeName] || attributeName.toLowerCase();\n\n threeAttributeMap[threeAttributeName] = gltfAttributeMap[attributeName];\n }\n\n for (attributeName in primitive.attributes) {\n var threeAttributeName = ATTRIBUTES[attributeName] || attributeName.toLowerCase();\n\n if (gltfAttributeMap[attributeName] !== undefined) {\n var accessorDef = json.accessors[primitive.attributes[attributeName]];\n var componentType = WEBGL_COMPONENT_TYPES[accessorDef.componentType];\n\n attributeTypeMap[threeAttributeName] = componentType;\n attributeNormalizedMap[threeAttributeName] = accessorDef.normalized === true;\n }\n }\n\n return parser.getDependency('bufferView', bufferViewIndex).then(function (bufferView) {\n return new Promise(function (resolve) {\n dracoLoader.decodeDracoFile(\n bufferView,\n function (geometry) {\n for (var attributeName in geometry.attributes) {\n var attribute = geometry.attributes[attributeName];\n var normalized = attributeNormalizedMap[attributeName];\n\n if (normalized !== undefined) attribute.normalized = normalized;\n }\n\n resolve(geometry);\n },\n threeAttributeMap,\n attributeTypeMap\n );\n });\n });\n };\n\n /**\n * Texture Transform Extension\n *\n * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_texture_transform\n */\n function GLTFTextureTransformExtension() {\n this.name = EXTENSIONS.KHR_TEXTURE_TRANSFORM;\n }\n\n GLTFTextureTransformExtension.prototype.extendTexture = function (texture, transform) {\n texture = texture.clone();\n\n if (transform.offset !== undefined) {\n texture.offset.fromArray(transform.offset);\n }\n\n if (transform.rotation !== undefined) {\n texture.rotation = transform.rotation;\n }\n\n if (transform.scale !== undefined) {\n texture.repeat.fromArray(transform.scale);\n }\n\n if (transform.texCoord !== undefined) {\n console.warn(\n 'THREE.GLTFLoader: Custom UV sets in \"' + this.name + '\" extension not yet supported.'\n );\n }\n\n texture.needsUpdate = true;\n\n return texture;\n };\n\n /**\n * Specular-Glossiness Extension\n *\n * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_pbrSpecularGlossiness\n */\n\n /**\n * A sub class of StandardMaterial with some of the functionality\n * changed via the `onBeforeCompile` callback\n * @pailhead\n */\n\n function GLTFMeshStandardSGMaterial(params) {\n MeshStandardMaterial.call(this);\n\n this.isGLTFSpecularGlossinessMaterial = true;\n\n //various chunks that need replacing\n var specularMapParsFragmentChunk = [\n '#ifdef USE_SPECULARMAP',\n '\tuniform sampler2D specularMap;',\n '#endif',\n ].join('\\n');\n\n var glossinessMapParsFragmentChunk = [\n '#ifdef USE_GLOSSINESSMAP',\n '\tuniform sampler2D glossinessMap;',\n '#endif',\n ].join('\\n');\n\n var specularMapFragmentChunk = [\n 'vec3 specularFactor = specular;',\n '#ifdef USE_SPECULARMAP',\n '\tvec4 texelSpecular = texture2D( specularMap, vUv );',\n '\ttexelSpecular = sRGBToLinear( texelSpecular );',\n '\t// reads channel RGB, compatible with a glTF Specular-Glossiness (RGBA) texture',\n '\tspecularFactor *= texelSpecular.rgb;',\n '#endif',\n ].join('\\n');\n\n var glossinessMapFragmentChunk = [\n 'float glossinessFactor = glossiness;',\n '#ifdef USE_GLOSSINESSMAP',\n '\tvec4 texelGlossiness = texture2D( glossinessMap, vUv );',\n '\t// reads channel A, compatible with a glTF Specular-Glossiness (RGBA) texture',\n '\tglossinessFactor *= texelGlossiness.a;',\n '#endif',\n ].join('\\n');\n\n var lightPhysicalFragmentChunk = [\n 'PhysicalMaterial material;',\n 'material.diffuseColor = diffuseColor.rgb;',\n 'vec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );',\n 'float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );',\n 'material.specularRoughness = max( 1.0 - glossinessFactor, 0.0525 );// 0.0525 corresponds to the base mip of a 256 cubemap.',\n 'material.specularRoughness += geometryRoughness;',\n 'material.specularRoughness = min( material.specularRoughness, 1.0 );',\n 'material.specularColor = specularFactor.rgb;',\n ].join('\\n');\n\n var uniforms = {\n specular: { value: new Color().setHex(0xffffff) },\n glossiness: { value: 1 },\n specularMap: { value: null },\n glossinessMap: { value: null },\n };\n\n this._extraUniforms = uniforms;\n\n // please see #14031 or #13198 for an alternate approach\n this.onBeforeCompile = function (shader) {\n for (var uniformName in uniforms) {\n shader.uniforms[uniformName] = uniforms[uniformName];\n }\n\n shader.fragmentShader = shader.fragmentShader.replace(\n 'uniform float roughness;',\n 'uniform vec3 specular;'\n );\n shader.fragmentShader = shader.fragmentShader.replace(\n 'uniform float metalness;',\n 'uniform float glossiness;'\n );\n shader.fragmentShader = shader.fragmentShader.replace(\n '#include ',\n specularMapParsFragmentChunk\n );\n shader.fragmentShader = shader.fragmentShader.replace(\n '#include ',\n glossinessMapParsFragmentChunk\n );\n shader.fragmentShader = shader.fragmentShader.replace(\n '#include ',\n specularMapFragmentChunk\n );\n shader.fragmentShader = shader.fragmentShader.replace(\n '#include ',\n glossinessMapFragmentChunk\n );\n shader.fragmentShader = shader.fragmentShader.replace(\n '#include ',\n lightPhysicalFragmentChunk\n );\n };\n\n /*eslint-disable*/\n Object.defineProperties(this, {\n specular: {\n get: function () {\n return uniforms.specular.value;\n },\n set: function (v) {\n uniforms.specular.value = v;\n },\n },\n specularMap: {\n get: function () {\n return uniforms.specularMap.value;\n },\n set: function (v) {\n uniforms.specularMap.value = v;\n },\n },\n glossiness: {\n get: function () {\n return uniforms.glossiness.value;\n },\n set: function (v) {\n uniforms.glossiness.value = v;\n },\n },\n glossinessMap: {\n get: function () {\n return uniforms.glossinessMap.value;\n },\n set: function (v) {\n uniforms.glossinessMap.value = v;\n //how about something like this - @pailhead\n if (v) {\n this.defines.USE_GLOSSINESSMAP = '';\n // set USE_ROUGHNESSMAP to enable vUv\n this.defines.USE_ROUGHNESSMAP = '';\n } else {\n delete this.defines.USE_ROUGHNESSMAP;\n delete this.defines.USE_GLOSSINESSMAP;\n }\n },\n },\n });\n\n /*eslint-enable*/\n delete this.metalness;\n delete this.roughness;\n delete this.metalnessMap;\n delete this.roughnessMap;\n\n this.setValues(params);\n }\n\n GLTFMeshStandardSGMaterial.prototype = Object.create(MeshStandardMaterial.prototype);\n GLTFMeshStandardSGMaterial.prototype.constructor = GLTFMeshStandardSGMaterial;\n\n GLTFMeshStandardSGMaterial.prototype.copy = function (source) {\n MeshStandardMaterial.prototype.copy.call(this, source);\n this.specularMap = source.specularMap;\n this.specular.copy(source.specular);\n this.glossinessMap = source.glossinessMap;\n this.glossiness = source.glossiness;\n delete this.metalness;\n delete this.roughness;\n delete this.metalnessMap;\n delete this.roughnessMap;\n return this;\n };\n\n function GLTFMaterialsPbrSpecularGlossinessExtension() {\n return {\n name: EXTENSIONS.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS,\n\n specularGlossinessParams: [\n 'color',\n 'map',\n 'lightMap',\n 'lightMapIntensity',\n 'aoMap',\n 'aoMapIntensity',\n 'emissive',\n 'emissiveIntensity',\n 'emissiveMap',\n 'bumpMap',\n 'bumpScale',\n 'normalMap',\n 'normalMapType',\n 'displacementMap',\n 'displacementScale',\n 'displacementBias',\n 'specularMap',\n 'specular',\n 'glossinessMap',\n 'glossiness',\n 'alphaMap',\n 'envMap',\n 'envMapIntensity',\n 'refractionRatio',\n ],\n\n getMaterialType: function () {\n return GLTFMeshStandardSGMaterial;\n },\n\n extendParams: function (materialParams, materialDef, parser) {\n var pbrSpecularGlossiness = materialDef.extensions[this.name];\n\n materialParams.color = new Color(1.0, 1.0, 1.0);\n materialParams.opacity = 1.0;\n\n var pending = [];\n\n if (Array.isArray(pbrSpecularGlossiness.diffuseFactor)) {\n var array = pbrSpecularGlossiness.diffuseFactor;\n\n materialParams.color.fromArray(array);\n materialParams.opacity = array[3];\n }\n\n if (pbrSpecularGlossiness.diffuseTexture !== undefined) {\n pending.push(\n parser.assignTexture(materialParams, 'map', pbrSpecularGlossiness.diffuseTexture)\n );\n }\n\n materialParams.emissive = new Color(0.0, 0.0, 0.0);\n materialParams.glossiness =\n pbrSpecularGlossiness.glossinessFactor !== undefined\n ? pbrSpecularGlossiness.glossinessFactor\n : 1.0;\n materialParams.specular = new Color(1.0, 1.0, 1.0);\n\n if (Array.isArray(pbrSpecularGlossiness.specularFactor)) {\n materialParams.specular.fromArray(pbrSpecularGlossiness.specularFactor);\n }\n\n if (pbrSpecularGlossiness.specularGlossinessTexture !== undefined) {\n var specGlossMapDef = pbrSpecularGlossiness.specularGlossinessTexture;\n pending.push(parser.assignTexture(materialParams, 'glossinessMap', specGlossMapDef));\n pending.push(parser.assignTexture(materialParams, 'specularMap', specGlossMapDef));\n }\n\n return Promise.all(pending);\n },\n\n createMaterial: function (materialParams) {\n var material = new GLTFMeshStandardSGMaterial(materialParams);\n material.fog = true;\n\n material.color = materialParams.color;\n\n material.map = materialParams.map === undefined ? null : materialParams.map;\n\n material.lightMap = null;\n material.lightMapIntensity = 1.0;\n\n material.aoMap = materialParams.aoMap === undefined ? null : materialParams.aoMap;\n material.aoMapIntensity = 1.0;\n\n material.emissive = materialParams.emissive;\n material.emissiveIntensity = 1.0;\n material.emissiveMap =\n materialParams.emissiveMap === undefined ? null : materialParams.emissiveMap;\n\n material.bumpMap = materialParams.bumpMap === undefined ? null : materialParams.bumpMap;\n material.bumpScale = 1;\n\n material.normalMap =\n materialParams.normalMap === undefined ? null : materialParams.normalMap;\n material.normalMapType = TangentSpaceNormalMap;\n\n if (materialParams.normalScale) material.normalScale = materialParams.normalScale;\n\n material.displacementMap = null;\n material.displacementScale = 1;\n material.displacementBias = 0;\n\n material.specularMap =\n materialParams.specularMap === undefined ? null : materialParams.specularMap;\n material.specular = materialParams.specular;\n\n material.glossinessMap =\n materialParams.glossinessMap === undefined ? null : materialParams.glossinessMap;\n material.glossiness = materialParams.glossiness;\n\n material.alphaMap = null;\n\n material.envMap = materialParams.envMap === undefined ? null : materialParams.envMap;\n material.envMapIntensity = 1.0;\n\n material.refractionRatio = 0.98;\n\n return material;\n },\n };\n }\n\n /**\n * Mesh Quantization Extension\n *\n * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_mesh_quantization\n */\n function GLTFMeshQuantizationExtension() {\n this.name = EXTENSIONS.KHR_MESH_QUANTIZATION;\n }\n\n /*********************************/\n /********** INTERPOLATION ********/\n /*********************************/\n\n // Spline Interpolation\n // Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#appendix-c-spline-interpolation\n function GLTFCubicSplineInterpolant(parameterPositions, sampleValues, sampleSize, resultBuffer) {\n Interpolant.call(this, parameterPositions, sampleValues, sampleSize, resultBuffer);\n }\n\n GLTFCubicSplineInterpolant.prototype = Object.create(Interpolant.prototype);\n GLTFCubicSplineInterpolant.prototype.constructor = GLTFCubicSplineInterpolant;\n\n GLTFCubicSplineInterpolant.prototype.copySampleValue_ = function (index) {\n // Copies a sample value to the result buffer. See description of glTF\n // CUBICSPLINE values layout in interpolate_() function below.\n\n var result = this.resultBuffer,\n values = this.sampleValues,\n valueSize = this.valueSize,\n offset = index * valueSize * 3 + valueSize;\n\n for (var i = 0; i !== valueSize; i++) {\n result[i] = values[offset + i];\n }\n\n return result;\n };\n\n GLTFCubicSplineInterpolant.prototype.beforeStart_ =\n GLTFCubicSplineInterpolant.prototype.copySampleValue_;\n\n GLTFCubicSplineInterpolant.prototype.afterEnd_ =\n GLTFCubicSplineInterpolant.prototype.copySampleValue_;\n\n GLTFCubicSplineInterpolant.prototype.interpolate_ = function (i1, t0, t, t1) {\n var result = this.resultBuffer;\n var values = this.sampleValues;\n var stride = this.valueSize;\n\n var stride2 = stride * 2;\n var stride3 = stride * 3;\n\n var td = t1 - t0;\n\n var p = (t - t0) / td;\n var pp = p * p;\n var ppp = pp * p;\n\n var offset1 = i1 * stride3;\n var offset0 = offset1 - stride3;\n\n var s2 = -2 * ppp + 3 * pp;\n var s3 = ppp - pp;\n var s0 = 1 - s2;\n var s1 = s3 - pp + p;\n\n // Layout of keyframe output values for CUBICSPLINE animations:\n // [ inTangent_1, splineVertex_1, outTangent_1, inTangent_2, splineVertex_2, ... ]\n for (var i = 0; i !== stride; i++) {\n var p0 = values[offset0 + i + stride]; // splineVertex_k\n var m0 = values[offset0 + i + stride2] * td; // outTangent_k * (t_k+1 - t_k)\n var p1 = values[offset1 + i + stride]; // splineVertex_k+1\n var m1 = values[offset1 + i] * td; // inTangent_k+1 * (t_k+1 - t_k)\n\n result[i] = s0 * p0 + s1 * m0 + s2 * p1 + s3 * m1;\n }\n\n return result;\n };\n\n /*********************************/\n /********** INTERNALS ************/\n /*********************************/\n\n /* CONSTANTS */\n\n var WEBGL_CONSTANTS = {\n FLOAT: 5126,\n //FLOAT_MAT2: 35674,\n FLOAT_MAT3: 35675,\n FLOAT_MAT4: 35676,\n FLOAT_VEC2: 35664,\n FLOAT_VEC3: 35665,\n FLOAT_VEC4: 35666,\n LINEAR: 9729,\n REPEAT: 10497,\n SAMPLER_2D: 35678,\n POINTS: 0,\n LINES: 1,\n LINE_LOOP: 2,\n LINE_STRIP: 3,\n TRIANGLES: 4,\n TRIANGLE_STRIP: 5,\n TRIANGLE_FAN: 6,\n UNSIGNED_BYTE: 5121,\n UNSIGNED_SHORT: 5123,\n };\n\n var WEBGL_COMPONENT_TYPES = {\n 5120: Int8Array,\n 5121: Uint8Array,\n 5122: Int16Array,\n 5123: Uint16Array,\n 5125: Uint32Array,\n 5126: Float32Array,\n };\n\n var WEBGL_FILTERS = {\n 9728: NearestFilter,\n 9729: LinearFilter,\n 9984: NearestMipmapNearestFilter,\n 9985: LinearMipmapNearestFilter,\n 9986: NearestMipmapLinearFilter,\n 9987: LinearMipmapLinearFilter,\n };\n\n var WEBGL_WRAPPINGS = {\n 33071: ClampToEdgeWrapping,\n 33648: MirroredRepeatWrapping,\n 10497: RepeatWrapping,\n };\n\n var WEBGL_TYPE_SIZES = {\n SCALAR: 1,\n VEC2: 2,\n VEC3: 3,\n VEC4: 4,\n MAT2: 4,\n MAT3: 9,\n MAT4: 16,\n };\n\n var ATTRIBUTES = {\n POSITION: 'position',\n NORMAL: 'normal',\n TANGENT: 'tangent',\n TEXCOORD_0: 'uv',\n TEXCOORD_1: 'uv2',\n COLOR_0: 'color',\n WEIGHTS_0: 'skinWeight',\n JOINTS_0: 'skinIndex',\n };\n\n var PATH_PROPERTIES = {\n scale: 'scale',\n translation: 'position',\n rotation: 'quaternion',\n weights: 'morphTargetInfluences',\n };\n\n var INTERPOLATION = {\n CUBICSPLINE: undefined, // We use a custom interpolant (GLTFCubicSplineInterpolation) for CUBICSPLINE tracks. Each\n // keyframe track will be initialized with a default interpolation type, then modified.\n LINEAR: InterpolateLinear,\n STEP: InterpolateDiscrete,\n };\n\n var ALPHA_MODES = {\n OPAQUE: 'OPAQUE',\n MASK: 'MASK',\n BLEND: 'BLEND',\n };\n\n var MIME_TYPE_FORMATS = {\n 'image/png': RGBAFormat,\n 'image/jpeg': RGBFormat,\n };\n\n /* UTILITY FUNCTIONS */\n\n function resolveURL(url, path) {\n // Invalid URL\n if (typeof url !== 'string' || url === '') return '';\n\n // Host Relative URL\n if (/^https?:\\/\\//i.test(path) && /^\\//.test(url)) {\n // eslint-disable-next-line no-useless-escape\n path = path.replace(/(^https?:\\/\\/[^\\/]+).*/i, '$1');\n }\n\n // Absolute URL http://,https://,//\n if (/^(https?:)?\\/\\//i.test(url)) return url;\n\n // Data URI\n if (/^data:.*,.*$/i.test(url)) return url;\n\n // Blob URL\n if (/^blob:.*$/i.test(url)) return url;\n\n // Relative URL\n return path + url;\n }\n\n /**\n * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#default-material\n */\n function createDefaultMaterial(cache) {\n if (cache['DefaultMaterial'] === undefined) {\n cache['DefaultMaterial'] = new MeshStandardMaterial({\n color: 0xffffff,\n emissive: 0x000000,\n metalness: 1,\n roughness: 1,\n transparent: false,\n depthTest: true,\n side: FrontSide,\n });\n }\n\n return cache['DefaultMaterial'];\n }\n\n function addUnknownExtensionsToUserData(knownExtensions, object, objectDef) {\n // Add unknown glTF extensions to an object's userData.\n\n for (var name in objectDef.extensions) {\n if (knownExtensions[name] === undefined) {\n object.userData.gltfExtensions = object.userData.gltfExtensions || {};\n object.userData.gltfExtensions[name] = objectDef.extensions[name];\n }\n }\n }\n\n /**\n * @param {Object3D|Material|BufferGeometry} object\n * @param {GLTF.definition} gltfDef\n */\n function assignExtrasToUserData(object, gltfDef) {\n if (gltfDef.extras !== undefined) {\n if (typeof gltfDef.extras === 'object') {\n Object.assign(object.userData, gltfDef.extras);\n } else {\n console.warn('THREE.GLTFLoader: Ignoring primitive type .extras, ' + gltfDef.extras);\n }\n }\n }\n\n /**\n * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#morph-targets\n *\n * @param {BufferGeometry} geometry\n * @param {Array} targets\n * @param {GLTFParser} parser\n * @return {Promise}\n */\n function addMorphTargets(geometry, targets, parser) {\n var hasMorphPosition = false;\n var hasMorphNormal = false;\n\n for (var i = 0, il = targets.length; i < il; i++) {\n var target = targets[i];\n\n if (target.POSITION !== undefined) hasMorphPosition = true;\n if (target.NORMAL !== undefined) hasMorphNormal = true;\n\n if (hasMorphPosition && hasMorphNormal) break;\n }\n\n if (!hasMorphPosition && !hasMorphNormal) return Promise.resolve(geometry);\n\n var pendingPositionAccessors = [];\n var pendingNormalAccessors = [];\n\n for (var i = 0, il = targets.length; i < il; i++) {\n var target = targets[i];\n\n if (hasMorphPosition) {\n var pendingAccessor =\n target.POSITION !== undefined\n ? parser.getDependency('accessor', target.POSITION)\n : geometry.attributes.position;\n\n pendingPositionAccessors.push(pendingAccessor);\n }\n\n if (hasMorphNormal) {\n var pendingAccessor =\n target.NORMAL !== undefined\n ? parser.getDependency('accessor', target.NORMAL)\n : geometry.attributes.normal;\n\n pendingNormalAccessors.push(pendingAccessor);\n }\n }\n\n return Promise.all([\n Promise.all(pendingPositionAccessors),\n Promise.all(pendingNormalAccessors),\n ]).then(function (accessors) {\n var morphPositions = accessors[0];\n var morphNormals = accessors[1];\n\n if (hasMorphPosition) geometry.morphAttributes.position = morphPositions;\n if (hasMorphNormal) geometry.morphAttributes.normal = morphNormals;\n geometry.morphTargetsRelative = true;\n\n return geometry;\n });\n }\n\n /**\n * @param {Mesh} mesh\n * @param {GLTF.Mesh} meshDef\n */\n function updateMorphTargets(mesh, meshDef) {\n mesh.updateMorphTargets();\n\n if (meshDef.weights !== undefined) {\n for (var i = 0, il = meshDef.weights.length; i < il; i++) {\n mesh.morphTargetInfluences[i] = meshDef.weights[i];\n }\n }\n\n // .extras has user-defined data, so check that .extras.targetNames is an array.\n if (meshDef.extras && Array.isArray(meshDef.extras.targetNames)) {\n var targetNames = meshDef.extras.targetNames;\n\n if (mesh.morphTargetInfluences.length === targetNames.length) {\n mesh.morphTargetDictionary = {};\n\n for (var i = 0, il = targetNames.length; i < il; i++) {\n mesh.morphTargetDictionary[targetNames[i]] = i;\n }\n } else {\n console.warn('THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.');\n }\n }\n }\n\n function createPrimitiveKey(primitiveDef) {\n var dracoExtension =\n primitiveDef.extensions && primitiveDef.extensions[EXTENSIONS.KHR_DRACO_MESH_COMPRESSION];\n var geometryKey;\n\n if (dracoExtension) {\n geometryKey =\n 'draco:' +\n dracoExtension.bufferView +\n ':' +\n dracoExtension.indices +\n ':' +\n createAttributesKey(dracoExtension.attributes);\n } else {\n geometryKey =\n primitiveDef.indices +\n ':' +\n createAttributesKey(primitiveDef.attributes) +\n ':' +\n primitiveDef.mode;\n }\n\n return geometryKey;\n }\n\n function createAttributesKey(attributes) {\n var attributesKey = '';\n\n var keys = Object.keys(attributes).sort();\n\n for (var i = 0, il = keys.length; i < il; i++) {\n attributesKey += keys[i] + ':' + attributes[keys[i]] + ';';\n }\n\n return attributesKey;\n }\n\n /* GLTF PARSER */\n\n function GLTFParser(json, extensions, options) {\n this.json = json || {};\n this.extensions = extensions || {};\n this.options = options || {};\n\n // loader object cache\n this.cache = new GLTFRegistry();\n\n // BufferGeometry caching\n this.primitiveCache = {};\n\n this.textureLoader = new TextureLoader(this.options.manager);\n this.textureLoader.setCrossOrigin(this.options.crossOrigin);\n\n this.fileLoader = new FileLoader(this.options.manager);\n this.fileLoader.setResponseType('arraybuffer');\n\n if (this.options.crossOrigin === 'use-credentials') {\n this.fileLoader.setWithCredentials(true);\n }\n }\n\n GLTFParser.prototype.parse = function (onLoad, onError) {\n var parser = this;\n var json = this.json;\n var extensions = this.extensions;\n\n // Clear the loader cache\n this.cache.removeAll();\n\n // Mark the special nodes/meshes in json for efficient parse\n this.markDefs();\n\n Promise.all([\n this.getDependencies('scene'),\n this.getDependencies('animation'),\n this.getDependencies('camera'),\n ])\n .then(function (dependencies) {\n var result = {\n scene: dependencies[0][json.scene || 0],\n scenes: dependencies[0],\n animations: dependencies[1],\n cameras: dependencies[2],\n asset: json.asset,\n parser: parser,\n userData: {},\n };\n\n addUnknownExtensionsToUserData(extensions, result, json);\n\n assignExtrasToUserData(result, json);\n\n onLoad(result);\n })\n .catch(onError);\n };\n\n /**\n * Marks the special nodes/meshes in json for efficient parse.\n */\n GLTFParser.prototype.markDefs = function () {\n var nodeDefs = this.json.nodes || [];\n var skinDefs = this.json.skins || [];\n var meshDefs = this.json.meshes || [];\n\n var meshReferences = {};\n var meshUses = {};\n\n // Nothing in the node definition indicates whether it is a Bone or an\n // Object3D. Use the skins' joint references to mark bones.\n for (var skinIndex = 0, skinLength = skinDefs.length; skinIndex < skinLength; skinIndex++) {\n var joints = skinDefs[skinIndex].joints;\n\n for (var i = 0, il = joints.length; i < il; i++) {\n nodeDefs[joints[i]].isBone = true;\n }\n }\n\n // Meshes can (and should) be reused by multiple nodes in a glTF asset. To\n // avoid having more than one Mesh with the same name, count\n // references and rename instances below.\n //\n // Example: CesiumMilkTruck sample model reuses \"Wheel\" meshes.\n for (var nodeIndex = 0, nodeLength = nodeDefs.length; nodeIndex < nodeLength; nodeIndex++) {\n var nodeDef = nodeDefs[nodeIndex];\n\n if (nodeDef.mesh !== undefined) {\n if (meshReferences[nodeDef.mesh] === undefined) {\n meshReferences[nodeDef.mesh] = meshUses[nodeDef.mesh] = 0;\n }\n\n meshReferences[nodeDef.mesh]++;\n\n // Nothing in the mesh definition indicates whether it is\n // a SkinnedMesh or Mesh. Use the node's mesh reference\n // to mark SkinnedMesh if node has skin.\n if (nodeDef.skin !== undefined) {\n meshDefs[nodeDef.mesh].isSkinnedMesh = true;\n }\n }\n }\n\n this.json.meshReferences = meshReferences;\n this.json.meshUses = meshUses;\n };\n\n /**\n * Requests the specified dependency asynchronously, with caching.\n * @param {string} type\n * @param {number} index\n * @return {Promise}\n */\n GLTFParser.prototype.getDependency = function (type, index) {\n var cacheKey = type + ':' + index;\n var dependency = this.cache.get(cacheKey);\n\n if (!dependency) {\n switch (type) {\n case 'scene':\n dependency = this.loadScene(index);\n break;\n\n case 'node':\n dependency = this.loadNode(index);\n break;\n\n case 'mesh':\n dependency = this.loadMesh(index);\n break;\n\n case 'accessor':\n dependency = this.loadAccessor(index);\n break;\n\n case 'bufferView':\n dependency = this.loadBufferView(index);\n break;\n\n case 'buffer':\n dependency = this.loadBuffer(index);\n break;\n\n case 'material':\n dependency = this.loadMaterial(index);\n break;\n\n case 'texture':\n dependency = this.loadTexture(index);\n break;\n\n case 'skin':\n dependency = this.loadSkin(index);\n break;\n\n case 'animation':\n dependency = this.loadAnimation(index);\n break;\n\n case 'camera':\n dependency = this.loadCamera(index);\n break;\n\n case 'light':\n dependency = this.extensions[EXTENSIONS.KHR_LIGHTS_PUNCTUAL].loadLight(index);\n break;\n\n default:\n throw new Error('Unknown type: ' + type);\n }\n\n this.cache.add(cacheKey, dependency);\n }\n\n return dependency;\n };\n\n /**\n * Requests all dependencies of the specified type asynchronously, with caching.\n * @param {string} type\n * @return {Promise>}\n */\n GLTFParser.prototype.getDependencies = function (type) {\n var dependencies = this.cache.get(type);\n\n if (!dependencies) {\n var parser = this;\n var defs = this.json[type + (type === 'mesh' ? 'es' : 's')] || [];\n\n dependencies = Promise.all(\n defs.map(function (def, index) {\n return parser.getDependency(type, index);\n })\n );\n\n this.cache.add(type, dependencies);\n }\n\n return dependencies;\n };\n\n /**\n * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#buffers-and-buffer-views\n * @param {number} bufferIndex\n * @return {Promise}\n */\n GLTFParser.prototype.loadBuffer = function (bufferIndex) {\n var bufferDef = this.json.buffers[bufferIndex];\n var loader = this.fileLoader;\n\n if (bufferDef.type && bufferDef.type !== 'arraybuffer') {\n throw new Error('THREE.GLTFLoader: ' + bufferDef.type + ' buffer type is not supported.');\n }\n\n // If present, GLB container is required to be the first buffer.\n if (bufferDef.uri === undefined && bufferIndex === 0) {\n return Promise.resolve(this.extensions[EXTENSIONS.KHR_BINARY_GLTF].body);\n }\n\n var options = this.options;\n\n return new Promise(function (resolve, reject) {\n loader.load(resolveURL(bufferDef.uri, options.path), resolve, undefined, function () {\n reject(new Error('THREE.GLTFLoader: Failed to load buffer \"' + bufferDef.uri + '\".'));\n });\n });\n };\n\n /**\n * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#buffers-and-buffer-views\n * @param {number} bufferViewIndex\n * @return {Promise}\n */\n GLTFParser.prototype.loadBufferView = function (bufferViewIndex) {\n var bufferViewDef = this.json.bufferViews[bufferViewIndex];\n\n return this.getDependency('buffer', bufferViewDef.buffer).then(function (buffer) {\n var byteLength = bufferViewDef.byteLength || 0;\n var byteOffset = bufferViewDef.byteOffset || 0;\n return buffer.slice(byteOffset, byteOffset + byteLength);\n });\n };\n\n /**\n * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#accessors\n * @param {number} accessorIndex\n * @return {Promise}\n */\n GLTFParser.prototype.loadAccessor = function (accessorIndex) {\n var parser = this;\n var json = this.json;\n\n var accessorDef = this.json.accessors[accessorIndex];\n\n if (accessorDef.bufferView === undefined && accessorDef.sparse === undefined) {\n // Ignore empty accessors, which may be used to declare runtime\n // information about attributes coming from another source (e.g. Draco\n // compression extension).\n return Promise.resolve(null);\n }\n\n var pendingBufferViews = [];\n\n if (accessorDef.bufferView !== undefined) {\n pendingBufferViews.push(this.getDependency('bufferView', accessorDef.bufferView));\n } else {\n pendingBufferViews.push(null);\n }\n\n if (accessorDef.sparse !== undefined) {\n pendingBufferViews.push(\n this.getDependency('bufferView', accessorDef.sparse.indices.bufferView)\n );\n pendingBufferViews.push(\n this.getDependency('bufferView', accessorDef.sparse.values.bufferView)\n );\n }\n\n return Promise.all(pendingBufferViews).then(function (bufferViews) {\n var bufferView = bufferViews[0];\n\n var itemSize = WEBGL_TYPE_SIZES[accessorDef.type];\n var TypedArray = WEBGL_COMPONENT_TYPES[accessorDef.componentType];\n\n // For VEC3: itemSize is 3, elementBytes is 4, itemBytes is 12.\n var elementBytes = TypedArray.BYTES_PER_ELEMENT;\n var itemBytes = elementBytes * itemSize;\n var byteOffset = accessorDef.byteOffset || 0;\n var byteStride =\n accessorDef.bufferView !== undefined\n ? json.bufferViews[accessorDef.bufferView].byteStride\n : undefined;\n var normalized = accessorDef.normalized === true;\n var array, bufferAttribute;\n\n // The buffer is not interleaved if the stride is the item size in bytes.\n if (byteStride && byteStride !== itemBytes) {\n // Each \"slice\" of the buffer, as defined by 'count' elements of 'byteStride' bytes, gets its own InterleavedBuffer\n // This makes sure that IBA.count reflects accessor.count properly\n var ibSlice = Math.floor(byteOffset / byteStride);\n var ibCacheKey =\n 'InterleavedBuffer:' +\n accessorDef.bufferView +\n ':' +\n accessorDef.componentType +\n ':' +\n ibSlice +\n ':' +\n accessorDef.count;\n var ib = parser.cache.get(ibCacheKey);\n\n if (!ib) {\n array = new TypedArray(\n bufferView,\n ibSlice * byteStride,\n (accessorDef.count * byteStride) / elementBytes\n );\n\n // Integer parameters to IB/IBA are in array elements, not bytes.\n ib = new InterleavedBuffer(array, byteStride / elementBytes);\n\n parser.cache.add(ibCacheKey, ib);\n }\n\n bufferAttribute = new InterleavedBufferAttribute(\n ib,\n itemSize,\n (byteOffset % byteStride) / elementBytes,\n normalized\n );\n } else {\n if (bufferView === null) {\n array = new TypedArray(accessorDef.count * itemSize);\n } else {\n array = new TypedArray(bufferView, byteOffset, accessorDef.count * itemSize);\n }\n\n bufferAttribute = new BufferAttribute(array, itemSize, normalized);\n }\n\n // https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#sparse-accessors\n if (accessorDef.sparse !== undefined) {\n var itemSizeIndices = WEBGL_TYPE_SIZES.SCALAR;\n var TypedArrayIndices = WEBGL_COMPONENT_TYPES[accessorDef.sparse.indices.componentType];\n\n var byteOffsetIndices = accessorDef.sparse.indices.byteOffset || 0;\n var byteOffsetValues = accessorDef.sparse.values.byteOffset || 0;\n\n var sparseIndices = new TypedArrayIndices(\n bufferViews[1],\n byteOffsetIndices,\n accessorDef.sparse.count * itemSizeIndices\n );\n var sparseValues = new TypedArray(\n bufferViews[2],\n byteOffsetValues,\n accessorDef.sparse.count * itemSize\n );\n\n if (bufferView !== null) {\n // Avoid modifying the original ArrayBuffer, if the bufferView wasn't initialized with zeroes.\n bufferAttribute = new BufferAttribute(\n bufferAttribute.array.slice(),\n bufferAttribute.itemSize,\n bufferAttribute.normalized\n );\n }\n\n for (var i = 0, il = sparseIndices.length; i < il; i++) {\n var index = sparseIndices[i];\n\n bufferAttribute.setX(index, sparseValues[i * itemSize]);\n if (itemSize >= 2) bufferAttribute.setY(index, sparseValues[i * itemSize + 1]);\n if (itemSize >= 3) bufferAttribute.setZ(index, sparseValues[i * itemSize + 2]);\n if (itemSize >= 4) bufferAttribute.setW(index, sparseValues[i * itemSize + 3]);\n if (itemSize >= 5)\n throw new Error('THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.');\n }\n }\n\n return bufferAttribute;\n });\n };\n\n /**\n * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#textures\n * @param {number} textureIndex\n * @return {Promise}\n */\n GLTFParser.prototype.loadTexture = function (textureIndex) {\n var parser = this;\n var json = this.json;\n var options = this.options;\n var textureLoader = this.textureLoader;\n\n var URL = self.URL || self.webkitURL;\n\n var textureDef = json.textures[textureIndex];\n\n var textureExtensions = textureDef.extensions || {};\n\n var source;\n\n if (textureExtensions[EXTENSIONS.MSFT_TEXTURE_DDS]) {\n source = json.images[textureExtensions[EXTENSIONS.MSFT_TEXTURE_DDS].source];\n } else {\n source = json.images[textureDef.source];\n }\n\n var sourceURI = source.uri;\n var isObjectURL = false;\n\n if (source.bufferView !== undefined) {\n // Load binary image data from bufferView, if provided.\n\n sourceURI = parser.getDependency('bufferView', source.bufferView).then(function (bufferView) {\n isObjectURL = true;\n var blob = new Blob([bufferView], { type: source.mimeType });\n sourceURI = URL.createObjectURL(blob);\n return sourceURI;\n });\n }\n\n return Promise.resolve(sourceURI)\n .then(function (sourceURI) {\n // Load Texture resource.\n\n var loader = options.manager.getHandler(sourceURI);\n\n if (!loader) {\n loader = textureExtensions[EXTENSIONS.MSFT_TEXTURE_DDS]\n ? parser.extensions[EXTENSIONS.MSFT_TEXTURE_DDS].ddsLoader\n : textureLoader;\n }\n\n return new Promise(function (resolve, reject) {\n loader.load(resolveURL(sourceURI, options.path), resolve, undefined, reject);\n });\n })\n .then(function (texture) {\n // Clean up resources and configure Texture.\n\n if (isObjectURL === true) {\n URL.revokeObjectURL(sourceURI);\n }\n\n texture.flipY = false;\n\n if (textureDef.name) texture.name = textureDef.name;\n\n // Ignore unknown mime types, like DDS files.\n if (source.mimeType in MIME_TYPE_FORMATS) {\n texture.format = MIME_TYPE_FORMATS[source.mimeType];\n }\n\n var samplers = json.samplers || {};\n var sampler = samplers[textureDef.sampler] || {};\n\n texture.magFilter = WEBGL_FILTERS[sampler.magFilter] || LinearFilter;\n texture.minFilter = WEBGL_FILTERS[sampler.minFilter] || LinearMipmapLinearFilter;\n texture.wrapS = WEBGL_WRAPPINGS[sampler.wrapS] || RepeatWrapping;\n texture.wrapT = WEBGL_WRAPPINGS[sampler.wrapT] || RepeatWrapping;\n\n return texture;\n });\n };\n\n /**\n * Asynchronously assigns a texture to the given material parameters.\n * @param {Object} materialParams\n * @param {string} mapName\n * @param {Object} mapDef\n * @return {Promise}\n */\n GLTFParser.prototype.assignTexture = function (materialParams, mapName, mapDef) {\n var parser = this;\n\n return this.getDependency('texture', mapDef.index).then(function (texture) {\n if (!texture.isCompressedTexture) {\n switch (mapName) {\n case 'aoMap':\n case 'emissiveMap':\n case 'metalnessMap':\n case 'normalMap':\n case 'roughnessMap':\n texture.format = RGBFormat;\n break;\n }\n }\n\n // Materials sample aoMap from UV set 1 and other maps from UV set 0 - this can't be configured\n // However, we will copy UV set 0 to UV set 1 on demand for aoMap\n if (\n mapDef.texCoord !== undefined &&\n mapDef.texCoord != 0 &&\n !(mapName === 'aoMap' && mapDef.texCoord == 1)\n ) {\n console.warn(\n 'THREE.GLTFLoader: Custom UV set ' +\n mapDef.texCoord +\n ' for texture ' +\n mapName +\n ' not yet supported.'\n );\n }\n\n if (parser.extensions[EXTENSIONS.KHR_TEXTURE_TRANSFORM]) {\n var transform =\n mapDef.extensions !== undefined\n ? mapDef.extensions[EXTENSIONS.KHR_TEXTURE_TRANSFORM]\n : undefined;\n\n if (transform) {\n texture = parser.extensions[EXTENSIONS.KHR_TEXTURE_TRANSFORM].extendTexture(\n texture,\n transform\n );\n }\n }\n\n materialParams[mapName] = texture;\n });\n };\n\n /**\n * Assigns final material to a Mesh, Line, or Points instance. The instance\n * already has a material (generated from the glTF material options alone)\n * but reuse of the same glTF material may require multiple threejs materials\n * to accomodate different primitive types, defines, etc. New materials will\n * be created if necessary, and reused from a cache.\n * @param {Object3D} mesh Mesh, Line, or Points instance.\n */\n GLTFParser.prototype.assignFinalMaterial = function (mesh) {\n var geometry = mesh.geometry;\n var material = mesh.material;\n\n var useVertexTangents = geometry.attributes.tangent !== undefined;\n var useVertexColors = geometry.attributes.color !== undefined;\n var useFlatShading = geometry.attributes.normal === undefined;\n var useSkinning = mesh.isSkinnedMesh === true;\n var useMorphTargets = Object.keys(geometry.morphAttributes).length > 0;\n var useMorphNormals = useMorphTargets && geometry.morphAttributes.normal !== undefined;\n\n if (mesh.isPoints) {\n var cacheKey = 'PointsMaterial:' + material.uuid;\n\n var pointsMaterial = this.cache.get(cacheKey);\n\n if (!pointsMaterial) {\n pointsMaterial = new PointsMaterial();\n Material.prototype.copy.call(pointsMaterial, material);\n pointsMaterial.color.copy(material.color);\n pointsMaterial.map = material.map;\n pointsMaterial.sizeAttenuation = false; // glTF spec says points should be 1px\n\n this.cache.add(cacheKey, pointsMaterial);\n }\n\n material = pointsMaterial;\n } else if (mesh.isLine) {\n var cacheKey = 'LineBasicMaterial:' + material.uuid;\n\n var lineMaterial = this.cache.get(cacheKey);\n\n if (!lineMaterial) {\n lineMaterial = new LineBasicMaterial();\n Material.prototype.copy.call(lineMaterial, material);\n lineMaterial.color.copy(material.color);\n\n this.cache.add(cacheKey, lineMaterial);\n }\n\n material = lineMaterial;\n }\n\n // Clone the material if it will be modified\n if (useVertexTangents || useVertexColors || useFlatShading || useSkinning || useMorphTargets) {\n var cacheKey = 'ClonedMaterial:' + material.uuid + ':';\n\n if (material.isGLTFSpecularGlossinessMaterial) cacheKey += 'specular-glossiness:';\n if (useSkinning) cacheKey += 'skinning:';\n if (useVertexTangents) cacheKey += 'vertex-tangents:';\n if (useVertexColors) cacheKey += 'vertex-colors:';\n if (useFlatShading) cacheKey += 'flat-shading:';\n if (useMorphTargets) cacheKey += 'morph-targets:';\n if (useMorphNormals) cacheKey += 'morph-normals:';\n\n var cachedMaterial = this.cache.get(cacheKey);\n\n if (!cachedMaterial) {\n cachedMaterial = material.clone();\n\n if (useSkinning) cachedMaterial.skinning = true;\n if (useVertexTangents) cachedMaterial.vertexTangents = true;\n if (useVertexColors) cachedMaterial.vertexColors = true;\n if (useFlatShading) cachedMaterial.flatShading = true;\n if (useMorphTargets) cachedMaterial.morphTargets = true;\n if (useMorphNormals) cachedMaterial.morphNormals = true;\n\n this.cache.add(cacheKey, cachedMaterial);\n }\n\n material = cachedMaterial;\n }\n\n // workarounds for mesh and geometry\n\n if (\n material.aoMap &&\n geometry.attributes.uv2 === undefined &&\n geometry.attributes.uv !== undefined\n ) {\n geometry.setAttribute('uv2', geometry.attributes.uv);\n }\n\n // https://github.com/mrdoob/three.js/issues/11438#issuecomment-507003995\n if (material.normalScale && !useVertexTangents) {\n material.normalScale.y = -material.normalScale.y;\n }\n\n if (material.clearcoatNormalScale && !useVertexTangents) {\n material.clearcoatNormalScale.y = -material.clearcoatNormalScale.y;\n }\n\n mesh.material = material;\n };\n\n /**\n * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#materials\n * @param {number} materialIndex\n * @return {Promise}\n */\n GLTFParser.prototype.loadMaterial = function (materialIndex) {\n var parser = this;\n var json = this.json;\n var extensions = this.extensions;\n var materialDef = json.materials[materialIndex];\n\n var materialType;\n var materialParams = {};\n var materialExtensions = materialDef.extensions || {};\n\n var pending = [];\n\n if (materialExtensions[EXTENSIONS.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS]) {\n var sgExtension = extensions[EXTENSIONS.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS];\n materialType = sgExtension.getMaterialType();\n pending.push(sgExtension.extendParams(materialParams, materialDef, parser));\n } else if (materialExtensions[EXTENSIONS.KHR_MATERIALS_UNLIT]) {\n var kmuExtension = extensions[EXTENSIONS.KHR_MATERIALS_UNLIT];\n materialType = kmuExtension.getMaterialType();\n pending.push(kmuExtension.extendParams(materialParams, materialDef, parser));\n } else {\n // Specification:\n // https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#metallic-roughness-material\n\n materialType = MeshStandardMaterial;\n\n var metallicRoughness = materialDef.pbrMetallicRoughness || {};\n\n materialParams.color = new Color(1.0, 1.0, 1.0);\n materialParams.opacity = 1.0;\n\n if (Array.isArray(metallicRoughness.baseColorFactor)) {\n var array = metallicRoughness.baseColorFactor;\n\n materialParams.color.fromArray(array);\n materialParams.opacity = array[3];\n }\n\n if (metallicRoughness.baseColorTexture !== undefined) {\n pending.push(\n parser.assignTexture(materialParams, 'map', metallicRoughness.baseColorTexture)\n );\n }\n\n materialParams.metalness =\n metallicRoughness.metallicFactor !== undefined ? metallicRoughness.metallicFactor : 1.0;\n materialParams.roughness =\n metallicRoughness.roughnessFactor !== undefined ? metallicRoughness.roughnessFactor : 1.0;\n\n if (metallicRoughness.metallicRoughnessTexture !== undefined) {\n pending.push(\n parser.assignTexture(\n materialParams,\n 'metalnessMap',\n metallicRoughness.metallicRoughnessTexture\n )\n );\n pending.push(\n parser.assignTexture(\n materialParams,\n 'roughnessMap',\n metallicRoughness.metallicRoughnessTexture\n )\n );\n }\n }\n\n if (materialDef.doubleSided === true) {\n materialParams.side = DoubleSide;\n }\n\n var alphaMode = materialDef.alphaMode || ALPHA_MODES.OPAQUE;\n\n if (alphaMode === ALPHA_MODES.BLEND) {\n materialParams.transparent = true;\n\n // See: https://github.com/mrdoob/three.js/issues/17706\n materialParams.depthWrite = false;\n } else {\n materialParams.transparent = false;\n\n if (alphaMode === ALPHA_MODES.MASK) {\n materialParams.alphaTest =\n materialDef.alphaCutoff !== undefined ? materialDef.alphaCutoff : 0.5;\n }\n }\n\n if (materialDef.normalTexture !== undefined && materialType !== MeshBasicMaterial) {\n pending.push(parser.assignTexture(materialParams, 'normalMap', materialDef.normalTexture));\n\n materialParams.normalScale = new Vector2(1, 1);\n\n if (materialDef.normalTexture.scale !== undefined) {\n materialParams.normalScale.set(\n materialDef.normalTexture.scale,\n materialDef.normalTexture.scale\n );\n }\n }\n\n if (materialDef.occlusionTexture !== undefined && materialType !== MeshBasicMaterial) {\n pending.push(parser.assignTexture(materialParams, 'aoMap', materialDef.occlusionTexture));\n\n if (materialDef.occlusionTexture.strength !== undefined) {\n materialParams.aoMapIntensity = materialDef.occlusionTexture.strength;\n }\n }\n\n if (materialDef.emissiveFactor !== undefined && materialType !== MeshBasicMaterial) {\n materialParams.emissive = new Color().fromArray(materialDef.emissiveFactor);\n }\n\n if (materialDef.emissiveTexture !== undefined && materialType !== MeshBasicMaterial) {\n pending.push(\n parser.assignTexture(materialParams, 'emissiveMap', materialDef.emissiveTexture)\n );\n }\n\n if (materialExtensions[EXTENSIONS.KHR_MATERIALS_CLEARCOAT]) {\n var clearcoatExtension = extensions[EXTENSIONS.KHR_MATERIALS_CLEARCOAT];\n materialType = clearcoatExtension.getMaterialType();\n pending.push(\n clearcoatExtension.extendParams(materialParams, { extensions: materialExtensions }, parser)\n );\n }\n\n return Promise.all(pending).then(function () {\n var material;\n\n if (materialType === GLTFMeshStandardSGMaterial) {\n material = extensions[EXTENSIONS.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS].createMaterial(\n materialParams\n );\n } else {\n material = new materialType(materialParams);\n }\n\n if (materialDef.name) material.name = materialDef.name;\n\n // baseColorTexture, emissiveTexture, and specularGlossinessTexture use sRGB encoding.\n if (material.map) material.map.encoding = sRGBEncoding;\n if (material.emissiveMap) material.emissiveMap.encoding = sRGBEncoding;\n\n assignExtrasToUserData(material, materialDef);\n\n if (materialDef.extensions) addUnknownExtensionsToUserData(extensions, material, materialDef);\n\n return material;\n });\n };\n\n /**\n * @param {BufferGeometry} geometry\n * @param {GLTF.Primitive} primitiveDef\n * @param {GLTFParser} parser\n */\n function computeBounds(geometry, primitiveDef, parser) {\n var attributes = primitiveDef.attributes;\n\n var box = new Box3();\n\n if (attributes.POSITION !== undefined) {\n var accessor = parser.json.accessors[attributes.POSITION];\n\n var min = accessor.min;\n var max = accessor.max;\n\n // glTF requires 'min' and 'max', but VRM (which extends glTF) currently ignores that requirement.\n\n if (min !== undefined && max !== undefined) {\n box.set(new Vector3(min[0], min[1], min[2]), new Vector3(max[0], max[1], max[2]));\n } else {\n console.warn('THREE.GLTFLoader: Missing min/max properties for accessor POSITION.');\n\n return;\n }\n } else {\n return;\n }\n\n var targets = primitiveDef.targets;\n\n if (targets !== undefined) {\n var maxDisplacement = new Vector3();\n var vector = new Vector3();\n\n for (var i = 0, il = targets.length; i < il; i++) {\n var target = targets[i];\n\n if (target.POSITION !== undefined) {\n var accessor = parser.json.accessors[target.POSITION];\n var min = accessor.min;\n var max = accessor.max;\n\n // glTF requires 'min' and 'max', but VRM (which extends glTF) currently ignores that requirement.\n\n if (min !== undefined && max !== undefined) {\n // we need to get max of absolute components because target weight is [-1,1]\n vector.setX(Math.max(Math.abs(min[0]), Math.abs(max[0])));\n vector.setY(Math.max(Math.abs(min[1]), Math.abs(max[1])));\n vector.setZ(Math.max(Math.abs(min[2]), Math.abs(max[2])));\n\n // Note: this assumes that the sum of all weights is at most 1. This isn't quite correct - it's more conservative\n // to assume that each target can have a max weight of 1. However, for some use cases - notably, when morph targets\n // are used to implement key-frame animations and as such only two are active at a time - this results in very large\n // boxes. So for now we make a box that's sometimes a touch too small but is hopefully mostly of reasonable size.\n maxDisplacement.max(vector);\n } else {\n console.warn('THREE.GLTFLoader: Missing min/max properties for accessor POSITION.');\n }\n }\n }\n\n // As per comment above this box isn't conservative, but has a reasonable size for a very large number of morph targets.\n box.expandByVector(maxDisplacement);\n }\n\n geometry.boundingBox = box;\n\n var sphere = new Sphere();\n\n box.getCenter(sphere.center);\n sphere.radius = box.min.distanceTo(box.max) / 2;\n\n geometry.boundingSphere = sphere;\n }\n\n /**\n * @param {BufferGeometry} geometry\n * @param {GLTF.Primitive} primitiveDef\n * @param {GLTFParser} parser\n * @return {Promise}\n */\n function addPrimitiveAttributes(geometry, primitiveDef, parser) {\n var attributes = primitiveDef.attributes;\n\n var pending = [];\n\n function assignAttributeAccessor(accessorIndex, attributeName) {\n return parser.getDependency('accessor', accessorIndex).then(function (accessor) {\n geometry.setAttribute(attributeName, accessor);\n });\n }\n\n for (var gltfAttributeName in attributes) {\n var threeAttributeName = ATTRIBUTES[gltfAttributeName] || gltfAttributeName.toLowerCase();\n\n // Skip attributes already provided by e.g. Draco extension.\n if (threeAttributeName in geometry.attributes) continue;\n\n pending.push(assignAttributeAccessor(attributes[gltfAttributeName], threeAttributeName));\n }\n\n if (primitiveDef.indices !== undefined && !geometry.index) {\n var accessor = parser\n .getDependency('accessor', primitiveDef.indices)\n .then(function (accessor) {\n geometry.setIndex(accessor);\n });\n\n pending.push(accessor);\n }\n\n assignExtrasToUserData(geometry, primitiveDef);\n\n computeBounds(geometry, primitiveDef, parser);\n\n return Promise.all(pending).then(function () {\n return primitiveDef.targets !== undefined\n ? addMorphTargets(geometry, primitiveDef.targets, parser)\n : geometry;\n });\n }\n\n /**\n * @param {BufferGeometry} geometry\n * @param {Number} drawMode\n * @return {BufferGeometry}\n */\n function toTrianglesDrawMode(geometry, drawMode) {\n var index = geometry.getIndex();\n\n // generate index if not present\n\n if (index === null) {\n var indices = [];\n\n var position = geometry.getAttribute('position');\n\n if (position !== undefined) {\n for (var i = 0; i < position.count; i++) {\n indices.push(i);\n }\n\n geometry.setIndex(indices);\n index = geometry.getIndex();\n } else {\n console.error(\n 'THREE.GLTFLoader.toTrianglesDrawMode(): Undefined position attribute. Processing not possible.'\n );\n return geometry;\n }\n }\n\n //\n\n var numberOfTriangles = index.count - 2;\n var newIndices = [];\n\n if (drawMode === TriangleFanDrawMode) {\n // gl.TRIANGLE_FAN\n\n for (var i = 1; i <= numberOfTriangles; i++) {\n newIndices.push(index.getX(0));\n newIndices.push(index.getX(i));\n newIndices.push(index.getX(i + 1));\n }\n } else {\n // gl.TRIANGLE_STRIP\n\n for (var i = 0; i < numberOfTriangles; i++) {\n if (i % 2 === 0) {\n newIndices.push(index.getX(i));\n newIndices.push(index.getX(i + 1));\n newIndices.push(index.getX(i + 2));\n } else {\n newIndices.push(index.getX(i + 2));\n newIndices.push(index.getX(i + 1));\n newIndices.push(index.getX(i));\n }\n }\n }\n\n if (newIndices.length / 3 !== numberOfTriangles) {\n console.error(\n 'THREE.GLTFLoader.toTrianglesDrawMode(): Unable to generate correct amount of triangles.'\n );\n }\n\n // build final geometry\n\n var newGeometry = geometry.clone();\n newGeometry.setIndex(newIndices);\n\n return newGeometry;\n }\n\n /**\n * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#geometry\n *\n * Creates BufferGeometries from primitives.\n *\n * @param {Array} primitives\n * @return {Promise>}\n */\n GLTFParser.prototype.loadGeometries = function (primitives) {\n var parser = this;\n var extensions = this.extensions;\n var cache = this.primitiveCache;\n\n function createDracoPrimitive(primitive) {\n return extensions[EXTENSIONS.KHR_DRACO_MESH_COMPRESSION]\n .decodePrimitive(primitive, parser)\n .then(function (geometry) {\n return addPrimitiveAttributes(geometry, primitive, parser);\n });\n }\n\n var pending = [];\n\n for (var i = 0, il = primitives.length; i < il; i++) {\n var primitive = primitives[i];\n var cacheKey = createPrimitiveKey(primitive);\n\n // See if we've already created this geometry\n var cached = cache[cacheKey];\n\n if (cached) {\n // Use the cached geometry if it exists\n pending.push(cached.promise);\n } else {\n var geometryPromise;\n\n if (primitive.extensions && primitive.extensions[EXTENSIONS.KHR_DRACO_MESH_COMPRESSION]) {\n // Use DRACO geometry if available\n geometryPromise = createDracoPrimitive(primitive);\n } else {\n // Otherwise create a new geometry\n geometryPromise = addPrimitiveAttributes(new BufferGeometry(), primitive, parser);\n }\n\n // Cache this geometry\n cache[cacheKey] = { primitive: primitive, promise: geometryPromise };\n\n pending.push(geometryPromise);\n }\n }\n\n return Promise.all(pending);\n };\n\n /**\n * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#meshes\n * @param {number} meshIndex\n * @return {Promise}\n */\n GLTFParser.prototype.loadMesh = function (meshIndex) {\n var parser = this;\n var json = this.json;\n\n var meshDef = json.meshes[meshIndex];\n var primitives = meshDef.primitives;\n\n var pending = [];\n\n for (var i = 0, il = primitives.length; i < il; i++) {\n var material =\n primitives[i].material === undefined\n ? createDefaultMaterial(this.cache)\n : this.getDependency('material', primitives[i].material);\n\n pending.push(material);\n }\n\n pending.push(parser.loadGeometries(primitives));\n\n return Promise.all(pending).then(function (results) {\n var materials = results.slice(0, results.length - 1);\n var geometries = results[results.length - 1];\n\n var meshes = [];\n\n for (var i = 0, il = geometries.length; i < il; i++) {\n var geometry = geometries[i];\n var primitive = primitives[i];\n\n // 1. create Mesh\n\n var mesh;\n\n var material = materials[i];\n\n if (\n primitive.mode === WEBGL_CONSTANTS.TRIANGLES ||\n primitive.mode === WEBGL_CONSTANTS.TRIANGLE_STRIP ||\n primitive.mode === WEBGL_CONSTANTS.TRIANGLE_FAN ||\n primitive.mode === undefined\n ) {\n // .isSkinnedMesh isn't in glTF spec. See .markDefs()\n mesh =\n meshDef.isSkinnedMesh === true\n ? new SkinnedMesh(geometry, material)\n : new Mesh(geometry, material);\n\n if (mesh.isSkinnedMesh === true && !mesh.geometry.attributes.skinWeight.normalized) {\n // we normalize floating point skin weight array to fix malformed assets (see #15319)\n // it's important to skip this for non-float32 data since normalizeSkinWeights assumes non-normalized inputs\n mesh.normalizeSkinWeights();\n }\n\n if (primitive.mode === WEBGL_CONSTANTS.TRIANGLE_STRIP) {\n mesh.geometry = toTrianglesDrawMode(mesh.geometry, TriangleStripDrawMode);\n } else if (primitive.mode === WEBGL_CONSTANTS.TRIANGLE_FAN) {\n mesh.geometry = toTrianglesDrawMode(mesh.geometry, TriangleFanDrawMode);\n }\n } else if (primitive.mode === WEBGL_CONSTANTS.LINES) {\n mesh = new LineSegments(geometry, material);\n } else if (primitive.mode === WEBGL_CONSTANTS.LINE_STRIP) {\n mesh = new Line(geometry, material);\n } else if (primitive.mode === WEBGL_CONSTANTS.LINE_LOOP) {\n mesh = new LineLoop(geometry, material);\n } else if (primitive.mode === WEBGL_CONSTANTS.POINTS) {\n mesh = new Points(geometry, material);\n } else {\n throw new Error('THREE.GLTFLoader: Primitive mode unsupported: ' + primitive.mode);\n }\n\n if (Object.keys(mesh.geometry.morphAttributes).length > 0) {\n updateMorphTargets(mesh, meshDef);\n }\n\n mesh.name = meshDef.name || 'mesh_' + meshIndex;\n\n if (geometries.length > 1) mesh.name += '_' + i;\n\n assignExtrasToUserData(mesh, meshDef);\n\n parser.assignFinalMaterial(mesh);\n\n meshes.push(mesh);\n }\n\n if (meshes.length === 1) {\n return meshes[0];\n }\n\n var group = new Group();\n\n for (var i = 0, il = meshes.length; i < il; i++) {\n group.add(meshes[i]);\n }\n\n return group;\n });\n };\n\n /**\n * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#cameras\n * @param {number} cameraIndex\n * @return {Promise}\n */\n GLTFParser.prototype.loadCamera = function (cameraIndex) {\n var camera;\n var cameraDef = this.json.cameras[cameraIndex];\n var params = cameraDef[cameraDef.type];\n\n if (!params) {\n console.warn('THREE.GLTFLoader: Missing camera parameters.');\n return;\n }\n\n if (cameraDef.type === 'perspective') {\n camera = new PerspectiveCamera(\n MathUtils.radToDeg(params.yfov),\n params.aspectRatio || 1,\n params.znear || 1,\n params.zfar || 2e6\n );\n } else if (cameraDef.type === 'orthographic') {\n camera = new OrthographicCamera(\n -params.xmag,\n params.xmag,\n params.ymag,\n -params.ymag,\n params.znear,\n params.zfar\n );\n }\n\n if (cameraDef.name) camera.name = cameraDef.name;\n\n assignExtrasToUserData(camera, cameraDef);\n\n return Promise.resolve(camera);\n };\n\n /**\n * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#skins\n * @param {number} skinIndex\n * @return {Promise