ThreeJS-Webpack-ES6-Boilerp.../build/js/0.app.js

1 line
78 KiB
JavaScript

(window.webpackJsonp=window.webpackJsonp||[]).push([[0],[,,,,function(e,t){e.exports=function(e){var t=e.MOUSE;function n(t){this.object=t,this.target=new e.Vector3,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.25;var n,a,o,r,i,s,l,c,h=this,u=1e-6,d=0,p=0,m=1,f=new e.Vector3,g=!1;this.getPolarAngle=function(){return a},this.getAzimuthalAngle=function(){return n},this.rotateLeft=function(e){p-=e},this.rotateUp=function(e){d-=e},this.panLeft=(o=new e.Vector3,function(e){var t=this.object.matrix.elements;o.set(t[0],t[1],t[2]),o.multiplyScalar(-e),f.add(o)}),this.panUp=function(){var t=new e.Vector3;return function(e){var n=this.object.matrix.elements;t.set(n[4],n[5],n[6]),t.multiplyScalar(e),f.add(t)}}(),this.pan=function(t,n,a,o){if(h.object instanceof e.PerspectiveCamera){var r=h.object.position.clone().sub(h.target).length();r*=Math.tan(h.object.fov/2*Math.PI/180),h.panLeft(2*t*r/o),h.panUp(2*n*r/o)}else h.object instanceof e.OrthographicCamera?(h.panLeft(t*(h.object.right-h.object.left)/a),h.panUp(n*(h.object.top-h.object.bottom)/o)):console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled.")},this.dollyIn=function(t){h.object instanceof e.PerspectiveCamera?m/=t:h.object instanceof e.OrthographicCamera?(h.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom*t)),h.object.updateProjectionMatrix(),g=!0):console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled.")},this.dollyOut=function(t){h.object instanceof e.PerspectiveCamera?m*=t:h.object instanceof e.OrthographicCamera?(h.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/t)),h.object.updateProjectionMatrix(),g=!0):console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled.")},this.update=(r=new e.Vector3,i=(new e.Quaternion).setFromUnitVectors(t.up,new e.Vector3(0,1,0)),s=i.clone().inverse(),l=new e.Vector3,c=new e.Quaternion,function(){var e=this.object.position;r.copy(e).sub(this.target),r.applyQuaternion(i),n=Math.atan2(r.x,r.z),a=Math.atan2(Math.sqrt(r.x*r.x+r.z*r.z),r.y),n+=p,a+=d,n=Math.max(this.minAzimuthAngle,Math.min(this.maxAzimuthAngle,n)),a=Math.max(this.minPolarAngle,Math.min(this.maxPolarAngle,a)),a=Math.max(u,Math.min(Math.PI-u,a));var t=r.length()*m;return t=Math.max(this.minDistance,Math.min(this.maxDistance,t)),this.target.add(f),r.x=t*Math.sin(a)*Math.sin(n),r.y=t*Math.cos(a),r.z=t*Math.sin(a)*Math.cos(n),r.applyQuaternion(s),e.copy(this.target).add(r),this.object.lookAt(this.target),!0===this.enableDamping?(p*=1-this.dampingFactor,d*=1-this.dampingFactor):(p=0,d=0),m=1,f.set(0,0,0),!!(g||l.distanceToSquared(this.object.position)>u||8*(1-c.dot(this.object.quaternion))>u)&&(l.copy(this.object.position),c.copy(this.object.quaternion),g=!1,!0)})}function a(t,a){var o=new n(t);this.domElement=void 0!==a?a:document,Object.defineProperty(this,"constraint",{get:function(){return o}}),this.getPolarAngle=function(){return o.getPolarAngle()},this.getAzimuthalAngle=function(){return o.getAzimuthalAngle()},this.enabled=!0,this.center=this.target,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.enablePan=!0,this.keyPanSpeed=7,this.autoRotate=!1,this.autoRotateSpeed=2,this.enableKeys=!0,this.keys={LEFT:37,UP:38,RIGHT:39,BOTTOM:40},this.mouseButtons={ORBIT:e.MOUSE.LEFT,ZOOM:e.MOUSE.MIDDLE,PAN:e.MOUSE.RIGHT};var r=this,i=new e.Vector2,s=new e.Vector2,l=new e.Vector2,c=new e.Vector2,h=new e.Vector2,u=new e.Vector2,d=new e.Vector2,p=new e.Vector2,m=new e.Vector2,f=-1,g=0,v=1,b=2,y=3,w=4,L=5,M=f;this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom;var x={type:"change"},S={type:"start"},E={type:"end"};function T(e,t){var n=r.domElement===document?r.domElement.body:r.domElement;o.pan(e,t,n.clientWidth,n.clientHeight)}function R(){return Math.pow(.95,r.zoomSpeed)}function C(e){if(!1!==r.enabled){if(e.preventDefault(),e.button===r.mouseButtons.ORBIT){if(!1===r.enableRotate)return;M=g,i.set(e.clientX,e.clientY)}else if(e.button===r.mouseButtons.ZOOM){if(!1===r.enableZoom)return;M=v,d.set(e.clientX,e.clientY)}else if(e.button===r.mouseButtons.PAN){if(!1===r.enablePan)return;M=b,c.set(e.clientX,e.clientY)}M!==f&&(document.addEventListener("mousemove",A,!1),document.addEventListener("mouseup",P,!1),r.dispatchEvent(S))}}function A(e){if(!1!==r.enabled){e.preventDefault();var t=r.domElement===document?r.domElement.body:r.domElement;if(M===g){if(!1===r.enableRotate)return;s.set(e.clientX,e.clientY),l.subVectors(s,i),o.rotateLeft(2*Math.PI*l.x/t.clientWidth*r.rotateSpeed),o.rotateUp(2*Math.PI*l.y/t.clientHeight*r.rotateSpeed),i.copy(s)}else if(M===v){if(!1===r.enableZoom)return;p.set(e.clientX,e.clientY),m.subVectors(p,d),m.y>0?o.dollyIn(R()):m.y<0&&o.dollyOut(R()),d.copy(p)}else if(M===b){if(!1===r.enablePan)return;h.set(e.clientX,e.clientY),u.subVectors(h,c),T(u.x,u.y),c.copy(h)}M!==f&&r.update()}}function P(){!1!==r.enabled&&(document.removeEventListener("mousemove",A,!1),document.removeEventListener("mouseup",P,!1),r.dispatchEvent(E),M=f)}function F(e){if(!1!==r.enabled&&!1!==r.enableZoom&&M===f){e.preventDefault(),e.stopPropagation();var t=0;void 0!==e.wheelDelta?t=e.wheelDelta:void 0!==e.detail&&(t=-e.detail),t>0?o.dollyOut(R()):t<0&&o.dollyIn(R()),r.update(),r.dispatchEvent(S),r.dispatchEvent(E)}}function _(e){if(!1!==r.enabled&&!1!==r.enableKeys&&!1!==r.enablePan)switch(e.keyCode){case r.keys.UP:T(0,r.keyPanSpeed),r.update();break;case r.keys.BOTTOM:T(0,-r.keyPanSpeed),r.update();break;case r.keys.LEFT:T(r.keyPanSpeed,0),r.update();break;case r.keys.RIGHT:T(-r.keyPanSpeed,0),r.update()}}function O(e){if(!1!==r.enabled){switch(e.touches.length){case 1:if(!1===r.enableRotate)return;M=y,i.set(e.touches[0].pageX,e.touches[0].pageY);break;case 2:if(!1===r.enableZoom)return;M=w;var t=e.touches[0].pageX-e.touches[1].pageX,n=e.touches[0].pageY-e.touches[1].pageY,a=Math.sqrt(t*t+n*n);d.set(0,a);break;case 3:if(!1===r.enablePan)return;M=L,c.set(e.touches[0].pageX,e.touches[0].pageY);break;default:M=f}M!==f&&r.dispatchEvent(S)}}function k(e){if(!1!==r.enabled){e.preventDefault(),e.stopPropagation();var t=r.domElement===document?r.domElement.body:r.domElement;switch(e.touches.length){case 1:if(!1===r.enableRotate)return;if(M!==y)return;s.set(e.touches[0].pageX,e.touches[0].pageY),l.subVectors(s,i),o.rotateLeft(2*Math.PI*l.x/t.clientWidth*r.rotateSpeed),o.rotateUp(2*Math.PI*l.y/t.clientHeight*r.rotateSpeed),i.copy(s),r.update();break;case 2:if(!1===r.enableZoom)return;if(M!==w)return;var n=e.touches[0].pageX-e.touches[1].pageX,a=e.touches[0].pageY-e.touches[1].pageY,g=Math.sqrt(n*n+a*a);p.set(0,g),m.subVectors(p,d),m.y>0?o.dollyOut(R()):m.y<0&&o.dollyIn(R()),d.copy(p),r.update();break;case 3:if(!1===r.enablePan)return;if(M!==L)return;h.set(e.touches[0].pageX,e.touches[0].pageY),u.subVectors(h,c),T(u.x,u.y),c.copy(h),r.update();break;default:M=f}}}function H(){!1!==r.enabled&&(r.dispatchEvent(E),M=f)}function I(e){e.preventDefault()}this.update=function(){this.autoRotate&&M===f&&o.rotateLeft(2*Math.PI/60/60*r.autoRotateSpeed),!0===o.update()&&this.dispatchEvent(x)},this.reset=function(){M=f,this.target.copy(this.target0),this.object.position.copy(this.position0),this.object.zoom=this.zoom0,this.object.updateProjectionMatrix(),this.dispatchEvent(x),this.update()},this.dispose=function(){this.domElement.removeEventListener("contextmenu",I,!1),this.domElement.removeEventListener("mousedown",C,!1),this.domElement.removeEventListener("mousewheel",F,!1),this.domElement.removeEventListener("MozMousePixelScroll",F,!1),this.domElement.removeEventListener("touchstart",O,!1),this.domElement.removeEventListener("touchend",H,!1),this.domElement.removeEventListener("touchmove",k,!1),document.removeEventListener("mousemove",A,!1),document.removeEventListener("mouseup",P,!1),window.removeEventListener("keydown",_,!1)},this.domElement.addEventListener("contextmenu",I,!1),this.domElement.addEventListener("mousedown",C,!1),this.domElement.addEventListener("mousewheel",F,!1),this.domElement.addEventListener("MozMousePixelScroll",F,!1),this.domElement.addEventListener("touchstart",O,!1),this.domElement.addEventListener("touchend",H,!1),this.domElement.addEventListener("touchmove",k,!1),window.addEventListener("keydown",_,!1),this.update()}return t||(t={LEFT:0,MIDDLE:1,RIGHT:2}),a.prototype=Object.create(e.EventDispatcher.prototype),a.prototype.constructor=a,Object.defineProperties(a.prototype,{object:{get:function(){return this.constraint.object}},target:{get:function(){return this.constraint.target},set:function(e){console.warn("THREE.OrbitControls: target is now immutable. Use target.set() instead."),this.constraint.target.copy(e)}},minDistance:{get:function(){return this.constraint.minDistance},set:function(e){this.constraint.minDistance=e}},maxDistance:{get:function(){return this.constraint.maxDistance},set:function(e){this.constraint.maxDistance=e}},minZoom:{get:function(){return this.constraint.minZoom},set:function(e){this.constraint.minZoom=e}},maxZoom:{get:function(){return this.constraint.maxZoom},set:function(e){this.constraint.maxZoom=e}},minPolarAngle:{get:function(){return this.constraint.minPolarAngle},set:function(e){this.constraint.minPolarAngle=e}},maxPolarAngle:{get:function(){return this.constraint.maxPolarAngle},set:function(e){this.constraint.maxPolarAngle=e}},minAzimuthAngle:{get:function(){return this.constraint.minAzimuthAngle},set:function(e){this.constraint.minAzimuthAngle=e}},maxAzimuthAngle:{get:function(){return this.constraint.maxAzimuthAngle},set:function(e){this.constraint.maxAzimuthAngle=e}},enableDamping:{get:function(){return this.constraint.enableDamping},set:function(e){this.constraint.enableDamping=e}},dampingFactor:{get:function(){return this.constraint.dampingFactor},set:function(e){this.constraint.dampingFactor=e}},noZoom:{get:function(){return console.warn("THREE.OrbitControls: .noZoom has been deprecated. Use .enableZoom instead."),!this.enableZoom},set:function(e){console.warn("THREE.OrbitControls: .noZoom has been deprecated. Use .enableZoom instead."),this.enableZoom=!e}},noRotate:{get:function(){return console.warn("THREE.OrbitControls: .noRotate has been deprecated. Use .enableRotate instead."),!this.enableRotate},set:function(e){console.warn("THREE.OrbitControls: .noRotate has been deprecated. Use .enableRotate instead."),this.enableRotate=!e}},noPan:{get:function(){return console.warn("THREE.OrbitControls: .noPan has been deprecated. Use .enablePan instead."),!this.enablePan},set:function(e){console.warn("THREE.OrbitControls: .noPan has been deprecated. Use .enablePan instead."),this.enablePan=!e}},noKeys:{get:function(){return console.warn("THREE.OrbitControls: .noKeys has been deprecated. Use .enableKeys instead."),!this.enableKeys},set:function(e){console.warn("THREE.OrbitControls: .noKeys has been deprecated. Use .enableKeys instead."),this.enableKeys=!e}},staticMoving:{get:function(){return console.warn("THREE.OrbitControls: .staticMoving has been deprecated. Use .enableDamping instead."),!this.constraint.enableDamping},set:function(e){console.warn("THREE.OrbitControls: .staticMoving has been deprecated. Use .enableDamping instead."),this.constraint.enableDamping=!e}},dynamicDampingFactor:{get:function(){return console.warn("THREE.OrbitControls: .dynamicDampingFactor has been renamed. Use .dampingFactor instead."),this.constraint.dampingFactor},set:function(e){console.warn("THREE.OrbitControls: .dynamicDampingFactor has been renamed. Use .dampingFactor instead."),this.constraint.dampingFactor=e}}}),a}},function(e,t,n){e.exports=n(8)},,function(e,t,n){},function(e,t,n){"use strict";n.r(t);var a=n(1),o={isDev:!1,isShowingStats:!0,isLoaded:!1,isTweening:!1,isRotating:!0,isMouseMoving:!1,isMouseOver:!1,maxAnisotropy:1,dpr:1,easing:a.a.Easing.Quadratic.InOut,duration:500,model:{selected:0,initialTypes:["gltf","object"],type:"gltf"},models:[{path:"./assets/models/duck.gltf",scale:20,type:"gltf"},{path:"./assets/models/Teapot.json",scale:20,type:"object"}],texture:{path:"./assets/textures/",imageFiles:[{name:"UV",image:"UV_Grid_Sm.jpg"}]},mesh:{enableHelper:!0,wireframe:!1,translucent:!1,material:{color:16777215,emissive:16777215}},fog:{color:16777215,near:8e-4},camera:{fov:40,near:2,far:1e3,aspect:1,posX:0,posY:30,posZ:40},controls:{autoRotate:!0,autoRotateSpeed:-.5,rotateSpeed:.5,zoomSpeed:.8,minDistance:200,maxDistance:600,minPolarAngle:Math.PI/5,maxPolarAngle:Math.PI/2,minAzimuthAngle:-1/0,maxAzimuthAngle:1/0,enableDamping:!0,dampingFactor:.5,enableZoom:!0,target:{x:0,y:0,z:0}},ambientLight:{enabled:!0,color:1315860},directionalLight:{enabled:!0,color:15790320,intensity:.4,x:-75,y:280,z:150},shadow:{enabled:!0,helperEnabled:!0,bias:0,mapWidth:2048,mapHeight:2048,near:250,far:400,top:100,right:100,bottom:-100,left:-100},pointLight:{enabled:!0,color:16777215,intensity:.34,distance:115,x:0,y:0,z:0},hemiLight:{enabled:!0,color:13158600,groundColor:16777215,intensity:.55,x:0,y:0,z:0}},r={canvas:!!window.CanvasRenderingContext2D,webgl:function(){try{var e=document.createElement("canvas");return!(!window.WebGLRenderingContext||!e.getContext("webgl")&&!e.getContext("experimental-webgl"))}catch(e){return!1}}(),workers:!!window.Worker,fileapi:window.File&&window.FileReader&&window.FileList&&window.Blob,getWebGLErrorMessage:function(){var e=document.createElement("div");return e.id="webgl-error-message",e.style.fontFamily="monospace",e.style.fontSize="13px",e.style.fontWeight="normal",e.style.textAlign="center",e.style.background="#fff",e.style.color="#000",e.style.padding="1.5em",e.style.width="400px",e.style.margin="5em auto 0",this.webgl||(e.innerHTML=window.WebGLRenderingContext?['Your graphics card does not seem to support <a href="http://khronos.org/webgl/wiki/Getting_a_WebGL_Implementation" style="color:#000000">WebGL</a>.<br />','Find out how to get it <a href="http://get.webgl.org/" style="color:#000000">here</a>.'].join("\n"):['Your browser does not seem to support <a href="http://khronos.org/webgl/wiki/Getting_a_WebGL_Implementation" style="color:#000000">WebGL</a>.<br/>','Find out how to get it <a href="http://get.webgl.org/" style="color:#000000">here</a>.'].join("\n")),e},addGetWebGLMessage:function(e){var t,n,a;t=void 0!==(e=e||{}).parent?e.parent:document.body,n=void 0!==e.id?e.id:"oldie",(a=this.getWebGLErrorMessage()).id=n,t.appendChild(a)}},i=n(0);function s(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}var l=function(){function e(t,n){var a=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.scene=t,this.container=n,this.threeRenderer=new i.WebGLRenderer({antialias:!0}),this.threeRenderer.setClearColor(t.fog.color),this.threeRenderer.setPixelRatio(window.devicePixelRatio),n.appendChild(this.threeRenderer.domElement),this.threeRenderer.shadowMap.enabled=!0,this.threeRenderer.shadowMap.type=i.PCFSoftShadowMap,o.maxAnisotropy=this.threeRenderer.capabilities.getMaxAnisotropy(),this.updateSize(),document.addEventListener("DOMContentLoaded",(function(){return a.updateSize()}),!1),window.addEventListener("resize",(function(){return a.updateSize()}),!1)}var t,n,a;return t=e,(n=[{key:"updateSize",value:function(){this.threeRenderer.setSize(this.container.offsetWidth,this.container.offsetHeight)}},{key:"render",value:function(e,t){this.threeRenderer.render(e,t)}}])&&s(t.prototype,n),a&&s(t,a),e}();function c(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}var h=function(){function e(t){var n=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e);var a=t.domElement.width,r=t.domElement.height;this.threeCamera=new i.PerspectiveCamera(o.camera.fov,a/r,o.camera.near,o.camera.far),this.threeCamera.position.set(o.camera.posX,o.camera.posY,o.camera.posZ),this.updateSize(t),window.addEventListener("resize",(function(){return n.updateSize(t)}),!1)}var t,n,a;return t=e,(n=[{key:"updateSize",value:function(e){this.threeCamera.aspect=e.domElement.width/e.domElement.height,this.threeCamera.updateProjectionMatrix()}}])&&c(t.prototype,n),a&&c(t,a),e}();function u(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}var d=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.scene=t,this.init()}var t,n,a;return t=e,(n=[{key:"init",value:function(){this.ambientLight=new i.AmbientLight(o.ambientLight.color),this.ambientLight.visible=o.ambientLight.enabled,this.pointLight=new i.PointLight(o.pointLight.color,o.pointLight.intensity,o.pointLight.distance),this.pointLight.position.set(o.pointLight.x,o.pointLight.y,o.pointLight.z),this.pointLight.visible=o.pointLight.enabled,this.directionalLight=new i.DirectionalLight(o.directionalLight.color,o.directionalLight.intensity),this.directionalLight.position.set(o.directionalLight.x,o.directionalLight.y,o.directionalLight.z),this.directionalLight.visible=o.directionalLight.enabled,this.directionalLight.castShadow=o.shadow.enabled,this.directionalLight.shadow.bias=o.shadow.bias,this.directionalLight.shadow.camera.near=o.shadow.near,this.directionalLight.shadow.camera.far=o.shadow.far,this.directionalLight.shadow.camera.left=o.shadow.left,this.directionalLight.shadow.camera.right=o.shadow.right,this.directionalLight.shadow.camera.top=o.shadow.top,this.directionalLight.shadow.camera.bottom=o.shadow.bottom,this.directionalLight.shadow.mapSize.width=o.shadow.mapWidth,this.directionalLight.shadow.mapSize.height=o.shadow.mapHeight,this.directionalLightHelper=new i.CameraHelper(this.directionalLight.shadow.camera),this.directionalLightHelper.visible=o.shadow.helperEnabled,this.hemiLight=new i.HemisphereLight(o.hemiLight.color,o.hemiLight.groundColor,o.hemiLight.intensity),this.hemiLight.position.set(o.hemiLight.x,o.hemiLight.y,o.hemiLight.z),this.hemiLight.visible=o.hemiLight.enabled}},{key:"place",value:function(e){switch(e){case"ambient":this.scene.add(this.ambientLight);break;case"directional":this.scene.add(this.directionalLight),this.scene.add(this.directionalLightHelper);break;case"point":this.scene.add(this.pointLight);break;case"hemi":this.scene.add(this.hemiLight)}}}])&&u(t.prototype,n),a&&u(t,a),e}(),p=n(4),m=n.n(p);function f(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}var g=function(){function e(t,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e);var a=new m.a(i);this.threeControls=new a(t,n),this.init()}var t,n,a;return t=e,(n=[{key:"init",value:function(){this.threeControls.target.set(o.controls.target.x,o.controls.target.y,o.controls.target.z),this.threeControls.autoRotate=o.controls.autoRotate,this.threeControls.autoRotateSpeed=o.controls.autoRotateSpeed,this.threeControls.rotateSpeed=o.controls.rotateSpeed,this.threeControls.zoomSpeed=o.controls.zoomSpeed,this.threeControls.minDistance=o.controls.minDistance,this.threeControls.maxDistance=o.controls.maxDistance,this.threeControls.minPolarAngle=o.controls.minPolarAngle,this.threeControls.maxPolarAngle=o.controls.maxPolarAngle,this.threeControls.enableDamping=o.controls.enableDamping,this.threeControls.enableZoom=o.controls.enableZoom,this.threeControls.dampingFactor=o.controls.dampingFactor}}])&&f(t.prototype,n),a&&f(t,a),e}();var v=function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.basic=new i.MeshBasicMaterial({color:t,side:i.DoubleSide}),this.standard=new i.MeshStandardMaterial({color:t,shading:i.FlatShading,roughness:1,metalness:0,side:i.DoubleSide}),this.wire=new i.MeshBasicMaterial({wireframe:!0})};function b(e){return function(e){if(Array.isArray(e))return y(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return y(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return y(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function y(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,a=new Array(t);n<t;n++)a[n]=e[n];return a}function w(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}var L,M,x,S,E=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.scene=t,this.geo=null}var t,n,a;return t=e,(n=[{key:"make",value:function(e){var t=this;return"plane"===e?function(e,n){var a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;t.geo=new i.PlaneGeometry(e,n,a,o)}:"sphere"===e?function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:32,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:32;t.geo=new i.SphereGeometry(e,n,a)}:void 0}},{key:"place",value:function(e,t){var n,a,r=new v(15658734).standard,s=new i.Mesh(this.geo,r);(n=s.position).set.apply(n,b(e)),(a=s.rotation).set.apply(a,b(t)),o.shadow.enabled&&(s.receiveShadow=!0),this.scene.add(s)}}])&&w(t.prototype,n),a&&w(t,a),e}();function T(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}var R=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.renderer=t}var t,n,a;return t=e,a=[{key:"start",value:function(){L("frame").start(),x.start(),L("rAF").tick(),L("FPS").frame(),L("render").start()}},{key:"end",value:function(){L("render").end(),L("frame").end(),L("rStats").start(),L().update(),L("rStats").end()}}],(n=[{key:"setUp",value:function(){M=new BrowserStats,x=new glStats,S=new threeStats(this.renderer.threeRenderer),L=new rStats({CSSPath:"./css/",userTimingAPI:!0,values:{frame:{caption:"Total frame time (ms)",over:16,average:!0,avgMs:100},fps:{caption:"Framerate (FPS)",below:30},calls:{caption:"Calls (three.js)",over:3e3},raf:{caption:"Time since last rAF (ms)",average:!0,avgMs:100},rstats:{caption:"rStats update (ms)",average:!0,avgMs:100},texture:{caption:"GenTex",average:!0,avgMs:100}},groups:[{caption:"Framerate",values:["fps","raf"]},{caption:"Frame Budget",values:["frame","texture","setup","render"]}],fractions:[{base:"frame",steps:["texture","setup","render"]}],plugins:[M,S]})}}])&&T(t.prototype,n),a&&T(t,a),e}(),C=new i.Vector3,A=new i.Vector3,P=new i.Matrix3,F=["a","b","c"];function _(e,t,n){this.object=e,this.size=void 0!==t?t:.1;var a=void 0!==n?n:16711680,o=0,r=this.object.geometry;r&&r.isGeometry?o=3*r.faces.length:r&&r.isBufferGeometry&&(o=r.attributes.normal.count);var s=new i.BufferGeometry,l=new i.Float32BufferAttribute(2*o*3,3);s.setAttribute("position",l),i.LineSegments.call(this,s,new i.LineBasicMaterial({color:a,toneMapped:!1})),this.type="VertexNormalsHelper",this.matrixAutoUpdate=!1,this.update()}function O(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}_.prototype=Object.create(i.LineSegments.prototype),_.prototype.constructor=_,_.prototype.update=function(){var e;this.object.updateMatrixWorld(!0),P.getNormalMatrix(this.object.matrixWorld);var t=this.object.matrixWorld,n=this.geometry.attributes.position,a=this.object.geometry;if(a&&a.isGeometry){var o=a.vertices,r=a.faces;e=0;for(var i=0,s=r.length;i<s;i++)for(var l=r[i],c=0,h=l.vertexNormals.length;c<h;c++){var u=o[l[F[c]]],d=l.vertexNormals[c];C.copy(u).applyMatrix4(t),A.copy(d).applyMatrix3(P).normalize().multiplyScalar(this.size).add(C),n.setXYZ(e,C.x,C.y,C.z),e+=1,n.setXYZ(e,A.x,A.y,A.z),e+=1}}else if(a&&a.isBufferGeometry){var p=a.attributes.position,m=a.attributes.normal;e=0;for(var f=0,g=p.count;f<g;f++)C.set(p.getX(f),p.getY(f),p.getZ(f)).applyMatrix4(t),A.set(m.getX(f),m.getY(f),m.getZ(f)),A.applyMatrix3(P).normalize().multiplyScalar(this.size).add(C),n.setXYZ(e,C.x,C.y,C.z),e+=1,n.setXYZ(e,A.x,A.y,A.z),e+=1}n.needsUpdate=!0};var k=function(){function e(t,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.mesh=n,this.scene=t;var a=new i.WireframeGeometry(this.mesh.geometry);this.wireLine=new i.LineSegments(a),this.wireLine.material.depthTest=!1,this.wireLine.material.opacity=.25,this.wireLine.material.transparent=!0;var o=new i.EdgesGeometry(this.mesh.geometry);this.edgesLine=new i.LineSegments(o),this.edgesLine.material.depthTest=!1,this.edgesLine.material.opacity=.25,this.edgesLine.material.transparent=!0,this.vertexHelper=new _(this.mesh,2),this.boxHelper=new i.BoxHelper(this.mesh)}var t,n,a;return t=e,(n=[{key:"enable",value:function(){this.mesh.add(this.wireLine),this.mesh.add(this.edgesLine),this.scene.add(this.vertexHelper),this.scene.add(this.boxHelper)}},{key:"disable",value:function(){this.mesh.remove(this.wireLine),this.mesh.remove(this.edgesLine),this.scene.remove(this.vertexHelper),this.scene.remove(this.boxHelper)}}])&&O(t.prototype,n),a&&O(t,a),e}(),H=n(2);function I(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}var U=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}var t,n,a;return t=e,a=[{key:"throttle",value:function(e,t,n){var a,o;return t||(t=250),function(){var r=n||this,i=+new Date,s=arguments;a&&i<a+t?(clearTimeout(o),o=setTimeout((function(){a=i,e.apply(r,s)}),t)):(a=i,e.apply(r,s))}}},{key:"logProgress",value:function(){return function(e){if(e.lengthComputable){var t=e.loaded/e.total*100;console.log(Math.round(t,2)+"% downloaded")}}}},{key:"logError",value:function(){return function(e){console.error(e)}}},{key:"handleColorChange",value:function(e){return function(t){"string"==typeof t&&(t=t.replace("#","0x")),e.setHex(t)}}},{key:"update",value:function(e){this.needsUpdate(e.material,e.geometry)}},{key:"needsUpdate",value:function(e,t){return function(){e.shading=+e.shading,e.vertexColors=+e.vertexColors,e.side=+e.side,e.needsUpdate=!0,t.verticesNeedUpdate=!0,t.normalsNeedUpdate=!0,t.colorsNeedUpdate=!0}}},{key:"updateTexture",value:function(e,t,n){return function(a){e[t]=n[a],e.needsUpdate=!0}}}],(n=null)&&I(t.prototype,n),a&&I(t,a),e}();function D(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}var j=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.textures={}}var t,n,a;return t=e,(n=[{key:"load",value:function(){var e=this,t=new i.TextureLoader,n=o.maxAnisotropy,a=o.texture.imageFiles,r=[];return t.setPath(o.texture.path),a.forEach((function(e){r.push(new H.Promise((function(a,o){t.load(e.image,(function(t){t.anisotropy=n;var o={};o[e.name]=t,o[e.name]instanceof i.Texture&&a(o)}),U.logProgress(),(function(t){return o(new Error(t+"An error occurred loading while loading "+e.image))}))})))})),H.Promise.all(r).then((function(t){for(var n=0;n<t.length;n++)e.textures[Object.keys(t[n])[0]]=t[n][Object.keys(t[n])[0]]}),(function(e){return console.log(e)}))}}])&&D(t.prototype,n),a&&D(t,a),e}(),N=function(e){var t=e.index,n=e.attributes;if(null!==t&&void 0!==n.position&&void 0!==n.normal&&void 0!==n.uv){var a=t.array,o=n.position.array,r=n.normal.array,s=n.uv.array,l=o.length/3;void 0===n.tangent&&e.setAttribute("tangent",new i.BufferAttribute(new Float32Array(4*l),4));for(var c=n.tangent.array,h=[],u=[],d=0;d<l;d++)h[d]=new i.Vector3,u[d]=new i.Vector3;var p=new i.Vector3,m=new i.Vector3,f=new i.Vector3,g=new i.Vector2,v=new i.Vector2,b=new i.Vector2,y=new i.Vector3,w=new i.Vector3,L=e.groups;0===L.length&&(L=[{start:0,count:a.length}]);d=0;for(var M=L.length;d<M;++d)for(var x=O=(_=L[d]).start,S=O+_.count;x<S;x+=3)k(a[x+0],a[x+1],a[x+2]);var E,T,R,C=new i.Vector3,A=new i.Vector3,P=new i.Vector3,F=new i.Vector3;for(d=0,M=L.length;d<M;++d){var _,O;for(x=O=(_=L[d]).start,S=O+_.count;x<S;x+=3)H(a[x+0]),H(a[x+1]),H(a[x+2])}}else console.error("THREE.BufferGeometryUtils: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");function k(e,t,n){p.fromArray(o,3*e),m.fromArray(o,3*t),f.fromArray(o,3*n),g.fromArray(s,2*e),v.fromArray(s,2*t),b.fromArray(s,2*n),m.sub(p),f.sub(p),v.sub(g),b.sub(g);var a=1/(v.x*b.y-b.x*v.y);isFinite(a)&&(y.copy(m).multiplyScalar(b.y).addScaledVector(f,-v.y).multiplyScalar(a),w.copy(f).multiplyScalar(v.x).addScaledVector(m,-b.x).multiplyScalar(a),h[e].add(y),h[t].add(y),h[n].add(y),u[e].add(w),u[t].add(w),u[n].add(w))}function H(e){P.fromArray(r,3*e),F.copy(P),T=h[e],C.copy(T),C.sub(P.multiplyScalar(P.dot(T))).normalize(),A.crossVectors(F,T),R=A.dot(u[e]),E=R<0?-1:1,c[4*e]=C.x,c[4*e+1]=C.y,c[4*e+2]=C.z,c[4*e+3]=E}};function G(e){return(G="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var z=function(){function e(e){i.Loader.call(this,e),this.dracoLoader=null,this.ddsLoader=null}function t(){var e={};return{get:function(t){return e[t]},add:function(t,n){e[t]=n},remove:function(t){delete e[t]},removeAll:function(){e={}}}}e.prototype=Object.assign(Object.create(i.Loader.prototype),{constructor:e,load:function(e,t,n,a){var o,r=this;o=""!==this.resourcePath?this.resourcePath:""!==this.path?this.path:i.LoaderUtils.extractUrlBase(e),r.manager.itemStart(e);var s=function(t){a?a(t):console.error(t),r.manager.itemError(e),r.manager.itemEnd(e)},l=new i.FileLoader(r.manager);l.setPath(this.path),l.setResponseType("arraybuffer"),"use-credentials"===r.crossOrigin&&l.setWithCredentials(!0),l.load(e,(function(n){try{r.parse(n,o,(function(n){t(n),r.manager.itemEnd(e)}),s)}catch(e){s(e)}}),n,s)},setDRACOLoader:function(e){return this.dracoLoader=e,this},setDDSLoader:function(e){return this.ddsLoader=e,this},parse:function(e,t,c,h){var m,v={};if("string"==typeof e)m=e;else if(i.LoaderUtils.decodeText(new Uint8Array(e,0,4))===l){try{v[n.KHR_BINARY_GLTF]=new u(e)}catch(e){return void(h&&h(e))}m=v[n.KHR_BINARY_GLTF].content}else m=i.LoaderUtils.decodeText(new Uint8Array(e));var b=JSON.parse(m);if(void 0===b.asset||b.asset.version[0]<2)h&&h(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));else{if(b.extensionsUsed)for(var y=0;y<b.extensionsUsed.length;++y){var w=b.extensionsUsed[y],L=b.extensionsRequired||[];switch(w){case n.KHR_LIGHTS_PUNCTUAL:v[w]=new o(b);break;case n.KHR_MATERIALS_CLEARCOAT:v[w]=new s;break;case n.KHR_MATERIALS_UNLIT:v[w]=new r;break;case n.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS:v[w]=new f;break;case n.KHR_DRACO_MESH_COMPRESSION:v[w]=new d(b,this.dracoLoader);break;case n.MSFT_TEXTURE_DDS:v[w]=new a(this.ddsLoader);break;case n.KHR_TEXTURE_TRANSFORM:v[w]=new p;break;case n.KHR_MESH_QUANTIZATION:v[w]=new g;break;default:L.indexOf(w)>=0&&console.warn('THREE.GLTFLoader: Unknown extension "'+w+'".')}}new z(b,v,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,manager:this.manager}).parse(c,h)}}});var n={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS:"KHR_materials_pbrSpecularGlossiness",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",MSFT_TEXTURE_DDS:"MSFT_texture_dds"};function a(e){if(!e)throw new Error("THREE.GLTFLoader: Attempting to load .dds texture without importing DDSLoader");this.name=n.MSFT_TEXTURE_DDS,this.ddsLoader=e}function o(e){this.name=n.KHR_LIGHTS_PUNCTUAL;var t=e.extensions&&e.extensions[n.KHR_LIGHTS_PUNCTUAL]||{};this.lightDefs=t.lights||[]}function r(){this.name=n.KHR_MATERIALS_UNLIT}function s(){this.name=n.KHR_MATERIALS_CLEARCOAT}o.prototype.loadLight=function(e){var t,n=this.lightDefs[e],a=new i.Color(16777215);void 0!==n.color&&a.fromArray(n.color);var o=void 0!==n.range?n.range:0;switch(n.type){case"directional":(t=new i.DirectionalLight(a)).target.position.set(0,0,-1),t.add(t.target);break;case"point":(t=new i.PointLight(a)).distance=o;break;case"spot":(t=new i.SpotLight(a)).distance=o,n.spot=n.spot||{},n.spot.innerConeAngle=void 0!==n.spot.innerConeAngle?n.spot.innerConeAngle:0,n.spot.outerConeAngle=void 0!==n.spot.outerConeAngle?n.spot.outerConeAngle:Math.PI/4,t.angle=n.spot.outerConeAngle,t.penumbra=1-n.spot.innerConeAngle/n.spot.outerConeAngle,t.target.position.set(0,0,-1),t.add(t.target);break;default:throw new Error('THREE.GLTFLoader: Unexpected light type, "'+n.type+'".')}return t.position.set(0,0,0),t.decay=2,void 0!==n.intensity&&(t.intensity=n.intensity),t.name=n.name||"light_"+e,Promise.resolve(t)},r.prototype.getMaterialType=function(){return i.MeshBasicMaterial},r.prototype.extendParams=function(e,t,n){var a=[];e.color=new i.Color(1,1,1),e.opacity=1;var o=t.pbrMetallicRoughness;if(o){if(Array.isArray(o.baseColorFactor)){var r=o.baseColorFactor;e.color.fromArray(r),e.opacity=r[3]}void 0!==o.baseColorTexture&&a.push(n.assignTexture(e,"map",o.baseColorTexture))}return Promise.all(a)},s.prototype.getMaterialType=function(){return i.MeshPhysicalMaterial},s.prototype.extendParams=function(e,t,n){var a=[],o=t.extensions[this.name];if(void 0!==o.clearcoatFactor&&(e.clearcoat=o.clearcoatFactor),void 0!==o.clearcoatTexture&&a.push(n.assignTexture(e,"clearcoatMap",o.clearcoatTexture)),void 0!==o.clearcoatRoughnessFactor&&(e.clearcoatRoughness=o.clearcoatRoughnessFactor),void 0!==o.clearcoatRoughnessTexture&&a.push(n.assignTexture(e,"clearcoatRoughnessMap",o.clearcoatRoughnessTexture)),void 0!==o.clearcoatNormalTexture&&(a.push(n.assignTexture(e,"clearcoatNormalMap",o.clearcoatNormalTexture)),void 0!==o.clearcoatNormalTexture.scale)){var r=o.clearcoatNormalTexture.scale;e.clearcoatNormalScale=new i.Vector2(r,r)}return Promise.all(a)};var l="glTF",c=1313821514,h=5130562;function u(e){this.name=n.KHR_BINARY_GLTF,this.content=null,this.body=null;var t=new DataView(e,0,12);if(this.header={magic:i.LoaderUtils.decodeText(new Uint8Array(e.slice(0,4))),version:t.getUint32(4,!0),length:t.getUint32(8,!0)},this.header.magic!==l)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");for(var a=new DataView(e,12),o=0;o<a.byteLength;){var r=a.getUint32(o,!0);o+=4;var s=a.getUint32(o,!0);if(o+=4,s===c){var u=new Uint8Array(e,12+o,r);this.content=i.LoaderUtils.decodeText(u)}else if(s===h){var d=12+o;this.body=e.slice(d,d+r)}o+=r}if(null===this.content)throw new Error("THREE.GLTFLoader: JSON content not found.")}function d(e,t){if(!t)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=n.KHR_DRACO_MESH_COMPRESSION,this.json=e,this.dracoLoader=t,this.dracoLoader.preload()}function p(){this.name=n.KHR_TEXTURE_TRANSFORM}function m(e){i.MeshStandardMaterial.call(this),this.isGLTFSpecularGlossinessMaterial=!0;var t=["#ifdef USE_SPECULARMAP","\tuniform sampler2D specularMap;","#endif"].join("\n"),n=["#ifdef USE_GLOSSINESSMAP","\tuniform sampler2D glossinessMap;","#endif"].join("\n"),a=["vec3 specularFactor = specular;","#ifdef USE_SPECULARMAP","\tvec4 texelSpecular = texture2D( specularMap, vUv );","\ttexelSpecular = sRGBToLinear( texelSpecular );","\t// reads channel RGB, compatible with a glTF Specular-Glossiness (RGBA) texture","\tspecularFactor *= texelSpecular.rgb;","#endif"].join("\n"),o=["float glossinessFactor = glossiness;","#ifdef USE_GLOSSINESSMAP","\tvec4 texelGlossiness = texture2D( glossinessMap, vUv );","\t// reads channel A, compatible with a glTF Specular-Glossiness (RGBA) texture","\tglossinessFactor *= texelGlossiness.a;","#endif"].join("\n"),r=["PhysicalMaterial material;","material.diffuseColor = diffuseColor.rgb;","vec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );","float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );","material.specularRoughness = max( 1.0 - glossinessFactor, 0.0525 );// 0.0525 corresponds to the base mip of a 256 cubemap.","material.specularRoughness += geometryRoughness;","material.specularRoughness = min( material.specularRoughness, 1.0 );","material.specularColor = specularFactor.rgb;"].join("\n"),s={specular:{value:(new i.Color).setHex(16777215)},glossiness:{value:1},specularMap:{value:null},glossinessMap:{value:null}};this._extraUniforms=s,this.onBeforeCompile=function(e){for(var i in s)e.uniforms[i]=s[i];e.fragmentShader=e.fragmentShader.replace("uniform float roughness;","uniform vec3 specular;"),e.fragmentShader=e.fragmentShader.replace("uniform float metalness;","uniform float glossiness;"),e.fragmentShader=e.fragmentShader.replace("#include <roughnessmap_pars_fragment>",t),e.fragmentShader=e.fragmentShader.replace("#include <metalnessmap_pars_fragment>",n),e.fragmentShader=e.fragmentShader.replace("#include <roughnessmap_fragment>",a),e.fragmentShader=e.fragmentShader.replace("#include <metalnessmap_fragment>",o),e.fragmentShader=e.fragmentShader.replace("#include <lights_physical_fragment>",r)},Object.defineProperties(this,{specular:{get:function(){return s.specular.value},set:function(e){s.specular.value=e}},specularMap:{get:function(){return s.specularMap.value},set:function(e){s.specularMap.value=e}},glossiness:{get:function(){return s.glossiness.value},set:function(e){s.glossiness.value=e}},glossinessMap:{get:function(){return s.glossinessMap.value},set:function(e){s.glossinessMap.value=e,e?(this.defines.USE_GLOSSINESSMAP="",this.defines.USE_ROUGHNESSMAP=""):(delete this.defines.USE_ROUGHNESSMAP,delete this.defines.USE_GLOSSINESSMAP)}}}),delete this.metalness,delete this.roughness,delete this.metalnessMap,delete this.roughnessMap,this.setValues(e)}function f(){return{name:n.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS,specularGlossinessParams:["color","map","lightMap","lightMapIntensity","aoMap","aoMapIntensity","emissive","emissiveIntensity","emissiveMap","bumpMap","bumpScale","normalMap","normalMapType","displacementMap","displacementScale","displacementBias","specularMap","specular","glossinessMap","glossiness","alphaMap","envMap","envMapIntensity","refractionRatio"],getMaterialType:function(){return m},extendParams:function(e,t,n){var a=t.extensions[this.name];e.color=new i.Color(1,1,1),e.opacity=1;var o=[];if(Array.isArray(a.diffuseFactor)){var r=a.diffuseFactor;e.color.fromArray(r),e.opacity=r[3]}if(void 0!==a.diffuseTexture&&o.push(n.assignTexture(e,"map",a.diffuseTexture)),e.emissive=new i.Color(0,0,0),e.glossiness=void 0!==a.glossinessFactor?a.glossinessFactor:1,e.specular=new i.Color(1,1,1),Array.isArray(a.specularFactor)&&e.specular.fromArray(a.specularFactor),void 0!==a.specularGlossinessTexture){var s=a.specularGlossinessTexture;o.push(n.assignTexture(e,"glossinessMap",s)),o.push(n.assignTexture(e,"specularMap",s))}return Promise.all(o)},createMaterial:function(e){var t=new m(e);return t.fog=!0,t.color=e.color,t.map=void 0===e.map?null:e.map,t.lightMap=null,t.lightMapIntensity=1,t.aoMap=void 0===e.aoMap?null:e.aoMap,t.aoMapIntensity=1,t.emissive=e.emissive,t.emissiveIntensity=1,t.emissiveMap=void 0===e.emissiveMap?null:e.emissiveMap,t.bumpMap=void 0===e.bumpMap?null:e.bumpMap,t.bumpScale=1,t.normalMap=void 0===e.normalMap?null:e.normalMap,t.normalMapType=i.TangentSpaceNormalMap,e.normalScale&&(t.normalScale=e.normalScale),t.displacementMap=null,t.displacementScale=1,t.displacementBias=0,t.specularMap=void 0===e.specularMap?null:e.specularMap,t.specular=e.specular,t.glossinessMap=void 0===e.glossinessMap?null:e.glossinessMap,t.glossiness=e.glossiness,t.alphaMap=null,t.envMap=void 0===e.envMap?null:e.envMap,t.envMapIntensity=1,t.refractionRatio=.98,t}}}function g(){this.name=n.KHR_MESH_QUANTIZATION}function v(e,t,n,a){i.Interpolant.call(this,e,t,n,a)}d.prototype.decodePrimitive=function(e,t){var n=this.json,a=this.dracoLoader,o=e.extensions[this.name].bufferView,r=e.extensions[this.name].attributes,i={},s={},l={};for(var c in r){var h=A[c]||c.toLowerCase();i[h]=r[c]}for(c in e.attributes){h=A[c]||c.toLowerCase();if(void 0!==r[c]){var u=n.accessors[e.attributes[c]],d=E[u.componentType];l[h]=d,s[h]=!0===u.normalized}}return t.getDependency("bufferView",o).then((function(e){return new Promise((function(t){a.decodeDracoFile(e,(function(e){for(var n in e.attributes){var a=e.attributes[n],o=s[n];void 0!==o&&(a.normalized=o)}t(e)}),i,l)}))}))},p.prototype.extendTexture=function(e,t){return e=e.clone(),void 0!==t.offset&&e.offset.fromArray(t.offset),void 0!==t.rotation&&(e.rotation=t.rotation),void 0!==t.scale&&e.repeat.fromArray(t.scale),void 0!==t.texCoord&&console.warn('THREE.GLTFLoader: Custom UV sets in "'+this.name+'" extension not yet supported.'),e.needsUpdate=!0,e},m.prototype=Object.create(i.MeshStandardMaterial.prototype),m.prototype.constructor=m,m.prototype.copy=function(e){return i.MeshStandardMaterial.prototype.copy.call(this,e),this.specularMap=e.specularMap,this.specular.copy(e.specular),this.glossinessMap=e.glossinessMap,this.glossiness=e.glossiness,delete this.metalness,delete this.roughness,delete this.metalnessMap,delete this.roughnessMap,this},v.prototype=Object.create(i.Interpolant.prototype),v.prototype.constructor=v,v.prototype.copySampleValue_=function(e){for(var t=this.resultBuffer,n=this.sampleValues,a=this.valueSize,o=e*a*3+a,r=0;r!==a;r++)t[r]=n[o+r];return t},v.prototype.beforeStart_=v.prototype.copySampleValue_,v.prototype.afterEnd_=v.prototype.copySampleValue_,v.prototype.interpolate_=function(e,t,n,a){for(var o=this.resultBuffer,r=this.sampleValues,i=this.valueSize,s=2*i,l=3*i,c=a-t,h=(n-t)/c,u=h*h,d=u*h,p=e*l,m=p-l,f=-2*d+3*u,g=d-u,v=1-f,b=g-u+h,y=0;y!==i;y++){var w=r[m+y+i],L=r[m+y+s]*c,M=r[p+y+i],x=r[p+y]*c;o[y]=v*w+b*L+f*M+g*x}return o};var b=0,y=1,w=2,L=3,M=4,x=5,S=6,E={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},T={9728:i.NearestFilter,9729:i.LinearFilter,9984:i.NearestMipmapNearestFilter,9985:i.LinearMipmapNearestFilter,9986:i.NearestMipmapLinearFilter,9987:i.LinearMipmapLinearFilter},R={33071:i.ClampToEdgeWrapping,33648:i.MirroredRepeatWrapping,10497:i.RepeatWrapping},C={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},A={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv2",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},P={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},F={CUBICSPLINE:void 0,LINEAR:i.InterpolateLinear,STEP:i.InterpolateDiscrete},_="OPAQUE",O="MASK",k="BLEND",H={"image/png":i.RGBAFormat,"image/jpeg":i.RGBFormat};function I(e,t){return"string"!=typeof e||""===e?"":(/^https?:\/\//i.test(t)&&/^\//.test(e)&&(t=t.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(e)||/^data:.*,.*$/i.test(e)||/^blob:.*$/i.test(e)?e:t+e)}function U(e,t,n){for(var a in n.extensions)void 0===e[a]&&(t.userData.gltfExtensions=t.userData.gltfExtensions||{},t.userData.gltfExtensions[a]=n.extensions[a])}function D(e,t){void 0!==t.extras&&("object"===G(t.extras)?Object.assign(e.userData,t.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+t.extras))}function j(e,t){if(e.updateMorphTargets(),void 0!==t.weights)for(var n=0,a=t.weights.length;n<a;n++)e.morphTargetInfluences[n]=t.weights[n];if(t.extras&&Array.isArray(t.extras.targetNames)){var o=t.extras.targetNames;if(e.morphTargetInfluences.length===o.length){e.morphTargetDictionary={};for(n=0,a=o.length;n<a;n++)e.morphTargetDictionary[o[n]]=n}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function N(e){for(var t="",n=Object.keys(e).sort(),a=0,o=n.length;a<o;a++)t+=n[a]+":"+e[n[a]]+";";return t}function z(e,n,a){this.json=e||{},this.extensions=n||{},this.options=a||{},this.cache=new t,this.primitiveCache={},this.textureLoader=new i.TextureLoader(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.fileLoader=new i.FileLoader(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),"use-credentials"===this.options.crossOrigin&&this.fileLoader.setWithCredentials(!0)}function V(e,t,n){var a=t.attributes,o=[];function r(t,a){return n.getDependency("accessor",t).then((function(t){e.setAttribute(a,t)}))}for(var s in a){var l=A[s]||s.toLowerCase();l in e.attributes||o.push(r(a[s],l))}if(void 0!==t.indices&&!e.index){var c=n.getDependency("accessor",t.indices).then((function(t){e.setIndex(t)}));o.push(c)}return D(e,t),function(e,t,n){var a=t.attributes,o=new i.Box3;if(void 0!==a.POSITION){var r=(m=n.json.accessors[a.POSITION]).min,s=m.max;if(void 0!==r&&void 0!==s){o.set(new i.Vector3(r[0],r[1],r[2]),new i.Vector3(s[0],s[1],s[2]));var l=t.targets;if(void 0!==l){for(var c=new i.Vector3,h=new i.Vector3,u=0,d=l.length;u<d;u++){var p=l[u];if(void 0!==p.POSITION){var m;r=(m=n.json.accessors[p.POSITION]).min,s=m.max;void 0!==r&&void 0!==s?(h.setX(Math.max(Math.abs(r[0]),Math.abs(s[0]))),h.setY(Math.max(Math.abs(r[1]),Math.abs(s[1]))),h.setZ(Math.max(Math.abs(r[2]),Math.abs(s[2]))),c.max(h)):console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}o.expandByVector(c)}e.boundingBox=o;var f=new i.Sphere;o.getCenter(f.center),f.radius=o.min.distanceTo(o.max)/2,e.boundingSphere=f}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}(e,t,n),Promise.all(o).then((function(){return void 0!==t.targets?function(e,t,n){for(var a=!1,o=!1,r=0,i=t.length;r<i;r++){if(void 0!==(c=t[r]).POSITION&&(a=!0),void 0!==c.NORMAL&&(o=!0),a&&o)break}if(!a&&!o)return Promise.resolve(e);var s=[],l=[];for(r=0,i=t.length;r<i;r++){var c=t[r];if(a){var h=void 0!==c.POSITION?n.getDependency("accessor",c.POSITION):e.attributes.position;s.push(h)}if(o){h=void 0!==c.NORMAL?n.getDependency("accessor",c.NORMAL):e.attributes.normal;l.push(h)}}return Promise.all([Promise.all(s),Promise.all(l)]).then((function(t){var n=t[0],r=t[1];return a&&(e.morphAttributes.position=n),o&&(e.morphAttributes.normal=r),e.morphTargetsRelative=!0,e}))}(e,t.targets,n):e}))}function B(e,t){var n=e.getIndex();if(null===n){var a=[],o=e.getAttribute("position");if(void 0===o)return console.error("THREE.GLTFLoader.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),e;for(var r=0;r<o.count;r++)a.push(r);e.setIndex(a),n=e.getIndex()}var s=n.count-2,l=[];if(t===i.TriangleFanDrawMode)for(r=1;r<=s;r++)l.push(n.getX(0)),l.push(n.getX(r)),l.push(n.getX(r+1));else for(r=0;r<s;r++)r%2==0?(l.push(n.getX(r)),l.push(n.getX(r+1)),l.push(n.getX(r+2))):(l.push(n.getX(r+2)),l.push(n.getX(r+1)),l.push(n.getX(r)));l.length/3!==s&&console.error("THREE.GLTFLoader.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");var c=e.clone();return c.setIndex(l),c}return z.prototype.parse=function(e,t){var n=this,a=this.json,o=this.extensions;this.cache.removeAll(),this.markDefs(),Promise.all([this.getDependencies("scene"),this.getDependencies("animation"),this.getDependencies("camera")]).then((function(t){var r={scene:t[0][a.scene||0],scenes:t[0],animations:t[1],cameras:t[2],asset:a.asset,parser:n,userData:{}};U(o,r,a),D(r,a),e(r)})).catch(t)},z.prototype.markDefs=function(){for(var e=this.json.nodes||[],t=this.json.skins||[],n=this.json.meshes||[],a={},o={},r=0,i=t.length;r<i;r++)for(var s=t[r].joints,l=0,c=s.length;l<c;l++)e[s[l]].isBone=!0;for(var h=0,u=e.length;h<u;h++){var d=e[h];void 0!==d.mesh&&(void 0===a[d.mesh]&&(a[d.mesh]=o[d.mesh]=0),a[d.mesh]++,void 0!==d.skin&&(n[d.mesh].isSkinnedMesh=!0))}this.json.meshReferences=a,this.json.meshUses=o},z.prototype.getDependency=function(e,t){var a=e+":"+t,o=this.cache.get(a);if(!o){switch(e){case"scene":o=this.loadScene(t);break;case"node":o=this.loadNode(t);break;case"mesh":o=this.loadMesh(t);break;case"accessor":o=this.loadAccessor(t);break;case"bufferView":o=this.loadBufferView(t);break;case"buffer":o=this.loadBuffer(t);break;case"material":o=this.loadMaterial(t);break;case"texture":o=this.loadTexture(t);break;case"skin":o=this.loadSkin(t);break;case"animation":o=this.loadAnimation(t);break;case"camera":o=this.loadCamera(t);break;case"light":o=this.extensions[n.KHR_LIGHTS_PUNCTUAL].loadLight(t);break;default:throw new Error("Unknown type: "+e)}this.cache.add(a,o)}return o},z.prototype.getDependencies=function(e){var t=this.cache.get(e);if(!t){var n=this,a=this.json[e+("mesh"===e?"es":"s")]||[];t=Promise.all(a.map((function(t,a){return n.getDependency(e,a)}))),this.cache.add(e,t)}return t},z.prototype.loadBuffer=function(e){var t=this.json.buffers[e],a=this.fileLoader;if(t.type&&"arraybuffer"!==t.type)throw new Error("THREE.GLTFLoader: "+t.type+" buffer type is not supported.");if(void 0===t.uri&&0===e)return Promise.resolve(this.extensions[n.KHR_BINARY_GLTF].body);var o=this.options;return new Promise((function(e,n){a.load(I(t.uri,o.path),e,void 0,(function(){n(new Error('THREE.GLTFLoader: Failed to load buffer "'+t.uri+'".'))}))}))},z.prototype.loadBufferView=function(e){var t=this.json.bufferViews[e];return this.getDependency("buffer",t.buffer).then((function(e){var n=t.byteLength||0,a=t.byteOffset||0;return e.slice(a,a+n)}))},z.prototype.loadAccessor=function(e){var t=this,n=this.json,a=this.json.accessors[e];if(void 0===a.bufferView&&void 0===a.sparse)return Promise.resolve(null);var o=[];return void 0!==a.bufferView?o.push(this.getDependency("bufferView",a.bufferView)):o.push(null),void 0!==a.sparse&&(o.push(this.getDependency("bufferView",a.sparse.indices.bufferView)),o.push(this.getDependency("bufferView",a.sparse.values.bufferView))),Promise.all(o).then((function(e){var o,r,s=e[0],l=C[a.type],c=E[a.componentType],h=c.BYTES_PER_ELEMENT,u=h*l,d=a.byteOffset||0,p=void 0!==a.bufferView?n.bufferViews[a.bufferView].byteStride:void 0,m=!0===a.normalized;if(p&&p!==u){var f=Math.floor(d/p),g="InterleavedBuffer:"+a.bufferView+":"+a.componentType+":"+f+":"+a.count,v=t.cache.get(g);v||(o=new c(s,f*p,a.count*p/h),v=new i.InterleavedBuffer(o,p/h),t.cache.add(g,v)),r=new i.InterleavedBufferAttribute(v,l,d%p/h,m)}else o=null===s?new c(a.count*l):new c(s,d,a.count*l),r=new i.BufferAttribute(o,l,m);if(void 0!==a.sparse){var b=C.SCALAR,y=E[a.sparse.indices.componentType],w=a.sparse.indices.byteOffset||0,L=a.sparse.values.byteOffset||0,M=new y(e[1],w,a.sparse.count*b),x=new c(e[2],L,a.sparse.count*l);null!==s&&(r=new i.BufferAttribute(r.array.slice(),r.itemSize,r.normalized));for(var S=0,T=M.length;S<T;S++){var R=M[S];if(r.setX(R,x[S*l]),l>=2&&r.setY(R,x[S*l+1]),l>=3&&r.setZ(R,x[S*l+2]),l>=4&&r.setW(R,x[S*l+3]),l>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return r}))},z.prototype.loadTexture=function(e){var t,a=this,o=this.json,r=this.options,s=this.textureLoader,l=self.URL||self.webkitURL,c=o.textures[e],h=c.extensions||{},u=(t=h[n.MSFT_TEXTURE_DDS]?o.images[h[n.MSFT_TEXTURE_DDS].source]:o.images[c.source]).uri,d=!1;return void 0!==t.bufferView&&(u=a.getDependency("bufferView",t.bufferView).then((function(e){d=!0;var n=new Blob([e],{type:t.mimeType});return u=l.createObjectURL(n)}))),Promise.resolve(u).then((function(e){var t=r.manager.getHandler(e);return t||(t=h[n.MSFT_TEXTURE_DDS]?a.extensions[n.MSFT_TEXTURE_DDS].ddsLoader:s),new Promise((function(n,a){t.load(I(e,r.path),n,void 0,a)}))})).then((function(e){!0===d&&l.revokeObjectURL(u),e.flipY=!1,c.name&&(e.name=c.name),t.mimeType in H&&(e.format=H[t.mimeType]);var n=(o.samplers||{})[c.sampler]||{};return e.magFilter=T[n.magFilter]||i.LinearFilter,e.minFilter=T[n.minFilter]||i.LinearMipmapLinearFilter,e.wrapS=R[n.wrapS]||i.RepeatWrapping,e.wrapT=R[n.wrapT]||i.RepeatWrapping,e}))},z.prototype.assignTexture=function(e,t,a){var o=this;return this.getDependency("texture",a.index).then((function(r){if(!r.isCompressedTexture)switch(t){case"aoMap":case"emissiveMap":case"metalnessMap":case"normalMap":case"roughnessMap":r.format=i.RGBFormat}if(void 0===a.texCoord||0==a.texCoord||"aoMap"===t&&1==a.texCoord||console.warn("THREE.GLTFLoader: Custom UV set "+a.texCoord+" for texture "+t+" not yet supported."),o.extensions[n.KHR_TEXTURE_TRANSFORM]){var s=void 0!==a.extensions?a.extensions[n.KHR_TEXTURE_TRANSFORM]:void 0;s&&(r=o.extensions[n.KHR_TEXTURE_TRANSFORM].extendTexture(r,s))}e[t]=r}))},z.prototype.assignFinalMaterial=function(e){var t=e.geometry,n=e.material,a=void 0!==t.attributes.tangent,o=void 0!==t.attributes.color,r=void 0===t.attributes.normal,s=!0===e.isSkinnedMesh,l=Object.keys(t.morphAttributes).length>0,c=l&&void 0!==t.morphAttributes.normal;if(e.isPoints){var h="PointsMaterial:"+n.uuid,u=this.cache.get(h);u||(u=new i.PointsMaterial,i.Material.prototype.copy.call(u,n),u.color.copy(n.color),u.map=n.map,u.sizeAttenuation=!1,this.cache.add(h,u)),n=u}else if(e.isLine){h="LineBasicMaterial:"+n.uuid;var d=this.cache.get(h);d||(d=new i.LineBasicMaterial,i.Material.prototype.copy.call(d,n),d.color.copy(n.color),this.cache.add(h,d)),n=d}if(a||o||r||s||l){h="ClonedMaterial:"+n.uuid+":";n.isGLTFSpecularGlossinessMaterial&&(h+="specular-glossiness:"),s&&(h+="skinning:"),a&&(h+="vertex-tangents:"),o&&(h+="vertex-colors:"),r&&(h+="flat-shading:"),l&&(h+="morph-targets:"),c&&(h+="morph-normals:");var p=this.cache.get(h);p||(p=n.clone(),s&&(p.skinning=!0),a&&(p.vertexTangents=!0),o&&(p.vertexColors=!0),r&&(p.flatShading=!0),l&&(p.morphTargets=!0),c&&(p.morphNormals=!0),this.cache.add(h,p)),n=p}n.aoMap&&void 0===t.attributes.uv2&&void 0!==t.attributes.uv&&t.setAttribute("uv2",t.attributes.uv),n.normalScale&&!a&&(n.normalScale.y=-n.normalScale.y),n.clearcoatNormalScale&&!a&&(n.clearcoatNormalScale.y=-n.clearcoatNormalScale.y),e.material=n},z.prototype.loadMaterial=function(e){var t,a=this.json,o=this.extensions,r=a.materials[e],s={},l=r.extensions||{},c=[];if(l[n.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS]){var h=o[n.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS];t=h.getMaterialType(),c.push(h.extendParams(s,r,this))}else if(l[n.KHR_MATERIALS_UNLIT]){var u=o[n.KHR_MATERIALS_UNLIT];t=u.getMaterialType(),c.push(u.extendParams(s,r,this))}else{t=i.MeshStandardMaterial;var d=r.pbrMetallicRoughness||{};if(s.color=new i.Color(1,1,1),s.opacity=1,Array.isArray(d.baseColorFactor)){var p=d.baseColorFactor;s.color.fromArray(p),s.opacity=p[3]}void 0!==d.baseColorTexture&&c.push(this.assignTexture(s,"map",d.baseColorTexture)),s.metalness=void 0!==d.metallicFactor?d.metallicFactor:1,s.roughness=void 0!==d.roughnessFactor?d.roughnessFactor:1,void 0!==d.metallicRoughnessTexture&&(c.push(this.assignTexture(s,"metalnessMap",d.metallicRoughnessTexture)),c.push(this.assignTexture(s,"roughnessMap",d.metallicRoughnessTexture)))}!0===r.doubleSided&&(s.side=i.DoubleSide);var f=r.alphaMode||_;if(f===k?(s.transparent=!0,s.depthWrite=!1):(s.transparent=!1,f===O&&(s.alphaTest=void 0!==r.alphaCutoff?r.alphaCutoff:.5)),void 0!==r.normalTexture&&t!==i.MeshBasicMaterial&&(c.push(this.assignTexture(s,"normalMap",r.normalTexture)),s.normalScale=new i.Vector2(1,1),void 0!==r.normalTexture.scale&&s.normalScale.set(r.normalTexture.scale,r.normalTexture.scale)),void 0!==r.occlusionTexture&&t!==i.MeshBasicMaterial&&(c.push(this.assignTexture(s,"aoMap",r.occlusionTexture)),void 0!==r.occlusionTexture.strength&&(s.aoMapIntensity=r.occlusionTexture.strength)),void 0!==r.emissiveFactor&&t!==i.MeshBasicMaterial&&(s.emissive=(new i.Color).fromArray(r.emissiveFactor)),void 0!==r.emissiveTexture&&t!==i.MeshBasicMaterial&&c.push(this.assignTexture(s,"emissiveMap",r.emissiveTexture)),l[n.KHR_MATERIALS_CLEARCOAT]){var g=o[n.KHR_MATERIALS_CLEARCOAT];t=g.getMaterialType(),c.push(g.extendParams(s,{extensions:l},this))}return Promise.all(c).then((function(){var e;return e=t===m?o[n.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS].createMaterial(s):new t(s),r.name&&(e.name=r.name),e.map&&(e.map.encoding=i.sRGBEncoding),e.emissiveMap&&(e.emissiveMap.encoding=i.sRGBEncoding),D(e,r),r.extensions&&U(o,e,r),e}))},z.prototype.loadGeometries=function(e){var t=this,a=this.extensions,o=this.primitiveCache;function r(e){return a[n.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(e,t).then((function(n){return V(n,e,t)}))}for(var s,l,c=[],h=0,u=e.length;h<u;h++){var d,p=e[h],m=(l=void 0,(l=(s=p).extensions&&s.extensions[n.KHR_DRACO_MESH_COMPRESSION])?"draco:"+l.bufferView+":"+l.indices+":"+N(l.attributes):s.indices+":"+N(s.attributes)+":"+s.mode),f=o[m];if(f)c.push(f.promise);else d=p.extensions&&p.extensions[n.KHR_DRACO_MESH_COMPRESSION]?r(p):V(new i.BufferGeometry,p,t),o[m]={primitive:p,promise:d},c.push(d)}return Promise.all(c)},z.prototype.loadMesh=function(e){for(var t,n=this,a=this.json.meshes[e],o=a.primitives,r=[],s=0,l=o.length;s<l;s++){var c=void 0===o[s].material?(void 0===(t=this.cache).DefaultMaterial&&(t.DefaultMaterial=new i.MeshStandardMaterial({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:i.FrontSide})),t.DefaultMaterial):this.getDependency("material",o[s].material);r.push(c)}return r.push(n.loadGeometries(o)),Promise.all(r).then((function(t){for(var r=t.slice(0,t.length-1),s=t[t.length-1],l=[],c=0,h=s.length;c<h;c++){var u,d=s[c],p=o[c],m=r[c];if(p.mode===M||p.mode===x||p.mode===S||void 0===p.mode)!0!==(u=!0===a.isSkinnedMesh?new i.SkinnedMesh(d,m):new i.Mesh(d,m)).isSkinnedMesh||u.geometry.attributes.skinWeight.normalized||u.normalizeSkinWeights(),p.mode===x?u.geometry=B(u.geometry,i.TriangleStripDrawMode):p.mode===S&&(u.geometry=B(u.geometry,i.TriangleFanDrawMode));else if(p.mode===y)u=new i.LineSegments(d,m);else if(p.mode===L)u=new i.Line(d,m);else if(p.mode===w)u=new i.LineLoop(d,m);else{if(p.mode!==b)throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+p.mode);u=new i.Points(d,m)}Object.keys(u.geometry.morphAttributes).length>0&&j(u,a),u.name=a.name||"mesh_"+e,s.length>1&&(u.name+="_"+c),D(u,a),n.assignFinalMaterial(u),l.push(u)}if(1===l.length)return l[0];var f=new i.Group;for(c=0,h=l.length;c<h;c++)f.add(l[c]);return f}))},z.prototype.loadCamera=function(e){var t,n=this.json.cameras[e],a=n[n.type];if(a)return"perspective"===n.type?t=new i.PerspectiveCamera(i.MathUtils.radToDeg(a.yfov),a.aspectRatio||1,a.znear||1,a.zfar||2e6):"orthographic"===n.type&&(t=new i.OrthographicCamera(-a.xmag,a.xmag,a.ymag,-a.ymag,a.znear,a.zfar)),n.name&&(t.name=n.name),D(t,n),Promise.resolve(t);console.warn("THREE.GLTFLoader: Missing camera parameters.")},z.prototype.loadSkin=function(e){var t=this.json.skins[e],n={joints:t.joints};return void 0===t.inverseBindMatrices?Promise.resolve(n):this.getDependency("accessor",t.inverseBindMatrices).then((function(e){return n.inverseBindMatrices=e,n}))},z.prototype.loadAnimation=function(e){for(var t=this.json.animations[e],n=[],a=[],o=[],r=[],s=[],l=0,c=t.channels.length;l<c;l++){var h=t.channels[l],u=t.samplers[h.sampler],d=h.target,p=void 0!==d.node?d.node:d.id,m=void 0!==t.parameters?t.parameters[u.input]:u.input,f=void 0!==t.parameters?t.parameters[u.output]:u.output;n.push(this.getDependency("node",p)),a.push(this.getDependency("accessor",m)),o.push(this.getDependency("accessor",f)),r.push(u),s.push(d)}return Promise.all([Promise.all(n),Promise.all(a),Promise.all(o),Promise.all(r),Promise.all(s)]).then((function(n){for(var a=n[0],o=n[1],r=n[2],s=n[3],l=n[4],c=[],h=0,u=a.length;h<u;h++){var d=a[h],p=o[h],m=r[h],f=s[h],g=l[h];if(void 0!==d){var b;switch(d.updateMatrix(),d.matrixAutoUpdate=!0,P[g.path]){case P.weights:b=i.NumberKeyframeTrack;break;case P.rotation:b=i.QuaternionKeyframeTrack;break;case P.position:case P.scale:default:b=i.VectorKeyframeTrack}var y=d.name?d.name:d.uuid,w=void 0!==f.interpolation?F[f.interpolation]:i.InterpolateLinear,L=[];P[g.path]===P.weights?d.traverse((function(e){!0===e.isMesh&&e.morphTargetInfluences&&L.push(e.name?e.name:e.uuid)})):L.push(y);var M=m.array;if(m.normalized){var x;if(M.constructor===Int8Array)x=1/127;else if(M.constructor===Uint8Array)x=1/255;else if(M.constructor==Int16Array)x=1/32767;else{if(M.constructor!==Uint16Array)throw new Error("THREE.GLTFLoader: Unsupported output accessor component type.");x=1/65535}for(var S=new Float32Array(M.length),E=0,T=M.length;E<T;E++)S[E]=M[E]*x;M=S}for(E=0,T=L.length;E<T;E++){var R=new b(L[E]+"."+P[g.path],p.array,M,w);"CUBICSPLINE"===f.interpolation&&(R.createInterpolant=function(e){return new v(this.times,this.values,this.getValueSize()/3,e)},R.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0),c.push(R)}}}var C=t.name?t.name:"animation_"+e;return new i.AnimationClip(C,void 0,c)}))},z.prototype.loadNode=function(e){var t,a=this.json,o=this.extensions,r=this,s=a.meshReferences,l=a.meshUses,c=a.nodes[e];return(t=[],void 0!==c.mesh&&t.push(r.getDependency("mesh",c.mesh).then((function(e){var t;if(s[c.mesh]>1){var n=l[c.mesh]++;(t=e.clone()).name+="_instance_"+n}else t=e;return void 0!==c.weights&&t.traverse((function(e){if(e.isMesh)for(var t=0,n=c.weights.length;t<n;t++)e.morphTargetInfluences[t]=c.weights[t]})),t}))),void 0!==c.camera&&t.push(r.getDependency("camera",c.camera)),c.extensions&&c.extensions[n.KHR_LIGHTS_PUNCTUAL]&&void 0!==c.extensions[n.KHR_LIGHTS_PUNCTUAL].light&&t.push(r.getDependency("light",c.extensions[n.KHR_LIGHTS_PUNCTUAL].light)),Promise.all(t)).then((function(e){var t;if((t=!0===c.isBone?new i.Bone:e.length>1?new i.Group:1===e.length?e[0]:new i.Object3D)!==e[0])for(var n=0,a=e.length;n<a;n++)t.add(e[n]);if(c.name&&(t.userData.name=c.name,t.name=i.PropertyBinding.sanitizeNodeName(c.name)),D(t,c),c.extensions&&U(o,t,c),void 0!==c.matrix){var r=new i.Matrix4;r.fromArray(c.matrix),t.applyMatrix4(r)}else void 0!==c.translation&&t.position.fromArray(c.translation),void 0!==c.rotation&&t.quaternion.fromArray(c.rotation),void 0!==c.scale&&t.scale.fromArray(c.scale);return t}))},z.prototype.loadScene=function(){function e(t,n,a,o){var r=a.nodes[t];return o.getDependency("node",t).then((function(e){return void 0===r.skin?e:o.getDependency("skin",r.skin).then((function(e){for(var n=[],a=0,r=(t=e).joints.length;a<r;a++)n.push(o.getDependency("node",t.joints[a]));return Promise.all(n)})).then((function(n){return e.traverse((function(e){if(e.isMesh){for(var a=[],o=[],r=0,s=n.length;r<s;r++){var l=n[r];if(l){a.push(l);var c=new i.Matrix4;void 0!==t.inverseBindMatrices&&c.fromArray(t.inverseBindMatrices.array,16*r),o.push(c)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',t.joints[r])}e.bind(new i.Skeleton(a,o),e.matrixWorld)}})),e}));var t})).then((function(t){n.add(t);var i=[];if(r.children)for(var s=r.children,l=0,c=s.length;l<c;l++){var h=s[l];i.push(e(h,t,a,o))}return Promise.all(i)}))}return function(t){var n=this.json,a=this.extensions,o=this.json.scenes[t],r=new i.Group;o.name&&(r.name=o.name),D(r,o),o.extensions&&U(a,r,o);for(var s=o.nodes||[],l=[],c=0,h=s.length;c<h;c++)l.push(e(s[c],r,n,this));return Promise.all(l).then((function(){return r}))}}(),e}();function V(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}var B=function(){function e(t,n,a){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.scene=t,this.textures=a,this.manager=n,this.obj=null,this.ref=null}var t,n,a;return t=e,(n=[{key:"load",value:function(e){var t=this;switch(e){case"gltf":new z(this.manager).load(o.models[o.model.selected].path,(function(e){var n,a=e.scene;o.shadow.enabled&&a.traverse((function(e){(e.isMesh||e.isLight)&&(e.castShadow=!0),e.isMesh&&(e.material.wireframe=o.mesh.wireframe,n=e)})),t.obj=n,N(n.geometry);var r=new i.Group;r.scale.multiplyScalar(.25),t.scene.add(r),t.ref=r,r.updateMatrixWorld(!0),r.add(n),t.scene.add(a)}),U.logProgress(),U.logError());break;case"object":new i.ObjectLoader(this.manager).load(o.models[o.model.selected].path,(function(e){e.traverse((function(e){if(e instanceof i.Mesh){var n=new v(16777215).standard;n.map=t.textures.UV,e.material=n,o.shadow.enabled&&(e.receiveShadow=!0,e.castShadow=!0)}})),t.obj=e,t.ref=e,e.scale.multiplyScalar(o.models[o.model.selected].scale),t.scene.add(e)}),U.logProgress(),U.logError())}}},{key:"unload",value:function(){this.scene.remove(this.ref)}}])&&V(t.prototype,n),a&&V(t,a),e}();function K(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}var X={left:37,up:38,right:39,down:40,space:32,tab:9,escape:27},Z=function(){function e(t){var n=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.domElement=t||document,this.keyCodes={},this.domElement.addEventListener("keydown",(function(e){return n.onKeyChange(e)}),!1),this.domElement.addEventListener("keyup",(function(e){return n.onKeyChange(e)}),!1),window.addEventListener("blur",(function(){return n.onBlur}),!1)}var t,n,a;return t=e,(n=[{key:"destroy",value:function(){var e=this;this.domElement.removeEventListener("keydown",(function(t){return e.onKeyChange(t)}),!1),this.domElement.removeEventListener("keyup",(function(t){return e.onKeyChange(t)}),!1),window.removeEventListener("blur",(function(){return e.onBlur}),!1)}},{key:"onBlur",value:function(){for(var e in this.keyCodes)this.keyCodes[e]=!1}},{key:"onKeyChange",value:function(e){var t=e.keyCode;this.keyCodes[t]="keydown"===e.type}},{key:"pressed",value:function(e){for(var t=e.split("+"),n=0;n<t.length;n++){var a=t[n],o=!1;if(o=-1!=Object.keys(X).indexOf(a)?this.keyCodes[X[a]]:this.keyCodes[a.toUpperCase().charCodeAt(0)],!o)return!1}return!0}},{key:"eventMatches",value:function(e,t){for(var n=X,a=Object.keys(n),o=t.split("+"),r=0;r<o.length;r++){var i=o[r],s=!1;if("shift"===i?s=!!e.shiftKey:"ctrl"===i?s=!!e.ctrlKey:"alt"===i?s=!!e.altKey:"meta"===i?s=!!e.metaKey:-1!==a.indexOf(i)?s=e.keyCode===n[i]:e.keyCode===i.toUpperCase().charCodeAt(0)&&(s=!0),!s)return!1}return!0}}])&&K(t.prototype,n),a&&K(t,a),e}();function W(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}var Y=function(){function e(t,n,a,o){var r=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.renderer=t,this.scene=n,this.camera=a,this.controls=o,this.timeout=null,this.keyboard=new Z,this.renderer.domElement.addEventListener("mousemove",(function(e){return U.throttle(r.onMouseMove(e),250)}),!1),this.renderer.domElement.addEventListener("mouseleave",(function(e){return r.onMouseLeave(e)}),!1),this.renderer.domElement.addEventListener("mouseover",(function(e){return r.onMouseOver(e)}),!1),this.keyboard.domElement.addEventListener("keydown",(function(e){e.repeat||r.keyboard.eventMatches(e,"escape")&&console.log("Escape pressed")}))}var t,n,a;return t=e,(n=[{key:"onMouseOver",value:function(e){e.preventDefault(),o.isMouseOver=!0}},{key:"onMouseLeave",value:function(e){e.preventDefault(),o.isMouseOver=!1}},{key:"onMouseMove",value:function(e){e.preventDefault(),clearTimeout(this.timeout),this.timeout=setTimeout((function(){o.isMouseMoving=!1}),200),o.isMouseMoving=!0}}])&&W(t.prototype,n),a&&W(t,a),e}();function q(e){return function(e){if(Array.isArray(e))return Q(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return Q(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Q(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Q(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,a=new Array(t);n<t;n++)a[n]=e[n];return a}function J(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}var $=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.gui=new dat.GUI,this.camera=t.camera.threeCamera,this.controls=t.controls.threeControls,this.light=t.light,this.scene=t.scene,this.model=null,this.meshHelper=null}var t,n,a;return t=e,(n=[{key:"load",value:function(e,t){var n=this;this.model=e.model,this.meshHelper=e.meshHelper;var a=this.gui.addFolder("Camera"),r=a.add(o.camera,"fov",0,180).name("Camera FOV");r.onChange((function(e){n.controls.enableRotate=!1,n.camera.fov=e})),r.onFinishChange((function(){n.camera.updateProjectionMatrix(),n.controls.enableRotate=!0}));var i=a.add(o.camera,"aspect",0,4).name("Camera Aspect");i.onChange((function(e){n.controls.enableRotate=!1,n.camera.aspect=e})),i.onFinishChange((function(){n.camera.updateProjectionMatrix(),n.controls.enableRotate=!0})),a.addColor(o.fog,"color").name("Fog Color").onChange((function(e){n.scene.fog.color.setHex(e)}));var s=a.add(o.fog,"near",0,.01).name("Fog Near");s.onChange((function(e){n.controls.enableRotate=!1,n.scene.fog.density=e})),s.onFinishChange((function(){n.controls.enableRotate=!0}));var l=this.gui.addFolder("Controls");l.add(o.controls,"autoRotate").name("Auto Rotate").onChange((function(e){n.controls.autoRotate=e}));var c=l.add(o.controls,"autoRotateSpeed",-1,1).name("Rotation Speed");c.onChange((function(e){n.controls.enableRotate=!1,n.controls.autoRotateSpeed=e})),c.onFinishChange((function(){n.controls.enableRotate=!0})),this.gui.addFolder("Model").add(o.model,"type",q(o.model.initialTypes)).name("Select Model").onChange((function(e){e&&(o.mesh.enableHelper&&n.meshHelper.disable(),o.model.selected=o.model.initialTypes.indexOf(e),n.unload(),n.model.unload(),n.model.load(e))}));var h=this.gui.addFolder("Mesh");h.add(o.mesh,"enableHelper",!0).name("Enable Helpers").onChange((function(e){e?n.meshHelper.enable():n.meshHelper.disable()})),h.add(o.mesh,"translucent",!0).name("Translucent").onChange((function(e){e?(t.material.transparent=!0,t.material.opacity=.5):t.material.opacity=1})),h.add(o.mesh,"wireframe",!0).name("Wireframe").onChange((function(e){t.material.wireframe=e}));var u=this.gui.addFolder("Ambient Light");u.add(o.ambientLight,"enabled").name("Enabled").onChange((function(e){n.light.ambientLight.visible=e})),u.addColor(o.ambientLight,"color").name("Color").onChange((function(e){n.light.ambientLight.color.setHex(e)}));var d=this.gui.addFolder("Directional Light");d.add(o.directionalLight,"enabled").name("Enabled").onChange((function(e){n.light.directionalLight.visible=e})),d.addColor(o.directionalLight,"color").name("Color").onChange((function(e){n.light.directionalLight.color.setHex(e)}));var p=d.add(o.directionalLight,"intensity",0,2).name("Intensity");p.onChange((function(e){n.controls.enableRotate=!1,n.light.directionalLight.intensity=e})),p.onFinishChange((function(){n.controls.enableRotate=!0}));var m=d.add(o.directionalLight,"x",-1e3,1e3).name("Position X");m.onChange((function(e){n.controls.enableRotate=!1,n.light.directionalLight.position.x=e})),m.onFinishChange((function(){n.controls.enableRotate=!0}));var f=d.add(o.directionalLight,"y",-1e3,1e3).name("Position Y");f.onChange((function(e){n.controls.enableRotate=!1,n.light.directionalLight.position.y=e})),f.onFinishChange((function(){n.controls.enableRotate=!0}));var g=d.add(o.directionalLight,"z",-1e3,1e3).name("Position Z");g.onChange((function(e){n.controls.enableRotate=!1,n.light.directionalLight.position.z=e})),g.onFinishChange((function(){n.controls.enableRotate=!0}));var v=this.gui.addFolder("Shadow Map");v.add(o.shadow,"enabled").name("Enabled").onChange((function(e){n.light.directionalLight.castShadow=e})),v.add(o.shadow,"helperEnabled").name("Helper Enabled").onChange((function(e){n.light.directionalLightHelper.visible=e}));var b=v.add(o.shadow,"near",0,400).name("Near");b.onChange((function(e){n.controls.enableRotate=!1,n.light.directionalLight.shadow.camera.near=e})),b.onFinishChange((function(){n.controls.enableRotate=!0,n.light.directionalLight.shadow.map.dispose(),n.light.directionalLight.shadow.map=null,n.light.directionalLightHelper.update()}));var y=v.add(o.shadow,"far",0,1200).name("Far");y.onChange((function(e){n.controls.enableRotate=!1,n.light.directionalLight.shadow.camera.far=e})),y.onFinishChange((function(){n.controls.enableRotate=!0,n.light.directionalLight.shadow.map.dispose(),n.light.directionalLight.shadow.map=null,n.light.directionalLightHelper.update()}));var w=v.add(o.shadow,"top",-400,400).name("Top");w.onChange((function(e){n.controls.enableRotate=!1,n.light.directionalLight.shadow.camera.top=e})),w.onFinishChange((function(){n.controls.enableRotate=!0,n.light.directionalLight.shadow.map.dispose(),n.light.directionalLight.shadow.map=null,n.light.directionalLightHelper.update()}));var L=v.add(o.shadow,"right",-400,400).name("Right");L.onChange((function(e){n.controls.enableRotate=!1,n.light.directionalLight.shadow.camera.right=e})),L.onFinishChange((function(){n.controls.enableRotate=!0,n.light.directionalLight.shadow.map.dispose(),n.light.directionalLight.shadow.map=null,n.light.directionalLightHelper.update()}));var M=v.add(o.shadow,"bottom",-400,400).name("Bottom");M.onChange((function(e){n.controls.enableRotate=!1,n.light.directionalLight.shadow.camera.bottom=e})),M.onFinishChange((function(){n.controls.enableRotate=!0,n.light.directionalLight.shadow.map.dispose(),n.light.directionalLight.shadow.map=null,n.light.directionalLightHelper.update()}));var x=v.add(o.shadow,"left",-400,400).name("Left");x.onChange((function(e){n.controls.enableRotate=!1,n.light.directionalLight.shadow.camera.left=e})),x.onFinishChange((function(){n.controls.enableRotate=!0,n.light.directionalLight.shadow.map.dispose(),n.light.directionalLight.shadow.map=null,n.light.directionalLightHelper.update()}));var S=v.add(o.shadow,"bias",-1e-5,1).name("Bias");S.onChange((function(e){n.controls.enableRotate=!1,n.light.directionalLight.shadow.bias=e})),S.onFinishChange((function(){n.controls.enableRotate=!0,n.light.directionalLight.shadow.map.dispose(),n.light.directionalLight.shadow.map=null,n.light.directionalLightHelper.update()}));var E=this.gui.addFolder("Point Light");E.add(o.pointLight,"enabled").name("Enabled").onChange((function(e){n.light.pointLight.visible=e})),E.addColor(o.pointLight,"color").name("Color").onChange((function(e){n.light.pointLight.color.setHex(e)}));var T=E.add(o.pointLight,"intensity",0,2).name("Intensity");T.onChange((function(e){n.controls.enableRotate=!1,n.light.pointLight.intensity=e})),T.onFinishChange((function(){n.controls.enableRotate=!0}));var R=E.add(o.pointLight,"distance",0,1e3).name("Distance");R.onChange((function(e){n.controls.enableRotate=!1,n.light.pointLight.distance=e})),R.onFinishChange((function(){n.controls.enableRotate=!0}));var C=E.add(o.pointLight,"x",-1e3,1e3).name("Position X");C.onChange((function(e){n.controls.enableRotate=!1,n.light.pointLight.position.x=e})),C.onFinishChange((function(){n.controls.enableRotate=!0}));var A=E.add(o.pointLight,"y",-1e3,1e3).name("Position Y");A.onChange((function(e){n.controls.enableRotate=!1,n.light.pointLight.position.y=e})),A.onFinishChange((function(){n.controls.enableRotate=!0}));var P=E.add(o.pointLight,"z",-1e3,1e3).name("Position Z");P.onChange((function(e){n.controls.enableRotate=!1,n.light.pointLight.position.z=e})),P.onFinishChange((function(){n.controls.enableRotate=!0}));var F=this.gui.addFolder("Hemi Light");F.add(o.hemiLight,"enabled").name("Enabled").onChange((function(e){n.light.hemiLight.visible=e})),F.addColor(o.hemiLight,"color").name("Color").onChange((function(e){n.light.hemiLight.color.setHex(e)})),F.addColor(o.hemiLight,"groundColor").name("ground Color").onChange((function(e){n.light.hemiLight.groundColor.setHex(e)}));var _=F.add(o.hemiLight,"intensity",0,2).name("Intensity");_.onChange((function(e){n.controls.enableRotate=!1,n.light.hemiLight.intensity=e})),_.onFinishChange((function(){n.controls.enableRotate=!0}));var O=F.add(o.hemiLight,"x",-1e3,1e3).name("Position X");O.onChange((function(e){n.controls.enableRotate=!1,n.light.hemiLight.position.x=e})),O.onFinishChange((function(){n.controls.enableRotate=!0}));var k=F.add(o.hemiLight,"y",-500,1e3).name("Position Y");k.onChange((function(e){n.controls.enableRotate=!1,n.light.hemiLight.position.y=e})),k.onFinishChange((function(){n.controls.enableRotate=!0}));var H=F.add(o.hemiLight,"z",-1e3,1e3).name("Position Z");H.onChange((function(e){n.controls.enableRotate=!1,n.light.hemiLight.position.z=e})),H.onFinishChange((function(){n.controls.enableRotate=!0}))}},{key:"unload",value:function(){this.gui.destroy(),this.gui=new dat.GUI}}])&&J(t.prototype,n),a&&J(t,a),e}();function ee(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}var te=function(){function e(t){var n=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.container=t,this.clock=new i.Clock,this.scene=new i.Scene,this.scene.fog=new i.FogExp2(o.fog.color,o.fog.near),window.devicePixelRatio&&(o.dpr=window.devicePixelRatio),this.renderer=new l(this.scene,t),this.camera=new h(this.renderer.threeRenderer),this.controls=new g(this.camera.threeCamera,t),this.light=new d(this.scene);["ambient","directional","point","hemi"].forEach((function(e){return n.light.place(e)})),this.geometry=new E(this.scene),this.geometry.make("plane")(150,150,10,10),this.geometry.place([0,-20,0],[Math.PI/2,0,0]),o.isDev&&o.isShowingStats&&(this.stats=new R(this.renderer),this.stats.setUp()),o.isDev&&(this.gui=new $(this)),this.texture=new j,this.texture.load().then((function(){n.manager=new i.LoadingManager,n.model=new B(n.scene,n.manager,n.texture.textures),n.model.load(o.models[o.model.selected].type),n.manager.onProgress=function(e,t,n){console.log("".concat(e,": ").concat(t," ").concat(n))},n.manager.onLoad=function(){new Y(n.renderer.threeRenderer,n.scene,n.camera.threeCamera,n.controls.threeControls),o.isDev&&(n.meshHelper=new k(n.scene,n.model.obj),o.mesh.enableHelper&&n.meshHelper.enable(),n.gui.load(n,n.model.obj)),o.isLoaded=!0,n.container.querySelector("#loading").style.display="none"}})),this.render()}var t,n,r;return t=e,(n=[{key:"render",value:function(){o.isDev&&o.isShowingStats&&R.start(),this.renderer.render(this.scene,this.camera.threeCamera),o.isDev&&o.isShowingStats&&R.end(),a.a.update(),this.controls.threeControls.update(),requestAnimationFrame(this.render.bind(this))}}])&&ee(t.prototype,n),r&&ee(t,r),e}();n(7);(function(){if(r.webgl){var e=document.getElementById("appContainer");new te(e)}else r.addGetWebGLMessage()})()}],[[5,1,2]]]);