From 46417186de731d77e648c53245780dfbe5dda5b3 Mon Sep 17 00:00:00 2001 From: Thiago Pontes Date: Mon, 23 Dec 2019 15:26:44 -0300 Subject: [PATCH] Update dist files --- dist/clappr-video360.js | 4 ++-- dist/clappr-video360.min.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/dist/clappr-video360.js b/dist/clappr-video360.js index 40a49e4..ce266b7 100644 --- a/dist/clappr-video360.js +++ b/dist/clappr-video360.js @@ -1438,11 +1438,11 @@ var i=programs.indexOf(program);programs[i]=programs[programs.length-1];programs.pop();// Free WebGL resources program.destroy();}};// Exposed for resource monitoring & error feedback via renderer.info: this.programs=programs;};var Renderer=/*#__PURE__*/function(){function Renderer(options){_classCallCheck$1(this,Renderer);Object.assign(this,options);this.renderer=new threejs360.WebGLRenderer();this.renderer.setClearColor(0x000000,0);this.renderer.setSize(this.width,this.height);this.renderer.setPixelRatio(window.devicePixelRatio);this.el=this.renderer.domElement;}_createClass$1(Renderer,[{key:"setTexture",value:function setTexture(texture){this.texture=texture;this.mesh=this.createMesh();}},{key:"setSize",value:function setSize(_ref){var height=_ref.height,width=_ref.width;this.height=height;this.width=width;this.renderer.setSize(width,height);}},{key:"createMesh",value:function createMesh(){this.material=new threejs360.MeshBasicMaterial({map:this.texture});this.geometry=new threejs360.SphereGeometry(1,50,50);this.geometry.scale(-1,1,1);var mesh=new threejs360.Mesh(this.geometry,this.material);return mesh;}},{key:"destroy",value:function destroy(){this.geometry.dispose();this.material.dispose();this.renderer.dispose();}},{key:"render",value:function render(scene,camera,needsUpdate){if(!needsUpdate)return;this.renderer.render(scene,camera);}}]);return Renderer;}();var easeOutBack=function easeOutBack(k){var s=1.70158;return --k*k*((s+1)*k+s)+1;};var Controls=/*#__PURE__*/function(){function Controls(options){var _this=this;_classCallCheck$1(this,Controls);Object.assign(this,options);this.el=this.renderer.el;this.theta=this.initialYaw*Math.PI/180;this.phi=0;this.velo=0.02;this.rotateStart=new threejs360.Vector2();this.rotateEnd=new threejs360.Vector2();this.rotateDelta=new threejs360.Vector2();this.orientation=new threejs360.Quaternion();this.euler=new threejs360.Euler();this.momentum=false;this.isUserInteracting=false;this.addDraggableStyle();this.onMouseMove=this.onMouseMove.bind(this);this.onMouseDown=this.onMouseDown.bind(this);this.onMouseUp=this.onMouseUp.bind(this);this.onTouchStart=function(e){return _this.onMouseDown({clientX:e.touches[0].pageX,clientY:e.touches[0].pageY});};this.onTouchMove=function(e){return _this.onMouseMove({clientX:e.touches[0].pageX,clientY:e.touches[0].pageY});};this.onTouchEnd=function(_){return _this.onMouseUp();};this.onDeviceMotion=this.onDeviceMotion.bind(this);this.onMessage=this.onMessage.bind(this);this.bindEvents();}_createClass$1(Controls,[{key:"bindEvents",value:function bindEvents(){this.el.addEventListener('mouseleave',this.onMouseUp);this.el.addEventListener('mousemove',this.onMouseMove);this.el.addEventListener('mousedown',this.onMouseDown);this.el.addEventListener('mouseup',this.onMouseUp);this.el.addEventListener('touchstart',this.onTouchStart);this.el.addEventListener('touchmove',this.onTouchMove);this.el.addEventListener('touchend',this.onTouchEnd);if(!this.isInIframe())window.addEventListener('devicemotion',this.onDeviceMotion);window.addEventListener('message',this.onMessage);}},{key:"centralize",value:function centralize(){var _this2=this;var endTheta=this.initialYaw*Math.PI/180;var duration=750;var startTheta=this.theta;var startPhi=this.phi;var start=Date.now();var animate=function animate(){var progress=Date.now()-start;var elapsed=progress/duration;elapsed=elapsed>1?1:elapsed;if(progress>=duration){return cancelAnimationFrame(id);}_this2.theta=startTheta+(endTheta-startTheta)*easeOutBack(elapsed);_this2.phi=startPhi+(0-startPhi)*easeOutBack(elapsed);return requestAnimationFrame(animate);};var id=animate();}},{key:"isInIframe",value:function isInIframe(){try{return window.self!==window.top;}catch(e){return true;}}},{key:"destroy",value:function destroy(){this.el.removeEventListener('mouseleave',this.onMouseUp);this.el.removeEventListener('mousemove',this.onMouseMove);this.el.removeEventListener('mousedown',this.onMouseDown);this.el.removeEventListener('mouseup',this.onMouseUp);this.el.removeEventListener('touchstart',this.onTouchStart);this.el.removeEventListener('touchmove',this.onTouchMove);this.el.removeEventListener('touchend',this.onTouchEnd);window.removeEventListener('devicemotion',this.onDeviceMotion);window.removeEventListener('message',this.onMessage);}},{key:"getCurrentStyle",value:function getCurrentStyle(){return "height: ".concat(parseInt(this.el.style.height,10),"px; width: ").concat(parseInt(this.el.style.width,10),"px; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: rgba(0,0,0,0);");}},{key:"addDraggingStyle",value:function addDraggingStyle(){this.el.setAttribute('style',"".concat(this.getCurrentStyle()," cursor: -webkit-grabbing; cursor: -moz-grabbing; cursor: grabbing;"));}},{key:"addDraggableStyle",value:function addDraggableStyle(){this.el.setAttribute('style',"".concat(this.getCurrentStyle()," cursor: -webkit-grab; cursor: -moz-grab; cursor: grab;"));}},{key:"onMessage",value:function onMessage(event){var _event$data=event.data,orientation=_event$data.orientation,portrait=_event$data.portrait,rotationRate=_event$data.rotationRate;if(!rotationRate)return;this.onDeviceMotion({orientation:orientation,portrait:portrait,rotationRate:rotationRate});}},{key:"onDeviceMotion",value:function onDeviceMotion(event){var portrait=event.portrait!==undefined?event.portrait:window.matchMedia("(orientation: portrait)").matches;var orientation;if(event.orientation!==undefined){orientation=event.orientation;}else if(window.orientation!==undefined){orientation=window.orientation;}else{orientation=-90;}var alpha=threejs360.Math.degToRad(event.rotationRate.alpha);var beta=threejs360.Math.degToRad(event.rotationRate.beta);if(portrait){this.phi=this.verticalPanning?this.phi+alpha*this.velo:this.phi;this.theta=this.theta-beta*this.velo*-1;}else{if(this.verticalPanning){this.phi=orientation===-90?this.phi+beta*this.velo:this.phi-beta*this.velo;}this.theta=orientation===-90?this.theta-alpha*this.velo:this.theta+alpha*this.velo;}this.adjustPhi();}},{key:"onMouseMove",value:function onMouseMove(event){if(!this.isUserInteracting){return;}this.rotateEnd.set(event.clientX,event.clientY);this.rotateDelta.subVectors(this.rotateEnd,this.rotateStart);this.rotateStart.copy(this.rotateEnd);this.phi=this.verticalPanning?this.phi+2*Math.PI*this.rotateDelta.y/this.renderer.height*0.3:this.phi;this.theta+=2*Math.PI*this.rotateDelta.x/this.renderer.width*0.5;this.adjustPhi();}},{key:"adjustPhi",value:function adjustPhi(){// Prevent looking too far up or down. - this.phi=threejs360.Math.clamp(this.phi,-Math.PI/1.95,Math.PI/1.95);}},{key:"onMouseDown",value:function onMouseDown(event){this.addDraggingStyle();this.rotateStart.set(event.clientX,event.clientY);this.isUserInteracting=true;this.momentum=false;this.onDragStart&&this.onDragStart();}},{key:"inertia",value:function inertia(){if(!this.momentum)return;this.rotateDelta.y*=0.90;this.rotateDelta.x*=0.90;this.theta+=0.005*this.rotateDelta.x;this.phi=this.verticalPanning?this.phi+0.005*this.rotateDelta.y:this.phi;this.adjustPhi();}},{key:"onMouseUp",value:function onMouseUp(){this.isUserInteracting&&this.onDragStop&&this.onDragStop();this.addDraggableStyle();this.isUserInteracting=false;this.momentum=true;this.inertia();}},{key:"update",value:function update(){if(this.phi===this.previousPhi&&this.theta===this.previousTheta)return false;this.previousPhi=this.phi;this.previousTheta=this.theta;this.euler.set(this.phi,this.theta,0,'YXZ');this.orientation.setFromEuler(this.euler);this.camera.quaternion.copy(this.orientation);this.inertia();return true;}}]);return Controls;}();var ThreeSixtyViewer=/*#__PURE__*/function(){function ThreeSixtyViewer(){var options=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};_classCallCheck$1(this,ThreeSixtyViewer);Object.assign(this,{height:360,width:640,initialYaw:90,verticalPanning:true},options);var height=this.height,width=this.width,container=this.container,containerId=this.containerId,initialYaw=this.initialYaw,verticalPanning=this.verticalPanning,onDragStart=this.onDragStart,onDragStop=this.onDragStop;this.renderer=new Renderer({height:height,width:width});this.camera=new threejs360.PerspectiveCamera(80,this.width/this.height,0.1,100);this.controls=new Controls({camera:this.camera,renderer:this.renderer,initialYaw:initialYaw,verticalPanning:verticalPanning,onDragStart:onDragStart,onDragStop:onDragStop});this.stopVideoLoop=this.stopVideoLoop.bind(this);this.onError=this.onError.bind(this);this.startVideoLoop=this.startVideoLoop.bind(this);this.needsUpdate=false;this.scene=this.createScene();this.scene.add(this.camera);this.element=this.getElement();this.element.addEventListener('playing',this.startVideoLoop);this.element.addEventListener('pause',this.stopVideoLoop);this.element.addEventListener('ended',this.stopVideoLoop);this.texture=this.createTexture();this.renderer.setTexture(this.texture);this.scene.getObjectByName('photo').children=[this.renderer.mesh];this.target=this.container?this.container:document.querySelector(this.containerId);}_createClass$1(ThreeSixtyViewer,[{key:"play",value:function play(){this.element.play&&this.element.play();}},{key:"pause",value:function pause(){this.element.pause&&this.element.pause();}},{key:"centralize",value:function centralize(){this.controls.centralize();}},{key:"stopVideoLoop",value:function stopVideoLoop(){clearTimeout(this.videoLoopId);this.videoLoopId=null;this.needsUpdate=false;}},{key:"destroy",value:function destroy(){this.element.style.display='';clearTimeout(this.videoLoopId);cancelAnimationFrame(this.animationFrameId);this.element.pause&&this.element.pause();this.target.removeChild(this.renderer.el);this.controls.destroy();this.renderer.destroy();}},{key:"setSize",value:function setSize(_ref){var height=_ref.height,width=_ref.width;this.camera.aspect=width/height;this.camera.updateProjectionMatrix();this.renderer.setSize({height:height,width:width});}},{key:"getElement",value:function getElement(){if(this.source&&this.source.tagName)return this.source;var video=document.createElement('video');video.loop=this.loop||false;video.muted=this.muted||false;video.setAttribute('crossorigin','anonymous');video.setAttribute('webkit-playsinline','true');video.setAttribute('playsinline','true');video.setAttribute('src',this.source);video.autoplay=this.autoplay!==undefined?this.autoplay:true;video.addEventListener('error',this.onError);return video;}},{key:"createTexture",value:function createTexture(){var texture=new threejs360.Texture(this.element);texture.minFilter=threejs360.LinearFilter;texture.magFilter=threejs360.LinearFilter;texture.format=threejs360.RGBFormat;texture.generateMipmaps=false;texture.needsUpdate=true;return texture;}},{key:"createScene",value:function createScene(){var scene=new threejs360.Scene();var group=new threejs360.Object3D();group.name='photo';scene.add(group);return scene;}},{key:"onError",value:function onError(err){}},{key:"startVideoLoop",value:function startVideoLoop(){var _this=this;var videoFps=1000/25;if(this.videoLoopId){clearTimeout(this.videoLoopId);this.videoLoopId=null;}var videoLoop=function videoLoop(){_this.needsUpdate=true;_this.videoLoopId=setTimeout(videoLoop,videoFps);};videoLoop();}},{key:"render",value:function render(){var _this2=this;this.target.appendChild(this.renderer.el);this.element.style.display='none';var loop=function loop(){_this2.animationFrameId=requestAnimationFrame(loop);var cameraUpdated=_this2.controls.update();_this2.renderer.render(_this2.scene,_this2.camera,_this2.needsUpdate||cameraUpdated);_this2.needsUpdate=false;};this.startVideoLoop();loop();}}]);return ThreeSixtyViewer;}();var Video=/*#__PURE__*/function(_ThreeSixtyViewer){_inherits$1(Video,_ThreeSixtyViewer);function Video(options){_classCallCheck$1(this,Video);return _possibleConstructorReturn$1(this,_getPrototypeOf$1(Video).call(this,options));}_createClass$1(Video,[{key:"createTexture",value:function createTexture(){var texture=new threejs360.VideoTexture(this.element);//TODO: we can pass all this info through the constructor + this.phi=threejs360.Math.clamp(this.phi,-Math.PI/1.95,Math.PI/1.95);}},{key:"onMouseDown",value:function onMouseDown(event){this.addDraggingStyle();this.rotateStart.set(event.clientX,event.clientY);this.isUserInteracting=true;this.momentum=false;this.onDragStart&&this.onDragStart();}},{key:"inertia",value:function inertia(){if(!this.momentum)return;this.rotateDelta.y*=0.90;this.rotateDelta.x*=0.90;this.theta+=0.005*this.rotateDelta.x;this.phi=this.verticalPanning?this.phi+0.005*this.rotateDelta.y:this.phi;this.adjustPhi();}},{key:"onMouseUp",value:function onMouseUp(){this.isUserInteracting&&this.onDragStop&&this.onDragStop();this.addDraggableStyle();this.isUserInteracting=false;this.momentum=true;this.inertia();}},{key:"update",value:function update(){if(this.phi===this.previousPhi&&this.theta===this.previousTheta)return false;this.previousPhi=this.phi;this.previousTheta=this.theta;this.euler.set(this.phi,this.theta,0,'YXZ');this.orientation.setFromEuler(this.euler);this.camera.quaternion.copy(this.orientation);this.inertia();return true;}}]);return Controls;}();var ThreeSixtyViewer=/*#__PURE__*/function(){function ThreeSixtyViewer(){var options=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};_classCallCheck$1(this,ThreeSixtyViewer);Object.assign(this,{height:360,width:640,initialYaw:90,verticalPanning:true},options);var height=this.height,width=this.width,container=this.container,containerId=this.containerId,initialYaw=this.initialYaw,verticalPanning=this.verticalPanning,onDragStart=this.onDragStart,onDragStop=this.onDragStop;this.renderer=new Renderer({height:height,width:width});this.camera=new threejs360.PerspectiveCamera(80,this.width/this.height,0.1,100);this.controls=new Controls({camera:this.camera,renderer:this.renderer,initialYaw:initialYaw,verticalPanning:verticalPanning,onDragStart:onDragStart,onDragStop:onDragStop});this.stopVideoLoop=this.stopVideoLoop.bind(this);this.onError=this.onError.bind(this);this.startVideoLoop=this.startVideoLoop.bind(this);this.needsUpdate=false;this.scene=this.createScene();this.scene.add(this.camera);this.element=this.getElement();this.elementReady=false;this.element.addEventListener('playing',this.startVideoLoop);this.element.addEventListener('pause',this.stopVideoLoop);this.element.addEventListener('ended',this.stopVideoLoop);this.element.addEventListener('loadedmetadata',this.initAfterLoadedMetadata.bind(this));this.target=this.container?this.container:document.querySelector(this.containerId);}_createClass$1(ThreeSixtyViewer,[{key:"initAfterLoadedMetadata",value:function initAfterLoadedMetadata(){if(this.element.readyState>=1&&!this.elementReady){this.texture=this.createTexture();this.renderer.setTexture(this.texture);this.scene.getObjectByName('photo').children=[this.renderer.mesh];this.elementReady=true;}}},{key:"play",value:function play(){this.element.play&&this.element.play();}},{key:"pause",value:function pause(){this.element.pause&&this.element.pause();}},{key:"centralize",value:function centralize(){this.controls.centralize();}},{key:"stopVideoLoop",value:function stopVideoLoop(){clearTimeout(this.videoLoopId);this.videoLoopId=null;this.needsUpdate=false;}},{key:"destroy",value:function destroy(){this.element.style.display='';clearTimeout(this.videoLoopId);cancelAnimationFrame(this.animationFrameId);this.element.pause&&this.element.pause();this.target.removeChild(this.renderer.el);this.controls.destroy();this.renderer.destroy();}},{key:"setSize",value:function setSize(_ref){var height=_ref.height,width=_ref.width;this.camera.aspect=width/height;this.camera.updateProjectionMatrix();this.renderer.setSize({height:height,width:width});}},{key:"getElement",value:function getElement(){if(this.source&&this.source.tagName)return this.source;var video=document.createElement('video');video.loop=this.loop||false;video.muted=this.muted||false;video.setAttribute('crossorigin','anonymous');video.setAttribute('webkit-playsinline','true');video.setAttribute('playsinline','true');video.setAttribute('src',this.source);video.autoplay=this.autoplay!==undefined?this.autoplay:true;video.addEventListener('error',this.onError);return video;}},{key:"createTexture",value:function createTexture(){var texture=new threejs360.Texture(this.element);texture.minFilter=threejs360.LinearFilter;texture.magFilter=threejs360.LinearFilter;texture.format=threejs360.RGBFormat;texture.generateMipmaps=false;texture.needsUpdate=true;return texture;}},{key:"createScene",value:function createScene(){var scene=new threejs360.Scene();var group=new threejs360.Object3D();group.name='photo';scene.add(group);return scene;}},{key:"onError",value:function onError(err){}},{key:"startVideoLoop",value:function startVideoLoop(){var _this=this;var videoFps=1000/25;if(this.videoLoopId){clearTimeout(this.videoLoopId);this.videoLoopId=null;}var videoLoop=function videoLoop(){_this.needsUpdate=true;_this.videoLoopId=setTimeout(videoLoop,videoFps);};videoLoop();}},{key:"render",value:function render(){var _this2=this;this.target.appendChild(this.renderer.el);this.element.style.display='none';var loop=function loop(){_this2.animationFrameId=requestAnimationFrame(loop);var cameraUpdated=_this2.controls.update();_this2.renderer.render(_this2.scene,_this2.camera,_this2.needsUpdate||cameraUpdated);_this2.needsUpdate=false;};this.startVideoLoop();loop();}}]);return ThreeSixtyViewer;}();var Video=/*#__PURE__*/function(_ThreeSixtyViewer){_inherits$1(Video,_ThreeSixtyViewer);function Video(options){_classCallCheck$1(this,Video);return _possibleConstructorReturn$1(this,_getPrototypeOf$1(Video).call(this,options));}_createClass$1(Video,[{key:"createTexture",value:function createTexture(){var texture=new threejs360.VideoTexture(this.element);//TODO: we can pass all this info through the constructor texture.minFilter=threejs360.LinearFilter;texture.magFilter=threejs360.LinearFilter;texture.format=threejs360.RGBFormat;texture.generateMipmaps=false;texture.needsUpdate=true;return texture;}}]);return Video;}(ThreeSixtyViewer);var Image=/*#__PURE__*/function(_ThreeSixtyViewer){_inherits$1(Image,_ThreeSixtyViewer);function Image(options){_classCallCheck$1(this,Image);return _possibleConstructorReturn$1(this,_getPrototypeOf$1(Image).call(this,options));}_createClass$1(Image,[{key:"getElement",value:function getElement(){if(this.source&&this.source.tagName)return this.source;var image=document.createElement('img');image.setAttribute('crossorigin','anonymous');image.src=this.source;return image;}}]);return Image;}(ThreeSixtyViewer);var Canvas=/*#__PURE__*/function(_ThreeSixtyViewer){_inherits$1(Canvas,_ThreeSixtyViewer);function Canvas(options){var _this;_classCallCheck$1(this,Canvas);_this=_possibleConstructorReturn$1(this,_getPrototypeOf$1(Canvas).call(this,options));_this.context=_this.element.getContext('2d');return _this;}_createClass$1(Canvas,[{key:"play",value:function play(){this.video.play&&this.video.play();}},{key:"pause",value:function pause(){this.video.pause&&this.video.pause();}},{key:"destroy",value:function destroy(){this.video.style.display='';_get$1(_getPrototypeOf$1(Canvas.prototype),"destroy",this).call(this);}},{key:"getElement",value:function getElement(){this.video=_get$1(_getPrototypeOf$1(Canvas.prototype),"getElement",this).call(this);this.video.addEventListener('playing',this.startVideoLoop);this.video.addEventListener('pause',this.stopVideoLoop);this.video.addEventListener('ended',this.stopVideoLoop);var canvas=document.createElement('canvas');canvas.height=this.video.videoHeight;canvas.width=this.video.videoWidth;return canvas;}},{key:"render",value:function render(){var _this2=this;this.target.appendChild(this.renderer.el);this.video.style.display='none';var loop=function loop(){_this2.animationFrameId=requestAnimationFrame(loop);var h=_this2.video.videoHeight;var w=_this2.video.videoWidth;if(_this2.element.height!=h){_this2.element.height=h;}if(_this2.element.width!=w){_this2.element.width=w;}_this2.context.clearRect(0,0,w,h);_this2.context.drawImage(_this2.video,0,0,w,h);var cameraUpdated=_this2.controls.update();_this2.renderer.render(_this2.scene,_this2.camera,_this2.needsUpdate||cameraUpdated);_this2.renderer.mesh.material.map.needsUpdate=true;_this2.needsUpdate=false;};this.startVideoLoop();loop();}}]);return Canvas;}(ThreeSixtyViewer);var Audio=/*#__PURE__*/function(_ThreeSixtyViewer){_inherits$1(Audio,_ThreeSixtyViewer);function Audio(options){var _this;_classCallCheck$1(this,Audio);_this=_possibleConstructorReturn$1(this,_getPrototypeOf$1(Audio).call(this,options));_this.driver.addEventListener('playing',_this.startVideoLoop);_this.driver.addEventListener('pause',_this.stopVideoLoop);_this.driver.addEventListener('ended',_this.stopVideoLoop);_this.driver.addEventListener('stalled',_this.stopVideoLoop);_this.driverInitialized=false;return _this;}_createClass$1(Audio,[{key:"play",value:function play(){this.driver.play();}},{key:"pause",value:function pause(){this.driver.pause();}},{key:"getElement",value:function getElement(){if(this.source&&this.source.tagName){this.driver=this.source;}else{this.driver=document.createElement('audio');this.driver.src=this.source;this.driver.loop=this.loop||false;this.driver.muted=this.muted||false;this.driver.setAttribute('crossorigin','anonymous');this.driver.autoplay=this.autoplay||true;}this.source=this.driver.src;this.driver.src='';this.driver.load();var video=document.createElement('video');video.setAttribute('crossorigin','anonymous');video.src=this.source;video.load();video.addEventListener('error',this.onError);return video;}},{key:"createTexture",value:function createTexture(){var texture=new threejs360.VideoTexture(this.element);//TODO: we can pass all this info through the constructor texture.minFilter=threejs360.LinearFilter;texture.magFilter=threejs360.LinearFilter;texture.format=threejs360.RGBFormat;texture.generateMipmaps=false;texture.needsUpdate=true;return texture;}},{key:"startVideoLoop",value:function startVideoLoop(){var _this2=this;var videoFps=1000/25;if(this.videoLoopId){clearTimeout(this.videoLoopId);this.videoLoopId=null;}var videoLoop=function videoLoop(){_this2.element.currentTime=_this2.driver.currentTime;_this2.needsUpdate=true;_this2.videoLoopId=setTimeout(videoLoop,videoFps);};videoLoop();}},{key:"destroy",value:function destroy(){this.driver.style.display='';_get$1(_getPrototypeOf$1(Audio.prototype),"destroy",this).call(this);}},{key:"render",value:function render(){var _this3=this;this.target.appendChild(this.renderer.el);this.element.style.display='none';this.driver.style.display='none';var loop=function loop(){var cameraUpdated=_this3.controls.update();_this3.renderer.render(_this3.scene,_this3.camera,_this3.needsUpdate||cameraUpdated);_this3.needsUpdate=false;_this3.animationFrameId=requestAnimationFrame(loop);var shouldInitializeDriver=_this3.element.readyState>=_this3.element.HAVE_FUTURE_DATA&&!_this3.driverInitialized;if(shouldInitializeDriver){_this3.driver.src=_this3.source;_this3.driver.load();_this3.onDriverReady&&_this3.onDriverReady();_this3.driverInitialized=true;}};loop();}}]);return Audio;}(ThreeSixtyViewer);var video=function video(options){if(utils.shouldUseAudioDriver()){return new Audio(options);}if(utils.shouldUseCanvasInBetween()){return new Canvas(options);}return new Video(options);}; - var Video360=/*#__PURE__*/function(a){function b(a){var c;_classCallCheck(this,b),c=_possibleConstructorReturn(this,_getPrototypeOf(b).call(this,a)),clappr.Mediator.on("".concat(c.options.playerId,":").concat(clappr.Events.PLAYER_RESIZE),c.updateSize,_assertThisInitialized(_assertThisInitialized(c)));var d=a.options,e=d.height,f=d.width,g=d.autoplay;return a.playback.el.setAttribute("crossorigin","anonymous"),a.el.style.touchAction="none",a.el.addEventListener("touchmove",function(a){a.preventDefault();},!1),c.viewer=new video({height:isNaN(e)?300:e,width:isNaN(f)?400:f,container:c.container.el,source:c.container.playback.el}),c.viewer.render(),c}return _inherits(b,a),_createClass(b,[{key:"updateSize",value:function b(){var a=this;setTimeout(function(){return a.viewer.setSize({height:a.container.$el.height(),width:a.container.$el.width()})},250);}},{key:"name",get:function a(){return "Video360"}}]),b}(clappr.ContainerPlugin); + var Video360=/*#__PURE__*/function(a){function b(a){var c;_classCallCheck(this,b),c=_possibleConstructorReturn(this,_getPrototypeOf(b).call(this,a)),clappr.Mediator.on("".concat(c.options.playerId,":").concat(clappr.Events.PLAYER_RESIZE),c.updateSize,_assertThisInitialized(c));var d=a.options,e=d.height,f=d.width,g=d.autoplay;return a.playback.el.setAttribute("crossorigin","anonymous"),a.el.style.touchAction="none",a.el.addEventListener("touchmove",function(a){a.preventDefault();},!1),c.viewer=new video({height:isNaN(e)?300:e,width:isNaN(f)?400:f,container:c.container.el,source:c.container.playback.el}),c.viewer.render(),c}return _inherits(b,a),_createClass(b,[{key:"updateSize",value:function updateSize(){var a=this;setTimeout(function(){return a.viewer.setSize({height:a.container.$el.height(),width:a.container.$el.width()})},250);}},{key:"name",get:function get(){return "Video360"}}]),b}(clappr.ContainerPlugin); return Video360; diff --git a/dist/clappr-video360.min.js b/dist/clappr-video360.min.js index 5d92c46..1f9d96e 100644 --- a/dist/clappr-video360.min.js +++ b/dist/clappr-video360.min.js @@ -1 +1 @@ -!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(require("clappr")):"function"==typeof define&&define.amd?define(["clappr"],e):t.Video360=e(t.Clappr)}(this,function(h){"use strict";function n(t,e){for(var i=0;i>=4,x[19===t?3&y|8:y]);return M.join("")}),clamp:function(t,e,i){return Math.max(e,Math.min(i,t))},euclideanModulo:function(t,e){return(t%e+e)%e},mapLinear:function(t,e,i,r,n){return r+(t-e)*(n-r)/(i-e)},smoothstep:function(t,e,i){return t<=e?0:i<=t?1:(t=(t-e)/(i-e))*t*(3-2*t)},smootherstep:function(t,e,i){return t<=e?0:i<=t?1:(t=(t-e)/(i-e))*t*t*(t*(6*t-15)+10)},random16:function(){return Math.random()},randInt:function(t,e){return t+Math.floor(Math.random()*(e-t+1))},randFloat:function(t,e){return t+Math.random()*(e-t)},randFloatSpread:function(t){return t*(.5-Math.random())},degToRad:(g=Math.PI/180,function(t){return t*g}),radToDeg:(v=180/Math.PI,function(t){return t*v}),isPowerOfTwo:function(t){return 0==(t&t-1)&&0!==t},nearestPowerOfTwo:function(t){return Math.pow(2,Math.round(Math.log(t)/Math.LN2))},nextPowerOfTwo:function(t){return t--,t|=t>>1,t|=t>>2,t|=t>>4,t|=t>>8,t|=t>>16,++t}},xe.Color=function(t){return 3===arguments.length?this.fromArray(arguments):this.set(t)},xe.Color.prototype={constructor:xe.Color,r:1,g:1,b:1,set:function(t){return t instanceof xe.Color?this.copy(t):"number"==typeof t?this.setHex(t):"string"==typeof t&&this.setStyle(t),this},setScalar:function(t){this.r=t,this.g=t,this.b=t},setHex:function(t){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(255&t)/255,this},setRGB:function(t,e,i){return this.r=t,this.g=e,this.b=i,this},setHSL:function(){function a(t,e,i){return i<0&&(i+=1),1Math.abs(t.z)?K.set(-t.y,t.x,0):K.set(0,-t.z,t.y)):K.crossVectors(t,e),this._x=K.x,this._y=K.y,this._z=K.z,this._w=$,this.normalize(),this},inverse:function(){return this.conjugate().normalize(),this},conjugate:function(){return this._x*=-1,this._y*=-1,this._z*=-1,this.onChangeCallback(),this},dot:function(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w},lengthSq:function(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w},length:function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)},normalize:function(){var t=this.length();return this._w=0===t?(this._x=0,this._y=0,this._z=0,1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w*t),this.onChangeCallback(),this},multiply:function(t,e){return void 0!==e?this.multiplyQuaternions(t,e):this.multiplyQuaternions(this,t)},multiplyQuaternions:function(t,e){var i=t._x,r=t._y,n=t._z,a=t._w,o=e._x,s=e._y,h=e._z,l=e._w;return this._x=i*l+a*o+r*h-n*s,this._y=r*l+a*s+n*o-i*h,this._z=n*l+a*h+i*s-r*o,this._w=a*l-i*o-r*s-n*h,this.onChangeCallback(),this},slerp:function(t,e){if(0===e)return this;if(1===e)return this.copy(t);var i=this._x,r=this._y,n=this._z,a=this._w,o=a*t._w+i*t._x+r*t._y+n*t._z;if(o<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,o=-o):this.copy(t),1<=o)return this._w=a,this._x=i,this._y=r,this._z=n,this;var s=Math.sqrt(1-o*o);if(Math.abs(s)<.001)return this._w=.5*(a+this._w),this._x=.5*(i+this._x),this._y=.5*(r+this._y),this._z=.5*(n+this._z),this;var h=Math.atan2(s,o),l=Math.sin((1-e)*h)/s,u=Math.sin(e*h)/s;return this._w=a*l+this._w*u,this._x=i*l+this._x*u,this._y=r*l+this._y*u,this._z=n*l+this._z*u,this.onChangeCallback(),this},equals:function(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w},fromArray:function(t,e){return void 0===e&&(e=0),this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this.onChangeCallback(),this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t},onChange:function(t){return this.onChangeCallback=t,this},onChangeCallback:function(){}},Object.assign(xe.Quaternion,{slerp:function(t,e,i,r){return i.copy(t).slerp(e,r)},slerpFlat:function(t,e,i,r,n,a,o){var s=i[r+0],h=i[r+1],l=i[r+2],u=i[r+3],c=n[a+0],p=n[a+1],d=n[a+2],f=n[a+3];if(u!==f||s!==c||h!==p||l!==d){var m=1-o,v=s*c+h*p+l*d+u*f,g=0<=v?1:-1,y=1-v*v;if(y>Number.EPSILON){var x=Math.sqrt(y),M=Math.atan2(x,v*g);m=Math.sin(m*M)/x,o=Math.sin(o*M)/x}var b=o*g;if(s=s*m+c*b,h=h*m+p*b,l=l*m+d*b,u=u*m+f*b,m===1-o){var _=1/Math.sqrt(s*s+h*h+l*l+u*u);s*=_,h*=_,l*=_,u*=_}}t[e]=s,t[e+1]=h,t[e+2]=l,t[e+3]=u}}),xe.Triangle=function(t,e,i){this.a=void 0!==t?t:new xe.Vector3,this.b=void 0!==e?e:new xe.Vector3,this.c=void 0!==i?i:new xe.Vector3},xe.Triangle.normal=(tt=new xe.Vector3,function(t,e,i,r){var n=r||new xe.Vector3;n.subVectors(i,e),tt.subVectors(t,e),n.cross(tt);var a=n.lengthSq();return 0this.max.x||t.ythis.max.y||t.zthis.max.z)},containsBox:function(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z},getParameter:function(t,e){return(e||new xe.Vector3).set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))},intersectsBox:function(t){return!(t.max.xthis.max.x||t.max.ythis.max.y||t.max.zthis.max.z)},intersectsSphere:function(t){return void 0===ut&&(ut=new xe.Vector3),this.clampPoint(t.center,ut),ut.distanceToSquared(t.center)<=t.radius*t.radius},intersectsPlane:function(t){var e,i;return i=0=t.constant},clampPoint:function(t,e){return(e||new xe.Vector3).copy(t).clamp(this.min,this.max)},distanceToPoint:(lt=new xe.Vector3,function(t){return lt.copy(t).clamp(this.min,this.max).sub(t).length()}),getBoundingSphere:(ht=new xe.Vector3,function(t){var e=t||new xe.Sphere;return e.center=this.center(),e.radius=.5*this.size(ht).length(),e}),intersect:function(t){return this.min.max(t.min),this.max.min(t.max),this},union:function(t){return this.min.min(t.min),this.max.max(t.max),this},applyMatrix4:(st=[new xe.Vector3,new xe.Vector3,new xe.Vector3,new xe.Vector3,new xe.Vector3,new xe.Vector3,new xe.Vector3,new xe.Vector3],function(t){return st[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),st[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),st[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),st[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),st[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),st[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),st[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),st[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.makeEmpty(),this.setFromPoints(st),this}),translate:function(t){return this.min.add(t),this.max.add(t),this},equals:function(t){return t.min.equals(this.min)&&t.max.equals(this.max)}},xe.Euler=function(t,e,i,r){this._x=t||0,this._y=e||0,this._z=i||0,this._order=r||xe.Euler.DefaultOrder},xe.Euler.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"],xe.Euler.DefaultOrder="XYZ",xe.Euler.prototype={constructor:xe.Euler,get x(){return this._x},set x(t){this._x=t,this.onChangeCallback()},get y(){return this._y},set y(t){this._y=t,this.onChangeCallback()},get z(){return this._z},set z(t){this._z=t,this.onChangeCallback()},get order(){return this._order},set order(t){this._order=t,this.onChangeCallback()},set:function(t,e,i,r){return this._x=t,this._y=e,this._z=i,this._order=r||this._order,this.onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._order)},copy:function(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this.onChangeCallback(),this},setFromRotationMatrix:function(t,e,i){var r=xe.Math.clamp,n=t.elements,a=n[0],o=n[4],s=n[8],h=n[1],l=n[5],u=n[9],c=n[2],p=n[6],d=n[10];return"XYZ"===(e=e||this._order)?(this._y=Math.asin(r(s,-1,1)),Math.abs(s)<.99999?(this._x=Math.atan2(-u,d),this._z=Math.atan2(-o,a)):(this._x=Math.atan2(p,l),this._z=0)):"YXZ"===e?(this._x=Math.asin(-r(u,-1,1)),Math.abs(u)<.99999?(this._y=Math.atan2(s,d),this._z=Math.atan2(h,l)):(this._y=Math.atan2(-c,a),this._z=0)):"ZXY"===e?(this._x=Math.asin(r(p,-1,1)),Math.abs(p)<.99999?(this._y=Math.atan2(-c,d),this._z=Math.atan2(-o,l)):(this._y=0,this._z=Math.atan2(h,a))):"ZYX"===e?(this._y=Math.asin(-r(c,-1,1)),Math.abs(c)<.99999?(this._x=Math.atan2(p,d),this._z=Math.atan2(h,a)):(this._x=0,this._z=Math.atan2(-o,l))):"YZX"===e?(this._z=Math.asin(r(h,-1,1)),Math.abs(h)<.99999?(this._x=Math.atan2(-u,l),this._y=Math.atan2(-c,a)):(this._x=0,this._y=Math.atan2(s,d))):"XZY"===e&&(this._z=Math.asin(-r(o,-1,1)),Math.abs(o)<.99999?(this._x=Math.atan2(p,l),this._y=Math.atan2(s,a)):(this._x=Math.atan2(-u,d),this._y=0)),this._order=e,!1!==i&&this.onChangeCallback(),this},setFromQuaternion:function(t,e,i){return void 0===ft&&(ft=new xe.Matrix4),ft.makeRotationFromQuaternion(t),this.setFromRotationMatrix(ft,e,i),this},setFromVector3:function(t,e){return this.set(t.x,t.y,t.z,e||this._order)},reorder:(dt=new xe.Quaternion,function(t){dt.setFromEuler(this),this.setFromQuaternion(dt,t)}),equals:function(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order},fromArray:function(t){return this._x=t[0],this._y=t[1],this._z=t[2],void 0!==t[3]&&(this._order=t[3]),this.onChangeCallback(),this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._order,t},toVector3:function(t){return t?t.set(this._x,this._y,this._z):new xe.Vector3(this._x,this._y,this._z)},onChange:function(t){return this.onChangeCallback=t,this},onChangeCallback:function(){}},xe.Ray=function(t,e){this.origin=void 0!==t?t:new xe.Vector3,this.direction=void 0!==e?e:new xe.Vector3},xe.Ray.prototype={constructor:xe.Ray,set:function(t,e){return this.origin.copy(t),this.direction.copy(e),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.origin.copy(t.origin),this.direction.copy(t.direction),this},at:function(t,e){return(e||new xe.Vector3).copy(this.direction).multiplyScalar(t).add(this.origin)},lookAt:function(t){this.direction.copy(t).sub(this.origin).normalize()},recast:(Et=new xe.Vector3,function(t){return this.origin.copy(this.at(t,Et)),this}),closestPointToPoint:function(t,e){var i=e||new xe.Vector3;i.subVectors(t,this.origin);var r=i.dot(this.direction);return r<0?i.copy(this.origin):i.copy(this.direction).multiplyScalar(r).add(this.origin)},distanceToPoint:function(t){return Math.sqrt(this.distanceSqToPoint(t))},distanceSqToPoint:(wt=new xe.Vector3,function(t){var e=wt.subVectors(t,this.origin).dot(this.direction);return e<0?this.origin.distanceToSquared(t):(wt.copy(this.direction).multiplyScalar(e).add(this.origin),wt.distanceToSquared(t))}),distanceSqToSegment:(bt=new xe.Vector3,_t=new xe.Vector3,St=new xe.Vector3,function(t,e,i,r){bt.copy(t).add(e).multiplyScalar(.5),_t.copy(e).sub(t).normalize(),St.copy(this.origin).sub(bt);var n,a,o,s,h=.5*t.distanceTo(e),l=-this.direction.dot(_t),u=St.dot(this.direction),c=-St.dot(_t),p=St.lengthSq(),d=Math.abs(1-l*l);if(0this.radius*this.radius&&(r.sub(this.center).normalize(),r.multiplyScalar(this.radius).add(this.center)),r},getBoundingBox:function(t){var e=t||new xe.Box3;return e.set(this.center,this.center),e.expandByScalar(this.radius),e},applyMatrix4:function(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this},translate:function(t){return this.center.add(t),this},equals:function(t){return t.center.equals(this.center)&&t.radius===this.radius}},xe.Frustum=function(t,e,i,r,n,a){this.planes=[void 0!==t?t:new xe.Plane,void 0!==e?e:new xe.Plane,void 0!==i?i:new xe.Plane,void 0!==r?r:new xe.Plane,void 0!==n?n:new xe.Plane,void 0!==a?a:new xe.Plane]},xe.Frustum.prototype={constructor:xe.Frustum,set:function(t,e,i,r,n,a){var o=this.planes;return o[0].copy(t),o[1].copy(e),o[2].copy(i),o[3].copy(r),o[4].copy(n),o[5].copy(a),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){for(var e=this.planes,i=0;i<6;i++)e[i].copy(t.planes[i]);return this},setFromMatrix:function(t){var e=this.planes,i=t.elements,r=i[0],n=i[1],a=i[2],o=i[3],s=i[4],h=i[5],l=i[6],u=i[7],c=i[8],p=i[9],d=i[10],f=i[11],m=i[12],v=i[13],g=i[14],y=i[15];return e[0].setComponents(o-r,u-s,f-c,y-m).normalize(),e[1].setComponents(o+r,u+s,f+c,y+m).normalize(),e[2].setComponents(o+n,u+h,f+p,y+v).normalize(),e[3].setComponents(o-n,u-h,f-p,y-v).normalize(),e[4].setComponents(o-a,u-l,f-d,y-g).normalize(),e[5].setComponents(o+a,u+l,f+d,y+g).normalize(),this},intersectsObject:(Rt=new xe.Sphere,function(t){var e=t.geometry;return null===e.boundingSphere&&e.computeBoundingSphere(),Rt.copy(e.boundingSphere),Rt.applyMatrix4(t.matrixWorld),this.intersectsSphere(Rt)}),intersectsSphere:function(t){for(var e=this.planes,i=t.center,r=-t.radius,n=0;n<6;n++){if(e[n].distanceToPoint(i)=e.HAVE_CURRENT_DATA&&(l.needsUpdate=!0)}()},xe.VideoTexture.prototype=Object.create(xe.Texture.prototype),xe.VideoTexture.prototype.constructor=xe.VideoTexture,xe.Sprite=(he=new Uint16Array([0,1,2,0,2,3]),le=new Float32Array([-.5,-.5,0,.5,-.5,0,.5,.5,0,-.5,.5,0]),ue=new Float32Array([0,0,1,0,1,1,0,1]),(ce=new xe.BufferGeometry).setIndex(new xe.BufferAttribute(he,1)),ce.addAttribute("position",new xe.BufferAttribute(le,3)),ce.addAttribute("uv",new xe.BufferAttribute(ue,2)),function(t){xe.Object3D.call(this),this.type="Sprite",this.geometry=ce,this.material=void 0!==t?t:new xe.SpriteMaterial}),xe.Sprite.prototype=Object.create(xe.Object3D.prototype),xe.Sprite.prototype.constructor=xe.Sprite,xe.Sprite.prototype.raycast=(pe=new xe.Vector3,function(t,e){pe.setFromMatrixPosition(this.matrixWorld);var i=t.ray.distanceSqToPoint(pe);this.scale.x*this.scale.yt.far||e.push({distance:M,point:h.clone().applyMatrix4(this.matrixWorld),index:f,face:null,faceIndex:null,object:this}))}else for(f=0,m=p.length/3-1;ft.far||e.push({distance:M,point:h.clone().applyMatrix4(this.matrixWorld),index:f,face:null,faceIndex:null,object:this}))}else if(n instanceof xe.Geometry){var y=n.vertices,x=y.length;for(f=0;ft.far||e.push({distance:M,point:h.clone().applyMatrix4(this.matrixWorld),index:f,face:null,faceIndex:null,object:this}))}}}}),xe.Line.prototype.clone=function(){return new this.constructor(this.geometry,this.material).copy(this)},xe.LineStrip=0,xe.LinePieces=1,xe.LineSegments=function(t,e){xe.Line.call(this,t,e),this.type="LineSegments"},xe.LineSegments.prototype=Object.create(xe.Line.prototype),xe.LineSegments.prototype.constructor=xe.LineSegments,xe.Mesh=function(t,e){xe.Object3D.call(this),this.type="Mesh",this.geometry=void 0!==t?t:new xe.Geometry,this.material=void 0!==e?e:new xe.MeshBasicMaterial({color:16777215*Math.random()}),this.drawMode=xe.TrianglesDrawMode,this.updateMorphTargets()},xe.Mesh.prototype=Object.create(xe.Object3D.prototype),xe.Mesh.prototype.constructor=xe.Mesh,xe.Mesh.prototype.setDrawMode=function(t){this.drawMode=t},xe.Mesh.prototype.updateMorphTargets=function(){if(void 0!==this.geometry.morphTargets&&0e.far?null:{distance:h,point:l.clone(),object:t}}function Q(t,e,i,r,n,a,o,s){O.fromArray(r,3*a),V.fromArray(r,3*o),z.fromArray(r,3*s);var h=Z(t,e,i,O,V,z,q);return h&&(n&&(j.fromArray(n,2*a),X.fromArray(n,2*o),H.fromArray(n,2*s),h.uv=Y(q,O,V,z,j,X,H)),h.face=new xe.Face3(a,o,s,xe.Triangle.normal(O,V,z)),h.faceIndex=a),h}return function(t,e){var i,r,n=this.geometry,a=this.material,o=this.matrixWorld;if(void 0!==a&&(null===n.boundingSphere&&n.computeBoundingSphere(),I.copy(n.boundingSphere),I.applyMatrix4(o),!1!==t.ray.intersectsSphere(I)&&(D.getInverse(o),B.copy(t.ray).applyMatrix4(D),null===n.boundingBox||!1!==B.intersectsBox(n.boundingBox))))if(n instanceof xe.BufferGeometry){var s,h,l,u=n.index,c=n.attributes,p=c.position.array;if(void 0!==c.uv&&(i=c.uv.array),null!==u)for(var d=u.array,f=0,m=d.length;fa.far)return;o.push({distance:n,distanceToRay:Math.sqrt(i),point:r.clone(),index:e,face:null,object:s})}}}),xe.Points.prototype.clone=function(){return new this.constructor(this.geometry,this.material).copy(this)},xe.Light=function(t,e){xe.Object3D.call(this),this.type="Light",this.color=new xe.Color(t),this.intensity=void 0!==e?e:1,this.receiveShadow=void 0},xe.Light.prototype=Object.create(xe.Object3D.prototype),xe.Light.prototype.constructor=xe.Light,xe.Light.prototype.copy=function(t){return xe.Object3D.prototype.copy.call(this,t),this.color.copy(t.color),this.intensity=t.intensity,this},xe.Light.prototype.toJSON=function(t){var e=xe.Object3D.prototype.toJSON.call(this,t);return e.object.color=this.color.getHex(),e.object.intensity=this.intensity,void 0!==this.groundColor&&(e.object.groundColor=this.groundColor.getHex()),void 0!==this.distance&&(e.object.distance=this.distance),void 0!==this.angle&&(e.object.angle=this.angle),void 0!==this.decay&&(e.object.decay=this.decay),void 0!==this.penumbra&&(e.object.penumbra=this.penumbra),e},xe.ShaderChunk={},xe.ShaderChunk.alphamap_fragment="#ifdef USE_ALPHAMAP\n\n\tdiffuseColor.a *= texture2D( alphaMap, vUv ).g;\n\n#endif\n",xe.ShaderChunk.alphamap_pars_fragment="#ifdef USE_ALPHAMAP\n\n\tuniform sampler2D alphaMap;\n\n#endif\n",xe.ShaderChunk.alphatest_fragment="#ifdef ALPHATEST\n\n\tif ( diffuseColor.a < ALPHATEST ) discard;\n\n#endif\n",xe.ShaderChunk.aomap_fragment="#ifdef USE_AOMAP\n\n\tfloat ambientOcclusion = ( texture2D( aoMap, vUv2 ).r - 1.0 ) * aoMapIntensity + 1.0;\n\n\treflectedLight.indirectDiffuse *= ambientOcclusion;\n\n\t#if defined( USE_ENVMAP ) && defined( STANDARD )\n\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\n\t\treflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.specularRoughness );\n\n\t#endif\n\n#endif\n",xe.ShaderChunk.aomap_pars_fragment="#ifdef USE_AOMAP\n\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n\n#endif",xe.ShaderChunk.begin_vertex="\nvec3 transformed = vec3( position );\n",xe.ShaderChunk.beginnormal_vertex="\nvec3 objectNormal = vec3( normal );\n",xe.ShaderChunk.color_fragment="#ifdef USE_COLOR\n\n\tdiffuseColor.rgb *= vColor;\n\n#endif",xe.ShaderChunk.color_pars_fragment="#ifdef USE_COLOR\n\n\tvarying vec3 vColor;\n\n#endif\n",xe.ShaderChunk.color_pars_vertex="#ifdef USE_COLOR\n\n\tvarying vec3 vColor;\n\n#endif",xe.ShaderChunk.color_vertex="#ifdef USE_COLOR\n\n\tvColor.xyz = color.xyz;\n\n#endif",xe.ShaderChunk.common="#define PI 3.14159\n#define PI2 6.28318\n#define RECIPROCAL_PI 0.31830988618\n#define RECIPROCAL_PI2 0.15915494\n#define LOG2 1.442695\n#define EPSILON 1e-6\n\n#define saturate(a) clamp( a, 0.0, 1.0 )\n#define whiteCompliment(a) ( 1.0 - saturate( a ) )\n\nfloat pow2( const in float x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }\n\n\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\n\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\n\nstruct GeometricContext {\n\tvec3 position;\n\tvec3 normal;\n\tvec3 viewDir;\n};\n\n\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n\n}\n\n// http://en.wikibooks.org/wiki/GLSL_Programming/Applying_Matrix_Transformations\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n\n}\n\nvec3 projectOnPlane(in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\n\tfloat distance = dot( planeNormal, point - pointOnPlane );\n\n\treturn - distance * planeNormal + point;\n\n}\n\nfloat sideOfPlane( in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\n\treturn sign( dot( point - pointOnPlane, planeNormal ) );\n\n}\n\nvec3 linePlaneIntersect( in vec3 pointOnLine, in vec3 lineDirection, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\n\treturn lineDirection * ( dot( planeNormal, pointOnPlane - pointOnLine ) / dot( planeNormal, lineDirection ) ) + pointOnLine;\n\n}\n",xe.ShaderChunk.defaultnormal_vertex="#ifdef FLIP_SIDED\n\n\tobjectNormal = -objectNormal;\n\n#endif\n\nvec3 transformedNormal = normalMatrix * objectNormal;\n",xe.ShaderChunk.encodings_fragment=" gl_FragColor = linearToOutputTexel( gl_FragColor );\n",xe.ShaderChunk.encodings_pars_fragment="// For a discussion of what this is, please read this: http://lousodrome.net/blog/light/2013/05/26/gamma-correct-and-hdr-rendering-in-a-32-bits-buffer/\n\nvec4 LinearToLinear( in vec4 value ) {\n return value;\n}\n\nvec4 GammaToLinear( in vec4 value, in float gammaFactor ) {\n return vec4( pow( value.xyz, vec3( gammaFactor ) ), value.w );\n}\nvec4 LinearToGamma( in vec4 value, in float gammaFactor ) {\n return vec4( pow( value.xyz, vec3( 1.0 / gammaFactor ) ), value.w );\n}\n\nvec4 sRGBToLinear( in vec4 value ) {\n return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.w );\n}\nvec4 LinearTosRGB( in vec4 value ) {\n return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.w );\n}\n\nvec4 RGBEToLinear( in vec4 value ) {\n return vec4( value.rgb * exp2( value.a * 255.0 - 128.0 ), 1.0 );\n}\nvec4 LinearToRGBE( in vec4 value ) {\n float maxComponent = max( max( value.r, value.g ), value.b );\n float fExp = clamp( ceil( log2( maxComponent ) ), -128.0, 127.0 );\n return vec4( value.rgb / exp2( fExp ), ( fExp + 128.0 ) / 255.0 );\n// return vec4( value.brg, ( 3.0 + 128.0 ) / 256.0 );\n}\n\n// reference: http://iwasbeingirony.blogspot.ca/2010/06/difference-between-rgbm-and-rgbd.html\nvec4 RGBMToLinear( in vec4 value, in float maxRange ) {\n return vec4( value.xyz * value.w * maxRange, 1.0 );\n}\nvec4 LinearToRGBM( in vec4 value, in float maxRange ) {\n float maxRGB = max( value.x, max( value.g, value.b ) );\n float M = clamp( maxRGB / maxRange, 0.0, 1.0 );\n M = ceil( M * 255.0 ) / 255.0;\n return vec4( value.rgb / ( M * maxRange ), M );\n}\n\n// reference: http://iwasbeingirony.blogspot.ca/2010/06/difference-between-rgbm-and-rgbd.html\nvec4 RGBDToLinear( in vec4 value, in float maxRange ) {\n return vec4( value.rgb * ( ( maxRange / 255.0 ) / value.a ), 1.0 );\n}\nvec4 LinearToRGBD( in vec4 value, in float maxRange ) {\n float maxRGB = max( value.x, max( value.g, value.b ) );\n float D = max( maxRange / maxRGB, 1.0 );\n D = min( floor( D ) / 255.0, 1.0 );\n return vec4( value.rgb * ( D * ( 255.0 / maxRange ) ), D );\n}\n\n// LogLuv reference: http://graphicrants.blogspot.ca/2009/04/rgbm-color-encoding.html\n\n// M matrix, for encoding\nconst mat3 cLogLuvM = mat3( 0.2209, 0.3390, 0.4184, 0.1138, 0.6780, 0.7319, 0.0102, 0.1130, 0.2969 );\nvec4 LinearToLogLuv( in vec4 value ) {\n vec3 Xp_Y_XYZp = value.rgb * cLogLuvM;\n Xp_Y_XYZp = max(Xp_Y_XYZp, vec3(1e-6, 1e-6, 1e-6));\n vec4 vResult;\n vResult.xy = Xp_Y_XYZp.xy / Xp_Y_XYZp.z;\n float Le = 2.0 * log2(Xp_Y_XYZp.y) + 127.0;\n vResult.w = fract(Le);\n vResult.z = (Le - (floor(vResult.w*255.0))/255.0)/255.0;\n return vResult;\n}\n\n// Inverse M matrix, for decoding\nconst mat3 cLogLuvInverseM = mat3( 6.0014, -2.7008, -1.7996, -1.3320, 3.1029, -5.7721, 0.3008, -1.0882, 5.6268 );\nvec4 LogLuvToLinear( in vec4 value ) {\n float Le = value.z * 255.0 + value.w;\n vec3 Xp_Y_XYZp;\n Xp_Y_XYZp.y = exp2((Le - 127.0) / 2.0);\n Xp_Y_XYZp.z = Xp_Y_XYZp.y / value.y;\n Xp_Y_XYZp.x = value.x * Xp_Y_XYZp.z;\n vec3 vRGB = Xp_Y_XYZp.rgb * cLogLuvInverseM;\n return vec4( max(vRGB, 0.0), 1.0 );\n}\n",xe.ShaderChunk.envmap_fragment="#ifdef USE_ENVMAP\n\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\n\t\tvec3 cameraToVertex = normalize( vWorldPosition - cameraPosition );\n\n\t\t// Transforming Normal Vectors with the Inverse Transformation\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\n\t\t\tvec3 reflectVec = reflect( cameraToVertex, worldNormal );\n\n\t\t#else\n\n\t\t\tvec3 reflectVec = refract( cameraToVertex, worldNormal, refractionRatio );\n\n\t\t#endif\n\n\t#else\n\n\t\tvec3 reflectVec = vReflect;\n\n\t#endif\n\n\t#ifdef DOUBLE_SIDED\n\t\tfloat flipNormal = ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t#else\n\t\tfloat flipNormal = 1.0;\n\t#endif\n\n\t#ifdef ENVMAP_TYPE_CUBE\n\n\t\tvec4 envColor = textureCube( envMap, flipNormal * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\n\t#elif defined( ENVMAP_TYPE_EQUIREC )\n\n\t\tvec2 sampleUV;\n\t\tsampleUV.y = saturate( flipNormal * reflectVec.y * 0.5 + 0.5 );\n\t\tsampleUV.x = atan( flipNormal * reflectVec.z, flipNormal * reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n\t\tvec4 envColor = texture2D( envMap, sampleUV );\n\n\t#elif defined( ENVMAP_TYPE_SPHERE )\n\n\t\tvec3 reflectView = flipNormal * normalize((viewMatrix * vec4( reflectVec, 0.0 )).xyz + vec3(0.0,0.0,1.0));\n\t\tvec4 envColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5 );\n\n\t#endif\n\n\tenvColor = envMapTexelToLinear( envColor );\n\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\n\t#endif\n\n#endif\n",xe.ShaderChunk.envmap_pars_fragment="#if defined( USE_ENVMAP ) || defined( STANDARD )\n\tuniform float reflectivity;\n\tuniform float envMapIntenstiy;\n#endif\n\n#ifdef USE_ENVMAP\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\tuniform float flipEnvMap;\n\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( STANDARD )\n\n\t\tuniform float refractionRatio;\n\n\t#else\n\n\t\tvarying vec3 vReflect;\n\n\t#endif\n\n#endif\n",xe.ShaderChunk.envmap_pars_vertex="#if defined( USE_ENVMAP ) && ! defined( USE_BUMPMAP ) && ! defined( USE_NORMALMAP ) && ! defined( PHONG ) && ! defined( STANDARD )\n\n\tvarying vec3 vReflect;\n\n\tuniform float refractionRatio;\n\n#endif\n",xe.ShaderChunk.envmap_vertex="#if defined( USE_ENVMAP ) && ! defined( USE_BUMPMAP ) && ! defined( USE_NORMALMAP ) && ! defined( PHONG ) && ! defined( STANDARD )\n\n\tvec3 cameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\n\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\n\t#ifdef ENVMAP_MODE_REFLECTION\n\n\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\n\t#else\n\n\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\n\t#endif\n\n#endif\n",xe.ShaderChunk.fog_fragment="#ifdef USE_FOG\n\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\n\t\tfloat depth = gl_FragDepthEXT / gl_FragCoord.w;\n\n\t#else\n\n\t\tfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n\n\t#endif\n\n\t#ifdef FOG_EXP2\n\n\t\tfloat fogFactor = whiteCompliment( exp2( - fogDensity * fogDensity * depth * depth * LOG2 ) );\n\n\t#else\n\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n\n\t#endif\n\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n\n#endif\n",xe.ShaderChunk.fog_pars_fragment="#ifdef USE_FOG\n\n\tuniform vec3 fogColor;\n\n\t#ifdef FOG_EXP2\n\n\t\tuniform float fogDensity;\n\n\t#else\n\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n\n#endif",xe.ShaderChunk.logdepthbuf_fragment="#if defined(USE_LOGDEPTHBUF) && defined(USE_LOGDEPTHBUF_EXT)\n\n\tgl_FragDepthEXT = log2(vFragDepth) * logDepthBufFC * 0.5;\n\n#endif",xe.ShaderChunk.logdepthbuf_pars_fragment="#ifdef USE_LOGDEPTHBUF\n\n\tuniform float logDepthBufFC;\n\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\n\t\tvarying float vFragDepth;\n\n\t#endif\n\n#endif\n",xe.ShaderChunk.logdepthbuf_pars_vertex="#ifdef USE_LOGDEPTHBUF\n\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\n\t\tvarying float vFragDepth;\n\n\t#endif\n\n\tuniform float logDepthBufFC;\n\n#endif",xe.ShaderChunk.logdepthbuf_vertex="#ifdef USE_LOGDEPTHBUF\n\n\tgl_Position.z = log2(max( EPSILON, gl_Position.w + 1.0 )) * logDepthBufFC;\n\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\n\t\tvFragDepth = 1.0 + gl_Position.w;\n\n\t#else\n\n\t\tgl_Position.z = (gl_Position.z - 1.0) * gl_Position.w;\n\n\t#endif\n\n#endif\n",xe.ShaderChunk.map_fragment="#ifdef USE_MAP\n\n\tvec4 texelColor = texture2D( map, vUv );\n\n\ttexelColor = mapTexelToLinear( texelColor );\n\tdiffuseColor *= texelColor;\n\n#endif\n",xe.ShaderChunk.map_pars_fragment="#ifdef USE_MAP\n\n\tuniform sampler2D map;\n\n#endif\n",xe.ShaderChunk.morphnormal_vertex="#ifdef USE_MORPHNORMALS\n\n\tobjectNormal += ( morphNormal0 - normal ) * morphTargetInfluences[ 0 ];\n\tobjectNormal += ( morphNormal1 - normal ) * morphTargetInfluences[ 1 ];\n\tobjectNormal += ( morphNormal2 - normal ) * morphTargetInfluences[ 2 ];\n\tobjectNormal += ( morphNormal3 - normal ) * morphTargetInfluences[ 3 ];\n\n#endif\n",xe.ShaderChunk.morphtarget_pars_vertex="#ifdef USE_MORPHTARGETS\n\n\t#ifndef USE_MORPHNORMALS\n\n\tuniform float morphTargetInfluences[ 8 ];\n\n\t#else\n\n\tuniform float morphTargetInfluences[ 4 ];\n\n\t#endif\n\n#endif",xe.ShaderChunk.morphtarget_vertex="#ifdef USE_MORPHTARGETS\n\n\ttransformed += ( morphTarget0 - position ) * morphTargetInfluences[ 0 ];\n\ttransformed += ( morphTarget1 - position ) * morphTargetInfluences[ 1 ];\n\ttransformed += ( morphTarget2 - position ) * morphTargetInfluences[ 2 ];\n\ttransformed += ( morphTarget3 - position ) * morphTargetInfluences[ 3 ];\n\n\t#ifndef USE_MORPHNORMALS\n\n\ttransformed += ( morphTarget4 - position ) * morphTargetInfluences[ 4 ];\n\ttransformed += ( morphTarget5 - position ) * morphTargetInfluences[ 5 ];\n\ttransformed += ( morphTarget6 - position ) * morphTargetInfluences[ 6 ];\n\ttransformed += ( morphTarget7 - position ) * morphTargetInfluences[ 7 ];\n\n\t#endif\n\n#endif\n",xe.ShaderChunk.premultiplied_alpha_fragment="#ifdef PREMULTIPLIED_ALPHA\n\n\t// Get get normal blending with premultipled, use with CustomBlending, OneFactor, OneMinusSrcAlphaFactor, AddEquation.\n\tgl_FragColor.rgb *= gl_FragColor.a;\n\n#endif\n",xe.ShaderChunk.project_vertex="#ifdef USE_SKINNING\n\n\tvec4 mvPosition = modelViewMatrix * skinned;\n\n#else\n\n\tvec4 mvPosition = modelViewMatrix * vec4( transformed, 1.0 );\n\n#endif\n\ngl_Position = projectionMatrix * mvPosition;\n",xe.ShaderChunk.skinbase_vertex="#ifdef USE_SKINNING\n\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n\n#endif",xe.ShaderChunk.skinning_pars_vertex="#ifdef USE_SKINNING\n\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\n\t#ifdef BONE_TEXTURE\n\n\t\tuniform sampler2D boneTexture;\n\t\tuniform int boneTextureWidth;\n\t\tuniform int boneTextureHeight;\n\n\t\tmat4 getBoneMatrix( const in float i ) {\n\n\t\t\tfloat j = i * 4.0;\n\t\t\tfloat x = mod( j, float( boneTextureWidth ) );\n\t\t\tfloat y = floor( j / float( boneTextureWidth ) );\n\n\t\t\tfloat dx = 1.0 / float( boneTextureWidth );\n\t\t\tfloat dy = 1.0 / float( boneTextureHeight );\n\n\t\t\ty = dy * ( y + 0.5 );\n\n\t\t\tvec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n\t\t\tvec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n\t\t\tvec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n\t\t\tvec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n\n\t\t\tmat4 bone = mat4( v1, v2, v3, v4 );\n\n\t\t\treturn bone;\n\n\t\t}\n\n\t#else\n\n\t\tuniform mat4 boneGlobalMatrices[ MAX_BONES ];\n\n\t\tmat4 getBoneMatrix( const in float i ) {\n\n\t\t\tmat4 bone = boneGlobalMatrices[ int(i) ];\n\t\t\treturn bone;\n\n\t\t}\n\n\t#endif\n\n#endif\n",xe.ShaderChunk.skinning_vertex="#ifdef USE_SKINNING\n\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\tskinned = bindMatrixInverse * skinned;\n\n#endif\n",xe.ShaderChunk.skinnormal_vertex="#ifdef USE_SKINNING\n\n\tmat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight.x * boneMatX;\n\tskinMatrix += skinWeight.y * boneMatY;\n\tskinMatrix += skinWeight.z * boneMatZ;\n\tskinMatrix += skinWeight.w * boneMatW;\n\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n\n#endif\n",xe.ShaderChunk.specularmap_fragment="float specularStrength;\n\n#ifdef USE_SPECULARMAP\n\n\tvec4 texelSpecular = texture2D( specularMap, vUv );\n\tspecularStrength = texelSpecular.r;\n\n#else\n\n\tspecularStrength = 1.0;\n\n#endif",xe.ShaderChunk.specularmap_pars_fragment="#ifdef USE_SPECULARMAP\n\n\tuniform sampler2D specularMap;\n\n#endif",xe.ShaderChunk.tonemapping_fragment="#if defined( TONE_MAPPING )\n\n gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n\n#endif\n",xe.ShaderChunk.tonemapping_pars_fragment="#define saturate(a) clamp( a, 0.0, 1.0 )\n\nuniform float toneMappingExposure;\nuniform float toneMappingWhitePoint;\n\n// exposure only\nvec3 LinearToneMapping( vec3 color ) {\n\n return toneMappingExposure * color;\n\n}\n\n// source: https://www.cs.utah.edu/~reinhard/cdrom/\nvec3 ReinhardToneMapping( vec3 color ) {\n\n color *= toneMappingExposure;\n return saturate( color / ( vec3( 1.0 ) + color ) );\n\n}\n\n// source: http://filmicgames.com/archives/75\n#define Uncharted2Helper( x ) max( ( ( x * ( 0.15 * x + 0.10 * 0.50 ) + 0.20 * 0.02 ) / ( x * ( 0.15 * x + 0.50 ) + 0.20 * 0.30 ) ) - 0.02 / 0.30, vec3( 0.0 ) )\nvec3 Uncharted2ToneMapping( vec3 color ) {\n\n // John Hable's filmic operator from Uncharted 2 video game\n color *= toneMappingExposure;\n return saturate( Uncharted2Helper( color ) / Uncharted2Helper( vec3( toneMappingWhitePoint ) ) );\n\n}\n\n// source: http://filmicgames.com/archives/75\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n\n // optimized filmic operator by Jim Hejl and Richard Burgess-Dawson\n color *= toneMappingExposure;\n color = max( vec3( 0.0 ), color - 0.004 );\n return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n\n}\n",xe.ShaderChunk.uv2_pars_fragment="#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\n\tvarying vec2 vUv2;\n\n#endif",xe.ShaderChunk.uv2_pars_vertex="#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\n\tattribute vec2 uv2;\n\tvarying vec2 vUv2;\n\n#endif",xe.ShaderChunk.uv2_vertex="#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\n\tvUv2 = uv2;\n\n#endif",xe.ShaderChunk.uv_pars_fragment="#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n\n\tvarying vec2 vUv;\n\n#endif",xe.ShaderChunk.uv_pars_vertex="#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n\n\tvarying vec2 vUv;\n\tuniform vec4 offsetRepeat;\n\n#endif\n",xe.ShaderChunk.uv_vertex="#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n\n\tvUv = uv * offsetRepeat.zw + offsetRepeat.xy;\n\n#endif",xe.ShaderChunk.worldpos_vertex="#if defined( USE_ENVMAP ) || defined( PHONG ) || defined( STANDARD ) || defined( LAMBERT ) || defined ( USE_SHADOWMAP )\n\n\t#ifdef USE_SKINNING\n\n\t\tvec4 worldPosition = modelMatrix * skinned;\n\n\t#else\n\n\t\tvec4 worldPosition = modelMatrix * vec4( transformed, 1.0 );\n\n\t#endif\n\n#endif\n",xe.ShaderChunk.meshbasic_frag="uniform vec3 diffuse;\nuniform float opacity;\n\n#ifndef FLAT_SHADED\n\n\tvarying vec3 vNormal;\n\n#endif\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nvoid main() {\n\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\tReflectedLight reflectedLight;\n\treflectedLight.directDiffuse = vec3( 0.0 );\n\treflectedLight.directSpecular = vec3( 0.0 );\n\treflectedLight.indirectDiffuse = diffuseColor.rgb;\n\treflectedLight.indirectSpecular = vec3( 0.0 );\n\n\t#include \n\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\n\t#include \n\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\n\t#include \n\t#include \n\t#include \n\t#include \n\n}\n",xe.ShaderChunk.meshbasic_vert="#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nvoid main() {\n\n\t#include \n\t#include \n\t#include \n\t#include \n\n\t#ifdef USE_ENVMAP\n\n\t#include \n\t#include \n\t#include \n\t#include \n\n\t#endif\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\t#include \n\t#include \n\n}\n",xe.UniformsUtils={merge:function(t){for(var e={},i=0;ie||t.height>e){var i=e/Math.max(t.width,t.height),r=document.createElement("canvas");return r.width=Math.floor(t.width*i),r.height=Math.floor(t.height*i),r.getContext("2d").drawImage(t,0,0,t.width,t.height,0,0,r.width,r.height),r}return t}function Tt(t){return xe.Math.isPowerOfTwo(t.width)&&xe.Math.isPowerOfTwo(t.height)}function At(t,e){var i=q.get(t);if(6===t.image.length)if(0 0 ) {","float depth = gl_FragCoord.z / gl_FragCoord.w;","float fogFactor = 0.0;","if ( fogType == 1 ) {","fogFactor = smoothstep( fogNear, fogFar, depth );","} else {","const float LOG2 = 1.442695;","fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );","fogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );","}","gl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );","}","}"].join("\n")),x.compileShader(e),x.compileShader(i),x.attachShader(t,e),x.attachShader(t,i),x.linkProgram(t),m=t,v={position:x.getAttribLocation(m,"position"),uv:x.getAttribLocation(m,"uv")},g={uvOffset:x.getUniformLocation(m,"uvOffset"),uvScale:x.getUniformLocation(m,"uvScale"),rotation:x.getUniformLocation(m,"rotation"),scale:x.getUniformLocation(m,"scale"),color:x.getUniformLocation(m,"color"),map:x.getUniformLocation(m,"map"),opacity:x.getUniformLocation(m,"opacity"),modelViewMatrix:x.getUniformLocation(m,"modelViewMatrix"),projectionMatrix:x.getUniformLocation(m,"projectionMatrix"),fogType:x.getUniformLocation(m,"fogType"),fogDensity:x.getUniformLocation(m,"fogDensity"),fogNear:x.getUniformLocation(m,"fogNear"),fogFar:x.getUniformLocation(m,"fogFar"),fogColor:x.getUniformLocation(m,"fogColor"),alphaTest:x.getUniformLocation(m,"alphaTest")};var a=document.createElement("canvas");a.width=8,a.height=8;var o=a.getContext("2d");o.fillStyle="white",o.fillRect(0,0,8,8),(y=new xe.Texture(a)).needsUpdate=!0}function E(t,e){return t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.z!==e.z?e.z-t.z:e.id-t.id}this.render=function(t,e){if(0!==p.length){void 0===m&&w(),x.useProgram(m),M.initAttributes(),M.enableAttribute(v.position),M.enableAttribute(v.uv),M.disableUnusedAttributes(),M.disable(x.CULL_FACE),M.enable(x.BLEND),x.bindBuffer(x.ARRAY_BUFFER,d),x.vertexAttribPointer(v.position,2,x.FLOAT,!1,16,0),x.vertexAttribPointer(v.uv,2,x.FLOAT,!1,16,8),x.bindBuffer(x.ELEMENT_ARRAY_BUFFER,f),x.uniformMatrix4fv(g.projectionMatrix,!1,e.projectionMatrix.elements),M.activeTexture(x.TEXTURE0),x.uniform1i(g.map,0);var i=0,r=0,n=t.fog;n?(x.uniform3f(g.fogColor,n.color.r,n.color.g,n.color.b),n instanceof xe.Fog?(x.uniform1f(g.fogNear,n.near),x.uniform1f(g.fogFar,n.far),x.uniform1i(g.fogType,1),r=i=1):n instanceof xe.FogExp2&&(x.uniform1f(g.fogDensity,n.density),x.uniform1i(g.fogType,2),r=i=2)):(x.uniform1i(g.fogType,0),r=i=0);for(var a=0,o=p.length;a/g,function(t,e){var i=xe.ShaderChunk[e];if(void 0===i)throw new Error("Can not resolve #include <"+e+">");return j(i)})}function X(t){return t.replace(/for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g,function(t,e,i,r){for(var n="",a=parseInt(e);a=i.element.HAVE_FUTURE_DATA&&!i.driverInitialized&&(i.driver.src=i.source,i.driver.load(),i.onDriverReady&&i.onDriverReady(),i.driverInitialized=!0)}()}}]),i}(),Le=function(t){return e()?new Ae(t):i()?new Te(t):new Ee(t)};return function(t){function s(t){var e,i,r;(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")})(this,s),i=this,e=!(r=l(s).call(this,t))||"object"!=typeof r&&"function"!=typeof r?u(i):r,h.Mediator.on("".concat(e.options.playerId,":").concat(h.Events.PLAYER_RESIZE),e.updateSize,u(u(e)));var n=t.options,a=n.height,o=n.width;n.autoplay;return t.playback.el.setAttribute("crossorigin","anonymous"),t.el.style.touchAction="none",t.el.addEventListener("touchmove",function(t){t.preventDefault()},!1),e.viewer=new Le({height:isNaN(a)?300:a,width:isNaN(o)?400:o,container:e.container.el,source:e.container.playback.el}),e.viewer.render(),e}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&a(t,e)}(s,h.ContainerPlugin),e=s,(i=[{key:"updateSize",value:function(){var t=this;setTimeout(function(){return t.viewer.setSize({height:t.container.$el.height(),width:t.container.$el.width()})},250)}},{key:"name",get:function(){return"Video360"}}])&&n(e.prototype,i),r&&n(e,r),s;var e,i,r}()}); +!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(require("clappr")):"function"==typeof define&&define.amd?define(["clappr"],e):t.Video360=e(t.Clappr)}(this,function(h){"use strict";function r(t,e){for(var i=0;ie.far?null:{distance:h,point:Ce.clone(),object:t}}function We(t,e,i,r,n,a,o,s){xe.fromArray(r,3*a),Me.fromArray(r,3*o),be.fromArray(r,3*s);var h=Ge(t,e,i,xe,Me,be,Re);return h&&(n&&(Ee.fromArray(n,2*a),Te.fromArray(n,2*o),Ae.fromArray(n,2*s),h.uv=ke(Re,xe,Me,be,Ee,Te,Ae)),h.face=new Oe.Face3(a,o,s,Oe.Triangle.normal(xe,Me,be)),h.faceIndex=a),h}function je(t){switch(t){case Oe.LinearEncoding:return["Linear","( value )"];case Oe.sRGBEncoding:return["sRGB","( value )"];case Oe.RGBEEncoding:return["RGBE","( value )"];case Oe.RGBM7Encoding:return["RGBM","( value, 7.0 )"];case Oe.RGBM16Encoding:return["RGBM","( value, 16.0 )"];case Oe.RGBDEncoding:return["RGBD","( value, 256.0 )"];case Oe.GammaEncoding:return["Gamma","( value, float( GAMMA_FACTOR ) )"];default:throw new Error("unsupported encoding: "+t)}}function Xe(t,e){var i=je(e);return"vec4 "+t+"( vec4 value ) { return "+i[0]+"ToLinear"+i[1]+"; }"}function He(t){return""!==t}function qe(t,e){return t.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_POINT_LIGHTS/g,e.numPointLights).replace(/NUM_HEMI_LIGHTS/g,e.numHemiLights)}function Ye(t){return t.replace(/#include +<([\w\d.]+)>/g,function(t,e){var i=Oe.ShaderChunk[e];if(void 0===i)throw new Error("Can not resolve #include <"+e+">");return Ye(i)})}function Ze(t){return t.replace(/for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g,function(t,e,i,r){for(var n="",a=parseInt(e);a>=4,x[t]=y[19===t?3&g|8:g]);return x.join("")}),clamp:function(t,e,i){return Math.max(e,Math.min(i,t))},euclideanModulo:function(t,e){return(t%e+e)%e},mapLinear:function(t,e,i,r,n){return r+(t-e)*(n-r)/(i-e)},smoothstep:function(t,e,i){return t<=e?0:i<=t?1:(t=(t-e)/(i-e))*t*(3-2*t)},smootherstep:function(t,e,i){return t<=e?0:i<=t?1:(t=(t-e)/(i-e))*t*t*(t*(6*t-15)+10)},random16:function(){return Math.random()},randInt:function(t,e){return t+Math.floor(Math.random()*(e-t+1))},randFloat:function(t,e){return t+Math.random()*(e-t)},randFloatSpread:function(t){return t*(.5-Math.random())},degToRad:(v=Math.PI/180,function(t){return t*v}),radToDeg:(m=180/Math.PI,function(t){return t*m}),isPowerOfTwo:function(t){return 0==(t&t-1)&&0!==t},nearestPowerOfTwo:function(t){return Math.pow(2,Math.round(Math.log(t)/Math.LN2))},nextPowerOfTwo:function(t){return t--,t|=t>>1,t|=t>>2,t|=t>>4,t|=t>>8,t|=t>>16,++t}},Oe.Color=function(t){return 3===arguments.length?this.fromArray(arguments):this.set(t)},Oe.Color.prototype={constructor:Oe.Color,r:1,g:1,b:1,set:function(t){return t instanceof Oe.Color?this.copy(t):"number"==typeof t?this.setHex(t):"string"==typeof t&&this.setStyle(t),this},setScalar:function(t){this.r=t,this.g=t,this.b=t},setHex:function(t){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(255&t)/255,this},setRGB:function(t,e,i){return this.r=t,this.g=e,this.b=i,this},setHSL:function(t,e,i){if(t=Oe.Math.euclideanModulo(t,1),e=Oe.Math.clamp(e,0,1),i=Oe.Math.clamp(i,0,1),0===e)this.r=this.g=this.b=i;else{var r=i<=.5?i*(1+e):i+e-i*e,n=2*i-r;this.r=ze(n,r,t+1/3),this.g=ze(n,r,t),this.b=ze(n,r,t-1/3)}return this},setStyle:function(t){var e;if(e=/^((?:rgb|hsl)a?)\(\s*([^\)]*)\)/.exec(t)){var i,r=e[1],n=e[2];switch(r){case"rgb":case"rgba":if(i=/^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(n))return this.r=Math.min(255,parseInt(i[1],10))/255,this.g=Math.min(255,parseInt(i[2],10))/255,this.b=Math.min(255,parseInt(i[3],10))/255,i[5],this;if(i=/^(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(n))return this.r=Math.min(100,parseInt(i[1],10))/100,this.g=Math.min(100,parseInt(i[2],10))/100,this.b=Math.min(100,parseInt(i[3],10))/100,i[5],this;break;case"hsl":case"hsla":if(i=/^([0-9]*\.?[0-9]+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(n)){var a=parseFloat(i[1])/360,o=parseInt(i[2],10)/100,s=parseInt(i[3],10)/100;return i[5],this.setHSL(a,o,s)}}}else if(e=/^\#([A-Fa-f0-9]+)$/.exec(t)){var h,l=(h=e[1]).length;if(3===l)return this.r=parseInt(h.charAt(0)+h.charAt(0),16)/255,this.g=parseInt(h.charAt(1)+h.charAt(1),16)/255,this.b=parseInt(h.charAt(2)+h.charAt(2),16)/255,this;if(6===l)return this.r=parseInt(h.charAt(0)+h.charAt(1),16)/255,this.g=parseInt(h.charAt(2)+h.charAt(3),16)/255,this.b=parseInt(h.charAt(4)+h.charAt(5),16)/255,this}t&&0Math.abs(t.z)?K.set(-t.y,t.x,0):K.set(0,-t.z,t.y)):K.crossVectors(t,e),this._x=K.x,this._y=K.y,this._z=K.z,this._w=$,this.normalize(),this},inverse:function(){return this.conjugate().normalize(),this},conjugate:function(){return this._x*=-1,this._y*=-1,this._z*=-1,this.onChangeCallback(),this},dot:function(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w},lengthSq:function(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w},length:function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)},normalize:function(){var t=this.length();return 0===t?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this.onChangeCallback(),this},multiply:function(t,e){return void 0!==e?this.multiplyQuaternions(t,e):this.multiplyQuaternions(this,t)},multiplyQuaternions:function(t,e){var i=t._x,r=t._y,n=t._z,a=t._w,o=e._x,s=e._y,h=e._z,l=e._w;return this._x=i*l+a*o+r*h-n*s,this._y=r*l+a*s+n*o-i*h,this._z=n*l+a*h+i*s-r*o,this._w=a*l-i*o-r*s-n*h,this.onChangeCallback(),this},slerp:function(t,e){if(0===e)return this;if(1===e)return this.copy(t);var i=this._x,r=this._y,n=this._z,a=this._w,o=a*t._w+i*t._x+r*t._y+n*t._z;if(o<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,o=-o):this.copy(t),1<=o)return this._w=a,this._x=i,this._y=r,this._z=n,this;var s=Math.sqrt(1-o*o);if(Math.abs(s)<.001)return this._w=.5*(a+this._w),this._x=.5*(i+this._x),this._y=.5*(r+this._y),this._z=.5*(n+this._z),this;var h=Math.atan2(s,o),l=Math.sin((1-e)*h)/s,u=Math.sin(e*h)/s;return this._w=a*l+this._w*u,this._x=i*l+this._x*u,this._y=r*l+this._y*u,this._z=n*l+this._z*u,this.onChangeCallback(),this},equals:function(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w},fromArray:function(t,e){return void 0===e&&(e=0),this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this.onChangeCallback(),this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t},onChange:function(t){return this.onChangeCallback=t,this},onChangeCallback:function(){}},Object.assign(Oe.Quaternion,{slerp:function(t,e,i,r){return i.copy(t).slerp(e,r)},slerpFlat:function(t,e,i,r,n,a,o){var s=i[r+0],h=i[r+1],l=i[r+2],u=i[r+3],c=n[a+0],p=n[a+1],d=n[a+2],f=n[a+3];if(u!==f||s!==c||h!==p||l!==d){var m=1-o,v=s*c+h*p+l*d+u*f,g=0<=v?1:-1,y=1-v*v;if(y>Number.EPSILON){var x=Math.sqrt(y),M=Math.atan2(x,v*g);m=Math.sin(m*M)/x,o=Math.sin(o*M)/x}var b=o*g;if(s=s*m+c*b,h=h*m+p*b,l=l*m+d*b,u=u*m+f*b,m===1-o){var _=1/Math.sqrt(s*s+h*h+l*l+u*u);s*=_,h*=_,l*=_,u*=_}}t[e]=s,t[e+1]=h,t[e+2]=l,t[e+3]=u}}),Oe.Triangle=function(t,e,i){this.a=void 0!==t?t:new Oe.Vector3,this.b=void 0!==e?e:new Oe.Vector3,this.c=void 0!==i?i:new Oe.Vector3},Oe.Triangle.normal=(tt=new Oe.Vector3,function(t,e,i,r){var n=r||new Oe.Vector3;n.subVectors(i,e),tt.subVectors(t,e),n.cross(tt);var a=n.lengthSq();return 0this.max.x||t.ythis.max.y||t.zthis.max.z)},containsBox:function(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z},getParameter:function(t,e){return(e||new Oe.Vector3).set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))},intersectsBox:function(t){return!(t.max.xthis.max.x||t.max.ythis.max.y||t.max.zthis.max.z)},intersectsSphere:function(t){return void 0===ut&&(ut=new Oe.Vector3),this.clampPoint(t.center,ut),ut.distanceToSquared(t.center)<=t.radius*t.radius},intersectsPlane:function(t){var e,i;return i=0=t.constant},clampPoint:function(t,e){return(e||new Oe.Vector3).copy(t).clamp(this.min,this.max)},distanceToPoint:(lt=new Oe.Vector3,function(t){return lt.copy(t).clamp(this.min,this.max).sub(t).length()}),getBoundingSphere:(ht=new Oe.Vector3,function(t){var e=t||new Oe.Sphere;return e.center=this.center(),e.radius=.5*this.size(ht).length(),e}),intersect:function(t){return this.min.max(t.min),this.max.min(t.max),this},union:function(t){return this.min.min(t.min),this.max.max(t.max),this},applyMatrix4:(st=[new Oe.Vector3,new Oe.Vector3,new Oe.Vector3,new Oe.Vector3,new Oe.Vector3,new Oe.Vector3,new Oe.Vector3,new Oe.Vector3],function(t){return st[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),st[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),st[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),st[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),st[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),st[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),st[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),st[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.makeEmpty(),this.setFromPoints(st),this}),translate:function(t){return this.min.add(t),this.max.add(t),this},equals:function(t){return t.min.equals(this.min)&&t.max.equals(this.max)}},Oe.Euler=function(t,e,i,r){this._x=t||0,this._y=e||0,this._z=i||0,this._order=r||Oe.Euler.DefaultOrder},Oe.Euler.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"],Oe.Euler.DefaultOrder="XYZ",Oe.Euler.prototype={constructor:Oe.Euler,get x(){return this._x},set x(t){this._x=t,this.onChangeCallback()},get y(){return this._y},set y(t){this._y=t,this.onChangeCallback()},get z(){return this._z},set z(t){this._z=t,this.onChangeCallback()},get order(){return this._order},set order(t){this._order=t,this.onChangeCallback()},set:function(t,e,i,r){return this._x=t,this._y=e,this._z=i,this._order=r||this._order,this.onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._order)},copy:function(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this.onChangeCallback(),this},setFromRotationMatrix:function(t,e,i){var r=Oe.Math.clamp,n=t.elements,a=n[0],o=n[4],s=n[8],h=n[1],l=n[5],u=n[9],c=n[2],p=n[6],d=n[10];return"XYZ"===(e=e||this._order)?(this._y=Math.asin(r(s,-1,1)),Math.abs(s)<.99999?(this._x=Math.atan2(-u,d),this._z=Math.atan2(-o,a)):(this._x=Math.atan2(p,l),this._z=0)):"YXZ"===e?(this._x=Math.asin(-r(u,-1,1)),Math.abs(u)<.99999?(this._y=Math.atan2(s,d),this._z=Math.atan2(h,l)):(this._y=Math.atan2(-c,a),this._z=0)):"ZXY"===e?(this._x=Math.asin(r(p,-1,1)),Math.abs(p)<.99999?(this._y=Math.atan2(-c,d),this._z=Math.atan2(-o,l)):(this._y=0,this._z=Math.atan2(h,a))):"ZYX"===e?(this._y=Math.asin(-r(c,-1,1)),Math.abs(c)<.99999?(this._x=Math.atan2(p,d),this._z=Math.atan2(h,a)):(this._x=0,this._z=Math.atan2(-o,l))):"YZX"===e?(this._z=Math.asin(r(h,-1,1)),Math.abs(h)<.99999?(this._x=Math.atan2(-u,l),this._y=Math.atan2(-c,a)):(this._x=0,this._y=Math.atan2(s,d))):"XZY"===e&&(this._z=Math.asin(-r(o,-1,1)),Math.abs(o)<.99999?(this._x=Math.atan2(p,l),this._y=Math.atan2(s,a)):(this._x=Math.atan2(-u,d),this._y=0)),this._order=e,!1!==i&&this.onChangeCallback(),this},setFromQuaternion:function(t,e,i){return void 0===ft&&(ft=new Oe.Matrix4),ft.makeRotationFromQuaternion(t),this.setFromRotationMatrix(ft,e,i),this},setFromVector3:function(t,e){return this.set(t.x,t.y,t.z,e||this._order)},reorder:(dt=new Oe.Quaternion,function(t){dt.setFromEuler(this),this.setFromQuaternion(dt,t)}),equals:function(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order},fromArray:function(t){return this._x=t[0],this._y=t[1],this._z=t[2],void 0!==t[3]&&(this._order=t[3]),this.onChangeCallback(),this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._order,t},toVector3:function(t){return t?t.set(this._x,this._y,this._z):new Oe.Vector3(this._x,this._y,this._z)},onChange:function(t){return this.onChangeCallback=t,this},onChangeCallback:function(){}},Oe.Ray=function(t,e){this.origin=void 0!==t?t:new Oe.Vector3,this.direction=void 0!==e?e:new Oe.Vector3},Oe.Ray.prototype={constructor:Oe.Ray,set:function(t,e){return this.origin.copy(t),this.direction.copy(e),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.origin.copy(t.origin),this.direction.copy(t.direction),this},at:function(t,e){return(e||new Oe.Vector3).copy(this.direction).multiplyScalar(t).add(this.origin)},lookAt:function(t){this.direction.copy(t).sub(this.origin).normalize()},recast:(Et=new Oe.Vector3,function(t){return this.origin.copy(this.at(t,Et)),this}),closestPointToPoint:function(t,e){var i=e||new Oe.Vector3;i.subVectors(t,this.origin);var r=i.dot(this.direction);return r<0?i.copy(this.origin):i.copy(this.direction).multiplyScalar(r).add(this.origin)},distanceToPoint:function(t){return Math.sqrt(this.distanceSqToPoint(t))},distanceSqToPoint:(wt=new Oe.Vector3,function(t){var e=wt.subVectors(t,this.origin).dot(this.direction);return e<0?this.origin.distanceToSquared(t):(wt.copy(this.direction).multiplyScalar(e).add(this.origin),wt.distanceToSquared(t))}),distanceSqToSegment:(bt=new Oe.Vector3,_t=new Oe.Vector3,St=new Oe.Vector3,function(t,e,i,r){bt.copy(t).add(e).multiplyScalar(.5),_t.copy(e).sub(t).normalize(),St.copy(this.origin).sub(bt);var n,a,o,s,h=.5*t.distanceTo(e),l=-this.direction.dot(_t),u=St.dot(this.direction),c=-St.dot(_t),p=St.lengthSq(),d=Math.abs(1-l*l);if(0this.radius*this.radius&&(r.sub(this.center).normalize(),r.multiplyScalar(this.radius).add(this.center)),r},getBoundingBox:function(t){var e=t||new Oe.Box3;return e.set(this.center,this.center),e.expandByScalar(this.radius),e},applyMatrix4:function(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this},translate:function(t){return this.center.add(t),this},equals:function(t){return t.center.equals(this.center)&&t.radius===this.radius}},Oe.Frustum=function(t,e,i,r,n,a){this.planes=[void 0!==t?t:new Oe.Plane,void 0!==e?e:new Oe.Plane,void 0!==i?i:new Oe.Plane,void 0!==r?r:new Oe.Plane,void 0!==n?n:new Oe.Plane,void 0!==a?a:new Oe.Plane]},Oe.Frustum.prototype={constructor:Oe.Frustum,set:function(t,e,i,r,n,a){var o=this.planes;return o[0].copy(t),o[1].copy(e),o[2].copy(i),o[3].copy(r),o[4].copy(n),o[5].copy(a),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){for(var e=this.planes,i=0;i<6;i++)e[i].copy(t.planes[i]);return this},setFromMatrix:function(t){var e=this.planes,i=t.elements,r=i[0],n=i[1],a=i[2],o=i[3],s=i[4],h=i[5],l=i[6],u=i[7],c=i[8],p=i[9],d=i[10],f=i[11],m=i[12],v=i[13],g=i[14],y=i[15];return e[0].setComponents(o-r,u-s,f-c,y-m).normalize(),e[1].setComponents(o+r,u+s,f+c,y+m).normalize(),e[2].setComponents(o+n,u+h,f+p,y+v).normalize(),e[3].setComponents(o-n,u-h,f-p,y-v).normalize(),e[4].setComponents(o-a,u-l,f-d,y-g).normalize(),e[5].setComponents(o+a,u+l,f+d,y+g).normalize(),this},intersectsObject:(Rt=new Oe.Sphere,function(t){var e=t.geometry;return null===e.boundingSphere&&e.computeBoundingSphere(),Rt.copy(e.boundingSphere),Rt.applyMatrix4(t.matrixWorld),this.intersectsSphere(Rt)}),intersectsSphere:function(t){for(var e=this.planes,i=t.center,r=-t.radius,n=0;n<6;n++){if(e[n].distanceToPoint(i)=e.HAVE_CURRENT_DATA&&(l.needsUpdate=!0)}()},Oe.VideoTexture.prototype=Object.create(Oe.Texture.prototype),Oe.VideoTexture.prototype.constructor=Oe.VideoTexture,Oe.Sprite=(he=new Uint16Array([0,1,2,0,2,3]),le=new Float32Array([-.5,-.5,0,.5,-.5,0,.5,.5,0,-.5,.5,0]),ue=new Float32Array([0,0,1,0,1,1,0,1]),(ce=new Oe.BufferGeometry).setIndex(new Oe.BufferAttribute(he,1)),ce.addAttribute("position",new Oe.BufferAttribute(le,3)),ce.addAttribute("uv",new Oe.BufferAttribute(ue,2)),function(t){Oe.Object3D.call(this),this.type="Sprite",this.geometry=ce,this.material=void 0!==t?t:new Oe.SpriteMaterial}),Oe.Sprite.prototype=Object.create(Oe.Object3D.prototype),Oe.Sprite.prototype.constructor=Oe.Sprite,Oe.Sprite.prototype.raycast=(pe=new Oe.Vector3,function(t,e){pe.setFromMatrixPosition(this.matrixWorld);var i=t.ray.distanceSqToPoint(pe);this.scale.x*this.scale.yt.far||e.push({distance:M,point:h.clone().applyMatrix4(this.matrixWorld),index:f,face:null,faceIndex:null,object:this}))}else for(f=0,m=p.length/3-1;ft.far||e.push({distance:M,point:h.clone().applyMatrix4(this.matrixWorld),index:f,face:null,faceIndex:null,object:this}))}else if(n instanceof Oe.Geometry){var y=n.vertices,x=y.length;for(f=0;ft.far||e.push({distance:M,point:h.clone().applyMatrix4(this.matrixWorld),index:f,face:null,faceIndex:null,object:this}))}}}}),Oe.Line.prototype.clone=function(){return new this.constructor(this.geometry,this.material).copy(this)},Oe.LineStrip=0,Oe.LinePieces=1,Oe.LineSegments=function(t,e){Oe.Line.call(this,t,e),this.type="LineSegments"},Oe.LineSegments.prototype=Object.create(Oe.Line.prototype),Oe.LineSegments.prototype.constructor=Oe.LineSegments,Oe.Mesh=function(t,e){Oe.Object3D.call(this),this.type="Mesh",this.geometry=void 0!==t?t:new Oe.Geometry,this.material=void 0!==e?e:new Oe.MeshBasicMaterial({color:16777215*Math.random()}),this.drawMode=Oe.TrianglesDrawMode,this.updateMorphTargets()},Oe.Mesh.prototype=Object.create(Oe.Object3D.prototype),Oe.Mesh.prototype.constructor=Oe.Mesh,Oe.Mesh.prototype.setDrawMode=function(t){this.drawMode=t},Oe.Mesh.prototype.updateMorphTargets=function(){if(void 0!==this.geometry.morphTargets&&0a.far)return;o.push({distance:n,distanceToRay:Math.sqrt(i),point:r.clone(),index:e,face:null,object:s})}}}),Oe.Points.prototype.clone=function(){return new this.constructor(this.geometry,this.material).copy(this)},Oe.Light=function(t,e){Oe.Object3D.call(this),this.type="Light",this.color=new Oe.Color(t),this.intensity=void 0!==e?e:1,this.receiveShadow=void 0},Oe.Light.prototype=Object.create(Oe.Object3D.prototype),Oe.Light.prototype.constructor=Oe.Light,Oe.Light.prototype.copy=function(t){return Oe.Object3D.prototype.copy.call(this,t),this.color.copy(t.color),this.intensity=t.intensity,this},Oe.Light.prototype.toJSON=function(t){var e=Oe.Object3D.prototype.toJSON.call(this,t);return e.object.color=this.color.getHex(),e.object.intensity=this.intensity,void 0!==this.groundColor&&(e.object.groundColor=this.groundColor.getHex()),void 0!==this.distance&&(e.object.distance=this.distance),void 0!==this.angle&&(e.object.angle=this.angle),void 0!==this.decay&&(e.object.decay=this.decay),void 0!==this.penumbra&&(e.object.penumbra=this.penumbra),e},Oe.ShaderChunk={},Oe.ShaderChunk.alphamap_fragment="#ifdef USE_ALPHAMAP\n\n\tdiffuseColor.a *= texture2D( alphaMap, vUv ).g;\n\n#endif\n",Oe.ShaderChunk.alphamap_pars_fragment="#ifdef USE_ALPHAMAP\n\n\tuniform sampler2D alphaMap;\n\n#endif\n",Oe.ShaderChunk.alphatest_fragment="#ifdef ALPHATEST\n\n\tif ( diffuseColor.a < ALPHATEST ) discard;\n\n#endif\n",Oe.ShaderChunk.aomap_fragment="#ifdef USE_AOMAP\n\n\tfloat ambientOcclusion = ( texture2D( aoMap, vUv2 ).r - 1.0 ) * aoMapIntensity + 1.0;\n\n\treflectedLight.indirectDiffuse *= ambientOcclusion;\n\n\t#if defined( USE_ENVMAP ) && defined( STANDARD )\n\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\n\t\treflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.specularRoughness );\n\n\t#endif\n\n#endif\n",Oe.ShaderChunk.aomap_pars_fragment="#ifdef USE_AOMAP\n\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n\n#endif",Oe.ShaderChunk.begin_vertex="\nvec3 transformed = vec3( position );\n",Oe.ShaderChunk.beginnormal_vertex="\nvec3 objectNormal = vec3( normal );\n",Oe.ShaderChunk.color_fragment="#ifdef USE_COLOR\n\n\tdiffuseColor.rgb *= vColor;\n\n#endif",Oe.ShaderChunk.color_pars_fragment="#ifdef USE_COLOR\n\n\tvarying vec3 vColor;\n\n#endif\n",Oe.ShaderChunk.color_pars_vertex="#ifdef USE_COLOR\n\n\tvarying vec3 vColor;\n\n#endif",Oe.ShaderChunk.color_vertex="#ifdef USE_COLOR\n\n\tvColor.xyz = color.xyz;\n\n#endif",Oe.ShaderChunk.common="#define PI 3.14159\n#define PI2 6.28318\n#define RECIPROCAL_PI 0.31830988618\n#define RECIPROCAL_PI2 0.15915494\n#define LOG2 1.442695\n#define EPSILON 1e-6\n\n#define saturate(a) clamp( a, 0.0, 1.0 )\n#define whiteCompliment(a) ( 1.0 - saturate( a ) )\n\nfloat pow2( const in float x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }\n\n\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\n\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\n\nstruct GeometricContext {\n\tvec3 position;\n\tvec3 normal;\n\tvec3 viewDir;\n};\n\n\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n\n}\n\n// http://en.wikibooks.org/wiki/GLSL_Programming/Applying_Matrix_Transformations\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n\n}\n\nvec3 projectOnPlane(in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\n\tfloat distance = dot( planeNormal, point - pointOnPlane );\n\n\treturn - distance * planeNormal + point;\n\n}\n\nfloat sideOfPlane( in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\n\treturn sign( dot( point - pointOnPlane, planeNormal ) );\n\n}\n\nvec3 linePlaneIntersect( in vec3 pointOnLine, in vec3 lineDirection, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\n\treturn lineDirection * ( dot( planeNormal, pointOnPlane - pointOnLine ) / dot( planeNormal, lineDirection ) ) + pointOnLine;\n\n}\n",Oe.ShaderChunk.defaultnormal_vertex="#ifdef FLIP_SIDED\n\n\tobjectNormal = -objectNormal;\n\n#endif\n\nvec3 transformedNormal = normalMatrix * objectNormal;\n",Oe.ShaderChunk.encodings_fragment=" gl_FragColor = linearToOutputTexel( gl_FragColor );\n",Oe.ShaderChunk.encodings_pars_fragment="// For a discussion of what this is, please read this: http://lousodrome.net/blog/light/2013/05/26/gamma-correct-and-hdr-rendering-in-a-32-bits-buffer/\n\nvec4 LinearToLinear( in vec4 value ) {\n return value;\n}\n\nvec4 GammaToLinear( in vec4 value, in float gammaFactor ) {\n return vec4( pow( value.xyz, vec3( gammaFactor ) ), value.w );\n}\nvec4 LinearToGamma( in vec4 value, in float gammaFactor ) {\n return vec4( pow( value.xyz, vec3( 1.0 / gammaFactor ) ), value.w );\n}\n\nvec4 sRGBToLinear( in vec4 value ) {\n return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.w );\n}\nvec4 LinearTosRGB( in vec4 value ) {\n return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.w );\n}\n\nvec4 RGBEToLinear( in vec4 value ) {\n return vec4( value.rgb * exp2( value.a * 255.0 - 128.0 ), 1.0 );\n}\nvec4 LinearToRGBE( in vec4 value ) {\n float maxComponent = max( max( value.r, value.g ), value.b );\n float fExp = clamp( ceil( log2( maxComponent ) ), -128.0, 127.0 );\n return vec4( value.rgb / exp2( fExp ), ( fExp + 128.0 ) / 255.0 );\n// return vec4( value.brg, ( 3.0 + 128.0 ) / 256.0 );\n}\n\n// reference: http://iwasbeingirony.blogspot.ca/2010/06/difference-between-rgbm-and-rgbd.html\nvec4 RGBMToLinear( in vec4 value, in float maxRange ) {\n return vec4( value.xyz * value.w * maxRange, 1.0 );\n}\nvec4 LinearToRGBM( in vec4 value, in float maxRange ) {\n float maxRGB = max( value.x, max( value.g, value.b ) );\n float M = clamp( maxRGB / maxRange, 0.0, 1.0 );\n M = ceil( M * 255.0 ) / 255.0;\n return vec4( value.rgb / ( M * maxRange ), M );\n}\n\n// reference: http://iwasbeingirony.blogspot.ca/2010/06/difference-between-rgbm-and-rgbd.html\nvec4 RGBDToLinear( in vec4 value, in float maxRange ) {\n return vec4( value.rgb * ( ( maxRange / 255.0 ) / value.a ), 1.0 );\n}\nvec4 LinearToRGBD( in vec4 value, in float maxRange ) {\n float maxRGB = max( value.x, max( value.g, value.b ) );\n float D = max( maxRange / maxRGB, 1.0 );\n D = min( floor( D ) / 255.0, 1.0 );\n return vec4( value.rgb * ( D * ( 255.0 / maxRange ) ), D );\n}\n\n// LogLuv reference: http://graphicrants.blogspot.ca/2009/04/rgbm-color-encoding.html\n\n// M matrix, for encoding\nconst mat3 cLogLuvM = mat3( 0.2209, 0.3390, 0.4184, 0.1138, 0.6780, 0.7319, 0.0102, 0.1130, 0.2969 );\nvec4 LinearToLogLuv( in vec4 value ) {\n vec3 Xp_Y_XYZp = value.rgb * cLogLuvM;\n Xp_Y_XYZp = max(Xp_Y_XYZp, vec3(1e-6, 1e-6, 1e-6));\n vec4 vResult;\n vResult.xy = Xp_Y_XYZp.xy / Xp_Y_XYZp.z;\n float Le = 2.0 * log2(Xp_Y_XYZp.y) + 127.0;\n vResult.w = fract(Le);\n vResult.z = (Le - (floor(vResult.w*255.0))/255.0)/255.0;\n return vResult;\n}\n\n// Inverse M matrix, for decoding\nconst mat3 cLogLuvInverseM = mat3( 6.0014, -2.7008, -1.7996, -1.3320, 3.1029, -5.7721, 0.3008, -1.0882, 5.6268 );\nvec4 LogLuvToLinear( in vec4 value ) {\n float Le = value.z * 255.0 + value.w;\n vec3 Xp_Y_XYZp;\n Xp_Y_XYZp.y = exp2((Le - 127.0) / 2.0);\n Xp_Y_XYZp.z = Xp_Y_XYZp.y / value.y;\n Xp_Y_XYZp.x = value.x * Xp_Y_XYZp.z;\n vec3 vRGB = Xp_Y_XYZp.rgb * cLogLuvInverseM;\n return vec4( max(vRGB, 0.0), 1.0 );\n}\n",Oe.ShaderChunk.envmap_fragment="#ifdef USE_ENVMAP\n\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\n\t\tvec3 cameraToVertex = normalize( vWorldPosition - cameraPosition );\n\n\t\t// Transforming Normal Vectors with the Inverse Transformation\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\n\t\t\tvec3 reflectVec = reflect( cameraToVertex, worldNormal );\n\n\t\t#else\n\n\t\t\tvec3 reflectVec = refract( cameraToVertex, worldNormal, refractionRatio );\n\n\t\t#endif\n\n\t#else\n\n\t\tvec3 reflectVec = vReflect;\n\n\t#endif\n\n\t#ifdef DOUBLE_SIDED\n\t\tfloat flipNormal = ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t#else\n\t\tfloat flipNormal = 1.0;\n\t#endif\n\n\t#ifdef ENVMAP_TYPE_CUBE\n\n\t\tvec4 envColor = textureCube( envMap, flipNormal * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\n\t#elif defined( ENVMAP_TYPE_EQUIREC )\n\n\t\tvec2 sampleUV;\n\t\tsampleUV.y = saturate( flipNormal * reflectVec.y * 0.5 + 0.5 );\n\t\tsampleUV.x = atan( flipNormal * reflectVec.z, flipNormal * reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n\t\tvec4 envColor = texture2D( envMap, sampleUV );\n\n\t#elif defined( ENVMAP_TYPE_SPHERE )\n\n\t\tvec3 reflectView = flipNormal * normalize((viewMatrix * vec4( reflectVec, 0.0 )).xyz + vec3(0.0,0.0,1.0));\n\t\tvec4 envColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5 );\n\n\t#endif\n\n\tenvColor = envMapTexelToLinear( envColor );\n\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\n\t#endif\n\n#endif\n",Oe.ShaderChunk.envmap_pars_fragment="#if defined( USE_ENVMAP ) || defined( STANDARD )\n\tuniform float reflectivity;\n\tuniform float envMapIntenstiy;\n#endif\n\n#ifdef USE_ENVMAP\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\tuniform float flipEnvMap;\n\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( STANDARD )\n\n\t\tuniform float refractionRatio;\n\n\t#else\n\n\t\tvarying vec3 vReflect;\n\n\t#endif\n\n#endif\n",Oe.ShaderChunk.envmap_pars_vertex="#if defined( USE_ENVMAP ) && ! defined( USE_BUMPMAP ) && ! defined( USE_NORMALMAP ) && ! defined( PHONG ) && ! defined( STANDARD )\n\n\tvarying vec3 vReflect;\n\n\tuniform float refractionRatio;\n\n#endif\n",Oe.ShaderChunk.envmap_vertex="#if defined( USE_ENVMAP ) && ! defined( USE_BUMPMAP ) && ! defined( USE_NORMALMAP ) && ! defined( PHONG ) && ! defined( STANDARD )\n\n\tvec3 cameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\n\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\n\t#ifdef ENVMAP_MODE_REFLECTION\n\n\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\n\t#else\n\n\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\n\t#endif\n\n#endif\n",Oe.ShaderChunk.fog_fragment="#ifdef USE_FOG\n\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\n\t\tfloat depth = gl_FragDepthEXT / gl_FragCoord.w;\n\n\t#else\n\n\t\tfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n\n\t#endif\n\n\t#ifdef FOG_EXP2\n\n\t\tfloat fogFactor = whiteCompliment( exp2( - fogDensity * fogDensity * depth * depth * LOG2 ) );\n\n\t#else\n\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n\n\t#endif\n\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n\n#endif\n",Oe.ShaderChunk.fog_pars_fragment="#ifdef USE_FOG\n\n\tuniform vec3 fogColor;\n\n\t#ifdef FOG_EXP2\n\n\t\tuniform float fogDensity;\n\n\t#else\n\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n\n#endif",Oe.ShaderChunk.logdepthbuf_fragment="#if defined(USE_LOGDEPTHBUF) && defined(USE_LOGDEPTHBUF_EXT)\n\n\tgl_FragDepthEXT = log2(vFragDepth) * logDepthBufFC * 0.5;\n\n#endif",Oe.ShaderChunk.logdepthbuf_pars_fragment="#ifdef USE_LOGDEPTHBUF\n\n\tuniform float logDepthBufFC;\n\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\n\t\tvarying float vFragDepth;\n\n\t#endif\n\n#endif\n",Oe.ShaderChunk.logdepthbuf_pars_vertex="#ifdef USE_LOGDEPTHBUF\n\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\n\t\tvarying float vFragDepth;\n\n\t#endif\n\n\tuniform float logDepthBufFC;\n\n#endif",Oe.ShaderChunk.logdepthbuf_vertex="#ifdef USE_LOGDEPTHBUF\n\n\tgl_Position.z = log2(max( EPSILON, gl_Position.w + 1.0 )) * logDepthBufFC;\n\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\n\t\tvFragDepth = 1.0 + gl_Position.w;\n\n\t#else\n\n\t\tgl_Position.z = (gl_Position.z - 1.0) * gl_Position.w;\n\n\t#endif\n\n#endif\n",Oe.ShaderChunk.map_fragment="#ifdef USE_MAP\n\n\tvec4 texelColor = texture2D( map, vUv );\n\n\ttexelColor = mapTexelToLinear( texelColor );\n\tdiffuseColor *= texelColor;\n\n#endif\n",Oe.ShaderChunk.map_pars_fragment="#ifdef USE_MAP\n\n\tuniform sampler2D map;\n\n#endif\n",Oe.ShaderChunk.morphnormal_vertex="#ifdef USE_MORPHNORMALS\n\n\tobjectNormal += ( morphNormal0 - normal ) * morphTargetInfluences[ 0 ];\n\tobjectNormal += ( morphNormal1 - normal ) * morphTargetInfluences[ 1 ];\n\tobjectNormal += ( morphNormal2 - normal ) * morphTargetInfluences[ 2 ];\n\tobjectNormal += ( morphNormal3 - normal ) * morphTargetInfluences[ 3 ];\n\n#endif\n",Oe.ShaderChunk.morphtarget_pars_vertex="#ifdef USE_MORPHTARGETS\n\n\t#ifndef USE_MORPHNORMALS\n\n\tuniform float morphTargetInfluences[ 8 ];\n\n\t#else\n\n\tuniform float morphTargetInfluences[ 4 ];\n\n\t#endif\n\n#endif",Oe.ShaderChunk.morphtarget_vertex="#ifdef USE_MORPHTARGETS\n\n\ttransformed += ( morphTarget0 - position ) * morphTargetInfluences[ 0 ];\n\ttransformed += ( morphTarget1 - position ) * morphTargetInfluences[ 1 ];\n\ttransformed += ( morphTarget2 - position ) * morphTargetInfluences[ 2 ];\n\ttransformed += ( morphTarget3 - position ) * morphTargetInfluences[ 3 ];\n\n\t#ifndef USE_MORPHNORMALS\n\n\ttransformed += ( morphTarget4 - position ) * morphTargetInfluences[ 4 ];\n\ttransformed += ( morphTarget5 - position ) * morphTargetInfluences[ 5 ];\n\ttransformed += ( morphTarget6 - position ) * morphTargetInfluences[ 6 ];\n\ttransformed += ( morphTarget7 - position ) * morphTargetInfluences[ 7 ];\n\n\t#endif\n\n#endif\n",Oe.ShaderChunk.premultiplied_alpha_fragment="#ifdef PREMULTIPLIED_ALPHA\n\n\t// Get get normal blending with premultipled, use with CustomBlending, OneFactor, OneMinusSrcAlphaFactor, AddEquation.\n\tgl_FragColor.rgb *= gl_FragColor.a;\n\n#endif\n",Oe.ShaderChunk.project_vertex="#ifdef USE_SKINNING\n\n\tvec4 mvPosition = modelViewMatrix * skinned;\n\n#else\n\n\tvec4 mvPosition = modelViewMatrix * vec4( transformed, 1.0 );\n\n#endif\n\ngl_Position = projectionMatrix * mvPosition;\n",Oe.ShaderChunk.skinbase_vertex="#ifdef USE_SKINNING\n\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n\n#endif",Oe.ShaderChunk.skinning_pars_vertex="#ifdef USE_SKINNING\n\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\n\t#ifdef BONE_TEXTURE\n\n\t\tuniform sampler2D boneTexture;\n\t\tuniform int boneTextureWidth;\n\t\tuniform int boneTextureHeight;\n\n\t\tmat4 getBoneMatrix( const in float i ) {\n\n\t\t\tfloat j = i * 4.0;\n\t\t\tfloat x = mod( j, float( boneTextureWidth ) );\n\t\t\tfloat y = floor( j / float( boneTextureWidth ) );\n\n\t\t\tfloat dx = 1.0 / float( boneTextureWidth );\n\t\t\tfloat dy = 1.0 / float( boneTextureHeight );\n\n\t\t\ty = dy * ( y + 0.5 );\n\n\t\t\tvec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n\t\t\tvec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n\t\t\tvec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n\t\t\tvec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n\n\t\t\tmat4 bone = mat4( v1, v2, v3, v4 );\n\n\t\t\treturn bone;\n\n\t\t}\n\n\t#else\n\n\t\tuniform mat4 boneGlobalMatrices[ MAX_BONES ];\n\n\t\tmat4 getBoneMatrix( const in float i ) {\n\n\t\t\tmat4 bone = boneGlobalMatrices[ int(i) ];\n\t\t\treturn bone;\n\n\t\t}\n\n\t#endif\n\n#endif\n",Oe.ShaderChunk.skinning_vertex="#ifdef USE_SKINNING\n\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\tskinned = bindMatrixInverse * skinned;\n\n#endif\n",Oe.ShaderChunk.skinnormal_vertex="#ifdef USE_SKINNING\n\n\tmat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight.x * boneMatX;\n\tskinMatrix += skinWeight.y * boneMatY;\n\tskinMatrix += skinWeight.z * boneMatZ;\n\tskinMatrix += skinWeight.w * boneMatW;\n\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n\n#endif\n",Oe.ShaderChunk.specularmap_fragment="float specularStrength;\n\n#ifdef USE_SPECULARMAP\n\n\tvec4 texelSpecular = texture2D( specularMap, vUv );\n\tspecularStrength = texelSpecular.r;\n\n#else\n\n\tspecularStrength = 1.0;\n\n#endif",Oe.ShaderChunk.specularmap_pars_fragment="#ifdef USE_SPECULARMAP\n\n\tuniform sampler2D specularMap;\n\n#endif",Oe.ShaderChunk.tonemapping_fragment="#if defined( TONE_MAPPING )\n\n gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n\n#endif\n",Oe.ShaderChunk.tonemapping_pars_fragment="#define saturate(a) clamp( a, 0.0, 1.0 )\n\nuniform float toneMappingExposure;\nuniform float toneMappingWhitePoint;\n\n// exposure only\nvec3 LinearToneMapping( vec3 color ) {\n\n return toneMappingExposure * color;\n\n}\n\n// source: https://www.cs.utah.edu/~reinhard/cdrom/\nvec3 ReinhardToneMapping( vec3 color ) {\n\n color *= toneMappingExposure;\n return saturate( color / ( vec3( 1.0 ) + color ) );\n\n}\n\n// source: http://filmicgames.com/archives/75\n#define Uncharted2Helper( x ) max( ( ( x * ( 0.15 * x + 0.10 * 0.50 ) + 0.20 * 0.02 ) / ( x * ( 0.15 * x + 0.50 ) + 0.20 * 0.30 ) ) - 0.02 / 0.30, vec3( 0.0 ) )\nvec3 Uncharted2ToneMapping( vec3 color ) {\n\n // John Hable's filmic operator from Uncharted 2 video game\n color *= toneMappingExposure;\n return saturate( Uncharted2Helper( color ) / Uncharted2Helper( vec3( toneMappingWhitePoint ) ) );\n\n}\n\n// source: http://filmicgames.com/archives/75\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n\n // optimized filmic operator by Jim Hejl and Richard Burgess-Dawson\n color *= toneMappingExposure;\n color = max( vec3( 0.0 ), color - 0.004 );\n return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n\n}\n",Oe.ShaderChunk.uv2_pars_fragment="#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\n\tvarying vec2 vUv2;\n\n#endif",Oe.ShaderChunk.uv2_pars_vertex="#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\n\tattribute vec2 uv2;\n\tvarying vec2 vUv2;\n\n#endif",Oe.ShaderChunk.uv2_vertex="#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\n\tvUv2 = uv2;\n\n#endif",Oe.ShaderChunk.uv_pars_fragment="#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n\n\tvarying vec2 vUv;\n\n#endif",Oe.ShaderChunk.uv_pars_vertex="#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n\n\tvarying vec2 vUv;\n\tuniform vec4 offsetRepeat;\n\n#endif\n",Oe.ShaderChunk.uv_vertex="#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n\n\tvUv = uv * offsetRepeat.zw + offsetRepeat.xy;\n\n#endif",Oe.ShaderChunk.worldpos_vertex="#if defined( USE_ENVMAP ) || defined( PHONG ) || defined( STANDARD ) || defined( LAMBERT ) || defined ( USE_SHADOWMAP )\n\n\t#ifdef USE_SKINNING\n\n\t\tvec4 worldPosition = modelMatrix * skinned;\n\n\t#else\n\n\t\tvec4 worldPosition = modelMatrix * vec4( transformed, 1.0 );\n\n\t#endif\n\n#endif\n",Oe.ShaderChunk.meshbasic_frag="uniform vec3 diffuse;\nuniform float opacity;\n\n#ifndef FLAT_SHADED\n\n\tvarying vec3 vNormal;\n\n#endif\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nvoid main() {\n\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\tReflectedLight reflectedLight;\n\treflectedLight.directDiffuse = vec3( 0.0 );\n\treflectedLight.directSpecular = vec3( 0.0 );\n\treflectedLight.indirectDiffuse = diffuseColor.rgb;\n\treflectedLight.indirectSpecular = vec3( 0.0 );\n\n\t#include \n\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\n\t#include \n\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\n\t#include \n\t#include \n\t#include \n\t#include \n\n}\n",Oe.ShaderChunk.meshbasic_vert="#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nvoid main() {\n\n\t#include \n\t#include \n\t#include \n\t#include \n\n\t#ifdef USE_ENVMAP\n\n\t#include \n\t#include \n\t#include \n\t#include \n\n\t#endif\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\t#include \n\t#include \n\n}\n",Oe.UniformsUtils={merge:function(t){for(var e={},i=0;ie||t.height>e){var i=e/Math.max(t.width,t.height),r=document.createElement("canvas");return r.width=Math.floor(t.width*i),r.height=Math.floor(t.height*i),r.getContext("2d").drawImage(t,0,0,t.width,t.height,0,0,r.width,r.height),r}return t}function Tt(t){return Oe.Math.isPowerOfTwo(t.width)&&Oe.Math.isPowerOfTwo(t.height)}function At(t,e){var i=q.get(t);if(6===t.image.length)if(0 0 ) {","float depth = gl_FragCoord.z / gl_FragCoord.w;","float fogFactor = 0.0;","if ( fogType == 1 ) {","fogFactor = smoothstep( fogNear, fogFar, depth );","} else {","const float LOG2 = 1.442695;","fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );","fogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );","}","gl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );","}","}"].join("\n")),x.compileShader(e),x.compileShader(i),x.attachShader(t,e),x.attachShader(t,i),x.linkProgram(t),m=t,v={position:x.getAttribLocation(m,"position"),uv:x.getAttribLocation(m,"uv")},g={uvOffset:x.getUniformLocation(m,"uvOffset"),uvScale:x.getUniformLocation(m,"uvScale"),rotation:x.getUniformLocation(m,"rotation"),scale:x.getUniformLocation(m,"scale"),color:x.getUniformLocation(m,"color"),map:x.getUniformLocation(m,"map"),opacity:x.getUniformLocation(m,"opacity"),modelViewMatrix:x.getUniformLocation(m,"modelViewMatrix"),projectionMatrix:x.getUniformLocation(m,"projectionMatrix"),fogType:x.getUniformLocation(m,"fogType"),fogDensity:x.getUniformLocation(m,"fogDensity"),fogNear:x.getUniformLocation(m,"fogNear"),fogFar:x.getUniformLocation(m,"fogFar"),fogColor:x.getUniformLocation(m,"fogColor"),alphaTest:x.getUniformLocation(m,"alphaTest")};var a=document.createElement("canvas");a.width=8,a.height=8;var o=a.getContext("2d");o.fillStyle="white",o.fillRect(0,0,8,8),(y=new Oe.Texture(a)).needsUpdate=!0}function E(t,e){return t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.z!==e.z?e.z-t.z:e.id-t.id}this.render=function(t,e){if(0!==p.length){void 0===m&&w(),x.useProgram(m),M.initAttributes(),M.enableAttribute(v.position),M.enableAttribute(v.uv),M.disableUnusedAttributes(),M.disable(x.CULL_FACE),M.enable(x.BLEND),x.bindBuffer(x.ARRAY_BUFFER,d),x.vertexAttribPointer(v.position,2,x.FLOAT,!1,16,0),x.vertexAttribPointer(v.uv,2,x.FLOAT,!1,16,8),x.bindBuffer(x.ELEMENT_ARRAY_BUFFER,f),x.uniformMatrix4fv(g.projectionMatrix,!1,e.projectionMatrix.elements),M.activeTexture(x.TEXTURE0),x.uniform1i(g.map,0);var i=0,r=0,n=t.fog;n?(x.uniform3f(g.fogColor,n.color.r,n.color.g,n.color.b),n instanceof Oe.Fog?(x.uniform1f(g.fogNear,n.near),x.uniform1f(g.fogFar,n.far),x.uniform1i(g.fogType,1),r=i=1):n instanceof Oe.FogExp2&&(x.uniform1f(g.fogDensity,n.density),x.uniform1i(g.fogType,2),r=i=2)):(x.uniform1i(g.fogType,0),r=i=0);for(var a=0,o=p.length;a=i.element.HAVE_FUTURE_DATA&&!i.driverInitialized&&(i.driver.src=i.source,i.driver.load(),i.onDriverReady&&i.onDriverReady(),i.driverInitialized=!0)}()}}]),i}();return function(){function s(t){var e,i,r;(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")})(this,s),i=this,e=!(r=l(s).call(this,t))||"object"!=typeof r&&"function"!=typeof r?u(i):r,h.Mediator.on("".concat(e.options.playerId,":").concat(h.Events.PLAYER_RESIZE),e.updateSize,u(e));var n=t.options,a=n.height,o=n.width;n.autoplay;return t.playback.el.setAttribute("crossorigin","anonymous"),t.el.style.touchAction="none",t.el.addEventListener("touchmove",function(t){t.preventDefault()},!1),e.viewer=new Je({height:isNaN(a)?300:a,width:isNaN(o)?400:o,container:e.container.el,source:e.container.playback.el}),e.viewer.render(),e}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&n(t,e)}(s,h.ContainerPlugin),t=s,(e=[{key:"updateSize",value:function(){var t=this;setTimeout(function(){return t.viewer.setSize({height:t.container.$el.height(),width:t.container.$el.width()})},250)}},{key:"name",get:function(){return"Video360"}}])&&r(t.prototype,e),i&&r(t,i),s;var t,e,i}()});