diff --git a/build/vr.dev.js b/build/vr.dev.js index 25bafd0..adfb2ec 100644 --- a/build/vr.dev.js +++ b/build/vr.dev.js @@ -44,7 +44,7 @@ /* 0 */ /***/ function(module, exports, __webpack_require__) { - eval("(function () {\n\t'use strict';\n\n\t//global-ish declarations\n\tvar VR,\n\t\tNoSleep = __webpack_require__(1).NoSleep;\n\n\tfunction initRequirements() {\n\t\t//load styles\n\t\t__webpack_require__(2);\n\n\t\tVR = __webpack_require__(6);\n\t}\n\n\tfunction initUI() {\n\t\tvar container,\n\t\t\tenableFullscreen,\n\t\t\tdisableFullscreen,\n\t\t\tvrButton,\n\t\t\torientationButton,\n\t\t\telement,\n\n\t\t\tnoSleep = new NoSleep(),\n\n\t\t\tfullScreenElement = document.body,\n\n\t\t\tfullscreenEnabled = document.fullscreenEnabled ||\n\t\t\t\tdocument.webkitFullscreenEnabled ||\n\t\t\t\tdocument.mozFullScreenEnabled ||\n\t\t\t\tdocument.msFullscreenEnabled,\n\n\t\t\trequestFullscreen = fullScreenElement.webkitRequestFullscreen ||\n\t\t\t\tfullScreenElement.mozRequestFullScreen ||\n\t\t\t\tfullScreenElement.msRequestFullscreen;\n\n\t\tfunction svgButton(source, id) {\n\t\t\tvar span = document.createElement('span'),\n\t\t\t\tsvg;\n\n\t\t\tspan.innerHTML = source;\n\t\t\tspan.id = id;\n\n\t\t\tsvg = span.firstChild;\n\t\t\tsvg.setAttribute('width', 18);\n\t\t\tsvg.setAttribute('height', 18);\n\n\t\t\tcontainer.appendChild(span);\n\n\t\t\treturn span;\n\t\t}\n\n\t\tfunction toggleOrientation() {\n\t\t\tif (VR.orientationEnabled()) {\n\t\t\t\tVR.disableOrientation();\n\t\t\t} else {\n\t\t\t\tVR.enableOrientation();\n\t\t\t}\n\t\t}\n\n\t\tfunction deviceChange() {\n\t\t\tif (VR.controlMode()) {\n\t\t\t\tvrButton.classList.remove('unsupported');\n\t\t\t\torientationButton.classList.remove('unsupported');\n\t\t\t}\n\n\t\t\t//todo: enable this\n\t\t\t//info.innerHTML = hmd && hmd.deviceName ? 'HMD: ' + hmd.deviceName : '';\n\t\t\t//info.className = hmd && hmd.deviceId !== 'debug-0' ? 'has-hmd' : '';\n\t\t}\n\n\t\t//set up meta viewport tag for mobile devices\n\t\telement = document.createElement('meta');\n\t\telement.setAttribute('name', 'viewport');\n\t\telement.setAttribute('content', 'width=device-width, initial-scale=1, user-scalable=no');\n\t\tdocument.head.appendChild(element);\n\n\t\tcontainer = document.createElement('div');\n\t\tcontainer.id = 'buttons';\n\t\tdocument.body.appendChild(container);\n\n\t\t//todo: use icons instead of text\n\t\tif (requestFullscreen && fullscreenEnabled) {\n\t\t\tenableFullscreen = svgButton(__webpack_require__(79), 'fs-enable');\n\t\t\tenableFullscreen.setAttribute('title', 'Enable Full Screen');\n\t\t\tenableFullscreen.addEventListener('click', requestFullscreen.bind(fullScreenElement), false);\n\n\t\t\tdisableFullscreen = svgButton(__webpack_require__(80), 'fs-disable');\n\t\t\tdisableFullscreen.setAttribute('title', 'Exit Full Screen');\n\t\t\tdisableFullscreen.addEventListener('click', VR.exitFullscreen, false);\n\t\t}\n\n\t\tVR.on('fullscreenchange', function () {\n\t\t\tif (VR.isFullscreen()) {\n\t\t\t\tdisableFullscreen.style.display = 'inline-block';\n\t\t\t\tenableFullscreen.style.display = 'none';\n\t\t\t} else {\n\t\t\t\tdisableFullscreen.style.display = '';\n\t\t\t\tenableFullscreen.style.display = '';\n\t\t\t}\n\n\t\t\t//disable sleep on mobile devices in VR mode\n\t\t\tif (VR.vrMode()) {\n\t\t\t\tnoSleep.enable();\n\t\t\t} else {\n\t\t\t\tnoSleep.disable();\n\t\t\t}\n\t\t});\n\n\t\tvrButton = svgButton(__webpack_require__(81), 'vr');\n\t\tvrButton.setAttribute('title', 'Toggle Virtual Reality');\n\t\tvrButton.className = 'unsupported';\n\t\tvrButton.addEventListener('click', VR.requestVR, false);\n\n\t\torientationButton = svgButton(__webpack_require__(82), 'orientation');\n\t\torientationButton.setAttribute('title', 'Toggle Orientation');\n\t\torientationButton.className = 'unsupported';\n\t\torientationButton.addEventListener('click', toggleOrientation, false);\n\n\t\t//report on HMD\n\t\tVR.on('devicechange', deviceChange);\n\t\tdeviceChange();\n\n\t\t//keyboard shortcuts for making life a little easier\n\t\twindow.addEventListener('keydown', function (evt) {\n\t\t\tif (evt.keyCode === 'Z'.charCodeAt(0)) {\n\t\t\t\tVR.zeroSensor();\n\t\t\t} else if (evt.keyCode === 'O'.charCodeAt(0)) {\n\t\t\t\tVR.enableOrientation();\n\t\t\t} else if (evt.keyCode === 13) {\n\t\t\t\tVR.requestVR();\n\t\t\t}\n\t\t}, false);\n\n\t\tVR.resize();\n\t}\n\n\tfunction initialize() {\n\t\tinitRequirements();\n\n\t\t//todo: set up button/info elements\n\n\t\tVR.init();\n\n\t\tif (document.body) {\n\t\t\tinitUI();\n\t\t} else {\n\t\t\twindow.addEventListener('load', initUI, false);\n\t\t}\n\n\t\twindow.addEventListener('resize', VR.resize, false);\n\n\t\t/*\n\t\texport global things\n\t\t*/\n\t\twindow.VR = VR;\n\t\twindow.THREE = VR.THREE;\n\t}\n\n\tinitialize();\n\tVR.start();\n}());\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/entry.js\n ** module id = 0\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/entry.js?"); + eval("(function () {\n\t'use strict';\n\n\t//global-ish declarations\n\tvar VR,\n\t\tNoSleep = __webpack_require__(1).NoSleep;\n\n\tfunction initRequirements() {\n\t\t//load styles\n\t\t__webpack_require__(2);\n\n\t\tVR = __webpack_require__(6);\n\t}\n\n\tfunction initUI() {\n\t\tvar container,\n\t\t\tenableFullscreen,\n\t\t\tdisableFullscreen,\n\t\t\tvrButton,\n\t\t\torientationButton,\n\t\t\telement,\n\n\t\t\tnoSleep = new NoSleep(),\n\n\t\t\tfullScreenElement = document.body,\n\n\t\t\tfullscreenEnabled = document.fullscreenEnabled ||\n\t\t\t\tdocument.webkitFullscreenEnabled ||\n\t\t\t\tdocument.mozFullScreenEnabled ||\n\t\t\t\tdocument.msFullscreenEnabled,\n\n\t\t\trequestFullscreen = fullScreenElement.webkitRequestFullscreen ||\n\t\t\t\tfullScreenElement.mozRequestFullScreen ||\n\t\t\t\tfullScreenElement.msRequestFullscreen;\n\n\t\tfunction svgButton(source, id) {\n\t\t\tvar span = document.createElement('span'),\n\t\t\t\tsvg;\n\n\t\t\tspan.innerHTML = source;\n\t\t\tspan.id = id;\n\n\t\t\tsvg = span.firstChild;\n\t\t\tsvg.setAttribute('width', 18);\n\t\t\tsvg.setAttribute('height', 18);\n\n\t\t\tcontainer.appendChild(span);\n\n\t\t\treturn span;\n\t\t}\n\n\t\tfunction toggleOrientation() {\n\t\t\tif (VR.orientationEnabled()) {\n\t\t\t\tVR.disableOrientation();\n\t\t\t} else {\n\t\t\t\tVR.enableOrientation();\n\t\t\t}\n\t\t}\n\n\t\tfunction deviceChange() {\n\t\t\tif (VR.controlMode()) {\n\t\t\t\tvrButton.classList.remove('unsupported');\n\t\t\t\torientationButton.classList.remove('unsupported');\n\t\t\t}\n\n\t\t\t//todo: enable this\n\t\t\t//info.innerHTML = hmd && hmd.deviceName ? 'HMD: ' + hmd.deviceName : '';\n\t\t\t//info.className = hmd && hmd.deviceId !== 'debug-0' ? 'has-hmd' : '';\n\t\t}\n\n\t\t//set up meta viewport tag for mobile devices\n\t\telement = document.createElement('meta');\n\t\telement.setAttribute('name', 'viewport');\n\t\telement.setAttribute('content', 'width=device-width, initial-scale=1, user-scalable=no');\n\t\tdocument.head.appendChild(element);\n\n\t\tcontainer = document.createElement('div');\n\t\tcontainer.id = 'buttons';\n\t\tdocument.body.appendChild(container);\n\n\t\t//todo: use icons instead of text\n\t\tif (requestFullscreen && fullscreenEnabled) {\n\t\t\tenableFullscreen = svgButton(__webpack_require__(80), 'fs-enable');\n\t\t\tenableFullscreen.setAttribute('title', 'Enable Full Screen');\n\t\t\tenableFullscreen.addEventListener('click', requestFullscreen.bind(fullScreenElement), false);\n\n\t\t\tdisableFullscreen = svgButton(__webpack_require__(81), 'fs-disable');\n\t\t\tdisableFullscreen.setAttribute('title', 'Exit Full Screen');\n\t\t\tdisableFullscreen.addEventListener('click', VR.exitFullscreen, false);\n\t\t}\n\n\t\tVR.on('fullscreenchange', function () {\n\t\t\tif (VR.isFullscreen()) {\n\t\t\t\tdisableFullscreen.style.display = 'inline-block';\n\t\t\t\tenableFullscreen.style.display = 'none';\n\t\t\t} else {\n\t\t\t\tdisableFullscreen.style.display = '';\n\t\t\t\tenableFullscreen.style.display = '';\n\t\t\t}\n\n\t\t\t//disable sleep on mobile devices in VR mode\n\t\t\tif (VR.vrMode()) {\n\t\t\t\tnoSleep.enable();\n\t\t\t} else {\n\t\t\t\tnoSleep.disable();\n\t\t\t}\n\t\t});\n\n\t\tvrButton = svgButton(__webpack_require__(82), 'vr');\n\t\tvrButton.setAttribute('title', 'Toggle Virtual Reality');\n\t\tvrButton.className = 'unsupported';\n\t\tvrButton.addEventListener('click', VR.requestVR, false);\n\n\t\torientationButton = svgButton(__webpack_require__(83), 'orientation');\n\t\torientationButton.setAttribute('title', 'Toggle Orientation');\n\t\torientationButton.className = 'unsupported';\n\t\torientationButton.addEventListener('click', toggleOrientation, false);\n\n\t\t//report on HMD\n\t\tVR.on('devicechange', deviceChange);\n\t\tdeviceChange();\n\n\t\t//keyboard shortcuts for making life a little easier\n\t\twindow.addEventListener('keydown', function (evt) {\n\t\t\tif (evt.keyCode === 'Z'.charCodeAt(0)) {\n\t\t\t\tVR.zeroSensor();\n\t\t\t} else if (evt.keyCode === 'O'.charCodeAt(0)) {\n\t\t\t\tVR.enableOrientation();\n\t\t\t} else if (evt.keyCode === 13) {\n\t\t\t\tVR.requestVR();\n\t\t\t}\n\t\t}, false);\n\n\t\tVR.resize();\n\t}\n\n\tfunction initialize() {\n\t\tinitRequirements();\n\n\t\t//todo: set up button/info elements\n\n\t\tVR.init();\n\n\t\tif (document.body) {\n\t\t\tinitUI();\n\t\t} else {\n\t\t\twindow.addEventListener('load', initUI, false);\n\t\t}\n\n\t\twindow.addEventListener('resize', VR.resize, false);\n\n\t\t/*\n\t\texport global things\n\t\t*/\n\t\twindow.VR = VR;\n\t\twindow.THREE = VR.THREE;\n\t}\n\n\tinitialize();\n\tVR.start();\n}());\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/entry.js\n ** module id = 0\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/entry.js?"); /***/ }, /* 1 */ @@ -80,7 +80,7 @@ /* 6 */ /***/ function(module, exports, __webpack_require__) { - eval("(function () {\n\t'use strict';\n\n\t//constants\n\tvar NEAR = 0.1,\n\t\tFAR = 1000000,\n\n\t//global-ish declarations\n\t\tTHREE,\n\t\teventEmitter,\n\t\tmaterials = __webpack_require__(7),\n\t\tnop = function () {},\n\t\trequestFullscreen = nop,\n\t\texitFullscreen = (\n\t\t\tdocument.exitFullscreen ||\n\t\t\tdocument.mozCancelFullScreen ||\n\t\t\tdocument.webkitExitFullscreen ||\n\t\t\tdocument.msExitFullscreen ||\n\t\t\tnop\n\t\t).bind(document),\n\n\t//scene assets\n\t\tcamera,\n\t\tscene,\n\t\tbody,\n\t\trenderer,\n\t\taudioListener,\n\t\tvrControls,\n\t\tvrEffect,\n\t\tmouseControls,\n\t\traycaster,\n\t\ttarget,\n\n\t\tbodyWrapper,\n\t\tcameraWrapper,\n\n\t\tfloor,\n\n\t//state\n\t\tgoing = false,\n\t\tvrMode = false,\n\t\torientationEnabled,\n\t\torientationPossible = false,\n\n\t//exported object\n\t\tVR,\n\n\t\tVRObject = __webpack_require__(43),\n\t\tobjectMethods = [\n\t\t\t'box',\n\t\t\t'cylinder',\n\t\t\t'torus',\n\t\t\t'sphere',\n\t\t\t'empty',\n\t\t\t'sound',\n\t\t\t'floor',\n\t\t\t'sky',\n\t\t\t'panorama',\n\t\t\t'image',\n\t\t\t'video',\n\t\t\t'text'\n\t\t],\n\n\t\t//todo: use a weak map or set instead\n\t\tvrObjects = [],\n\t\traycastable = [],\n\n\t\tlastTick = 0,\n\t\tanimationCallbacks = [];\n\n\tfunction isFullscreen() {\n\t\treturn !!(document.fullscreenElement ||\n\t\t\tdocument.mozFullScreenElement ||\n\t\t\tdocument.webkitFullscreenElement ||\n\t\t\tdocument.msFullscreenElement);\n\t}\n\n\tfunction fullScreenError() {\n\t\tvrMode = false;\n\t\tif (vrEffect) {\n\t\t\tvrEffect.exit();\n\t\t}\n\t}\n\n\tfunction pruneObject(object) {\n\t\tvar i = raycastable.indexOf(object);\n\t\tif (i >= 0) {\n\t\t\traycastable.splice(i, 1);\n\t\t}\n\n\t\ti = vrObjects.indexOf(VRObject.findObject(object));\n\t\tif (i >= 0) {\n\t\t\tvrObjects.splice(i, 1);\n\t\t}\n\n\t\tobject.children.forEach(pruneObject);\n\t}\n\n\tfunction raycast() {\n\t\tvar i,\n\t\t\tintersect,\n\t\t\tobject,\n\t\t\tintersects,\n\t\t\tparent,\n\t\t\tprune = [],\n\t\t\tvrObject;\n\n\t\traycaster.ray.origin.setFromMatrixPosition(camera.matrixWorld); // world position\n\t\traycaster.ray.direction.set(0, 0, 0.5).unproject(camera).sub(raycaster.ray.origin).normalize();\n\n\t\tintersects = raycaster.intersectObjects(raycastable, true);\n\t\tfor (i = 0; i < intersects.length; i++) {\n\t\t\tintersect = intersects[i];\n\n\t\t\t// if object has been removed from scene, remove it from raycastable\n\t\t\tparent = intersect.object;\n\t\t\twhile (parent && parent !== scene) {\n\t\t\t\tif (!parent.parent) {\n\t\t\t\t\tprune.push(parent);\n\t\t\t\t}\n\t\t\t\tparent = parent.parent;\n\t\t\t}\n\n\t\t\tif (parent && intersect.object instanceof THREE.Mesh) {\n\t\t\t\tobject = intersect.object;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tprune.forEach(pruneObject);\n\n\t\tif (target !== object) {\n\t\t\tif (target) {\n\t\t\t\tvrObject = VRObject.findObject(target);\n\t\t\t\tvrObject.emit('lookaway');\n\t\t\t\tVR.emit('lookaway', vrObject);\n\t\t\t}\n\t\t\ttarget = object;\n\t\t\tif (target) {\n\t\t\t\tvrObject = VRObject.findObject(target);\n\t\t\t\twhile (!vrObject && target.parent) {\n\t\t\t\t\ttarget = target.parent;\n\t\t\t\t\tvrObject = VRObject.findObject(target);\n\t\t\t\t}\n\t\t\t\tif (vrObject) {\n\t\t\t\t\tvrObject.emit('lookat', intersect);\n\t\t\t\t\tVR.emit('lookat', vrObject, intersect);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tfunction render() {\n\t\tvar now = Date.now() / 1000,\n\t\t\tdelta = Math.min(1, now - lastTick);\n\n\t\tvrControls.update();\n\n\t\tanimationCallbacks.forEach(function (cb) {\n\t\t\tcb(delta, now);\n\t\t});\n\n\t\tscene.updateMatrixWorld();\n\n\t\tvrObjects.forEach(function (object) {\n\t\t\tobject.update(now);\n\t\t});\n\n\t\traycast();\n\n\t\tvrEffect.render(scene, camera);\n\n\t\tlastTick = now;\n\t}\n\n\tfunction renderLoop() {\n\t\tif (going) {\n\t\t\trender();\n\t\t\trequestAnimationFrame(renderLoop);\n\t\t}\n\t}\n\n\tfunction stop() {\n\t\tgoing = false;\n\t}\n\n\tfunction start() {\n\t\tif (!going) {\n\t\t\tgoing = true;\n\t\t\trenderLoop();\n\t\t}\n\t}\n\n\t/*\n\tMute any sounds when this browser tab is in the background or minimized.\n\t*/\n\tfunction visibilityChange() {\n\t\tif (document.hidden || document.mozHidden || document.msHidden || document.webkitHidden) {\n\t\t\taudioListener.volume(0);\n\t\t} else {\n\t\t\taudioListener.volume(1);\n\t\t}\n\t}\n\n\tfunction resize(width, height) {\n\t\twidth = typeof width === 'number' && width || window.innerWidth;\n\t\theight = typeof height === 'number' && height || window.innerHeight;\n\n\t\tcamera.aspect = width / height;\n\t\tcamera.updateProjectionMatrix();\n\t\trenderer.setSize(width, height);\n\t}\n\n\tfunction initShake() {\n\t\tvar lastTime = 0,\n\t\t\tlastX,\n\t\t\tlastY,\n\t\t\tlastZ,\n\t\t\tthreshold = 15;\n\n\t\twindow.addEventListener('devicemotion', function (evt) {\n\t\t\tvar current = evt.accelerationIncludingGravity,\n\t\t\t\ttime,\n\t\t\t\tdiff,\n\t\t\t\tdeltaX = 0,\n\t\t\t\tdeltaY = 0,\n\t\t\t\tdeltaZ = 0,\n\t\t\t\tdist;\n\n\t\t\tif (lastX !== undefined) {\n\t\t\t\tdeltaX = Math.abs(lastX - current.x);\n\t\t\t\tdeltaY = Math.abs(lastY - current.y);\n\t\t\t\tdeltaZ = Math.abs(lastZ - current.z);\n\n\t\t\t\t// if (deltaX > threshold &&\n\t\t\t\t// \t\t(deltaY > threshold || deltaZ > threshold)\n\t\t\t\t// \t) {\n\t\t\t\tdist = Math.sqrt(deltaX * deltaX + deltaY * deltaY + deltaZ * deltaZ);\n\t\t\t\tif (dist > threshold) {\n\n\t\t\t\t\ttime = Date.now();\n\t\t\t\t\tdiff = time - lastTime;\n\t\t\t\t\tif (diff > 1000) {\n\t\t\t\t\t\tif (navigator.vibrate) {\n\t\t\t\t\t\t\tnavigator.vibrate(100);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tlastTime = Date.now();\n\n\t\t\t\t\t\tVR.emit('shake');\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tlastX = current.x;\n\t\t\tlastY = current.y;\n\t\t\tlastZ = current.z;\n\n\t\t\torientationPossible = true;\n\t\t}, false);\n\t}\n\n\tfunction initScene() {\n\t\tfunction attachCanvas() {\n\t\t\tdocument.body.insertBefore(renderer.domElement, document.body.firstChild || null);\n\t\t\tresize();\n\t\t}\n\n\t\tif (renderer) {\n\t\t\treturn;\n\t\t}\n\n\t\t//create renderer and place in document\n\t\trenderer = new THREE.WebGLRenderer({ antialias: true });\n\t\trenderer.domElement.addEventListener('webglcontextlost', function contextLost(event) {\n\t\t\tconsole.log('lost context', event);\n\t\t});\n\t\t// renderer.shadowMapEnabled = true;\n\t\t// renderer.shadowMapSoft = true;\n\n\t\t//need a scene to put all our objects in\n\t\tscene = new THREE.Scene();\n\n\t\tbodyWrapper = new VRObject(scene, __webpack_require__(59), null, {\n\t\t\tname: 'body'\n\t\t}).moveTo(0, 1.5, 4);\n\t\tbody = bodyWrapper.object;\n\n\t\tcameraWrapper = new VRObject(body, function (parent) {\n\t\t\t//need a camera with which to look at stuff\n\t\t\tcamera = new THREE.PerspectiveCamera(60, window.innerWidth / window.innerHeight, NEAR, FAR);\n\t\t\tparent.add(camera);\n\n\t\t\treturn camera;\n\t\t})\n\t\t// set camera position so that OrbitControls works properly.\n\t\t\t.moveTo(0, 0.0001, 0.0001);\n\n\t\taudioListener = new THREE.AudioListener();\n\t\taudioListener.name = 'audio-listener';\n\t\tcamera.add(audioListener);\n\n\t\t//VRControls point the camera wherever we're looking\n\t\tvrControls = new THREE.VRControls(camera);\n\t\tvrControls.freeze = !orientationEnabled;\n\n\t\t//render left and right eye\n\t\tvrEffect = new THREE.VRStereoEffect(renderer);\n\t\tvrEffect.near = NEAR;\n\t\tvrEffect.far = FAR;\n\t\tvrEffect.addEventListener('fullscreenchange', function (evt) {\n\t\t\tvar screen;\n\t\t\tif (isFullscreen()) {\n\t\t\t\tif (vrMode) {\n\t\t\t\t\t//no mouse control\n\t\t\t\t\tmouseControls.enabled = false;\n\n\t\t\t\t\tvrControls.freeze = false;\n\t\t\t\t\tvrControls.reset();\n\n\t\t\t\t\tscreen = window.screen;\n\t\t\t\t\tif (screen.lockOrientation) {\n\t\t\t\t\t\tscreen.lockOrientation('landscape-primary');\n\t\t\t\t\t} else if (screen.mozLockOrientation) {\n\t\t\t\t\t\tscreen.mozLockOrientation('landscape-primary');\n\t\t\t\t\t} else if (screen.orientation && screen.orientation.lock) {\n\t\t\t\t\t\tscreen.orientation.lock('landscape-primary');\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tVR.exitVR();\n\t\t\t}\n\n\t\t\tcamera.position.set(0, 0.0001, 0.0001);\n\t\t\tcamera.rotation.set(0, 0, 0);\n\n\t\t\tVR.emit('fullscreenchange', evt);\n\t\t});\n\n\t\t//report on HMD\n\t\tvrControls.addEventListener('devicechange', function () {\n\t\t\torientationPossible = true;\n\t\t\tif (orientationEnabled === undefined) {\n\t\t\t\torientationEnabled = vrControls.mode() === 'deviceorientation';\n\t\t\t}\n\n\t\t\tvrControls.freeze = !orientationEnabled && !vrMode;\n\n\t\t\tVR.emit('devicechange', vrControls.mode(), vrEffect.hmd());\n\t\t});\n\n\t\t//mouse control in case got no orientation device\n\t\tmouseControls = new THREE.OrbitControls(camera);\n\t\tmouseControls.target0.set(0, 0.0001, 0.000);\n\t\tmouseControls.target.copy(mouseControls.target0);\n\t\tmouseControls.update();\n\n\t\t//todo: remove any default lights once other lights are added\n\t\tvar dLight = new THREE.DirectionalLight(0xffffff, 0.8);\n\t\tdLight.name = 'directional-light';\n\t\tdLight.position.set(20, 100, 100);\n\n\t\tdLight.castShadow = true;\n\t\tdLight.shadowCameraVisible = true;\n\n\t\tdLight.shadowMapWidth = 2048;\n\t\tdLight.shadowMapHeight = 2048;\n\n\t\tdLight.shadowCameraLeft = -10;\n\t\tdLight.shadowCameraRight = 10;\n\t\tdLight.shadowCameraTop = 10;\n\t\tdLight.shadowCameraBottom = -10;\n\n\t\tdLight.shadowCameraFar = 150;\n\t\tdLight.shadowCameraNear = 100;\n\t\tdLight.shadowDarkness = 1;\n\n\t\tscene.add(dLight);\n\n\t\tscene.add(new THREE.AmbientLight(0x444444));\n\n\t\tif (VR) {\n\t\t\tVR.camera = cameraWrapper;\n\t\t\tVR.body = bodyWrapper;\n\t\t\tVR.scene = scene;\n\t\t\tVR.canvas = renderer.domElement;\n\t\t\tVR.renderer = renderer;\n\t\t\tVR.zeroSensor = vrControls.zeroSensor;\n\t\t}\n\n\t\traycaster = new THREE.Raycaster();\n\n\t\tif (document.body) {\n\t\t\tattachCanvas();\n\t\t} else {\n\t\t\twindow.addEventListener('load', attachCanvas, false);\n\t\t}\n\n\t\tVR.canvas.addEventListener('mozfullscreenerror', fullScreenError, false);\n\t\tVR.canvas.addEventListener('webkitfullscreenerror', fullScreenError, false);\n\t\tVR.canvas.addEventListener('fullscreenerror', fullScreenError, false);\n\t}\n\n\tfunction initRequirements() {\n\t\t//load external requirements\n\t\tTHREE = __webpack_require__(8);\n\t\t__webpack_require__(60);\n\t\t__webpack_require__(61);\n\n\t\t//if (typeof __DEV__ !== 'undefined' && __DEV__) {\n\t\t\t__webpack_require__(62);\n\t\t//}\n\n\t\tTHREE.ImageUtils.crossOrigin = '';\n\n\t\teventEmitter = __webpack_require__(44);\n\n\t\t//my VR stuff. todo: move these to a separate repo or two for easy packaging\n\t\t__webpack_require__(63);\n\t\t__webpack_require__(64);\n\t}\n\n\tfunction initialize() {\n\t\t//todo: set up button/info elements\n\n\t\tinitScene();\n\n\t\tinitShake();\n\n\t\tresize();\n\n\t\tdocument.addEventListener('visibilitychange', visibilityChange);\n\t\tdocument.addEventListener('mozvisibilitychange', visibilityChange);\n\t\tdocument.addEventListener('msvisibilitychange', visibilityChange);\n\t\tdocument.addEventListener('webkitvisibilitychange', visibilityChange);\n\t}\n\n\tinitRequirements();\n\n\tmodule.exports = VR = {\n\t\tinit: initialize,\n\t\trender: render,\n\t\tstart: start,\n\t\tstop: stop,\n\t\tresize: resize,\n\n\t\tTHREE: THREE,\n\n\t\tmaterials: materials,\n\n\t\tanimate: function (callback) {\n\t\t\tvar i;\n\t\t\tif (typeof callback === 'function') {\n\t\t\t\ti = animationCallbacks.indexOf(callback);\n\t\t\t\tif (i < 0) {\n\t\t\t\t\tanimationCallbacks.push(callback);\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\n\t\tend: function (callback) {\n\t\t\tvar i;\n\n\t\t\tif (!callback) {\n\t\t\t\tanimationCallbacks.length = 0;\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (typeof callback === 'function') {\n\t\t\t\ti = animationCallbacks.indexOf(callback);\n\t\t\t\tif (i >= 0) {\n\t\t\t\t\tanimationCallbacks.splice(i, 1);\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\n\t\trequestVR: function () {\n\t\t\t//todo: check if it's possible\n\t\t\tif (vrMode || !vrEffect) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tvrMode = true;\n\n\t\t\t//full screen and render two eyes\n\t\t\t//always full screen\n\t\t\tvrEffect.requestFullScreen();\n\t\t},\n\n\t\texitVR: function () {\n\t\t\tvrMode = false;\n\t\t\tif (isFullscreen()) {\n\t\t\t\texitFullscreen();\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tmouseControls.enabled = true;\n\t\t\tvrControls.freeze = !orientationEnabled;\n\t\t\tcamera.rotation.set(0, 0, 0);\n\t\t},\n\n\t\tvrMode: function () {\n\t\t\treturn vrMode && isFullscreen();\n\t\t},\n\n\t\torientationEnabled: function () {\n\t\t\treturn !!orientationEnabled;\n\t\t},\n\t\tenableOrientation: function () {\n\t\t\torientationEnabled = true;\n\t\t\tif (!vrMode) {\n\t\t\t\tvrControls.freeze = false;\n\t\t\t}\n\t\t},\n\t\tdisableOrientation: function () {\n\t\t\torientationEnabled = false;\n\t\t\tcamera.rotation.set(0, 0, 0);\n\t\t\tvrControls.freeze = !vrMode;\n\t\t},\n\n\t\tisFullscreen: isFullscreen,\n\t\trequestFullscreen: requestFullscreen,\n\t\texitFullscreen: function () {\n\t\t\tif (isFullscreen()) {\n\t\t\t\texitFullscreen();\n\t\t\t}\n\t\t},\n\n\t\tcontrolMode: function () {\n\t\t\treturn vrControls && vrControls.mode();\n\t\t},\n\n\t\tzeroSensor: nop,\n\n\t\tvibrate: navigator.vibrate ? navigator.vibrate.bind(navigator) : nop,\n\n\t\t// Utility\n\t\ttimes: function (n, callback) {\n\t\t\tvar i;\n\n\t\t\tfor (i = 0; i < n; i++) {\n\t\t\t\tcallback(i);\n\t\t\t}\n\t\t},\n\n\t\tcamera: cameraWrapper,\n\t\tbody: bodyWrapper,\n\t\tscene: scene,\n\t\trenderer: renderer || null,\n\t\tcanvas: renderer && renderer.domElement || null\n\t};\n\n\tobjectMethods.forEach(function (method) {\n\t\tvar creator = __webpack_require__(65)(\"./\" + method),\n\t\t\tkey;\n\n\t\tVR[method] = function (options) {\n\t\t\tvar obj = new VRObject(scene, creator, body, options);\n\t\t\tvrObjects.push(obj);\n\t\t\tif (obj.raycastable) {\n\t\t\t\traycastable.push(obj.object);\n\t\t\t}\n\t\t\treturn obj;\n\t\t};\n\n\t\tVRObject.prototype[method] = function (options) {\n\t\t\tvar obj = new VRObject(this.object, creator, body, options);\n\t\t\tvrObjects.push(obj);\n\t\t\tif (obj.raycastable) {\n\t\t\t\traycastable.push(obj.object);\n\t\t\t}\n\t\t\treturn obj;\n\t\t};\n\n\t\tfor (key in creator) {\n\t\t\tif (creator.hasOwnProperty(key) && typeof creator[key] === 'function') {\n\t\t\t\tVR[method][key] = creator[key];\n\t\t\t\tVRObject.prototype[method][key] = creator[key];\n\t\t\t}\n\t\t}\n\t});\n\n\teventEmitter(VR);\n\n\tObject.defineProperty(VR, 'target', {\n\t\tget: function () {\n\t\t\treturn target;\n\t\t}\n\t});\n}());\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/vr.js\n ** module id = 6\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/vr.js?"); + eval("(function () {\n\t'use strict';\n\n\t//constants\n\tvar NEAR = 0.1,\n\t\tFAR = 1000000,\n\n\t//global-ish declarations\n\t\tTHREE,\n\t\teventEmitter,\n\t\tmaterials = __webpack_require__(7),\n\t\tnop = function () {},\n\t\trequestFullscreen = nop,\n\t\texitFullscreen = (\n\t\t\tdocument.exitFullscreen ||\n\t\t\tdocument.mozCancelFullScreen ||\n\t\t\tdocument.webkitExitFullscreen ||\n\t\t\tdocument.msExitFullscreen ||\n\t\t\tnop\n\t\t).bind(document),\n\n\t//scene assets\n\t\tcamera,\n\t\tscene,\n\t\tbody,\n\t\trenderer,\n\t\taudioListener,\n\t\tvrControls,\n\t\tvrEffect,\n\t\tmouseControls,\n\t\traycaster,\n\t\ttarget,\n\n\t\tbodyWrapper,\n\t\tcameraWrapper,\n\n\t\tfloor,\n\n\t//state\n\t\tgoing = false,\n\t\tvrMode = false,\n\t\torientationEnabled,\n\t\torientationPossible = false,\n\n\t//exported object\n\t\tVR,\n\n\t\tVRObject = __webpack_require__(43),\n\t\tobjectMethods = [\n\t\t\t'box',\n\t\t\t'cylinder',\n\t\t\t'torus',\n\t\t\t'sphere',\n\t\t\t'empty',\n\t\t\t'sound',\n\t\t\t'floor',\n\t\t\t'sky',\n\t\t\t'panorama',\n\t\t\t'image',\n\t\t\t'video',\n\t\t\t'text',\n\t\t\t'grid'\n\t\t],\n\n\t\t//todo: use a weak map or set instead\n\t\tvrObjects = [],\n\t\traycastable = [],\n\n\t\tlastTick = 0,\n\t\tanimationCallbacks = [];\n\n\tfunction isFullscreen() {\n\t\treturn !!(document.fullscreenElement ||\n\t\t\tdocument.mozFullScreenElement ||\n\t\t\tdocument.webkitFullscreenElement ||\n\t\t\tdocument.msFullscreenElement);\n\t}\n\n\tfunction fullScreenError() {\n\t\tvrMode = false;\n\t\tif (vrEffect) {\n\t\t\tvrEffect.exit();\n\t\t}\n\t}\n\n\tfunction pruneObject(object) {\n\t\tvar i = raycastable.indexOf(object);\n\t\tif (i >= 0) {\n\t\t\traycastable.splice(i, 1);\n\t\t}\n\n\t\ti = vrObjects.indexOf(VRObject.findObject(object));\n\t\tif (i >= 0) {\n\t\t\tvrObjects.splice(i, 1);\n\t\t}\n\n\t\tobject.children.forEach(pruneObject);\n\t}\n\n\tfunction raycast() {\n\t\tvar i,\n\t\t\tintersect,\n\t\t\tobject,\n\t\t\tintersects,\n\t\t\tparent,\n\t\t\tprune = [],\n\t\t\tvrObject;\n\n\t\traycaster.ray.origin.setFromMatrixPosition(camera.matrixWorld); // world position\n\t\traycaster.ray.direction.set(0, 0, 0.5).unproject(camera).sub(raycaster.ray.origin).normalize();\n\n\t\tintersects = raycaster.intersectObjects(raycastable, true);\n\t\tfor (i = 0; i < intersects.length; i++) {\n\t\t\tintersect = intersects[i];\n\n\t\t\t// if object has been removed from scene, remove it from raycastable\n\t\t\tparent = intersect.object;\n\t\t\twhile (parent && parent !== scene) {\n\t\t\t\tif (!parent.parent) {\n\t\t\t\t\tprune.push(parent);\n\t\t\t\t}\n\t\t\t\tparent = parent.parent;\n\t\t\t}\n\n\t\t\tif (parent && intersect.object instanceof THREE.Mesh) {\n\t\t\t\tobject = intersect.object;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tprune.forEach(pruneObject);\n\n\t\tif (target !== object) {\n\t\t\tif (target) {\n\t\t\t\tvrObject = VRObject.findObject(target);\n\t\t\t\tvrObject.emit('lookaway');\n\t\t\t\tVR.emit('lookaway', vrObject);\n\t\t\t}\n\t\t\ttarget = object;\n\t\t\tif (target) {\n\t\t\t\tvrObject = VRObject.findObject(target);\n\t\t\t\twhile (!vrObject && target.parent) {\n\t\t\t\t\ttarget = target.parent;\n\t\t\t\t\tvrObject = VRObject.findObject(target);\n\t\t\t\t}\n\t\t\t\tif (vrObject) {\n\t\t\t\t\tvrObject.emit('lookat', intersect);\n\t\t\t\t\tVR.emit('lookat', vrObject, intersect);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tfunction render() {\n\t\tvar now = Date.now() / 1000,\n\t\t\tdelta = Math.min(1, now - lastTick);\n\n\t\tvrControls.update();\n\n\t\tanimationCallbacks.forEach(function (cb) {\n\t\t\tcb(delta, now);\n\t\t});\n\n\t\tscene.updateMatrixWorld();\n\n\t\tvrObjects.forEach(function (object) {\n\t\t\tobject.update(now);\n\t\t});\n\n\t\traycast();\n\n\t\tvrEffect.render(scene, camera);\n\n\t\tlastTick = now;\n\t}\n\n\tfunction renderLoop() {\n\t\tif (going) {\n\t\t\trender();\n\t\t\trequestAnimationFrame(renderLoop);\n\t\t}\n\t}\n\n\tfunction stop() {\n\t\tgoing = false;\n\t}\n\n\tfunction start() {\n\t\tif (!going) {\n\t\t\tgoing = true;\n\t\t\trenderLoop();\n\t\t}\n\t}\n\n\t/*\n\tMute any sounds when this browser tab is in the background or minimized.\n\t*/\n\tfunction visibilityChange() {\n\t\tif (document.hidden || document.mozHidden || document.msHidden || document.webkitHidden) {\n\t\t\taudioListener.volume(0);\n\t\t} else {\n\t\t\taudioListener.volume(1);\n\t\t}\n\t}\n\n\tfunction resize(width, height) {\n\t\twidth = typeof width === 'number' && width || window.innerWidth;\n\t\theight = typeof height === 'number' && height || window.innerHeight;\n\n\t\tcamera.aspect = width / height;\n\t\tcamera.updateProjectionMatrix();\n\t\trenderer.setSize(width, height);\n\t}\n\n\tfunction initShake() {\n\t\tvar lastTime = 0,\n\t\t\tlastX,\n\t\t\tlastY,\n\t\t\tlastZ,\n\t\t\tthreshold = 15;\n\n\t\twindow.addEventListener('devicemotion', function (evt) {\n\t\t\tvar current = evt.accelerationIncludingGravity,\n\t\t\t\ttime,\n\t\t\t\tdiff,\n\t\t\t\tdeltaX = 0,\n\t\t\t\tdeltaY = 0,\n\t\t\t\tdeltaZ = 0,\n\t\t\t\tdist;\n\n\t\t\tif (lastX !== undefined) {\n\t\t\t\tdeltaX = Math.abs(lastX - current.x);\n\t\t\t\tdeltaY = Math.abs(lastY - current.y);\n\t\t\t\tdeltaZ = Math.abs(lastZ - current.z);\n\n\t\t\t\t// if (deltaX > threshold &&\n\t\t\t\t// \t\t(deltaY > threshold || deltaZ > threshold)\n\t\t\t\t// \t) {\n\t\t\t\tdist = Math.sqrt(deltaX * deltaX + deltaY * deltaY + deltaZ * deltaZ);\n\t\t\t\tif (dist > threshold) {\n\n\t\t\t\t\ttime = Date.now();\n\t\t\t\t\tdiff = time - lastTime;\n\t\t\t\t\tif (diff > 1000) {\n\t\t\t\t\t\tif (navigator.vibrate) {\n\t\t\t\t\t\t\tnavigator.vibrate(100);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tlastTime = Date.now();\n\n\t\t\t\t\t\tVR.emit('shake');\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tlastX = current.x;\n\t\t\tlastY = current.y;\n\t\t\tlastZ = current.z;\n\n\t\t\torientationPossible = true;\n\t\t}, false);\n\t}\n\n\tfunction initScene() {\n\t\tfunction attachCanvas() {\n\t\t\tdocument.body.insertBefore(renderer.domElement, document.body.firstChild || null);\n\t\t\tresize();\n\t\t}\n\n\t\tif (renderer) {\n\t\t\treturn;\n\t\t}\n\n\t\t//create renderer and place in document\n\t\trenderer = new THREE.WebGLRenderer({ antialias: true });\n\t\trenderer.domElement.addEventListener('webglcontextlost', function contextLost(event) {\n\t\t\tconsole.log('lost context', event);\n\t\t});\n\t\t// renderer.shadowMapEnabled = true;\n\t\t// renderer.shadowMapSoft = true;\n\n\t\t//need a scene to put all our objects in\n\t\tscene = new THREE.Scene();\n\n\t\tbodyWrapper = new VRObject(scene, __webpack_require__(59), null, {\n\t\t\tname: 'body'\n\t\t}).moveTo(0, 1.5, 4);\n\t\tbody = bodyWrapper.object;\n\n\t\tcameraWrapper = new VRObject(body, function (parent) {\n\t\t\t//need a camera with which to look at stuff\n\t\t\tcamera = new THREE.PerspectiveCamera(60, window.innerWidth / window.innerHeight, NEAR, FAR);\n\t\t\tparent.add(camera);\n\n\t\t\treturn camera;\n\t\t})\n\t\t// set camera position so that OrbitControls works properly.\n\t\t\t.moveTo(0, 0.0001, 0.0001);\n\n\t\taudioListener = new THREE.AudioListener();\n\t\taudioListener.name = 'audio-listener';\n\t\tcamera.add(audioListener);\n\n\t\t//VRControls point the camera wherever we're looking\n\t\tvrControls = new THREE.VRControls(camera);\n\t\tvrControls.freeze = !orientationEnabled;\n\n\t\t//render left and right eye\n\t\tvrEffect = new THREE.VRStereoEffect(renderer);\n\t\tvrEffect.near = NEAR;\n\t\tvrEffect.far = FAR;\n\t\tvrEffect.addEventListener('fullscreenchange', function (evt) {\n\t\t\tvar screen;\n\t\t\tif (isFullscreen()) {\n\t\t\t\tif (vrMode) {\n\t\t\t\t\t//no mouse control\n\t\t\t\t\tmouseControls.enabled = false;\n\n\t\t\t\t\tvrControls.freeze = false;\n\t\t\t\t\tvrControls.reset();\n\n\t\t\t\t\tscreen = window.screen;\n\t\t\t\t\tif (screen.lockOrientation) {\n\t\t\t\t\t\tscreen.lockOrientation('landscape-primary');\n\t\t\t\t\t} else if (screen.mozLockOrientation) {\n\t\t\t\t\t\tscreen.mozLockOrientation('landscape-primary');\n\t\t\t\t\t} else if (screen.orientation && screen.orientation.lock) {\n\t\t\t\t\t\tscreen.orientation.lock('landscape-primary');\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tVR.exitVR();\n\t\t\t}\n\n\t\t\tcamera.position.set(0, 0.0001, 0.0001);\n\t\t\tcamera.rotation.set(0, 0, 0);\n\n\t\t\tVR.emit('fullscreenchange', evt);\n\t\t});\n\n\t\t//report on HMD\n\t\tvrControls.addEventListener('devicechange', function () {\n\t\t\torientationPossible = true;\n\t\t\tif (orientationEnabled === undefined) {\n\t\t\t\torientationEnabled = vrControls.mode() === 'deviceorientation';\n\t\t\t}\n\n\t\t\tvrControls.freeze = !orientationEnabled && !vrMode;\n\n\t\t\tVR.emit('devicechange', vrControls.mode(), vrEffect.hmd());\n\t\t});\n\n\t\t//mouse control in case got no orientation device\n\t\tmouseControls = new THREE.OrbitControls(camera);\n\t\tmouseControls.target0.set(0, 0.0001, 0.000);\n\t\tmouseControls.target.copy(mouseControls.target0);\n\t\tmouseControls.update();\n\n\t\t//todo: remove any default lights once other lights are added\n\t\tvar dLight = new THREE.DirectionalLight(0xffffff, 0.8);\n\t\tdLight.name = 'directional-light';\n\t\tdLight.position.set(20, 100, 100);\n\n\t\tdLight.castShadow = true;\n\t\tdLight.shadowCameraVisible = true;\n\n\t\tdLight.shadowMapWidth = 2048;\n\t\tdLight.shadowMapHeight = 2048;\n\n\t\tdLight.shadowCameraLeft = -10;\n\t\tdLight.shadowCameraRight = 10;\n\t\tdLight.shadowCameraTop = 10;\n\t\tdLight.shadowCameraBottom = -10;\n\n\t\tdLight.shadowCameraFar = 150;\n\t\tdLight.shadowCameraNear = 100;\n\t\tdLight.shadowDarkness = 1;\n\n\t\tscene.add(dLight);\n\n\t\tscene.add(new THREE.AmbientLight(0x444444));\n\n\t\tif (VR) {\n\t\t\tVR.camera = cameraWrapper;\n\t\t\tVR.body = bodyWrapper;\n\t\t\tVR.scene = scene;\n\t\t\tVR.canvas = renderer.domElement;\n\t\t\tVR.renderer = renderer;\n\t\t\tVR.zeroSensor = vrControls.zeroSensor;\n\t\t}\n\n\t\traycaster = new THREE.Raycaster();\n\n\t\tif (document.body) {\n\t\t\tattachCanvas();\n\t\t} else {\n\t\t\twindow.addEventListener('load', attachCanvas, false);\n\t\t}\n\n\t\tVR.canvas.addEventListener('mozfullscreenerror', fullScreenError, false);\n\t\tVR.canvas.addEventListener('webkitfullscreenerror', fullScreenError, false);\n\t\tVR.canvas.addEventListener('fullscreenerror', fullScreenError, false);\n\t}\n\n\tfunction initRequirements() {\n\t\t//load external requirements\n\t\tTHREE = __webpack_require__(8);\n\t\t__webpack_require__(60);\n\t\t__webpack_require__(61);\n\n\t\t//if (typeof __DEV__ !== 'undefined' && __DEV__) {\n\t\t\t__webpack_require__(62);\n\t\t//}\n\n\t\tTHREE.ImageUtils.crossOrigin = '';\n\n\t\teventEmitter = __webpack_require__(44);\n\n\t\t//my VR stuff. todo: move these to a separate repo or two for easy packaging\n\t\t__webpack_require__(63);\n\t\t__webpack_require__(64);\n\t}\n\n\tfunction initialize() {\n\t\t//todo: set up button/info elements\n\n\t\tinitScene();\n\n\t\tinitShake();\n\n\t\tresize();\n\n\t\tdocument.addEventListener('visibilitychange', visibilityChange);\n\t\tdocument.addEventListener('mozvisibilitychange', visibilityChange);\n\t\tdocument.addEventListener('msvisibilitychange', visibilityChange);\n\t\tdocument.addEventListener('webkitvisibilitychange', visibilityChange);\n\t}\n\n\tinitRequirements();\n\n\tmodule.exports = VR = {\n\t\tinit: initialize,\n\t\trender: render,\n\t\tstart: start,\n\t\tstop: stop,\n\t\tresize: resize,\n\n\t\tTHREE: THREE,\n\n\t\tmaterials: materials,\n\n\t\tanimate: function (callback) {\n\t\t\tvar i;\n\t\t\tif (typeof callback === 'function') {\n\t\t\t\ti = animationCallbacks.indexOf(callback);\n\t\t\t\tif (i < 0) {\n\t\t\t\t\tanimationCallbacks.push(callback);\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\n\t\tend: function (callback) {\n\t\t\tvar i;\n\n\t\t\tif (!callback) {\n\t\t\t\tanimationCallbacks.length = 0;\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (typeof callback === 'function') {\n\t\t\t\ti = animationCallbacks.indexOf(callback);\n\t\t\t\tif (i >= 0) {\n\t\t\t\t\tanimationCallbacks.splice(i, 1);\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\n\t\trequestVR: function () {\n\t\t\t//todo: check if it's possible\n\t\t\tif (vrMode || !vrEffect) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tvrMode = true;\n\n\t\t\t//full screen and render two eyes\n\t\t\t//always full screen\n\t\t\tvrEffect.requestFullScreen();\n\t\t},\n\n\t\texitVR: function () {\n\t\t\tvrMode = false;\n\t\t\tif (isFullscreen()) {\n\t\t\t\texitFullscreen();\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tmouseControls.enabled = true;\n\t\t\tvrControls.freeze = !orientationEnabled;\n\t\t\tcamera.rotation.set(0, 0, 0);\n\t\t},\n\n\t\tvrMode: function () {\n\t\t\treturn vrMode && isFullscreen();\n\t\t},\n\n\t\torientationEnabled: function () {\n\t\t\treturn !!orientationEnabled;\n\t\t},\n\t\tenableOrientation: function () {\n\t\t\torientationEnabled = true;\n\t\t\tif (!vrMode) {\n\t\t\t\tvrControls.freeze = false;\n\t\t\t}\n\t\t},\n\t\tdisableOrientation: function () {\n\t\t\torientationEnabled = false;\n\t\t\tcamera.rotation.set(0, 0, 0);\n\t\t\tvrControls.freeze = !vrMode;\n\t\t},\n\n\t\tisFullscreen: isFullscreen,\n\t\trequestFullscreen: requestFullscreen,\n\t\texitFullscreen: function () {\n\t\t\tif (isFullscreen()) {\n\t\t\t\texitFullscreen();\n\t\t\t}\n\t\t},\n\n\t\tcontrolMode: function () {\n\t\t\treturn vrControls && vrControls.mode();\n\t\t},\n\n\t\tzeroSensor: nop,\n\n\t\tvibrate: navigator.vibrate ? navigator.vibrate.bind(navigator) : nop,\n\n\t\t// Utility\n\t\ttimes: function (n, callback) {\n\t\t\tvar i;\n\n\t\t\tfor (i = 0; i < n; i++) {\n\t\t\t\tcallback(i);\n\t\t\t}\n\t\t},\n\n\t\tcamera: cameraWrapper,\n\t\tbody: bodyWrapper,\n\t\tscene: scene,\n\t\trenderer: renderer || null,\n\t\tcanvas: renderer && renderer.domElement || null\n\t};\n\n\tobjectMethods.forEach(function (method) {\n\t\tvar creator = __webpack_require__(65)(\"./\" + method),\n\t\t\tkey;\n\n\t\tVR[method] = function (options) {\n\t\t\tvar obj = new VRObject(scene, creator, body, options);\n\t\t\tvrObjects.push(obj);\n\t\t\tif (obj.raycastable) {\n\t\t\t\traycastable.push(obj.object);\n\t\t\t}\n\t\t\treturn obj;\n\t\t};\n\n\t\tVRObject.prototype[method] = function (options) {\n\t\t\tvar obj = new VRObject(this.object, creator, body, options);\n\t\t\tvrObjects.push(obj);\n\t\t\tif (obj.raycastable) {\n\t\t\t\traycastable.push(obj.object);\n\t\t\t}\n\t\t\treturn obj;\n\t\t};\n\n\t\tfor (key in creator) {\n\t\t\tif (creator.hasOwnProperty(key) && typeof creator[key] === 'function') {\n\t\t\t\tVR[method][key] = creator[key];\n\t\t\t\tVRObject.prototype[method][key] = creator[key];\n\t\t\t}\n\t\t}\n\t});\n\n\teventEmitter(VR);\n\n\tObject.defineProperty(VR, 'target', {\n\t\tget: function () {\n\t\t\treturn target;\n\t\t}\n\t});\n}());\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/vr.js\n ** module id = 6\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/vr.js?"); /***/ }, /* 7 */ @@ -92,7 +92,7 @@ /* 8 */ /***/ function(module, exports, __webpack_require__) { - eval("var self = self || {};// File:src/Three.js\r\n\r\n/**\r\n * @author mrdoob / http://mrdoob.com/\r\n */\r\n\r\nvar THREE = { REVISION: '71' };\r\n\r\n// browserify support\r\n\r\nif ( true ) {\r\n\r\n\tmodule.exports = THREE;\r\n\r\n}\r\n\r\n// polyfills\r\n\r\nif ( Math.sign === undefined ) {\r\n\r\n\t// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/sign\r\n\r\n\tMath.sign = function ( x ) {\r\n\r\n\t\treturn ( x < 0 ) ? - 1 : ( x > 0 ) ? 1 : +x;\r\n\r\n\t};\r\n\r\n}\r\n\r\n\r\n// set the default log handlers\r\nTHREE.log = function() { console.log.apply( console, arguments ); }\r\nTHREE.warn = function() { console.warn.apply( console, arguments ); }\r\nTHREE.error = function() { console.error.apply( console, arguments ); }\r\n\r\n\r\n// https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent.button\r\n\r\nTHREE.MOUSE = { LEFT: 0, MIDDLE: 1, RIGHT: 2 };\r\n\r\n// GL STATE CONSTANTS\r\n\r\nTHREE.CullFaceNone = 0;\r\nTHREE.CullFaceBack = 1;\r\nTHREE.CullFaceFront = 2;\r\nTHREE.CullFaceFrontBack = 3;\r\n\r\nTHREE.FrontFaceDirectionCW = 0;\r\nTHREE.FrontFaceDirectionCCW = 1;\r\n\r\n// SHADOWING TYPES\r\n\r\nTHREE.BasicShadowMap = 0;\r\nTHREE.PCFShadowMap = 1;\r\nTHREE.PCFSoftShadowMap = 2;\r\n\r\n// MATERIAL CONSTANTS\r\n\r\n// side\r\n\r\nTHREE.FrontSide = 0;\r\nTHREE.BackSide = 1;\r\nTHREE.DoubleSide = 2;\r\n\r\n// shading\r\n\r\nTHREE.NoShading = 0;\r\nTHREE.FlatShading = 1;\r\nTHREE.SmoothShading = 2;\r\n\r\n// colors\r\n\r\nTHREE.NoColors = 0;\r\nTHREE.FaceColors = 1;\r\nTHREE.VertexColors = 2;\r\n\r\n// blending modes\r\n\r\nTHREE.NoBlending = 0;\r\nTHREE.NormalBlending = 1;\r\nTHREE.AdditiveBlending = 2;\r\nTHREE.SubtractiveBlending = 3;\r\nTHREE.MultiplyBlending = 4;\r\nTHREE.CustomBlending = 5;\r\n\r\n// custom blending equations\r\n// (numbers start from 100 not to clash with other\r\n// mappings to OpenGL constants defined in Texture.js)\r\n\r\nTHREE.AddEquation = 100;\r\nTHREE.SubtractEquation = 101;\r\nTHREE.ReverseSubtractEquation = 102;\r\nTHREE.MinEquation = 103;\r\nTHREE.MaxEquation = 104;\r\n\r\n// custom blending destination factors\r\n\r\nTHREE.ZeroFactor = 200;\r\nTHREE.OneFactor = 201;\r\nTHREE.SrcColorFactor = 202;\r\nTHREE.OneMinusSrcColorFactor = 203;\r\nTHREE.SrcAlphaFactor = 204;\r\nTHREE.OneMinusSrcAlphaFactor = 205;\r\nTHREE.DstAlphaFactor = 206;\r\nTHREE.OneMinusDstAlphaFactor = 207;\r\n\r\n// custom blending source factors\r\n\r\n//THREE.ZeroFactor = 200;\r\n//THREE.OneFactor = 201;\r\n//THREE.SrcAlphaFactor = 204;\r\n//THREE.OneMinusSrcAlphaFactor = 205;\r\n//THREE.DstAlphaFactor = 206;\r\n//THREE.OneMinusDstAlphaFactor = 207;\r\nTHREE.DstColorFactor = 208;\r\nTHREE.OneMinusDstColorFactor = 209;\r\nTHREE.SrcAlphaSaturateFactor = 210;\r\n\r\n\r\n// TEXTURE CONSTANTS\r\n\r\nTHREE.MultiplyOperation = 0;\r\nTHREE.MixOperation = 1;\r\nTHREE.AddOperation = 2;\r\n\r\n// Mapping modes\r\n\r\nTHREE.UVMapping = 300;\r\n\r\nTHREE.CubeReflectionMapping = 301;\r\nTHREE.CubeRefractionMapping = 302;\r\n\r\nTHREE.EquirectangularReflectionMapping = 303;\r\nTHREE.EquirectangularRefractionMapping = 304;\r\n\r\nTHREE.SphericalReflectionMapping = 305;\r\n\r\n// Wrapping modes\r\n\r\nTHREE.RepeatWrapping = 1000;\r\nTHREE.ClampToEdgeWrapping = 1001;\r\nTHREE.MirroredRepeatWrapping = 1002;\r\n\r\n// Filters\r\n\r\nTHREE.NearestFilter = 1003;\r\nTHREE.NearestMipMapNearestFilter = 1004;\r\nTHREE.NearestMipMapLinearFilter = 1005;\r\nTHREE.LinearFilter = 1006;\r\nTHREE.LinearMipMapNearestFilter = 1007;\r\nTHREE.LinearMipMapLinearFilter = 1008;\r\n\r\n// Data types\r\n\r\nTHREE.UnsignedByteType = 1009;\r\nTHREE.ByteType = 1010;\r\nTHREE.ShortType = 1011;\r\nTHREE.UnsignedShortType = 1012;\r\nTHREE.IntType = 1013;\r\nTHREE.UnsignedIntType = 1014;\r\nTHREE.FloatType = 1015;\r\nTHREE.HalfFloatType = 1025;\r\n\r\n// Pixel types\r\n\r\n//THREE.UnsignedByteType = 1009;\r\nTHREE.UnsignedShort4444Type = 1016;\r\nTHREE.UnsignedShort5551Type = 1017;\r\nTHREE.UnsignedShort565Type = 1018;\r\n\r\n// Pixel formats\r\n\r\nTHREE.AlphaFormat = 1019;\r\nTHREE.RGBFormat = 1020;\r\nTHREE.RGBAFormat = 1021;\r\nTHREE.LuminanceFormat = 1022;\r\nTHREE.LuminanceAlphaFormat = 1023;\r\n// THREE.RGBEFormat handled as THREE.RGBAFormat in shaders\r\nTHREE.RGBEFormat = THREE.RGBAFormat; //1024;\r\n\r\n// DDS / ST3C Compressed texture formats\r\n\r\nTHREE.RGB_S3TC_DXT1_Format = 2001;\r\nTHREE.RGBA_S3TC_DXT1_Format = 2002;\r\nTHREE.RGBA_S3TC_DXT3_Format = 2003;\r\nTHREE.RGBA_S3TC_DXT5_Format = 2004;\r\n\r\n\r\n// PVRTC compressed texture formats\r\n\r\nTHREE.RGB_PVRTC_4BPPV1_Format = 2100;\r\nTHREE.RGB_PVRTC_2BPPV1_Format = 2101;\r\nTHREE.RGBA_PVRTC_4BPPV1_Format = 2102;\r\nTHREE.RGBA_PVRTC_2BPPV1_Format = 2103;\r\n\r\n\r\n// DEPRECATED\r\n\r\nTHREE.Projector = function () {\r\n\r\n\tTHREE.error( 'THREE.Projector has been moved to /examples/js/renderers/Projector.js.' );\r\n\r\n\tthis.projectVector = function ( vector, camera ) {\r\n\r\n\t\tTHREE.warn( 'THREE.Projector: .projectVector() is now vector.project().' );\r\n\t\tvector.project( camera );\r\n\r\n\t};\r\n\r\n\tthis.unprojectVector = function ( vector, camera ) {\r\n\r\n\t\tTHREE.warn( 'THREE.Projector: .unprojectVector() is now vector.unproject().' );\r\n\t\tvector.unproject( camera );\r\n\r\n\t};\r\n\r\n\tthis.pickingRay = function ( vector, camera ) {\r\n\r\n\t\tTHREE.error( 'THREE.Projector: .pickingRay() is now raycaster.setFromCamera().' );\r\n\r\n\t};\r\n\r\n};\r\n\r\nTHREE.CanvasRenderer = function () {\r\n\r\n\tTHREE.error( 'THREE.CanvasRenderer has been moved to /examples/js/renderers/CanvasRenderer.js' );\r\n\r\n\tthis.domElement = document.createElement( 'canvas' );\r\n\tthis.clear = function () {};\r\n\tthis.render = function () {};\r\n\tthis.setClearColor = function () {};\r\n\tthis.setSize = function () {};\r\n\r\n};\r\n\r\n// File:src/math/Color.js\r\n\r\n/**\r\n * @author mrdoob / http://mrdoob.com/\r\n */\r\n\r\nTHREE.Color = function ( color ) {\r\n\r\n\tif ( arguments.length === 3 ) {\r\n\r\n\t\treturn this.setRGB( arguments[ 0 ], arguments[ 1 ], arguments[ 2 ] );\r\n\r\n\t}\r\n\r\n\treturn this.set( color )\r\n\r\n};\r\n\r\nTHREE.Color.prototype = {\r\n\r\n\tconstructor: THREE.Color,\r\n\r\n\tr: 1, g: 1, b: 1,\r\n\r\n\tset: function ( value ) {\r\n\r\n\t\tif ( value instanceof THREE.Color ) {\r\n\r\n\t\t\tthis.copy( value );\r\n\r\n\t\t} else if ( typeof value === 'number' ) {\r\n\r\n\t\t\tthis.setHex( value );\r\n\r\n\t\t} else if ( typeof value === 'string' ) {\r\n\r\n\t\t\tthis.setStyle( value );\r\n\r\n\t\t}\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tsetHex: function ( hex ) {\r\n\r\n\t\thex = Math.floor( hex );\r\n\r\n\t\tthis.r = ( hex >> 16 & 255 ) / 255;\r\n\t\tthis.g = ( hex >> 8 & 255 ) / 255;\r\n\t\tthis.b = ( hex & 255 ) / 255;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tsetRGB: function ( r, g, b ) {\r\n\r\n\t\tthis.r = r;\r\n\t\tthis.g = g;\r\n\t\tthis.b = b;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tsetHSL: function ( h, s, l ) {\r\n\r\n\t\t// h,s,l ranges are in 0.0 - 1.0\r\n\r\n\t\tif ( s === 0 ) {\r\n\r\n\t\t\tthis.r = this.g = this.b = l;\r\n\r\n\t\t} else {\r\n\r\n\t\t\tvar hue2rgb = function ( p, q, t ) {\r\n\r\n\t\t\t\tif ( t < 0 ) t += 1;\r\n\t\t\t\tif ( t > 1 ) t -= 1;\r\n\t\t\t\tif ( t < 1 / 6 ) return p + ( q - p ) * 6 * t;\r\n\t\t\t\tif ( t < 1 / 2 ) return q;\r\n\t\t\t\tif ( t < 2 / 3 ) return p + ( q - p ) * 6 * ( 2 / 3 - t );\r\n\t\t\t\treturn p;\r\n\r\n\t\t\t};\r\n\r\n\t\t\tvar p = l <= 0.5 ? l * ( 1 + s ) : l + s - ( l * s );\r\n\t\t\tvar q = ( 2 * l ) - p;\r\n\r\n\t\t\tthis.r = hue2rgb( q, p, h + 1 / 3 );\r\n\t\t\tthis.g = hue2rgb( q, p, h );\r\n\t\t\tthis.b = hue2rgb( q, p, h - 1 / 3 );\r\n\r\n\t\t}\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tsetStyle: function ( style ) {\r\n\r\n\t\t// rgb(255,0,0)\r\n\r\n\t\tif ( /^rgb\\((\\d+), ?(\\d+), ?(\\d+)\\)$/i.test( style ) ) {\r\n\r\n\t\t\tvar color = /^rgb\\((\\d+), ?(\\d+), ?(\\d+)\\)$/i.exec( style );\r\n\r\n\t\t\tthis.r = Math.min( 255, parseInt( color[ 1 ], 10 ) ) / 255;\r\n\t\t\tthis.g = Math.min( 255, parseInt( color[ 2 ], 10 ) ) / 255;\r\n\t\t\tthis.b = Math.min( 255, parseInt( color[ 3 ], 10 ) ) / 255;\r\n\r\n\t\t\treturn this;\r\n\r\n\t\t}\r\n\r\n\t\t// rgb(100%,0%,0%)\r\n\r\n\t\tif ( /^rgb\\((\\d+)\\%, ?(\\d+)\\%, ?(\\d+)\\%\\)$/i.test( style ) ) {\r\n\r\n\t\t\tvar color = /^rgb\\((\\d+)\\%, ?(\\d+)\\%, ?(\\d+)\\%\\)$/i.exec( style );\r\n\r\n\t\t\tthis.r = Math.min( 100, parseInt( color[ 1 ], 10 ) ) / 100;\r\n\t\t\tthis.g = Math.min( 100, parseInt( color[ 2 ], 10 ) ) / 100;\r\n\t\t\tthis.b = Math.min( 100, parseInt( color[ 3 ], 10 ) ) / 100;\r\n\r\n\t\t\treturn this;\r\n\r\n\t\t}\r\n\r\n\t\t// #ff0000\r\n\r\n\t\tif ( /^\\#([0-9a-f]{6})$/i.test( style ) ) {\r\n\r\n\t\t\tvar color = /^\\#([0-9a-f]{6})$/i.exec( style );\r\n\r\n\t\t\tthis.setHex( parseInt( color[ 1 ], 16 ) );\r\n\r\n\t\t\treturn this;\r\n\r\n\t\t}\r\n\r\n\t\t// #f00\r\n\r\n\t\tif ( /^\\#([0-9a-f])([0-9a-f])([0-9a-f])$/i.test( style ) ) {\r\n\r\n\t\t\tvar color = /^\\#([0-9a-f])([0-9a-f])([0-9a-f])$/i.exec( style );\r\n\r\n\t\t\tthis.setHex( parseInt( color[ 1 ] + color[ 1 ] + color[ 2 ] + color[ 2 ] + color[ 3 ] + color[ 3 ], 16 ) );\r\n\r\n\t\t\treturn this;\r\n\r\n\t\t}\r\n\r\n\t\t// red\r\n\r\n\t\tif ( /^(\\w+)$/i.test( style ) ) {\r\n\r\n\t\t\tthis.setHex( THREE.ColorKeywords[ style ] );\r\n\r\n\t\t\treturn this;\r\n\r\n\t\t}\r\n\r\n\r\n\t},\r\n\r\n\tcopy: function ( color ) {\r\n\r\n\t\tthis.r = color.r;\r\n\t\tthis.g = color.g;\r\n\t\tthis.b = color.b;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tcopyGammaToLinear: function ( color, gammaFactor ) {\r\n\r\n\t\tif ( gammaFactor === undefined ) gammaFactor = 2.0;\r\n\r\n\t\tthis.r = Math.pow( color.r, gammaFactor );\r\n\t\tthis.g = Math.pow( color.g, gammaFactor );\r\n\t\tthis.b = Math.pow( color.b, gammaFactor );\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tcopyLinearToGamma: function ( color, gammaFactor ) {\r\n\r\n\t\tif ( gammaFactor === undefined ) gammaFactor = 2.0;\r\n\r\n\t\tvar safeInverse = ( gammaFactor > 0 ) ? ( 1.0 / gammaFactor ) : 1.0;\r\n\r\n\t\tthis.r = Math.pow( color.r, safeInverse );\r\n\t\tthis.g = Math.pow( color.g, safeInverse );\r\n\t\tthis.b = Math.pow( color.b, safeInverse );\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tconvertGammaToLinear: function () {\r\n\r\n\t\tvar r = this.r, g = this.g, b = this.b;\r\n\r\n\t\tthis.r = r * r;\r\n\t\tthis.g = g * g;\r\n\t\tthis.b = b * b;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tconvertLinearToGamma: function () {\r\n\r\n\t\tthis.r = Math.sqrt( this.r );\r\n\t\tthis.g = Math.sqrt( this.g );\r\n\t\tthis.b = Math.sqrt( this.b );\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tgetHex: function () {\r\n\r\n\t\treturn ( this.r * 255 ) << 16 ^ ( this.g * 255 ) << 8 ^ ( this.b * 255 ) << 0;\r\n\r\n\t},\r\n\r\n\tgetHexString: function () {\r\n\r\n\t\treturn ( '000000' + this.getHex().toString( 16 ) ).slice( - 6 );\r\n\r\n\t},\r\n\r\n\tgetHSL: function ( optionalTarget ) {\r\n\r\n\t\t// h,s,l ranges are in 0.0 - 1.0\r\n\r\n\t\tvar hsl = optionalTarget || { h: 0, s: 0, l: 0 };\r\n\r\n\t\tvar r = this.r, g = this.g, b = this.b;\r\n\r\n\t\tvar max = Math.max( r, g, b );\r\n\t\tvar min = Math.min( r, g, b );\r\n\r\n\t\tvar hue, saturation;\r\n\t\tvar lightness = ( min + max ) / 2.0;\r\n\r\n\t\tif ( min === max ) {\r\n\r\n\t\t\thue = 0;\r\n\t\t\tsaturation = 0;\r\n\r\n\t\t} else {\r\n\r\n\t\t\tvar delta = max - min;\r\n\r\n\t\t\tsaturation = lightness <= 0.5 ? delta / ( max + min ) : delta / ( 2 - max - min );\r\n\r\n\t\t\tswitch ( max ) {\r\n\r\n\t\t\t\tcase r: hue = ( g - b ) / delta + ( g < b ? 6 : 0 ); break;\r\n\t\t\t\tcase g: hue = ( b - r ) / delta + 2; break;\r\n\t\t\t\tcase b: hue = ( r - g ) / delta + 4; break;\r\n\r\n\t\t\t}\r\n\r\n\t\t\thue /= 6;\r\n\r\n\t\t}\r\n\r\n\t\thsl.h = hue;\r\n\t\thsl.s = saturation;\r\n\t\thsl.l = lightness;\r\n\r\n\t\treturn hsl;\r\n\r\n\t},\r\n\r\n\tgetStyle: function () {\r\n\r\n\t\treturn 'rgb(' + ( ( this.r * 255 ) | 0 ) + ',' + ( ( this.g * 255 ) | 0 ) + ',' + ( ( this.b * 255 ) | 0 ) + ')';\r\n\r\n\t},\r\n\r\n\toffsetHSL: function ( h, s, l ) {\r\n\r\n\t\tvar hsl = this.getHSL();\r\n\r\n\t\thsl.h += h; hsl.s += s; hsl.l += l;\r\n\r\n\t\tthis.setHSL( hsl.h, hsl.s, hsl.l );\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tadd: function ( color ) {\r\n\r\n\t\tthis.r += color.r;\r\n\t\tthis.g += color.g;\r\n\t\tthis.b += color.b;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\taddColors: function ( color1, color2 ) {\r\n\r\n\t\tthis.r = color1.r + color2.r;\r\n\t\tthis.g = color1.g + color2.g;\r\n\t\tthis.b = color1.b + color2.b;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\taddScalar: function ( s ) {\r\n\r\n\t\tthis.r += s;\r\n\t\tthis.g += s;\r\n\t\tthis.b += s;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tmultiply: function ( color ) {\r\n\r\n\t\tthis.r *= color.r;\r\n\t\tthis.g *= color.g;\r\n\t\tthis.b *= color.b;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tmultiplyScalar: function ( s ) {\r\n\r\n\t\tthis.r *= s;\r\n\t\tthis.g *= s;\r\n\t\tthis.b *= s;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tlerp: function ( color, alpha ) {\r\n\r\n\t\tthis.r += ( color.r - this.r ) * alpha;\r\n\t\tthis.g += ( color.g - this.g ) * alpha;\r\n\t\tthis.b += ( color.b - this.b ) * alpha;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tequals: function ( c ) {\r\n\r\n\t\treturn ( c.r === this.r ) && ( c.g === this.g ) && ( c.b === this.b );\r\n\r\n\t},\r\n\r\n\tfromArray: function ( array ) {\r\n\r\n\t\tthis.r = array[ 0 ];\r\n\t\tthis.g = array[ 1 ];\r\n\t\tthis.b = array[ 2 ];\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\ttoArray: function ( array, offset ) {\r\n\r\n\t\tif ( array === undefined ) array = [];\r\n\t\tif ( offset === undefined ) offset = 0;\r\n\r\n\t\tarray[ offset ] = this.r;\r\n\t\tarray[ offset + 1 ] = this.g;\r\n\t\tarray[ offset + 2 ] = this.b;\r\n\r\n\t\treturn array;\r\n\t},\r\n\r\n\tclone: function () {\r\n\r\n\t\treturn new THREE.Color().setRGB( this.r, this.g, this.b );\r\n\r\n\t}\r\n\r\n};\r\n\r\nTHREE.ColorKeywords = { 'aliceblue': 0xF0F8FF, 'antiquewhite': 0xFAEBD7, 'aqua': 0x00FFFF, 'aquamarine': 0x7FFFD4, 'azure': 0xF0FFFF,\r\n'beige': 0xF5F5DC, 'bisque': 0xFFE4C4, 'black': 0x000000, 'blanchedalmond': 0xFFEBCD, 'blue': 0x0000FF, 'blueviolet': 0x8A2BE2,\r\n'brown': 0xA52A2A, 'burlywood': 0xDEB887, 'cadetblue': 0x5F9EA0, 'chartreuse': 0x7FFF00, 'chocolate': 0xD2691E, 'coral': 0xFF7F50,\r\n'cornflowerblue': 0x6495ED, 'cornsilk': 0xFFF8DC, 'crimson': 0xDC143C, 'cyan': 0x00FFFF, 'darkblue': 0x00008B, 'darkcyan': 0x008B8B,\r\n'darkgoldenrod': 0xB8860B, 'darkgray': 0xA9A9A9, 'darkgreen': 0x006400, 'darkgrey': 0xA9A9A9, 'darkkhaki': 0xBDB76B, 'darkmagenta': 0x8B008B,\r\n'darkolivegreen': 0x556B2F, 'darkorange': 0xFF8C00, 'darkorchid': 0x9932CC, 'darkred': 0x8B0000, 'darksalmon': 0xE9967A, 'darkseagreen': 0x8FBC8F,\r\n'darkslateblue': 0x483D8B, 'darkslategray': 0x2F4F4F, 'darkslategrey': 0x2F4F4F, 'darkturquoise': 0x00CED1, 'darkviolet': 0x9400D3,\r\n'deeppink': 0xFF1493, 'deepskyblue': 0x00BFFF, 'dimgray': 0x696969, 'dimgrey': 0x696969, 'dodgerblue': 0x1E90FF, 'firebrick': 0xB22222,\r\n'floralwhite': 0xFFFAF0, 'forestgreen': 0x228B22, 'fuchsia': 0xFF00FF, 'gainsboro': 0xDCDCDC, 'ghostwhite': 0xF8F8FF, 'gold': 0xFFD700,\r\n'goldenrod': 0xDAA520, 'gray': 0x808080, 'green': 0x008000, 'greenyellow': 0xADFF2F, 'grey': 0x808080, 'honeydew': 0xF0FFF0, 'hotpink': 0xFF69B4,\r\n'indianred': 0xCD5C5C, 'indigo': 0x4B0082, 'ivory': 0xFFFFF0, 'khaki': 0xF0E68C, 'lavender': 0xE6E6FA, 'lavenderblush': 0xFFF0F5, 'lawngreen': 0x7CFC00,\r\n'lemonchiffon': 0xFFFACD, 'lightblue': 0xADD8E6, 'lightcoral': 0xF08080, 'lightcyan': 0xE0FFFF, 'lightgoldenrodyellow': 0xFAFAD2, 'lightgray': 0xD3D3D3,\r\n'lightgreen': 0x90EE90, 'lightgrey': 0xD3D3D3, 'lightpink': 0xFFB6C1, 'lightsalmon': 0xFFA07A, 'lightseagreen': 0x20B2AA, 'lightskyblue': 0x87CEFA,\r\n'lightslategray': 0x778899, 'lightslategrey': 0x778899, 'lightsteelblue': 0xB0C4DE, 'lightyellow': 0xFFFFE0, 'lime': 0x00FF00, 'limegreen': 0x32CD32,\r\n'linen': 0xFAF0E6, 'magenta': 0xFF00FF, 'maroon': 0x800000, 'mediumaquamarine': 0x66CDAA, 'mediumblue': 0x0000CD, 'mediumorchid': 0xBA55D3,\r\n'mediumpurple': 0x9370DB, 'mediumseagreen': 0x3CB371, 'mediumslateblue': 0x7B68EE, 'mediumspringgreen': 0x00FA9A, 'mediumturquoise': 0x48D1CC,\r\n'mediumvioletred': 0xC71585, 'midnightblue': 0x191970, 'mintcream': 0xF5FFFA, 'mistyrose': 0xFFE4E1, 'moccasin': 0xFFE4B5, 'navajowhite': 0xFFDEAD,\r\n'navy': 0x000080, 'oldlace': 0xFDF5E6, 'olive': 0x808000, 'olivedrab': 0x6B8E23, 'orange': 0xFFA500, 'orangered': 0xFF4500, 'orchid': 0xDA70D6,\r\n'palegoldenrod': 0xEEE8AA, 'palegreen': 0x98FB98, 'paleturquoise': 0xAFEEEE, 'palevioletred': 0xDB7093, 'papayawhip': 0xFFEFD5, 'peachpuff': 0xFFDAB9,\r\n'peru': 0xCD853F, 'pink': 0xFFC0CB, 'plum': 0xDDA0DD, 'powderblue': 0xB0E0E6, 'purple': 0x800080, 'red': 0xFF0000, 'rosybrown': 0xBC8F8F,\r\n'royalblue': 0x4169E1, 'saddlebrown': 0x8B4513, 'salmon': 0xFA8072, 'sandybrown': 0xF4A460, 'seagreen': 0x2E8B57, 'seashell': 0xFFF5EE,\r\n'sienna': 0xA0522D, 'silver': 0xC0C0C0, 'skyblue': 0x87CEEB, 'slateblue': 0x6A5ACD, 'slategray': 0x708090, 'slategrey': 0x708090, 'snow': 0xFFFAFA,\r\n'springgreen': 0x00FF7F, 'steelblue': 0x4682B4, 'tan': 0xD2B48C, 'teal': 0x008080, 'thistle': 0xD8BFD8, 'tomato': 0xFF6347, 'turquoise': 0x40E0D0,\r\n'violet': 0xEE82EE, 'wheat': 0xF5DEB3, 'white': 0xFFFFFF, 'whitesmoke': 0xF5F5F5, 'yellow': 0xFFFF00, 'yellowgreen': 0x9ACD32 };\r\n\r\n// File:src/math/Quaternion.js\r\n\r\n/**\r\n * @author mikael emtinger / http://gomo.se/\r\n * @author alteredq / http://alteredqualia.com/\r\n * @author WestLangley / http://github.com/WestLangley\r\n * @author bhouston / http://exocortex.com\r\n */\r\n\r\nTHREE.Quaternion = function ( x, y, z, w ) {\r\n\r\n\tthis._x = x || 0;\r\n\tthis._y = y || 0;\r\n\tthis._z = z || 0;\r\n\tthis._w = ( w !== undefined ) ? w : 1;\r\n\r\n};\r\n\r\nTHREE.Quaternion.prototype = {\r\n\r\n\tconstructor: THREE.Quaternion,\r\n\r\n\t_x: 0,_y: 0, _z: 0, _w: 0,\r\n\r\n\tget x () {\r\n\r\n\t\treturn this._x;\r\n\r\n\t},\r\n\r\n\tset x ( value ) {\r\n\r\n\t\tthis._x = value;\r\n\t\tthis.onChangeCallback();\r\n\r\n\t},\r\n\r\n\tget y () {\r\n\r\n\t\treturn this._y;\r\n\r\n\t},\r\n\r\n\tset y ( value ) {\r\n\r\n\t\tthis._y = value;\r\n\t\tthis.onChangeCallback();\r\n\r\n\t},\r\n\r\n\tget z () {\r\n\r\n\t\treturn this._z;\r\n\r\n\t},\r\n\r\n\tset z ( value ) {\r\n\r\n\t\tthis._z = value;\r\n\t\tthis.onChangeCallback();\r\n\r\n\t},\r\n\r\n\tget w () {\r\n\r\n\t\treturn this._w;\r\n\r\n\t},\r\n\r\n\tset w ( value ) {\r\n\r\n\t\tthis._w = value;\r\n\t\tthis.onChangeCallback();\r\n\r\n\t},\r\n\r\n\tset: function ( x, y, z, w ) {\r\n\r\n\t\tthis._x = x;\r\n\t\tthis._y = y;\r\n\t\tthis._z = z;\r\n\t\tthis._w = w;\r\n\r\n\t\tthis.onChangeCallback();\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tcopy: function ( quaternion ) {\r\n\r\n\t\tthis._x = quaternion.x;\r\n\t\tthis._y = quaternion.y;\r\n\t\tthis._z = quaternion.z;\r\n\t\tthis._w = quaternion.w;\r\n\r\n\t\tthis.onChangeCallback();\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tsetFromEuler: function ( euler, update ) {\r\n\r\n\t\tif ( euler instanceof THREE.Euler === false ) {\r\n\r\n\t\t\tthrow new Error( 'THREE.Quaternion: .setFromEuler() now expects a Euler rotation rather than a Vector3 and order.' );\r\n\t\t}\r\n\r\n\t\t// http://www.mathworks.com/matlabcentral/fileexchange/\r\n\t\t// \t20696-function-to-convert-between-dcm-euler-angles-quaternions-and-euler-vectors/\r\n\t\t//\tcontent/SpinCalc.m\r\n\r\n\t\tvar c1 = Math.cos( euler._x / 2 );\r\n\t\tvar c2 = Math.cos( euler._y / 2 );\r\n\t\tvar c3 = Math.cos( euler._z / 2 );\r\n\t\tvar s1 = Math.sin( euler._x / 2 );\r\n\t\tvar s2 = Math.sin( euler._y / 2 );\r\n\t\tvar s3 = Math.sin( euler._z / 2 );\r\n\r\n\t\tif ( euler.order === 'XYZ' ) {\r\n\r\n\t\t\tthis._x = s1 * c2 * c3 + c1 * s2 * s3;\r\n\t\t\tthis._y = c1 * s2 * c3 - s1 * c2 * s3;\r\n\t\t\tthis._z = c1 * c2 * s3 + s1 * s2 * c3;\r\n\t\t\tthis._w = c1 * c2 * c3 - s1 * s2 * s3;\r\n\r\n\t\t} else if ( euler.order === 'YXZ' ) {\r\n\r\n\t\t\tthis._x = s1 * c2 * c3 + c1 * s2 * s3;\r\n\t\t\tthis._y = c1 * s2 * c3 - s1 * c2 * s3;\r\n\t\t\tthis._z = c1 * c2 * s3 - s1 * s2 * c3;\r\n\t\t\tthis._w = c1 * c2 * c3 + s1 * s2 * s3;\r\n\r\n\t\t} else if ( euler.order === 'ZXY' ) {\r\n\r\n\t\t\tthis._x = s1 * c2 * c3 - c1 * s2 * s3;\r\n\t\t\tthis._y = c1 * s2 * c3 + s1 * c2 * s3;\r\n\t\t\tthis._z = c1 * c2 * s3 + s1 * s2 * c3;\r\n\t\t\tthis._w = c1 * c2 * c3 - s1 * s2 * s3;\r\n\r\n\t\t} else if ( euler.order === 'ZYX' ) {\r\n\r\n\t\t\tthis._x = s1 * c2 * c3 - c1 * s2 * s3;\r\n\t\t\tthis._y = c1 * s2 * c3 + s1 * c2 * s3;\r\n\t\t\tthis._z = c1 * c2 * s3 - s1 * s2 * c3;\r\n\t\t\tthis._w = c1 * c2 * c3 + s1 * s2 * s3;\r\n\r\n\t\t} else if ( euler.order === 'YZX' ) {\r\n\r\n\t\t\tthis._x = s1 * c2 * c3 + c1 * s2 * s3;\r\n\t\t\tthis._y = c1 * s2 * c3 + s1 * c2 * s3;\r\n\t\t\tthis._z = c1 * c2 * s3 - s1 * s2 * c3;\r\n\t\t\tthis._w = c1 * c2 * c3 - s1 * s2 * s3;\r\n\r\n\t\t} else if ( euler.order === 'XZY' ) {\r\n\r\n\t\t\tthis._x = s1 * c2 * c3 - c1 * s2 * s3;\r\n\t\t\tthis._y = c1 * s2 * c3 - s1 * c2 * s3;\r\n\t\t\tthis._z = c1 * c2 * s3 + s1 * s2 * c3;\r\n\t\t\tthis._w = c1 * c2 * c3 + s1 * s2 * s3;\r\n\r\n\t\t}\r\n\r\n\t\tif ( update !== false ) this.onChangeCallback();\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tsetFromAxisAngle: function ( axis, angle ) {\r\n\r\n\t\t// http://www.euclideanspace.com/maths/geometry/rotations/conversions/angleToQuaternion/index.htm\r\n\r\n\t\t// assumes axis is normalized\r\n\r\n\t\tvar halfAngle = angle / 2, s = Math.sin( halfAngle );\r\n\r\n\t\tthis._x = axis.x * s;\r\n\t\tthis._y = axis.y * s;\r\n\t\tthis._z = axis.z * s;\r\n\t\tthis._w = Math.cos( halfAngle );\r\n\r\n\t\tthis.onChangeCallback();\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tsetFromRotationMatrix: function ( m ) {\r\n\r\n\t\t// http://www.euclideanspace.com/maths/geometry/rotations/conversions/matrixToQuaternion/index.htm\r\n\r\n\t\t// assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled)\r\n\r\n\t\tvar te = m.elements,\r\n\r\n\t\t\tm11 = te[ 0 ], m12 = te[ 4 ], m13 = te[ 8 ],\r\n\t\t\tm21 = te[ 1 ], m22 = te[ 5 ], m23 = te[ 9 ],\r\n\t\t\tm31 = te[ 2 ], m32 = te[ 6 ], m33 = te[ 10 ],\r\n\r\n\t\t\ttrace = m11 + m22 + m33,\r\n\t\t\ts;\r\n\r\n\t\tif ( trace > 0 ) {\r\n\r\n\t\t\ts = 0.5 / Math.sqrt( trace + 1.0 );\r\n\r\n\t\t\tthis._w = 0.25 / s;\r\n\t\t\tthis._x = ( m32 - m23 ) * s;\r\n\t\t\tthis._y = ( m13 - m31 ) * s;\r\n\t\t\tthis._z = ( m21 - m12 ) * s;\r\n\r\n\t\t} else if ( m11 > m22 && m11 > m33 ) {\r\n\r\n\t\t\ts = 2.0 * Math.sqrt( 1.0 + m11 - m22 - m33 );\r\n\r\n\t\t\tthis._w = ( m32 - m23 ) / s;\r\n\t\t\tthis._x = 0.25 * s;\r\n\t\t\tthis._y = ( m12 + m21 ) / s;\r\n\t\t\tthis._z = ( m13 + m31 ) / s;\r\n\r\n\t\t} else if ( m22 > m33 ) {\r\n\r\n\t\t\ts = 2.0 * Math.sqrt( 1.0 + m22 - m11 - m33 );\r\n\r\n\t\t\tthis._w = ( m13 - m31 ) / s;\r\n\t\t\tthis._x = ( m12 + m21 ) / s;\r\n\t\t\tthis._y = 0.25 * s;\r\n\t\t\tthis._z = ( m23 + m32 ) / s;\r\n\r\n\t\t} else {\r\n\r\n\t\t\ts = 2.0 * Math.sqrt( 1.0 + m33 - m11 - m22 );\r\n\r\n\t\t\tthis._w = ( m21 - m12 ) / s;\r\n\t\t\tthis._x = ( m13 + m31 ) / s;\r\n\t\t\tthis._y = ( m23 + m32 ) / s;\r\n\t\t\tthis._z = 0.25 * s;\r\n\r\n\t\t}\r\n\r\n\t\tthis.onChangeCallback();\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tsetFromUnitVectors: function () {\r\n\r\n\t\t// http://lolengine.net/blog/2014/02/24/quaternion-from-two-vectors-final\r\n\r\n\t\t// assumes direction vectors vFrom and vTo are normalized\r\n\r\n\t\tvar v1, r;\r\n\r\n\t\tvar EPS = 0.000001;\r\n\r\n\t\treturn function ( vFrom, vTo ) {\r\n\r\n\t\t\tif ( v1 === undefined ) v1 = new THREE.Vector3();\r\n\r\n\t\t\tr = vFrom.dot( vTo ) + 1;\r\n\r\n\t\t\tif ( r < EPS ) {\r\n\r\n\t\t\t\tr = 0;\r\n\r\n\t\t\t\tif ( Math.abs( vFrom.x ) > Math.abs( vFrom.z ) ) {\r\n\r\n\t\t\t\t\tv1.set( - vFrom.y, vFrom.x, 0 );\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\tv1.set( 0, - vFrom.z, vFrom.y );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tv1.crossVectors( vFrom, vTo );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tthis._x = v1.x;\r\n\t\t\tthis._y = v1.y;\r\n\t\t\tthis._z = v1.z;\r\n\t\t\tthis._w = r;\r\n\r\n\t\t\tthis.normalize();\r\n\r\n\t\t\treturn this;\r\n\r\n\t\t}\r\n\r\n\t}(),\r\n\r\n\tinverse: function () {\r\n\r\n\t\tthis.conjugate().normalize();\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tconjugate: function () {\r\n\r\n\t\tthis._x *= - 1;\r\n\t\tthis._y *= - 1;\r\n\t\tthis._z *= - 1;\r\n\r\n\t\tthis.onChangeCallback();\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tdot: function ( v ) {\r\n\r\n\t\treturn this._x * v._x + this._y * v._y + this._z * v._z + this._w * v._w;\r\n\r\n\t},\r\n\r\n\tlengthSq: function () {\r\n\r\n\t\treturn this._x * this._x + this._y * this._y + this._z * this._z + this._w * this._w;\r\n\r\n\t},\r\n\r\n\tlength: function () {\r\n\r\n\t\treturn Math.sqrt( this._x * this._x + this._y * this._y + this._z * this._z + this._w * this._w );\r\n\r\n\t},\r\n\r\n\tnormalize: function () {\r\n\r\n\t\tvar l = this.length();\r\n\r\n\t\tif ( l === 0 ) {\r\n\r\n\t\t\tthis._x = 0;\r\n\t\t\tthis._y = 0;\r\n\t\t\tthis._z = 0;\r\n\t\t\tthis._w = 1;\r\n\r\n\t\t} else {\r\n\r\n\t\t\tl = 1 / l;\r\n\r\n\t\t\tthis._x = this._x * l;\r\n\t\t\tthis._y = this._y * l;\r\n\t\t\tthis._z = this._z * l;\r\n\t\t\tthis._w = this._w * l;\r\n\r\n\t\t}\r\n\r\n\t\tthis.onChangeCallback();\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tmultiply: function ( q, p ) {\r\n\r\n\t\tif ( p !== undefined ) {\r\n\r\n\t\t\tTHREE.warn( 'THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead.' );\r\n\t\t\treturn this.multiplyQuaternions( q, p );\r\n\r\n\t\t}\r\n\r\n\t\treturn this.multiplyQuaternions( this, q );\r\n\r\n\t},\r\n\r\n\tmultiplyQuaternions: function ( a, b ) {\r\n\r\n\t\t// from http://www.euclideanspace.com/maths/algebra/realNormedAlgebra/quaternions/code/index.htm\r\n\r\n\t\tvar qax = a._x, qay = a._y, qaz = a._z, qaw = a._w;\r\n\t\tvar qbx = b._x, qby = b._y, qbz = b._z, qbw = b._w;\r\n\r\n\t\tthis._x = qax * qbw + qaw * qbx + qay * qbz - qaz * qby;\r\n\t\tthis._y = qay * qbw + qaw * qby + qaz * qbx - qax * qbz;\r\n\t\tthis._z = qaz * qbw + qaw * qbz + qax * qby - qay * qbx;\r\n\t\tthis._w = qaw * qbw - qax * qbx - qay * qby - qaz * qbz;\r\n\r\n\t\tthis.onChangeCallback();\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tmultiplyVector3: function ( vector ) {\r\n\r\n\t\tTHREE.warn( 'THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead.' );\r\n\t\treturn vector.applyQuaternion( this );\r\n\r\n\t},\r\n\r\n\tslerp: function ( qb, t ) {\r\n\r\n\t\tif ( t === 0 ) return this;\r\n\t\tif ( t === 1 ) return this.copy( qb );\r\n\r\n\t\tvar x = this._x, y = this._y, z = this._z, w = this._w;\r\n\r\n\t\t// http://www.euclideanspace.com/maths/algebra/realNormedAlgebra/quaternions/slerp/\r\n\r\n\t\tvar cosHalfTheta = w * qb._w + x * qb._x + y * qb._y + z * qb._z;\r\n\r\n\t\tif ( cosHalfTheta < 0 ) {\r\n\r\n\t\t\tthis._w = - qb._w;\r\n\t\t\tthis._x = - qb._x;\r\n\t\t\tthis._y = - qb._y;\r\n\t\t\tthis._z = - qb._z;\r\n\r\n\t\t\tcosHalfTheta = - cosHalfTheta;\r\n\r\n\t\t} else {\r\n\r\n\t\t\tthis.copy( qb );\r\n\r\n\t\t}\r\n\r\n\t\tif ( cosHalfTheta >= 1.0 ) {\r\n\r\n\t\t\tthis._w = w;\r\n\t\t\tthis._x = x;\r\n\t\t\tthis._y = y;\r\n\t\t\tthis._z = z;\r\n\r\n\t\t\treturn this;\r\n\r\n\t\t}\r\n\r\n\t\tvar halfTheta = Math.acos( cosHalfTheta );\r\n\t\tvar sinHalfTheta = Math.sqrt( 1.0 - cosHalfTheta * cosHalfTheta );\r\n\r\n\t\tif ( Math.abs( sinHalfTheta ) < 0.001 ) {\r\n\r\n\t\t\tthis._w = 0.5 * ( w + this._w );\r\n\t\t\tthis._x = 0.5 * ( x + this._x );\r\n\t\t\tthis._y = 0.5 * ( y + this._y );\r\n\t\t\tthis._z = 0.5 * ( z + this._z );\r\n\r\n\t\t\treturn this;\r\n\r\n\t\t}\r\n\r\n\t\tvar ratioA = Math.sin( ( 1 - t ) * halfTheta ) / sinHalfTheta,\r\n\t\tratioB = Math.sin( t * halfTheta ) / sinHalfTheta;\r\n\r\n\t\tthis._w = ( w * ratioA + this._w * ratioB );\r\n\t\tthis._x = ( x * ratioA + this._x * ratioB );\r\n\t\tthis._y = ( y * ratioA + this._y * ratioB );\r\n\t\tthis._z = ( z * ratioA + this._z * ratioB );\r\n\r\n\t\tthis.onChangeCallback();\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tequals: function ( quaternion ) {\r\n\r\n\t\treturn ( quaternion._x === this._x ) && ( quaternion._y === this._y ) && ( quaternion._z === this._z ) && ( quaternion._w === this._w );\r\n\r\n\t},\r\n\r\n\tfromArray: function ( array, offset ) {\r\n\r\n\t\tif ( offset === undefined ) offset = 0;\r\n\r\n\t\tthis._x = array[ offset ];\r\n\t\tthis._y = array[ offset + 1 ];\r\n\t\tthis._z = array[ offset + 2 ];\r\n\t\tthis._w = array[ offset + 3 ];\r\n\r\n\t\tthis.onChangeCallback();\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\ttoArray: function ( array, offset ) {\r\n\r\n\t\tif ( array === undefined ) array = [];\r\n\t\tif ( offset === undefined ) offset = 0;\r\n\r\n\t\tarray[ offset ] = this._x;\r\n\t\tarray[ offset + 1 ] = this._y;\r\n\t\tarray[ offset + 2 ] = this._z;\r\n\t\tarray[ offset + 3 ] = this._w;\r\n\r\n\t\treturn array;\r\n\r\n\t},\r\n\r\n\tonChange: function ( callback ) {\r\n\r\n\t\tthis.onChangeCallback = callback;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tonChangeCallback: function () {},\r\n\r\n\tclone: function () {\r\n\r\n\t\treturn new THREE.Quaternion( this._x, this._y, this._z, this._w );\r\n\r\n\t}\r\n\r\n};\r\n\r\nTHREE.Quaternion.slerp = function ( qa, qb, qm, t ) {\r\n\r\n\treturn qm.copy( qa ).slerp( qb, t );\r\n\r\n}\r\n\r\n// File:src/math/Vector2.js\r\n\r\n/**\r\n * @author mrdoob / http://mrdoob.com/\r\n * @author philogb / http://blog.thejit.org/\r\n * @author egraether / http://egraether.com/\r\n * @author zz85 / http://www.lab4games.net/zz85/blog\r\n */\r\n\r\nTHREE.Vector2 = function ( x, y ) {\r\n\r\n\tthis.x = x || 0;\r\n\tthis.y = y || 0;\r\n\r\n};\r\n\r\nTHREE.Vector2.prototype = {\r\n\r\n\tconstructor: THREE.Vector2,\r\n\r\n\tset: function ( x, y ) {\r\n\r\n\t\tthis.x = x;\r\n\t\tthis.y = y;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tsetX: function ( x ) {\r\n\r\n\t\tthis.x = x;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tsetY: function ( y ) {\r\n\r\n\t\tthis.y = y;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tsetComponent: function ( index, value ) {\r\n\r\n\t\tswitch ( index ) {\r\n\r\n\t\t\tcase 0: this.x = value; break;\r\n\t\t\tcase 1: this.y = value; break;\r\n\t\t\tdefault: throw new Error( 'index is out of range: ' + index );\r\n\r\n\t\t}\r\n\r\n\t},\r\n\r\n\tgetComponent: function ( index ) {\r\n\r\n\t\tswitch ( index ) {\r\n\r\n\t\t\tcase 0: return this.x;\r\n\t\t\tcase 1: return this.y;\r\n\t\t\tdefault: throw new Error( 'index is out of range: ' + index );\r\n\r\n\t\t}\r\n\r\n\t},\r\n\r\n\tcopy: function ( v ) {\r\n\r\n\t\tthis.x = v.x;\r\n\t\tthis.y = v.y;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tadd: function ( v, w ) {\r\n\r\n\t\tif ( w !== undefined ) {\r\n\r\n\t\t\tTHREE.warn( 'THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead.' );\r\n\t\t\treturn this.addVectors( v, w );\r\n\r\n\t\t}\r\n\r\n\t\tthis.x += v.x;\r\n\t\tthis.y += v.y;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\taddScalar: function ( s ) {\r\n\r\n\t\tthis.x += s;\r\n\t\tthis.y += s;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\taddVectors: function ( a, b ) {\r\n\r\n\t\tthis.x = a.x + b.x;\r\n\t\tthis.y = a.y + b.y;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tsub: function ( v, w ) {\r\n\r\n\t\tif ( w !== undefined ) {\r\n\r\n\t\t\tTHREE.warn( 'THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead.' );\r\n\t\t\treturn this.subVectors( v, w );\r\n\r\n\t\t}\r\n\r\n\t\tthis.x -= v.x;\r\n\t\tthis.y -= v.y;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tsubScalar: function ( s ) {\r\n\r\n\t\tthis.x -= s;\r\n\t\tthis.y -= s;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tsubVectors: function ( a, b ) {\r\n\r\n\t\tthis.x = a.x - b.x;\r\n\t\tthis.y = a.y - b.y;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tmultiply: function ( v ) {\r\n\r\n\t\tthis.x *= v.x;\r\n\t\tthis.y *= v.y;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tmultiplyScalar: function ( s ) {\r\n\r\n\t\tthis.x *= s;\r\n\t\tthis.y *= s;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tdivide: function ( v ) {\r\n\r\n\t\tthis.x /= v.x;\r\n\t\tthis.y /= v.y;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tdivideScalar: function ( scalar ) {\r\n\r\n\t\tif ( scalar !== 0 ) {\r\n\r\n\t\t\tvar invScalar = 1 / scalar;\r\n\r\n\t\t\tthis.x *= invScalar;\r\n\t\t\tthis.y *= invScalar;\r\n\r\n\t\t} else {\r\n\r\n\t\t\tthis.x = 0;\r\n\t\t\tthis.y = 0;\r\n\r\n\t\t}\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tmin: function ( v ) {\r\n\r\n\t\tif ( this.x > v.x ) {\r\n\r\n\t\t\tthis.x = v.x;\r\n\r\n\t\t}\r\n\r\n\t\tif ( this.y > v.y ) {\r\n\r\n\t\t\tthis.y = v.y;\r\n\r\n\t\t}\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tmax: function ( v ) {\r\n\r\n\t\tif ( this.x < v.x ) {\r\n\r\n\t\t\tthis.x = v.x;\r\n\r\n\t\t}\r\n\r\n\t\tif ( this.y < v.y ) {\r\n\r\n\t\t\tthis.y = v.y;\r\n\r\n\t\t}\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tclamp: function ( min, max ) {\r\n\r\n\t\t// This function assumes min < max, if this assumption isn't true it will not operate correctly\r\n\r\n\t\tif ( this.x < min.x ) {\r\n\r\n\t\t\tthis.x = min.x;\r\n\r\n\t\t} else if ( this.x > max.x ) {\r\n\r\n\t\t\tthis.x = max.x;\r\n\r\n\t\t}\r\n\r\n\t\tif ( this.y < min.y ) {\r\n\r\n\t\t\tthis.y = min.y;\r\n\r\n\t\t} else if ( this.y > max.y ) {\r\n\r\n\t\t\tthis.y = max.y;\r\n\r\n\t\t}\r\n\r\n\t\treturn this;\r\n\t},\r\n\r\n\tclampScalar: ( function () {\r\n\r\n\t\tvar min, max;\r\n\r\n\t\treturn function ( minVal, maxVal ) {\r\n\r\n\t\t\tif ( min === undefined ) {\r\n\r\n\t\t\t\tmin = new THREE.Vector2();\r\n\t\t\t\tmax = new THREE.Vector2();\r\n\r\n\t\t\t}\r\n\r\n\t\t\tmin.set( minVal, minVal );\r\n\t\t\tmax.set( maxVal, maxVal );\r\n\r\n\t\t\treturn this.clamp( min, max );\r\n\r\n\t\t};\r\n\r\n\t} )(),\r\n\r\n\tfloor: function () {\r\n\r\n\t\tthis.x = Math.floor( this.x );\r\n\t\tthis.y = Math.floor( this.y );\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tceil: function () {\r\n\r\n\t\tthis.x = Math.ceil( this.x );\r\n\t\tthis.y = Math.ceil( this.y );\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tround: function () {\r\n\r\n\t\tthis.x = Math.round( this.x );\r\n\t\tthis.y = Math.round( this.y );\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\troundToZero: function () {\r\n\r\n\t\tthis.x = ( this.x < 0 ) ? Math.ceil( this.x ) : Math.floor( this.x );\r\n\t\tthis.y = ( this.y < 0 ) ? Math.ceil( this.y ) : Math.floor( this.y );\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tnegate: function () {\r\n\r\n\t\tthis.x = - this.x;\r\n\t\tthis.y = - this.y;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tdot: function ( v ) {\r\n\r\n\t\treturn this.x * v.x + this.y * v.y;\r\n\r\n\t},\r\n\r\n\tlengthSq: function () {\r\n\r\n\t\treturn this.x * this.x + this.y * this.y;\r\n\r\n\t},\r\n\r\n\tlength: function () {\r\n\r\n\t\treturn Math.sqrt( this.x * this.x + this.y * this.y );\r\n\r\n\t},\r\n\r\n\tnormalize: function () {\r\n\r\n\t\treturn this.divideScalar( this.length() );\r\n\r\n\t},\r\n\r\n\tdistanceTo: function ( v ) {\r\n\r\n\t\treturn Math.sqrt( this.distanceToSquared( v ) );\r\n\r\n\t},\r\n\r\n\tdistanceToSquared: function ( v ) {\r\n\r\n\t\tvar dx = this.x - v.x, dy = this.y - v.y;\r\n\t\treturn dx * dx + dy * dy;\r\n\r\n\t},\r\n\r\n\tsetLength: function ( l ) {\r\n\r\n\t\tvar oldLength = this.length();\r\n\r\n\t\tif ( oldLength !== 0 && l !== oldLength ) {\r\n\r\n\t\t\tthis.multiplyScalar( l / oldLength );\r\n\t\t}\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tlerp: function ( v, alpha ) {\r\n\r\n\t\tthis.x += ( v.x - this.x ) * alpha;\r\n\t\tthis.y += ( v.y - this.y ) * alpha;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tlerpVectors: function ( v1, v2, alpha ) {\r\n\r\n\t\tthis.subVectors( v2, v1 ).multiplyScalar( alpha ).add( v1 );\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tequals: function ( v ) {\r\n\r\n\t\treturn ( ( v.x === this.x ) && ( v.y === this.y ) );\r\n\r\n\t},\r\n\r\n\tfromArray: function ( array, offset ) {\r\n\r\n\t\tif ( offset === undefined ) offset = 0;\r\n\r\n\t\tthis.x = array[ offset ];\r\n\t\tthis.y = array[ offset + 1 ];\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\ttoArray: function ( array, offset ) {\r\n\r\n\t\tif ( array === undefined ) array = [];\r\n\t\tif ( offset === undefined ) offset = 0;\r\n\r\n\t\tarray[ offset ] = this.x;\r\n\t\tarray[ offset + 1 ] = this.y;\r\n\r\n\t\treturn array;\r\n\r\n\t},\r\n\r\n\tfromAttribute: function ( attribute, index, offset ) {\r\n\r\n\t\tif ( offset === undefined ) offset = 0;\r\n\r\n\t\tindex = index * attribute.itemSize + offset;\r\n\r\n\t\tthis.x = attribute.array[ index ];\r\n\t\tthis.y = attribute.array[ index + 1 ];\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tclone: function () {\r\n\r\n\t\treturn new THREE.Vector2( this.x, this.y );\r\n\r\n\t}\r\n\r\n};\r\n\r\n// File:src/math/Vector3.js\r\n\r\n/**\r\n * @author mrdoob / http://mrdoob.com/\r\n * @author *kile / http://kile.stravaganza.org/\r\n * @author philogb / http://blog.thejit.org/\r\n * @author mikael emtinger / http://gomo.se/\r\n * @author egraether / http://egraether.com/\r\n * @author WestLangley / http://github.com/WestLangley\r\n */\r\n\r\nTHREE.Vector3 = function ( x, y, z ) {\r\n\r\n\tthis.x = x || 0;\r\n\tthis.y = y || 0;\r\n\tthis.z = z || 0;\r\n\r\n};\r\n\r\nTHREE.Vector3.prototype = {\r\n\r\n\tconstructor: THREE.Vector3,\r\n\r\n\tset: function ( x, y, z ) {\r\n\r\n\t\tthis.x = x;\r\n\t\tthis.y = y;\r\n\t\tthis.z = z;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tsetX: function ( x ) {\r\n\r\n\t\tthis.x = x;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tsetY: function ( y ) {\r\n\r\n\t\tthis.y = y;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tsetZ: function ( z ) {\r\n\r\n\t\tthis.z = z;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tsetComponent: function ( index, value ) {\r\n\r\n\t\tswitch ( index ) {\r\n\r\n\t\t\tcase 0: this.x = value; break;\r\n\t\t\tcase 1: this.y = value; break;\r\n\t\t\tcase 2: this.z = value; break;\r\n\t\t\tdefault: throw new Error( 'index is out of range: ' + index );\r\n\r\n\t\t}\r\n\r\n\t},\r\n\r\n\tgetComponent: function ( index ) {\r\n\r\n\t\tswitch ( index ) {\r\n\r\n\t\t\tcase 0: return this.x;\r\n\t\t\tcase 1: return this.y;\r\n\t\t\tcase 2: return this.z;\r\n\t\t\tdefault: throw new Error( 'index is out of range: ' + index );\r\n\r\n\t\t}\r\n\r\n\t},\r\n\r\n\tcopy: function ( v ) {\r\n\r\n\t\tthis.x = v.x;\r\n\t\tthis.y = v.y;\r\n\t\tthis.z = v.z;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tadd: function ( v, w ) {\r\n\r\n\t\tif ( w !== undefined ) {\r\n\r\n\t\t\tTHREE.warn( 'THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead.' );\r\n\t\t\treturn this.addVectors( v, w );\r\n\r\n\t\t}\r\n\r\n\t\tthis.x += v.x;\r\n\t\tthis.y += v.y;\r\n\t\tthis.z += v.z;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\taddScalar: function ( s ) {\r\n\r\n\t\tthis.x += s;\r\n\t\tthis.y += s;\r\n\t\tthis.z += s;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\taddVectors: function ( a, b ) {\r\n\r\n\t\tthis.x = a.x + b.x;\r\n\t\tthis.y = a.y + b.y;\r\n\t\tthis.z = a.z + b.z;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tsub: function ( v, w ) {\r\n\r\n\t\tif ( w !== undefined ) {\r\n\r\n\t\t\tTHREE.warn( 'THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead.' );\r\n\t\t\treturn this.subVectors( v, w );\r\n\r\n\t\t}\r\n\r\n\t\tthis.x -= v.x;\r\n\t\tthis.y -= v.y;\r\n\t\tthis.z -= v.z;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\t\r\n\tsubScalar: function ( s ) {\r\n\r\n\t\tthis.x -= s;\r\n\t\tthis.y -= s;\r\n\t\tthis.z -= s;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tsubVectors: function ( a, b ) {\r\n\r\n\t\tthis.x = a.x - b.x;\r\n\t\tthis.y = a.y - b.y;\r\n\t\tthis.z = a.z - b.z;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tmultiply: function ( v, w ) {\r\n\r\n\t\tif ( w !== undefined ) {\r\n\r\n\t\t\tTHREE.warn( 'THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead.' );\r\n\t\t\treturn this.multiplyVectors( v, w );\r\n\r\n\t\t}\r\n\r\n\t\tthis.x *= v.x;\r\n\t\tthis.y *= v.y;\r\n\t\tthis.z *= v.z;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tmultiplyScalar: function ( scalar ) {\r\n\r\n\t\tthis.x *= scalar;\r\n\t\tthis.y *= scalar;\r\n\t\tthis.z *= scalar;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tmultiplyVectors: function ( a, b ) {\r\n\r\n\t\tthis.x = a.x * b.x;\r\n\t\tthis.y = a.y * b.y;\r\n\t\tthis.z = a.z * b.z;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tapplyEuler: function () {\r\n\r\n\t\tvar quaternion;\r\n\r\n\t\treturn function ( euler ) {\r\n\r\n\t\t\tif ( euler instanceof THREE.Euler === false ) {\r\n\r\n\t\t\t\tTHREE.error( 'THREE.Vector3: .applyEuler() now expects a Euler rotation rather than a Vector3 and order.' );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( quaternion === undefined ) quaternion = new THREE.Quaternion();\r\n\r\n\t\t\tthis.applyQuaternion( quaternion.setFromEuler( euler ) );\r\n\r\n\t\t\treturn this;\r\n\r\n\t\t};\r\n\r\n\t}(),\r\n\r\n\tapplyAxisAngle: function () {\r\n\r\n\t\tvar quaternion;\r\n\r\n\t\treturn function ( axis, angle ) {\r\n\r\n\t\t\tif ( quaternion === undefined ) quaternion = new THREE.Quaternion();\r\n\r\n\t\t\tthis.applyQuaternion( quaternion.setFromAxisAngle( axis, angle ) );\r\n\r\n\t\t\treturn this;\r\n\r\n\t\t};\r\n\r\n\t}(),\r\n\r\n\tapplyMatrix3: function ( m ) {\r\n\r\n\t\tvar x = this.x;\r\n\t\tvar y = this.y;\r\n\t\tvar z = this.z;\r\n\r\n\t\tvar e = m.elements;\r\n\r\n\t\tthis.x = e[ 0 ] * x + e[ 3 ] * y + e[ 6 ] * z;\r\n\t\tthis.y = e[ 1 ] * x + e[ 4 ] * y + e[ 7 ] * z;\r\n\t\tthis.z = e[ 2 ] * x + e[ 5 ] * y + e[ 8 ] * z;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tapplyMatrix4: function ( m ) {\r\n\r\n\t\t// input: THREE.Matrix4 affine matrix\r\n\r\n\t\tvar x = this.x, y = this.y, z = this.z;\r\n\r\n\t\tvar e = m.elements;\r\n\r\n\t\tthis.x = e[ 0 ] * x + e[ 4 ] * y + e[ 8 ] * z + e[ 12 ];\r\n\t\tthis.y = e[ 1 ] * x + e[ 5 ] * y + e[ 9 ] * z + e[ 13 ];\r\n\t\tthis.z = e[ 2 ] * x + e[ 6 ] * y + e[ 10 ] * z + e[ 14 ];\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tapplyProjection: function ( m ) {\r\n\r\n\t\t// input: THREE.Matrix4 projection matrix\r\n\r\n\t\tvar x = this.x, y = this.y, z = this.z;\r\n\r\n\t\tvar e = m.elements;\r\n\t\tvar d = 1 / ( e[ 3 ] * x + e[ 7 ] * y + e[ 11 ] * z + e[ 15 ] ); // perspective divide\r\n\r\n\t\tthis.x = ( e[ 0 ] * x + e[ 4 ] * y + e[ 8 ] * z + e[ 12 ] ) * d;\r\n\t\tthis.y = ( e[ 1 ] * x + e[ 5 ] * y + e[ 9 ] * z + e[ 13 ] ) * d;\r\n\t\tthis.z = ( e[ 2 ] * x + e[ 6 ] * y + e[ 10 ] * z + e[ 14 ] ) * d;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tapplyQuaternion: function ( q ) {\r\n\r\n\t\tvar x = this.x;\r\n\t\tvar y = this.y;\r\n\t\tvar z = this.z;\r\n\r\n\t\tvar qx = q.x;\r\n\t\tvar qy = q.y;\r\n\t\tvar qz = q.z;\r\n\t\tvar qw = q.w;\r\n\r\n\t\t// calculate quat * vector\r\n\r\n\t\tvar ix = qw * x + qy * z - qz * y;\r\n\t\tvar iy = qw * y + qz * x - qx * z;\r\n\t\tvar iz = qw * z + qx * y - qy * x;\r\n\t\tvar iw = - qx * x - qy * y - qz * z;\r\n\r\n\t\t// calculate result * inverse quat\r\n\r\n\t\tthis.x = ix * qw + iw * - qx + iy * - qz - iz * - qy;\r\n\t\tthis.y = iy * qw + iw * - qy + iz * - qx - ix * - qz;\r\n\t\tthis.z = iz * qw + iw * - qz + ix * - qy - iy * - qx;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tproject: function () {\r\n\r\n\t\tvar matrix;\r\n\r\n\t\treturn function ( camera ) {\r\n\r\n\t\t\tif ( matrix === undefined ) matrix = new THREE.Matrix4();\r\n\r\n\t\t\tmatrix.multiplyMatrices( camera.projectionMatrix, matrix.getInverse( camera.matrixWorld ) );\r\n\t\t\treturn this.applyProjection( matrix );\r\n\r\n\t\t};\r\n\r\n\t}(),\r\n\r\n\tunproject: function () {\r\n\r\n\t\tvar matrix;\r\n\r\n\t\treturn function ( camera ) {\r\n\r\n\t\t\tif ( matrix === undefined ) matrix = new THREE.Matrix4();\r\n\r\n\t\t\tmatrix.multiplyMatrices( camera.matrixWorld, matrix.getInverse( camera.projectionMatrix ) );\r\n\t\t\treturn this.applyProjection( matrix );\r\n\r\n\t\t};\r\n\r\n\t}(),\r\n\r\n\ttransformDirection: function ( m ) {\r\n\r\n\t\t// input: THREE.Matrix4 affine matrix\r\n\t\t// vector interpreted as a direction\r\n\r\n\t\tvar x = this.x, y = this.y, z = this.z;\r\n\r\n\t\tvar e = m.elements;\r\n\r\n\t\tthis.x = e[ 0 ] * x + e[ 4 ] * y + e[ 8 ] * z;\r\n\t\tthis.y = e[ 1 ] * x + e[ 5 ] * y + e[ 9 ] * z;\r\n\t\tthis.z = e[ 2 ] * x + e[ 6 ] * y + e[ 10 ] * z;\r\n\r\n\t\tthis.normalize();\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tdivide: function ( v ) {\r\n\r\n\t\tthis.x /= v.x;\r\n\t\tthis.y /= v.y;\r\n\t\tthis.z /= v.z;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tdivideScalar: function ( scalar ) {\r\n\r\n\t\tif ( scalar !== 0 ) {\r\n\r\n\t\t\tvar invScalar = 1 / scalar;\r\n\r\n\t\t\tthis.x *= invScalar;\r\n\t\t\tthis.y *= invScalar;\r\n\t\t\tthis.z *= invScalar;\r\n\r\n\t\t} else {\r\n\r\n\t\t\tthis.x = 0;\r\n\t\t\tthis.y = 0;\r\n\t\t\tthis.z = 0;\r\n\r\n\t\t}\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tmin: function ( v ) {\r\n\r\n\t\tif ( this.x > v.x ) {\r\n\r\n\t\t\tthis.x = v.x;\r\n\r\n\t\t}\r\n\r\n\t\tif ( this.y > v.y ) {\r\n\r\n\t\t\tthis.y = v.y;\r\n\r\n\t\t}\r\n\r\n\t\tif ( this.z > v.z ) {\r\n\r\n\t\t\tthis.z = v.z;\r\n\r\n\t\t}\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tmax: function ( v ) {\r\n\r\n\t\tif ( this.x < v.x ) {\r\n\r\n\t\t\tthis.x = v.x;\r\n\r\n\t\t}\r\n\r\n\t\tif ( this.y < v.y ) {\r\n\r\n\t\t\tthis.y = v.y;\r\n\r\n\t\t}\r\n\r\n\t\tif ( this.z < v.z ) {\r\n\r\n\t\t\tthis.z = v.z;\r\n\r\n\t\t}\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tclamp: function ( min, max ) {\r\n\r\n\t\t// This function assumes min < max, if this assumption isn't true it will not operate correctly\r\n\r\n\t\tif ( this.x < min.x ) {\r\n\r\n\t\t\tthis.x = min.x;\r\n\r\n\t\t} else if ( this.x > max.x ) {\r\n\r\n\t\t\tthis.x = max.x;\r\n\r\n\t\t}\r\n\r\n\t\tif ( this.y < min.y ) {\r\n\r\n\t\t\tthis.y = min.y;\r\n\r\n\t\t} else if ( this.y > max.y ) {\r\n\r\n\t\t\tthis.y = max.y;\r\n\r\n\t\t}\r\n\r\n\t\tif ( this.z < min.z ) {\r\n\r\n\t\t\tthis.z = min.z;\r\n\r\n\t\t} else if ( this.z > max.z ) {\r\n\r\n\t\t\tthis.z = max.z;\r\n\r\n\t\t}\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tclampScalar: ( function () {\r\n\r\n\t\tvar min, max;\r\n\r\n\t\treturn function ( minVal, maxVal ) {\r\n\r\n\t\t\tif ( min === undefined ) {\r\n\r\n\t\t\t\tmin = new THREE.Vector3();\r\n\t\t\t\tmax = new THREE.Vector3();\r\n\r\n\t\t\t}\r\n\r\n\t\t\tmin.set( minVal, minVal, minVal );\r\n\t\t\tmax.set( maxVal, maxVal, maxVal );\r\n\r\n\t\t\treturn this.clamp( min, max );\r\n\r\n\t\t};\r\n\r\n\t} )(),\r\n\r\n\tfloor: function () {\r\n\r\n\t\tthis.x = Math.floor( this.x );\r\n\t\tthis.y = Math.floor( this.y );\r\n\t\tthis.z = Math.floor( this.z );\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tceil: function () {\r\n\r\n\t\tthis.x = Math.ceil( this.x );\r\n\t\tthis.y = Math.ceil( this.y );\r\n\t\tthis.z = Math.ceil( this.z );\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tround: function () {\r\n\r\n\t\tthis.x = Math.round( this.x );\r\n\t\tthis.y = Math.round( this.y );\r\n\t\tthis.z = Math.round( this.z );\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\troundToZero: function () {\r\n\r\n\t\tthis.x = ( this.x < 0 ) ? Math.ceil( this.x ) : Math.floor( this.x );\r\n\t\tthis.y = ( this.y < 0 ) ? Math.ceil( this.y ) : Math.floor( this.y );\r\n\t\tthis.z = ( this.z < 0 ) ? Math.ceil( this.z ) : Math.floor( this.z );\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tnegate: function () {\r\n\r\n\t\tthis.x = - this.x;\r\n\t\tthis.y = - this.y;\r\n\t\tthis.z = - this.z;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tdot: function ( v ) {\r\n\r\n\t\treturn this.x * v.x + this.y * v.y + this.z * v.z;\r\n\r\n\t},\r\n\r\n\tlengthSq: function () {\r\n\r\n\t\treturn this.x * this.x + this.y * this.y + this.z * this.z;\r\n\r\n\t},\r\n\r\n\tlength: function () {\r\n\r\n\t\treturn Math.sqrt( this.x * this.x + this.y * this.y + this.z * this.z );\r\n\r\n\t},\r\n\r\n\tlengthManhattan: function () {\r\n\r\n\t\treturn Math.abs( this.x ) + Math.abs( this.y ) + Math.abs( this.z );\r\n\r\n\t},\r\n\r\n\tnormalize: function () {\r\n\r\n\t\treturn this.divideScalar( this.length() );\r\n\r\n\t},\r\n\r\n\tsetLength: function ( l ) {\r\n\r\n\t\tvar oldLength = this.length();\r\n\r\n\t\tif ( oldLength !== 0 && l !== oldLength ) {\r\n\r\n\t\t\tthis.multiplyScalar( l / oldLength );\r\n\t\t}\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tlerp: function ( v, alpha ) {\r\n\r\n\t\tthis.x += ( v.x - this.x ) * alpha;\r\n\t\tthis.y += ( v.y - this.y ) * alpha;\r\n\t\tthis.z += ( v.z - this.z ) * alpha;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tlerpVectors: function ( v1, v2, alpha ) {\r\n\r\n\t\tthis.subVectors( v2, v1 ).multiplyScalar( alpha ).add( v1 );\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tcross: function ( v, w ) {\r\n\r\n\t\tif ( w !== undefined ) {\r\n\r\n\t\t\tTHREE.warn( 'THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead.' );\r\n\t\t\treturn this.crossVectors( v, w );\r\n\r\n\t\t}\r\n\r\n\t\tvar x = this.x, y = this.y, z = this.z;\r\n\r\n\t\tthis.x = y * v.z - z * v.y;\r\n\t\tthis.y = z * v.x - x * v.z;\r\n\t\tthis.z = x * v.y - y * v.x;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tcrossVectors: function ( a, b ) {\r\n\r\n\t\tvar ax = a.x, ay = a.y, az = a.z;\r\n\t\tvar bx = b.x, by = b.y, bz = b.z;\r\n\r\n\t\tthis.x = ay * bz - az * by;\r\n\t\tthis.y = az * bx - ax * bz;\r\n\t\tthis.z = ax * by - ay * bx;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tprojectOnVector: function () {\r\n\r\n\t\tvar v1, dot;\r\n\r\n\t\treturn function ( vector ) {\r\n\r\n\t\t\tif ( v1 === undefined ) v1 = new THREE.Vector3();\r\n\r\n\t\t\tv1.copy( vector ).normalize();\r\n\r\n\t\t\tdot = this.dot( v1 );\r\n\r\n\t\t\treturn this.copy( v1 ).multiplyScalar( dot );\r\n\r\n\t\t};\r\n\r\n\t}(),\r\n\r\n\tprojectOnPlane: function () {\r\n\r\n\t\tvar v1;\r\n\r\n\t\treturn function ( planeNormal ) {\r\n\r\n\t\t\tif ( v1 === undefined ) v1 = new THREE.Vector3();\r\n\r\n\t\t\tv1.copy( this ).projectOnVector( planeNormal );\r\n\r\n\t\t\treturn this.sub( v1 );\r\n\r\n\t\t}\r\n\r\n\t}(),\r\n\r\n\treflect: function () {\r\n\r\n\t\t// reflect incident vector off plane orthogonal to normal\r\n\t\t// normal is assumed to have unit length\r\n\r\n\t\tvar v1;\r\n\r\n\t\treturn function ( normal ) {\r\n\r\n\t\t\tif ( v1 === undefined ) v1 = new THREE.Vector3();\r\n\r\n\t\t\treturn this.sub( v1.copy( normal ).multiplyScalar( 2 * this.dot( normal ) ) );\r\n\r\n\t\t}\r\n\r\n\t}(),\r\n\r\n\tangleTo: function ( v ) {\r\n\r\n\t\tvar theta = this.dot( v ) / ( this.length() * v.length() );\r\n\r\n\t\t// clamp, to handle numerical problems\r\n\r\n\t\treturn Math.acos( THREE.Math.clamp( theta, - 1, 1 ) );\r\n\r\n\t},\r\n\r\n\tdistanceTo: function ( v ) {\r\n\r\n\t\treturn Math.sqrt( this.distanceToSquared( v ) );\r\n\r\n\t},\r\n\r\n\tdistanceToSquared: function ( v ) {\r\n\r\n\t\tvar dx = this.x - v.x;\r\n\t\tvar dy = this.y - v.y;\r\n\t\tvar dz = this.z - v.z;\r\n\r\n\t\treturn dx * dx + dy * dy + dz * dz;\r\n\r\n\t},\r\n\r\n\tsetEulerFromRotationMatrix: function ( m, order ) {\r\n\r\n\t\tTHREE.error( 'THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.' );\r\n\r\n\t},\r\n\r\n\tsetEulerFromQuaternion: function ( q, order ) {\r\n\r\n\t\tTHREE.error( 'THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.' );\r\n\r\n\t},\r\n\r\n\tgetPositionFromMatrix: function ( m ) {\r\n\r\n\t\tTHREE.warn( 'THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition().' );\r\n\r\n\t\treturn this.setFromMatrixPosition( m );\r\n\r\n\t},\r\n\r\n\tgetScaleFromMatrix: function ( m ) {\r\n\r\n\t\tTHREE.warn( 'THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale().' );\r\n\r\n\t\treturn this.setFromMatrixScale( m );\r\n\t},\r\n\r\n\tgetColumnFromMatrix: function ( index, matrix ) {\r\n\r\n\t\tTHREE.warn( 'THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn().' );\r\n\r\n\t\treturn this.setFromMatrixColumn( index, matrix );\r\n\r\n\t},\r\n\r\n\tsetFromMatrixPosition: function ( m ) {\r\n\r\n\t\tthis.x = m.elements[ 12 ];\r\n\t\tthis.y = m.elements[ 13 ];\r\n\t\tthis.z = m.elements[ 14 ];\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tsetFromMatrixScale: function ( m ) {\r\n\r\n\t\tvar sx = this.set( m.elements[ 0 ], m.elements[ 1 ], m.elements[ 2 ] ).length();\r\n\t\tvar sy = this.set( m.elements[ 4 ], m.elements[ 5 ], m.elements[ 6 ] ).length();\r\n\t\tvar sz = this.set( m.elements[ 8 ], m.elements[ 9 ], m.elements[ 10 ] ).length();\r\n\r\n\t\tthis.x = sx;\r\n\t\tthis.y = sy;\r\n\t\tthis.z = sz;\r\n\r\n\t\treturn this;\r\n\t},\r\n\r\n\tsetFromMatrixColumn: function ( index, matrix ) {\r\n\t\t\r\n\t\tvar offset = index * 4;\r\n\r\n\t\tvar me = matrix.elements;\r\n\r\n\t\tthis.x = me[ offset ];\r\n\t\tthis.y = me[ offset + 1 ];\r\n\t\tthis.z = me[ offset + 2 ];\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tequals: function ( v ) {\r\n\r\n\t\treturn ( ( v.x === this.x ) && ( v.y === this.y ) && ( v.z === this.z ) );\r\n\r\n\t},\r\n\r\n\tfromArray: function ( array, offset ) {\r\n\r\n\t\tif ( offset === undefined ) offset = 0;\r\n\r\n\t\tthis.x = array[ offset ];\r\n\t\tthis.y = array[ offset + 1 ];\r\n\t\tthis.z = array[ offset + 2 ];\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\ttoArray: function ( array, offset ) {\r\n\r\n\t\tif ( array === undefined ) array = [];\r\n\t\tif ( offset === undefined ) offset = 0;\r\n\r\n\t\tarray[ offset ] = this.x;\r\n\t\tarray[ offset + 1 ] = this.y;\r\n\t\tarray[ offset + 2 ] = this.z;\r\n\r\n\t\treturn array;\r\n\r\n\t},\r\n\r\n\tfromAttribute: function ( attribute, index, offset ) {\r\n\r\n\t\tif ( offset === undefined ) offset = 0;\r\n\r\n\t\tindex = index * attribute.itemSize + offset;\r\n\r\n\t\tthis.x = attribute.array[ index ];\r\n\t\tthis.y = attribute.array[ index + 1 ];\r\n\t\tthis.z = attribute.array[ index + 2 ];\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tclone: function () {\r\n\r\n\t\treturn new THREE.Vector3( this.x, this.y, this.z );\r\n\r\n\t}\r\n\r\n};\r\n\r\n// File:src/math/Vector4.js\r\n\r\n/**\r\n * @author supereggbert / http://www.paulbrunt.co.uk/\r\n * @author philogb / http://blog.thejit.org/\r\n * @author mikael emtinger / http://gomo.se/\r\n * @author egraether / http://egraether.com/\r\n * @author WestLangley / http://github.com/WestLangley\r\n */\r\n\r\nTHREE.Vector4 = function ( x, y, z, w ) {\r\n\r\n\tthis.x = x || 0;\r\n\tthis.y = y || 0;\r\n\tthis.z = z || 0;\r\n\tthis.w = ( w !== undefined ) ? w : 1;\r\n\r\n};\r\n\r\nTHREE.Vector4.prototype = {\r\n\r\n\tconstructor: THREE.Vector4,\r\n\r\n\tset: function ( x, y, z, w ) {\r\n\r\n\t\tthis.x = x;\r\n\t\tthis.y = y;\r\n\t\tthis.z = z;\r\n\t\tthis.w = w;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tsetX: function ( x ) {\r\n\r\n\t\tthis.x = x;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tsetY: function ( y ) {\r\n\r\n\t\tthis.y = y;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tsetZ: function ( z ) {\r\n\r\n\t\tthis.z = z;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tsetW: function ( w ) {\r\n\r\n\t\tthis.w = w;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tsetComponent: function ( index, value ) {\r\n\r\n\t\tswitch ( index ) {\r\n\r\n\t\t\tcase 0: this.x = value; break;\r\n\t\t\tcase 1: this.y = value; break;\r\n\t\t\tcase 2: this.z = value; break;\r\n\t\t\tcase 3: this.w = value; break;\r\n\t\t\tdefault: throw new Error( 'index is out of range: ' + index );\r\n\r\n\t\t}\r\n\r\n\t},\r\n\r\n\tgetComponent: function ( index ) {\r\n\r\n\t\tswitch ( index ) {\r\n\r\n\t\t\tcase 0: return this.x;\r\n\t\t\tcase 1: return this.y;\r\n\t\t\tcase 2: return this.z;\r\n\t\t\tcase 3: return this.w;\r\n\t\t\tdefault: throw new Error( 'index is out of range: ' + index );\r\n\r\n\t\t}\r\n\r\n\t},\r\n\r\n\tcopy: function ( v ) {\r\n\r\n\t\tthis.x = v.x;\r\n\t\tthis.y = v.y;\r\n\t\tthis.z = v.z;\r\n\t\tthis.w = ( v.w !== undefined ) ? v.w : 1;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tadd: function ( v, w ) {\r\n\r\n\t\tif ( w !== undefined ) {\r\n\r\n\t\t\tTHREE.warn( 'THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead.' );\r\n\t\t\treturn this.addVectors( v, w );\r\n\r\n\t\t}\r\n\r\n\t\tthis.x += v.x;\r\n\t\tthis.y += v.y;\r\n\t\tthis.z += v.z;\r\n\t\tthis.w += v.w;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\taddScalar: function ( s ) {\r\n\r\n\t\tthis.x += s;\r\n\t\tthis.y += s;\r\n\t\tthis.z += s;\r\n\t\tthis.w += s;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\taddVectors: function ( a, b ) {\r\n\r\n\t\tthis.x = a.x + b.x;\r\n\t\tthis.y = a.y + b.y;\r\n\t\tthis.z = a.z + b.z;\r\n\t\tthis.w = a.w + b.w;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tsub: function ( v, w ) {\r\n\r\n\t\tif ( w !== undefined ) {\r\n\r\n\t\t\tTHREE.warn( 'THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead.' );\r\n\t\t\treturn this.subVectors( v, w );\r\n\r\n\t\t}\r\n\r\n\t\tthis.x -= v.x;\r\n\t\tthis.y -= v.y;\r\n\t\tthis.z -= v.z;\r\n\t\tthis.w -= v.w;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tsubScalar: function ( s ) {\r\n\r\n\t\tthis.x -= s;\r\n\t\tthis.y -= s;\r\n\t\tthis.z -= s;\r\n\t\tthis.w -= s;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tsubVectors: function ( a, b ) {\r\n\r\n\t\tthis.x = a.x - b.x;\r\n\t\tthis.y = a.y - b.y;\r\n\t\tthis.z = a.z - b.z;\r\n\t\tthis.w = a.w - b.w;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tmultiplyScalar: function ( scalar ) {\r\n\r\n\t\tthis.x *= scalar;\r\n\t\tthis.y *= scalar;\r\n\t\tthis.z *= scalar;\r\n\t\tthis.w *= scalar;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tapplyMatrix4: function ( m ) {\r\n\r\n\t\tvar x = this.x;\r\n\t\tvar y = this.y;\r\n\t\tvar z = this.z;\r\n\t\tvar w = this.w;\r\n\r\n\t\tvar e = m.elements;\r\n\r\n\t\tthis.x = e[ 0 ] * x + e[ 4 ] * y + e[ 8 ] * z + e[ 12 ] * w;\r\n\t\tthis.y = e[ 1 ] * x + e[ 5 ] * y + e[ 9 ] * z + e[ 13 ] * w;\r\n\t\tthis.z = e[ 2 ] * x + e[ 6 ] * y + e[ 10 ] * z + e[ 14 ] * w;\r\n\t\tthis.w = e[ 3 ] * x + e[ 7 ] * y + e[ 11 ] * z + e[ 15 ] * w;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tdivideScalar: function ( scalar ) {\r\n\r\n\t\tif ( scalar !== 0 ) {\r\n\r\n\t\t\tvar invScalar = 1 / scalar;\r\n\r\n\t\t\tthis.x *= invScalar;\r\n\t\t\tthis.y *= invScalar;\r\n\t\t\tthis.z *= invScalar;\r\n\t\t\tthis.w *= invScalar;\r\n\r\n\t\t} else {\r\n\r\n\t\t\tthis.x = 0;\r\n\t\t\tthis.y = 0;\r\n\t\t\tthis.z = 0;\r\n\t\t\tthis.w = 1;\r\n\r\n\t\t}\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tsetAxisAngleFromQuaternion: function ( q ) {\r\n\r\n\t\t// http://www.euclideanspace.com/maths/geometry/rotations/conversions/quaternionToAngle/index.htm\r\n\r\n\t\t// q is assumed to be normalized\r\n\r\n\t\tthis.w = 2 * Math.acos( q.w );\r\n\r\n\t\tvar s = Math.sqrt( 1 - q.w * q.w );\r\n\r\n\t\tif ( s < 0.0001 ) {\r\n\r\n\t\t\t this.x = 1;\r\n\t\t\t this.y = 0;\r\n\t\t\t this.z = 0;\r\n\r\n\t\t} else {\r\n\r\n\t\t\t this.x = q.x / s;\r\n\t\t\t this.y = q.y / s;\r\n\t\t\t this.z = q.z / s;\r\n\r\n\t\t}\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tsetAxisAngleFromRotationMatrix: function ( m ) {\r\n\r\n\t\t// http://www.euclideanspace.com/maths/geometry/rotations/conversions/matrixToAngle/index.htm\r\n\r\n\t\t// assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled)\r\n\r\n\t\tvar angle, x, y, z,\t\t// variables for result\r\n\t\t\tepsilon = 0.01,\t\t// margin to allow for rounding errors\r\n\t\t\tepsilon2 = 0.1,\t\t// margin to distinguish between 0 and 180 degrees\r\n\r\n\t\t\tte = m.elements,\r\n\r\n\t\t\tm11 = te[ 0 ], m12 = te[ 4 ], m13 = te[ 8 ],\r\n\t\t\tm21 = te[ 1 ], m22 = te[ 5 ], m23 = te[ 9 ],\r\n\t\t\tm31 = te[ 2 ], m32 = te[ 6 ], m33 = te[ 10 ];\r\n\r\n\t\tif ( ( Math.abs( m12 - m21 ) < epsilon )\r\n\t\t && ( Math.abs( m13 - m31 ) < epsilon )\r\n\t\t && ( Math.abs( m23 - m32 ) < epsilon ) ) {\r\n\r\n\t\t\t// singularity found\r\n\t\t\t// first check for identity matrix which must have +1 for all terms\r\n\t\t\t// in leading diagonal and zero in other terms\r\n\r\n\t\t\tif ( ( Math.abs( m12 + m21 ) < epsilon2 )\r\n\t\t\t && ( Math.abs( m13 + m31 ) < epsilon2 )\r\n\t\t\t && ( Math.abs( m23 + m32 ) < epsilon2 )\r\n\t\t\t && ( Math.abs( m11 + m22 + m33 - 3 ) < epsilon2 ) ) {\r\n\r\n\t\t\t\t// this singularity is identity matrix so angle = 0\r\n\r\n\t\t\t\tthis.set( 1, 0, 0, 0 );\r\n\r\n\t\t\t\treturn this; // zero angle, arbitrary axis\r\n\r\n\t\t\t}\r\n\r\n\t\t\t// otherwise this singularity is angle = 180\r\n\r\n\t\t\tangle = Math.PI;\r\n\r\n\t\t\tvar xx = ( m11 + 1 ) / 2;\r\n\t\t\tvar yy = ( m22 + 1 ) / 2;\r\n\t\t\tvar zz = ( m33 + 1 ) / 2;\r\n\t\t\tvar xy = ( m12 + m21 ) / 4;\r\n\t\t\tvar xz = ( m13 + m31 ) / 4;\r\n\t\t\tvar yz = ( m23 + m32 ) / 4;\r\n\r\n\t\t\tif ( ( xx > yy ) && ( xx > zz ) ) { // m11 is the largest diagonal term\r\n\r\n\t\t\t\tif ( xx < epsilon ) {\r\n\r\n\t\t\t\t\tx = 0;\r\n\t\t\t\t\ty = 0.707106781;\r\n\t\t\t\t\tz = 0.707106781;\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\tx = Math.sqrt( xx );\r\n\t\t\t\t\ty = xy / x;\r\n\t\t\t\t\tz = xz / x;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t} else if ( yy > zz ) { // m22 is the largest diagonal term\r\n\r\n\t\t\t\tif ( yy < epsilon ) {\r\n\r\n\t\t\t\t\tx = 0.707106781;\r\n\t\t\t\t\ty = 0;\r\n\t\t\t\t\tz = 0.707106781;\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\ty = Math.sqrt( yy );\r\n\t\t\t\t\tx = xy / y;\r\n\t\t\t\t\tz = yz / y;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t} else { // m33 is the largest diagonal term so base result on this\r\n\r\n\t\t\t\tif ( zz < epsilon ) {\r\n\r\n\t\t\t\t\tx = 0.707106781;\r\n\t\t\t\t\ty = 0.707106781;\r\n\t\t\t\t\tz = 0;\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\tz = Math.sqrt( zz );\r\n\t\t\t\t\tx = xz / z;\r\n\t\t\t\t\ty = yz / z;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\tthis.set( x, y, z, angle );\r\n\r\n\t\t\treturn this; // return 180 deg rotation\r\n\r\n\t\t}\r\n\r\n\t\t// as we have reached here there are no singularities so we can handle normally\r\n\r\n\t\tvar s = Math.sqrt( ( m32 - m23 ) * ( m32 - m23 )\r\n\t\t\t\t\t\t + ( m13 - m31 ) * ( m13 - m31 )\r\n\t\t\t\t\t\t + ( m21 - m12 ) * ( m21 - m12 ) ); // used to normalize\r\n\r\n\t\tif ( Math.abs( s ) < 0.001 ) s = 1;\r\n\r\n\t\t// prevent divide by zero, should not happen if matrix is orthogonal and should be\r\n\t\t// caught by singularity test above, but I've left it in just in case\r\n\r\n\t\tthis.x = ( m32 - m23 ) / s;\r\n\t\tthis.y = ( m13 - m31 ) / s;\r\n\t\tthis.z = ( m21 - m12 ) / s;\r\n\t\tthis.w = Math.acos( ( m11 + m22 + m33 - 1 ) / 2 );\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tmin: function ( v ) {\r\n\r\n\t\tif ( this.x > v.x ) {\r\n\r\n\t\t\tthis.x = v.x;\r\n\r\n\t\t}\r\n\r\n\t\tif ( this.y > v.y ) {\r\n\r\n\t\t\tthis.y = v.y;\r\n\r\n\t\t}\r\n\r\n\t\tif ( this.z > v.z ) {\r\n\r\n\t\t\tthis.z = v.z;\r\n\r\n\t\t}\r\n\r\n\t\tif ( this.w > v.w ) {\r\n\r\n\t\t\tthis.w = v.w;\r\n\r\n\t\t}\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tmax: function ( v ) {\r\n\r\n\t\tif ( this.x < v.x ) {\r\n\r\n\t\t\tthis.x = v.x;\r\n\r\n\t\t}\r\n\r\n\t\tif ( this.y < v.y ) {\r\n\r\n\t\t\tthis.y = v.y;\r\n\r\n\t\t}\r\n\r\n\t\tif ( this.z < v.z ) {\r\n\r\n\t\t\tthis.z = v.z;\r\n\r\n\t\t}\r\n\r\n\t\tif ( this.w < v.w ) {\r\n\r\n\t\t\tthis.w = v.w;\r\n\r\n\t\t}\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tclamp: function ( min, max ) {\r\n\r\n\t\t// This function assumes min < max, if this assumption isn't true it will not operate correctly\r\n\r\n\t\tif ( this.x < min.x ) {\r\n\r\n\t\t\tthis.x = min.x;\r\n\r\n\t\t} else if ( this.x > max.x ) {\r\n\r\n\t\t\tthis.x = max.x;\r\n\r\n\t\t}\r\n\r\n\t\tif ( this.y < min.y ) {\r\n\r\n\t\t\tthis.y = min.y;\r\n\r\n\t\t} else if ( this.y > max.y ) {\r\n\r\n\t\t\tthis.y = max.y;\r\n\r\n\t\t}\r\n\r\n\t\tif ( this.z < min.z ) {\r\n\r\n\t\t\tthis.z = min.z;\r\n\r\n\t\t} else if ( this.z > max.z ) {\r\n\r\n\t\t\tthis.z = max.z;\r\n\r\n\t\t}\r\n\r\n\t\tif ( this.w < min.w ) {\r\n\r\n\t\t\tthis.w = min.w;\r\n\r\n\t\t} else if ( this.w > max.w ) {\r\n\r\n\t\t\tthis.w = max.w;\r\n\r\n\t\t}\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tclampScalar: ( function () {\r\n\r\n\t\tvar min, max;\r\n\r\n\t\treturn function ( minVal, maxVal ) {\r\n\r\n\t\t\tif ( min === undefined ) {\r\n\r\n\t\t\t\tmin = new THREE.Vector4();\r\n\t\t\t\tmax = new THREE.Vector4();\r\n\r\n\t\t\t}\r\n\r\n\t\t\tmin.set( minVal, minVal, minVal, minVal );\r\n\t\t\tmax.set( maxVal, maxVal, maxVal, maxVal );\r\n\r\n\t\t\treturn this.clamp( min, max );\r\n\r\n\t\t};\r\n\r\n\t} )(),\r\n\r\n floor: function () {\r\n\r\n\t\tthis.x = Math.floor( this.x );\r\n\t\tthis.y = Math.floor( this.y );\r\n\t\tthis.z = Math.floor( this.z );\r\n\t\tthis.w = Math.floor( this.w );\r\n\r\n\t\treturn this;\r\n\r\n },\r\n\r\n ceil: function () {\r\n\r\n\t\tthis.x = Math.ceil( this.x );\r\n\t\tthis.y = Math.ceil( this.y );\r\n\t\tthis.z = Math.ceil( this.z );\r\n\t\tthis.w = Math.ceil( this.w );\r\n\r\n\t\treturn this;\r\n\r\n },\r\n\r\n round: function () {\r\n\r\n\t\tthis.x = Math.round( this.x );\r\n\t\tthis.y = Math.round( this.y );\r\n\t\tthis.z = Math.round( this.z );\r\n\t\tthis.w = Math.round( this.w );\r\n\r\n\t\treturn this;\r\n\r\n },\r\n\r\n roundToZero: function () {\r\n\r\n\t\tthis.x = ( this.x < 0 ) ? Math.ceil( this.x ) : Math.floor( this.x );\r\n\t\tthis.y = ( this.y < 0 ) ? Math.ceil( this.y ) : Math.floor( this.y );\r\n\t\tthis.z = ( this.z < 0 ) ? Math.ceil( this.z ) : Math.floor( this.z );\r\n\t\tthis.w = ( this.w < 0 ) ? Math.ceil( this.w ) : Math.floor( this.w );\r\n\r\n\t\treturn this;\r\n\r\n },\r\n\r\n\tnegate: function () {\r\n\r\n\t\tthis.x = - this.x;\r\n\t\tthis.y = - this.y;\r\n\t\tthis.z = - this.z;\r\n\t\tthis.w = - this.w;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tdot: function ( v ) {\r\n\r\n\t\treturn this.x * v.x + this.y * v.y + this.z * v.z + this.w * v.w;\r\n\r\n\t},\r\n\r\n\tlengthSq: function () {\r\n\r\n\t\treturn this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w;\r\n\r\n\t},\r\n\r\n\tlength: function () {\r\n\r\n\t\treturn Math.sqrt( this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w );\r\n\r\n\t},\r\n\r\n\tlengthManhattan: function () {\r\n\r\n\t\treturn Math.abs( this.x ) + Math.abs( this.y ) + Math.abs( this.z ) + Math.abs( this.w );\r\n\r\n\t},\r\n\r\n\tnormalize: function () {\r\n\r\n\t\treturn this.divideScalar( this.length() );\r\n\r\n\t},\r\n\r\n\tsetLength: function ( l ) {\r\n\r\n\t\tvar oldLength = this.length();\r\n\r\n\t\tif ( oldLength !== 0 && l !== oldLength ) {\r\n\r\n\t\t\tthis.multiplyScalar( l / oldLength );\r\n\r\n\t\t}\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tlerp: function ( v, alpha ) {\r\n\r\n\t\tthis.x += ( v.x - this.x ) * alpha;\r\n\t\tthis.y += ( v.y - this.y ) * alpha;\r\n\t\tthis.z += ( v.z - this.z ) * alpha;\r\n\t\tthis.w += ( v.w - this.w ) * alpha;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tlerpVectors: function ( v1, v2, alpha ) {\r\n\r\n\t\tthis.subVectors( v2, v1 ).multiplyScalar( alpha ).add( v1 );\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tequals: function ( v ) {\r\n\r\n\t\treturn ( ( v.x === this.x ) && ( v.y === this.y ) && ( v.z === this.z ) && ( v.w === this.w ) );\r\n\r\n\t},\r\n\r\n\tfromArray: function ( array, offset ) {\r\n\r\n\t\tif ( offset === undefined ) offset = 0;\r\n\r\n\t\tthis.x = array[ offset ];\r\n\t\tthis.y = array[ offset + 1 ];\r\n\t\tthis.z = array[ offset + 2 ];\r\n\t\tthis.w = array[ offset + 3 ];\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\ttoArray: function ( array, offset ) {\r\n\r\n\t\tif ( array === undefined ) array = [];\r\n\t\tif ( offset === undefined ) offset = 0;\r\n\r\n\t\tarray[ offset ] = this.x;\r\n\t\tarray[ offset + 1 ] = this.y;\r\n\t\tarray[ offset + 2 ] = this.z;\r\n\t\tarray[ offset + 3 ] = this.w;\r\n\r\n\t\treturn array;\r\n\r\n\t},\r\n\r\n\tfromAttribute: function ( attribute, index, offset ) {\r\n\r\n\t\tif ( offset === undefined ) offset = 0;\r\n\r\n\t\tindex = index * attribute.itemSize + offset;\r\n\r\n\t\tthis.x = attribute.array[ index ];\r\n\t\tthis.y = attribute.array[ index + 1 ];\r\n\t\tthis.z = attribute.array[ index + 2 ];\r\n\t\tthis.w = attribute.array[ index + 3 ];\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tclone: function () {\r\n\r\n\t\treturn new THREE.Vector4( this.x, this.y, this.z, this.w );\r\n\r\n\t}\r\n\r\n};\r\n\r\n// File:src/math/Euler.js\r\n\r\n/**\r\n * @author mrdoob / http://mrdoob.com/\r\n * @author WestLangley / http://github.com/WestLangley\r\n * @author bhouston / http://exocortex.com\r\n */\r\n\r\nTHREE.Euler = function ( x, y, z, order ) {\r\n\r\n\tthis._x = x || 0;\r\n\tthis._y = y || 0;\r\n\tthis._z = z || 0;\r\n\tthis._order = order || THREE.Euler.DefaultOrder;\r\n\r\n};\r\n\r\nTHREE.Euler.RotationOrders = [ 'XYZ', 'YZX', 'ZXY', 'XZY', 'YXZ', 'ZYX' ];\r\n\r\nTHREE.Euler.DefaultOrder = 'XYZ';\r\n\r\nTHREE.Euler.prototype = {\r\n\r\n\tconstructor: THREE.Euler,\r\n\r\n\t_x: 0, _y: 0, _z: 0, _order: THREE.Euler.DefaultOrder,\r\n\r\n\tget x () {\r\n\r\n\t\treturn this._x;\r\n\r\n\t},\r\n\r\n\tset x ( value ) {\r\n\r\n\t\tthis._x = value;\r\n\t\tthis.onChangeCallback();\r\n\r\n\t},\r\n\r\n\tget y () {\r\n\r\n\t\treturn this._y;\r\n\r\n\t},\r\n\r\n\tset y ( value ) {\r\n\r\n\t\tthis._y = value;\r\n\t\tthis.onChangeCallback();\r\n\r\n\t},\r\n\r\n\tget z () {\r\n\r\n\t\treturn this._z;\r\n\r\n\t},\r\n\r\n\tset z ( value ) {\r\n\r\n\t\tthis._z = value;\r\n\t\tthis.onChangeCallback();\r\n\r\n\t},\r\n\r\n\tget order () {\r\n\r\n\t\treturn this._order;\r\n\r\n\t},\r\n\r\n\tset order ( value ) {\r\n\r\n\t\tthis._order = value;\r\n\t\tthis.onChangeCallback();\r\n\r\n\t},\r\n\r\n\tset: function ( x, y, z, order ) {\r\n\r\n\t\tthis._x = x;\r\n\t\tthis._y = y;\r\n\t\tthis._z = z;\r\n\t\tthis._order = order || this._order;\r\n\r\n\t\tthis.onChangeCallback();\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tcopy: function ( euler ) {\r\n\r\n\t\tthis._x = euler._x;\r\n\t\tthis._y = euler._y;\r\n\t\tthis._z = euler._z;\r\n\t\tthis._order = euler._order;\r\n\r\n\t\tthis.onChangeCallback();\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tsetFromRotationMatrix: function ( m, order, update ) {\r\n\r\n\t\tvar clamp = THREE.Math.clamp;\r\n\r\n\t\t// assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled)\r\n\r\n\t\tvar te = m.elements;\r\n\t\tvar m11 = te[ 0 ], m12 = te[ 4 ], m13 = te[ 8 ];\r\n\t\tvar m21 = te[ 1 ], m22 = te[ 5 ], m23 = te[ 9 ];\r\n\t\tvar m31 = te[ 2 ], m32 = te[ 6 ], m33 = te[ 10 ];\r\n\r\n\t\torder = order || this._order;\r\n\r\n\t\tif ( order === 'XYZ' ) {\r\n\r\n\t\t\tthis._y = Math.asin( clamp( m13, - 1, 1 ) );\r\n\r\n\t\t\tif ( Math.abs( m13 ) < 0.99999 ) {\r\n\r\n\t\t\t\tthis._x = Math.atan2( - m23, m33 );\r\n\t\t\t\tthis._z = Math.atan2( - m12, m11 );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tthis._x = Math.atan2( m32, m22 );\r\n\t\t\t\tthis._z = 0;\r\n\r\n\t\t\t}\r\n\r\n\t\t} else if ( order === 'YXZ' ) {\r\n\r\n\t\t\tthis._x = Math.asin( - clamp( m23, - 1, 1 ) );\r\n\r\n\t\t\tif ( Math.abs( m23 ) < 0.99999 ) {\r\n\r\n\t\t\t\tthis._y = Math.atan2( m13, m33 );\r\n\t\t\t\tthis._z = Math.atan2( m21, m22 );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tthis._y = Math.atan2( - m31, m11 );\r\n\t\t\t\tthis._z = 0;\r\n\r\n\t\t\t}\r\n\r\n\t\t} else if ( order === 'ZXY' ) {\r\n\r\n\t\t\tthis._x = Math.asin( clamp( m32, - 1, 1 ) );\r\n\r\n\t\t\tif ( Math.abs( m32 ) < 0.99999 ) {\r\n\r\n\t\t\t\tthis._y = Math.atan2( - m31, m33 );\r\n\t\t\t\tthis._z = Math.atan2( - m12, m22 );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tthis._y = 0;\r\n\t\t\t\tthis._z = Math.atan2( m21, m11 );\r\n\r\n\t\t\t}\r\n\r\n\t\t} else if ( order === 'ZYX' ) {\r\n\r\n\t\t\tthis._y = Math.asin( - clamp( m31, - 1, 1 ) );\r\n\r\n\t\t\tif ( Math.abs( m31 ) < 0.99999 ) {\r\n\r\n\t\t\t\tthis._x = Math.atan2( m32, m33 );\r\n\t\t\t\tthis._z = Math.atan2( m21, m11 );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tthis._x = 0;\r\n\t\t\t\tthis._z = Math.atan2( - m12, m22 );\r\n\r\n\t\t\t}\r\n\r\n\t\t} else if ( order === 'YZX' ) {\r\n\r\n\t\t\tthis._z = Math.asin( clamp( m21, - 1, 1 ) );\r\n\r\n\t\t\tif ( Math.abs( m21 ) < 0.99999 ) {\r\n\r\n\t\t\t\tthis._x = Math.atan2( - m23, m22 );\r\n\t\t\t\tthis._y = Math.atan2( - m31, m11 );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tthis._x = 0;\r\n\t\t\t\tthis._y = Math.atan2( m13, m33 );\r\n\r\n\t\t\t}\r\n\r\n\t\t} else if ( order === 'XZY' ) {\r\n\r\n\t\t\tthis._z = Math.asin( - clamp( m12, - 1, 1 ) );\r\n\r\n\t\t\tif ( Math.abs( m12 ) < 0.99999 ) {\r\n\r\n\t\t\t\tthis._x = Math.atan2( m32, m22 );\r\n\t\t\t\tthis._y = Math.atan2( m13, m11 );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tthis._x = Math.atan2( - m23, m33 );\r\n\t\t\t\tthis._y = 0;\r\n\r\n\t\t\t}\r\n\r\n\t\t} else {\r\n\r\n\t\t\tTHREE.warn( 'THREE.Euler: .setFromRotationMatrix() given unsupported order: ' + order )\r\n\r\n\t\t}\r\n\r\n\t\tthis._order = order;\r\n\r\n\t\tif ( update !== false ) this.onChangeCallback();\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tsetFromQuaternion: function () {\r\n\r\n\t\tvar matrix;\r\n\r\n\t\treturn function ( q, order, update ) {\r\n\r\n\t\t\tif ( matrix === undefined ) matrix = new THREE.Matrix4();\r\n\t\t\tmatrix.makeRotationFromQuaternion( q );\r\n\t\t\tthis.setFromRotationMatrix( matrix, order, update );\r\n\r\n\t\t\treturn this;\r\n\r\n\t\t};\r\n\r\n\t}(),\r\n\r\n\tsetFromVector3: function ( v, order ) {\r\n\r\n\t\treturn this.set( v.x, v.y, v.z, order || this._order );\r\n\r\n\t},\r\n\r\n\treorder: function () {\r\n\r\n\t\t// WARNING: this discards revolution information -bhouston\r\n\r\n\t\tvar q = new THREE.Quaternion();\r\n\r\n\t\treturn function ( newOrder ) {\r\n\r\n\t\t\tq.setFromEuler( this );\r\n\t\t\tthis.setFromQuaternion( q, newOrder );\r\n\r\n\t\t};\r\n\r\n\t}(),\r\n\r\n\tequals: function ( euler ) {\r\n\r\n\t\treturn ( euler._x === this._x ) && ( euler._y === this._y ) && ( euler._z === this._z ) && ( euler._order === this._order );\r\n\r\n\t},\r\n\r\n\tfromArray: function ( array ) {\r\n\r\n\t\tthis._x = array[ 0 ];\r\n\t\tthis._y = array[ 1 ];\r\n\t\tthis._z = array[ 2 ];\r\n\t\tif ( array[ 3 ] !== undefined ) this._order = array[ 3 ];\r\n\r\n\t\tthis.onChangeCallback();\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\ttoArray: function ( array, offset ) {\r\n\r\n\t\tif ( array === undefined ) array = [];\r\n\t\tif ( offset === undefined ) offset = 0;\r\n\r\n\t\tarray[ offset ] = this._x;\r\n\t\tarray[ offset + 1 ] = this._y;\r\n\t\tarray[ offset + 2 ] = this._z;\r\n\t\tarray[ offset + 3 ] = this._order;\r\n\r\n\t\treturn array;\r\n\t},\r\n\r\n\ttoVector3: function ( optionalResult ) {\r\n\r\n\t\tif ( optionalResult ) {\r\n\r\n\t\t\treturn optionalResult.set( this._x, this._y, this._z );\r\n\r\n\t\t} else {\r\n\r\n\t\t\treturn new THREE.Vector3( this._x, this._y, this._z );\r\n\r\n\t\t}\r\n\r\n\t},\r\n\r\n\tonChange: function ( callback ) {\r\n\r\n\t\tthis.onChangeCallback = callback;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tonChangeCallback: function () {},\r\n\r\n\tclone: function () {\r\n\r\n\t\treturn new THREE.Euler( this._x, this._y, this._z, this._order );\r\n\r\n\t}\r\n\r\n};\r\n\r\n// File:src/math/Line3.js\r\n\r\n/**\r\n * @author bhouston / http://exocortex.com\r\n */\r\n\r\nTHREE.Line3 = function ( start, end ) {\r\n\r\n\tthis.start = ( start !== undefined ) ? start : new THREE.Vector3();\r\n\tthis.end = ( end !== undefined ) ? end : new THREE.Vector3();\r\n\r\n};\r\n\r\nTHREE.Line3.prototype = {\r\n\r\n\tconstructor: THREE.Line3,\r\n\r\n\tset: function ( start, end ) {\r\n\r\n\t\tthis.start.copy( start );\r\n\t\tthis.end.copy( end );\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tcopy: function ( line ) {\r\n\r\n\t\tthis.start.copy( line.start );\r\n\t\tthis.end.copy( line.end );\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tcenter: function ( optionalTarget ) {\r\n\r\n\t\tvar result = optionalTarget || new THREE.Vector3();\r\n\t\treturn result.addVectors( this.start, this.end ).multiplyScalar( 0.5 );\r\n\r\n\t},\r\n\r\n\tdelta: function ( optionalTarget ) {\r\n\r\n\t\tvar result = optionalTarget || new THREE.Vector3();\r\n\t\treturn result.subVectors( this.end, this.start );\r\n\r\n\t},\r\n\r\n\tdistanceSq: function () {\r\n\r\n\t\treturn this.start.distanceToSquared( this.end );\r\n\r\n\t},\r\n\r\n\tdistance: function () {\r\n\r\n\t\treturn this.start.distanceTo( this.end );\r\n\r\n\t},\r\n\r\n\tat: function ( t, optionalTarget ) {\r\n\r\n\t\tvar result = optionalTarget || new THREE.Vector3();\r\n\r\n\t\treturn this.delta( result ).multiplyScalar( t ).add( this.start );\r\n\r\n\t},\r\n\r\n\tclosestPointToPointParameter: function () {\r\n\r\n\t\tvar startP = new THREE.Vector3();\r\n\t\tvar startEnd = new THREE.Vector3();\r\n\r\n\t\treturn function ( point, clampToLine ) {\r\n\r\n\t\t\tstartP.subVectors( point, this.start );\r\n\t\t\tstartEnd.subVectors( this.end, this.start );\r\n\r\n\t\t\tvar startEnd2 = startEnd.dot( startEnd );\r\n\t\t\tvar startEnd_startP = startEnd.dot( startP );\r\n\r\n\t\t\tvar t = startEnd_startP / startEnd2;\r\n\r\n\t\t\tif ( clampToLine ) {\r\n\r\n\t\t\t\tt = THREE.Math.clamp( t, 0, 1 );\r\n\r\n\t\t\t}\r\n\r\n\t\t\treturn t;\r\n\r\n\t\t};\r\n\r\n\t}(),\r\n\r\n\tclosestPointToPoint: function ( point, clampToLine, optionalTarget ) {\r\n\r\n\t\tvar t = this.closestPointToPointParameter( point, clampToLine );\r\n\r\n\t\tvar result = optionalTarget || new THREE.Vector3();\r\n\r\n\t\treturn this.delta( result ).multiplyScalar( t ).add( this.start );\r\n\r\n\t},\r\n\r\n\tapplyMatrix4: function ( matrix ) {\r\n\r\n\t\tthis.start.applyMatrix4( matrix );\r\n\t\tthis.end.applyMatrix4( matrix );\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tequals: function ( line ) {\r\n\r\n\t\treturn line.start.equals( this.start ) && line.end.equals( this.end );\r\n\r\n\t},\r\n\r\n\tclone: function () {\r\n\r\n\t\treturn new THREE.Line3().copy( this );\r\n\r\n\t}\r\n\r\n};\r\n\r\n// File:src/math/Box2.js\r\n\r\n/**\r\n * @author bhouston / http://exocortex.com\r\n */\r\n\r\nTHREE.Box2 = function ( min, max ) {\r\n\r\n\tthis.min = ( min !== undefined ) ? min : new THREE.Vector2( Infinity, Infinity );\r\n\tthis.max = ( max !== undefined ) ? max : new THREE.Vector2( - Infinity, - Infinity );\r\n\r\n};\r\n\r\nTHREE.Box2.prototype = {\r\n\r\n\tconstructor: THREE.Box2,\r\n\r\n\tset: function ( min, max ) {\r\n\r\n\t\tthis.min.copy( min );\r\n\t\tthis.max.copy( max );\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tsetFromPoints: function ( points ) {\r\n\r\n\t\tthis.makeEmpty();\r\n\r\n\t\tfor ( var i = 0, il = points.length; i < il; i ++ ) {\r\n\r\n\t\t\tthis.expandByPoint( points[ i ] )\r\n\r\n\t\t}\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tsetFromCenterAndSize: function () {\r\n\r\n\t\tvar v1 = new THREE.Vector2();\r\n\r\n\t\treturn function ( center, size ) {\r\n\r\n\t\t\tvar halfSize = v1.copy( size ).multiplyScalar( 0.5 );\r\n\t\t\tthis.min.copy( center ).sub( halfSize );\r\n\t\t\tthis.max.copy( center ).add( halfSize );\r\n\r\n\t\t\treturn this;\r\n\r\n\t\t};\r\n\r\n\t}(),\r\n\r\n\tcopy: function ( box ) {\r\n\r\n\t\tthis.min.copy( box.min );\r\n\t\tthis.max.copy( box.max );\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tmakeEmpty: function () {\r\n\r\n\t\tthis.min.x = this.min.y = Infinity;\r\n\t\tthis.max.x = this.max.y = - Infinity;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tempty: function () {\r\n\r\n\t\t// this is a more robust check for empty than ( volume <= 0 ) because volume can get positive with two negative axes\r\n\r\n\t\treturn ( this.max.x < this.min.x ) || ( this.max.y < this.min.y );\r\n\r\n\t},\r\n\r\n\tcenter: function ( optionalTarget ) {\r\n\r\n\t\tvar result = optionalTarget || new THREE.Vector2();\r\n\t\treturn result.addVectors( this.min, this.max ).multiplyScalar( 0.5 );\r\n\r\n\t},\r\n\r\n\tsize: function ( optionalTarget ) {\r\n\r\n\t\tvar result = optionalTarget || new THREE.Vector2();\r\n\t\treturn result.subVectors( this.max, this.min );\r\n\r\n\t},\r\n\r\n\texpandByPoint: function ( point ) {\r\n\r\n\t\tthis.min.min( point );\r\n\t\tthis.max.max( point );\r\n\r\n\t\treturn this;\r\n\t},\r\n\r\n\texpandByVector: function ( vector ) {\r\n\r\n\t\tthis.min.sub( vector );\r\n\t\tthis.max.add( vector );\r\n\r\n\t\treturn this;\r\n\t},\r\n\r\n\texpandByScalar: function ( scalar ) {\r\n\r\n\t\tthis.min.addScalar( - scalar );\r\n\t\tthis.max.addScalar( scalar );\r\n\r\n\t\treturn this;\r\n\t},\r\n\r\n\tcontainsPoint: function ( point ) {\r\n\r\n\t\tif ( point.x < this.min.x || point.x > this.max.x ||\r\n\t\t point.y < this.min.y || point.y > this.max.y ) {\r\n\r\n\t\t\treturn false;\r\n\r\n\t\t}\r\n\r\n\t\treturn true;\r\n\r\n\t},\r\n\r\n\tcontainsBox: function ( box ) {\r\n\r\n\t\tif ( ( this.min.x <= box.min.x ) && ( box.max.x <= this.max.x ) &&\r\n\t\t ( this.min.y <= box.min.y ) && ( box.max.y <= this.max.y ) ) {\r\n\r\n\t\t\treturn true;\r\n\r\n\t\t}\r\n\r\n\t\treturn false;\r\n\r\n\t},\r\n\r\n\tgetParameter: function ( point, optionalTarget ) {\r\n\r\n\t\t// This can potentially have a divide by zero if the box\r\n\t\t// has a size dimension of 0.\r\n\r\n\t\tvar result = optionalTarget || new THREE.Vector2();\r\n\r\n\t\treturn result.set(\r\n\t\t\t( point.x - this.min.x ) / ( this.max.x - this.min.x ),\r\n\t\t\t( point.y - this.min.y ) / ( this.max.y - this.min.y )\r\n\t\t);\r\n\r\n\t},\r\n\r\n\tisIntersectionBox: function ( box ) {\r\n\r\n\t\t// using 6 splitting planes to rule out intersections.\r\n\r\n\t\tif ( box.max.x < this.min.x || box.min.x > this.max.x ||\r\n\t\t box.max.y < this.min.y || box.min.y > this.max.y ) {\r\n\r\n\t\t\treturn false;\r\n\r\n\t\t}\r\n\r\n\t\treturn true;\r\n\r\n\t},\r\n\r\n\tclampPoint: function ( point, optionalTarget ) {\r\n\r\n\t\tvar result = optionalTarget || new THREE.Vector2();\r\n\t\treturn result.copy( point ).clamp( this.min, this.max );\r\n\r\n\t},\r\n\r\n\tdistanceToPoint: function () {\r\n\r\n\t\tvar v1 = new THREE.Vector2();\r\n\r\n\t\treturn function ( point ) {\r\n\r\n\t\t\tvar clampedPoint = v1.copy( point ).clamp( this.min, this.max );\r\n\t\t\treturn clampedPoint.sub( point ).length();\r\n\r\n\t\t};\r\n\r\n\t}(),\r\n\r\n\tintersect: function ( box ) {\r\n\r\n\t\tthis.min.max( box.min );\r\n\t\tthis.max.min( box.max );\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tunion: function ( box ) {\r\n\r\n\t\tthis.min.min( box.min );\r\n\t\tthis.max.max( box.max );\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\ttranslate: function ( offset ) {\r\n\r\n\t\tthis.min.add( offset );\r\n\t\tthis.max.add( offset );\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tequals: function ( box ) {\r\n\r\n\t\treturn box.min.equals( this.min ) && box.max.equals( this.max );\r\n\r\n\t},\r\n\r\n\tclone: function () {\r\n\r\n\t\treturn new THREE.Box2().copy( this );\r\n\r\n\t}\r\n\r\n};\r\n\r\n// File:src/math/Box3.js\r\n\r\n/**\r\n * @author bhouston / http://exocortex.com\r\n * @author WestLangley / http://github.com/WestLangley\r\n */\r\n\r\nTHREE.Box3 = function ( min, max ) {\r\n\r\n\tthis.min = ( min !== undefined ) ? min : new THREE.Vector3( Infinity, Infinity, Infinity );\r\n\tthis.max = ( max !== undefined ) ? max : new THREE.Vector3( - Infinity, - Infinity, - Infinity );\r\n\r\n};\r\n\r\nTHREE.Box3.prototype = {\r\n\r\n\tconstructor: THREE.Box3,\r\n\r\n\tset: function ( min, max ) {\r\n\r\n\t\tthis.min.copy( min );\r\n\t\tthis.max.copy( max );\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tsetFromPoints: function ( points ) {\r\n\r\n\t\tthis.makeEmpty();\r\n\r\n\t\tfor ( var i = 0, il = points.length; i < il; i ++ ) {\r\n\r\n\t\t\tthis.expandByPoint( points[ i ] )\r\n\r\n\t\t}\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tsetFromCenterAndSize: function () {\r\n\r\n\t\tvar v1 = new THREE.Vector3();\r\n\r\n\t\treturn function ( center, size ) {\r\n\r\n\t\t\tvar halfSize = v1.copy( size ).multiplyScalar( 0.5 );\r\n\r\n\t\t\tthis.min.copy( center ).sub( halfSize );\r\n\t\t\tthis.max.copy( center ).add( halfSize );\r\n\r\n\t\t\treturn this;\r\n\r\n\t\t};\r\n\r\n\t}(),\r\n\r\n\tsetFromObject: function () {\r\n\r\n\t\t// Computes the world-axis-aligned bounding box of an object (including its children),\r\n\t\t// accounting for both the object's, and childrens', world transforms\r\n\r\n\t\tvar v1 = new THREE.Vector3();\r\n\r\n\t\treturn function ( object ) {\r\n\r\n\t\t\tvar scope = this;\r\n\r\n\t\t\tobject.updateMatrixWorld( true );\r\n\r\n\t\t\tthis.makeEmpty();\r\n\r\n\t\t\tobject.traverse( function ( node ) {\r\n\r\n\t\t\t\tvar geometry = node.geometry;\r\n\r\n\t\t\t\tif ( geometry !== undefined ) {\r\n\r\n\t\t\t\t\tif ( geometry instanceof THREE.Geometry ) {\r\n\r\n\t\t\t\t\t\tvar vertices = geometry.vertices;\r\n\r\n\t\t\t\t\t\tfor ( var i = 0, il = vertices.length; i < il; i ++ ) {\r\n\r\n\t\t\t\t\t\t\tv1.copy( vertices[ i ] );\r\n\r\n\t\t\t\t\t\t\tv1.applyMatrix4( node.matrixWorld );\r\n\r\n\t\t\t\t\t\t\tscope.expandByPoint( v1 );\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t} else if ( geometry instanceof THREE.BufferGeometry && geometry.attributes[ 'position' ] !== undefined ) {\r\n\r\n\t\t\t\t\t\tvar positions = geometry.attributes[ 'position' ].array;\r\n\r\n\t\t\t\t\t\tfor ( var i = 0, il = positions.length; i < il; i += 3 ) {\r\n\r\n\t\t\t\t\t\t\tv1.set( positions[ i ], positions[ i + 1 ], positions[ i + 2 ] );\r\n\r\n\t\t\t\t\t\t\tv1.applyMatrix4( node.matrixWorld );\r\n\r\n\t\t\t\t\t\t\tscope.expandByPoint( v1 );\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t} );\r\n\r\n\t\t\treturn this;\r\n\r\n\t\t};\r\n\r\n\t}(),\r\n\r\n\tcopy: function ( box ) {\r\n\r\n\t\tthis.min.copy( box.min );\r\n\t\tthis.max.copy( box.max );\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tmakeEmpty: function () {\r\n\r\n\t\tthis.min.x = this.min.y = this.min.z = Infinity;\r\n\t\tthis.max.x = this.max.y = this.max.z = - Infinity;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tempty: function () {\r\n\r\n\t\t// this is a more robust check for empty than ( volume <= 0 ) because volume can get positive with two negative axes\r\n\r\n\t\treturn ( this.max.x < this.min.x ) || ( this.max.y < this.min.y ) || ( this.max.z < this.min.z );\r\n\r\n\t},\r\n\r\n\tcenter: function ( optionalTarget ) {\r\n\r\n\t\tvar result = optionalTarget || new THREE.Vector3();\r\n\t\treturn result.addVectors( this.min, this.max ).multiplyScalar( 0.5 );\r\n\r\n\t},\r\n\r\n\tsize: function ( optionalTarget ) {\r\n\r\n\t\tvar result = optionalTarget || new THREE.Vector3();\r\n\t\treturn result.subVectors( this.max, this.min );\r\n\r\n\t},\r\n\r\n\texpandByPoint: function ( point ) {\r\n\r\n\t\tthis.min.min( point );\r\n\t\tthis.max.max( point );\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\texpandByVector: function ( vector ) {\r\n\r\n\t\tthis.min.sub( vector );\r\n\t\tthis.max.add( vector );\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\texpandByScalar: function ( scalar ) {\r\n\r\n\t\tthis.min.addScalar( - scalar );\r\n\t\tthis.max.addScalar( scalar );\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tcontainsPoint: function ( point ) {\r\n\r\n\t\tif ( point.x < this.min.x || point.x > this.max.x ||\r\n\t\t point.y < this.min.y || point.y > this.max.y ||\r\n\t\t point.z < this.min.z || point.z > this.max.z ) {\r\n\r\n\t\t\treturn false;\r\n\r\n\t\t}\r\n\r\n\t\treturn true;\r\n\r\n\t},\r\n\r\n\tcontainsBox: function ( box ) {\r\n\r\n\t\tif ( ( this.min.x <= box.min.x ) && ( box.max.x <= this.max.x ) &&\r\n\t\t\t ( this.min.y <= box.min.y ) && ( box.max.y <= this.max.y ) &&\r\n\t\t\t ( this.min.z <= box.min.z ) && ( box.max.z <= this.max.z ) ) {\r\n\r\n\t\t\treturn true;\r\n\r\n\t\t}\r\n\r\n\t\treturn false;\r\n\r\n\t},\r\n\r\n\tgetParameter: function ( point, optionalTarget ) {\r\n\r\n\t\t// This can potentially have a divide by zero if the box\r\n\t\t// has a size dimension of 0.\r\n\r\n\t\tvar result = optionalTarget || new THREE.Vector3();\r\n\r\n\t\treturn result.set(\r\n\t\t\t( point.x - this.min.x ) / ( this.max.x - this.min.x ),\r\n\t\t\t( point.y - this.min.y ) / ( this.max.y - this.min.y ),\r\n\t\t\t( point.z - this.min.z ) / ( this.max.z - this.min.z )\r\n\t\t);\r\n\r\n\t},\r\n\r\n\tisIntersectionBox: function ( box ) {\r\n\r\n\t\t// using 6 splitting planes to rule out intersections.\r\n\r\n\t\tif ( box.max.x < this.min.x || box.min.x > this.max.x ||\r\n\t\t box.max.y < this.min.y || box.min.y > this.max.y ||\r\n\t\t box.max.z < this.min.z || box.min.z > this.max.z ) {\r\n\r\n\t\t\treturn false;\r\n\r\n\t\t}\r\n\r\n\t\treturn true;\r\n\r\n\t},\r\n\r\n\tclampPoint: function ( point, optionalTarget ) {\r\n\r\n\t\tvar result = optionalTarget || new THREE.Vector3();\r\n\t\treturn result.copy( point ).clamp( this.min, this.max );\r\n\r\n\t},\r\n\r\n\tdistanceToPoint: function () {\r\n\r\n\t\tvar v1 = new THREE.Vector3();\r\n\r\n\t\treturn function ( point ) {\r\n\r\n\t\t\tvar clampedPoint = v1.copy( point ).clamp( this.min, this.max );\r\n\t\t\treturn clampedPoint.sub( point ).length();\r\n\r\n\t\t};\r\n\r\n\t}(),\r\n\r\n\tgetBoundingSphere: function () {\r\n\r\n\t\tvar v1 = new THREE.Vector3();\r\n\r\n\t\treturn function ( optionalTarget ) {\r\n\r\n\t\t\tvar result = optionalTarget || new THREE.Sphere();\r\n\r\n\t\t\tresult.center = this.center();\r\n\t\t\tresult.radius = this.size( v1 ).length() * 0.5;\r\n\r\n\t\t\treturn result;\r\n\r\n\t\t};\r\n\r\n\t}(),\r\n\r\n\tintersect: function ( box ) {\r\n\r\n\t\tthis.min.max( box.min );\r\n\t\tthis.max.min( box.max );\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tunion: function ( box ) {\r\n\r\n\t\tthis.min.min( box.min );\r\n\t\tthis.max.max( box.max );\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tapplyMatrix4: function () {\r\n\r\n\t\tvar points = [\r\n\t\t\tnew THREE.Vector3(),\r\n\t\t\tnew THREE.Vector3(),\r\n\t\t\tnew THREE.Vector3(),\r\n\t\t\tnew THREE.Vector3(),\r\n\t\t\tnew THREE.Vector3(),\r\n\t\t\tnew THREE.Vector3(),\r\n\t\t\tnew THREE.Vector3(),\r\n\t\t\tnew THREE.Vector3()\r\n\t\t];\r\n\r\n\t\treturn function ( matrix ) {\r\n\r\n\t\t\t// NOTE: I am using a binary pattern to specify all 2^3 combinations below\r\n\t\t\tpoints[ 0 ].set( this.min.x, this.min.y, this.min.z ).applyMatrix4( matrix ); // 000\r\n\t\t\tpoints[ 1 ].set( this.min.x, this.min.y, this.max.z ).applyMatrix4( matrix ); // 001\r\n\t\t\tpoints[ 2 ].set( this.min.x, this.max.y, this.min.z ).applyMatrix4( matrix ); // 010\r\n\t\t\tpoints[ 3 ].set( this.min.x, this.max.y, this.max.z ).applyMatrix4( matrix ); // 011\r\n\t\t\tpoints[ 4 ].set( this.max.x, this.min.y, this.min.z ).applyMatrix4( matrix ); // 100\r\n\t\t\tpoints[ 5 ].set( this.max.x, this.min.y, this.max.z ).applyMatrix4( matrix ); // 101\r\n\t\t\tpoints[ 6 ].set( this.max.x, this.max.y, this.min.z ).applyMatrix4( matrix ); // 110\r\n\t\t\tpoints[ 7 ].set( this.max.x, this.max.y, this.max.z ).applyMatrix4( matrix ); // 111\r\n\r\n\t\t\tthis.makeEmpty();\r\n\t\t\tthis.setFromPoints( points );\r\n\r\n\t\t\treturn this;\r\n\r\n\t\t};\r\n\r\n\t}(),\r\n\r\n\ttranslate: function ( offset ) {\r\n\r\n\t\tthis.min.add( offset );\r\n\t\tthis.max.add( offset );\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tequals: function ( box ) {\r\n\r\n\t\treturn box.min.equals( this.min ) && box.max.equals( this.max );\r\n\r\n\t},\r\n\r\n\tclone: function () {\r\n\r\n\t\treturn new THREE.Box3().copy( this );\r\n\r\n\t}\r\n\r\n};\r\n\r\n// File:src/math/Matrix3.js\r\n\r\n/**\r\n * @author alteredq / http://alteredqualia.com/\r\n * @author WestLangley / http://github.com/WestLangley\r\n * @author bhouston / http://exocortex.com\r\n */\r\n\r\nTHREE.Matrix3 = function () {\r\n\r\n\tthis.elements = new Float32Array( [\r\n\r\n\t\t1, 0, 0,\r\n\t\t0, 1, 0,\r\n\t\t0, 0, 1\r\n\r\n\t] );\r\n\r\n\tif ( arguments.length > 0 ) {\r\n\r\n\t\tTHREE.error( 'THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.' );\r\n\r\n\t}\r\n\r\n};\r\n\r\nTHREE.Matrix3.prototype = {\r\n\r\n\tconstructor: THREE.Matrix3,\r\n\r\n\tset: function ( n11, n12, n13, n21, n22, n23, n31, n32, n33 ) {\r\n\r\n\t\tvar te = this.elements;\r\n\r\n\t\tte[ 0 ] = n11; te[ 3 ] = n12; te[ 6 ] = n13;\r\n\t\tte[ 1 ] = n21; te[ 4 ] = n22; te[ 7 ] = n23;\r\n\t\tte[ 2 ] = n31; te[ 5 ] = n32; te[ 8 ] = n33;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tidentity: function () {\r\n\r\n\t\tthis.set(\r\n\r\n\t\t\t1, 0, 0,\r\n\t\t\t0, 1, 0,\r\n\t\t\t0, 0, 1\r\n\r\n\t\t);\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tcopy: function ( m ) {\r\n\r\n\t\tvar me = m.elements;\r\n\r\n\t\tthis.set(\r\n\r\n\t\t\tme[ 0 ], me[ 3 ], me[ 6 ],\r\n\t\t\tme[ 1 ], me[ 4 ], me[ 7 ],\r\n\t\t\tme[ 2 ], me[ 5 ], me[ 8 ]\r\n\r\n\t\t);\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tmultiplyVector3: function ( vector ) {\r\n\r\n\t\tTHREE.warn( 'THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead.' );\r\n\t\treturn vector.applyMatrix3( this );\r\n\r\n\t},\r\n\r\n\tmultiplyVector3Array: function ( a ) {\r\n\r\n\t\tTHREE.warn( 'THREE.Matrix3: .multiplyVector3Array() has been renamed. Use matrix.applyToVector3Array( array ) instead.' );\r\n\t\treturn this.applyToVector3Array( a );\r\n\r\n\t},\r\n\r\n\tapplyToVector3Array: function () {\r\n\r\n\t\tvar v1 = new THREE.Vector3();\r\n\r\n\t\treturn function ( array, offset, length ) {\r\n\r\n\t\t\tif ( offset === undefined ) offset = 0;\r\n\t\t\tif ( length === undefined ) length = array.length;\r\n\r\n\t\t\tfor ( var i = 0, j = offset; i < length; i += 3, j += 3 ) {\r\n\r\n\t\t\t\tv1.x = array[ j ];\r\n\t\t\t\tv1.y = array[ j + 1 ];\r\n\t\t\t\tv1.z = array[ j + 2 ];\r\n\r\n\t\t\t\tv1.applyMatrix3( this );\r\n\r\n\t\t\t\tarray[ j ] = v1.x;\r\n\t\t\t\tarray[ j + 1 ] = v1.y;\r\n\t\t\t\tarray[ j + 2 ] = v1.z;\r\n\r\n\t\t\t}\r\n\r\n\t\t\treturn array;\r\n\r\n\t\t};\r\n\r\n\t}(),\r\n\r\n\tmultiplyScalar: function ( s ) {\r\n\r\n\t\tvar te = this.elements;\r\n\r\n\t\tte[ 0 ] *= s; te[ 3 ] *= s; te[ 6 ] *= s;\r\n\t\tte[ 1 ] *= s; te[ 4 ] *= s; te[ 7 ] *= s;\r\n\t\tte[ 2 ] *= s; te[ 5 ] *= s; te[ 8 ] *= s;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tdeterminant: function () {\r\n\r\n\t\tvar te = this.elements;\r\n\r\n\t\tvar a = te[ 0 ], b = te[ 1 ], c = te[ 2 ],\r\n\t\t\td = te[ 3 ], e = te[ 4 ], f = te[ 5 ],\r\n\t\t\tg = te[ 6 ], h = te[ 7 ], i = te[ 8 ];\r\n\r\n\t\treturn a * e * i - a * f * h - b * d * i + b * f * g + c * d * h - c * e * g;\r\n\r\n\t},\r\n\r\n\tgetInverse: function ( matrix, throwOnInvertible ) {\r\n\r\n\t\t// input: THREE.Matrix4\r\n\t\t// ( based on http://code.google.com/p/webgl-mjs/ )\r\n\r\n\t\tvar me = matrix.elements;\r\n\t\tvar te = this.elements;\r\n\r\n\t\tte[ 0 ] = me[ 10 ] * me[ 5 ] - me[ 6 ] * me[ 9 ];\r\n\t\tte[ 1 ] = - me[ 10 ] * me[ 1 ] + me[ 2 ] * me[ 9 ];\r\n\t\tte[ 2 ] = me[ 6 ] * me[ 1 ] - me[ 2 ] * me[ 5 ];\r\n\t\tte[ 3 ] = - me[ 10 ] * me[ 4 ] + me[ 6 ] * me[ 8 ];\r\n\t\tte[ 4 ] = me[ 10 ] * me[ 0 ] - me[ 2 ] * me[ 8 ];\r\n\t\tte[ 5 ] = - me[ 6 ] * me[ 0 ] + me[ 2 ] * me[ 4 ];\r\n\t\tte[ 6 ] = me[ 9 ] * me[ 4 ] - me[ 5 ] * me[ 8 ];\r\n\t\tte[ 7 ] = - me[ 9 ] * me[ 0 ] + me[ 1 ] * me[ 8 ];\r\n\t\tte[ 8 ] = me[ 5 ] * me[ 0 ] - me[ 1 ] * me[ 4 ];\r\n\r\n\t\tvar det = me[ 0 ] * te[ 0 ] + me[ 1 ] * te[ 3 ] + me[ 2 ] * te[ 6 ];\r\n\r\n\t\t// no inverse\r\n\r\n\t\tif ( det === 0 ) {\r\n\r\n\t\t\tvar msg = \"Matrix3.getInverse(): can't invert matrix, determinant is 0\";\r\n\r\n\t\t\tif ( throwOnInvertible || false ) {\r\n\r\n\t\t\t\tthrow new Error( msg );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tTHREE.warn( msg );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tthis.identity();\r\n\r\n\t\t\treturn this;\r\n\r\n\t\t}\r\n\r\n\t\tthis.multiplyScalar( 1.0 / det );\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\ttranspose: function () {\r\n\r\n\t\tvar tmp, m = this.elements;\r\n\r\n\t\ttmp = m[ 1 ]; m[ 1 ] = m[ 3 ]; m[ 3 ] = tmp;\r\n\t\ttmp = m[ 2 ]; m[ 2 ] = m[ 6 ]; m[ 6 ] = tmp;\r\n\t\ttmp = m[ 5 ]; m[ 5 ] = m[ 7 ]; m[ 7 ] = tmp;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tflattenToArrayOffset: function ( array, offset ) {\r\n\r\n\t\tvar te = this.elements;\r\n\r\n\t\tarray[ offset ] = te[ 0 ];\r\n\t\tarray[ offset + 1 ] = te[ 1 ];\r\n\t\tarray[ offset + 2 ] = te[ 2 ];\r\n\r\n\t\tarray[ offset + 3 ] = te[ 3 ];\r\n\t\tarray[ offset + 4 ] = te[ 4 ];\r\n\t\tarray[ offset + 5 ] = te[ 5 ];\r\n\r\n\t\tarray[ offset + 6 ] = te[ 6 ];\r\n\t\tarray[ offset + 7 ] = te[ 7 ];\r\n\t\tarray[ offset + 8 ] = te[ 8 ];\r\n\r\n\t\treturn array;\r\n\r\n\t},\r\n\r\n\tgetNormalMatrix: function ( m ) {\r\n\r\n\t\t// input: THREE.Matrix4\r\n\r\n\t\tthis.getInverse( m ).transpose();\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\ttransposeIntoArray: function ( r ) {\r\n\r\n\t\tvar m = this.elements;\r\n\r\n\t\tr[ 0 ] = m[ 0 ];\r\n\t\tr[ 1 ] = m[ 3 ];\r\n\t\tr[ 2 ] = m[ 6 ];\r\n\t\tr[ 3 ] = m[ 1 ];\r\n\t\tr[ 4 ] = m[ 4 ];\r\n\t\tr[ 5 ] = m[ 7 ];\r\n\t\tr[ 6 ] = m[ 2 ];\r\n\t\tr[ 7 ] = m[ 5 ];\r\n\t\tr[ 8 ] = m[ 8 ];\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tfromArray: function ( array ) {\r\n\r\n\t\tthis.elements.set( array );\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\ttoArray: function () {\r\n\r\n\t\tvar te = this.elements;\r\n\r\n\t\treturn [\r\n\t\t\tte[ 0 ], te[ 1 ], te[ 2 ],\r\n\t\t\tte[ 3 ], te[ 4 ], te[ 5 ],\r\n\t\t\tte[ 6 ], te[ 7 ], te[ 8 ]\r\n\t\t];\r\n\r\n\t},\r\n\r\n\tclone: function () {\r\n\r\n\t\treturn new THREE.Matrix3().fromArray( this.elements );\r\n\r\n\t}\r\n\r\n};\r\n\r\n// File:src/math/Matrix4.js\r\n\r\n/**\r\n * @author mrdoob / http://mrdoob.com/\r\n * @author supereggbert / http://www.paulbrunt.co.uk/\r\n * @author philogb / http://blog.thejit.org/\r\n * @author jordi_ros / http://plattsoft.com\r\n * @author D1plo1d / http://github.com/D1plo1d\r\n * @author alteredq / http://alteredqualia.com/\r\n * @author mikael emtinger / http://gomo.se/\r\n * @author timknip / http://www.floorplanner.com/\r\n * @author bhouston / http://exocortex.com\r\n * @author WestLangley / http://github.com/WestLangley\r\n */\r\n\r\nTHREE.Matrix4 = function () {\r\n\r\n\tthis.elements = new Float32Array( [\r\n\r\n\t\t1, 0, 0, 0,\r\n\t\t0, 1, 0, 0,\r\n\t\t0, 0, 1, 0,\r\n\t\t0, 0, 0, 1\r\n\r\n\t] );\r\n\r\n\tif ( arguments.length > 0 ) {\r\n\r\n\t\tTHREE.error( 'THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.' );\r\n\r\n\t}\r\n\r\n};\r\n\r\nTHREE.Matrix4.prototype = {\r\n\r\n\tconstructor: THREE.Matrix4,\r\n\r\n\tset: function ( n11, n12, n13, n14, n21, n22, n23, n24, n31, n32, n33, n34, n41, n42, n43, n44 ) {\r\n\r\n\t\tvar te = this.elements;\r\n\r\n\t\tte[ 0 ] = n11; te[ 4 ] = n12; te[ 8 ] = n13; te[ 12 ] = n14;\r\n\t\tte[ 1 ] = n21; te[ 5 ] = n22; te[ 9 ] = n23; te[ 13 ] = n24;\r\n\t\tte[ 2 ] = n31; te[ 6 ] = n32; te[ 10 ] = n33; te[ 14 ] = n34;\r\n\t\tte[ 3 ] = n41; te[ 7 ] = n42; te[ 11 ] = n43; te[ 15 ] = n44;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tidentity: function () {\r\n\r\n\t\tthis.set(\r\n\r\n\t\t\t1, 0, 0, 0,\r\n\t\t\t0, 1, 0, 0,\r\n\t\t\t0, 0, 1, 0,\r\n\t\t\t0, 0, 0, 1\r\n\r\n\t\t);\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tcopy: function ( m ) {\r\n\r\n\t\tthis.elements.set( m.elements );\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\textractPosition: function ( m ) {\r\n\r\n\t\tTHREE.warn( 'THREE.Matrix4: .extractPosition() has been renamed to .copyPosition().' );\r\n\t\treturn this.copyPosition( m );\r\n\r\n\t},\r\n\r\n\tcopyPosition: function ( m ) {\r\n\r\n\t\tvar te = this.elements;\r\n\t\tvar me = m.elements;\r\n\r\n\t\tte[ 12 ] = me[ 12 ];\r\n\t\tte[ 13 ] = me[ 13 ];\r\n\t\tte[ 14 ] = me[ 14 ];\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\textractBasis: function ( xAxis, yAxis, zAxis ) {\r\n \r\n\t\tvar te = this.elements;\r\n \r\n\t\txAxis.set( te[ 0 ], te[ 1 ], te[ 2 ] );\r\n\t\tyAxis.set( te[ 4 ], te[ 5 ], te[ 6 ] );\r\n\t\tzAxis.set( te[ 8 ], te[ 9 ], te[ 10 ] );\r\n \r\n\t\treturn this;\r\n \t\t\r\n\t},\r\n \r\n\tmakeBasis: function ( xAxis, yAxis, zAxis ) {\r\n\r\n\t\tthis.set(\r\n\t\t\txAxis.x, yAxis.x, zAxis.x, 0,\r\n\t\t\txAxis.y, yAxis.y, zAxis.y, 0,\r\n\t\t\txAxis.z, yAxis.z, zAxis.z, 0,\r\n\t\t\t0, 0, 0, 1\r\n\t\t);\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\textractRotation: function () {\r\n\r\n\t\tvar v1 = new THREE.Vector3();\r\n\r\n\t\treturn function ( m ) {\r\n\r\n\t\t\tvar te = this.elements;\r\n\t\t\tvar me = m.elements;\r\n\r\n\t\t\tvar scaleX = 1 / v1.set( me[ 0 ], me[ 1 ], me[ 2 ] ).length();\r\n\t\t\tvar scaleY = 1 / v1.set( me[ 4 ], me[ 5 ], me[ 6 ] ).length();\r\n\t\t\tvar scaleZ = 1 / v1.set( me[ 8 ], me[ 9 ], me[ 10 ] ).length();\r\n\r\n\t\t\tte[ 0 ] = me[ 0 ] * scaleX;\r\n\t\t\tte[ 1 ] = me[ 1 ] * scaleX;\r\n\t\t\tte[ 2 ] = me[ 2 ] * scaleX;\r\n\r\n\t\t\tte[ 4 ] = me[ 4 ] * scaleY;\r\n\t\t\tte[ 5 ] = me[ 5 ] * scaleY;\r\n\t\t\tte[ 6 ] = me[ 6 ] * scaleY;\r\n\r\n\t\t\tte[ 8 ] = me[ 8 ] * scaleZ;\r\n\t\t\tte[ 9 ] = me[ 9 ] * scaleZ;\r\n\t\t\tte[ 10 ] = me[ 10 ] * scaleZ;\r\n\r\n\t\t\treturn this;\r\n\r\n\t\t};\r\n\r\n\t}(),\r\n\r\n\tmakeRotationFromEuler: function ( euler ) {\r\n\r\n\t\tif ( euler instanceof THREE.Euler === false ) {\r\n\r\n\t\t\tTHREE.error( 'THREE.Matrix: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.' );\r\n\r\n\t\t}\r\n\r\n\t\tvar te = this.elements;\r\n\r\n\t\tvar x = euler.x, y = euler.y, z = euler.z;\r\n\t\tvar a = Math.cos( x ), b = Math.sin( x );\r\n\t\tvar c = Math.cos( y ), d = Math.sin( y );\r\n\t\tvar e = Math.cos( z ), f = Math.sin( z );\r\n\r\n\t\tif ( euler.order === 'XYZ' ) {\r\n\r\n\t\t\tvar ae = a * e, af = a * f, be = b * e, bf = b * f;\r\n\r\n\t\t\tte[ 0 ] = c * e;\r\n\t\t\tte[ 4 ] = - c * f;\r\n\t\t\tte[ 8 ] = d;\r\n\r\n\t\t\tte[ 1 ] = af + be * d;\r\n\t\t\tte[ 5 ] = ae - bf * d;\r\n\t\t\tte[ 9 ] = - b * c;\r\n\r\n\t\t\tte[ 2 ] = bf - ae * d;\r\n\t\t\tte[ 6 ] = be + af * d;\r\n\t\t\tte[ 10 ] = a * c;\r\n\r\n\t\t} else if ( euler.order === 'YXZ' ) {\r\n\r\n\t\t\tvar ce = c * e, cf = c * f, de = d * e, df = d * f;\r\n\r\n\t\t\tte[ 0 ] = ce + df * b;\r\n\t\t\tte[ 4 ] = de * b - cf;\r\n\t\t\tte[ 8 ] = a * d;\r\n\r\n\t\t\tte[ 1 ] = a * f;\r\n\t\t\tte[ 5 ] = a * e;\r\n\t\t\tte[ 9 ] = - b;\r\n\r\n\t\t\tte[ 2 ] = cf * b - de;\r\n\t\t\tte[ 6 ] = df + ce * b;\r\n\t\t\tte[ 10 ] = a * c;\r\n\r\n\t\t} else if ( euler.order === 'ZXY' ) {\r\n\r\n\t\t\tvar ce = c * e, cf = c * f, de = d * e, df = d * f;\r\n\r\n\t\t\tte[ 0 ] = ce - df * b;\r\n\t\t\tte[ 4 ] = - a * f;\r\n\t\t\tte[ 8 ] = de + cf * b;\r\n\r\n\t\t\tte[ 1 ] = cf + de * b;\r\n\t\t\tte[ 5 ] = a * e;\r\n\t\t\tte[ 9 ] = df - ce * b;\r\n\r\n\t\t\tte[ 2 ] = - a * d;\r\n\t\t\tte[ 6 ] = b;\r\n\t\t\tte[ 10 ] = a * c;\r\n\r\n\t\t} else if ( euler.order === 'ZYX' ) {\r\n\r\n\t\t\tvar ae = a * e, af = a * f, be = b * e, bf = b * f;\r\n\r\n\t\t\tte[ 0 ] = c * e;\r\n\t\t\tte[ 4 ] = be * d - af;\r\n\t\t\tte[ 8 ] = ae * d + bf;\r\n\r\n\t\t\tte[ 1 ] = c * f;\r\n\t\t\tte[ 5 ] = bf * d + ae;\r\n\t\t\tte[ 9 ] = af * d - be;\r\n\r\n\t\t\tte[ 2 ] = - d;\r\n\t\t\tte[ 6 ] = b * c;\r\n\t\t\tte[ 10 ] = a * c;\r\n\r\n\t\t} else if ( euler.order === 'YZX' ) {\r\n\r\n\t\t\tvar ac = a * c, ad = a * d, bc = b * c, bd = b * d;\r\n\r\n\t\t\tte[ 0 ] = c * e;\r\n\t\t\tte[ 4 ] = bd - ac * f;\r\n\t\t\tte[ 8 ] = bc * f + ad;\r\n\r\n\t\t\tte[ 1 ] = f;\r\n\t\t\tte[ 5 ] = a * e;\r\n\t\t\tte[ 9 ] = - b * e;\r\n\r\n\t\t\tte[ 2 ] = - d * e;\r\n\t\t\tte[ 6 ] = ad * f + bc;\r\n\t\t\tte[ 10 ] = ac - bd * f;\r\n\r\n\t\t} else if ( euler.order === 'XZY' ) {\r\n\r\n\t\t\tvar ac = a * c, ad = a * d, bc = b * c, bd = b * d;\r\n\r\n\t\t\tte[ 0 ] = c * e;\r\n\t\t\tte[ 4 ] = - f;\r\n\t\t\tte[ 8 ] = d * e;\r\n\r\n\t\t\tte[ 1 ] = ac * f + bd;\r\n\t\t\tte[ 5 ] = a * e;\r\n\t\t\tte[ 9 ] = ad * f - bc;\r\n\r\n\t\t\tte[ 2 ] = bc * f - ad;\r\n\t\t\tte[ 6 ] = b * e;\r\n\t\t\tte[ 10 ] = bd * f + ac;\r\n\r\n\t\t}\r\n\r\n\t\t// last column\r\n\t\tte[ 3 ] = 0;\r\n\t\tte[ 7 ] = 0;\r\n\t\tte[ 11 ] = 0;\r\n\r\n\t\t// bottom row\r\n\t\tte[ 12 ] = 0;\r\n\t\tte[ 13 ] = 0;\r\n\t\tte[ 14 ] = 0;\r\n\t\tte[ 15 ] = 1;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tsetRotationFromQuaternion: function ( q ) {\r\n\r\n\t\tTHREE.warn( 'THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion().' );\r\n\r\n\t\treturn this.makeRotationFromQuaternion( q );\r\n\r\n\t},\r\n\r\n\tmakeRotationFromQuaternion: function ( q ) {\r\n\r\n\t\tvar te = this.elements;\r\n\r\n\t\tvar x = q.x, y = q.y, z = q.z, w = q.w;\r\n\t\tvar x2 = x + x, y2 = y + y, z2 = z + z;\r\n\t\tvar xx = x * x2, xy = x * y2, xz = x * z2;\r\n\t\tvar yy = y * y2, yz = y * z2, zz = z * z2;\r\n\t\tvar wx = w * x2, wy = w * y2, wz = w * z2;\r\n\r\n\t\tte[ 0 ] = 1 - ( yy + zz );\r\n\t\tte[ 4 ] = xy - wz;\r\n\t\tte[ 8 ] = xz + wy;\r\n\r\n\t\tte[ 1 ] = xy + wz;\r\n\t\tte[ 5 ] = 1 - ( xx + zz );\r\n\t\tte[ 9 ] = yz - wx;\r\n\r\n\t\tte[ 2 ] = xz - wy;\r\n\t\tte[ 6 ] = yz + wx;\r\n\t\tte[ 10 ] = 1 - ( xx + yy );\r\n\r\n\t\t// last column\r\n\t\tte[ 3 ] = 0;\r\n\t\tte[ 7 ] = 0;\r\n\t\tte[ 11 ] = 0;\r\n\r\n\t\t// bottom row\r\n\t\tte[ 12 ] = 0;\r\n\t\tte[ 13 ] = 0;\r\n\t\tte[ 14 ] = 0;\r\n\t\tte[ 15 ] = 1;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tlookAt: function () {\r\n\r\n\t\tvar x = new THREE.Vector3();\r\n\t\tvar y = new THREE.Vector3();\r\n\t\tvar z = new THREE.Vector3();\r\n\r\n\t\treturn function ( eye, target, up ) {\r\n\r\n\t\t\tvar te = this.elements;\r\n\r\n\t\t\tz.subVectors( eye, target ).normalize();\r\n\r\n\t\t\tif ( z.length() === 0 ) {\r\n\r\n\t\t\t\tz.z = 1;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tx.crossVectors( up, z ).normalize();\r\n\r\n\t\t\tif ( x.length() === 0 ) {\r\n\r\n\t\t\t\tz.x += 0.0001;\r\n\t\t\t\tx.crossVectors( up, z ).normalize();\r\n\r\n\t\t\t}\r\n\r\n\t\t\ty.crossVectors( z, x );\r\n\r\n\r\n\t\t\tte[ 0 ] = x.x; te[ 4 ] = y.x; te[ 8 ] = z.x;\r\n\t\t\tte[ 1 ] = x.y; te[ 5 ] = y.y; te[ 9 ] = z.y;\r\n\t\t\tte[ 2 ] = x.z; te[ 6 ] = y.z; te[ 10 ] = z.z;\r\n\r\n\t\t\treturn this;\r\n\r\n\t\t};\r\n\r\n\t}(),\r\n\r\n\tmultiply: function ( m, n ) {\r\n\r\n\t\tif ( n !== undefined ) {\r\n\r\n\t\t\tTHREE.warn( 'THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead.' );\r\n\t\t\treturn this.multiplyMatrices( m, n );\r\n\r\n\t\t}\r\n\r\n\t\treturn this.multiplyMatrices( this, m );\r\n\r\n\t},\r\n\r\n\tmultiplyMatrices: function ( a, b ) {\r\n\r\n\t\tvar ae = a.elements;\r\n\t\tvar be = b.elements;\r\n\t\tvar te = this.elements;\r\n\r\n\t\tvar a11 = ae[ 0 ], a12 = ae[ 4 ], a13 = ae[ 8 ], a14 = ae[ 12 ];\r\n\t\tvar a21 = ae[ 1 ], a22 = ae[ 5 ], a23 = ae[ 9 ], a24 = ae[ 13 ];\r\n\t\tvar a31 = ae[ 2 ], a32 = ae[ 6 ], a33 = ae[ 10 ], a34 = ae[ 14 ];\r\n\t\tvar a41 = ae[ 3 ], a42 = ae[ 7 ], a43 = ae[ 11 ], a44 = ae[ 15 ];\r\n\r\n\t\tvar b11 = be[ 0 ], b12 = be[ 4 ], b13 = be[ 8 ], b14 = be[ 12 ];\r\n\t\tvar b21 = be[ 1 ], b22 = be[ 5 ], b23 = be[ 9 ], b24 = be[ 13 ];\r\n\t\tvar b31 = be[ 2 ], b32 = be[ 6 ], b33 = be[ 10 ], b34 = be[ 14 ];\r\n\t\tvar b41 = be[ 3 ], b42 = be[ 7 ], b43 = be[ 11 ], b44 = be[ 15 ];\r\n\r\n\t\tte[ 0 ] = a11 * b11 + a12 * b21 + a13 * b31 + a14 * b41;\r\n\t\tte[ 4 ] = a11 * b12 + a12 * b22 + a13 * b32 + a14 * b42;\r\n\t\tte[ 8 ] = a11 * b13 + a12 * b23 + a13 * b33 + a14 * b43;\r\n\t\tte[ 12 ] = a11 * b14 + a12 * b24 + a13 * b34 + a14 * b44;\r\n\r\n\t\tte[ 1 ] = a21 * b11 + a22 * b21 + a23 * b31 + a24 * b41;\r\n\t\tte[ 5 ] = a21 * b12 + a22 * b22 + a23 * b32 + a24 * b42;\r\n\t\tte[ 9 ] = a21 * b13 + a22 * b23 + a23 * b33 + a24 * b43;\r\n\t\tte[ 13 ] = a21 * b14 + a22 * b24 + a23 * b34 + a24 * b44;\r\n\r\n\t\tte[ 2 ] = a31 * b11 + a32 * b21 + a33 * b31 + a34 * b41;\r\n\t\tte[ 6 ] = a31 * b12 + a32 * b22 + a33 * b32 + a34 * b42;\r\n\t\tte[ 10 ] = a31 * b13 + a32 * b23 + a33 * b33 + a34 * b43;\r\n\t\tte[ 14 ] = a31 * b14 + a32 * b24 + a33 * b34 + a34 * b44;\r\n\r\n\t\tte[ 3 ] = a41 * b11 + a42 * b21 + a43 * b31 + a44 * b41;\r\n\t\tte[ 7 ] = a41 * b12 + a42 * b22 + a43 * b32 + a44 * b42;\r\n\t\tte[ 11 ] = a41 * b13 + a42 * b23 + a43 * b33 + a44 * b43;\r\n\t\tte[ 15 ] = a41 * b14 + a42 * b24 + a43 * b34 + a44 * b44;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tmultiplyToArray: function ( a, b, r ) {\r\n\r\n\t\tvar te = this.elements;\r\n\r\n\t\tthis.multiplyMatrices( a, b );\r\n\r\n\t\tr[ 0 ] = te[ 0 ]; r[ 1 ] = te[ 1 ]; r[ 2 ] = te[ 2 ]; r[ 3 ] = te[ 3 ];\r\n\t\tr[ 4 ] = te[ 4 ]; r[ 5 ] = te[ 5 ]; r[ 6 ] = te[ 6 ]; r[ 7 ] = te[ 7 ];\r\n\t\tr[ 8 ] = te[ 8 ]; r[ 9 ] = te[ 9 ]; r[ 10 ] = te[ 10 ]; r[ 11 ] = te[ 11 ];\r\n\t\tr[ 12 ] = te[ 12 ]; r[ 13 ] = te[ 13 ]; r[ 14 ] = te[ 14 ]; r[ 15 ] = te[ 15 ];\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tmultiplyScalar: function ( s ) {\r\n\r\n\t\tvar te = this.elements;\r\n\r\n\t\tte[ 0 ] *= s; te[ 4 ] *= s; te[ 8 ] *= s; te[ 12 ] *= s;\r\n\t\tte[ 1 ] *= s; te[ 5 ] *= s; te[ 9 ] *= s; te[ 13 ] *= s;\r\n\t\tte[ 2 ] *= s; te[ 6 ] *= s; te[ 10 ] *= s; te[ 14 ] *= s;\r\n\t\tte[ 3 ] *= s; te[ 7 ] *= s; te[ 11 ] *= s; te[ 15 ] *= s;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tmultiplyVector3: function ( vector ) {\r\n\r\n\t\tTHREE.warn( 'THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) or vector.applyProjection( matrix ) instead.' );\r\n\t\treturn vector.applyProjection( this );\r\n\r\n\t},\r\n\r\n\tmultiplyVector4: function ( vector ) {\r\n\r\n\t\tTHREE.warn( 'THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead.' );\r\n\t\treturn vector.applyMatrix4( this );\r\n\r\n\t},\r\n\r\n\tmultiplyVector3Array: function ( a ) {\r\n\r\n\t\tTHREE.warn( 'THREE.Matrix4: .multiplyVector3Array() has been renamed. Use matrix.applyToVector3Array( array ) instead.' );\r\n\t\treturn this.applyToVector3Array( a );\r\n\r\n\t},\r\n\r\n\tapplyToVector3Array: function () {\r\n\r\n\t\tvar v1 = new THREE.Vector3();\r\n\r\n\t\treturn function ( array, offset, length ) {\r\n\r\n\t\t\tif ( offset === undefined ) offset = 0;\r\n\t\t\tif ( length === undefined ) length = array.length;\r\n\r\n\t\t\tfor ( var i = 0, j = offset; i < length; i += 3, j += 3 ) {\r\n\r\n\t\t\t\tv1.x = array[ j ];\r\n\t\t\t\tv1.y = array[ j + 1 ];\r\n\t\t\t\tv1.z = array[ j + 2 ];\r\n\r\n\t\t\t\tv1.applyMatrix4( this );\r\n\r\n\t\t\t\tarray[ j ] = v1.x;\r\n\t\t\t\tarray[ j + 1 ] = v1.y;\r\n\t\t\t\tarray[ j + 2 ] = v1.z;\r\n\r\n\t\t\t}\r\n\r\n\t\t\treturn array;\r\n\r\n\t\t};\r\n\r\n\t}(),\r\n\r\n\trotateAxis: function ( v ) {\r\n\r\n\t\tTHREE.warn( 'THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead.' );\r\n\r\n\t\tv.transformDirection( this );\r\n\r\n\t},\r\n\r\n\tcrossVector: function ( vector ) {\r\n\r\n\t\tTHREE.warn( 'THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead.' );\r\n\t\treturn vector.applyMatrix4( this );\r\n\r\n\t},\r\n\r\n\tdeterminant: function () {\r\n\r\n\t\tvar te = this.elements;\r\n\r\n\t\tvar n11 = te[ 0 ], n12 = te[ 4 ], n13 = te[ 8 ], n14 = te[ 12 ];\r\n\t\tvar n21 = te[ 1 ], n22 = te[ 5 ], n23 = te[ 9 ], n24 = te[ 13 ];\r\n\t\tvar n31 = te[ 2 ], n32 = te[ 6 ], n33 = te[ 10 ], n34 = te[ 14 ];\r\n\t\tvar n41 = te[ 3 ], n42 = te[ 7 ], n43 = te[ 11 ], n44 = te[ 15 ];\r\n\r\n\t\t//TODO: make this more efficient\r\n\t\t//( based on http://www.euclideanspace.com/maths/algebra/matrix/functions/inverse/fourD/index.htm )\r\n\r\n\t\treturn (\r\n\t\t\tn41 * (\r\n\t\t\t\t+ n14 * n23 * n32\r\n\t\t\t\t - n13 * n24 * n32\r\n\t\t\t\t - n14 * n22 * n33\r\n\t\t\t\t + n12 * n24 * n33\r\n\t\t\t\t + n13 * n22 * n34\r\n\t\t\t\t - n12 * n23 * n34\r\n\t\t\t) +\r\n\t\t\tn42 * (\r\n\t\t\t\t+ n11 * n23 * n34\r\n\t\t\t\t - n11 * n24 * n33\r\n\t\t\t\t + n14 * n21 * n33\r\n\t\t\t\t - n13 * n21 * n34\r\n\t\t\t\t + n13 * n24 * n31\r\n\t\t\t\t - n14 * n23 * n31\r\n\t\t\t) +\r\n\t\t\tn43 * (\r\n\t\t\t\t+ n11 * n24 * n32\r\n\t\t\t\t - n11 * n22 * n34\r\n\t\t\t\t - n14 * n21 * n32\r\n\t\t\t\t + n12 * n21 * n34\r\n\t\t\t\t + n14 * n22 * n31\r\n\t\t\t\t - n12 * n24 * n31\r\n\t\t\t) +\r\n\t\t\tn44 * (\r\n\t\t\t\t- n13 * n22 * n31\r\n\t\t\t\t - n11 * n23 * n32\r\n\t\t\t\t + n11 * n22 * n33\r\n\t\t\t\t + n13 * n21 * n32\r\n\t\t\t\t - n12 * n21 * n33\r\n\t\t\t\t + n12 * n23 * n31\r\n\t\t\t)\r\n\r\n\t\t);\r\n\r\n\t},\r\n\r\n\ttranspose: function () {\r\n\r\n\t\tvar te = this.elements;\r\n\t\tvar tmp;\r\n\r\n\t\ttmp = te[ 1 ]; te[ 1 ] = te[ 4 ]; te[ 4 ] = tmp;\r\n\t\ttmp = te[ 2 ]; te[ 2 ] = te[ 8 ]; te[ 8 ] = tmp;\r\n\t\ttmp = te[ 6 ]; te[ 6 ] = te[ 9 ]; te[ 9 ] = tmp;\r\n\r\n\t\ttmp = te[ 3 ]; te[ 3 ] = te[ 12 ]; te[ 12 ] = tmp;\r\n\t\ttmp = te[ 7 ]; te[ 7 ] = te[ 13 ]; te[ 13 ] = tmp;\r\n\t\ttmp = te[ 11 ]; te[ 11 ] = te[ 14 ]; te[ 14 ] = tmp;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tflattenToArrayOffset: function ( array, offset ) {\r\n\r\n\t\tvar te = this.elements;\r\n\r\n\t\tarray[ offset ] = te[ 0 ];\r\n\t\tarray[ offset + 1 ] = te[ 1 ];\r\n\t\tarray[ offset + 2 ] = te[ 2 ];\r\n\t\tarray[ offset + 3 ] = te[ 3 ];\r\n\r\n\t\tarray[ offset + 4 ] = te[ 4 ];\r\n\t\tarray[ offset + 5 ] = te[ 5 ];\r\n\t\tarray[ offset + 6 ] = te[ 6 ];\r\n\t\tarray[ offset + 7 ] = te[ 7 ];\r\n\r\n\t\tarray[ offset + 8 ] = te[ 8 ];\r\n\t\tarray[ offset + 9 ] = te[ 9 ];\r\n\t\tarray[ offset + 10 ] = te[ 10 ];\r\n\t\tarray[ offset + 11 ] = te[ 11 ];\r\n\r\n\t\tarray[ offset + 12 ] = te[ 12 ];\r\n\t\tarray[ offset + 13 ] = te[ 13 ];\r\n\t\tarray[ offset + 14 ] = te[ 14 ];\r\n\t\tarray[ offset + 15 ] = te[ 15 ];\r\n\r\n\t\treturn array;\r\n\r\n\t},\r\n\r\n\tgetPosition: function () {\r\n\r\n\t\tvar v1 = new THREE.Vector3();\r\n\r\n\t\treturn function () {\r\n\r\n\t\t\tTHREE.warn( 'THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead.' );\r\n\r\n\t\t\tvar te = this.elements;\r\n\t\t\treturn v1.set( te[ 12 ], te[ 13 ], te[ 14 ] );\r\n\r\n\t\t};\r\n\r\n\t}(),\r\n\r\n\tsetPosition: function ( v ) {\r\n\r\n\t\tvar te = this.elements;\r\n\r\n\t\tte[ 12 ] = v.x;\r\n\t\tte[ 13 ] = v.y;\r\n\t\tte[ 14 ] = v.z;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tgetInverse: function ( m, throwOnInvertible ) {\r\n\r\n\t\t// based on http://www.euclideanspace.com/maths/algebra/matrix/functions/inverse/fourD/index.htm\r\n\t\tvar te = this.elements;\r\n\t\tvar me = m.elements;\r\n\r\n\t\tvar n11 = me[ 0 ], n12 = me[ 4 ], n13 = me[ 8 ], n14 = me[ 12 ];\r\n\t\tvar n21 = me[ 1 ], n22 = me[ 5 ], n23 = me[ 9 ], n24 = me[ 13 ];\r\n\t\tvar n31 = me[ 2 ], n32 = me[ 6 ], n33 = me[ 10 ], n34 = me[ 14 ];\r\n\t\tvar n41 = me[ 3 ], n42 = me[ 7 ], n43 = me[ 11 ], n44 = me[ 15 ];\r\n\r\n\t\tte[ 0 ] = n23 * n34 * n42 - n24 * n33 * n42 + n24 * n32 * n43 - n22 * n34 * n43 - n23 * n32 * n44 + n22 * n33 * n44;\r\n\t\tte[ 4 ] = n14 * n33 * n42 - n13 * n34 * n42 - n14 * n32 * n43 + n12 * n34 * n43 + n13 * n32 * n44 - n12 * n33 * n44;\r\n\t\tte[ 8 ] = n13 * n24 * n42 - n14 * n23 * n42 + n14 * n22 * n43 - n12 * n24 * n43 - n13 * n22 * n44 + n12 * n23 * n44;\r\n\t\tte[ 12 ] = n14 * n23 * n32 - n13 * n24 * n32 - n14 * n22 * n33 + n12 * n24 * n33 + n13 * n22 * n34 - n12 * n23 * n34;\r\n\t\tte[ 1 ] = n24 * n33 * n41 - n23 * n34 * n41 - n24 * n31 * n43 + n21 * n34 * n43 + n23 * n31 * n44 - n21 * n33 * n44;\r\n\t\tte[ 5 ] = n13 * n34 * n41 - n14 * n33 * n41 + n14 * n31 * n43 - n11 * n34 * n43 - n13 * n31 * n44 + n11 * n33 * n44;\r\n\t\tte[ 9 ] = n14 * n23 * n41 - n13 * n24 * n41 - n14 * n21 * n43 + n11 * n24 * n43 + n13 * n21 * n44 - n11 * n23 * n44;\r\n\t\tte[ 13 ] = n13 * n24 * n31 - n14 * n23 * n31 + n14 * n21 * n33 - n11 * n24 * n33 - n13 * n21 * n34 + n11 * n23 * n34;\r\n\t\tte[ 2 ] = n22 * n34 * n41 - n24 * n32 * n41 + n24 * n31 * n42 - n21 * n34 * n42 - n22 * n31 * n44 + n21 * n32 * n44;\r\n\t\tte[ 6 ] = n14 * n32 * n41 - n12 * n34 * n41 - n14 * n31 * n42 + n11 * n34 * n42 + n12 * n31 * n44 - n11 * n32 * n44;\r\n\t\tte[ 10 ] = n12 * n24 * n41 - n14 * n22 * n41 + n14 * n21 * n42 - n11 * n24 * n42 - n12 * n21 * n44 + n11 * n22 * n44;\r\n\t\tte[ 14 ] = n14 * n22 * n31 - n12 * n24 * n31 - n14 * n21 * n32 + n11 * n24 * n32 + n12 * n21 * n34 - n11 * n22 * n34;\r\n\t\tte[ 3 ] = n23 * n32 * n41 - n22 * n33 * n41 - n23 * n31 * n42 + n21 * n33 * n42 + n22 * n31 * n43 - n21 * n32 * n43;\r\n\t\tte[ 7 ] = n12 * n33 * n41 - n13 * n32 * n41 + n13 * n31 * n42 - n11 * n33 * n42 - n12 * n31 * n43 + n11 * n32 * n43;\r\n\t\tte[ 11 ] = n13 * n22 * n41 - n12 * n23 * n41 - n13 * n21 * n42 + n11 * n23 * n42 + n12 * n21 * n43 - n11 * n22 * n43;\r\n\t\tte[ 15 ] = n12 * n23 * n31 - n13 * n22 * n31 + n13 * n21 * n32 - n11 * n23 * n32 - n12 * n21 * n33 + n11 * n22 * n33;\r\n\r\n\t\tvar det = n11 * te[ 0 ] + n21 * te[ 4 ] + n31 * te[ 8 ] + n41 * te[ 12 ];\r\n\r\n\t\tif ( det == 0 ) {\r\n\r\n\t\t\tvar msg = \"THREE.Matrix4.getInverse(): can't invert matrix, determinant is 0\";\r\n\r\n\t\t\tif ( throwOnInvertible || false ) {\r\n\r\n\t\t\t\tthrow new Error( msg );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tTHREE.warn( msg );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tthis.identity();\r\n\r\n\t\t\treturn this;\r\n\t\t}\r\n\r\n\t\tthis.multiplyScalar( 1 / det );\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\ttranslate: function ( v ) {\r\n\r\n\t\tTHREE.error( 'THREE.Matrix4: .translate() has been removed.' );\r\n\r\n\t},\r\n\r\n\trotateX: function ( angle ) {\r\n\r\n\t\tTHREE.error( 'THREE.Matrix4: .rotateX() has been removed.' );\r\n\r\n\t},\r\n\r\n\trotateY: function ( angle ) {\r\n\r\n\t\tTHREE.error( 'THREE.Matrix4: .rotateY() has been removed.' );\r\n\r\n\t},\r\n\r\n\trotateZ: function ( angle ) {\r\n\r\n\t\tTHREE.error( 'THREE.Matrix4: .rotateZ() has been removed.' );\r\n\r\n\t},\r\n\r\n\trotateByAxis: function ( axis, angle ) {\r\n\r\n\t\tTHREE.error( 'THREE.Matrix4: .rotateByAxis() has been removed.' );\r\n\r\n\t},\r\n\r\n\tscale: function ( v ) {\r\n\r\n\t\tvar te = this.elements;\r\n\t\tvar x = v.x, y = v.y, z = v.z;\r\n\r\n\t\tte[ 0 ] *= x; te[ 4 ] *= y; te[ 8 ] *= z;\r\n\t\tte[ 1 ] *= x; te[ 5 ] *= y; te[ 9 ] *= z;\r\n\t\tte[ 2 ] *= x; te[ 6 ] *= y; te[ 10 ] *= z;\r\n\t\tte[ 3 ] *= x; te[ 7 ] *= y; te[ 11 ] *= z;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tgetMaxScaleOnAxis: function () {\r\n\r\n\t\tvar te = this.elements;\r\n\r\n\t\tvar scaleXSq = te[ 0 ] * te[ 0 ] + te[ 1 ] * te[ 1 ] + te[ 2 ] * te[ 2 ];\r\n\t\tvar scaleYSq = te[ 4 ] * te[ 4 ] + te[ 5 ] * te[ 5 ] + te[ 6 ] * te[ 6 ];\r\n\t\tvar scaleZSq = te[ 8 ] * te[ 8 ] + te[ 9 ] * te[ 9 ] + te[ 10 ] * te[ 10 ];\r\n\r\n\t\treturn Math.sqrt( Math.max( scaleXSq, Math.max( scaleYSq, scaleZSq ) ) );\r\n\r\n\t},\r\n\r\n\tmakeTranslation: function ( x, y, z ) {\r\n\r\n\t\tthis.set(\r\n\r\n\t\t\t1, 0, 0, x,\r\n\t\t\t0, 1, 0, y,\r\n\t\t\t0, 0, 1, z,\r\n\t\t\t0, 0, 0, 1\r\n\r\n\t\t);\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tmakeRotationX: function ( theta ) {\r\n\r\n\t\tvar c = Math.cos( theta ), s = Math.sin( theta );\r\n\r\n\t\tthis.set(\r\n\r\n\t\t\t1, 0, 0, 0,\r\n\t\t\t0, c, - s, 0,\r\n\t\t\t0, s, c, 0,\r\n\t\t\t0, 0, 0, 1\r\n\r\n\t\t);\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tmakeRotationY: function ( theta ) {\r\n\r\n\t\tvar c = Math.cos( theta ), s = Math.sin( theta );\r\n\r\n\t\tthis.set(\r\n\r\n\t\t\t c, 0, s, 0,\r\n\t\t\t 0, 1, 0, 0,\r\n\t\t\t- s, 0, c, 0,\r\n\t\t\t 0, 0, 0, 1\r\n\r\n\t\t);\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tmakeRotationZ: function ( theta ) {\r\n\r\n\t\tvar c = Math.cos( theta ), s = Math.sin( theta );\r\n\r\n\t\tthis.set(\r\n\r\n\t\t\tc, - s, 0, 0,\r\n\t\t\ts, c, 0, 0,\r\n\t\t\t0, 0, 1, 0,\r\n\t\t\t0, 0, 0, 1\r\n\r\n\t\t);\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tmakeRotationAxis: function ( axis, angle ) {\r\n\r\n\t\t// Based on http://www.gamedev.net/reference/articles/article1199.asp\r\n\r\n\t\tvar c = Math.cos( angle );\r\n\t\tvar s = Math.sin( angle );\r\n\t\tvar t = 1 - c;\r\n\t\tvar x = axis.x, y = axis.y, z = axis.z;\r\n\t\tvar tx = t * x, ty = t * y;\r\n\r\n\t\tthis.set(\r\n\r\n\t\t\ttx * x + c, tx * y - s * z, tx * z + s * y, 0,\r\n\t\t\ttx * y + s * z, ty * y + c, ty * z - s * x, 0,\r\n\t\t\ttx * z - s * y, ty * z + s * x, t * z * z + c, 0,\r\n\t\t\t0, 0, 0, 1\r\n\r\n\t\t);\r\n\r\n\t\t return this;\r\n\r\n\t},\r\n\r\n\tmakeScale: function ( x, y, z ) {\r\n\r\n\t\tthis.set(\r\n\r\n\t\t\tx, 0, 0, 0,\r\n\t\t\t0, y, 0, 0,\r\n\t\t\t0, 0, z, 0,\r\n\t\t\t0, 0, 0, 1\r\n\r\n\t\t);\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tcompose: function ( position, quaternion, scale ) {\r\n\r\n\t\tthis.makeRotationFromQuaternion( quaternion );\r\n\t\tthis.scale( scale );\r\n\t\tthis.setPosition( position );\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tdecompose: function () {\r\n\r\n\t\tvar vector = new THREE.Vector3();\r\n\t\tvar matrix = new THREE.Matrix4();\r\n\r\n\t\treturn function ( position, quaternion, scale ) {\r\n\r\n\t\t\tvar te = this.elements;\r\n\r\n\t\t\tvar sx = vector.set( te[ 0 ], te[ 1 ], te[ 2 ] ).length();\r\n\t\t\tvar sy = vector.set( te[ 4 ], te[ 5 ], te[ 6 ] ).length();\r\n\t\t\tvar sz = vector.set( te[ 8 ], te[ 9 ], te[ 10 ] ).length();\r\n\r\n\t\t\t// if determine is negative, we need to invert one scale\r\n\t\t\tvar det = this.determinant();\r\n\t\t\tif ( det < 0 ) {\r\n\t\t\t\tsx = - sx;\r\n\t\t\t}\r\n\r\n\t\t\tposition.x = te[ 12 ];\r\n\t\t\tposition.y = te[ 13 ];\r\n\t\t\tposition.z = te[ 14 ];\r\n\r\n\t\t\t// scale the rotation part\r\n\r\n\t\t\tmatrix.elements.set( this.elements ); // at this point matrix is incomplete so we can't use .copy()\r\n\r\n\t\t\tvar invSX = 1 / sx;\r\n\t\t\tvar invSY = 1 / sy;\r\n\t\t\tvar invSZ = 1 / sz;\r\n\r\n\t\t\tmatrix.elements[ 0 ] *= invSX;\r\n\t\t\tmatrix.elements[ 1 ] *= invSX;\r\n\t\t\tmatrix.elements[ 2 ] *= invSX;\r\n\r\n\t\t\tmatrix.elements[ 4 ] *= invSY;\r\n\t\t\tmatrix.elements[ 5 ] *= invSY;\r\n\t\t\tmatrix.elements[ 6 ] *= invSY;\r\n\r\n\t\t\tmatrix.elements[ 8 ] *= invSZ;\r\n\t\t\tmatrix.elements[ 9 ] *= invSZ;\r\n\t\t\tmatrix.elements[ 10 ] *= invSZ;\r\n\r\n\t\t\tquaternion.setFromRotationMatrix( matrix );\r\n\r\n\t\t\tscale.x = sx;\r\n\t\t\tscale.y = sy;\r\n\t\t\tscale.z = sz;\r\n\r\n\t\t\treturn this;\r\n\r\n\t\t};\r\n\r\n\t}(),\r\n\r\n\tmakeFrustum: function ( left, right, bottom, top, near, far ) {\r\n\r\n\t\tvar te = this.elements;\r\n\t\tvar x = 2 * near / ( right - left );\r\n\t\tvar y = 2 * near / ( top - bottom );\r\n\r\n\t\tvar a = ( right + left ) / ( right - left );\r\n\t\tvar b = ( top + bottom ) / ( top - bottom );\r\n\t\tvar c = - ( far + near ) / ( far - near );\r\n\t\tvar d = - 2 * far * near / ( far - near );\r\n\r\n\t\tte[ 0 ] = x;\tte[ 4 ] = 0;\tte[ 8 ] = a;\tte[ 12 ] = 0;\r\n\t\tte[ 1 ] = 0;\tte[ 5 ] = y;\tte[ 9 ] = b;\tte[ 13 ] = 0;\r\n\t\tte[ 2 ] = 0;\tte[ 6 ] = 0;\tte[ 10 ] = c;\tte[ 14 ] = d;\r\n\t\tte[ 3 ] = 0;\tte[ 7 ] = 0;\tte[ 11 ] = - 1;\tte[ 15 ] = 0;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tmakePerspective: function ( fov, aspect, near, far ) {\r\n\r\n\t\tvar ymax = near * Math.tan( THREE.Math.degToRad( fov * 0.5 ) );\r\n\t\tvar ymin = - ymax;\r\n\t\tvar xmin = ymin * aspect;\r\n\t\tvar xmax = ymax * aspect;\r\n\r\n\t\treturn this.makeFrustum( xmin, xmax, ymin, ymax, near, far );\r\n\r\n\t},\r\n\r\n\tmakeOrthographic: function ( left, right, top, bottom, near, far ) {\r\n\r\n\t\tvar te = this.elements;\r\n\t\tvar w = right - left;\r\n\t\tvar h = top - bottom;\r\n\t\tvar p = far - near;\r\n\r\n\t\tvar x = ( right + left ) / w;\r\n\t\tvar y = ( top + bottom ) / h;\r\n\t\tvar z = ( far + near ) / p;\r\n\r\n\t\tte[ 0 ] = 2 / w;\tte[ 4 ] = 0;\tte[ 8 ] = 0;\tte[ 12 ] = - x;\r\n\t\tte[ 1 ] = 0;\tte[ 5 ] = 2 / h;\tte[ 9 ] = 0;\tte[ 13 ] = - y;\r\n\t\tte[ 2 ] = 0;\tte[ 6 ] = 0;\tte[ 10 ] = - 2 / p;\tte[ 14 ] = - z;\r\n\t\tte[ 3 ] = 0;\tte[ 7 ] = 0;\tte[ 11 ] = 0;\tte[ 15 ] = 1;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tfromArray: function ( array ) {\r\n\r\n\t\tthis.elements.set( array );\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\ttoArray: function () {\r\n\r\n\t\tvar te = this.elements;\r\n\r\n\t\treturn [\r\n\t\t\tte[ 0 ], te[ 1 ], te[ 2 ], te[ 3 ],\r\n\t\t\tte[ 4 ], te[ 5 ], te[ 6 ], te[ 7 ],\r\n\t\t\tte[ 8 ], te[ 9 ], te[ 10 ], te[ 11 ],\r\n\t\t\tte[ 12 ], te[ 13 ], te[ 14 ], te[ 15 ]\r\n\t\t];\r\n\r\n\t},\r\n\r\n\tclone: function () {\r\n\r\n\t\treturn new THREE.Matrix4().fromArray( this.elements );\r\n\r\n\t}\r\n\r\n};\r\n\r\n// File:src/math/Ray.js\r\n\r\n/**\r\n * @author bhouston / http://exocortex.com\r\n */\r\n\r\nTHREE.Ray = function ( origin, direction ) {\r\n\r\n\tthis.origin = ( origin !== undefined ) ? origin : new THREE.Vector3();\r\n\tthis.direction = ( direction !== undefined ) ? direction : new THREE.Vector3();\r\n\r\n};\r\n\r\nTHREE.Ray.prototype = {\r\n\r\n\tconstructor: THREE.Ray,\r\n\r\n\tset: function ( origin, direction ) {\r\n\r\n\t\tthis.origin.copy( origin );\r\n\t\tthis.direction.copy( direction );\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tcopy: function ( ray ) {\r\n\r\n\t\tthis.origin.copy( ray.origin );\r\n\t\tthis.direction.copy( ray.direction );\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tat: function ( t, optionalTarget ) {\r\n\r\n\t\tvar result = optionalTarget || new THREE.Vector3();\r\n\r\n\t\treturn result.copy( this.direction ).multiplyScalar( t ).add( this.origin );\r\n\r\n\t},\r\n\r\n\trecast: function () {\r\n\r\n\t\tvar v1 = new THREE.Vector3();\r\n\r\n\t\treturn function ( t ) {\r\n\r\n\t\t\tthis.origin.copy( this.at( t, v1 ) );\r\n\r\n\t\t\treturn this;\r\n\r\n\t\t};\r\n\r\n\t}(),\r\n\r\n\tclosestPointToPoint: function ( point, optionalTarget ) {\r\n\r\n\t\tvar result = optionalTarget || new THREE.Vector3();\r\n\t\tresult.subVectors( point, this.origin );\r\n\t\tvar directionDistance = result.dot( this.direction );\r\n\r\n\t\tif ( directionDistance < 0 ) {\r\n\r\n\t\t\treturn result.copy( this.origin );\r\n\r\n\t\t}\r\n\r\n\t\treturn result.copy( this.direction ).multiplyScalar( directionDistance ).add( this.origin );\r\n\r\n\t},\r\n\r\n\tdistanceToPoint: function () {\r\n\r\n\t\tvar v1 = new THREE.Vector3();\r\n\r\n\t\treturn function ( point ) {\r\n\r\n\t\t\tvar directionDistance = v1.subVectors( point, this.origin ).dot( this.direction );\r\n\r\n\t\t\t// point behind the ray\r\n\r\n\t\t\tif ( directionDistance < 0 ) {\r\n\r\n\t\t\t\treturn this.origin.distanceTo( point );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tv1.copy( this.direction ).multiplyScalar( directionDistance ).add( this.origin );\r\n\r\n\t\t\treturn v1.distanceTo( point );\r\n\r\n\t\t};\r\n\r\n\t}(),\r\n\r\n\tdistanceSqToSegment: function () {\r\n\r\n\t\tvar segCenter = new THREE.Vector3();\r\n\t\tvar segDir = new THREE.Vector3();\r\n\t\tvar diff = new THREE.Vector3();\r\n\r\n\t\treturn function ( v0, v1, optionalPointOnRay, optionalPointOnSegment ) {\r\n\r\n\t\t\t// from http://www.geometrictools.com/LibMathematics/Distance/Wm5DistRay3Segment3.cpp\r\n\t\t\t// It returns the min distance between the ray and the segment\r\n\t\t\t// defined by v0 and v1\r\n\t\t\t// It can also set two optional targets :\r\n\t\t\t// - The closest point on the ray\r\n\t\t\t// - The closest point on the segment\r\n\r\n\t\t\tsegCenter.copy( v0 ).add( v1 ).multiplyScalar( 0.5 );\r\n\t\t\tsegDir.copy( v1 ).sub( v0 ).normalize();\r\n\t\t\tdiff.copy( this.origin ).sub( segCenter );\r\n\r\n\t\t\tvar segExtent = v0.distanceTo( v1 ) * 0.5;\r\n\t\t\tvar a01 = - this.direction.dot( segDir );\r\n\t\t\tvar b0 = diff.dot( this.direction );\r\n\t\t\tvar b1 = - diff.dot( segDir );\r\n\t\t\tvar c = diff.lengthSq();\r\n\t\t\tvar det = Math.abs( 1 - a01 * a01 );\r\n\t\t\tvar s0, s1, sqrDist, extDet;\r\n\r\n\t\t\tif ( det > 0 ) {\r\n\r\n\t\t\t\t// The ray and segment are not parallel.\r\n\r\n\t\t\t\ts0 = a01 * b1 - b0;\r\n\t\t\t\ts1 = a01 * b0 - b1;\r\n\t\t\t\textDet = segExtent * det;\r\n\r\n\t\t\t\tif ( s0 >= 0 ) {\r\n\r\n\t\t\t\t\tif ( s1 >= - extDet ) {\r\n\r\n\t\t\t\t\t\tif ( s1 <= extDet ) {\r\n\r\n\t\t\t\t\t\t\t// region 0\r\n\t\t\t\t\t\t\t// Minimum at interior points of ray and segment.\r\n\r\n\t\t\t\t\t\t\tvar invDet = 1 / det;\r\n\t\t\t\t\t\t\ts0 *= invDet;\r\n\t\t\t\t\t\t\ts1 *= invDet;\r\n\t\t\t\t\t\t\tsqrDist = s0 * ( s0 + a01 * s1 + 2 * b0 ) + s1 * ( a01 * s0 + s1 + 2 * b1 ) + c;\r\n\r\n\t\t\t\t\t\t} else {\r\n\r\n\t\t\t\t\t\t\t// region 1\r\n\r\n\t\t\t\t\t\t\ts1 = segExtent;\r\n\t\t\t\t\t\t\ts0 = Math.max( 0, - ( a01 * s1 + b0 ) );\r\n\t\t\t\t\t\t\tsqrDist = - s0 * s0 + s1 * ( s1 + 2 * b1 ) + c;\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t} else {\r\n\r\n\t\t\t\t\t\t// region 5\r\n\r\n\t\t\t\t\t\ts1 = - segExtent;\r\n\t\t\t\t\t\ts0 = Math.max( 0, - ( a01 * s1 + b0 ) );\r\n\t\t\t\t\t\tsqrDist = - s0 * s0 + s1 * ( s1 + 2 * b1 ) + c;\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\tif ( s1 <= - extDet ) {\r\n\r\n\t\t\t\t\t\t// region 4\r\n\r\n\t\t\t\t\t\ts0 = Math.max( 0, - ( - a01 * segExtent + b0 ) );\r\n\t\t\t\t\t\ts1 = ( s0 > 0 ) ? - segExtent : Math.min( Math.max( - segExtent, - b1 ), segExtent );\r\n\t\t\t\t\t\tsqrDist = - s0 * s0 + s1 * ( s1 + 2 * b1 ) + c;\r\n\r\n\t\t\t\t\t} else if ( s1 <= extDet ) {\r\n\r\n\t\t\t\t\t\t// region 3\r\n\r\n\t\t\t\t\t\ts0 = 0;\r\n\t\t\t\t\t\ts1 = Math.min( Math.max( - segExtent, - b1 ), segExtent );\r\n\t\t\t\t\t\tsqrDist = s1 * ( s1 + 2 * b1 ) + c;\r\n\r\n\t\t\t\t\t} else {\r\n\r\n\t\t\t\t\t\t// region 2\r\n\r\n\t\t\t\t\t\ts0 = Math.max( 0, - ( a01 * segExtent + b0 ) );\r\n\t\t\t\t\t\ts1 = ( s0 > 0 ) ? segExtent : Math.min( Math.max( - segExtent, - b1 ), segExtent );\r\n\t\t\t\t\t\tsqrDist = - s0 * s0 + s1 * ( s1 + 2 * b1 ) + c;\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\t// Ray and segment are parallel.\r\n\r\n\t\t\t\ts1 = ( a01 > 0 ) ? - segExtent : segExtent;\r\n\t\t\t\ts0 = Math.max( 0, - ( a01 * s1 + b0 ) );\r\n\t\t\t\tsqrDist = - s0 * s0 + s1 * ( s1 + 2 * b1 ) + c;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( optionalPointOnRay ) {\r\n\r\n\t\t\t\toptionalPointOnRay.copy( this.direction ).multiplyScalar( s0 ).add( this.origin );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( optionalPointOnSegment ) {\r\n\r\n\t\t\t\toptionalPointOnSegment.copy( segDir ).multiplyScalar( s1 ).add( segCenter );\r\n\r\n\t\t\t}\r\n\r\n\t\t\treturn sqrDist;\r\n\r\n\t\t};\r\n\r\n\t}(),\r\n\r\n\r\n\tisIntersectionSphere: function ( sphere ) {\r\n\r\n\t\treturn this.distanceToPoint( sphere.center ) <= sphere.radius;\r\n\r\n\t},\r\n\r\n\tintersectSphere: function () {\r\n\r\n\t\t// from http://www.scratchapixel.com/lessons/3d-basic-lessons/lesson-7-intersecting-simple-shapes/ray-sphere-intersection/\r\n\r\n\t\tvar v1 = new THREE.Vector3();\r\n\r\n\t\treturn function ( sphere, optionalTarget ) {\r\n\r\n\t\t\tv1.subVectors( sphere.center, this.origin );\r\n\r\n\t\t\tvar tca = v1.dot( this.direction );\r\n\r\n\t\t\tvar d2 = v1.dot( v1 ) - tca * tca;\r\n\r\n\t\t\tvar radius2 = sphere.radius * sphere.radius;\r\n\r\n\t\t\tif ( d2 > radius2 ) return null;\r\n\r\n\t\t\tvar thc = Math.sqrt( radius2 - d2 );\r\n\r\n\t\t\t// t0 = first intersect point - entrance on front of sphere\r\n\t\t\tvar t0 = tca - thc;\r\n\r\n\t\t\t// t1 = second intersect point - exit point on back of sphere\r\n\t\t\tvar t1 = tca + thc;\r\n\r\n\t\t\t// test to see if both t0 and t1 are behind the ray - if so, return null\r\n\t\t\tif ( t0 < 0 && t1 < 0 ) return null;\r\n\r\n\t\t\t// test to see if t0 is behind the ray:\r\n\t\t\t// if it is, the ray is inside the sphere, so return the second exit point scaled by t1,\r\n\t\t\t// in order to always return an intersect point that is in front of the ray.\r\n\t\t\tif ( t0 < 0 ) return this.at( t1, optionalTarget );\r\n\r\n\t\t\t// else t0 is in front of the ray, so return the first collision point scaled by t0 \r\n\t\t\treturn this.at( t0, optionalTarget );\r\n\r\n\t\t}\r\n\r\n\t}(),\r\n\r\n\tisIntersectionPlane: function ( plane ) {\r\n\r\n\t\t// check if the ray lies on the plane first\r\n\r\n\t\tvar distToPoint = plane.distanceToPoint( this.origin );\r\n\r\n\t\tif ( distToPoint === 0 ) {\r\n\r\n\t\t\treturn true;\r\n\r\n\t\t}\r\n\r\n\t\tvar denominator = plane.normal.dot( this.direction );\r\n\r\n\t\tif ( denominator * distToPoint < 0 ) {\r\n\r\n\t\t\treturn true;\r\n\r\n\t\t}\r\n\r\n\t\t// ray origin is behind the plane (and is pointing behind it)\r\n\r\n\t\treturn false;\r\n\r\n\t},\r\n\r\n\tdistanceToPlane: function ( plane ) {\r\n\r\n\t\tvar denominator = plane.normal.dot( this.direction );\r\n\t\tif ( denominator == 0 ) {\r\n\r\n\t\t\t// line is coplanar, return origin\r\n\t\t\tif ( plane.distanceToPoint( this.origin ) == 0 ) {\r\n\r\n\t\t\t\treturn 0;\r\n\r\n\t\t\t}\r\n\r\n\t\t\t// Null is preferable to undefined since undefined means.... it is undefined\r\n\r\n\t\t\treturn null;\r\n\r\n\t\t}\r\n\r\n\t\tvar t = - ( this.origin.dot( plane.normal ) + plane.constant ) / denominator;\r\n\r\n\t\t// Return if the ray never intersects the plane\r\n\r\n\t\treturn t >= 0 ? t : null;\r\n\r\n\t},\r\n\r\n\tintersectPlane: function ( plane, optionalTarget ) {\r\n\r\n\t\tvar t = this.distanceToPlane( plane );\r\n\r\n\t\tif ( t === null ) {\r\n\r\n\t\t\treturn null;\r\n\t\t}\r\n\r\n\t\treturn this.at( t, optionalTarget );\r\n\r\n\t},\r\n\r\n\tisIntersectionBox: function () {\r\n\r\n\t\tvar v = new THREE.Vector3();\r\n\r\n\t\treturn function ( box ) {\r\n\r\n\t\t\treturn this.intersectBox( box, v ) !== null;\r\n\r\n\t\t};\r\n\r\n\t}(),\r\n\r\n\tintersectBox: function ( box, optionalTarget ) {\r\n\r\n\t\t// http://www.scratchapixel.com/lessons/3d-basic-lessons/lesson-7-intersecting-simple-shapes/ray-box-intersection/\r\n\r\n\t\tvar tmin,tmax,tymin,tymax,tzmin,tzmax;\r\n\r\n\t\tvar invdirx = 1 / this.direction.x,\r\n\t\t\tinvdiry = 1 / this.direction.y,\r\n\t\t\tinvdirz = 1 / this.direction.z;\r\n\r\n\t\tvar origin = this.origin;\r\n\r\n\t\tif ( invdirx >= 0 ) {\r\n\r\n\t\t\ttmin = ( box.min.x - origin.x ) * invdirx;\r\n\t\t\ttmax = ( box.max.x - origin.x ) * invdirx;\r\n\r\n\t\t} else {\r\n\r\n\t\t\ttmin = ( box.max.x - origin.x ) * invdirx;\r\n\t\t\ttmax = ( box.min.x - origin.x ) * invdirx;\r\n\t\t}\r\n\r\n\t\tif ( invdiry >= 0 ) {\r\n\r\n\t\t\ttymin = ( box.min.y - origin.y ) * invdiry;\r\n\t\t\ttymax = ( box.max.y - origin.y ) * invdiry;\r\n\r\n\t\t} else {\r\n\r\n\t\t\ttymin = ( box.max.y - origin.y ) * invdiry;\r\n\t\t\ttymax = ( box.min.y - origin.y ) * invdiry;\r\n\t\t}\r\n\r\n\t\tif ( ( tmin > tymax ) || ( tymin > tmax ) ) return null;\r\n\r\n\t\t// These lines also handle the case where tmin or tmax is NaN\r\n\t\t// (result of 0 * Infinity). x !== x returns true if x is NaN\r\n\r\n\t\tif ( tymin > tmin || tmin !== tmin ) tmin = tymin;\r\n\r\n\t\tif ( tymax < tmax || tmax !== tmax ) tmax = tymax;\r\n\r\n\t\tif ( invdirz >= 0 ) {\r\n\r\n\t\t\ttzmin = ( box.min.z - origin.z ) * invdirz;\r\n\t\t\ttzmax = ( box.max.z - origin.z ) * invdirz;\r\n\r\n\t\t} else {\r\n\r\n\t\t\ttzmin = ( box.max.z - origin.z ) * invdirz;\r\n\t\t\ttzmax = ( box.min.z - origin.z ) * invdirz;\r\n\t\t}\r\n\r\n\t\tif ( ( tmin > tzmax ) || ( tzmin > tmax ) ) return null;\r\n\r\n\t\tif ( tzmin > tmin || tmin !== tmin ) tmin = tzmin;\r\n\r\n\t\tif ( tzmax < tmax || tmax !== tmax ) tmax = tzmax;\r\n\r\n\t\t//return point closest to the ray (positive side)\r\n\r\n\t\tif ( tmax < 0 ) return null;\r\n\r\n\t\treturn this.at( tmin >= 0 ? tmin : tmax, optionalTarget );\r\n\r\n\t},\r\n\r\n\tintersectTriangle: function () {\r\n\r\n\t\t// Compute the offset origin, edges, and normal.\r\n\t\tvar diff = new THREE.Vector3();\r\n\t\tvar edge1 = new THREE.Vector3();\r\n\t\tvar edge2 = new THREE.Vector3();\r\n\t\tvar normal = new THREE.Vector3();\r\n\r\n\t\treturn function ( a, b, c, backfaceCulling, optionalTarget ) {\r\n\r\n\t\t\t// from http://www.geometrictools.com/LibMathematics/Intersection/Wm5IntrRay3Triangle3.cpp\r\n\r\n\t\t\tedge1.subVectors( b, a );\r\n\t\t\tedge2.subVectors( c, a );\r\n\t\t\tnormal.crossVectors( edge1, edge2 );\r\n\r\n\t\t\t// Solve Q + t*D = b1*E1 + b2*E2 (Q = kDiff, D = ray direction,\r\n\t\t\t// E1 = kEdge1, E2 = kEdge2, N = Cross(E1,E2)) by\r\n\t\t\t// |Dot(D,N)|*b1 = sign(Dot(D,N))*Dot(D,Cross(Q,E2))\r\n\t\t\t// |Dot(D,N)|*b2 = sign(Dot(D,N))*Dot(D,Cross(E1,Q))\r\n\t\t\t// |Dot(D,N)|*t = -sign(Dot(D,N))*Dot(Q,N)\r\n\t\t\tvar DdN = this.direction.dot( normal );\r\n\t\t\tvar sign;\r\n\r\n\t\t\tif ( DdN > 0 ) {\r\n\r\n\t\t\t\tif ( backfaceCulling ) return null;\r\n\t\t\t\tsign = 1;\r\n\r\n\t\t\t} else if ( DdN < 0 ) {\r\n\r\n\t\t\t\tsign = - 1;\r\n\t\t\t\tDdN = - DdN;\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\treturn null;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tdiff.subVectors( this.origin, a );\r\n\t\t\tvar DdQxE2 = sign * this.direction.dot( edge2.crossVectors( diff, edge2 ) );\r\n\r\n\t\t\t// b1 < 0, no intersection\r\n\t\t\tif ( DdQxE2 < 0 ) {\r\n\r\n\t\t\t\treturn null;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tvar DdE1xQ = sign * this.direction.dot( edge1.cross( diff ) );\r\n\r\n\t\t\t// b2 < 0, no intersection\r\n\t\t\tif ( DdE1xQ < 0 ) {\r\n\r\n\t\t\t\treturn null;\r\n\r\n\t\t\t}\r\n\r\n\t\t\t// b1+b2 > 1, no intersection\r\n\t\t\tif ( DdQxE2 + DdE1xQ > DdN ) {\r\n\r\n\t\t\t\treturn null;\r\n\r\n\t\t\t}\r\n\r\n\t\t\t// Line intersects triangle, check if ray does.\r\n\t\t\tvar QdN = - sign * diff.dot( normal );\r\n\r\n\t\t\t// t < 0, no intersection\r\n\t\t\tif ( QdN < 0 ) {\r\n\r\n\t\t\t\treturn null;\r\n\r\n\t\t\t}\r\n\r\n\t\t\t// Ray intersects triangle.\r\n\t\t\treturn this.at( QdN / DdN, optionalTarget );\r\n\r\n\t\t};\r\n\r\n\t}(),\r\n\r\n\tapplyMatrix4: function ( matrix4 ) {\r\n\r\n\t\tthis.direction.add( this.origin ).applyMatrix4( matrix4 );\r\n\t\tthis.origin.applyMatrix4( matrix4 );\r\n\t\tthis.direction.sub( this.origin );\r\n\t\tthis.direction.normalize();\r\n\r\n\t\treturn this;\r\n\t},\r\n\r\n\tequals: function ( ray ) {\r\n\r\n\t\treturn ray.origin.equals( this.origin ) && ray.direction.equals( this.direction );\r\n\r\n\t},\r\n\r\n\tclone: function () {\r\n\r\n\t\treturn new THREE.Ray().copy( this );\r\n\r\n\t}\r\n\r\n};\r\n\r\n// File:src/math/Sphere.js\r\n\r\n/**\r\n * @author bhouston / http://exocortex.com\r\n * @author mrdoob / http://mrdoob.com/\r\n */\r\n\r\nTHREE.Sphere = function ( center, radius ) {\r\n\r\n\tthis.center = ( center !== undefined ) ? center : new THREE.Vector3();\r\n\tthis.radius = ( radius !== undefined ) ? radius : 0;\r\n\r\n};\r\n\r\nTHREE.Sphere.prototype = {\r\n\r\n\tconstructor: THREE.Sphere,\r\n\r\n\tset: function ( center, radius ) {\r\n\r\n\t\tthis.center.copy( center );\r\n\t\tthis.radius = radius;\r\n\r\n\t\treturn this;\r\n\t},\r\n\r\n\tsetFromPoints: function () {\r\n\r\n\t\tvar box = new THREE.Box3();\r\n\r\n\t\treturn function ( points, optionalCenter ) {\r\n\r\n\t\t\tvar center = this.center;\r\n\r\n\t\t\tif ( optionalCenter !== undefined ) {\r\n\r\n\t\t\t\tcenter.copy( optionalCenter );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tbox.setFromPoints( points ).center( center );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tvar maxRadiusSq = 0;\r\n\r\n\t\t\tfor ( var i = 0, il = points.length; i < il; i ++ ) {\r\n\r\n\t\t\t\tmaxRadiusSq = Math.max( maxRadiusSq, center.distanceToSquared( points[ i ] ) );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tthis.radius = Math.sqrt( maxRadiusSq );\r\n\r\n\t\t\treturn this;\r\n\r\n\t\t};\r\n\r\n\t}(),\r\n\r\n\tcopy: function ( sphere ) {\r\n\r\n\t\tthis.center.copy( sphere.center );\r\n\t\tthis.radius = sphere.radius;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tempty: function () {\r\n\r\n\t\treturn ( this.radius <= 0 );\r\n\r\n\t},\r\n\r\n\tcontainsPoint: function ( point ) {\r\n\r\n\t\treturn ( point.distanceToSquared( this.center ) <= ( this.radius * this.radius ) );\r\n\r\n\t},\r\n\r\n\tdistanceToPoint: function ( point ) {\r\n\r\n\t\treturn ( point.distanceTo( this.center ) - this.radius );\r\n\r\n\t},\r\n\r\n\tintersectsSphere: function ( sphere ) {\r\n\r\n\t\tvar radiusSum = this.radius + sphere.radius;\r\n\r\n\t\treturn sphere.center.distanceToSquared( this.center ) <= ( radiusSum * radiusSum );\r\n\r\n\t},\r\n\r\n\tclampPoint: function ( point, optionalTarget ) {\r\n\r\n\t\tvar deltaLengthSq = this.center.distanceToSquared( point );\r\n\r\n\t\tvar result = optionalTarget || new THREE.Vector3();\r\n\t\tresult.copy( point );\r\n\r\n\t\tif ( deltaLengthSq > ( this.radius * this.radius ) ) {\r\n\r\n\t\t\tresult.sub( this.center ).normalize();\r\n\t\t\tresult.multiplyScalar( this.radius ).add( this.center );\r\n\r\n\t\t}\r\n\r\n\t\treturn result;\r\n\r\n\t},\r\n\r\n\tgetBoundingBox: function ( optionalTarget ) {\r\n\r\n\t\tvar box = optionalTarget || new THREE.Box3();\r\n\r\n\t\tbox.set( this.center, this.center );\r\n\t\tbox.expandByScalar( this.radius );\r\n\r\n\t\treturn box;\r\n\r\n\t},\r\n\r\n\tapplyMatrix4: function ( matrix ) {\r\n\r\n\t\tthis.center.applyMatrix4( matrix );\r\n\t\tthis.radius = this.radius * matrix.getMaxScaleOnAxis();\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\ttranslate: function ( offset ) {\r\n\r\n\t\tthis.center.add( offset );\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tequals: function ( sphere ) {\r\n\r\n\t\treturn sphere.center.equals( this.center ) && ( sphere.radius === this.radius );\r\n\r\n\t},\r\n\r\n\tclone: function () {\r\n\r\n\t\treturn new THREE.Sphere().copy( this );\r\n\r\n\t}\r\n\r\n};\r\n\r\n// File:src/math/Frustum.js\r\n\r\n/**\r\n * @author mrdoob / http://mrdoob.com/\r\n * @author alteredq / http://alteredqualia.com/\r\n * @author bhouston / http://exocortex.com\r\n */\r\n\r\nTHREE.Frustum = function ( p0, p1, p2, p3, p4, p5 ) {\r\n\r\n\tthis.planes = [\r\n\r\n\t\t( p0 !== undefined ) ? p0 : new THREE.Plane(),\r\n\t\t( p1 !== undefined ) ? p1 : new THREE.Plane(),\r\n\t\t( p2 !== undefined ) ? p2 : new THREE.Plane(),\r\n\t\t( p3 !== undefined ) ? p3 : new THREE.Plane(),\r\n\t\t( p4 !== undefined ) ? p4 : new THREE.Plane(),\r\n\t\t( p5 !== undefined ) ? p5 : new THREE.Plane()\r\n\r\n\t];\r\n\r\n};\r\n\r\nTHREE.Frustum.prototype = {\r\n\r\n\tconstructor: THREE.Frustum,\r\n\r\n\tset: function ( p0, p1, p2, p3, p4, p5 ) {\r\n\r\n\t\tvar planes = this.planes;\r\n\r\n\t\tplanes[ 0 ].copy( p0 );\r\n\t\tplanes[ 1 ].copy( p1 );\r\n\t\tplanes[ 2 ].copy( p2 );\r\n\t\tplanes[ 3 ].copy( p3 );\r\n\t\tplanes[ 4 ].copy( p4 );\r\n\t\tplanes[ 5 ].copy( p5 );\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tcopy: function ( frustum ) {\r\n\r\n\t\tvar planes = this.planes;\r\n\r\n\t\tfor ( var i = 0; i < 6; i ++ ) {\r\n\r\n\t\t\tplanes[ i ].copy( frustum.planes[ i ] );\r\n\r\n\t\t}\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tsetFromMatrix: function ( m ) {\r\n\r\n\t\tvar planes = this.planes;\r\n\t\tvar me = m.elements;\r\n\t\tvar me0 = me[ 0 ], me1 = me[ 1 ], me2 = me[ 2 ], me3 = me[ 3 ];\r\n\t\tvar me4 = me[ 4 ], me5 = me[ 5 ], me6 = me[ 6 ], me7 = me[ 7 ];\r\n\t\tvar me8 = me[ 8 ], me9 = me[ 9 ], me10 = me[ 10 ], me11 = me[ 11 ];\r\n\t\tvar me12 = me[ 12 ], me13 = me[ 13 ], me14 = me[ 14 ], me15 = me[ 15 ];\r\n\r\n\t\tplanes[ 0 ].setComponents( me3 - me0, me7 - me4, me11 - me8, me15 - me12 ).normalize();\r\n\t\tplanes[ 1 ].setComponents( me3 + me0, me7 + me4, me11 + me8, me15 + me12 ).normalize();\r\n\t\tplanes[ 2 ].setComponents( me3 + me1, me7 + me5, me11 + me9, me15 + me13 ).normalize();\r\n\t\tplanes[ 3 ].setComponents( me3 - me1, me7 - me5, me11 - me9, me15 - me13 ).normalize();\r\n\t\tplanes[ 4 ].setComponents( me3 - me2, me7 - me6, me11 - me10, me15 - me14 ).normalize();\r\n\t\tplanes[ 5 ].setComponents( me3 + me2, me7 + me6, me11 + me10, me15 + me14 ).normalize();\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tintersectsObject: function () {\r\n\r\n\t\tvar sphere = new THREE.Sphere();\r\n\r\n\t\treturn function ( object ) {\r\n\r\n\t\t\tvar geometry = object.geometry;\r\n\r\n\t\t\tif ( geometry.boundingSphere === null ) geometry.computeBoundingSphere();\r\n\r\n\t\t\tsphere.copy( geometry.boundingSphere );\r\n\t\t\tsphere.applyMatrix4( object.matrixWorld );\r\n\r\n\t\t\treturn this.intersectsSphere( sphere );\r\n\r\n\t\t};\r\n\r\n\t}(),\r\n\r\n\tintersectsSphere: function ( sphere ) {\r\n\r\n\t\tvar planes = this.planes;\r\n\t\tvar center = sphere.center;\r\n\t\tvar negRadius = - sphere.radius;\r\n\r\n\t\tfor ( var i = 0; i < 6; i ++ ) {\r\n\r\n\t\t\tvar distance = planes[ i ].distanceToPoint( center );\r\n\r\n\t\t\tif ( distance < negRadius ) {\r\n\r\n\t\t\t\treturn false;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn true;\r\n\r\n\t},\r\n\r\n\tintersectsBox: function () {\r\n\r\n\t\tvar p1 = new THREE.Vector3(),\r\n\t\t\tp2 = new THREE.Vector3();\r\n\r\n\t\treturn function ( box ) {\r\n\r\n\t\t\tvar planes = this.planes;\r\n\r\n\t\t\tfor ( var i = 0; i < 6 ; i ++ ) {\r\n\r\n\t\t\t\tvar plane = planes[ i ];\r\n\r\n\t\t\t\tp1.x = plane.normal.x > 0 ? box.min.x : box.max.x;\r\n\t\t\t\tp2.x = plane.normal.x > 0 ? box.max.x : box.min.x;\r\n\t\t\t\tp1.y = plane.normal.y > 0 ? box.min.y : box.max.y;\r\n\t\t\t\tp2.y = plane.normal.y > 0 ? box.max.y : box.min.y;\r\n\t\t\t\tp1.z = plane.normal.z > 0 ? box.min.z : box.max.z;\r\n\t\t\t\tp2.z = plane.normal.z > 0 ? box.max.z : box.min.z;\r\n\r\n\t\t\t\tvar d1 = plane.distanceToPoint( p1 );\r\n\t\t\t\tvar d2 = plane.distanceToPoint( p2 );\r\n\r\n\t\t\t\t// if both outside plane, no intersection\r\n\r\n\t\t\t\tif ( d1 < 0 && d2 < 0 ) {\r\n\r\n\t\t\t\t\treturn false;\r\n\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\treturn true;\r\n\t\t};\r\n\r\n\t}(),\r\n\r\n\r\n\tcontainsPoint: function ( point ) {\r\n\r\n\t\tvar planes = this.planes;\r\n\r\n\t\tfor ( var i = 0; i < 6; i ++ ) {\r\n\r\n\t\t\tif ( planes[ i ].distanceToPoint( point ) < 0 ) {\r\n\r\n\t\t\t\treturn false;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn true;\r\n\r\n\t},\r\n\r\n\tclone: function () {\r\n\r\n\t\treturn new THREE.Frustum().copy( this );\r\n\r\n\t}\r\n\r\n};\r\n\r\n// File:src/math/Plane.js\r\n\r\n/**\r\n * @author bhouston / http://exocortex.com\r\n */\r\n\r\nTHREE.Plane = function ( normal, constant ) {\r\n\r\n\tthis.normal = ( normal !== undefined ) ? normal : new THREE.Vector3( 1, 0, 0 );\r\n\tthis.constant = ( constant !== undefined ) ? constant : 0;\r\n\r\n};\r\n\r\nTHREE.Plane.prototype = {\r\n\r\n\tconstructor: THREE.Plane,\r\n\r\n\tset: function ( normal, constant ) {\r\n\r\n\t\tthis.normal.copy( normal );\r\n\t\tthis.constant = constant;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tsetComponents: function ( x, y, z, w ) {\r\n\r\n\t\tthis.normal.set( x, y, z );\r\n\t\tthis.constant = w;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tsetFromNormalAndCoplanarPoint: function ( normal, point ) {\r\n\r\n\t\tthis.normal.copy( normal );\r\n\t\tthis.constant = - point.dot( this.normal );\t// must be this.normal, not normal, as this.normal is normalized\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tsetFromCoplanarPoints: function () {\r\n\r\n\t\tvar v1 = new THREE.Vector3();\r\n\t\tvar v2 = new THREE.Vector3();\r\n\r\n\t\treturn function ( a, b, c ) {\r\n\r\n\t\t\tvar normal = v1.subVectors( c, b ).cross( v2.subVectors( a, b ) ).normalize();\r\n\r\n\t\t\t// Q: should an error be thrown if normal is zero (e.g. degenerate plane)?\r\n\r\n\t\t\tthis.setFromNormalAndCoplanarPoint( normal, a );\r\n\r\n\t\t\treturn this;\r\n\r\n\t\t};\r\n\r\n\t}(),\r\n\r\n\r\n\tcopy: function ( plane ) {\r\n\r\n\t\tthis.normal.copy( plane.normal );\r\n\t\tthis.constant = plane.constant;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tnormalize: function () {\r\n\r\n\t\t// Note: will lead to a divide by zero if the plane is invalid.\r\n\r\n\t\tvar inverseNormalLength = 1.0 / this.normal.length();\r\n\t\tthis.normal.multiplyScalar( inverseNormalLength );\r\n\t\tthis.constant *= inverseNormalLength;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tnegate: function () {\r\n\r\n\t\tthis.constant *= - 1;\r\n\t\tthis.normal.negate();\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tdistanceToPoint: function ( point ) {\r\n\r\n\t\treturn this.normal.dot( point ) + this.constant;\r\n\r\n\t},\r\n\r\n\tdistanceToSphere: function ( sphere ) {\r\n\r\n\t\treturn this.distanceToPoint( sphere.center ) - sphere.radius;\r\n\r\n\t},\r\n\r\n\tprojectPoint: function ( point, optionalTarget ) {\r\n\r\n\t\treturn this.orthoPoint( point, optionalTarget ).sub( point ).negate();\r\n\r\n\t},\r\n\r\n\torthoPoint: function ( point, optionalTarget ) {\r\n\r\n\t\tvar perpendicularMagnitude = this.distanceToPoint( point );\r\n\r\n\t\tvar result = optionalTarget || new THREE.Vector3();\r\n\t\treturn result.copy( this.normal ).multiplyScalar( perpendicularMagnitude );\r\n\r\n\t},\r\n\r\n\tisIntersectionLine: function ( line ) {\r\n\r\n\t\t// Note: this tests if a line intersects the plane, not whether it (or its end-points) are coplanar with it.\r\n\r\n\t\tvar startSign = this.distanceToPoint( line.start );\r\n\t\tvar endSign = this.distanceToPoint( line.end );\r\n\r\n\t\treturn ( startSign < 0 && endSign > 0 ) || ( endSign < 0 && startSign > 0 );\r\n\r\n\t},\r\n\r\n\tintersectLine: function () {\r\n\r\n\t\tvar v1 = new THREE.Vector3();\r\n\r\n\t\treturn function ( line, optionalTarget ) {\r\n\r\n\t\t\tvar result = optionalTarget || new THREE.Vector3();\r\n\r\n\t\t\tvar direction = line.delta( v1 );\r\n\r\n\t\t\tvar denominator = this.normal.dot( direction );\r\n\r\n\t\t\tif ( denominator == 0 ) {\r\n\r\n\t\t\t\t// line is coplanar, return origin\r\n\t\t\t\tif ( this.distanceToPoint( line.start ) == 0 ) {\r\n\r\n\t\t\t\t\treturn result.copy( line.start );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\t// Unsure if this is the correct method to handle this case.\r\n\t\t\t\treturn undefined;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tvar t = - ( line.start.dot( this.normal ) + this.constant ) / denominator;\r\n\r\n\t\t\tif ( t < 0 || t > 1 ) {\r\n\r\n\t\t\t\treturn undefined;\r\n\r\n\t\t\t}\r\n\r\n\t\t\treturn result.copy( direction ).multiplyScalar( t ).add( line.start );\r\n\r\n\t\t};\r\n\r\n\t}(),\r\n\r\n\r\n\tcoplanarPoint: function ( optionalTarget ) {\r\n\r\n\t\tvar result = optionalTarget || new THREE.Vector3();\r\n\t\treturn result.copy( this.normal ).multiplyScalar( - this.constant );\r\n\r\n\t},\r\n\r\n\tapplyMatrix4: function () {\r\n\r\n\t\tvar v1 = new THREE.Vector3();\r\n\t\tvar v2 = new THREE.Vector3();\r\n\t\tvar m1 = new THREE.Matrix3();\r\n\r\n\t\treturn function ( matrix, optionalNormalMatrix ) {\r\n\r\n\t\t\t// compute new normal based on theory here:\r\n\t\t\t// http://www.songho.ca/opengl/gl_normaltransform.html\r\n\t\t\tvar normalMatrix = optionalNormalMatrix || m1.getNormalMatrix( matrix );\r\n\t\t\tvar newNormal = v1.copy( this.normal ).applyMatrix3( normalMatrix );\r\n\r\n\t\t\tvar newCoplanarPoint = this.coplanarPoint( v2 );\r\n\t\t\tnewCoplanarPoint.applyMatrix4( matrix );\r\n\r\n\t\t\tthis.setFromNormalAndCoplanarPoint( newNormal, newCoplanarPoint );\r\n\r\n\t\t\treturn this;\r\n\r\n\t\t};\r\n\r\n\t}(),\r\n\r\n\ttranslate: function ( offset ) {\r\n\r\n\t\tthis.constant = this.constant - offset.dot( this.normal );\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tequals: function ( plane ) {\r\n\r\n\t\treturn plane.normal.equals( this.normal ) && ( plane.constant == this.constant );\r\n\r\n\t},\r\n\r\n\tclone: function () {\r\n\r\n\t\treturn new THREE.Plane().copy( this );\r\n\r\n\t}\r\n\r\n};\r\n\r\n// File:src/math/Math.js\r\n\r\n/**\r\n * @author alteredq / http://alteredqualia.com/\r\n * @author mrdoob / http://mrdoob.com/\r\n */\r\n\r\nTHREE.Math = {\r\n\r\n\tgenerateUUID: function () {\r\n\r\n\t\t// http://www.broofa.com/Tools/Math.uuid.htm\r\n\r\n\t\tvar chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'.split( '' );\r\n\t\tvar uuid = new Array( 36 );\r\n\t\tvar rnd = 0, r;\r\n\r\n\t\treturn function () {\r\n\r\n\t\t\tfor ( var i = 0; i < 36; i ++ ) {\r\n\r\n\t\t\t\tif ( i == 8 || i == 13 || i == 18 || i == 23 ) {\r\n\r\n\t\t\t\t\tuuid[ i ] = '-';\r\n\r\n\t\t\t\t} else if ( i == 14 ) {\r\n\r\n\t\t\t\t\tuuid[ i ] = '4';\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\tif ( rnd <= 0x02 ) rnd = 0x2000000 + ( Math.random() * 0x1000000 ) | 0;\r\n\t\t\t\t\tr = rnd & 0xf;\r\n\t\t\t\t\trnd = rnd >> 4;\r\n\t\t\t\t\tuuid[ i ] = chars[ ( i == 19 ) ? ( r & 0x3 ) | 0x8 : r ];\r\n\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\treturn uuid.join( '' );\r\n\r\n\t\t};\r\n\r\n\t}(),\r\n\r\n\t// Clamp value to range \r\n\r\n\tclamp: function ( x, a, b ) {\r\n\r\n\t\treturn ( x < a ) ? a : ( ( x > b ) ? b : x );\r\n\r\n\t},\r\n\r\n\t// Clamp value to range to range \r\n\r\n\tmapLinear: function ( x, a1, a2, b1, b2 ) {\r\n\r\n\t\treturn b1 + ( x - a1 ) * ( b2 - b1 ) / ( a2 - a1 );\r\n\r\n\t},\r\n\r\n\t// http://en.wikipedia.org/wiki/Smoothstep\r\n\r\n\tsmoothstep: function ( x, min, max ) {\r\n\r\n\t\tif ( x <= min ) return 0;\r\n\t\tif ( x >= max ) return 1;\r\n\r\n\t\tx = ( x - min ) / ( max - min );\r\n\r\n\t\treturn x * x * ( 3 - 2 * x );\r\n\r\n\t},\r\n\r\n\tsmootherstep: function ( x, min, max ) {\r\n\r\n\t\tif ( x <= min ) return 0;\r\n\t\tif ( x >= max ) return 1;\r\n\r\n\t\tx = ( x - min ) / ( max - min );\r\n\r\n\t\treturn x * x * x * ( x * ( x * 6 - 15 ) + 10 );\r\n\r\n\t},\r\n\r\n\t// Random float from <0, 1> with 16 bits of randomness\r\n\t// (standard Math.random() creates repetitive patterns when applied over larger space)\r\n\r\n\trandom16: function () {\r\n\r\n\t\treturn ( 65280 * Math.random() + 255 * Math.random() ) / 65535;\r\n\r\n\t},\r\n\r\n\t// Random integer from interval\r\n\r\n\trandInt: function ( low, high ) {\r\n\r\n\t\treturn Math.floor( this.randFloat( low, high ) );\r\n\r\n\t},\r\n\r\n\t// Random float from interval\r\n\r\n\trandFloat: function ( low, high ) {\r\n\r\n\t\treturn low + Math.random() * ( high - low );\r\n\r\n\t},\r\n\r\n\t// Random float from <-range/2, range/2> interval\r\n\r\n\trandFloatSpread: function ( range ) {\r\n\r\n\t\treturn range * ( 0.5 - Math.random() );\r\n\r\n\t},\r\n\r\n\tdegToRad: function () {\r\n\r\n\t\tvar degreeToRadiansFactor = Math.PI / 180;\r\n\r\n\t\treturn function ( degrees ) {\r\n\r\n\t\t\treturn degrees * degreeToRadiansFactor;\r\n\r\n\t\t};\r\n\r\n\t}(),\r\n\r\n\tradToDeg: function () {\r\n\r\n\t\tvar radianToDegreesFactor = 180 / Math.PI;\r\n\r\n\t\treturn function ( radians ) {\r\n\r\n\t\t\treturn radians * radianToDegreesFactor;\r\n\r\n\t\t};\r\n\r\n\t}(),\r\n\r\n\tisPowerOfTwo: function ( value ) {\r\n\r\n\t\treturn ( value & ( value - 1 ) ) === 0 && value !== 0;\r\n\r\n\t},\r\n\r\n\tnextPowerOfTwo: function ( value ) {\r\n\r\n\t\tvalue --;\r\n\t\tvalue |= value >> 1;\r\n\t\tvalue |= value >> 2;\r\n\t\tvalue |= value >> 4;\r\n\t\tvalue |= value >> 8;\r\n\t\tvalue |= value >> 16;\r\n\t\tvalue ++;\r\n\r\n\t\treturn value;\r\n\r\n\t}\r\n\r\n};\r\n\r\n// File:src/math/Spline.js\r\n\r\n/**\r\n * Spline from Tween.js, slightly optimized (and trashed)\r\n * http://sole.github.com/tween.js/examples/05_spline.html\r\n *\r\n * @author mrdoob / http://mrdoob.com/\r\n * @author alteredq / http://alteredqualia.com/\r\n */\r\n\r\nTHREE.Spline = function ( points ) {\r\n\r\n\tthis.points = points;\r\n\r\n\tvar c = [], v3 = { x: 0, y: 0, z: 0 },\r\n\tpoint, intPoint, weight, w2, w3,\r\n\tpa, pb, pc, pd;\r\n\r\n\tthis.initFromArray = function ( a ) {\r\n\r\n\t\tthis.points = [];\r\n\r\n\t\tfor ( var i = 0; i < a.length; i ++ ) {\r\n\r\n\t\t\tthis.points[ i ] = { x: a[ i ][ 0 ], y: a[ i ][ 1 ], z: a[ i ][ 2 ] };\r\n\r\n\t\t}\r\n\r\n\t};\r\n\r\n\tthis.getPoint = function ( k ) {\r\n\r\n\t\tpoint = ( this.points.length - 1 ) * k;\r\n\t\tintPoint = Math.floor( point );\r\n\t\tweight = point - intPoint;\r\n\r\n\t\tc[ 0 ] = intPoint === 0 ? intPoint : intPoint - 1;\r\n\t\tc[ 1 ] = intPoint;\r\n\t\tc[ 2 ] = intPoint > this.points.length - 2 ? this.points.length - 1 : intPoint + 1;\r\n\t\tc[ 3 ] = intPoint > this.points.length - 3 ? this.points.length - 1 : intPoint + 2;\r\n\r\n\t\tpa = this.points[ c[ 0 ] ];\r\n\t\tpb = this.points[ c[ 1 ] ];\r\n\t\tpc = this.points[ c[ 2 ] ];\r\n\t\tpd = this.points[ c[ 3 ] ];\r\n\r\n\t\tw2 = weight * weight;\r\n\t\tw3 = weight * w2;\r\n\r\n\t\tv3.x = interpolate( pa.x, pb.x, pc.x, pd.x, weight, w2, w3 );\r\n\t\tv3.y = interpolate( pa.y, pb.y, pc.y, pd.y, weight, w2, w3 );\r\n\t\tv3.z = interpolate( pa.z, pb.z, pc.z, pd.z, weight, w2, w3 );\r\n\r\n\t\treturn v3;\r\n\r\n\t};\r\n\r\n\tthis.getControlPointsArray = function () {\r\n\r\n\t\tvar i, p, l = this.points.length,\r\n\t\t\tcoords = [];\r\n\r\n\t\tfor ( i = 0; i < l; i ++ ) {\r\n\r\n\t\t\tp = this.points[ i ];\r\n\t\t\tcoords[ i ] = [ p.x, p.y, p.z ];\r\n\r\n\t\t}\r\n\r\n\t\treturn coords;\r\n\r\n\t};\r\n\r\n\t// approximate length by summing linear segments\r\n\r\n\tthis.getLength = function ( nSubDivisions ) {\r\n\r\n\t\tvar i, index, nSamples, position,\r\n\t\t\tpoint = 0, intPoint = 0, oldIntPoint = 0,\r\n\t\t\toldPosition = new THREE.Vector3(),\r\n\t\t\ttmpVec = new THREE.Vector3(),\r\n\t\t\tchunkLengths = [],\r\n\t\t\ttotalLength = 0;\r\n\r\n\t\t// first point has 0 length\r\n\r\n\t\tchunkLengths[ 0 ] = 0;\r\n\r\n\t\tif ( ! nSubDivisions ) nSubDivisions = 100;\r\n\r\n\t\tnSamples = this.points.length * nSubDivisions;\r\n\r\n\t\toldPosition.copy( this.points[ 0 ] );\r\n\r\n\t\tfor ( i = 1; i < nSamples; i ++ ) {\r\n\r\n\t\t\tindex = i / nSamples;\r\n\r\n\t\t\tposition = this.getPoint( index );\r\n\t\t\ttmpVec.copy( position );\r\n\r\n\t\t\ttotalLength += tmpVec.distanceTo( oldPosition );\r\n\r\n\t\t\toldPosition.copy( position );\r\n\r\n\t\t\tpoint = ( this.points.length - 1 ) * index;\r\n\t\t\tintPoint = Math.floor( point );\r\n\r\n\t\t\tif ( intPoint != oldIntPoint ) {\r\n\r\n\t\t\t\tchunkLengths[ intPoint ] = totalLength;\r\n\t\t\t\toldIntPoint = intPoint;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\t// last point ends with total length\r\n\r\n\t\tchunkLengths[ chunkLengths.length ] = totalLength;\r\n\r\n\t\treturn { chunks: chunkLengths, total: totalLength };\r\n\r\n\t};\r\n\r\n\tthis.reparametrizeByArcLength = function ( samplingCoef ) {\r\n\r\n\t\tvar i, j,\r\n\t\t\tindex, indexCurrent, indexNext,\r\n\t\t\trealDistance,\r\n\t\t\tsampling, position,\r\n\t\t\tnewpoints = [],\r\n\t\t\ttmpVec = new THREE.Vector3(),\r\n\t\t\tsl = this.getLength();\r\n\r\n\t\tnewpoints.push( tmpVec.copy( this.points[ 0 ] ).clone() );\r\n\r\n\t\tfor ( i = 1; i < this.points.length; i ++ ) {\r\n\r\n\t\t\t//tmpVec.copy( this.points[ i - 1 ] );\r\n\t\t\t//linearDistance = tmpVec.distanceTo( this.points[ i ] );\r\n\r\n\t\t\trealDistance = sl.chunks[ i ] - sl.chunks[ i - 1 ];\r\n\r\n\t\t\tsampling = Math.ceil( samplingCoef * realDistance / sl.total );\r\n\r\n\t\t\tindexCurrent = ( i - 1 ) / ( this.points.length - 1 );\r\n\t\t\tindexNext = i / ( this.points.length - 1 );\r\n\r\n\t\t\tfor ( j = 1; j < sampling - 1; j ++ ) {\r\n\r\n\t\t\t\tindex = indexCurrent + j * ( 1 / sampling ) * ( indexNext - indexCurrent );\r\n\r\n\t\t\t\tposition = this.getPoint( index );\r\n\t\t\t\tnewpoints.push( tmpVec.copy( position ).clone() );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tnewpoints.push( tmpVec.copy( this.points[ i ] ).clone() );\r\n\r\n\t\t}\r\n\r\n\t\tthis.points = newpoints;\r\n\r\n\t};\r\n\r\n\t// Catmull-Rom\r\n\r\n\tfunction interpolate( p0, p1, p2, p3, t, t2, t3 ) {\r\n\r\n\t\tvar v0 = ( p2 - p0 ) * 0.5,\r\n\t\t\tv1 = ( p3 - p1 ) * 0.5;\r\n\r\n\t\treturn ( 2 * ( p1 - p2 ) + v0 + v1 ) * t3 + ( - 3 * ( p1 - p2 ) - 2 * v0 - v1 ) * t2 + v0 * t + p1;\r\n\r\n\t};\r\n\r\n};\r\n\r\n// File:src/math/Triangle.js\r\n\r\n/**\r\n * @author bhouston / http://exocortex.com\r\n * @author mrdoob / http://mrdoob.com/\r\n */\r\n\r\nTHREE.Triangle = function ( a, b, c ) {\r\n\r\n\tthis.a = ( a !== undefined ) ? a : new THREE.Vector3();\r\n\tthis.b = ( b !== undefined ) ? b : new THREE.Vector3();\r\n\tthis.c = ( c !== undefined ) ? c : new THREE.Vector3();\r\n\r\n};\r\n\r\nTHREE.Triangle.normal = function () {\r\n\r\n\tvar v0 = new THREE.Vector3();\r\n\r\n\treturn function ( a, b, c, optionalTarget ) {\r\n\r\n\t\tvar result = optionalTarget || new THREE.Vector3();\r\n\r\n\t\tresult.subVectors( c, b );\r\n\t\tv0.subVectors( a, b );\r\n\t\tresult.cross( v0 );\r\n\r\n\t\tvar resultLengthSq = result.lengthSq();\r\n\t\tif ( resultLengthSq > 0 ) {\r\n\r\n\t\t\treturn result.multiplyScalar( 1 / Math.sqrt( resultLengthSq ) );\r\n\r\n\t\t}\r\n\r\n\t\treturn result.set( 0, 0, 0 );\r\n\r\n\t};\r\n\r\n}();\r\n\r\n// static/instance method to calculate barycoordinates\r\n// based on: http://www.blackpawn.com/texts/pointinpoly/default.html\r\nTHREE.Triangle.barycoordFromPoint = function () {\r\n\r\n\tvar v0 = new THREE.Vector3();\r\n\tvar v1 = new THREE.Vector3();\r\n\tvar v2 = new THREE.Vector3();\r\n\r\n\treturn function ( point, a, b, c, optionalTarget ) {\r\n\r\n\t\tv0.subVectors( c, a );\r\n\t\tv1.subVectors( b, a );\r\n\t\tv2.subVectors( point, a );\r\n\r\n\t\tvar dot00 = v0.dot( v0 );\r\n\t\tvar dot01 = v0.dot( v1 );\r\n\t\tvar dot02 = v0.dot( v2 );\r\n\t\tvar dot11 = v1.dot( v1 );\r\n\t\tvar dot12 = v1.dot( v2 );\r\n\r\n\t\tvar denom = ( dot00 * dot11 - dot01 * dot01 );\r\n\r\n\t\tvar result = optionalTarget || new THREE.Vector3();\r\n\r\n\t\t// colinear or singular triangle\r\n\t\tif ( denom == 0 ) {\r\n\t\t\t// arbitrary location outside of triangle?\r\n\t\t\t// not sure if this is the best idea, maybe should be returning undefined\r\n\t\t\treturn result.set( - 2, - 1, - 1 );\r\n\t\t}\r\n\r\n\t\tvar invDenom = 1 / denom;\r\n\t\tvar u = ( dot11 * dot02 - dot01 * dot12 ) * invDenom;\r\n\t\tvar v = ( dot00 * dot12 - dot01 * dot02 ) * invDenom;\r\n\r\n\t\t// barycoordinates must always sum to 1\r\n\t\treturn result.set( 1 - u - v, v, u );\r\n\r\n\t};\r\n\r\n}();\r\n\r\nTHREE.Triangle.containsPoint = function () {\r\n\r\n\tvar v1 = new THREE.Vector3();\r\n\r\n\treturn function ( point, a, b, c ) {\r\n\r\n\t\tvar result = THREE.Triangle.barycoordFromPoint( point, a, b, c, v1 );\r\n\r\n\t\treturn ( result.x >= 0 ) && ( result.y >= 0 ) && ( ( result.x + result.y ) <= 1 );\r\n\r\n\t};\r\n\r\n}();\r\n\r\nTHREE.Triangle.prototype = {\r\n\r\n\tconstructor: THREE.Triangle,\r\n\r\n\tset: function ( a, b, c ) {\r\n\r\n\t\tthis.a.copy( a );\r\n\t\tthis.b.copy( b );\r\n\t\tthis.c.copy( c );\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tsetFromPointsAndIndices: function ( points, i0, i1, i2 ) {\r\n\r\n\t\tthis.a.copy( points[ i0 ] );\r\n\t\tthis.b.copy( points[ i1 ] );\r\n\t\tthis.c.copy( points[ i2 ] );\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tcopy: function ( triangle ) {\r\n\r\n\t\tthis.a.copy( triangle.a );\r\n\t\tthis.b.copy( triangle.b );\r\n\t\tthis.c.copy( triangle.c );\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tarea: function () {\r\n\r\n\t\tvar v0 = new THREE.Vector3();\r\n\t\tvar v1 = new THREE.Vector3();\r\n\r\n\t\treturn function () {\r\n\r\n\t\t\tv0.subVectors( this.c, this.b );\r\n\t\t\tv1.subVectors( this.a, this.b );\r\n\r\n\t\t\treturn v0.cross( v1 ).length() * 0.5;\r\n\r\n\t\t};\r\n\r\n\t}(),\r\n\r\n\tmidpoint: function ( optionalTarget ) {\r\n\r\n\t\tvar result = optionalTarget || new THREE.Vector3();\r\n\t\treturn result.addVectors( this.a, this.b ).add( this.c ).multiplyScalar( 1 / 3 );\r\n\r\n\t},\r\n\r\n\tnormal: function ( optionalTarget ) {\r\n\r\n\t\treturn THREE.Triangle.normal( this.a, this.b, this.c, optionalTarget );\r\n\r\n\t},\r\n\r\n\tplane: function ( optionalTarget ) {\r\n\r\n\t\tvar result = optionalTarget || new THREE.Plane();\r\n\r\n\t\treturn result.setFromCoplanarPoints( this.a, this.b, this.c );\r\n\r\n\t},\r\n\r\n\tbarycoordFromPoint: function ( point, optionalTarget ) {\r\n\r\n\t\treturn THREE.Triangle.barycoordFromPoint( point, this.a, this.b, this.c, optionalTarget );\r\n\r\n\t},\r\n\r\n\tcontainsPoint: function ( point ) {\r\n\r\n\t\treturn THREE.Triangle.containsPoint( point, this.a, this.b, this.c );\r\n\r\n\t},\r\n\r\n\tequals: function ( triangle ) {\r\n\r\n\t\treturn triangle.a.equals( this.a ) && triangle.b.equals( this.b ) && triangle.c.equals( this.c );\r\n\r\n\t},\r\n\r\n\tclone: function () {\r\n\r\n\t\treturn new THREE.Triangle().copy( this );\r\n\r\n\t}\r\n\r\n};\r\n\r\n// File:src/core/Clock.js\r\n\r\n/**\r\n * @author alteredq / http://alteredqualia.com/\r\n */\r\n\r\nTHREE.Clock = function ( autoStart ) {\r\n\r\n\tthis.autoStart = ( autoStart !== undefined ) ? autoStart : true;\r\n\r\n\tthis.startTime = 0;\r\n\tthis.oldTime = 0;\r\n\tthis.elapsedTime = 0;\r\n\r\n\tthis.running = false;\r\n\r\n};\r\n\r\nTHREE.Clock.prototype = {\r\n\r\n\tconstructor: THREE.Clock,\r\n\r\n\tstart: function () {\r\n\r\n\t\tthis.startTime = self.performance !== undefined && self.performance.now !== undefined\r\n\t\t\t\t\t ? self.performance.now()\r\n\t\t\t\t\t : Date.now();\r\n\r\n\t\tthis.oldTime = this.startTime;\r\n\t\tthis.running = true;\r\n\t},\r\n\r\n\tstop: function () {\r\n\r\n\t\tthis.getElapsedTime();\r\n\t\tthis.running = false;\r\n\r\n\t},\r\n\r\n\tgetElapsedTime: function () {\r\n\r\n\t\tthis.getDelta();\r\n\t\treturn this.elapsedTime;\r\n\r\n\t},\r\n\r\n\tgetDelta: function () {\r\n\r\n\t\tvar diff = 0;\r\n\r\n\t\tif ( this.autoStart && ! this.running ) {\r\n\r\n\t\t\tthis.start();\r\n\r\n\t\t}\r\n\r\n\t\tif ( this.running ) {\r\n\r\n\t\t\tvar newTime = self.performance !== undefined && self.performance.now !== undefined\r\n\t\t\t\t\t ? self.performance.now()\r\n\t\t\t\t\t : Date.now();\r\n\r\n\t\t\tdiff = 0.001 * ( newTime - this.oldTime );\r\n\t\t\tthis.oldTime = newTime;\r\n\r\n\t\t\tthis.elapsedTime += diff;\r\n\r\n\t\t}\r\n\r\n\t\treturn diff;\r\n\r\n\t}\r\n\r\n};\r\n\r\n// File:src/core/EventDispatcher.js\r\n\r\n/**\r\n * https://github.com/mrdoob/eventdispatcher.js/\r\n */\r\n\r\nTHREE.EventDispatcher = function () {}\r\n\r\nTHREE.EventDispatcher.prototype = {\r\n\r\n\tconstructor: THREE.EventDispatcher,\r\n\r\n\tapply: function ( object ) {\r\n\r\n\t\tobject.addEventListener = THREE.EventDispatcher.prototype.addEventListener;\r\n\t\tobject.hasEventListener = THREE.EventDispatcher.prototype.hasEventListener;\r\n\t\tobject.removeEventListener = THREE.EventDispatcher.prototype.removeEventListener;\r\n\t\tobject.dispatchEvent = THREE.EventDispatcher.prototype.dispatchEvent;\r\n\r\n\t},\r\n\r\n\taddEventListener: function ( type, listener ) {\r\n\r\n\t\tif ( this._listeners === undefined ) this._listeners = {};\r\n\r\n\t\tvar listeners = this._listeners;\r\n\r\n\t\tif ( listeners[ type ] === undefined ) {\r\n\r\n\t\t\tlisteners[ type ] = [];\r\n\r\n\t\t}\r\n\r\n\t\tif ( listeners[ type ].indexOf( listener ) === - 1 ) {\r\n\r\n\t\t\tlisteners[ type ].push( listener );\r\n\r\n\t\t}\r\n\r\n\t},\r\n\r\n\thasEventListener: function ( type, listener ) {\r\n\r\n\t\tif ( this._listeners === undefined ) return false;\r\n\r\n\t\tvar listeners = this._listeners;\r\n\r\n\t\tif ( listeners[ type ] !== undefined && listeners[ type ].indexOf( listener ) !== - 1 ) {\r\n\r\n\t\t\treturn true;\r\n\r\n\t\t}\r\n\r\n\t\treturn false;\r\n\r\n\t},\r\n\r\n\tremoveEventListener: function ( type, listener ) {\r\n\r\n\t\tif ( this._listeners === undefined ) return;\r\n\r\n\t\tvar listeners = this._listeners;\r\n\t\tvar listenerArray = listeners[ type ];\r\n\r\n\t\tif ( listenerArray !== undefined ) {\r\n\r\n\t\t\tvar index = listenerArray.indexOf( listener );\r\n\r\n\t\t\tif ( index !== - 1 ) {\r\n\r\n\t\t\t\tlistenerArray.splice( index, 1 );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t},\r\n\r\n\tdispatchEvent: function ( event ) {\r\n\r\n\t\tif ( this._listeners === undefined ) return;\r\n\r\n\t\tvar listeners = this._listeners;\r\n\t\tvar listenerArray = listeners[ event.type ];\r\n\r\n\t\tif ( listenerArray !== undefined ) {\r\n\r\n\t\t\tevent.target = this;\r\n\r\n\t\t\tvar array = [];\r\n\t\t\tvar length = listenerArray.length;\r\n\r\n\t\t\tfor ( var i = 0; i < length; i ++ ) {\r\n\r\n\t\t\t\tarray[ i ] = listenerArray[ i ];\r\n\r\n\t\t\t}\r\n\r\n\t\t\tfor ( var i = 0; i < length; i ++ ) {\r\n\r\n\t\t\t\tarray[ i ].call( this, event );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n};\r\n\r\n// File:src/core/Raycaster.js\r\n\r\n/**\r\n * @author mrdoob / http://mrdoob.com/\r\n * @author bhouston / http://exocortex.com/\r\n * @author stephomi / http://stephaneginier.com/\r\n */\r\n\r\n( function ( THREE ) {\r\n\r\n\tTHREE.Raycaster = function ( origin, direction, near, far ) {\r\n\r\n\t\tthis.ray = new THREE.Ray( origin, direction );\r\n\t\t// direction is assumed to be normalized (for accurate distance calculations)\r\n\r\n\t\tthis.near = near || 0;\r\n\t\tthis.far = far || Infinity;\r\n\r\n\t\tthis.params = {\r\n\t\t\tSprite: {},\r\n\t\t\tMesh: {},\r\n\t\t\tPointCloud: { threshold: 1 },\r\n\t\t\tLOD: {},\r\n\t\t\tLine: {}\r\n\t\t};\r\n\r\n\t};\r\n\r\n\tvar descSort = function ( a, b ) {\r\n\r\n\t\treturn a.distance - b.distance;\r\n\r\n\t};\r\n\r\n\tvar intersectObject = function ( object, raycaster, intersects, recursive ) {\r\n\r\n\t\tobject.raycast( raycaster, intersects );\r\n\r\n\t\tif ( recursive === true ) {\r\n\r\n\t\t\tvar children = object.children;\r\n\r\n\t\t\tfor ( var i = 0, l = children.length; i < l; i ++ ) {\r\n\r\n\t\t\t\tintersectObject( children[ i ], raycaster, intersects, true );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t};\r\n\r\n\t//\r\n\r\n\tTHREE.Raycaster.prototype = {\r\n\r\n\t\tconstructor: THREE.Raycaster,\r\n\r\n\t\tprecision: 0.0001,\r\n\t\tlinePrecision: 1,\r\n\r\n\t\tset: function ( origin, direction ) {\r\n\r\n\t\t\t// direction is assumed to be normalized (for accurate distance calculations)\r\n\r\n\t\t\tthis.ray.set( origin, direction );\r\n\r\n\t\t},\r\n\r\n\t\tsetFromCamera: function ( coords, camera ) {\r\n\r\n\t\t\t// camera is assumed _not_ to be a child of a transformed object\r\n\r\n\t\t\tif ( camera instanceof THREE.PerspectiveCamera ) {\r\n\r\n\t\t\t\tthis.ray.origin.copy( camera.position );\r\n\t\t\t\tthis.ray.direction.set( coords.x, coords.y, 0.5 ).unproject( camera ).sub( camera.position ).normalize();\r\n\r\n\t\t\t} else if ( camera instanceof THREE.OrthographicCamera ) {\r\n\r\n\t\t\t\tthis.ray.origin.set( coords.x, coords.y, - 1 ).unproject( camera );\r\n\t\t\t\tthis.ray.direction.set( 0, 0, - 1 ).transformDirection( camera.matrixWorld );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tTHREE.error( 'THREE.Raycaster: Unsupported camera type.' );\r\n\r\n\t\t\t}\r\n\r\n\t\t},\r\n\r\n\t\tintersectObject: function ( object, recursive ) {\r\n\r\n\t\t\tvar intersects = [];\r\n\r\n\t\t\tintersectObject( object, this, intersects, recursive );\r\n\r\n\t\t\tintersects.sort( descSort );\r\n\r\n\t\t\treturn intersects;\r\n\r\n\t\t},\r\n\r\n\t\tintersectObjects: function ( objects, recursive ) {\r\n\r\n\t\t\tvar intersects = [];\r\n\r\n\t\t\tif ( objects instanceof Array === false ) {\r\n\r\n\t\t\t\tTHREE.warn( 'THREE.Raycaster.intersectObjects: objects is not an Array.' );\r\n\t\t\t\treturn intersects;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tfor ( var i = 0, l = objects.length; i < l; i ++ ) {\r\n\r\n\t\t\t\tintersectObject( objects[ i ], this, intersects, recursive );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tintersects.sort( descSort );\r\n\r\n\t\t\treturn intersects;\r\n\r\n\t\t}\r\n\r\n\t};\r\n\r\n}( THREE ) );\r\n\r\n// File:src/core/Object3D.js\r\n\r\n/**\r\n * @author mrdoob / http://mrdoob.com/\r\n * @author mikael emtinger / http://gomo.se/\r\n * @author alteredq / http://alteredqualia.com/\r\n * @author WestLangley / http://github.com/WestLangley\r\n */\r\n\r\nTHREE.Object3D = function () {\r\n\r\n\tObject.defineProperty( this, 'id', { value: THREE.Object3DIdCount ++ } );\r\n\r\n\tthis.uuid = THREE.Math.generateUUID();\r\n\r\n\tthis.name = '';\r\n\tthis.type = 'Object3D';\r\n\r\n\tthis.parent = undefined;\r\n\tthis.children = [];\r\n\r\n\tthis.up = THREE.Object3D.DefaultUp.clone();\r\n\r\n\tvar position = new THREE.Vector3();\r\n\tvar rotation = new THREE.Euler();\r\n\tvar quaternion = new THREE.Quaternion();\r\n\tvar scale = new THREE.Vector3( 1, 1, 1 );\r\n\r\n\tvar onRotationChange = function () {\r\n\t\tquaternion.setFromEuler( rotation, false );\r\n\t};\r\n\r\n\tvar onQuaternionChange = function () {\r\n\t\trotation.setFromQuaternion( quaternion, undefined, false );\r\n\t};\r\n\r\n\trotation.onChange( onRotationChange );\r\n\tquaternion.onChange( onQuaternionChange );\r\n\r\n\tObject.defineProperties( this, {\r\n\t\tposition: {\r\n\t\t\tenumerable: true,\r\n\t\t\tvalue: position\r\n\t\t},\r\n\t\trotation: {\r\n\t\t\tenumerable: true,\r\n\t\t\tvalue: rotation\r\n\t\t},\r\n\t\tquaternion: {\r\n\t\t\tenumerable: true,\r\n\t\t\tvalue: quaternion\r\n\t\t},\r\n\t\tscale: {\r\n\t\t\tenumerable: true,\r\n\t\t\tvalue: scale\r\n\t\t}\r\n\t} );\r\n\r\n\tthis.rotationAutoUpdate = true;\r\n\r\n\tthis.matrix = new THREE.Matrix4();\r\n\tthis.matrixWorld = new THREE.Matrix4();\r\n\r\n\tthis.matrixAutoUpdate = true;\r\n\tthis.matrixWorldNeedsUpdate = false;\r\n\r\n\tthis.visible = true;\r\n\r\n\tthis.castShadow = false;\r\n\tthis.receiveShadow = false;\r\n\r\n\tthis.frustumCulled = true;\r\n\tthis.renderOrder = 0;\r\n\r\n\tthis.userData = {};\r\n\r\n};\r\n\r\nTHREE.Object3D.DefaultUp = new THREE.Vector3( 0, 1, 0 );\r\n\r\nTHREE.Object3D.prototype = {\r\n\r\n\tconstructor: THREE.Object3D,\r\n\r\n\tget eulerOrder () {\r\n\r\n\t\tTHREE.warn( 'THREE.Object3D: .eulerOrder has been moved to .rotation.order.' );\r\n\r\n\t\treturn this.rotation.order;\r\n\r\n\t},\r\n\r\n\tset eulerOrder ( value ) {\r\n\r\n\t\tTHREE.warn( 'THREE.Object3D: .eulerOrder has been moved to .rotation.order.' );\r\n\r\n\t\tthis.rotation.order = value;\r\n\r\n\t},\r\n\r\n\tget useQuaternion () {\r\n\r\n\t\tTHREE.warn( 'THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.' );\r\n\r\n\t},\r\n\r\n\tset useQuaternion ( value ) {\r\n\r\n\t\tTHREE.warn( 'THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.' );\r\n\r\n\t},\r\n\r\n\tapplyMatrix: function ( matrix ) {\r\n\r\n\t\tthis.matrix.multiplyMatrices( matrix, this.matrix );\r\n\r\n\t\tthis.matrix.decompose( this.position, this.quaternion, this.scale );\r\n\r\n\t},\r\n\r\n\tsetRotationFromAxisAngle: function ( axis, angle ) {\r\n\r\n\t\t// assumes axis is normalized\r\n\r\n\t\tthis.quaternion.setFromAxisAngle( axis, angle );\r\n\r\n\t},\r\n\r\n\tsetRotationFromEuler: function ( euler ) {\r\n\r\n\t\tthis.quaternion.setFromEuler( euler, true );\r\n\r\n\t},\r\n\r\n\tsetRotationFromMatrix: function ( m ) {\r\n\r\n\t\t// assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled)\r\n\r\n\t\tthis.quaternion.setFromRotationMatrix( m );\r\n\r\n\t},\r\n\r\n\tsetRotationFromQuaternion: function ( q ) {\r\n\r\n\t\t// assumes q is normalized\r\n\r\n\t\tthis.quaternion.copy( q );\r\n\r\n\t},\r\n\r\n\trotateOnAxis: function () {\r\n\r\n\t\t// rotate object on axis in object space\r\n\t\t// axis is assumed to be normalized\r\n\r\n\t\tvar q1 = new THREE.Quaternion();\r\n\r\n\t\treturn function ( axis, angle ) {\r\n\r\n\t\t\tq1.setFromAxisAngle( axis, angle );\r\n\r\n\t\t\tthis.quaternion.multiply( q1 );\r\n\r\n\t\t\treturn this;\r\n\r\n\t\t}\r\n\r\n\t}(),\r\n\r\n\trotateX: function () {\r\n\r\n\t\tvar v1 = new THREE.Vector3( 1, 0, 0 );\r\n\r\n\t\treturn function ( angle ) {\r\n\r\n\t\t\treturn this.rotateOnAxis( v1, angle );\r\n\r\n\t\t};\r\n\r\n\t}(),\r\n\r\n\trotateY: function () {\r\n\r\n\t\tvar v1 = new THREE.Vector3( 0, 1, 0 );\r\n\r\n\t\treturn function ( angle ) {\r\n\r\n\t\t\treturn this.rotateOnAxis( v1, angle );\r\n\r\n\t\t};\r\n\r\n\t}(),\r\n\r\n\trotateZ: function () {\r\n\r\n\t\tvar v1 = new THREE.Vector3( 0, 0, 1 );\r\n\r\n\t\treturn function ( angle ) {\r\n\r\n\t\t\treturn this.rotateOnAxis( v1, angle );\r\n\r\n\t\t};\r\n\r\n\t}(),\r\n\r\n\ttranslateOnAxis: function () {\r\n\r\n\t\t// translate object by distance along axis in object space\r\n\t\t// axis is assumed to be normalized\r\n\r\n\t\tvar v1 = new THREE.Vector3();\r\n\r\n\t\treturn function ( axis, distance ) {\r\n\r\n\t\t\tv1.copy( axis ).applyQuaternion( this.quaternion );\r\n\r\n\t\t\tthis.position.add( v1.multiplyScalar( distance ) );\r\n\r\n\t\t\treturn this;\r\n\r\n\t\t}\r\n\r\n\t}(),\r\n\r\n\ttranslate: function ( distance, axis ) {\r\n\r\n\t\tTHREE.warn( 'THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead.' );\r\n\t\treturn this.translateOnAxis( axis, distance );\r\n\r\n\t},\r\n\r\n\ttranslateX: function () {\r\n\r\n\t\tvar v1 = new THREE.Vector3( 1, 0, 0 );\r\n\r\n\t\treturn function ( distance ) {\r\n\r\n\t\t\treturn this.translateOnAxis( v1, distance );\r\n\r\n\t\t};\r\n\r\n\t}(),\r\n\r\n\ttranslateY: function () {\r\n\r\n\t\tvar v1 = new THREE.Vector3( 0, 1, 0 );\r\n\r\n\t\treturn function ( distance ) {\r\n\r\n\t\t\treturn this.translateOnAxis( v1, distance );\r\n\r\n\t\t};\r\n\r\n\t}(),\r\n\r\n\ttranslateZ: function () {\r\n\r\n\t\tvar v1 = new THREE.Vector3( 0, 0, 1 );\r\n\r\n\t\treturn function ( distance ) {\r\n\r\n\t\t\treturn this.translateOnAxis( v1, distance );\r\n\r\n\t\t};\r\n\r\n\t}(),\r\n\r\n\tlocalToWorld: function ( vector ) {\r\n\r\n\t\treturn vector.applyMatrix4( this.matrixWorld );\r\n\r\n\t},\r\n\r\n\tworldToLocal: function () {\r\n\r\n\t\tvar m1 = new THREE.Matrix4();\r\n\r\n\t\treturn function ( vector ) {\r\n\r\n\t\t\treturn vector.applyMatrix4( m1.getInverse( this.matrixWorld ) );\r\n\r\n\t\t};\r\n\r\n\t}(),\r\n\r\n\tlookAt: function () {\r\n\r\n\t\t// This routine does not support objects with rotated and/or translated parent(s)\r\n\r\n\t\tvar m1 = new THREE.Matrix4();\r\n\r\n\t\treturn function ( vector ) {\r\n\r\n\t\t\tm1.lookAt( vector, this.position, this.up );\r\n\r\n\t\t\tthis.quaternion.setFromRotationMatrix( m1 );\r\n\r\n\t\t};\r\n\r\n\t}(),\r\n\r\n\tadd: function ( object ) {\r\n\r\n\t\tif ( arguments.length > 1 ) {\r\n\r\n\t\t\tfor ( var i = 0; i < arguments.length; i ++ ) {\r\n\r\n\t\t\t\tthis.add( arguments[ i ] );\r\n\r\n\t\t\t}\r\n\r\n\t\t\treturn this;\r\n\r\n\t\t};\r\n\r\n\t\tif ( object === this ) {\r\n\r\n\t\t\tTHREE.error( \"THREE.Object3D.add: object can't be added as a child of itself.\", object );\r\n\t\t\treturn this;\r\n\r\n\t\t}\r\n\r\n\t\tif ( object instanceof THREE.Object3D ) {\r\n\r\n\t\t\tif ( object.parent !== undefined ) {\r\n\r\n\t\t\t\tobject.parent.remove( object );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tobject.parent = this;\r\n\t\t\tobject.dispatchEvent( { type: 'added' } );\r\n\r\n\t\t\tthis.children.push( object );\r\n\r\n\t\t} else {\r\n\r\n\t\t\tTHREE.error( \"THREE.Object3D.add: object not an instance of THREE.Object3D.\", object );\r\n\r\n\t\t}\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tremove: function ( object ) {\r\n\r\n\t\tif ( arguments.length > 1 ) {\r\n\r\n\t\t\tfor ( var i = 0; i < arguments.length; i ++ ) {\r\n\r\n\t\t\t\tthis.remove( arguments[ i ] );\r\n\r\n\t\t\t}\r\n\r\n\t\t};\r\n\r\n\t\tvar index = this.children.indexOf( object );\r\n\r\n\t\tif ( index !== - 1 ) {\r\n\r\n\t\t\tobject.parent = undefined;\r\n\r\n\t\t\tobject.dispatchEvent( { type: 'removed' } );\r\n\r\n\t\t\tthis.children.splice( index, 1 );\r\n\r\n\t\t}\r\n\r\n\t},\r\n\r\n\tgetChildByName: function ( name ) {\r\n\r\n\t\tTHREE.warn( 'THREE.Object3D: .getChildByName() has been renamed to .getObjectByName().' );\r\n\t\treturn this.getObjectByName( name );\r\n\r\n\t},\r\n\r\n\tgetObjectById: function ( id ) {\r\n\r\n\t\treturn this.getObjectByProperty( 'id', id );\r\n\r\n\t},\r\n\r\n\tgetObjectByName: function ( name ) {\r\n\r\n\t\treturn this.getObjectByProperty( 'name', name );\r\n\r\n\t},\r\n\r\n\tgetObjectByProperty: function ( name, value ) {\r\n\r\n\t\tif ( this[ name ] === value ) return this;\r\n\r\n\t\tfor ( var i = 0, l = this.children.length; i < l; i ++ ) {\r\n\r\n\t\t\tvar child = this.children[ i ];\r\n\t\t\tvar object = child.getObjectByProperty( name, value );\r\n\r\n\t\t\tif ( object !== undefined ) {\r\n\r\n\t\t\t\treturn object;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn undefined;\r\n\r\n\t},\r\n\r\n\tgetWorldPosition: function ( optionalTarget ) {\r\n\r\n\t\tvar result = optionalTarget || new THREE.Vector3();\r\n\r\n\t\tthis.updateMatrixWorld( true );\r\n\r\n\t\treturn result.setFromMatrixPosition( this.matrixWorld );\r\n\r\n\t},\r\n\r\n\tgetWorldQuaternion: function () {\r\n\r\n\t\tvar position = new THREE.Vector3();\r\n\t\tvar scale = new THREE.Vector3();\r\n\r\n\t\treturn function ( optionalTarget ) {\r\n\r\n\t\t\tvar result = optionalTarget || new THREE.Quaternion();\r\n\r\n\t\t\tthis.updateMatrixWorld( true );\r\n\r\n\t\t\tthis.matrixWorld.decompose( position, result, scale );\r\n\r\n\t\t\treturn result;\r\n\r\n\t\t}\r\n\r\n\t}(),\r\n\r\n\tgetWorldRotation: function () {\r\n\r\n\t\tvar quaternion = new THREE.Quaternion();\r\n\r\n\t\treturn function ( optionalTarget ) {\r\n\r\n\t\t\tvar result = optionalTarget || new THREE.Euler();\r\n\r\n\t\t\tthis.getWorldQuaternion( quaternion );\r\n\r\n\t\t\treturn result.setFromQuaternion( quaternion, this.rotation.order, false );\r\n\r\n\t\t}\r\n\r\n\t}(),\r\n\r\n\tgetWorldScale: function () {\r\n\r\n\t\tvar position = new THREE.Vector3();\r\n\t\tvar quaternion = new THREE.Quaternion();\r\n\r\n\t\treturn function ( optionalTarget ) {\r\n\r\n\t\t\tvar result = optionalTarget || new THREE.Vector3();\r\n\r\n\t\t\tthis.updateMatrixWorld( true );\r\n\r\n\t\t\tthis.matrixWorld.decompose( position, quaternion, result );\r\n\r\n\t\t\treturn result;\r\n\r\n\t\t}\r\n\r\n\t}(),\r\n\r\n\tgetWorldDirection: function () {\r\n\r\n\t\tvar quaternion = new THREE.Quaternion();\r\n\r\n\t\treturn function ( optionalTarget ) {\r\n\r\n\t\t\tvar result = optionalTarget || new THREE.Vector3();\r\n\r\n\t\t\tthis.getWorldQuaternion( quaternion );\r\n\r\n\t\t\treturn result.set( 0, 0, 1 ).applyQuaternion( quaternion );\r\n\r\n\t\t}\r\n\r\n\t}(),\r\n\r\n\traycast: function () {},\r\n\r\n\ttraverse: function ( callback ) {\r\n\r\n\t\tcallback( this );\r\n\r\n\t\tfor ( var i = 0, l = this.children.length; i < l; i ++ ) {\r\n\r\n\t\t\tthis.children[ i ].traverse( callback );\r\n\r\n\t\t}\r\n\r\n\t},\r\n\r\n\ttraverseVisible: function ( callback ) {\r\n\r\n\t\tif ( this.visible === false ) return;\r\n\r\n\t\tcallback( this );\r\n\r\n\t\tfor ( var i = 0, l = this.children.length; i < l; i ++ ) {\r\n\r\n\t\t\tthis.children[ i ].traverseVisible( callback );\r\n\r\n\t\t}\r\n\r\n\t},\r\n\r\n\ttraverseAncestors: function ( callback ) {\r\n\r\n\t\tif ( this.parent ) {\r\n\r\n\t\t\tcallback( this.parent );\r\n\r\n\t\t\tthis.parent.traverseAncestors( callback );\r\n\r\n\t\t}\r\n\r\n\t},\r\n\r\n\tupdateMatrix: function () {\r\n\r\n\t\tthis.matrix.compose( this.position, this.quaternion, this.scale );\r\n\r\n\t\tthis.matrixWorldNeedsUpdate = true;\r\n\r\n\t},\r\n\r\n\tupdateMatrixWorld: function ( force ) {\r\n\r\n\t\tif ( this.matrixAutoUpdate === true ) this.updateMatrix();\r\n\r\n\t\tif ( this.matrixWorldNeedsUpdate === true || force === true ) {\r\n\r\n\t\t\tif ( this.parent === undefined ) {\r\n\r\n\t\t\t\tthis.matrixWorld.copy( this.matrix );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tthis.matrixWorld.multiplyMatrices( this.parent.matrixWorld, this.matrix );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tthis.matrixWorldNeedsUpdate = false;\r\n\r\n\t\t\tforce = true;\r\n\r\n\t\t}\r\n\r\n\t\t// update children\r\n\r\n\t\tfor ( var i = 0, l = this.children.length; i < l; i ++ ) {\r\n\r\n\t\t\tthis.children[ i ].updateMatrixWorld( force );\r\n\r\n\t\t}\r\n\r\n\t},\r\n\r\n\ttoJSON: function () {\r\n\r\n\t\tvar output = {\r\n\t\t\tmetadata: {\r\n\t\t\t\tversion: 4.3,\r\n\t\t\t\ttype: 'Object',\r\n\t\t\t\tgenerator: 'ObjectExporter'\r\n\t\t\t}\r\n\t\t};\r\n\r\n\t\t//\r\n\r\n\t\tvar geometries = {};\r\n\r\n\t\tvar parseGeometry = function ( geometry ) {\r\n\r\n\t\t\tif ( output.geometries === undefined ) {\r\n\r\n\t\t\t\toutput.geometries = [];\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( geometries[ geometry.uuid ] === undefined ) {\r\n\r\n\t\t\t\tvar json = geometry.toJSON();\r\n\r\n\t\t\t\tdelete json.metadata;\r\n\r\n\t\t\t\tgeometries[ geometry.uuid ] = json;\r\n\r\n\t\t\t\toutput.geometries.push( json );\r\n\r\n\t\t\t}\r\n\r\n\t\t\treturn geometry.uuid;\r\n\r\n\t\t};\r\n\r\n\t\t//\r\n\r\n\t\tvar materials = {};\r\n\r\n\t\tvar parseMaterial = function ( material ) {\r\n\r\n\t\t\tif ( output.materials === undefined ) {\r\n\r\n\t\t\t\toutput.materials = [];\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( materials[ material.uuid ] === undefined ) {\r\n\r\n\t\t\t\tvar json = material.toJSON();\r\n\r\n\t\t\t\tdelete json.metadata;\r\n\r\n\t\t\t\tmaterials[ material.uuid ] = json;\r\n\r\n\t\t\t\toutput.materials.push( json );\r\n\r\n\t\t\t}\r\n\r\n\t\t\treturn material.uuid;\r\n\r\n\t\t};\r\n\r\n\t\t//\r\n\r\n\t\tvar parseObject = function ( object ) {\r\n\r\n\t\t\tvar data = {};\r\n\r\n\t\t\tdata.uuid = object.uuid;\r\n\t\t\tdata.type = object.type;\r\n\r\n\t\t\tif ( object.name !== '' ) data.name = object.name;\r\n\t\t\tif ( JSON.stringify( object.userData ) !== '{}' ) data.userData = object.userData;\r\n\t\t\tif ( object.visible !== true ) data.visible = object.visible;\r\n\r\n\t\t\tif ( object instanceof THREE.PerspectiveCamera ) {\r\n\r\n\t\t\t\tdata.fov = object.fov;\r\n\t\t\t\tdata.aspect = object.aspect;\r\n\t\t\t\tdata.near = object.near;\r\n\t\t\t\tdata.far = object.far;\r\n\r\n\t\t\t} else if ( object instanceof THREE.OrthographicCamera ) {\r\n\r\n\t\t\t\tdata.left = object.left;\r\n\t\t\t\tdata.right = object.right;\r\n\t\t\t\tdata.top = object.top;\r\n\t\t\t\tdata.bottom = object.bottom;\r\n\t\t\t\tdata.near = object.near;\r\n\t\t\t\tdata.far = object.far;\r\n\r\n\t\t\t} else if ( object instanceof THREE.AmbientLight ) {\r\n\r\n\t\t\t\tdata.color = object.color.getHex();\r\n\r\n\t\t\t} else if ( object instanceof THREE.DirectionalLight ) {\r\n\r\n\t\t\t\tdata.color = object.color.getHex();\r\n\t\t\t\tdata.intensity = object.intensity;\r\n\r\n\t\t\t} else if ( object instanceof THREE.PointLight ) {\r\n\r\n\t\t\t\tdata.color = object.color.getHex();\r\n\t\t\t\tdata.intensity = object.intensity;\r\n\t\t\t\tdata.distance = object.distance;\r\n\t\t\t\tdata.decay = object.decay;\r\n\r\n\t\t\t} else if ( object instanceof THREE.SpotLight ) {\r\n\r\n\t\t\t\tdata.color = object.color.getHex();\r\n\t\t\t\tdata.intensity = object.intensity;\r\n\t\t\t\tdata.distance = object.distance;\r\n\t\t\t\tdata.angle = object.angle;\r\n\t\t\t\tdata.exponent = object.exponent;\r\n\t\t\t\tdata.decay = object.decay;\r\n\r\n\t\t\t} else if ( object instanceof THREE.HemisphereLight ) {\r\n\r\n\t\t\t\tdata.color = object.color.getHex();\r\n\t\t\t\tdata.groundColor = object.groundColor.getHex();\r\n\r\n\t\t\t} else if ( object instanceof THREE.Mesh || object instanceof THREE.Line || object instanceof THREE.PointCloud ) {\r\n\r\n\t\t\t\tdata.geometry = parseGeometry( object.geometry );\r\n\t\t\t\tdata.material = parseMaterial( object.material );\r\n\r\n\t\t\t\tif ( object instanceof THREE.Line ) data.mode = object.mode;\r\n\r\n\t\t\t} else if ( object instanceof THREE.Sprite ) {\r\n\r\n\t\t\t\tdata.material = parseMaterial( object.material );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tdata.matrix = object.matrix.toArray();\r\n\r\n\t\t\tif ( object.children.length > 0 ) {\r\n\r\n\t\t\t\tdata.children = [];\r\n\r\n\t\t\t\tfor ( var i = 0; i < object.children.length; i ++ ) {\r\n\r\n\t\t\t\t\tdata.children.push( parseObject( object.children[ i ] ) );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\treturn data;\r\n\r\n\t\t}\r\n\r\n\t\toutput.object = parseObject( this );\r\n\r\n\t\treturn output;\r\n\r\n\t},\r\n\r\n\tclone: function ( object, recursive ) {\r\n\r\n\t\tif ( object === undefined ) object = new THREE.Object3D();\r\n\t\tif ( recursive === undefined ) recursive = true;\r\n\r\n\t\tobject.name = this.name;\r\n\r\n\t\tobject.up.copy( this.up );\r\n\r\n\t\tobject.position.copy( this.position );\r\n\t\tobject.quaternion.copy( this.quaternion );\r\n\t\tobject.scale.copy( this.scale );\r\n\r\n\t\tobject.rotationAutoUpdate = this.rotationAutoUpdate;\r\n\r\n\t\tobject.matrix.copy( this.matrix );\r\n\t\tobject.matrixWorld.copy( this.matrixWorld );\r\n\r\n\t\tobject.matrixAutoUpdate = this.matrixAutoUpdate;\r\n\t\tobject.matrixWorldNeedsUpdate = this.matrixWorldNeedsUpdate;\r\n\r\n\t\tobject.visible = this.visible;\r\n\r\n\t\tobject.castShadow = this.castShadow;\r\n\t\tobject.receiveShadow = this.receiveShadow;\r\n\r\n\t\tobject.frustumCulled = this.frustumCulled;\r\n\r\n\t\tobject.userData = JSON.parse( JSON.stringify( this.userData ) );\r\n\r\n\t\tif ( recursive === true ) {\r\n\r\n\t\t\tfor ( var i = 0; i < this.children.length; i ++ ) {\r\n\r\n\t\t\t\tvar child = this.children[ i ];\r\n\t\t\t\tobject.add( child.clone() );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn object;\r\n\r\n\t}\r\n\r\n};\r\n\r\nTHREE.EventDispatcher.prototype.apply( THREE.Object3D.prototype );\r\n\r\nTHREE.Object3DIdCount = 0;\r\n\r\n// File:src/core/Face3.js\r\n\r\n/**\r\n * @author mrdoob / http://mrdoob.com/\r\n * @author alteredq / http://alteredqualia.com/\r\n */\r\n\r\nTHREE.Face3 = function ( a, b, c, normal, color, materialIndex ) {\r\n\r\n\tthis.a = a;\r\n\tthis.b = b;\r\n\tthis.c = c;\r\n\r\n\tthis.normal = normal instanceof THREE.Vector3 ? normal : new THREE.Vector3();\r\n\tthis.vertexNormals = normal instanceof Array ? normal : [];\r\n\r\n\tthis.color = color instanceof THREE.Color ? color : new THREE.Color();\r\n\tthis.vertexColors = color instanceof Array ? color : [];\r\n\r\n\tthis.vertexTangents = [];\r\n\r\n\tthis.materialIndex = materialIndex !== undefined ? materialIndex : 0;\r\n\r\n};\r\n\r\nTHREE.Face3.prototype = {\r\n\r\n\tconstructor: THREE.Face3,\r\n\r\n\tclone: function () {\r\n\r\n\t\tvar face = new THREE.Face3( this.a, this.b, this.c );\r\n\r\n\t\tface.normal.copy( this.normal );\r\n\t\tface.color.copy( this.color );\r\n\r\n\t\tface.materialIndex = this.materialIndex;\r\n\r\n\t\tfor ( var i = 0, il = this.vertexNormals.length; i < il; i ++ ) {\r\n\r\n\t\t\tface.vertexNormals[ i ] = this.vertexNormals[ i ].clone();\r\n\r\n\t\t}\r\n\r\n\t\tfor ( var i = 0, il = this.vertexColors.length; i < il; i ++ ) {\r\n\r\n\t\t\tface.vertexColors[ i ] = this.vertexColors[ i ].clone();\r\n\r\n\t\t}\r\n\r\n\t\tfor ( var i = 0, il = this.vertexTangents.length; i < il; i ++ ) {\r\n\r\n\t\t\tface.vertexTangents[ i ] = this.vertexTangents[ i ].clone();\r\n\r\n\t\t}\r\n\r\n\t\treturn face;\r\n\r\n\t}\r\n\r\n};\r\n\r\n// File:src/core/Face4.js\r\n\r\n/**\r\n * @author mrdoob / http://mrdoob.com/\r\n */\r\n\r\nTHREE.Face4 = function ( a, b, c, d, normal, color, materialIndex ) {\r\n\r\n\tTHREE.warn( 'THREE.Face4 has been removed. A THREE.Face3 will be created instead.' )\r\n\treturn new THREE.Face3( a, b, c, normal, color, materialIndex );\r\n\r\n};\r\n\r\n// File:src/core/BufferAttribute.js\r\n\r\n/**\r\n * @author mrdoob / http://mrdoob.com/\r\n */\r\n\r\nTHREE.BufferAttribute = function ( array, itemSize ) {\r\n\r\n\tthis.array = array;\r\n\tthis.itemSize = itemSize;\r\n\r\n\tthis.needsUpdate = false;\r\n\r\n};\r\n\r\nTHREE.BufferAttribute.prototype = {\r\n\r\n\tconstructor: THREE.BufferAttribute,\r\n\r\n\tget length () {\r\n\r\n\t\treturn this.array.length;\r\n\r\n\t},\r\n\r\n\tcopyAt: function ( index1, attribute, index2 ) {\r\n\r\n\t\tindex1 *= this.itemSize;\r\n\t\tindex2 *= attribute.itemSize;\r\n\r\n\t\tfor ( var i = 0, l = this.itemSize; i < l; i ++ ) {\r\n\r\n\t\t\tthis.array[ index1 + i ] = attribute.array[ index2 + i ];\r\n\r\n\t\t}\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tset: function ( value, offset ) {\r\n\r\n\t\tif ( offset === undefined ) offset = 0;\r\n\r\n\t\tthis.array.set( value, offset );\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tsetX: function ( index, x ) {\r\n\r\n\t\tthis.array[ index * this.itemSize ] = x;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tsetY: function ( index, y ) {\r\n\r\n\t\tthis.array[ index * this.itemSize + 1 ] = y;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tsetZ: function ( index, z ) {\r\n\r\n\t\tthis.array[ index * this.itemSize + 2 ] = z;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tsetXY: function ( index, x, y ) {\r\n\r\n\t\tindex *= this.itemSize;\r\n\r\n\t\tthis.array[ index ] = x;\r\n\t\tthis.array[ index + 1 ] = y;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tsetXYZ: function ( index, x, y, z ) {\r\n\r\n\t\tindex *= this.itemSize;\r\n\r\n\t\tthis.array[ index ] = x;\r\n\t\tthis.array[ index + 1 ] = y;\r\n\t\tthis.array[ index + 2 ] = z;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tsetXYZW: function ( index, x, y, z, w ) {\r\n\r\n\t\tindex *= this.itemSize;\r\n\r\n\t\tthis.array[ index ] = x;\r\n\t\tthis.array[ index + 1 ] = y;\r\n\t\tthis.array[ index + 2 ] = z;\r\n\t\tthis.array[ index + 3 ] = w;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tclone: function () {\r\n\r\n\t\treturn new THREE.BufferAttribute( new this.array.constructor( this.array ), this.itemSize );\r\n\r\n\t}\r\n\r\n};\r\n\r\n//\r\n\r\nTHREE.Int8Attribute = function ( data, itemSize ) {\r\n\r\n\tTHREE.warn( 'THREE.Int8Attribute has been removed. Use THREE.BufferAttribute( array, itemSize ) instead.' );\r\n\treturn new THREE.BufferAttribute( data, itemSize );\r\n\r\n};\r\n\r\nTHREE.Uint8Attribute = function ( data, itemSize ) {\r\n\r\n\tTHREE.warn( 'THREE.Uint8Attribute has been removed. Use THREE.BufferAttribute( array, itemSize ) instead.' );\r\n\treturn new THREE.BufferAttribute( data, itemSize );\r\n\r\n};\r\n\r\nTHREE.Uint8ClampedAttribute = function ( data, itemSize ) {\r\n\r\n\tTHREE.warn( 'THREE.Uint8ClampedAttribute has been removed. Use THREE.BufferAttribute( array, itemSize ) instead.' );\r\n\treturn new THREE.BufferAttribute( data, itemSize );\r\n\r\n\r\n};\r\n\r\nTHREE.Int16Attribute = function ( data, itemSize ) {\r\n\r\n\tTHREE.warn( 'THREE.Int16Attribute has been removed. Use THREE.BufferAttribute( array, itemSize ) instead.' );\r\n\treturn new THREE.BufferAttribute( data, itemSize );\r\n\r\n};\r\n\r\nTHREE.Uint16Attribute = function ( data, itemSize ) {\r\n\r\n\tTHREE.warn( 'THREE.Uint16Attribute has been removed. Use THREE.BufferAttribute( array, itemSize ) instead.' );\r\n\treturn new THREE.BufferAttribute( data, itemSize );\r\n\r\n};\r\n\r\nTHREE.Int32Attribute = function ( data, itemSize ) {\r\n\r\n\tTHREE.warn( 'THREE.Int32Attribute has been removed. Use THREE.BufferAttribute( array, itemSize ) instead.' );\r\n\treturn new THREE.BufferAttribute( data, itemSize );\r\n\r\n};\r\n\r\nTHREE.Uint32Attribute = function ( data, itemSize ) {\r\n\r\n\tTHREE.warn( 'THREE.Uint32Attribute has been removed. Use THREE.BufferAttribute( array, itemSize ) instead.' );\r\n\treturn new THREE.BufferAttribute( data, itemSize );\r\n\r\n};\r\n\r\nTHREE.Float32Attribute = function ( data, itemSize ) {\r\n\r\n\tTHREE.warn( 'THREE.Float32Attribute has been removed. Use THREE.BufferAttribute( array, itemSize ) instead.' );\r\n\treturn new THREE.BufferAttribute( data, itemSize );\r\n\r\n};\r\n\r\nTHREE.Float64Attribute = function ( data, itemSize ) {\r\n\r\n\tTHREE.warn( 'THREE.Float64Attribute has been removed. Use THREE.BufferAttribute( array, itemSize ) instead.' );\r\n\treturn new THREE.BufferAttribute( data, itemSize );\r\n\r\n};\r\n\r\n// File:src/core/DynamicBufferAttribute.js\r\n\r\n/**\r\n * @author benaadams / https://twitter.com/ben_a_adams\r\n * @author mrdoob / http://mrdoob.com/\r\n */\r\n\r\nTHREE.DynamicBufferAttribute = function ( array, itemSize ) {\r\n\r\n\tTHREE.BufferAttribute.call( this, array, itemSize );\r\n\r\n\tthis.updateRange = { offset: 0, count: -1 };\r\n\r\n};\r\n\r\nTHREE.DynamicBufferAttribute.prototype = Object.create( THREE.BufferAttribute.prototype );\r\nTHREE.DynamicBufferAttribute.prototype.constructor = THREE.DynamicBufferAttribute;\r\n\r\nTHREE.DynamicBufferAttribute.prototype.clone = function () {\r\n\r\n\treturn new THREE.DynamicBufferAttribute( new this.array.constructor( this.array ), this.itemSize );\r\n\r\n};\r\n\r\n// File:src/core/BufferGeometry.js\r\n\r\n/**\r\n * @author alteredq / http://alteredqualia.com/\r\n * @author mrdoob / http://mrdoob.com/\r\n */\r\n\r\nTHREE.BufferGeometry = function () {\r\n\r\n\tObject.defineProperty( this, 'id', { value: THREE.GeometryIdCount ++ } );\r\n\r\n\tthis.uuid = THREE.Math.generateUUID();\r\n\r\n\tthis.name = '';\r\n\tthis.type = 'BufferGeometry';\r\n\r\n\tthis.attributes = {};\r\n\tthis.attributesKeys = [];\r\n\r\n\tthis.drawcalls = [];\r\n\tthis.offsets = this.drawcalls; // backwards compatibility\r\n\r\n\tthis.boundingBox = null;\r\n\tthis.boundingSphere = null;\r\n\r\n};\r\n\r\nTHREE.BufferGeometry.prototype = {\r\n\r\n\tconstructor: THREE.BufferGeometry,\r\n\r\n\taddAttribute: function ( name, attribute ) {\r\n\r\n\t\tif ( attribute instanceof THREE.BufferAttribute === false ) {\r\n\r\n\t\t\tTHREE.warn( 'THREE.BufferGeometry: .addAttribute() now expects ( name, attribute ).' );\r\n\r\n\t\t\tthis.attributes[ name ] = { array: arguments[ 1 ], itemSize: arguments[ 2 ] };\r\n\r\n\t\t\treturn;\r\n\r\n\t\t}\r\n\r\n\t\tthis.attributes[ name ] = attribute;\r\n\t\tthis.attributesKeys = Object.keys( this.attributes );\r\n\r\n\t},\r\n\r\n\tgetAttribute: function ( name ) {\r\n\r\n\t\treturn this.attributes[ name ];\r\n\r\n\t},\r\n\r\n\taddDrawCall: function ( start, count, indexOffset ) {\r\n\r\n\t\tthis.drawcalls.push( {\r\n\r\n\t\t\tstart: start,\r\n\t\t\tcount: count,\r\n\t\t\tindex: indexOffset !== undefined ? indexOffset : 0\r\n\r\n\t\t} );\r\n\r\n\t},\r\n\r\n\tapplyMatrix: function ( matrix ) {\r\n\r\n\t\tvar position = this.attributes.position;\r\n\r\n\t\tif ( position !== undefined ) {\r\n\r\n\t\t\tmatrix.applyToVector3Array( position.array );\r\n\t\t\tposition.needsUpdate = true;\r\n\r\n\t\t}\r\n\r\n\t\tvar normal = this.attributes.normal;\r\n\r\n\t\tif ( normal !== undefined ) {\r\n\r\n\t\t\tvar normalMatrix = new THREE.Matrix3().getNormalMatrix( matrix );\r\n\r\n\t\t\tnormalMatrix.applyToVector3Array( normal.array );\r\n\t\t\tnormal.needsUpdate = true;\r\n\r\n\t\t}\r\n\r\n\t\tif ( this.boundingBox !== null ) {\r\n\r\n\t\t\tthis.computeBoundingBox();\r\n\r\n\t\t}\r\n\r\n\t\tif ( this.boundingSphere !== null ) {\r\n\r\n\t\t\tthis.computeBoundingSphere();\r\n\r\n\t\t}\r\n\r\n\t},\r\n\r\n\tcenter: function () {\r\n\r\n\t\tthis.computeBoundingBox();\r\n\r\n\t\tvar offset = this.boundingBox.center().negate();\r\n\r\n\t\tthis.applyMatrix( new THREE.Matrix4().setPosition( offset ) );\r\n\r\n\t\treturn offset;\r\n\r\n\t},\r\n\r\n\tfromGeometry: function ( geometry, settings ) {\r\n\r\n\t\tsettings = settings || { 'vertexColors': THREE.NoColors };\r\n\r\n\t\tvar vertices = geometry.vertices;\r\n\t\tvar faces = geometry.faces;\r\n\t\tvar faceVertexUvs = geometry.faceVertexUvs;\r\n\t\tvar vertexColors = settings.vertexColors;\r\n\t\tvar hasFaceVertexUv = faceVertexUvs[ 0 ].length > 0;\r\n\t\tvar hasFaceVertexNormals = faces[ 0 ].vertexNormals.length == 3;\r\n\r\n\t\tvar positions = new Float32Array( faces.length * 3 * 3 );\r\n\t\tthis.addAttribute( 'position', new THREE.BufferAttribute( positions, 3 ) );\r\n\r\n\t\tvar normals = new Float32Array( faces.length * 3 * 3 );\r\n\t\tthis.addAttribute( 'normal', new THREE.BufferAttribute( normals, 3 ) );\r\n\r\n\t\tif ( vertexColors !== THREE.NoColors ) {\r\n\r\n\t\t\tvar colors = new Float32Array( faces.length * 3 * 3 );\r\n\t\t\tthis.addAttribute( 'color', new THREE.BufferAttribute( colors, 3 ) );\r\n\r\n\t\t}\r\n\r\n\t\tif ( hasFaceVertexUv === true ) {\r\n\r\n\t\t\tvar uvs = new Float32Array( faces.length * 3 * 2 );\r\n\t\t\tthis.addAttribute( 'uv', new THREE.BufferAttribute( uvs, 2 ) );\r\n\r\n\t\t}\r\n\r\n\t\tfor ( var i = 0, i2 = 0, i3 = 0; i < faces.length; i ++, i2 += 6, i3 += 9 ) {\r\n\r\n\t\t\tvar face = faces[ i ];\r\n\r\n\t\t\tvar a = vertices[ face.a ];\r\n\t\t\tvar b = vertices[ face.b ];\r\n\t\t\tvar c = vertices[ face.c ];\r\n\r\n\t\t\tpositions[ i3 ] = a.x;\r\n\t\t\tpositions[ i3 + 1 ] = a.y;\r\n\t\t\tpositions[ i3 + 2 ] = a.z;\r\n\r\n\t\t\tpositions[ i3 + 3 ] = b.x;\r\n\t\t\tpositions[ i3 + 4 ] = b.y;\r\n\t\t\tpositions[ i3 + 5 ] = b.z;\r\n\r\n\t\t\tpositions[ i3 + 6 ] = c.x;\r\n\t\t\tpositions[ i3 + 7 ] = c.y;\r\n\t\t\tpositions[ i3 + 8 ] = c.z;\r\n\r\n\t\t\tif ( hasFaceVertexNormals === true ) {\r\n\r\n\t\t\t\tvar na = face.vertexNormals[ 0 ];\r\n\t\t\t\tvar nb = face.vertexNormals[ 1 ];\r\n\t\t\t\tvar nc = face.vertexNormals[ 2 ];\r\n\r\n\t\t\t\tnormals[ i3 ] = na.x;\r\n\t\t\t\tnormals[ i3 + 1 ] = na.y;\r\n\t\t\t\tnormals[ i3 + 2 ] = na.z;\r\n\r\n\t\t\t\tnormals[ i3 + 3 ] = nb.x;\r\n\t\t\t\tnormals[ i3 + 4 ] = nb.y;\r\n\t\t\t\tnormals[ i3 + 5 ] = nb.z;\r\n\r\n\t\t\t\tnormals[ i3 + 6 ] = nc.x;\r\n\t\t\t\tnormals[ i3 + 7 ] = nc.y;\r\n\t\t\t\tnormals[ i3 + 8 ] = nc.z;\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tvar n = face.normal;\r\n\r\n\t\t\t\tnormals[ i3 ] = n.x;\r\n\t\t\t\tnormals[ i3 + 1 ] = n.y;\r\n\t\t\t\tnormals[ i3 + 2 ] = n.z;\r\n\r\n\t\t\t\tnormals[ i3 + 3 ] = n.x;\r\n\t\t\t\tnormals[ i3 + 4 ] = n.y;\r\n\t\t\t\tnormals[ i3 + 5 ] = n.z;\r\n\r\n\t\t\t\tnormals[ i3 + 6 ] = n.x;\r\n\t\t\t\tnormals[ i3 + 7 ] = n.y;\r\n\t\t\t\tnormals[ i3 + 8 ] = n.z;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( vertexColors === THREE.FaceColors ) {\r\n\r\n\t\t\t\tvar fc = face.color;\r\n\r\n\t\t\t\tcolors[ i3 ] = fc.r;\r\n\t\t\t\tcolors[ i3 + 1 ] = fc.g;\r\n\t\t\t\tcolors[ i3 + 2 ] = fc.b;\r\n\r\n\t\t\t\tcolors[ i3 + 3 ] = fc.r;\r\n\t\t\t\tcolors[ i3 + 4 ] = fc.g;\r\n\t\t\t\tcolors[ i3 + 5 ] = fc.b;\r\n\r\n\t\t\t\tcolors[ i3 + 6 ] = fc.r;\r\n\t\t\t\tcolors[ i3 + 7 ] = fc.g;\r\n\t\t\t\tcolors[ i3 + 8 ] = fc.b;\r\n\r\n\t\t\t} else if ( vertexColors === THREE.VertexColors ) {\r\n\r\n\t\t\t\tvar vca = face.vertexColors[ 0 ];\r\n\t\t\t\tvar vcb = face.vertexColors[ 1 ];\r\n\t\t\t\tvar vcc = face.vertexColors[ 2 ];\r\n\r\n\t\t\t\tcolors[ i3 ] = vca.r;\r\n\t\t\t\tcolors[ i3 + 1 ] = vca.g;\r\n\t\t\t\tcolors[ i3 + 2 ] = vca.b;\r\n\r\n\t\t\t\tcolors[ i3 + 3 ] = vcb.r;\r\n\t\t\t\tcolors[ i3 + 4 ] = vcb.g;\r\n\t\t\t\tcolors[ i3 + 5 ] = vcb.b;\r\n\r\n\t\t\t\tcolors[ i3 + 6 ] = vcc.r;\r\n\t\t\t\tcolors[ i3 + 7 ] = vcc.g;\r\n\t\t\t\tcolors[ i3 + 8 ] = vcc.b;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( hasFaceVertexUv === true ) {\r\n\r\n\t\t\t\tvar uva = faceVertexUvs[ 0 ][ i ][ 0 ];\r\n\t\t\t\tvar uvb = faceVertexUvs[ 0 ][ i ][ 1 ];\r\n\t\t\t\tvar uvc = faceVertexUvs[ 0 ][ i ][ 2 ];\r\n\r\n\t\t\t\tuvs[ i2 ] = uva.x;\r\n\t\t\t\tuvs[ i2 + 1 ] = uva.y;\r\n\r\n\t\t\t\tuvs[ i2 + 2 ] = uvb.x;\r\n\t\t\t\tuvs[ i2 + 3 ] = uvb.y;\r\n\r\n\t\t\t\tuvs[ i2 + 4 ] = uvc.x;\r\n\t\t\t\tuvs[ i2 + 5 ] = uvc.y;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tthis.computeBoundingSphere()\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tcomputeBoundingBox: function () {\r\n\r\n\t\tvar vector = new THREE.Vector3();\r\n\r\n\t\treturn function () {\r\n\r\n\t\t\tif ( this.boundingBox === null ) {\r\n\r\n\t\t\t\tthis.boundingBox = new THREE.Box3();\r\n\r\n\t\t\t}\r\n\r\n\t\t\tvar positions = this.attributes.position.array;\r\n\r\n\t\t\tif ( positions ) {\r\n\r\n\t\t\t\tvar bb = this.boundingBox;\r\n\t\t\t\tbb.makeEmpty();\r\n\r\n\t\t\t\tfor ( var i = 0, il = positions.length; i < il; i += 3 ) {\r\n\r\n\t\t\t\t\tvector.set( positions[ i ], positions[ i + 1 ], positions[ i + 2 ] );\r\n\t\t\t\t\tbb.expandByPoint( vector );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( positions === undefined || positions.length === 0 ) {\r\n\r\n\t\t\t\tthis.boundingBox.min.set( 0, 0, 0 );\r\n\t\t\t\tthis.boundingBox.max.set( 0, 0, 0 );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( isNaN( this.boundingBox.min.x ) || isNaN( this.boundingBox.min.y ) || isNaN( this.boundingBox.min.z ) ) {\r\n\r\n\t\t\t\tTHREE.error( 'THREE.BufferGeometry.computeBoundingBox: Computed min/max have NaN values. The \"position\" attribute is likely to have NaN values.' );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t}(),\r\n\r\n\tcomputeBoundingSphere: function () {\r\n\r\n\t\tvar box = new THREE.Box3();\r\n\t\tvar vector = new THREE.Vector3();\r\n\r\n\t\treturn function () {\r\n\r\n\t\t\tif ( this.boundingSphere === null ) {\r\n\r\n\t\t\t\tthis.boundingSphere = new THREE.Sphere();\r\n\r\n\t\t\t}\r\n\r\n\t\t\tvar positions = this.attributes.position.array;\r\n\r\n\t\t\tif ( positions ) {\r\n\r\n\t\t\t\tbox.makeEmpty();\r\n\r\n\t\t\t\tvar center = this.boundingSphere.center;\r\n\r\n\t\t\t\tfor ( var i = 0, il = positions.length; i < il; i += 3 ) {\r\n\r\n\t\t\t\t\tvector.set( positions[ i ], positions[ i + 1 ], positions[ i + 2 ] );\r\n\t\t\t\t\tbox.expandByPoint( vector );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tbox.center( center );\r\n\r\n\t\t\t\t// hoping to find a boundingSphere with a radius smaller than the\r\n\t\t\t\t// boundingSphere of the boundingBox: sqrt(3) smaller in the best case\r\n\r\n\t\t\t\tvar maxRadiusSq = 0;\r\n\r\n\t\t\t\tfor ( var i = 0, il = positions.length; i < il; i += 3 ) {\r\n\r\n\t\t\t\t\tvector.set( positions[ i ], positions[ i + 1 ], positions[ i + 2 ] );\r\n\t\t\t\t\tmaxRadiusSq = Math.max( maxRadiusSq, center.distanceToSquared( vector ) );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tthis.boundingSphere.radius = Math.sqrt( maxRadiusSq );\r\n\r\n\t\t\t\tif ( isNaN( this.boundingSphere.radius ) ) {\r\n\r\n\t\t\t\t\tTHREE.error( 'THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The \"position\" attribute is likely to have NaN values.' );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t}(),\r\n\r\n\tcomputeFaceNormals: function () {\r\n\r\n\t\t// backwards compatibility\r\n\r\n\t},\r\n\r\n\tcomputeVertexNormals: function () {\r\n\r\n\t\tvar attributes = this.attributes;\r\n\r\n\t\tif ( attributes.position ) {\r\n\r\n\t\t\tvar positions = attributes.position.array;\r\n\r\n\t\t\tif ( attributes.normal === undefined ) {\r\n\r\n\t\t\t\tthis.addAttribute( 'normal', new THREE.BufferAttribute( new Float32Array( positions.length ), 3 ) );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\t// reset existing normals to zero\r\n\r\n\t\t\t\tvar normals = attributes.normal.array;\r\n\r\n\t\t\t\tfor ( var i = 0, il = normals.length; i < il; i ++ ) {\r\n\r\n\t\t\t\t\tnormals[ i ] = 0;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\tvar normals = attributes.normal.array;\r\n\r\n\t\t\tvar vA, vB, vC,\r\n\r\n\t\t\tpA = new THREE.Vector3(),\r\n\t\t\tpB = new THREE.Vector3(),\r\n\t\t\tpC = new THREE.Vector3(),\r\n\r\n\t\t\tcb = new THREE.Vector3(),\r\n\t\t\tab = new THREE.Vector3();\r\n\r\n\t\t\t// indexed elements\r\n\r\n\t\t\tif ( attributes.index ) {\r\n\r\n\t\t\t\tvar indices = attributes.index.array;\r\n\r\n\t\t\t\tvar offsets = ( this.offsets.length > 0 ? this.offsets : [ { start: 0, count: indices.length, index: 0 } ] );\r\n\r\n\t\t\t\tfor ( var j = 0, jl = offsets.length; j < jl; ++ j ) {\r\n\r\n\t\t\t\t\tvar start = offsets[ j ].start;\r\n\t\t\t\t\tvar count = offsets[ j ].count;\r\n\t\t\t\t\tvar index = offsets[ j ].index;\r\n\r\n\t\t\t\t\tfor ( var i = start, il = start + count; i < il; i += 3 ) {\r\n\r\n\t\t\t\t\t\tvA = ( index + indices[ i ] ) * 3;\r\n\t\t\t\t\t\tvB = ( index + indices[ i + 1 ] ) * 3;\r\n\t\t\t\t\t\tvC = ( index + indices[ i + 2 ] ) * 3;\r\n\r\n\t\t\t\t\t\tpA.fromArray( positions, vA );\r\n\t\t\t\t\t\tpB.fromArray( positions, vB );\r\n\t\t\t\t\t\tpC.fromArray( positions, vC );\r\n\r\n\t\t\t\t\t\tcb.subVectors( pC, pB );\r\n\t\t\t\t\t\tab.subVectors( pA, pB );\r\n\t\t\t\t\t\tcb.cross( ab );\r\n\r\n\t\t\t\t\t\tnormals[ vA ] += cb.x;\r\n\t\t\t\t\t\tnormals[ vA + 1 ] += cb.y;\r\n\t\t\t\t\t\tnormals[ vA + 2 ] += cb.z;\r\n\r\n\t\t\t\t\t\tnormals[ vB ] += cb.x;\r\n\t\t\t\t\t\tnormals[ vB + 1 ] += cb.y;\r\n\t\t\t\t\t\tnormals[ vB + 2 ] += cb.z;\r\n\r\n\t\t\t\t\t\tnormals[ vC ] += cb.x;\r\n\t\t\t\t\t\tnormals[ vC + 1 ] += cb.y;\r\n\t\t\t\t\t\tnormals[ vC + 2 ] += cb.z;\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\t// non-indexed elements (unconnected triangle soup)\r\n\r\n\t\t\t\tfor ( var i = 0, il = positions.length; i < il; i += 9 ) {\r\n\r\n\t\t\t\t\tpA.fromArray( positions, i );\r\n\t\t\t\t\tpB.fromArray( positions, i + 3 );\r\n\t\t\t\t\tpC.fromArray( positions, i + 6 );\r\n\r\n\t\t\t\t\tcb.subVectors( pC, pB );\r\n\t\t\t\t\tab.subVectors( pA, pB );\r\n\t\t\t\t\tcb.cross( ab );\r\n\r\n\t\t\t\t\tnormals[ i ] = cb.x;\r\n\t\t\t\t\tnormals[ i + 1 ] = cb.y;\r\n\t\t\t\t\tnormals[ i + 2 ] = cb.z;\r\n\r\n\t\t\t\t\tnormals[ i + 3 ] = cb.x;\r\n\t\t\t\t\tnormals[ i + 4 ] = cb.y;\r\n\t\t\t\t\tnormals[ i + 5 ] = cb.z;\r\n\r\n\t\t\t\t\tnormals[ i + 6 ] = cb.x;\r\n\t\t\t\t\tnormals[ i + 7 ] = cb.y;\r\n\t\t\t\t\tnormals[ i + 8 ] = cb.z;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\tthis.normalizeNormals();\r\n\r\n\t\t\tattributes.normal.needsUpdate = true;\r\n\r\n\t\t}\r\n\r\n\t},\r\n\r\n\tcomputeTangents: function () {\r\n\r\n\t\t// based on http://www.terathon.com/code/tangent.html\r\n\t\t// (per vertex tangents)\r\n\r\n\t\tif ( this.attributes.index === undefined ||\r\n\t\t\t this.attributes.position === undefined ||\r\n\t\t\t this.attributes.normal === undefined ||\r\n\t\t\t this.attributes.uv === undefined ) {\r\n\r\n\t\t\tTHREE.warn( 'THREE.BufferGeometry: Missing required attributes (index, position, normal or uv) in BufferGeometry.computeTangents()' );\r\n\t\t\treturn;\r\n\r\n\t\t}\r\n\r\n\t\tvar indices = this.attributes.index.array;\r\n\t\tvar positions = this.attributes.position.array;\r\n\t\tvar normals = this.attributes.normal.array;\r\n\t\tvar uvs = this.attributes.uv.array;\r\n\r\n\t\tvar nVertices = positions.length / 3;\r\n\r\n\t\tif ( this.attributes.tangent === undefined ) {\r\n\r\n\t\t\tthis.addAttribute( 'tangent', new THREE.BufferAttribute( new Float32Array( 4 * nVertices ), 4 ) );\r\n\r\n\t\t}\r\n\r\n\t\tvar tangents = this.attributes.tangent.array;\r\n\r\n\t\tvar tan1 = [], tan2 = [];\r\n\r\n\t\tfor ( var k = 0; k < nVertices; k ++ ) {\r\n\r\n\t\t\ttan1[ k ] = new THREE.Vector3();\r\n\t\t\ttan2[ k ] = new THREE.Vector3();\r\n\r\n\t\t}\r\n\r\n\t\tvar vA = new THREE.Vector3(),\r\n\t\t\tvB = new THREE.Vector3(),\r\n\t\t\tvC = new THREE.Vector3(),\r\n\r\n\t\t\tuvA = new THREE.Vector2(),\r\n\t\t\tuvB = new THREE.Vector2(),\r\n\t\t\tuvC = new THREE.Vector2(),\r\n\r\n\t\t\tx1, x2, y1, y2, z1, z2,\r\n\t\t\ts1, s2, t1, t2, r;\r\n\r\n\t\tvar sdir = new THREE.Vector3(), tdir = new THREE.Vector3();\r\n\r\n\t\tfunction handleTriangle( a, b, c ) {\r\n\r\n\t\t\tvA.fromArray( positions, a * 3 );\r\n\t\t\tvB.fromArray( positions, b * 3 );\r\n\t\t\tvC.fromArray( positions, c * 3 );\r\n\r\n\t\t\tuvA.fromArray( uvs, a * 2 );\r\n\t\t\tuvB.fromArray( uvs, b * 2 );\r\n\t\t\tuvC.fromArray( uvs, c * 2 );\r\n\r\n\t\t\tx1 = vB.x - vA.x;\r\n\t\t\tx2 = vC.x - vA.x;\r\n\r\n\t\t\ty1 = vB.y - vA.y;\r\n\t\t\ty2 = vC.y - vA.y;\r\n\r\n\t\t\tz1 = vB.z - vA.z;\r\n\t\t\tz2 = vC.z - vA.z;\r\n\r\n\t\t\ts1 = uvB.x - uvA.x;\r\n\t\t\ts2 = uvC.x - uvA.x;\r\n\r\n\t\t\tt1 = uvB.y - uvA.y;\r\n\t\t\tt2 = uvC.y - uvA.y;\r\n\r\n\t\t\tr = 1.0 / ( s1 * t2 - s2 * t1 );\r\n\r\n\t\t\tsdir.set(\r\n\t\t\t\t( t2 * x1 - t1 * x2 ) * r,\r\n\t\t\t\t( t2 * y1 - t1 * y2 ) * r,\r\n\t\t\t\t( t2 * z1 - t1 * z2 ) * r\r\n\t\t\t);\r\n\r\n\t\t\ttdir.set(\r\n\t\t\t\t( s1 * x2 - s2 * x1 ) * r,\r\n\t\t\t\t( s1 * y2 - s2 * y1 ) * r,\r\n\t\t\t\t( s1 * z2 - s2 * z1 ) * r\r\n\t\t\t);\r\n\r\n\t\t\ttan1[ a ].add( sdir );\r\n\t\t\ttan1[ b ].add( sdir );\r\n\t\t\ttan1[ c ].add( sdir );\r\n\r\n\t\t\ttan2[ a ].add( tdir );\r\n\t\t\ttan2[ b ].add( tdir );\r\n\t\t\ttan2[ c ].add( tdir );\r\n\r\n\t\t}\r\n\r\n\t\tvar i, il;\r\n\t\tvar j, jl;\r\n\t\tvar iA, iB, iC;\r\n\r\n\t\tif ( this.drawcalls.length === 0 ) {\r\n\r\n\t\t\tthis.addDrawCall( 0, indices.length, 0 );\r\n\r\n\t\t}\r\n\r\n\t\tvar drawcalls = this.drawcalls;\r\n\r\n\t\tfor ( j = 0, jl = drawcalls.length; j < jl; ++ j ) {\r\n\r\n\t\t\tvar start = drawcalls[ j ].start;\r\n\t\t\tvar count = drawcalls[ j ].count;\r\n\t\t\tvar index = drawcalls[ j ].index;\r\n\r\n\t\t\tfor ( i = start, il = start + count; i < il; i += 3 ) {\r\n\r\n\t\t\t\tiA = index + indices[ i ];\r\n\t\t\t\tiB = index + indices[ i + 1 ];\r\n\t\t\t\tiC = index + indices[ i + 2 ];\r\n\r\n\t\t\t\thandleTriangle( iA, iB, iC );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tvar tmp = new THREE.Vector3(), tmp2 = new THREE.Vector3();\r\n\t\tvar n = new THREE.Vector3(), n2 = new THREE.Vector3();\r\n\t\tvar w, t, test;\r\n\r\n\t\tfunction handleVertex( v ) {\r\n\r\n\t\t\tn.fromArray( normals, v * 3 );\r\n\t\t\tn2.copy( n );\r\n\r\n\t\t\tt = tan1[ v ];\r\n\r\n\t\t\t// Gram-Schmidt orthogonalize\r\n\r\n\t\t\ttmp.copy( t );\r\n\t\t\ttmp.sub( n.multiplyScalar( n.dot( t ) ) ).normalize();\r\n\r\n\t\t\t// Calculate handedness\r\n\r\n\t\t\ttmp2.crossVectors( n2, t );\r\n\t\t\ttest = tmp2.dot( tan2[ v ] );\r\n\t\t\tw = ( test < 0.0 ) ? - 1.0 : 1.0;\r\n\r\n\t\t\ttangents[ v * 4 ] = tmp.x;\r\n\t\t\ttangents[ v * 4 + 1 ] = tmp.y;\r\n\t\t\ttangents[ v * 4 + 2 ] = tmp.z;\r\n\t\t\ttangents[ v * 4 + 3 ] = w;\r\n\r\n\t\t}\r\n\r\n\t\tfor ( j = 0, jl = drawcalls.length; j < jl; ++ j ) {\r\n\r\n\t\t\tvar start = drawcalls[ j ].start;\r\n\t\t\tvar count = drawcalls[ j ].count;\r\n\t\t\tvar index = drawcalls[ j ].index;\r\n\r\n\t\t\tfor ( i = start, il = start + count; i < il; i += 3 ) {\r\n\r\n\t\t\t\tiA = index + indices[ i ];\r\n\t\t\t\tiB = index + indices[ i + 1 ];\r\n\t\t\t\tiC = index + indices[ i + 2 ];\r\n\r\n\t\t\t\thandleVertex( iA );\r\n\t\t\t\thandleVertex( iB );\r\n\t\t\t\thandleVertex( iC );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t},\r\n\r\n\t/*\r\n\tCompute the draw offset for large models by chunking the index buffer into chunks of 65k addressable vertices.\r\n\tThis method will effectively rewrite the index buffer and remap all attributes to match the new indices.\r\n\tWARNING: This method will also expand the vertex count to prevent sprawled triangles across draw offsets.\r\n\tsize - Defaults to 65535, but allows for larger or smaller chunks.\r\n\t*/\r\n\tcomputeOffsets: function ( size ) {\r\n\r\n\t\tif ( size === undefined ) size = 65535; // WebGL limits type of index buffer values to 16-bit.\r\n\r\n\t\tvar indices = this.attributes.index.array;\r\n\t\tvar vertices = this.attributes.position.array;\r\n\r\n\t\tvar facesCount = ( indices.length / 3 );\r\n\r\n\t\t/*\r\n\t\tconsole.log(\"Computing buffers in offsets of \"+size+\" -> indices:\"+indices.length+\" vertices:\"+vertices.length);\r\n\t\tconsole.log(\"Faces to process: \"+(indices.length/3));\r\n\t\tconsole.log(\"Reordering \"+verticesCount+\" vertices.\");\r\n\t\t*/\r\n\r\n\t\tvar sortedIndices = new Uint16Array( indices.length ); //16-bit buffers\r\n\t\tvar indexPtr = 0;\r\n\t\tvar vertexPtr = 0;\r\n\r\n\t\tvar offsets = [ { start:0, count:0, index:0 } ];\r\n\t\tvar offset = offsets[ 0 ];\r\n\r\n\t\tvar duplicatedVertices = 0;\r\n\t\tvar newVerticeMaps = 0;\r\n\t\tvar faceVertices = new Int32Array( 6 );\r\n\t\tvar vertexMap = new Int32Array( vertices.length );\r\n\t\tvar revVertexMap = new Int32Array( vertices.length );\r\n\t\tfor ( var j = 0; j < vertices.length; j ++ ) { vertexMap[ j ] = - 1; revVertexMap[ j ] = - 1; }\r\n\r\n\t\t/*\r\n\t\t\tTraverse every face and reorder vertices in the proper offsets of 65k.\r\n\t\t\tWe can have more than 65k entries in the index buffer per offset, but only reference 65k values.\r\n\t\t*/\r\n\t\tfor ( var findex = 0; findex < facesCount; findex ++ ) {\r\n\t\t\tnewVerticeMaps = 0;\r\n\r\n\t\t\tfor ( var vo = 0; vo < 3; vo ++ ) {\r\n\t\t\t\tvar vid = indices[ findex * 3 + vo ];\r\n\t\t\t\tif ( vertexMap[ vid ] == - 1 ) {\r\n\t\t\t\t\t//Unmapped vertice\r\n\t\t\t\t\tfaceVertices[ vo * 2 ] = vid;\r\n\t\t\t\t\tfaceVertices[ vo * 2 + 1 ] = - 1;\r\n\t\t\t\t\tnewVerticeMaps ++;\r\n\t\t\t\t} else if ( vertexMap[ vid ] < offset.index ) {\r\n\t\t\t\t\t//Reused vertices from previous block (duplicate)\r\n\t\t\t\t\tfaceVertices[ vo * 2 ] = vid;\r\n\t\t\t\t\tfaceVertices[ vo * 2 + 1 ] = - 1;\r\n\t\t\t\t\tduplicatedVertices ++;\r\n\t\t\t\t} else {\r\n\t\t\t\t\t//Reused vertice in the current block\r\n\t\t\t\t\tfaceVertices[ vo * 2 ] = vid;\r\n\t\t\t\t\tfaceVertices[ vo * 2 + 1 ] = vertexMap[ vid ];\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tvar faceMax = vertexPtr + newVerticeMaps;\r\n\t\t\tif ( faceMax > ( offset.index + size ) ) {\r\n\t\t\t\tvar new_offset = { start:indexPtr, count:0, index:vertexPtr };\r\n\t\t\t\toffsets.push( new_offset );\r\n\t\t\t\toffset = new_offset;\r\n\r\n\t\t\t\t//Re-evaluate reused vertices in light of new offset.\r\n\t\t\t\tfor ( var v = 0; v < 6; v += 2 ) {\r\n\t\t\t\t\tvar new_vid = faceVertices[ v + 1 ];\r\n\t\t\t\t\tif ( new_vid > - 1 && new_vid < offset.index )\r\n\t\t\t\t\t\tfaceVertices[ v + 1 ] = - 1;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\t//Reindex the face.\r\n\t\t\tfor ( var v = 0; v < 6; v += 2 ) {\r\n\t\t\t\tvar vid = faceVertices[ v ];\r\n\t\t\t\tvar new_vid = faceVertices[ v + 1 ];\r\n\r\n\t\t\t\tif ( new_vid === - 1 )\r\n\t\t\t\t\tnew_vid = vertexPtr ++;\r\n\r\n\t\t\t\tvertexMap[ vid ] = new_vid;\r\n\t\t\t\trevVertexMap[ new_vid ] = vid;\r\n\t\t\t\tsortedIndices[ indexPtr ++ ] = new_vid - offset.index; //XXX overflows at 16bit\r\n\t\t\t\toffset.count ++;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t/* Move all attribute values to map to the new computed indices , also expand the vertice stack to match our new vertexPtr. */\r\n\t\tthis.reorderBuffers( sortedIndices, revVertexMap, vertexPtr );\r\n\t\tthis.offsets = offsets; // TODO: Deprecate\r\n\t\tthis.drawcalls = offsets;\r\n\r\n\t\t/*\r\n\t\tvar orderTime = Date.now();\r\n\t\tconsole.log(\"Reorder time: \"+(orderTime-s)+\"ms\");\r\n\t\tconsole.log(\"Duplicated \"+duplicatedVertices+\" vertices.\");\r\n\t\tconsole.log(\"Compute Buffers time: \"+(Date.now()-s)+\"ms\");\r\n\t\tconsole.log(\"Draw offsets: \"+offsets.length);\r\n\t\t*/\r\n\r\n\t\treturn offsets;\r\n\r\n\t},\r\n\r\n\tmerge: function ( geometry, offset ) {\r\n\r\n\t\tif ( geometry instanceof THREE.BufferGeometry === false ) {\r\n\r\n\t\t\tTHREE.error( 'THREE.BufferGeometry.merge(): geometry not an instance of THREE.BufferGeometry.', geometry );\r\n\t\t\treturn;\r\n\r\n\t\t}\r\n\r\n\t\tif ( offset === undefined ) offset = 0;\r\n\r\n\t\tvar attributes = this.attributes;\r\n\r\n\t\tfor ( var key in attributes ) {\r\n\r\n\t\t\tif ( geometry.attributes[ key ] === undefined ) continue;\r\n\r\n\t\t\tvar attribute1 = attributes[ key ];\r\n\t\t\tvar attributeArray1 = attribute1.array;\r\n\r\n\t\t\tvar attribute2 = geometry.attributes[ key ];\r\n\t\t\tvar attributeArray2 = attribute2.array;\r\n\r\n\t\t\tvar attributeSize = attribute2.itemSize;\r\n\r\n\t\t\tfor ( var i = 0, j = attributeSize * offset; i < attributeArray2.length; i ++, j ++ ) {\r\n\r\n\t\t\t\tattributeArray1[ j ] = attributeArray2[ i ];\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tnormalizeNormals: function () {\r\n\r\n\t\tvar normals = this.attributes.normal.array;\r\n\r\n\t\tvar x, y, z, n;\r\n\r\n\t\tfor ( var i = 0, il = normals.length; i < il; i += 3 ) {\r\n\r\n\t\t\tx = normals[ i ];\r\n\t\t\ty = normals[ i + 1 ];\r\n\t\t\tz = normals[ i + 2 ];\r\n\r\n\t\t\tn = 1.0 / Math.sqrt( x * x + y * y + z * z );\r\n\r\n\t\t\tnormals[ i ] *= n;\r\n\t\t\tnormals[ i + 1 ] *= n;\r\n\t\t\tnormals[ i + 2 ] *= n;\r\n\r\n\t\t}\r\n\r\n\t},\r\n\r\n\t/*\r\n\t\treoderBuffers:\r\n\t\tReorder attributes based on a new indexBuffer and indexMap.\r\n\t\tindexBuffer - Uint16Array of the new ordered indices.\r\n\t\tindexMap - Int32Array where the position is the new vertex ID and the value the old vertex ID for each vertex.\r\n\t\tvertexCount - Amount of total vertices considered in this reordering (in case you want to grow the vertice stack).\r\n\t*/\r\n\treorderBuffers: function ( indexBuffer, indexMap, vertexCount ) {\r\n\r\n\t\t/* Create a copy of all attributes for reordering. */\r\n\t\tvar sortedAttributes = {};\r\n\t\tfor ( var attr in this.attributes ) {\r\n\t\t\tif ( attr == 'index' )\r\n\t\t\t\tcontinue;\r\n\t\t\tvar sourceArray = this.attributes[ attr ].array;\r\n\t\t\tsortedAttributes[ attr ] = new sourceArray.constructor( this.attributes[ attr ].itemSize * vertexCount );\r\n\t\t}\r\n\r\n\t\t/* Move attribute positions based on the new index map */\r\n\t\tfor ( var new_vid = 0; new_vid < vertexCount; new_vid ++ ) {\r\n\t\t\tvar vid = indexMap[ new_vid ];\r\n\t\t\tfor ( var attr in this.attributes ) {\r\n\t\t\t\tif ( attr == 'index' )\r\n\t\t\t\t\tcontinue;\r\n\t\t\t\tvar attrArray = this.attributes[ attr ].array;\r\n\t\t\t\tvar attrSize = this.attributes[ attr ].itemSize;\r\n\t\t\t\tvar sortedAttr = sortedAttributes[ attr ];\r\n\t\t\t\tfor ( var k = 0; k < attrSize; k ++ )\r\n\t\t\t\t\tsortedAttr[ new_vid * attrSize + k ] = attrArray[ vid * attrSize + k ];\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t/* Carry the new sorted buffers locally */\r\n\t\tthis.attributes[ 'index' ].array = indexBuffer;\r\n\t\tfor ( var attr in this.attributes ) {\r\n\t\t\tif ( attr == 'index' )\r\n\t\t\t\tcontinue;\r\n\t\t\tthis.attributes[ attr ].array = sortedAttributes[ attr ];\r\n\t\t\tthis.attributes[ attr ].numItems = this.attributes[ attr ].itemSize * vertexCount;\r\n\t\t}\r\n\t},\r\n\r\n\ttoJSON: function () {\r\n\r\n\t\tvar output = {\r\n\t\t\tmetadata: {\r\n\t\t\t\tversion: 4.0,\r\n\t\t\t\ttype: 'BufferGeometry',\r\n\t\t\t\tgenerator: 'BufferGeometryExporter'\r\n\t\t\t},\r\n\t\t\tuuid: this.uuid,\r\n\t\t\ttype: this.type,\r\n\t\t\tdata: {\r\n\t\t\t\tattributes: {}\r\n\t\t\t}\r\n\t\t};\r\n\r\n\t\tvar attributes = this.attributes;\r\n\t\tvar offsets = this.offsets;\r\n\t\tvar boundingSphere = this.boundingSphere;\r\n\r\n\t\tfor ( var key in attributes ) {\r\n\r\n\t\t\tvar attribute = attributes[ key ];\r\n\r\n\t\t\tvar array = Array.prototype.slice.call( attribute.array );\r\n\r\n\t\t\toutput.data.attributes[ key ] = {\r\n\t\t\t\titemSize: attribute.itemSize,\r\n\t\t\t\ttype: attribute.array.constructor.name,\r\n\t\t\t\tarray: array\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tif ( offsets.length > 0 ) {\r\n\r\n\t\t\toutput.data.offsets = JSON.parse( JSON.stringify( offsets ) );\r\n\r\n\t\t}\r\n\r\n\t\tif ( boundingSphere !== null ) {\r\n\r\n\t\t\toutput.data.boundingSphere = {\r\n\t\t\t\tcenter: boundingSphere.center.toArray(),\r\n\t\t\t\tradius: boundingSphere.radius\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn output;\r\n\r\n\t},\r\n\r\n\tclone: function () {\r\n\r\n\t\tvar geometry = new THREE.BufferGeometry();\r\n\r\n\t\tfor ( var attr in this.attributes ) {\r\n\r\n\t\t\tvar sourceAttr = this.attributes[ attr ];\r\n\t\t\tgeometry.addAttribute( attr, sourceAttr.clone() );\r\n\r\n\t\t}\r\n\r\n\t\tfor ( var i = 0, il = this.offsets.length; i < il; i ++ ) {\r\n\r\n\t\t\tvar offset = this.offsets[ i ];\r\n\r\n\t\t\tgeometry.offsets.push( {\r\n\r\n\t\t\t\tstart: offset.start,\r\n\t\t\t\tindex: offset.index,\r\n\t\t\t\tcount: offset.count\r\n\r\n\t\t\t} );\r\n\r\n\t\t}\r\n\r\n\t\treturn geometry;\r\n\r\n\t},\r\n\r\n\tdispose: function () {\r\n\r\n\t\tthis.dispatchEvent( { type: 'dispose' } );\r\n\r\n\t}\r\n\r\n};\r\n\r\nTHREE.EventDispatcher.prototype.apply( THREE.BufferGeometry.prototype );\r\n\r\n// File:src/core/Geometry.js\r\n\r\n/**\r\n * @author mrdoob / http://mrdoob.com/\r\n * @author kile / http://kile.stravaganza.org/\r\n * @author alteredq / http://alteredqualia.com/\r\n * @author mikael emtinger / http://gomo.se/\r\n * @author zz85 / http://www.lab4games.net/zz85/blog\r\n * @author bhouston / http://exocortex.com\r\n */\r\n\r\nTHREE.Geometry = function () {\r\n\r\n\tObject.defineProperty( this, 'id', { value: THREE.GeometryIdCount ++ } );\r\n\r\n\tthis.uuid = THREE.Math.generateUUID();\r\n\r\n\tthis.name = '';\r\n\tthis.type = 'Geometry';\r\n\r\n\tthis.vertices = [];\r\n\tthis.colors = []; // one-to-one vertex colors, used in Points and Line\r\n\r\n\tthis.faces = [];\r\n\r\n\tthis.faceVertexUvs = [ [] ];\r\n\r\n\tthis.morphTargets = [];\r\n\tthis.morphColors = [];\r\n\tthis.morphNormals = [];\r\n\r\n\tthis.skinWeights = [];\r\n\tthis.skinIndices = [];\r\n\r\n\tthis.lineDistances = [];\r\n\r\n\tthis.boundingBox = null;\r\n\tthis.boundingSphere = null;\r\n\r\n\tthis.hasTangents = false;\r\n\r\n\tthis.dynamic = true; // the intermediate typed arrays will be deleted when set to false\r\n\r\n\t// update flags\r\n\r\n\tthis.verticesNeedUpdate = false;\r\n\tthis.elementsNeedUpdate = false;\r\n\tthis.uvsNeedUpdate = false;\r\n\tthis.normalsNeedUpdate = false;\r\n\tthis.tangentsNeedUpdate = false;\r\n\tthis.colorsNeedUpdate = false;\r\n\tthis.lineDistancesNeedUpdate = false;\r\n\r\n\tthis.groupsNeedUpdate = false;\r\n\r\n};\r\n\r\nTHREE.Geometry.prototype = {\r\n\r\n\tconstructor: THREE.Geometry,\r\n\r\n\tapplyMatrix: function ( matrix ) {\r\n\r\n\t\tvar normalMatrix = new THREE.Matrix3().getNormalMatrix( matrix );\r\n\r\n\t\tfor ( var i = 0, il = this.vertices.length; i < il; i ++ ) {\r\n\r\n\t\t\tvar vertex = this.vertices[ i ];\r\n\t\t\tvertex.applyMatrix4( matrix );\r\n\r\n\t\t}\r\n\r\n\t\tfor ( var i = 0, il = this.faces.length; i < il; i ++ ) {\r\n\r\n\t\t\tvar face = this.faces[ i ];\r\n\t\t\tface.normal.applyMatrix3( normalMatrix ).normalize();\r\n\r\n\t\t\tfor ( var j = 0, jl = face.vertexNormals.length; j < jl; j ++ ) {\r\n\r\n\t\t\t\tface.vertexNormals[ j ].applyMatrix3( normalMatrix ).normalize();\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tif ( this.boundingBox !== null ) {\r\n\r\n\t\t\tthis.computeBoundingBox();\r\n\r\n\t\t}\r\n\r\n\t\tif ( this.boundingSphere !== null ) {\r\n\r\n\t\t\tthis.computeBoundingSphere();\r\n\r\n\t\t}\r\n\r\n\t\tthis.verticesNeedUpdate = true;\r\n\t\tthis.normalsNeedUpdate = true;\r\n\r\n\t},\r\n\r\n\tfromBufferGeometry: function ( geometry ) {\r\n\r\n\t\tvar scope = this;\r\n\r\n\t\tvar attributes = geometry.attributes;\r\n\r\n\t\tvar vertices = attributes.position.array;\r\n\t\tvar indices = attributes.index !== undefined ? attributes.index.array : undefined;\r\n\t\tvar normals = attributes.normal !== undefined ? attributes.normal.array : undefined;\r\n\t\tvar colors = attributes.color !== undefined ? attributes.color.array : undefined;\r\n\t\tvar uvs = attributes.uv !== undefined ? attributes.uv.array : undefined;\r\n\r\n\t\tvar tempNormals = [];\r\n\t\tvar tempUVs = [];\r\n\r\n\t\tfor ( var i = 0, j = 0; i < vertices.length; i += 3, j += 2 ) {\r\n\r\n\t\t\tscope.vertices.push( new THREE.Vector3( vertices[ i ], vertices[ i + 1 ], vertices[ i + 2 ] ) );\r\n\r\n\t\t\tif ( normals !== undefined ) {\r\n\r\n\t\t\t\ttempNormals.push( new THREE.Vector3( normals[ i ], normals[ i + 1 ], normals[ i + 2 ] ) );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( colors !== undefined ) {\r\n\r\n\t\t\t\tscope.colors.push( new THREE.Color( colors[ i ], colors[ i + 1 ], colors[ i + 2 ] ) );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( uvs !== undefined ) {\r\n\r\n\t\t\t\ttempUVs.push( new THREE.Vector2( uvs[ j ], uvs[ j + 1 ] ) );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tvar addFace = function ( a, b, c ) {\r\n\r\n\t\t\tvar vertexNormals = normals !== undefined ? [ tempNormals[ a ].clone(), tempNormals[ b ].clone(), tempNormals[ c ].clone() ] : [];\r\n\t\t\tvar vertexColors = colors !== undefined ? [ scope.colors[ a ].clone(), scope.colors[ b ].clone(), scope.colors[ c ].clone() ] : [];\r\n\r\n\t\t\tscope.faces.push( new THREE.Face3( a, b, c, vertexNormals, vertexColors ) );\r\n\r\n\t\t\tif ( uvs !== undefined ) {\r\n\r\n\t\t\t\tscope.faceVertexUvs[ 0 ].push( [ tempUVs[ a ].clone(), tempUVs[ b ].clone(), tempUVs[ c ].clone() ] );\r\n\r\n\t\t\t}\r\n\r\n\t\t};\r\n\r\n\t\tif ( indices !== undefined ) {\r\n\r\n\t\t\tvar drawcalls = geometry.drawcalls;\r\n\r\n\t\t\tif ( drawcalls.length > 0 ) {\r\n\r\n\t\t\t\tfor ( var i = 0; i < drawcalls.length; i ++ ) {\r\n\r\n\t\t\t\t\tvar drawcall = drawcalls[ i ];\r\n\r\n\t\t\t\t\tvar start = drawcall.start;\r\n\t\t\t\t\tvar count = drawcall.count;\r\n\t\t\t\t\tvar index = drawcall.index;\r\n\r\n\t\t\t\t\tfor ( var j = start, jl = start + count; j < jl; j += 3 ) {\r\n\r\n\t\t\t\t\t\taddFace( index + indices[ j ], index + indices[ j + 1 ], index + indices[ j + 2 ] );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tfor ( var i = 0; i < indices.length; i += 3 ) {\r\n\r\n\t\t\t\t\taddFace( indices[ i ], indices[ i + 1 ], indices[ i + 2 ] );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t} else {\r\n\r\n\t\t\tfor ( var i = 0; i < vertices.length / 3; i += 3 ) {\r\n\r\n\t\t\t\taddFace( i, i + 1, i + 2 );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tthis.computeFaceNormals();\r\n\r\n\t\tif ( geometry.boundingBox !== null ) {\r\n\r\n\t\t\tthis.boundingBox = geometry.boundingBox.clone();\r\n\r\n\t\t}\r\n\r\n\t\tif ( geometry.boundingSphere !== null ) {\r\n\r\n\t\t\tthis.boundingSphere = geometry.boundingSphere.clone();\r\n\r\n\t\t}\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tcenter: function () {\r\n\r\n\t\tthis.computeBoundingBox();\r\n\r\n\t\tvar offset = this.boundingBox.center().negate();\r\n\r\n\t\tthis.applyMatrix( new THREE.Matrix4().setPosition( offset ) );\r\n\r\n\t\treturn offset;\r\n\r\n\t},\r\n\r\n\tcomputeFaceNormals: function () {\r\n\r\n\t\tvar cb = new THREE.Vector3(), ab = new THREE.Vector3();\r\n\r\n\t\tfor ( var f = 0, fl = this.faces.length; f < fl; f ++ ) {\r\n\r\n\t\t\tvar face = this.faces[ f ];\r\n\r\n\t\t\tvar vA = this.vertices[ face.a ];\r\n\t\t\tvar vB = this.vertices[ face.b ];\r\n\t\t\tvar vC = this.vertices[ face.c ];\r\n\r\n\t\t\tcb.subVectors( vC, vB );\r\n\t\t\tab.subVectors( vA, vB );\r\n\t\t\tcb.cross( ab );\r\n\r\n\t\t\tcb.normalize();\r\n\r\n\t\t\tface.normal.copy( cb );\r\n\r\n\t\t}\r\n\r\n\t},\r\n\r\n\tcomputeVertexNormals: function ( areaWeighted ) {\r\n\r\n\t\tvar v, vl, f, fl, face, vertices;\r\n\r\n\t\tvertices = new Array( this.vertices.length );\r\n\r\n\t\tfor ( v = 0, vl = this.vertices.length; v < vl; v ++ ) {\r\n\r\n\t\t\tvertices[ v ] = new THREE.Vector3();\r\n\r\n\t\t}\r\n\r\n\t\tif ( areaWeighted ) {\r\n\r\n\t\t\t// vertex normals weighted by triangle areas\r\n\t\t\t// http://www.iquilezles.org/www/articles/normals/normals.htm\r\n\r\n\t\t\tvar vA, vB, vC;\r\n\t\t\tvar cb = new THREE.Vector3(), ab = new THREE.Vector3();\r\n\r\n\t\t\tfor ( f = 0, fl = this.faces.length; f < fl; f ++ ) {\r\n\r\n\t\t\t\tface = this.faces[ f ];\r\n\r\n\t\t\t\tvA = this.vertices[ face.a ];\r\n\t\t\t\tvB = this.vertices[ face.b ];\r\n\t\t\t\tvC = this.vertices[ face.c ];\r\n\r\n\t\t\t\tcb.subVectors( vC, vB );\r\n\t\t\t\tab.subVectors( vA, vB );\r\n\t\t\t\tcb.cross( ab );\r\n\r\n\t\t\t\tvertices[ face.a ].add( cb );\r\n\t\t\t\tvertices[ face.b ].add( cb );\r\n\t\t\t\tvertices[ face.c ].add( cb );\r\n\r\n\t\t\t}\r\n\r\n\t\t} else {\r\n\r\n\t\t\tfor ( f = 0, fl = this.faces.length; f < fl; f ++ ) {\r\n\r\n\t\t\t\tface = this.faces[ f ];\r\n\r\n\t\t\t\tvertices[ face.a ].add( face.normal );\r\n\t\t\t\tvertices[ face.b ].add( face.normal );\r\n\t\t\t\tvertices[ face.c ].add( face.normal );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tfor ( v = 0, vl = this.vertices.length; v < vl; v ++ ) {\r\n\r\n\t\t\tvertices[ v ].normalize();\r\n\r\n\t\t}\r\n\r\n\t\tfor ( f = 0, fl = this.faces.length; f < fl; f ++ ) {\r\n\r\n\t\t\tface = this.faces[ f ];\r\n\r\n\t\t\tface.vertexNormals[ 0 ] = vertices[ face.a ].clone();\r\n\t\t\tface.vertexNormals[ 1 ] = vertices[ face.b ].clone();\r\n\t\t\tface.vertexNormals[ 2 ] = vertices[ face.c ].clone();\r\n\r\n\t\t}\r\n\r\n\t},\r\n\r\n\tcomputeMorphNormals: function () {\r\n\r\n\t\tvar i, il, f, fl, face;\r\n\r\n\t\t// save original normals\r\n\t\t// - create temp variables on first access\r\n\t\t// otherwise just copy (for faster repeated calls)\r\n\r\n\t\tfor ( f = 0, fl = this.faces.length; f < fl; f ++ ) {\r\n\r\n\t\t\tface = this.faces[ f ];\r\n\r\n\t\t\tif ( ! face.__originalFaceNormal ) {\r\n\r\n\t\t\t\tface.__originalFaceNormal = face.normal.clone();\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tface.__originalFaceNormal.copy( face.normal );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( ! face.__originalVertexNormals ) face.__originalVertexNormals = [];\r\n\r\n\t\t\tfor ( i = 0, il = face.vertexNormals.length; i < il; i ++ ) {\r\n\r\n\t\t\t\tif ( ! face.__originalVertexNormals[ i ] ) {\r\n\r\n\t\t\t\t\tface.__originalVertexNormals[ i ] = face.vertexNormals[ i ].clone();\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\tface.__originalVertexNormals[ i ].copy( face.vertexNormals[ i ] );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\t// use temp geometry to compute face and vertex normals for each morph\r\n\r\n\t\tvar tmpGeo = new THREE.Geometry();\r\n\t\ttmpGeo.faces = this.faces;\r\n\r\n\t\tfor ( i = 0, il = this.morphTargets.length; i < il; i ++ ) {\r\n\r\n\t\t\t// create on first access\r\n\r\n\t\t\tif ( ! this.morphNormals[ i ] ) {\r\n\r\n\t\t\t\tthis.morphNormals[ i ] = {};\r\n\t\t\t\tthis.morphNormals[ i ].faceNormals = [];\r\n\t\t\t\tthis.morphNormals[ i ].vertexNormals = [];\r\n\r\n\t\t\t\tvar dstNormalsFace = this.morphNormals[ i ].faceNormals;\r\n\t\t\t\tvar dstNormalsVertex = this.morphNormals[ i ].vertexNormals;\r\n\r\n\t\t\t\tvar faceNormal, vertexNormals;\r\n\r\n\t\t\t\tfor ( f = 0, fl = this.faces.length; f < fl; f ++ ) {\r\n\r\n\t\t\t\t\tfaceNormal = new THREE.Vector3();\r\n\t\t\t\t\tvertexNormals = { a: new THREE.Vector3(), b: new THREE.Vector3(), c: new THREE.Vector3() };\r\n\r\n\t\t\t\t\tdstNormalsFace.push( faceNormal );\r\n\t\t\t\t\tdstNormalsVertex.push( vertexNormals );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\tvar morphNormals = this.morphNormals[ i ];\r\n\r\n\t\t\t// set vertices to morph target\r\n\r\n\t\t\ttmpGeo.vertices = this.morphTargets[ i ].vertices;\r\n\r\n\t\t\t// compute morph normals\r\n\r\n\t\t\ttmpGeo.computeFaceNormals();\r\n\t\t\ttmpGeo.computeVertexNormals();\r\n\r\n\t\t\t// store morph normals\r\n\r\n\t\t\tvar faceNormal, vertexNormals;\r\n\r\n\t\t\tfor ( f = 0, fl = this.faces.length; f < fl; f ++ ) {\r\n\r\n\t\t\t\tface = this.faces[ f ];\r\n\r\n\t\t\t\tfaceNormal = morphNormals.faceNormals[ f ];\r\n\t\t\t\tvertexNormals = morphNormals.vertexNormals[ f ];\r\n\r\n\t\t\t\tfaceNormal.copy( face.normal );\r\n\r\n\t\t\t\tvertexNormals.a.copy( face.vertexNormals[ 0 ] );\r\n\t\t\t\tvertexNormals.b.copy( face.vertexNormals[ 1 ] );\r\n\t\t\t\tvertexNormals.c.copy( face.vertexNormals[ 2 ] );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\t// restore original normals\r\n\r\n\t\tfor ( f = 0, fl = this.faces.length; f < fl; f ++ ) {\r\n\r\n\t\t\tface = this.faces[ f ];\r\n\r\n\t\t\tface.normal = face.__originalFaceNormal;\r\n\t\t\tface.vertexNormals = face.__originalVertexNormals;\r\n\r\n\t\t}\r\n\r\n\t},\r\n\r\n\tcomputeTangents: function () {\r\n\r\n\t\t// based on http://www.terathon.com/code/tangent.html\r\n\t\t// tangents go to vertices\r\n\r\n\t\tvar f, fl, v, vl, i, vertexIndex,\r\n\t\t\tface, uv, vA, vB, vC, uvA, uvB, uvC,\r\n\t\t\tx1, x2, y1, y2, z1, z2,\r\n\t\t\ts1, s2, t1, t2, r, t, test,\r\n\t\t\ttan1 = [], tan2 = [],\r\n\t\t\tsdir = new THREE.Vector3(), tdir = new THREE.Vector3(),\r\n\t\t\ttmp = new THREE.Vector3(), tmp2 = new THREE.Vector3(),\r\n\t\t\tn = new THREE.Vector3(), w;\r\n\r\n\t\tfor ( v = 0, vl = this.vertices.length; v < vl; v ++ ) {\r\n\r\n\t\t\ttan1[ v ] = new THREE.Vector3();\r\n\t\t\ttan2[ v ] = new THREE.Vector3();\r\n\r\n\t\t}\r\n\r\n\t\tfunction handleTriangle( context, a, b, c, ua, ub, uc ) {\r\n\r\n\t\t\tvA = context.vertices[ a ];\r\n\t\t\tvB = context.vertices[ b ];\r\n\t\t\tvC = context.vertices[ c ];\r\n\r\n\t\t\tuvA = uv[ ua ];\r\n\t\t\tuvB = uv[ ub ];\r\n\t\t\tuvC = uv[ uc ];\r\n\r\n\t\t\tx1 = vB.x - vA.x;\r\n\t\t\tx2 = vC.x - vA.x;\r\n\t\t\ty1 = vB.y - vA.y;\r\n\t\t\ty2 = vC.y - vA.y;\r\n\t\t\tz1 = vB.z - vA.z;\r\n\t\t\tz2 = vC.z - vA.z;\r\n\r\n\t\t\ts1 = uvB.x - uvA.x;\r\n\t\t\ts2 = uvC.x - uvA.x;\r\n\t\t\tt1 = uvB.y - uvA.y;\r\n\t\t\tt2 = uvC.y - uvA.y;\r\n\r\n\t\t\tr = 1.0 / ( s1 * t2 - s2 * t1 );\r\n\t\t\tsdir.set( ( t2 * x1 - t1 * x2 ) * r,\r\n\t\t\t\t\t ( t2 * y1 - t1 * y2 ) * r,\r\n\t\t\t\t\t ( t2 * z1 - t1 * z2 ) * r );\r\n\t\t\ttdir.set( ( s1 * x2 - s2 * x1 ) * r,\r\n\t\t\t\t\t ( s1 * y2 - s2 * y1 ) * r,\r\n\t\t\t\t\t ( s1 * z2 - s2 * z1 ) * r );\r\n\r\n\t\t\ttan1[ a ].add( sdir );\r\n\t\t\ttan1[ b ].add( sdir );\r\n\t\t\ttan1[ c ].add( sdir );\r\n\r\n\t\t\ttan2[ a ].add( tdir );\r\n\t\t\ttan2[ b ].add( tdir );\r\n\t\t\ttan2[ c ].add( tdir );\r\n\r\n\t\t}\r\n\r\n\t\tfor ( f = 0, fl = this.faces.length; f < fl; f ++ ) {\r\n\r\n\t\t\tface = this.faces[ f ];\r\n\t\t\tuv = this.faceVertexUvs[ 0 ][ f ]; // use UV layer 0 for tangents\r\n\r\n\t\t\thandleTriangle( this, face.a, face.b, face.c, 0, 1, 2 );\r\n\r\n\t\t}\r\n\r\n\t\tvar faceIndex = [ 'a', 'b', 'c', 'd' ];\r\n\r\n\t\tfor ( f = 0, fl = this.faces.length; f < fl; f ++ ) {\r\n\r\n\t\t\tface = this.faces[ f ];\r\n\r\n\t\t\tfor ( i = 0; i < Math.min( face.vertexNormals.length, 3 ); i ++ ) {\r\n\r\n\t\t\t\tn.copy( face.vertexNormals[ i ] );\r\n\r\n\t\t\t\tvertexIndex = face[ faceIndex[ i ] ];\r\n\r\n\t\t\t\tt = tan1[ vertexIndex ];\r\n\r\n\t\t\t\t// Gram-Schmidt orthogonalize\r\n\r\n\t\t\t\ttmp.copy( t );\r\n\t\t\t\ttmp.sub( n.multiplyScalar( n.dot( t ) ) ).normalize();\r\n\r\n\t\t\t\t// Calculate handedness\r\n\r\n\t\t\t\ttmp2.crossVectors( face.vertexNormals[ i ], t );\r\n\t\t\t\ttest = tmp2.dot( tan2[ vertexIndex ] );\r\n\t\t\t\tw = ( test < 0.0 ) ? - 1.0 : 1.0;\r\n\r\n\t\t\t\tface.vertexTangents[ i ] = new THREE.Vector4( tmp.x, tmp.y, tmp.z, w );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tthis.hasTangents = true;\r\n\r\n\t},\r\n\r\n\tcomputeLineDistances: function () {\r\n\r\n\t\tvar d = 0;\r\n\t\tvar vertices = this.vertices;\r\n\r\n\t\tfor ( var i = 0, il = vertices.length; i < il; i ++ ) {\r\n\r\n\t\t\tif ( i > 0 ) {\r\n\r\n\t\t\t\td += vertices[ i ].distanceTo( vertices[ i - 1 ] );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tthis.lineDistances[ i ] = d;\r\n\r\n\t\t}\r\n\r\n\t},\r\n\r\n\tcomputeBoundingBox: function () {\r\n\r\n\t\tif ( this.boundingBox === null ) {\r\n\r\n\t\t\tthis.boundingBox = new THREE.Box3();\r\n\r\n\t\t}\r\n\r\n\t\tthis.boundingBox.setFromPoints( this.vertices );\r\n\r\n\t},\r\n\r\n\tcomputeBoundingSphere: function () {\r\n\r\n\t\tif ( this.boundingSphere === null ) {\r\n\r\n\t\t\tthis.boundingSphere = new THREE.Sphere();\r\n\r\n\t\t}\r\n\r\n\t\tthis.boundingSphere.setFromPoints( this.vertices );\r\n\r\n\t},\r\n\r\n\tmerge: function ( geometry, matrix, materialIndexOffset ) {\r\n\r\n\t\tif ( geometry instanceof THREE.Geometry === false ) {\r\n\r\n\t\t\tTHREE.error( 'THREE.Geometry.merge(): geometry not an instance of THREE.Geometry.', geometry );\r\n\t\t\treturn;\r\n\r\n\t\t}\r\n\r\n\t\tvar normalMatrix,\r\n\t\tvertexOffset = this.vertices.length,\r\n\t\tvertices1 = this.vertices,\r\n\t\tvertices2 = geometry.vertices,\r\n\t\tfaces1 = this.faces,\r\n\t\tfaces2 = geometry.faces,\r\n\t\tuvs1 = this.faceVertexUvs[ 0 ],\r\n\t\tuvs2 = geometry.faceVertexUvs[ 0 ];\r\n\r\n\t\tif ( materialIndexOffset === undefined ) materialIndexOffset = 0;\r\n\r\n\t\tif ( matrix !== undefined ) {\r\n\r\n\t\t\tnormalMatrix = new THREE.Matrix3().getNormalMatrix( matrix );\r\n\r\n\t\t}\r\n\r\n\t\t// vertices\r\n\r\n\t\tfor ( var i = 0, il = vertices2.length; i < il; i ++ ) {\r\n\r\n\t\t\tvar vertex = vertices2[ i ];\r\n\r\n\t\t\tvar vertexCopy = vertex.clone();\r\n\r\n\t\t\tif ( matrix !== undefined ) vertexCopy.applyMatrix4( matrix );\r\n\r\n\t\t\tvertices1.push( vertexCopy );\r\n\r\n\t\t}\r\n\r\n\t\t// faces\r\n\r\n\t\tfor ( i = 0, il = faces2.length; i < il; i ++ ) {\r\n\r\n\t\t\tvar face = faces2[ i ], faceCopy, normal, color,\r\n\t\t\tfaceVertexNormals = face.vertexNormals,\r\n\t\t\tfaceVertexColors = face.vertexColors;\r\n\r\n\t\t\tfaceCopy = new THREE.Face3( face.a + vertexOffset, face.b + vertexOffset, face.c + vertexOffset );\r\n\t\t\tfaceCopy.normal.copy( face.normal );\r\n\r\n\t\t\tif ( normalMatrix !== undefined ) {\r\n\r\n\t\t\t\tfaceCopy.normal.applyMatrix3( normalMatrix ).normalize();\r\n\r\n\t\t\t}\r\n\r\n\t\t\tfor ( var j = 0, jl = faceVertexNormals.length; j < jl; j ++ ) {\r\n\r\n\t\t\t\tnormal = faceVertexNormals[ j ].clone();\r\n\r\n\t\t\t\tif ( normalMatrix !== undefined ) {\r\n\r\n\t\t\t\t\tnormal.applyMatrix3( normalMatrix ).normalize();\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tfaceCopy.vertexNormals.push( normal );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tfaceCopy.color.copy( face.color );\r\n\r\n\t\t\tfor ( var j = 0, jl = faceVertexColors.length; j < jl; j ++ ) {\r\n\r\n\t\t\t\tcolor = faceVertexColors[ j ];\r\n\t\t\t\tfaceCopy.vertexColors.push( color.clone() );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tfaceCopy.materialIndex = face.materialIndex + materialIndexOffset;\r\n\r\n\t\t\tfaces1.push( faceCopy );\r\n\r\n\t\t}\r\n\r\n\t\t// uvs\r\n\r\n\t\tfor ( i = 0, il = uvs2.length; i < il; i ++ ) {\r\n\r\n\t\t\tvar uv = uvs2[ i ], uvCopy = [];\r\n\r\n\t\t\tif ( uv === undefined ) {\r\n\r\n\t\t\t\tcontinue;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tfor ( var j = 0, jl = uv.length; j < jl; j ++ ) {\r\n\r\n\t\t\t\tuvCopy.push( uv[ j ].clone() );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tuvs1.push( uvCopy );\r\n\r\n\t\t}\r\n\r\n\t},\r\n\r\n\tmergeMesh: function ( mesh ) {\r\n\r\n\t\tif ( mesh instanceof THREE.Mesh === false ) {\r\n\r\n\t\t\tTHREE.error( 'THREE.Geometry.mergeMesh(): mesh not an instance of THREE.Mesh.', mesh );\r\n\t\t\treturn;\r\n\r\n\t\t}\r\n\r\n\t\tmesh.matrixAutoUpdate && mesh.updateMatrix();\r\n\r\n\t\tthis.merge( mesh.geometry, mesh.matrix );\r\n\r\n\t},\r\n\r\n\t/*\r\n\t * Checks for duplicate vertices with hashmap.\r\n\t * Duplicated vertices are removed\r\n\t * and faces' vertices are updated.\r\n\t */\r\n\r\n\tmergeVertices: function () {\r\n\r\n\t\tvar verticesMap = {}; // Hashmap for looking up vertice by position coordinates (and making sure they are unique)\r\n\t\tvar unique = [], changes = [];\r\n\r\n\t\tvar v, key;\r\n\t\tvar precisionPoints = 4; // number of decimal points, eg. 4 for epsilon of 0.0001\r\n\t\tvar precision = Math.pow( 10, precisionPoints );\r\n\t\tvar i, il, face;\r\n\t\tvar indices, j, jl;\r\n\r\n\t\tfor ( i = 0, il = this.vertices.length; i < il; i ++ ) {\r\n\r\n\t\t\tv = this.vertices[ i ];\r\n\t\t\tkey = Math.round( v.x * precision ) + '_' + Math.round( v.y * precision ) + '_' + Math.round( v.z * precision );\r\n\r\n\t\t\tif ( verticesMap[ key ] === undefined ) {\r\n\r\n\t\t\t\tverticesMap[ key ] = i;\r\n\t\t\t\tunique.push( this.vertices[ i ] );\r\n\t\t\t\tchanges[ i ] = unique.length - 1;\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\t//console.log('Duplicate vertex found. ', i, ' could be using ', verticesMap[key]);\r\n\t\t\t\tchanges[ i ] = changes[ verticesMap[ key ] ];\r\n\r\n\t\t\t}\r\n\r\n\t\t};\r\n\r\n\r\n\t\t// if faces are completely degenerate after merging vertices, we\r\n\t\t// have to remove them from the geometry.\r\n\t\tvar faceIndicesToRemove = [];\r\n\r\n\t\tfor ( i = 0, il = this.faces.length; i < il; i ++ ) {\r\n\r\n\t\t\tface = this.faces[ i ];\r\n\r\n\t\t\tface.a = changes[ face.a ];\r\n\t\t\tface.b = changes[ face.b ];\r\n\t\t\tface.c = changes[ face.c ];\r\n\r\n\t\t\tindices = [ face.a, face.b, face.c ];\r\n\r\n\t\t\tvar dupIndex = - 1;\r\n\r\n\t\t\t// if any duplicate vertices are found in a Face3\r\n\t\t\t// we have to remove the face as nothing can be saved\r\n\t\t\tfor ( var n = 0; n < 3; n ++ ) {\r\n\t\t\t\tif ( indices[ n ] == indices[ ( n + 1 ) % 3 ] ) {\r\n\r\n\t\t\t\t\tdupIndex = n;\r\n\t\t\t\t\tfaceIndicesToRemove.push( i );\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tfor ( i = faceIndicesToRemove.length - 1; i >= 0; i -- ) {\r\n\t\t\tvar idx = faceIndicesToRemove[ i ];\r\n\r\n\t\t\tthis.faces.splice( idx, 1 );\r\n\r\n\t\t\tfor ( j = 0, jl = this.faceVertexUvs.length; j < jl; j ++ ) {\r\n\r\n\t\t\t\tthis.faceVertexUvs[ j ].splice( idx, 1 );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\t// Use unique set of vertices\r\n\r\n\t\tvar diff = this.vertices.length - unique.length;\r\n\t\tthis.vertices = unique;\r\n\t\treturn diff;\r\n\r\n\t},\r\n\r\n\ttoJSON: function () {\r\n\r\n\t\tvar output = {\r\n\t\t\tmetadata: {\r\n\t\t\t\tversion: 4.0,\r\n\t\t\t\ttype: 'BufferGeometry',\r\n\t\t\t\tgenerator: 'BufferGeometryExporter'\r\n\t\t\t},\r\n\t\t\tuuid: this.uuid,\r\n\t\t\ttype: this.type\r\n\t\t};\r\n\r\n\t\tif ( this.name !== \"\" ) output.name = this.name;\r\n\r\n\t\tif ( this.parameters !== undefined ) {\r\n\r\n\t\t\tvar parameters = this.parameters;\r\n\r\n\t\t\tfor ( var key in parameters ) {\r\n\r\n\t\t\t\tif ( parameters[ key ] !== undefined ) output[ key ] = parameters[ key ];\r\n\r\n\t\t\t}\r\n\r\n\t\t\treturn output;\r\n\r\n\t\t}\r\n\r\n\t\tvar vertices = [];\r\n\r\n\t\tfor ( var i = 0; i < this.vertices.length; i ++ ) {\r\n\r\n\t\t\tvar vertex = this.vertices[ i ];\r\n\t\t\tvertices.push( vertex.x, vertex.y, vertex.z );\r\n\r\n\t\t}\r\n\r\n\t\tvar faces = [];\r\n\t\tvar normals = [];\r\n\t\tvar normalsHash = {};\r\n\t\tvar colors = [];\r\n\t\tvar colorsHash = {};\r\n\t\tvar uvs = [];\r\n\t\tvar uvsHash = {};\r\n\r\n\t\tfor ( var i = 0; i < this.faces.length; i ++ ) {\r\n\r\n\t\t\tvar face = this.faces[ i ];\r\n\r\n\t\t\tvar hasMaterial = false; // face.materialIndex !== undefined;\r\n\t\t\tvar hasFaceUv = false; // deprecated\r\n\t\t\tvar hasFaceVertexUv = this.faceVertexUvs[ 0 ][ i ] !== undefined;\r\n\t\t\tvar hasFaceNormal = face.normal.length() > 0;\r\n\t\t\tvar hasFaceVertexNormal = face.vertexNormals.length > 0;\r\n\t\t\tvar hasFaceColor = face.color.r !== 1 || face.color.g !== 1 || face.color.b !== 1;\r\n\t\t\tvar hasFaceVertexColor = face.vertexColors.length > 0;\r\n\r\n\t\t\tvar faceType = 0;\r\n\r\n\t\t\tfaceType = setBit( faceType, 0, 0 );\r\n\t\t\tfaceType = setBit( faceType, 1, hasMaterial );\r\n\t\t\tfaceType = setBit( faceType, 2, hasFaceUv );\r\n\t\t\tfaceType = setBit( faceType, 3, hasFaceVertexUv );\r\n\t\t\tfaceType = setBit( faceType, 4, hasFaceNormal );\r\n\t\t\tfaceType = setBit( faceType, 5, hasFaceVertexNormal );\r\n\t\t\tfaceType = setBit( faceType, 6, hasFaceColor );\r\n\t\t\tfaceType = setBit( faceType, 7, hasFaceVertexColor );\r\n\r\n\t\t\tfaces.push( faceType );\r\n\t\t\tfaces.push( face.a, face.b, face.c );\r\n\r\n\r\n\t\t\t/*\r\n\t\t\tif ( hasMaterial ) {\r\n\r\n\t\t\t\tfaces.push( face.materialIndex );\r\n\r\n\t\t\t}\r\n\t\t\t*/\r\n\r\n\t\t\tif ( hasFaceVertexUv ) {\r\n\r\n\t\t\t\tvar faceVertexUvs = this.faceVertexUvs[ 0 ][ i ];\r\n\r\n\t\t\t\tfaces.push(\r\n\t\t\t\t\tgetUvIndex( faceVertexUvs[ 0 ] ),\r\n\t\t\t\t\tgetUvIndex( faceVertexUvs[ 1 ] ),\r\n\t\t\t\t\tgetUvIndex( faceVertexUvs[ 2 ] )\r\n\t\t\t\t);\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( hasFaceNormal ) {\r\n\r\n\t\t\t\tfaces.push( getNormalIndex( face.normal ) );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( hasFaceVertexNormal ) {\r\n\r\n\t\t\t\tvar vertexNormals = face.vertexNormals;\r\n\r\n\t\t\t\tfaces.push(\r\n\t\t\t\t\tgetNormalIndex( vertexNormals[ 0 ] ),\r\n\t\t\t\t\tgetNormalIndex( vertexNormals[ 1 ] ),\r\n\t\t\t\t\tgetNormalIndex( vertexNormals[ 2 ] )\r\n\t\t\t\t);\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( hasFaceColor ) {\r\n\r\n\t\t\t\tfaces.push( getColorIndex( face.color ) );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( hasFaceVertexColor ) {\r\n\r\n\t\t\t\tvar vertexColors = face.vertexColors;\r\n\r\n\t\t\t\tfaces.push(\r\n\t\t\t\t\tgetColorIndex( vertexColors[ 0 ] ),\r\n\t\t\t\t\tgetColorIndex( vertexColors[ 1 ] ),\r\n\t\t\t\t\tgetColorIndex( vertexColors[ 2 ] )\r\n\t\t\t\t);\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tfunction setBit( value, position, enabled ) {\r\n\r\n\t\t\treturn enabled ? value | ( 1 << position ) : value & ( ~ ( 1 << position) );\r\n\r\n\t\t}\r\n\r\n\t\tfunction getNormalIndex( normal ) {\r\n\r\n\t\t\tvar hash = normal.x.toString() + normal.y.toString() + normal.z.toString();\r\n\r\n\t\t\tif ( normalsHash[ hash ] !== undefined ) {\r\n\r\n\t\t\t\treturn normalsHash[ hash ];\r\n\r\n\t\t\t}\r\n\r\n\t\t\tnormalsHash[ hash ] = normals.length / 3;\r\n\t\t\tnormals.push( normal.x, normal.y, normal.z );\r\n\r\n\t\t\treturn normalsHash[ hash ];\r\n\r\n\t\t}\r\n\r\n\t\tfunction getColorIndex( color ) {\r\n\r\n\t\t\tvar hash = color.r.toString() + color.g.toString() + color.b.toString();\r\n\r\n\t\t\tif ( colorsHash[ hash ] !== undefined ) {\r\n\r\n\t\t\t\treturn colorsHash[ hash ];\r\n\r\n\t\t\t}\r\n\r\n\t\t\tcolorsHash[ hash ] = colors.length;\r\n\t\t\tcolors.push( color.getHex() );\r\n\r\n\t\t\treturn colorsHash[ hash ];\r\n\r\n\t\t}\r\n\r\n\t\tfunction getUvIndex( uv ) {\r\n\r\n\t\t\tvar hash = uv.x.toString() + uv.y.toString();\r\n\r\n\t\t\tif ( uvsHash[ hash ] !== undefined ) {\r\n\r\n\t\t\t\treturn uvsHash[ hash ];\r\n\r\n\t\t\t}\r\n\r\n\t\t\tuvsHash[ hash ] = uvs.length / 2;\r\n\t\t\tuvs.push( uv.x, uv.y );\r\n\r\n\t\t\treturn uvsHash[ hash ];\r\n\r\n\t\t}\r\n\r\n\t\toutput.data = {};\r\n\r\n\t\toutput.data.vertices = vertices;\r\n\t\toutput.data.normals = normals;\r\n\t\tif ( colors.length > 0 ) output.data.colors = colors;\r\n\t\tif ( uvs.length > 0 ) output.data.uvs = [ uvs ]; // temporal backward compatibility\r\n\t\toutput.data.faces = faces;\r\n\r\n\t\t//\r\n\r\n\t\treturn output;\r\n\r\n\t},\r\n\r\n\tclone: function () {\r\n\r\n\t\tvar geometry = new THREE.Geometry();\r\n\r\n\t\tvar vertices = this.vertices;\r\n\r\n\t\tfor ( var i = 0, il = vertices.length; i < il; i ++ ) {\r\n\r\n\t\t\tgeometry.vertices.push( vertices[ i ].clone() );\r\n\r\n\t\t}\r\n\r\n\t\tvar faces = this.faces;\r\n\r\n\t\tfor ( var i = 0, il = faces.length; i < il; i ++ ) {\r\n\r\n\t\t\tgeometry.faces.push( faces[ i ].clone() );\r\n\r\n\t\t}\r\n\r\n\t\tfor ( var i = 0, il = this.faceVertexUvs.length; i < il; i ++ ) {\r\n\r\n\t\t\tvar faceVertexUvs = this.faceVertexUvs[ i ];\r\n\r\n\t\t\tif ( geometry.faceVertexUvs[ i ] === undefined ) {\r\n\r\n\t\t\t\tgeometry.faceVertexUvs[ i ] = [];\r\n\r\n\t\t\t}\r\n\r\n\t\t\tfor ( var j = 0, jl = faceVertexUvs.length; j < jl; j ++ ) {\r\n\r\n\t\t\t\tvar uvs = faceVertexUvs[ j ], uvsCopy = [];\r\n\r\n\t\t\t\tfor ( var k = 0, kl = uvs.length; k < kl; k ++ ) {\r\n\r\n\t\t\t\t\tvar uv = uvs[ k ];\r\n\r\n\t\t\t\t\tuvsCopy.push( uv.clone() );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tgeometry.faceVertexUvs[ i ].push( uvsCopy );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn geometry;\r\n\r\n\t},\r\n\r\n\tdispose: function () {\r\n\r\n\t\tthis.dispatchEvent( { type: 'dispose' } );\r\n\r\n\t}\r\n\r\n};\r\n\r\nTHREE.EventDispatcher.prototype.apply( THREE.Geometry.prototype );\r\n\r\nTHREE.GeometryIdCount = 0;\r\n\r\n// File:src/cameras/Camera.js\r\n\r\n/**\r\n * @author mrdoob / http://mrdoob.com/\r\n * @author mikael emtinger / http://gomo.se/\r\n * @author WestLangley / http://github.com/WestLangley\r\n*/\r\n\r\nTHREE.Camera = function () {\r\n\r\n\tTHREE.Object3D.call( this );\r\n\r\n\tthis.type = 'Camera';\r\n\r\n\tthis.matrixWorldInverse = new THREE.Matrix4();\r\n\tthis.projectionMatrix = new THREE.Matrix4();\r\n\r\n};\r\n\r\nTHREE.Camera.prototype = Object.create( THREE.Object3D.prototype );\r\nTHREE.Camera.prototype.constructor = THREE.Camera;\r\n\r\nTHREE.Camera.prototype.getWorldDirection = function () {\r\n\r\n\tvar quaternion = new THREE.Quaternion();\r\n\r\n\treturn function ( optionalTarget ) {\r\n\r\n\t\tvar result = optionalTarget || new THREE.Vector3();\r\n\r\n\t\tthis.getWorldQuaternion( quaternion );\r\n\r\n\t\treturn result.set( 0, 0, - 1 ).applyQuaternion( quaternion );\r\n\r\n\t}\r\n\r\n}();\r\n\r\nTHREE.Camera.prototype.lookAt = function () {\r\n\r\n\t// This routine does not support cameras with rotated and/or translated parent(s)\r\n\r\n\tvar m1 = new THREE.Matrix4();\r\n\r\n\treturn function ( vector ) {\r\n\r\n\t\tm1.lookAt( this.position, vector, this.up );\r\n\r\n\t\tthis.quaternion.setFromRotationMatrix( m1 );\r\n\r\n\t};\r\n\r\n}();\r\n\r\nTHREE.Camera.prototype.clone = function ( camera ) {\r\n\r\n\tif ( camera === undefined ) camera = new THREE.Camera();\r\n\r\n\tTHREE.Object3D.prototype.clone.call( this, camera );\r\n\r\n\tcamera.matrixWorldInverse.copy( this.matrixWorldInverse );\r\n\tcamera.projectionMatrix.copy( this.projectionMatrix );\r\n\r\n\treturn camera;\r\n};\r\n\r\n// File:src/cameras/CubeCamera.js\r\n\r\n/**\r\n * Camera for rendering cube maps\r\n *\t- renders scene into axis-aligned cube\r\n *\r\n * @author alteredq / http://alteredqualia.com/\r\n */\r\n\r\nTHREE.CubeCamera = function ( near, far, cubeResolution ) {\r\n\r\n\tTHREE.Object3D.call( this );\r\n\r\n\tthis.type = 'CubeCamera';\r\n\r\n\tvar fov = 90, aspect = 1;\r\n\r\n\tvar cameraPX = new THREE.PerspectiveCamera( fov, aspect, near, far );\r\n\tcameraPX.up.set( 0, - 1, 0 );\r\n\tcameraPX.lookAt( new THREE.Vector3( 1, 0, 0 ) );\r\n\tthis.add( cameraPX );\r\n\r\n\tvar cameraNX = new THREE.PerspectiveCamera( fov, aspect, near, far );\r\n\tcameraNX.up.set( 0, - 1, 0 );\r\n\tcameraNX.lookAt( new THREE.Vector3( - 1, 0, 0 ) );\r\n\tthis.add( cameraNX );\r\n\r\n\tvar cameraPY = new THREE.PerspectiveCamera( fov, aspect, near, far );\r\n\tcameraPY.up.set( 0, 0, 1 );\r\n\tcameraPY.lookAt( new THREE.Vector3( 0, 1, 0 ) );\r\n\tthis.add( cameraPY );\r\n\r\n\tvar cameraNY = new THREE.PerspectiveCamera( fov, aspect, near, far );\r\n\tcameraNY.up.set( 0, 0, - 1 );\r\n\tcameraNY.lookAt( new THREE.Vector3( 0, - 1, 0 ) );\r\n\tthis.add( cameraNY );\r\n\r\n\tvar cameraPZ = new THREE.PerspectiveCamera( fov, aspect, near, far );\r\n\tcameraPZ.up.set( 0, - 1, 0 );\r\n\tcameraPZ.lookAt( new THREE.Vector3( 0, 0, 1 ) );\r\n\tthis.add( cameraPZ );\r\n\r\n\tvar cameraNZ = new THREE.PerspectiveCamera( fov, aspect, near, far );\r\n\tcameraNZ.up.set( 0, - 1, 0 );\r\n\tcameraNZ.lookAt( new THREE.Vector3( 0, 0, - 1 ) );\r\n\tthis.add( cameraNZ );\r\n\r\n\tthis.renderTarget = new THREE.WebGLRenderTargetCube( cubeResolution, cubeResolution, { format: THREE.RGBFormat, magFilter: THREE.LinearFilter, minFilter: THREE.LinearFilter } );\r\n\r\n\tthis.updateCubeMap = function ( renderer, scene ) {\r\n\r\n\t\tvar renderTarget = this.renderTarget;\r\n\t\tvar generateMipmaps = renderTarget.generateMipmaps;\r\n\r\n\t\trenderTarget.generateMipmaps = false;\r\n\r\n\t\trenderTarget.activeCubeFace = 0;\r\n\t\trenderer.render( scene, cameraPX, renderTarget );\r\n\r\n\t\trenderTarget.activeCubeFace = 1;\r\n\t\trenderer.render( scene, cameraNX, renderTarget );\r\n\r\n\t\trenderTarget.activeCubeFace = 2;\r\n\t\trenderer.render( scene, cameraPY, renderTarget );\r\n\r\n\t\trenderTarget.activeCubeFace = 3;\r\n\t\trenderer.render( scene, cameraNY, renderTarget );\r\n\r\n\t\trenderTarget.activeCubeFace = 4;\r\n\t\trenderer.render( scene, cameraPZ, renderTarget );\r\n\r\n\t\trenderTarget.generateMipmaps = generateMipmaps;\r\n\r\n\t\trenderTarget.activeCubeFace = 5;\r\n\t\trenderer.render( scene, cameraNZ, renderTarget );\r\n\r\n\t};\r\n\r\n};\r\n\r\nTHREE.CubeCamera.prototype = Object.create( THREE.Object3D.prototype );\r\nTHREE.CubeCamera.prototype.constructor = THREE.CubeCamera;\r\n\r\n// File:src/cameras/OrthographicCamera.js\r\n\r\n/**\r\n * @author alteredq / http://alteredqualia.com/\r\n */\r\n\r\nTHREE.OrthographicCamera = function ( left, right, top, bottom, near, far ) {\r\n\r\n\tTHREE.Camera.call( this );\r\n\r\n\tthis.type = 'OrthographicCamera';\r\n\r\n\tthis.zoom = 1;\r\n\r\n\tthis.left = left;\r\n\tthis.right = right;\r\n\tthis.top = top;\r\n\tthis.bottom = bottom;\r\n\r\n\tthis.near = ( near !== undefined ) ? near : 0.1;\r\n\tthis.far = ( far !== undefined ) ? far : 2000;\r\n\r\n\tthis.updateProjectionMatrix();\r\n\r\n};\r\n\r\nTHREE.OrthographicCamera.prototype = Object.create( THREE.Camera.prototype );\r\nTHREE.OrthographicCamera.prototype.constructor = THREE.OrthographicCamera;\r\n\r\nTHREE.OrthographicCamera.prototype.updateProjectionMatrix = function () {\r\n\r\n\tvar dx = ( this.right - this.left ) / ( 2 * this.zoom );\r\n\tvar dy = ( this.top - this.bottom ) / ( 2 * this.zoom );\r\n\tvar cx = ( this.right + this.left ) / 2;\r\n\tvar cy = ( this.top + this.bottom ) / 2;\r\n\r\n\tthis.projectionMatrix.makeOrthographic( cx - dx, cx + dx, cy + dy, cy - dy, this.near, this.far );\r\n\r\n};\r\n\r\nTHREE.OrthographicCamera.prototype.clone = function () {\r\n\r\n\tvar camera = new THREE.OrthographicCamera();\r\n\r\n\tTHREE.Camera.prototype.clone.call( this, camera );\r\n\r\n\tcamera.zoom = this.zoom;\r\n\r\n\tcamera.left = this.left;\r\n\tcamera.right = this.right;\r\n\tcamera.top = this.top;\r\n\tcamera.bottom = this.bottom;\r\n\r\n\tcamera.near = this.near;\r\n\tcamera.far = this.far;\r\n\r\n\tcamera.projectionMatrix.copy( this.projectionMatrix );\r\n\r\n\treturn camera;\r\n};\r\n\r\n// File:src/cameras/PerspectiveCamera.js\r\n\r\n/**\r\n * @author mrdoob / http://mrdoob.com/\r\n * @author greggman / http://games.greggman.com/\r\n * @author zz85 / http://www.lab4games.net/zz85/blog\r\n */\r\n\r\nTHREE.PerspectiveCamera = function ( fov, aspect, near, far ) {\r\n\r\n\tTHREE.Camera.call( this );\r\n\r\n\tthis.type = 'PerspectiveCamera';\r\n\r\n\tthis.zoom = 1;\r\n\r\n\tthis.fov = fov !== undefined ? fov : 50;\r\n\tthis.aspect = aspect !== undefined ? aspect : 1;\r\n\tthis.near = near !== undefined ? near : 0.1;\r\n\tthis.far = far !== undefined ? far : 2000;\r\n\r\n\tthis.updateProjectionMatrix();\r\n\r\n};\r\n\r\nTHREE.PerspectiveCamera.prototype = Object.create( THREE.Camera.prototype );\r\nTHREE.PerspectiveCamera.prototype.constructor = THREE.PerspectiveCamera;\r\n\r\n\r\n/**\r\n * Uses Focal Length (in mm) to estimate and set FOV\r\n * 35mm (fullframe) camera is used if frame size is not specified;\r\n * Formula based on http://www.bobatkins.com/photography/technical/field_of_view.html\r\n */\r\n\r\nTHREE.PerspectiveCamera.prototype.setLens = function ( focalLength, frameHeight ) {\r\n\r\n\tif ( frameHeight === undefined ) frameHeight = 24;\r\n\r\n\tthis.fov = 2 * THREE.Math.radToDeg( Math.atan( frameHeight / ( focalLength * 2 ) ) );\r\n\tthis.updateProjectionMatrix();\r\n\r\n}\r\n\r\n\r\n/**\r\n * Sets an offset in a larger frustum. This is useful for multi-window or\r\n * multi-monitor/multi-machine setups.\r\n *\r\n * For example, if you have 3x2 monitors and each monitor is 1920x1080 and\r\n * the monitors are in grid like this\r\n *\r\n * +---+---+---+\r\n * | A | B | C |\r\n * +---+---+---+\r\n * | D | E | F |\r\n * +---+---+---+\r\n *\r\n * then for each monitor you would call it like this\r\n *\r\n * var w = 1920;\r\n * var h = 1080;\r\n * var fullWidth = w * 3;\r\n * var fullHeight = h * 2;\r\n *\r\n * --A--\r\n * camera.setOffset( fullWidth, fullHeight, w * 0, h * 0, w, h );\r\n * --B--\r\n * camera.setOffset( fullWidth, fullHeight, w * 1, h * 0, w, h );\r\n * --C--\r\n * camera.setOffset( fullWidth, fullHeight, w * 2, h * 0, w, h );\r\n * --D--\r\n * camera.setOffset( fullWidth, fullHeight, w * 0, h * 1, w, h );\r\n * --E--\r\n * camera.setOffset( fullWidth, fullHeight, w * 1, h * 1, w, h );\r\n * --F--\r\n * camera.setOffset( fullWidth, fullHeight, w * 2, h * 1, w, h );\r\n *\r\n * Note there is no reason monitors have to be the same size or in a grid.\r\n */\r\n\r\nTHREE.PerspectiveCamera.prototype.setViewOffset = function ( fullWidth, fullHeight, x, y, width, height ) {\r\n\r\n\tthis.fullWidth = fullWidth;\r\n\tthis.fullHeight = fullHeight;\r\n\tthis.x = x;\r\n\tthis.y = y;\r\n\tthis.width = width;\r\n\tthis.height = height;\r\n\r\n\tthis.updateProjectionMatrix();\r\n\r\n};\r\n\r\n\r\nTHREE.PerspectiveCamera.prototype.updateProjectionMatrix = function () {\r\n\r\n\tvar fov = THREE.Math.radToDeg( 2 * Math.atan( Math.tan( THREE.Math.degToRad( this.fov ) * 0.5 ) / this.zoom ) );\r\n\r\n\tif ( this.fullWidth ) {\r\n\r\n\t\tvar aspect = this.fullWidth / this.fullHeight;\r\n\t\tvar top = Math.tan( THREE.Math.degToRad( fov * 0.5 ) ) * this.near;\r\n\t\tvar bottom = - top;\r\n\t\tvar left = aspect * bottom;\r\n\t\tvar right = aspect * top;\r\n\t\tvar width = Math.abs( right - left );\r\n\t\tvar height = Math.abs( top - bottom );\r\n\r\n\t\tthis.projectionMatrix.makeFrustum(\r\n\t\t\tleft + this.x * width / this.fullWidth,\r\n\t\t\tleft + ( this.x + this.width ) * width / this.fullWidth,\r\n\t\t\ttop - ( this.y + this.height ) * height / this.fullHeight,\r\n\t\t\ttop - this.y * height / this.fullHeight,\r\n\t\t\tthis.near,\r\n\t\t\tthis.far\r\n\t\t);\r\n\r\n\t} else {\r\n\r\n\t\tthis.projectionMatrix.makePerspective( fov, this.aspect, this.near, this.far );\r\n\r\n\t}\r\n\r\n};\r\n\r\nTHREE.PerspectiveCamera.prototype.clone = function () {\r\n\r\n\tvar camera = new THREE.PerspectiveCamera();\r\n\r\n\tTHREE.Camera.prototype.clone.call( this, camera );\r\n\r\n\tcamera.zoom = this.zoom;\r\n\r\n\tcamera.fov = this.fov;\r\n\tcamera.aspect = this.aspect;\r\n\tcamera.near = this.near;\r\n\tcamera.far = this.far;\r\n\r\n\tcamera.projectionMatrix.copy( this.projectionMatrix );\r\n\r\n\treturn camera;\r\n\r\n};\r\n\r\n// File:src/lights/Light.js\r\n\r\n/**\r\n * @author mrdoob / http://mrdoob.com/\r\n * @author alteredq / http://alteredqualia.com/\r\n */\r\n\r\nTHREE.Light = function ( color ) {\r\n\r\n\tTHREE.Object3D.call( this );\r\n\r\n\tthis.type = 'Light';\r\n\t\r\n\tthis.color = new THREE.Color( color );\r\n\r\n};\r\n\r\nTHREE.Light.prototype = Object.create( THREE.Object3D.prototype );\r\nTHREE.Light.prototype.constructor = THREE.Light;\r\n\r\nTHREE.Light.prototype.clone = function ( light ) {\r\n\r\n\tif ( light === undefined ) light = new THREE.Light();\r\n\r\n\tTHREE.Object3D.prototype.clone.call( this, light );\r\n\r\n\tlight.color.copy( this.color );\r\n\r\n\treturn light;\r\n\r\n};\r\n\r\n// File:src/lights/AmbientLight.js\r\n\r\n/**\r\n * @author mrdoob / http://mrdoob.com/\r\n */\r\n\r\nTHREE.AmbientLight = function ( color ) {\r\n\r\n\tTHREE.Light.call( this, color );\r\n\r\n\tthis.type = 'AmbientLight';\r\n\r\n};\r\n\r\nTHREE.AmbientLight.prototype = Object.create( THREE.Light.prototype );\r\nTHREE.AmbientLight.prototype.constructor = THREE.AmbientLight;\r\n\r\nTHREE.AmbientLight.prototype.clone = function () {\r\n\r\n\tvar light = new THREE.AmbientLight();\r\n\r\n\tTHREE.Light.prototype.clone.call( this, light );\r\n\r\n\treturn light;\r\n\r\n};\r\n\r\n// File:src/lights/AreaLight.js\r\n\r\n/**\r\n * @author MPanknin / http://www.redplant.de/\r\n * @author alteredq / http://alteredqualia.com/\r\n */\r\n\r\nTHREE.AreaLight = function ( color, intensity ) {\r\n\r\n\tTHREE.Light.call( this, color );\r\n\r\n\tthis.type = 'AreaLight';\r\n\r\n\tthis.normal = new THREE.Vector3( 0, - 1, 0 );\r\n\tthis.right = new THREE.Vector3( 1, 0, 0 );\r\n\r\n\tthis.intensity = ( intensity !== undefined ) ? intensity : 1;\r\n\r\n\tthis.width = 1.0;\r\n\tthis.height = 1.0;\r\n\r\n\tthis.constantAttenuation = 1.5;\r\n\tthis.linearAttenuation = 0.5;\r\n\tthis.quadraticAttenuation = 0.1;\r\n\r\n};\r\n\r\nTHREE.AreaLight.prototype = Object.create( THREE.Light.prototype );\r\nTHREE.AreaLight.prototype.constructor = THREE.AreaLight;\r\n\r\n\r\n// File:src/lights/DirectionalLight.js\r\n\r\n/**\r\n * @author mrdoob / http://mrdoob.com/\r\n * @author alteredq / http://alteredqualia.com/\r\n */\r\n\r\nTHREE.DirectionalLight = function ( color, intensity ) {\r\n\r\n\tTHREE.Light.call( this, color );\r\n\r\n\tthis.type = 'DirectionalLight';\r\n\r\n\tthis.position.set( 0, 1, 0 );\r\n\tthis.target = new THREE.Object3D();\r\n\r\n\tthis.intensity = ( intensity !== undefined ) ? intensity : 1;\r\n\r\n\tthis.castShadow = false;\r\n\tthis.onlyShadow = false;\r\n\r\n\t//\r\n\r\n\tthis.shadowCameraNear = 50;\r\n\tthis.shadowCameraFar = 5000;\r\n\r\n\tthis.shadowCameraLeft = - 500;\r\n\tthis.shadowCameraRight = 500;\r\n\tthis.shadowCameraTop = 500;\r\n\tthis.shadowCameraBottom = - 500;\r\n\r\n\tthis.shadowCameraVisible = false;\r\n\r\n\tthis.shadowBias = 0;\r\n\tthis.shadowDarkness = 0.5;\r\n\r\n\tthis.shadowMapWidth = 512;\r\n\tthis.shadowMapHeight = 512;\r\n\r\n\t//\r\n\r\n\tthis.shadowCascade = false;\r\n\r\n\tthis.shadowCascadeOffset = new THREE.Vector3( 0, 0, - 1000 );\r\n\tthis.shadowCascadeCount = 2;\r\n\r\n\tthis.shadowCascadeBias = [ 0, 0, 0 ];\r\n\tthis.shadowCascadeWidth = [ 512, 512, 512 ];\r\n\tthis.shadowCascadeHeight = [ 512, 512, 512 ];\r\n\r\n\tthis.shadowCascadeNearZ = [ - 1.000, 0.990, 0.998 ];\r\n\tthis.shadowCascadeFarZ = [ 0.990, 0.998, 1.000 ];\r\n\r\n\tthis.shadowCascadeArray = [];\r\n\r\n\t//\r\n\r\n\tthis.shadowMap = null;\r\n\tthis.shadowMapSize = null;\r\n\tthis.shadowCamera = null;\r\n\tthis.shadowMatrix = null;\r\n\r\n};\r\n\r\nTHREE.DirectionalLight.prototype = Object.create( THREE.Light.prototype );\r\nTHREE.DirectionalLight.prototype.constructor = THREE.DirectionalLight;\r\n\r\nTHREE.DirectionalLight.prototype.clone = function () {\r\n\r\n\tvar light = new THREE.DirectionalLight();\r\n\r\n\tTHREE.Light.prototype.clone.call( this, light );\r\n\r\n\tlight.target = this.target.clone();\r\n\r\n\tlight.intensity = this.intensity;\r\n\r\n\tlight.castShadow = this.castShadow;\r\n\tlight.onlyShadow = this.onlyShadow;\r\n\r\n\t//\r\n\r\n\tlight.shadowCameraNear = this.shadowCameraNear;\r\n\tlight.shadowCameraFar = this.shadowCameraFar;\r\n\r\n\tlight.shadowCameraLeft = this.shadowCameraLeft;\r\n\tlight.shadowCameraRight = this.shadowCameraRight;\r\n\tlight.shadowCameraTop = this.shadowCameraTop;\r\n\tlight.shadowCameraBottom = this.shadowCameraBottom;\r\n\r\n\tlight.shadowCameraVisible = this.shadowCameraVisible;\r\n\r\n\tlight.shadowBias = this.shadowBias;\r\n\tlight.shadowDarkness = this.shadowDarkness;\r\n\r\n\tlight.shadowMapWidth = this.shadowMapWidth;\r\n\tlight.shadowMapHeight = this.shadowMapHeight;\r\n\r\n\t//\r\n\r\n\tlight.shadowCascade = this.shadowCascade;\r\n\r\n\tlight.shadowCascadeOffset.copy( this.shadowCascadeOffset );\r\n\tlight.shadowCascadeCount = this.shadowCascadeCount;\r\n\r\n\tlight.shadowCascadeBias = this.shadowCascadeBias.slice( 0 );\r\n\tlight.shadowCascadeWidth = this.shadowCascadeWidth.slice( 0 );\r\n\tlight.shadowCascadeHeight = this.shadowCascadeHeight.slice( 0 );\r\n\r\n\tlight.shadowCascadeNearZ = this.shadowCascadeNearZ.slice( 0 );\r\n\tlight.shadowCascadeFarZ = this.shadowCascadeFarZ.slice( 0 );\r\n\r\n\treturn light;\r\n\r\n};\r\n\r\n// File:src/lights/HemisphereLight.js\r\n\r\n/**\r\n * @author alteredq / http://alteredqualia.com/\r\n */\r\n\r\nTHREE.HemisphereLight = function ( skyColor, groundColor, intensity ) {\r\n\r\n\tTHREE.Light.call( this, skyColor );\r\n\r\n\tthis.type = 'HemisphereLight';\r\n\r\n\tthis.position.set( 0, 100, 0 );\r\n\r\n\tthis.groundColor = new THREE.Color( groundColor );\r\n\tthis.intensity = ( intensity !== undefined ) ? intensity : 1;\r\n\r\n};\r\n\r\nTHREE.HemisphereLight.prototype = Object.create( THREE.Light.prototype );\r\nTHREE.HemisphereLight.prototype.constructor = THREE.HemisphereLight;\r\n\r\nTHREE.HemisphereLight.prototype.clone = function () {\r\n\r\n\tvar light = new THREE.HemisphereLight();\r\n\r\n\tTHREE.Light.prototype.clone.call( this, light );\r\n\r\n\tlight.groundColor.copy( this.groundColor );\r\n\tlight.intensity = this.intensity;\r\n\r\n\treturn light;\r\n\r\n};\r\n\r\n// File:src/lights/PointLight.js\r\n\r\n/**\r\n * @author mrdoob / http://mrdoob.com/\r\n */\r\n\r\nTHREE.PointLight = function ( color, intensity, distance, decay ) {\r\n\r\n\tTHREE.Light.call( this, color );\r\n\r\n\tthis.type = 'PointLight';\r\n\r\n\tthis.intensity = ( intensity !== undefined ) ? intensity : 1;\r\n\tthis.distance = ( distance !== undefined ) ? distance : 0;\r\n\tthis.decay = ( decay !== undefined ) ? decay : 1;\t// for physically correct lights, should be 2.\r\n\r\n};\r\n\r\nTHREE.PointLight.prototype = Object.create( THREE.Light.prototype );\r\nTHREE.PointLight.prototype.constructor = THREE.PointLight;\r\n\r\nTHREE.PointLight.prototype.clone = function () {\r\n\r\n\tvar light = new THREE.PointLight();\r\n\r\n\tTHREE.Light.prototype.clone.call( this, light );\r\n\r\n\tlight.intensity = this.intensity;\r\n\tlight.distance = this.distance;\r\n\tlight.decay = this.decay;\r\n\r\n\treturn light;\r\n\r\n};\r\n\r\n// File:src/lights/SpotLight.js\r\n\r\n/**\r\n * @author alteredq / http://alteredqualia.com/\r\n */\r\n\r\nTHREE.SpotLight = function ( color, intensity, distance, angle, exponent, decay ) {\r\n\r\n\tTHREE.Light.call( this, color );\r\n\r\n\tthis.type = 'SpotLight';\r\n\r\n\tthis.position.set( 0, 1, 0 );\r\n\tthis.target = new THREE.Object3D();\r\n\r\n\tthis.intensity = ( intensity !== undefined ) ? intensity : 1;\r\n\tthis.distance = ( distance !== undefined ) ? distance : 0;\r\n\tthis.angle = ( angle !== undefined ) ? angle : Math.PI / 3;\r\n\tthis.exponent = ( exponent !== undefined ) ? exponent : 10;\r\n\tthis.decay = ( decay !== undefined ) ? decay : 1;\t// for physically correct lights, should be 2.\r\n\r\n\tthis.castShadow = false;\r\n\tthis.onlyShadow = false;\r\n\r\n\t//\r\n\r\n\tthis.shadowCameraNear = 50;\r\n\tthis.shadowCameraFar = 5000;\r\n\tthis.shadowCameraFov = 50;\r\n\r\n\tthis.shadowCameraVisible = false;\r\n\r\n\tthis.shadowBias = 0;\r\n\tthis.shadowDarkness = 0.5;\r\n\r\n\tthis.shadowMapWidth = 512;\r\n\tthis.shadowMapHeight = 512;\r\n\r\n\t//\r\n\r\n\tthis.shadowMap = null;\r\n\tthis.shadowMapSize = null;\r\n\tthis.shadowCamera = null;\r\n\tthis.shadowMatrix = null;\r\n\r\n};\r\n\r\nTHREE.SpotLight.prototype = Object.create( THREE.Light.prototype );\r\nTHREE.SpotLight.prototype.constructor = THREE.SpotLight;\r\n\r\nTHREE.SpotLight.prototype.clone = function () {\r\n\r\n\tvar light = new THREE.SpotLight();\r\n\r\n\tTHREE.Light.prototype.clone.call( this, light );\r\n\r\n\tlight.target = this.target.clone();\r\n\r\n\tlight.intensity = this.intensity;\r\n\tlight.distance = this.distance;\r\n\tlight.angle = this.angle;\r\n\tlight.exponent = this.exponent;\r\n\tlight.decay = this.decay;\r\n\r\n\tlight.castShadow = this.castShadow;\r\n\tlight.onlyShadow = this.onlyShadow;\r\n\r\n\t//\r\n\r\n\tlight.shadowCameraNear = this.shadowCameraNear;\r\n\tlight.shadowCameraFar = this.shadowCameraFar;\r\n\tlight.shadowCameraFov = this.shadowCameraFov;\r\n\r\n\tlight.shadowCameraVisible = this.shadowCameraVisible;\r\n\r\n\tlight.shadowBias = this.shadowBias;\r\n\tlight.shadowDarkness = this.shadowDarkness;\r\n\r\n\tlight.shadowMapWidth = this.shadowMapWidth;\r\n\tlight.shadowMapHeight = this.shadowMapHeight;\r\n\r\n\treturn light;\r\n\r\n};\r\n\r\n// File:src/loaders/Cache.js\r\n\r\n/**\r\n * @author mrdoob / http://mrdoob.com/\r\n */\r\n\r\nTHREE.Cache = {\r\n\r\n\tfiles: {},\r\n\r\n\tadd: function ( key, file ) {\r\n\r\n\t\t// console.log( 'THREE.Cache', 'Adding key:', key );\r\n\r\n\t\tthis.files[ key ] = file;\r\n\r\n\t},\r\n\r\n\tget: function ( key ) {\r\n\r\n\t\t// console.log( 'THREE.Cache', 'Checking key:', key );\r\n\r\n\t\treturn this.files[ key ];\r\n\r\n\t},\r\n\r\n\tremove: function ( key ) {\r\n\r\n\t\tdelete this.files[ key ];\r\n\r\n\t},\r\n\r\n\tclear: function () {\r\n\r\n\t\tthis.files = {}\r\n\r\n\t}\r\n\r\n};\r\n\r\n// File:src/loaders/Loader.js\r\n\r\n/**\r\n * @author alteredq / http://alteredqualia.com/\r\n */\r\n\r\nTHREE.Loader = function ( showStatus ) {\r\n\r\n\tthis.showStatus = showStatus;\r\n\tthis.statusDomElement = showStatus ? THREE.Loader.prototype.addStatusElement() : null;\r\n\r\n\tthis.imageLoader = new THREE.ImageLoader();\r\n\r\n\tthis.onLoadStart = function () {};\r\n\tthis.onLoadProgress = function () {};\r\n\tthis.onLoadComplete = function () {};\r\n\r\n};\r\n\r\nTHREE.Loader.prototype = {\r\n\r\n\tconstructor: THREE.Loader,\r\n\r\n\tcrossOrigin: undefined,\r\n\r\n\taddStatusElement: function () {\r\n\r\n\t\tvar e = document.createElement( 'div' );\r\n\r\n\t\te.style.position = 'absolute';\r\n\t\te.style.right = '0px';\r\n\t\te.style.top = '0px';\r\n\t\te.style.fontSize = '0.8em';\r\n\t\te.style.textAlign = 'left';\r\n\t\te.style.background = 'rgba(0,0,0,0.25)';\r\n\t\te.style.color = '#fff';\r\n\t\te.style.width = '120px';\r\n\t\te.style.padding = '0.5em 0.5em 0.5em 0.5em';\r\n\t\te.style.zIndex = 1000;\r\n\r\n\t\te.innerHTML = 'Loading ...';\r\n\r\n\t\treturn e;\r\n\r\n\t},\r\n\r\n\tupdateProgress: function ( progress ) {\r\n\r\n\t\tvar message = 'Loaded ';\r\n\r\n\t\tif ( progress.total ) {\r\n\r\n\t\t\tmessage += ( 100 * progress.loaded / progress.total ).toFixed( 0 ) + '%';\r\n\r\n\r\n\t\t} else {\r\n\r\n\t\t\tmessage += ( progress.loaded / 1024 ).toFixed( 2 ) + ' KB';\r\n\r\n\t\t}\r\n\r\n\t\tthis.statusDomElement.innerHTML = message;\r\n\r\n\t},\r\n\r\n\textractUrlBase: function ( url ) {\r\n\r\n\t\tvar parts = url.split( '/' );\r\n\r\n\t\tif ( parts.length === 1 ) return './';\r\n\r\n\t\tparts.pop();\r\n\r\n\t\treturn parts.join( '/' ) + '/';\r\n\r\n\t},\r\n\r\n\tinitMaterials: function ( materials, texturePath ) {\r\n\r\n\t\tvar array = [];\r\n\r\n\t\tfor ( var i = 0; i < materials.length; ++ i ) {\r\n\r\n\t\t\tarray[ i ] = this.createMaterial( materials[ i ], texturePath );\r\n\r\n\t\t}\r\n\r\n\t\treturn array;\r\n\r\n\t},\r\n\r\n\tneedsTangents: function ( materials ) {\r\n\r\n\t\tfor ( var i = 0, il = materials.length; i < il; i ++ ) {\r\n\r\n\t\t\tvar m = materials[ i ];\r\n\r\n\t\t\tif ( m instanceof THREE.ShaderMaterial ) return true;\r\n\r\n\t\t}\r\n\r\n\t\treturn false;\r\n\r\n\t},\r\n\r\n\tcreateMaterial: function ( m, texturePath ) {\r\n\r\n\t\tvar scope = this;\r\n\r\n\t\tfunction nearest_pow2( n ) {\r\n\r\n\t\t\tvar l = Math.log( n ) / Math.LN2;\r\n\t\t\treturn Math.pow( 2, Math.round( l ) );\r\n\r\n\t\t}\r\n\r\n\t\tfunction create_texture( where, name, sourceFile, repeat, offset, wrap, anisotropy ) {\r\n\r\n\t\t\tvar fullPath = texturePath + sourceFile;\r\n\r\n\t\t\tvar texture;\r\n\r\n\t\t\tvar loader = THREE.Loader.Handlers.get( fullPath );\r\n\r\n\t\t\tif ( loader !== null ) {\r\n\r\n\t\t\t\ttexture = loader.load( fullPath );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\ttexture = new THREE.Texture();\r\n\r\n\t\t\t\tloader = scope.imageLoader;\r\n\t\t\t\tloader.crossOrigin = scope.crossOrigin;\r\n\t\t\t\tloader.load( fullPath, function ( image ) {\r\n\r\n\t\t\t\t\tif ( THREE.Math.isPowerOfTwo( image.width ) === false ||\r\n\t\t\t\t\t\t THREE.Math.isPowerOfTwo( image.height ) === false ) {\r\n\r\n\t\t\t\t\t\tvar width = nearest_pow2( image.width );\r\n\t\t\t\t\t\tvar height = nearest_pow2( image.height );\r\n\r\n\t\t\t\t\t\tvar canvas = document.createElement( 'canvas' );\r\n\t\t\t\t\t\tcanvas.width = width;\r\n\t\t\t\t\t\tcanvas.height = height;\r\n\r\n\t\t\t\t\t\tvar context = canvas.getContext( '2d' );\r\n\t\t\t\t\t\tcontext.drawImage( image, 0, 0, width, height );\r\n\r\n\t\t\t\t\t\ttexture.image = canvas;\r\n\r\n\t\t\t\t\t} else {\r\n\r\n\t\t\t\t\t\ttexture.image = image;\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\ttexture.needsUpdate = true;\r\n\r\n\t\t\t\t} );\r\n\r\n\t\t\t}\r\n\r\n\t\t\ttexture.sourceFile = sourceFile;\r\n\r\n\t\t\tif ( repeat ) {\r\n\r\n\t\t\t\ttexture.repeat.set( repeat[ 0 ], repeat[ 1 ] );\r\n\r\n\t\t\t\tif ( repeat[ 0 ] !== 1 ) texture.wrapS = THREE.RepeatWrapping;\r\n\t\t\t\tif ( repeat[ 1 ] !== 1 ) texture.wrapT = THREE.RepeatWrapping;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( offset ) {\r\n\r\n\t\t\t\ttexture.offset.set( offset[ 0 ], offset[ 1 ] );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( wrap ) {\r\n\r\n\t\t\t\tvar wrapMap = {\r\n\t\t\t\t\t'repeat': THREE.RepeatWrapping,\r\n\t\t\t\t\t'mirror': THREE.MirroredRepeatWrapping\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif ( wrapMap[ wrap[ 0 ] ] !== undefined ) texture.wrapS = wrapMap[ wrap[ 0 ] ];\r\n\t\t\t\tif ( wrapMap[ wrap[ 1 ] ] !== undefined ) texture.wrapT = wrapMap[ wrap[ 1 ] ];\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( anisotropy ) {\r\n\r\n\t\t\t\ttexture.anisotropy = anisotropy;\r\n\r\n\t\t\t}\r\n\r\n\t\t\twhere[ name ] = texture;\r\n\r\n\t\t}\r\n\r\n\t\tfunction rgb2hex( rgb ) {\r\n\r\n\t\t\treturn ( rgb[ 0 ] * 255 << 16 ) + ( rgb[ 1 ] * 255 << 8 ) + rgb[ 2 ] * 255;\r\n\r\n\t\t}\r\n\r\n\t\t// defaults\r\n\r\n\t\tvar mtype = 'MeshLambertMaterial';\r\n\t\tvar mpars = { color: 0xeeeeee, opacity: 1.0, map: null, lightMap: null, normalMap: null, bumpMap: null, wireframe: false };\r\n\r\n\t\t// parameters from model file\r\n\r\n\t\tif ( m.shading ) {\r\n\r\n\t\t\tvar shading = m.shading.toLowerCase();\r\n\r\n\t\t\tif ( shading === 'phong' ) mtype = 'MeshPhongMaterial';\r\n\t\t\telse if ( shading === 'basic' ) mtype = 'MeshBasicMaterial';\r\n\r\n\t\t}\r\n\r\n\t\tif ( m.blending !== undefined && THREE[ m.blending ] !== undefined ) {\r\n\r\n\t\t\tmpars.blending = THREE[ m.blending ];\r\n\r\n\t\t}\r\n\r\n\t\tif ( m.transparent !== undefined ) {\r\n\r\n\t\t\tmpars.transparent = m.transparent;\r\n\r\n\t\t}\r\n\r\n\t\tif ( m.opacity !== undefined && m.opacity < 1.0 ) {\r\n\r\n\t\t\tmpars.transparent = true;\r\n\r\n\t\t}\r\n\r\n\t\tif ( m.depthTest !== undefined ) {\r\n\r\n\t\t\tmpars.depthTest = m.depthTest;\r\n\r\n\t\t}\r\n\r\n\t\tif ( m.depthWrite !== undefined ) {\r\n\r\n\t\t\tmpars.depthWrite = m.depthWrite;\r\n\r\n\t\t}\r\n\r\n\t\tif ( m.visible !== undefined ) {\r\n\r\n\t\t\tmpars.visible = m.visible;\r\n\r\n\t\t}\r\n\r\n\t\tif ( m.flipSided !== undefined ) {\r\n\r\n\t\t\tmpars.side = THREE.BackSide;\r\n\r\n\t\t}\r\n\r\n\t\tif ( m.doubleSided !== undefined ) {\r\n\r\n\t\t\tmpars.side = THREE.DoubleSide;\r\n\r\n\t\t}\r\n\r\n\t\tif ( m.wireframe !== undefined ) {\r\n\r\n\t\t\tmpars.wireframe = m.wireframe;\r\n\r\n\t\t}\r\n\r\n\t\tif ( m.vertexColors !== undefined ) {\r\n\r\n\t\t\tif ( m.vertexColors === 'face' ) {\r\n\r\n\t\t\t\tmpars.vertexColors = THREE.FaceColors;\r\n\r\n\t\t\t} else if ( m.vertexColors ) {\r\n\r\n\t\t\t\tmpars.vertexColors = THREE.VertexColors;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\t// colors\r\n\r\n\t\tif ( m.colorDiffuse ) {\r\n\r\n\t\t\tmpars.color = rgb2hex( m.colorDiffuse );\r\n\r\n\t\t} else if ( m.DbgColor ) {\r\n\r\n\t\t\tmpars.color = m.DbgColor;\r\n\r\n\t\t}\r\n\r\n\t\tif ( m.colorSpecular ) {\r\n\r\n\t\t\tmpars.specular = rgb2hex( m.colorSpecular );\r\n\r\n\t\t}\r\n\r\n\t\tif ( m.colorEmissive ) {\r\n\r\n\t\t\tmpars.emissive = rgb2hex( m.colorEmissive );\r\n\r\n\t\t}\r\n\r\n\t\t// modifiers\r\n\r\n\t\tif ( m.transparency !== undefined ) {\r\n\r\n\t\t\tconsole.warn( 'THREE.Loader: transparency has been renamed to opacity' );\r\n\t\t\tm.opacity = m.transparency;\r\n\r\n\t\t}\r\n\r\n\t\tif ( m.opacity !== undefined ) {\r\n\r\n\t\t\tmpars.opacity = m.opacity;\r\n\r\n\t\t}\r\n\r\n\t\tif ( m.specularCoef ) {\r\n\r\n\t\t\tmpars.shininess = m.specularCoef;\r\n\r\n\t\t}\r\n\r\n\t\t// textures\r\n\r\n\t\tif ( m.mapDiffuse && texturePath ) {\r\n\r\n\t\t\tcreate_texture( mpars, 'map', m.mapDiffuse, m.mapDiffuseRepeat, m.mapDiffuseOffset, m.mapDiffuseWrap, m.mapDiffuseAnisotropy );\r\n\r\n\t\t}\r\n\r\n\t\tif ( m.mapLight && texturePath ) {\r\n\r\n\t\t\tcreate_texture( mpars, 'lightMap', m.mapLight, m.mapLightRepeat, m.mapLightOffset, m.mapLightWrap, m.mapLightAnisotropy );\r\n\r\n\t\t}\r\n\r\n\t\tif ( m.mapBump && texturePath ) {\r\n\r\n\t\t\tcreate_texture( mpars, 'bumpMap', m.mapBump, m.mapBumpRepeat, m.mapBumpOffset, m.mapBumpWrap, m.mapBumpAnisotropy );\r\n\r\n\t\t}\r\n\r\n\t\tif ( m.mapNormal && texturePath ) {\r\n\r\n\t\t\tcreate_texture( mpars, 'normalMap', m.mapNormal, m.mapNormalRepeat, m.mapNormalOffset, m.mapNormalWrap, m.mapNormalAnisotropy );\r\n\r\n\t\t}\r\n\r\n\t\tif ( m.mapSpecular && texturePath ) {\r\n\r\n\t\t\tcreate_texture( mpars, 'specularMap', m.mapSpecular, m.mapSpecularRepeat, m.mapSpecularOffset, m.mapSpecularWrap, m.mapSpecularAnisotropy );\r\n\r\n\t\t}\r\n\r\n\t\tif ( m.mapAlpha && texturePath ) {\r\n\r\n\t\t\tcreate_texture( mpars, 'alphaMap', m.mapAlpha, m.mapAlphaRepeat, m.mapAlphaOffset, m.mapAlphaWrap, m.mapAlphaAnisotropy );\r\n\r\n\t\t}\r\n\r\n\t\t//\r\n\r\n\t\tif ( m.mapBumpScale ) {\r\n\r\n\t\t\tmpars.bumpScale = m.mapBumpScale;\r\n\r\n\t\t}\r\n\r\n\t\tif ( m.mapNormalFactor ) {\r\n\r\n\t\t\tmpars.normalScale = new THREE.Vector2( m.mapNormalFactor, m.mapNormalFactor );\r\n\r\n\t\t}\r\n\r\n\t\tvar material = new THREE[ mtype ]( mpars );\r\n\r\n\t\tif ( m.DbgName !== undefined ) material.name = m.DbgName;\r\n\r\n\t\treturn material;\r\n\r\n\t}\r\n\r\n};\r\n\r\nTHREE.Loader.Handlers = {\r\n\r\n\thandlers: [],\r\n\r\n\tadd: function ( regex, loader ) {\r\n\r\n\t\tthis.handlers.push( regex, loader );\r\n\r\n\t},\r\n\r\n\tget: function ( file ) {\r\n\r\n\t\tfor ( var i = 0, l = this.handlers.length; i < l; i += 2 ) {\r\n\r\n\t\t\tvar regex = this.handlers[ i ];\r\n\t\t\tvar loader = this.handlers[ i + 1 ];\r\n\r\n\t\t\tif ( regex.test( file ) ) {\r\n\r\n\t\t\t\treturn loader;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn null;\r\n\r\n\t}\r\n\r\n};\r\n\r\n// File:src/loaders/XHRLoader.js\r\n\r\n/**\r\n * @author mrdoob / http://mrdoob.com/\r\n */\r\n\r\nTHREE.XHRLoader = function ( manager ) {\r\n\r\n\tthis.manager = ( manager !== undefined ) ? manager : THREE.DefaultLoadingManager;\r\n\r\n};\r\n\r\nTHREE.XHRLoader.prototype = {\r\n\r\n\tconstructor: THREE.XHRLoader,\r\n\r\n\tload: function ( url, onLoad, onProgress, onError ) {\r\n\r\n\t\tvar scope = this;\r\n\r\n\t\tvar cached = THREE.Cache.get( url );\r\n\r\n\t\tif ( cached !== undefined ) {\r\n\r\n\t\t\tif ( onLoad ) onLoad( cached );\r\n\t\t\treturn;\r\n\r\n\t\t}\r\n\r\n\t\tvar request = new XMLHttpRequest();\r\n\t\trequest.open( 'GET', url, true );\r\n\r\n\t\trequest.addEventListener( 'load', function ( event ) {\r\n\r\n\t\t\tTHREE.Cache.add( url, this.response );\r\n\r\n\t\t\tif ( onLoad ) onLoad( this.response );\r\n\r\n\t\t\tscope.manager.itemEnd( url );\r\n\r\n\t\t}, false );\r\n\r\n\t\tif ( onProgress !== undefined ) {\r\n\r\n\t\t\trequest.addEventListener( 'progress', function ( event ) {\r\n\r\n\t\t\t\tonProgress( event );\r\n\r\n\t\t\t}, false );\r\n\r\n\t\t}\r\n\r\n\t\tif ( onError !== undefined ) {\r\n\r\n\t\t\trequest.addEventListener( 'error', function ( event ) {\r\n\r\n\t\t\t\tonError( event );\r\n\r\n\t\t\t}, false );\r\n\r\n\t\t}\r\n\r\n\t\tif ( this.crossOrigin !== undefined ) request.crossOrigin = this.crossOrigin;\r\n\t\tif ( this.responseType !== undefined ) request.responseType = this.responseType;\r\n\r\n\t\trequest.send( null );\r\n\r\n\t\tscope.manager.itemStart( url );\r\n\r\n\t},\r\n\r\n\tsetResponseType: function ( value ) {\r\n\r\n\t\tthis.responseType = value;\r\n\r\n\t},\r\n\r\n\tsetCrossOrigin: function ( value ) {\r\n\r\n\t\tthis.crossOrigin = value;\r\n\r\n\t}\r\n\r\n};\r\n\r\n// File:src/loaders/ImageLoader.js\r\n\r\n/**\r\n * @author mrdoob / http://mrdoob.com/\r\n */\r\n\r\nTHREE.ImageLoader = function ( manager ) {\r\n\r\n\tthis.manager = ( manager !== undefined ) ? manager : THREE.DefaultLoadingManager;\r\n\r\n};\r\n\r\nTHREE.ImageLoader.prototype = {\r\n\r\n\tconstructor: THREE.ImageLoader,\r\n\r\n\tload: function ( url, onLoad, onProgress, onError ) {\r\n\r\n\t\tvar scope = this;\r\n\r\n\t\tvar cached = THREE.Cache.get( url );\r\n\r\n\t\tif ( cached !== undefined ) {\r\n\r\n\t\t\tonLoad( cached );\r\n\t\t\treturn;\r\n\r\n\t\t}\r\n\r\n\t\tvar image = document.createElement( 'img' );\r\n\r\n\t\timage.addEventListener( 'load', function ( event ) {\r\n\r\n\t\t\tTHREE.Cache.add( url, this );\r\n\r\n\t\t\tif ( onLoad ) onLoad( this );\r\n\t\t\t\r\n\t\t\tscope.manager.itemEnd( url );\r\n\r\n\t\t}, false );\r\n\r\n\t\tif ( onProgress !== undefined ) {\r\n\r\n\t\t\timage.addEventListener( 'progress', function ( event ) {\r\n\r\n\t\t\t\tonProgress( event );\r\n\r\n\t\t\t}, false );\r\n\r\n\t\t}\r\n\r\n\t\tif ( onError !== undefined ) {\r\n\r\n\t\t\timage.addEventListener( 'error', function ( event ) {\r\n\r\n\t\t\t\tonError( event );\r\n\r\n\t\t\t}, false );\r\n\r\n\t\t}\r\n\r\n\t\tif ( this.crossOrigin !== undefined ) image.crossOrigin = this.crossOrigin;\r\n\r\n\t\timage.src = url;\r\n\r\n\t\tscope.manager.itemStart( url );\r\n\r\n\t\treturn image;\r\n\r\n\t},\r\n\r\n\tsetCrossOrigin: function ( value ) {\r\n\r\n\t\tthis.crossOrigin = value;\r\n\r\n\t}\r\n\r\n}\r\n\r\n// File:src/loaders/JSONLoader.js\r\n\r\n/**\r\n * @author mrdoob / http://mrdoob.com/\r\n * @author alteredq / http://alteredqualia.com/\r\n */\r\n\r\nTHREE.JSONLoader = function ( showStatus ) {\r\n\r\n\tTHREE.Loader.call( this, showStatus );\r\n\r\n\tthis.withCredentials = false;\r\n\r\n};\r\n\r\nTHREE.JSONLoader.prototype = Object.create( THREE.Loader.prototype );\r\nTHREE.JSONLoader.prototype.constructor = THREE.JSONLoader;\r\n\r\nTHREE.JSONLoader.prototype.load = function ( url, callback, texturePath ) {\r\n\r\n\t// todo: unify load API to for easier SceneLoader use\r\n\r\n\ttexturePath = texturePath && ( typeof texturePath === 'string' ) ? texturePath : this.extractUrlBase( url );\r\n\r\n\tthis.onLoadStart();\r\n\tthis.loadAjaxJSON( this, url, callback, texturePath );\r\n\r\n};\r\n\r\nTHREE.JSONLoader.prototype.loadAjaxJSON = function ( context, url, callback, texturePath, callbackProgress ) {\r\n\r\n\tvar xhr = new XMLHttpRequest();\r\n\r\n\tvar length = 0;\r\n\r\n\txhr.onreadystatechange = function () {\r\n\r\n\t\tif ( xhr.readyState === xhr.DONE ) {\r\n\r\n\t\t\tif ( xhr.status === 200 || xhr.status === 0 ) {\r\n\r\n\t\t\t\tif ( xhr.responseText ) {\r\n\r\n\t\t\t\t\tvar json = JSON.parse( xhr.responseText );\r\n\t\t\t\t\tvar metadata = json.metadata;\r\n\r\n\t\t\t\t\tif ( metadata !== undefined ) {\r\n\r\n\t\t\t\t\t\tif ( metadata.type === 'object' ) {\r\n\r\n\t\t\t\t\t\t\tTHREE.error( 'THREE.JSONLoader: ' + url + ' should be loaded with THREE.ObjectLoader instead.' );\r\n\t\t\t\t\t\t\treturn;\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\tif ( metadata.type === 'scene' ) {\r\n\r\n\t\t\t\t\t\t\tTHREE.error( 'THREE.JSONLoader: ' + url + ' seems to be a Scene. Use THREE.SceneLoader instead.' );\r\n\t\t\t\t\t\t\treturn;\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tvar result = context.parse( json, texturePath );\r\n\t\t\t\t\tcallback( result.geometry, result.materials );\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\tTHREE.error( 'THREE.JSONLoader: ' + url + ' seems to be unreachable or the file is empty.' );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\t// in context of more complex asset initialization\r\n\t\t\t\t// do not block on single failed file\r\n\t\t\t\t// maybe should go even one more level up\r\n\r\n\t\t\t\tcontext.onLoadComplete();\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tTHREE.error( 'THREE.JSONLoader: Couldn\\'t load ' + url + ' (' + xhr.status + ')' );\r\n\r\n\t\t\t}\r\n\r\n\t\t} else if ( xhr.readyState === xhr.LOADING ) {\r\n\r\n\t\t\tif ( callbackProgress ) {\r\n\r\n\t\t\t\tif ( length === 0 ) {\r\n\r\n\t\t\t\t\tlength = xhr.getResponseHeader( 'Content-Length' );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tcallbackProgress( { total: length, loaded: xhr.responseText.length } );\r\n\r\n\t\t\t}\r\n\r\n\t\t} else if ( xhr.readyState === xhr.HEADERS_RECEIVED ) {\r\n\r\n\t\t\tif ( callbackProgress !== undefined ) {\r\n\r\n\t\t\t\tlength = xhr.getResponseHeader( 'Content-Length' );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t};\r\n\r\n\txhr.open( 'GET', url, true );\r\n\txhr.withCredentials = this.withCredentials;\r\n\txhr.send( null );\r\n\r\n};\r\n\r\nTHREE.JSONLoader.prototype.parse = function ( json, texturePath ) {\r\n\r\n\tvar geometry = new THREE.Geometry(),\r\n\tscale = ( json.scale !== undefined ) ? 1.0 / json.scale : 1.0;\r\n\r\n\tparseModel( scale );\r\n\r\n\tparseSkin();\r\n\tparseMorphing( scale );\r\n\r\n\tgeometry.computeFaceNormals();\r\n\tgeometry.computeBoundingSphere();\r\n\r\n\tfunction parseModel( scale ) {\r\n\r\n\t\tfunction isBitSet( value, position ) {\r\n\r\n\t\t\treturn value & ( 1 << position );\r\n\r\n\t\t}\r\n\r\n\t\tvar i, j, fi,\r\n\r\n\t\toffset, zLength,\r\n\r\n\t\tcolorIndex, normalIndex, uvIndex, materialIndex,\r\n\r\n\t\ttype,\r\n\t\tisQuad,\r\n\t\thasMaterial,\r\n\t\thasFaceVertexUv,\r\n\t\thasFaceNormal, hasFaceVertexNormal,\r\n\t\thasFaceColor, hasFaceVertexColor,\r\n\r\n\t\tvertex, face, faceA, faceB, hex, normal,\r\n\r\n\t\tuvLayer, uv, u, v,\r\n\r\n\t\tfaces = json.faces,\r\n\t\tvertices = json.vertices,\r\n\t\tnormals = json.normals,\r\n\t\tcolors = json.colors,\r\n\r\n\t\tnUvLayers = 0;\r\n\r\n\t\tif ( json.uvs !== undefined ) {\r\n\r\n\t\t\t// disregard empty arrays\r\n\r\n\t\t\tfor ( i = 0; i < json.uvs.length; i ++ ) {\r\n\r\n\t\t\t\tif ( json.uvs[ i ].length ) nUvLayers ++;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tfor ( i = 0; i < nUvLayers; i ++ ) {\r\n\r\n\t\t\t\tgeometry.faceVertexUvs[ i ] = [];\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\toffset = 0;\r\n\t\tzLength = vertices.length;\r\n\r\n\t\twhile ( offset < zLength ) {\r\n\r\n\t\t\tvertex = new THREE.Vector3();\r\n\r\n\t\t\tvertex.x = vertices[ offset ++ ] * scale;\r\n\t\t\tvertex.y = vertices[ offset ++ ] * scale;\r\n\t\t\tvertex.z = vertices[ offset ++ ] * scale;\r\n\r\n\t\t\tgeometry.vertices.push( vertex );\r\n\r\n\t\t}\r\n\r\n\t\toffset = 0;\r\n\t\tzLength = faces.length;\r\n\r\n\t\twhile ( offset < zLength ) {\r\n\r\n\t\t\ttype = faces[ offset ++ ];\r\n\r\n\r\n\t\t\tisQuad = isBitSet( type, 0 );\r\n\t\t\thasMaterial = isBitSet( type, 1 );\r\n\t\t\thasFaceVertexUv = isBitSet( type, 3 );\r\n\t\t\thasFaceNormal = isBitSet( type, 4 );\r\n\t\t\thasFaceVertexNormal = isBitSet( type, 5 );\r\n\t\t\thasFaceColor\t = isBitSet( type, 6 );\r\n\t\t\thasFaceVertexColor = isBitSet( type, 7 );\r\n\r\n\t\t\t// console.log(\"type\", type, \"bits\", isQuad, hasMaterial, hasFaceVertexUv, hasFaceNormal, hasFaceVertexNormal, hasFaceColor, hasFaceVertexColor);\r\n\r\n\t\t\tif ( isQuad ) {\r\n\r\n\t\t\t\tfaceA = new THREE.Face3();\r\n\t\t\t\tfaceA.a = faces[ offset ];\r\n\t\t\t\tfaceA.b = faces[ offset + 1 ];\r\n\t\t\t\tfaceA.c = faces[ offset + 3 ];\r\n\r\n\t\t\t\tfaceB = new THREE.Face3();\r\n\t\t\t\tfaceB.a = faces[ offset + 1 ];\r\n\t\t\t\tfaceB.b = faces[ offset + 2 ];\r\n\t\t\t\tfaceB.c = faces[ offset + 3 ];\r\n\r\n\t\t\t\toffset += 4;\r\n\r\n\t\t\t\tif ( hasMaterial ) {\r\n\r\n\t\t\t\t\tmaterialIndex = faces[ offset ++ ];\r\n\t\t\t\t\tfaceA.materialIndex = materialIndex;\r\n\t\t\t\t\tfaceB.materialIndex = materialIndex;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\t// to get face <=> uv index correspondence\r\n\r\n\t\t\t\tfi = geometry.faces.length;\r\n\r\n\t\t\t\tif ( hasFaceVertexUv ) {\r\n\r\n\t\t\t\t\tfor ( i = 0; i < nUvLayers; i ++ ) {\r\n\r\n\t\t\t\t\t\tuvLayer = json.uvs[ i ];\r\n\r\n\t\t\t\t\t\tgeometry.faceVertexUvs[ i ][ fi ] = [];\r\n\t\t\t\t\t\tgeometry.faceVertexUvs[ i ][ fi + 1 ] = []\r\n\r\n\t\t\t\t\t\tfor ( j = 0; j < 4; j ++ ) {\r\n\r\n\t\t\t\t\t\t\tuvIndex = faces[ offset ++ ];\r\n\r\n\t\t\t\t\t\t\tu = uvLayer[ uvIndex * 2 ];\r\n\t\t\t\t\t\t\tv = uvLayer[ uvIndex * 2 + 1 ];\r\n\r\n\t\t\t\t\t\t\tuv = new THREE.Vector2( u, v );\r\n\r\n\t\t\t\t\t\t\tif ( j !== 2 ) geometry.faceVertexUvs[ i ][ fi ].push( uv );\r\n\t\t\t\t\t\t\tif ( j !== 0 ) geometry.faceVertexUvs[ i ][ fi + 1 ].push( uv );\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif ( hasFaceNormal ) {\r\n\r\n\t\t\t\t\tnormalIndex = faces[ offset ++ ] * 3;\r\n\r\n\t\t\t\t\tfaceA.normal.set(\r\n\t\t\t\t\t\tnormals[ normalIndex ++ ],\r\n\t\t\t\t\t\tnormals[ normalIndex ++ ],\r\n\t\t\t\t\t\tnormals[ normalIndex ]\r\n\t\t\t\t\t);\r\n\r\n\t\t\t\t\tfaceB.normal.copy( faceA.normal );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif ( hasFaceVertexNormal ) {\r\n\r\n\t\t\t\t\tfor ( i = 0; i < 4; i ++ ) {\r\n\r\n\t\t\t\t\t\tnormalIndex = faces[ offset ++ ] * 3;\r\n\r\n\t\t\t\t\t\tnormal = new THREE.Vector3(\r\n\t\t\t\t\t\t\tnormals[ normalIndex ++ ],\r\n\t\t\t\t\t\t\tnormals[ normalIndex ++ ],\r\n\t\t\t\t\t\t\tnormals[ normalIndex ]\r\n\t\t\t\t\t\t);\r\n\r\n\r\n\t\t\t\t\t\tif ( i !== 2 ) faceA.vertexNormals.push( normal );\r\n\t\t\t\t\t\tif ( i !== 0 ) faceB.vertexNormals.push( normal );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\r\n\t\t\t\tif ( hasFaceColor ) {\r\n\r\n\t\t\t\t\tcolorIndex = faces[ offset ++ ];\r\n\t\t\t\t\thex = colors[ colorIndex ];\r\n\r\n\t\t\t\t\tfaceA.color.setHex( hex );\r\n\t\t\t\t\tfaceB.color.setHex( hex );\r\n\r\n\t\t\t\t}\r\n\r\n\r\n\t\t\t\tif ( hasFaceVertexColor ) {\r\n\r\n\t\t\t\t\tfor ( i = 0; i < 4; i ++ ) {\r\n\r\n\t\t\t\t\t\tcolorIndex = faces[ offset ++ ];\r\n\t\t\t\t\t\thex = colors[ colorIndex ];\r\n\r\n\t\t\t\t\t\tif ( i !== 2 ) faceA.vertexColors.push( new THREE.Color( hex ) );\r\n\t\t\t\t\t\tif ( i !== 0 ) faceB.vertexColors.push( new THREE.Color( hex ) );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tgeometry.faces.push( faceA );\r\n\t\t\t\tgeometry.faces.push( faceB );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tface = new THREE.Face3();\r\n\t\t\t\tface.a = faces[ offset ++ ];\r\n\t\t\t\tface.b = faces[ offset ++ ];\r\n\t\t\t\tface.c = faces[ offset ++ ];\r\n\r\n\t\t\t\tif ( hasMaterial ) {\r\n\r\n\t\t\t\t\tmaterialIndex = faces[ offset ++ ];\r\n\t\t\t\t\tface.materialIndex = materialIndex;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\t// to get face <=> uv index correspondence\r\n\r\n\t\t\t\tfi = geometry.faces.length;\r\n\r\n\t\t\t\tif ( hasFaceVertexUv ) {\r\n\r\n\t\t\t\t\tfor ( i = 0; i < nUvLayers; i ++ ) {\r\n\r\n\t\t\t\t\t\tuvLayer = json.uvs[ i ];\r\n\r\n\t\t\t\t\t\tgeometry.faceVertexUvs[ i ][ fi ] = [];\r\n\r\n\t\t\t\t\t\tfor ( j = 0; j < 3; j ++ ) {\r\n\r\n\t\t\t\t\t\t\tuvIndex = faces[ offset ++ ];\r\n\r\n\t\t\t\t\t\t\tu = uvLayer[ uvIndex * 2 ];\r\n\t\t\t\t\t\t\tv = uvLayer[ uvIndex * 2 + 1 ];\r\n\r\n\t\t\t\t\t\t\tuv = new THREE.Vector2( u, v );\r\n\r\n\t\t\t\t\t\t\tgeometry.faceVertexUvs[ i ][ fi ].push( uv );\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif ( hasFaceNormal ) {\r\n\r\n\t\t\t\t\tnormalIndex = faces[ offset ++ ] * 3;\r\n\r\n\t\t\t\t\tface.normal.set(\r\n\t\t\t\t\t\tnormals[ normalIndex ++ ],\r\n\t\t\t\t\t\tnormals[ normalIndex ++ ],\r\n\t\t\t\t\t\tnormals[ normalIndex ]\r\n\t\t\t\t\t);\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif ( hasFaceVertexNormal ) {\r\n\r\n\t\t\t\t\tfor ( i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\t\t\t\tnormalIndex = faces[ offset ++ ] * 3;\r\n\r\n\t\t\t\t\t\tnormal = new THREE.Vector3(\r\n\t\t\t\t\t\t\tnormals[ normalIndex ++ ],\r\n\t\t\t\t\t\t\tnormals[ normalIndex ++ ],\r\n\t\t\t\t\t\t\tnormals[ normalIndex ]\r\n\t\t\t\t\t\t);\r\n\r\n\t\t\t\t\t\tface.vertexNormals.push( normal );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\r\n\t\t\t\tif ( hasFaceColor ) {\r\n\r\n\t\t\t\t\tcolorIndex = faces[ offset ++ ];\r\n\t\t\t\t\tface.color.setHex( colors[ colorIndex ] );\r\n\r\n\t\t\t\t}\r\n\r\n\r\n\t\t\t\tif ( hasFaceVertexColor ) {\r\n\r\n\t\t\t\t\tfor ( i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\t\t\t\tcolorIndex = faces[ offset ++ ];\r\n\t\t\t\t\t\tface.vertexColors.push( new THREE.Color( colors[ colorIndex ] ) );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tgeometry.faces.push( face );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t};\r\n\r\n\tfunction parseSkin() {\r\n\t\tvar influencesPerVertex = ( json.influencesPerVertex !== undefined ) ? json.influencesPerVertex : 2;\r\n\r\n\t\tif ( json.skinWeights ) {\r\n\r\n\t\t\tfor ( var i = 0, l = json.skinWeights.length; i < l; i += influencesPerVertex ) {\r\n\r\n\t\t\t\tvar x = json.skinWeights[ i ];\r\n\t\t\t\tvar y = ( influencesPerVertex > 1 ) ? json.skinWeights[ i + 1 ] : 0;\r\n\t\t\t\tvar z = ( influencesPerVertex > 2 ) ? json.skinWeights[ i + 2 ] : 0;\r\n\t\t\t\tvar w = ( influencesPerVertex > 3 ) ? json.skinWeights[ i + 3 ] : 0;\r\n\r\n\t\t\t\tgeometry.skinWeights.push( new THREE.Vector4( x, y, z, w ) );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tif ( json.skinIndices ) {\r\n\r\n\t\t\tfor ( var i = 0, l = json.skinIndices.length; i < l; i += influencesPerVertex ) {\r\n\r\n\t\t\t\tvar a = json.skinIndices[ i ];\r\n\t\t\t\tvar b = ( influencesPerVertex > 1 ) ? json.skinIndices[ i + 1 ] : 0;\r\n\t\t\t\tvar c = ( influencesPerVertex > 2 ) ? json.skinIndices[ i + 2 ] : 0;\r\n\t\t\t\tvar d = ( influencesPerVertex > 3 ) ? json.skinIndices[ i + 3 ] : 0;\r\n\r\n\t\t\t\tgeometry.skinIndices.push( new THREE.Vector4( a, b, c, d ) );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tgeometry.bones = json.bones;\r\n\r\n\t\tif ( geometry.bones && geometry.bones.length > 0 && ( geometry.skinWeights.length !== geometry.skinIndices.length || geometry.skinIndices.length !== geometry.vertices.length ) ) {\r\n\r\n\t\t\tTHREE.warn( 'THREE.JSONLoader: When skinning, number of vertices (' + geometry.vertices.length + '), skinIndices (' +\r\n\t\t\t\t\tgeometry.skinIndices.length + '), and skinWeights (' + geometry.skinWeights.length + ') should match.' );\r\n\r\n\t\t}\r\n\r\n\r\n\t\t// could change this to json.animations[0] or remove completely\r\n\r\n\t\tgeometry.animation = json.animation;\r\n\t\tgeometry.animations = json.animations;\r\n\r\n\t};\r\n\r\n\tfunction parseMorphing( scale ) {\r\n\r\n\t\tif ( json.morphTargets !== undefined ) {\r\n\r\n\t\t\tvar i, l, v, vl, dstVertices, srcVertices;\r\n\r\n\t\t\tfor ( i = 0, l = json.morphTargets.length; i < l; i ++ ) {\r\n\r\n\t\t\t\tgeometry.morphTargets[ i ] = {};\r\n\t\t\t\tgeometry.morphTargets[ i ].name = json.morphTargets[ i ].name;\r\n\t\t\t\tgeometry.morphTargets[ i ].vertices = [];\r\n\r\n\t\t\t\tdstVertices = geometry.morphTargets[ i ].vertices;\r\n\t\t\t\tsrcVertices = json.morphTargets [ i ].vertices;\r\n\r\n\t\t\t\tfor ( v = 0, vl = srcVertices.length; v < vl; v += 3 ) {\r\n\r\n\t\t\t\t\tvar vertex = new THREE.Vector3();\r\n\t\t\t\t\tvertex.x = srcVertices[ v ] * scale;\r\n\t\t\t\t\tvertex.y = srcVertices[ v + 1 ] * scale;\r\n\t\t\t\t\tvertex.z = srcVertices[ v + 2 ] * scale;\r\n\r\n\t\t\t\t\tdstVertices.push( vertex );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tif ( json.morphColors !== undefined ) {\r\n\r\n\t\t\tvar i, l, c, cl, dstColors, srcColors, color;\r\n\r\n\t\t\tfor ( i = 0, l = json.morphColors.length; i < l; i ++ ) {\r\n\r\n\t\t\t\tgeometry.morphColors[ i ] = {};\r\n\t\t\t\tgeometry.morphColors[ i ].name = json.morphColors[ i ].name;\r\n\t\t\t\tgeometry.morphColors[ i ].colors = [];\r\n\r\n\t\t\t\tdstColors = geometry.morphColors[ i ].colors;\r\n\t\t\t\tsrcColors = json.morphColors [ i ].colors;\r\n\r\n\t\t\t\tfor ( c = 0, cl = srcColors.length; c < cl; c += 3 ) {\r\n\r\n\t\t\t\t\tcolor = new THREE.Color( 0xffaa00 );\r\n\t\t\t\t\tcolor.setRGB( srcColors[ c ], srcColors[ c + 1 ], srcColors[ c + 2 ] );\r\n\t\t\t\t\tdstColors.push( color );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t};\r\n\r\n\tif ( json.materials === undefined || json.materials.length === 0 ) {\r\n\r\n\t\treturn { geometry: geometry };\r\n\r\n\t} else {\r\n\r\n\t\tvar materials = this.initMaterials( json.materials, texturePath );\r\n\r\n\t\tif ( this.needsTangents( materials ) ) {\r\n\r\n\t\t\tgeometry.computeTangents();\r\n\r\n\t\t}\r\n\r\n\t\treturn { geometry: geometry, materials: materials };\r\n\r\n\t}\r\n\r\n};\r\n\r\n// File:src/loaders/LoadingManager.js\r\n\r\n/**\r\n * @author mrdoob / http://mrdoob.com/\r\n */\r\n\r\nTHREE.LoadingManager = function ( onLoad, onProgress, onError ) {\r\n\r\n\tvar scope = this;\r\n\r\n\tvar loaded = 0, total = 0;\r\n\r\n\tthis.onLoad = onLoad;\r\n\tthis.onProgress = onProgress;\r\n\tthis.onError = onError;\r\n\r\n\tthis.itemStart = function ( url ) {\r\n\r\n\t\ttotal ++;\r\n\r\n\t};\r\n\r\n\tthis.itemEnd = function ( url ) {\r\n\r\n\t\tloaded ++;\r\n\r\n\t\tif ( scope.onProgress !== undefined ) {\r\n\r\n\t\t\tscope.onProgress( url, loaded, total );\r\n\r\n\t\t}\r\n\r\n\t\tif ( loaded === total && scope.onLoad !== undefined ) {\r\n\r\n\t\t\tscope.onLoad();\r\n\r\n\t\t}\r\n\r\n\t};\r\n\r\n};\r\n\r\nTHREE.DefaultLoadingManager = new THREE.LoadingManager();\r\n\r\n// File:src/loaders/BufferGeometryLoader.js\r\n\r\n/**\r\n * @author mrdoob / http://mrdoob.com/\r\n */\r\n\r\nTHREE.BufferGeometryLoader = function ( manager ) {\r\n\r\n\tthis.manager = ( manager !== undefined ) ? manager : THREE.DefaultLoadingManager;\r\n\r\n};\r\n\r\nTHREE.BufferGeometryLoader.prototype = {\r\n\r\n\tconstructor: THREE.BufferGeometryLoader,\r\n\r\n\tload: function ( url, onLoad, onProgress, onError ) {\r\n\r\n\t\tvar scope = this;\r\n\r\n\t\tvar loader = new THREE.XHRLoader( scope.manager );\r\n\t\tloader.setCrossOrigin( this.crossOrigin );\r\n\t\tloader.load( url, function ( text ) {\r\n\r\n\t\t\tonLoad( scope.parse( JSON.parse( text ) ) );\r\n\r\n\t\t}, onProgress, onError );\r\n\r\n\t},\r\n\r\n\tsetCrossOrigin: function ( value ) {\r\n\r\n\t\tthis.crossOrigin = value;\r\n\r\n\t},\r\n\r\n\tparse: function ( json ) {\r\n\r\n\t\tvar geometry = new THREE.BufferGeometry();\r\n\r\n\t\tvar attributes = json.data.attributes;\r\n\r\n\t\tfor ( var key in attributes ) {\r\n\r\n\t\t\tvar attribute = attributes[ key ];\r\n\t\t\tvar typedArray = new self[ attribute.type ]( attribute.array );\r\n\r\n\t\t\tgeometry.addAttribute( key, new THREE.BufferAttribute( typedArray, attribute.itemSize ) );\r\n\r\n\t\t}\r\n\r\n\t\tvar offsets = json.data.offsets;\r\n\r\n\t\tif ( offsets !== undefined ) {\r\n\r\n\t\t\tgeometry.offsets = JSON.parse( JSON.stringify( offsets ) );\r\n\r\n\t\t}\r\n\r\n\t\tvar boundingSphere = json.data.boundingSphere;\r\n\r\n\t\tif ( boundingSphere !== undefined ) {\r\n\r\n\t\t\tvar center = new THREE.Vector3();\r\n\r\n\t\t\tif ( boundingSphere.center !== undefined ) {\r\n\r\n\t\t\t\tcenter.fromArray( boundingSphere.center );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tgeometry.boundingSphere = new THREE.Sphere( center, boundingSphere.radius );\r\n\r\n\t\t}\r\n\r\n\t\treturn geometry;\r\n\r\n\t}\r\n\r\n};\r\n\r\n// File:src/loaders/MaterialLoader.js\r\n\r\n/**\r\n * @author mrdoob / http://mrdoob.com/\r\n */\r\n\r\nTHREE.MaterialLoader = function ( manager ) {\r\n\r\n\tthis.manager = ( manager !== undefined ) ? manager : THREE.DefaultLoadingManager;\r\n\r\n};\r\n\r\nTHREE.MaterialLoader.prototype = {\r\n\r\n\tconstructor: THREE.MaterialLoader,\r\n\r\n\tload: function ( url, onLoad, onProgress, onError ) {\r\n\r\n\t\tvar scope = this;\r\n\r\n\t\tvar loader = new THREE.XHRLoader( scope.manager );\r\n\t\tloader.setCrossOrigin( this.crossOrigin );\r\n\t\tloader.load( url, function ( text ) {\r\n\r\n\t\t\tonLoad( scope.parse( JSON.parse( text ) ) );\r\n\r\n\t\t}, onProgress, onError );\r\n\r\n\t},\r\n\r\n\tsetCrossOrigin: function ( value ) {\r\n\r\n\t\tthis.crossOrigin = value;\r\n\r\n\t},\r\n\r\n\tparse: function ( json ) {\r\n\r\n\t\tvar material = new THREE[ json.type ];\r\n\r\n\t\tif ( json.color !== undefined ) material.color.setHex( json.color );\r\n\t\tif ( json.emissive !== undefined ) material.emissive.setHex( json.emissive );\r\n\t\tif ( json.specular !== undefined ) material.specular.setHex( json.specular );\r\n\t\tif ( json.shininess !== undefined ) material.shininess = json.shininess;\r\n\t\tif ( json.uniforms !== undefined ) material.uniforms = json.uniforms;\r\n\t\tif ( json.vertexShader !== undefined ) material.vertexShader = json.vertexShader;\r\n\t\tif ( json.fragmentShader !== undefined ) material.fragmentShader = json.fragmentShader;\r\n\t\tif ( json.vertexColors !== undefined ) material.vertexColors = json.vertexColors;\r\n\t\tif ( json.shading !== undefined ) material.shading = json.shading;\r\n\t\tif ( json.blending !== undefined ) material.blending = json.blending;\r\n\t\tif ( json.side !== undefined ) material.side = json.side;\r\n\t\tif ( json.opacity !== undefined ) material.opacity = json.opacity;\r\n\t\tif ( json.transparent !== undefined ) material.transparent = json.transparent;\r\n\t\tif ( json.wireframe !== undefined ) material.wireframe = json.wireframe;\r\n\r\n\t\t// for PointCloudMaterial\r\n\t\tif ( json.size !== undefined ) material.size = json.size;\r\n\t\tif ( json.sizeAttenuation !== undefined ) material.sizeAttenuation = json.sizeAttenuation;\r\n\r\n\t\tif ( json.materials !== undefined ) {\r\n\r\n\t\t\tfor ( var i = 0, l = json.materials.length; i < l; i ++ ) {\r\n\r\n\t\t\t\tmaterial.materials.push( this.parse( json.materials[ i ] ) );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn material;\r\n\r\n\t}\r\n\r\n};\r\n\r\n// File:src/loaders/ObjectLoader.js\r\n\r\n/**\r\n * @author mrdoob / http://mrdoob.com/\r\n */\r\n\r\nTHREE.ObjectLoader = function ( manager ) {\r\n\r\n\tthis.manager = ( manager !== undefined ) ? manager : THREE.DefaultLoadingManager;\r\n\tthis.texturePath = '';\r\n\r\n};\r\n\r\nTHREE.ObjectLoader.prototype = {\r\n\r\n\tconstructor: THREE.ObjectLoader,\r\n\r\n\tload: function ( url, onLoad, onProgress, onError ) {\r\n\r\n\t\tif ( this.texturePath === '' ) {\r\n\r\n\t\t\tthis.texturePath = url.substring( 0, url.lastIndexOf( '/' ) + 1 );\r\n\r\n\t\t}\r\n\r\n\t\tvar scope = this;\r\n\r\n\t\tvar loader = new THREE.XHRLoader( scope.manager );\r\n\t\tloader.setCrossOrigin( this.crossOrigin );\r\n\t\tloader.load( url, function ( text ) {\r\n\r\n\t\t\tscope.parse( JSON.parse( text ), onLoad );\r\n\r\n\t\t}, onProgress, onError );\r\n\r\n\t},\r\n\r\n\tsetTexturePath: function ( value ) {\r\n\r\n\t\tthis.texturePath = value;\r\n\r\n\t},\r\n\r\n\tsetCrossOrigin: function ( value ) {\r\n\r\n\t\tthis.crossOrigin = value;\r\n\r\n\t},\r\n\r\n\tparse: function ( json, onLoad ) {\r\n\r\n\t\tvar geometries = this.parseGeometries( json.geometries );\r\n\r\n\t\tvar images = this.parseImages( json.images, function () {\r\n\r\n\t\t\tif ( onLoad !== undefined ) onLoad( object );\r\n\r\n\t\t} );\r\n\t\tvar textures = this.parseTextures( json.textures, images );\r\n\t\tvar materials = this.parseMaterials( json.materials, textures );\r\n\t\tvar object = this.parseObject( json.object, geometries, materials );\r\n\r\n\t\tif ( json.images === undefined || json.images.length === 0 ) {\r\n\r\n\t\t\tif ( onLoad !== undefined ) onLoad( object );\r\n\r\n\t\t}\r\n\r\n\t\treturn object;\r\n\r\n\t},\r\n\r\n\tparseGeometries: function ( json ) {\r\n\r\n\t\tvar geometries = {};\r\n\r\n\t\tif ( json !== undefined ) {\r\n\r\n\t\t\tvar geometryLoader = new THREE.JSONLoader();\r\n\t\t\tvar bufferGeometryLoader = new THREE.BufferGeometryLoader();\r\n\r\n\t\t\tfor ( var i = 0, l = json.length; i < l; i ++ ) {\r\n\r\n\t\t\t\tvar geometry;\r\n\t\t\t\tvar data = json[ i ];\r\n\r\n\t\t\t\tswitch ( data.type ) {\r\n\r\n\t\t\t\t\tcase 'PlaneGeometry':\r\n\t\t\t\t\tcase 'PlaneBufferGeometry':\r\n\r\n\t\t\t\t\t\tgeometry = new THREE[ data.type ](\r\n\t\t\t\t\t\t\tdata.width,\r\n\t\t\t\t\t\t\tdata.height,\r\n\t\t\t\t\t\t\tdata.widthSegments,\r\n\t\t\t\t\t\t\tdata.heightSegments\r\n\t\t\t\t\t\t);\r\n\r\n\t\t\t\t\t\tbreak;\r\n\r\n\t\t\t\t\tcase 'BoxGeometry':\r\n\t\t\t\t\tcase 'CubeGeometry': // backwards compatible\r\n\r\n\t\t\t\t\t\tgeometry = new THREE.BoxGeometry(\r\n\t\t\t\t\t\t\tdata.width,\r\n\t\t\t\t\t\t\tdata.height,\r\n\t\t\t\t\t\t\tdata.depth,\r\n\t\t\t\t\t\t\tdata.widthSegments,\r\n\t\t\t\t\t\t\tdata.heightSegments,\r\n\t\t\t\t\t\t\tdata.depthSegments\r\n\t\t\t\t\t\t);\r\n\r\n\t\t\t\t\t\tbreak;\r\n\r\n\t\t\t\t\tcase 'CircleGeometry':\r\n\r\n\t\t\t\t\t\tgeometry = new THREE.CircleGeometry(\r\n\t\t\t\t\t\t\tdata.radius,\r\n\t\t\t\t\t\t\tdata.segments\r\n\t\t\t\t\t\t);\r\n\r\n\t\t\t\t\t\tbreak;\r\n\r\n\t\t\t\t\tcase 'CylinderGeometry':\r\n\r\n\t\t\t\t\t\tgeometry = new THREE.CylinderGeometry(\r\n\t\t\t\t\t\t\tdata.radiusTop,\r\n\t\t\t\t\t\t\tdata.radiusBottom,\r\n\t\t\t\t\t\t\tdata.height,\r\n\t\t\t\t\t\t\tdata.radialSegments,\r\n\t\t\t\t\t\t\tdata.heightSegments,\r\n\t\t\t\t\t\t\tdata.openEnded\r\n\t\t\t\t\t\t);\r\n\r\n\t\t\t\t\t\tbreak;\r\n\r\n\t\t\t\t\tcase 'SphereGeometry':\r\n\r\n\t\t\t\t\t\tgeometry = new THREE.SphereGeometry(\r\n\t\t\t\t\t\t\tdata.radius,\r\n\t\t\t\t\t\t\tdata.widthSegments,\r\n\t\t\t\t\t\t\tdata.heightSegments,\r\n\t\t\t\t\t\t\tdata.phiStart,\r\n\t\t\t\t\t\t\tdata.phiLength,\r\n\t\t\t\t\t\t\tdata.thetaStart,\r\n\t\t\t\t\t\t\tdata.thetaLength\r\n\t\t\t\t\t\t);\r\n\r\n\t\t\t\t\t\tbreak;\r\n\r\n\t\t\t\t\tcase 'IcosahedronGeometry':\r\n\r\n\t\t\t\t\t\tgeometry = new THREE.IcosahedronGeometry(\r\n\t\t\t\t\t\t\tdata.radius,\r\n\t\t\t\t\t\t\tdata.detail\r\n\t\t\t\t\t\t);\r\n\r\n\t\t\t\t\t\tbreak;\r\n\r\n\t\t\t\t\tcase 'TorusGeometry':\r\n\r\n\t\t\t\t\t\tgeometry = new THREE.TorusGeometry(\r\n\t\t\t\t\t\t\tdata.radius,\r\n\t\t\t\t\t\t\tdata.tube,\r\n\t\t\t\t\t\t\tdata.radialSegments,\r\n\t\t\t\t\t\t\tdata.tubularSegments,\r\n\t\t\t\t\t\t\tdata.arc\r\n\t\t\t\t\t\t);\r\n\r\n\t\t\t\t\t\tbreak;\r\n\r\n\t\t\t\t\tcase 'TorusKnotGeometry':\r\n\r\n\t\t\t\t\t\tgeometry = new THREE.TorusKnotGeometry(\r\n\t\t\t\t\t\t\tdata.radius,\r\n\t\t\t\t\t\t\tdata.tube,\r\n\t\t\t\t\t\t\tdata.radialSegments,\r\n\t\t\t\t\t\t\tdata.tubularSegments,\r\n\t\t\t\t\t\t\tdata.p,\r\n\t\t\t\t\t\t\tdata.q,\r\n\t\t\t\t\t\t\tdata.heightScale\r\n\t\t\t\t\t\t);\r\n\r\n\t\t\t\t\t\tbreak;\r\n\r\n\t\t\t\t\tcase 'BufferGeometry':\r\n\r\n\t\t\t\t\t\tgeometry = bufferGeometryLoader.parse( data );\r\n\r\n\t\t\t\t\t\tbreak;\r\n\r\n\t\t\t\t\tcase 'Geometry':\r\n\r\n\t\t\t\t\t\tgeometry = geometryLoader.parse( data.data ).geometry;\r\n\r\n\t\t\t\t\t\tbreak;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tgeometry.uuid = data.uuid;\r\n\r\n\t\t\t\tif ( data.name !== undefined ) geometry.name = data.name;\r\n\r\n\t\t\t\tgeometries[ data.uuid ] = geometry;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn geometries;\r\n\r\n\t},\r\n\r\n\tparseMaterials: function ( json, textures ) {\r\n\r\n\t\tvar materials = {};\r\n\r\n\t\tif ( json !== undefined ) {\r\n\r\n\t\t\tvar getTexture = function ( name ) {\r\n\r\n\t\t\t\tif ( textures[ name ] === undefined ) {\r\n\r\n\t\t\t\t\tTHREE.warn( 'THREE.ObjectLoader: Undefined texture', name );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\treturn textures[ name ];\r\n\r\n\t\t\t};\r\n\r\n\t\t\tvar loader = new THREE.MaterialLoader();\r\n\r\n\t\t\tfor ( var i = 0, l = json.length; i < l; i ++ ) {\r\n\r\n\t\t\t\tvar data = json[ i ];\r\n\t\t\t\tvar material = loader.parse( data );\r\n\r\n\t\t\t\tmaterial.uuid = data.uuid;\r\n\r\n\t\t\t\tif ( data.name !== undefined ) material.name = data.name;\r\n\r\n\t\t\t\tif ( data.map !== undefined ) {\r\n\r\n\t\t\t\t\tmaterial.map = getTexture( data.map );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif ( data.bumpMap !== undefined ) {\r\n\r\n\t\t\t\t\tmaterial.bumpMap = getTexture( data.bumpMap );\r\n\t\t\t\t\tif ( data.bumpScale ) {\r\n\t\t\t\t\t\tmaterial.bumpScale = new THREE.Vector2( data.bumpScale, data.bumpScale );\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif ( data.alphaMap !== undefined ) {\r\n\r\n\t\t\t\t\tmaterial.alphaMap = getTexture( data.alphaMap );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif ( data.envMap !== undefined ) {\r\n\r\n\t\t\t\t\tmaterial.envMap = getTexture( data.envMap );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif ( data.normalMap !== undefined ) {\r\n\r\n\t\t\t\t\tmaterial.normalMap = getTexture( data.normalMap );\r\n\t\t\t\t\tif ( data.normalScale ) {\r\n\t\t\t\t\t\tmaterial.normalScale = new THREE.Vector2( data.normalScale, data.normalScale );\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif ( data.lightMap !== undefined ) {\r\n\r\n\t\t\t\t\tmaterial.lightMap = getTexture( data.lightMap );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif ( data.specularMap !== undefined ) {\r\n\r\n\t\t\t\t\tmaterial.specularMap = getTexture( data.specularMap );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tmaterials[ data.uuid ] = material;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn materials;\r\n\r\n\t},\r\n\r\n\tparseImages: function ( json, onLoad ) {\r\n\r\n\t\tvar scope = this;\r\n\t\tvar images = {};\r\n\r\n\t\tif ( json !== undefined && json.length > 0 ) {\r\n\r\n\t\t\tvar manager = new THREE.LoadingManager( onLoad );\r\n\r\n\t\t\tvar loader = new THREE.ImageLoader( manager );\r\n\t\t\tloader.setCrossOrigin( this.crossOrigin );\r\n\r\n\t\t\tvar loadImage = function ( url ) {\r\n\r\n\t\t\t\tscope.manager.itemStart( url );\r\n\r\n\t\t\t\treturn loader.load( url, function () {\r\n\r\n\t\t\t\t\tscope.manager.itemEnd( url );\r\n\r\n\t\t\t\t} );\r\n\r\n\t\t\t};\r\n\r\n\t\t\tfor ( var i = 0, l = json.length; i < l; i ++ ) {\r\n\r\n\t\t\t\tvar image = json[ i ];\r\n\t\t\t\tvar path = /^(\\/\\/)|([a-z]+:(\\/\\/)?)/i.test( image.url ) ? image.url : scope.texturePath + image.url;\r\n\r\n\t\t\t\timages[ image.uuid ] = loadImage( path );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn images;\r\n\r\n\t},\r\n\r\n\tparseTextures: function ( json, images ) {\r\n\r\n\t\tvar textures = {};\r\n\r\n\t\tif ( json !== undefined ) {\r\n\r\n\t\t\tfor ( var i = 0, l = json.length; i < l; i ++ ) {\r\n\r\n\t\t\t\tvar data = json[ i ];\r\n\r\n\t\t\t\tif ( data.image === undefined ) {\r\n\r\n\t\t\t\t\tTHREE.warn( 'THREE.ObjectLoader: No \"image\" speficied for', data.uuid );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif ( images[ data.image ] === undefined ) {\r\n\r\n\t\t\t\t\tTHREE.warn( 'THREE.ObjectLoader: Undefined image', data.image );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tvar texture = new THREE.Texture( images[ data.image ] );\r\n\t\t\t\ttexture.needsUpdate = true;\r\n\r\n\t\t\t\ttexture.uuid = data.uuid;\r\n\r\n\t\t\t\tif ( data.name !== undefined ) texture.name = data.name;\r\n\t\t\t\tif ( data.repeat !== undefined ) texture.repeat = new THREE.Vector2( data.repeat[ 0 ], data.repeat[ 1 ] );\r\n\t\t\t\tif ( data.minFilter !== undefined ) texture.minFilter = THREE[ data.minFilter ];\r\n\t\t\t\tif ( data.magFilter !== undefined ) texture.magFilter = THREE[ data.magFilter ];\r\n\t\t\t\tif ( data.anisotropy !== undefined ) texture.anisotropy = data.anisotropy;\r\n\t\t\t\tif ( data.wrap instanceof Array ) {\r\n\r\n\t\t\t\t\ttexture.wrapS = THREE[ data.wrap[ 0 ] ];\r\n\t\t\t\t\ttexture.wrapT = THREE[ data.wrap[ 1 ] ];\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\ttextures[ data.uuid ] = texture;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn textures;\r\n\r\n\t},\r\n\r\n\tparseObject: function () {\r\n\r\n\t\tvar matrix = new THREE.Matrix4();\r\n\r\n\t\treturn function ( data, geometries, materials ) {\r\n\r\n\t\t\tvar object;\r\n\r\n\t\t\tvar getGeometry = function ( name ) {\r\n\r\n\t\t\t\tif ( geometries[ name ] === undefined ) {\r\n\r\n\t\t\t\t\tTHREE.warn( 'THREE.ObjectLoader: Undefined geometry', name );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\treturn geometries[ name ];\r\n\r\n\t\t\t};\r\n\r\n\t\t\tvar getMaterial = function ( name ) {\r\n\r\n\t\t\t\tif ( materials[ name ] === undefined ) {\r\n\r\n\t\t\t\t\tTHREE.warn( 'THREE.ObjectLoader: Undefined material', name );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\treturn materials[ name ];\r\n\r\n\t\t\t};\r\n\r\n\t\t\tswitch ( data.type ) {\r\n\r\n\t\t\t\tcase 'Scene':\r\n\r\n\t\t\t\t\tobject = new THREE.Scene();\r\n\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase 'PerspectiveCamera':\r\n\r\n\t\t\t\t\tobject = new THREE.PerspectiveCamera( data.fov, data.aspect, data.near, data.far );\r\n\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase 'OrthographicCamera':\r\n\r\n\t\t\t\t\tobject = new THREE.OrthographicCamera( data.left, data.right, data.top, data.bottom, data.near, data.far );\r\n\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase 'AmbientLight':\r\n\r\n\t\t\t\t\tobject = new THREE.AmbientLight( data.color );\r\n\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase 'DirectionalLight':\r\n\r\n\t\t\t\t\tobject = new THREE.DirectionalLight( data.color, data.intensity );\r\n\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase 'PointLight':\r\n\r\n\t\t\t\t\tobject = new THREE.PointLight( data.color, data.intensity, data.distance, data.decay );\r\n\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase 'SpotLight':\r\n\r\n\t\t\t\t\tobject = new THREE.SpotLight( data.color, data.intensity, data.distance, data.angle, data.exponent, data.decay );\r\n\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase 'HemisphereLight':\r\n\r\n\t\t\t\t\tobject = new THREE.HemisphereLight( data.color, data.groundColor, data.intensity );\r\n\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase 'Mesh':\r\n\r\n\t\t\t\t\tobject = new THREE.Mesh( getGeometry( data.geometry ), getMaterial( data.material ) );\r\n\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase 'Line':\r\n\r\n\t\t\t\t\tobject = new THREE.Line( getGeometry( data.geometry ), getMaterial( data.material ), data.mode );\r\n\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase 'PointCloud':\r\n\r\n\t\t\t\t\tobject = new THREE.PointCloud( getGeometry( data.geometry ), getMaterial( data.material ) );\r\n\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase 'Sprite':\r\n\r\n\t\t\t\t\tobject = new THREE.Sprite( getMaterial( data.material ) );\r\n\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase 'Group':\r\n\r\n\t\t\t\t\tobject = new THREE.Group();\r\n\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tdefault:\r\n\r\n\t\t\t\t\tobject = new THREE.Object3D();\r\n\r\n\t\t\t}\r\n\r\n\t\t\tobject.uuid = data.uuid;\r\n\r\n\t\t\tif ( data.name !== undefined ) object.name = data.name;\r\n\t\t\tif ( data.matrix !== undefined ) {\r\n\r\n\t\t\t\tmatrix.fromArray( data.matrix );\r\n\t\t\t\tmatrix.decompose( object.position, object.quaternion, object.scale );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tif ( data.position !== undefined ) object.position.fromArray( data.position );\r\n\t\t\t\tif ( data.rotation !== undefined ) object.rotation.fromArray( data.rotation );\r\n\t\t\t\tif ( data.scale !== undefined ) object.scale.fromArray( data.scale );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( data.visible !== undefined ) object.visible = data.visible;\r\n\t\t\tif ( data.userData !== undefined ) object.userData = data.userData;\r\n\r\n\t\t\tif ( data.children !== undefined ) {\r\n\r\n\t\t\t\tfor ( var child in data.children ) {\r\n\r\n\t\t\t\t\tobject.add( this.parseObject( data.children[ child ], geometries, materials ) );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\treturn object;\r\n\r\n\t\t}\r\n\r\n\t}()\r\n\r\n};\r\n\r\n// File:src/loaders/TextureLoader.js\r\n\r\n/**\r\n * @author mrdoob / http://mrdoob.com/\r\n */\r\n\r\nTHREE.TextureLoader = function ( manager ) {\r\n\r\n\tthis.manager = ( manager !== undefined ) ? manager : THREE.DefaultLoadingManager;\r\n\r\n};\r\n\r\nTHREE.TextureLoader.prototype = {\r\n\r\n\tconstructor: THREE.TextureLoader,\r\n\r\n\tload: function ( url, onLoad, onProgress, onError ) {\r\n\r\n\t\tvar scope = this;\r\n\r\n\t\tvar loader = new THREE.ImageLoader( scope.manager );\r\n\t\tloader.setCrossOrigin( this.crossOrigin );\r\n\t\tloader.load( url, function ( image ) {\r\n\r\n\t\t\tvar texture = new THREE.Texture( image );\r\n\t\t\ttexture.needsUpdate = true;\r\n\r\n\t\t\tif ( onLoad !== undefined ) {\r\n\r\n\t\t\t\tonLoad( texture );\r\n\r\n\t\t\t}\r\n\r\n\t\t}, onProgress, onError );\r\n\r\n\t},\r\n\r\n\tsetCrossOrigin: function ( value ) {\r\n\r\n\t\tthis.crossOrigin = value;\r\n\r\n\t}\r\n\r\n};\r\n\r\n// File:src/loaders/BinaryTextureLoader.js\r\n\r\n/**\r\n * @author Nikos M. / https://github.com/foo123/\r\n *\r\n * Abstract Base class to load generic binary textures formats (rgbe, hdr, ...)\r\n */\r\n\r\nTHREE.DataTextureLoader = THREE.BinaryTextureLoader = function () {\r\n\r\n\t// override in sub classes\r\n\tthis._parser = null;\r\n\r\n};\r\n\r\nTHREE.BinaryTextureLoader.prototype = {\r\n\r\n\tconstructor: THREE.BinaryTextureLoader,\r\n\r\n\tload: function ( url, onLoad, onProgress, onError ) {\r\n\r\n\t\tvar scope = this;\r\n\r\n\t\tvar texture = new THREE.DataTexture( );\r\n\r\n\t\tvar loader = new THREE.XHRLoader();\r\n\t\tloader.setResponseType( 'arraybuffer' );\r\n\r\n\t\tloader.load( url, function ( buffer ) {\r\n\r\n\t\t\tvar texData = scope._parser( buffer );\r\n\r\n\t\t\tif ( !texData ) return;\r\n\r\n\t\t\tif ( undefined !== texData.image ) {\r\n\r\n\t\t\t\ttexture.image = texData.image;\r\n\r\n\t\t\t} else if ( undefined !== texData.data ) {\r\n\r\n\t\t\t\ttexture.image.width = texData.width;\r\n\t\t\t\ttexture.image.height = texData.height;\r\n\t\t\t\ttexture.image.data = texData.data;\r\n\r\n\t\t\t}\r\n\r\n\t\t\ttexture.wrapS = undefined !== texData.wrapS ? texData.wrapS : THREE.ClampToEdgeWrapping;\r\n\t\t\ttexture.wrapT = undefined !== texData.wrapT ? texData.wrapT : THREE.ClampToEdgeWrapping;\r\n\r\n\t\t\ttexture.magFilter = undefined !== texData.magFilter ? texData.magFilter : THREE.LinearFilter;\r\n\t\t\ttexture.minFilter = undefined !== texData.minFilter ? texData.minFilter : THREE.LinearMipMapLinearFilter;\r\n\r\n\t\t\ttexture.anisotropy = undefined !== texData.anisotropy ? texData.anisotropy : 1;\r\n\r\n\t\t\tif ( undefined !== texData.format ) {\r\n\r\n\t\t\t\ttexture.format = texData.format;\r\n\r\n\t\t\t}\r\n\t\t\tif ( undefined !== texData.type ) {\r\n\r\n\t\t\t\ttexture.type = texData.type;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( undefined !== texData.mipmaps ) {\r\n\r\n\t\t\t\ttexture.mipmaps = texData.mipmaps;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( 1 === texData.mipmapCount ) {\r\n\r\n\t\t\t\ttexture.minFilter = THREE.LinearFilter;\r\n\r\n\t\t\t}\r\n\r\n\t\t\ttexture.needsUpdate = true;\r\n\r\n\t\t\tif ( onLoad ) onLoad( texture, texData );\r\n\r\n\t\t}, onProgress, onError );\r\n\r\n\r\n\t\treturn texture;\r\n\r\n\t}\r\n\r\n};\r\n\r\n// File:src/loaders/CompressedTextureLoader.js\r\n\r\n/**\r\n * @author mrdoob / http://mrdoob.com/\r\n *\r\n * Abstract Base class to block based textures loader (dds, pvr, ...)\r\n */\r\n\r\nTHREE.CompressedTextureLoader = function () {\r\n\r\n\t// override in sub classes\r\n\tthis._parser = null;\r\n\r\n};\r\n\r\n\r\nTHREE.CompressedTextureLoader.prototype = {\r\n\r\n\tconstructor: THREE.CompressedTextureLoader,\r\n\r\n\tload: function ( url, onLoad, onError ) {\r\n\r\n\t\tvar scope = this;\r\n\r\n\t\tvar images = [];\r\n\r\n\t\tvar texture = new THREE.CompressedTexture();\r\n\t\ttexture.image = images;\r\n\r\n\t\tvar loader = new THREE.XHRLoader();\r\n\t\tloader.setResponseType( 'arraybuffer' );\r\n\r\n\t\tif ( url instanceof Array ) {\r\n\r\n\t\t\tvar loaded = 0;\r\n\r\n\t\t\tvar loadTexture = function ( i ) {\r\n\r\n\t\t\t\tloader.load( url[ i ], function ( buffer ) {\r\n\r\n\t\t\t\t\tvar texDatas = scope._parser( buffer, true );\r\n\r\n\t\t\t\t\timages[ i ] = {\r\n\t\t\t\t\t\twidth: texDatas.width,\r\n\t\t\t\t\t\theight: texDatas.height,\r\n\t\t\t\t\t\tformat: texDatas.format,\r\n\t\t\t\t\t\tmipmaps: texDatas.mipmaps\r\n\t\t\t\t\t};\r\n\r\n\t\t\t\t\tloaded += 1;\r\n\r\n\t\t\t\t\tif ( loaded === 6 ) {\r\n\r\n\t\t\t\t\t\tif (texDatas.mipmapCount == 1)\r\n \t\t\t\t\t\t\ttexture.minFilter = THREE.LinearFilter;\r\n\r\n\t\t\t\t\t\ttexture.format = texDatas.format;\r\n\t\t\t\t\t\ttexture.needsUpdate = true;\r\n\r\n\t\t\t\t\t\tif ( onLoad ) onLoad( texture );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t} );\r\n\r\n\t\t\t};\r\n\r\n\t\t\tfor ( var i = 0, il = url.length; i < il; ++ i ) {\r\n\r\n\t\t\t\tloadTexture( i );\r\n\r\n\t\t\t}\r\n\r\n\t\t} else {\r\n\r\n\t\t\t// compressed cubemap texture stored in a single DDS file\r\n\r\n\t\t\tloader.load( url, function ( buffer ) {\r\n\r\n\t\t\t\tvar texDatas = scope._parser( buffer, true );\r\n\r\n\t\t\t\tif ( texDatas.isCubemap ) {\r\n\r\n\t\t\t\t\tvar faces = texDatas.mipmaps.length / texDatas.mipmapCount;\r\n\r\n\t\t\t\t\tfor ( var f = 0; f < faces; f ++ ) {\r\n\r\n\t\t\t\t\t\timages[ f ] = { mipmaps : [] };\r\n\r\n\t\t\t\t\t\tfor ( var i = 0; i < texDatas.mipmapCount; i ++ ) {\r\n\r\n\t\t\t\t\t\t\timages[ f ].mipmaps.push( texDatas.mipmaps[ f * texDatas.mipmapCount + i ] );\r\n\t\t\t\t\t\t\timages[ f ].format = texDatas.format;\r\n\t\t\t\t\t\t\timages[ f ].width = texDatas.width;\r\n\t\t\t\t\t\t\timages[ f ].height = texDatas.height;\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\ttexture.image.width = texDatas.width;\r\n\t\t\t\t\ttexture.image.height = texDatas.height;\r\n\t\t\t\t\ttexture.mipmaps = texDatas.mipmaps;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif ( texDatas.mipmapCount === 1 ) {\r\n\r\n\t\t\t\t\ttexture.minFilter = THREE.LinearFilter;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\ttexture.format = texDatas.format;\r\n\t\t\t\ttexture.needsUpdate = true;\r\n\r\n\t\t\t\tif ( onLoad ) onLoad( texture );\r\n\r\n\t\t\t} );\r\n\r\n\t\t}\r\n\r\n\t\treturn texture;\r\n\r\n\t}\r\n\r\n};\r\n\r\n// File:src/materials/Material.js\r\n\r\n/**\r\n * @author mrdoob / http://mrdoob.com/\r\n * @author alteredq / http://alteredqualia.com/\r\n */\r\n\r\nTHREE.Material = function () {\r\n\r\n\tObject.defineProperty( this, 'id', { value: THREE.MaterialIdCount ++ } );\r\n\r\n\tthis.uuid = THREE.Math.generateUUID();\r\n\r\n\tthis.name = '';\r\n\tthis.type = 'Material';\r\n\r\n\tthis.side = THREE.FrontSide;\r\n\r\n\tthis.opacity = 1;\r\n\tthis.transparent = false;\r\n\r\n\tthis.blending = THREE.NormalBlending;\r\n\r\n\tthis.blendSrc = THREE.SrcAlphaFactor;\r\n\tthis.blendDst = THREE.OneMinusSrcAlphaFactor;\r\n\tthis.blendEquation = THREE.AddEquation;\r\n\tthis.blendSrcAlpha = null;\r\n\tthis.blendDstAlpha = null;\r\n\tthis.blendEquationAlpha = null;\r\n\r\n\tthis.depthTest = true;\r\n\tthis.depthWrite = true;\r\n\r\n\tthis.colorWrite = true;\r\n\r\n\tthis.polygonOffset = false;\r\n\tthis.polygonOffsetFactor = 0;\r\n\tthis.polygonOffsetUnits = 0;\r\n\r\n\tthis.alphaTest = 0;\r\n\r\n\tthis.overdraw = 0; // Overdrawn pixels (typically between 0 and 1) for fixing antialiasing gaps in CanvasRenderer\r\n\r\n\tthis.visible = true;\r\n\r\n\tthis._needsUpdate = true;\r\n\r\n};\r\n\r\nTHREE.Material.prototype = {\r\n\r\n\tconstructor: THREE.Material,\r\n\r\n\tget needsUpdate () {\r\n\r\n\t\treturn this._needsUpdate;\r\n\r\n\t},\r\n\r\n\tset needsUpdate ( value ) {\r\n\r\n\t\tif ( value === true ) this.update();\r\n\r\n\t\tthis._needsUpdate = value;\r\n\r\n\t},\r\n\r\n\tsetValues: function ( values ) {\r\n\r\n\t\tif ( values === undefined ) return;\r\n\r\n\t\tfor ( var key in values ) {\r\n\r\n\t\t\tvar newValue = values[ key ];\r\n\r\n\t\t\tif ( newValue === undefined ) {\r\n\r\n\t\t\t\tTHREE.warn( \"THREE.Material: '\" + key + \"' parameter is undefined.\" );\r\n\t\t\t\tcontinue;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( key in this ) {\r\n\r\n\t\t\t\tvar currentValue = this[ key ];\r\n\r\n\t\t\t\tif ( currentValue instanceof THREE.Color ) {\r\n\r\n\t\t\t\t\tcurrentValue.set( newValue );\r\n\r\n\t\t\t\t} else if ( currentValue instanceof THREE.Vector3 && newValue instanceof THREE.Vector3 ) {\r\n\r\n\t\t\t\t\tcurrentValue.copy( newValue );\r\n\r\n\t\t\t\t} else if ( key == 'overdraw' ) {\r\n\r\n\t\t\t\t\t// ensure overdraw is backwards-compatable with legacy boolean type\r\n\t\t\t\t\tthis[ key ] = Number( newValue );\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\tthis[ key ] = newValue;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t},\r\n\r\n\ttoJSON: function () {\r\n\r\n\t\tvar output = {\r\n\t\t\tmetadata: {\r\n\t\t\t\tversion: 4.2,\r\n\t\t\t\ttype: 'material',\r\n\t\t\t\tgenerator: 'MaterialExporter'\r\n\t\t\t},\r\n\t\t\tuuid: this.uuid,\r\n\t\t\ttype: this.type\r\n\t\t};\r\n\r\n\t\tif ( this.name !== \"\" ) output.name = this.name;\r\n\r\n\t\tif ( this instanceof THREE.MeshBasicMaterial ) {\r\n\r\n\t\t\toutput.color = this.color.getHex();\r\n\t\t\tif ( this.vertexColors !== THREE.NoColors ) output.vertexColors = this.vertexColors;\r\n\t\t\tif ( this.blending !== THREE.NormalBlending ) output.blending = this.blending;\r\n\t\t\tif ( this.side !== THREE.FrontSide ) output.side = this.side;\r\n\r\n\t\t} else if ( this instanceof THREE.MeshLambertMaterial ) {\r\n\r\n\t\t\toutput.color = this.color.getHex();\r\n\t\t\toutput.emissive = this.emissive.getHex();\r\n\t\t\tif ( this.vertexColors !== THREE.NoColors ) output.vertexColors = this.vertexColors;\r\n\t\t\tif ( this.shading !== THREE.SmoothShading ) output.shading = this.shading;\r\n\t\t\tif ( this.blending !== THREE.NormalBlending ) output.blending = this.blending;\r\n\t\t\tif ( this.side !== THREE.FrontSide ) output.side = this.side;\r\n\r\n\t\t} else if ( this instanceof THREE.MeshPhongMaterial ) {\r\n\r\n\t\t\toutput.color = this.color.getHex();\r\n\t\t\toutput.emissive = this.emissive.getHex();\r\n\t\t\toutput.specular = this.specular.getHex();\r\n\t\t\toutput.shininess = this.shininess;\r\n\t\t\tif ( this.vertexColors !== THREE.NoColors ) output.vertexColors = this.vertexColors;\r\n\t\t\tif ( this.shading !== THREE.SmoothShading ) output.shading = this.shading;\r\n\t\t\tif ( this.blending !== THREE.NormalBlending ) output.blending = this.blending;\r\n\t\t\tif ( this.side !== THREE.FrontSide ) output.side = this.side;\r\n\r\n\t\t} else if ( this instanceof THREE.MeshNormalMaterial ) {\r\n\r\n\t\t\tif ( this.blending !== THREE.NormalBlending ) output.blending = this.blending;\r\n\t\t\tif ( this.side !== THREE.FrontSide ) output.side = this.side;\r\n\r\n\t\t} else if ( this instanceof THREE.MeshDepthMaterial ) {\r\n\r\n\t\t\tif ( this.blending !== THREE.NormalBlending ) output.blending = this.blending;\r\n\t\t\tif ( this.side !== THREE.FrontSide ) output.side = this.side;\r\n\r\n\t\t} else if ( this instanceof THREE.PointCloudMaterial ) {\r\n\r\n\t\t\toutput.size = this.size;\r\n\t\t\toutput.sizeAttenuation = this.sizeAttenuation;\r\n\t\t\toutput.color = this.color.getHex();\r\n\r\n\t\t\tif ( this.vertexColors !== THREE.NoColors ) output.vertexColors = this.vertexColors;\r\n\t\t\tif ( this.blending !== THREE.NormalBlending ) output.blending = this.blending;\r\n\r\n\t\t} else if ( this instanceof THREE.ShaderMaterial ) {\r\n\r\n\t\t\toutput.uniforms = this.uniforms;\r\n\t\t\toutput.vertexShader = this.vertexShader;\r\n\t\t\toutput.fragmentShader = this.fragmentShader;\r\n\r\n\t\t} else if ( this instanceof THREE.SpriteMaterial ) {\r\n\r\n\t\t\toutput.color = this.color.getHex();\r\n\r\n\t\t}\r\n\r\n\t\tif ( this.opacity < 1 ) output.opacity = this.opacity;\r\n\t\tif ( this.transparent !== false ) output.transparent = this.transparent;\r\n\t\tif ( this.wireframe !== false ) output.wireframe = this.wireframe;\r\n\r\n\t\treturn output;\r\n\r\n\t},\r\n\r\n\tclone: function ( material ) {\r\n\r\n\t\tif ( material === undefined ) material = new THREE.Material();\r\n\r\n\t\tmaterial.name = this.name;\r\n\r\n\t\tmaterial.side = this.side;\r\n\r\n\t\tmaterial.opacity = this.opacity;\r\n\t\tmaterial.transparent = this.transparent;\r\n\r\n\t\tmaterial.blending = this.blending;\r\n\r\n\t\tmaterial.blendSrc = this.blendSrc;\r\n\t\tmaterial.blendDst = this.blendDst;\r\n\t\tmaterial.blendEquation = this.blendEquation;\r\n\t\tmaterial.blendSrcAlpha = this.blendSrcAlpha;\r\n\t\tmaterial.blendDstAlpha = this.blendDstAlpha;\r\n\t\tmaterial.blendEquationAlpha = this.blendEquationAlpha;\r\n\r\n\t\tmaterial.depthTest = this.depthTest;\r\n\t\tmaterial.depthWrite = this.depthWrite;\r\n\r\n\t\tmaterial.polygonOffset = this.polygonOffset;\r\n\t\tmaterial.polygonOffsetFactor = this.polygonOffsetFactor;\r\n\t\tmaterial.polygonOffsetUnits = this.polygonOffsetUnits;\r\n\r\n\t\tmaterial.alphaTest = this.alphaTest;\r\n\r\n\t\tmaterial.overdraw = this.overdraw;\r\n\r\n\t\tmaterial.visible = this.visible;\r\n\r\n\t\treturn material;\r\n\r\n\t},\r\n\r\n\tupdate: function () {\r\n\r\n\t\tthis.dispatchEvent( { type: 'update' } );\r\n\r\n\t},\r\n\r\n\tdispose: function () {\r\n\r\n\t\tthis.dispatchEvent( { type: 'dispose' } );\r\n\r\n\t}\r\n\r\n};\r\n\r\nTHREE.EventDispatcher.prototype.apply( THREE.Material.prototype );\r\n\r\nTHREE.MaterialIdCount = 0;\r\n\r\n// File:src/materials/LineBasicMaterial.js\r\n\r\n/**\r\n * @author mrdoob / http://mrdoob.com/\r\n * @author alteredq / http://alteredqualia.com/\r\n *\r\n * parameters = {\r\n * color: ,\r\n * opacity: ,\r\n *\r\n * blending: THREE.NormalBlending,\r\n * depthTest: ,\r\n * depthWrite: ,\r\n *\r\n * linewidth: ,\r\n * linecap: \"round\",\r\n * linejoin: \"round\",\r\n *\r\n * vertexColors: \r\n *\r\n * fog: \r\n * }\r\n */\r\n\r\nTHREE.LineBasicMaterial = function ( parameters ) {\r\n\r\n\tTHREE.Material.call( this );\r\n\r\n\tthis.type = 'LineBasicMaterial';\r\n\r\n\tthis.color = new THREE.Color( 0xffffff );\r\n\r\n\tthis.linewidth = 1;\r\n\tthis.linecap = 'round';\r\n\tthis.linejoin = 'round';\r\n\r\n\tthis.vertexColors = THREE.NoColors;\r\n\r\n\tthis.fog = true;\r\n\r\n\tthis.setValues( parameters );\r\n\r\n};\r\n\r\nTHREE.LineBasicMaterial.prototype = Object.create( THREE.Material.prototype );\r\nTHREE.LineBasicMaterial.prototype.constructor = THREE.LineBasicMaterial;\r\n\r\nTHREE.LineBasicMaterial.prototype.clone = function () {\r\n\r\n\tvar material = new THREE.LineBasicMaterial();\r\n\r\n\tTHREE.Material.prototype.clone.call( this, material );\r\n\r\n\tmaterial.color.copy( this.color );\r\n\r\n\tmaterial.linewidth = this.linewidth;\r\n\tmaterial.linecap = this.linecap;\r\n\tmaterial.linejoin = this.linejoin;\r\n\r\n\tmaterial.vertexColors = this.vertexColors;\r\n\r\n\tmaterial.fog = this.fog;\r\n\r\n\treturn material;\r\n\r\n};\r\n\r\n// File:src/materials/LineDashedMaterial.js\r\n\r\n/**\r\n * @author alteredq / http://alteredqualia.com/\r\n *\r\n * parameters = {\r\n * color: ,\r\n * opacity: ,\r\n *\r\n * blending: THREE.NormalBlending,\r\n * depthTest: ,\r\n * depthWrite: ,\r\n *\r\n * linewidth: ,\r\n *\r\n * scale: ,\r\n * dashSize: ,\r\n * gapSize: ,\r\n *\r\n * vertexColors: \r\n *\r\n * fog: \r\n * }\r\n */\r\n\r\nTHREE.LineDashedMaterial = function ( parameters ) {\r\n\r\n\tTHREE.Material.call( this );\r\n\r\n\tthis.type = 'LineDashedMaterial';\r\n\r\n\tthis.color = new THREE.Color( 0xffffff );\r\n\r\n\tthis.linewidth = 1;\r\n\r\n\tthis.scale = 1;\r\n\tthis.dashSize = 3;\r\n\tthis.gapSize = 1;\r\n\r\n\tthis.vertexColors = false;\r\n\r\n\tthis.fog = true;\r\n\r\n\tthis.setValues( parameters );\r\n\r\n};\r\n\r\nTHREE.LineDashedMaterial.prototype = Object.create( THREE.Material.prototype );\r\nTHREE.LineDashedMaterial.prototype.constructor = THREE.LineDashedMaterial;\r\n\r\nTHREE.LineDashedMaterial.prototype.clone = function () {\r\n\r\n\tvar material = new THREE.LineDashedMaterial();\r\n\r\n\tTHREE.Material.prototype.clone.call( this, material );\r\n\r\n\tmaterial.color.copy( this.color );\r\n\r\n\tmaterial.linewidth = this.linewidth;\r\n\r\n\tmaterial.scale = this.scale;\r\n\tmaterial.dashSize = this.dashSize;\r\n\tmaterial.gapSize = this.gapSize;\r\n\r\n\tmaterial.vertexColors = this.vertexColors;\r\n\r\n\tmaterial.fog = this.fog;\r\n\r\n\treturn material;\r\n\r\n};\r\n\r\n// File:src/materials/MeshBasicMaterial.js\r\n\r\n/**\r\n * @author mrdoob / http://mrdoob.com/\r\n * @author alteredq / http://alteredqualia.com/\r\n *\r\n * parameters = {\r\n * color: ,\r\n * opacity: ,\r\n * map: new THREE.Texture( ),\r\n *\r\n * lightMap: new THREE.Texture( ),\r\n *\r\n * specularMap: new THREE.Texture( ),\r\n *\r\n * alphaMap: new THREE.Texture( ),\r\n *\r\n * envMap: new THREE.TextureCube( [posx, negx, posy, negy, posz, negz] ),\r\n * combine: THREE.Multiply,\r\n * reflectivity: ,\r\n * refractionRatio: ,\r\n *\r\n * shading: THREE.SmoothShading,\r\n * blending: THREE.NormalBlending,\r\n * depthTest: ,\r\n * depthWrite: ,\r\n *\r\n * wireframe: ,\r\n * wireframeLinewidth: ,\r\n *\r\n * vertexColors: THREE.NoColors / THREE.VertexColors / THREE.FaceColors,\r\n *\r\n * skinning: ,\r\n * morphTargets: ,\r\n *\r\n * fog: \r\n * }\r\n */\r\n\r\nTHREE.MeshBasicMaterial = function ( parameters ) {\r\n\r\n\tTHREE.Material.call( this );\r\n\r\n\tthis.type = 'MeshBasicMaterial';\r\n\r\n\tthis.color = new THREE.Color( 0xffffff ); // emissive\r\n\r\n\tthis.map = null;\r\n\r\n\tthis.lightMap = null;\r\n\r\n\tthis.specularMap = null;\r\n\r\n\tthis.alphaMap = null;\r\n\r\n\tthis.envMap = null;\r\n\tthis.combine = THREE.MultiplyOperation;\r\n\tthis.reflectivity = 1;\r\n\tthis.refractionRatio = 0.98;\r\n\r\n\tthis.fog = true;\r\n\r\n\tthis.shading = THREE.SmoothShading;\r\n\r\n\tthis.wireframe = false;\r\n\tthis.wireframeLinewidth = 1;\r\n\tthis.wireframeLinecap = 'round';\r\n\tthis.wireframeLinejoin = 'round';\r\n\r\n\tthis.vertexColors = THREE.NoColors;\r\n\r\n\tthis.skinning = false;\r\n\tthis.morphTargets = false;\r\n\r\n\tthis.setValues( parameters );\r\n\r\n};\r\n\r\nTHREE.MeshBasicMaterial.prototype = Object.create( THREE.Material.prototype );\r\nTHREE.MeshBasicMaterial.prototype.constructor = THREE.MeshBasicMaterial;\r\n\r\nTHREE.MeshBasicMaterial.prototype.clone = function () {\r\n\r\n\tvar material = new THREE.MeshBasicMaterial();\r\n\r\n\tTHREE.Material.prototype.clone.call( this, material );\r\n\r\n\tmaterial.color.copy( this.color );\r\n\r\n\tmaterial.map = this.map;\r\n\r\n\tmaterial.lightMap = this.lightMap;\r\n\r\n\tmaterial.specularMap = this.specularMap;\r\n\r\n\tmaterial.alphaMap = this.alphaMap;\r\n\r\n\tmaterial.envMap = this.envMap;\r\n\tmaterial.combine = this.combine;\r\n\tmaterial.reflectivity = this.reflectivity;\r\n\tmaterial.refractionRatio = this.refractionRatio;\r\n\r\n\tmaterial.fog = this.fog;\r\n\r\n\tmaterial.shading = this.shading;\r\n\r\n\tmaterial.wireframe = this.wireframe;\r\n\tmaterial.wireframeLinewidth = this.wireframeLinewidth;\r\n\tmaterial.wireframeLinecap = this.wireframeLinecap;\r\n\tmaterial.wireframeLinejoin = this.wireframeLinejoin;\r\n\r\n\tmaterial.vertexColors = this.vertexColors;\r\n\r\n\tmaterial.skinning = this.skinning;\r\n\tmaterial.morphTargets = this.morphTargets;\r\n\r\n\treturn material;\r\n\r\n};\r\n\r\n// File:src/materials/MeshLambertMaterial.js\r\n\r\n/**\r\n * @author mrdoob / http://mrdoob.com/\r\n * @author alteredq / http://alteredqualia.com/\r\n *\r\n * parameters = {\r\n * color: ,\r\n * emissive: ,\r\n * opacity: ,\r\n *\r\n * map: new THREE.Texture( ),\r\n *\r\n * lightMap: new THREE.Texture( ),\r\n *\r\n * specularMap: new THREE.Texture( ),\r\n *\r\n * alphaMap: new THREE.Texture( ),\r\n *\r\n * envMap: new THREE.TextureCube( [posx, negx, posy, negy, posz, negz] ),\r\n * combine: THREE.Multiply,\r\n * reflectivity: ,\r\n * refractionRatio: ,\r\n *\r\n * shading: THREE.SmoothShading,\r\n * blending: THREE.NormalBlending,\r\n * depthTest: ,\r\n * depthWrite: ,\r\n *\r\n * wireframe: ,\r\n * wireframeLinewidth: ,\r\n *\r\n * vertexColors: THREE.NoColors / THREE.VertexColors / THREE.FaceColors,\r\n *\r\n * skinning: ,\r\n * morphTargets: ,\r\n * morphNormals: ,\r\n *\r\n *\tfog: \r\n * }\r\n */\r\n\r\nTHREE.MeshLambertMaterial = function ( parameters ) {\r\n\r\n\tTHREE.Material.call( this );\r\n\r\n\tthis.type = 'MeshLambertMaterial';\r\n\r\n\tthis.color = new THREE.Color( 0xffffff ); // diffuse\r\n\tthis.emissive = new THREE.Color( 0x000000 );\r\n\r\n\tthis.wrapAround = false;\r\n\tthis.wrapRGB = new THREE.Vector3( 1, 1, 1 );\r\n\r\n\tthis.map = null;\r\n\r\n\tthis.lightMap = null;\r\n\r\n\tthis.specularMap = null;\r\n\r\n\tthis.alphaMap = null;\r\n\r\n\tthis.envMap = null;\r\n\tthis.combine = THREE.MultiplyOperation;\r\n\tthis.reflectivity = 1;\r\n\tthis.refractionRatio = 0.98;\r\n\r\n\tthis.fog = true;\r\n\r\n\tthis.shading = THREE.SmoothShading;\r\n\r\n\tthis.wireframe = false;\r\n\tthis.wireframeLinewidth = 1;\r\n\tthis.wireframeLinecap = 'round';\r\n\tthis.wireframeLinejoin = 'round';\r\n\r\n\tthis.vertexColors = THREE.NoColors;\r\n\r\n\tthis.skinning = false;\r\n\tthis.morphTargets = false;\r\n\tthis.morphNormals = false;\r\n\r\n\tthis.setValues( parameters );\r\n\r\n};\r\n\r\nTHREE.MeshLambertMaterial.prototype = Object.create( THREE.Material.prototype );\r\nTHREE.MeshLambertMaterial.prototype.constructor = THREE.MeshLambertMaterial;\r\n\r\nTHREE.MeshLambertMaterial.prototype.clone = function () {\r\n\r\n\tvar material = new THREE.MeshLambertMaterial();\r\n\r\n\tTHREE.Material.prototype.clone.call( this, material );\r\n\r\n\tmaterial.color.copy( this.color );\r\n\tmaterial.emissive.copy( this.emissive );\r\n\r\n\tmaterial.wrapAround = this.wrapAround;\r\n\tmaterial.wrapRGB.copy( this.wrapRGB );\r\n\r\n\tmaterial.map = this.map;\r\n\r\n\tmaterial.lightMap = this.lightMap;\r\n\r\n\tmaterial.specularMap = this.specularMap;\r\n\r\n\tmaterial.alphaMap = this.alphaMap;\r\n\r\n\tmaterial.envMap = this.envMap;\r\n\tmaterial.combine = this.combine;\r\n\tmaterial.reflectivity = this.reflectivity;\r\n\tmaterial.refractionRatio = this.refractionRatio;\r\n\r\n\tmaterial.fog = this.fog;\r\n\r\n\tmaterial.shading = this.shading;\r\n\r\n\tmaterial.wireframe = this.wireframe;\r\n\tmaterial.wireframeLinewidth = this.wireframeLinewidth;\r\n\tmaterial.wireframeLinecap = this.wireframeLinecap;\r\n\tmaterial.wireframeLinejoin = this.wireframeLinejoin;\r\n\r\n\tmaterial.vertexColors = this.vertexColors;\r\n\r\n\tmaterial.skinning = this.skinning;\r\n\tmaterial.morphTargets = this.morphTargets;\r\n\tmaterial.morphNormals = this.morphNormals;\r\n\r\n\treturn material;\r\n\r\n};\r\n\r\n// File:src/materials/MeshPhongMaterial.js\r\n\r\n/**\r\n * @author mrdoob / http://mrdoob.com/\r\n * @author alteredq / http://alteredqualia.com/\r\n *\r\n * parameters = {\r\n * color: ,\r\n * emissive: ,\r\n * specular: ,\r\n * shininess: ,\r\n * opacity: ,\r\n *\r\n * map: new THREE.Texture( ),\r\n *\r\n * lightMap: new THREE.Texture( ),\r\n *\r\n * bumpMap: new THREE.Texture( ),\r\n * bumpScale: ,\r\n *\r\n * normalMap: new THREE.Texture( ),\r\n * normalScale: ,\r\n *\r\n * specularMap: new THREE.Texture( ),\r\n *\r\n * alphaMap: new THREE.Texture( ),\r\n *\r\n * envMap: new THREE.TextureCube( [posx, negx, posy, negy, posz, negz] ),\r\n * combine: THREE.Multiply,\r\n * reflectivity: ,\r\n * refractionRatio: ,\r\n *\r\n * shading: THREE.SmoothShading,\r\n * blending: THREE.NormalBlending,\r\n * depthTest: ,\r\n * depthWrite: ,\r\n *\r\n * wireframe: ,\r\n * wireframeLinewidth: ,\r\n *\r\n * vertexColors: THREE.NoColors / THREE.VertexColors / THREE.FaceColors,\r\n *\r\n * skinning: ,\r\n * morphTargets: ,\r\n * morphNormals: ,\r\n *\r\n *\tfog: \r\n * }\r\n */\r\n\r\nTHREE.MeshPhongMaterial = function ( parameters ) {\r\n\r\n\tTHREE.Material.call( this );\r\n\r\n\tthis.type = 'MeshPhongMaterial';\r\n\r\n\tthis.color = new THREE.Color( 0xffffff ); // diffuse\r\n\tthis.emissive = new THREE.Color( 0x000000 );\r\n\tthis.specular = new THREE.Color( 0x111111 );\r\n\tthis.shininess = 30;\r\n\r\n\tthis.metal = false;\r\n\r\n\tthis.wrapAround = false;\r\n\tthis.wrapRGB = new THREE.Vector3( 1, 1, 1 );\r\n\r\n\tthis.map = null;\r\n\r\n\tthis.lightMap = null;\r\n\r\n\tthis.bumpMap = null;\r\n\tthis.bumpScale = 1;\r\n\r\n\tthis.normalMap = null;\r\n\tthis.normalScale = new THREE.Vector2( 1, 1 );\r\n\r\n\tthis.specularMap = null;\r\n\r\n\tthis.alphaMap = null;\r\n\r\n\tthis.envMap = null;\r\n\tthis.combine = THREE.MultiplyOperation;\r\n\tthis.reflectivity = 1;\r\n\tthis.refractionRatio = 0.98;\r\n\r\n\tthis.fog = true;\r\n\r\n\tthis.shading = THREE.SmoothShading;\r\n\r\n\tthis.wireframe = false;\r\n\tthis.wireframeLinewidth = 1;\r\n\tthis.wireframeLinecap = 'round';\r\n\tthis.wireframeLinejoin = 'round';\r\n\r\n\tthis.vertexColors = THREE.NoColors;\r\n\r\n\tthis.skinning = false;\r\n\tthis.morphTargets = false;\r\n\tthis.morphNormals = false;\r\n\r\n\tthis.setValues( parameters );\r\n\r\n};\r\n\r\nTHREE.MeshPhongMaterial.prototype = Object.create( THREE.Material.prototype );\r\nTHREE.MeshPhongMaterial.prototype.constructor = THREE.MeshPhongMaterial;\r\n\r\nTHREE.MeshPhongMaterial.prototype.clone = function () {\r\n\r\n\tvar material = new THREE.MeshPhongMaterial();\r\n\r\n\tTHREE.Material.prototype.clone.call( this, material );\r\n\r\n\tmaterial.color.copy( this.color );\r\n\tmaterial.emissive.copy( this.emissive );\r\n\tmaterial.specular.copy( this.specular );\r\n\tmaterial.shininess = this.shininess;\r\n\r\n\tmaterial.metal = this.metal;\r\n\r\n\tmaterial.wrapAround = this.wrapAround;\r\n\tmaterial.wrapRGB.copy( this.wrapRGB );\r\n\r\n\tmaterial.map = this.map;\r\n\r\n\tmaterial.lightMap = this.lightMap;\r\n\r\n\tmaterial.bumpMap = this.bumpMap;\r\n\tmaterial.bumpScale = this.bumpScale;\r\n\r\n\tmaterial.normalMap = this.normalMap;\r\n\tmaterial.normalScale.copy( this.normalScale );\r\n\r\n\tmaterial.specularMap = this.specularMap;\r\n\r\n\tmaterial.alphaMap = this.alphaMap;\r\n\r\n\tmaterial.envMap = this.envMap;\r\n\tmaterial.combine = this.combine;\r\n\tmaterial.reflectivity = this.reflectivity;\r\n\tmaterial.refractionRatio = this.refractionRatio;\r\n\r\n\tmaterial.fog = this.fog;\r\n\r\n\tmaterial.shading = this.shading;\r\n\r\n\tmaterial.wireframe = this.wireframe;\r\n\tmaterial.wireframeLinewidth = this.wireframeLinewidth;\r\n\tmaterial.wireframeLinecap = this.wireframeLinecap;\r\n\tmaterial.wireframeLinejoin = this.wireframeLinejoin;\r\n\r\n\tmaterial.vertexColors = this.vertexColors;\r\n\r\n\tmaterial.skinning = this.skinning;\r\n\tmaterial.morphTargets = this.morphTargets;\r\n\tmaterial.morphNormals = this.morphNormals;\r\n\r\n\treturn material;\r\n\r\n};\r\n\r\n// File:src/materials/MeshDepthMaterial.js\r\n\r\n/**\r\n * @author mrdoob / http://mrdoob.com/\r\n * @author alteredq / http://alteredqualia.com/\r\n *\r\n * parameters = {\r\n * opacity: ,\r\n *\r\n * blending: THREE.NormalBlending,\r\n * depthTest: ,\r\n * depthWrite: ,\r\n *\r\n * wireframe: ,\r\n * wireframeLinewidth: \r\n * }\r\n */\r\n\r\nTHREE.MeshDepthMaterial = function ( parameters ) {\r\n\r\n\tTHREE.Material.call( this );\r\n\r\n\tthis.type = 'MeshDepthMaterial';\r\n\r\n\tthis.morphTargets = false;\r\n\tthis.wireframe = false;\r\n\tthis.wireframeLinewidth = 1;\r\n\r\n\tthis.setValues( parameters );\r\n\r\n};\r\n\r\nTHREE.MeshDepthMaterial.prototype = Object.create( THREE.Material.prototype );\r\nTHREE.MeshDepthMaterial.prototype.constructor = THREE.MeshDepthMaterial;\r\n\r\nTHREE.MeshDepthMaterial.prototype.clone = function () {\r\n\r\n\tvar material = new THREE.MeshDepthMaterial();\r\n\r\n\tTHREE.Material.prototype.clone.call( this, material );\r\n\r\n\tmaterial.wireframe = this.wireframe;\r\n\tmaterial.wireframeLinewidth = this.wireframeLinewidth;\r\n\r\n\treturn material;\r\n\r\n};\r\n\r\n// File:src/materials/MeshNormalMaterial.js\r\n\r\n/**\r\n * @author mrdoob / http://mrdoob.com/\r\n *\r\n * parameters = {\r\n * opacity: ,\r\n *\r\n * shading: THREE.FlatShading,\r\n * blending: THREE.NormalBlending,\r\n * depthTest: ,\r\n * depthWrite: ,\r\n *\r\n * wireframe: ,\r\n * wireframeLinewidth: \r\n * }\r\n */\r\n\r\nTHREE.MeshNormalMaterial = function ( parameters ) {\r\n\r\n\tTHREE.Material.call( this, parameters );\r\n\r\n\tthis.type = 'MeshNormalMaterial';\r\n\r\n\tthis.wireframe = false;\r\n\tthis.wireframeLinewidth = 1;\r\n\r\n\tthis.morphTargets = false;\r\n\r\n\tthis.setValues( parameters );\r\n\r\n};\r\n\r\nTHREE.MeshNormalMaterial.prototype = Object.create( THREE.Material.prototype );\r\nTHREE.MeshNormalMaterial.prototype.constructor = THREE.MeshNormalMaterial;\r\n\r\nTHREE.MeshNormalMaterial.prototype.clone = function () {\r\n\r\n\tvar material = new THREE.MeshNormalMaterial();\r\n\r\n\tTHREE.Material.prototype.clone.call( this, material );\r\n\r\n\tmaterial.wireframe = this.wireframe;\r\n\tmaterial.wireframeLinewidth = this.wireframeLinewidth;\r\n\r\n\treturn material;\r\n\r\n};\r\n\r\n// File:src/materials/MeshFaceMaterial.js\r\n\r\n/**\r\n * @author mrdoob / http://mrdoob.com/\r\n */\r\n\r\nTHREE.MeshFaceMaterial = function ( materials ) {\r\n\r\n\tthis.uuid = THREE.Math.generateUUID();\r\n\r\n\tthis.type = 'MeshFaceMaterial';\r\n\t\r\n\tthis.materials = materials instanceof Array ? materials : [];\r\n\r\n};\r\n\r\nTHREE.MeshFaceMaterial.prototype = {\r\n\r\n\tconstructor: THREE.MeshFaceMaterial,\r\n\r\n\ttoJSON: function () {\r\n\r\n\t\tvar output = {\r\n\t\t\tmetadata: {\r\n\t\t\t\tversion: 4.2,\r\n\t\t\t\ttype: 'material',\r\n\t\t\t\tgenerator: 'MaterialExporter'\r\n\t\t\t},\r\n\t\t\tuuid: this.uuid,\r\n\t\t\ttype: this.type,\r\n\t\t\tmaterials: []\r\n\t\t};\r\n\r\n\t\tfor ( var i = 0, l = this.materials.length; i < l; i ++ ) {\r\n\r\n\t\t\toutput.materials.push( this.materials[ i ].toJSON() );\r\n\r\n\t\t}\r\n\r\n\t\treturn output;\r\n\r\n\t},\r\n\r\n\tclone: function () {\r\n\r\n\t\tvar material = new THREE.MeshFaceMaterial();\r\n\r\n\t\tfor ( var i = 0; i < this.materials.length; i ++ ) {\r\n\r\n\t\t\tmaterial.materials.push( this.materials[ i ].clone() );\r\n\r\n\t\t}\r\n\r\n\t\treturn material;\r\n\r\n\t}\r\n\r\n};\r\n\r\n// File:src/materials/PointCloudMaterial.js\r\n\r\n/**\r\n * @author mrdoob / http://mrdoob.com/\r\n * @author alteredq / http://alteredqualia.com/\r\n *\r\n * parameters = {\r\n * color: ,\r\n * opacity: ,\r\n * map: new THREE.Texture( ),\r\n *\r\n * size: ,\r\n * sizeAttenuation: ,\r\n *\r\n * blending: THREE.NormalBlending,\r\n * depthTest: ,\r\n * depthWrite: ,\r\n *\r\n * vertexColors: ,\r\n *\r\n * fog: \r\n * }\r\n */\r\n\r\nTHREE.PointCloudMaterial = function ( parameters ) {\r\n\r\n\tTHREE.Material.call( this );\r\n\r\n\tthis.type = 'PointCloudMaterial';\r\n\r\n\tthis.color = new THREE.Color( 0xffffff );\r\n\r\n\tthis.map = null;\r\n\r\n\tthis.size = 1;\r\n\tthis.sizeAttenuation = true;\r\n\r\n\tthis.vertexColors = THREE.NoColors;\r\n\r\n\tthis.fog = true;\r\n\r\n\tthis.setValues( parameters );\r\n\r\n};\r\n\r\nTHREE.PointCloudMaterial.prototype = Object.create( THREE.Material.prototype );\r\nTHREE.PointCloudMaterial.prototype.constructor = THREE.PointCloudMaterial;\r\n\r\nTHREE.PointCloudMaterial.prototype.clone = function () {\r\n\r\n\tvar material = new THREE.PointCloudMaterial();\r\n\r\n\tTHREE.Material.prototype.clone.call( this, material );\r\n\r\n\tmaterial.color.copy( this.color );\r\n\r\n\tmaterial.map = this.map;\r\n\r\n\tmaterial.size = this.size;\r\n\tmaterial.sizeAttenuation = this.sizeAttenuation;\r\n\r\n\tmaterial.vertexColors = this.vertexColors;\r\n\r\n\tmaterial.fog = this.fog;\r\n\r\n\treturn material;\r\n\r\n};\r\n\r\n// backwards compatibility\r\n\r\nTHREE.ParticleBasicMaterial = function ( parameters ) {\r\n\r\n\tTHREE.warn( 'THREE.ParticleBasicMaterial has been renamed to THREE.PointCloudMaterial.' );\r\n\treturn new THREE.PointCloudMaterial( parameters );\r\n\r\n};\r\n\r\nTHREE.ParticleSystemMaterial = function ( parameters ) {\r\n\r\n\tTHREE.warn( 'THREE.ParticleSystemMaterial has been renamed to THREE.PointCloudMaterial.' );\r\n\treturn new THREE.PointCloudMaterial( parameters );\r\n\r\n};\r\n\r\n// File:src/materials/ShaderMaterial.js\r\n\r\n/**\r\n * @author alteredq / http://alteredqualia.com/\r\n *\r\n * parameters = {\r\n * defines: { \"label\" : \"value\" },\r\n * uniforms: { \"parameter1\": { type: \"f\", value: 1.0 }, \"parameter2\": { type: \"i\" value2: 2 } },\r\n *\r\n * fragmentShader: ,\r\n * vertexShader: ,\r\n *\r\n * shading: THREE.SmoothShading,\r\n * blending: THREE.NormalBlending,\r\n * depthTest: ,\r\n * depthWrite: ,\r\n *\r\n * wireframe: ,\r\n * wireframeLinewidth: ,\r\n *\r\n * lights: ,\r\n *\r\n * vertexColors: THREE.NoColors / THREE.VertexColors / THREE.FaceColors,\r\n *\r\n * skinning: ,\r\n * morphTargets: ,\r\n * morphNormals: ,\r\n *\r\n *\tfog: \r\n * }\r\n */\r\n\r\nTHREE.ShaderMaterial = function ( parameters ) {\r\n\r\n\tTHREE.Material.call( this );\r\n\r\n\tthis.type = 'ShaderMaterial';\r\n\r\n\tthis.defines = {};\r\n\tthis.uniforms = {};\r\n\tthis.attributes = null;\r\n\r\n\tthis.vertexShader = 'void main() {\\n\\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\\n}';\r\n\tthis.fragmentShader = 'void main() {\\n\\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\\n}';\r\n\r\n\tthis.shading = THREE.SmoothShading;\r\n\r\n\tthis.linewidth = 1;\r\n\r\n\tthis.wireframe = false;\r\n\tthis.wireframeLinewidth = 1;\r\n\r\n\tthis.fog = false; // set to use scene fog\r\n\r\n\tthis.lights = false; // set to use scene lights\r\n\r\n\tthis.vertexColors = THREE.NoColors; // set to use \"color\" attribute stream\r\n\r\n\tthis.skinning = false; // set to use skinning attribute streams\r\n\r\n\tthis.morphTargets = false; // set to use morph targets\r\n\tthis.morphNormals = false; // set to use morph normals\r\n\r\n\t// When rendered geometry doesn't include these attributes but the material does,\r\n\t// use these default values in WebGL. This avoids errors when buffer data is missing.\r\n\tthis.defaultAttributeValues = {\r\n\t\t'color': [ 1, 1, 1 ],\r\n\t\t'uv': [ 0, 0 ],\r\n\t\t'uv2': [ 0, 0 ]\r\n\t};\r\n\r\n\tthis.index0AttributeName = undefined;\r\n\r\n\tthis.setValues( parameters );\r\n\r\n};\r\n\r\nTHREE.ShaderMaterial.prototype = Object.create( THREE.Material.prototype );\r\nTHREE.ShaderMaterial.prototype.constructor = THREE.ShaderMaterial;\r\n\r\nTHREE.ShaderMaterial.prototype.clone = function () {\r\n\r\n\tvar material = new THREE.ShaderMaterial();\r\n\r\n\tTHREE.Material.prototype.clone.call( this, material );\r\n\r\n\tmaterial.fragmentShader = this.fragmentShader;\r\n\tmaterial.vertexShader = this.vertexShader;\r\n\r\n\tmaterial.uniforms = THREE.UniformsUtils.clone( this.uniforms );\r\n\r\n\tmaterial.attributes = this.attributes;\r\n\tmaterial.defines = this.defines;\r\n\r\n\tmaterial.shading = this.shading;\r\n\r\n\tmaterial.wireframe = this.wireframe;\r\n\tmaterial.wireframeLinewidth = this.wireframeLinewidth;\r\n\r\n\tmaterial.fog = this.fog;\r\n\r\n\tmaterial.lights = this.lights;\r\n\r\n\tmaterial.vertexColors = this.vertexColors;\r\n\r\n\tmaterial.skinning = this.skinning;\r\n\r\n\tmaterial.morphTargets = this.morphTargets;\r\n\tmaterial.morphNormals = this.morphNormals;\r\n\r\n\treturn material;\r\n\r\n};\r\n\r\n// File:src/materials/RawShaderMaterial.js\r\n\r\n/**\r\n * @author mrdoob / http://mrdoob.com/\r\n */\r\n\r\nTHREE.RawShaderMaterial = function ( parameters ) {\r\n\r\n\tTHREE.ShaderMaterial.call( this, parameters );\r\n\r\n\tthis.type = 'RawShaderMaterial';\r\n\r\n};\r\n\r\nTHREE.RawShaderMaterial.prototype = Object.create( THREE.ShaderMaterial.prototype );\r\nTHREE.RawShaderMaterial.prototype.constructor = THREE.RawShaderMaterial;\r\n\r\nTHREE.RawShaderMaterial.prototype.clone = function () {\r\n\r\n\tvar material = new THREE.RawShaderMaterial();\r\n\r\n\tTHREE.ShaderMaterial.prototype.clone.call( this, material );\r\n\r\n\treturn material;\r\n\r\n};\r\n\r\n// File:src/materials/SpriteMaterial.js\r\n\r\n/**\r\n * @author alteredq / http://alteredqualia.com/\r\n *\r\n * parameters = {\r\n * color: ,\r\n * opacity: ,\r\n * map: new THREE.Texture( ),\r\n *\r\n * blending: THREE.NormalBlending,\r\n * depthTest: ,\r\n * depthWrite: ,\r\n *\r\n *\tuvOffset: new THREE.Vector2(),\r\n *\tuvScale: new THREE.Vector2(),\r\n *\r\n * fog: \r\n * }\r\n */\r\n\r\nTHREE.SpriteMaterial = function ( parameters ) {\r\n\r\n\tTHREE.Material.call( this );\r\n\r\n\tthis.type = 'SpriteMaterial';\r\n\r\n\tthis.color = new THREE.Color( 0xffffff );\r\n\tthis.map = null;\r\n\r\n\tthis.rotation = 0;\r\n\r\n\tthis.fog = false;\r\n\r\n\t// set parameters\r\n\r\n\tthis.setValues( parameters );\r\n\r\n};\r\n\r\nTHREE.SpriteMaterial.prototype = Object.create( THREE.Material.prototype );\r\nTHREE.SpriteMaterial.prototype.constructor = THREE.SpriteMaterial;\r\n\r\nTHREE.SpriteMaterial.prototype.clone = function () {\r\n\r\n\tvar material = new THREE.SpriteMaterial();\r\n\r\n\tTHREE.Material.prototype.clone.call( this, material );\r\n\r\n\tmaterial.color.copy( this.color );\r\n\tmaterial.map = this.map;\r\n\r\n\tmaterial.rotation = this.rotation;\r\n\r\n\tmaterial.fog = this.fog;\r\n\r\n\treturn material;\r\n\r\n};\r\n\r\n// File:src/textures/Texture.js\r\n\r\n/**\r\n * @author mrdoob / http://mrdoob.com/\r\n * @author alteredq / http://alteredqualia.com/\r\n * @author szimek / https://github.com/szimek/\r\n */\r\n\r\nTHREE.Texture = function ( image, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy ) {\r\n\r\n\tObject.defineProperty( this, 'id', { value: THREE.TextureIdCount ++ } );\r\n\r\n\tthis.uuid = THREE.Math.generateUUID();\r\n\r\n\tthis.name = '';\r\n\tthis.sourceFile = '';\r\n\r\n\tthis.image = image !== undefined ? image : THREE.Texture.DEFAULT_IMAGE;\r\n\tthis.mipmaps = [];\r\n\r\n\tthis.mapping = mapping !== undefined ? mapping : THREE.Texture.DEFAULT_MAPPING;\r\n\r\n\tthis.wrapS = wrapS !== undefined ? wrapS : THREE.ClampToEdgeWrapping;\r\n\tthis.wrapT = wrapT !== undefined ? wrapT : THREE.ClampToEdgeWrapping;\r\n\r\n\tthis.magFilter = magFilter !== undefined ? magFilter : THREE.LinearFilter;\r\n\tthis.minFilter = minFilter !== undefined ? minFilter : THREE.LinearMipMapLinearFilter;\r\n\r\n\tthis.anisotropy = anisotropy !== undefined ? anisotropy : 1;\r\n\r\n\tthis.format = format !== undefined ? format : THREE.RGBAFormat;\r\n\tthis.type = type !== undefined ? type : THREE.UnsignedByteType;\r\n\r\n\tthis.offset = new THREE.Vector2( 0, 0 );\r\n\tthis.repeat = new THREE.Vector2( 1, 1 );\r\n\r\n\tthis.generateMipmaps = true;\r\n\tthis.premultiplyAlpha = false;\r\n\tthis.flipY = true;\r\n\tthis.unpackAlignment = 4; // valid values: 1, 2, 4, 8 (see http://www.khronos.org/opengles/sdk/docs/man/xhtml/glPixelStorei.xml)\r\n\r\n\tthis._needsUpdate = false;\r\n\tthis.onUpdate = null;\r\n\r\n};\r\n\r\nTHREE.Texture.DEFAULT_IMAGE = undefined;\r\nTHREE.Texture.DEFAULT_MAPPING = THREE.UVMapping;\r\n\r\nTHREE.Texture.prototype = {\r\n\r\n\tconstructor: THREE.Texture,\r\n\r\n\tget needsUpdate () {\r\n\r\n\t\treturn this._needsUpdate;\r\n\r\n\t},\r\n\r\n\tset needsUpdate ( value ) {\r\n\r\n\t\tif ( value === true ) this.update();\r\n\r\n\t\tthis._needsUpdate = value;\r\n\r\n\t},\r\n\r\n\tclone: function ( texture ) {\r\n\r\n\t\tif ( texture === undefined ) texture = new THREE.Texture();\r\n\r\n\t\ttexture.image = this.image;\r\n\t\ttexture.mipmaps = this.mipmaps.slice( 0 );\r\n\r\n\t\ttexture.mapping = this.mapping;\r\n\r\n\t\ttexture.wrapS = this.wrapS;\r\n\t\ttexture.wrapT = this.wrapT;\r\n\r\n\t\ttexture.magFilter = this.magFilter;\r\n\t\ttexture.minFilter = this.minFilter;\r\n\r\n\t\ttexture.anisotropy = this.anisotropy;\r\n\r\n\t\ttexture.format = this.format;\r\n\t\ttexture.type = this.type;\r\n\r\n\t\ttexture.offset.copy( this.offset );\r\n\t\ttexture.repeat.copy( this.repeat );\r\n\r\n\t\ttexture.generateMipmaps = this.generateMipmaps;\r\n\t\ttexture.premultiplyAlpha = this.premultiplyAlpha;\r\n\t\ttexture.flipY = this.flipY;\r\n\t\ttexture.unpackAlignment = this.unpackAlignment;\r\n\r\n\t\treturn texture;\r\n\r\n\t},\r\n\r\n\tupdate: function () {\r\n\r\n\t\tthis.dispatchEvent( { type: 'update' } );\r\n\r\n\t},\r\n\r\n\tdispose: function () {\r\n\r\n\t\tthis.dispatchEvent( { type: 'dispose' } );\r\n\r\n\t}\r\n\r\n};\r\n\r\nTHREE.EventDispatcher.prototype.apply( THREE.Texture.prototype );\r\n\r\nTHREE.TextureIdCount = 0;\r\n\r\n// File:src/textures/CubeTexture.js\r\n\r\n/**\r\n * @author mrdoob / http://mrdoob.com/\r\n */\r\n\r\nTHREE.CubeTexture = function ( images, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy ) {\r\n\r\n\tmapping = mapping !== undefined ? mapping : THREE.CubeReflectionMapping;\r\n\t\r\n\tTHREE.Texture.call( this, images, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy );\r\n\r\n\tthis.images = images;\r\n\r\n};\r\n\r\nTHREE.CubeTexture.prototype = Object.create( THREE.Texture.prototype );\r\nTHREE.CubeTexture.prototype.constructor = THREE.CubeTexture;\r\n\r\nTHREE.CubeTexture.clone = function ( texture ) {\r\n\r\n\tif ( texture === undefined ) texture = new THREE.CubeTexture();\r\n\r\n\tTHREE.Texture.prototype.clone.call( this, texture );\r\n\r\n\ttexture.images = this.images;\r\n\r\n\treturn texture;\r\n\r\n};\r\n\r\n// File:src/textures/CompressedTexture.js\r\n\r\n/**\r\n * @author alteredq / http://alteredqualia.com/\r\n */\r\n\r\nTHREE.CompressedTexture = function ( mipmaps, width, height, format, type, mapping, wrapS, wrapT, magFilter, minFilter, anisotropy ) {\r\n\r\n\tTHREE.Texture.call( this, null, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy );\r\n\r\n\tthis.image = { width: width, height: height };\r\n\tthis.mipmaps = mipmaps;\r\n\r\n\t// no flipping for cube textures\r\n\t// (also flipping doesn't work for compressed textures )\r\n\r\n\tthis.flipY = false;\r\n\r\n\t// can't generate mipmaps for compressed textures\r\n\t// mips must be embedded in DDS files\r\n\r\n\tthis.generateMipmaps = false;\r\n\r\n};\r\n\r\nTHREE.CompressedTexture.prototype = Object.create( THREE.Texture.prototype );\r\nTHREE.CompressedTexture.prototype.constructor = THREE.CompressedTexture;\r\n\r\nTHREE.CompressedTexture.prototype.clone = function () {\r\n\r\n\tvar texture = new THREE.CompressedTexture();\r\n\r\n\tTHREE.Texture.prototype.clone.call( this, texture );\r\n\r\n\treturn texture;\r\n\r\n};\r\n\r\n// File:src/textures/DataTexture.js\r\n\r\n/**\r\n * @author alteredq / http://alteredqualia.com/\r\n */\r\n\r\nTHREE.DataTexture = function ( data, width, height, format, type, mapping, wrapS, wrapT, magFilter, minFilter, anisotropy ) {\r\n\r\n\tTHREE.Texture.call( this, null, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy );\r\n\r\n\tthis.image = { data: data, width: width, height: height };\r\n\r\n};\r\n\r\nTHREE.DataTexture.prototype = Object.create( THREE.Texture.prototype );\r\nTHREE.DataTexture.prototype.constructor = THREE.DataTexture;\r\n\r\nTHREE.DataTexture.prototype.clone = function () {\r\n\r\n\tvar texture = new THREE.DataTexture();\r\n\r\n\tTHREE.Texture.prototype.clone.call( this, texture );\r\n\r\n\treturn texture;\r\n\r\n};\r\n\r\n// File:src/textures/VideoTexture.js\r\n\r\n/**\r\n * @author mrdoob / http://mrdoob.com/\r\n */\r\n\r\nTHREE.VideoTexture = function ( video, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy ) {\r\n\r\n\tTHREE.Texture.call( this, video, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy );\r\n\r\n\tthis.generateMipmaps = false;\r\n\r\n\tvar scope = this;\r\n\r\n\tvar update = function () {\r\n\r\n\t\trequestAnimationFrame( update );\r\n\r\n\t\tif ( video.readyState === video.HAVE_ENOUGH_DATA ) {\r\n\r\n\t\t\tscope.needsUpdate = true;\r\n\r\n\t\t}\r\n\r\n\t};\r\n\r\n\tupdate();\r\n\r\n};\r\n\r\nTHREE.VideoTexture.prototype = Object.create( THREE.Texture.prototype );\r\nTHREE.VideoTexture.prototype.constructor = THREE.VideoTexture;\r\n\r\n// File:src/objects/Group.js\r\n\r\n/**\r\n * @author mrdoob / http://mrdoob.com/\r\n */\r\n\r\nTHREE.Group = function () {\r\n\r\n\tTHREE.Object3D.call( this );\r\n\r\n\tthis.type = 'Group';\r\n\r\n};\r\n\r\nTHREE.Group.prototype = Object.create( THREE.Object3D.prototype );\r\nTHREE.Group.prototype.constructor = THREE.Group;\r\n\r\n// File:src/objects/PointCloud.js\r\n\r\n/**\r\n * @author alteredq / http://alteredqualia.com/\r\n */\r\n\r\nTHREE.PointCloud = function ( geometry, material ) {\r\n\r\n\tTHREE.Object3D.call( this );\r\n\r\n\tthis.type = 'PointCloud';\r\n\r\n\tthis.geometry = geometry !== undefined ? geometry : new THREE.Geometry();\r\n\tthis.material = material !== undefined ? material : new THREE.PointCloudMaterial( { color: Math.random() * 0xffffff } );\r\n\r\n};\r\n\r\nTHREE.PointCloud.prototype = Object.create( THREE.Object3D.prototype );\r\nTHREE.PointCloud.prototype.constructor = THREE.PointCloud;\r\n\r\nTHREE.PointCloud.prototype.raycast = ( function () {\r\n\r\n\tvar inverseMatrix = new THREE.Matrix4();\r\n\tvar ray = new THREE.Ray();\r\n\r\n\treturn function ( raycaster, intersects ) {\r\n\r\n\t\tvar object = this;\r\n\t\tvar geometry = object.geometry;\r\n\t\tvar threshold = raycaster.params.PointCloud.threshold;\r\n\r\n\t\tinverseMatrix.getInverse( this.matrixWorld );\r\n\t\tray.copy( raycaster.ray ).applyMatrix4( inverseMatrix );\r\n\r\n\t\tif ( geometry.boundingBox !== null ) {\r\n\r\n\t\t\tif ( ray.isIntersectionBox( geometry.boundingBox ) === false ) {\r\n\r\n\t\t\t\treturn;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tvar localThreshold = threshold / ( ( this.scale.x + this.scale.y + this.scale.z ) / 3 );\r\n\t\tvar position = new THREE.Vector3();\r\n\r\n\t\tvar testPoint = function ( point, index ) {\r\n\r\n\t\t\tvar rayPointDistance = ray.distanceToPoint( point );\r\n\r\n\t\t\tif ( rayPointDistance < localThreshold ) {\r\n\r\n\t\t\t\tvar intersectPoint = ray.closestPointToPoint( point );\r\n\t\t\t\tintersectPoint.applyMatrix4( object.matrixWorld );\r\n\r\n\t\t\t\tvar distance = raycaster.ray.origin.distanceTo( intersectPoint );\r\n\r\n\t\t\t\tintersects.push( {\r\n\r\n\t\t\t\t\tdistance: distance,\r\n\t\t\t\t\tdistanceToRay: rayPointDistance,\r\n\t\t\t\t\tpoint: intersectPoint.clone(),\r\n\t\t\t\t\tindex: index,\r\n\t\t\t\t\tface: null,\r\n\t\t\t\t\tobject: object\r\n\r\n\t\t\t\t} );\r\n\r\n\t\t\t}\r\n\r\n\t\t};\r\n\r\n\t\tif ( geometry instanceof THREE.BufferGeometry ) {\r\n\r\n\t\t\tvar attributes = geometry.attributes;\r\n\t\t\tvar positions = attributes.position.array;\r\n\r\n\t\t\tif ( attributes.index !== undefined ) {\r\n\r\n\t\t\t\tvar indices = attributes.index.array;\r\n\t\t\t\tvar offsets = geometry.offsets;\r\n\r\n\t\t\t\tif ( offsets.length === 0 ) {\r\n\r\n\t\t\t\t\tvar offset = {\r\n\t\t\t\t\t\tstart: 0,\r\n\t\t\t\t\t\tcount: indices.length,\r\n\t\t\t\t\t\tindex: 0\r\n\t\t\t\t\t};\r\n\r\n\t\t\t\t\toffsets = [ offset ];\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tfor ( var oi = 0, ol = offsets.length; oi < ol; ++ oi ) {\r\n\r\n\t\t\t\t\tvar start = offsets[ oi ].start;\r\n\t\t\t\t\tvar count = offsets[ oi ].count;\r\n\t\t\t\t\tvar index = offsets[ oi ].index;\r\n\r\n\t\t\t\t\tfor ( var i = start, il = start + count; i < il; i ++ ) {\r\n\r\n\t\t\t\t\t\tvar a = index + indices[ i ];\r\n\r\n\t\t\t\t\t\tposition.fromArray( positions, a * 3 );\r\n\r\n\t\t\t\t\t\ttestPoint( position, a );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tvar pointCount = positions.length / 3;\r\n\r\n\t\t\t\tfor ( var i = 0; i < pointCount; i ++ ) {\r\n\r\n\t\t\t\t\tposition.set(\r\n\t\t\t\t\t\tpositions[ 3 * i ],\r\n\t\t\t\t\t\tpositions[ 3 * i + 1 ],\r\n\t\t\t\t\t\tpositions[ 3 * i + 2 ]\r\n\t\t\t\t\t);\r\n\r\n\t\t\t\t\ttestPoint( position, i );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t} else {\r\n\r\n\t\t\tvar vertices = this.geometry.vertices;\r\n\r\n\t\t\tfor ( var i = 0; i < vertices.length; i ++ ) {\r\n\r\n\t\t\t\ttestPoint( vertices[ i ], i );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t};\r\n\r\n}() );\r\n\r\nTHREE.PointCloud.prototype.clone = function ( object ) {\r\n\r\n\tif ( object === undefined ) object = new THREE.PointCloud( this.geometry, this.material );\r\n\r\n\tTHREE.Object3D.prototype.clone.call( this, object );\r\n\r\n\treturn object;\r\n\r\n};\r\n\r\n// Backwards compatibility\r\n\r\nTHREE.ParticleSystem = function ( geometry, material ) {\r\n\r\n\tTHREE.warn( 'THREE.ParticleSystem has been renamed to THREE.PointCloud.' );\r\n\treturn new THREE.PointCloud( geometry, material );\r\n\r\n};\r\n\r\n// File:src/objects/Line.js\r\n\r\n/**\r\n * @author mrdoob / http://mrdoob.com/\r\n */\r\n\r\nTHREE.Line = function ( geometry, material, mode ) {\r\n\r\n\tTHREE.Object3D.call( this );\r\n\r\n\tthis.type = 'Line';\r\n\r\n\tthis.geometry = geometry !== undefined ? geometry : new THREE.Geometry();\r\n\tthis.material = material !== undefined ? material : new THREE.LineBasicMaterial( { color: Math.random() * 0xffffff } );\r\n\r\n\tthis.mode = mode !== undefined ? mode : THREE.LineStrip;\r\n\r\n};\r\n\r\nTHREE.LineStrip = 0;\r\nTHREE.LinePieces = 1;\r\n\r\nTHREE.Line.prototype = Object.create( THREE.Object3D.prototype );\r\nTHREE.Line.prototype.constructor = THREE.Line;\r\n\r\nTHREE.Line.prototype.raycast = ( function () {\r\n\r\n\tvar inverseMatrix = new THREE.Matrix4();\r\n\tvar ray = new THREE.Ray();\r\n\tvar sphere = new THREE.Sphere();\r\n\r\n\treturn function ( raycaster, intersects ) {\r\n\r\n\t\tvar precision = raycaster.linePrecision;\r\n\t\tvar precisionSq = precision * precision;\r\n\r\n\t\tvar geometry = this.geometry;\r\n\r\n\t\tif ( geometry.boundingSphere === null ) geometry.computeBoundingSphere();\r\n\r\n\t\t// Checking boundingSphere distance to ray\r\n\r\n\t\tsphere.copy( geometry.boundingSphere );\r\n\t\tsphere.applyMatrix4( this.matrixWorld );\r\n\r\n\t\tif ( raycaster.ray.isIntersectionSphere( sphere ) === false ) {\r\n\r\n\t\t\treturn;\r\n\r\n\t\t}\r\n\r\n\t\tinverseMatrix.getInverse( this.matrixWorld );\r\n\t\tray.copy( raycaster.ray ).applyMatrix4( inverseMatrix );\r\n\r\n\t\tvar vStart = new THREE.Vector3();\r\n\t\tvar vEnd = new THREE.Vector3();\r\n\t\tvar interSegment = new THREE.Vector3();\r\n\t\tvar interRay = new THREE.Vector3();\r\n\t\tvar step = this.mode === THREE.LineStrip ? 1 : 2;\r\n\r\n\t\tif ( geometry instanceof THREE.BufferGeometry ) {\r\n\r\n\t\t\tvar attributes = geometry.attributes;\r\n\r\n\t\t\tif ( attributes.index !== undefined ) {\r\n\r\n\t\t\t\tvar indices = attributes.index.array;\r\n\t\t\t\tvar positions = attributes.position.array;\r\n\t\t\t\tvar offsets = geometry.offsets;\r\n\r\n\t\t\t\tif ( offsets.length === 0 ) {\r\n\r\n\t\t\t\t\toffsets = [ { start: 0, count: indices.length, index: 0 } ];\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tfor ( var oi = 0; oi < offsets.length; oi ++) {\r\n\r\n\t\t\t\t\tvar start = offsets[ oi ].start;\r\n\t\t\t\t\tvar count = offsets[ oi ].count;\r\n\t\t\t\t\tvar index = offsets[ oi ].index;\r\n\r\n\t\t\t\t\tfor ( var i = start; i < start + count - 1; i += step ) {\r\n\r\n\t\t\t\t\t\tvar a = index + indices[ i ];\r\n\t\t\t\t\t\tvar b = index + indices[ i + 1 ];\r\n\r\n\t\t\t\t\t\tvStart.fromArray( positions, a * 3 );\r\n\t\t\t\t\t\tvEnd.fromArray( positions, b * 3 );\r\n\r\n\t\t\t\t\t\tvar distSq = ray.distanceSqToSegment( vStart, vEnd, interRay, interSegment );\r\n\r\n\t\t\t\t\t\tif ( distSq > precisionSq ) continue;\r\n\r\n\t\t\t\t\t\tvar distance = ray.origin.distanceTo( interRay );\r\n\r\n\t\t\t\t\t\tif ( distance < raycaster.near || distance > raycaster.far ) continue;\r\n\r\n\t\t\t\t\t\tintersects.push( {\r\n\r\n\t\t\t\t\t\t\tdistance: distance,\r\n\t\t\t\t\t\t\t// What do we want? intersection point on the ray or on the segment??\r\n\t\t\t\t\t\t\t// point: raycaster.ray.at( distance ),\r\n\t\t\t\t\t\t\tpoint: interSegment.clone().applyMatrix4( this.matrixWorld ),\r\n\t\t\t\t\t\t\tindex: i,\r\n\t\t\t\t\t\t\toffsetIndex: oi,\r\n\t\t\t\t\t\t\tface: null,\r\n\t\t\t\t\t\t\tfaceIndex: null,\r\n\t\t\t\t\t\t\tobject: this\r\n\r\n\t\t\t\t\t\t} );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tvar positions = attributes.position.array;\r\n\r\n\t\t\t\tfor ( var i = 0; i < positions.length / 3 - 1; i += step ) {\r\n\r\n\t\t\t\t\tvStart.fromArray( positions, 3 * i );\r\n\t\t\t\t\tvEnd.fromArray( positions, 3 * i + 3 );\r\n\r\n\t\t\t\t\tvar distSq = ray.distanceSqToSegment( vStart, vEnd, interRay, interSegment );\r\n\r\n\t\t\t\t\tif ( distSq > precisionSq ) continue;\r\n\r\n\t\t\t\t\tvar distance = ray.origin.distanceTo( interRay );\r\n\r\n\t\t\t\t\tif ( distance < raycaster.near || distance > raycaster.far ) continue;\r\n\r\n\t\t\t\t\tintersects.push( {\r\n\r\n\t\t\t\t\t\tdistance: distance,\r\n\t\t\t\t\t\t// What do we want? intersection point on the ray or on the segment??\r\n\t\t\t\t\t\t// point: raycaster.ray.at( distance ),\r\n\t\t\t\t\t\tpoint: interSegment.clone().applyMatrix4( this.matrixWorld ),\r\n\t\t\t\t\t\tindex: i,\r\n\t\t\t\t\t\tface: null,\r\n\t\t\t\t\t\tfaceIndex: null,\r\n\t\t\t\t\t\tobject: this\r\n\r\n\t\t\t\t\t} );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t} else if ( geometry instanceof THREE.Geometry ) {\r\n\r\n\t\t\tvar vertices = geometry.vertices;\r\n\t\t\tvar nbVertices = vertices.length;\r\n\r\n\t\t\tfor ( var i = 0; i < nbVertices - 1; i += step ) {\r\n\r\n\t\t\t\tvar distSq = ray.distanceSqToSegment( vertices[ i ], vertices[ i + 1 ], interRay, interSegment );\r\n\r\n\t\t\t\tif ( distSq > precisionSq ) continue;\r\n\r\n\t\t\t\tvar distance = ray.origin.distanceTo( interRay );\r\n\r\n\t\t\t\tif ( distance < raycaster.near || distance > raycaster.far ) continue;\r\n\r\n\t\t\t\tintersects.push( {\r\n\r\n\t\t\t\t\tdistance: distance,\r\n\t\t\t\t\t// What do we want? intersection point on the ray or on the segment??\r\n\t\t\t\t\t// point: raycaster.ray.at( distance ),\r\n\t\t\t\t\tpoint: interSegment.clone().applyMatrix4( this.matrixWorld ),\r\n\t\t\t\t\tindex: i,\r\n\t\t\t\t\tface: null,\r\n\t\t\t\t\tfaceIndex: null,\r\n\t\t\t\t\tobject: this\r\n\r\n\t\t\t\t} );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t};\r\n\r\n}() );\r\n\r\nTHREE.Line.prototype.clone = function ( object ) {\r\n\r\n\tif ( object === undefined ) object = new THREE.Line( this.geometry, this.material, this.mode );\r\n\r\n\tTHREE.Object3D.prototype.clone.call( this, object );\r\n\r\n\treturn object;\r\n\r\n};\r\n\r\n// File:src/objects/Mesh.js\r\n\r\n/**\r\n * @author mrdoob / http://mrdoob.com/\r\n * @author alteredq / http://alteredqualia.com/\r\n * @author mikael emtinger / http://gomo.se/\r\n * @author jonobr1 / http://jonobr1.com/\r\n */\r\n\r\nTHREE.Mesh = function ( geometry, material ) {\r\n\r\n\tTHREE.Object3D.call( this );\r\n\r\n\tthis.type = 'Mesh';\r\n\t\r\n\tthis.geometry = geometry !== undefined ? geometry : new THREE.Geometry();\r\n\tthis.material = material !== undefined ? material : new THREE.MeshBasicMaterial( { color: Math.random() * 0xffffff } );\r\n\r\n\tthis.updateMorphTargets();\r\n\r\n};\r\n\r\nTHREE.Mesh.prototype = Object.create( THREE.Object3D.prototype );\r\nTHREE.Mesh.prototype.constructor = THREE.Mesh;\r\n\r\nTHREE.Mesh.prototype.updateMorphTargets = function () {\r\n\r\n\tif ( this.geometry.morphTargets !== undefined && this.geometry.morphTargets.length > 0 ) {\r\n\r\n\t\tthis.morphTargetBase = - 1;\r\n\t\tthis.morphTargetForcedOrder = [];\r\n\t\tthis.morphTargetInfluences = [];\r\n\t\tthis.morphTargetDictionary = {};\r\n\r\n\t\tfor ( var m = 0, ml = this.geometry.morphTargets.length; m < ml; m ++ ) {\r\n\r\n\t\t\tthis.morphTargetInfluences.push( 0 );\r\n\t\t\tthis.morphTargetDictionary[ this.geometry.morphTargets[ m ].name ] = m;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n};\r\n\r\nTHREE.Mesh.prototype.getMorphTargetIndexByName = function ( name ) {\r\n\r\n\tif ( this.morphTargetDictionary[ name ] !== undefined ) {\r\n\r\n\t\treturn this.morphTargetDictionary[ name ];\r\n\r\n\t}\r\n\r\n\tTHREE.warn( 'THREE.Mesh.getMorphTargetIndexByName: morph target ' + name + ' does not exist. Returning 0.' );\r\n\r\n\treturn 0;\r\n\r\n};\r\n\r\n\r\nTHREE.Mesh.prototype.raycast = ( function () {\r\n\r\n\tvar inverseMatrix = new THREE.Matrix4();\r\n\tvar ray = new THREE.Ray();\r\n\tvar sphere = new THREE.Sphere();\r\n\r\n\tvar vA = new THREE.Vector3();\r\n\tvar vB = new THREE.Vector3();\r\n\tvar vC = new THREE.Vector3();\r\n\r\n\treturn function ( raycaster, intersects ) {\r\n\r\n\t\tvar geometry = this.geometry;\r\n\r\n\t\t// Checking boundingSphere distance to ray\r\n\r\n\t\tif ( geometry.boundingSphere === null ) geometry.computeBoundingSphere();\r\n\r\n\t\tsphere.copy( geometry.boundingSphere );\r\n\t\tsphere.applyMatrix4( this.matrixWorld );\r\n\r\n\t\tif ( raycaster.ray.isIntersectionSphere( sphere ) === false ) {\r\n\r\n\t\t\treturn;\r\n\r\n\t\t}\r\n\r\n\t\t// Check boundingBox before continuing\r\n\r\n\t\tinverseMatrix.getInverse( this.matrixWorld );\r\n\t\tray.copy( raycaster.ray ).applyMatrix4( inverseMatrix );\r\n\r\n\t\tif ( geometry.boundingBox !== null ) {\r\n\r\n\t\t\tif ( ray.isIntersectionBox( geometry.boundingBox ) === false ) {\r\n\r\n\t\t\t\treturn;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tif ( geometry instanceof THREE.BufferGeometry ) {\r\n\r\n\t\t\tvar material = this.material;\r\n\r\n\t\t\tif ( material === undefined ) return;\r\n\r\n\t\t\tvar attributes = geometry.attributes;\r\n\r\n\t\t\tvar a, b, c;\r\n\t\t\tvar precision = raycaster.precision;\r\n\r\n\t\t\tif ( attributes.index !== undefined ) {\r\n\r\n\t\t\t\tvar indices = attributes.index.array;\r\n\t\t\t\tvar positions = attributes.position.array;\r\n\t\t\t\tvar offsets = geometry.offsets;\r\n\r\n\t\t\t\tif ( offsets.length === 0 ) {\r\n\r\n\t\t\t\t\toffsets = [ { start: 0, count: indices.length, index: 0 } ];\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tfor ( var oi = 0, ol = offsets.length; oi < ol; ++ oi ) {\r\n\r\n\t\t\t\t\tvar start = offsets[ oi ].start;\r\n\t\t\t\t\tvar count = offsets[ oi ].count;\r\n\t\t\t\t\tvar index = offsets[ oi ].index;\r\n\r\n\t\t\t\t\tfor ( var i = start, il = start + count; i < il; i += 3 ) {\r\n\r\n\t\t\t\t\t\ta = index + indices[ i ];\r\n\t\t\t\t\t\tb = index + indices[ i + 1 ];\r\n\t\t\t\t\t\tc = index + indices[ i + 2 ];\r\n\r\n\t\t\t\t\t\tvA.fromArray( positions, a * 3 );\r\n\t\t\t\t\t\tvB.fromArray( positions, b * 3 );\r\n\t\t\t\t\t\tvC.fromArray( positions, c * 3 );\r\n\r\n\t\t\t\t\t\tif ( material.side === THREE.BackSide ) {\r\n\r\n\t\t\t\t\t\t\tvar intersectionPoint = ray.intersectTriangle( vC, vB, vA, true );\r\n\r\n\t\t\t\t\t\t} else {\r\n\r\n\t\t\t\t\t\t\tvar intersectionPoint = ray.intersectTriangle( vA, vB, vC, material.side !== THREE.DoubleSide );\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\tif ( intersectionPoint === null ) continue;\r\n\r\n\t\t\t\t\t\tintersectionPoint.applyMatrix4( this.matrixWorld );\r\n\r\n\t\t\t\t\t\tvar distance = raycaster.ray.origin.distanceTo( intersectionPoint );\r\n\r\n\t\t\t\t\t\tif ( distance < precision || distance < raycaster.near || distance > raycaster.far ) continue;\r\n\r\n\t\t\t\t\t\tintersects.push( {\r\n\r\n\t\t\t\t\t\t\tdistance: distance,\r\n\t\t\t\t\t\t\tpoint: intersectionPoint,\r\n\t\t\t\t\t\t\tface: new THREE.Face3( a, b, c, THREE.Triangle.normal( vA, vB, vC ) ),\r\n\t\t\t\t\t\t\tfaceIndex: null,\r\n\t\t\t\t\t\t\tobject: this\r\n\r\n\t\t\t\t\t\t} );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tvar positions = attributes.position.array;\r\n\r\n\t\t\t\tfor ( var i = 0, j = 0, il = positions.length; i < il; i += 3, j += 9 ) {\r\n\r\n\t\t\t\t\ta = i;\r\n\t\t\t\t\tb = i + 1;\r\n\t\t\t\t\tc = i + 2;\r\n\r\n\t\t\t\t\tvA.fromArray( positions, j );\r\n\t\t\t\t\tvB.fromArray( positions, j + 3 );\r\n\t\t\t\t\tvC.fromArray( positions, j + 6 );\r\n\r\n\t\t\t\t\tif ( material.side === THREE.BackSide ) {\r\n\r\n\t\t\t\t\t\tvar intersectionPoint = ray.intersectTriangle( vC, vB, vA, true );\r\n\r\n\t\t\t\t\t} else {\r\n\r\n\t\t\t\t\t\tvar intersectionPoint = ray.intersectTriangle( vA, vB, vC, material.side !== THREE.DoubleSide );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tif ( intersectionPoint === null ) continue;\r\n\r\n\t\t\t\t\tintersectionPoint.applyMatrix4( this.matrixWorld );\r\n\r\n\t\t\t\t\tvar distance = raycaster.ray.origin.distanceTo( intersectionPoint );\r\n\r\n\t\t\t\t\tif ( distance < precision || distance < raycaster.near || distance > raycaster.far ) continue;\r\n\r\n\t\t\t\t\tintersects.push( {\r\n\r\n\t\t\t\t\t\tdistance: distance,\r\n\t\t\t\t\t\tpoint: intersectionPoint,\r\n\t\t\t\t\t\tface: new THREE.Face3( a, b, c, THREE.Triangle.normal( vA, vB, vC ) ),\r\n\t\t\t\t\t\tfaceIndex: null,\r\n\t\t\t\t\t\tobject: this\r\n\r\n\t\t\t\t\t} );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t} else if ( geometry instanceof THREE.Geometry ) {\r\n\r\n\t\t\tvar isFaceMaterial = this.material instanceof THREE.MeshFaceMaterial;\r\n\t\t\tvar objectMaterials = isFaceMaterial === true ? this.material.materials : null;\r\n\r\n\t\t\tvar a, b, c;\r\n\t\t\tvar precision = raycaster.precision;\r\n\r\n\t\t\tvar vertices = geometry.vertices;\r\n\r\n\t\t\tfor ( var f = 0, fl = geometry.faces.length; f < fl; f ++ ) {\r\n\r\n\t\t\t\tvar face = geometry.faces[ f ];\r\n\r\n\t\t\t\tvar material = isFaceMaterial === true ? objectMaterials[ face.materialIndex ] : this.material;\r\n\r\n\t\t\t\tif ( material === undefined ) continue;\r\n\r\n\t\t\t\ta = vertices[ face.a ];\r\n\t\t\t\tb = vertices[ face.b ];\r\n\t\t\t\tc = vertices[ face.c ];\r\n\r\n\t\t\t\tif ( material.morphTargets === true ) {\r\n\r\n\t\t\t\t\tvar morphTargets = geometry.morphTargets;\r\n\t\t\t\t\tvar morphInfluences = this.morphTargetInfluences;\r\n\r\n\t\t\t\t\tvA.set( 0, 0, 0 );\r\n\t\t\t\t\tvB.set( 0, 0, 0 );\r\n\t\t\t\t\tvC.set( 0, 0, 0 );\r\n\r\n\t\t\t\t\tfor ( var t = 0, tl = morphTargets.length; t < tl; t ++ ) {\r\n\r\n\t\t\t\t\t\tvar influence = morphInfluences[ t ];\r\n\r\n\t\t\t\t\t\tif ( influence === 0 ) continue;\r\n\r\n\t\t\t\t\t\tvar targets = morphTargets[ t ].vertices;\r\n\r\n\t\t\t\t\t\tvA.x += ( targets[ face.a ].x - a.x ) * influence;\r\n\t\t\t\t\t\tvA.y += ( targets[ face.a ].y - a.y ) * influence;\r\n\t\t\t\t\t\tvA.z += ( targets[ face.a ].z - a.z ) * influence;\r\n\r\n\t\t\t\t\t\tvB.x += ( targets[ face.b ].x - b.x ) * influence;\r\n\t\t\t\t\t\tvB.y += ( targets[ face.b ].y - b.y ) * influence;\r\n\t\t\t\t\t\tvB.z += ( targets[ face.b ].z - b.z ) * influence;\r\n\r\n\t\t\t\t\t\tvC.x += ( targets[ face.c ].x - c.x ) * influence;\r\n\t\t\t\t\t\tvC.y += ( targets[ face.c ].y - c.y ) * influence;\r\n\t\t\t\t\t\tvC.z += ( targets[ face.c ].z - c.z ) * influence;\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tvA.add( a );\r\n\t\t\t\t\tvB.add( b );\r\n\t\t\t\t\tvC.add( c );\r\n\r\n\t\t\t\t\ta = vA;\r\n\t\t\t\t\tb = vB;\r\n\t\t\t\t\tc = vC;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif ( material.side === THREE.BackSide ) {\r\n\r\n\t\t\t\t\tvar intersectionPoint = ray.intersectTriangle( c, b, a, true );\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\tvar intersectionPoint = ray.intersectTriangle( a, b, c, material.side !== THREE.DoubleSide );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif ( intersectionPoint === null ) continue;\r\n\r\n\t\t\t\tintersectionPoint.applyMatrix4( this.matrixWorld );\r\n\r\n\t\t\t\tvar distance = raycaster.ray.origin.distanceTo( intersectionPoint );\r\n\r\n\t\t\t\tif ( distance < precision || distance < raycaster.near || distance > raycaster.far ) continue;\r\n\r\n\t\t\t\tintersects.push( {\r\n\r\n\t\t\t\t\tdistance: distance,\r\n\t\t\t\t\tpoint: intersectionPoint,\r\n\t\t\t\t\tface: face,\r\n\t\t\t\t\tfaceIndex: f,\r\n\t\t\t\t\tobject: this\r\n\r\n\t\t\t\t} );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t};\r\n\r\n}() );\r\n\r\nTHREE.Mesh.prototype.clone = function ( object, recursive ) {\r\n\r\n\tif ( object === undefined ) object = new THREE.Mesh( this.geometry, this.material );\r\n\r\n\tTHREE.Object3D.prototype.clone.call( this, object, recursive );\r\n\r\n\treturn object;\r\n\r\n};\r\n\r\n// File:src/objects/Bone.js\r\n\r\n/**\r\n * @author mikael emtinger / http://gomo.se/\r\n * @author alteredq / http://alteredqualia.com/\r\n * @author ikerr / http://verold.com\r\n */\r\n\r\nTHREE.Bone = function ( skin ) {\r\n\r\n\tTHREE.Object3D.call( this );\r\n\r\n\tthis.type = 'Bone';\r\n\r\n\tthis.skin = skin;\r\n\r\n};\r\n\r\nTHREE.Bone.prototype = Object.create( THREE.Object3D.prototype );\r\nTHREE.Bone.prototype.constructor = THREE.Bone;\r\n\r\n// File:src/objects/Skeleton.js\r\n\r\n/**\r\n * @author mikael emtinger / http://gomo.se/\r\n * @author alteredq / http://alteredqualia.com/\r\n * @author michael guerrero / http://realitymeltdown.com\r\n * @author ikerr / http://verold.com\r\n */\r\n\r\nTHREE.Skeleton = function ( bones, boneInverses, useVertexTexture ) {\r\n\r\n\tthis.useVertexTexture = useVertexTexture !== undefined ? useVertexTexture : true;\r\n\r\n\tthis.identityMatrix = new THREE.Matrix4();\r\n\r\n\t// copy the bone array\r\n\r\n\tbones = bones || [];\r\n\r\n\tthis.bones = bones.slice( 0 );\r\n\r\n\t// create a bone texture or an array of floats\r\n\r\n\tif ( this.useVertexTexture ) {\r\n\r\n\t\t// layout (1 matrix = 4 pixels)\r\n\t\t// RGBA RGBA RGBA RGBA (=> column1, column2, column3, column4)\r\n\t\t// with 8x8 pixel texture max 16 bones (8 * 8 / 4)\r\n\t\t// 16x16 pixel texture max 64 bones (16 * 16 / 4)\r\n\t\t// 32x32 pixel texture max 256 bones (32 * 32 / 4)\r\n\t\t// 64x64 pixel texture max 1024 bones (64 * 64 / 4)\r\n\r\n\t\tvar size;\r\n\r\n\t\tif ( this.bones.length > 256 )\r\n\t\t\tsize = 64;\r\n\t\telse if ( this.bones.length > 64 )\r\n\t\t\tsize = 32;\r\n\t\telse if ( this.bones.length > 16 )\r\n\t\t\tsize = 16;\r\n\t\telse\r\n\t\t\tsize = 8;\r\n\r\n\t\tthis.boneTextureWidth = size;\r\n\t\tthis.boneTextureHeight = size;\r\n\r\n\t\tthis.boneMatrices = new Float32Array( this.boneTextureWidth * this.boneTextureHeight * 4 ); // 4 floats per RGBA pixel\r\n\t\tthis.boneTexture = new THREE.DataTexture( this.boneMatrices, this.boneTextureWidth, this.boneTextureHeight, THREE.RGBAFormat, THREE.FloatType );\r\n\t\tthis.boneTexture.minFilter = THREE.NearestFilter;\r\n\t\tthis.boneTexture.magFilter = THREE.NearestFilter;\r\n\t\tthis.boneTexture.generateMipmaps = false;\r\n\t\tthis.boneTexture.flipY = false;\r\n\r\n\t} else {\r\n\r\n\t\tthis.boneMatrices = new Float32Array( 16 * this.bones.length );\r\n\r\n\t}\r\n\r\n\t// use the supplied bone inverses or calculate the inverses\r\n\r\n\tif ( boneInverses === undefined ) {\r\n\r\n\t\tthis.calculateInverses();\r\n\r\n\t} else {\r\n\r\n\t\tif ( this.bones.length === boneInverses.length ) {\r\n\r\n\t\t\tthis.boneInverses = boneInverses.slice( 0 );\r\n\r\n\t\t} else {\r\n\r\n\t\t\tTHREE.warn( 'THREE.Skeleton bonInverses is the wrong length.' );\r\n\r\n\t\t\tthis.boneInverses = [];\r\n\r\n\t\t\tfor ( var b = 0, bl = this.bones.length; b < bl; b ++ ) {\r\n\r\n\t\t\t\tthis.boneInverses.push( new THREE.Matrix4() );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n};\r\n\r\nTHREE.Skeleton.prototype.calculateInverses = function () {\r\n\r\n\tthis.boneInverses = [];\r\n\r\n\tfor ( var b = 0, bl = this.bones.length; b < bl; b ++ ) {\r\n\r\n\t\tvar inverse = new THREE.Matrix4();\r\n\r\n\t\tif ( this.bones[ b ] ) {\r\n\r\n\t\t\tinverse.getInverse( this.bones[ b ].matrixWorld );\r\n\r\n\t\t}\r\n\r\n\t\tthis.boneInverses.push( inverse );\r\n\r\n\t}\r\n\r\n};\r\n\r\nTHREE.Skeleton.prototype.pose = function () {\r\n\r\n\tvar bone;\r\n\r\n\t// recover the bind-time world matrices\r\n\r\n\tfor ( var b = 0, bl = this.bones.length; b < bl; b ++ ) {\r\n\r\n\t\tbone = this.bones[ b ];\r\n\r\n\t\tif ( bone ) {\r\n\r\n\t\t\tbone.matrixWorld.getInverse( this.boneInverses[ b ] );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\t// compute the local matrices, positions, rotations and scales\r\n\r\n\tfor ( var b = 0, bl = this.bones.length; b < bl; b ++ ) {\r\n\r\n\t\tbone = this.bones[ b ];\r\n\r\n\t\tif ( bone ) {\r\n\r\n\t\t\tif ( bone.parent ) {\r\n\r\n\t\t\t\tbone.matrix.getInverse( bone.parent.matrixWorld );\r\n\t\t\t\tbone.matrix.multiply( bone.matrixWorld );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tbone.matrix.copy( bone.matrixWorld );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tbone.matrix.decompose( bone.position, bone.quaternion, bone.scale );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n};\r\n\r\nTHREE.Skeleton.prototype.update = ( function () {\r\n\r\n\tvar offsetMatrix = new THREE.Matrix4();\r\n\t\r\n\treturn function () {\r\n\r\n\t\t// flatten bone matrices to array\r\n\r\n\t\tfor ( var b = 0, bl = this.bones.length; b < bl; b ++ ) {\r\n\r\n\t\t\t// compute the offset between the current and the original transform\r\n\r\n\t\t\tvar matrix = this.bones[ b ] ? this.bones[ b ].matrixWorld : this.identityMatrix;\r\n\r\n\t\t\toffsetMatrix.multiplyMatrices( matrix, this.boneInverses[ b ] );\r\n\t\t\toffsetMatrix.flattenToArrayOffset( this.boneMatrices, b * 16 );\r\n\r\n\t\t}\r\n\r\n\t\tif ( this.useVertexTexture ) {\r\n\r\n\t\t\tthis.boneTexture.needsUpdate = true;\r\n\r\n\t\t}\r\n\t\t\r\n\t};\r\n\r\n} )();\r\n\r\n\r\n// File:src/objects/SkinnedMesh.js\r\n\r\n/**\r\n * @author mikael emtinger / http://gomo.se/\r\n * @author alteredq / http://alteredqualia.com/\r\n * @author ikerr / http://verold.com\r\n */\r\n\r\nTHREE.SkinnedMesh = function ( geometry, material, useVertexTexture ) {\r\n\r\n\tTHREE.Mesh.call( this, geometry, material );\r\n\r\n\tthis.type = 'SkinnedMesh';\r\n\r\n\tthis.bindMode = \"attached\";\r\n\tthis.bindMatrix = new THREE.Matrix4();\r\n\tthis.bindMatrixInverse = new THREE.Matrix4();\r\n\r\n\t// init bones\r\n\r\n\t// TODO: remove bone creation as there is no reason (other than\r\n\t// convenience) for THREE.SkinnedMesh to do this.\r\n\r\n\tvar bones = [];\r\n\r\n\tif ( this.geometry && this.geometry.bones !== undefined ) {\r\n\r\n\t\tvar bone, gbone, p, q, s;\r\n\r\n\t\tfor ( var b = 0, bl = this.geometry.bones.length; b < bl; ++ b ) {\r\n\r\n\t\t\tgbone = this.geometry.bones[ b ];\r\n\r\n\t\t\tp = gbone.pos;\r\n\t\t\tq = gbone.rotq;\r\n\t\t\ts = gbone.scl;\r\n\r\n\t\t\tbone = new THREE.Bone( this );\r\n\t\t\tbones.push( bone );\r\n\r\n\t\t\tbone.name = gbone.name;\r\n\t\t\tbone.position.set( p[ 0 ], p[ 1 ], p[ 2 ] );\r\n\t\t\tbone.quaternion.set( q[ 0 ], q[ 1 ], q[ 2 ], q[ 3 ] );\r\n\r\n\t\t\tif ( s !== undefined ) {\r\n\r\n\t\t\t\tbone.scale.set( s[ 0 ], s[ 1 ], s[ 2 ] );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tbone.scale.set( 1, 1, 1 );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tfor ( var b = 0, bl = this.geometry.bones.length; b < bl; ++ b ) {\r\n\r\n\t\t\tgbone = this.geometry.bones[ b ];\r\n\r\n\t\t\tif ( gbone.parent !== - 1 ) {\r\n\r\n\t\t\t\tbones[ gbone.parent ].add( bones[ b ] );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tthis.add( bones[ b ] );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tthis.normalizeSkinWeights();\r\n\r\n\tthis.updateMatrixWorld( true );\r\n\tthis.bind( new THREE.Skeleton( bones, undefined, useVertexTexture ) );\r\n\r\n};\r\n\r\n\r\nTHREE.SkinnedMesh.prototype = Object.create( THREE.Mesh.prototype );\r\nTHREE.SkinnedMesh.prototype.constructor = THREE.SkinnedMesh;\r\n\r\nTHREE.SkinnedMesh.prototype.bind = function( skeleton, bindMatrix ) {\r\n\r\n\tthis.skeleton = skeleton;\r\n\r\n\tif ( bindMatrix === undefined ) {\r\n\r\n\t\tthis.updateMatrixWorld( true );\r\n\r\n\t\tbindMatrix = this.matrixWorld;\r\n\r\n\t}\r\n\r\n\tthis.bindMatrix.copy( bindMatrix );\r\n\tthis.bindMatrixInverse.getInverse( bindMatrix );\r\n\r\n};\r\n\r\nTHREE.SkinnedMesh.prototype.pose = function () {\r\n\r\n\tthis.skeleton.pose();\r\n\r\n};\r\n\r\nTHREE.SkinnedMesh.prototype.normalizeSkinWeights = function () {\r\n\r\n\tif ( this.geometry instanceof THREE.Geometry ) {\r\n\r\n\t\tfor ( var i = 0; i < this.geometry.skinIndices.length; i ++ ) {\r\n\r\n\t\t\tvar sw = this.geometry.skinWeights[ i ];\r\n\r\n\t\t\tvar scale = 1.0 / sw.lengthManhattan();\r\n\r\n\t\t\tif ( scale !== Infinity ) {\r\n\r\n\t\t\t\tsw.multiplyScalar( scale );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tsw.set( 1 ); // this will be normalized by the shader anyway\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t} else {\r\n\r\n\t\t// skinning weights assumed to be normalized for THREE.BufferGeometry\r\n\r\n\t}\r\n\r\n};\r\n\r\nTHREE.SkinnedMesh.prototype.updateMatrixWorld = function( force ) {\r\n\r\n\tTHREE.Mesh.prototype.updateMatrixWorld.call( this, true );\r\n\r\n\tif ( this.bindMode === \"attached\" ) {\r\n\r\n\t\tthis.bindMatrixInverse.getInverse( this.matrixWorld );\r\n\r\n\t} else if ( this.bindMode === \"detached\" ) {\r\n\r\n\t\tthis.bindMatrixInverse.getInverse( this.bindMatrix );\r\n\r\n\t} else {\r\n\r\n\t\tTHREE.warn( 'THREE.SkinnedMesh unreckognized bindMode: ' + this.bindMode );\r\n\r\n\t}\r\n\r\n};\r\n\r\nTHREE.SkinnedMesh.prototype.clone = function( object ) {\r\n\r\n\tif ( object === undefined ) {\r\n\r\n\t\tobject = new THREE.SkinnedMesh( this.geometry, this.material, this.useVertexTexture );\r\n\r\n\t}\r\n\r\n\tTHREE.Mesh.prototype.clone.call( this, object );\r\n\r\n\treturn object;\r\n\r\n};\r\n\r\n\r\n// File:src/objects/MorphAnimMesh.js\r\n\r\n/**\r\n * @author alteredq / http://alteredqualia.com/\r\n */\r\n\r\nTHREE.MorphAnimMesh = function ( geometry, material ) {\r\n\r\n\tTHREE.Mesh.call( this, geometry, material );\r\n\r\n\tthis.type = 'MorphAnimMesh';\r\n\r\n\t// API\r\n\r\n\tthis.duration = 1000; // milliseconds\r\n\tthis.mirroredLoop = false;\r\n\tthis.time = 0;\r\n\r\n\t// internals\r\n\r\n\tthis.lastKeyframe = 0;\r\n\tthis.currentKeyframe = 0;\r\n\r\n\tthis.direction = 1;\r\n\tthis.directionBackwards = false;\r\n\r\n\tthis.setFrameRange( 0, this.geometry.morphTargets.length - 1 );\r\n\r\n};\r\n\r\nTHREE.MorphAnimMesh.prototype = Object.create( THREE.Mesh.prototype );\r\nTHREE.MorphAnimMesh.prototype.constructor = THREE.MorphAnimMesh;\r\n\r\nTHREE.MorphAnimMesh.prototype.setFrameRange = function ( start, end ) {\r\n\r\n\tthis.startKeyframe = start;\r\n\tthis.endKeyframe = end;\r\n\r\n\tthis.length = this.endKeyframe - this.startKeyframe + 1;\r\n\r\n};\r\n\r\nTHREE.MorphAnimMesh.prototype.setDirectionForward = function () {\r\n\r\n\tthis.direction = 1;\r\n\tthis.directionBackwards = false;\r\n\r\n};\r\n\r\nTHREE.MorphAnimMesh.prototype.setDirectionBackward = function () {\r\n\r\n\tthis.direction = - 1;\r\n\tthis.directionBackwards = true;\r\n\r\n};\r\n\r\nTHREE.MorphAnimMesh.prototype.parseAnimations = function () {\r\n\r\n\tvar geometry = this.geometry;\r\n\r\n\tif ( ! geometry.animations ) geometry.animations = {};\r\n\r\n\tvar firstAnimation, animations = geometry.animations;\r\n\r\n\tvar pattern = /([a-z]+)_?(\\d+)/;\r\n\r\n\tfor ( var i = 0, il = geometry.morphTargets.length; i < il; i ++ ) {\r\n\r\n\t\tvar morph = geometry.morphTargets[ i ];\r\n\t\tvar parts = morph.name.match( pattern );\r\n\r\n\t\tif ( parts && parts.length > 1 ) {\r\n\r\n\t\t\tvar label = parts[ 1 ];\r\n\r\n\t\t\tif ( ! animations[ label ] ) animations[ label ] = { start: Infinity, end: - Infinity };\r\n\r\n\t\t\tvar animation = animations[ label ];\r\n\r\n\t\t\tif ( i < animation.start ) animation.start = i;\r\n\t\t\tif ( i > animation.end ) animation.end = i;\r\n\r\n\t\t\tif ( ! firstAnimation ) firstAnimation = label;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tgeometry.firstAnimation = firstAnimation;\r\n\r\n};\r\n\r\nTHREE.MorphAnimMesh.prototype.setAnimationLabel = function ( label, start, end ) {\r\n\r\n\tif ( ! this.geometry.animations ) this.geometry.animations = {};\r\n\r\n\tthis.geometry.animations[ label ] = { start: start, end: end };\r\n\r\n};\r\n\r\nTHREE.MorphAnimMesh.prototype.playAnimation = function ( label, fps ) {\r\n\r\n\tvar animation = this.geometry.animations[ label ];\r\n\r\n\tif ( animation ) {\r\n\r\n\t\tthis.setFrameRange( animation.start, animation.end );\r\n\t\tthis.duration = 1000 * ( ( animation.end - animation.start ) / fps );\r\n\t\tthis.time = 0;\r\n\r\n\t} else {\r\n\r\n\t\tTHREE.warn( 'THREE.MorphAnimMesh: animation[' + label + '] undefined in .playAnimation()' );\r\n\r\n\t}\r\n\r\n};\r\n\r\nTHREE.MorphAnimMesh.prototype.updateAnimation = function ( delta ) {\r\n\r\n\tvar frameTime = this.duration / this.length;\r\n\r\n\tthis.time += this.direction * delta;\r\n\r\n\tif ( this.mirroredLoop ) {\r\n\r\n\t\tif ( this.time > this.duration || this.time < 0 ) {\r\n\r\n\t\t\tthis.direction *= - 1;\r\n\r\n\t\t\tif ( this.time > this.duration ) {\r\n\r\n\t\t\t\tthis.time = this.duration;\r\n\t\t\t\tthis.directionBackwards = true;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( this.time < 0 ) {\r\n\r\n\t\t\t\tthis.time = 0;\r\n\t\t\t\tthis.directionBackwards = false;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t} else {\r\n\r\n\t\tthis.time = this.time % this.duration;\r\n\r\n\t\tif ( this.time < 0 ) this.time += this.duration;\r\n\r\n\t}\r\n\r\n\tvar keyframe = this.startKeyframe + THREE.Math.clamp( Math.floor( this.time / frameTime ), 0, this.length - 1 );\r\n\r\n\tif ( keyframe !== this.currentKeyframe ) {\r\n\r\n\t\tthis.morphTargetInfluences[ this.lastKeyframe ] = 0;\r\n\t\tthis.morphTargetInfluences[ this.currentKeyframe ] = 1;\r\n\r\n\t\tthis.morphTargetInfluences[ keyframe ] = 0;\r\n\r\n\t\tthis.lastKeyframe = this.currentKeyframe;\r\n\t\tthis.currentKeyframe = keyframe;\r\n\r\n\t}\r\n\r\n\tvar mix = ( this.time % frameTime ) / frameTime;\r\n\r\n\tif ( this.directionBackwards ) {\r\n\r\n\t\tmix = 1 - mix;\r\n\r\n\t}\r\n\r\n\tthis.morphTargetInfluences[ this.currentKeyframe ] = mix;\r\n\tthis.morphTargetInfluences[ this.lastKeyframe ] = 1 - mix;\r\n\r\n};\r\n\r\nTHREE.MorphAnimMesh.prototype.interpolateTargets = function ( a, b, t ) {\r\n\r\n\tvar influences = this.morphTargetInfluences;\r\n\r\n\tfor ( var i = 0, l = influences.length; i < l; i ++ ) {\r\n\r\n\t\tinfluences[ i ] = 0;\r\n\r\n\t}\r\n\r\n\tif ( a > -1 ) influences[ a ] = 1 - t;\r\n\tif ( b > -1 ) influences[ b ] = t;\r\n\r\n};\r\n\r\nTHREE.MorphAnimMesh.prototype.clone = function ( object ) {\r\n\r\n\tif ( object === undefined ) object = new THREE.MorphAnimMesh( this.geometry, this.material );\r\n\r\n\tobject.duration = this.duration;\r\n\tobject.mirroredLoop = this.mirroredLoop;\r\n\tobject.time = this.time;\r\n\r\n\tobject.lastKeyframe = this.lastKeyframe;\r\n\tobject.currentKeyframe = this.currentKeyframe;\r\n\r\n\tobject.direction = this.direction;\r\n\tobject.directionBackwards = this.directionBackwards;\r\n\r\n\tTHREE.Mesh.prototype.clone.call( this, object );\r\n\r\n\treturn object;\r\n\r\n};\r\n\r\n// File:src/objects/LOD.js\r\n\r\n/**\r\n * @author mikael emtinger / http://gomo.se/\r\n * @author alteredq / http://alteredqualia.com/\r\n * @author mrdoob / http://mrdoob.com/\r\n */\r\n\r\nTHREE.LOD = function () {\r\n\r\n\tTHREE.Object3D.call( this );\r\n\r\n\tthis.objects = [];\r\n\r\n};\r\n\r\n\r\nTHREE.LOD.prototype = Object.create( THREE.Object3D.prototype );\r\nTHREE.LOD.prototype.constructor = THREE.LOD;\r\n\r\nTHREE.LOD.prototype.addLevel = function ( object, distance ) {\r\n\r\n\tif ( distance === undefined ) distance = 0;\r\n\r\n\tdistance = Math.abs( distance );\r\n\r\n\tfor ( var l = 0; l < this.objects.length; l ++ ) {\r\n\r\n\t\tif ( distance < this.objects[ l ].distance ) {\r\n\r\n\t\t\tbreak;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tthis.objects.splice( l, 0, { distance: distance, object: object } );\r\n\tthis.add( object );\r\n\r\n};\r\n\r\nTHREE.LOD.prototype.getObjectForDistance = function ( distance ) {\r\n\r\n\tfor ( var i = 1, l = this.objects.length; i < l; i ++ ) {\r\n\r\n\t\tif ( distance < this.objects[ i ].distance ) {\r\n\r\n\t\t\tbreak;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn this.objects[ i - 1 ].object;\r\n\r\n};\r\n\r\nTHREE.LOD.prototype.raycast = ( function () {\r\n\r\n\tvar matrixPosition = new THREE.Vector3();\r\n\r\n\treturn function ( raycaster, intersects ) {\r\n\r\n\t\tmatrixPosition.setFromMatrixPosition( this.matrixWorld );\r\n\r\n\t\tvar distance = raycaster.ray.origin.distanceTo( matrixPosition );\r\n\r\n\t\tthis.getObjectForDistance( distance ).raycast( raycaster, intersects );\r\n\r\n\t};\r\n\r\n}() );\r\n\r\nTHREE.LOD.prototype.update = function () {\r\n\r\n\tvar v1 = new THREE.Vector3();\r\n\tvar v2 = new THREE.Vector3();\r\n\r\n\treturn function ( camera ) {\r\n\r\n\t\tif ( this.objects.length > 1 ) {\r\n\r\n\t\t\tv1.setFromMatrixPosition( camera.matrixWorld );\r\n\t\t\tv2.setFromMatrixPosition( this.matrixWorld );\r\n\r\n\t\t\tvar distance = v1.distanceTo( v2 );\r\n\r\n\t\t\tthis.objects[ 0 ].object.visible = true;\r\n\r\n\t\t\tfor ( var i = 1, l = this.objects.length; i < l; i ++ ) {\r\n\r\n\t\t\t\tif ( distance >= this.objects[ i ].distance ) {\r\n\r\n\t\t\t\t\tthis.objects[ i - 1 ].object.visible = false;\r\n\t\t\t\t\tthis.objects[ i ].object.visible = true;\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\tfor ( ; i < l; i ++ ) {\r\n\r\n\t\t\t\tthis.objects[ i ].object.visible = false;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t};\r\n\r\n}();\r\n\r\nTHREE.LOD.prototype.clone = function ( object ) {\r\n\r\n\tif ( object === undefined ) object = new THREE.LOD();\r\n\r\n\tTHREE.Object3D.prototype.clone.call( this, object );\r\n\r\n\tfor ( var i = 0, l = this.objects.length; i < l; i ++ ) {\r\n\t\tvar x = this.objects[ i ].object.clone();\r\n\t\tx.visible = i === 0;\r\n\t\tobject.addLevel( x, this.objects[ i ].distance );\r\n\t}\r\n\r\n\treturn object;\r\n\r\n};\r\n\r\n// File:src/objects/Sprite.js\r\n\r\n/**\r\n * @author mikael emtinger / http://gomo.se/\r\n * @author alteredq / http://alteredqualia.com/\r\n */\r\n\r\nTHREE.Sprite = ( function () {\r\n\r\n\tvar indices = new Uint16Array( [ 0, 1, 2, 0, 2, 3 ] );\r\n\tvar vertices = new Float32Array( [ - 0.5, - 0.5, 0, 0.5, - 0.5, 0, 0.5, 0.5, 0, - 0.5, 0.5, 0 ] );\r\n\tvar uvs = new Float32Array( [ 0, 0, 1, 0, 1, 1, 0, 1 ] );\r\n\r\n\tvar geometry = new THREE.BufferGeometry();\r\n\tgeometry.addAttribute( 'index', new THREE.BufferAttribute( indices, 1 ) );\r\n\tgeometry.addAttribute( 'position', new THREE.BufferAttribute( vertices, 3 ) );\r\n\tgeometry.addAttribute( 'uv', new THREE.BufferAttribute( uvs, 2 ) );\r\n\r\n\treturn function ( material ) {\r\n\r\n\t\tTHREE.Object3D.call( this );\r\n\r\n\t\tthis.type = 'Sprite';\r\n\r\n\t\tthis.geometry = geometry;\r\n\t\tthis.material = ( material !== undefined ) ? material : new THREE.SpriteMaterial();\r\n\r\n\t};\r\n\r\n} )();\r\n\r\nTHREE.Sprite.prototype = Object.create( THREE.Object3D.prototype );\r\nTHREE.Sprite.prototype.constructor = THREE.Sprite;\r\n\r\nTHREE.Sprite.prototype.raycast = ( function () {\r\n\r\n\tvar matrixPosition = new THREE.Vector3();\r\n\r\n\treturn function ( raycaster, intersects ) {\r\n\r\n\t\tmatrixPosition.setFromMatrixPosition( this.matrixWorld );\r\n\r\n\t\tvar distance = raycaster.ray.distanceToPoint( matrixPosition );\r\n\r\n\t\tif ( distance > this.scale.x ) {\r\n\r\n\t\t\treturn;\r\n\r\n\t\t}\r\n\r\n\t\tintersects.push( {\r\n\r\n\t\t\tdistance: distance,\r\n\t\t\tpoint: this.position,\r\n\t\t\tface: null,\r\n\t\t\tobject: this\r\n\r\n\t\t} );\r\n\r\n\t};\r\n\r\n}() );\r\n\r\nTHREE.Sprite.prototype.clone = function ( object ) {\r\n\r\n\tif ( object === undefined ) object = new THREE.Sprite( this.material );\r\n\r\n\tTHREE.Object3D.prototype.clone.call( this, object );\r\n\r\n\treturn object;\r\n\r\n};\r\n\r\n// Backwards compatibility\r\n\r\nTHREE.Particle = THREE.Sprite;\r\n\r\n// File:src/objects/LensFlare.js\r\n\r\n/**\r\n * @author mikael emtinger / http://gomo.se/\r\n * @author alteredq / http://alteredqualia.com/\r\n */\r\n\r\nTHREE.LensFlare = function ( texture, size, distance, blending, color ) {\r\n\r\n\tTHREE.Object3D.call( this );\r\n\r\n\tthis.lensFlares = [];\r\n\r\n\tthis.positionScreen = new THREE.Vector3();\r\n\tthis.customUpdateCallback = undefined;\r\n\r\n\tif ( texture !== undefined ) {\r\n\r\n\t\tthis.add( texture, size, distance, blending, color );\r\n\r\n\t}\r\n\r\n};\r\n\r\nTHREE.LensFlare.prototype = Object.create( THREE.Object3D.prototype );\r\nTHREE.LensFlare.prototype.constructor = THREE.LensFlare;\r\n\r\n\r\n/*\r\n * Add: adds another flare\r\n */\r\n\r\nTHREE.LensFlare.prototype.add = function ( texture, size, distance, blending, color, opacity ) {\r\n\r\n\tif ( size === undefined ) size = - 1;\r\n\tif ( distance === undefined ) distance = 0;\r\n\tif ( opacity === undefined ) opacity = 1;\r\n\tif ( color === undefined ) color = new THREE.Color( 0xffffff );\r\n\tif ( blending === undefined ) blending = THREE.NormalBlending;\r\n\r\n\tdistance = Math.min( distance, Math.max( 0, distance ) );\r\n\r\n\tthis.lensFlares.push( {\r\n\t\ttexture: texture, \t\t\t// THREE.Texture\r\n\t\tsize: size, \t\t\t\t// size in pixels (-1 = use texture.width)\r\n\t\tdistance: distance, \t\t// distance (0-1) from light source (0=at light source)\r\n\t\tx: 0, y: 0, z: 0,\t\t\t// screen position (-1 => 1) z = 0 is ontop z = 1 is back\r\n\t\tscale: 1, \t\t\t\t\t// scale\r\n\t\trotation: 1, \t\t\t\t// rotation\r\n\t\topacity: opacity,\t\t\t// opacity\r\n\t\tcolor: color,\t\t\t\t// color\r\n\t\tblending: blending\t\t\t// blending\r\n\t} );\r\n\r\n};\r\n\r\n/*\r\n * Update lens flares update positions on all flares based on the screen position\r\n * Set myLensFlare.customUpdateCallback to alter the flares in your project specific way.\r\n */\r\n\r\nTHREE.LensFlare.prototype.updateLensFlares = function () {\r\n\r\n\tvar f, fl = this.lensFlares.length;\r\n\tvar flare;\r\n\tvar vecX = - this.positionScreen.x * 2;\r\n\tvar vecY = - this.positionScreen.y * 2;\r\n\r\n\tfor ( f = 0; f < fl; f ++ ) {\r\n\r\n\t\tflare = this.lensFlares[ f ];\r\n\r\n\t\tflare.x = this.positionScreen.x + vecX * flare.distance;\r\n\t\tflare.y = this.positionScreen.y + vecY * flare.distance;\r\n\r\n\t\tflare.wantedRotation = flare.x * Math.PI * 0.25;\r\n\t\tflare.rotation += ( flare.wantedRotation - flare.rotation ) * 0.25;\r\n\r\n\t}\r\n\r\n};\r\n\r\n\r\n// File:src/scenes/Scene.js\r\n\r\n/**\r\n * @author mrdoob / http://mrdoob.com/\r\n */\r\n\r\nTHREE.Scene = function () {\r\n\r\n\tTHREE.Object3D.call( this );\r\n\r\n\tthis.type = 'Scene';\r\n\r\n\tthis.fog = null;\r\n\tthis.overrideMaterial = null;\r\n\r\n\tthis.autoUpdate = true; // checked by the renderer\r\n\r\n};\r\n\r\nTHREE.Scene.prototype = Object.create( THREE.Object3D.prototype );\r\nTHREE.Scene.prototype.constructor = THREE.Scene;\r\n\r\nTHREE.Scene.prototype.clone = function ( object ) {\r\n\r\n\tif ( object === undefined ) object = new THREE.Scene();\r\n\r\n\tTHREE.Object3D.prototype.clone.call( this, object );\r\n\r\n\tif ( this.fog !== null ) object.fog = this.fog.clone();\r\n\tif ( this.overrideMaterial !== null ) object.overrideMaterial = this.overrideMaterial.clone();\r\n\r\n\tobject.autoUpdate = this.autoUpdate;\r\n\tobject.matrixAutoUpdate = this.matrixAutoUpdate;\r\n\r\n\treturn object;\r\n\r\n};\r\n\r\n// File:src/scenes/Fog.js\r\n\r\n/**\r\n * @author mrdoob / http://mrdoob.com/\r\n * @author alteredq / http://alteredqualia.com/\r\n */\r\n\r\nTHREE.Fog = function ( color, near, far ) {\r\n\r\n\tthis.name = '';\r\n\r\n\tthis.color = new THREE.Color( color );\r\n\r\n\tthis.near = ( near !== undefined ) ? near : 1;\r\n\tthis.far = ( far !== undefined ) ? far : 1000;\r\n\r\n};\r\n\r\nTHREE.Fog.prototype.clone = function () {\r\n\r\n\treturn new THREE.Fog( this.color.getHex(), this.near, this.far );\r\n\r\n};\r\n\r\n// File:src/scenes/FogExp2.js\r\n\r\n/**\r\n * @author mrdoob / http://mrdoob.com/\r\n * @author alteredq / http://alteredqualia.com/\r\n */\r\n\r\nTHREE.FogExp2 = function ( color, density ) {\r\n\r\n\tthis.name = '';\r\n\r\n\tthis.color = new THREE.Color( color );\r\n\tthis.density = ( density !== undefined ) ? density : 0.00025;\r\n\r\n};\r\n\r\nTHREE.FogExp2.prototype.clone = function () {\r\n\r\n\treturn new THREE.FogExp2( this.color.getHex(), this.density );\r\n\r\n};\r\n\r\n// File:src/renderers/shaders/ShaderChunk.js\r\n\r\nTHREE.ShaderChunk = {};\r\n\r\n// File:src/renderers/shaders/ShaderChunk/common.glsl\r\n\r\nTHREE.ShaderChunk[ 'common'] = \"#define PI 3.14159\\n#define PI2 6.28318\\n#define RECIPROCAL_PI2 0.15915494\\n#define LOG2 1.442695\\n#define EPSILON 1e-6\\n\\nfloat square( in float a ) { return a*a; }\\nvec2 square( in vec2 a ) { return vec2( a.x*a.x, a.y*a.y ); }\\nvec3 square( in vec3 a ) { return vec3( a.x*a.x, a.y*a.y, a.z*a.z ); }\\nvec4 square( in vec4 a ) { return vec4( a.x*a.x, a.y*a.y, a.z*a.z, a.w*a.w ); }\\nfloat saturate( in float a ) { return clamp( a, 0.0, 1.0 ); }\\nvec2 saturate( in vec2 a ) { return clamp( a, 0.0, 1.0 ); }\\nvec3 saturate( in vec3 a ) { return clamp( a, 0.0, 1.0 ); }\\nvec4 saturate( in vec4 a ) { return clamp( a, 0.0, 1.0 ); }\\nfloat average( in float a ) { return a; }\\nfloat average( in vec2 a ) { return ( a.x + a.y) * 0.5; }\\nfloat average( in vec3 a ) { return ( a.x + a.y + a.z) / 3.0; }\\nfloat average( in vec4 a ) { return ( a.x + a.y + a.z + a.w) * 0.25; }\\nfloat whiteCompliment( in float a ) { return saturate( 1.0 - a ); }\\nvec2 whiteCompliment( in vec2 a ) { return saturate( vec2(1.0) - a ); }\\nvec3 whiteCompliment( in vec3 a ) { return saturate( vec3(1.0) - a ); }\\nvec4 whiteCompliment( in vec4 a ) { return saturate( vec4(1.0) - a ); }\\nvec3 transformDirection( in vec3 normal, in mat4 matrix ) {\\n\treturn normalize( ( matrix * vec4( normal, 0.0 ) ).xyz );\\n}\\n// http://en.wikibooks.org/wiki/GLSL_Programming/Applying_Matrix_Transformations\\nvec3 inverseTransformDirection( in vec3 normal, in mat4 matrix ) {\\n\treturn normalize( ( vec4( normal, 0.0 ) * matrix ).xyz );\\n}\\nvec3 projectOnPlane(in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal) {\\n\tfloat distance = dot( planeNormal, point-pointOnPlane );\\n\treturn point - distance * planeNormal;\\n}\\nfloat sideOfPlane( in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\\n\treturn sign( dot( point - pointOnPlane, planeNormal ) );\\n}\\nvec3 linePlaneIntersect( in vec3 pointOnLine, in vec3 lineDirection, in vec3 pointOnPlane, in vec3 planeNormal ) {\\n\treturn pointOnLine + lineDirection * ( dot( planeNormal, pointOnPlane - pointOnLine ) / dot( planeNormal, lineDirection ) );\\n}\\nfloat calcLightAttenuation( float lightDistance, float cutoffDistance, float decayExponent ) {\\n\tif ( decayExponent > 0.0 ) {\\n\t return pow( saturate( 1.0 - lightDistance / cutoffDistance ), decayExponent );\\n\t}\\n\treturn 1.0;\\n}\\n\\nvec3 inputToLinear( in vec3 a ) {\\n#ifdef GAMMA_INPUT\\n\treturn pow( a, vec3( float( GAMMA_FACTOR ) ) );\\n#else\\n\treturn a;\\n#endif\\n}\\nvec3 linearToOutput( in vec3 a ) {\\n#ifdef GAMMA_OUTPUT\\n\treturn pow( a, vec3( 1.0 / float( GAMMA_FACTOR ) ) );\\n#else\\n\treturn a;\\n#endif\\n}\\n\";\r\n\r\n// File:src/renderers/shaders/ShaderChunk/alphatest_fragment.glsl\r\n\r\nTHREE.ShaderChunk[ 'alphatest_fragment'] = \"#ifdef ALPHATEST\\n\\n\tif ( diffuseColor.a < ALPHATEST ) discard;\\n\\n#endif\\n\";\r\n\r\n// File:src/renderers/shaders/ShaderChunk/lights_lambert_vertex.glsl\r\n\r\nTHREE.ShaderChunk[ 'lights_lambert_vertex'] = \"vLightFront = vec3( 0.0 );\\n\\n#ifdef DOUBLE_SIDED\\n\\n\tvLightBack = vec3( 0.0 );\\n\\n#endif\\n\\ntransformedNormal = normalize( transformedNormal );\\n\\n#if MAX_DIR_LIGHTS > 0\\n\\nfor( int i = 0; i < MAX_DIR_LIGHTS; i ++ ) {\\n\\n\tvec3 dirVector = transformDirection( directionalLightDirection[ i ], viewMatrix );\\n\\n\tfloat dotProduct = dot( transformedNormal, dirVector );\\n\tvec3 directionalLightWeighting = vec3( max( dotProduct, 0.0 ) );\\n\\n\t#ifdef DOUBLE_SIDED\\n\\n\t\tvec3 directionalLightWeightingBack = vec3( max( -dotProduct, 0.0 ) );\\n\\n\t\t#ifdef WRAP_AROUND\\n\\n\t\t\tvec3 directionalLightWeightingHalfBack = vec3( max( -0.5 * dotProduct + 0.5, 0.0 ) );\\n\\n\t\t#endif\\n\\n\t#endif\\n\\n\t#ifdef WRAP_AROUND\\n\\n\t\tvec3 directionalLightWeightingHalf = vec3( max( 0.5 * dotProduct + 0.5, 0.0 ) );\\n\t\tdirectionalLightWeighting = mix( directionalLightWeighting, directionalLightWeightingHalf, wrapRGB );\\n\\n\t\t#ifdef DOUBLE_SIDED\\n\\n\t\t\tdirectionalLightWeightingBack = mix( directionalLightWeightingBack, directionalLightWeightingHalfBack, wrapRGB );\\n\\n\t\t#endif\\n\\n\t#endif\\n\\n\tvLightFront += directionalLightColor[ i ] * directionalLightWeighting;\\n\\n\t#ifdef DOUBLE_SIDED\\n\\n\t\tvLightBack += directionalLightColor[ i ] * directionalLightWeightingBack;\\n\\n\t#endif\\n\\n}\\n\\n#endif\\n\\n#if MAX_POINT_LIGHTS > 0\\n\\n\tfor( int i = 0; i < MAX_POINT_LIGHTS; i ++ ) {\\n\\n\t\tvec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );\\n\t\tvec3 lVector = lPosition.xyz - mvPosition.xyz;\\n\\n\t\tfloat attenuation = calcLightAttenuation( length( lVector ), pointLightDistance[ i ], pointLightDecay[ i ] );\\n\\n\t\tlVector = normalize( lVector );\\n\t\tfloat dotProduct = dot( transformedNormal, lVector );\\n\\n\t\tvec3 pointLightWeighting = vec3( max( dotProduct, 0.0 ) );\\n\\n\t\t#ifdef DOUBLE_SIDED\\n\\n\t\t\tvec3 pointLightWeightingBack = vec3( max( -dotProduct, 0.0 ) );\\n\\n\t\t\t#ifdef WRAP_AROUND\\n\\n\t\t\t\tvec3 pointLightWeightingHalfBack = vec3( max( -0.5 * dotProduct + 0.5, 0.0 ) );\\n\\n\t\t\t#endif\\n\\n\t\t#endif\\n\\n\t\t#ifdef WRAP_AROUND\\n\\n\t\t\tvec3 pointLightWeightingHalf = vec3( max( 0.5 * dotProduct + 0.5, 0.0 ) );\\n\t\t\tpointLightWeighting = mix( pointLightWeighting, pointLightWeightingHalf, wrapRGB );\\n\\n\t\t\t#ifdef DOUBLE_SIDED\\n\\n\t\t\t\tpointLightWeightingBack = mix( pointLightWeightingBack, pointLightWeightingHalfBack, wrapRGB );\\n\\n\t\t\t#endif\\n\\n\t\t#endif\\n\\n\t\tvLightFront += pointLightColor[ i ] * pointLightWeighting * attenuation;\\n\\n\t\t#ifdef DOUBLE_SIDED\\n\\n\t\t\tvLightBack += pointLightColor[ i ] * pointLightWeightingBack * attenuation;\\n\\n\t\t#endif\\n\\n\t}\\n\\n#endif\\n\\n#if MAX_SPOT_LIGHTS > 0\\n\\n\tfor( int i = 0; i < MAX_SPOT_LIGHTS; i ++ ) {\\n\\n\t\tvec4 lPosition = viewMatrix * vec4( spotLightPosition[ i ], 1.0 );\\n\t\tvec3 lVector = lPosition.xyz - mvPosition.xyz;\\n\\n\t\tfloat spotEffect = dot( spotLightDirection[ i ], normalize( spotLightPosition[ i ] - worldPosition.xyz ) );\\n\\n\t\tif ( spotEffect > spotLightAngleCos[ i ] ) {\\n\\n\t\t\tspotEffect = max( pow( max( spotEffect, 0.0 ), spotLightExponent[ i ] ), 0.0 );\\n\\n\t\t\tfloat attenuation = calcLightAttenuation( length( lVector ), spotLightDistance[ i ], spotLightDecay[ i ] );\\n\\n\t\t\tlVector = normalize( lVector );\\n\\n\t\t\tfloat dotProduct = dot( transformedNormal, lVector );\\n\t\t\tvec3 spotLightWeighting = vec3( max( dotProduct, 0.0 ) );\\n\\n\t\t\t#ifdef DOUBLE_SIDED\\n\\n\t\t\t\tvec3 spotLightWeightingBack = vec3( max( -dotProduct, 0.0 ) );\\n\\n\t\t\t\t#ifdef WRAP_AROUND\\n\\n\t\t\t\t\tvec3 spotLightWeightingHalfBack = vec3( max( -0.5 * dotProduct + 0.5, 0.0 ) );\\n\\n\t\t\t\t#endif\\n\\n\t\t\t#endif\\n\\n\t\t\t#ifdef WRAP_AROUND\\n\\n\t\t\t\tvec3 spotLightWeightingHalf = vec3( max( 0.5 * dotProduct + 0.5, 0.0 ) );\\n\t\t\t\tspotLightWeighting = mix( spotLightWeighting, spotLightWeightingHalf, wrapRGB );\\n\\n\t\t\t\t#ifdef DOUBLE_SIDED\\n\\n\t\t\t\t\tspotLightWeightingBack = mix( spotLightWeightingBack, spotLightWeightingHalfBack, wrapRGB );\\n\\n\t\t\t\t#endif\\n\\n\t\t\t#endif\\n\\n\t\t\tvLightFront += spotLightColor[ i ] * spotLightWeighting * attenuation * spotEffect;\\n\\n\t\t\t#ifdef DOUBLE_SIDED\\n\\n\t\t\t\tvLightBack += spotLightColor[ i ] * spotLightWeightingBack * attenuation * spotEffect;\\n\\n\t\t\t#endif\\n\\n\t\t}\\n\\n\t}\\n\\n#endif\\n\\n#if MAX_HEMI_LIGHTS > 0\\n\\n\tfor( int i = 0; i < MAX_HEMI_LIGHTS; i ++ ) {\\n\\n\t\tvec3 lVector = transformDirection( hemisphereLightDirection[ i ], viewMatrix );\\n\\n\t\tfloat dotProduct = dot( transformedNormal, lVector );\\n\\n\t\tfloat hemiDiffuseWeight = 0.5 * dotProduct + 0.5;\\n\t\tfloat hemiDiffuseWeightBack = -0.5 * dotProduct + 0.5;\\n\\n\t\tvLightFront += mix( hemisphereLightGroundColor[ i ], hemisphereLightSkyColor[ i ], hemiDiffuseWeight );\\n\\n\t\t#ifdef DOUBLE_SIDED\\n\\n\t\t\tvLightBack += mix( hemisphereLightGroundColor[ i ], hemisphereLightSkyColor[ i ], hemiDiffuseWeightBack );\\n\\n\t\t#endif\\n\\n\t}\\n\\n#endif\\n\\nvLightFront += ambientLightColor;\\n\\n#ifdef DOUBLE_SIDED\\n\\n\tvLightBack += ambientLightColor;\\n\\n#endif\\n\";\r\n\r\n// File:src/renderers/shaders/ShaderChunk/map_particle_pars_fragment.glsl\r\n\r\nTHREE.ShaderChunk[ 'map_particle_pars_fragment'] = \"#ifdef USE_MAP\\n\\n\tuniform vec4 offsetRepeat;\\n\tuniform sampler2D map;\\n\\n#endif\\n\";\r\n\r\n// File:src/renderers/shaders/ShaderChunk/default_vertex.glsl\r\n\r\nTHREE.ShaderChunk[ 'default_vertex'] = \"#ifdef USE_SKINNING\\n\\n\tvec4 mvPosition = modelViewMatrix * skinned;\\n\\n#elif defined( USE_MORPHTARGETS )\\n\\n\tvec4 mvPosition = modelViewMatrix * vec4( morphed, 1.0 );\\n\\n#else\\n\\n\tvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\\n\\n#endif\\n\\ngl_Position = projectionMatrix * mvPosition;\\n\";\r\n\r\n// File:src/renderers/shaders/ShaderChunk/map_pars_fragment.glsl\r\n\r\nTHREE.ShaderChunk[ 'map_pars_fragment'] = \"#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP )\\n\\n\tvarying vec2 vUv;\\n\\n#endif\\n\\n#ifdef USE_MAP\\n\\n\tuniform sampler2D map;\\n\\n#endif\";\r\n\r\n// File:src/renderers/shaders/ShaderChunk/skinnormal_vertex.glsl\r\n\r\nTHREE.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\t#ifdef USE_MORPHNORMALS\\n\\n\tvec4 skinnedNormal = skinMatrix * vec4( morphedNormal, 0.0 );\\n\\n\t#else\\n\\n\tvec4 skinnedNormal = skinMatrix * vec4( normal, 0.0 );\\n\\n\t#endif\\n\\n#endif\\n\";\r\n\r\n// File:src/renderers/shaders/ShaderChunk/logdepthbuf_pars_vertex.glsl\r\n\r\nTHREE.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\";\r\n\r\n// File:src/renderers/shaders/ShaderChunk/lightmap_pars_vertex.glsl\r\n\r\nTHREE.ShaderChunk[ 'lightmap_pars_vertex'] = \"#ifdef USE_LIGHTMAP\\n\\n\tvarying vec2 vUv2;\\n\\n#endif\";\r\n\r\n// File:src/renderers/shaders/ShaderChunk/lights_phong_fragment.glsl\r\n\r\nTHREE.ShaderChunk[ 'lights_phong_fragment'] = \"#ifndef FLAT_SHADED\\n\\n\tvec3 normal = normalize( vNormal );\\n\\n\t#ifdef DOUBLE_SIDED\\n\\n\t\tnormal = normal * ( -1.0 + 2.0 * float( gl_FrontFacing ) );\\n\\n\t#endif\\n\\n#else\\n\\n\tvec3 fdx = dFdx( vViewPosition );\\n\tvec3 fdy = dFdy( vViewPosition );\\n\tvec3 normal = normalize( cross( fdx, fdy ) );\\n\\n#endif\\n\\nvec3 viewPosition = normalize( vViewPosition );\\n\\n#ifdef USE_NORMALMAP\\n\\n\tnormal = perturbNormal2Arb( -vViewPosition, normal );\\n\\n#elif defined( USE_BUMPMAP )\\n\\n\tnormal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd() );\\n\\n#endif\\n\\nvec3 totalDiffuseLight = vec3( 0.0 );\\nvec3 totalSpecularLight = vec3( 0.0 );\\n\\n#if MAX_POINT_LIGHTS > 0\\n\\n\tfor ( int i = 0; i < MAX_POINT_LIGHTS; i ++ ) {\\n\\n\t\tvec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );\\n\t\tvec3 lVector = lPosition.xyz + vViewPosition.xyz;\\n\\n\t\tfloat attenuation = calcLightAttenuation( length( lVector ), pointLightDistance[ i ], pointLightDecay[ i ] );\\n\\n\t\tlVector = normalize( lVector );\\n\\n\t\t// diffuse\\n\\n\t\tfloat dotProduct = dot( normal, lVector );\\n\\n\t\t#ifdef WRAP_AROUND\\n\\n\t\t\tfloat pointDiffuseWeightFull = max( dotProduct, 0.0 );\\n\t\t\tfloat pointDiffuseWeightHalf = max( 0.5 * dotProduct + 0.5, 0.0 );\\n\\n\t\t\tvec3 pointDiffuseWeight = mix( vec3( pointDiffuseWeightFull ), vec3( pointDiffuseWeightHalf ), wrapRGB );\\n\\n\t\t#else\\n\\n\t\t\tfloat pointDiffuseWeight = max( dotProduct, 0.0 );\\n\\n\t\t#endif\\n\\n\t\ttotalDiffuseLight += pointLightColor[ i ] * pointDiffuseWeight * attenuation;\\n\\n\t\t\t\t// specular\\n\\n\t\tvec3 pointHalfVector = normalize( lVector + viewPosition );\\n\t\tfloat pointDotNormalHalf = max( dot( normal, pointHalfVector ), 0.0 );\\n\t\tfloat pointSpecularWeight = specularStrength * max( pow( pointDotNormalHalf, shininess ), 0.0 );\\n\\n\t\tfloat specularNormalization = ( shininess + 2.0 ) / 8.0;\\n\\n\t\tvec3 schlick = specular + vec3( 1.0 - specular ) * pow( max( 1.0 - dot( lVector, pointHalfVector ), 0.0 ), 5.0 );\\n\t\ttotalSpecularLight += schlick * pointLightColor[ i ] * pointSpecularWeight * pointDiffuseWeight * attenuation * specularNormalization;\\n\\n\t}\\n\\n#endif\\n\\n#if MAX_SPOT_LIGHTS > 0\\n\\n\tfor ( int i = 0; i < MAX_SPOT_LIGHTS; i ++ ) {\\n\\n\t\tvec4 lPosition = viewMatrix * vec4( spotLightPosition[ i ], 1.0 );\\n\t\tvec3 lVector = lPosition.xyz + vViewPosition.xyz;\\n\\n\t\tfloat attenuation = calcLightAttenuation( length( lVector ), spotLightDistance[ i ], spotLightDecay[ i ] );\\n\\n\t\tlVector = normalize( lVector );\\n\\n\t\tfloat spotEffect = dot( spotLightDirection[ i ], normalize( spotLightPosition[ i ] - vWorldPosition ) );\\n\\n\t\tif ( spotEffect > spotLightAngleCos[ i ] ) {\\n\\n\t\t\tspotEffect = max( pow( max( spotEffect, 0.0 ), spotLightExponent[ i ] ), 0.0 );\\n\\n\t\t\t// diffuse\\n\\n\t\t\tfloat dotProduct = dot( normal, lVector );\\n\\n\t\t\t#ifdef WRAP_AROUND\\n\\n\t\t\t\tfloat spotDiffuseWeightFull = max( dotProduct, 0.0 );\\n\t\t\t\tfloat spotDiffuseWeightHalf = max( 0.5 * dotProduct + 0.5, 0.0 );\\n\\n\t\t\t\tvec3 spotDiffuseWeight = mix( vec3( spotDiffuseWeightFull ), vec3( spotDiffuseWeightHalf ), wrapRGB );\\n\\n\t\t\t#else\\n\\n\t\t\t\tfloat spotDiffuseWeight = max( dotProduct, 0.0 );\\n\\n\t\t\t#endif\\n\\n\t\t\ttotalDiffuseLight += spotLightColor[ i ] * spotDiffuseWeight * attenuation * spotEffect;\\n\\n\t\t\t// specular\\n\\n\t\t\tvec3 spotHalfVector = normalize( lVector + viewPosition );\\n\t\t\tfloat spotDotNormalHalf = max( dot( normal, spotHalfVector ), 0.0 );\\n\t\t\tfloat spotSpecularWeight = specularStrength * max( pow( spotDotNormalHalf, shininess ), 0.0 );\\n\\n\t\t\tfloat specularNormalization = ( shininess + 2.0 ) / 8.0;\\n\\n\t\t\tvec3 schlick = specular + vec3( 1.0 - specular ) * pow( max( 1.0 - dot( lVector, spotHalfVector ), 0.0 ), 5.0 );\\n\t\t\ttotalSpecularLight += schlick * spotLightColor[ i ] * spotSpecularWeight * spotDiffuseWeight * attenuation * specularNormalization * spotEffect;\\n\\n\t\t}\\n\\n\t}\\n\\n#endif\\n\\n#if MAX_DIR_LIGHTS > 0\\n\\n\tfor( int i = 0; i < MAX_DIR_LIGHTS; i ++ ) {\\n\\n\t\tvec3 dirVector = transformDirection( directionalLightDirection[ i ], viewMatrix );\\n\\n\t\t// diffuse\\n\\n\t\tfloat dotProduct = dot( normal, dirVector );\\n\\n\t\t#ifdef WRAP_AROUND\\n\\n\t\t\tfloat dirDiffuseWeightFull = max( dotProduct, 0.0 );\\n\t\t\tfloat dirDiffuseWeightHalf = max( 0.5 * dotProduct + 0.5, 0.0 );\\n\\n\t\t\tvec3 dirDiffuseWeight = mix( vec3( dirDiffuseWeightFull ), vec3( dirDiffuseWeightHalf ), wrapRGB );\\n\\n\t\t#else\\n\\n\t\t\tfloat dirDiffuseWeight = max( dotProduct, 0.0 );\\n\\n\t\t#endif\\n\\n\t\ttotalDiffuseLight += directionalLightColor[ i ] * dirDiffuseWeight;\\n\\n\t\t// specular\\n\\n\t\tvec3 dirHalfVector = normalize( dirVector + viewPosition );\\n\t\tfloat dirDotNormalHalf = max( dot( normal, dirHalfVector ), 0.0 );\\n\t\tfloat dirSpecularWeight = specularStrength * max( pow( dirDotNormalHalf, shininess ), 0.0 );\\n\\n\t\t/*\\n\t\t// fresnel term from skin shader\\n\t\tconst float F0 = 0.128;\\n\\n\t\tfloat base = 1.0 - dot( viewPosition, dirHalfVector );\\n\t\tfloat exponential = pow( base, 5.0 );\\n\\n\t\tfloat fresnel = exponential + F0 * ( 1.0 - exponential );\\n\t\t*/\\n\\n\t\t/*\\n\t\t// fresnel term from fresnel shader\\n\t\tconst float mFresnelBias = 0.08;\\n\t\tconst float mFresnelScale = 0.3;\\n\t\tconst float mFresnelPower = 5.0;\\n\\n\t\tfloat fresnel = mFresnelBias + mFresnelScale * pow( 1.0 + dot( normalize( -viewPosition ), normal ), mFresnelPower );\\n\t\t*/\\n\\n\t\tfloat specularNormalization = ( shininess + 2.0 ) / 8.0;\\n\\n\t\t// \t\tdirSpecular += specular * directionalLightColor[ i ] * dirSpecularWeight * dirDiffuseWeight * specularNormalization * fresnel;\\n\\n\t\tvec3 schlick = specular + vec3( 1.0 - specular ) * pow( max( 1.0 - dot( dirVector, dirHalfVector ), 0.0 ), 5.0 );\\n\t\ttotalSpecularLight += schlick * directionalLightColor[ i ] * dirSpecularWeight * dirDiffuseWeight * specularNormalization;\\n\\n\\n\t}\\n\\n#endif\\n\\n#if MAX_HEMI_LIGHTS > 0\\n\\n\tfor( int i = 0; i < MAX_HEMI_LIGHTS; i ++ ) {\\n\\n\t\tvec3 lVector = transformDirection( hemisphereLightDirection[ i ], viewMatrix );\\n\\n\t\t// diffuse\\n\\n\t\tfloat dotProduct = dot( normal, lVector );\\n\t\tfloat hemiDiffuseWeight = 0.5 * dotProduct + 0.5;\\n\\n\t\tvec3 hemiColor = mix( hemisphereLightGroundColor[ i ], hemisphereLightSkyColor[ i ], hemiDiffuseWeight );\\n\\n\t\ttotalDiffuseLight += hemiColor;\\n\\n\t\t// specular (sky light)\\n\\n\t\tvec3 hemiHalfVectorSky = normalize( lVector + viewPosition );\\n\t\tfloat hemiDotNormalHalfSky = 0.5 * dot( normal, hemiHalfVectorSky ) + 0.5;\\n\t\tfloat hemiSpecularWeightSky = specularStrength * max( pow( max( hemiDotNormalHalfSky, 0.0 ), shininess ), 0.0 );\\n\\n\t\t// specular (ground light)\\n\\n\t\tvec3 lVectorGround = -lVector;\\n\\n\t\tvec3 hemiHalfVectorGround = normalize( lVectorGround + viewPosition );\\n\t\tfloat hemiDotNormalHalfGround = 0.5 * dot( normal, hemiHalfVectorGround ) + 0.5;\\n\t\tfloat hemiSpecularWeightGround = specularStrength * max( pow( max( hemiDotNormalHalfGround, 0.0 ), shininess ), 0.0 );\\n\\n\t\tfloat dotProductGround = dot( normal, lVectorGround );\\n\\n\t\tfloat specularNormalization = ( shininess + 2.0 ) / 8.0;\\n\\n\t\tvec3 schlickSky = specular + vec3( 1.0 - specular ) * pow( max( 1.0 - dot( lVector, hemiHalfVectorSky ), 0.0 ), 5.0 );\\n\t\tvec3 schlickGround = specular + vec3( 1.0 - specular ) * pow( max( 1.0 - dot( lVectorGround, hemiHalfVectorGround ), 0.0 ), 5.0 );\\n\t\ttotalSpecularLight += hemiColor * specularNormalization * ( schlickSky * hemiSpecularWeightSky * max( dotProduct, 0.0 ) + schlickGround * hemiSpecularWeightGround * max( dotProductGround, 0.0 ) );\\n\\n\t}\\n\\n#endif\\n\\n#ifdef METAL\\n\\n\toutgoingLight += diffuseColor.rgb * ( totalDiffuseLight + ambientLightColor ) * specular + totalSpecularLight + emissive;\\n\\n#else\\n\\n\toutgoingLight += diffuseColor.rgb * ( totalDiffuseLight + ambientLightColor ) + totalSpecularLight + emissive;\\n\\n#endif\\n\";\r\n\r\n// File:src/renderers/shaders/ShaderChunk/fog_pars_fragment.glsl\r\n\r\nTHREE.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\";\r\n\r\n// File:src/renderers/shaders/ShaderChunk/morphnormal_vertex.glsl\r\n\r\nTHREE.ShaderChunk[ 'morphnormal_vertex'] = \"#ifdef USE_MORPHNORMALS\\n\\n\tvec3 morphedNormal = vec3( 0.0 );\\n\\n\tmorphedNormal += ( morphNormal0 - normal ) * morphTargetInfluences[ 0 ];\\n\tmorphedNormal += ( morphNormal1 - normal ) * morphTargetInfluences[ 1 ];\\n\tmorphedNormal += ( morphNormal2 - normal ) * morphTargetInfluences[ 2 ];\\n\tmorphedNormal += ( morphNormal3 - normal ) * morphTargetInfluences[ 3 ];\\n\\n\tmorphedNormal += normal;\\n\\n#endif\";\r\n\r\n// File:src/renderers/shaders/ShaderChunk/envmap_pars_fragment.glsl\r\n\r\nTHREE.ShaderChunk[ 'envmap_pars_fragment'] = \"#ifdef USE_ENVMAP\\n\\n\tuniform float reflectivity;\\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 )\\n\\n\t\tuniform float refractionRatio;\\n\\n\t#else\\n\\n\t\tvarying vec3 vReflect;\\n\\n\t#endif\\n\\n#endif\\n\";\r\n\r\n// File:src/renderers/shaders/ShaderChunk/logdepthbuf_fragment.glsl\r\n\r\nTHREE.ShaderChunk[ 'logdepthbuf_fragment'] = \"#if defined(USE_LOGDEPTHBUF) && defined(USE_LOGDEPTHBUF_EXT)\\n\\n\tgl_FragDepthEXT = log2(vFragDepth) * logDepthBufFC * 0.5;\\n\\n#endif\";\r\n\r\n// File:src/renderers/shaders/ShaderChunk/normalmap_pars_fragment.glsl\r\n\r\nTHREE.ShaderChunk[ 'normalmap_pars_fragment'] = \"#ifdef USE_NORMALMAP\\n\\n\tuniform sampler2D normalMap;\\n\tuniform vec2 normalScale;\\n\\n\t// Per-Pixel Tangent Space Normal Mapping\\n\t// http://hacksoflife.blogspot.ch/2009/11/per-pixel-tangent-space-normal-mapping.html\\n\\n\tvec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm ) {\\n\\n\t\tvec3 q0 = dFdx( eye_pos.xyz );\\n\t\tvec3 q1 = dFdy( eye_pos.xyz );\\n\t\tvec2 st0 = dFdx( vUv.st );\\n\t\tvec2 st1 = dFdy( vUv.st );\\n\\n\t\tvec3 S = normalize( q0 * st1.t - q1 * st0.t );\\n\t\tvec3 T = normalize( -q0 * st1.s + q1 * st0.s );\\n\t\tvec3 N = normalize( surf_norm );\\n\\n\t\tvec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\\n\t\tmapN.xy = normalScale * mapN.xy;\\n\t\tmat3 tsn = mat3( S, T, N );\\n\t\treturn normalize( tsn * mapN );\\n\\n\t}\\n\\n#endif\\n\";\r\n\r\n// File:src/renderers/shaders/ShaderChunk/lights_phong_pars_vertex.glsl\r\n\r\nTHREE.ShaderChunk[ 'lights_phong_pars_vertex'] = \"#if MAX_SPOT_LIGHTS > 0 || defined( USE_BUMPMAP ) || defined( USE_ENVMAP )\\n\\n\tvarying vec3 vWorldPosition;\\n\\n#endif\\n\";\r\n\r\n// File:src/renderers/shaders/ShaderChunk/lightmap_pars_fragment.glsl\r\n\r\nTHREE.ShaderChunk[ 'lightmap_pars_fragment'] = \"#ifdef USE_LIGHTMAP\\n\\n\tvarying vec2 vUv2;\\n\tuniform sampler2D lightMap;\\n\\n#endif\";\r\n\r\n// File:src/renderers/shaders/ShaderChunk/shadowmap_vertex.glsl\r\n\r\nTHREE.ShaderChunk[ 'shadowmap_vertex'] = \"#ifdef USE_SHADOWMAP\\n\\n\tfor( int i = 0; i < MAX_SHADOWS; i ++ ) {\\n\\n\t\tvShadowCoord[ i ] = shadowMatrix[ i ] * worldPosition;\\n\\n\t}\\n\\n#endif\";\r\n\r\n// File:src/renderers/shaders/ShaderChunk/lights_phong_vertex.glsl\r\n\r\nTHREE.ShaderChunk[ 'lights_phong_vertex'] = \"#if MAX_SPOT_LIGHTS > 0 || defined( USE_BUMPMAP ) || defined( USE_ENVMAP )\\n\\n\tvWorldPosition = worldPosition.xyz;\\n\\n#endif\";\r\n\r\n// File:src/renderers/shaders/ShaderChunk/map_fragment.glsl\r\n\r\nTHREE.ShaderChunk[ 'map_fragment'] = \"#ifdef USE_MAP\\n\\n\tvec4 texelColor = texture2D( map, vUv );\\n\\n\ttexelColor.xyz = inputToLinear( texelColor.xyz );\\n\\n\tdiffuseColor *= texelColor;\\n\\n#endif\";\r\n\r\n// File:src/renderers/shaders/ShaderChunk/lightmap_vertex.glsl\r\n\r\nTHREE.ShaderChunk[ 'lightmap_vertex'] = \"#ifdef USE_LIGHTMAP\\n\\n\tvUv2 = uv2;\\n\\n#endif\";\r\n\r\n// File:src/renderers/shaders/ShaderChunk/map_particle_fragment.glsl\r\n\r\nTHREE.ShaderChunk[ 'map_particle_fragment'] = \"#ifdef USE_MAP\\n\\n\tdiffuseColor *= texture2D( map, vec2( gl_PointCoord.x, 1.0 - gl_PointCoord.y ) * offsetRepeat.zw + offsetRepeat.xy );\\n\\n#endif\\n\";\r\n\r\n// File:src/renderers/shaders/ShaderChunk/color_pars_fragment.glsl\r\n\r\nTHREE.ShaderChunk[ 'color_pars_fragment'] = \"#ifdef USE_COLOR\\n\\n\tvarying vec3 vColor;\\n\\n#endif\\n\";\r\n\r\n// File:src/renderers/shaders/ShaderChunk/color_vertex.glsl\r\n\r\nTHREE.ShaderChunk[ 'color_vertex'] = \"#ifdef USE_COLOR\\n\\n\tvColor.xyz = inputToLinear( color.xyz );\\n\\n#endif\";\r\n\r\n// File:src/renderers/shaders/ShaderChunk/skinning_vertex.glsl\r\n\r\nTHREE.ShaderChunk[ 'skinning_vertex'] = \"#ifdef USE_SKINNING\\n\\n\t#ifdef USE_MORPHTARGETS\\n\\n\tvec4 skinVertex = bindMatrix * vec4( morphed, 1.0 );\\n\\n\t#else\\n\\n\tvec4 skinVertex = bindMatrix * vec4( position, 1.0 );\\n\\n\t#endif\\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\";\r\n\r\n// File:src/renderers/shaders/ShaderChunk/envmap_pars_vertex.glsl\r\n\r\nTHREE.ShaderChunk[ 'envmap_pars_vertex'] = \"#if defined( USE_ENVMAP ) && ! defined( USE_BUMPMAP ) && ! defined( USE_NORMALMAP ) && ! defined( PHONG )\\n\\n\tvarying vec3 vReflect;\\n\\n\tuniform float refractionRatio;\\n\\n#endif\\n\";\r\n\r\n// File:src/renderers/shaders/ShaderChunk/linear_to_gamma_fragment.glsl\r\n\r\nTHREE.ShaderChunk[ 'linear_to_gamma_fragment'] = \"\\n\toutgoingLight = linearToOutput( outgoingLight );\\n\";\r\n\r\n// File:src/renderers/shaders/ShaderChunk/color_pars_vertex.glsl\r\n\r\nTHREE.ShaderChunk[ 'color_pars_vertex'] = \"#ifdef USE_COLOR\\n\\n\tvarying vec3 vColor;\\n\\n#endif\";\r\n\r\n// File:src/renderers/shaders/ShaderChunk/lights_lambert_pars_vertex.glsl\r\n\r\nTHREE.ShaderChunk[ 'lights_lambert_pars_vertex'] = \"uniform vec3 ambientLightColor;\\n\\n#if MAX_DIR_LIGHTS > 0\\n\\n\tuniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];\\n\tuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\\n\\n#endif\\n\\n#if MAX_HEMI_LIGHTS > 0\\n\\n\tuniform vec3 hemisphereLightSkyColor[ MAX_HEMI_LIGHTS ];\\n\tuniform vec3 hemisphereLightGroundColor[ MAX_HEMI_LIGHTS ];\\n\tuniform vec3 hemisphereLightDirection[ MAX_HEMI_LIGHTS ];\\n\\n#endif\\n\\n#if MAX_POINT_LIGHTS > 0\\n\\n\tuniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];\\n\tuniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\\n\tuniform float pointLightDistance[ MAX_POINT_LIGHTS ];\\n\tuniform float pointLightDecay[ MAX_POINT_LIGHTS ];\\n\\n#endif\\n\\n#if MAX_SPOT_LIGHTS > 0\\n\\n\tuniform vec3 spotLightColor[ MAX_SPOT_LIGHTS ];\\n\tuniform vec3 spotLightPosition[ MAX_SPOT_LIGHTS ];\\n\tuniform vec3 spotLightDirection[ MAX_SPOT_LIGHTS ];\\n\tuniform float spotLightDistance[ MAX_SPOT_LIGHTS ];\\n\tuniform float spotLightAngleCos[ MAX_SPOT_LIGHTS ];\\n\tuniform float spotLightExponent[ MAX_SPOT_LIGHTS ];\\n\tuniform float spotLightDecay[ MAX_SPOT_LIGHTS ];\\n\\n#endif\\n\\n#ifdef WRAP_AROUND\\n\\n\tuniform vec3 wrapRGB;\\n\\n#endif\\n\";\r\n\r\n// File:src/renderers/shaders/ShaderChunk/map_pars_vertex.glsl\r\n\r\nTHREE.ShaderChunk[ 'map_pars_vertex'] = \"#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP )\\n\\n\tvarying vec2 vUv;\\n\tuniform vec4 offsetRepeat;\\n\\n#endif\\n\";\r\n\r\n// File:src/renderers/shaders/ShaderChunk/envmap_fragment.glsl\r\n\r\nTHREE.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 = ( -1.0 + 2.0 * float( gl_FrontFacing ) );\\n\t#else\\n\t\tfloat flipNormal = 1.0;\\n\t#endif\\n\\n\t#ifdef ENVMAP_TYPE_CUBE\\n\t\tvec4 envColor = textureCube( envMap, flipNormal * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\\n\\n\t#elif defined( ENVMAP_TYPE_EQUIREC )\\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\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\t#endif\\n\\n\tenvColor.xyz = inputToLinear( envColor.xyz );\\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\";\r\n\r\n// File:src/renderers/shaders/ShaderChunk/specularmap_pars_fragment.glsl\r\n\r\nTHREE.ShaderChunk[ 'specularmap_pars_fragment'] = \"#ifdef USE_SPECULARMAP\\n\\n\tuniform sampler2D specularMap;\\n\\n#endif\";\r\n\r\n// File:src/renderers/shaders/ShaderChunk/logdepthbuf_vertex.glsl\r\n\r\nTHREE.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#else\\n\\n\t\tgl_Position.z = (gl_Position.z - 1.0) * gl_Position.w;\\n\\n\t#endif\\n\\n#endif\";\r\n\r\n// File:src/renderers/shaders/ShaderChunk/morphtarget_pars_vertex.glsl\r\n\r\nTHREE.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\";\r\n\r\n// File:src/renderers/shaders/ShaderChunk/specularmap_fragment.glsl\r\n\r\nTHREE.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\";\r\n\r\n// File:src/renderers/shaders/ShaderChunk/fog_fragment.glsl\r\n\r\nTHREE.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 = exp2( - square( fogDensity ) * square( depth ) * LOG2 );\\n\t\tfogFactor = whiteCompliment( fogFactor );\\n\\n\t#else\\n\\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, depth );\\n\\n\t#endif\\n\t\\n\toutgoingLight = mix( outgoingLight, fogColor, fogFactor );\\n\\n#endif\";\r\n\r\n// File:src/renderers/shaders/ShaderChunk/bumpmap_pars_fragment.glsl\r\n\r\nTHREE.ShaderChunk[ 'bumpmap_pars_fragment'] = \"#ifdef USE_BUMPMAP\\n\\n\tuniform sampler2D bumpMap;\\n\tuniform float bumpScale;\\n\\n\t// Derivative maps - bump mapping unparametrized surfaces by Morten Mikkelsen\\n\t// http://mmikkelsen3d.blogspot.sk/2011/07/derivative-maps.html\\n\\n\t// Evaluate the derivative of the height w.r.t. screen-space using forward differencing (listing 2)\\n\\n\tvec2 dHdxy_fwd() {\\n\\n\t\tvec2 dSTdx = dFdx( vUv );\\n\t\tvec2 dSTdy = dFdy( vUv );\\n\\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vUv ).x;\\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;\\n\\n\t\treturn vec2( dBx, dBy );\\n\\n\t}\\n\\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy ) {\\n\\n\t\tvec3 vSigmaX = dFdx( surf_pos );\\n\t\tvec3 vSigmaY = dFdy( surf_pos );\\n\t\tvec3 vN = surf_norm;\t\t// normalized\\n\\n\t\tvec3 R1 = cross( vSigmaY, vN );\\n\t\tvec3 R2 = cross( vN, vSigmaX );\\n\\n\t\tfloat fDet = dot( vSigmaX, R1 );\\n\\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\\n\\n\t}\\n\\n#endif\\n\";\r\n\r\n// File:src/renderers/shaders/ShaderChunk/defaultnormal_vertex.glsl\r\n\r\nTHREE.ShaderChunk[ 'defaultnormal_vertex'] = \"#ifdef USE_SKINNING\\n\\n\tvec3 objectNormal = skinnedNormal.xyz;\\n\\n#elif defined( USE_MORPHNORMALS )\\n\\n\tvec3 objectNormal = morphedNormal;\\n\\n#else\\n\\n\tvec3 objectNormal = normal;\\n\\n#endif\\n\\n#ifdef FLIP_SIDED\\n\\n\tobjectNormal = -objectNormal;\\n\\n#endif\\n\\nvec3 transformedNormal = normalMatrix * objectNormal;\\n\";\r\n\r\n// File:src/renderers/shaders/ShaderChunk/lights_phong_pars_fragment.glsl\r\n\r\nTHREE.ShaderChunk[ 'lights_phong_pars_fragment'] = \"uniform vec3 ambientLightColor;\\n\\n#if MAX_DIR_LIGHTS > 0\\n\\n\tuniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];\\n\tuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\\n\\n#endif\\n\\n#if MAX_HEMI_LIGHTS > 0\\n\\n\tuniform vec3 hemisphereLightSkyColor[ MAX_HEMI_LIGHTS ];\\n\tuniform vec3 hemisphereLightGroundColor[ MAX_HEMI_LIGHTS ];\\n\tuniform vec3 hemisphereLightDirection[ MAX_HEMI_LIGHTS ];\\n\\n#endif\\n\\n#if MAX_POINT_LIGHTS > 0\\n\\n\tuniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];\\n\\n\tuniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\\n\tuniform float pointLightDistance[ MAX_POINT_LIGHTS ];\\n\tuniform float pointLightDecay[ MAX_POINT_LIGHTS ];\\n\\n#endif\\n\\n#if MAX_SPOT_LIGHTS > 0\\n\\n\tuniform vec3 spotLightColor[ MAX_SPOT_LIGHTS ];\\n\tuniform vec3 spotLightPosition[ MAX_SPOT_LIGHTS ];\\n\tuniform vec3 spotLightDirection[ MAX_SPOT_LIGHTS ];\\n\tuniform float spotLightAngleCos[ MAX_SPOT_LIGHTS ];\\n\tuniform float spotLightExponent[ MAX_SPOT_LIGHTS ];\\n\tuniform float spotLightDistance[ MAX_SPOT_LIGHTS ];\\n\tuniform float spotLightDecay[ MAX_SPOT_LIGHTS ];\\n\\n#endif\\n\\n#if MAX_SPOT_LIGHTS > 0 || defined( USE_BUMPMAP ) || defined( USE_ENVMAP )\\n\\n\tvarying vec3 vWorldPosition;\\n\\n#endif\\n\\n#ifdef WRAP_AROUND\\n\\n\tuniform vec3 wrapRGB;\\n\\n#endif\\n\\nvarying vec3 vViewPosition;\\n\\n#ifndef FLAT_SHADED\\n\\n\tvarying vec3 vNormal;\\n\\n#endif\\n\";\r\n\r\n// File:src/renderers/shaders/ShaderChunk/skinbase_vertex.glsl\r\n\r\nTHREE.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\";\r\n\r\n// File:src/renderers/shaders/ShaderChunk/map_vertex.glsl\r\n\r\nTHREE.ShaderChunk[ 'map_vertex'] = \"#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP )\\n\\n\tvUv = uv * offsetRepeat.zw + offsetRepeat.xy;\\n\\n#endif\";\r\n\r\n// File:src/renderers/shaders/ShaderChunk/lightmap_fragment.glsl\r\n\r\nTHREE.ShaderChunk[ 'lightmap_fragment'] = \"#ifdef USE_LIGHTMAP\\n\\n\toutgoingLight *= diffuseColor.xyz * texture2D( lightMap, vUv2 ).xyz;\\n\\n#endif\";\r\n\r\n// File:src/renderers/shaders/ShaderChunk/shadowmap_pars_vertex.glsl\r\n\r\nTHREE.ShaderChunk[ 'shadowmap_pars_vertex'] = \"#ifdef USE_SHADOWMAP\\n\\n\tvarying vec4 vShadowCoord[ MAX_SHADOWS ];\\n\tuniform mat4 shadowMatrix[ MAX_SHADOWS ];\\n\\n#endif\";\r\n\r\n// File:src/renderers/shaders/ShaderChunk/color_fragment.glsl\r\n\r\nTHREE.ShaderChunk[ 'color_fragment'] = \"#ifdef USE_COLOR\\n\\n\tdiffuseColor.rgb *= vColor;\\n\\n#endif\";\r\n\r\n// File:src/renderers/shaders/ShaderChunk/morphtarget_vertex.glsl\r\n\r\nTHREE.ShaderChunk[ 'morphtarget_vertex'] = \"#ifdef USE_MORPHTARGETS\\n\\n\tvec3 morphed = vec3( 0.0 );\\n\tmorphed += ( morphTarget0 - position ) * morphTargetInfluences[ 0 ];\\n\tmorphed += ( morphTarget1 - position ) * morphTargetInfluences[ 1 ];\\n\tmorphed += ( morphTarget2 - position ) * morphTargetInfluences[ 2 ];\\n\tmorphed += ( morphTarget3 - position ) * morphTargetInfluences[ 3 ];\\n\\n\t#ifndef USE_MORPHNORMALS\\n\\n\tmorphed += ( morphTarget4 - position ) * morphTargetInfluences[ 4 ];\\n\tmorphed += ( morphTarget5 - position ) * morphTargetInfluences[ 5 ];\\n\tmorphed += ( morphTarget6 - position ) * morphTargetInfluences[ 6 ];\\n\tmorphed += ( morphTarget7 - position ) * morphTargetInfluences[ 7 ];\\n\\n\t#endif\\n\\n\tmorphed += position;\\n\\n#endif\";\r\n\r\n// File:src/renderers/shaders/ShaderChunk/envmap_vertex.glsl\r\n\r\nTHREE.ShaderChunk[ 'envmap_vertex'] = \"#if defined( USE_ENVMAP ) && ! defined( USE_BUMPMAP ) && ! defined( USE_NORMALMAP ) && ! defined( PHONG )\\n\\n\tvec3 worldNormal = transformDirection( objectNormal, modelMatrix );\\n\\n\tvec3 cameraToVertex = normalize( worldPosition.xyz - cameraPosition );\\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\";\r\n\r\n// File:src/renderers/shaders/ShaderChunk/shadowmap_fragment.glsl\r\n\r\nTHREE.ShaderChunk[ 'shadowmap_fragment'] = \"#ifdef USE_SHADOWMAP\\n\\n\t#ifdef SHADOWMAP_DEBUG\\n\\n\t\tvec3 frustumColors[3];\\n\t\tfrustumColors[0] = vec3( 1.0, 0.5, 0.0 );\\n\t\tfrustumColors[1] = vec3( 0.0, 1.0, 0.8 );\\n\t\tfrustumColors[2] = vec3( 0.0, 0.5, 1.0 );\\n\\n\t#endif\\n\\n\t#ifdef SHADOWMAP_CASCADE\\n\\n\t\tint inFrustumCount = 0;\\n\\n\t#endif\\n\\n\tfloat fDepth;\\n\tvec3 shadowColor = vec3( 1.0 );\\n\\n\tfor( int i = 0; i < MAX_SHADOWS; i ++ ) {\\n\\n\t\tvec3 shadowCoord = vShadowCoord[ i ].xyz / vShadowCoord[ i ].w;\\n\\n\t\t\t\t// if ( something && something ) breaks ATI OpenGL shader compiler\\n\t\t\t\t// if ( all( something, something ) ) using this instead\\n\\n\t\tbvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\\n\t\tbool inFrustum = all( inFrustumVec );\\n\\n\t\t\t\t// don't shadow pixels outside of light frustum\\n\t\t\t\t// use just first frustum (for cascades)\\n\t\t\t\t// don't shadow pixels behind far plane of light frustum\\n\\n\t\t#ifdef SHADOWMAP_CASCADE\\n\\n\t\t\tinFrustumCount += int( inFrustum );\\n\t\t\tbvec3 frustumTestVec = bvec3( inFrustum, inFrustumCount == 1, shadowCoord.z <= 1.0 );\\n\\n\t\t#else\\n\\n\t\t\tbvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\\n\\n\t\t#endif\\n\\n\t\tbool frustumTest = all( frustumTestVec );\\n\\n\t\tif ( frustumTest ) {\\n\\n\t\t\tshadowCoord.z += shadowBias[ i ];\\n\\n\t\t\t#if defined( SHADOWMAP_TYPE_PCF )\\n\\n\t\t\t\t\t\t// Percentage-close filtering\\n\t\t\t\t\t\t// (9 pixel kernel)\\n\t\t\t\t\t\t// http://fabiensanglard.net/shadowmappingPCF/\\n\\n\t\t\t\tfloat shadow = 0.0;\\n\\n\t\t/*\\n\t\t\t\t\t\t// nested loops breaks shader compiler / validator on some ATI cards when using OpenGL\\n\t\t\t\t\t\t// must enroll loop manually\\n\\n\t\t\t\tfor ( float y = -1.25; y <= 1.25; y += 1.25 )\\n\t\t\t\t\tfor ( float x = -1.25; x <= 1.25; x += 1.25 ) {\\n\\n\t\t\t\t\t\tvec4 rgbaDepth = texture2D( shadowMap[ i ], vec2( x * xPixelOffset, y * yPixelOffset ) + shadowCoord.xy );\\n\\n\t\t\t\t\t\t\t\t// doesn't seem to produce any noticeable visual difference compared to simple texture2D lookup\\n\t\t\t\t\t\t\t\t//vec4 rgbaDepth = texture2DProj( shadowMap[ i ], vec4( vShadowCoord[ i ].w * ( vec2( x * xPixelOffset, y * yPixelOffset ) + shadowCoord.xy ), 0.05, vShadowCoord[ i ].w ) );\\n\\n\t\t\t\t\t\tfloat fDepth = unpackDepth( rgbaDepth );\\n\\n\t\t\t\t\t\tif ( fDepth < shadowCoord.z )\\n\t\t\t\t\t\t\tshadow += 1.0;\\n\\n\t\t\t\t}\\n\\n\t\t\t\tshadow /= 9.0;\\n\\n\t\t*/\\n\\n\t\t\t\tconst float shadowDelta = 1.0 / 9.0;\\n\\n\t\t\t\tfloat xPixelOffset = 1.0 / shadowMapSize[ i ].x;\\n\t\t\t\tfloat yPixelOffset = 1.0 / shadowMapSize[ i ].y;\\n\\n\t\t\t\tfloat dx0 = -1.25 * xPixelOffset;\\n\t\t\t\tfloat dy0 = -1.25 * yPixelOffset;\\n\t\t\t\tfloat dx1 = 1.25 * xPixelOffset;\\n\t\t\t\tfloat dy1 = 1.25 * yPixelOffset;\\n\\n\t\t\t\tfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, dy0 ) ) );\\n\t\t\t\tif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\\n\\n\t\t\t\tfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( 0.0, dy0 ) ) );\\n\t\t\t\tif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\\n\\n\t\t\t\tfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, dy0 ) ) );\\n\t\t\t\tif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\\n\\n\t\t\t\tfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, 0.0 ) ) );\\n\t\t\t\tif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\\n\\n\t\t\t\tfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy ) );\\n\t\t\t\tif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\\n\\n\t\t\t\tfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, 0.0 ) ) );\\n\t\t\t\tif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\\n\\n\t\t\t\tfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, dy1 ) ) );\\n\t\t\t\tif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\\n\\n\t\t\t\tfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( 0.0, dy1 ) ) );\\n\t\t\t\tif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\\n\\n\t\t\t\tfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, dy1 ) ) );\\n\t\t\t\tif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\\n\\n\t\t\t\tshadowColor = shadowColor * vec3( ( 1.0 - shadowDarkness[ i ] * shadow ) );\\n\\n\t\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\\n\\n\t\t\t\t\t\t// Percentage-close filtering\\n\t\t\t\t\t\t// (9 pixel kernel)\\n\t\t\t\t\t\t// http://fabiensanglard.net/shadowmappingPCF/\\n\\n\t\t\t\tfloat shadow = 0.0;\\n\\n\t\t\t\tfloat xPixelOffset = 1.0 / shadowMapSize[ i ].x;\\n\t\t\t\tfloat yPixelOffset = 1.0 / shadowMapSize[ i ].y;\\n\\n\t\t\t\tfloat dx0 = -1.0 * xPixelOffset;\\n\t\t\t\tfloat dy0 = -1.0 * yPixelOffset;\\n\t\t\t\tfloat dx1 = 1.0 * xPixelOffset;\\n\t\t\t\tfloat dy1 = 1.0 * yPixelOffset;\\n\\n\t\t\t\tmat3 shadowKernel;\\n\t\t\t\tmat3 depthKernel;\\n\\n\t\t\t\tdepthKernel[0][0] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, dy0 ) ) );\\n\t\t\t\tdepthKernel[0][1] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, 0.0 ) ) );\\n\t\t\t\tdepthKernel[0][2] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, dy1 ) ) );\\n\t\t\t\tdepthKernel[1][0] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( 0.0, dy0 ) ) );\\n\t\t\t\tdepthKernel[1][1] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy ) );\\n\t\t\t\tdepthKernel[1][2] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( 0.0, dy1 ) ) );\\n\t\t\t\tdepthKernel[2][0] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, dy0 ) ) );\\n\t\t\t\tdepthKernel[2][1] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, 0.0 ) ) );\\n\t\t\t\tdepthKernel[2][2] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, dy1 ) ) );\\n\\n\t\t\t\tvec3 shadowZ = vec3( shadowCoord.z );\\n\t\t\t\tshadowKernel[0] = vec3(lessThan(depthKernel[0], shadowZ ));\\n\t\t\t\tshadowKernel[0] *= vec3(0.25);\\n\\n\t\t\t\tshadowKernel[1] = vec3(lessThan(depthKernel[1], shadowZ ));\\n\t\t\t\tshadowKernel[1] *= vec3(0.25);\\n\\n\t\t\t\tshadowKernel[2] = vec3(lessThan(depthKernel[2], shadowZ ));\\n\t\t\t\tshadowKernel[2] *= vec3(0.25);\\n\\n\t\t\t\tvec2 fractionalCoord = 1.0 - fract( shadowCoord.xy * shadowMapSize[i].xy );\\n\\n\t\t\t\tshadowKernel[0] = mix( shadowKernel[1], shadowKernel[0], fractionalCoord.x );\\n\t\t\t\tshadowKernel[1] = mix( shadowKernel[2], shadowKernel[1], fractionalCoord.x );\\n\\n\t\t\t\tvec4 shadowValues;\\n\t\t\t\tshadowValues.x = mix( shadowKernel[0][1], shadowKernel[0][0], fractionalCoord.y );\\n\t\t\t\tshadowValues.y = mix( shadowKernel[0][2], shadowKernel[0][1], fractionalCoord.y );\\n\t\t\t\tshadowValues.z = mix( shadowKernel[1][1], shadowKernel[1][0], fractionalCoord.y );\\n\t\t\t\tshadowValues.w = mix( shadowKernel[1][2], shadowKernel[1][1], fractionalCoord.y );\\n\\n\t\t\t\tshadow = dot( shadowValues, vec4( 1.0 ) );\\n\\n\t\t\t\tshadowColor = shadowColor * vec3( ( 1.0 - shadowDarkness[ i ] * shadow ) );\\n\\n\t\t\t#else\\n\\n\t\t\t\tvec4 rgbaDepth = texture2D( shadowMap[ i ], shadowCoord.xy );\\n\t\t\t\tfloat fDepth = unpackDepth( rgbaDepth );\\n\\n\t\t\t\tif ( fDepth < shadowCoord.z )\\n\\n\t\t// spot with multiple shadows is darker\\n\\n\t\t\t\t\tshadowColor = shadowColor * vec3( 1.0 - shadowDarkness[ i ] );\\n\\n\t\t// spot with multiple shadows has the same color as single shadow spot\\n\\n\t\t// \t\t\t\t\tshadowColor = min( shadowColor, vec3( shadowDarkness[ i ] ) );\\n\\n\t\t\t#endif\\n\\n\t\t}\\n\\n\\n\t\t#ifdef SHADOWMAP_DEBUG\\n\\n\t\t\t#ifdef SHADOWMAP_CASCADE\\n\\n\t\t\t\tif ( inFrustum && inFrustumCount == 1 ) outgoingLight *= frustumColors[ i ];\\n\\n\t\t\t#else\\n\\n\t\t\t\tif ( inFrustum ) outgoingLight *= frustumColors[ i ];\\n\\n\t\t\t#endif\\n\\n\t\t#endif\\n\\n\t}\\n\\n\t// NOTE: I am unsure if this is correct in linear space. -bhouston, Dec 29, 2014\\n\tshadowColor = inputToLinear( shadowColor );\\n\\n\toutgoingLight = outgoingLight * shadowColor;\\n\\n#endif\\n\";\r\n\r\n// File:src/renderers/shaders/ShaderChunk/worldpos_vertex.glsl\r\n\r\nTHREE.ShaderChunk[ 'worldpos_vertex'] = \"#if defined( USE_ENVMAP ) || defined( PHONG ) || defined( LAMBERT ) || defined ( USE_SHADOWMAP )\\n\\n\t#ifdef USE_SKINNING\\n\\n\t\tvec4 worldPosition = modelMatrix * skinned;\\n\\n\t#elif defined( USE_MORPHTARGETS )\\n\\n\t\tvec4 worldPosition = modelMatrix * vec4( morphed, 1.0 );\\n\\n\t#else\\n\\n\t\tvec4 worldPosition = modelMatrix * vec4( position, 1.0 );\\n\\n\t#endif\\n\\n#endif\\n\";\r\n\r\n// File:src/renderers/shaders/ShaderChunk/shadowmap_pars_fragment.glsl\r\n\r\nTHREE.ShaderChunk[ 'shadowmap_pars_fragment'] = \"#ifdef USE_SHADOWMAP\\n\\n\tuniform sampler2D shadowMap[ MAX_SHADOWS ];\\n\tuniform vec2 shadowMapSize[ MAX_SHADOWS ];\\n\\n\tuniform float shadowDarkness[ MAX_SHADOWS ];\\n\tuniform float shadowBias[ MAX_SHADOWS ];\\n\\n\tvarying vec4 vShadowCoord[ MAX_SHADOWS ];\\n\\n\tfloat unpackDepth( const in vec4 rgba_depth ) {\\n\\n\t\tconst vec4 bit_shift = vec4( 1.0 / ( 256.0 * 256.0 * 256.0 ), 1.0 / ( 256.0 * 256.0 ), 1.0 / 256.0, 1.0 );\\n\t\tfloat depth = dot( rgba_depth, bit_shift );\\n\t\treturn depth;\\n\\n\t}\\n\\n#endif\";\r\n\r\n// File:src/renderers/shaders/ShaderChunk/skinning_pars_vertex.glsl\r\n\r\nTHREE.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\";\r\n\r\n// File:src/renderers/shaders/ShaderChunk/logdepthbuf_pars_fragment.glsl\r\n\r\nTHREE.ShaderChunk[ 'logdepthbuf_pars_fragment'] = \"#ifdef USE_LOGDEPTHBUF\\n\\n\tuniform float logDepthBufFC;\\n\\n\t#ifdef USE_LOGDEPTHBUF_EXT\\n\\n\t\t#extension GL_EXT_frag_depth : enable\\n\t\tvarying float vFragDepth;\\n\\n\t#endif\\n\\n#endif\";\r\n\r\n// File:src/renderers/shaders/ShaderChunk/alphamap_fragment.glsl\r\n\r\nTHREE.ShaderChunk[ 'alphamap_fragment'] = \"#ifdef USE_ALPHAMAP\\n\\n\tdiffuseColor.a *= texture2D( alphaMap, vUv ).g;\\n\\n#endif\\n\";\r\n\r\n// File:src/renderers/shaders/ShaderChunk/alphamap_pars_fragment.glsl\r\n\r\nTHREE.ShaderChunk[ 'alphamap_pars_fragment'] = \"#ifdef USE_ALPHAMAP\\n\\n\tuniform sampler2D alphaMap;\\n\\n#endif\\n\";\r\n\r\n// File:src/renderers/shaders/UniformsUtils.js\r\n\r\n/**\r\n * Uniform Utilities\r\n */\r\n\r\nTHREE.UniformsUtils = {\r\n\r\n\tmerge: function ( uniforms ) {\r\n\r\n\t\tvar merged = {};\r\n\r\n\t\tfor ( var u = 0; u < uniforms.length; u ++ ) {\r\n\r\n\t\t\tvar tmp = this.clone( uniforms[ u ] );\r\n\r\n\t\t\tfor ( var p in tmp ) {\r\n\r\n\t\t\t\tmerged[ p ] = tmp[ p ];\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn merged;\r\n\r\n\t},\r\n\r\n\tclone: function ( uniforms_src ) {\r\n\r\n\t\tvar uniforms_dst = {};\r\n\r\n\t\tfor ( var u in uniforms_src ) {\r\n\r\n\t\t\tuniforms_dst[ u ] = {};\r\n\r\n\t\t\tfor ( var p in uniforms_src[ u ] ) {\r\n\r\n\t\t\t\tvar parameter_src = uniforms_src[ u ][ p ];\r\n\r\n\t\t\t\tif ( parameter_src instanceof THREE.Color ||\r\n\t\t\t\t\t parameter_src instanceof THREE.Vector2 ||\r\n\t\t\t\t\t parameter_src instanceof THREE.Vector3 ||\r\n\t\t\t\t\t parameter_src instanceof THREE.Vector4 ||\r\n\t\t\t\t\t parameter_src instanceof THREE.Matrix4 ||\r\n\t\t\t\t\t parameter_src instanceof THREE.Texture ) {\r\n\r\n\t\t\t\t\tuniforms_dst[ u ][ p ] = parameter_src.clone();\r\n\r\n\t\t\t\t} else if ( parameter_src instanceof Array ) {\r\n\r\n\t\t\t\t\tuniforms_dst[ u ][ p ] = parameter_src.slice();\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\tuniforms_dst[ u ][ p ] = parameter_src;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn uniforms_dst;\r\n\r\n\t}\r\n\r\n};\r\n\r\n// File:src/renderers/shaders/UniformsLib.js\r\n\r\n/**\r\n * Uniforms library for shared webgl shaders\r\n */\r\n\r\nTHREE.UniformsLib = {\r\n\r\n\tcommon: {\r\n\r\n\t\t\"diffuse\" : { type: \"c\", value: new THREE.Color( 0xeeeeee ) },\r\n\t\t\"opacity\" : { type: \"f\", value: 1.0 },\r\n\r\n\t\t\"map\" : { type: \"t\", value: null },\r\n\t\t\"offsetRepeat\" : { type: \"v4\", value: new THREE.Vector4( 0, 0, 1, 1 ) },\r\n\r\n\t\t\"lightMap\" : { type: \"t\", value: null },\r\n\t\t\"specularMap\" : { type: \"t\", value: null },\r\n\t\t\"alphaMap\" : { type: \"t\", value: null },\r\n\r\n\t\t\"envMap\" : { type: \"t\", value: null },\r\n\t\t\"flipEnvMap\" : { type: \"f\", value: - 1 },\r\n\t\t\"reflectivity\" : { type: \"f\", value: 1.0 },\r\n\t\t\"refractionRatio\" : { type: \"f\", value: 0.98 },\r\n\r\n\t\t\"morphTargetInfluences\" : { type: \"f\", value: 0 }\r\n\r\n\t},\r\n\r\n\tbump: {\r\n\r\n\t\t\"bumpMap\" : { type: \"t\", value: null },\r\n\t\t\"bumpScale\" : { type: \"f\", value: 1 }\r\n\r\n\t},\r\n\r\n\tnormalmap: {\r\n\r\n\t\t\"normalMap\" : { type: \"t\", value: null },\r\n\t\t\"normalScale\" : { type: \"v2\", value: new THREE.Vector2( 1, 1 ) }\r\n\t},\r\n\r\n\tfog : {\r\n\r\n\t\t\"fogDensity\" : { type: \"f\", value: 0.00025 },\r\n\t\t\"fogNear\" : { type: \"f\", value: 1 },\r\n\t\t\"fogFar\" : { type: \"f\", value: 2000 },\r\n\t\t\"fogColor\" : { type: \"c\", value: new THREE.Color( 0xffffff ) }\r\n\r\n\t},\r\n\r\n\tlights: {\r\n\r\n\t\t\"ambientLightColor\" : { type: \"fv\", value: [] },\r\n\r\n\t\t\"directionalLightDirection\" : { type: \"fv\", value: [] },\r\n\t\t\"directionalLightColor\" : { type: \"fv\", value: [] },\r\n\r\n\t\t\"hemisphereLightDirection\" : { type: \"fv\", value: [] },\r\n\t\t\"hemisphereLightSkyColor\" : { type: \"fv\", value: [] },\r\n\t\t\"hemisphereLightGroundColor\" : { type: \"fv\", value: [] },\r\n\r\n\t\t\"pointLightColor\" : { type: \"fv\", value: [] },\r\n\t\t\"pointLightPosition\" : { type: \"fv\", value: [] },\r\n\t\t\"pointLightDistance\" : { type: \"fv1\", value: [] },\r\n\t\t\"pointLightDecay\" : { type: \"fv1\", value: [] },\r\n\r\n\t\t\"spotLightColor\" : { type: \"fv\", value: [] },\r\n\t\t\"spotLightPosition\" : { type: \"fv\", value: [] },\r\n\t\t\"spotLightDirection\" : { type: \"fv\", value: [] },\r\n\t\t\"spotLightDistance\" : { type: \"fv1\", value: [] },\r\n\t\t\"spotLightAngleCos\" : { type: \"fv1\", value: [] },\r\n\t\t\"spotLightExponent\" : { type: \"fv1\", value: [] },\r\n\t\t\"spotLightDecay\" : { type: \"fv1\", value: [] }\r\n\r\n\t},\r\n\r\n\tparticle: {\r\n\r\n\t\t\"psColor\" : { type: \"c\", value: new THREE.Color( 0xeeeeee ) },\r\n\t\t\"opacity\" : { type: \"f\", value: 1.0 },\r\n\t\t\"size\" : { type: \"f\", value: 1.0 },\r\n\t\t\"scale\" : { type: \"f\", value: 1.0 },\r\n\t\t\"map\" : { type: \"t\", value: null },\r\n\t\t\"offsetRepeat\" : { type: \"v4\", value: new THREE.Vector4( 0, 0, 1, 1 ) },\r\n\r\n\t\t\"fogDensity\" : { type: \"f\", value: 0.00025 },\r\n\t\t\"fogNear\" : { type: \"f\", value: 1 },\r\n\t\t\"fogFar\" : { type: \"f\", value: 2000 },\r\n\t\t\"fogColor\" : { type: \"c\", value: new THREE.Color( 0xffffff ) }\r\n\r\n\t},\r\n\r\n\tshadowmap: {\r\n\r\n\t\t\"shadowMap\": { type: \"tv\", value: [] },\r\n\t\t\"shadowMapSize\": { type: \"v2v\", value: [] },\r\n\r\n\t\t\"shadowBias\" : { type: \"fv1\", value: [] },\r\n\t\t\"shadowDarkness\": { type: \"fv1\", value: [] },\r\n\r\n\t\t\"shadowMatrix\" : { type: \"m4v\", value: [] }\r\n\r\n\t}\r\n\r\n};\r\n\r\n// File:src/renderers/shaders/ShaderLib.js\r\n\r\n/**\r\n * Webgl Shader Library for three.js\r\n *\r\n * @author alteredq / http://alteredqualia.com/\r\n * @author mrdoob / http://mrdoob.com/\r\n * @author mikael emtinger / http://gomo.se/\r\n */\r\n\r\n\r\nTHREE.ShaderLib = {\r\n\r\n\t'basic': {\r\n\r\n\t\tuniforms: THREE.UniformsUtils.merge( [\r\n\r\n\t\t\tTHREE.UniformsLib[ \"common\" ],\r\n\t\t\tTHREE.UniformsLib[ \"fog\" ],\r\n\t\t\tTHREE.UniformsLib[ \"shadowmap\" ]\r\n\r\n\t\t] ),\r\n\r\n\t\tvertexShader: [\r\n\r\n\t\t\tTHREE.ShaderChunk[ \"common\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"map_pars_vertex\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"lightmap_pars_vertex\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"envmap_pars_vertex\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"color_pars_vertex\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"morphtarget_pars_vertex\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"skinning_pars_vertex\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"shadowmap_pars_vertex\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"logdepthbuf_pars_vertex\" ],\r\n\r\n\t\t\t\"void main() {\",\r\n\r\n\t\t\t\tTHREE.ShaderChunk[ \"map_vertex\" ],\r\n\t\t\t\tTHREE.ShaderChunk[ \"lightmap_vertex\" ],\r\n\t\t\t\tTHREE.ShaderChunk[ \"color_vertex\" ],\r\n\t\t\t\tTHREE.ShaderChunk[ \"skinbase_vertex\" ],\r\n\r\n\t\t\t\"\t#ifdef USE_ENVMAP\",\r\n\r\n\t\t\t\tTHREE.ShaderChunk[ \"morphnormal_vertex\" ],\r\n\t\t\t\tTHREE.ShaderChunk[ \"skinnormal_vertex\" ],\r\n\t\t\t\tTHREE.ShaderChunk[ \"defaultnormal_vertex\" ],\r\n\r\n\t\t\t\"\t#endif\",\r\n\r\n\t\t\t\tTHREE.ShaderChunk[ \"morphtarget_vertex\" ],\r\n\t\t\t\tTHREE.ShaderChunk[ \"skinning_vertex\" ],\r\n\t\t\t\tTHREE.ShaderChunk[ \"default_vertex\" ],\r\n\t\t\t\tTHREE.ShaderChunk[ \"logdepthbuf_vertex\" ],\r\n\r\n\t\t\t\tTHREE.ShaderChunk[ \"worldpos_vertex\" ],\r\n\t\t\t\tTHREE.ShaderChunk[ \"envmap_vertex\" ],\r\n\t\t\t\tTHREE.ShaderChunk[ \"shadowmap_vertex\" ],\r\n\r\n\t\t\t\"}\"\r\n\r\n\t\t].join(\"\\n\"),\r\n\r\n\t\tfragmentShader: [\r\n\r\n\t\t\t\"uniform vec3 diffuse;\",\r\n\t\t\t\"uniform float opacity;\",\r\n\r\n\t\t\tTHREE.ShaderChunk[ \"common\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"color_pars_fragment\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"map_pars_fragment\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"alphamap_pars_fragment\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"lightmap_pars_fragment\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"envmap_pars_fragment\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"fog_pars_fragment\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"shadowmap_pars_fragment\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"specularmap_pars_fragment\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"logdepthbuf_pars_fragment\" ],\r\n\r\n\t\t\t\"void main() {\",\r\n\r\n\t\t\t\"\tvec3 outgoingLight = vec3( 0.0 );\",\t// outgoing light does not have an alpha, the surface does\r\n\t\t\t\"\tvec4 diffuseColor = vec4( diffuse, opacity );\",\r\n\r\n\t\t\t\tTHREE.ShaderChunk[ \"logdepthbuf_fragment\" ],\r\n\t\t\t\tTHREE.ShaderChunk[ \"map_fragment\" ],\r\n\t\t\t\tTHREE.ShaderChunk[ \"color_fragment\" ],\r\n\t\t\t\tTHREE.ShaderChunk[ \"alphamap_fragment\" ],\r\n\t\t\t\tTHREE.ShaderChunk[ \"alphatest_fragment\" ],\r\n\t\t\t\tTHREE.ShaderChunk[ \"specularmap_fragment\" ],\r\n\r\n\t\t\t\"\toutgoingLight = diffuseColor.rgb;\", // simple shader\r\n\r\n\t\t\t\tTHREE.ShaderChunk[ \"lightmap_fragment\" ],\t\t// TODO: Light map on an otherwise unlit surface doesn't make sense.\r\n\t\t\t\tTHREE.ShaderChunk[ \"envmap_fragment\" ],\r\n\t\t\t\tTHREE.ShaderChunk[ \"shadowmap_fragment\" ],\t\t// TODO: Shadows on an otherwise unlit surface doesn't make sense.\r\n\r\n\t\t\t\tTHREE.ShaderChunk[ \"linear_to_gamma_fragment\" ],\r\n\r\n\t\t\t\tTHREE.ShaderChunk[ \"fog_fragment\" ],\r\n\r\n\t\t\t\"\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\",\t// TODO, this should be pre-multiplied to allow for bright highlights on very transparent objects\r\n\r\n\t\t\t\"}\"\r\n\r\n\t\t].join(\"\\n\")\r\n\r\n\t},\r\n\r\n\t'lambert': {\r\n\r\n\t\tuniforms: THREE.UniformsUtils.merge( [\r\n\r\n\t\t\tTHREE.UniformsLib[ \"common\" ],\r\n\t\t\tTHREE.UniformsLib[ \"fog\" ],\r\n\t\t\tTHREE.UniformsLib[ \"lights\" ],\r\n\t\t\tTHREE.UniformsLib[ \"shadowmap\" ],\r\n\r\n\t\t\t{\r\n\t\t\t\t\"emissive\" : { type: \"c\", value: new THREE.Color( 0x000000 ) },\r\n\t\t\t\t\"wrapRGB\" : { type: \"v3\", value: new THREE.Vector3( 1, 1, 1 ) }\r\n\t\t\t}\r\n\r\n\t\t] ),\r\n\r\n\t\tvertexShader: [\r\n\r\n\t\t\t\"#define LAMBERT\",\r\n\r\n\t\t\t\"varying vec3 vLightFront;\",\r\n\r\n\t\t\t\"#ifdef DOUBLE_SIDED\",\r\n\r\n\t\t\t\"\tvarying vec3 vLightBack;\",\r\n\r\n\t\t\t\"#endif\",\r\n\r\n\t\t\tTHREE.ShaderChunk[ \"common\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"map_pars_vertex\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"lightmap_pars_vertex\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"envmap_pars_vertex\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"lights_lambert_pars_vertex\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"color_pars_vertex\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"morphtarget_pars_vertex\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"skinning_pars_vertex\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"shadowmap_pars_vertex\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"logdepthbuf_pars_vertex\" ],\r\n\r\n\t\t\t\"void main() {\",\r\n\r\n\t\t\t\tTHREE.ShaderChunk[ \"map_vertex\" ],\r\n\t\t\t\tTHREE.ShaderChunk[ \"lightmap_vertex\" ],\r\n\t\t\t\tTHREE.ShaderChunk[ \"color_vertex\" ],\r\n\r\n\t\t\t\tTHREE.ShaderChunk[ \"morphnormal_vertex\" ],\r\n\t\t\t\tTHREE.ShaderChunk[ \"skinbase_vertex\" ],\r\n\t\t\t\tTHREE.ShaderChunk[ \"skinnormal_vertex\" ],\r\n\t\t\t\tTHREE.ShaderChunk[ \"defaultnormal_vertex\" ],\r\n\r\n\t\t\t\tTHREE.ShaderChunk[ \"morphtarget_vertex\" ],\r\n\t\t\t\tTHREE.ShaderChunk[ \"skinning_vertex\" ],\r\n\t\t\t\tTHREE.ShaderChunk[ \"default_vertex\" ],\r\n\t\t\t\tTHREE.ShaderChunk[ \"logdepthbuf_vertex\" ],\r\n\r\n\t\t\t\tTHREE.ShaderChunk[ \"worldpos_vertex\" ],\r\n\t\t\t\tTHREE.ShaderChunk[ \"envmap_vertex\" ],\r\n\t\t\t\tTHREE.ShaderChunk[ \"lights_lambert_vertex\" ],\r\n\t\t\t\tTHREE.ShaderChunk[ \"shadowmap_vertex\" ],\r\n\r\n\t\t\t\"}\"\r\n\r\n\t\t].join(\"\\n\"),\r\n\r\n\t\tfragmentShader: [\r\n\r\n\t\t\t\"uniform vec3 diffuse;\",\r\n\t\t\t\"uniform vec3 emissive;\",\r\n\t\t\t\"uniform float opacity;\",\r\n\r\n\t\t\t\"varying vec3 vLightFront;\",\r\n\r\n\t\t\t\"#ifdef DOUBLE_SIDED\",\r\n\r\n\t\t\t\"\tvarying vec3 vLightBack;\",\r\n\r\n\t\t\t\"#endif\",\r\n\r\n\t\t\tTHREE.ShaderChunk[ \"common\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"color_pars_fragment\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"map_pars_fragment\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"alphamap_pars_fragment\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"lightmap_pars_fragment\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"envmap_pars_fragment\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"fog_pars_fragment\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"shadowmap_pars_fragment\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"specularmap_pars_fragment\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"logdepthbuf_pars_fragment\" ],\r\n\r\n\t\t\t\"void main() {\",\r\n\r\n\t\t\t\"\tvec3 outgoingLight = vec3( 0.0 );\",\t// outgoing light does not have an alpha, the surface does\r\n\t\t\t\"\tvec4 diffuseColor = vec4( diffuse, opacity );\",\r\n\r\n\t\t\t\tTHREE.ShaderChunk[ \"logdepthbuf_fragment\" ],\r\n\t\t\t\tTHREE.ShaderChunk[ \"map_fragment\" ],\r\n\t\t\t\tTHREE.ShaderChunk[ \"color_fragment\" ],\r\n\t\t\t\tTHREE.ShaderChunk[ \"alphamap_fragment\" ],\r\n\t\t\t\tTHREE.ShaderChunk[ \"alphatest_fragment\" ],\r\n\t\t\t\tTHREE.ShaderChunk[ \"specularmap_fragment\" ],\r\n\r\n\t\t\t\"\t#ifdef DOUBLE_SIDED\",\r\n\r\n\t\t\t\t\t//\"float isFront = float( gl_FrontFacing );\",\r\n\t\t\t\t\t//\"gl_FragColor.xyz *= isFront * vLightFront + ( 1.0 - isFront ) * vLightBack;\",\r\n\r\n\t\t\t\"\t\tif ( gl_FrontFacing )\",\r\n\t\t\t\"\t\t\toutgoingLight += diffuseColor.rgb * vLightFront + emissive;\",\r\n\t\t\t\"\t\telse\",\r\n\t\t\t\"\t\t\toutgoingLight += diffuseColor.rgb * vLightBack + emissive;\",\r\n\r\n\t\t\t\"\t#else\",\r\n\r\n\t\t\t\"\t\toutgoingLight += diffuseColor.rgb * vLightFront + emissive;\",\r\n\r\n\t\t\t\"\t#endif\",\r\n\r\n\t\t\t\tTHREE.ShaderChunk[ \"lightmap_fragment\" ],\r\n\t\t\t\tTHREE.ShaderChunk[ \"envmap_fragment\" ],\r\n\t\t\t\tTHREE.ShaderChunk[ \"shadowmap_fragment\" ],\r\n\r\n\t\t\t\tTHREE.ShaderChunk[ \"linear_to_gamma_fragment\" ],\r\n\r\n\t\t\t\tTHREE.ShaderChunk[ \"fog_fragment\" ],\r\n\r\n\t\t\t\"\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\",\t// TODO, this should be pre-multiplied to allow for bright highlights on very transparent objects\r\n\r\n\t\t\t\"}\"\r\n\r\n\t\t].join(\"\\n\")\r\n\r\n\t},\r\n\r\n\t'phong': {\r\n\r\n\t\tuniforms: THREE.UniformsUtils.merge( [\r\n\r\n\t\t\tTHREE.UniformsLib[ \"common\" ],\r\n\t\t\tTHREE.UniformsLib[ \"bump\" ],\r\n\t\t\tTHREE.UniformsLib[ \"normalmap\" ],\r\n\t\t\tTHREE.UniformsLib[ \"fog\" ],\r\n\t\t\tTHREE.UniformsLib[ \"lights\" ],\r\n\t\t\tTHREE.UniformsLib[ \"shadowmap\" ],\r\n\r\n\t\t\t{\r\n\t\t\t\t\"emissive\" : { type: \"c\", value: new THREE.Color( 0x000000 ) },\r\n\t\t\t\t\"specular\" : { type: \"c\", value: new THREE.Color( 0x111111 ) },\r\n\t\t\t\t\"shininess\": { type: \"f\", value: 30 },\r\n\t\t\t\t\"wrapRGB\" : { type: \"v3\", value: new THREE.Vector3( 1, 1, 1 ) }\r\n\t\t\t}\r\n\r\n\t\t] ),\r\n\r\n\t\tvertexShader: [\r\n\r\n\t\t\t\"#define PHONG\",\r\n\r\n\t\t\t\"varying vec3 vViewPosition;\",\r\n\r\n\t\t\t\"#ifndef FLAT_SHADED\",\r\n\r\n\t\t\t\"\tvarying vec3 vNormal;\",\r\n\r\n\t\t\t\"#endif\",\r\n\r\n\t\t\tTHREE.ShaderChunk[ \"common\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"map_pars_vertex\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"lightmap_pars_vertex\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"envmap_pars_vertex\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"lights_phong_pars_vertex\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"color_pars_vertex\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"morphtarget_pars_vertex\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"skinning_pars_vertex\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"shadowmap_pars_vertex\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"logdepthbuf_pars_vertex\" ],\r\n\r\n\t\t\t\"void main() {\",\r\n\r\n\t\t\t\tTHREE.ShaderChunk[ \"map_vertex\" ],\r\n\t\t\t\tTHREE.ShaderChunk[ \"lightmap_vertex\" ],\r\n\t\t\t\tTHREE.ShaderChunk[ \"color_vertex\" ],\r\n\r\n\t\t\t\tTHREE.ShaderChunk[ \"morphnormal_vertex\" ],\r\n\t\t\t\tTHREE.ShaderChunk[ \"skinbase_vertex\" ],\r\n\t\t\t\tTHREE.ShaderChunk[ \"skinnormal_vertex\" ],\r\n\t\t\t\tTHREE.ShaderChunk[ \"defaultnormal_vertex\" ],\r\n\r\n\t\t\t\"#ifndef FLAT_SHADED\", // Normal computed with derivatives when FLAT_SHADED\r\n\r\n\t\t\t\"\tvNormal = normalize( transformedNormal );\",\r\n\r\n\t\t\t\"#endif\",\r\n\r\n\t\t\t\tTHREE.ShaderChunk[ \"morphtarget_vertex\" ],\r\n\t\t\t\tTHREE.ShaderChunk[ \"skinning_vertex\" ],\r\n\t\t\t\tTHREE.ShaderChunk[ \"default_vertex\" ],\r\n\t\t\t\tTHREE.ShaderChunk[ \"logdepthbuf_vertex\" ],\r\n\r\n\t\t\t\"\tvViewPosition = -mvPosition.xyz;\",\r\n\r\n\t\t\t\tTHREE.ShaderChunk[ \"worldpos_vertex\" ],\r\n\t\t\t\tTHREE.ShaderChunk[ \"envmap_vertex\" ],\r\n\t\t\t\tTHREE.ShaderChunk[ \"lights_phong_vertex\" ],\r\n\t\t\t\tTHREE.ShaderChunk[ \"shadowmap_vertex\" ],\r\n\r\n\t\t\t\"}\"\r\n\r\n\t\t].join(\"\\n\"),\r\n\r\n\t\tfragmentShader: [\r\n\r\n\t\t\t\"#define PHONG\",\r\n\r\n\t\t\t\"uniform vec3 diffuse;\",\r\n\t\t\t\"uniform vec3 emissive;\",\r\n\t\t\t\"uniform vec3 specular;\",\r\n\t\t\t\"uniform float shininess;\",\r\n\t\t\t\"uniform float opacity;\",\r\n\r\n\t\t\tTHREE.ShaderChunk[ \"common\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"color_pars_fragment\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"map_pars_fragment\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"alphamap_pars_fragment\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"lightmap_pars_fragment\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"envmap_pars_fragment\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"fog_pars_fragment\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"lights_phong_pars_fragment\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"shadowmap_pars_fragment\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"bumpmap_pars_fragment\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"normalmap_pars_fragment\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"specularmap_pars_fragment\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"logdepthbuf_pars_fragment\" ],\r\n\r\n\t\t\t\"void main() {\",\r\n\r\n\t\t\t\"\tvec3 outgoingLight = vec3( 0.0 );\",\t// outgoing light does not have an alpha, the surface does\r\n\t\t\t\"\tvec4 diffuseColor = vec4( diffuse, opacity );\",\r\n\r\n\t\t\t\tTHREE.ShaderChunk[ \"logdepthbuf_fragment\" ],\r\n\t\t\t\tTHREE.ShaderChunk[ \"map_fragment\" ],\r\n\t\t\t\tTHREE.ShaderChunk[ \"color_fragment\" ],\r\n\t\t\t\tTHREE.ShaderChunk[ \"alphamap_fragment\" ],\r\n\t\t\t\tTHREE.ShaderChunk[ \"alphatest_fragment\" ],\r\n\t\t\t\tTHREE.ShaderChunk[ \"specularmap_fragment\" ],\r\n\r\n\t\t\t\tTHREE.ShaderChunk[ \"lights_phong_fragment\" ],\r\n\r\n\t\t\t\tTHREE.ShaderChunk[ \"lightmap_fragment\" ],\r\n\t\t\t\tTHREE.ShaderChunk[ \"envmap_fragment\" ],\r\n\t\t\t\tTHREE.ShaderChunk[ \"shadowmap_fragment\" ],\r\n\r\n\t\t\t\tTHREE.ShaderChunk[ \"linear_to_gamma_fragment\" ],\r\n\r\n\t\t\t\tTHREE.ShaderChunk[ \"fog_fragment\" ],\r\n\r\n\t\t\t\"\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\",\t// TODO, this should be pre-multiplied to allow for bright highlights on very transparent objects\r\n\r\n\t\t\t\"}\"\r\n\r\n\t\t].join(\"\\n\")\r\n\r\n\t},\r\n\r\n\t'particle_basic': {\r\n\r\n\t\tuniforms: THREE.UniformsUtils.merge( [\r\n\r\n\t\t\tTHREE.UniformsLib[ \"particle\" ],\r\n\t\t\tTHREE.UniformsLib[ \"shadowmap\" ]\r\n\r\n\t\t] ),\r\n\r\n\t\tvertexShader: [\r\n\r\n\t\t\t\"uniform float size;\",\r\n\t\t\t\"uniform float scale;\",\r\n\r\n\t\t\tTHREE.ShaderChunk[ \"common\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"color_pars_vertex\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"shadowmap_pars_vertex\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"logdepthbuf_pars_vertex\" ],\r\n\r\n\t\t\t\"void main() {\",\r\n\r\n\t\t\t\tTHREE.ShaderChunk[ \"color_vertex\" ],\r\n\r\n\t\t\t\"\tvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\",\r\n\r\n\t\t\t\"\t#ifdef USE_SIZEATTENUATION\",\r\n\t\t\t\"\t\tgl_PointSize = size * ( scale / length( mvPosition.xyz ) );\",\r\n\t\t\t\"\t#else\",\r\n\t\t\t\"\t\tgl_PointSize = size;\",\r\n\t\t\t\"\t#endif\",\r\n\r\n\t\t\t\"\tgl_Position = projectionMatrix * mvPosition;\",\r\n\r\n\t\t\t\tTHREE.ShaderChunk[ \"logdepthbuf_vertex\" ],\r\n\t\t\t\tTHREE.ShaderChunk[ \"worldpos_vertex\" ],\r\n\t\t\t\tTHREE.ShaderChunk[ \"shadowmap_vertex\" ],\r\n\r\n\t\t\t\"}\"\r\n\r\n\t\t].join(\"\\n\"),\r\n\r\n\t\tfragmentShader: [\r\n\r\n\t\t\t\"uniform vec3 psColor;\",\r\n\t\t\t\"uniform float opacity;\",\r\n\r\n\t\t\tTHREE.ShaderChunk[ \"common\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"color_pars_fragment\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"map_particle_pars_fragment\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"fog_pars_fragment\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"shadowmap_pars_fragment\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"logdepthbuf_pars_fragment\" ],\r\n\r\n\t\t\t\"void main() {\",\r\n\r\n\t\t\t\"\tvec3 outgoingLight = vec3( 0.0 );\",\t// outgoing light does not have an alpha, the surface does\r\n\t\t\t\"\tvec4 diffuseColor = vec4( psColor, opacity );\",\r\n\r\n\t\t\t\tTHREE.ShaderChunk[ \"logdepthbuf_fragment\" ],\r\n\t\t\t\tTHREE.ShaderChunk[ \"map_particle_fragment\" ],\r\n\t\t\t\tTHREE.ShaderChunk[ \"color_fragment\" ],\r\n\t\t\t\tTHREE.ShaderChunk[ \"alphatest_fragment\" ],\r\n\r\n\t\t\t\"\toutgoingLight = diffuseColor.rgb;\", // simple shader\r\n\r\n\t\t\t\tTHREE.ShaderChunk[ \"shadowmap_fragment\" ],\r\n\t\t\t\tTHREE.ShaderChunk[ \"fog_fragment\" ],\r\n\r\n\t\t\t\"\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\",\t// TODO, this should be pre-multiplied to allow for bright highlights on very transparent objects\r\n\r\n\t\t\t\"}\"\r\n\r\n\t\t].join(\"\\n\")\r\n\r\n\t},\r\n\r\n\t'dashed': {\r\n\r\n\t\tuniforms: THREE.UniformsUtils.merge( [\r\n\r\n\t\t\tTHREE.UniformsLib[ \"common\" ],\r\n\t\t\tTHREE.UniformsLib[ \"fog\" ],\r\n\r\n\t\t\t{\r\n\t\t\t\t\"scale\" : { type: \"f\", value: 1 },\r\n\t\t\t\t\"dashSize\" : { type: \"f\", value: 1 },\r\n\t\t\t\t\"totalSize\": { type: \"f\", value: 2 }\r\n\t\t\t}\r\n\r\n\t\t] ),\r\n\r\n\t\tvertexShader: [\r\n\r\n\t\t\t\"uniform float scale;\",\r\n\t\t\t\"attribute float lineDistance;\",\r\n\r\n\t\t\t\"varying float vLineDistance;\",\r\n\r\n\t\t\tTHREE.ShaderChunk[ \"common\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"color_pars_vertex\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"logdepthbuf_pars_vertex\" ],\r\n\r\n\t\t\t\"void main() {\",\r\n\r\n\t\t\t\tTHREE.ShaderChunk[ \"color_vertex\" ],\r\n\r\n\t\t\t\"\tvLineDistance = scale * lineDistance;\",\r\n\r\n\t\t\t\"\tvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\",\r\n\t\t\t\"\tgl_Position = projectionMatrix * mvPosition;\",\r\n\r\n\t\t\t\tTHREE.ShaderChunk[ \"logdepthbuf_vertex\" ],\r\n\r\n\t\t\t\"}\"\r\n\r\n\t\t].join(\"\\n\"),\r\n\r\n\t\tfragmentShader: [\r\n\r\n\t\t\t\"uniform vec3 diffuse;\",\r\n\t\t\t\"uniform float opacity;\",\r\n\r\n\t\t\t\"uniform float dashSize;\",\r\n\t\t\t\"uniform float totalSize;\",\r\n\r\n\t\t\t\"varying float vLineDistance;\",\r\n\r\n\t\t\tTHREE.ShaderChunk[ \"common\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"color_pars_fragment\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"fog_pars_fragment\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"logdepthbuf_pars_fragment\" ],\r\n\r\n\t\t\t\"void main() {\",\r\n\r\n\t\t\t\"\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\",\r\n\r\n\t\t\t\"\t\tdiscard;\",\r\n\r\n\t\t\t\"\t}\",\r\n\r\n\t\t\t\"\tvec3 outgoingLight = vec3( 0.0 );\",\t// outgoing light does not have an alpha, the surface does\r\n\t\t\t\"\tvec4 diffuseColor = vec4( diffuse, opacity );\",\r\n\r\n\t\t\t\tTHREE.ShaderChunk[ \"logdepthbuf_fragment\" ],\r\n\t\t\t\tTHREE.ShaderChunk[ \"color_fragment\" ],\r\n\r\n\t\t\t\"\toutgoingLight = diffuseColor.rgb;\", // simple shader\r\n\r\n\t\t\t\tTHREE.ShaderChunk[ \"fog_fragment\" ],\r\n\r\n\t\t\t\"\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\",\t// TODO, this should be pre-multiplied to allow for bright highlights on very transparent objects\r\n\r\n\t\t\t\"}\"\r\n\r\n\t\t].join(\"\\n\")\r\n\r\n\t},\r\n\r\n\t'depth': {\r\n\r\n\t\tuniforms: {\r\n\r\n\t\t\t\"mNear\": { type: \"f\", value: 1.0 },\r\n\t\t\t\"mFar\" : { type: \"f\", value: 2000.0 },\r\n\t\t\t\"opacity\" : { type: \"f\", value: 1.0 }\r\n\r\n\t\t},\r\n\r\n\t\tvertexShader: [\r\n\r\n\t\t\tTHREE.ShaderChunk[ \"common\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"morphtarget_pars_vertex\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"logdepthbuf_pars_vertex\" ],\r\n\r\n\t\t\t\"void main() {\",\r\n\r\n\t\t\t\tTHREE.ShaderChunk[ \"morphtarget_vertex\" ],\r\n\t\t\t\tTHREE.ShaderChunk[ \"default_vertex\" ],\r\n\t\t\t\tTHREE.ShaderChunk[ \"logdepthbuf_vertex\" ],\r\n\r\n\t\t\t\"}\"\r\n\r\n\t\t].join(\"\\n\"),\r\n\r\n\t\tfragmentShader: [\r\n\r\n\t\t\t\"uniform float mNear;\",\r\n\t\t\t\"uniform float mFar;\",\r\n\t\t\t\"uniform float opacity;\",\r\n\r\n\t\t\tTHREE.ShaderChunk[ \"common\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"logdepthbuf_pars_fragment\" ],\r\n\r\n\t\t\t\"void main() {\",\r\n\r\n\t\t\t\tTHREE.ShaderChunk[ \"logdepthbuf_fragment\" ],\r\n\r\n\t\t\t\"\t#ifdef USE_LOGDEPTHBUF_EXT\",\r\n\r\n\t\t\t\"\t\tfloat depth = gl_FragDepthEXT / gl_FragCoord.w;\",\r\n\r\n\t\t\t\"\t#else\",\r\n\r\n\t\t\t\"\t\tfloat depth = gl_FragCoord.z / gl_FragCoord.w;\",\r\n\r\n\t\t\t\"\t#endif\",\r\n\r\n\t\t\t\"\tfloat color = 1.0 - smoothstep( mNear, mFar, depth );\",\r\n\t\t\t\"\tgl_FragColor = vec4( vec3( color ), opacity );\", // TODO, this should be pre-multiplied to allow for bright highlights on very transparent objects\r\n\r\n\t\t\t\"}\"\r\n\r\n\t\t].join(\"\\n\")\r\n\r\n\t},\r\n\r\n\t'normal': {\r\n\r\n\t\tuniforms: {\r\n\r\n\t\t\t\"opacity\" : { type: \"f\", value: 1.0 }\r\n\r\n\t\t},\r\n\r\n\t\tvertexShader: [\r\n\r\n\t\t\t\"varying vec3 vNormal;\",\r\n\r\n\t\t\tTHREE.ShaderChunk[ \"common\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"morphtarget_pars_vertex\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"logdepthbuf_pars_vertex\" ],\r\n\r\n\t\t\t\"void main() {\",\r\n\r\n\t\t\t\"\tvNormal = normalize( normalMatrix * normal );\",\r\n\r\n\t\t\t\tTHREE.ShaderChunk[ \"morphtarget_vertex\" ],\r\n\t\t\t\tTHREE.ShaderChunk[ \"default_vertex\" ],\r\n\t\t\t\tTHREE.ShaderChunk[ \"logdepthbuf_vertex\" ],\r\n\r\n\t\t\t\"}\"\r\n\r\n\t\t].join(\"\\n\"),\r\n\r\n\t\tfragmentShader: [\r\n\r\n\t\t\t\"uniform float opacity;\",\r\n\t\t\t\"varying vec3 vNormal;\",\r\n\r\n\t\t\tTHREE.ShaderChunk[ \"common\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"logdepthbuf_pars_fragment\" ],\r\n\r\n\t\t\t\"void main() {\",\r\n\r\n\t\t\t\"\tgl_FragColor = vec4( 0.5 * normalize( vNormal ) + 0.5, opacity );\",\r\n\r\n\t\t\t\tTHREE.ShaderChunk[ \"logdepthbuf_fragment\" ],\r\n\r\n\t\t\t\"}\"\r\n\r\n\t\t].join(\"\\n\")\r\n\r\n\t},\r\n\r\n\t/* -------------------------------------------------------------------------\r\n\t//\tCube map shader\r\n\t ------------------------------------------------------------------------- */\r\n\r\n\t'cube': {\r\n\r\n\t\tuniforms: { \"tCube\": { type: \"t\", value: null },\r\n\t\t\t\t\t\"tFlip\": { type: \"f\", value: - 1 } },\r\n\r\n\t\tvertexShader: [\r\n\r\n\t\t\t\"varying vec3 vWorldPosition;\",\r\n\r\n\t\t\tTHREE.ShaderChunk[ \"common\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"logdepthbuf_pars_vertex\" ],\r\n\r\n\t\t\t\"void main() {\",\r\n\r\n\t\t\t\"\tvWorldPosition = transformDirection( position, modelMatrix );\",\r\n\r\n\t\t\t\"\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\",\r\n\r\n\t\t\t\tTHREE.ShaderChunk[ \"logdepthbuf_vertex\" ],\r\n\r\n\t\t\t\"}\"\r\n\r\n\t\t].join(\"\\n\"),\r\n\r\n\t\tfragmentShader: [\r\n\r\n\t\t\t\"uniform samplerCube tCube;\",\r\n\t\t\t\"uniform float tFlip;\",\r\n\r\n\t\t\t\"varying vec3 vWorldPosition;\",\r\n\r\n\t\t\tTHREE.ShaderChunk[ \"common\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"logdepthbuf_pars_fragment\" ],\r\n\r\n\t\t\t\"void main() {\",\r\n\r\n\t\t\t\"\tgl_FragColor = textureCube( tCube, vec3( tFlip * vWorldPosition.x, vWorldPosition.yz ) );\",\r\n\r\n\t\t\t\tTHREE.ShaderChunk[ \"logdepthbuf_fragment\" ],\r\n\r\n\t\t\t\"}\"\r\n\r\n\t\t].join(\"\\n\")\r\n\r\n\t},\r\n\r\n\t/* -------------------------------------------------------------------------\r\n\t//\tCube map shader\r\n\t ------------------------------------------------------------------------- */\r\n\r\n\t'equirect': {\r\n\r\n\t\tuniforms: { \"tEquirect\": { type: \"t\", value: null },\r\n\t\t\t\t\t\"tFlip\": { type: \"f\", value: - 1 } },\r\n\r\n\t\tvertexShader: [\r\n\r\n\t\t\t\"varying vec3 vWorldPosition;\",\r\n\r\n\t\t\tTHREE.ShaderChunk[ \"common\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"logdepthbuf_pars_vertex\" ],\r\n\r\n\t\t\t\"void main() {\",\r\n\r\n\t\t\t\"\tvWorldPosition = transformDirection( position, modelMatrix );\",\r\n\r\n\t\t\t\"\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\",\r\n\r\n\t\t\t\tTHREE.ShaderChunk[ \"logdepthbuf_vertex\" ],\r\n\r\n\t\t\t\"}\"\r\n\r\n\t\t].join(\"\\n\"),\r\n\r\n\t\tfragmentShader: [\r\n\r\n\t\t\t\"uniform sampler2D tEquirect;\",\r\n\t\t\t\"uniform float tFlip;\",\r\n\r\n\t\t\t\"varying vec3 vWorldPosition;\",\r\n\r\n\t\t\tTHREE.ShaderChunk[ \"common\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"logdepthbuf_pars_fragment\" ],\r\n\r\n\t\t\t\"void main() {\",\r\n\r\n\t\t\t\t// \"\tgl_FragColor = textureCube( tCube, vec3( tFlip * vWorldPosition.x, vWorldPosition.yz ) );\",\r\n\t\t\t\t\"vec3 direction = normalize( vWorldPosition );\",\r\n\t\t\t\t\"vec2 sampleUV;\",\r\n\t\t\t\t\"sampleUV.y = saturate( tFlip * direction.y * -0.5 + 0.5 );\",\r\n\t\t\t\t\"sampleUV.x = atan( direction.z, direction.x ) * RECIPROCAL_PI2 + 0.5;\",\r\n\t\t\t\t\"gl_FragColor = texture2D( tEquirect, sampleUV );\",\r\n\r\n\t\t\t\tTHREE.ShaderChunk[ \"logdepthbuf_fragment\" ],\r\n\r\n\t\t\t\"}\"\r\n\r\n\t\t].join(\"\\n\")\r\n\r\n\t},\r\n\r\n\t/* Depth encoding into RGBA texture\r\n\t *\r\n\t * based on SpiderGL shadow map example\r\n\t * http://spidergl.org/example.php?id=6\r\n\t *\r\n\t * originally from\r\n\t * http://www.gamedev.net/topic/442138-packing-a-float-into-a-a8r8g8b8-texture-shader/page__whichpage__1%25EF%25BF%25BD\r\n\t *\r\n\t * see also\r\n\t * http://aras-p.info/blog/2009/07/30/encoding-floats-to-rgba-the-final/\r\n\t */\r\n\r\n\t'depthRGBA': {\r\n\r\n\t\tuniforms: {},\r\n\r\n\t\tvertexShader: [\r\n\r\n\t\t\tTHREE.ShaderChunk[ \"common\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"morphtarget_pars_vertex\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"skinning_pars_vertex\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"logdepthbuf_pars_vertex\" ],\r\n\r\n\t\t\t\"void main() {\",\r\n\r\n\t\t\t\tTHREE.ShaderChunk[ \"skinbase_vertex\" ],\r\n\t\t\t\tTHREE.ShaderChunk[ \"morphtarget_vertex\" ],\r\n\t\t\t\tTHREE.ShaderChunk[ \"skinning_vertex\" ],\r\n\t\t\t\tTHREE.ShaderChunk[ \"default_vertex\" ],\r\n\t\t\t\tTHREE.ShaderChunk[ \"logdepthbuf_vertex\" ],\r\n\r\n\t\t\t\"}\"\r\n\r\n\t\t].join(\"\\n\"),\r\n\r\n\t\tfragmentShader: [\r\n\r\n\t\t\tTHREE.ShaderChunk[ \"common\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"logdepthbuf_pars_fragment\" ],\r\n\r\n\t\t\t\"vec4 pack_depth( const in float depth ) {\",\r\n\r\n\t\t\t\"\tconst vec4 bit_shift = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );\",\r\n\t\t\t\"\tconst vec4 bit_mask = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );\",\r\n\t\t\t\"\tvec4 res = mod( depth * bit_shift * vec4( 255 ), vec4( 256 ) ) / vec4( 255 );\", // \"\tvec4 res = fract( depth * bit_shift );\",\r\n\t\t\t\"\tres -= res.xxyz * bit_mask;\",\r\n\t\t\t\"\treturn res;\",\r\n\r\n\t\t\t\"}\",\r\n\r\n\t\t\t\"void main() {\",\r\n\r\n\t\t\t\tTHREE.ShaderChunk[ \"logdepthbuf_fragment\" ],\r\n\r\n\t\t\t\"\t#ifdef USE_LOGDEPTHBUF_EXT\",\r\n\r\n\t\t\t\"\t\tgl_FragData[ 0 ] = pack_depth( gl_FragDepthEXT );\",\r\n\r\n\t\t\t\"\t#else\",\r\n\r\n\t\t\t\"\t\tgl_FragData[ 0 ] = pack_depth( gl_FragCoord.z );\",\r\n\r\n\t\t\t\"\t#endif\",\r\n\r\n\t\t\t\t//\"gl_FragData[ 0 ] = pack_depth( gl_FragCoord.z / gl_FragCoord.w );\",\r\n\t\t\t\t//\"float z = ( ( gl_FragCoord.z / gl_FragCoord.w ) - 3.0 ) / ( 4000.0 - 3.0 );\",\r\n\t\t\t\t//\"gl_FragData[ 0 ] = pack_depth( z );\",\r\n\t\t\t\t//\"gl_FragData[ 0 ] = vec4( z, z, z, 1.0 );\",\r\n\r\n\t\t\t\"}\"\r\n\r\n\t\t].join(\"\\n\")\r\n\r\n\t}\r\n\r\n};\r\n\r\n// File:src/renderers/WebGLRenderer.js\r\n\r\n/**\r\n * @author supereggbert / http://www.paulbrunt.co.uk/\r\n * @author mrdoob / http://mrdoob.com/\r\n * @author alteredq / http://alteredqualia.com/\r\n * @author szimek / https://github.com/szimek/\r\n */\r\n\r\nTHREE.WebGLRenderer = function ( parameters ) {\r\n\r\n\tconsole.log( 'THREE.WebGLRenderer', THREE.REVISION );\r\n\r\n\tparameters = parameters || {};\r\n\r\n\tvar _canvas = parameters.canvas !== undefined ? parameters.canvas : document.createElement( 'canvas' ),\r\n\t_context = parameters.context !== undefined ? parameters.context : null,\r\n\r\n\tpixelRatio = 1,\r\n\r\n\t_precision = parameters.precision !== undefined ? parameters.precision : 'highp',\r\n\r\n\t_alpha = parameters.alpha !== undefined ? parameters.alpha : false,\r\n\t_depth = parameters.depth !== undefined ? parameters.depth : true,\r\n\t_stencil = parameters.stencil !== undefined ? parameters.stencil : true,\r\n\t_antialias = parameters.antialias !== undefined ? parameters.antialias : false,\r\n\t_premultipliedAlpha = parameters.premultipliedAlpha !== undefined ? parameters.premultipliedAlpha : true,\r\n\t_preserveDrawingBuffer = parameters.preserveDrawingBuffer !== undefined ? parameters.preserveDrawingBuffer : false,\r\n\t_logarithmicDepthBuffer = parameters.logarithmicDepthBuffer !== undefined ? parameters.logarithmicDepthBuffer : false,\r\n\r\n\t_clearColor = new THREE.Color( 0x000000 ),\r\n\t_clearAlpha = 0;\r\n\r\n\tvar lights = [];\r\n\r\n\tvar _webglObjects = {};\r\n\tvar _webglObjectsImmediate = [];\r\n\r\n\tvar opaqueObjects = [];\r\n\tvar transparentObjects = [];\r\n\r\n\tvar sprites = [];\r\n\tvar lensFlares = [];\r\n\r\n\t// public properties\r\n\r\n\tthis.domElement = _canvas;\r\n\tthis.context = null;\r\n\r\n\t// clearing\r\n\r\n\tthis.autoClear = true;\r\n\tthis.autoClearColor = true;\r\n\tthis.autoClearDepth = true;\r\n\tthis.autoClearStencil = true;\r\n\r\n\t// scene graph\r\n\r\n\tthis.sortObjects = true;\r\n\r\n\t// physically based shading\r\n\r\n\tthis.gammaFactor = 2.0;\t// for backwards compatibility\r\n\tthis.gammaInput = false;\r\n\tthis.gammaOutput = false;\r\n\r\n\t// shadow map\r\n\r\n\tthis.shadowMapEnabled = false;\r\n\tthis.shadowMapType = THREE.PCFShadowMap;\r\n\tthis.shadowMapCullFace = THREE.CullFaceFront;\r\n\tthis.shadowMapDebug = false;\r\n\tthis.shadowMapCascade = false;\r\n\r\n\t// morphs\r\n\r\n\tthis.maxMorphTargets = 8;\r\n\tthis.maxMorphNormals = 4;\r\n\r\n\t// flags\r\n\r\n\tthis.autoScaleCubemaps = true;\r\n\r\n\t// info\r\n\r\n\tthis.info = {\r\n\r\n\t\tmemory: {\r\n\r\n\t\t\tprograms: 0,\r\n\t\t\tgeometries: 0,\r\n\t\t\ttextures: 0\r\n\r\n\t\t},\r\n\r\n\t\trender: {\r\n\r\n\t\t\tcalls: 0,\r\n\t\t\tvertices: 0,\r\n\t\t\tfaces: 0,\r\n\t\t\tpoints: 0\r\n\r\n\t\t}\r\n\r\n\t};\r\n\r\n\t// internal properties\r\n\r\n\tvar _this = this,\r\n\r\n\t_programs = [],\r\n\r\n\t// internal state cache\r\n\r\n\t_currentProgram = null,\r\n\t_currentFramebuffer = null,\r\n\t_currentMaterialId = - 1,\r\n\t_currentGeometryProgram = '',\r\n\t_currentCamera = null,\r\n\r\n\t_usedTextureUnits = 0,\r\n\r\n\t_viewportX = 0,\r\n\t_viewportY = 0,\r\n\t_viewportWidth = _canvas.width,\r\n\t_viewportHeight = _canvas.height,\r\n\t_currentWidth = 0,\r\n\t_currentHeight = 0,\r\n\r\n\t// frustum\r\n\r\n\t_frustum = new THREE.Frustum(),\r\n\r\n\t // camera matrices cache\r\n\r\n\t_projScreenMatrix = new THREE.Matrix4(),\r\n\r\n\t_vector3 = new THREE.Vector3(),\r\n\r\n\t// light arrays cache\r\n\r\n\t_direction = new THREE.Vector3(),\r\n\r\n\t_lightsNeedUpdate = true,\r\n\r\n\t_lights = {\r\n\r\n\t\tambient: [ 0, 0, 0 ],\r\n\t\tdirectional: { length: 0, colors:[], positions: [] },\r\n\t\tpoint: { length: 0, colors: [], positions: [], distances: [], decays: [] },\r\n\t\tspot: { length: 0, colors: [], positions: [], distances: [], directions: [], anglesCos: [], exponents: [], decays: [] },\r\n\t\themi: { length: 0, skyColors: [], groundColors: [], positions: [] }\r\n\r\n\t};\r\n\r\n\t// initialize\r\n\r\n\tvar _gl;\r\n\r\n\ttry {\r\n\r\n\t\tvar attributes = {\r\n\t\t\talpha: _alpha,\r\n\t\t\tdepth: _depth,\r\n\t\t\tstencil: _stencil,\r\n\t\t\tantialias: _antialias,\r\n\t\t\tpremultipliedAlpha: _premultipliedAlpha,\r\n\t\t\tpreserveDrawingBuffer: _preserveDrawingBuffer\r\n\t\t};\r\n\r\n\t\t_gl = _context || _canvas.getContext( 'webgl', attributes ) || _canvas.getContext( 'experimental-webgl', attributes );\r\n\r\n\t\tif ( _gl === null ) {\r\n\r\n\t\t\tif ( _canvas.getContext( 'webgl') !== null ) {\r\n\r\n\t\t\t\tthrow 'Error creating WebGL context with your selected attributes.';\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tthrow 'Error creating WebGL context.';\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\t_canvas.addEventListener( 'webglcontextlost', function ( event ) {\r\n\r\n\t\t\tevent.preventDefault();\r\n\r\n\t\t\tresetGLState();\r\n\t\t\tsetDefaultGLState();\r\n\r\n\t\t\t_webglObjects = {};\r\n\r\n\t\t}, false);\r\n\r\n\t} catch ( error ) {\r\n\r\n\t\tTHREE.error( 'THREE.WebGLRenderer: ' + error );\r\n\r\n\t}\r\n\r\n\tvar state = new THREE.WebGLState( _gl, paramThreeToGL );\r\n\r\n\tif ( _gl.getShaderPrecisionFormat === undefined ) {\r\n\r\n\t\t_gl.getShaderPrecisionFormat = function () {\r\n\r\n\t\t\treturn {\r\n\t\t\t\t'rangeMin': 1,\r\n\t\t\t\t'rangeMax': 1,\r\n\t\t\t\t'precision': 1\r\n\t\t\t};\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tvar extensions = new THREE.WebGLExtensions( _gl );\r\n\r\n\textensions.get( 'OES_texture_float' );\r\n\textensions.get( 'OES_texture_float_linear' );\r\n\textensions.get( 'OES_texture_half_float' );\r\n\textensions.get( 'OES_texture_half_float_linear' );\r\n\textensions.get( 'OES_standard_derivatives' );\r\n\r\n\tif ( _logarithmicDepthBuffer ) {\r\n\r\n\t\textensions.get( 'EXT_frag_depth' );\r\n\r\n\t}\r\n\r\n\t//\r\n\r\n\tvar glClearColor = function ( r, g, b, a ) {\r\n\r\n\t\tif ( _premultipliedAlpha === true ) {\r\n\r\n\t\t\tr *= a; g *= a; b *= a;\r\n\r\n\t\t}\r\n\r\n\t\t_gl.clearColor( r, g, b, a );\r\n\r\n\t};\r\n\r\n\tvar setDefaultGLState = function () {\r\n\r\n\t\t_gl.clearColor( 0, 0, 0, 1 );\r\n\t\t_gl.clearDepth( 1 );\r\n\t\t_gl.clearStencil( 0 );\r\n\r\n\t\t_gl.enable( _gl.DEPTH_TEST );\r\n\t\t_gl.depthFunc( _gl.LEQUAL );\r\n\r\n\t\t_gl.frontFace( _gl.CCW );\r\n\t\t_gl.cullFace( _gl.BACK );\r\n\t\t_gl.enable( _gl.CULL_FACE );\r\n\r\n\t\t_gl.enable( _gl.BLEND );\r\n\t\t_gl.blendEquation( _gl.FUNC_ADD );\r\n\t\t_gl.blendFunc( _gl.SRC_ALPHA, _gl.ONE_MINUS_SRC_ALPHA );\r\n\r\n\t\t_gl.viewport( _viewportX, _viewportY, _viewportWidth, _viewportHeight );\r\n\r\n\t\tglClearColor( _clearColor.r, _clearColor.g, _clearColor.b, _clearAlpha );\r\n\r\n\t};\r\n\r\n\tvar resetGLState = function () {\r\n\r\n\t\t_currentProgram = null;\r\n\t\t_currentCamera = null;\r\n\r\n\t\t_currentGeometryProgram = '';\r\n\t\t_currentMaterialId = - 1;\r\n\r\n\t\t_lightsNeedUpdate = true;\r\n\r\n\t\tstate.reset();\r\n\r\n\t};\r\n\r\n\tsetDefaultGLState();\r\n\r\n\tthis.context = _gl;\r\n\tthis.state = state;\r\n\r\n\t// GPU capabilities\r\n\r\n\tvar _maxTextures = _gl.getParameter( _gl.MAX_TEXTURE_IMAGE_UNITS );\r\n\tvar _maxVertexTextures = _gl.getParameter( _gl.MAX_VERTEX_TEXTURE_IMAGE_UNITS );\r\n\tvar _maxTextureSize = _gl.getParameter( _gl.MAX_TEXTURE_SIZE );\r\n\tvar _maxCubemapSize = _gl.getParameter( _gl.MAX_CUBE_MAP_TEXTURE_SIZE );\r\n\r\n\tvar _supportsVertexTextures = _maxVertexTextures > 0;\r\n\tvar _supportsBoneTextures = _supportsVertexTextures && extensions.get( 'OES_texture_float' );\r\n\r\n\t//\r\n\r\n\tvar _vertexShaderPrecisionHighpFloat = _gl.getShaderPrecisionFormat( _gl.VERTEX_SHADER, _gl.HIGH_FLOAT );\r\n\tvar _vertexShaderPrecisionMediumpFloat = _gl.getShaderPrecisionFormat( _gl.VERTEX_SHADER, _gl.MEDIUM_FLOAT );\r\n\r\n\tvar _fragmentShaderPrecisionHighpFloat = _gl.getShaderPrecisionFormat( _gl.FRAGMENT_SHADER, _gl.HIGH_FLOAT );\r\n\tvar _fragmentShaderPrecisionMediumpFloat = _gl.getShaderPrecisionFormat( _gl.FRAGMENT_SHADER, _gl.MEDIUM_FLOAT );\r\n\r\n\tvar getCompressedTextureFormats = ( function () {\r\n\r\n\t\tvar array;\r\n\r\n\t\treturn function () {\r\n\r\n\t\t\tif ( array !== undefined ) {\r\n\r\n\t\t\t\treturn array;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tarray = [];\r\n\r\n\t\t\tif ( extensions.get( 'WEBGL_compressed_texture_pvrtc' ) || extensions.get( 'WEBGL_compressed_texture_s3tc' ) ) {\r\n\r\n\t\t\t\tvar formats = _gl.getParameter( _gl.COMPRESSED_TEXTURE_FORMATS );\r\n\r\n\t\t\t\tfor ( var i = 0; i < formats.length; i ++ ) {\r\n\r\n\t\t\t\t\tarray.push( formats[ i ] );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\treturn array;\r\n\r\n\t\t};\r\n\r\n\t} )();\r\n\r\n\t// clamp precision to maximum available\r\n\r\n\tvar highpAvailable = _vertexShaderPrecisionHighpFloat.precision > 0 && _fragmentShaderPrecisionHighpFloat.precision > 0;\r\n\tvar mediumpAvailable = _vertexShaderPrecisionMediumpFloat.precision > 0 && _fragmentShaderPrecisionMediumpFloat.precision > 0;\r\n\r\n\tif ( _precision === 'highp' && ! highpAvailable ) {\r\n\r\n\t\tif ( mediumpAvailable ) {\r\n\r\n\t\t\t_precision = 'mediump';\r\n\t\t\tTHREE.warn( 'THREE.WebGLRenderer: highp not supported, using mediump.' );\r\n\r\n\t\t} else {\r\n\r\n\t\t\t_precision = 'lowp';\r\n\t\t\tTHREE.warn( 'THREE.WebGLRenderer: highp and mediump not supported, using lowp.' );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tif ( _precision === 'mediump' && ! mediumpAvailable ) {\r\n\r\n\t\t_precision = 'lowp';\r\n\t\tTHREE.warn( 'THREE.WebGLRenderer: mediump not supported, using lowp.' );\r\n\r\n\t}\r\n\r\n\t// Plugins\r\n\r\n\tvar shadowMapPlugin = new THREE.ShadowMapPlugin( this, lights, _webglObjects, _webglObjectsImmediate );\r\n\r\n\tvar spritePlugin = new THREE.SpritePlugin( this, sprites );\r\n\tvar lensFlarePlugin = new THREE.LensFlarePlugin( this, lensFlares );\r\n\r\n\t// API\r\n\r\n\tthis.getContext = function () {\r\n\r\n\t\treturn _gl;\r\n\r\n\t};\r\n\r\n\tthis.forceContextLoss = function () {\r\n\r\n\t\textensions.get( 'WEBGL_lose_context' ).loseContext();\r\n\r\n\t};\r\n\r\n\tthis.supportsVertexTextures = function () {\r\n\r\n\t\treturn _supportsVertexTextures;\r\n\r\n\t};\r\n\r\n\tthis.supportsFloatTextures = function () {\r\n\r\n\t\treturn extensions.get( 'OES_texture_float' );\r\n\r\n\t};\r\n\r\n\tthis.supportsHalfFloatTextures = function () {\r\n\r\n\t\treturn extensions.get( 'OES_texture_half_float' );\r\n\r\n\t};\r\n\r\n\tthis.supportsStandardDerivatives = function () {\r\n\r\n\t\treturn extensions.get( 'OES_standard_derivatives' );\r\n\r\n\t};\r\n\r\n\tthis.supportsCompressedTextureS3TC = function () {\r\n\r\n\t\treturn extensions.get( 'WEBGL_compressed_texture_s3tc' );\r\n\r\n\t};\r\n\r\n\tthis.supportsCompressedTexturePVRTC = function () {\r\n\r\n\t\treturn extensions.get( 'WEBGL_compressed_texture_pvrtc' );\r\n\r\n\t};\r\n\r\n\tthis.supportsBlendMinMax = function () {\r\n\r\n\t\treturn extensions.get( 'EXT_blend_minmax' );\r\n\r\n\t};\r\n\r\n\tthis.getMaxAnisotropy = ( function () {\r\n\r\n\t\tvar value;\r\n\r\n\t\treturn function () {\r\n\r\n\t\t\tif ( value !== undefined ) {\r\n\r\n\t\t\t\treturn value;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tvar extension = extensions.get( 'EXT_texture_filter_anisotropic' );\r\n\r\n\t\t\tvalue = extension !== null ? _gl.getParameter( extension.MAX_TEXTURE_MAX_ANISOTROPY_EXT ) : 0;\r\n\r\n\t\t\treturn value;\r\n\r\n\t\t}\r\n\r\n\t} )();\r\n\r\n\tthis.getPrecision = function () {\r\n\r\n\t\treturn _precision;\r\n\r\n\t};\r\n\r\n\tthis.getPixelRatio = function () {\r\n\r\n\t\treturn pixelRatio;\r\n\r\n\t};\r\n\r\n\tthis.setPixelRatio = function ( value ) {\r\n\r\n\t\tpixelRatio = value;\r\n\r\n\t};\r\n\r\n\tthis.setSize = function ( width, height, updateStyle ) {\r\n\r\n\t\t_canvas.width = width * pixelRatio;\r\n\t\t_canvas.height = height * pixelRatio;\r\n\r\n\t\tif ( updateStyle !== false ) {\r\n\r\n\t\t\t_canvas.style.width = width + 'px';\r\n\t\t\t_canvas.style.height = height + 'px';\r\n\r\n\t\t}\r\n\r\n\t\tthis.setViewport( 0, 0, width, height );\r\n\r\n\t};\r\n\r\n\tthis.setViewport = function ( x, y, width, height ) {\r\n\r\n\t\t_viewportX = x * pixelRatio;\r\n\t\t_viewportY = y * pixelRatio;\r\n\r\n\t\t_viewportWidth = width * pixelRatio;\r\n\t\t_viewportHeight = height * pixelRatio;\r\n\r\n\t\t_gl.viewport( _viewportX, _viewportY, _viewportWidth, _viewportHeight );\r\n\r\n\t};\r\n\r\n\tthis.setScissor = function ( x, y, width, height ) {\r\n\r\n\t\t_gl.scissor(\r\n\t\t\tx * pixelRatio,\r\n\t\t\ty * pixelRatio,\r\n\t\t\twidth * pixelRatio,\r\n\t\t\theight * pixelRatio\r\n\t\t);\r\n\r\n\t};\r\n\r\n\tthis.enableScissorTest = function ( enable ) {\r\n\r\n\t\tenable ? _gl.enable( _gl.SCISSOR_TEST ) : _gl.disable( _gl.SCISSOR_TEST );\r\n\r\n\t};\r\n\r\n\t// Clearing\r\n\r\n\tthis.getClearColor = function () {\r\n\r\n\t\treturn _clearColor;\r\n\r\n\t};\r\n\r\n\tthis.setClearColor = function ( color, alpha ) {\r\n\r\n\t\t_clearColor.set( color );\r\n\r\n\t\t_clearAlpha = alpha !== undefined ? alpha : 1;\r\n\r\n\t\tglClearColor( _clearColor.r, _clearColor.g, _clearColor.b, _clearAlpha );\r\n\r\n\t};\r\n\r\n\tthis.getClearAlpha = function () {\r\n\r\n\t\treturn _clearAlpha;\r\n\r\n\t};\r\n\r\n\tthis.setClearAlpha = function ( alpha ) {\r\n\r\n\t\t_clearAlpha = alpha;\r\n\r\n\t\tglClearColor( _clearColor.r, _clearColor.g, _clearColor.b, _clearAlpha );\r\n\r\n\t};\r\n\r\n\tthis.clear = function ( color, depth, stencil ) {\r\n\r\n\t\tvar bits = 0;\r\n\r\n\t\tif ( color === undefined || color ) bits |= _gl.COLOR_BUFFER_BIT;\r\n\t\tif ( depth === undefined || depth ) bits |= _gl.DEPTH_BUFFER_BIT;\r\n\t\tif ( stencil === undefined || stencil ) bits |= _gl.STENCIL_BUFFER_BIT;\r\n\r\n\t\t_gl.clear( bits );\r\n\r\n\t};\r\n\r\n\tthis.clearColor = function () {\r\n\r\n\t\t_gl.clear( _gl.COLOR_BUFFER_BIT );\r\n\r\n\t};\r\n\r\n\tthis.clearDepth = function () {\r\n\r\n\t\t_gl.clear( _gl.DEPTH_BUFFER_BIT );\r\n\r\n\t};\r\n\r\n\tthis.clearStencil = function () {\r\n\r\n\t\t_gl.clear( _gl.STENCIL_BUFFER_BIT );\r\n\r\n\t};\r\n\r\n\tthis.clearTarget = function ( renderTarget, color, depth, stencil ) {\r\n\r\n\t\tthis.setRenderTarget( renderTarget );\r\n\t\tthis.clear( color, depth, stencil );\r\n\r\n\t};\r\n\r\n\t// Reset\r\n\r\n\tthis.resetGLState = resetGLState;\r\n\r\n\t// Buffer allocation\r\n\r\n\tfunction createParticleBuffers ( geometry ) {\r\n\r\n\t\tgeometry.__webglVertexBuffer = _gl.createBuffer();\r\n\t\tgeometry.__webglColorBuffer = _gl.createBuffer();\r\n\r\n\t\t_this.info.memory.geometries ++;\r\n\r\n\t};\r\n\r\n\tfunction createLineBuffers ( geometry ) {\r\n\r\n\t\tgeometry.__webglVertexBuffer = _gl.createBuffer();\r\n\t\tgeometry.__webglColorBuffer = _gl.createBuffer();\r\n\t\tgeometry.__webglLineDistanceBuffer = _gl.createBuffer();\r\n\r\n\t\t_this.info.memory.geometries ++;\r\n\r\n\t};\r\n\r\n\tfunction createMeshBuffers ( geometryGroup ) {\r\n\r\n\t\tgeometryGroup.__webglVertexBuffer = _gl.createBuffer();\r\n\t\tgeometryGroup.__webglNormalBuffer = _gl.createBuffer();\r\n\t\tgeometryGroup.__webglTangentBuffer = _gl.createBuffer();\r\n\t\tgeometryGroup.__webglColorBuffer = _gl.createBuffer();\r\n\t\tgeometryGroup.__webglUVBuffer = _gl.createBuffer();\r\n\t\tgeometryGroup.__webglUV2Buffer = _gl.createBuffer();\r\n\r\n\t\tgeometryGroup.__webglSkinIndicesBuffer = _gl.createBuffer();\r\n\t\tgeometryGroup.__webglSkinWeightsBuffer = _gl.createBuffer();\r\n\r\n\t\tgeometryGroup.__webglFaceBuffer = _gl.createBuffer();\r\n\t\tgeometryGroup.__webglLineBuffer = _gl.createBuffer();\r\n\r\n\t\tvar numMorphTargets = geometryGroup.numMorphTargets;\r\n\r\n\t\tif ( numMorphTargets ) {\r\n\r\n\t\t\tgeometryGroup.__webglMorphTargetsBuffers = [];\r\n\r\n\t\t\tfor ( var m = 0, ml = numMorphTargets; m < ml; m ++ ) {\r\n\r\n\t\t\t\tgeometryGroup.__webglMorphTargetsBuffers.push( _gl.createBuffer() );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tvar numMorphNormals = geometryGroup.numMorphNormals;\r\n\r\n\t\tif ( numMorphNormals ) {\r\n\r\n\t\t\tgeometryGroup.__webglMorphNormalsBuffers = [];\r\n\r\n\t\t\tfor ( var m = 0, ml = numMorphNormals; m < ml; m ++ ) {\r\n\r\n\t\t\t\tgeometryGroup.__webglMorphNormalsBuffers.push( _gl.createBuffer() );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\t_this.info.memory.geometries ++;\r\n\r\n\t};\r\n\r\n\t// Events\r\n\r\n\tvar onObjectRemoved = function ( event ) {\r\n\r\n\t\tvar object = event.target;\r\n\r\n\t\tobject.traverse( function ( child ) {\r\n\r\n\t\t\tchild.removeEventListener( 'remove', onObjectRemoved );\r\n\r\n\t\t\tremoveObject( child );\r\n\r\n\t\t} );\r\n\r\n\t};\r\n\r\n\tvar onGeometryDispose = function ( event ) {\r\n\r\n\t\tvar geometry = event.target;\r\n\r\n\t\tgeometry.removeEventListener( 'dispose', onGeometryDispose );\r\n\r\n\t\tdeallocateGeometry( geometry );\r\n\r\n\t};\r\n\r\n\tvar onTextureDispose = function ( event ) {\r\n\r\n\t\tvar texture = event.target;\r\n\r\n\t\ttexture.removeEventListener( 'dispose', onTextureDispose );\r\n\r\n\t\tdeallocateTexture( texture );\r\n\r\n\t\t_this.info.memory.textures --;\r\n\r\n\r\n\t};\r\n\r\n\tvar onRenderTargetDispose = function ( event ) {\r\n\r\n\t\tvar renderTarget = event.target;\r\n\r\n\t\trenderTarget.removeEventListener( 'dispose', onRenderTargetDispose );\r\n\r\n\t\tdeallocateRenderTarget( renderTarget );\r\n\r\n\t\t_this.info.memory.textures --;\r\n\r\n\t};\r\n\r\n\tvar onMaterialDispose = function ( event ) {\r\n\r\n\t\tvar material = event.target;\r\n\r\n\t\tmaterial.removeEventListener( 'dispose', onMaterialDispose );\r\n\r\n\t\tdeallocateMaterial( material );\r\n\r\n\t};\r\n\r\n\t// Buffer deallocation\r\n\r\n\tvar deleteBuffers = function ( geometry ) {\r\n\r\n\t\tvar buffers = [\r\n\t\t\t'__webglVertexBuffer',\r\n\t\t\t'__webglNormalBuffer',\r\n\t\t\t'__webglTangentBuffer',\r\n\t\t\t'__webglColorBuffer',\r\n\t\t\t'__webglUVBuffer',\r\n\t\t\t'__webglUV2Buffer',\r\n\r\n\t\t\t'__webglSkinIndicesBuffer',\r\n\t\t\t'__webglSkinWeightsBuffer',\r\n\r\n\t\t\t'__webglFaceBuffer',\r\n\t\t\t'__webglLineBuffer',\r\n\r\n\t\t\t'__webglLineDistanceBuffer'\r\n\t\t];\r\n\r\n\t\tfor ( var i = 0, l = buffers.length; i < l; i ++ ) {\r\n\r\n\t\t\tvar name = buffers[ i ];\r\n\r\n\t\t\tif ( geometry[ name ] !== undefined ) {\r\n\r\n\t\t\t\t_gl.deleteBuffer( geometry[ name ] );\r\n\r\n\t\t\t\tdelete geometry[ name ];\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\t// custom attributes\r\n\r\n\t\tif ( geometry.__webglCustomAttributesList !== undefined ) {\r\n\r\n\t\t\tfor ( var name in geometry.__webglCustomAttributesList ) {\r\n\r\n\t\t\t\t_gl.deleteBuffer( geometry.__webglCustomAttributesList[ name ].buffer );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tdelete geometry.__webglCustomAttributesList;\r\n\r\n\t\t}\r\n\r\n\t\t_this.info.memory.geometries --;\r\n\r\n\t};\r\n\r\n\tvar deallocateGeometry = function ( geometry ) {\r\n\r\n\t\tdelete geometry.__webglInit;\r\n\r\n\t\tif ( geometry instanceof THREE.BufferGeometry ) {\r\n\r\n\t\t\tfor ( var name in geometry.attributes ) {\r\n\r\n\t\t\t\tvar attribute = geometry.attributes[ name ];\r\n\r\n\t\t\t\tif ( attribute.buffer !== undefined ) {\r\n\r\n\t\t\t\t\t_gl.deleteBuffer( attribute.buffer );\r\n\r\n\t\t\t\t\tdelete attribute.buffer;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\t_this.info.memory.geometries --;\r\n\r\n\t\t} else {\r\n\r\n\t\t\tvar geometryGroupsList = geometryGroups[ geometry.id ];\r\n\r\n\t\t\tif ( geometryGroupsList !== undefined ) {\r\n\r\n\t\t\t\tfor ( var i = 0, l = geometryGroupsList.length; i < l; i ++ ) {\r\n\r\n\t\t\t\t\tvar geometryGroup = geometryGroupsList[ i ];\r\n\r\n\t\t\t\t\tif ( geometryGroup.numMorphTargets !== undefined ) {\r\n\r\n\t\t\t\t\t\tfor ( var m = 0, ml = geometryGroup.numMorphTargets; m < ml; m ++ ) {\r\n\r\n\t\t\t\t\t\t\t_gl.deleteBuffer( geometryGroup.__webglMorphTargetsBuffers[ m ] );\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\tdelete geometryGroup.__webglMorphTargetsBuffers;\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tif ( geometryGroup.numMorphNormals !== undefined ) {\r\n\r\n\t\t\t\t\t\tfor ( var m = 0, ml = geometryGroup.numMorphNormals; m < ml; m ++ ) {\r\n\r\n\t\t\t\t\t\t\t_gl.deleteBuffer( geometryGroup.__webglMorphNormalsBuffers[ m ] );\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\tdelete geometryGroup.__webglMorphNormalsBuffers;\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tdeleteBuffers( geometryGroup );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tdelete geometryGroups[ geometry.id ];\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tdeleteBuffers( geometry );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\t// TOFIX: Workaround for deleted geometry being currently bound\r\n\r\n\t\t_currentGeometryProgram = '';\r\n\r\n\t};\r\n\r\n\tvar deallocateTexture = function ( texture ) {\r\n\r\n\t\tif ( texture.image && texture.image.__webglTextureCube ) {\r\n\r\n\t\t\t// cube texture\r\n\r\n\t\t\t_gl.deleteTexture( texture.image.__webglTextureCube );\r\n\r\n\t\t\tdelete texture.image.__webglTextureCube;\r\n\r\n\t\t} else {\r\n\r\n\t\t\t// 2D texture\r\n\r\n\t\t\tif ( texture.__webglInit === undefined ) return;\r\n\r\n\t\t\t_gl.deleteTexture( texture.__webglTexture );\r\n\r\n\t\t\tdelete texture.__webglTexture;\r\n\t\t\tdelete texture.__webglInit;\r\n\r\n\t\t}\r\n\r\n\t};\r\n\r\n\tvar deallocateRenderTarget = function ( renderTarget ) {\r\n\r\n\t\tif ( ! renderTarget || renderTarget.__webglTexture === undefined ) return;\r\n\r\n\t\t_gl.deleteTexture( renderTarget.__webglTexture );\r\n\r\n\t\tdelete renderTarget.__webglTexture;\r\n\r\n\t\tif ( renderTarget instanceof THREE.WebGLRenderTargetCube ) {\r\n\r\n\t\t\tfor ( var i = 0; i < 6; i ++ ) {\r\n\r\n\t\t\t\t_gl.deleteFramebuffer( renderTarget.__webglFramebuffer[ i ] );\r\n\t\t\t\t_gl.deleteRenderbuffer( renderTarget.__webglRenderbuffer[ i ] );\r\n\r\n\t\t\t}\r\n\r\n\t\t} else {\r\n\r\n\t\t\t_gl.deleteFramebuffer( renderTarget.__webglFramebuffer );\r\n\t\t\t_gl.deleteRenderbuffer( renderTarget.__webglRenderbuffer );\r\n\r\n\t\t}\r\n\r\n\t\tdelete renderTarget.__webglFramebuffer;\r\n\t\tdelete renderTarget.__webglRenderbuffer;\r\n\r\n\t};\r\n\r\n\tvar deallocateMaterial = function ( material ) {\r\n\r\n\t\tvar program = material.program.program;\r\n\r\n\t\tif ( program === undefined ) return;\r\n\r\n\t\tmaterial.program = undefined;\r\n\r\n\t\t// only deallocate GL program if this was the last use of shared program\r\n\t\t// assumed there is only single copy of any program in the _programs list\r\n\t\t// (that's how it's constructed)\r\n\r\n\t\tvar i, il, programInfo;\r\n\t\tvar deleteProgram = false;\r\n\r\n\t\tfor ( i = 0, il = _programs.length; i < il; i ++ ) {\r\n\r\n\t\t\tprogramInfo = _programs[ i ];\r\n\r\n\t\t\tif ( programInfo.program === program ) {\r\n\r\n\t\t\t\tprogramInfo.usedTimes --;\r\n\r\n\t\t\t\tif ( programInfo.usedTimes === 0 ) {\r\n\r\n\t\t\t\t\tdeleteProgram = true;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tbreak;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tif ( deleteProgram === true ) {\r\n\r\n\t\t\t// avoid using array.splice, this is costlier than creating new array from scratch\r\n\r\n\t\t\tvar newPrograms = [];\r\n\r\n\t\t\tfor ( i = 0, il = _programs.length; i < il; i ++ ) {\r\n\r\n\t\t\t\tprogramInfo = _programs[ i ];\r\n\r\n\t\t\t\tif ( programInfo.program !== program ) {\r\n\r\n\t\t\t\t\tnewPrograms.push( programInfo );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\t_programs = newPrograms;\r\n\r\n\t\t\t_gl.deleteProgram( program );\r\n\r\n\t\t\t_this.info.memory.programs --;\r\n\r\n\t\t}\r\n\r\n\t};\r\n\r\n\t// Buffer initialization\r\n\r\n\tfunction initCustomAttributes ( object ) {\r\n\r\n\t\tvar geometry = object.geometry;\r\n\t\tvar material = object.material;\r\n\r\n\t\tvar nvertices = geometry.vertices.length;\r\n\r\n\t\tif ( material.attributes ) {\r\n\r\n\t\t\tif ( geometry.__webglCustomAttributesList === undefined ) {\r\n\r\n\t\t\t\tgeometry.__webglCustomAttributesList = [];\r\n\r\n\t\t\t}\r\n\r\n\t\t\tfor ( var name in material.attributes ) {\r\n\r\n\t\t\t\tvar attribute = material.attributes[ name ];\r\n\r\n\t\t\t\tif ( ! attribute.__webglInitialized || attribute.createUniqueBuffers ) {\r\n\r\n\t\t\t\t\tattribute.__webglInitialized = true;\r\n\r\n\t\t\t\t\tvar size = 1; // \"f\" and \"i\"\r\n\r\n\t\t\t\t\tif ( attribute.type === 'v2' ) size = 2;\r\n\t\t\t\t\telse if ( attribute.type === 'v3' ) size = 3;\r\n\t\t\t\t\telse if ( attribute.type === 'v4' ) size = 4;\r\n\t\t\t\t\telse if ( attribute.type === 'c' ) size = 3;\r\n\r\n\t\t\t\t\tattribute.size = size;\r\n\r\n\t\t\t\t\tattribute.array = new Float32Array( nvertices * size );\r\n\r\n\t\t\t\t\tattribute.buffer = _gl.createBuffer();\r\n\t\t\t\t\tattribute.buffer.belongsToAttribute = name;\r\n\r\n\t\t\t\t\tattribute.needsUpdate = true;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tgeometry.__webglCustomAttributesList.push( attribute );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t};\r\n\r\n\tfunction initParticleBuffers ( geometry, object ) {\r\n\r\n\t\tvar nvertices = geometry.vertices.length;\r\n\r\n\t\tgeometry.__vertexArray = new Float32Array( nvertices * 3 );\r\n\t\tgeometry.__colorArray = new Float32Array( nvertices * 3 );\r\n\r\n\t\tgeometry.__webglParticleCount = nvertices;\r\n\r\n\t\tinitCustomAttributes( object );\r\n\r\n\t};\r\n\r\n\tfunction initLineBuffers ( geometry, object ) {\r\n\r\n\t\tvar nvertices = geometry.vertices.length;\r\n\r\n\t\tgeometry.__vertexArray = new Float32Array( nvertices * 3 );\r\n\t\tgeometry.__colorArray = new Float32Array( nvertices * 3 );\r\n\t\tgeometry.__lineDistanceArray = new Float32Array( nvertices * 1 );\r\n\r\n\t\tgeometry.__webglLineCount = nvertices;\r\n\r\n\t\tinitCustomAttributes( object );\r\n\r\n\t};\r\n\r\n\tfunction initMeshBuffers ( geometryGroup, object ) {\r\n\r\n\t\tvar geometry = object.geometry,\r\n\t\t\tfaces3 = geometryGroup.faces3,\r\n\r\n\t\t\tnvertices = faces3.length * 3,\r\n\t\t\tntris = faces3.length * 1,\r\n\t\t\tnlines = faces3.length * 3,\r\n\r\n\t\t\tmaterial = getBufferMaterial( object, geometryGroup );\r\n\r\n\t\tgeometryGroup.__vertexArray = new Float32Array( nvertices * 3 );\r\n\t\tgeometryGroup.__normalArray = new Float32Array( nvertices * 3 );\r\n\t\tgeometryGroup.__colorArray = new Float32Array( nvertices * 3 );\r\n\t\tgeometryGroup.__uvArray = new Float32Array( nvertices * 2 );\r\n\r\n\t\tif ( geometry.faceVertexUvs.length > 1 ) {\r\n\r\n\t\t\tgeometryGroup.__uv2Array = new Float32Array( nvertices * 2 );\r\n\r\n\t\t}\r\n\r\n\t\tif ( geometry.hasTangents ) {\r\n\r\n\t\t\tgeometryGroup.__tangentArray = new Float32Array( nvertices * 4 );\r\n\r\n\t\t}\r\n\r\n\t\tif ( object.geometry.skinWeights.length && object.geometry.skinIndices.length ) {\r\n\r\n\t\t\tgeometryGroup.__skinIndexArray = new Float32Array( nvertices * 4 );\r\n\t\t\tgeometryGroup.__skinWeightArray = new Float32Array( nvertices * 4 );\r\n\r\n\t\t}\r\n\r\n\t\tvar UintArray = extensions.get( 'OES_element_index_uint' ) !== null && ntris > 21845 ? Uint32Array : Uint16Array; // 65535 / 3\r\n\r\n\t\tgeometryGroup.__typeArray = UintArray;\r\n\t\tgeometryGroup.__faceArray = new UintArray( ntris * 3 );\r\n\t\tgeometryGroup.__lineArray = new UintArray( nlines * 2 );\r\n\r\n\t\tvar numMorphTargets = geometryGroup.numMorphTargets;\r\n\r\n\t\tif ( numMorphTargets ) {\r\n\r\n\t\t\tgeometryGroup.__morphTargetsArrays = [];\r\n\r\n\t\t\tfor ( var m = 0, ml = numMorphTargets; m < ml; m ++ ) {\r\n\r\n\t\t\t\tgeometryGroup.__morphTargetsArrays.push( new Float32Array( nvertices * 3 ) );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tvar numMorphNormals = geometryGroup.numMorphNormals;\r\n\r\n\t\tif ( numMorphNormals ) {\r\n\r\n\t\t\tgeometryGroup.__morphNormalsArrays = [];\r\n\r\n\t\t\tfor ( var m = 0, ml = numMorphNormals; m < ml; m ++ ) {\r\n\r\n\t\t\t\tgeometryGroup.__morphNormalsArrays.push( new Float32Array( nvertices * 3 ) );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tgeometryGroup.__webglFaceCount = ntris * 3;\r\n\t\tgeometryGroup.__webglLineCount = nlines * 2;\r\n\r\n\r\n\t\t// custom attributes\r\n\r\n\t\tif ( material.attributes ) {\r\n\r\n\t\t\tif ( geometryGroup.__webglCustomAttributesList === undefined ) {\r\n\r\n\t\t\t\tgeometryGroup.__webglCustomAttributesList = [];\r\n\r\n\t\t\t}\r\n\r\n\t\t\tfor ( var name in material.attributes ) {\r\n\r\n\t\t\t\t// Do a shallow copy of the attribute object so different geometryGroup chunks use different\r\n\t\t\t\t// attribute buffers which are correctly indexed in the setMeshBuffers function\r\n\r\n\t\t\t\tvar originalAttribute = material.attributes[ name ];\r\n\r\n\t\t\t\tvar attribute = {};\r\n\r\n\t\t\t\tfor ( var property in originalAttribute ) {\r\n\r\n\t\t\t\t\tattribute[ property ] = originalAttribute[ property ];\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif ( ! attribute.__webglInitialized || attribute.createUniqueBuffers ) {\r\n\r\n\t\t\t\t\tattribute.__webglInitialized = true;\r\n\r\n\t\t\t\t\tvar size = 1; // \"f\" and \"i\"\r\n\r\n\t\t\t\t\tif ( attribute.type === 'v2' ) size = 2;\r\n\t\t\t\t\telse if ( attribute.type === 'v3' ) size = 3;\r\n\t\t\t\t\telse if ( attribute.type === 'v4' ) size = 4;\r\n\t\t\t\t\telse if ( attribute.type === 'c' ) size = 3;\r\n\r\n\t\t\t\t\tattribute.size = size;\r\n\r\n\t\t\t\t\tattribute.array = new Float32Array( nvertices * size );\r\n\r\n\t\t\t\t\tattribute.buffer = _gl.createBuffer();\r\n\t\t\t\t\tattribute.buffer.belongsToAttribute = name;\r\n\r\n\t\t\t\t\toriginalAttribute.needsUpdate = true;\r\n\t\t\t\t\tattribute.__original = originalAttribute;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tgeometryGroup.__webglCustomAttributesList.push( attribute );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tgeometryGroup.__inittedArrays = true;\r\n\r\n\t};\r\n\r\n\tfunction getBufferMaterial( object, geometryGroup ) {\r\n\r\n\t\treturn object.material instanceof THREE.MeshFaceMaterial\r\n\t\t\t ? object.material.materials[ geometryGroup.materialIndex ]\r\n\t\t\t : object.material;\r\n\r\n\t}\r\n\r\n\tfunction materialNeedsFaceNormals ( material ) {\r\n\r\n\t\treturn material instanceof THREE.MeshPhongMaterial === false && material.shading === THREE.FlatShading;\r\n\r\n\t}\r\n\r\n\t// Buffer setting\r\n\r\n\tfunction setParticleBuffers ( geometry, hint, object ) {\r\n\r\n\t\tvar v, c, vertex, offset, color,\r\n\r\n\t\tvertices = geometry.vertices,\r\n\t\tvl = vertices.length,\r\n\r\n\t\tcolors = geometry.colors,\r\n\t\tcl = colors.length,\r\n\r\n\t\tvertexArray = geometry.__vertexArray,\r\n\t\tcolorArray = geometry.__colorArray,\r\n\r\n\t\tdirtyVertices = geometry.verticesNeedUpdate,\r\n\t\tdirtyColors = geometry.colorsNeedUpdate,\r\n\r\n\t\tcustomAttributes = geometry.__webglCustomAttributesList,\r\n\t\ti, il,\r\n\t\tca, cal, value,\r\n\t\tcustomAttribute;\r\n\r\n\t\tif ( dirtyVertices ) {\r\n\r\n\t\t\tfor ( v = 0; v < vl; v ++ ) {\r\n\r\n\t\t\t\tvertex = vertices[ v ];\r\n\r\n\t\t\t\toffset = v * 3;\r\n\r\n\t\t\t\tvertexArray[ offset ] = vertex.x;\r\n\t\t\t\tvertexArray[ offset + 1 ] = vertex.y;\r\n\t\t\t\tvertexArray[ offset + 2 ] = vertex.z;\r\n\r\n\t\t\t}\r\n\r\n\t\t\t_gl.bindBuffer( _gl.ARRAY_BUFFER, geometry.__webglVertexBuffer );\r\n\t\t\t_gl.bufferData( _gl.ARRAY_BUFFER, vertexArray, hint );\r\n\r\n\t\t}\r\n\r\n\t\tif ( dirtyColors ) {\r\n\r\n\t\t\tfor ( c = 0; c < cl; c ++ ) {\r\n\r\n\t\t\t\tcolor = colors[ c ];\r\n\r\n\t\t\t\toffset = c * 3;\r\n\r\n\t\t\t\tcolorArray[ offset ] = color.r;\r\n\t\t\t\tcolorArray[ offset + 1 ] = color.g;\r\n\t\t\t\tcolorArray[ offset + 2 ] = color.b;\r\n\r\n\t\t\t}\r\n\r\n\t\t\t_gl.bindBuffer( _gl.ARRAY_BUFFER, geometry.__webglColorBuffer );\r\n\t\t\t_gl.bufferData( _gl.ARRAY_BUFFER, colorArray, hint );\r\n\r\n\t\t}\r\n\r\n\t\tif ( customAttributes ) {\r\n\r\n\t\t\tfor ( i = 0, il = customAttributes.length; i < il; i ++ ) {\r\n\r\n\t\t\t\tcustomAttribute = customAttributes[ i ];\r\n\r\n\t\t\t\tif ( customAttribute.needsUpdate && ( customAttribute.boundTo === undefined || customAttribute.boundTo === 'vertices' ) ) {\r\n\r\n\t\t\t\t\tcal = customAttribute.value.length;\r\n\r\n\t\t\t\t\toffset = 0;\r\n\r\n\t\t\t\t\tif ( customAttribute.size === 1 ) {\r\n\r\n\t\t\t\t\t\tfor ( ca = 0; ca < cal; ca ++ ) {\r\n\r\n\t\t\t\t\t\t\tcustomAttribute.array[ ca ] = customAttribute.value[ ca ];\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t} else if ( customAttribute.size === 2 ) {\r\n\r\n\t\t\t\t\t\tfor ( ca = 0; ca < cal; ca ++ ) {\r\n\r\n\t\t\t\t\t\t\tvalue = customAttribute.value[ ca ];\r\n\r\n\t\t\t\t\t\t\tcustomAttribute.array[ offset ] = value.x;\r\n\t\t\t\t\t\t\tcustomAttribute.array[ offset + 1 ] = value.y;\r\n\r\n\t\t\t\t\t\t\toffset += 2;\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t} else if ( customAttribute.size === 3 ) {\r\n\r\n\t\t\t\t\t\tif ( customAttribute.type === 'c' ) {\r\n\r\n\t\t\t\t\t\t\tfor ( ca = 0; ca < cal; ca ++ ) {\r\n\r\n\t\t\t\t\t\t\t\tvalue = customAttribute.value[ ca ];\r\n\r\n\t\t\t\t\t\t\t\tcustomAttribute.array[ offset ] = value.r;\r\n\t\t\t\t\t\t\t\tcustomAttribute.array[ offset + 1 ] = value.g;\r\n\t\t\t\t\t\t\t\tcustomAttribute.array[ offset + 2 ] = value.b;\r\n\r\n\t\t\t\t\t\t\t\toffset += 3;\r\n\r\n\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t} else {\r\n\r\n\t\t\t\t\t\t\tfor ( ca = 0; ca < cal; ca ++ ) {\r\n\r\n\t\t\t\t\t\t\t\tvalue = customAttribute.value[ ca ];\r\n\r\n\t\t\t\t\t\t\t\tcustomAttribute.array[ offset ] = value.x;\r\n\t\t\t\t\t\t\t\tcustomAttribute.array[ offset + 1 ] = value.y;\r\n\t\t\t\t\t\t\t\tcustomAttribute.array[ offset + 2 ] = value.z;\r\n\r\n\t\t\t\t\t\t\t\toffset += 3;\r\n\r\n\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t} else if ( customAttribute.size === 4 ) {\r\n\r\n\t\t\t\t\t\tfor ( ca = 0; ca < cal; ca ++ ) {\r\n\r\n\t\t\t\t\t\t\tvalue = customAttribute.value[ ca ];\r\n\r\n\t\t\t\t\t\t\tcustomAttribute.array[ offset ] = value.x;\r\n\t\t\t\t\t\t\tcustomAttribute.array[ offset + 1 ] = value.y;\r\n\t\t\t\t\t\t\tcustomAttribute.array[ offset + 2 ] = value.z;\r\n\t\t\t\t\t\t\tcustomAttribute.array[ offset + 3 ] = value.w;\r\n\r\n\t\t\t\t\t\t\toffset += 4;\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\t_gl.bindBuffer( _gl.ARRAY_BUFFER, customAttribute.buffer );\r\n\t\t\t\t_gl.bufferData( _gl.ARRAY_BUFFER, customAttribute.array, hint );\r\n\r\n\t\t\t\tcustomAttribute.needsUpdate = false;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tfunction setLineBuffers ( geometry, hint ) {\r\n\r\n\t\tvar v, c, d, vertex, offset, color,\r\n\r\n\t\tvertices = geometry.vertices,\r\n\t\tcolors = geometry.colors,\r\n\t\tlineDistances = geometry.lineDistances,\r\n\r\n\t\tvl = vertices.length,\r\n\t\tcl = colors.length,\r\n\t\tdl = lineDistances.length,\r\n\r\n\t\tvertexArray = geometry.__vertexArray,\r\n\t\tcolorArray = geometry.__colorArray,\r\n\t\tlineDistanceArray = geometry.__lineDistanceArray,\r\n\r\n\t\tdirtyVertices = geometry.verticesNeedUpdate,\r\n\t\tdirtyColors = geometry.colorsNeedUpdate,\r\n\t\tdirtyLineDistances = geometry.lineDistancesNeedUpdate,\r\n\r\n\t\tcustomAttributes = geometry.__webglCustomAttributesList,\r\n\r\n\t\ti, il,\r\n\t\tca, cal, value,\r\n\t\tcustomAttribute;\r\n\r\n\t\tif ( dirtyVertices ) {\r\n\r\n\t\t\tfor ( v = 0; v < vl; v ++ ) {\r\n\r\n\t\t\t\tvertex = vertices[ v ];\r\n\r\n\t\t\t\toffset = v * 3;\r\n\r\n\t\t\t\tvertexArray[ offset ] = vertex.x;\r\n\t\t\t\tvertexArray[ offset + 1 ] = vertex.y;\r\n\t\t\t\tvertexArray[ offset + 2 ] = vertex.z;\r\n\r\n\t\t\t}\r\n\r\n\t\t\t_gl.bindBuffer( _gl.ARRAY_BUFFER, geometry.__webglVertexBuffer );\r\n\t\t\t_gl.bufferData( _gl.ARRAY_BUFFER, vertexArray, hint );\r\n\r\n\t\t}\r\n\r\n\t\tif ( dirtyColors ) {\r\n\r\n\t\t\tfor ( c = 0; c < cl; c ++ ) {\r\n\r\n\t\t\t\tcolor = colors[ c ];\r\n\r\n\t\t\t\toffset = c * 3;\r\n\r\n\t\t\t\tcolorArray[ offset ] = color.r;\r\n\t\t\t\tcolorArray[ offset + 1 ] = color.g;\r\n\t\t\t\tcolorArray[ offset + 2 ] = color.b;\r\n\r\n\t\t\t}\r\n\r\n\t\t\t_gl.bindBuffer( _gl.ARRAY_BUFFER, geometry.__webglColorBuffer );\r\n\t\t\t_gl.bufferData( _gl.ARRAY_BUFFER, colorArray, hint );\r\n\r\n\t\t}\r\n\r\n\t\tif ( dirtyLineDistances ) {\r\n\r\n\t\t\tfor ( d = 0; d < dl; d ++ ) {\r\n\r\n\t\t\t\tlineDistanceArray[ d ] = lineDistances[ d ];\r\n\r\n\t\t\t}\r\n\r\n\t\t\t_gl.bindBuffer( _gl.ARRAY_BUFFER, geometry.__webglLineDistanceBuffer );\r\n\t\t\t_gl.bufferData( _gl.ARRAY_BUFFER, lineDistanceArray, hint );\r\n\r\n\t\t}\r\n\r\n\t\tif ( customAttributes ) {\r\n\r\n\t\t\tfor ( i = 0, il = customAttributes.length; i < il; i ++ ) {\r\n\r\n\t\t\t\tcustomAttribute = customAttributes[ i ];\r\n\r\n\t\t\t\tif ( customAttribute.needsUpdate && ( customAttribute.boundTo === undefined || customAttribute.boundTo === 'vertices' ) ) {\r\n\r\n\t\t\t\t\toffset = 0;\r\n\r\n\t\t\t\t\tcal = customAttribute.value.length;\r\n\r\n\t\t\t\t\tif ( customAttribute.size === 1 ) {\r\n\r\n\t\t\t\t\t\tfor ( ca = 0; ca < cal; ca ++ ) {\r\n\r\n\t\t\t\t\t\t\tcustomAttribute.array[ ca ] = customAttribute.value[ ca ];\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t} else if ( customAttribute.size === 2 ) {\r\n\r\n\t\t\t\t\t\tfor ( ca = 0; ca < cal; ca ++ ) {\r\n\r\n\t\t\t\t\t\t\tvalue = customAttribute.value[ ca ];\r\n\r\n\t\t\t\t\t\t\tcustomAttribute.array[ offset ] = value.x;\r\n\t\t\t\t\t\t\tcustomAttribute.array[ offset + 1 ] = value.y;\r\n\r\n\t\t\t\t\t\t\toffset += 2;\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t} else if ( customAttribute.size === 3 ) {\r\n\r\n\t\t\t\t\t\tif ( customAttribute.type === 'c' ) {\r\n\r\n\t\t\t\t\t\t\tfor ( ca = 0; ca < cal; ca ++ ) {\r\n\r\n\t\t\t\t\t\t\t\tvalue = customAttribute.value[ ca ];\r\n\r\n\t\t\t\t\t\t\t\tcustomAttribute.array[ offset ] = value.r;\r\n\t\t\t\t\t\t\t\tcustomAttribute.array[ offset + 1 ] = value.g;\r\n\t\t\t\t\t\t\t\tcustomAttribute.array[ offset + 2 ] = value.b;\r\n\r\n\t\t\t\t\t\t\t\toffset += 3;\r\n\r\n\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t} else {\r\n\r\n\t\t\t\t\t\t\tfor ( ca = 0; ca < cal; ca ++ ) {\r\n\r\n\t\t\t\t\t\t\t\tvalue = customAttribute.value[ ca ];\r\n\r\n\t\t\t\t\t\t\t\tcustomAttribute.array[ offset ] = value.x;\r\n\t\t\t\t\t\t\t\tcustomAttribute.array[ offset + 1 ] = value.y;\r\n\t\t\t\t\t\t\t\tcustomAttribute.array[ offset + 2 ] = value.z;\r\n\r\n\t\t\t\t\t\t\t\toffset += 3;\r\n\r\n\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t} else if ( customAttribute.size === 4 ) {\r\n\r\n\t\t\t\t\t\tfor ( ca = 0; ca < cal; ca ++ ) {\r\n\r\n\t\t\t\t\t\t\tvalue = customAttribute.value[ ca ];\r\n\r\n\t\t\t\t\t\t\tcustomAttribute.array[ offset ] = value.x;\r\n\t\t\t\t\t\t\tcustomAttribute.array[ offset + 1 ] = value.y;\r\n\t\t\t\t\t\t\tcustomAttribute.array[ offset + 2 ] = value.z;\r\n\t\t\t\t\t\t\tcustomAttribute.array[ offset + 3 ] = value.w;\r\n\r\n\t\t\t\t\t\t\toffset += 4;\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\t_gl.bindBuffer( _gl.ARRAY_BUFFER, customAttribute.buffer );\r\n\t\t\t\t\t_gl.bufferData( _gl.ARRAY_BUFFER, customAttribute.array, hint );\r\n\r\n\t\t\t\t\tcustomAttribute.needsUpdate = false;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tfunction setMeshBuffers( geometryGroup, object, hint, dispose, material ) {\r\n\r\n\t\tif ( ! geometryGroup.__inittedArrays ) {\r\n\r\n\t\t\treturn;\r\n\r\n\t\t}\r\n\r\n\t\tvar needsFaceNormals = materialNeedsFaceNormals( material );\r\n\r\n\t\tvar f, fl, fi, face,\r\n\t\tvertexNormals, faceNormal,\r\n\t\tvertexColors, faceColor,\r\n\t\tvertexTangents,\r\n\t\tuv, uv2, v1, v2, v3, t1, t2, t3, n1, n2, n3,\r\n\t\tc1, c2, c3,\r\n\t\tsw1, sw2, sw3,\r\n\t\tsi1, si2, si3,\r\n\t\ti, il,\r\n\t\tvn, uvi, uv2i,\r\n\t\tvk, vkl, vka,\r\n\t\tnka, chf, faceVertexNormals,\r\n\r\n\t\tvertexIndex = 0,\r\n\r\n\t\toffset = 0,\r\n\t\toffset_uv = 0,\r\n\t\toffset_uv2 = 0,\r\n\t\toffset_face = 0,\r\n\t\toffset_normal = 0,\r\n\t\toffset_tangent = 0,\r\n\t\toffset_line = 0,\r\n\t\toffset_color = 0,\r\n\t\toffset_skin = 0,\r\n\t\toffset_morphTarget = 0,\r\n\t\toffset_custom = 0,\r\n\r\n\t\tvalue,\r\n\r\n\t\tvertexArray = geometryGroup.__vertexArray,\r\n\t\tuvArray = geometryGroup.__uvArray,\r\n\t\tuv2Array = geometryGroup.__uv2Array,\r\n\t\tnormalArray = geometryGroup.__normalArray,\r\n\t\ttangentArray = geometryGroup.__tangentArray,\r\n\t\tcolorArray = geometryGroup.__colorArray,\r\n\r\n\t\tskinIndexArray = geometryGroup.__skinIndexArray,\r\n\t\tskinWeightArray = geometryGroup.__skinWeightArray,\r\n\r\n\t\tmorphTargetsArrays = geometryGroup.__morphTargetsArrays,\r\n\t\tmorphNormalsArrays = geometryGroup.__morphNormalsArrays,\r\n\r\n\t\tcustomAttributes = geometryGroup.__webglCustomAttributesList,\r\n\t\tcustomAttribute,\r\n\r\n\t\tfaceArray = geometryGroup.__faceArray,\r\n\t\tlineArray = geometryGroup.__lineArray,\r\n\r\n\t\tgeometry = object.geometry, // this is shared for all chunks\r\n\r\n\t\tdirtyVertices = geometry.verticesNeedUpdate,\r\n\t\tdirtyElements = geometry.elementsNeedUpdate,\r\n\t\tdirtyUvs = geometry.uvsNeedUpdate,\r\n\t\tdirtyNormals = geometry.normalsNeedUpdate,\r\n\t\tdirtyTangents = geometry.tangentsNeedUpdate,\r\n\t\tdirtyColors = geometry.colorsNeedUpdate,\r\n\t\tdirtyMorphTargets = geometry.morphTargetsNeedUpdate,\r\n\r\n\t\tvertices = geometry.vertices,\r\n\t\tchunk_faces3 = geometryGroup.faces3,\r\n\t\tobj_faces = geometry.faces,\r\n\r\n\t\tobj_uvs = geometry.faceVertexUvs[ 0 ],\r\n\t\tobj_uvs2 = geometry.faceVertexUvs[ 1 ],\r\n\r\n\t\tobj_skinIndices = geometry.skinIndices,\r\n\t\tobj_skinWeights = geometry.skinWeights,\r\n\r\n\t\tmorphTargets = geometry.morphTargets,\r\n\t\tmorphNormals = geometry.morphNormals;\r\n\r\n\t\tif ( dirtyVertices ) {\r\n\r\n\t\t\tfor ( f = 0, fl = chunk_faces3.length; f < fl; f ++ ) {\r\n\r\n\t\t\t\tface = obj_faces[ chunk_faces3[ f ] ];\r\n\r\n\t\t\t\tv1 = vertices[ face.a ];\r\n\t\t\t\tv2 = vertices[ face.b ];\r\n\t\t\t\tv3 = vertices[ face.c ];\r\n\r\n\t\t\t\tvertexArray[ offset ] = v1.x;\r\n\t\t\t\tvertexArray[ offset + 1 ] = v1.y;\r\n\t\t\t\tvertexArray[ offset + 2 ] = v1.z;\r\n\r\n\t\t\t\tvertexArray[ offset + 3 ] = v2.x;\r\n\t\t\t\tvertexArray[ offset + 4 ] = v2.y;\r\n\t\t\t\tvertexArray[ offset + 5 ] = v2.z;\r\n\r\n\t\t\t\tvertexArray[ offset + 6 ] = v3.x;\r\n\t\t\t\tvertexArray[ offset + 7 ] = v3.y;\r\n\t\t\t\tvertexArray[ offset + 8 ] = v3.z;\r\n\r\n\t\t\t\toffset += 9;\r\n\r\n\t\t\t}\r\n\r\n\t\t\t_gl.bindBuffer( _gl.ARRAY_BUFFER, geometryGroup.__webglVertexBuffer );\r\n\t\t\t_gl.bufferData( _gl.ARRAY_BUFFER, vertexArray, hint );\r\n\r\n\t\t}\r\n\r\n\t\tif ( dirtyMorphTargets ) {\r\n\r\n\t\t\tfor ( vk = 0, vkl = morphTargets.length; vk < vkl; vk ++ ) {\r\n\r\n\t\t\t\toffset_morphTarget = 0;\r\n\r\n\t\t\t\tfor ( f = 0, fl = chunk_faces3.length; f < fl; f ++ ) {\r\n\r\n\t\t\t\t\tchf = chunk_faces3[ f ];\r\n\t\t\t\t\tface = obj_faces[ chf ];\r\n\r\n\t\t\t\t\t// morph positions\r\n\r\n\t\t\t\t\tv1 = morphTargets[ vk ].vertices[ face.a ];\r\n\t\t\t\t\tv2 = morphTargets[ vk ].vertices[ face.b ];\r\n\t\t\t\t\tv3 = morphTargets[ vk ].vertices[ face.c ];\r\n\r\n\t\t\t\t\tvka = morphTargetsArrays[ vk ];\r\n\r\n\t\t\t\t\tvka[ offset_morphTarget ] = v1.x;\r\n\t\t\t\t\tvka[ offset_morphTarget + 1 ] = v1.y;\r\n\t\t\t\t\tvka[ offset_morphTarget + 2 ] = v1.z;\r\n\r\n\t\t\t\t\tvka[ offset_morphTarget + 3 ] = v2.x;\r\n\t\t\t\t\tvka[ offset_morphTarget + 4 ] = v2.y;\r\n\t\t\t\t\tvka[ offset_morphTarget + 5 ] = v2.z;\r\n\r\n\t\t\t\t\tvka[ offset_morphTarget + 6 ] = v3.x;\r\n\t\t\t\t\tvka[ offset_morphTarget + 7 ] = v3.y;\r\n\t\t\t\t\tvka[ offset_morphTarget + 8 ] = v3.z;\r\n\r\n\t\t\t\t\t// morph normals\r\n\r\n\t\t\t\t\tif ( material.morphNormals ) {\r\n\r\n\t\t\t\t\t\tif ( needsFaceNormals ) {\r\n\r\n\t\t\t\t\t\t\tn1 = morphNormals[ vk ].faceNormals[ chf ];\r\n\t\t\t\t\t\t\tn2 = n1;\r\n\t\t\t\t\t\t\tn3 = n1;\r\n\r\n\t\t\t\t\t\t} else {\r\n\r\n\t\t\t\t\t\t\tfaceVertexNormals = morphNormals[ vk ].vertexNormals[ chf ];\r\n\r\n\t\t\t\t\t\t\tn1 = faceVertexNormals.a;\r\n\t\t\t\t\t\t\tn2 = faceVertexNormals.b;\r\n\t\t\t\t\t\t\tn3 = faceVertexNormals.c;\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\tnka = morphNormalsArrays[ vk ];\r\n\r\n\t\t\t\t\t\tnka[ offset_morphTarget ] = n1.x;\r\n\t\t\t\t\t\tnka[ offset_morphTarget + 1 ] = n1.y;\r\n\t\t\t\t\t\tnka[ offset_morphTarget + 2 ] = n1.z;\r\n\r\n\t\t\t\t\t\tnka[ offset_morphTarget + 3 ] = n2.x;\r\n\t\t\t\t\t\tnka[ offset_morphTarget + 4 ] = n2.y;\r\n\t\t\t\t\t\tnka[ offset_morphTarget + 5 ] = n2.z;\r\n\r\n\t\t\t\t\t\tnka[ offset_morphTarget + 6 ] = n3.x;\r\n\t\t\t\t\t\tnka[ offset_morphTarget + 7 ] = n3.y;\r\n\t\t\t\t\t\tnka[ offset_morphTarget + 8 ] = n3.z;\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\t//\r\n\r\n\t\t\t\t\toffset_morphTarget += 9;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\t_gl.bindBuffer( _gl.ARRAY_BUFFER, geometryGroup.__webglMorphTargetsBuffers[ vk ] );\r\n\t\t\t\t_gl.bufferData( _gl.ARRAY_BUFFER, morphTargetsArrays[ vk ], hint );\r\n\r\n\t\t\t\tif ( material.morphNormals ) {\r\n\r\n\t\t\t\t\t_gl.bindBuffer( _gl.ARRAY_BUFFER, geometryGroup.__webglMorphNormalsBuffers[ vk ] );\r\n\t\t\t\t\t_gl.bufferData( _gl.ARRAY_BUFFER, morphNormalsArrays[ vk ], hint );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tif ( obj_skinWeights.length ) {\r\n\r\n\t\t\tfor ( f = 0, fl = chunk_faces3.length; f < fl; f ++ ) {\r\n\r\n\t\t\t\tface = obj_faces[ chunk_faces3[ f ] ];\r\n\r\n\t\t\t\t// weights\r\n\r\n\t\t\t\tsw1 = obj_skinWeights[ face.a ];\r\n\t\t\t\tsw2 = obj_skinWeights[ face.b ];\r\n\t\t\t\tsw3 = obj_skinWeights[ face.c ];\r\n\r\n\t\t\t\tskinWeightArray[ offset_skin ] = sw1.x;\r\n\t\t\t\tskinWeightArray[ offset_skin + 1 ] = sw1.y;\r\n\t\t\t\tskinWeightArray[ offset_skin + 2 ] = sw1.z;\r\n\t\t\t\tskinWeightArray[ offset_skin + 3 ] = sw1.w;\r\n\r\n\t\t\t\tskinWeightArray[ offset_skin + 4 ] = sw2.x;\r\n\t\t\t\tskinWeightArray[ offset_skin + 5 ] = sw2.y;\r\n\t\t\t\tskinWeightArray[ offset_skin + 6 ] = sw2.z;\r\n\t\t\t\tskinWeightArray[ offset_skin + 7 ] = sw2.w;\r\n\r\n\t\t\t\tskinWeightArray[ offset_skin + 8 ] = sw3.x;\r\n\t\t\t\tskinWeightArray[ offset_skin + 9 ] = sw3.y;\r\n\t\t\t\tskinWeightArray[ offset_skin + 10 ] = sw3.z;\r\n\t\t\t\tskinWeightArray[ offset_skin + 11 ] = sw3.w;\r\n\r\n\t\t\t\t// indices\r\n\r\n\t\t\t\tsi1 = obj_skinIndices[ face.a ];\r\n\t\t\t\tsi2 = obj_skinIndices[ face.b ];\r\n\t\t\t\tsi3 = obj_skinIndices[ face.c ];\r\n\r\n\t\t\t\tskinIndexArray[ offset_skin ] = si1.x;\r\n\t\t\t\tskinIndexArray[ offset_skin + 1 ] = si1.y;\r\n\t\t\t\tskinIndexArray[ offset_skin + 2 ] = si1.z;\r\n\t\t\t\tskinIndexArray[ offset_skin + 3 ] = si1.w;\r\n\r\n\t\t\t\tskinIndexArray[ offset_skin + 4 ] = si2.x;\r\n\t\t\t\tskinIndexArray[ offset_skin + 5 ] = si2.y;\r\n\t\t\t\tskinIndexArray[ offset_skin + 6 ] = si2.z;\r\n\t\t\t\tskinIndexArray[ offset_skin + 7 ] = si2.w;\r\n\r\n\t\t\t\tskinIndexArray[ offset_skin + 8 ] = si3.x;\r\n\t\t\t\tskinIndexArray[ offset_skin + 9 ] = si3.y;\r\n\t\t\t\tskinIndexArray[ offset_skin + 10 ] = si3.z;\r\n\t\t\t\tskinIndexArray[ offset_skin + 11 ] = si3.w;\r\n\r\n\t\t\t\toffset_skin += 12;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( offset_skin > 0 ) {\r\n\r\n\t\t\t\t_gl.bindBuffer( _gl.ARRAY_BUFFER, geometryGroup.__webglSkinIndicesBuffer );\r\n\t\t\t\t_gl.bufferData( _gl.ARRAY_BUFFER, skinIndexArray, hint );\r\n\r\n\t\t\t\t_gl.bindBuffer( _gl.ARRAY_BUFFER, geometryGroup.__webglSkinWeightsBuffer );\r\n\t\t\t\t_gl.bufferData( _gl.ARRAY_BUFFER, skinWeightArray, hint );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tif ( dirtyColors ) {\r\n\r\n\t\t\tfor ( f = 0, fl = chunk_faces3.length; f < fl; f ++ ) {\r\n\r\n\t\t\t\tface = obj_faces[ chunk_faces3[ f ] ];\r\n\r\n\t\t\t\tvertexColors = face.vertexColors;\r\n\t\t\t\tfaceColor = face.color;\r\n\r\n\t\t\t\tif ( vertexColors.length === 3 && material.vertexColors === THREE.VertexColors ) {\r\n\r\n\t\t\t\t\tc1 = vertexColors[ 0 ];\r\n\t\t\t\t\tc2 = vertexColors[ 1 ];\r\n\t\t\t\t\tc3 = vertexColors[ 2 ];\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\tc1 = faceColor;\r\n\t\t\t\t\tc2 = faceColor;\r\n\t\t\t\t\tc3 = faceColor;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tcolorArray[ offset_color ] = c1.r;\r\n\t\t\t\tcolorArray[ offset_color + 1 ] = c1.g;\r\n\t\t\t\tcolorArray[ offset_color + 2 ] = c1.b;\r\n\r\n\t\t\t\tcolorArray[ offset_color + 3 ] = c2.r;\r\n\t\t\t\tcolorArray[ offset_color + 4 ] = c2.g;\r\n\t\t\t\tcolorArray[ offset_color + 5 ] = c2.b;\r\n\r\n\t\t\t\tcolorArray[ offset_color + 6 ] = c3.r;\r\n\t\t\t\tcolorArray[ offset_color + 7 ] = c3.g;\r\n\t\t\t\tcolorArray[ offset_color + 8 ] = c3.b;\r\n\r\n\t\t\t\toffset_color += 9;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( offset_color > 0 ) {\r\n\r\n\t\t\t\t_gl.bindBuffer( _gl.ARRAY_BUFFER, geometryGroup.__webglColorBuffer );\r\n\t\t\t\t_gl.bufferData( _gl.ARRAY_BUFFER, colorArray, hint );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tif ( dirtyTangents && geometry.hasTangents ) {\r\n\r\n\t\t\tfor ( f = 0, fl = chunk_faces3.length; f < fl; f ++ ) {\r\n\r\n\t\t\t\tface = obj_faces[ chunk_faces3[ f ] ];\r\n\r\n\t\t\t\tvertexTangents = face.vertexTangents;\r\n\r\n\t\t\t\tt1 = vertexTangents[ 0 ];\r\n\t\t\t\tt2 = vertexTangents[ 1 ];\r\n\t\t\t\tt3 = vertexTangents[ 2 ];\r\n\r\n\t\t\t\ttangentArray[ offset_tangent ] = t1.x;\r\n\t\t\t\ttangentArray[ offset_tangent + 1 ] = t1.y;\r\n\t\t\t\ttangentArray[ offset_tangent + 2 ] = t1.z;\r\n\t\t\t\ttangentArray[ offset_tangent + 3 ] = t1.w;\r\n\r\n\t\t\t\ttangentArray[ offset_tangent + 4 ] = t2.x;\r\n\t\t\t\ttangentArray[ offset_tangent + 5 ] = t2.y;\r\n\t\t\t\ttangentArray[ offset_tangent + 6 ] = t2.z;\r\n\t\t\t\ttangentArray[ offset_tangent + 7 ] = t2.w;\r\n\r\n\t\t\t\ttangentArray[ offset_tangent + 8 ] = t3.x;\r\n\t\t\t\ttangentArray[ offset_tangent + 9 ] = t3.y;\r\n\t\t\t\ttangentArray[ offset_tangent + 10 ] = t3.z;\r\n\t\t\t\ttangentArray[ offset_tangent + 11 ] = t3.w;\r\n\r\n\t\t\t\toffset_tangent += 12;\r\n\r\n\t\t\t}\r\n\r\n\t\t\t_gl.bindBuffer( _gl.ARRAY_BUFFER, geometryGroup.__webglTangentBuffer );\r\n\t\t\t_gl.bufferData( _gl.ARRAY_BUFFER, tangentArray, hint );\r\n\r\n\t\t}\r\n\r\n\t\tif ( dirtyNormals ) {\r\n\r\n\t\t\tfor ( f = 0, fl = chunk_faces3.length; f < fl; f ++ ) {\r\n\r\n\t\t\t\tface = obj_faces[ chunk_faces3[ f ] ];\r\n\r\n\t\t\t\tvertexNormals = face.vertexNormals;\r\n\t\t\t\tfaceNormal = face.normal;\r\n\r\n\t\t\t\tif ( vertexNormals.length === 3 && needsFaceNormals === false ) {\r\n\r\n\t\t\t\t\tfor ( i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\t\t\t\tvn = vertexNormals[ i ];\r\n\r\n\t\t\t\t\t\tnormalArray[ offset_normal ] = vn.x;\r\n\t\t\t\t\t\tnormalArray[ offset_normal + 1 ] = vn.y;\r\n\t\t\t\t\t\tnormalArray[ offset_normal + 2 ] = vn.z;\r\n\r\n\t\t\t\t\t\toffset_normal += 3;\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\tfor ( i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\t\t\t\tnormalArray[ offset_normal ] = faceNormal.x;\r\n\t\t\t\t\t\tnormalArray[ offset_normal + 1 ] = faceNormal.y;\r\n\t\t\t\t\t\tnormalArray[ offset_normal + 2 ] = faceNormal.z;\r\n\r\n\t\t\t\t\t\toffset_normal += 3;\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\t_gl.bindBuffer( _gl.ARRAY_BUFFER, geometryGroup.__webglNormalBuffer );\r\n\t\t\t_gl.bufferData( _gl.ARRAY_BUFFER, normalArray, hint );\r\n\r\n\t\t}\r\n\r\n\t\tif ( dirtyUvs && obj_uvs ) {\r\n\r\n\t\t\tfor ( f = 0, fl = chunk_faces3.length; f < fl; f ++ ) {\r\n\r\n\t\t\t\tfi = chunk_faces3[ f ];\r\n\r\n\t\t\t\tuv = obj_uvs[ fi ];\r\n\r\n\t\t\t\tif ( uv === undefined ) continue;\r\n\r\n\t\t\t\tfor ( i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\t\t\tuvi = uv[ i ];\r\n\r\n\t\t\t\t\tuvArray[ offset_uv ] = uvi.x;\r\n\t\t\t\t\tuvArray[ offset_uv + 1 ] = uvi.y;\r\n\r\n\t\t\t\t\toffset_uv += 2;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( offset_uv > 0 ) {\r\n\r\n\t\t\t\t_gl.bindBuffer( _gl.ARRAY_BUFFER, geometryGroup.__webglUVBuffer );\r\n\t\t\t\t_gl.bufferData( _gl.ARRAY_BUFFER, uvArray, hint );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tif ( dirtyUvs && obj_uvs2 ) {\r\n\r\n\t\t\tfor ( f = 0, fl = chunk_faces3.length; f < fl; f ++ ) {\r\n\r\n\t\t\t\tfi = chunk_faces3[ f ];\r\n\r\n\t\t\t\tuv2 = obj_uvs2[ fi ];\r\n\r\n\t\t\t\tif ( uv2 === undefined ) continue;\r\n\r\n\t\t\t\tfor ( i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\t\t\tuv2i = uv2[ i ];\r\n\r\n\t\t\t\t\tuv2Array[ offset_uv2 ] = uv2i.x;\r\n\t\t\t\t\tuv2Array[ offset_uv2 + 1 ] = uv2i.y;\r\n\r\n\t\t\t\t\toffset_uv2 += 2;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( offset_uv2 > 0 ) {\r\n\r\n\t\t\t\t_gl.bindBuffer( _gl.ARRAY_BUFFER, geometryGroup.__webglUV2Buffer );\r\n\t\t\t\t_gl.bufferData( _gl.ARRAY_BUFFER, uv2Array, hint );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tif ( dirtyElements ) {\r\n\r\n\t\t\tfor ( f = 0, fl = chunk_faces3.length; f < fl; f ++ ) {\r\n\r\n\t\t\t\tfaceArray[ offset_face ] = vertexIndex;\r\n\t\t\t\tfaceArray[ offset_face + 1 ] = vertexIndex + 1;\r\n\t\t\t\tfaceArray[ offset_face + 2 ] = vertexIndex + 2;\r\n\r\n\t\t\t\toffset_face += 3;\r\n\r\n\t\t\t\tlineArray[ offset_line ] = vertexIndex;\r\n\t\t\t\tlineArray[ offset_line + 1 ] = vertexIndex + 1;\r\n\r\n\t\t\t\tlineArray[ offset_line + 2 ] = vertexIndex;\r\n\t\t\t\tlineArray[ offset_line + 3 ] = vertexIndex + 2;\r\n\r\n\t\t\t\tlineArray[ offset_line + 4 ] = vertexIndex + 1;\r\n\t\t\t\tlineArray[ offset_line + 5 ] = vertexIndex + 2;\r\n\r\n\t\t\t\toffset_line += 6;\r\n\r\n\t\t\t\tvertexIndex += 3;\r\n\r\n\t\t\t}\r\n\r\n\t\t\t_gl.bindBuffer( _gl.ELEMENT_ARRAY_BUFFER, geometryGroup.__webglFaceBuffer );\r\n\t\t\t_gl.bufferData( _gl.ELEMENT_ARRAY_BUFFER, faceArray, hint );\r\n\r\n\t\t\t_gl.bindBuffer( _gl.ELEMENT_ARRAY_BUFFER, geometryGroup.__webglLineBuffer );\r\n\t\t\t_gl.bufferData( _gl.ELEMENT_ARRAY_BUFFER, lineArray, hint );\r\n\r\n\t\t}\r\n\r\n\t\tif ( customAttributes ) {\r\n\r\n\t\t\tfor ( i = 0, il = customAttributes.length; i < il; i ++ ) {\r\n\r\n\t\t\t\tcustomAttribute = customAttributes[ i ];\r\n\r\n\t\t\t\tif ( ! customAttribute.__original.needsUpdate ) continue;\r\n\r\n\t\t\t\toffset_custom = 0;\r\n\r\n\t\t\t\tif ( customAttribute.size === 1 ) {\r\n\r\n\t\t\t\t\tif ( customAttribute.boundTo === undefined || customAttribute.boundTo === 'vertices' ) {\r\n\r\n\t\t\t\t\t\tfor ( f = 0, fl = chunk_faces3.length; f < fl; f ++ ) {\r\n\r\n\t\t\t\t\t\t\tface = obj_faces[ chunk_faces3[ f ] ];\r\n\r\n\t\t\t\t\t\t\tcustomAttribute.array[ offset_custom ] = customAttribute.value[ face.a ];\r\n\t\t\t\t\t\t\tcustomAttribute.array[ offset_custom + 1 ] = customAttribute.value[ face.b ];\r\n\t\t\t\t\t\t\tcustomAttribute.array[ offset_custom + 2 ] = customAttribute.value[ face.c ];\r\n\r\n\t\t\t\t\t\t\toffset_custom += 3;\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t} else if ( customAttribute.boundTo === 'faces' ) {\r\n\r\n\t\t\t\t\t\tfor ( f = 0, fl = chunk_faces3.length; f < fl; f ++ ) {\r\n\r\n\t\t\t\t\t\t\tvalue = customAttribute.value[ chunk_faces3[ f ] ];\r\n\r\n\t\t\t\t\t\t\tcustomAttribute.array[ offset_custom ] = value;\r\n\t\t\t\t\t\t\tcustomAttribute.array[ offset_custom + 1 ] = value;\r\n\t\t\t\t\t\t\tcustomAttribute.array[ offset_custom + 2 ] = value;\r\n\r\n\t\t\t\t\t\t\toffset_custom += 3;\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t} else if ( customAttribute.size === 2 ) {\r\n\r\n\t\t\t\t\tif ( customAttribute.boundTo === undefined || customAttribute.boundTo === 'vertices' ) {\r\n\r\n\t\t\t\t\t\tfor ( f = 0, fl = chunk_faces3.length; f < fl; f ++ ) {\r\n\r\n\t\t\t\t\t\t\tface = obj_faces[ chunk_faces3[ f ] ];\r\n\r\n\t\t\t\t\t\t\tv1 = customAttribute.value[ face.a ];\r\n\t\t\t\t\t\t\tv2 = customAttribute.value[ face.b ];\r\n\t\t\t\t\t\t\tv3 = customAttribute.value[ face.c ];\r\n\r\n\t\t\t\t\t\t\tcustomAttribute.array[ offset_custom ] = v1.x;\r\n\t\t\t\t\t\t\tcustomAttribute.array[ offset_custom + 1 ] = v1.y;\r\n\r\n\t\t\t\t\t\t\tcustomAttribute.array[ offset_custom + 2 ] = v2.x;\r\n\t\t\t\t\t\t\tcustomAttribute.array[ offset_custom + 3 ] = v2.y;\r\n\r\n\t\t\t\t\t\t\tcustomAttribute.array[ offset_custom + 4 ] = v3.x;\r\n\t\t\t\t\t\t\tcustomAttribute.array[ offset_custom + 5 ] = v3.y;\r\n\r\n\t\t\t\t\t\t\toffset_custom += 6;\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t} else if ( customAttribute.boundTo === 'faces' ) {\r\n\r\n\t\t\t\t\t\tfor ( f = 0, fl = chunk_faces3.length; f < fl; f ++ ) {\r\n\r\n\t\t\t\t\t\t\tvalue = customAttribute.value[ chunk_faces3[ f ] ];\r\n\r\n\t\t\t\t\t\t\tv1 = value;\r\n\t\t\t\t\t\t\tv2 = value;\r\n\t\t\t\t\t\t\tv3 = value;\r\n\r\n\t\t\t\t\t\t\tcustomAttribute.array[ offset_custom ] = v1.x;\r\n\t\t\t\t\t\t\tcustomAttribute.array[ offset_custom + 1 ] = v1.y;\r\n\r\n\t\t\t\t\t\t\tcustomAttribute.array[ offset_custom + 2 ] = v2.x;\r\n\t\t\t\t\t\t\tcustomAttribute.array[ offset_custom + 3 ] = v2.y;\r\n\r\n\t\t\t\t\t\t\tcustomAttribute.array[ offset_custom + 4 ] = v3.x;\r\n\t\t\t\t\t\t\tcustomAttribute.array[ offset_custom + 5 ] = v3.y;\r\n\r\n\t\t\t\t\t\t\toffset_custom += 6;\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t} else if ( customAttribute.size === 3 ) {\r\n\r\n\t\t\t\t\tvar pp;\r\n\r\n\t\t\t\t\tif ( customAttribute.type === 'c' ) {\r\n\r\n\t\t\t\t\t\tpp = [ 'r', 'g', 'b' ];\r\n\r\n\t\t\t\t\t} else {\r\n\r\n\t\t\t\t\t\tpp = [ 'x', 'y', 'z' ];\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tif ( customAttribute.boundTo === undefined || customAttribute.boundTo === 'vertices' ) {\r\n\r\n\t\t\t\t\t\tfor ( f = 0, fl = chunk_faces3.length; f < fl; f ++ ) {\r\n\r\n\t\t\t\t\t\t\tface = obj_faces[ chunk_faces3[ f ] ];\r\n\r\n\t\t\t\t\t\t\tv1 = customAttribute.value[ face.a ];\r\n\t\t\t\t\t\t\tv2 = customAttribute.value[ face.b ];\r\n\t\t\t\t\t\t\tv3 = customAttribute.value[ face.c ];\r\n\r\n\t\t\t\t\t\t\tcustomAttribute.array[ offset_custom ] = v1[ pp[ 0 ] ];\r\n\t\t\t\t\t\t\tcustomAttribute.array[ offset_custom + 1 ] = v1[ pp[ 1 ] ];\r\n\t\t\t\t\t\t\tcustomAttribute.array[ offset_custom + 2 ] = v1[ pp[ 2 ] ];\r\n\r\n\t\t\t\t\t\t\tcustomAttribute.array[ offset_custom + 3 ] = v2[ pp[ 0 ] ];\r\n\t\t\t\t\t\t\tcustomAttribute.array[ offset_custom + 4 ] = v2[ pp[ 1 ] ];\r\n\t\t\t\t\t\t\tcustomAttribute.array[ offset_custom + 5 ] = v2[ pp[ 2 ] ];\r\n\r\n\t\t\t\t\t\t\tcustomAttribute.array[ offset_custom + 6 ] = v3[ pp[ 0 ] ];\r\n\t\t\t\t\t\t\tcustomAttribute.array[ offset_custom + 7 ] = v3[ pp[ 1 ] ];\r\n\t\t\t\t\t\t\tcustomAttribute.array[ offset_custom + 8 ] = v3[ pp[ 2 ] ];\r\n\r\n\t\t\t\t\t\t\toffset_custom += 9;\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t} else if ( customAttribute.boundTo === 'faces' ) {\r\n\r\n\t\t\t\t\t\tfor ( f = 0, fl = chunk_faces3.length; f < fl; f ++ ) {\r\n\r\n\t\t\t\t\t\t\tvalue = customAttribute.value[ chunk_faces3[ f ] ];\r\n\r\n\t\t\t\t\t\t\tv1 = value;\r\n\t\t\t\t\t\t\tv2 = value;\r\n\t\t\t\t\t\t\tv3 = value;\r\n\r\n\t\t\t\t\t\t\tcustomAttribute.array[ offset_custom ] = v1[ pp[ 0 ] ];\r\n\t\t\t\t\t\t\tcustomAttribute.array[ offset_custom + 1 ] = v1[ pp[ 1 ] ];\r\n\t\t\t\t\t\t\tcustomAttribute.array[ offset_custom + 2 ] = v1[ pp[ 2 ] ];\r\n\r\n\t\t\t\t\t\t\tcustomAttribute.array[ offset_custom + 3 ] = v2[ pp[ 0 ] ];\r\n\t\t\t\t\t\t\tcustomAttribute.array[ offset_custom + 4 ] = v2[ pp[ 1 ] ];\r\n\t\t\t\t\t\t\tcustomAttribute.array[ offset_custom + 5 ] = v2[ pp[ 2 ] ];\r\n\r\n\t\t\t\t\t\t\tcustomAttribute.array[ offset_custom + 6 ] = v3[ pp[ 0 ] ];\r\n\t\t\t\t\t\t\tcustomAttribute.array[ offset_custom + 7 ] = v3[ pp[ 1 ] ];\r\n\t\t\t\t\t\t\tcustomAttribute.array[ offset_custom + 8 ] = v3[ pp[ 2 ] ];\r\n\r\n\t\t\t\t\t\t\toffset_custom += 9;\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t} else if ( customAttribute.boundTo === 'faceVertices' ) {\r\n\r\n\t\t\t\t\t\tfor ( f = 0, fl = chunk_faces3.length; f < fl; f ++ ) {\r\n\r\n\t\t\t\t\t\t\tvalue = customAttribute.value[ chunk_faces3[ f ] ];\r\n\r\n\t\t\t\t\t\t\tv1 = value[ 0 ];\r\n\t\t\t\t\t\t\tv2 = value[ 1 ];\r\n\t\t\t\t\t\t\tv3 = value[ 2 ];\r\n\r\n\t\t\t\t\t\t\tcustomAttribute.array[ offset_custom ] = v1[ pp[ 0 ] ];\r\n\t\t\t\t\t\t\tcustomAttribute.array[ offset_custom + 1 ] = v1[ pp[ 1 ] ];\r\n\t\t\t\t\t\t\tcustomAttribute.array[ offset_custom + 2 ] = v1[ pp[ 2 ] ];\r\n\r\n\t\t\t\t\t\t\tcustomAttribute.array[ offset_custom + 3 ] = v2[ pp[ 0 ] ];\r\n\t\t\t\t\t\t\tcustomAttribute.array[ offset_custom + 4 ] = v2[ pp[ 1 ] ];\r\n\t\t\t\t\t\t\tcustomAttribute.array[ offset_custom + 5 ] = v2[ pp[ 2 ] ];\r\n\r\n\t\t\t\t\t\t\tcustomAttribute.array[ offset_custom + 6 ] = v3[ pp[ 0 ] ];\r\n\t\t\t\t\t\t\tcustomAttribute.array[ offset_custom + 7 ] = v3[ pp[ 1 ] ];\r\n\t\t\t\t\t\t\tcustomAttribute.array[ offset_custom + 8 ] = v3[ pp[ 2 ] ];\r\n\r\n\t\t\t\t\t\t\toffset_custom += 9;\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t} else if ( customAttribute.size === 4 ) {\r\n\r\n\t\t\t\t\tif ( customAttribute.boundTo === undefined || customAttribute.boundTo === 'vertices' ) {\r\n\r\n\t\t\t\t\t\tfor ( f = 0, fl = chunk_faces3.length; f < fl; f ++ ) {\r\n\r\n\t\t\t\t\t\t\tface = obj_faces[ chunk_faces3[ f ] ];\r\n\r\n\t\t\t\t\t\t\tv1 = customAttribute.value[ face.a ];\r\n\t\t\t\t\t\t\tv2 = customAttribute.value[ face.b ];\r\n\t\t\t\t\t\t\tv3 = customAttribute.value[ face.c ];\r\n\r\n\t\t\t\t\t\t\tcustomAttribute.array[ offset_custom ] = v1.x;\r\n\t\t\t\t\t\t\tcustomAttribute.array[ offset_custom + 1 ] = v1.y;\r\n\t\t\t\t\t\t\tcustomAttribute.array[ offset_custom + 2 ] = v1.z;\r\n\t\t\t\t\t\t\tcustomAttribute.array[ offset_custom + 3 ] = v1.w;\r\n\r\n\t\t\t\t\t\t\tcustomAttribute.array[ offset_custom + 4 ] = v2.x;\r\n\t\t\t\t\t\t\tcustomAttribute.array[ offset_custom + 5 ] = v2.y;\r\n\t\t\t\t\t\t\tcustomAttribute.array[ offset_custom + 6 ] = v2.z;\r\n\t\t\t\t\t\t\tcustomAttribute.array[ offset_custom + 7 ] = v2.w;\r\n\r\n\t\t\t\t\t\t\tcustomAttribute.array[ offset_custom + 8 ] = v3.x;\r\n\t\t\t\t\t\t\tcustomAttribute.array[ offset_custom + 9 ] = v3.y;\r\n\t\t\t\t\t\t\tcustomAttribute.array[ offset_custom + 10 ] = v3.z;\r\n\t\t\t\t\t\t\tcustomAttribute.array[ offset_custom + 11 ] = v3.w;\r\n\r\n\t\t\t\t\t\t\toffset_custom += 12;\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t} else if ( customAttribute.boundTo === 'faces' ) {\r\n\r\n\t\t\t\t\t\tfor ( f = 0, fl = chunk_faces3.length; f < fl; f ++ ) {\r\n\r\n\t\t\t\t\t\t\tvalue = customAttribute.value[ chunk_faces3[ f ] ];\r\n\r\n\t\t\t\t\t\t\tv1 = value;\r\n\t\t\t\t\t\t\tv2 = value;\r\n\t\t\t\t\t\t\tv3 = value;\r\n\r\n\t\t\t\t\t\t\tcustomAttribute.array[ offset_custom ] = v1.x;\r\n\t\t\t\t\t\t\tcustomAttribute.array[ offset_custom + 1 ] = v1.y;\r\n\t\t\t\t\t\t\tcustomAttribute.array[ offset_custom + 2 ] = v1.z;\r\n\t\t\t\t\t\t\tcustomAttribute.array[ offset_custom + 3 ] = v1.w;\r\n\r\n\t\t\t\t\t\t\tcustomAttribute.array[ offset_custom + 4 ] = v2.x;\r\n\t\t\t\t\t\t\tcustomAttribute.array[ offset_custom + 5 ] = v2.y;\r\n\t\t\t\t\t\t\tcustomAttribute.array[ offset_custom + 6 ] = v2.z;\r\n\t\t\t\t\t\t\tcustomAttribute.array[ offset_custom + 7 ] = v2.w;\r\n\r\n\t\t\t\t\t\t\tcustomAttribute.array[ offset_custom + 8 ] = v3.x;\r\n\t\t\t\t\t\t\tcustomAttribute.array[ offset_custom + 9 ] = v3.y;\r\n\t\t\t\t\t\t\tcustomAttribute.array[ offset_custom + 10 ] = v3.z;\r\n\t\t\t\t\t\t\tcustomAttribute.array[ offset_custom + 11 ] = v3.w;\r\n\r\n\t\t\t\t\t\t\toffset_custom += 12;\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t} else if ( customAttribute.boundTo === 'faceVertices' ) {\r\n\r\n\t\t\t\t\t\tfor ( f = 0, fl = chunk_faces3.length; f < fl; f ++ ) {\r\n\r\n\t\t\t\t\t\t\tvalue = customAttribute.value[ chunk_faces3[ f ] ];\r\n\r\n\t\t\t\t\t\t\tv1 = value[ 0 ];\r\n\t\t\t\t\t\t\tv2 = value[ 1 ];\r\n\t\t\t\t\t\t\tv3 = value[ 2 ];\r\n\r\n\t\t\t\t\t\t\tcustomAttribute.array[ offset_custom ] = v1.x;\r\n\t\t\t\t\t\t\tcustomAttribute.array[ offset_custom + 1 ] = v1.y;\r\n\t\t\t\t\t\t\tcustomAttribute.array[ offset_custom + 2 ] = v1.z;\r\n\t\t\t\t\t\t\tcustomAttribute.array[ offset_custom + 3 ] = v1.w;\r\n\r\n\t\t\t\t\t\t\tcustomAttribute.array[ offset_custom + 4 ] = v2.x;\r\n\t\t\t\t\t\t\tcustomAttribute.array[ offset_custom + 5 ] = v2.y;\r\n\t\t\t\t\t\t\tcustomAttribute.array[ offset_custom + 6 ] = v2.z;\r\n\t\t\t\t\t\t\tcustomAttribute.array[ offset_custom + 7 ] = v2.w;\r\n\r\n\t\t\t\t\t\t\tcustomAttribute.array[ offset_custom + 8 ] = v3.x;\r\n\t\t\t\t\t\t\tcustomAttribute.array[ offset_custom + 9 ] = v3.y;\r\n\t\t\t\t\t\t\tcustomAttribute.array[ offset_custom + 10 ] = v3.z;\r\n\t\t\t\t\t\t\tcustomAttribute.array[ offset_custom + 11 ] = v3.w;\r\n\r\n\t\t\t\t\t\t\toffset_custom += 12;\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\t_gl.bindBuffer( _gl.ARRAY_BUFFER, customAttribute.buffer );\r\n\t\t\t\t_gl.bufferData( _gl.ARRAY_BUFFER, customAttribute.array, hint );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tif ( dispose ) {\r\n\r\n\t\t\tdelete geometryGroup.__inittedArrays;\r\n\t\t\tdelete geometryGroup.__colorArray;\r\n\t\t\tdelete geometryGroup.__normalArray;\r\n\t\t\tdelete geometryGroup.__tangentArray;\r\n\t\t\tdelete geometryGroup.__uvArray;\r\n\t\t\tdelete geometryGroup.__uv2Array;\r\n\t\t\tdelete geometryGroup.__faceArray;\r\n\t\t\tdelete geometryGroup.__vertexArray;\r\n\t\t\tdelete geometryGroup.__lineArray;\r\n\t\t\tdelete geometryGroup.__skinIndexArray;\r\n\t\t\tdelete geometryGroup.__skinWeightArray;\r\n\r\n\t\t}\r\n\r\n\t};\r\n\r\n\t// Buffer rendering\r\n\r\n\tthis.renderBufferImmediate = function ( object, program, material ) {\r\n\r\n\t\tstate.initAttributes();\r\n\r\n\t\tif ( object.hasPositions && ! object.__webglVertexBuffer ) object.__webglVertexBuffer = _gl.createBuffer();\r\n\t\tif ( object.hasNormals && ! object.__webglNormalBuffer ) object.__webglNormalBuffer = _gl.createBuffer();\r\n\t\tif ( object.hasUvs && ! object.__webglUvBuffer ) object.__webglUvBuffer = _gl.createBuffer();\r\n\t\tif ( object.hasColors && ! object.__webglColorBuffer ) object.__webglColorBuffer = _gl.createBuffer();\r\n\r\n\t\tif ( object.hasPositions ) {\r\n\r\n\t\t\t_gl.bindBuffer( _gl.ARRAY_BUFFER, object.__webglVertexBuffer );\r\n\t\t\t_gl.bufferData( _gl.ARRAY_BUFFER, object.positionArray, _gl.DYNAMIC_DRAW );\r\n\r\n\t\t\tstate.enableAttribute( program.attributes.position );\r\n\r\n\t\t\t_gl.vertexAttribPointer( program.attributes.position, 3, _gl.FLOAT, false, 0, 0 );\r\n\r\n\t\t}\r\n\r\n\t\tif ( object.hasNormals ) {\r\n\r\n\t\t\t_gl.bindBuffer( _gl.ARRAY_BUFFER, object.__webglNormalBuffer );\r\n\r\n\t\t\tif ( material instanceof THREE.MeshPhongMaterial === false &&\r\n\t\t\t\t material.shading === THREE.FlatShading ) {\r\n\r\n\t\t\t\tvar nx, ny, nz,\r\n\t\t\t\t\tnax, nbx, ncx, nay, nby, ncy, naz, nbz, ncz,\r\n\t\t\t\t\tnormalArray,\r\n\t\t\t\t\ti, il = object.count * 3;\r\n\r\n\t\t\t\tfor ( i = 0; i < il; i += 9 ) {\r\n\r\n\t\t\t\t\tnormalArray = object.normalArray;\r\n\r\n\t\t\t\t\tnax = normalArray[ i ];\r\n\t\t\t\t\tnay = normalArray[ i + 1 ];\r\n\t\t\t\t\tnaz = normalArray[ i + 2 ];\r\n\r\n\t\t\t\t\tnbx = normalArray[ i + 3 ];\r\n\t\t\t\t\tnby = normalArray[ i + 4 ];\r\n\t\t\t\t\tnbz = normalArray[ i + 5 ];\r\n\r\n\t\t\t\t\tncx = normalArray[ i + 6 ];\r\n\t\t\t\t\tncy = normalArray[ i + 7 ];\r\n\t\t\t\t\tncz = normalArray[ i + 8 ];\r\n\r\n\t\t\t\t\tnx = ( nax + nbx + ncx ) / 3;\r\n\t\t\t\t\tny = ( nay + nby + ncy ) / 3;\r\n\t\t\t\t\tnz = ( naz + nbz + ncz ) / 3;\r\n\r\n\t\t\t\t\tnormalArray[ i ] = nx;\r\n\t\t\t\t\tnormalArray[ i + 1 ] = ny;\r\n\t\t\t\t\tnormalArray[ i + 2 ] = nz;\r\n\r\n\t\t\t\t\tnormalArray[ i + 3 ] = nx;\r\n\t\t\t\t\tnormalArray[ i + 4 ] = ny;\r\n\t\t\t\t\tnormalArray[ i + 5 ] = nz;\r\n\r\n\t\t\t\t\tnormalArray[ i + 6 ] = nx;\r\n\t\t\t\t\tnormalArray[ i + 7 ] = ny;\r\n\t\t\t\t\tnormalArray[ i + 8 ] = nz;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\t_gl.bufferData( _gl.ARRAY_BUFFER, object.normalArray, _gl.DYNAMIC_DRAW );\r\n\r\n\t\t\tstate.enableAttribute( program.attributes.normal );\r\n\r\n\t\t\t_gl.vertexAttribPointer( program.attributes.normal, 3, _gl.FLOAT, false, 0, 0 );\r\n\r\n\t\t}\r\n\r\n\t\tif ( object.hasUvs && material.map ) {\r\n\r\n\t\t\t_gl.bindBuffer( _gl.ARRAY_BUFFER, object.__webglUvBuffer );\r\n\t\t\t_gl.bufferData( _gl.ARRAY_BUFFER, object.uvArray, _gl.DYNAMIC_DRAW );\r\n\r\n\t\t\tstate.enableAttribute( program.attributes.uv );\r\n\r\n\t\t\t_gl.vertexAttribPointer( program.attributes.uv, 2, _gl.FLOAT, false, 0, 0 );\r\n\r\n\t\t}\r\n\r\n\t\tif ( object.hasColors && material.vertexColors !== THREE.NoColors ) {\r\n\r\n\t\t\t_gl.bindBuffer( _gl.ARRAY_BUFFER, object.__webglColorBuffer );\r\n\t\t\t_gl.bufferData( _gl.ARRAY_BUFFER, object.colorArray, _gl.DYNAMIC_DRAW );\r\n\r\n\t\t\tstate.enableAttribute( program.attributes.color );\r\n\r\n\t\t\t_gl.vertexAttribPointer( program.attributes.color, 3, _gl.FLOAT, false, 0, 0 );\r\n\r\n\t\t}\r\n\r\n\t\tstate.disableUnusedAttributes();\r\n\r\n\t\t_gl.drawArrays( _gl.TRIANGLES, 0, object.count );\r\n\r\n\t\tobject.count = 0;\r\n\r\n\t};\r\n\r\n\tfunction setupVertexAttributes( material, program, geometry, startIndex ) {\r\n\r\n\t\tvar geometryAttributes = geometry.attributes;\r\n\r\n\t\tvar programAttributes = program.attributes;\r\n\t\tvar programAttributesKeys = program.attributesKeys;\r\n\r\n\t\tfor ( var i = 0, l = programAttributesKeys.length; i < l; i ++ ) {\r\n\r\n\t\t\tvar key = programAttributesKeys[ i ];\r\n\t\t\tvar programAttribute = programAttributes[ key ];\r\n\r\n\t\t\tif ( programAttribute >= 0 ) {\r\n\r\n\t\t\t\tvar geometryAttribute = geometryAttributes[ key ];\r\n\r\n\t\t\t\tif ( geometryAttribute !== undefined ) {\r\n\r\n\t\t\t\t\tvar size = geometryAttribute.itemSize;\r\n\r\n\t\t\t\t\t_gl.bindBuffer( _gl.ARRAY_BUFFER, geometryAttribute.buffer );\r\n\r\n\t\t\t\t\tstate.enableAttribute( programAttribute );\r\n\r\n\t\t\t\t\t_gl.vertexAttribPointer( programAttribute, size, _gl.FLOAT, false, 0, startIndex * size * 4 ); // 4 bytes per Float32\r\n\r\n\t\t\t\t} else if ( material.defaultAttributeValues !== undefined ) {\r\n\r\n\t\t\t\t\tif ( material.defaultAttributeValues[ key ].length === 2 ) {\r\n\r\n\t\t\t\t\t\t_gl.vertexAttrib2fv( programAttribute, material.defaultAttributeValues[ key ] );\r\n\r\n\t\t\t\t\t} else if ( material.defaultAttributeValues[ key ].length === 3 ) {\r\n\r\n\t\t\t\t\t\t_gl.vertexAttrib3fv( programAttribute, material.defaultAttributeValues[ key ] );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tstate.disableUnusedAttributes();\r\n\r\n\t}\r\n\r\n\tthis.renderBufferDirect = function ( camera, lights, fog, material, geometry, object ) {\r\n\r\n\t\tif ( material.visible === false ) return;\r\n\r\n\t\tupdateObject( object );\r\n\r\n\t\tvar program = setProgram( camera, lights, fog, material, object );\r\n\r\n\t\tvar updateBuffers = false,\r\n\t\t\twireframeBit = material.wireframe ? 1 : 0,\r\n\t\t\tgeometryProgram = 'direct_' + geometry.id + '_' + program.id + '_' + wireframeBit;\r\n\r\n\t\tif ( geometryProgram !== _currentGeometryProgram ) {\r\n\r\n\t\t\t_currentGeometryProgram = geometryProgram;\r\n\t\t\tupdateBuffers = true;\r\n\r\n\t\t}\r\n\r\n\t\tif ( updateBuffers ) {\r\n\r\n\t\t\tstate.initAttributes();\r\n\r\n\t\t}\r\n\r\n\t\t// render mesh\r\n\r\n\t\tif ( object instanceof THREE.Mesh ) {\r\n\r\n\t\t\tvar mode = material.wireframe === true ? _gl.LINES : _gl.TRIANGLES;\r\n\r\n\t\t\tvar index = geometry.attributes.index;\r\n\r\n\t\t\tif ( index ) {\r\n\r\n\t\t\t\t// indexed triangles\r\n\r\n\t\t\t\tvar type, size;\r\n\r\n\t\t\t\tif ( index.array instanceof Uint32Array && extensions.get( 'OES_element_index_uint' ) ) {\r\n\r\n\t\t\t\t\ttype = _gl.UNSIGNED_INT;\r\n\t\t\t\t\tsize = 4;\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\ttype = _gl.UNSIGNED_SHORT;\r\n\t\t\t\t\tsize = 2;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tvar offsets = geometry.offsets;\r\n\r\n\t\t\t\tif ( offsets.length === 0 ) {\r\n\r\n\t\t\t\t\tif ( updateBuffers ) {\r\n\r\n\t\t\t\t\t\tsetupVertexAttributes( material, program, geometry, 0 );\r\n\t\t\t\t\t\t_gl.bindBuffer( _gl.ELEMENT_ARRAY_BUFFER, index.buffer );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\t_gl.drawElements( mode, index.array.length, type, 0 );\r\n\r\n\t\t\t\t\t_this.info.render.calls ++;\r\n\t\t\t\t\t_this.info.render.vertices += index.array.length; // not really true, here vertices can be shared\r\n\t\t\t\t\t_this.info.render.faces += index.array.length / 3;\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\t// if there is more than 1 chunk\r\n\t\t\t\t\t// must set attribute pointers to use new offsets for each chunk\r\n\t\t\t\t\t// even if geometry and materials didn't change\r\n\r\n\t\t\t\t\tupdateBuffers = true;\r\n\r\n\t\t\t\t\tfor ( var i = 0, il = offsets.length; i < il; i ++ ) {\r\n\r\n\t\t\t\t\t\tvar startIndex = offsets[ i ].index;\r\n\r\n\t\t\t\t\t\tif ( updateBuffers ) {\r\n\r\n\t\t\t\t\t\t\tsetupVertexAttributes( material, program, geometry, startIndex );\r\n\t\t\t\t\t\t\t_gl.bindBuffer( _gl.ELEMENT_ARRAY_BUFFER, index.buffer );\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t// render indexed triangles\r\n\r\n\t\t\t\t\t\t_gl.drawElements( mode, offsets[ i ].count, type, offsets[ i ].start * size );\r\n\r\n\t\t\t\t\t\t_this.info.render.calls ++;\r\n\t\t\t\t\t\t_this.info.render.vertices += offsets[ i ].count; // not really true, here vertices can be shared\r\n\t\t\t\t\t\t_this.info.render.faces += offsets[ i ].count / 3;\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\t// non-indexed triangles\r\n\r\n\t\t\t\tif ( updateBuffers ) {\r\n\r\n\t\t\t\t\tsetupVertexAttributes( material, program, geometry, 0 );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tvar position = geometry.attributes[ 'position' ];\r\n\r\n\t\t\t\t// render non-indexed triangles\r\n\r\n\t\t\t\t_gl.drawArrays( mode, 0, position.array.length / position.itemSize );\r\n\r\n\t\t\t\t_this.info.render.calls ++;\r\n\t\t\t\t_this.info.render.vertices += position.array.length / position.itemSize;\r\n\t\t\t\t_this.info.render.faces += position.array.length / ( 3 * position.itemSize );\r\n\r\n\t\t\t}\r\n\r\n\t\t} else if ( object instanceof THREE.PointCloud ) {\r\n\r\n\t\t\t// render particles\r\n\r\n\t\t\tvar mode = _gl.POINTS;\r\n\r\n\t\t\tvar index = geometry.attributes.index;\r\n\r\n\t\t\tif ( index ) {\r\n\r\n\t\t\t\t// indexed points\r\n\r\n\t\t\t\tvar type, size;\r\n\r\n\t\t\t\tif ( index.array instanceof Uint32Array && extensions.get( 'OES_element_index_uint' ) ) {\r\n\r\n\t\t\t\t\ttype = _gl.UNSIGNED_INT;\r\n\t\t\t\t\tsize = 4;\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\ttype = _gl.UNSIGNED_SHORT;\r\n\t\t\t\t\tsize = 2;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tvar offsets = geometry.offsets;\r\n\r\n\t\t\t\tif ( offsets.length === 0 ) {\r\n\r\n\t\t\t\t\tif ( updateBuffers ) {\r\n\r\n\t\t\t\t\t\tsetupVertexAttributes( material, program, geometry, 0 );\r\n\t\t\t\t\t\t_gl.bindBuffer( _gl.ELEMENT_ARRAY_BUFFER, index.buffer );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\t_gl.drawElements( mode, index.array.length, type, 0);\r\n\r\n\t\t\t\t\t_this.info.render.calls ++;\r\n\t\t\t\t\t_this.info.render.points += index.array.length;\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\t// if there is more than 1 chunk\r\n\t\t\t\t\t// must set attribute pointers to use new offsets for each chunk\r\n\t\t\t\t\t// even if geometry and materials didn't change\r\n\r\n\t\t\t\t\tif ( offsets.length > 1 ) updateBuffers = true;\r\n\r\n\t\t\t\t\tfor ( var i = 0, il = offsets.length; i < il; i ++ ) {\r\n\r\n\t\t\t\t\t\tvar startIndex = offsets[ i ].index;\r\n\r\n\t\t\t\t\t\tif ( updateBuffers ) {\r\n\r\n\t\t\t\t\t\t\tsetupVertexAttributes( material, program, geometry, startIndex );\r\n\t\t\t\t\t\t\t_gl.bindBuffer( _gl.ELEMENT_ARRAY_BUFFER, index.buffer );\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t// render indexed points\r\n\r\n\t\t\t\t\t\t_gl.drawElements( mode, offsets[ i ].count, type, offsets[ i ].start * size );\r\n\r\n\t\t\t\t\t\t_this.info.render.calls ++;\r\n\t\t\t\t\t\t_this.info.render.points += offsets[ i ].count;\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\t// non-indexed points\r\n\r\n\t\t\t\tif ( updateBuffers ) {\r\n\r\n\t\t\t\t\tsetupVertexAttributes( material, program, geometry, 0 );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tvar position = geometry.attributes.position;\r\n\t\t\t\tvar offsets = geometry.offsets;\r\n\r\n\t\t\t\tif ( offsets.length === 0 ) {\r\n\r\n\t\t\t\t\t_gl.drawArrays( mode, 0, position.array.length / 3 );\r\n\r\n\t\t\t\t\t_this.info.render.calls ++;\r\n\t\t\t\t\t_this.info.render.points += position.array.length / 3;\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\tfor ( var i = 0, il = offsets.length; i < il; i ++ ) {\r\n\r\n\t\t\t\t\t\t_gl.drawArrays( mode, offsets[ i ].index, offsets[ i ].count );\r\n\r\n\t\t\t\t\t\t_this.info.render.calls ++;\r\n\t\t\t\t\t\t_this.info.render.points += offsets[ i ].count;\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t} else if ( object instanceof THREE.Line ) {\r\n\r\n\t\t\tvar mode = ( object.mode === THREE.LineStrip ) ? _gl.LINE_STRIP : _gl.LINES;\r\n\r\n\t\t\tstate.setLineWidth( material.linewidth * pixelRatio );\r\n\r\n\t\t\tvar index = geometry.attributes.index;\r\n\r\n\t\t\tif ( index ) {\r\n\r\n\t\t\t\t// indexed lines\r\n\r\n\t\t\t\tvar type, size;\r\n\r\n\t\t\t\tif ( index.array instanceof Uint32Array ) {\r\n\r\n\t\t\t\t\ttype = _gl.UNSIGNED_INT;\r\n\t\t\t\t\tsize = 4;\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\ttype = _gl.UNSIGNED_SHORT;\r\n\t\t\t\t\tsize = 2;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tvar offsets = geometry.offsets;\r\n\r\n\t\t\t\tif ( offsets.length === 0 ) {\r\n\r\n\t\t\t\t\tif ( updateBuffers ) {\r\n\r\n\t\t\t\t\t\tsetupVertexAttributes( material, program, geometry, 0 );\r\n\t\t\t\t\t\t_gl.bindBuffer( _gl.ELEMENT_ARRAY_BUFFER, index.buffer );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\t_gl.drawElements( mode, index.array.length, type, 0 ); // 2 bytes per Uint16Array\r\n\r\n\t\t\t\t\t_this.info.render.calls ++;\r\n\t\t\t\t\t_this.info.render.vertices += index.array.length; // not really true, here vertices can be shared\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\t// if there is more than 1 chunk\r\n\t\t\t\t\t// must set attribute pointers to use new offsets for each chunk\r\n\t\t\t\t\t// even if geometry and materials didn't change\r\n\r\n\t\t\t\t\tif ( offsets.length > 1 ) updateBuffers = true;\r\n\r\n\t\t\t\t\tfor ( var i = 0, il = offsets.length; i < il; i ++ ) {\r\n\r\n\t\t\t\t\t\tvar startIndex = offsets[ i ].index;\r\n\r\n\t\t\t\t\t\tif ( updateBuffers ) {\r\n\r\n\t\t\t\t\t\t\tsetupVertexAttributes( material, program, geometry, startIndex );\r\n\t\t\t\t\t\t\t_gl.bindBuffer( _gl.ELEMENT_ARRAY_BUFFER, index.buffer );\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t// render indexed lines\r\n\r\n\t\t\t\t\t\t_gl.drawElements( mode, offsets[ i ].count, type, offsets[ i ].start * size ); // 2 bytes per Uint16Array\r\n\r\n\t\t\t\t\t\t_this.info.render.calls ++;\r\n\t\t\t\t\t\t_this.info.render.vertices += offsets[ i ].count; // not really true, here vertices can be shared\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\t// non-indexed lines\r\n\r\n\t\t\t\tif ( updateBuffers ) {\r\n\r\n\t\t\t\t\tsetupVertexAttributes( material, program, geometry, 0 );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tvar position = geometry.attributes.position;\r\n\t\t\t\tvar offsets = geometry.offsets;\r\n\r\n\t\t\t\tif ( offsets.length === 0 ) {\r\n\r\n\t\t\t\t\t_gl.drawArrays( mode, 0, position.array.length / 3 );\r\n\r\n\t\t\t\t\t_this.info.render.calls ++;\r\n\t\t\t\t\t_this.info.render.vertices += position.array.length / 3;\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\tfor ( var i = 0, il = offsets.length; i < il; i ++ ) {\r\n\r\n\t\t\t\t\t\t_gl.drawArrays( mode, offsets[ i ].index, offsets[ i ].count );\r\n\r\n\t\t\t\t\t\t_this.info.render.calls ++;\r\n\t\t\t\t\t\t_this.info.render.vertices += offsets[ i ].count;\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t};\r\n\r\n\tthis.renderBuffer = function ( camera, lights, fog, material, geometryGroup, object ) {\r\n\r\n\t\tif ( material.visible === false ) return;\r\n\r\n\t\tupdateObject( object );\r\n\r\n\t\tvar program = setProgram( camera, lights, fog, material, object );\r\n\r\n\t\tvar attributes = program.attributes;\r\n\r\n\t\tvar updateBuffers = false,\r\n\t\t\twireframeBit = material.wireframe ? 1 : 0,\r\n\t\t\tgeometryProgram = geometryGroup.id + '_' + program.id + '_' + wireframeBit;\r\n\r\n\t\tif ( geometryProgram !== _currentGeometryProgram ) {\r\n\r\n\t\t\t_currentGeometryProgram = geometryProgram;\r\n\t\t\tupdateBuffers = true;\r\n\r\n\t\t}\r\n\r\n\t\tif ( updateBuffers ) {\r\n\r\n\t\t\tstate.initAttributes();\r\n\r\n\t\t}\r\n\r\n\t\t// vertices\r\n\r\n\t\tif ( ! material.morphTargets && attributes.position >= 0 ) {\r\n\r\n\t\t\tif ( updateBuffers ) {\r\n\r\n\t\t\t\t_gl.bindBuffer( _gl.ARRAY_BUFFER, geometryGroup.__webglVertexBuffer );\r\n\r\n\t\t\t\tstate.enableAttribute( attributes.position );\r\n\r\n\t\t\t\t_gl.vertexAttribPointer( attributes.position, 3, _gl.FLOAT, false, 0, 0 );\r\n\r\n\t\t\t}\r\n\r\n\t\t} else {\r\n\r\n\t\t\tif ( object.morphTargetBase ) {\r\n\r\n\t\t\t\tsetupMorphTargets( material, geometryGroup, object );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\r\n\t\tif ( updateBuffers ) {\r\n\r\n\t\t\t// custom attributes\r\n\r\n\t\t\t// Use the per-geometryGroup custom attribute arrays which are setup in initMeshBuffers\r\n\r\n\t\t\tif ( geometryGroup.__webglCustomAttributesList ) {\r\n\r\n\t\t\t\tfor ( var i = 0, il = geometryGroup.__webglCustomAttributesList.length; i < il; i ++ ) {\r\n\r\n\t\t\t\t\tvar attribute = geometryGroup.__webglCustomAttributesList[ i ];\r\n\r\n\t\t\t\t\tif ( attributes[ attribute.buffer.belongsToAttribute ] >= 0 ) {\r\n\r\n\t\t\t\t\t\t_gl.bindBuffer( _gl.ARRAY_BUFFER, attribute.buffer );\r\n\r\n\t\t\t\t\t\tstate.enableAttribute( attributes[ attribute.buffer.belongsToAttribute ] );\r\n\r\n\t\t\t\t\t\t_gl.vertexAttribPointer( attributes[ attribute.buffer.belongsToAttribute ], attribute.size, _gl.FLOAT, false, 0, 0 );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\r\n\t\t\t// colors\r\n\r\n\t\t\tif ( attributes.color >= 0 ) {\r\n\r\n\t\t\t\tif ( object.geometry.colors.length > 0 || object.geometry.faces.length > 0 ) {\r\n\r\n\t\t\t\t\t_gl.bindBuffer( _gl.ARRAY_BUFFER, geometryGroup.__webglColorBuffer );\r\n\r\n\t\t\t\t\tstate.enableAttribute( attributes.color );\r\n\r\n\t\t\t\t\t_gl.vertexAttribPointer( attributes.color, 3, _gl.FLOAT, false, 0, 0 );\r\n\r\n\t\t\t\t} else if ( material.defaultAttributeValues !== undefined ) {\r\n\r\n\r\n\t\t\t\t\t_gl.vertexAttrib3fv( attributes.color, material.defaultAttributeValues.color );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\t// normals\r\n\r\n\t\t\tif ( attributes.normal >= 0 ) {\r\n\r\n\t\t\t\t_gl.bindBuffer( _gl.ARRAY_BUFFER, geometryGroup.__webglNormalBuffer );\r\n\r\n\t\t\t\tstate.enableAttribute( attributes.normal );\r\n\r\n\t\t\t\t_gl.vertexAttribPointer( attributes.normal, 3, _gl.FLOAT, false, 0, 0 );\r\n\r\n\t\t\t}\r\n\r\n\t\t\t// tangents\r\n\r\n\t\t\tif ( attributes.tangent >= 0 ) {\r\n\r\n\t\t\t\t_gl.bindBuffer( _gl.ARRAY_BUFFER, geometryGroup.__webglTangentBuffer );\r\n\r\n\t\t\t\tstate.enableAttribute( attributes.tangent );\r\n\r\n\t\t\t\t_gl.vertexAttribPointer( attributes.tangent, 4, _gl.FLOAT, false, 0, 0 );\r\n\r\n\t\t\t}\r\n\r\n\t\t\t// uvs\r\n\r\n\t\t\tif ( attributes.uv >= 0 ) {\r\n\r\n\t\t\t\tif ( object.geometry.faceVertexUvs[ 0 ] ) {\r\n\r\n\t\t\t\t\t_gl.bindBuffer( _gl.ARRAY_BUFFER, geometryGroup.__webglUVBuffer );\r\n\r\n\t\t\t\t\tstate.enableAttribute( attributes.uv );\r\n\r\n\t\t\t\t\t_gl.vertexAttribPointer( attributes.uv, 2, _gl.FLOAT, false, 0, 0 );\r\n\r\n\t\t\t\t} else if ( material.defaultAttributeValues !== undefined ) {\r\n\r\n\r\n\t\t\t\t\t_gl.vertexAttrib2fv( attributes.uv, material.defaultAttributeValues.uv );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( attributes.uv2 >= 0 ) {\r\n\r\n\t\t\t\tif ( object.geometry.faceVertexUvs[ 1 ] ) {\r\n\r\n\t\t\t\t\t_gl.bindBuffer( _gl.ARRAY_BUFFER, geometryGroup.__webglUV2Buffer );\r\n\r\n\t\t\t\t\tstate.enableAttribute( attributes.uv2 );\r\n\r\n\t\t\t\t\t_gl.vertexAttribPointer( attributes.uv2, 2, _gl.FLOAT, false, 0, 0 );\r\n\r\n\t\t\t\t} else if ( material.defaultAttributeValues !== undefined ) {\r\n\r\n\r\n\t\t\t\t\t_gl.vertexAttrib2fv( attributes.uv2, material.defaultAttributeValues.uv2 );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( material.skinning &&\r\n\t\t\t\t attributes.skinIndex >= 0 && attributes.skinWeight >= 0 ) {\r\n\r\n\t\t\t\t_gl.bindBuffer( _gl.ARRAY_BUFFER, geometryGroup.__webglSkinIndicesBuffer );\r\n\r\n\t\t\t\tstate.enableAttribute( attributes.skinIndex );\r\n\r\n\t\t\t\t_gl.vertexAttribPointer( attributes.skinIndex, 4, _gl.FLOAT, false, 0, 0 );\r\n\r\n\t\t\t\t_gl.bindBuffer( _gl.ARRAY_BUFFER, geometryGroup.__webglSkinWeightsBuffer );\r\n\r\n\t\t\t\tstate.enableAttribute( attributes.skinWeight );\r\n\r\n\t\t\t\t_gl.vertexAttribPointer( attributes.skinWeight, 4, _gl.FLOAT, false, 0, 0 );\r\n\r\n\t\t\t}\r\n\r\n\t\t\t// line distances\r\n\r\n\t\t\tif ( attributes.lineDistance >= 0 ) {\r\n\r\n\t\t\t\t_gl.bindBuffer( _gl.ARRAY_BUFFER, geometryGroup.__webglLineDistanceBuffer );\r\n\r\n\t\t\t\tstate.enableAttribute( attributes.lineDistance );\r\n\r\n\t\t\t\t_gl.vertexAttribPointer( attributes.lineDistance, 1, _gl.FLOAT, false, 0, 0 );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tstate.disableUnusedAttributes();\r\n\r\n\t\t// render mesh\r\n\r\n\t\tif ( object instanceof THREE.Mesh ) {\r\n\r\n\t\t\tvar type = geometryGroup.__typeArray === Uint32Array ? _gl.UNSIGNED_INT : _gl.UNSIGNED_SHORT;\r\n\r\n\t\t\t// wireframe\r\n\r\n\t\t\tif ( material.wireframe ) {\r\n\r\n\t\t\t\tstate.setLineWidth( material.wireframeLinewidth * pixelRatio );\r\n\r\n\t\t\t\tif ( updateBuffers ) _gl.bindBuffer( _gl.ELEMENT_ARRAY_BUFFER, geometryGroup.__webglLineBuffer );\r\n\t\t\t\t_gl.drawElements( _gl.LINES, geometryGroup.__webglLineCount, type, 0 );\r\n\r\n\t\t\t// triangles\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tif ( updateBuffers ) _gl.bindBuffer( _gl.ELEMENT_ARRAY_BUFFER, geometryGroup.__webglFaceBuffer );\r\n\t\t\t\t_gl.drawElements( _gl.TRIANGLES, geometryGroup.__webglFaceCount, type, 0 );\r\n\r\n\t\t\t}\r\n\r\n\t\t\t_this.info.render.calls ++;\r\n\t\t\t_this.info.render.vertices += geometryGroup.__webglFaceCount;\r\n\t\t\t_this.info.render.faces += geometryGroup.__webglFaceCount / 3;\r\n\r\n\t\t// render lines\r\n\r\n\t\t} else if ( object instanceof THREE.Line ) {\r\n\r\n\t\t\tvar mode = ( object.mode === THREE.LineStrip ) ? _gl.LINE_STRIP : _gl.LINES;\r\n\r\n\t\t\tstate.setLineWidth( material.linewidth * pixelRatio );\r\n\r\n\t\t\t_gl.drawArrays( mode, 0, geometryGroup.__webglLineCount );\r\n\r\n\t\t\t_this.info.render.calls ++;\r\n\r\n\t\t// render particles\r\n\r\n\t\t} else if ( object instanceof THREE.PointCloud ) {\r\n\r\n\t\t\t_gl.drawArrays( _gl.POINTS, 0, geometryGroup.__webglParticleCount );\r\n\r\n\t\t\t_this.info.render.calls ++;\r\n\t\t\t_this.info.render.points += geometryGroup.__webglParticleCount;\r\n\r\n\t\t}\r\n\r\n\t};\r\n\r\n\tfunction setupMorphTargets ( material, geometryGroup, object ) {\r\n\r\n\t\t// set base\r\n\r\n\t\tvar attributes = material.program.attributes;\r\n\r\n\t\tif ( object.morphTargetBase !== - 1 && attributes.position >= 0 ) {\r\n\r\n\t\t\t_gl.bindBuffer( _gl.ARRAY_BUFFER, geometryGroup.__webglMorphTargetsBuffers[ object.morphTargetBase ] );\r\n\r\n\t\t\tstate.enableAttribute( attributes.position );\r\n\r\n\t\t\t_gl.vertexAttribPointer( attributes.position, 3, _gl.FLOAT, false, 0, 0 );\r\n\r\n\t\t} else if ( attributes.position >= 0 ) {\r\n\r\n\t\t\t_gl.bindBuffer( _gl.ARRAY_BUFFER, geometryGroup.__webglVertexBuffer );\r\n\r\n\t\t\tstate.enableAttribute( attributes.position );\r\n\r\n\t\t\t_gl.vertexAttribPointer( attributes.position, 3, _gl.FLOAT, false, 0, 0 );\r\n\r\n\t\t}\r\n\r\n\t\tif ( object.morphTargetForcedOrder.length ) {\r\n\r\n\t\t\t// set forced order\r\n\r\n\t\t\tvar m = 0;\r\n\t\t\tvar order = object.morphTargetForcedOrder;\r\n\t\t\tvar influences = object.morphTargetInfluences;\r\n\r\n\t\t\tvar attribute;\r\n\r\n\t\t\twhile ( m < material.numSupportedMorphTargets && m < order.length ) {\r\n\r\n\t\t\t\tattribute = attributes[ 'morphTarget' + m ];\r\n\r\n\t\t\t\tif ( attribute >= 0 ) {\r\n\r\n\t\t\t\t\t_gl.bindBuffer( _gl.ARRAY_BUFFER, geometryGroup.__webglMorphTargetsBuffers[ order[ m ] ] );\r\n\r\n\t\t\t\t\tstate.enableAttribute( attribute );\r\n\r\n\t\t\t\t\t_gl.vertexAttribPointer( attribute, 3, _gl.FLOAT, false, 0, 0 );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tattribute = attributes[ 'morphNormal' + m ];\r\n\r\n\t\t\t\tif ( attribute >= 0 && material.morphNormals ) {\r\n\r\n\t\t\t\t\t_gl.bindBuffer( _gl.ARRAY_BUFFER, geometryGroup.__webglMorphNormalsBuffers[ order[ m ] ] );\r\n\r\n\t\t\t\t\tstate.enableAttribute( attribute );\r\n\r\n\t\t\t\t\t_gl.vertexAttribPointer( attribute, 3, _gl.FLOAT, false, 0, 0 );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tobject.__webglMorphTargetInfluences[ m ] = influences[ order[ m ] ];\r\n\r\n\t\t\t\tm ++;\r\n\r\n\t\t\t}\r\n\r\n\t\t} else {\r\n\r\n\t\t\t// find the most influencing\r\n\r\n\t\t\tvar activeInfluenceIndices = [];\r\n\t\t\tvar influences = object.morphTargetInfluences;\r\n\t\t\tvar morphTargets = object.geometry.morphTargets;\r\n\r\n\t\t\tif ( influences.length > morphTargets.length ) {\r\n\r\n\t\t\t\tconsole.warn( 'THREE.WebGLRenderer: Influences array is bigger than morphTargets array.' );\r\n\t\t\t\tinfluences.length = morphTargets.length;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tfor ( var i = 0, il = influences.length; i < il; i ++ ) {\r\n\r\n\t\t\t\tvar influence = influences[ i ];\r\n\r\n\t\t\t\tactiveInfluenceIndices.push( [ influence, i ] );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( activeInfluenceIndices.length > material.numSupportedMorphTargets ) {\r\n\r\n\t\t\t\tactiveInfluenceIndices.sort( numericalSort );\r\n\t\t\t\tactiveInfluenceIndices.length = material.numSupportedMorphTargets;\r\n\r\n\t\t\t} else if ( activeInfluenceIndices.length > material.numSupportedMorphNormals ) {\r\n\r\n\t\t\t\tactiveInfluenceIndices.sort( numericalSort );\r\n\r\n\t\t\t} else if ( activeInfluenceIndices.length === 0 ) {\r\n\r\n\t\t\t\tactiveInfluenceIndices.push( [ 0, 0 ] );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tvar attribute;\r\n\r\n\t\t\tfor ( var m = 0, ml = material.numSupportedMorphTargets; m < ml; m ++ ) {\r\n\r\n\t\t\t\tif ( activeInfluenceIndices[ m ] ) {\r\n\r\n\t\t\t\t\tvar influenceIndex = activeInfluenceIndices[ m ][ 1 ];\r\n\r\n\t\t\t\t\tattribute = attributes[ 'morphTarget' + m ];\r\n\r\n\t\t\t\t\tif ( attribute >= 0 ) {\r\n\r\n\t\t\t\t\t\t_gl.bindBuffer( _gl.ARRAY_BUFFER, geometryGroup.__webglMorphTargetsBuffers[ influenceIndex ] );\r\n\r\n\t\t\t\t\t\tstate.enableAttribute( attribute );\r\n\r\n\t\t\t\t\t\t_gl.vertexAttribPointer( attribute, 3, _gl.FLOAT, false, 0, 0 );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tattribute = attributes[ 'morphNormal' + m ];\r\n\r\n\t\t\t\t\tif ( attribute >= 0 && material.morphNormals ) {\r\n\r\n\t\t\t\t\t\t_gl.bindBuffer( _gl.ARRAY_BUFFER, geometryGroup.__webglMorphNormalsBuffers[ influenceIndex ] );\r\n\r\n\t\t\t\t\t\tstate.enableAttribute( attribute );\r\n\r\n\t\t\t\t\t\t_gl.vertexAttribPointer( attribute, 3, _gl.FLOAT, false, 0, 0 );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tobject.__webglMorphTargetInfluences[ m ] = influences[ influenceIndex ];\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\t/*\r\n\t\t\t\t\t_gl.vertexAttribPointer( attributes[ \"morphTarget\" + m ], 3, _gl.FLOAT, false, 0, 0 );\r\n\r\n\t\t\t\t\tif ( material.morphNormals ) {\r\n\r\n\t\t\t\t\t\t_gl.vertexAttribPointer( attributes[ \"morphNormal\" + m ], 3, _gl.FLOAT, false, 0, 0 );\r\n\r\n\t\t\t\t\t}\r\n\t\t\t\t\t*/\r\n\r\n\t\t\t\t\tobject.__webglMorphTargetInfluences[ m ] = 0;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\t// load updated influences uniform\r\n\r\n\t\tif ( material.program.uniforms.morphTargetInfluences !== null ) {\r\n\r\n\t\t\t_gl.uniform1fv( material.program.uniforms.morphTargetInfluences, object.__webglMorphTargetInfluences );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\t// Sorting\r\n\r\n\tfunction painterSortStable ( a, b ) {\r\n\r\n\t\tif ( a.object.renderOrder !== b.object.renderOrder ) {\r\n\r\n\t\t\treturn a.object.renderOrder - b.object.renderOrder;\r\n\r\n\t\t} else if ( a.material.id !== b.material.id ) {\r\n\r\n\t\t\treturn a.material.id - b.material.id;\r\n\r\n\t\t} else if ( a.z !== b.z ) {\r\n\r\n\t\t\treturn a.z - b.z;\r\n\r\n\t\t} else {\r\n\r\n\t\t\treturn a.id - b.id;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tfunction reversePainterSortStable ( a, b ) {\r\n\r\n\t\tif ( a.object.renderOrder !== b.object.renderOrder ) {\r\n\r\n\t\t\treturn a.object.renderOrder - b.object.renderOrder;\r\n\r\n\t\t} if ( a.z !== b.z ) {\r\n\r\n\t\t\treturn b.z - a.z;\r\n\r\n\t\t} else {\r\n\r\n\t\t\treturn a.id - b.id;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tfunction numericalSort ( a, b ) {\r\n\r\n\t\treturn b[ 0 ] - a[ 0 ];\r\n\r\n\t}\r\n\r\n\t// Rendering\r\n\r\n\tthis.render = function ( scene, camera, renderTarget, forceClear ) {\r\n\r\n\t\tif ( camera instanceof THREE.Camera === false ) {\r\n\r\n\t\t\tTHREE.error( 'THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.' );\r\n\t\t\treturn;\r\n\r\n\t\t}\r\n\r\n\t\tvar fog = scene.fog;\r\n\r\n\t\t// reset caching for this frame\r\n\r\n\t\t_currentGeometryProgram = '';\r\n\t\t_currentMaterialId = - 1;\r\n\t\t_currentCamera = null;\r\n\t\t_lightsNeedUpdate = true;\r\n\r\n\t\t// update scene graph\r\n\r\n\t\tif ( scene.autoUpdate === true ) scene.updateMatrixWorld();\r\n\r\n\t\t// update camera matrices and frustum\r\n\r\n\t\tif ( camera.parent === undefined ) camera.updateMatrixWorld();\r\n\r\n\t\t// update Skeleton objects\r\n\r\n\t\tscene.traverse( function ( object ) {\r\n\r\n\t\t\tif ( object instanceof THREE.SkinnedMesh ) {\r\n\r\n\t\t\t\tobject.skeleton.update();\r\n\r\n\t\t\t}\r\n\r\n\t\t} );\r\n\r\n\t\tcamera.matrixWorldInverse.getInverse( camera.matrixWorld );\r\n\r\n\t\t_projScreenMatrix.multiplyMatrices( camera.projectionMatrix, camera.matrixWorldInverse );\r\n\t\t_frustum.setFromMatrix( _projScreenMatrix );\r\n\r\n\t\tlights.length = 0;\r\n\t\topaqueObjects.length = 0;\r\n\t\ttransparentObjects.length = 0;\r\n\r\n\t\tsprites.length = 0;\r\n\t\tlensFlares.length = 0;\r\n\r\n\t\tprojectObject( scene );\r\n\r\n\t\tif ( _this.sortObjects === true ) {\r\n\r\n\t\t\topaqueObjects.sort( painterSortStable );\r\n\t\t\ttransparentObjects.sort( reversePainterSortStable );\r\n\r\n\t\t}\r\n\r\n\t\t// custom render plugins (pre pass)\r\n\r\n\t\tshadowMapPlugin.render( scene, camera );\r\n\r\n\t\t//\r\n\r\n\t\t_this.info.render.calls = 0;\r\n\t\t_this.info.render.vertices = 0;\r\n\t\t_this.info.render.faces = 0;\r\n\t\t_this.info.render.points = 0;\r\n\r\n\t\tthis.setRenderTarget( renderTarget );\r\n\r\n\t\tif ( this.autoClear || forceClear ) {\r\n\r\n\t\t\tthis.clear( this.autoClearColor, this.autoClearDepth, this.autoClearStencil );\r\n\r\n\t\t}\r\n\r\n\t\t// set matrices for immediate objects\r\n\r\n\t\tfor ( var i = 0, il = _webglObjectsImmediate.length; i < il; i ++ ) {\r\n\r\n\t\t\tvar webglObject = _webglObjectsImmediate[ i ];\r\n\t\t\tvar object = webglObject.object;\r\n\r\n\t\t\tif ( object.visible ) {\r\n\r\n\t\t\t\tsetupMatrices( object, camera );\r\n\r\n\t\t\t\tunrollImmediateBufferMaterial( webglObject );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tif ( scene.overrideMaterial ) {\r\n\r\n\t\t\tvar overrideMaterial = scene.overrideMaterial;\r\n\r\n\t\t\tsetMaterial( overrideMaterial );\r\n\r\n\t\t\trenderObjects( opaqueObjects, camera, lights, fog, overrideMaterial );\r\n\t\t\trenderObjects( transparentObjects, camera, lights, fog, overrideMaterial );\r\n\t\t\trenderObjectsImmediate( _webglObjectsImmediate, '', camera, lights, fog, overrideMaterial );\r\n\r\n\t\t} else {\r\n\r\n\t\t\t// opaque pass (front-to-back order)\r\n\r\n\t\t\tstate.setBlending( THREE.NoBlending );\r\n\r\n\t\t\trenderObjects( opaqueObjects, camera, lights, fog, null );\r\n\t\t\trenderObjectsImmediate( _webglObjectsImmediate, 'opaque', camera, lights, fog, null );\r\n\r\n\t\t\t// transparent pass (back-to-front order)\r\n\r\n\t\t\trenderObjects( transparentObjects, camera, lights, fog, null );\r\n\t\t\trenderObjectsImmediate( _webglObjectsImmediate, 'transparent', camera, lights, fog, null );\r\n\r\n\t\t}\r\n\r\n\t\t// custom render plugins (post pass)\r\n\r\n\t\tspritePlugin.render( scene, camera );\r\n\t\tlensFlarePlugin.render( scene, camera, _currentWidth, _currentHeight );\r\n\r\n\t\t// Generate mipmap if we're using any kind of mipmap filtering\r\n\r\n\t\tif ( renderTarget && renderTarget.generateMipmaps && renderTarget.minFilter !== THREE.NearestFilter && renderTarget.minFilter !== THREE.LinearFilter ) {\r\n\r\n\t\t\tupdateRenderTargetMipmap( renderTarget );\r\n\r\n\t\t}\r\n\r\n\t\t// Ensure depth buffer writing is enabled so it can be cleared on next render\r\n\r\n\t\tstate.setDepthTest( true );\r\n\t\tstate.setDepthWrite( true );\r\n\t\tstate.setColorWrite( true );\r\n\r\n\t\t// _gl.finish();\r\n\r\n\t};\r\n\r\n\tfunction projectObject( object ) {\r\n\r\n\t\tif ( object.visible === false ) return;\r\n\r\n\t\tif ( object instanceof THREE.Scene || object instanceof THREE.Group ) {\r\n\r\n\t\t\t// skip\r\n\r\n\t\t} else {\r\n\r\n\t\t\tinitObject( object );\r\n\r\n\t\t\tif ( object instanceof THREE.Light ) {\r\n\r\n\t\t\t\tlights.push( object );\r\n\r\n\t\t\t} else if ( object instanceof THREE.Sprite ) {\r\n\r\n\t\t\t\tsprites.push( object );\r\n\r\n\t\t\t} else if ( object instanceof THREE.LensFlare ) {\r\n\r\n\t\t\t\tlensFlares.push( object );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tvar webglObjects = _webglObjects[ object.id ];\r\n\r\n\t\t\t\tif ( webglObjects && ( object.frustumCulled === false || _frustum.intersectsObject( object ) === true ) ) {\r\n\r\n\t\t\t\t\tfor ( var i = 0, l = webglObjects.length; i < l; i ++ ) {\r\n\r\n\t\t\t\t\t\tvar webglObject = webglObjects[ i ];\r\n\r\n\t\t\t\t\t\tunrollBufferMaterial( webglObject );\r\n\r\n\t\t\t\t\t\twebglObject.render = true;\r\n\r\n\t\t\t\t\t\tif ( _this.sortObjects === true ) {\r\n\r\n\t\t\t\t\t\t\t_vector3.setFromMatrixPosition( object.matrixWorld );\r\n\t\t\t\t\t\t\t_vector3.applyProjection( _projScreenMatrix );\r\n\r\n\t\t\t\t\t\t\twebglObject.z = _vector3.z;\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tfor ( var i = 0, l = object.children.length; i < l; i ++ ) {\r\n\r\n\t\t\tprojectObject( object.children[ i ] );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tfunction renderObjects( renderList, camera, lights, fog, overrideMaterial ) {\r\n\r\n\t\tvar material;\r\n\r\n\t\tfor ( var i = 0, l = renderList.length; i < l; i ++ ) {\r\n\r\n\t\t\tvar webglObject = renderList[ i ];\r\n\r\n\t\t\tvar object = webglObject.object;\r\n\t\t\tvar buffer = webglObject.buffer;\r\n\r\n\t\t\tsetupMatrices( object, camera );\r\n\r\n\t\t\tif ( overrideMaterial ) {\r\n\r\n\t\t\t\tmaterial = overrideMaterial;\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tmaterial = webglObject.material;\r\n\r\n\t\t\t\tif ( ! material ) continue;\r\n\r\n\t\t\t\tsetMaterial( material );\r\n\r\n\t\t\t}\r\n\r\n\t\t\t_this.setMaterialFaces( material );\r\n\r\n\t\t\tif ( buffer instanceof THREE.BufferGeometry ) {\r\n\r\n\t\t\t\t_this.renderBufferDirect( camera, lights, fog, material, buffer, object );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\t_this.renderBuffer( camera, lights, fog, material, buffer, object );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tfunction renderObjectsImmediate ( renderList, materialType, camera, lights, fog, overrideMaterial ) {\r\n\r\n\t\tvar material;\r\n\r\n\t\tfor ( var i = 0, l = renderList.length; i < l; i ++ ) {\r\n\r\n\t\t\tvar webglObject = renderList[ i ];\r\n\t\t\tvar object = webglObject.object;\r\n\r\n\t\t\tif ( object.visible ) {\r\n\r\n\t\t\t\tif ( overrideMaterial ) {\r\n\r\n\t\t\t\t\tmaterial = overrideMaterial;\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\tmaterial = webglObject[ materialType ];\r\n\r\n\t\t\t\t\tif ( ! material ) continue;\r\n\r\n\t\t\t\t\tsetMaterial( material );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\t_this.renderImmediateObject( camera, lights, fog, material, object );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tthis.renderImmediateObject = function ( camera, lights, fog, material, object ) {\r\n\r\n\t\tvar program = setProgram( camera, lights, fog, material, object );\r\n\r\n\t\t_currentGeometryProgram = '';\r\n\r\n\t\t_this.setMaterialFaces( material );\r\n\r\n\t\tif ( object.immediateRenderCallback ) {\r\n\r\n\t\t\tobject.immediateRenderCallback( program, _gl, _frustum );\r\n\r\n\t\t} else {\r\n\r\n\t\t\tobject.render( function ( object ) { _this.renderBufferImmediate( object, program, material ); } );\r\n\r\n\t\t}\r\n\r\n\t};\r\n\r\n\tfunction unrollImmediateBufferMaterial ( globject ) {\r\n\r\n\t\tvar object = globject.object,\r\n\t\t\tmaterial = object.material;\r\n\r\n\t\tif ( material.transparent ) {\r\n\r\n\t\t\tglobject.transparent = material;\r\n\t\t\tglobject.opaque = null;\r\n\r\n\t\t} else {\r\n\r\n\t\t\tglobject.opaque = material;\r\n\t\t\tglobject.transparent = null;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tfunction unrollBufferMaterial ( globject ) {\r\n\r\n\t\tvar object = globject.object;\r\n\t\tvar buffer = globject.buffer;\r\n\r\n\t\tvar geometry = object.geometry;\r\n\t\tvar material = object.material;\r\n\r\n\t\tif ( material instanceof THREE.MeshFaceMaterial ) {\r\n\r\n\t\t\tvar materialIndex = geometry instanceof THREE.BufferGeometry ? 0 : buffer.materialIndex;\r\n\r\n\t\t\tmaterial = material.materials[ materialIndex ];\r\n\r\n\t\t\tglobject.material = material;\r\n\r\n\t\t\tif ( material.transparent ) {\r\n\r\n\t\t\t\ttransparentObjects.push( globject );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\topaqueObjects.push( globject );\r\n\r\n\t\t\t}\r\n\r\n\t\t} else if ( material ) {\r\n\r\n\t\t\tglobject.material = material;\r\n\r\n\t\t\tif ( material.transparent ) {\r\n\r\n\t\t\t\ttransparentObjects.push( globject );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\topaqueObjects.push( globject );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tfunction initObject( object ) {\r\n\r\n\t\tif ( object.__webglInit === undefined ) {\r\n\r\n\t\t\tobject.__webglInit = true;\r\n\t\t\tobject._modelViewMatrix = new THREE.Matrix4();\r\n\t\t\tobject._normalMatrix = new THREE.Matrix3();\r\n\r\n\t\t\tobject.addEventListener( 'removed', onObjectRemoved );\r\n\r\n\t\t}\r\n\r\n\t\tvar geometry = object.geometry;\r\n\r\n\t\tif ( geometry === undefined ) {\r\n\r\n\t\t\t// ImmediateRenderObject\r\n\r\n\t\t} else if ( geometry.__webglInit === undefined ) {\r\n\r\n\t\t\tgeometry.__webglInit = true;\r\n\t\t\tgeometry.addEventListener( 'dispose', onGeometryDispose );\r\n\r\n\t\t\tif ( geometry instanceof THREE.BufferGeometry ) {\r\n\r\n\t\t\t\t_this.info.memory.geometries ++;\r\n\r\n\t\t\t} else if ( object instanceof THREE.Mesh ) {\r\n\r\n\t\t\t\tinitGeometryGroups( object, geometry );\r\n\r\n\t\t\t} else if ( object instanceof THREE.Line ) {\r\n\r\n\t\t\t\tif ( geometry.__webglVertexBuffer === undefined ) {\r\n\r\n\t\t\t\t\tcreateLineBuffers( geometry );\r\n\t\t\t\t\tinitLineBuffers( geometry, object );\r\n\r\n\t\t\t\t\tgeometry.verticesNeedUpdate = true;\r\n\t\t\t\t\tgeometry.colorsNeedUpdate = true;\r\n\t\t\t\t\tgeometry.lineDistancesNeedUpdate = true;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t} else if ( object instanceof THREE.PointCloud ) {\r\n\r\n\t\t\t\tif ( geometry.__webglVertexBuffer === undefined ) {\r\n\r\n\t\t\t\t\tcreateParticleBuffers( geometry );\r\n\t\t\t\t\tinitParticleBuffers( geometry, object );\r\n\r\n\t\t\t\t\tgeometry.verticesNeedUpdate = true;\r\n\t\t\t\t\tgeometry.colorsNeedUpdate = true;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tif ( object.__webglActive === undefined) {\r\n\r\n\t\t\tobject.__webglActive = true;\r\n\r\n\t\t\tif ( object instanceof THREE.Mesh ) {\r\n\r\n\t\t\t\tif ( geometry instanceof THREE.BufferGeometry ) {\r\n\r\n\t\t\t\t\taddBuffer( _webglObjects, geometry, object );\r\n\r\n\t\t\t\t} else if ( geometry instanceof THREE.Geometry ) {\r\n\r\n\t\t\t\t\tvar geometryGroupsList = geometryGroups[ geometry.id ];\r\n\r\n\t\t\t\t\tfor ( var i = 0,l = geometryGroupsList.length; i < l; i ++ ) {\r\n\r\n\t\t\t\t\t\taddBuffer( _webglObjects, geometryGroupsList[ i ], object );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t} else if ( object instanceof THREE.Line || object instanceof THREE.PointCloud ) {\r\n\r\n\t\t\t\taddBuffer( _webglObjects, geometry, object );\r\n\r\n\t\t\t} else if ( object instanceof THREE.ImmediateRenderObject || object.immediateRenderCallback ) {\r\n\r\n\t\t\t\taddBufferImmediate( _webglObjectsImmediate, object );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\t// Geometry splitting\r\n\r\n\tvar geometryGroups = {};\r\n\tvar geometryGroupCounter = 0;\r\n\r\n\tfunction makeGroups( geometry, usesFaceMaterial ) {\r\n\r\n\t\tvar maxVerticesInGroup = extensions.get( 'OES_element_index_uint' ) ? 4294967296 : 65535;\r\n\r\n\t\tvar groupHash, hash_map = {};\r\n\r\n\t\tvar numMorphTargets = geometry.morphTargets.length;\r\n\t\tvar numMorphNormals = geometry.morphNormals.length;\r\n\r\n\t\tvar group;\r\n\t\tvar groups = {};\r\n\t\tvar groupsList = [];\r\n\r\n\t\tfor ( var f = 0, fl = geometry.faces.length; f < fl; f ++ ) {\r\n\r\n\t\t\tvar face = geometry.faces[ f ];\r\n\t\t\tvar materialIndex = usesFaceMaterial ? face.materialIndex : 0;\r\n\r\n\t\t\tif ( ! ( materialIndex in hash_map ) ) {\r\n\r\n\t\t\t\thash_map[ materialIndex ] = { hash: materialIndex, counter: 0 };\r\n\r\n\t\t\t}\r\n\r\n\t\t\tgroupHash = hash_map[ materialIndex ].hash + '_' + hash_map[ materialIndex ].counter;\r\n\r\n\t\t\tif ( ! ( groupHash in groups ) ) {\r\n\r\n\t\t\t\tgroup = {\r\n\t\t\t\t\tid: geometryGroupCounter ++,\r\n\t\t\t\t\tfaces3: [],\r\n\t\t\t\t\tmaterialIndex: materialIndex,\r\n\t\t\t\t\tvertices: 0,\r\n\t\t\t\t\tnumMorphTargets: numMorphTargets,\r\n\t\t\t\t\tnumMorphNormals: numMorphNormals\r\n\t\t\t\t};\r\n\r\n\t\t\t\tgroups[ groupHash ] = group;\r\n\t\t\t\tgroupsList.push( group );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( groups[ groupHash ].vertices + 3 > maxVerticesInGroup ) {\r\n\r\n\t\t\t\thash_map[ materialIndex ].counter += 1;\r\n\t\t\t\tgroupHash = hash_map[ materialIndex ].hash + '_' + hash_map[ materialIndex ].counter;\r\n\r\n\t\t\t\tif ( ! ( groupHash in groups ) ) {\r\n\r\n\t\t\t\t\tgroup = {\r\n\t\t\t\t\t\tid: geometryGroupCounter ++,\r\n\t\t\t\t\t\tfaces3: [],\r\n\t\t\t\t\t\tmaterialIndex: materialIndex,\r\n\t\t\t\t\t\tvertices: 0,\r\n\t\t\t\t\t\tnumMorphTargets: numMorphTargets,\r\n\t\t\t\t\t\tnumMorphNormals: numMorphNormals\r\n\t\t\t\t\t};\r\n\r\n\t\t\t\t\tgroups[ groupHash ] = group;\r\n\t\t\t\t\tgroupsList.push( group );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\tgroups[ groupHash ].faces3.push( f );\r\n\t\t\tgroups[ groupHash ].vertices += 3;\r\n\r\n\t\t}\r\n\r\n\t\treturn groupsList;\r\n\r\n\t}\r\n\r\n\tfunction initGeometryGroups( object, geometry ) {\r\n\r\n\t\tvar material = object.material, addBuffers = false;\r\n\r\n\t\tif ( geometryGroups[ geometry.id ] === undefined || geometry.groupsNeedUpdate === true ) {\r\n\r\n\t\t\tdelete _webglObjects[ object.id ];\r\n\r\n\t\t\tgeometryGroups[ geometry.id ] = makeGroups( geometry, material instanceof THREE.MeshFaceMaterial );\r\n\r\n\t\t\tgeometry.groupsNeedUpdate = false;\r\n\r\n\t\t}\r\n\r\n\t\tvar geometryGroupsList = geometryGroups[ geometry.id ];\r\n\r\n\t\t// create separate VBOs per geometry chunk\r\n\r\n\t\tfor ( var i = 0, il = geometryGroupsList.length; i < il; i ++ ) {\r\n\r\n\t\t\tvar geometryGroup = geometryGroupsList[ i ];\r\n\r\n\t\t\t// initialise VBO on the first access\r\n\r\n\t\t\tif ( geometryGroup.__webglVertexBuffer === undefined ) {\r\n\r\n\t\t\t\tcreateMeshBuffers( geometryGroup );\r\n\t\t\t\tinitMeshBuffers( geometryGroup, object );\r\n\r\n\t\t\t\tgeometry.verticesNeedUpdate = true;\r\n\t\t\t\tgeometry.morphTargetsNeedUpdate = true;\r\n\t\t\t\tgeometry.elementsNeedUpdate = true;\r\n\t\t\t\tgeometry.uvsNeedUpdate = true;\r\n\t\t\t\tgeometry.normalsNeedUpdate = true;\r\n\t\t\t\tgeometry.tangentsNeedUpdate = true;\r\n\t\t\t\tgeometry.colorsNeedUpdate = true;\r\n\r\n\t\t\t\taddBuffers = true;\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\taddBuffers = false;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( addBuffers || object.__webglActive === undefined ) {\r\n\r\n\t\t\t\taddBuffer( _webglObjects, geometryGroup, object );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tobject.__webglActive = true;\r\n\r\n\t}\r\n\r\n\tfunction addBuffer( objlist, buffer, object ) {\r\n\r\n\t\tvar id = object.id;\r\n\t\tobjlist[id] = objlist[id] || [];\r\n\t\tobjlist[id].push(\r\n\t\t\t{\r\n\t\t\t\tid: id,\r\n\t\t\t\tbuffer: buffer,\r\n\t\t\t\tobject: object,\r\n\t\t\t\tmaterial: null,\r\n\t\t\t\tz: 0\r\n\t\t\t}\r\n\t\t);\r\n\r\n\t};\r\n\r\n\tfunction addBufferImmediate( objlist, object ) {\r\n\r\n\t\tobjlist.push(\r\n\t\t\t{\r\n\t\t\t\tid: null,\r\n\t\t\t\tobject: object,\r\n\t\t\t\topaque: null,\r\n\t\t\t\ttransparent: null,\r\n\t\t\t\tz: 0\r\n\t\t\t}\r\n\t\t);\r\n\r\n\t};\r\n\r\n\t// Objects updates\r\n\r\n\tfunction updateObject( object ) {\r\n\r\n\t\tvar geometry = object.geometry;\r\n\r\n\t\tif ( geometry instanceof THREE.BufferGeometry ) {\r\n\r\n\t\t\tvar attributes = geometry.attributes;\r\n\t\t\tvar attributesKeys = geometry.attributesKeys;\r\n\r\n\t\t\tfor ( var i = 0, l = attributesKeys.length; i < l; i ++ ) {\r\n\r\n\t\t\t\tvar key = attributesKeys[ i ];\r\n\t\t\t\tvar attribute = attributes[ key ];\r\n\t\t\t\tvar bufferType = ( key === 'index' ) ? _gl.ELEMENT_ARRAY_BUFFER : _gl.ARRAY_BUFFER;\r\n\r\n\t\t\t\tif ( attribute.buffer === undefined ) {\r\n\r\n\t\t\t\t\tattribute.buffer = _gl.createBuffer();\r\n\t\t\t\t\t_gl.bindBuffer( bufferType, attribute.buffer );\r\n\t\t\t\t\t_gl.bufferData( bufferType, attribute.array, ( attribute instanceof THREE.DynamicBufferAttribute ) ? _gl.DYNAMIC_DRAW : _gl.STATIC_DRAW );\r\n\r\n\t\t\t\t\tattribute.needsUpdate = false;\r\n\r\n\t\t\t\t} else if ( attribute.needsUpdate === true ) {\r\n\r\n\t\t\t\t\t_gl.bindBuffer( bufferType, attribute.buffer );\r\n\r\n\t\t\t\t\tif ( attribute.updateRange === undefined || attribute.updateRange.count === -1 ) { // Not using update ranges\r\n\r\n\t\t\t\t\t\t_gl.bufferSubData( bufferType, 0, attribute.array );\r\n\r\n\t\t\t\t\t} else if ( attribute.updateRange.count === 0 ) {\r\n\r\n\t\t\t\t\t\tconsole.error( 'THREE.WebGLRenderer.updateObject: using updateRange for THREE.DynamicBufferAttribute and marked as needsUpdate but count is 0, ensure you are using set methods or updating manually.' );\r\n\r\n\t\t\t\t\t} else {\r\n\r\n\t\t\t\t\t\t_gl.bufferSubData( bufferType, attribute.updateRange.offset * attribute.array.BYTES_PER_ELEMENT,\r\n\t\t\t\t\t\t\t\t\t\t attribute.array.subarray( attribute.updateRange.offset, attribute.updateRange.offset + attribute.updateRange.count ) );\r\n\r\n\t\t\t\t\t\tattribute.updateRange.count = 0; // reset range\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tattribute.needsUpdate = false;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t} else if ( object instanceof THREE.Mesh ) {\r\n\r\n\t\t\t// check all geometry groups\r\n\r\n\t\t\tif ( geometry.groupsNeedUpdate === true ) {\r\n\r\n\t\t\t\tinitGeometryGroups( object, geometry );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tvar geometryGroupsList = geometryGroups[ geometry.id ];\r\n\r\n\t\t\tfor ( var i = 0, il = geometryGroupsList.length; i < il; i ++ ) {\r\n\r\n\t\t\t\tvar geometryGroup = geometryGroupsList[ i ];\r\n\t\t\t\tvar material = getBufferMaterial( object, geometryGroup );\r\n\r\n\t\t\t\tvar customAttributesDirty = material.attributes && areCustomAttributesDirty( material );\r\n\r\n\t\t\t\tif ( geometry.verticesNeedUpdate || geometry.morphTargetsNeedUpdate || geometry.elementsNeedUpdate ||\r\n\t\t\t\t\t geometry.uvsNeedUpdate || geometry.normalsNeedUpdate ||\r\n\t\t\t\t\t geometry.colorsNeedUpdate || geometry.tangentsNeedUpdate || customAttributesDirty ) {\r\n\r\n\t\t\t\t\tsetMeshBuffers( geometryGroup, object, _gl.DYNAMIC_DRAW, ! geometry.dynamic, material );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\tgeometry.verticesNeedUpdate = false;\r\n\t\t\tgeometry.morphTargetsNeedUpdate = false;\r\n\t\t\tgeometry.elementsNeedUpdate = false;\r\n\t\t\tgeometry.uvsNeedUpdate = false;\r\n\t\t\tgeometry.normalsNeedUpdate = false;\r\n\t\t\tgeometry.colorsNeedUpdate = false;\r\n\t\t\tgeometry.tangentsNeedUpdate = false;\r\n\r\n\t\t\tmaterial.attributes && clearCustomAttributes( material );\r\n\r\n\t\t} else if ( object instanceof THREE.Line ) {\r\n\r\n\t\t\tvar material = getBufferMaterial( object, geometry );\r\n\t\t\tvar customAttributesDirty = material.attributes && areCustomAttributesDirty( material );\r\n\r\n\t\t\tif ( geometry.verticesNeedUpdate || geometry.colorsNeedUpdate || geometry.lineDistancesNeedUpdate || customAttributesDirty ) {\r\n\r\n\t\t\t\tsetLineBuffers( geometry, _gl.DYNAMIC_DRAW );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tgeometry.verticesNeedUpdate = false;\r\n\t\t\tgeometry.colorsNeedUpdate = false;\r\n\t\t\tgeometry.lineDistancesNeedUpdate = false;\r\n\r\n\t\t\tmaterial.attributes && clearCustomAttributes( material );\r\n\r\n\t\t} else if ( object instanceof THREE.PointCloud ) {\r\n\r\n\t\t\tvar material = getBufferMaterial( object, geometry );\r\n\t\t\tvar customAttributesDirty = material.attributes && areCustomAttributesDirty( material );\r\n\r\n\t\t\tif ( geometry.verticesNeedUpdate || geometry.colorsNeedUpdate || customAttributesDirty ) {\r\n\r\n\t\t\t\tsetParticleBuffers( geometry, _gl.DYNAMIC_DRAW, object );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tgeometry.verticesNeedUpdate = false;\r\n\t\t\tgeometry.colorsNeedUpdate = false;\r\n\r\n\t\t\tmaterial.attributes && clearCustomAttributes( material );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\t// Objects updates - custom attributes check\r\n\r\n\tfunction areCustomAttributesDirty( material ) {\r\n\r\n\t\tfor ( var name in material.attributes ) {\r\n\r\n\t\t\tif ( material.attributes[ name ].needsUpdate ) return true;\r\n\r\n\t\t}\r\n\r\n\t\treturn false;\r\n\r\n\t}\r\n\r\n\tfunction clearCustomAttributes( material ) {\r\n\r\n\t\tfor ( var name in material.attributes ) {\r\n\r\n\t\t\tmaterial.attributes[ name ].needsUpdate = false;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\t// Objects removal\r\n\r\n\tfunction removeObject( object ) {\r\n\r\n\t\tif ( object instanceof THREE.Mesh ||\r\n\t\t\t object instanceof THREE.PointCloud ||\r\n\t\t\t object instanceof THREE.Line ) {\r\n\r\n\t\t\tdelete _webglObjects[ object.id ];\r\n\r\n\t\t} else if ( object instanceof THREE.ImmediateRenderObject || object.immediateRenderCallback ) {\r\n\r\n\t\t\tremoveInstances( _webglObjectsImmediate, object );\r\n\r\n\t\t}\r\n\r\n\t\tdelete object.__webglInit;\r\n\t\tdelete object._modelViewMatrix;\r\n\t\tdelete object._normalMatrix;\r\n\r\n\t\tdelete object.__webglActive;\r\n\r\n\t}\r\n\r\n\tfunction removeInstances( objlist, object ) {\r\n\r\n\t\tfor ( var o = objlist.length - 1; o >= 0; o -- ) {\r\n\r\n\t\t\tif ( objlist[ o ].object === object ) {\r\n\r\n\t\t\t\tobjlist.splice( o, 1 );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\t// Materials\r\n\r\n\tvar shaderIDs = {\r\n\t\tMeshDepthMaterial: 'depth',\r\n\t\tMeshNormalMaterial: 'normal',\r\n\t\tMeshBasicMaterial: 'basic',\r\n\t\tMeshLambertMaterial: 'lambert',\r\n\t\tMeshPhongMaterial: 'phong',\r\n\t\tLineBasicMaterial: 'basic',\r\n\t\tLineDashedMaterial: 'dashed',\r\n\t\tPointCloudMaterial: 'particle_basic'\r\n\t};\r\n\r\n\tfunction initMaterial( material, lights, fog, object ) {\r\n\r\n\t\tmaterial.addEventListener( 'dispose', onMaterialDispose );\r\n\r\n\t\tvar shaderID = shaderIDs[ material.type ];\r\n\r\n\t\tif ( shaderID ) {\r\n\r\n\t\t\tvar shader = THREE.ShaderLib[ shaderID ];\r\n\r\n\t\t\tmaterial.__webglShader = {\r\n\t\t\t\tuniforms: THREE.UniformsUtils.clone( shader.uniforms ),\r\n\t\t\t\tvertexShader: shader.vertexShader,\r\n\t\t\t\tfragmentShader: shader.fragmentShader\r\n\t\t\t}\r\n\r\n\t\t} else {\r\n\r\n\t\t\tmaterial.__webglShader = {\r\n\t\t\t\tuniforms: material.uniforms,\r\n\t\t\t\tvertexShader: material.vertexShader,\r\n\t\t\t\tfragmentShader: material.fragmentShader\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\t// heuristics to create shader parameters according to lights in the scene\r\n\t\t// (not to blow over maxLights budget)\r\n\r\n\t\tvar maxLightCount = allocateLights( lights );\r\n\t\tvar maxShadows = allocateShadows( lights );\r\n\t\tvar maxBones = allocateBones( object );\r\n\r\n\t\tvar parameters = {\r\n\r\n\t\t\tprecision: _precision,\r\n\t\t\tsupportsVertexTextures: _supportsVertexTextures,\r\n\r\n\t\t\tmap: !! material.map,\r\n\t\t\tenvMap: !! material.envMap,\r\n\t\t\tenvMapMode: material.envMap && material.envMap.mapping,\r\n\t\t\tlightMap: !! material.lightMap,\r\n\t\t\tbumpMap: !! material.bumpMap,\r\n\t\t\tnormalMap: !! material.normalMap,\r\n\t\t\tspecularMap: !! material.specularMap,\r\n\t\t\talphaMap: !! material.alphaMap,\r\n\r\n\t\t\tcombine: material.combine,\r\n\r\n\t\t\tvertexColors: material.vertexColors,\r\n\r\n\t\t\tfog: fog,\r\n\t\t\tuseFog: material.fog,\r\n\t\t\tfogExp: fog instanceof THREE.FogExp2,\r\n\r\n\t\t\tflatShading: material.shading === THREE.FlatShading,\r\n\r\n\t\t\tsizeAttenuation: material.sizeAttenuation,\r\n\t\t\tlogarithmicDepthBuffer: _logarithmicDepthBuffer,\r\n\r\n\t\t\tskinning: material.skinning,\r\n\t\t\tmaxBones: maxBones,\r\n\t\t\tuseVertexTexture: _supportsBoneTextures && object && object.skeleton && object.skeleton.useVertexTexture,\r\n\r\n\t\t\tmorphTargets: material.morphTargets,\r\n\t\t\tmorphNormals: material.morphNormals,\r\n\t\t\tmaxMorphTargets: _this.maxMorphTargets,\r\n\t\t\tmaxMorphNormals: _this.maxMorphNormals,\r\n\r\n\t\t\tmaxDirLights: maxLightCount.directional,\r\n\t\t\tmaxPointLights: maxLightCount.point,\r\n\t\t\tmaxSpotLights: maxLightCount.spot,\r\n\t\t\tmaxHemiLights: maxLightCount.hemi,\r\n\r\n\t\t\tmaxShadows: maxShadows,\r\n\t\t\tshadowMapEnabled: _this.shadowMapEnabled && object.receiveShadow && maxShadows > 0,\r\n\t\t\tshadowMapType: _this.shadowMapType,\r\n\t\t\tshadowMapDebug: _this.shadowMapDebug,\r\n\t\t\tshadowMapCascade: _this.shadowMapCascade,\r\n\r\n\t\t\talphaTest: material.alphaTest,\r\n\t\t\tmetal: material.metal,\r\n\t\t\twrapAround: material.wrapAround,\r\n\t\t\tdoubleSided: material.side === THREE.DoubleSide,\r\n\t\t\tflipSided: material.side === THREE.BackSide\r\n\r\n\t\t};\r\n\r\n\t\t// Generate code\r\n\r\n\t\tvar chunks = [];\r\n\r\n\t\tif ( shaderID ) {\r\n\r\n\t\t\tchunks.push( shaderID );\r\n\r\n\t\t} else {\r\n\r\n\t\t\tchunks.push( material.fragmentShader );\r\n\t\t\tchunks.push( material.vertexShader );\r\n\r\n\t\t}\r\n\r\n\t\tif ( material.defines !== undefined ) {\r\n\r\n\t\t\tfor ( var name in material.defines ) {\r\n\r\n\t\t\t\tchunks.push( name );\r\n\t\t\t\tchunks.push( material.defines[ name ] );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tfor ( var name in parameters ) {\r\n\r\n\t\t\tchunks.push( name );\r\n\t\t\tchunks.push( parameters[ name ] );\r\n\r\n\t\t}\r\n\r\n\t\tvar code = chunks.join();\r\n\r\n\t\tvar program;\r\n\r\n\t\t// Check if code has been already compiled\r\n\r\n\t\tfor ( var p = 0, pl = _programs.length; p < pl; p ++ ) {\r\n\r\n\t\t\tvar programInfo = _programs[ p ];\r\n\r\n\t\t\tif ( programInfo.code === code ) {\r\n\r\n\t\t\t\tprogram = programInfo;\r\n\t\t\t\tprogram.usedTimes ++;\r\n\r\n\t\t\t\tbreak;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tif ( program === undefined ) {\r\n\r\n\t\t\tprogram = new THREE.WebGLProgram( _this, code, material, parameters );\r\n\t\t\t_programs.push( program );\r\n\r\n\t\t\t_this.info.memory.programs = _programs.length;\r\n\r\n\t\t}\r\n\r\n\t\tmaterial.program = program;\r\n\r\n\t\tvar attributes = program.attributes;\r\n\r\n\t\tif ( material.morphTargets ) {\r\n\r\n\t\t\tmaterial.numSupportedMorphTargets = 0;\r\n\r\n\t\t\tvar id, base = 'morphTarget';\r\n\r\n\t\t\tfor ( var i = 0; i < _this.maxMorphTargets; i ++ ) {\r\n\r\n\t\t\t\tid = base + i;\r\n\r\n\t\t\t\tif ( attributes[ id ] >= 0 ) {\r\n\r\n\t\t\t\t\tmaterial.numSupportedMorphTargets ++;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tif ( material.morphNormals ) {\r\n\r\n\t\t\tmaterial.numSupportedMorphNormals = 0;\r\n\r\n\t\t\tvar id, base = 'morphNormal';\r\n\r\n\t\t\tfor ( i = 0; i < _this.maxMorphNormals; i ++ ) {\r\n\r\n\t\t\t\tid = base + i;\r\n\r\n\t\t\t\tif ( attributes[ id ] >= 0 ) {\r\n\r\n\t\t\t\t\tmaterial.numSupportedMorphNormals ++;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tmaterial.uniformsList = [];\r\n\r\n\t\tfor ( var u in material.__webglShader.uniforms ) {\r\n\r\n\t\t\tvar location = material.program.uniforms[ u ];\r\n\r\n\t\t\tif ( location ) {\r\n\t\t\t\tmaterial.uniformsList.push( [ material.__webglShader.uniforms[ u ], location ] );\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tfunction setMaterial( material ) {\r\n\r\n\t\tif ( material.transparent === true ) {\r\n\r\n\t\t\tstate.setBlending( material.blending, material.blendEquation, material.blendSrc, material.blendDst, material.blendEquationAlpha, material.blendSrcAlpha, material.blendDstAlpha );\r\n\r\n\t\t} else {\r\n\r\n\t\t\tstate.setBlending( THREE.NoBlending );\r\n\r\n\t\t}\r\n\r\n\t\tstate.setDepthTest( material.depthTest );\r\n\t\tstate.setDepthWrite( material.depthWrite );\r\n\t\tstate.setColorWrite( material.colorWrite );\r\n\t\tstate.setPolygonOffset( material.polygonOffset, material.polygonOffsetFactor, material.polygonOffsetUnits );\r\n\r\n\t}\r\n\r\n\tfunction setProgram( camera, lights, fog, material, object ) {\r\n\r\n\t\t_usedTextureUnits = 0;\r\n\r\n\t\tif ( material.needsUpdate ) {\r\n\r\n\t\t\tif ( material.program ) deallocateMaterial( material );\r\n\r\n\t\t\tinitMaterial( material, lights, fog, object );\r\n\t\t\tmaterial.needsUpdate = false;\r\n\r\n\t\t}\r\n\r\n\t\tif ( material.morphTargets ) {\r\n\r\n\t\t\tif ( ! object.__webglMorphTargetInfluences ) {\r\n\r\n\t\t\t\tobject.__webglMorphTargetInfluences = new Float32Array( _this.maxMorphTargets );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tvar refreshProgram = false;\r\n\t\tvar refreshMaterial = false;\r\n\t\tvar refreshLights = false;\r\n\r\n\t\tvar program = material.program,\r\n\t\t\tp_uniforms = program.uniforms,\r\n\t\t\tm_uniforms = material.__webglShader.uniforms;\r\n\r\n\t\tif ( program.id !== _currentProgram ) {\r\n\r\n\t\t\t_gl.useProgram( program.program );\r\n\t\t\t_currentProgram = program.id;\r\n\r\n\t\t\trefreshProgram = true;\r\n\t\t\trefreshMaterial = true;\r\n\t\t\trefreshLights = true;\r\n\r\n\t\t}\r\n\r\n\t\tif ( material.id !== _currentMaterialId ) {\r\n\r\n\t\t\tif ( _currentMaterialId === -1 ) refreshLights = true;\r\n\t\t\t_currentMaterialId = material.id;\r\n\r\n\t\t\trefreshMaterial = true;\r\n\r\n\t\t}\r\n\r\n\t\tif ( refreshProgram || camera !== _currentCamera ) {\r\n\r\n\t\t\t_gl.uniformMatrix4fv( p_uniforms.projectionMatrix, false, camera.projectionMatrix.elements );\r\n\r\n\t\t\tif ( _logarithmicDepthBuffer ) {\r\n\r\n\t\t\t\t_gl.uniform1f( p_uniforms.logDepthBufFC, 2.0 / ( Math.log( camera.far + 1.0 ) / Math.LN2 ) );\r\n\r\n\t\t\t}\r\n\r\n\r\n\t\t\tif ( camera !== _currentCamera ) _currentCamera = camera;\r\n\r\n\t\t\t// load material specific uniforms\r\n\t\t\t// (shader material also gets them for the sake of genericity)\r\n\r\n\t\t\tif ( material instanceof THREE.ShaderMaterial ||\r\n\t\t\t\t material instanceof THREE.MeshPhongMaterial ||\r\n\t\t\t\t material.envMap ) {\r\n\r\n\t\t\t\tif ( p_uniforms.cameraPosition !== null ) {\r\n\r\n\t\t\t\t\t_vector3.setFromMatrixPosition( camera.matrixWorld );\r\n\t\t\t\t\t_gl.uniform3f( p_uniforms.cameraPosition, _vector3.x, _vector3.y, _vector3.z );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( material instanceof THREE.MeshPhongMaterial ||\r\n\t\t\t\t material instanceof THREE.MeshLambertMaterial ||\r\n\t\t\t\t material instanceof THREE.MeshBasicMaterial ||\r\n\t\t\t\t material instanceof THREE.ShaderMaterial ||\r\n\t\t\t\t material.skinning ) {\r\n\r\n\t\t\t\tif ( p_uniforms.viewMatrix !== null ) {\r\n\r\n\t\t\t\t\t_gl.uniformMatrix4fv( p_uniforms.viewMatrix, false, camera.matrixWorldInverse.elements );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\t// skinning uniforms must be set even if material didn't change\r\n\t\t// auto-setting of texture unit for bone texture must go before other textures\r\n\t\t// not sure why, but otherwise weird things happen\r\n\r\n\t\tif ( material.skinning ) {\r\n\r\n\t\t\tif ( object.bindMatrix && p_uniforms.bindMatrix !== null ) {\r\n\r\n\t\t\t\t_gl.uniformMatrix4fv( p_uniforms.bindMatrix, false, object.bindMatrix.elements );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( object.bindMatrixInverse && p_uniforms.bindMatrixInverse !== null ) {\r\n\r\n\t\t\t\t_gl.uniformMatrix4fv( p_uniforms.bindMatrixInverse, false, object.bindMatrixInverse.elements );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( _supportsBoneTextures && object.skeleton && object.skeleton.useVertexTexture ) {\r\n\r\n\t\t\t\tif ( p_uniforms.boneTexture !== null ) {\r\n\r\n\t\t\t\t\tvar textureUnit = getTextureUnit();\r\n\r\n\t\t\t\t\t_gl.uniform1i( p_uniforms.boneTexture, textureUnit );\r\n\t\t\t\t\t_this.setTexture( object.skeleton.boneTexture, textureUnit );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif ( p_uniforms.boneTextureWidth !== null ) {\r\n\r\n\t\t\t\t\t_gl.uniform1i( p_uniforms.boneTextureWidth, object.skeleton.boneTextureWidth );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif ( p_uniforms.boneTextureHeight !== null ) {\r\n\r\n\t\t\t\t\t_gl.uniform1i( p_uniforms.boneTextureHeight, object.skeleton.boneTextureHeight );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t} else if ( object.skeleton && object.skeleton.boneMatrices ) {\r\n\r\n\t\t\t\tif ( p_uniforms.boneGlobalMatrices !== null ) {\r\n\r\n\t\t\t\t\t_gl.uniformMatrix4fv( p_uniforms.boneGlobalMatrices, false, object.skeleton.boneMatrices );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tif ( refreshMaterial ) {\r\n\r\n\t\t\t// refresh uniforms common to several materials\r\n\r\n\t\t\tif ( fog && material.fog ) {\r\n\r\n\t\t\t\trefreshUniformsFog( m_uniforms, fog );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( material instanceof THREE.MeshPhongMaterial ||\r\n\t\t\t\t material instanceof THREE.MeshLambertMaterial ||\r\n\t\t\t\t material.lights ) {\r\n\r\n\t\t\t\tif ( _lightsNeedUpdate ) {\r\n\r\n\t\t\t\t\trefreshLights = true;\r\n\t\t\t\t\tsetupLights( lights );\r\n\t\t\t\t\t_lightsNeedUpdate = false;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif ( refreshLights ) {\r\n\t\t\t\t\trefreshUniformsLights( m_uniforms, _lights );\r\n\t\t\t\t\tmarkUniformsLightsNeedsUpdate( m_uniforms, true );\r\n\t\t\t\t} else {\r\n\t\t\t\t\tmarkUniformsLightsNeedsUpdate( m_uniforms, false );\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( material instanceof THREE.MeshBasicMaterial ||\r\n\t\t\t\t material instanceof THREE.MeshLambertMaterial ||\r\n\t\t\t\t material instanceof THREE.MeshPhongMaterial ) {\r\n\r\n\t\t\t\trefreshUniformsCommon( m_uniforms, material );\r\n\r\n\t\t\t}\r\n\r\n\t\t\t// refresh single material specific uniforms\r\n\r\n\t\t\tif ( material instanceof THREE.LineBasicMaterial ) {\r\n\r\n\t\t\t\trefreshUniformsLine( m_uniforms, material );\r\n\r\n\t\t\t} else if ( material instanceof THREE.LineDashedMaterial ) {\r\n\r\n\t\t\t\trefreshUniformsLine( m_uniforms, material );\r\n\t\t\t\trefreshUniformsDash( m_uniforms, material );\r\n\r\n\t\t\t} else if ( material instanceof THREE.PointCloudMaterial ) {\r\n\r\n\t\t\t\trefreshUniformsParticle( m_uniforms, material );\r\n\r\n\t\t\t} else if ( material instanceof THREE.MeshPhongMaterial ) {\r\n\r\n\t\t\t\trefreshUniformsPhong( m_uniforms, material );\r\n\r\n\t\t\t} else if ( material instanceof THREE.MeshLambertMaterial ) {\r\n\r\n\t\t\t\trefreshUniformsLambert( m_uniforms, material );\r\n\r\n\t\t\t} else if ( material instanceof THREE.MeshDepthMaterial ) {\r\n\r\n\t\t\t\tm_uniforms.mNear.value = camera.near;\r\n\t\t\t\tm_uniforms.mFar.value = camera.far;\r\n\t\t\t\tm_uniforms.opacity.value = material.opacity;\r\n\r\n\t\t\t} else if ( material instanceof THREE.MeshNormalMaterial ) {\r\n\r\n\t\t\t\tm_uniforms.opacity.value = material.opacity;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( object.receiveShadow && ! material._shadowPass ) {\r\n\r\n\t\t\t\trefreshUniformsShadow( m_uniforms, lights );\r\n\r\n\t\t\t}\r\n\r\n\t\t\t// load common uniforms\r\n\r\n\t\t\tloadUniformsGeneric( material.uniformsList );\r\n\r\n\t\t}\r\n\r\n\t\tloadUniformsMatrices( p_uniforms, object );\r\n\r\n\t\tif ( p_uniforms.modelMatrix !== null ) {\r\n\r\n\t\t\t_gl.uniformMatrix4fv( p_uniforms.modelMatrix, false, object.matrixWorld.elements );\r\n\r\n\t\t}\r\n\r\n\t\treturn program;\r\n\r\n\t}\r\n\r\n\t// Uniforms (refresh uniforms objects)\r\n\r\n\tfunction refreshUniformsCommon ( uniforms, material ) {\r\n\r\n\t\tuniforms.opacity.value = material.opacity;\r\n\r\n\t\tuniforms.diffuse.value = material.color;\r\n\r\n\t\tuniforms.map.value = material.map;\r\n\t\tuniforms.lightMap.value = material.lightMap;\r\n\t\tuniforms.specularMap.value = material.specularMap;\r\n\t\tuniforms.alphaMap.value = material.alphaMap;\r\n\r\n\t\tif ( material.bumpMap ) {\r\n\r\n\t\t\tuniforms.bumpMap.value = material.bumpMap;\r\n\t\t\tuniforms.bumpScale.value = material.bumpScale;\r\n\r\n\t\t}\r\n\r\n\t\tif ( material.normalMap ) {\r\n\r\n\t\t\tuniforms.normalMap.value = material.normalMap;\r\n\t\t\tuniforms.normalScale.value.copy( material.normalScale );\r\n\r\n\t\t}\r\n\r\n\t\t// uv repeat and offset setting priorities\r\n\t\t// 1. color map\r\n\t\t// 2. specular map\r\n\t\t// 3. normal map\r\n\t\t// 4. bump map\r\n\t\t// 5. alpha map\r\n\r\n\t\tvar uvScaleMap;\r\n\r\n\t\tif ( material.map ) {\r\n\r\n\t\t\tuvScaleMap = material.map;\r\n\r\n\t\t} else if ( material.specularMap ) {\r\n\r\n\t\t\tuvScaleMap = material.specularMap;\r\n\r\n\t\t} else if ( material.normalMap ) {\r\n\r\n\t\t\tuvScaleMap = material.normalMap;\r\n\r\n\t\t} else if ( material.bumpMap ) {\r\n\r\n\t\t\tuvScaleMap = material.bumpMap;\r\n\r\n\t\t} else if ( material.alphaMap ) {\r\n\r\n\t\t\tuvScaleMap = material.alphaMap;\r\n\r\n\t\t}\r\n\r\n\t\tif ( uvScaleMap !== undefined ) {\r\n\r\n\t\t\tvar offset = uvScaleMap.offset;\r\n\t\t\tvar repeat = uvScaleMap.repeat;\r\n\r\n\t\t\tuniforms.offsetRepeat.value.set( offset.x, offset.y, repeat.x, repeat.y );\r\n\r\n\t\t}\r\n\r\n\t\tuniforms.envMap.value = material.envMap;\r\n\t\tuniforms.flipEnvMap.value = ( material.envMap instanceof THREE.WebGLRenderTargetCube ) ? 1 : - 1;\r\n\r\n\t\tuniforms.reflectivity.value = material.reflectivity;\r\n\t\tuniforms.refractionRatio.value = material.refractionRatio;\r\n\r\n\t}\r\n\r\n\tfunction refreshUniformsLine ( uniforms, material ) {\r\n\r\n\t\tuniforms.diffuse.value = material.color;\r\n\t\tuniforms.opacity.value = material.opacity;\r\n\r\n\t}\r\n\r\n\tfunction refreshUniformsDash ( uniforms, material ) {\r\n\r\n\t\tuniforms.dashSize.value = material.dashSize;\r\n\t\tuniforms.totalSize.value = material.dashSize + material.gapSize;\r\n\t\tuniforms.scale.value = material.scale;\r\n\r\n\t}\r\n\r\n\tfunction refreshUniformsParticle ( uniforms, material ) {\r\n\r\n\t\tuniforms.psColor.value = material.color;\r\n\t\tuniforms.opacity.value = material.opacity;\r\n\t\tuniforms.size.value = material.size;\r\n\t\tuniforms.scale.value = _canvas.height / 2.0; // TODO: Cache this.\r\n\r\n\t\tuniforms.map.value = material.map;\r\n\r\n\t\tif ( material.map !== null ) {\r\n\r\n\t\t\tvar offset = material.map.offset;\r\n\t\t\tvar repeat = material.map.repeat;\r\n\r\n\t\t\tuniforms.offsetRepeat.value.set( offset.x, offset.y, repeat.x, repeat.y );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tfunction refreshUniformsFog ( uniforms, fog ) {\r\n\r\n\t\tuniforms.fogColor.value = fog.color;\r\n\r\n\t\tif ( fog instanceof THREE.Fog ) {\r\n\r\n\t\t\tuniforms.fogNear.value = fog.near;\r\n\t\t\tuniforms.fogFar.value = fog.far;\r\n\r\n\t\t} else if ( fog instanceof THREE.FogExp2 ) {\r\n\r\n\t\t\tuniforms.fogDensity.value = fog.density;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tfunction refreshUniformsPhong ( uniforms, material ) {\r\n\r\n\t\tuniforms.shininess.value = material.shininess;\r\n\r\n\t\tuniforms.emissive.value = material.emissive;\r\n\t\tuniforms.specular.value = material.specular;\r\n\r\n\t\tif ( material.wrapAround ) {\r\n\r\n\t\t\tuniforms.wrapRGB.value.copy( material.wrapRGB );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tfunction refreshUniformsLambert ( uniforms, material ) {\r\n\r\n\t\tuniforms.emissive.value = material.emissive;\r\n\r\n\t\tif ( material.wrapAround ) {\r\n\r\n\t\t\tuniforms.wrapRGB.value.copy( material.wrapRGB );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tfunction refreshUniformsLights ( uniforms, lights ) {\r\n\r\n\t\tuniforms.ambientLightColor.value = lights.ambient;\r\n\r\n\t\tuniforms.directionalLightColor.value = lights.directional.colors;\r\n\t\tuniforms.directionalLightDirection.value = lights.directional.positions;\r\n\r\n\t\tuniforms.pointLightColor.value = lights.point.colors;\r\n\t\tuniforms.pointLightPosition.value = lights.point.positions;\r\n\t\tuniforms.pointLightDistance.value = lights.point.distances;\r\n\t\tuniforms.pointLightDecay.value = lights.point.decays;\r\n\r\n\t\tuniforms.spotLightColor.value = lights.spot.colors;\r\n\t\tuniforms.spotLightPosition.value = lights.spot.positions;\r\n\t\tuniforms.spotLightDistance.value = lights.spot.distances;\r\n\t\tuniforms.spotLightDirection.value = lights.spot.directions;\r\n\t\tuniforms.spotLightAngleCos.value = lights.spot.anglesCos;\r\n\t\tuniforms.spotLightExponent.value = lights.spot.exponents;\r\n\t\tuniforms.spotLightDecay.value = lights.spot.decays;\r\n\r\n\t\tuniforms.hemisphereLightSkyColor.value = lights.hemi.skyColors;\r\n\t\tuniforms.hemisphereLightGroundColor.value = lights.hemi.groundColors;\r\n\t\tuniforms.hemisphereLightDirection.value = lights.hemi.positions;\r\n\r\n\t}\r\n\r\n\t// If uniforms are marked as clean, they don't need to be loaded to the GPU.\r\n\r\n\tfunction markUniformsLightsNeedsUpdate ( uniforms, value ) {\r\n\r\n\t\tuniforms.ambientLightColor.needsUpdate = value;\r\n\r\n\t\tuniforms.directionalLightColor.needsUpdate = value;\r\n\t\tuniforms.directionalLightDirection.needsUpdate = value;\r\n\r\n\t\tuniforms.pointLightColor.needsUpdate = value;\r\n\t\tuniforms.pointLightPosition.needsUpdate = value;\r\n\t\tuniforms.pointLightDistance.needsUpdate = value;\r\n\t\tuniforms.pointLightDecay.needsUpdate = value;\r\n\r\n\t\tuniforms.spotLightColor.needsUpdate = value;\r\n\t\tuniforms.spotLightPosition.needsUpdate = value;\r\n\t\tuniforms.spotLightDistance.needsUpdate = value;\r\n\t\tuniforms.spotLightDirection.needsUpdate = value;\r\n\t\tuniforms.spotLightAngleCos.needsUpdate = value;\r\n\t\tuniforms.spotLightExponent.needsUpdate = value;\r\n\t\tuniforms.spotLightDecay.needsUpdate = value;\r\n\r\n\t\tuniforms.hemisphereLightSkyColor.needsUpdate = value;\r\n\t\tuniforms.hemisphereLightGroundColor.needsUpdate = value;\r\n\t\tuniforms.hemisphereLightDirection.needsUpdate = value;\r\n\r\n\t}\r\n\r\n\tfunction refreshUniformsShadow ( uniforms, lights ) {\r\n\r\n\t\tif ( uniforms.shadowMatrix ) {\r\n\r\n\t\t\tvar j = 0;\r\n\r\n\t\t\tfor ( var i = 0, il = lights.length; i < il; i ++ ) {\r\n\r\n\t\t\t\tvar light = lights[ i ];\r\n\r\n\t\t\t\tif ( ! light.castShadow ) continue;\r\n\r\n\t\t\t\tif ( light instanceof THREE.SpotLight || ( light instanceof THREE.DirectionalLight && ! light.shadowCascade ) ) {\r\n\r\n\t\t\t\t\tuniforms.shadowMap.value[ j ] = light.shadowMap;\r\n\t\t\t\t\tuniforms.shadowMapSize.value[ j ] = light.shadowMapSize;\r\n\r\n\t\t\t\t\tuniforms.shadowMatrix.value[ j ] = light.shadowMatrix;\r\n\r\n\t\t\t\t\tuniforms.shadowDarkness.value[ j ] = light.shadowDarkness;\r\n\t\t\t\t\tuniforms.shadowBias.value[ j ] = light.shadowBias;\r\n\r\n\t\t\t\t\tj ++;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\t// Uniforms (load to GPU)\r\n\r\n\tfunction loadUniformsMatrices ( uniforms, object ) {\r\n\r\n\t\t_gl.uniformMatrix4fv( uniforms.modelViewMatrix, false, object._modelViewMatrix.elements );\r\n\r\n\t\tif ( uniforms.normalMatrix ) {\r\n\r\n\t\t\t_gl.uniformMatrix3fv( uniforms.normalMatrix, false, object._normalMatrix.elements );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tfunction getTextureUnit() {\r\n\r\n\t\tvar textureUnit = _usedTextureUnits;\r\n\r\n\t\tif ( textureUnit >= _maxTextures ) {\r\n\r\n\t\t\tTHREE.warn( 'WebGLRenderer: trying to use ' + textureUnit + ' texture units while this GPU supports only ' + _maxTextures );\r\n\r\n\t\t}\r\n\r\n\t\t_usedTextureUnits += 1;\r\n\r\n\t\treturn textureUnit;\r\n\r\n\t}\r\n\r\n\tfunction loadUniformsGeneric ( uniforms ) {\r\n\r\n\t\tvar texture, textureUnit, offset;\r\n\r\n\t\tfor ( var j = 0, jl = uniforms.length; j < jl; j ++ ) {\r\n\r\n\t\t\tvar uniform = uniforms[ j ][ 0 ];\r\n\r\n\t\t\t// needsUpdate property is not added to all uniforms.\r\n\t\t\tif ( uniform.needsUpdate === false ) continue;\r\n\r\n\t\t\tvar type = uniform.type;\r\n\t\t\tvar value = uniform.value;\r\n\t\t\tvar location = uniforms[ j ][ 1 ];\r\n\r\n\t\t\tswitch ( type ) {\r\n\r\n\t\t\t\tcase '1i':\r\n\t\t\t\t\t_gl.uniform1i( location, value );\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase '1f':\r\n\t\t\t\t\t_gl.uniform1f( location, value );\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase '2f':\r\n\t\t\t\t\t_gl.uniform2f( location, value[ 0 ], value[ 1 ] );\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase '3f':\r\n\t\t\t\t\t_gl.uniform3f( location, value[ 0 ], value[ 1 ], value[ 2 ] );\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase '4f':\r\n\t\t\t\t\t_gl.uniform4f( location, value[ 0 ], value[ 1 ], value[ 2 ], value[ 3 ] );\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase '1iv':\r\n\t\t\t\t\t_gl.uniform1iv( location, value );\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase '3iv':\r\n\t\t\t\t\t_gl.uniform3iv( location, value );\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase '1fv':\r\n\t\t\t\t\t_gl.uniform1fv( location, value );\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase '2fv':\r\n\t\t\t\t\t_gl.uniform2fv( location, value );\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase '3fv':\r\n\t\t\t\t\t_gl.uniform3fv( location, value );\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase '4fv':\r\n\t\t\t\t\t_gl.uniform4fv( location, value );\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase 'Matrix3fv':\r\n\t\t\t\t\t_gl.uniformMatrix3fv( location, false, value );\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase 'Matrix4fv':\r\n\t\t\t\t\t_gl.uniformMatrix4fv( location, false, value );\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\t//\r\n\r\n\t\t\t\tcase 'i':\r\n\r\n\t\t\t\t\t// single integer\r\n\t\t\t\t\t_gl.uniform1i( location, value );\r\n\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase 'f':\r\n\r\n\t\t\t\t\t// single float\r\n\t\t\t\t\t_gl.uniform1f( location, value );\r\n\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase 'v2':\r\n\r\n\t\t\t\t\t// single THREE.Vector2\r\n\t\t\t\t\t_gl.uniform2f( location, value.x, value.y );\r\n\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase 'v3':\r\n\r\n\t\t\t\t\t// single THREE.Vector3\r\n\t\t\t\t\t_gl.uniform3f( location, value.x, value.y, value.z );\r\n\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase 'v4':\r\n\r\n\t\t\t\t\t// single THREE.Vector4\r\n\t\t\t\t\t_gl.uniform4f( location, value.x, value.y, value.z, value.w );\r\n\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase 'c':\r\n\r\n\t\t\t\t\t// single THREE.Color\r\n\t\t\t\t\t_gl.uniform3f( location, value.r, value.g, value.b );\r\n\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase 'iv1':\r\n\r\n\t\t\t\t\t// flat array of integers (JS or typed array)\r\n\t\t\t\t\t_gl.uniform1iv( location, value );\r\n\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase 'iv':\r\n\r\n\t\t\t\t\t// flat array of integers with 3 x N size (JS or typed array)\r\n\t\t\t\t\t_gl.uniform3iv( location, value );\r\n\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase 'fv1':\r\n\r\n\t\t\t\t\t// flat array of floats (JS or typed array)\r\n\t\t\t\t\t_gl.uniform1fv( location, value );\r\n\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase 'fv':\r\n\r\n\t\t\t\t\t// flat array of floats with 3 x N size (JS or typed array)\r\n\t\t\t\t\t_gl.uniform3fv( location, value );\r\n\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase 'v2v':\r\n\r\n\t\t\t\t\t// array of THREE.Vector2\r\n\r\n\t\t\t\t\tif ( uniform._array === undefined ) {\r\n\r\n\t\t\t\t\t\tuniform._array = new Float32Array( 2 * value.length );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tfor ( var i = 0, il = value.length; i < il; i ++ ) {\r\n\r\n\t\t\t\t\t\toffset = i * 2;\r\n\r\n\t\t\t\t\t\tuniform._array[ offset ] = value[ i ].x;\r\n\t\t\t\t\t\tuniform._array[ offset + 1 ] = value[ i ].y;\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\t_gl.uniform2fv( location, uniform._array );\r\n\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase 'v3v':\r\n\r\n\t\t\t\t\t// array of THREE.Vector3\r\n\r\n\t\t\t\t\tif ( uniform._array === undefined ) {\r\n\r\n\t\t\t\t\t\tuniform._array = new Float32Array( 3 * value.length );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tfor ( var i = 0, il = value.length; i < il; i ++ ) {\r\n\r\n\t\t\t\t\t\toffset = i * 3;\r\n\r\n\t\t\t\t\t\tuniform._array[ offset ] = value[ i ].x;\r\n\t\t\t\t\t\tuniform._array[ offset + 1 ] = value[ i ].y;\r\n\t\t\t\t\t\tuniform._array[ offset + 2 ] = value[ i ].z;\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\t_gl.uniform3fv( location, uniform._array );\r\n\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase 'v4v':\r\n\r\n\t\t\t\t\t// array of THREE.Vector4\r\n\r\n\t\t\t\t\tif ( uniform._array === undefined ) {\r\n\r\n\t\t\t\t\t\tuniform._array = new Float32Array( 4 * value.length );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tfor ( var i = 0, il = value.length; i < il; i ++ ) {\r\n\r\n\t\t\t\t\t\toffset = i * 4;\r\n\r\n\t\t\t\t\t\tuniform._array[ offset ] = value[ i ].x;\r\n\t\t\t\t\t\tuniform._array[ offset + 1 ] = value[ i ].y;\r\n\t\t\t\t\t\tuniform._array[ offset + 2 ] = value[ i ].z;\r\n\t\t\t\t\t\tuniform._array[ offset + 3 ] = value[ i ].w;\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\t_gl.uniform4fv( location, uniform._array );\r\n\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase 'm3':\r\n\r\n\t\t\t\t\t// single THREE.Matrix3\r\n\t\t\t\t\t_gl.uniformMatrix3fv( location, false, value.elements );\r\n\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase 'm3v':\r\n\r\n\t\t\t\t\t// array of THREE.Matrix3\r\n\r\n\t\t\t\t\tif ( uniform._array === undefined ) {\r\n\r\n\t\t\t\t\t\tuniform._array = new Float32Array( 9 * value.length );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tfor ( var i = 0, il = value.length; i < il; i ++ ) {\r\n\r\n\t\t\t\t\t\tvalue[ i ].flattenToArrayOffset( uniform._array, i * 9 );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\t_gl.uniformMatrix3fv( location, false, uniform._array );\r\n\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase 'm4':\r\n\r\n\t\t\t\t\t// single THREE.Matrix4\r\n\t\t\t\t\t_gl.uniformMatrix4fv( location, false, value.elements );\r\n\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase 'm4v':\r\n\r\n\t\t\t\t\t// array of THREE.Matrix4\r\n\r\n\t\t\t\t\tif ( uniform._array === undefined ) {\r\n\r\n\t\t\t\t\t\tuniform._array = new Float32Array( 16 * value.length );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tfor ( var i = 0, il = value.length; i < il; i ++ ) {\r\n\r\n\t\t\t\t\t\tvalue[ i ].flattenToArrayOffset( uniform._array, i * 16 );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\t_gl.uniformMatrix4fv( location, false, uniform._array );\r\n\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase 't':\r\n\r\n\t\t\t\t\t// single THREE.Texture (2d or cube)\r\n\r\n\t\t\t\t\ttexture = value;\r\n\t\t\t\t\ttextureUnit = getTextureUnit();\r\n\r\n\t\t\t\t\t_gl.uniform1i( location, textureUnit );\r\n\r\n\t\t\t\t\tif ( ! texture ) continue;\r\n\r\n\t\t\t\t\tif ( texture instanceof THREE.CubeTexture ||\r\n\t\t\t\t\t ( texture.image instanceof Array && texture.image.length === 6 ) ) { // CompressedTexture can have Array in image :/\r\n\r\n\t\t\t\t\t\tsetCubeTexture( texture, textureUnit );\r\n\r\n\t\t\t\t\t} else if ( texture instanceof THREE.WebGLRenderTargetCube ) {\r\n\r\n\t\t\t\t\t\tsetCubeTextureDynamic( texture, textureUnit );\r\n\r\n\t\t\t\t\t} else {\r\n\r\n\t\t\t\t\t\t_this.setTexture( texture, textureUnit );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase 'tv':\r\n\r\n\t\t\t\t\t// array of THREE.Texture (2d)\r\n\r\n\t\t\t\t\tif ( uniform._array === undefined ) {\r\n\r\n\t\t\t\t\t\tuniform._array = [];\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tfor ( var i = 0, il = uniform.value.length; i < il; i ++ ) {\r\n\r\n\t\t\t\t\t\tuniform._array[ i ] = getTextureUnit();\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\t_gl.uniform1iv( location, uniform._array );\r\n\r\n\t\t\t\t\tfor ( var i = 0, il = uniform.value.length; i < il; i ++ ) {\r\n\r\n\t\t\t\t\t\ttexture = uniform.value[ i ];\r\n\t\t\t\t\t\ttextureUnit = uniform._array[ i ];\r\n\r\n\t\t\t\t\t\tif ( ! texture ) continue;\r\n\r\n\t\t\t\t\t\t_this.setTexture( texture, textureUnit );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tdefault:\r\n\r\n\t\t\t\t\tTHREE.warn( 'THREE.WebGLRenderer: Unknown uniform type: ' + type );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tfunction setupMatrices ( object, camera ) {\r\n\r\n\t\tobject._modelViewMatrix.multiplyMatrices( camera.matrixWorldInverse, object.matrixWorld );\r\n\t\tobject._normalMatrix.getNormalMatrix( object._modelViewMatrix );\r\n\r\n\t}\r\n\r\n\tfunction setColorLinear( array, offset, color, intensity ) {\r\n\r\n\t\tarray[ offset ] = color.r * intensity;\r\n\t\tarray[ offset + 1 ] = color.g * intensity;\r\n\t\tarray[ offset + 2 ] = color.b * intensity;\r\n\r\n\t}\r\n\r\n\tfunction setupLights ( lights ) {\r\n\r\n\t\tvar l, ll, light,\r\n\t\tr = 0, g = 0, b = 0,\r\n\t\tcolor, skyColor, groundColor,\r\n\t\tintensity,\r\n\t\tdistance,\r\n\r\n\t\tzlights = _lights,\r\n\r\n\t\tdirColors = zlights.directional.colors,\r\n\t\tdirPositions = zlights.directional.positions,\r\n\r\n\t\tpointColors = zlights.point.colors,\r\n\t\tpointPositions = zlights.point.positions,\r\n\t\tpointDistances = zlights.point.distances,\r\n\t\tpointDecays = zlights.point.decays,\r\n\r\n\t\tspotColors = zlights.spot.colors,\r\n\t\tspotPositions = zlights.spot.positions,\r\n\t\tspotDistances = zlights.spot.distances,\r\n\t\tspotDirections = zlights.spot.directions,\r\n\t\tspotAnglesCos = zlights.spot.anglesCos,\r\n\t\tspotExponents = zlights.spot.exponents,\r\n\t\tspotDecays = zlights.spot.decays,\r\n\r\n\t\themiSkyColors = zlights.hemi.skyColors,\r\n\t\themiGroundColors = zlights.hemi.groundColors,\r\n\t\themiPositions = zlights.hemi.positions,\r\n\r\n\t\tdirLength = 0,\r\n\t\tpointLength = 0,\r\n\t\tspotLength = 0,\r\n\t\themiLength = 0,\r\n\r\n\t\tdirCount = 0,\r\n\t\tpointCount = 0,\r\n\t\tspotCount = 0,\r\n\t\themiCount = 0,\r\n\r\n\t\tdirOffset = 0,\r\n\t\tpointOffset = 0,\r\n\t\tspotOffset = 0,\r\n\t\themiOffset = 0;\r\n\r\n\t\tfor ( l = 0, ll = lights.length; l < ll; l ++ ) {\r\n\r\n\t\t\tlight = lights[ l ];\r\n\r\n\t\t\tif ( light.onlyShadow ) continue;\r\n\r\n\t\t\tcolor = light.color;\r\n\t\t\tintensity = light.intensity;\r\n\t\t\tdistance = light.distance;\r\n\r\n\t\t\tif ( light instanceof THREE.AmbientLight ) {\r\n\r\n\t\t\t\tif ( ! light.visible ) continue;\r\n\r\n\t\t\t\tr += color.r;\r\n\t\t\t\tg += color.g;\r\n\t\t\t\tb += color.b;\r\n\r\n\t\t\t} else if ( light instanceof THREE.DirectionalLight ) {\r\n\r\n\t\t\t\tdirCount += 1;\r\n\r\n\t\t\t\tif ( ! light.visible ) continue;\r\n\r\n\t\t\t\t_direction.setFromMatrixPosition( light.matrixWorld );\r\n\t\t\t\t_vector3.setFromMatrixPosition( light.target.matrixWorld );\r\n\t\t\t\t_direction.sub( _vector3 );\r\n\t\t\t\t_direction.normalize();\r\n\r\n\t\t\t\tdirOffset = dirLength * 3;\r\n\r\n\t\t\t\tdirPositions[ dirOffset ] = _direction.x;\r\n\t\t\t\tdirPositions[ dirOffset + 1 ] = _direction.y;\r\n\t\t\t\tdirPositions[ dirOffset + 2 ] = _direction.z;\r\n\r\n\t\t\t\tsetColorLinear( dirColors, dirOffset, color, intensity );\r\n\r\n\t\t\t\tdirLength += 1;\r\n\r\n\t\t\t} else if ( light instanceof THREE.PointLight ) {\r\n\r\n\t\t\t\tpointCount += 1;\r\n\r\n\t\t\t\tif ( ! light.visible ) continue;\r\n\r\n\t\t\t\tpointOffset = pointLength * 3;\r\n\r\n\t\t\t\tsetColorLinear( pointColors, pointOffset, color, intensity );\r\n\r\n\t\t\t\t_vector3.setFromMatrixPosition( light.matrixWorld );\r\n\r\n\t\t\t\tpointPositions[ pointOffset ] = _vector3.x;\r\n\t\t\t\tpointPositions[ pointOffset + 1 ] = _vector3.y;\r\n\t\t\t\tpointPositions[ pointOffset + 2 ] = _vector3.z;\r\n\r\n\t\t\t\t// distance is 0 if decay is 0, because there is no attenuation at all.\r\n\t\t\t\tpointDistances[ pointLength ] = distance;\r\n\t\t\t\tpointDecays[ pointLength ] = ( light.distance === 0 ) ? 0.0 : light.decay;\r\n\r\n\t\t\t\tpointLength += 1;\r\n\r\n\t\t\t} else if ( light instanceof THREE.SpotLight ) {\r\n\r\n\t\t\t\tspotCount += 1;\r\n\r\n\t\t\t\tif ( ! light.visible ) continue;\r\n\r\n\t\t\t\tspotOffset = spotLength * 3;\r\n\r\n\t\t\t\tsetColorLinear( spotColors, spotOffset, color, intensity );\r\n\r\n\t\t\t\t_direction.setFromMatrixPosition( light.matrixWorld );\r\n\r\n\t\t\t\tspotPositions[ spotOffset ] = _direction.x;\r\n\t\t\t\tspotPositions[ spotOffset + 1 ] = _direction.y;\r\n\t\t\t\tspotPositions[ spotOffset + 2 ] = _direction.z;\r\n\r\n\t\t\t\tspotDistances[ spotLength ] = distance;\r\n\r\n\t\t\t\t_vector3.setFromMatrixPosition( light.target.matrixWorld );\r\n\t\t\t\t_direction.sub( _vector3 );\r\n\t\t\t\t_direction.normalize();\r\n\r\n\t\t\t\tspotDirections[ spotOffset ] = _direction.x;\r\n\t\t\t\tspotDirections[ spotOffset + 1 ] = _direction.y;\r\n\t\t\t\tspotDirections[ spotOffset + 2 ] = _direction.z;\r\n\r\n\t\t\t\tspotAnglesCos[ spotLength ] = Math.cos( light.angle );\r\n\t\t\t\tspotExponents[ spotLength ] = light.exponent;\r\n\t\t\t\tspotDecays[ spotLength ] = ( light.distance === 0 ) ? 0.0 : light.decay;\r\n\r\n\t\t\t\tspotLength += 1;\r\n\r\n\t\t\t} else if ( light instanceof THREE.HemisphereLight ) {\r\n\r\n\t\t\t\themiCount += 1;\r\n\r\n\t\t\t\tif ( ! light.visible ) continue;\r\n\r\n\t\t\t\t_direction.setFromMatrixPosition( light.matrixWorld );\r\n\t\t\t\t_direction.normalize();\r\n\r\n\t\t\t\themiOffset = hemiLength * 3;\r\n\r\n\t\t\t\themiPositions[ hemiOffset ] = _direction.x;\r\n\t\t\t\themiPositions[ hemiOffset + 1 ] = _direction.y;\r\n\t\t\t\themiPositions[ hemiOffset + 2 ] = _direction.z;\r\n\r\n\t\t\t\tskyColor = light.color;\r\n\t\t\t\tgroundColor = light.groundColor;\r\n\r\n\t\t\t\tsetColorLinear( hemiSkyColors, hemiOffset, skyColor, intensity );\r\n\t\t\t\tsetColorLinear( hemiGroundColors, hemiOffset, groundColor, intensity );\r\n\r\n\t\t\t\themiLength += 1;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\t// null eventual remains from removed lights\r\n\t\t// (this is to avoid if in shader)\r\n\r\n\t\tfor ( l = dirLength * 3, ll = Math.max( dirColors.length, dirCount * 3 ); l < ll; l ++ ) dirColors[ l ] = 0.0;\r\n\t\tfor ( l = pointLength * 3, ll = Math.max( pointColors.length, pointCount * 3 ); l < ll; l ++ ) pointColors[ l ] = 0.0;\r\n\t\tfor ( l = spotLength * 3, ll = Math.max( spotColors.length, spotCount * 3 ); l < ll; l ++ ) spotColors[ l ] = 0.0;\r\n\t\tfor ( l = hemiLength * 3, ll = Math.max( hemiSkyColors.length, hemiCount * 3 ); l < ll; l ++ ) hemiSkyColors[ l ] = 0.0;\r\n\t\tfor ( l = hemiLength * 3, ll = Math.max( hemiGroundColors.length, hemiCount * 3 ); l < ll; l ++ ) hemiGroundColors[ l ] = 0.0;\r\n\r\n\t\tzlights.directional.length = dirLength;\r\n\t\tzlights.point.length = pointLength;\r\n\t\tzlights.spot.length = spotLength;\r\n\t\tzlights.hemi.length = hemiLength;\r\n\r\n\t\tzlights.ambient[ 0 ] = r;\r\n\t\tzlights.ambient[ 1 ] = g;\r\n\t\tzlights.ambient[ 2 ] = b;\r\n\r\n\t}\r\n\r\n\t// GL state setting\r\n\r\n\tthis.setFaceCulling = function ( cullFace, frontFaceDirection ) {\r\n\r\n\t\tif ( cullFace === THREE.CullFaceNone ) {\r\n\r\n\t\t\t_gl.disable( _gl.CULL_FACE );\r\n\r\n\t\t} else {\r\n\r\n\t\t\tif ( frontFaceDirection === THREE.FrontFaceDirectionCW ) {\r\n\r\n\t\t\t\t_gl.frontFace( _gl.CW );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\t_gl.frontFace( _gl.CCW );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( cullFace === THREE.CullFaceBack ) {\r\n\r\n\t\t\t\t_gl.cullFace( _gl.BACK );\r\n\r\n\t\t\t} else if ( cullFace === THREE.CullFaceFront ) {\r\n\r\n\t\t\t\t_gl.cullFace( _gl.FRONT );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\t_gl.cullFace( _gl.FRONT_AND_BACK );\r\n\r\n\t\t\t}\r\n\r\n\t\t\t_gl.enable( _gl.CULL_FACE );\r\n\r\n\t\t}\r\n\r\n\t};\r\n\r\n\tthis.setMaterialFaces = function ( material ) {\r\n\r\n\t\tstate.setDoubleSided( material.side === THREE.DoubleSide );\r\n\t\tstate.setFlipSided( material.side === THREE.BackSide );\r\n\r\n\t};\r\n\r\n\t// Textures\r\n\r\n\tfunction setTextureParameters ( textureType, texture, isImagePowerOfTwo ) {\r\n\r\n\t\tvar extension;\r\n\r\n\t\tif ( isImagePowerOfTwo ) {\r\n\r\n\t\t\t_gl.texParameteri( textureType, _gl.TEXTURE_WRAP_S, paramThreeToGL( texture.wrapS ) );\r\n\t\t\t_gl.texParameteri( textureType, _gl.TEXTURE_WRAP_T, paramThreeToGL( texture.wrapT ) );\r\n\r\n\t\t\t_gl.texParameteri( textureType, _gl.TEXTURE_MAG_FILTER, paramThreeToGL( texture.magFilter ) );\r\n\t\t\t_gl.texParameteri( textureType, _gl.TEXTURE_MIN_FILTER, paramThreeToGL( texture.minFilter ) );\r\n\r\n\t\t} else {\r\n\r\n\t\t\t_gl.texParameteri( textureType, _gl.TEXTURE_WRAP_S, _gl.CLAMP_TO_EDGE );\r\n\t\t\t_gl.texParameteri( textureType, _gl.TEXTURE_WRAP_T, _gl.CLAMP_TO_EDGE );\r\n\r\n\t\t\tif ( texture.wrapS !== THREE.ClampToEdgeWrapping || texture.wrapT !== THREE.ClampToEdgeWrapping ) {\r\n\r\n\t\t\t\tTHREE.warn( 'THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping. ( ' + texture.sourceFile + ' )' );\r\n\r\n\t\t\t}\r\n\r\n\t\t\t_gl.texParameteri( textureType, _gl.TEXTURE_MAG_FILTER, filterFallback( texture.magFilter ) );\r\n\t\t\t_gl.texParameteri( textureType, _gl.TEXTURE_MIN_FILTER, filterFallback( texture.minFilter ) );\r\n\r\n\t\t\tif ( texture.minFilter !== THREE.NearestFilter && texture.minFilter !== THREE.LinearFilter ) {\r\n\r\n\t\t\t\tTHREE.warn( 'THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter. ( ' + texture.sourceFile + ' )' );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\textension = extensions.get( 'EXT_texture_filter_anisotropic' );\r\n\r\n\t\tif ( extension && texture.type !== THREE.FloatType && texture.type !== THREE.HalfFloatType ) {\r\n\r\n\t\t\tif ( texture.anisotropy > 1 || texture.__currentAnisotropy ) {\r\n\r\n\t\t\t\t_gl.texParameterf( textureType, extension.TEXTURE_MAX_ANISOTROPY_EXT, Math.min( texture.anisotropy, _this.getMaxAnisotropy() ) );\r\n\t\t\t\ttexture.__currentAnisotropy = texture.anisotropy;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tthis.uploadTexture = function ( texture ) {\r\n\r\n\t\tif ( texture.__webglInit === undefined ) {\r\n\r\n\t\t\ttexture.__webglInit = true;\r\n\r\n\t\t\ttexture.addEventListener( 'dispose', onTextureDispose );\r\n\r\n\t\t\ttexture.__webglTexture = _gl.createTexture();\r\n\r\n\t\t\t_this.info.memory.textures ++;\r\n\r\n\t\t}\r\n\r\n\t\t_gl.bindTexture( _gl.TEXTURE_2D, texture.__webglTexture );\r\n\r\n\t\t_gl.pixelStorei( _gl.UNPACK_FLIP_Y_WEBGL, texture.flipY );\r\n\t\t_gl.pixelStorei( _gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, texture.premultiplyAlpha );\r\n\t\t_gl.pixelStorei( _gl.UNPACK_ALIGNMENT, texture.unpackAlignment );\r\n\r\n\t\ttexture.image = clampToMaxSize( texture.image, _maxTextureSize );\r\n\r\n\t\tvar image = texture.image,\r\n\t\tisImagePowerOfTwo = THREE.Math.isPowerOfTwo( image.width ) && THREE.Math.isPowerOfTwo( image.height ),\r\n\t\tglFormat = paramThreeToGL( texture.format ),\r\n\t\tglType = paramThreeToGL( texture.type );\r\n\r\n\t\tsetTextureParameters( _gl.TEXTURE_2D, texture, isImagePowerOfTwo );\r\n\r\n\t\tvar mipmap, mipmaps = texture.mipmaps;\r\n\r\n\t\tif ( texture instanceof THREE.DataTexture ) {\r\n\r\n\t\t\t// use manually created mipmaps if available\r\n\t\t\t// if there are no manual mipmaps\r\n\t\t\t// set 0 level mipmap and then use GL to generate other mipmap levels\r\n\r\n\t\t\tif ( mipmaps.length > 0 && isImagePowerOfTwo ) {\r\n\r\n\t\t\t\tfor ( var i = 0, il = mipmaps.length; i < il; i ++ ) {\r\n\r\n\t\t\t\t\tmipmap = mipmaps[ i ];\r\n\t\t\t\t\t_gl.texImage2D( _gl.TEXTURE_2D, i, glFormat, mipmap.width, mipmap.height, 0, glFormat, glType, mipmap.data );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\ttexture.generateMipmaps = false;\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\t_gl.texImage2D( _gl.TEXTURE_2D, 0, glFormat, image.width, image.height, 0, glFormat, glType, image.data );\r\n\r\n\t\t\t}\r\n\r\n\t\t} else if ( texture instanceof THREE.CompressedTexture ) {\r\n\r\n\t\t\tfor ( var i = 0, il = mipmaps.length; i < il; i ++ ) {\r\n\r\n\t\t\t\tmipmap = mipmaps[ i ];\r\n\r\n\t\t\t\tif ( texture.format !== THREE.RGBAFormat && texture.format !== THREE.RGBFormat ) {\r\n\r\n\t\t\t\t\tif ( getCompressedTextureFormats().indexOf( glFormat ) > -1 ) {\r\n\r\n\t\t\t\t\t\t_gl.compressedTexImage2D( _gl.TEXTURE_2D, i, glFormat, mipmap.width, mipmap.height, 0, mipmap.data );\r\n\r\n\t\t\t\t\t} else {\r\n\r\n\t\t\t\t\t\tTHREE.warn( \"THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()\" );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\t_gl.texImage2D( _gl.TEXTURE_2D, i, glFormat, mipmap.width, mipmap.height, 0, glFormat, glType, mipmap.data );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t} else { // regular Texture (image, video, canvas)\r\n\r\n\t\t\t// use manually created mipmaps if available\r\n\t\t\t// if there are no manual mipmaps\r\n\t\t\t// set 0 level mipmap and then use GL to generate other mipmap levels\r\n\r\n\t\t\tif ( mipmaps.length > 0 && isImagePowerOfTwo ) {\r\n\r\n\t\t\t\tfor ( var i = 0, il = mipmaps.length; i < il; i ++ ) {\r\n\r\n\t\t\t\t\tmipmap = mipmaps[ i ];\r\n\t\t\t\t\t_gl.texImage2D( _gl.TEXTURE_2D, i, glFormat, glFormat, glType, mipmap );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\ttexture.generateMipmaps = false;\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\t_gl.texImage2D( _gl.TEXTURE_2D, 0, glFormat, glFormat, glType, texture.image );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tif ( texture.generateMipmaps && isImagePowerOfTwo ) _gl.generateMipmap( _gl.TEXTURE_2D );\r\n\r\n\t\ttexture.needsUpdate = false;\r\n\r\n\t\tif ( texture.onUpdate ) texture.onUpdate();\r\n\r\n\t};\r\n\r\n\tthis.setTexture = function ( texture, slot ) {\r\n\r\n\t\t_gl.activeTexture( _gl.TEXTURE0 + slot );\r\n\r\n\t\tif ( texture.needsUpdate ) {\r\n\r\n\t\t\t_this.uploadTexture( texture );\r\n\r\n\t\t} else {\r\n\r\n\t\t\t_gl.bindTexture( _gl.TEXTURE_2D, texture.__webglTexture );\r\n\r\n\t\t}\r\n\r\n\t};\r\n\r\n\tfunction clampToMaxSize ( image, maxSize ) {\r\n\r\n\t\tif ( image.width > maxSize || image.height > maxSize ) {\r\n\r\n\t\t\t// Warning: Scaling through the canvas will only work with images that use\r\n\t\t\t// premultiplied alpha.\r\n\r\n\t\t\tvar scale = maxSize / Math.max( image.width, image.height );\r\n\r\n\t\t\tvar canvas = document.createElement( 'canvas' );\r\n\t\t\tcanvas.width = Math.floor( image.width * scale );\r\n\t\t\tcanvas.height = Math.floor( image.height * scale );\r\n\r\n\t\t\tvar context = canvas.getContext( '2d' );\r\n\t\t\tcontext.drawImage( image, 0, 0, image.width, image.height, 0, 0, canvas.width, canvas.height );\r\n\r\n\t\t\tTHREE.warn( 'THREE.WebGLRenderer: image is too big (' + image.width + 'x' + image.height + '). Resized to ' + canvas.width + 'x' + canvas.height, image );\r\n\r\n\t\t\treturn canvas;\r\n\r\n\t\t}\r\n\r\n\t\treturn image;\r\n\r\n\t}\r\n\r\n\tfunction setCubeTexture ( texture, slot ) {\r\n\r\n\t\tif ( texture.image.length === 6 ) {\r\n\r\n\t\t\tif ( texture.needsUpdate ) {\r\n\r\n\t\t\t\tif ( ! texture.image.__webglTextureCube ) {\r\n\r\n\t\t\t\t\ttexture.addEventListener( 'dispose', onTextureDispose );\r\n\r\n\t\t\t\t\ttexture.image.__webglTextureCube = _gl.createTexture();\r\n\r\n\t\t\t\t\t_this.info.memory.textures ++;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\t_gl.activeTexture( _gl.TEXTURE0 + slot );\r\n\t\t\t\t_gl.bindTexture( _gl.TEXTURE_CUBE_MAP, texture.image.__webglTextureCube );\r\n\r\n\t\t\t\t_gl.pixelStorei( _gl.UNPACK_FLIP_Y_WEBGL, texture.flipY );\r\n\r\n\t\t\t\tvar isCompressed = texture instanceof THREE.CompressedTexture;\r\n\t\t\t\tvar isDataTexture = texture.image[ 0 ] instanceof THREE.DataTexture;\r\n\r\n\t\t\t\tvar cubeImage = [];\r\n\r\n\t\t\t\tfor ( var i = 0; i < 6; i ++ ) {\r\n\r\n\t\t\t\t\tif ( _this.autoScaleCubemaps && ! isCompressed && ! isDataTexture ) {\r\n\r\n\t\t\t\t\t\tcubeImage[ i ] = clampToMaxSize( texture.image[ i ], _maxCubemapSize );\r\n\r\n\t\t\t\t\t} else {\r\n\r\n\t\t\t\t\t\tcubeImage[ i ] = isDataTexture ? texture.image[ i ].image : texture.image[ i ];\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tvar image = cubeImage[ 0 ],\r\n\t\t\t\tisImagePowerOfTwo = THREE.Math.isPowerOfTwo( image.width ) && THREE.Math.isPowerOfTwo( image.height ),\r\n\t\t\t\tglFormat = paramThreeToGL( texture.format ),\r\n\t\t\t\tglType = paramThreeToGL( texture.type );\r\n\r\n\t\t\t\tsetTextureParameters( _gl.TEXTURE_CUBE_MAP, texture, isImagePowerOfTwo );\r\n\r\n\t\t\t\tfor ( var i = 0; i < 6; i ++ ) {\r\n\r\n\t\t\t\t\tif ( ! isCompressed ) {\r\n\r\n\t\t\t\t\t\tif ( isDataTexture ) {\r\n\r\n\t\t\t\t\t\t\t_gl.texImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, glFormat, cubeImage[ i ].width, cubeImage[ i ].height, 0, glFormat, glType, cubeImage[ i ].data );\r\n\r\n\t\t\t\t\t\t} else {\r\n\r\n\t\t\t\t\t\t\t_gl.texImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, glFormat, glFormat, glType, cubeImage[ i ] );\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t} else {\r\n\r\n\t\t\t\t\t\tvar mipmap, mipmaps = cubeImage[ i ].mipmaps;\r\n\r\n\t\t\t\t\t\tfor ( var j = 0, jl = mipmaps.length; j < jl; j ++ ) {\r\n\r\n\t\t\t\t\t\t\tmipmap = mipmaps[ j ];\r\n\r\n\t\t\t\t\t\t\tif ( texture.format !== THREE.RGBAFormat && texture.format !== THREE.RGBFormat ) {\r\n\r\n\t\t\t\t\t\t\t\tif ( getCompressedTextureFormats().indexOf( glFormat ) > -1 ) {\r\n\r\n\t\t\t\t\t\t\t\t\t_gl.compressedTexImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, j, glFormat, mipmap.width, mipmap.height, 0, mipmap.data );\r\n\r\n\t\t\t\t\t\t\t\t} else {\r\n\r\n\t\t\t\t\t\t\t\t\tTHREE.warn( \"THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setCubeTexture()\" );\r\n\r\n\t\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\t} else {\r\n\r\n\t\t\t\t\t\t\t\t_gl.texImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, j, glFormat, mipmap.width, mipmap.height, 0, glFormat, glType, mipmap.data );\r\n\r\n\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif ( texture.generateMipmaps && isImagePowerOfTwo ) {\r\n\r\n\t\t\t\t\t_gl.generateMipmap( _gl.TEXTURE_CUBE_MAP );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\ttexture.needsUpdate = false;\r\n\r\n\t\t\t\tif ( texture.onUpdate ) texture.onUpdate();\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\t_gl.activeTexture( _gl.TEXTURE0 + slot );\r\n\t\t\t\t_gl.bindTexture( _gl.TEXTURE_CUBE_MAP, texture.image.__webglTextureCube );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tfunction setCubeTextureDynamic ( texture, slot ) {\r\n\r\n\t\t_gl.activeTexture( _gl.TEXTURE0 + slot );\r\n\t\t_gl.bindTexture( _gl.TEXTURE_CUBE_MAP, texture.__webglTexture );\r\n\r\n\t}\r\n\r\n\t// Render targets\r\n\r\n\tfunction setupFrameBuffer ( framebuffer, renderTarget, textureTarget ) {\r\n\r\n\t\t_gl.bindFramebuffer( _gl.FRAMEBUFFER, framebuffer );\r\n\t\t_gl.framebufferTexture2D( _gl.FRAMEBUFFER, _gl.COLOR_ATTACHMENT0, textureTarget, renderTarget.__webglTexture, 0 );\r\n\r\n\t}\r\n\r\n\tfunction setupRenderBuffer ( renderbuffer, renderTarget ) {\r\n\r\n\t\t_gl.bindRenderbuffer( _gl.RENDERBUFFER, renderbuffer );\r\n\r\n\t\tif ( renderTarget.depthBuffer && ! renderTarget.stencilBuffer ) {\r\n\r\n\t\t\t_gl.renderbufferStorage( _gl.RENDERBUFFER, _gl.DEPTH_COMPONENT16, renderTarget.width, renderTarget.height );\r\n\t\t\t_gl.framebufferRenderbuffer( _gl.FRAMEBUFFER, _gl.DEPTH_ATTACHMENT, _gl.RENDERBUFFER, renderbuffer );\r\n\r\n\t\t/* For some reason this is not working. Defaulting to RGBA4.\r\n\t\t} else if ( ! renderTarget.depthBuffer && renderTarget.stencilBuffer ) {\r\n\r\n\t\t\t_gl.renderbufferStorage( _gl.RENDERBUFFER, _gl.STENCIL_INDEX8, renderTarget.width, renderTarget.height );\r\n\t\t\t_gl.framebufferRenderbuffer( _gl.FRAMEBUFFER, _gl.STENCIL_ATTACHMENT, _gl.RENDERBUFFER, renderbuffer );\r\n\t\t*/\r\n\t\t} else if ( renderTarget.depthBuffer && renderTarget.stencilBuffer ) {\r\n\r\n\t\t\t_gl.renderbufferStorage( _gl.RENDERBUFFER, _gl.DEPTH_STENCIL, renderTarget.width, renderTarget.height );\r\n\t\t\t_gl.framebufferRenderbuffer( _gl.FRAMEBUFFER, _gl.DEPTH_STENCIL_ATTACHMENT, _gl.RENDERBUFFER, renderbuffer );\r\n\r\n\t\t} else {\r\n\r\n\t\t\t_gl.renderbufferStorage( _gl.RENDERBUFFER, _gl.RGBA4, renderTarget.width, renderTarget.height );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tthis.setRenderTarget = function ( renderTarget ) {\r\n\r\n\t\tvar isCube = ( renderTarget instanceof THREE.WebGLRenderTargetCube );\r\n\r\n\t\tif ( renderTarget && renderTarget.__webglFramebuffer === undefined ) {\r\n\r\n\t\t\tif ( renderTarget.depthBuffer === undefined ) renderTarget.depthBuffer = true;\r\n\t\t\tif ( renderTarget.stencilBuffer === undefined ) renderTarget.stencilBuffer = true;\r\n\r\n\t\t\trenderTarget.addEventListener( 'dispose', onRenderTargetDispose );\r\n\r\n\t\t\trenderTarget.__webglTexture = _gl.createTexture();\r\n\r\n\t\t\t_this.info.memory.textures ++;\r\n\r\n\t\t\t// Setup texture, create render and frame buffers\r\n\r\n\t\t\tvar isTargetPowerOfTwo = THREE.Math.isPowerOfTwo( renderTarget.width ) && THREE.Math.isPowerOfTwo( renderTarget.height ),\r\n\t\t\t\tglFormat = paramThreeToGL( renderTarget.format ),\r\n\t\t\t\tglType = paramThreeToGL( renderTarget.type );\r\n\r\n\t\t\tif ( isCube ) {\r\n\r\n\t\t\t\trenderTarget.__webglFramebuffer = [];\r\n\t\t\t\trenderTarget.__webglRenderbuffer = [];\r\n\r\n\t\t\t\t_gl.bindTexture( _gl.TEXTURE_CUBE_MAP, renderTarget.__webglTexture );\r\n\t\t\t\tsetTextureParameters( _gl.TEXTURE_CUBE_MAP, renderTarget, isTargetPowerOfTwo );\r\n\r\n\t\t\t\tfor ( var i = 0; i < 6; i ++ ) {\r\n\r\n\t\t\t\t\trenderTarget.__webglFramebuffer[ i ] = _gl.createFramebuffer();\r\n\t\t\t\t\trenderTarget.__webglRenderbuffer[ i ] = _gl.createRenderbuffer();\r\n\r\n\t\t\t\t\t_gl.texImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, glFormat, renderTarget.width, renderTarget.height, 0, glFormat, glType, null );\r\n\r\n\t\t\t\t\tsetupFrameBuffer( renderTarget.__webglFramebuffer[ i ], renderTarget, _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i );\r\n\t\t\t\t\tsetupRenderBuffer( renderTarget.__webglRenderbuffer[ i ], renderTarget );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif ( isTargetPowerOfTwo ) _gl.generateMipmap( _gl.TEXTURE_CUBE_MAP );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\trenderTarget.__webglFramebuffer = _gl.createFramebuffer();\r\n\r\n\t\t\t\tif ( renderTarget.shareDepthFrom ) {\r\n\r\n\t\t\t\t\trenderTarget.__webglRenderbuffer = renderTarget.shareDepthFrom.__webglRenderbuffer;\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\trenderTarget.__webglRenderbuffer = _gl.createRenderbuffer();\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\t_gl.bindTexture( _gl.TEXTURE_2D, renderTarget.__webglTexture );\r\n\t\t\t\tsetTextureParameters( _gl.TEXTURE_2D, renderTarget, isTargetPowerOfTwo );\r\n\r\n\t\t\t\t_gl.texImage2D( _gl.TEXTURE_2D, 0, glFormat, renderTarget.width, renderTarget.height, 0, glFormat, glType, null );\r\n\r\n\t\t\t\tsetupFrameBuffer( renderTarget.__webglFramebuffer, renderTarget, _gl.TEXTURE_2D );\r\n\r\n\t\t\t\tif ( renderTarget.shareDepthFrom ) {\r\n\r\n\t\t\t\t\tif ( renderTarget.depthBuffer && ! renderTarget.stencilBuffer ) {\r\n\r\n\t\t\t\t\t\t_gl.framebufferRenderbuffer( _gl.FRAMEBUFFER, _gl.DEPTH_ATTACHMENT, _gl.RENDERBUFFER, renderTarget.__webglRenderbuffer );\r\n\r\n\t\t\t\t\t} else if ( renderTarget.depthBuffer && renderTarget.stencilBuffer ) {\r\n\r\n\t\t\t\t\t\t_gl.framebufferRenderbuffer( _gl.FRAMEBUFFER, _gl.DEPTH_STENCIL_ATTACHMENT, _gl.RENDERBUFFER, renderTarget.__webglRenderbuffer );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\tsetupRenderBuffer( renderTarget.__webglRenderbuffer, renderTarget );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif ( isTargetPowerOfTwo ) _gl.generateMipmap( _gl.TEXTURE_2D );\r\n\r\n\t\t\t}\r\n\r\n\t\t\t// Release everything\r\n\r\n\t\t\tif ( isCube ) {\r\n\r\n\t\t\t\t_gl.bindTexture( _gl.TEXTURE_CUBE_MAP, null );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\t_gl.bindTexture( _gl.TEXTURE_2D, null );\r\n\r\n\t\t\t}\r\n\r\n\t\t\t_gl.bindRenderbuffer( _gl.RENDERBUFFER, null );\r\n\t\t\t_gl.bindFramebuffer( _gl.FRAMEBUFFER, null );\r\n\r\n\t\t}\r\n\r\n\t\tvar framebuffer, width, height, vx, vy;\r\n\r\n\t\tif ( renderTarget ) {\r\n\r\n\t\t\tif ( isCube ) {\r\n\r\n\t\t\t\tframebuffer = renderTarget.__webglFramebuffer[ renderTarget.activeCubeFace ];\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tframebuffer = renderTarget.__webglFramebuffer;\r\n\r\n\t\t\t}\r\n\r\n\t\t\twidth = renderTarget.width;\r\n\t\t\theight = renderTarget.height;\r\n\r\n\t\t\tvx = 0;\r\n\t\t\tvy = 0;\r\n\r\n\t\t} else {\r\n\r\n\t\t\tframebuffer = null;\r\n\r\n\t\t\twidth = _viewportWidth;\r\n\t\t\theight = _viewportHeight;\r\n\r\n\t\t\tvx = _viewportX;\r\n\t\t\tvy = _viewportY;\r\n\r\n\t\t}\r\n\r\n\t\tif ( framebuffer !== _currentFramebuffer ) {\r\n\r\n\t\t\t_gl.bindFramebuffer( _gl.FRAMEBUFFER, framebuffer );\r\n\t\t\t_gl.viewport( vx, vy, width, height );\r\n\r\n\t\t\t_currentFramebuffer = framebuffer;\r\n\r\n\t\t}\r\n\r\n\t\t_currentWidth = width;\r\n\t\t_currentHeight = height;\r\n\r\n\t};\r\n\r\n\tthis.readRenderTargetPixels = function( renderTarget, x, y, width, height, buffer ) {\r\n\r\n\t\tif ( ! ( renderTarget instanceof THREE.WebGLRenderTarget ) ) {\r\n\r\n\t\t\tconsole.error( 'THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.' );\r\n\t\t\treturn;\r\n\r\n\t\t}\r\n\r\n\t\tif ( renderTarget.__webglFramebuffer ) {\r\n\r\n\t\t\tif ( renderTarget.format !== THREE.RGBAFormat ) {\r\n\r\n\t\t\t\tconsole.error( 'THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA format. readPixels can read only RGBA format.' );\r\n\t\t\t\treturn;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tvar restore = false;\r\n\r\n\t\t\tif ( renderTarget.__webglFramebuffer !== _currentFramebuffer ) {\r\n\r\n\t\t\t\t_gl.bindFramebuffer( _gl.FRAMEBUFFER, renderTarget.__webglFramebuffer );\r\n\r\n\t\t\t\trestore = true;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( _gl.checkFramebufferStatus( _gl.FRAMEBUFFER ) === _gl.FRAMEBUFFER_COMPLETE ) {\r\n\r\n\t\t\t\t_gl.readPixels( x, y, width, height, _gl.RGBA, _gl.UNSIGNED_BYTE, buffer );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tconsole.error( 'THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.' );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( restore ) {\r\n\r\n\t\t\t\t_gl.bindFramebuffer( _gl.FRAMEBUFFER, _currentFramebuffer );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t};\r\n\r\n\tfunction updateRenderTargetMipmap ( renderTarget ) {\r\n\r\n\t\tif ( renderTarget instanceof THREE.WebGLRenderTargetCube ) {\r\n\r\n\t\t\t_gl.bindTexture( _gl.TEXTURE_CUBE_MAP, renderTarget.__webglTexture );\r\n\t\t\t_gl.generateMipmap( _gl.TEXTURE_CUBE_MAP );\r\n\t\t\t_gl.bindTexture( _gl.TEXTURE_CUBE_MAP, null );\r\n\r\n\t\t} else {\r\n\r\n\t\t\t_gl.bindTexture( _gl.TEXTURE_2D, renderTarget.__webglTexture );\r\n\t\t\t_gl.generateMipmap( _gl.TEXTURE_2D );\r\n\t\t\t_gl.bindTexture( _gl.TEXTURE_2D, null );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\t// Fallback filters for non-power-of-2 textures\r\n\r\n\tfunction filterFallback ( f ) {\r\n\r\n\t\tif ( f === THREE.NearestFilter || f === THREE.NearestMipMapNearestFilter || f === THREE.NearestMipMapLinearFilter ) {\r\n\r\n\t\t\treturn _gl.NEAREST;\r\n\r\n\t\t}\r\n\r\n\t\treturn _gl.LINEAR;\r\n\r\n\t}\r\n\r\n\t// Map three.js constants to WebGL constants\r\n\r\n\tfunction paramThreeToGL ( p ) {\r\n\r\n\t\tvar extension;\r\n\r\n\t\tif ( p === THREE.RepeatWrapping ) return _gl.REPEAT;\r\n\t\tif ( p === THREE.ClampToEdgeWrapping ) return _gl.CLAMP_TO_EDGE;\r\n\t\tif ( p === THREE.MirroredRepeatWrapping ) return _gl.MIRRORED_REPEAT;\r\n\r\n\t\tif ( p === THREE.NearestFilter ) return _gl.NEAREST;\r\n\t\tif ( p === THREE.NearestMipMapNearestFilter ) return _gl.NEAREST_MIPMAP_NEAREST;\r\n\t\tif ( p === THREE.NearestMipMapLinearFilter ) return _gl.NEAREST_MIPMAP_LINEAR;\r\n\r\n\t\tif ( p === THREE.LinearFilter ) return _gl.LINEAR;\r\n\t\tif ( p === THREE.LinearMipMapNearestFilter ) return _gl.LINEAR_MIPMAP_NEAREST;\r\n\t\tif ( p === THREE.LinearMipMapLinearFilter ) return _gl.LINEAR_MIPMAP_LINEAR;\r\n\r\n\t\tif ( p === THREE.UnsignedByteType ) return _gl.UNSIGNED_BYTE;\r\n\t\tif ( p === THREE.UnsignedShort4444Type ) return _gl.UNSIGNED_SHORT_4_4_4_4;\r\n\t\tif ( p === THREE.UnsignedShort5551Type ) return _gl.UNSIGNED_SHORT_5_5_5_1;\r\n\t\tif ( p === THREE.UnsignedShort565Type ) return _gl.UNSIGNED_SHORT_5_6_5;\r\n\r\n\t\tif ( p === THREE.ByteType ) return _gl.BYTE;\r\n\t\tif ( p === THREE.ShortType ) return _gl.SHORT;\r\n\t\tif ( p === THREE.UnsignedShortType ) return _gl.UNSIGNED_SHORT;\r\n\t\tif ( p === THREE.IntType ) return _gl.INT;\r\n\t\tif ( p === THREE.UnsignedIntType ) return _gl.UNSIGNED_INT;\r\n\t\tif ( p === THREE.FloatType ) return _gl.FLOAT;\r\n\r\n\t\textension = extensions.get( 'OES_texture_half_float' );\r\n\r\n\t\tif ( extension !== null ) {\r\n\r\n\t\t\tif ( p === THREE.HalfFloatType ) return extension.HALF_FLOAT_OES;\r\n\r\n\t\t}\r\n\r\n\t\tif ( p === THREE.AlphaFormat ) return _gl.ALPHA;\r\n\t\tif ( p === THREE.RGBFormat ) return _gl.RGB;\r\n\t\tif ( p === THREE.RGBAFormat ) return _gl.RGBA;\r\n\t\tif ( p === THREE.LuminanceFormat ) return _gl.LUMINANCE;\r\n\t\tif ( p === THREE.LuminanceAlphaFormat ) return _gl.LUMINANCE_ALPHA;\r\n\r\n\t\tif ( p === THREE.AddEquation ) return _gl.FUNC_ADD;\r\n\t\tif ( p === THREE.SubtractEquation ) return _gl.FUNC_SUBTRACT;\r\n\t\tif ( p === THREE.ReverseSubtractEquation ) return _gl.FUNC_REVERSE_SUBTRACT;\r\n\r\n\t\tif ( p === THREE.ZeroFactor ) return _gl.ZERO;\r\n\t\tif ( p === THREE.OneFactor ) return _gl.ONE;\r\n\t\tif ( p === THREE.SrcColorFactor ) return _gl.SRC_COLOR;\r\n\t\tif ( p === THREE.OneMinusSrcColorFactor ) return _gl.ONE_MINUS_SRC_COLOR;\r\n\t\tif ( p === THREE.SrcAlphaFactor ) return _gl.SRC_ALPHA;\r\n\t\tif ( p === THREE.OneMinusSrcAlphaFactor ) return _gl.ONE_MINUS_SRC_ALPHA;\r\n\t\tif ( p === THREE.DstAlphaFactor ) return _gl.DST_ALPHA;\r\n\t\tif ( p === THREE.OneMinusDstAlphaFactor ) return _gl.ONE_MINUS_DST_ALPHA;\r\n\r\n\t\tif ( p === THREE.DstColorFactor ) return _gl.DST_COLOR;\r\n\t\tif ( p === THREE.OneMinusDstColorFactor ) return _gl.ONE_MINUS_DST_COLOR;\r\n\t\tif ( p === THREE.SrcAlphaSaturateFactor ) return _gl.SRC_ALPHA_SATURATE;\r\n\r\n\t\textension = extensions.get( 'WEBGL_compressed_texture_s3tc' );\r\n\r\n\t\tif ( extension !== null ) {\r\n\r\n\t\t\tif ( p === THREE.RGB_S3TC_DXT1_Format ) return extension.COMPRESSED_RGB_S3TC_DXT1_EXT;\r\n\t\t\tif ( p === THREE.RGBA_S3TC_DXT1_Format ) return extension.COMPRESSED_RGBA_S3TC_DXT1_EXT;\r\n\t\t\tif ( p === THREE.RGBA_S3TC_DXT3_Format ) return extension.COMPRESSED_RGBA_S3TC_DXT3_EXT;\r\n\t\t\tif ( p === THREE.RGBA_S3TC_DXT5_Format ) return extension.COMPRESSED_RGBA_S3TC_DXT5_EXT;\r\n\r\n\t\t}\r\n\r\n\t\textension = extensions.get( 'WEBGL_compressed_texture_pvrtc' );\r\n\r\n\t\tif ( extension !== null ) {\r\n\r\n\t\t\tif ( p === THREE.RGB_PVRTC_4BPPV1_Format ) return extension.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;\r\n\t\t\tif ( p === THREE.RGB_PVRTC_2BPPV1_Format ) return extension.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;\r\n\t\t\tif ( p === THREE.RGBA_PVRTC_4BPPV1_Format ) return extension.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;\r\n\t\t\tif ( p === THREE.RGBA_PVRTC_2BPPV1_Format ) return extension.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG;\r\n\r\n\t\t}\r\n\r\n\t\textension = extensions.get( 'EXT_blend_minmax' );\r\n\r\n\t\tif ( extension !== null ) {\r\n\r\n\t\t\tif ( p === THREE.MinEquation ) return extension.MIN_EXT;\r\n\t\t\tif ( p === THREE.MaxEquation ) return extension.MAX_EXT;\r\n\r\n\t\t}\r\n\r\n\t\treturn 0;\r\n\r\n\t}\r\n\r\n\t// Allocations\r\n\r\n\tfunction allocateBones ( object ) {\r\n\r\n\t\tif ( _supportsBoneTextures && object && object.skeleton && object.skeleton.useVertexTexture ) {\r\n\r\n\t\t\treturn 1024;\r\n\r\n\t\t} else {\r\n\r\n\t\t\t// default for when object is not specified\r\n\t\t\t// ( for example when prebuilding shader\r\n\t\t\t// to be used with multiple objects )\r\n\t\t\t//\r\n\t\t\t// - leave some extra space for other uniforms\r\n\t\t\t// - limit here is ANGLE's 254 max uniform vectors\r\n\t\t\t// (up to 54 should be safe)\r\n\r\n\t\t\tvar nVertexUniforms = _gl.getParameter( _gl.MAX_VERTEX_UNIFORM_VECTORS );\r\n\t\t\tvar nVertexMatrices = Math.floor( ( nVertexUniforms - 20 ) / 4 );\r\n\r\n\t\t\tvar maxBones = nVertexMatrices;\r\n\r\n\t\t\tif ( object !== undefined && object instanceof THREE.SkinnedMesh ) {\r\n\r\n\t\t\t\tmaxBones = Math.min( object.skeleton.bones.length, maxBones );\r\n\r\n\t\t\t\tif ( maxBones < object.skeleton.bones.length ) {\r\n\r\n\t\t\t\t\tTHREE.warn( 'WebGLRenderer: too many bones - ' + object.skeleton.bones.length + ', this GPU supports just ' + maxBones + ' (try OpenGL instead of ANGLE)' );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\treturn maxBones;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tfunction allocateLights( lights ) {\r\n\r\n\t\tvar dirLights = 0;\r\n\t\tvar pointLights = 0;\r\n\t\tvar spotLights = 0;\r\n\t\tvar hemiLights = 0;\r\n\r\n\t\tfor ( var l = 0, ll = lights.length; l < ll; l ++ ) {\r\n\r\n\t\t\tvar light = lights[ l ];\r\n\r\n\t\t\tif ( light.onlyShadow || light.visible === false ) continue;\r\n\r\n\t\t\tif ( light instanceof THREE.DirectionalLight ) dirLights ++;\r\n\t\t\tif ( light instanceof THREE.PointLight ) pointLights ++;\r\n\t\t\tif ( light instanceof THREE.SpotLight ) spotLights ++;\r\n\t\t\tif ( light instanceof THREE.HemisphereLight ) hemiLights ++;\r\n\r\n\t\t}\r\n\r\n\t\treturn { 'directional': dirLights, 'point': pointLights, 'spot': spotLights, 'hemi': hemiLights };\r\n\r\n\t}\r\n\r\n\tfunction allocateShadows( lights ) {\r\n\r\n\t\tvar maxShadows = 0;\r\n\r\n\t\tfor ( var l = 0, ll = lights.length; l < ll; l ++ ) {\r\n\r\n\t\t\tvar light = lights[ l ];\r\n\r\n\t\t\tif ( ! light.castShadow ) continue;\r\n\r\n\t\t\tif ( light instanceof THREE.SpotLight ) maxShadows ++;\r\n\t\t\tif ( light instanceof THREE.DirectionalLight && ! light.shadowCascade ) maxShadows ++;\r\n\r\n\t\t}\r\n\r\n\t\treturn maxShadows;\r\n\r\n\t}\r\n\r\n\t// DEPRECATED\r\n\r\n\tthis.initMaterial = function () {\r\n\r\n\t\tTHREE.warn( 'THREE.WebGLRenderer: .initMaterial() has been removed.' );\r\n\r\n\t};\r\n\r\n\tthis.addPrePlugin = function () {\r\n\r\n\t\tTHREE.warn( 'THREE.WebGLRenderer: .addPrePlugin() has been removed.' );\r\n\r\n\t};\r\n\r\n\tthis.addPostPlugin = function () {\r\n\r\n\t\tTHREE.warn( 'THREE.WebGLRenderer: .addPostPlugin() has been removed.' );\r\n\r\n\t};\r\n\r\n\tthis.updateShadowMap = function () {\r\n\r\n\t\tTHREE.warn( 'THREE.WebGLRenderer: .updateShadowMap() has been removed.' );\r\n\r\n\t};\r\n\r\n};\r\n\r\n// File:src/renderers/WebGLRenderTarget.js\r\n\r\n/**\r\n * @author szimek / https://github.com/szimek/\r\n * @author alteredq / http://alteredqualia.com/\r\n */\r\n\r\nTHREE.WebGLRenderTarget = function ( width, height, options ) {\r\n\r\n\tthis.width = width;\r\n\tthis.height = height;\r\n\r\n\toptions = options || {};\r\n\r\n\tthis.wrapS = options.wrapS !== undefined ? options.wrapS : THREE.ClampToEdgeWrapping;\r\n\tthis.wrapT = options.wrapT !== undefined ? options.wrapT : THREE.ClampToEdgeWrapping;\r\n\r\n\tthis.magFilter = options.magFilter !== undefined ? options.magFilter : THREE.LinearFilter;\r\n\tthis.minFilter = options.minFilter !== undefined ? options.minFilter : THREE.LinearMipMapLinearFilter;\r\n\r\n\tthis.anisotropy = options.anisotropy !== undefined ? options.anisotropy : 1;\r\n\r\n\tthis.offset = new THREE.Vector2( 0, 0 );\r\n\tthis.repeat = new THREE.Vector2( 1, 1 );\r\n\r\n\tthis.format = options.format !== undefined ? options.format : THREE.RGBAFormat;\r\n\tthis.type = options.type !== undefined ? options.type : THREE.UnsignedByteType;\r\n\r\n\tthis.depthBuffer = options.depthBuffer !== undefined ? options.depthBuffer : true;\r\n\tthis.stencilBuffer = options.stencilBuffer !== undefined ? options.stencilBuffer : true;\r\n\r\n\tthis.generateMipmaps = true;\r\n\r\n\tthis.shareDepthFrom = options.shareDepthFrom !== undefined ? options.shareDepthFrom : null;\r\n\r\n};\r\n\r\nTHREE.WebGLRenderTarget.prototype = {\r\n\r\n\tconstructor: THREE.WebGLRenderTarget,\r\n\r\n\tsetSize: function ( width, height ) {\r\n\r\n\t\tthis.width = width;\r\n\t\tthis.height = height;\r\n\r\n\t},\r\n\r\n\tclone: function () {\r\n\r\n\t\tvar tmp = new THREE.WebGLRenderTarget( this.width, this.height );\r\n\r\n\t\ttmp.wrapS = this.wrapS;\r\n\t\ttmp.wrapT = this.wrapT;\r\n\r\n\t\ttmp.magFilter = this.magFilter;\r\n\t\ttmp.minFilter = this.minFilter;\r\n\r\n\t\ttmp.anisotropy = this.anisotropy;\r\n\r\n\t\ttmp.offset.copy( this.offset );\r\n\t\ttmp.repeat.copy( this.repeat );\r\n\r\n\t\ttmp.format = this.format;\r\n\t\ttmp.type = this.type;\r\n\r\n\t\ttmp.depthBuffer = this.depthBuffer;\r\n\t\ttmp.stencilBuffer = this.stencilBuffer;\r\n\r\n\t\ttmp.generateMipmaps = this.generateMipmaps;\r\n\r\n\t\ttmp.shareDepthFrom = this.shareDepthFrom;\r\n\r\n\t\treturn tmp;\r\n\r\n\t},\r\n\r\n\tdispose: function () {\r\n\r\n\t\tthis.dispatchEvent( { type: 'dispose' } );\r\n\r\n\t}\r\n\r\n};\r\n\r\nTHREE.EventDispatcher.prototype.apply( THREE.WebGLRenderTarget.prototype );\r\n\r\n// File:src/renderers/WebGLRenderTargetCube.js\r\n\r\n/**\r\n * @author alteredq / http://alteredqualia.com\r\n */\r\n\r\nTHREE.WebGLRenderTargetCube = function ( width, height, options ) {\r\n\r\n\tTHREE.WebGLRenderTarget.call( this, width, height, options );\r\n\r\n\tthis.activeCubeFace = 0; // PX 0, NX 1, PY 2, NY 3, PZ 4, NZ 5\r\n\r\n};\r\n\r\nTHREE.WebGLRenderTargetCube.prototype = Object.create( THREE.WebGLRenderTarget.prototype );\r\nTHREE.WebGLRenderTargetCube.prototype.constructor = THREE.WebGLRenderTargetCube;\r\n\r\n// File:src/renderers/webgl/WebGLExtensions.js\r\n\r\n/**\r\n* @author mrdoob / http://mrdoob.com/\r\n*/\r\n\r\nTHREE.WebGLExtensions = function ( gl ) {\r\n\r\n\tvar extensions = {};\r\n\r\n\tthis.get = function ( name ) {\r\n\r\n\t\tif ( extensions[ name ] !== undefined ) {\r\n\r\n\t\t\treturn extensions[ name ];\r\n\r\n\t\t}\r\n\r\n\t\tvar extension;\r\n\r\n\t\tswitch ( name ) {\r\n\r\n\t\t\tcase 'EXT_texture_filter_anisotropic':\r\n\t\t\t\textension = gl.getExtension( 'EXT_texture_filter_anisotropic' ) || gl.getExtension( 'MOZ_EXT_texture_filter_anisotropic' ) || gl.getExtension( 'WEBKIT_EXT_texture_filter_anisotropic' );\r\n\t\t\t\tbreak;\r\n\r\n\t\t\tcase 'WEBGL_compressed_texture_s3tc':\r\n\t\t\t\textension = gl.getExtension( 'WEBGL_compressed_texture_s3tc' ) || gl.getExtension( 'MOZ_WEBGL_compressed_texture_s3tc' ) || gl.getExtension( 'WEBKIT_WEBGL_compressed_texture_s3tc' );\r\n\t\t\t\tbreak;\r\n\r\n\t\t\tcase 'WEBGL_compressed_texture_pvrtc':\r\n\t\t\t\textension = gl.getExtension( 'WEBGL_compressed_texture_pvrtc' ) || gl.getExtension( 'WEBKIT_WEBGL_compressed_texture_pvrtc' );\r\n\t\t\t\tbreak;\r\n\r\n\t\t\tdefault:\r\n\t\t\t\textension = gl.getExtension( name );\r\n\r\n\t\t}\r\n\r\n\t\tif ( extension === null ) {\r\n\r\n\t\t\tTHREE.warn( 'THREE.WebGLRenderer: ' + name + ' extension not supported.' );\r\n\r\n\t\t}\r\n\r\n\t\textensions[ name ] = extension;\r\n\r\n\t\treturn extension;\r\n\r\n\t};\r\n\r\n};\r\n\r\n// File:src/renderers/webgl/WebGLProgram.js\r\n\r\nTHREE.WebGLProgram = ( function () {\r\n\r\n\tvar programIdCount = 0;\r\n\r\n\tvar generateDefines = function ( defines ) {\r\n\r\n\t\tvar value, chunk, chunks = [];\r\n\r\n\t\tfor ( var d in defines ) {\r\n\r\n\t\t\tvalue = defines[ d ];\r\n\t\t\tif ( value === false ) continue;\r\n\r\n\t\t\tchunk = '#define ' + d + ' ' + value;\r\n\t\t\tchunks.push( chunk );\r\n\r\n\t\t}\r\n\r\n\t\treturn chunks.join( '\\n' );\r\n\r\n\t};\r\n\r\n\tvar cacheUniformLocations = function ( gl, program, identifiers ) {\r\n\r\n\t\tvar uniforms = {};\r\n\r\n\t\tfor ( var i = 0, l = identifiers.length; i < l; i ++ ) {\r\n\r\n\t\t\tvar id = identifiers[ i ];\r\n\t\t\tuniforms[ id ] = gl.getUniformLocation( program, id );\r\n\r\n\t\t}\r\n\r\n\t\treturn uniforms;\r\n\r\n\t};\r\n\r\n\tvar cacheAttributeLocations = function ( gl, program, identifiers ) {\r\n\r\n\t\tvar attributes = {};\r\n\r\n\t\tfor ( var i = 0, l = identifiers.length; i < l; i ++ ) {\r\n\r\n\t\t\tvar id = identifiers[ i ];\r\n\t\t\tattributes[ id ] = gl.getAttribLocation( program, id );\r\n\r\n\t\t}\r\n\r\n\t\treturn attributes;\r\n\r\n\t};\r\n\r\n\treturn function ( renderer, code, material, parameters ) {\r\n\r\n\t\tvar _this = renderer;\r\n\t\tvar _gl = _this.context;\r\n\r\n\t\tvar defines = material.defines;\r\n\t\tvar uniforms = material.__webglShader.uniforms;\r\n\t\tvar attributes = material.attributes;\r\n\r\n\t\tvar vertexShader = material.__webglShader.vertexShader;\r\n\t\tvar fragmentShader = material.__webglShader.fragmentShader;\r\n\r\n\t\tvar index0AttributeName = material.index0AttributeName;\r\n\r\n\t\tif ( index0AttributeName === undefined && parameters.morphTargets === true ) {\r\n\r\n\t\t\t// programs with morphTargets displace position out of attribute 0\r\n\r\n\t\t\tindex0AttributeName = 'position';\r\n\r\n\t\t}\r\n\r\n\t\tvar shadowMapTypeDefine = 'SHADOWMAP_TYPE_BASIC';\r\n\r\n\t\tif ( parameters.shadowMapType === THREE.PCFShadowMap ) {\r\n\r\n\t\t\tshadowMapTypeDefine = 'SHADOWMAP_TYPE_PCF';\r\n\r\n\t\t} else if ( parameters.shadowMapType === THREE.PCFSoftShadowMap ) {\r\n\r\n\t\t\tshadowMapTypeDefine = 'SHADOWMAP_TYPE_PCF_SOFT';\r\n\r\n\t\t}\r\n\r\n\t\tvar envMapTypeDefine = 'ENVMAP_TYPE_CUBE';\r\n\t\tvar envMapModeDefine = 'ENVMAP_MODE_REFLECTION';\r\n\t\tvar envMapBlendingDefine = 'ENVMAP_BLENDING_MULTIPLY';\r\n\r\n\t\tif ( parameters.envMap ) {\r\n\r\n\t\t\tswitch ( material.envMap.mapping ) {\r\n\r\n\t\t\t\tcase THREE.CubeReflectionMapping:\r\n\t\t\t\tcase THREE.CubeRefractionMapping:\r\n\t\t\t\t\tenvMapTypeDefine = 'ENVMAP_TYPE_CUBE';\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase THREE.EquirectangularReflectionMapping:\r\n\t\t\t\tcase THREE.EquirectangularRefractionMapping:\r\n\t\t\t\t\tenvMapTypeDefine = 'ENVMAP_TYPE_EQUIREC';\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase THREE.SphericalReflectionMapping:\r\n\t\t\t\t\tenvMapTypeDefine = 'ENVMAP_TYPE_SPHERE';\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tswitch ( material.envMap.mapping ) {\r\n\r\n\t\t\t\tcase THREE.CubeRefractionMapping:\r\n\t\t\t\tcase THREE.EquirectangularRefractionMapping:\r\n\t\t\t\t\tenvMapModeDefine = 'ENVMAP_MODE_REFRACTION';\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tswitch ( material.combine ) {\r\n\r\n\t\t\t\tcase THREE.MultiplyOperation:\r\n\t\t\t\t\tenvMapBlendingDefine = 'ENVMAP_BLENDING_MULTIPLY';\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase THREE.MixOperation:\r\n\t\t\t\t\tenvMapBlendingDefine = 'ENVMAP_BLENDING_MIX';\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase THREE.AddOperation:\r\n\t\t\t\t\tenvMapBlendingDefine = 'ENVMAP_BLENDING_ADD';\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tvar gammaFactorDefine = ( renderer.gammaFactor > 0 ) ? renderer.gammaFactor : 1.0;\r\n\r\n\t\t// console.log( 'building new program ' );\r\n\r\n\t\t//\r\n\r\n\t\tvar customDefines = generateDefines( defines );\r\n\r\n\t\t//\r\n\r\n\t\tvar program = _gl.createProgram();\r\n\r\n\t\tvar prefix_vertex, prefix_fragment;\r\n\r\n\t\tif ( material instanceof THREE.RawShaderMaterial ) {\r\n\r\n\t\t\tprefix_vertex = '';\r\n\t\t\tprefix_fragment = '';\r\n\r\n\t\t} else {\r\n\r\n\t\t\tprefix_vertex = [\r\n\r\n\t\t\t\t'precision ' + parameters.precision + ' float;',\r\n\t\t\t\t'precision ' + parameters.precision + ' int;',\r\n\r\n\t\t\t\tcustomDefines,\r\n\r\n\t\t\t\tparameters.supportsVertexTextures ? '#define VERTEX_TEXTURES' : '',\r\n\r\n\t\t\t\t_this.gammaInput ? '#define GAMMA_INPUT' : '',\r\n\t\t\t\t_this.gammaOutput ? '#define GAMMA_OUTPUT' : '',\r\n\t\t\t\t'#define GAMMA_FACTOR ' + gammaFactorDefine,\r\n\r\n\t\t\t\t'#define MAX_DIR_LIGHTS ' + parameters.maxDirLights,\r\n\t\t\t\t'#define MAX_POINT_LIGHTS ' + parameters.maxPointLights,\r\n\t\t\t\t'#define MAX_SPOT_LIGHTS ' + parameters.maxSpotLights,\r\n\t\t\t\t'#define MAX_HEMI_LIGHTS ' + parameters.maxHemiLights,\r\n\r\n\t\t\t\t'#define MAX_SHADOWS ' + parameters.maxShadows,\r\n\r\n\t\t\t\t'#define MAX_BONES ' + parameters.maxBones,\r\n\r\n\t\t\t\tparameters.map ? '#define USE_MAP' : '',\r\n\t\t\t\tparameters.envMap ? '#define USE_ENVMAP' : '',\r\n\t\t\t\tparameters.envMap ? '#define ' + envMapModeDefine : '',\r\n\t\t\t\tparameters.lightMap ? '#define USE_LIGHTMAP' : '',\r\n\t\t\t\tparameters.bumpMap ? '#define USE_BUMPMAP' : '',\r\n\t\t\t\tparameters.normalMap ? '#define USE_NORMALMAP' : '',\r\n\t\t\t\tparameters.specularMap ? '#define USE_SPECULARMAP' : '',\r\n\t\t\t\tparameters.alphaMap ? '#define USE_ALPHAMAP' : '',\r\n\t\t\t\tparameters.vertexColors ? '#define USE_COLOR' : '',\r\n\r\n\t\t\t\tparameters.flatShading ? '#define FLAT_SHADED': '',\r\n\r\n\t\t\t\tparameters.skinning ? '#define USE_SKINNING' : '',\r\n\t\t\t\tparameters.useVertexTexture ? '#define BONE_TEXTURE' : '',\r\n\r\n\t\t\t\tparameters.morphTargets ? '#define USE_MORPHTARGETS' : '',\r\n\t\t\t\tparameters.morphNormals ? '#define USE_MORPHNORMALS' : '',\r\n\t\t\t\tparameters.wrapAround ? '#define WRAP_AROUND' : '',\r\n\t\t\t\tparameters.doubleSided ? '#define DOUBLE_SIDED' : '',\r\n\t\t\t\tparameters.flipSided ? '#define FLIP_SIDED' : '',\r\n\r\n\t\t\t\tparameters.shadowMapEnabled ? '#define USE_SHADOWMAP' : '',\r\n\t\t\t\tparameters.shadowMapEnabled ? '#define ' + shadowMapTypeDefine : '',\r\n\t\t\t\tparameters.shadowMapDebug ? '#define SHADOWMAP_DEBUG' : '',\r\n\t\t\t\tparameters.shadowMapCascade ? '#define SHADOWMAP_CASCADE' : '',\r\n\r\n\t\t\t\tparameters.sizeAttenuation ? '#define USE_SIZEATTENUATION' : '',\r\n\r\n\t\t\t\tparameters.logarithmicDepthBuffer ? '#define USE_LOGDEPTHBUF' : '',\r\n\t\t\t\t//_this._glExtensionFragDepth ? '#define USE_LOGDEPTHBUF_EXT' : '',\r\n\r\n\r\n\t\t\t\t'uniform mat4 modelMatrix;',\r\n\t\t\t\t'uniform mat4 modelViewMatrix;',\r\n\t\t\t\t'uniform mat4 projectionMatrix;',\r\n\t\t\t\t'uniform mat4 viewMatrix;',\r\n\t\t\t\t'uniform mat3 normalMatrix;',\r\n\t\t\t\t'uniform vec3 cameraPosition;',\r\n\r\n\t\t\t\t'attribute vec3 position;',\r\n\t\t\t\t'attribute vec3 normal;',\r\n\t\t\t\t'attribute vec2 uv;',\r\n\t\t\t\t'attribute vec2 uv2;',\r\n\r\n\t\t\t\t'#ifdef USE_COLOR',\r\n\r\n\t\t\t\t'\tattribute vec3 color;',\r\n\r\n\t\t\t\t'#endif',\r\n\r\n\t\t\t\t'#ifdef USE_MORPHTARGETS',\r\n\r\n\t\t\t\t'\tattribute vec3 morphTarget0;',\r\n\t\t\t\t'\tattribute vec3 morphTarget1;',\r\n\t\t\t\t'\tattribute vec3 morphTarget2;',\r\n\t\t\t\t'\tattribute vec3 morphTarget3;',\r\n\r\n\t\t\t\t'\t#ifdef USE_MORPHNORMALS',\r\n\r\n\t\t\t\t'\t\tattribute vec3 morphNormal0;',\r\n\t\t\t\t'\t\tattribute vec3 morphNormal1;',\r\n\t\t\t\t'\t\tattribute vec3 morphNormal2;',\r\n\t\t\t\t'\t\tattribute vec3 morphNormal3;',\r\n\r\n\t\t\t\t'\t#else',\r\n\r\n\t\t\t\t'\t\tattribute vec3 morphTarget4;',\r\n\t\t\t\t'\t\tattribute vec3 morphTarget5;',\r\n\t\t\t\t'\t\tattribute vec3 morphTarget6;',\r\n\t\t\t\t'\t\tattribute vec3 morphTarget7;',\r\n\r\n\t\t\t\t'\t#endif',\r\n\r\n\t\t\t\t'#endif',\r\n\r\n\t\t\t\t'#ifdef USE_SKINNING',\r\n\r\n\t\t\t\t'\tattribute vec4 skinIndex;',\r\n\t\t\t\t'\tattribute vec4 skinWeight;',\r\n\r\n\t\t\t\t'#endif',\r\n\r\n\t\t\t\t''\r\n\r\n\t\t\t].join( '\\n' );\r\n\r\n\t\t\tprefix_fragment = [\r\n\r\n\t\t\t\t'precision ' + parameters.precision + ' float;',\r\n\t\t\t\t'precision ' + parameters.precision + ' int;',\r\n\r\n\t\t\t\t( parameters.bumpMap || parameters.normalMap || parameters.flatShading ) ? '#extension GL_OES_standard_derivatives : enable' : '',\r\n\r\n\t\t\t\tcustomDefines,\r\n\r\n\t\t\t\t'#define MAX_DIR_LIGHTS ' + parameters.maxDirLights,\r\n\t\t\t\t'#define MAX_POINT_LIGHTS ' + parameters.maxPointLights,\r\n\t\t\t\t'#define MAX_SPOT_LIGHTS ' + parameters.maxSpotLights,\r\n\t\t\t\t'#define MAX_HEMI_LIGHTS ' + parameters.maxHemiLights,\r\n\r\n\t\t\t\t'#define MAX_SHADOWS ' + parameters.maxShadows,\r\n\r\n\t\t\t\tparameters.alphaTest ? '#define ALPHATEST ' + parameters.alphaTest : '',\r\n\r\n\t\t\t\t_this.gammaInput ? '#define GAMMA_INPUT' : '',\r\n\t\t\t\t_this.gammaOutput ? '#define GAMMA_OUTPUT' : '',\r\n\t\t\t\t'#define GAMMA_FACTOR ' + gammaFactorDefine,\r\n\r\n\t\t\t\t( parameters.useFog && parameters.fog ) ? '#define USE_FOG' : '',\r\n\t\t\t\t( parameters.useFog && parameters.fogExp ) ? '#define FOG_EXP2' : '',\r\n\r\n\t\t\t\tparameters.map ? '#define USE_MAP' : '',\r\n\t\t\t\tparameters.envMap ? '#define USE_ENVMAP' : '',\r\n\t\t\t\tparameters.envMap ? '#define ' + envMapTypeDefine : '',\r\n\t\t\t\tparameters.envMap ? '#define ' + envMapModeDefine : '',\r\n\t\t\t\tparameters.envMap ? '#define ' + envMapBlendingDefine : '',\r\n\t\t\t\tparameters.lightMap ? '#define USE_LIGHTMAP' : '',\r\n\t\t\t\tparameters.bumpMap ? '#define USE_BUMPMAP' : '',\r\n\t\t\t\tparameters.normalMap ? '#define USE_NORMALMAP' : '',\r\n\t\t\t\tparameters.specularMap ? '#define USE_SPECULARMAP' : '',\r\n\t\t\t\tparameters.alphaMap ? '#define USE_ALPHAMAP' : '',\r\n\t\t\t\tparameters.vertexColors ? '#define USE_COLOR' : '',\r\n\r\n\t\t\t\tparameters.flatShading ? '#define FLAT_SHADED': '',\r\n\r\n\t\t\t\tparameters.metal ? '#define METAL' : '',\r\n\t\t\t\tparameters.wrapAround ? '#define WRAP_AROUND' : '',\r\n\t\t\t\tparameters.doubleSided ? '#define DOUBLE_SIDED' : '',\r\n\t\t\t\tparameters.flipSided ? '#define FLIP_SIDED' : '',\r\n\r\n\t\t\t\tparameters.shadowMapEnabled ? '#define USE_SHADOWMAP' : '',\r\n\t\t\t\tparameters.shadowMapEnabled ? '#define ' + shadowMapTypeDefine : '',\r\n\t\t\t\tparameters.shadowMapDebug ? '#define SHADOWMAP_DEBUG' : '',\r\n\t\t\t\tparameters.shadowMapCascade ? '#define SHADOWMAP_CASCADE' : '',\r\n\r\n\t\t\t\tparameters.logarithmicDepthBuffer ? '#define USE_LOGDEPTHBUF' : '',\r\n\t\t\t\t//_this._glExtensionFragDepth ? '#define USE_LOGDEPTHBUF_EXT' : '',\r\n\r\n\t\t\t\t'uniform mat4 viewMatrix;',\r\n\t\t\t\t'uniform vec3 cameraPosition;',\r\n\t\t\t\t''\r\n\r\n\t\t\t].join( '\\n' );\r\n\r\n\t\t}\r\n\r\n\t\tvar glVertexShader = new THREE.WebGLShader( _gl, _gl.VERTEX_SHADER, prefix_vertex + vertexShader );\r\n\t\tvar glFragmentShader = new THREE.WebGLShader( _gl, _gl.FRAGMENT_SHADER, prefix_fragment + fragmentShader );\r\n\r\n\t\t_gl.attachShader( program, glVertexShader );\r\n\t\t_gl.attachShader( program, glFragmentShader );\r\n\r\n\t\tif ( index0AttributeName !== undefined ) {\r\n\r\n\t\t\t// Force a particular attribute to index 0.\r\n\t\t\t// because potentially expensive emulation is done by browser if attribute 0 is disabled.\r\n\t\t\t// And, color, for example is often automatically bound to index 0 so disabling it\r\n\r\n\t\t\t_gl.bindAttribLocation( program, 0, index0AttributeName );\r\n\r\n\t\t}\r\n\r\n\t\t_gl.linkProgram( program );\r\n\r\n\t\tvar programLogInfo = _gl.getProgramInfoLog( program );\r\n\r\n\t\tif ( _gl.getProgramParameter( program, _gl.LINK_STATUS ) === false ) {\r\n\r\n\t\t\tTHREE.error( 'THREE.WebGLProgram: shader error: ' + _gl.getError(), 'gl.VALIDATE_STATUS', _gl.getProgramParameter( program, _gl.VALIDATE_STATUS ), 'gl.getPRogramInfoLog', programLogInfo );\r\n\r\n\t\t}\r\n\r\n\t\tif ( programLogInfo !== '' ) {\r\n\r\n\t\t\tTHREE.warn( 'THREE.WebGLProgram: gl.getProgramInfoLog()' + programLogInfo );\r\n\t\t\t// THREE.warn( _gl.getExtension( 'WEBGL_debug_shaders' ).getTranslatedShaderSource( glVertexShader ) );\r\n\t\t\t// THREE.warn( _gl.getExtension( 'WEBGL_debug_shaders' ).getTranslatedShaderSource( glFragmentShader ) );\r\n\r\n\t\t}\r\n\r\n\t\t// clean up\r\n\r\n\t\t_gl.deleteShader( glVertexShader );\r\n\t\t_gl.deleteShader( glFragmentShader );\r\n\r\n\t\t// cache uniform locations\r\n\r\n\t\tvar identifiers = [\r\n\r\n\t\t\t'viewMatrix',\r\n\t\t\t'modelViewMatrix',\r\n\t\t\t'projectionMatrix',\r\n\t\t\t'normalMatrix',\r\n\t\t\t'modelMatrix',\r\n\t\t\t'cameraPosition',\r\n\t\t\t'morphTargetInfluences',\r\n\t\t\t'bindMatrix',\r\n\t\t\t'bindMatrixInverse'\r\n\r\n\t\t];\r\n\r\n\t\tif ( parameters.useVertexTexture ) {\r\n\r\n\t\t\tidentifiers.push( 'boneTexture' );\r\n\t\t\tidentifiers.push( 'boneTextureWidth' );\r\n\t\t\tidentifiers.push( 'boneTextureHeight' );\r\n\r\n\t\t} else {\r\n\r\n\t\t\tidentifiers.push( 'boneGlobalMatrices' );\r\n\r\n\t\t}\r\n\r\n\t\tif ( parameters.logarithmicDepthBuffer ) {\r\n\r\n\t\t\tidentifiers.push('logDepthBufFC');\r\n\r\n\t\t}\r\n\r\n\r\n\t\tfor ( var u in uniforms ) {\r\n\r\n\t\t\tidentifiers.push( u );\r\n\r\n\t\t}\r\n\r\n\t\tthis.uniforms = cacheUniformLocations( _gl, program, identifiers );\r\n\r\n\t\t// cache attributes locations\r\n\r\n\t\tidentifiers = [\r\n\r\n\t\t\t'position',\r\n\t\t\t'normal',\r\n\t\t\t'uv',\r\n\t\t\t'uv2',\r\n\t\t\t'tangent',\r\n\t\t\t'color',\r\n\t\t\t'skinIndex',\r\n\t\t\t'skinWeight',\r\n\t\t\t'lineDistance'\r\n\r\n\t\t];\r\n\r\n\t\tfor ( var i = 0; i < parameters.maxMorphTargets; i ++ ) {\r\n\r\n\t\t\tidentifiers.push( 'morphTarget' + i );\r\n\r\n\t\t}\r\n\r\n\t\tfor ( var i = 0; i < parameters.maxMorphNormals; i ++ ) {\r\n\r\n\t\t\tidentifiers.push( 'morphNormal' + i );\r\n\r\n\t\t}\r\n\r\n\t\tfor ( var a in attributes ) {\r\n\r\n\t\t\tidentifiers.push( a );\r\n\r\n\t\t}\r\n\r\n\t\tthis.attributes = cacheAttributeLocations( _gl, program, identifiers );\r\n\t\tthis.attributesKeys = Object.keys( this.attributes );\r\n\r\n\t\t//\r\n\r\n\t\tthis.id = programIdCount ++;\r\n\t\tthis.code = code;\r\n\t\tthis.usedTimes = 1;\r\n\t\tthis.program = program;\r\n\t\tthis.vertexShader = glVertexShader;\r\n\t\tthis.fragmentShader = glFragmentShader;\r\n\r\n\t\treturn this;\r\n\r\n\t};\r\n\r\n} )();\r\n\r\n// File:src/renderers/webgl/WebGLShader.js\r\n\r\nTHREE.WebGLShader = ( function () {\r\n\r\n\tvar addLineNumbers = function ( string ) {\r\n\r\n\t\tvar lines = string.split( '\\n' );\r\n\r\n\t\tfor ( var i = 0; i < lines.length; i ++ ) {\r\n\r\n\t\t\tlines[ i ] = ( i + 1 ) + ': ' + lines[ i ];\r\n\r\n\t\t}\r\n\r\n\t\treturn lines.join( '\\n' );\r\n\r\n\t};\r\n\r\n\treturn function ( gl, type, string ) {\r\n\r\n\t\tvar shader = gl.createShader( type ); \r\n\r\n\t\tgl.shaderSource( shader, string );\r\n\t\tgl.compileShader( shader );\r\n\r\n\t\tif ( gl.getShaderParameter( shader, gl.COMPILE_STATUS ) === false ) {\r\n\r\n\t\t\tTHREE.error( 'THREE.WebGLShader: Shader couldn\\'t compile.' );\r\n\r\n\t\t}\r\n\r\n\t\tif ( gl.getShaderInfoLog( shader ) !== '' ) {\r\n\r\n\t\t\tTHREE.warn( 'THREE.WebGLShader: gl.getShaderInfoLog()', gl.getShaderInfoLog( shader ), addLineNumbers( string ) );\r\n\r\n\t\t}\r\n\r\n\t\t// --enable-privileged-webgl-extension\r\n\t\t// console.log( type, gl.getExtension( 'WEBGL_debug_shaders' ).getTranslatedShaderSource( shader ) );\r\n\r\n\t\treturn shader;\r\n\r\n\t};\r\n\r\n} )();\r\n\r\n// File:src/renderers/webgl/WebGLState.js\r\n\r\n/**\r\n* @author mrdoob / http://mrdoob.com/\r\n*/\r\n\r\nTHREE.WebGLState = function ( gl, paramThreeToGL ) {\r\n\r\n\tvar newAttributes = new Uint8Array( 16 );\r\n\tvar enabledAttributes = new Uint8Array( 16 );\r\n\r\n\tvar currentBlending = null;\r\n\tvar currentBlendEquation = null;\r\n\tvar currentBlendSrc = null;\r\n\tvar currentBlendDst = null;\r\n\tvar currentBlendEquationAlpha = null;\r\n\tvar currentBlendSrcAlpha = null;\r\n\tvar currentBlendDstAlpha = null;\r\n\r\n\tvar currentDepthTest = null;\r\n\tvar currentDepthWrite = null;\r\n\r\n\tvar currentColorWrite = null;\r\n\r\n\tvar currentDoubleSided = null;\r\n\tvar currentFlipSided = null;\r\n\r\n\tvar currentLineWidth = null;\r\n\r\n\tvar currentPolygonOffset = null;\r\n\tvar currentPolygonOffsetFactor = null;\r\n\tvar currentPolygonOffsetUnits = null;\r\n\r\n\tthis.initAttributes = function () {\r\n\r\n\t\tfor ( var i = 0, l = newAttributes.length; i < l; i ++ ) {\r\n\r\n\t\t\tnewAttributes[ i ] = 0;\r\n\r\n\t\t}\r\n\r\n\t};\r\n\r\n\tthis.enableAttribute = function ( attribute ) {\r\n\r\n\t\tnewAttributes[ attribute ] = 1;\r\n\r\n\t\tif ( enabledAttributes[ attribute ] === 0 ) {\r\n\r\n\t\t\tgl.enableVertexAttribArray( attribute );\r\n\t\t\tenabledAttributes[ attribute ] = 1;\r\n\r\n\t\t}\r\n\r\n\t};\r\n\r\n\tthis.disableUnusedAttributes = function () {\r\n\r\n\t\tfor ( var i = 0, l = enabledAttributes.length; i < l; i ++ ) {\r\n\r\n\t\t\tif ( enabledAttributes[ i ] !== newAttributes[ i ] ) {\r\n\r\n\t\t\t\tgl.disableVertexAttribArray( i );\r\n\t\t\t\tenabledAttributes[ i ] = 0;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t};\r\n\r\n\tthis.setBlending = function ( blending, blendEquation, blendSrc, blendDst, blendEquationAlpha, blendSrcAlpha, blendDstAlpha ) {\r\n\r\n\t\tif ( blending !== currentBlending ) {\r\n\r\n\t\t\tif ( blending === THREE.NoBlending ) {\r\n\r\n\t\t\t\tgl.disable( gl.BLEND );\r\n\r\n\t\t\t} else if ( blending === THREE.AdditiveBlending ) {\r\n\r\n\t\t\t\tgl.enable( gl.BLEND );\r\n\t\t\t\tgl.blendEquation( gl.FUNC_ADD );\r\n\t\t\t\tgl.blendFunc( gl.SRC_ALPHA, gl.ONE );\r\n\r\n\t\t\t} else if ( blending === THREE.SubtractiveBlending ) {\r\n\r\n\t\t\t\t// TODO: Find blendFuncSeparate() combination\r\n\t\t\t\tgl.enable( gl.BLEND );\r\n\t\t\t\tgl.blendEquation( gl.FUNC_ADD );\r\n\t\t\t\tgl.blendFunc( gl.ZERO, gl.ONE_MINUS_SRC_COLOR );\r\n\r\n\t\t\t} else if ( blending === THREE.MultiplyBlending ) {\r\n\r\n\t\t\t\t// TODO: Find blendFuncSeparate() combination\r\n\t\t\t\tgl.enable( gl.BLEND );\r\n\t\t\t\tgl.blendEquation( gl.FUNC_ADD );\r\n\t\t\t\tgl.blendFunc( gl.ZERO, gl.SRC_COLOR );\r\n\r\n\t\t\t} else if ( blending === THREE.CustomBlending ) {\r\n\r\n\t\t\t\tgl.enable( gl.BLEND );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tgl.enable( gl.BLEND );\r\n\t\t\t\tgl.blendEquationSeparate( gl.FUNC_ADD, gl.FUNC_ADD );\r\n\t\t\t\tgl.blendFuncSeparate( gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA, gl.ONE, gl.ONE_MINUS_SRC_ALPHA );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tcurrentBlending = blending;\r\n\r\n\t\t}\r\n\r\n\t\tif ( blending === THREE.CustomBlending ) {\r\n\r\n\t\t\tblendEquationAlpha = blendEquationAlpha || blendEquation;\r\n\t\t\tblendSrcAlpha = blendSrcAlpha || blendSrc;\r\n\t\t\tblendDstAlpha = blendDstAlpha || blendDst;\r\n\r\n\t\t\tif ( blendEquation !== currentBlendEquation || blendEquationAlpha !== currentBlendEquationAlpha ) {\r\n\r\n\t\t\t\tgl.blendEquationSeparate( paramThreeToGL( blendEquation ), paramThreeToGL( blendEquationAlpha ) );\r\n\r\n\t\t\t\tcurrentBlendEquation = blendEquation;\r\n\t\t\t\tcurrentBlendEquationAlpha = blendEquationAlpha;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( blendSrc !== currentBlendSrc || blendDst !== currentBlendDst || blendSrcAlpha !== currentBlendSrcAlpha || blendDstAlpha !== currentBlendDstAlpha ) {\r\n\r\n\t\t\t\tgl.blendFuncSeparate( paramThreeToGL( blendSrc ), paramThreeToGL( blendDst ), paramThreeToGL( blendSrcAlpha ), paramThreeToGL( blendDstAlpha ) );\r\n\r\n\t\t\t\tcurrentBlendSrc = blendSrc;\r\n\t\t\t\tcurrentBlendDst = blendDst;\r\n\t\t\t\tcurrentBlendSrcAlpha = blendSrcAlpha;\r\n\t\t\t\tcurrentBlendDstAlpha = blendDstAlpha;\r\n\r\n\t\t\t}\r\n\r\n\t\t} else {\r\n\r\n\t\t\tcurrentBlendEquation = null;\r\n\t\t\tcurrentBlendSrc = null;\r\n\t\t\tcurrentBlendDst = null;\r\n\t\t\tcurrentBlendEquationAlpha = null;\r\n\t\t\tcurrentBlendSrcAlpha = null;\r\n\t\t\tcurrentBlendDstAlpha = null;\r\n\r\n\t\t}\r\n\r\n\t};\r\n\r\n\tthis.setDepthTest = function ( depthTest ) {\r\n\r\n\t\tif ( currentDepthTest !== depthTest ) {\r\n\r\n\t\t\tif ( depthTest ) {\r\n\r\n\t\t\t\tgl.enable( gl.DEPTH_TEST );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tgl.disable( gl.DEPTH_TEST );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tcurrentDepthTest = depthTest;\r\n\r\n\t\t}\r\n\r\n\t};\r\n\r\n\tthis.setDepthWrite = function ( depthWrite ) {\r\n\r\n\t\tif ( currentDepthWrite !== depthWrite ) {\r\n\r\n\t\t\tgl.depthMask( depthWrite );\r\n\t\t\tcurrentDepthWrite = depthWrite;\r\n\r\n\t\t}\r\n\r\n\t};\r\n\r\n\tthis.setColorWrite = function ( colorWrite ) {\r\n\r\n\t\tif ( currentColorWrite !== colorWrite ) {\r\n\r\n\t\t\tgl.colorMask( colorWrite, colorWrite, colorWrite, colorWrite );\r\n\t\t\tcurrentColorWrite = colorWrite;\r\n\r\n\t\t}\r\n\r\n\t};\r\n\r\n\tthis.setDoubleSided = function ( doubleSided ) {\r\n\r\n\t\tif ( currentDoubleSided !== doubleSided ) {\r\n\r\n\t\t\tif ( doubleSided ) {\r\n\r\n\t\t\t\tgl.disable( gl.CULL_FACE );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tgl.enable( gl.CULL_FACE );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tcurrentDoubleSided = doubleSided;\r\n\r\n\t\t}\r\n\r\n\t};\r\n\r\n\tthis.setFlipSided = function ( flipSided ) {\r\n\r\n\t\tif ( currentFlipSided !== flipSided ) {\r\n\r\n\t\t\tif ( flipSided ) {\r\n\r\n\t\t\t\tgl.frontFace( gl.CW );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tgl.frontFace( gl.CCW );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tcurrentFlipSided = flipSided;\r\n\r\n\t\t}\r\n\r\n\t};\r\n\r\n\tthis.setLineWidth = function ( width ) {\r\n\r\n\t\tif ( width !== currentLineWidth ) {\r\n\r\n\t\t\tgl.lineWidth( width );\r\n\r\n\t\t\tcurrentLineWidth = width;\r\n\r\n\t\t}\r\n\r\n\t};\r\n\r\n\tthis.setPolygonOffset = function ( polygonoffset, factor, units ) {\r\n\r\n\t\tif ( currentPolygonOffset !== polygonoffset ) {\r\n\r\n\t\t\tif ( polygonoffset ) {\r\n\r\n\t\t\t\tgl.enable( gl.POLYGON_OFFSET_FILL );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tgl.disable( gl.POLYGON_OFFSET_FILL );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tcurrentPolygonOffset = polygonoffset;\r\n\r\n\t\t}\r\n\r\n\t\tif ( polygonoffset && ( currentPolygonOffsetFactor !== factor || currentPolygonOffsetUnits !== units ) ) {\r\n\r\n\t\t\tgl.polygonOffset( factor, units );\r\n\r\n\t\t\tcurrentPolygonOffsetFactor = factor;\r\n\t\t\tcurrentPolygonOffsetUnits = units;\r\n\r\n\t\t}\r\n\r\n\t};\r\n\r\n\tthis.reset = function () {\r\n\r\n\t\tfor ( var i = 0; i < enabledAttributes.length; i ++ ) {\r\n\r\n\t\t\tenabledAttributes[ i ] = 0;\r\n\r\n\t\t}\r\n\r\n\t\tcurrentBlending = null;\r\n\t\tcurrentDepthTest = null;\r\n\t\tcurrentDepthWrite = null;\r\n\t\tcurrentColorWrite = null;\r\n\t\tcurrentDoubleSided = null;\r\n\t\tcurrentFlipSided = null;\r\n\r\n\t};\r\n\r\n};\r\n\r\n// File:src/renderers/webgl/plugins/LensFlarePlugin.js\r\n\r\n/**\r\n * @author mikael emtinger / http://gomo.se/\r\n * @author alteredq / http://alteredqualia.com/\r\n */\r\n\r\nTHREE.LensFlarePlugin = function ( renderer, flares ) {\r\n\r\n\tvar gl = renderer.context;\r\n\r\n\tvar vertexBuffer, elementBuffer;\r\n\tvar program, attributes, uniforms;\r\n\tvar hasVertexTexture;\r\n\r\n\tvar tempTexture, occlusionTexture;\r\n\r\n\tvar init = function () {\r\n\r\n\t\tvar vertices = new Float32Array( [\r\n\t\t\t-1, -1, 0, 0,\r\n\t\t\t 1, -1, 1, 0,\r\n\t\t\t 1, 1, 1, 1,\r\n\t\t\t-1, 1, 0, 1\r\n\t\t] );\r\n\r\n\t\tvar faces = new Uint16Array( [\r\n\t\t\t0, 1, 2,\r\n\t\t\t0, 2, 3\r\n\t\t] );\r\n\r\n\t\t// buffers\r\n\r\n\t\tvertexBuffer = gl.createBuffer();\r\n\t\telementBuffer = gl.createBuffer();\r\n\r\n\t\tgl.bindBuffer( gl.ARRAY_BUFFER, vertexBuffer );\r\n\t\tgl.bufferData( gl.ARRAY_BUFFER, vertices, gl.STATIC_DRAW );\r\n\r\n\t\tgl.bindBuffer( gl.ELEMENT_ARRAY_BUFFER, elementBuffer );\r\n\t\tgl.bufferData( gl.ELEMENT_ARRAY_BUFFER, faces, gl.STATIC_DRAW );\r\n\r\n\t\t// textures\r\n\r\n\t\ttempTexture = gl.createTexture();\r\n\t\tocclusionTexture = gl.createTexture();\r\n\r\n\t\tgl.bindTexture( gl.TEXTURE_2D, tempTexture );\r\n\t\tgl.texImage2D( gl.TEXTURE_2D, 0, gl.RGB, 16, 16, 0, gl.RGB, gl.UNSIGNED_BYTE, null );\r\n\t\tgl.texParameteri( gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE );\r\n\t\tgl.texParameteri( gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE );\r\n\t\tgl.texParameteri( gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST );\r\n\t\tgl.texParameteri( gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST );\r\n\r\n\t\tgl.bindTexture( gl.TEXTURE_2D, occlusionTexture );\r\n\t\tgl.texImage2D( gl.TEXTURE_2D, 0, gl.RGBA, 16, 16, 0, gl.RGBA, gl.UNSIGNED_BYTE, null );\r\n\t\tgl.texParameteri( gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE );\r\n\t\tgl.texParameteri( gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE );\r\n\t\tgl.texParameteri( gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST );\r\n\t\tgl.texParameteri( gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST );\r\n\r\n\t\thasVertexTexture = gl.getParameter( gl.MAX_VERTEX_TEXTURE_IMAGE_UNITS ) > 0;\r\n\r\n\t\tvar shader;\r\n\r\n\t\tif ( hasVertexTexture ) {\r\n\r\n\t\t\tshader = {\r\n\r\n\t\t\t\tvertexShader: [\r\n\r\n\t\t\t\t\t\"uniform lowp int renderType;\",\r\n\r\n\t\t\t\t\t\"uniform vec3 screenPosition;\",\r\n\t\t\t\t\t\"uniform vec2 scale;\",\r\n\t\t\t\t\t\"uniform float rotation;\",\r\n\r\n\t\t\t\t\t\"uniform sampler2D occlusionMap;\",\r\n\r\n\t\t\t\t\t\"attribute vec2 position;\",\r\n\t\t\t\t\t\"attribute vec2 uv;\",\r\n\r\n\t\t\t\t\t\"varying vec2 vUV;\",\r\n\t\t\t\t\t\"varying float vVisibility;\",\r\n\r\n\t\t\t\t\t\"void main() {\",\r\n\r\n\t\t\t\t\t\t\"vUV = uv;\",\r\n\r\n\t\t\t\t\t\t\"vec2 pos = position;\",\r\n\r\n\t\t\t\t\t\t\"if( renderType == 2 ) {\",\r\n\r\n\t\t\t\t\t\t\t\"vec4 visibility = texture2D( occlusionMap, vec2( 0.1, 0.1 ) );\",\r\n\t\t\t\t\t\t\t\"visibility += texture2D( occlusionMap, vec2( 0.5, 0.1 ) );\",\r\n\t\t\t\t\t\t\t\"visibility += texture2D( occlusionMap, vec2( 0.9, 0.1 ) );\",\r\n\t\t\t\t\t\t\t\"visibility += texture2D( occlusionMap, vec2( 0.9, 0.5 ) );\",\r\n\t\t\t\t\t\t\t\"visibility += texture2D( occlusionMap, vec2( 0.9, 0.9 ) );\",\r\n\t\t\t\t\t\t\t\"visibility += texture2D( occlusionMap, vec2( 0.5, 0.9 ) );\",\r\n\t\t\t\t\t\t\t\"visibility += texture2D( occlusionMap, vec2( 0.1, 0.9 ) );\",\r\n\t\t\t\t\t\t\t\"visibility += texture2D( occlusionMap, vec2( 0.1, 0.5 ) );\",\r\n\t\t\t\t\t\t\t\"visibility += texture2D( occlusionMap, vec2( 0.5, 0.5 ) );\",\r\n\r\n\t\t\t\t\t\t\t\"vVisibility = visibility.r / 9.0;\",\r\n\t\t\t\t\t\t\t\"vVisibility *= 1.0 - visibility.g / 9.0;\",\r\n\t\t\t\t\t\t\t\"vVisibility *= visibility.b / 9.0;\",\r\n\t\t\t\t\t\t\t\"vVisibility *= 1.0 - visibility.a / 9.0;\",\r\n\r\n\t\t\t\t\t\t\t\"pos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;\",\r\n\t\t\t\t\t\t\t\"pos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;\",\r\n\r\n\t\t\t\t\t\t\"}\",\r\n\r\n\t\t\t\t\t\t\"gl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );\",\r\n\r\n\t\t\t\t\t\"}\"\r\n\r\n\t\t\t\t].join( \"\\n\" ),\r\n\r\n\t\t\t\tfragmentShader: [\r\n\r\n\t\t\t\t\t\"uniform lowp int renderType;\",\r\n\r\n\t\t\t\t\t\"uniform sampler2D map;\",\r\n\t\t\t\t\t\"uniform float opacity;\",\r\n\t\t\t\t\t\"uniform vec3 color;\",\r\n\r\n\t\t\t\t\t\"varying vec2 vUV;\",\r\n\t\t\t\t\t\"varying float vVisibility;\",\r\n\r\n\t\t\t\t\t\"void main() {\",\r\n\r\n\t\t\t\t\t\t// pink square\r\n\r\n\t\t\t\t\t\t\"if( renderType == 0 ) {\",\r\n\r\n\t\t\t\t\t\t\t\"gl_FragColor = vec4( 1.0, 0.0, 1.0, 0.0 );\",\r\n\r\n\t\t\t\t\t\t// restore\r\n\r\n\t\t\t\t\t\t\"} else if( renderType == 1 ) {\",\r\n\r\n\t\t\t\t\t\t\t\"gl_FragColor = texture2D( map, vUV );\",\r\n\r\n\t\t\t\t\t\t// flare\r\n\r\n\t\t\t\t\t\t\"} else {\",\r\n\r\n\t\t\t\t\t\t\t\"vec4 texture = texture2D( map, vUV );\",\r\n\t\t\t\t\t\t\t\"texture.a *= opacity * vVisibility;\",\r\n\t\t\t\t\t\t\t\"gl_FragColor = texture;\",\r\n\t\t\t\t\t\t\t\"gl_FragColor.rgb *= color;\",\r\n\r\n\t\t\t\t\t\t\"}\",\r\n\r\n\t\t\t\t\t\"}\"\r\n\r\n\t\t\t\t].join( \"\\n\" )\r\n\r\n\t\t\t};\r\n\r\n\t\t} else {\r\n\r\n\t\t\tshader = {\r\n\r\n\t\t\t\tvertexShader: [\r\n\r\n\t\t\t\t\t\"uniform lowp int renderType;\",\r\n\r\n\t\t\t\t\t\"uniform vec3 screenPosition;\",\r\n\t\t\t\t\t\"uniform vec2 scale;\",\r\n\t\t\t\t\t\"uniform float rotation;\",\r\n\r\n\t\t\t\t\t\"attribute vec2 position;\",\r\n\t\t\t\t\t\"attribute vec2 uv;\",\r\n\r\n\t\t\t\t\t\"varying vec2 vUV;\",\r\n\r\n\t\t\t\t\t\"void main() {\",\r\n\r\n\t\t\t\t\t\t\"vUV = uv;\",\r\n\r\n\t\t\t\t\t\t\"vec2 pos = position;\",\r\n\r\n\t\t\t\t\t\t\"if( renderType == 2 ) {\",\r\n\r\n\t\t\t\t\t\t\t\"pos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;\",\r\n\t\t\t\t\t\t\t\"pos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;\",\r\n\r\n\t\t\t\t\t\t\"}\",\r\n\r\n\t\t\t\t\t\t\"gl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );\",\r\n\r\n\t\t\t\t\t\"}\"\r\n\r\n\t\t\t\t].join( \"\\n\" ),\r\n\r\n\t\t\t\tfragmentShader: [\r\n\r\n\t\t\t\t\t\"precision mediump float;\",\r\n\r\n\t\t\t\t\t\"uniform lowp int renderType;\",\r\n\r\n\t\t\t\t\t\"uniform sampler2D map;\",\r\n\t\t\t\t\t\"uniform sampler2D occlusionMap;\",\r\n\t\t\t\t\t\"uniform float opacity;\",\r\n\t\t\t\t\t\"uniform vec3 color;\",\r\n\r\n\t\t\t\t\t\"varying vec2 vUV;\",\r\n\r\n\t\t\t\t\t\"void main() {\",\r\n\r\n\t\t\t\t\t\t// pink square\r\n\r\n\t\t\t\t\t\t\"if( renderType == 0 ) {\",\r\n\r\n\t\t\t\t\t\t\t\"gl_FragColor = vec4( texture2D( map, vUV ).rgb, 0.0 );\",\r\n\r\n\t\t\t\t\t\t// restore\r\n\r\n\t\t\t\t\t\t\"} else if( renderType == 1 ) {\",\r\n\r\n\t\t\t\t\t\t\t\"gl_FragColor = texture2D( map, vUV );\",\r\n\r\n\t\t\t\t\t\t// flare\r\n\r\n\t\t\t\t\t\t\"} else {\",\r\n\r\n\t\t\t\t\t\t\t\"float visibility = texture2D( occlusionMap, vec2( 0.5, 0.1 ) ).a;\",\r\n\t\t\t\t\t\t\t\"visibility += texture2D( occlusionMap, vec2( 0.9, 0.5 ) ).a;\",\r\n\t\t\t\t\t\t\t\"visibility += texture2D( occlusionMap, vec2( 0.5, 0.9 ) ).a;\",\r\n\t\t\t\t\t\t\t\"visibility += texture2D( occlusionMap, vec2( 0.1, 0.5 ) ).a;\",\r\n\t\t\t\t\t\t\t\"visibility = ( 1.0 - visibility / 4.0 );\",\r\n\r\n\t\t\t\t\t\t\t\"vec4 texture = texture2D( map, vUV );\",\r\n\t\t\t\t\t\t\t\"texture.a *= opacity * visibility;\",\r\n\t\t\t\t\t\t\t\"gl_FragColor = texture;\",\r\n\t\t\t\t\t\t\t\"gl_FragColor.rgb *= color;\",\r\n\r\n\t\t\t\t\t\t\"}\",\r\n\r\n\t\t\t\t\t\"}\"\r\n\r\n\t\t\t\t].join( \"\\n\" )\r\n\r\n\t\t\t};\r\n\r\n\t\t}\r\n\r\n\t\tprogram = createProgram( shader );\r\n\r\n\t\tattributes = {\r\n\t\t\tvertex: gl.getAttribLocation ( program, \"position\" ),\r\n\t\t\tuv: gl.getAttribLocation ( program, \"uv\" )\r\n\t\t}\r\n\r\n\t\tuniforms = {\r\n\t\t\trenderType: gl.getUniformLocation( program, \"renderType\" ),\r\n\t\t\tmap: gl.getUniformLocation( program, \"map\" ),\r\n\t\t\tocclusionMap: gl.getUniformLocation( program, \"occlusionMap\" ),\r\n\t\t\topacity: gl.getUniformLocation( program, \"opacity\" ),\r\n\t\t\tcolor: gl.getUniformLocation( program, \"color\" ),\r\n\t\t\tscale: gl.getUniformLocation( program, \"scale\" ),\r\n\t\t\trotation: gl.getUniformLocation( program, \"rotation\" ),\r\n\t\t\tscreenPosition: gl.getUniformLocation( program, \"screenPosition\" )\r\n\t\t};\r\n\r\n\t};\r\n\r\n\t/*\r\n\t * Render lens flares\r\n\t * Method: renders 16x16 0xff00ff-colored points scattered over the light source area,\r\n\t * reads these back and calculates occlusion.\r\n\t */\r\n\r\n\tthis.render = function ( scene, camera, viewportWidth, viewportHeight ) {\r\n\r\n\t\tif ( flares.length === 0 ) return;\r\n\r\n\t\tvar tempPosition = new THREE.Vector3();\r\n\r\n\t\tvar invAspect = viewportHeight / viewportWidth,\r\n\t\t\thalfViewportWidth = viewportWidth * 0.5,\r\n\t\t\thalfViewportHeight = viewportHeight * 0.5;\r\n\r\n\t\tvar size = 16 / viewportHeight,\r\n\t\t\tscale = new THREE.Vector2( size * invAspect, size );\r\n\r\n\t\tvar screenPosition = new THREE.Vector3( 1, 1, 0 ),\r\n\t\t\tscreenPositionPixels = new THREE.Vector2( 1, 1 );\r\n\r\n\t\tif ( program === undefined ) {\r\n\r\n\t\t\tinit();\r\n\r\n\t\t}\r\n\r\n\t\tgl.useProgram( program );\r\n\r\n\t\tgl.enableVertexAttribArray( attributes.vertex );\r\n\t\tgl.enableVertexAttribArray( attributes.uv );\r\n\r\n\t\t// loop through all lens flares to update their occlusion and positions\r\n\t\t// setup gl and common used attribs/unforms\r\n\r\n\t\tgl.uniform1i( uniforms.occlusionMap, 0 );\r\n\t\tgl.uniform1i( uniforms.map, 1 );\r\n\r\n\t\tgl.bindBuffer( gl.ARRAY_BUFFER, vertexBuffer );\r\n\t\tgl.vertexAttribPointer( attributes.vertex, 2, gl.FLOAT, false, 2 * 8, 0 );\r\n\t\tgl.vertexAttribPointer( attributes.uv, 2, gl.FLOAT, false, 2 * 8, 8 );\r\n\r\n\t\tgl.bindBuffer( gl.ELEMENT_ARRAY_BUFFER, elementBuffer );\r\n\r\n\t\tgl.disable( gl.CULL_FACE );\r\n\t\tgl.depthMask( false );\r\n\r\n\t\tfor ( var i = 0, l = flares.length; i < l; i ++ ) {\r\n\r\n\t\t\tsize = 16 / viewportHeight;\r\n\t\t\tscale.set( size * invAspect, size );\r\n\r\n\t\t\t// calc object screen position\r\n\r\n\t\t\tvar flare = flares[ i ];\r\n\r\n\t\t\ttempPosition.set( flare.matrixWorld.elements[12], flare.matrixWorld.elements[13], flare.matrixWorld.elements[14] );\r\n\r\n\t\t\ttempPosition.applyMatrix4( camera.matrixWorldInverse );\r\n\t\t\ttempPosition.applyProjection( camera.projectionMatrix );\r\n\r\n\t\t\t// setup arrays for gl programs\r\n\r\n\t\t\tscreenPosition.copy( tempPosition )\r\n\r\n\t\t\tscreenPositionPixels.x = screenPosition.x * halfViewportWidth + halfViewportWidth;\r\n\t\t\tscreenPositionPixels.y = screenPosition.y * halfViewportHeight + halfViewportHeight;\r\n\r\n\t\t\t// screen cull\r\n\r\n\t\t\tif ( hasVertexTexture || (\r\n\t\t\t\tscreenPositionPixels.x > 0 &&\r\n\t\t\t\tscreenPositionPixels.x < viewportWidth &&\r\n\t\t\t\tscreenPositionPixels.y > 0 &&\r\n\t\t\t\tscreenPositionPixels.y < viewportHeight ) ) {\r\n\r\n\t\t\t\t// save current RGB to temp texture\r\n\r\n\t\t\t\tgl.activeTexture( gl.TEXTURE1 );\r\n\t\t\t\tgl.bindTexture( gl.TEXTURE_2D, tempTexture );\r\n\t\t\t\tgl.copyTexImage2D( gl.TEXTURE_2D, 0, gl.RGB, screenPositionPixels.x - 8, screenPositionPixels.y - 8, 16, 16, 0 );\r\n\r\n\r\n\t\t\t\t// render pink quad\r\n\r\n\t\t\t\tgl.uniform1i( uniforms.renderType, 0 );\r\n\t\t\t\tgl.uniform2f( uniforms.scale, scale.x, scale.y );\r\n\t\t\t\tgl.uniform3f( uniforms.screenPosition, screenPosition.x, screenPosition.y, screenPosition.z );\r\n\r\n\t\t\t\tgl.disable( gl.BLEND );\r\n\t\t\t\tgl.enable( gl.DEPTH_TEST );\r\n\r\n\t\t\t\tgl.drawElements( gl.TRIANGLES, 6, gl.UNSIGNED_SHORT, 0 );\r\n\r\n\r\n\t\t\t\t// copy result to occlusionMap\r\n\r\n\t\t\t\tgl.activeTexture( gl.TEXTURE0 );\r\n\t\t\t\tgl.bindTexture( gl.TEXTURE_2D, occlusionTexture );\r\n\t\t\t\tgl.copyTexImage2D( gl.TEXTURE_2D, 0, gl.RGBA, screenPositionPixels.x - 8, screenPositionPixels.y - 8, 16, 16, 0 );\r\n\r\n\r\n\t\t\t\t// restore graphics\r\n\r\n\t\t\t\tgl.uniform1i( uniforms.renderType, 1 );\r\n\t\t\t\tgl.disable( gl.DEPTH_TEST );\r\n\r\n\t\t\t\tgl.activeTexture( gl.TEXTURE1 );\r\n\t\t\t\tgl.bindTexture( gl.TEXTURE_2D, tempTexture );\r\n\t\t\t\tgl.drawElements( gl.TRIANGLES, 6, gl.UNSIGNED_SHORT, 0 );\r\n\r\n\r\n\t\t\t\t// update object positions\r\n\r\n\t\t\t\tflare.positionScreen.copy( screenPosition )\r\n\r\n\t\t\t\tif ( flare.customUpdateCallback ) {\r\n\r\n\t\t\t\t\tflare.customUpdateCallback( flare );\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\tflare.updateLensFlares();\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\t// render flares\r\n\r\n\t\t\t\tgl.uniform1i( uniforms.renderType, 2 );\r\n\t\t\t\tgl.enable( gl.BLEND );\r\n\r\n\t\t\t\tfor ( var j = 0, jl = flare.lensFlares.length; j < jl; j ++ ) {\r\n\r\n\t\t\t\t\tvar sprite = flare.lensFlares[ j ];\r\n\r\n\t\t\t\t\tif ( sprite.opacity > 0.001 && sprite.scale > 0.001 ) {\r\n\r\n\t\t\t\t\t\tscreenPosition.x = sprite.x;\r\n\t\t\t\t\t\tscreenPosition.y = sprite.y;\r\n\t\t\t\t\t\tscreenPosition.z = sprite.z;\r\n\r\n\t\t\t\t\t\tsize = sprite.size * sprite.scale / viewportHeight;\r\n\r\n\t\t\t\t\t\tscale.x = size * invAspect;\r\n\t\t\t\t\t\tscale.y = size;\r\n\r\n\t\t\t\t\t\tgl.uniform3f( uniforms.screenPosition, screenPosition.x, screenPosition.y, screenPosition.z );\r\n\t\t\t\t\t\tgl.uniform2f( uniforms.scale, scale.x, scale.y );\r\n\t\t\t\t\t\tgl.uniform1f( uniforms.rotation, sprite.rotation );\r\n\r\n\t\t\t\t\t\tgl.uniform1f( uniforms.opacity, sprite.opacity );\r\n\t\t\t\t\t\tgl.uniform3f( uniforms.color, sprite.color.r, sprite.color.g, sprite.color.b );\r\n\r\n\t\t\t\t\t\trenderer.state.setBlending( sprite.blending, sprite.blendEquation, sprite.blendSrc, sprite.blendDst );\r\n\t\t\t\t\t\trenderer.setTexture( sprite.texture, 1 );\r\n\r\n\t\t\t\t\t\tgl.drawElements( gl.TRIANGLES, 6, gl.UNSIGNED_SHORT, 0 );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\t// restore gl\r\n\r\n\t\tgl.enable( gl.CULL_FACE );\r\n\t\tgl.enable( gl.DEPTH_TEST );\r\n\t\tgl.depthMask( true );\r\n\r\n\t\trenderer.resetGLState();\r\n\r\n\t};\r\n\r\n\tfunction createProgram ( shader ) {\r\n\r\n\t\tvar program = gl.createProgram();\r\n\r\n\t\tvar fragmentShader = gl.createShader( gl.FRAGMENT_SHADER );\r\n\t\tvar vertexShader = gl.createShader( gl.VERTEX_SHADER );\r\n\r\n\t\tvar prefix = \"precision \" + renderer.getPrecision() + \" float;\\n\";\r\n\r\n\t\tgl.shaderSource( fragmentShader, prefix + shader.fragmentShader );\r\n\t\tgl.shaderSource( vertexShader, prefix + shader.vertexShader );\r\n\r\n\t\tgl.compileShader( fragmentShader );\r\n\t\tgl.compileShader( vertexShader );\r\n\r\n\t\tgl.attachShader( program, fragmentShader );\r\n\t\tgl.attachShader( program, vertexShader );\r\n\r\n\t\tgl.linkProgram( program );\r\n\r\n\t\treturn program;\r\n\r\n\t}\r\n\r\n};\r\n\r\n// File:src/renderers/webgl/plugins/ShadowMapPlugin.js\r\n\r\n/**\r\n * @author alteredq / http://alteredqualia.com/\r\n */\r\n\r\nTHREE.ShadowMapPlugin = function ( _renderer, _lights, _webglObjects, _webglObjectsImmediate ) {\r\n\r\n\tvar _gl = _renderer.context;\r\n\r\n\tvar _depthMaterial, _depthMaterialMorph, _depthMaterialSkin, _depthMaterialMorphSkin,\r\n\r\n\t_frustum = new THREE.Frustum(),\r\n\t_projScreenMatrix = new THREE.Matrix4(),\r\n\r\n\t_min = new THREE.Vector3(),\r\n\t_max = new THREE.Vector3(),\r\n\r\n\t_matrixPosition = new THREE.Vector3(),\r\n\r\n\t_renderList = [];\r\n\r\n\t// init\r\n\r\n\tvar depthShader = THREE.ShaderLib[ \"depthRGBA\" ];\r\n\tvar depthUniforms = THREE.UniformsUtils.clone( depthShader.uniforms );\r\n\r\n\t_depthMaterial = new THREE.ShaderMaterial( {\r\n\t\tuniforms: depthUniforms,\r\n\t\tvertexShader: depthShader.vertexShader,\r\n\t\tfragmentShader: depthShader.fragmentShader\r\n\t } );\r\n\r\n\t_depthMaterialMorph = new THREE.ShaderMaterial( {\r\n\t\tuniforms: depthUniforms,\r\n\t\tvertexShader: depthShader.vertexShader,\r\n\t\tfragmentShader: depthShader.fragmentShader,\r\n\t\tmorphTargets: true\r\n\t} );\r\n\r\n\t_depthMaterialSkin = new THREE.ShaderMaterial( {\r\n\t\tuniforms: depthUniforms,\r\n\t\tvertexShader: depthShader.vertexShader,\r\n\t\tfragmentShader: depthShader.fragmentShader,\r\n\t\tskinning: true\r\n\t} );\r\n\r\n\t_depthMaterialMorphSkin = new THREE.ShaderMaterial( {\r\n\t\tuniforms: depthUniforms,\r\n\t\tvertexShader: depthShader.vertexShader,\r\n\t\tfragmentShader: depthShader.fragmentShader,\r\n\t\tmorphTargets: true,\r\n\t\tskinning: true\r\n\t} );\r\n\r\n\t_depthMaterial._shadowPass = true;\r\n\t_depthMaterialMorph._shadowPass = true;\r\n\t_depthMaterialSkin._shadowPass = true;\r\n\t_depthMaterialMorphSkin._shadowPass = true;\r\n\r\n\tthis.render = function ( scene, camera ) {\r\n\r\n\t\tif ( _renderer.shadowMapEnabled === false ) return;\r\n\r\n\t\tvar i, il, j, jl, n,\r\n\r\n\t\tshadowMap, shadowMatrix, shadowCamera,\r\n\t\tbuffer, material,\r\n\t\twebglObject, object, light,\r\n\r\n\t\tlights = [],\r\n\t\tk = 0,\r\n\r\n\t\tfog = null;\r\n\r\n\t\t// set GL state for depth map\r\n\r\n\t\t_gl.clearColor( 1, 1, 1, 1 );\r\n\t\t_gl.disable( _gl.BLEND );\r\n\r\n\t\t_gl.enable( _gl.CULL_FACE );\r\n\t\t_gl.frontFace( _gl.CCW );\r\n\r\n\t\tif ( _renderer.shadowMapCullFace === THREE.CullFaceFront ) {\r\n\r\n\t\t\t_gl.cullFace( _gl.FRONT );\r\n\r\n\t\t} else {\r\n\r\n\t\t\t_gl.cullFace( _gl.BACK );\r\n\r\n\t\t}\r\n\r\n\t\t_renderer.state.setDepthTest( true );\r\n\r\n\t\t// preprocess lights\r\n\t\t// \t- skip lights that are not casting shadows\r\n\t\t//\t- create virtual lights for cascaded shadow maps\r\n\r\n\t\tfor ( i = 0, il = _lights.length; i < il; i ++ ) {\r\n\r\n\t\t\tlight = _lights[ i ];\r\n\r\n\t\t\tif ( ! light.castShadow ) continue;\r\n\r\n\t\t\tif ( ( light instanceof THREE.DirectionalLight ) && light.shadowCascade ) {\r\n\r\n\t\t\t\tfor ( n = 0; n < light.shadowCascadeCount; n ++ ) {\r\n\r\n\t\t\t\t\tvar virtualLight;\r\n\r\n\t\t\t\t\tif ( ! light.shadowCascadeArray[ n ] ) {\r\n\r\n\t\t\t\t\t\tvirtualLight = createVirtualLight( light, n );\r\n\t\t\t\t\t\tvirtualLight.originalCamera = camera;\r\n\r\n\t\t\t\t\t\tvar gyro = new THREE.Gyroscope();\r\n\t\t\t\t\t\tgyro.position.copy( light.shadowCascadeOffset );\r\n\r\n\t\t\t\t\t\tgyro.add( virtualLight );\r\n\t\t\t\t\t\tgyro.add( virtualLight.target );\r\n\r\n\t\t\t\t\t\tcamera.add( gyro );\r\n\r\n\t\t\t\t\t\tlight.shadowCascadeArray[ n ] = virtualLight;\r\n\r\n\t\t\t\t\t\t//console.log( \"Created virtualLight\", virtualLight );\r\n\r\n\t\t\t\t\t} else {\r\n\r\n\t\t\t\t\t\tvirtualLight = light.shadowCascadeArray[ n ];\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tupdateVirtualLight( light, n );\r\n\r\n\t\t\t\t\tlights[ k ] = virtualLight;\r\n\t\t\t\t\tk ++;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tlights[ k ] = light;\r\n\t\t\t\tk ++;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\t// render depth map\r\n\r\n\t\tfor ( i = 0, il = lights.length; i < il; i ++ ) {\r\n\r\n\t\t\tlight = lights[ i ];\r\n\r\n\t\t\tif ( ! light.shadowMap ) {\r\n\r\n\t\t\t\tvar shadowFilter = THREE.LinearFilter;\r\n\r\n\t\t\t\tif ( _renderer.shadowMapType === THREE.PCFSoftShadowMap ) {\r\n\r\n\t\t\t\t\tshadowFilter = THREE.NearestFilter;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tvar pars = { minFilter: shadowFilter, magFilter: shadowFilter, format: THREE.RGBAFormat };\r\n\r\n\t\t\t\tlight.shadowMap = new THREE.WebGLRenderTarget( light.shadowMapWidth, light.shadowMapHeight, pars );\r\n\t\t\t\tlight.shadowMapSize = new THREE.Vector2( light.shadowMapWidth, light.shadowMapHeight );\r\n\r\n\t\t\t\tlight.shadowMatrix = new THREE.Matrix4();\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( ! light.shadowCamera ) {\r\n\r\n\t\t\t\tif ( light instanceof THREE.SpotLight ) {\r\n\r\n\t\t\t\t\tlight.shadowCamera = new THREE.PerspectiveCamera( light.shadowCameraFov, light.shadowMapWidth / light.shadowMapHeight, light.shadowCameraNear, light.shadowCameraFar );\r\n\r\n\t\t\t\t} else if ( light instanceof THREE.DirectionalLight ) {\r\n\r\n\t\t\t\t\tlight.shadowCamera = new THREE.OrthographicCamera( light.shadowCameraLeft, light.shadowCameraRight, light.shadowCameraTop, light.shadowCameraBottom, light.shadowCameraNear, light.shadowCameraFar );\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\tTHREE.error( \"THREE.ShadowMapPlugin: Unsupported light type for shadow\", light );\r\n\t\t\t\t\tcontinue;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tscene.add( light.shadowCamera );\r\n\r\n\t\t\t\tif ( scene.autoUpdate === true ) scene.updateMatrixWorld();\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( light.shadowCameraVisible && ! light.cameraHelper ) {\r\n\r\n\t\t\t\tlight.cameraHelper = new THREE.CameraHelper( light.shadowCamera );\r\n\t\t\t\tscene.add( light.cameraHelper );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( light.isVirtual && virtualLight.originalCamera == camera ) {\r\n\r\n\t\t\t\tupdateShadowCamera( camera, light );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tshadowMap = light.shadowMap;\r\n\t\t\tshadowMatrix = light.shadowMatrix;\r\n\t\t\tshadowCamera = light.shadowCamera;\r\n\r\n\t\t\t//\r\n\r\n\t\t\tshadowCamera.position.setFromMatrixPosition( light.matrixWorld );\r\n\t\t\t_matrixPosition.setFromMatrixPosition( light.target.matrixWorld );\r\n\t\t\tshadowCamera.lookAt( _matrixPosition );\r\n\t\t\tshadowCamera.updateMatrixWorld();\r\n\r\n\t\t\tshadowCamera.matrixWorldInverse.getInverse( shadowCamera.matrixWorld );\r\n\r\n\t\t\t//\r\n\r\n\t\t\tif ( light.cameraHelper ) light.cameraHelper.visible = light.shadowCameraVisible;\r\n\t\t\tif ( light.shadowCameraVisible ) light.cameraHelper.update();\r\n\r\n\t\t\t// compute shadow matrix\r\n\r\n\t\t\tshadowMatrix.set(\r\n\t\t\t\t0.5, 0.0, 0.0, 0.5,\r\n\t\t\t\t0.0, 0.5, 0.0, 0.5,\r\n\t\t\t\t0.0, 0.0, 0.5, 0.5,\r\n\t\t\t\t0.0, 0.0, 0.0, 1.0\r\n\t\t\t);\r\n\r\n\t\t\tshadowMatrix.multiply( shadowCamera.projectionMatrix );\r\n\t\t\tshadowMatrix.multiply( shadowCamera.matrixWorldInverse );\r\n\r\n\t\t\t// update camera matrices and frustum\r\n\r\n\t\t\t_projScreenMatrix.multiplyMatrices( shadowCamera.projectionMatrix, shadowCamera.matrixWorldInverse );\r\n\t\t\t_frustum.setFromMatrix( _projScreenMatrix );\r\n\r\n\t\t\t// render shadow map\r\n\r\n\t\t\t_renderer.setRenderTarget( shadowMap );\r\n\t\t\t_renderer.clear();\r\n\r\n\t\t\t// set object matrices & frustum culling\r\n\r\n\t\t\t_renderList.length = 0;\r\n\r\n\t\t\tprojectObject( scene, scene, shadowCamera );\r\n\r\n\r\n\t\t\t// render regular objects\r\n\r\n\t\t\tvar objectMaterial, useMorphing, useSkinning;\r\n\r\n\t\t\tfor ( j = 0, jl = _renderList.length; j < jl; j ++ ) {\r\n\r\n\t\t\t\twebglObject = _renderList[ j ];\r\n\r\n\t\t\t\tobject = webglObject.object;\r\n\t\t\t\tbuffer = webglObject.buffer;\r\n\r\n\t\t\t\t// culling is overriden globally for all objects\r\n\t\t\t\t// while rendering depth map\r\n\r\n\t\t\t\t// need to deal with MeshFaceMaterial somehow\r\n\t\t\t\t// in that case just use the first of material.materials for now\r\n\t\t\t\t// (proper solution would require to break objects by materials\r\n\t\t\t\t// similarly to regular rendering and then set corresponding\r\n\t\t\t\t// depth materials per each chunk instead of just once per object)\r\n\r\n\t\t\t\tobjectMaterial = getObjectMaterial( object );\r\n\r\n\t\t\t\tuseMorphing = object.geometry.morphTargets !== undefined && object.geometry.morphTargets.length > 0 && objectMaterial.morphTargets;\r\n\t\t\t\tuseSkinning = object instanceof THREE.SkinnedMesh && objectMaterial.skinning;\r\n\r\n\t\t\t\tif ( object.customDepthMaterial ) {\r\n\r\n\t\t\t\t\tmaterial = object.customDepthMaterial;\r\n\r\n\t\t\t\t} else if ( useSkinning ) {\r\n\r\n\t\t\t\t\tmaterial = useMorphing ? _depthMaterialMorphSkin : _depthMaterialSkin;\r\n\r\n\t\t\t\t} else if ( useMorphing ) {\r\n\r\n\t\t\t\t\tmaterial = _depthMaterialMorph;\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\tmaterial = _depthMaterial;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\t_renderer.setMaterialFaces( objectMaterial );\r\n\r\n\t\t\t\tif ( buffer instanceof THREE.BufferGeometry ) {\r\n\r\n\t\t\t\t\t_renderer.renderBufferDirect( shadowCamera, _lights, fog, material, buffer, object );\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\t_renderer.renderBuffer( shadowCamera, _lights, fog, material, buffer, object );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\t// set matrices and render immediate objects\r\n\r\n\t\t\tfor ( j = 0, jl = _webglObjectsImmediate.length; j < jl; j ++ ) {\r\n\r\n\t\t\t\twebglObject = _webglObjectsImmediate[ j ];\r\n\t\t\t\tobject = webglObject.object;\r\n\r\n\t\t\t\tif ( object.visible && object.castShadow ) {\r\n\r\n\t\t\t\t\tobject._modelViewMatrix.multiplyMatrices( shadowCamera.matrixWorldInverse, object.matrixWorld );\r\n\r\n\t\t\t\t\t_renderer.renderImmediateObject( shadowCamera, _lights, fog, _depthMaterial, object );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\t// restore GL state\r\n\r\n\t\tvar clearColor = _renderer.getClearColor(),\r\n\t\tclearAlpha = _renderer.getClearAlpha();\r\n\r\n\t\t_gl.clearColor( clearColor.r, clearColor.g, clearColor.b, clearAlpha );\r\n\t\t_gl.enable( _gl.BLEND );\r\n\r\n\t\tif ( _renderer.shadowMapCullFace === THREE.CullFaceFront ) {\r\n\r\n\t\t\t_gl.cullFace( _gl.BACK );\r\n\r\n\t\t}\r\n\r\n\t\t_renderer.resetGLState();\r\n\r\n\t};\r\n\r\n\tfunction projectObject( scene, object, shadowCamera ) {\r\n\r\n\t\tif ( object.visible ) {\r\n\r\n\t\t\tvar webglObjects = _webglObjects[ object.id ];\r\n\r\n\t\t\tif ( webglObjects && object.castShadow && (object.frustumCulled === false || _frustum.intersectsObject( object ) === true) ) {\r\n\r\n\t\t\t\tfor ( var i = 0, l = webglObjects.length; i < l; i ++ ) {\r\n\r\n\t\t\t\t\tvar webglObject = webglObjects[ i ];\r\n\r\n\t\t\t\t\tobject._modelViewMatrix.multiplyMatrices( shadowCamera.matrixWorldInverse, object.matrixWorld );\r\n\t\t\t\t\t_renderList.push( webglObject );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\tfor ( var i = 0, l = object.children.length; i < l; i ++ ) {\r\n\r\n\t\t\t\tprojectObject( scene, object.children[ i ], shadowCamera );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tfunction createVirtualLight( light, cascade ) {\r\n\r\n\t\tvar virtualLight = new THREE.DirectionalLight();\r\n\r\n\t\tvirtualLight.isVirtual = true;\r\n\r\n\t\tvirtualLight.onlyShadow = true;\r\n\t\tvirtualLight.castShadow = true;\r\n\r\n\t\tvirtualLight.shadowCameraNear = light.shadowCameraNear;\r\n\t\tvirtualLight.shadowCameraFar = light.shadowCameraFar;\r\n\r\n\t\tvirtualLight.shadowCameraLeft = light.shadowCameraLeft;\r\n\t\tvirtualLight.shadowCameraRight = light.shadowCameraRight;\r\n\t\tvirtualLight.shadowCameraBottom = light.shadowCameraBottom;\r\n\t\tvirtualLight.shadowCameraTop = light.shadowCameraTop;\r\n\r\n\t\tvirtualLight.shadowCameraVisible = light.shadowCameraVisible;\r\n\r\n\t\tvirtualLight.shadowDarkness = light.shadowDarkness;\r\n\r\n\t\tvirtualLight.shadowBias = light.shadowCascadeBias[ cascade ];\r\n\t\tvirtualLight.shadowMapWidth = light.shadowCascadeWidth[ cascade ];\r\n\t\tvirtualLight.shadowMapHeight = light.shadowCascadeHeight[ cascade ];\r\n\r\n\t\tvirtualLight.pointsWorld = [];\r\n\t\tvirtualLight.pointsFrustum = [];\r\n\r\n\t\tvar pointsWorld = virtualLight.pointsWorld,\r\n\t\t\tpointsFrustum = virtualLight.pointsFrustum;\r\n\r\n\t\tfor ( var i = 0; i < 8; i ++ ) {\r\n\r\n\t\t\tpointsWorld[ i ] = new THREE.Vector3();\r\n\t\t\tpointsFrustum[ i ] = new THREE.Vector3();\r\n\r\n\t\t}\r\n\r\n\t\tvar nearZ = light.shadowCascadeNearZ[ cascade ];\r\n\t\tvar farZ = light.shadowCascadeFarZ[ cascade ];\r\n\r\n\t\tpointsFrustum[ 0 ].set( - 1, - 1, nearZ );\r\n\t\tpointsFrustum[ 1 ].set( 1, - 1, nearZ );\r\n\t\tpointsFrustum[ 2 ].set( - 1, 1, nearZ );\r\n\t\tpointsFrustum[ 3 ].set( 1, 1, nearZ );\r\n\r\n\t\tpointsFrustum[ 4 ].set( - 1, - 1, farZ );\r\n\t\tpointsFrustum[ 5 ].set( 1, - 1, farZ );\r\n\t\tpointsFrustum[ 6 ].set( - 1, 1, farZ );\r\n\t\tpointsFrustum[ 7 ].set( 1, 1, farZ );\r\n\r\n\t\treturn virtualLight;\r\n\r\n\t}\r\n\r\n\t// Synchronize virtual light with the original light\r\n\r\n\tfunction updateVirtualLight( light, cascade ) {\r\n\r\n\t\tvar virtualLight = light.shadowCascadeArray[ cascade ];\r\n\r\n\t\tvirtualLight.position.copy( light.position );\r\n\t\tvirtualLight.target.position.copy( light.target.position );\r\n\t\tvirtualLight.lookAt( virtualLight.target );\r\n\r\n\t\tvirtualLight.shadowCameraVisible = light.shadowCameraVisible;\r\n\t\tvirtualLight.shadowDarkness = light.shadowDarkness;\r\n\r\n\t\tvirtualLight.shadowBias = light.shadowCascadeBias[ cascade ];\r\n\r\n\t\tvar nearZ = light.shadowCascadeNearZ[ cascade ];\r\n\t\tvar farZ = light.shadowCascadeFarZ[ cascade ];\r\n\r\n\t\tvar pointsFrustum = virtualLight.pointsFrustum;\r\n\r\n\t\tpointsFrustum[ 0 ].z = nearZ;\r\n\t\tpointsFrustum[ 1 ].z = nearZ;\r\n\t\tpointsFrustum[ 2 ].z = nearZ;\r\n\t\tpointsFrustum[ 3 ].z = nearZ;\r\n\r\n\t\tpointsFrustum[ 4 ].z = farZ;\r\n\t\tpointsFrustum[ 5 ].z = farZ;\r\n\t\tpointsFrustum[ 6 ].z = farZ;\r\n\t\tpointsFrustum[ 7 ].z = farZ;\r\n\r\n\t}\r\n\r\n\t// Fit shadow camera's ortho frustum to camera frustum\r\n\r\n\tfunction updateShadowCamera( camera, light ) {\r\n\r\n\t\tvar shadowCamera = light.shadowCamera,\r\n\t\t\tpointsFrustum = light.pointsFrustum,\r\n\t\t\tpointsWorld = light.pointsWorld;\r\n\r\n\t\t_min.set( Infinity, Infinity, Infinity );\r\n\t\t_max.set( - Infinity, - Infinity, - Infinity );\r\n\r\n\t\tfor ( var i = 0; i < 8; i ++ ) {\r\n\r\n\t\t\tvar p = pointsWorld[ i ];\r\n\r\n\t\t\tp.copy( pointsFrustum[ i ] );\r\n\t\t\tp.unproject( camera );\r\n\r\n\t\t\tp.applyMatrix4( shadowCamera.matrixWorldInverse );\r\n\r\n\t\t\tif ( p.x < _min.x ) _min.x = p.x;\r\n\t\t\tif ( p.x > _max.x ) _max.x = p.x;\r\n\r\n\t\t\tif ( p.y < _min.y ) _min.y = p.y;\r\n\t\t\tif ( p.y > _max.y ) _max.y = p.y;\r\n\r\n\t\t\tif ( p.z < _min.z ) _min.z = p.z;\r\n\t\t\tif ( p.z > _max.z ) _max.z = p.z;\r\n\r\n\t\t}\r\n\r\n\t\tshadowCamera.left = _min.x;\r\n\t\tshadowCamera.right = _max.x;\r\n\t\tshadowCamera.top = _max.y;\r\n\t\tshadowCamera.bottom = _min.y;\r\n\r\n\t\t// can't really fit near/far\r\n\t\t//shadowCamera.near = _min.z;\r\n\t\t//shadowCamera.far = _max.z;\r\n\r\n\t\tshadowCamera.updateProjectionMatrix();\r\n\r\n\t}\r\n\r\n\t// For the moment just ignore objects that have multiple materials with different animation methods\r\n\t// Only the first material will be taken into account for deciding which depth material to use for shadow maps\r\n\r\n\tfunction getObjectMaterial( object ) {\r\n\r\n\t\treturn object.material instanceof THREE.MeshFaceMaterial\r\n\t\t\t? object.material.materials[ 0 ]\r\n\t\t\t: object.material;\r\n\r\n\t};\r\n\r\n};\r\n\r\n// File:src/renderers/webgl/plugins/SpritePlugin.js\r\n\r\n/**\r\n * @author mikael emtinger / http://gomo.se/\r\n * @author alteredq / http://alteredqualia.com/\r\n */\r\n\r\nTHREE.SpritePlugin = function ( renderer, sprites ) {\r\n\r\n\tvar gl = renderer.context;\r\n\r\n\tvar vertexBuffer, elementBuffer;\r\n\tvar program, attributes, uniforms;\r\n\r\n\tvar texture;\r\n\r\n\t// decompose matrixWorld\r\n\r\n\tvar spritePosition = new THREE.Vector3();\r\n\tvar spriteRotation = new THREE.Quaternion();\r\n\tvar spriteScale = new THREE.Vector3();\r\n\r\n\tvar init = function () {\r\n\r\n\t\tvar vertices = new Float32Array( [\r\n\t\t\t- 0.5, - 0.5, 0, 0,\r\n\t\t\t 0.5, - 0.5, 1, 0,\r\n\t\t\t 0.5, 0.5, 1, 1,\r\n\t\t\t- 0.5, 0.5, 0, 1\r\n\t\t] );\r\n\r\n\t\tvar faces = new Uint16Array( [\r\n\t\t\t0, 1, 2,\r\n\t\t\t0, 2, 3\r\n\t\t] );\r\n\r\n\t\tvertexBuffer = gl.createBuffer();\r\n\t\telementBuffer = gl.createBuffer();\r\n\r\n\t\tgl.bindBuffer( gl.ARRAY_BUFFER, vertexBuffer );\r\n\t\tgl.bufferData( gl.ARRAY_BUFFER, vertices, gl.STATIC_DRAW );\r\n\r\n\t\tgl.bindBuffer( gl.ELEMENT_ARRAY_BUFFER, elementBuffer );\r\n\t\tgl.bufferData( gl.ELEMENT_ARRAY_BUFFER, faces, gl.STATIC_DRAW );\r\n\r\n\t\tprogram = createProgram();\r\n\r\n\t\tattributes = {\r\n\t\t\tposition:\t\t\tgl.getAttribLocation ( program, 'position' ),\r\n\t\t\tuv:\t\t\t\t\tgl.getAttribLocation ( program, 'uv' )\r\n\t\t};\r\n\r\n\t\tuniforms = {\r\n\t\t\tuvOffset:\t\t\tgl.getUniformLocation( program, 'uvOffset' ),\r\n\t\t\tuvScale:\t\t\tgl.getUniformLocation( program, 'uvScale' ),\r\n\r\n\t\t\trotation:\t\t\tgl.getUniformLocation( program, 'rotation' ),\r\n\t\t\tscale:\t\t\t\tgl.getUniformLocation( program, 'scale' ),\r\n\r\n\t\t\tcolor:\t\t\t\tgl.getUniformLocation( program, 'color' ),\r\n\t\t\tmap:\t\t\t\tgl.getUniformLocation( program, 'map' ),\r\n\t\t\topacity:\t\t\tgl.getUniformLocation( program, 'opacity' ),\r\n\r\n\t\t\tmodelViewMatrix: \tgl.getUniformLocation( program, 'modelViewMatrix' ),\r\n\t\t\tprojectionMatrix:\tgl.getUniformLocation( program, 'projectionMatrix' ),\r\n\r\n\t\t\tfogType:\t\t\tgl.getUniformLocation( program, 'fogType' ),\r\n\t\t\tfogDensity:\t\t\tgl.getUniformLocation( program, 'fogDensity' ),\r\n\t\t\tfogNear:\t\t\tgl.getUniformLocation( program, 'fogNear' ),\r\n\t\t\tfogFar:\t\t\t\tgl.getUniformLocation( program, 'fogFar' ),\r\n\t\t\tfogColor:\t\t\tgl.getUniformLocation( program, 'fogColor' ),\r\n\r\n\t\t\talphaTest:\t\t\tgl.getUniformLocation( program, 'alphaTest' )\r\n\t\t};\r\n\r\n\t\tvar canvas = document.createElement( 'canvas' );\r\n\t\tcanvas.width = 8;\r\n\t\tcanvas.height = 8;\r\n\r\n\t\tvar context = canvas.getContext( '2d' );\r\n\t\tcontext.fillStyle = 'white';\r\n\t\tcontext.fillRect( 0, 0, 8, 8 );\r\n\r\n\t\ttexture = new THREE.Texture( canvas );\r\n\t\ttexture.needsUpdate = true;\r\n\r\n\t};\r\n\r\n\tthis.render = function ( scene, camera ) {\r\n\r\n\t\tif ( sprites.length === 0 ) return;\r\n\r\n\t\t// setup gl\r\n\r\n\t\tif ( program === undefined ) {\r\n\r\n\t\t\tinit();\r\n\r\n\t\t}\r\n\r\n\t\tgl.useProgram( program );\r\n\r\n\t\tgl.enableVertexAttribArray( attributes.position );\r\n\t\tgl.enableVertexAttribArray( attributes.uv );\r\n\r\n\t\tgl.disable( gl.CULL_FACE );\r\n\t\tgl.enable( gl.BLEND );\r\n\r\n\t\tgl.bindBuffer( gl.ARRAY_BUFFER, vertexBuffer );\r\n\t\tgl.vertexAttribPointer( attributes.position, 2, gl.FLOAT, false, 2 * 8, 0 );\r\n\t\tgl.vertexAttribPointer( attributes.uv, 2, gl.FLOAT, false, 2 * 8, 8 );\r\n\r\n\t\tgl.bindBuffer( gl.ELEMENT_ARRAY_BUFFER, elementBuffer );\r\n\r\n\t\tgl.uniformMatrix4fv( uniforms.projectionMatrix, false, camera.projectionMatrix.elements );\r\n\r\n\t\tgl.activeTexture( gl.TEXTURE0 );\r\n\t\tgl.uniform1i( uniforms.map, 0 );\r\n\r\n\t\tvar oldFogType = 0;\r\n\t\tvar sceneFogType = 0;\r\n\t\tvar fog = scene.fog;\r\n\r\n\t\tif ( fog ) {\r\n\r\n\t\t\tgl.uniform3f( uniforms.fogColor, fog.color.r, fog.color.g, fog.color.b );\r\n\r\n\t\t\tif ( fog instanceof THREE.Fog ) {\r\n\r\n\t\t\t\tgl.uniform1f( uniforms.fogNear, fog.near );\r\n\t\t\t\tgl.uniform1f( uniforms.fogFar, fog.far );\r\n\r\n\t\t\t\tgl.uniform1i( uniforms.fogType, 1 );\r\n\t\t\t\toldFogType = 1;\r\n\t\t\t\tsceneFogType = 1;\r\n\r\n\t\t\t} else if ( fog instanceof THREE.FogExp2 ) {\r\n\r\n\t\t\t\tgl.uniform1f( uniforms.fogDensity, fog.density );\r\n\r\n\t\t\t\tgl.uniform1i( uniforms.fogType, 2 );\r\n\t\t\t\toldFogType = 2;\r\n\t\t\t\tsceneFogType = 2;\r\n\r\n\t\t\t}\r\n\r\n\t\t} else {\r\n\r\n\t\t\tgl.uniform1i( uniforms.fogType, 0 );\r\n\t\t\toldFogType = 0;\r\n\t\t\tsceneFogType = 0;\r\n\r\n\t\t}\r\n\r\n\r\n\t\t// update positions and sort\r\n\r\n\t\tfor ( var i = 0, l = sprites.length; i < l; i ++ ) {\r\n\r\n\t\t\tvar sprite = sprites[ i ];\r\n\r\n\t\t\tsprite._modelViewMatrix.multiplyMatrices( camera.matrixWorldInverse, sprite.matrixWorld );\r\n\t\t\tsprite.z = - sprite._modelViewMatrix.elements[ 14 ];\r\n\r\n\t\t}\r\n\r\n\t\tsprites.sort( painterSortStable );\r\n\r\n\t\t// render all sprites\r\n\r\n\t\tvar scale = [];\r\n\r\n\t\tfor ( var i = 0, l = sprites.length; i < l; i ++ ) {\r\n\r\n\t\t\tvar sprite = sprites[ i ];\r\n\t\t\tvar material = sprite.material;\r\n\r\n\t\t\tgl.uniform1f( uniforms.alphaTest, material.alphaTest );\r\n\t\t\tgl.uniformMatrix4fv( uniforms.modelViewMatrix, false, sprite._modelViewMatrix.elements );\r\n\r\n\t\t\tsprite.matrixWorld.decompose( spritePosition, spriteRotation, spriteScale );\r\n\r\n\t\t\tscale[ 0 ] = spriteScale.x;\r\n\t\t\tscale[ 1 ] = spriteScale.y;\r\n\r\n\t\t\tvar fogType = 0;\r\n\r\n\t\t\tif ( scene.fog && material.fog ) {\r\n\r\n\t\t\t\tfogType = sceneFogType;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( oldFogType !== fogType ) {\r\n\r\n\t\t\t\tgl.uniform1i( uniforms.fogType, fogType );\r\n\t\t\t\toldFogType = fogType;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( material.map !== null ) {\r\n\r\n\t\t\t\tgl.uniform2f( uniforms.uvOffset, material.map.offset.x, material.map.offset.y );\r\n\t\t\t\tgl.uniform2f( uniforms.uvScale, material.map.repeat.x, material.map.repeat.y );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tgl.uniform2f( uniforms.uvOffset, 0, 0 );\r\n\t\t\t\tgl.uniform2f( uniforms.uvScale, 1, 1 );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tgl.uniform1f( uniforms.opacity, material.opacity );\r\n\t\t\tgl.uniform3f( uniforms.color, material.color.r, material.color.g, material.color.b );\r\n\r\n\t\t\tgl.uniform1f( uniforms.rotation, material.rotation );\r\n\t\t\tgl.uniform2fv( uniforms.scale, scale );\r\n\r\n\t\t\trenderer.state.setBlending( material.blending, material.blendEquation, material.blendSrc, material.blendDst );\r\n\t\t\trenderer.state.setDepthTest( material.depthTest );\r\n\t\t\trenderer.state.setDepthWrite( material.depthWrite );\r\n\r\n\t\t\tif ( material.map && material.map.image && material.map.image.width ) {\r\n\r\n\t\t\t\trenderer.setTexture( material.map, 0 );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\trenderer.setTexture( texture, 0 );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tgl.drawElements( gl.TRIANGLES, 6, gl.UNSIGNED_SHORT, 0 );\r\n\r\n\t\t}\r\n\r\n\t\t// restore gl\r\n\r\n\t\tgl.enable( gl.CULL_FACE );\r\n\r\n\t\trenderer.resetGLState();\r\n\r\n\t};\r\n\r\n\tfunction createProgram () {\r\n\r\n\t\tvar program = gl.createProgram();\r\n\r\n\t\tvar vertexShader = gl.createShader( gl.VERTEX_SHADER );\r\n\t\tvar fragmentShader = gl.createShader( gl.FRAGMENT_SHADER );\r\n\r\n\t\tgl.shaderSource( vertexShader, [\r\n\r\n\t\t\t'precision ' + renderer.getPrecision() + ' float;',\r\n\r\n\t\t\t'uniform mat4 modelViewMatrix;',\r\n\t\t\t'uniform mat4 projectionMatrix;',\r\n\t\t\t'uniform float rotation;',\r\n\t\t\t'uniform vec2 scale;',\r\n\t\t\t'uniform vec2 uvOffset;',\r\n\t\t\t'uniform vec2 uvScale;',\r\n\r\n\t\t\t'attribute vec2 position;',\r\n\t\t\t'attribute vec2 uv;',\r\n\r\n\t\t\t'varying vec2 vUV;',\r\n\r\n\t\t\t'void main() {',\r\n\r\n\t\t\t\t'vUV = uvOffset + uv * uvScale;',\r\n\r\n\t\t\t\t'vec2 alignedPosition = position * scale;',\r\n\r\n\t\t\t\t'vec2 rotatedPosition;',\r\n\t\t\t\t'rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;',\r\n\t\t\t\t'rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;',\r\n\r\n\t\t\t\t'vec4 finalPosition;',\r\n\r\n\t\t\t\t'finalPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );',\r\n\t\t\t\t'finalPosition.xy += rotatedPosition;',\r\n\t\t\t\t'finalPosition = projectionMatrix * finalPosition;',\r\n\r\n\t\t\t\t'gl_Position = finalPosition;',\r\n\r\n\t\t\t'}'\r\n\r\n\t\t].join( '\\n' ) );\r\n\r\n\t\tgl.shaderSource( fragmentShader, [\r\n\r\n\t\t\t'precision ' + renderer.getPrecision() + ' float;',\r\n\r\n\t\t\t'uniform vec3 color;',\r\n\t\t\t'uniform sampler2D map;',\r\n\t\t\t'uniform float opacity;',\r\n\r\n\t\t\t'uniform int fogType;',\r\n\t\t\t'uniform vec3 fogColor;',\r\n\t\t\t'uniform float fogDensity;',\r\n\t\t\t'uniform float fogNear;',\r\n\t\t\t'uniform float fogFar;',\r\n\t\t\t'uniform float alphaTest;',\r\n\r\n\t\t\t'varying vec2 vUV;',\r\n\r\n\t\t\t'void main() {',\r\n\r\n\t\t\t\t'vec4 texture = texture2D( map, vUV );',\r\n\r\n\t\t\t\t'if ( texture.a < alphaTest ) discard;',\r\n\r\n\t\t\t\t'gl_FragColor = vec4( color * texture.xyz, texture.a * opacity );',\r\n\r\n\t\t\t\t'if ( fogType > 0 ) {',\r\n\r\n\t\t\t\t\t'float depth = gl_FragCoord.z / gl_FragCoord.w;',\r\n\t\t\t\t\t'float fogFactor = 0.0;',\r\n\r\n\t\t\t\t\t'if ( fogType == 1 ) {',\r\n\r\n\t\t\t\t\t\t'fogFactor = smoothstep( fogNear, fogFar, depth );',\r\n\r\n\t\t\t\t\t'} else {',\r\n\r\n\t\t\t\t\t\t'const float LOG2 = 1.442695;',\r\n\t\t\t\t\t\t'float fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );',\r\n\t\t\t\t\t\t'fogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );',\r\n\r\n\t\t\t\t\t'}',\r\n\r\n\t\t\t\t\t'gl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );',\r\n\r\n\t\t\t\t'}',\r\n\r\n\t\t\t'}'\r\n\r\n\t\t].join( '\\n' ) );\r\n\r\n\t\tgl.compileShader( vertexShader );\r\n\t\tgl.compileShader( fragmentShader );\r\n\r\n\t\tgl.attachShader( program, vertexShader );\r\n\t\tgl.attachShader( program, fragmentShader );\r\n\r\n\t\tgl.linkProgram( program );\r\n\r\n\t\treturn program;\r\n\r\n\t};\r\n\r\n\tfunction painterSortStable ( a, b ) {\r\n\r\n\t\tif ( a.z !== b.z ) {\r\n\r\n\t\t\treturn b.z - a.z;\r\n\r\n\t\t} else {\r\n\r\n\t\t\treturn b.id - a.id;\r\n\r\n\t\t}\r\n\r\n\t};\r\n\r\n};\r\n\r\n// File:src/extras/GeometryUtils.js\r\n\r\n/**\r\n * @author mrdoob / http://mrdoob.com/\r\n */\r\n\r\nTHREE.GeometryUtils = {\r\n\r\n\tmerge: function ( geometry1, geometry2, materialIndexOffset ) {\r\n\r\n\t\tTHREE.warn( 'THREE.GeometryUtils: .merge() has been moved to Geometry. Use geometry.merge( geometry2, matrix, materialIndexOffset ) instead.' );\r\n\r\n\t\tvar matrix;\r\n\r\n\t\tif ( geometry2 instanceof THREE.Mesh ) {\r\n\r\n\t\t\tgeometry2.matrixAutoUpdate && geometry2.updateMatrix();\r\n\r\n\t\t\tmatrix = geometry2.matrix;\r\n\t\t\tgeometry2 = geometry2.geometry;\r\n\r\n\t\t}\r\n\r\n\t\tgeometry1.merge( geometry2, matrix, materialIndexOffset );\r\n\r\n\t},\r\n\r\n\tcenter: function ( geometry ) {\r\n\r\n\t\tTHREE.warn( 'THREE.GeometryUtils: .center() has been moved to Geometry. Use geometry.center() instead.' );\r\n\t\treturn geometry.center();\r\n\r\n\t}\r\n\r\n};\r\n\r\n// File:src/extras/ImageUtils.js\r\n\r\n/**\r\n * @author alteredq / http://alteredqualia.com/\r\n * @author mrdoob / http://mrdoob.com/\r\n * @author Daosheng Mu / https://github.com/DaoshengMu/\r\n */\r\n\r\nTHREE.ImageUtils = {\r\n\r\n\tcrossOrigin: undefined,\r\n\r\n\tloadTexture: function ( url, mapping, onLoad, onError ) {\r\n\r\n\t\tvar loader = new THREE.ImageLoader();\r\n\t\tloader.crossOrigin = this.crossOrigin;\r\n\r\n\t\tvar texture = new THREE.Texture( undefined, mapping );\r\n\r\n\t\tloader.load( url, function ( image ) {\r\n\r\n\t\t\ttexture.image = image;\r\n\t\t\ttexture.needsUpdate = true;\r\n\r\n\t\t\tif ( onLoad ) onLoad( texture );\r\n\r\n\t\t}, undefined, function ( event ) {\r\n\r\n\t\t\tif ( onError ) onError( event );\r\n\r\n\t\t} );\r\n\r\n\t\ttexture.sourceFile = url;\r\n\r\n\t\treturn texture;\r\n\r\n\t},\r\n\r\n\tloadTextureCube: function ( array, mapping, onLoad, onError ) {\r\n\r\n\t\tvar images = [];\r\n\r\n\t\tvar loader = new THREE.ImageLoader();\r\n\t\tloader.crossOrigin = this.crossOrigin;\r\n\r\n\t\tvar texture = new THREE.CubeTexture( images, mapping );\r\n\r\n\t\t// no flipping needed for cube textures\r\n\r\n\t\ttexture.flipY = false;\r\n\r\n\t\tvar loaded = 0;\r\n\r\n\t\tvar loadTexture = function ( i ) {\r\n\r\n\t\t\tloader.load( array[ i ], function ( image ) {\r\n\r\n\t\t\t\ttexture.images[ i ] = image;\r\n\r\n\t\t\t\tloaded += 1;\r\n\r\n\t\t\t\tif ( loaded === 6 ) {\r\n\r\n\t\t\t\t\ttexture.needsUpdate = true;\r\n\r\n\t\t\t\t\tif ( onLoad ) onLoad( texture );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}, undefined, onError );\r\n\r\n\t\t}\r\n\r\n\t\tfor ( var i = 0, il = array.length; i < il; ++ i ) {\r\n\r\n\t\t\tloadTexture( i );\r\n\r\n\t\t}\r\n\r\n\t\treturn texture;\r\n\r\n\t},\r\n\r\n\tloadCompressedTexture: function () {\r\n\r\n\t\tTHREE.error( 'THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.' )\r\n\r\n\t},\r\n\r\n\tloadCompressedTextureCube: function () {\r\n\r\n\t\tTHREE.error( 'THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead.' )\r\n\r\n\t},\r\n\r\n\tgetNormalMap: function ( image, depth ) {\r\n\r\n\t\t// Adapted from http://www.paulbrunt.co.uk/lab/heightnormal/\r\n\r\n\t\tvar cross = function ( a, b ) {\r\n\r\n\t\t\treturn [ a[ 1 ] * b[ 2 ] - a[ 2 ] * b[ 1 ], a[ 2 ] * b[ 0 ] - a[ 0 ] * b[ 2 ], a[ 0 ] * b[ 1 ] - a[ 1 ] * b[ 0 ] ];\r\n\r\n\t\t}\r\n\r\n\t\tvar subtract = function ( a, b ) {\r\n\r\n\t\t\treturn [ a[ 0 ] - b[ 0 ], a[ 1 ] - b[ 1 ], a[ 2 ] - b[ 2 ] ];\r\n\r\n\t\t}\r\n\r\n\t\tvar normalize = function ( a ) {\r\n\r\n\t\t\tvar l = Math.sqrt( a[ 0 ] * a[ 0 ] + a[ 1 ] * a[ 1 ] + a[ 2 ] * a[ 2 ] );\r\n\t\t\treturn [ a[ 0 ] / l, a[ 1 ] / l, a[ 2 ] / l ];\r\n\r\n\t\t}\r\n\r\n\t\tdepth = depth | 1;\r\n\r\n\t\tvar width = image.width;\r\n\t\tvar height = image.height;\r\n\r\n\t\tvar canvas = document.createElement( 'canvas' );\r\n\t\tcanvas.width = width;\r\n\t\tcanvas.height = height;\r\n\r\n\t\tvar context = canvas.getContext( '2d' );\r\n\t\tcontext.drawImage( image, 0, 0 );\r\n\r\n\t\tvar data = context.getImageData( 0, 0, width, height ).data;\r\n\t\tvar imageData = context.createImageData( width, height );\r\n\t\tvar output = imageData.data;\r\n\r\n\t\tfor ( var x = 0; x < width; x ++ ) {\r\n\r\n\t\t\tfor ( var y = 0; y < height; y ++ ) {\r\n\r\n\t\t\t\tvar ly = y - 1 < 0 ? 0 : y - 1;\r\n\t\t\t\tvar uy = y + 1 > height - 1 ? height - 1 : y + 1;\r\n\t\t\t\tvar lx = x - 1 < 0 ? 0 : x - 1;\r\n\t\t\t\tvar ux = x + 1 > width - 1 ? width - 1 : x + 1;\r\n\r\n\t\t\t\tvar points = [];\r\n\t\t\t\tvar origin = [ 0, 0, data[ ( y * width + x ) * 4 ] / 255 * depth ];\r\n\t\t\t\tpoints.push( [ - 1, 0, data[ ( y * width + lx ) * 4 ] / 255 * depth ] );\r\n\t\t\t\tpoints.push( [ - 1, - 1, data[ ( ly * width + lx ) * 4 ] / 255 * depth ] );\r\n\t\t\t\tpoints.push( [ 0, - 1, data[ ( ly * width + x ) * 4 ] / 255 * depth ] );\r\n\t\t\t\tpoints.push( [ 1, - 1, data[ ( ly * width + ux ) * 4 ] / 255 * depth ] );\r\n\t\t\t\tpoints.push( [ 1, 0, data[ ( y * width + ux ) * 4 ] / 255 * depth ] );\r\n\t\t\t\tpoints.push( [ 1, 1, data[ ( uy * width + ux ) * 4 ] / 255 * depth ] );\r\n\t\t\t\tpoints.push( [ 0, 1, data[ ( uy * width + x ) * 4 ] / 255 * depth ] );\r\n\t\t\t\tpoints.push( [ - 1, 1, data[ ( uy * width + lx ) * 4 ] / 255 * depth ] );\r\n\r\n\t\t\t\tvar normals = [];\r\n\t\t\t\tvar num_points = points.length;\r\n\r\n\t\t\t\tfor ( var i = 0; i < num_points; i ++ ) {\r\n\r\n\t\t\t\t\tvar v1 = points[ i ];\r\n\t\t\t\t\tvar v2 = points[ ( i + 1 ) % num_points ];\r\n\t\t\t\t\tv1 = subtract( v1, origin );\r\n\t\t\t\t\tv2 = subtract( v2, origin );\r\n\t\t\t\t\tnormals.push( normalize( cross( v1, v2 ) ) );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tvar normal = [ 0, 0, 0 ];\r\n\r\n\t\t\t\tfor ( var i = 0; i < normals.length; i ++ ) {\r\n\r\n\t\t\t\t\tnormal[ 0 ] += normals[ i ][ 0 ];\r\n\t\t\t\t\tnormal[ 1 ] += normals[ i ][ 1 ];\r\n\t\t\t\t\tnormal[ 2 ] += normals[ i ][ 2 ];\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tnormal[ 0 ] /= normals.length;\r\n\t\t\t\tnormal[ 1 ] /= normals.length;\r\n\t\t\t\tnormal[ 2 ] /= normals.length;\r\n\r\n\t\t\t\tvar idx = ( y * width + x ) * 4;\r\n\r\n\t\t\t\toutput[ idx ] = ( ( normal[ 0 ] + 1.0 ) / 2.0 * 255 ) | 0;\r\n\t\t\t\toutput[ idx + 1 ] = ( ( normal[ 1 ] + 1.0 ) / 2.0 * 255 ) | 0;\r\n\t\t\t\toutput[ idx + 2 ] = ( normal[ 2 ] * 255 ) | 0;\r\n\t\t\t\toutput[ idx + 3 ] = 255;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tcontext.putImageData( imageData, 0, 0 );\r\n\r\n\t\treturn canvas;\r\n\r\n\t},\r\n\r\n\tgenerateDataTexture: function ( width, height, color ) {\r\n\r\n\t\tvar size = width * height;\r\n\t\tvar data = new Uint8Array( 3 * size );\r\n\r\n\t\tvar r = Math.floor( color.r * 255 );\r\n\t\tvar g = Math.floor( color.g * 255 );\r\n\t\tvar b = Math.floor( color.b * 255 );\r\n\r\n\t\tfor ( var i = 0; i < size; i ++ ) {\r\n\r\n\t\t\tdata[ i * 3 ] \t = r;\r\n\t\t\tdata[ i * 3 + 1 ] = g;\r\n\t\t\tdata[ i * 3 + 2 ] = b;\r\n\r\n\t\t}\r\n\r\n\t\tvar texture = new THREE.DataTexture( data, width, height, THREE.RGBFormat );\r\n\t\ttexture.needsUpdate = true;\r\n\r\n\t\treturn texture;\r\n\r\n\t}\r\n\r\n};\r\n\r\n// File:src/extras/SceneUtils.js\r\n\r\n/**\r\n * @author alteredq / http://alteredqualia.com/\r\n */\r\n\r\nTHREE.SceneUtils = {\r\n\r\n\tcreateMultiMaterialObject: function ( geometry, materials ) {\r\n\r\n\t\tvar group = new THREE.Object3D();\r\n\r\n\t\tfor ( var i = 0, l = materials.length; i < l; i ++ ) {\r\n\r\n\t\t\tgroup.add( new THREE.Mesh( geometry, materials[ i ] ) );\r\n\r\n\t\t}\r\n\r\n\t\treturn group;\r\n\r\n\t},\r\n\r\n\tdetach: function ( child, parent, scene ) {\r\n\r\n\t\tchild.applyMatrix( parent.matrixWorld );\r\n\t\tparent.remove( child );\r\n\t\tscene.add( child );\r\n\r\n\t},\r\n\r\n\tattach: function ( child, scene, parent ) {\r\n\r\n\t\tvar matrixWorldInverse = new THREE.Matrix4();\r\n\t\tmatrixWorldInverse.getInverse( parent.matrixWorld );\r\n\t\tchild.applyMatrix( matrixWorldInverse );\r\n\r\n\t\tscene.remove( child );\r\n\t\tparent.add( child );\r\n\r\n\t}\r\n\r\n};\r\n\r\n// File:src/extras/FontUtils.js\r\n\r\n/**\r\n * @author zz85 / http://www.lab4games.net/zz85/blog\r\n * @author alteredq / http://alteredqualia.com/\r\n *\r\n * For Text operations in three.js (See TextGeometry)\r\n *\r\n * It uses techniques used in:\r\n *\r\n * \ttypeface.js and canvastext\r\n * \t\tFor converting fonts and rendering with javascript\r\n *\t\thttp://typeface.neocracy.org\r\n *\r\n *\tTriangulation ported from AS3\r\n *\t\tSimple Polygon Triangulation\r\n *\t\thttp://actionsnippet.com/?p=1462\r\n *\r\n * \tA Method to triangulate shapes with holes\r\n *\t\thttp://www.sakri.net/blog/2009/06/12/an-approach-to-triangulating-polygons-with-holes/\r\n *\r\n */\r\n\r\nTHREE.FontUtils = {\r\n\r\n\tfaces: {},\r\n\r\n\t// Just for now. face[weight][style]\r\n\r\n\tface: 'helvetiker',\r\n\tweight: 'normal',\r\n\tstyle: 'normal',\r\n\tsize: 150,\r\n\tdivisions: 10,\r\n\r\n\tgetFace: function () {\r\n\r\n\t\ttry {\r\n\r\n\t\t\treturn this.faces[ this.face ][ this.weight ][ this.style ];\r\n\r\n\t\t} catch (e) {\r\n\r\n\t\t\tthrow \"The font \" + this.face + \" with \" + this.weight + \" weight and \" + this.style + \" style is missing.\"\r\n\r\n\t\t};\r\n\r\n\t},\r\n\r\n\tloadFace: function ( data ) {\r\n\r\n\t\tvar family = data.familyName.toLowerCase();\r\n\r\n\t\tvar ThreeFont = this;\r\n\r\n\t\tThreeFont.faces[ family ] = ThreeFont.faces[ family ] || {};\r\n\r\n\t\tThreeFont.faces[ family ][ data.cssFontWeight ] = ThreeFont.faces[ family ][ data.cssFontWeight ] || {};\r\n\t\tThreeFont.faces[ family ][ data.cssFontWeight ][ data.cssFontStyle ] = data;\r\n\r\n\t\tThreeFont.faces[ family ][ data.cssFontWeight ][ data.cssFontStyle ] = data;\r\n\r\n\t\treturn data;\r\n\r\n\t},\r\n\r\n\tdrawText: function ( text ) {\r\n\r\n\t\t// RenderText\r\n\r\n\t\tvar i,\r\n\t\t\tface = this.getFace(),\r\n\t\t\tscale = this.size / face.resolution,\r\n\t\t\toffset = 0,\r\n\t\t\tchars = String( text ).split( '' ),\r\n\t\t\tlength = chars.length;\r\n\r\n\t\tvar fontPaths = [];\r\n\r\n\t\tfor ( i = 0; i < length; i ++ ) {\r\n\r\n\t\t\tvar path = new THREE.Path();\r\n\r\n\t\t\tvar ret = this.extractGlyphPoints( chars[ i ], face, scale, offset, path );\r\n\t\t\toffset += ret.offset;\r\n\r\n\t\t\tfontPaths.push( ret.path );\r\n\r\n\t\t}\r\n\r\n\t\t// get the width\r\n\r\n\t\tvar width = offset / 2;\r\n\t\t//\r\n\t\t// for ( p = 0; p < allPts.length; p++ ) {\r\n\t\t//\r\n\t\t// \tallPts[ p ].x -= width;\r\n\t\t//\r\n\t\t// }\r\n\r\n\t\t//var extract = this.extractPoints( allPts, characterPts );\r\n\t\t//extract.contour = allPts;\r\n\r\n\t\t//extract.paths = fontPaths;\r\n\t\t//extract.offset = width;\r\n\r\n\t\treturn { paths: fontPaths, offset: width };\r\n\r\n\t},\r\n\r\n\r\n\r\n\r\n\textractGlyphPoints: function ( c, face, scale, offset, path ) {\r\n\r\n\t\tvar pts = [];\r\n\r\n\t\tvar i, i2, divisions,\r\n\t\t\toutline, action, length,\r\n\t\t\tscaleX, scaleY,\r\n\t\t\tx, y, cpx, cpy, cpx0, cpy0, cpx1, cpy1, cpx2, cpy2,\r\n\t\t\tlaste,\r\n\t\t\tglyph = face.glyphs[ c ] || face.glyphs[ '?' ];\r\n\r\n\t\tif ( ! glyph ) return;\r\n\r\n\t\tif ( glyph.o ) {\r\n\r\n\t\t\toutline = glyph._cachedOutline || ( glyph._cachedOutline = glyph.o.split( ' ' ) );\r\n\t\t\tlength = outline.length;\r\n\r\n\t\t\tscaleX = scale;\r\n\t\t\tscaleY = scale;\r\n\r\n\t\t\tfor ( i = 0; i < length; ) {\r\n\r\n\t\t\t\taction = outline[ i ++ ];\r\n\r\n\t\t\t\t//console.log( action );\r\n\r\n\t\t\t\tswitch ( action ) {\r\n\r\n\t\t\t\tcase 'm':\r\n\r\n\t\t\t\t\t// Move To\r\n\r\n\t\t\t\t\tx = outline[ i ++ ] * scaleX + offset;\r\n\t\t\t\t\ty = outline[ i ++ ] * scaleY;\r\n\r\n\t\t\t\t\tpath.moveTo( x, y );\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase 'l':\r\n\r\n\t\t\t\t\t// Line To\r\n\r\n\t\t\t\t\tx = outline[ i ++ ] * scaleX + offset;\r\n\t\t\t\t\ty = outline[ i ++ ] * scaleY;\r\n\t\t\t\t\tpath.lineTo( x, y );\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase 'q':\r\n\r\n\t\t\t\t\t// QuadraticCurveTo\r\n\r\n\t\t\t\t\tcpx = outline[ i ++ ] * scaleX + offset;\r\n\t\t\t\t\tcpy = outline[ i ++ ] * scaleY;\r\n\t\t\t\t\tcpx1 = outline[ i ++ ] * scaleX + offset;\r\n\t\t\t\t\tcpy1 = outline[ i ++ ] * scaleY;\r\n\r\n\t\t\t\t\tpath.quadraticCurveTo( cpx1, cpy1, cpx, cpy );\r\n\r\n\t\t\t\t\tlaste = pts[ pts.length - 1 ];\r\n\r\n\t\t\t\t\tif ( laste ) {\r\n\r\n\t\t\t\t\t\tcpx0 = laste.x;\r\n\t\t\t\t\t\tcpy0 = laste.y;\r\n\r\n\t\t\t\t\t\tfor ( i2 = 1, divisions = this.divisions; i2 <= divisions; i2 ++ ) {\r\n\r\n\t\t\t\t\t\t\tvar t = i2 / divisions;\r\n\t\t\t\t\t\t\tTHREE.Shape.Utils.b2( t, cpx0, cpx1, cpx );\r\n\t\t\t\t\t\t\tTHREE.Shape.Utils.b2( t, cpy0, cpy1, cpy );\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase 'b':\r\n\r\n\t\t\t\t\t// Cubic Bezier Curve\r\n\r\n\t\t\t\t\tcpx = outline[ i ++ ] * scaleX + offset;\r\n\t\t\t\t\tcpy = outline[ i ++ ] * scaleY;\r\n\t\t\t\t\tcpx1 = outline[ i ++ ] * scaleX + offset;\r\n\t\t\t\t\tcpy1 = outline[ i ++ ] * scaleY;\r\n\t\t\t\t\tcpx2 = outline[ i ++ ] * scaleX + offset;\r\n\t\t\t\t\tcpy2 = outline[ i ++ ] * scaleY;\r\n\r\n\t\t\t\t\tpath.bezierCurveTo( cpx1, cpy1, cpx2, cpy2, cpx, cpy );\r\n\r\n\t\t\t\t\tlaste = pts[ pts.length - 1 ];\r\n\r\n\t\t\t\t\tif ( laste ) {\r\n\r\n\t\t\t\t\t\tcpx0 = laste.x;\r\n\t\t\t\t\t\tcpy0 = laste.y;\r\n\r\n\t\t\t\t\t\tfor ( i2 = 1, divisions = this.divisions; i2 <= divisions; i2 ++ ) {\r\n\r\n\t\t\t\t\t\t\tvar t = i2 / divisions;\r\n\t\t\t\t\t\t\tTHREE.Shape.Utils.b3( t, cpx0, cpx1, cpx2, cpx );\r\n\t\t\t\t\t\t\tTHREE.Shape.Utils.b3( t, cpy0, cpy1, cpy2, cpy );\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\t\t}\r\n\r\n\r\n\r\n\t\treturn { offset: glyph.ha * scale, path:path };\r\n\t}\r\n\r\n};\r\n\r\n\r\nTHREE.FontUtils.generateShapes = function ( text, parameters ) {\r\n\r\n\t// Parameters \r\n\r\n\tparameters = parameters || {};\r\n\r\n\tvar size = parameters.size !== undefined ? parameters.size : 100;\r\n\tvar curveSegments = parameters.curveSegments !== undefined ? parameters.curveSegments : 4;\r\n\r\n\tvar font = parameters.font !== undefined ? parameters.font : 'helvetiker';\r\n\tvar weight = parameters.weight !== undefined ? parameters.weight : 'normal';\r\n\tvar style = parameters.style !== undefined ? parameters.style : 'normal';\r\n\r\n\tTHREE.FontUtils.size = size;\r\n\tTHREE.FontUtils.divisions = curveSegments;\r\n\r\n\tTHREE.FontUtils.face = font;\r\n\tTHREE.FontUtils.weight = weight;\r\n\tTHREE.FontUtils.style = style;\r\n\r\n\t// Get a Font data json object\r\n\r\n\tvar data = THREE.FontUtils.drawText( text );\r\n\r\n\tvar paths = data.paths;\r\n\tvar shapes = [];\r\n\r\n\tfor ( var p = 0, pl = paths.length; p < pl; p ++ ) {\r\n\r\n\t\tArray.prototype.push.apply( shapes, paths[ p ].toShapes() );\r\n\r\n\t}\r\n\r\n\treturn shapes;\r\n\r\n};\r\n\r\n\r\n/**\r\n * This code is a quick port of code written in C++ which was submitted to\r\n * flipcode.com by John W. Ratcliff // July 22, 2000\r\n * See original code and more information here:\r\n * http://www.flipcode.com/archives/Efficient_Polygon_Triangulation.shtml\r\n *\r\n * ported to actionscript by Zevan Rosser\r\n * www.actionsnippet.com\r\n *\r\n * ported to javascript by Joshua Koo\r\n * http://www.lab4games.net/zz85/blog\r\n *\r\n */\r\n\r\n\r\n( function ( namespace ) {\r\n\r\n\tvar EPSILON = 0.0000000001;\r\n\r\n\t// takes in an contour array and returns\r\n\r\n\tvar process = function ( contour, indices ) {\r\n\r\n\t\tvar n = contour.length;\r\n\r\n\t\tif ( n < 3 ) return null;\r\n\r\n\t\tvar result = [],\r\n\t\t\tverts = [],\r\n\t\t\tvertIndices = [];\r\n\r\n\t\t/* we want a counter-clockwise polygon in verts */\r\n\r\n\t\tvar u, v, w;\r\n\r\n\t\tif ( area( contour ) > 0.0 ) {\r\n\r\n\t\t\tfor ( v = 0; v < n; v ++ ) verts[ v ] = v;\r\n\r\n\t\t} else {\r\n\r\n\t\t\tfor ( v = 0; v < n; v ++ ) verts[ v ] = ( n - 1 ) - v;\r\n\r\n\t\t}\r\n\r\n\t\tvar nv = n;\r\n\r\n\t\t/* remove nv - 2 vertices, creating 1 triangle every time */\r\n\r\n\t\tvar count = 2 * nv; /* error detection */\r\n\r\n\t\tfor ( v = nv - 1; nv > 2; ) {\r\n\r\n\t\t\t/* if we loop, it is probably a non-simple polygon */\r\n\r\n\t\t\tif ( ( count -- ) <= 0 ) {\r\n\r\n\t\t\t\t//** Triangulate: ERROR - probable bad polygon!\r\n\r\n\t\t\t\t//throw ( \"Warning, unable to triangulate polygon!\" );\r\n\t\t\t\t//return null;\r\n\t\t\t\t// Sometimes warning is fine, especially polygons are triangulated in reverse.\r\n\t\t\t\tTHREE.warn( 'THREE.FontUtils: Warning, unable to triangulate polygon! in Triangulate.process()' );\r\n\r\n\t\t\t\tif ( indices ) return vertIndices;\r\n\t\t\t\treturn result;\r\n\r\n\t\t\t}\r\n\r\n\t\t\t/* three consecutive vertices in current polygon, */\r\n\r\n\t\t\tu = v; \t \tif ( nv <= u ) u = 0; /* previous */\r\n\t\t\tv = u + 1; if ( nv <= v ) v = 0; /* new v */\r\n\t\t\tw = v + 1; if ( nv <= w ) w = 0; /* next */\r\n\r\n\t\t\tif ( snip( contour, u, v, w, nv, verts ) ) {\r\n\r\n\t\t\t\tvar a, b, c, s, t;\r\n\r\n\t\t\t\t/* true names of the vertices */\r\n\r\n\t\t\t\ta = verts[ u ];\r\n\t\t\t\tb = verts[ v ];\r\n\t\t\t\tc = verts[ w ];\r\n\r\n\t\t\t\t/* output Triangle */\r\n\r\n\t\t\t\tresult.push( [ contour[ a ],\r\n\t\t\t\t\tcontour[ b ],\r\n\t\t\t\t\tcontour[ c ] ] );\r\n\r\n\r\n\t\t\t\tvertIndices.push( [ verts[ u ], verts[ v ], verts[ w ] ] );\r\n\r\n\t\t\t\t/* remove v from the remaining polygon */\r\n\r\n\t\t\t\tfor ( s = v, t = v + 1; t < nv; s ++, t ++ ) {\r\n\r\n\t\t\t\t\tverts[ s ] = verts[ t ];\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tnv --;\r\n\r\n\t\t\t\t/* reset error detection counter */\r\n\r\n\t\t\t\tcount = 2 * nv;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tif ( indices ) return vertIndices;\r\n\t\treturn result;\r\n\r\n\t};\r\n\r\n\t// calculate area of the contour polygon\r\n\r\n\tvar area = function ( contour ) {\r\n\r\n\t\tvar n = contour.length;\r\n\t\tvar a = 0.0;\r\n\r\n\t\tfor ( var p = n - 1, q = 0; q < n; p = q ++ ) {\r\n\r\n\t\t\ta += contour[ p ].x * contour[ q ].y - contour[ q ].x * contour[ p ].y;\r\n\r\n\t\t}\r\n\r\n\t\treturn a * 0.5;\r\n\r\n\t};\r\n\r\n\tvar snip = function ( contour, u, v, w, n, verts ) {\r\n\r\n\t\tvar p;\r\n\t\tvar ax, ay, bx, by;\r\n\t\tvar cx, cy, px, py;\r\n\r\n\t\tax = contour[ verts[ u ] ].x;\r\n\t\tay = contour[ verts[ u ] ].y;\r\n\r\n\t\tbx = contour[ verts[ v ] ].x;\r\n\t\tby = contour[ verts[ v ] ].y;\r\n\r\n\t\tcx = contour[ verts[ w ] ].x;\r\n\t\tcy = contour[ verts[ w ] ].y;\r\n\r\n\t\tif ( EPSILON > ( ( ( bx - ax ) * ( cy - ay ) ) - ( ( by - ay ) * ( cx - ax ) ) ) ) return false;\r\n\r\n\t\tvar aX, aY, bX, bY, cX, cY;\r\n\t\tvar apx, apy, bpx, bpy, cpx, cpy;\r\n\t\tvar cCROSSap, bCROSScp, aCROSSbp;\r\n\r\n\t\taX = cx - bx; aY = cy - by;\r\n\t\tbX = ax - cx; bY = ay - cy;\r\n\t\tcX = bx - ax; cY = by - ay;\r\n\r\n\t\tfor ( p = 0; p < n; p ++ ) {\r\n\r\n\t\t\tpx = contour[ verts[ p ] ].x\r\n\t\t\tpy = contour[ verts[ p ] ].y\r\n\r\n\t\t\tif ( ( ( px === ax ) && ( py === ay ) ) ||\r\n\t\t\t\t ( ( px === bx ) && ( py === by ) ) ||\r\n\t\t\t\t ( ( px === cx ) && ( py === cy ) ) )\tcontinue;\r\n\r\n\t\t\tapx = px - ax; apy = py - ay;\r\n\t\t\tbpx = px - bx; bpy = py - by;\r\n\t\t\tcpx = px - cx; cpy = py - cy;\r\n\r\n\t\t\t// see if p is inside triangle abc\r\n\r\n\t\t\taCROSSbp = aX * bpy - aY * bpx;\r\n\t\t\tcCROSSap = cX * apy - cY * apx;\r\n\t\t\tbCROSScp = bX * cpy - bY * cpx;\r\n\r\n\t\t\tif ( ( aCROSSbp >= - EPSILON ) && ( bCROSScp >= - EPSILON ) && ( cCROSSap >= - EPSILON ) ) return false;\r\n\r\n\t\t}\r\n\r\n\t\treturn true;\r\n\r\n\t};\r\n\r\n\r\n\tnamespace.Triangulate = process;\r\n\tnamespace.Triangulate.area = area;\r\n\r\n\treturn namespace;\r\n\r\n} )( THREE.FontUtils );\r\n\r\n// To use the typeface.js face files, hook up the API\r\nself._typeface_js = { faces: THREE.FontUtils.faces, loadFace: THREE.FontUtils.loadFace };\r\nTHREE.typeface_js = self._typeface_js;\r\n\r\n// File:src/extras/audio/Audio.js\r\n\r\n/**\r\n * @author mrdoob / http://mrdoob.com/\r\n */\r\n\r\nTHREE.Audio = function ( listener ) {\r\n\r\n\tTHREE.Object3D.call( this );\r\n\r\n\tthis.type = 'Audio';\r\n\r\n\tthis.context = listener.context;\r\n\tthis.source = this.context.createBufferSource();\r\n\tthis.source.onended = this.onEnded.bind(this);\r\n\r\n\tthis.gain = this.context.createGain();\r\n\tthis.gain.connect( this.context.destination );\r\n\r\n\tthis.panner = this.context.createPanner();\r\n\tthis.panner.connect( this.gain );\r\n\r\n\tthis.autoplay = false;\r\n\r\n\tthis.startTime = 0;\r\n\tthis.isPlaying = false;\r\n\r\n};\r\n\r\nTHREE.Audio.prototype = Object.create( THREE.Object3D.prototype );\r\nTHREE.Audio.prototype.constructor = THREE.Audio;\r\n\r\nTHREE.Audio.prototype.load = function ( file ) {\r\n\r\n\tvar scope = this;\r\n\r\n\tvar request = new XMLHttpRequest();\r\n\trequest.open( 'GET', file, true );\r\n\trequest.responseType = 'arraybuffer';\r\n\trequest.onload = function ( e ) {\r\n\r\n\t\tscope.context.decodeAudioData( this.response, function ( buffer ) {\r\n\r\n\t\t\tscope.source.buffer = buffer;\r\n\r\n\t\t\tif( scope.autoplay ) scope.play();\r\n\r\n\t\t} );\r\n\r\n\t};\r\n\trequest.send();\r\n\r\n\treturn this;\r\n\r\n};\r\n\r\nTHREE.Audio.prototype.play = function () {\r\n\r\n\tif ( this.isPlaying === true ) {\r\n\r\n\t\tTHREE.warn( 'THREE.Audio: Audio is already playing.' );\r\n\t\treturn;\r\n\r\n\t}\r\n\r\n\tvar source = this.context.createBufferSource();\r\n\r\n\tsource.buffer = this.source.buffer;\r\n\tsource.loop = this.source.loop;\r\n\tsource.onended = this.source.onended;\r\n\tsource.connect( this.panner );\r\n\tsource.start( 0, this.startTime );\r\n\r\n\tthis.isPlaying = true;\r\n\r\n\tthis.source = source;\r\n\r\n};\r\n\r\nTHREE.Audio.prototype.pause = function () {\r\n\r\n\tthis.source.stop();\r\n\tthis.startTime = this.context.currentTime;\r\n\r\n};\r\n\r\nTHREE.Audio.prototype.stop = function () {\r\n\r\n\tthis.source.stop();\r\n\tthis.startTime = 0;\r\n\r\n};\r\n\r\nTHREE.Audio.prototype.onEnded = function() {\r\n\r\n\tthis.isPlaying = false;\r\n\r\n};\r\n\r\nTHREE.Audio.prototype.setLoop = function ( value ) {\r\n\r\n\tthis.source.loop = value;\r\n\r\n};\r\n\r\nTHREE.Audio.prototype.setRefDistance = function ( value ) {\r\n\r\n\tthis.panner.refDistance = value;\r\n\r\n};\r\n\r\nTHREE.Audio.prototype.setRolloffFactor = function ( value ) {\r\n\r\n\tthis.panner.rolloffFactor = value;\r\n\r\n};\r\n\r\nTHREE.Audio.prototype.setVolume = function ( value ) {\r\n\r\n\tthis.gain.gain.value = value;\r\n\r\n};\r\n\r\nTHREE.Audio.prototype.updateMatrixWorld = ( function () {\r\n\r\n\tvar position = new THREE.Vector3();\r\n\r\n\treturn function ( force ) {\r\n\r\n\t\tTHREE.Object3D.prototype.updateMatrixWorld.call( this, force );\r\n\r\n\t\tposition.setFromMatrixPosition( this.matrixWorld );\r\n\r\n\t\tthis.panner.setPosition( position.x, position.y, position.z );\r\n\r\n\t};\r\n\r\n} )();\r\n\r\n// File:src/extras/audio/AudioListener.js\r\n\r\n/**\r\n * @author mrdoob / http://mrdoob.com/\r\n */\r\n\r\nTHREE.AudioListener = function () {\r\n\r\n\tTHREE.Object3D.call( this );\r\n\r\n\tthis.type = 'AudioListener';\r\n\r\n\tthis.context = new ( window.AudioContext || window.webkitAudioContext )();\r\n\r\n};\r\n\r\nTHREE.AudioListener.prototype = Object.create( THREE.Object3D.prototype );\r\nTHREE.AudioListener.prototype.constructor = THREE.AudioListener;\r\n\r\nTHREE.AudioListener.prototype.updateMatrixWorld = ( function () {\r\n\r\n\tvar position = new THREE.Vector3();\r\n\tvar quaternion = new THREE.Quaternion();\r\n\tvar scale = new THREE.Vector3();\r\n\r\n\tvar orientation = new THREE.Vector3();\r\n\tvar velocity = new THREE.Vector3();\r\n\r\n\tvar positionPrev = new THREE.Vector3();\r\n\r\n\treturn function ( force ) {\r\n\r\n\t\tTHREE.Object3D.prototype.updateMatrixWorld.call( this, force );\r\n\r\n\t\tvar listener = this.context.listener;\r\n\t\tvar up = this.up;\r\n\r\n\t\tthis.matrixWorld.decompose( position, quaternion, scale );\r\n\r\n\t\torientation.set( 0, 0, -1 ).applyQuaternion( quaternion );\r\n\t\tvelocity.subVectors( position, positionPrev );\r\n\r\n\t\tlistener.setPosition( position.x, position.y, position.z );\r\n\t\tlistener.setOrientation( orientation.x, orientation.y, orientation.z, up.x, up.y, up.z );\r\n\t\tlistener.setVelocity( velocity.x, velocity.y, velocity.z );\r\n\r\n\t\tpositionPrev.copy( position );\r\n\r\n\t};\r\n\r\n} )();\r\n\r\n// File:src/extras/core/Curve.js\r\n\r\n/**\r\n * @author zz85 / http://www.lab4games.net/zz85/blog\r\n * Extensible curve object\r\n *\r\n * Some common of Curve methods\r\n * .getPoint(t), getTangent(t)\r\n * .getPointAt(u), getTagentAt(u)\r\n * .getPoints(), .getSpacedPoints()\r\n * .getLength()\r\n * .updateArcLengths()\r\n *\r\n * This following classes subclasses THREE.Curve:\r\n *\r\n * -- 2d classes --\r\n * THREE.LineCurve\r\n * THREE.QuadraticBezierCurve\r\n * THREE.CubicBezierCurve\r\n * THREE.SplineCurve\r\n * THREE.ArcCurve\r\n * THREE.EllipseCurve\r\n *\r\n * -- 3d classes --\r\n * THREE.LineCurve3\r\n * THREE.QuadraticBezierCurve3\r\n * THREE.CubicBezierCurve3\r\n * THREE.SplineCurve3\r\n * THREE.ClosedSplineCurve3\r\n *\r\n * A series of curves can be represented as a THREE.CurvePath\r\n *\r\n **/\r\n\r\n/**************************************************************\r\n *\tAbstract Curve base class\r\n **************************************************************/\r\n\r\nTHREE.Curve = function () {\r\n\r\n};\r\n\r\n// Virtual base class method to overwrite and implement in subclasses\r\n//\t- t [0 .. 1]\r\n\r\nTHREE.Curve.prototype.getPoint = function ( t ) {\r\n\r\n\tTHREE.warn( \"THREE.Curve: Warning, getPoint() not implemented!\" );\r\n\treturn null;\r\n\r\n};\r\n\r\n// Get point at relative position in curve according to arc length\r\n// - u [0 .. 1]\r\n\r\nTHREE.Curve.prototype.getPointAt = function ( u ) {\r\n\r\n\tvar t = this.getUtoTmapping( u );\r\n\treturn this.getPoint( t );\r\n\r\n};\r\n\r\n// Get sequence of points using getPoint( t )\r\n\r\nTHREE.Curve.prototype.getPoints = function ( divisions ) {\r\n\r\n\tif ( ! divisions ) divisions = 5;\r\n\r\n\tvar d, pts = [];\r\n\r\n\tfor ( d = 0; d <= divisions; d ++ ) {\r\n\r\n\t\tpts.push( this.getPoint( d / divisions ) );\r\n\r\n\t}\r\n\r\n\treturn pts;\r\n\r\n};\r\n\r\n// Get sequence of points using getPointAt( u )\r\n\r\nTHREE.Curve.prototype.getSpacedPoints = function ( divisions ) {\r\n\r\n\tif ( ! divisions ) divisions = 5;\r\n\r\n\tvar d, pts = [];\r\n\r\n\tfor ( d = 0; d <= divisions; d ++ ) {\r\n\r\n\t\tpts.push( this.getPointAt( d / divisions ) );\r\n\r\n\t}\r\n\r\n\treturn pts;\r\n\r\n};\r\n\r\n// Get total curve arc length\r\n\r\nTHREE.Curve.prototype.getLength = function () {\r\n\r\n\tvar lengths = this.getLengths();\r\n\treturn lengths[ lengths.length - 1 ];\r\n\r\n};\r\n\r\n// Get list of cumulative segment lengths\r\n\r\nTHREE.Curve.prototype.getLengths = function ( divisions ) {\r\n\r\n\tif ( ! divisions ) divisions = (this.__arcLengthDivisions) ? (this.__arcLengthDivisions) : 200;\r\n\r\n\tif ( this.cacheArcLengths\r\n\t\t&& ( this.cacheArcLengths.length == divisions + 1 )\r\n\t\t&& ! this.needsUpdate) {\r\n\r\n\t\t//console.log( \"cached\", this.cacheArcLengths );\r\n\t\treturn this.cacheArcLengths;\r\n\r\n\t}\r\n\r\n\tthis.needsUpdate = false;\r\n\r\n\tvar cache = [];\r\n\tvar current, last = this.getPoint( 0 );\r\n\tvar p, sum = 0;\r\n\r\n\tcache.push( 0 );\r\n\r\n\tfor ( p = 1; p <= divisions; p ++ ) {\r\n\r\n\t\tcurrent = this.getPoint ( p / divisions );\r\n\t\tsum += current.distanceTo( last );\r\n\t\tcache.push( sum );\r\n\t\tlast = current;\r\n\r\n\t}\r\n\r\n\tthis.cacheArcLengths = cache;\r\n\r\n\treturn cache; // { sums: cache, sum:sum }; Sum is in the last element.\r\n\r\n};\r\n\r\n\r\nTHREE.Curve.prototype.updateArcLengths = function() {\r\n\tthis.needsUpdate = true;\r\n\tthis.getLengths();\r\n};\r\n\r\n// Given u ( 0 .. 1 ), get a t to find p. This gives you points which are equi distance\r\n\r\nTHREE.Curve.prototype.getUtoTmapping = function ( u, distance ) {\r\n\r\n\tvar arcLengths = this.getLengths();\r\n\r\n\tvar i = 0, il = arcLengths.length;\r\n\r\n\tvar targetArcLength; // The targeted u distance value to get\r\n\r\n\tif ( distance ) {\r\n\r\n\t\ttargetArcLength = distance;\r\n\r\n\t} else {\r\n\r\n\t\ttargetArcLength = u * arcLengths[ il - 1 ];\r\n\r\n\t}\r\n\r\n\t//var time = Date.now();\r\n\r\n\t// binary search for the index with largest value smaller than target u distance\r\n\r\n\tvar low = 0, high = il - 1, comparison;\r\n\r\n\twhile ( low <= high ) {\r\n\r\n\t\ti = Math.floor( low + ( high - low ) / 2 ); // less likely to overflow, though probably not issue here, JS doesn't really have integers, all numbers are floats\r\n\r\n\t\tcomparison = arcLengths[ i ] - targetArcLength;\r\n\r\n\t\tif ( comparison < 0 ) {\r\n\r\n\t\t\tlow = i + 1;\r\n\r\n\t\t} else if ( comparison > 0 ) {\r\n\r\n\t\t\thigh = i - 1;\r\n\r\n\t\t} else {\r\n\r\n\t\t\thigh = i;\r\n\t\t\tbreak;\r\n\r\n\t\t\t// DONE\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\ti = high;\r\n\r\n\t//console.log('b' , i, low, high, Date.now()- time);\r\n\r\n\tif ( arcLengths[ i ] == targetArcLength ) {\r\n\r\n\t\tvar t = i / ( il - 1 );\r\n\t\treturn t;\r\n\r\n\t}\r\n\r\n\t// we could get finer grain at lengths, or use simple interpolatation between two points\r\n\r\n\tvar lengthBefore = arcLengths[ i ];\r\n\tvar lengthAfter = arcLengths[ i + 1 ];\r\n\r\n\tvar segmentLength = lengthAfter - lengthBefore;\r\n\r\n // determine where we are between the 'before' and 'after' points\r\n\r\n\tvar segmentFraction = ( targetArcLength - lengthBefore ) / segmentLength;\r\n\r\n // add that fractional amount to t\r\n\r\n\tvar t = ( i + segmentFraction ) / ( il - 1 );\r\n\r\n\treturn t;\r\n\r\n};\r\n\r\n// Returns a unit vector tangent at t\r\n// In case any sub curve does not implement its tangent derivation,\r\n// 2 points a small delta apart will be used to find its gradient\r\n// which seems to give a reasonable approximation\r\n\r\nTHREE.Curve.prototype.getTangent = function( t ) {\r\n\r\n\tvar delta = 0.0001;\r\n\tvar t1 = t - delta;\r\n\tvar t2 = t + delta;\r\n\r\n\t// Capping in case of danger\r\n\r\n\tif ( t1 < 0 ) t1 = 0;\r\n\tif ( t2 > 1 ) t2 = 1;\r\n\r\n\tvar pt1 = this.getPoint( t1 );\r\n\tvar pt2 = this.getPoint( t2 );\r\n\r\n\tvar vec = pt2.clone().sub(pt1);\r\n\treturn vec.normalize();\r\n\r\n};\r\n\r\n\r\nTHREE.Curve.prototype.getTangentAt = function ( u ) {\r\n\r\n\tvar t = this.getUtoTmapping( u );\r\n\treturn this.getTangent( t );\r\n\r\n};\r\n\r\n\r\n\r\n\r\n\r\n/**************************************************************\r\n *\tUtils\r\n **************************************************************/\r\n\r\nTHREE.Curve.Utils = {\r\n\r\n\ttangentQuadraticBezier: function ( t, p0, p1, p2 ) {\r\n\r\n\t\treturn 2 * ( 1 - t ) * ( p1 - p0 ) + 2 * t * ( p2 - p1 );\r\n\r\n\t},\r\n\r\n\t// Puay Bing, thanks for helping with this derivative!\r\n\r\n\ttangentCubicBezier: function (t, p0, p1, p2, p3 ) {\r\n\r\n\t\treturn - 3 * p0 * (1 - t) * (1 - t) +\r\n\t\t\t3 * p1 * (1 - t) * (1 - t) - 6 * t * p1 * (1 - t) +\r\n\t\t\t6 * t * p2 * (1 - t) - 3 * t * t * p2 +\r\n\t\t\t3 * t * t * p3;\r\n\r\n\t},\r\n\r\n\ttangentSpline: function ( t, p0, p1, p2, p3 ) {\r\n\r\n\t\t// To check if my formulas are correct\r\n\r\n\t\tvar h00 = 6 * t * t - 6 * t; \t// derived from 2t^3 āˆ’ 3t^2 + 1\r\n\t\tvar h10 = 3 * t * t - 4 * t + 1; // t^3 āˆ’ 2t^2 + t\r\n\t\tvar h01 = - 6 * t * t + 6 * t; \t// āˆ’ 2t3 + 3t2\r\n\t\tvar h11 = 3 * t * t - 2 * t;\t// t3 āˆ’ t2\r\n\r\n\t\treturn h00 + h10 + h01 + h11;\r\n\r\n\t},\r\n\r\n\t// Catmull-Rom\r\n\r\n\tinterpolate: function( p0, p1, p2, p3, t ) {\r\n\r\n\t\tvar v0 = ( p2 - p0 ) * 0.5;\r\n\t\tvar v1 = ( p3 - p1 ) * 0.5;\r\n\t\tvar t2 = t * t;\r\n\t\tvar t3 = t * t2;\r\n\t\treturn ( 2 * p1 - 2 * p2 + v0 + v1 ) * t3 + ( - 3 * p1 + 3 * p2 - 2 * v0 - v1 ) * t2 + v0 * t + p1;\r\n\r\n\t}\r\n\r\n};\r\n\r\n\r\n// TODO: Transformation for Curves?\r\n\r\n/**************************************************************\r\n *\t3D Curves\r\n **************************************************************/\r\n\r\n// A Factory method for creating new curve subclasses\r\n\r\nTHREE.Curve.create = function ( constructor, getPointFunc ) {\r\n\r\n\tconstructor.prototype = Object.create( THREE.Curve.prototype );\r\n\tconstructor.prototype.constructor = constructor;\r\n\tconstructor.prototype.getPoint = getPointFunc;\r\n\r\n\treturn constructor;\r\n\r\n};\r\n\r\n// File:src/extras/core/CurvePath.js\r\n\r\n/**\r\n * @author zz85 / http://www.lab4games.net/zz85/blog\r\n *\r\n **/\r\n\r\n/**************************************************************\r\n *\tCurved Path - a curve path is simply a array of connected\r\n * curves, but retains the api of a curve\r\n **************************************************************/\r\n\r\nTHREE.CurvePath = function () {\r\n\r\n\tthis.curves = [];\r\n\tthis.bends = [];\r\n\t\r\n\tthis.autoClose = false; // Automatically closes the path\r\n};\r\n\r\nTHREE.CurvePath.prototype = Object.create( THREE.Curve.prototype );\r\nTHREE.CurvePath.prototype.constructor = THREE.CurvePath;\r\n\r\nTHREE.CurvePath.prototype.add = function ( curve ) {\r\n\r\n\tthis.curves.push( curve );\r\n\r\n};\r\n\r\nTHREE.CurvePath.prototype.checkConnection = function() {\r\n\t// TODO\r\n\t// If the ending of curve is not connected to the starting\r\n\t// or the next curve, then, this is not a real path\r\n};\r\n\r\nTHREE.CurvePath.prototype.closePath = function() {\r\n\t// TODO Test\r\n\t// and verify for vector3 (needs to implement equals)\r\n\t// Add a line curve if start and end of lines are not connected\r\n\tvar startPoint = this.curves[0].getPoint(0);\r\n\tvar endPoint = this.curves[this.curves.length - 1].getPoint(1);\r\n\t\r\n\tif (! startPoint.equals(endPoint)) {\r\n\t\tthis.curves.push( new THREE.LineCurve(endPoint, startPoint) );\r\n\t}\r\n\t\r\n};\r\n\r\n// To get accurate point with reference to\r\n// entire path distance at time t,\r\n// following has to be done:\r\n\r\n// 1. Length of each sub path have to be known\r\n// 2. Locate and identify type of curve\r\n// 3. Get t for the curve\r\n// 4. Return curve.getPointAt(t')\r\n\r\nTHREE.CurvePath.prototype.getPoint = function( t ) {\r\n\r\n\tvar d = t * this.getLength();\r\n\tvar curveLengths = this.getCurveLengths();\r\n\tvar i = 0, diff, curve;\r\n\r\n\t// To think about boundaries points.\r\n\r\n\twhile ( i < curveLengths.length ) {\r\n\r\n\t\tif ( curveLengths[ i ] >= d ) {\r\n\r\n\t\t\tdiff = curveLengths[ i ] - d;\r\n\t\t\tcurve = this.curves[ i ];\r\n\r\n\t\t\tvar u = 1 - diff / curve.getLength();\r\n\r\n\t\t\treturn curve.getPointAt( u );\r\n\r\n\t\t}\r\n\r\n\t\ti ++;\r\n\r\n\t}\r\n\r\n\treturn null;\r\n\r\n\t// loop where sum != 0, sum > d , sum+1 maxX ) maxX = p.x;\r\n\t\telse if ( p.x < minX ) minX = p.x;\r\n\r\n\t\tif ( p.y > maxY ) maxY = p.y;\r\n\t\telse if ( p.y < minY ) minY = p.y;\r\n\r\n\t\tif ( v3 ) {\r\n\r\n\t\t\tif ( p.z > maxZ ) maxZ = p.z;\r\n\t\t\telse if ( p.z < minZ ) minZ = p.z;\r\n\r\n\t\t}\r\n\r\n\t\tsum.add( p );\r\n\r\n\t}\r\n\r\n\tvar ret = {\r\n\r\n\t\tminX: minX,\r\n\t\tminY: minY,\r\n\t\tmaxX: maxX,\r\n\t\tmaxY: maxY\r\n\r\n\t};\r\n\r\n\tif ( v3 ) {\r\n\r\n\t\tret.maxZ = maxZ;\r\n\t\tret.minZ = minZ;\r\n\r\n\t}\r\n\r\n\treturn ret;\r\n\r\n};\r\n\r\n/**************************************************************\r\n *\tCreate Geometries Helpers\r\n **************************************************************/\r\n\r\n/// Generate geometry from path points (for Line or Points objects)\r\n\r\nTHREE.CurvePath.prototype.createPointsGeometry = function( divisions ) {\r\n\r\n\tvar pts = this.getPoints( divisions, true );\r\n\treturn this.createGeometry( pts );\r\n\r\n};\r\n\r\n// Generate geometry from equidistance sampling along the path\r\n\r\nTHREE.CurvePath.prototype.createSpacedPointsGeometry = function( divisions ) {\r\n\r\n\tvar pts = this.getSpacedPoints( divisions, true );\r\n\treturn this.createGeometry( pts );\r\n\r\n};\r\n\r\nTHREE.CurvePath.prototype.createGeometry = function( points ) {\r\n\r\n\tvar geometry = new THREE.Geometry();\r\n\r\n\tfor ( var i = 0; i < points.length; i ++ ) {\r\n\r\n\t\tgeometry.vertices.push( new THREE.Vector3( points[ i ].x, points[ i ].y, points[ i ].z || 0) );\r\n\r\n\t}\r\n\r\n\treturn geometry;\r\n\r\n};\r\n\r\n\r\n/**************************************************************\r\n *\tBend / Wrap Helper Methods\r\n **************************************************************/\r\n\r\n// Wrap path / Bend modifiers?\r\n\r\nTHREE.CurvePath.prototype.addWrapPath = function ( bendpath ) {\r\n\r\n\tthis.bends.push( bendpath );\r\n\r\n};\r\n\r\nTHREE.CurvePath.prototype.getTransformedPoints = function( segments, bends ) {\r\n\r\n\tvar oldPts = this.getPoints( segments ); // getPoints getSpacedPoints\r\n\tvar i, il;\r\n\r\n\tif ( ! bends ) {\r\n\r\n\t\tbends = this.bends;\r\n\r\n\t}\r\n\r\n\tfor ( i = 0, il = bends.length; i < il; i ++ ) {\r\n\r\n\t\toldPts = this.getWrapPoints( oldPts, bends[ i ] );\r\n\r\n\t}\r\n\r\n\treturn oldPts;\r\n\r\n};\r\n\r\nTHREE.CurvePath.prototype.getTransformedSpacedPoints = function( segments, bends ) {\r\n\r\n\tvar oldPts = this.getSpacedPoints( segments );\r\n\r\n\tvar i, il;\r\n\r\n\tif ( ! bends ) {\r\n\r\n\t\tbends = this.bends;\r\n\r\n\t}\r\n\r\n\tfor ( i = 0, il = bends.length; i < il; i ++ ) {\r\n\r\n\t\toldPts = this.getWrapPoints( oldPts, bends[ i ] );\r\n\r\n\t}\r\n\r\n\treturn oldPts;\r\n\r\n};\r\n\r\n// This returns getPoints() bend/wrapped around the contour of a path.\r\n// Read http://www.planetclegg.com/projects/WarpingTextToSplines.html\r\n\r\nTHREE.CurvePath.prototype.getWrapPoints = function ( oldPts, path ) {\r\n\r\n\tvar bounds = this.getBoundingBox();\r\n\r\n\tvar i, il, p, oldX, oldY, xNorm;\r\n\r\n\tfor ( i = 0, il = oldPts.length; i < il; i ++ ) {\r\n\r\n\t\tp = oldPts[ i ];\r\n\r\n\t\toldX = p.x;\r\n\t\toldY = p.y;\r\n\r\n\t\txNorm = oldX / bounds.maxX;\r\n\r\n\t\t// If using actual distance, for length > path, requires line extrusions\r\n\t\t//xNorm = path.getUtoTmapping(xNorm, oldX); // 3 styles. 1) wrap stretched. 2) wrap stretch by arc length 3) warp by actual distance\r\n\r\n\t\txNorm = path.getUtoTmapping( xNorm, oldX );\r\n\r\n\t\t// check for out of bounds?\r\n\r\n\t\tvar pathPt = path.getPoint( xNorm );\r\n\t\tvar normal = path.getTangent( xNorm );\r\n\t\tnormal.set( - normal.y, normal.x ).multiplyScalar( oldY );\r\n\r\n\t\tp.x = pathPt.x + normal.x;\r\n\t\tp.y = pathPt.y + normal.y;\r\n\r\n\t}\r\n\r\n\treturn oldPts;\r\n\r\n};\r\n\r\n\r\n// File:src/extras/core/Gyroscope.js\r\n\r\n/**\r\n * @author alteredq / http://alteredqualia.com/\r\n */\r\n\r\nTHREE.Gyroscope = function () {\r\n\r\n\tTHREE.Object3D.call( this );\r\n\r\n};\r\n\r\nTHREE.Gyroscope.prototype = Object.create( THREE.Object3D.prototype );\r\nTHREE.Gyroscope.prototype.constructor = THREE.Gyroscope;\r\n\r\nTHREE.Gyroscope.prototype.updateMatrixWorld = ( function () {\r\n\r\n\tvar translationObject = new THREE.Vector3();\r\n\tvar quaternionObject = new THREE.Quaternion();\r\n\tvar scaleObject = new THREE.Vector3();\r\n\r\n\tvar translationWorld = new THREE.Vector3();\r\n\tvar quaternionWorld = new THREE.Quaternion();\r\n\tvar scaleWorld = new THREE.Vector3();\r\n\r\n\treturn function ( force ) {\r\n\r\n\t\tthis.matrixAutoUpdate && this.updateMatrix();\r\n\r\n\t\t// update matrixWorld\r\n\r\n\t\tif ( this.matrixWorldNeedsUpdate || force ) {\r\n\r\n\t\t\tif ( this.parent ) {\r\n\r\n\t\t\t\tthis.matrixWorld.multiplyMatrices( this.parent.matrixWorld, this.matrix );\r\n\r\n\t\t\t\tthis.matrixWorld.decompose( translationWorld, quaternionWorld, scaleWorld );\r\n\t\t\t\tthis.matrix.decompose( translationObject, quaternionObject, scaleObject );\r\n\r\n\t\t\t\tthis.matrixWorld.compose( translationWorld, quaternionObject, scaleWorld );\r\n\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tthis.matrixWorld.copy( this.matrix );\r\n\r\n\t\t\t}\r\n\r\n\r\n\t\t\tthis.matrixWorldNeedsUpdate = false;\r\n\r\n\t\t\tforce = true;\r\n\r\n\t\t}\r\n\r\n\t\t// update children\r\n\r\n\t\tfor ( var i = 0, l = this.children.length; i < l; i ++ ) {\r\n\r\n\t\t\tthis.children[ i ].updateMatrixWorld( force );\r\n\r\n\t\t}\r\n\r\n\t};\r\n\t\r\n}() );\r\n\r\n// File:src/extras/core/Path.js\r\n\r\n/**\r\n * @author zz85 / http://www.lab4games.net/zz85/blog\r\n * Creates free form 2d path using series of points, lines or curves.\r\n *\r\n **/\r\n\r\nTHREE.Path = function ( points ) {\r\n\r\n\tTHREE.CurvePath.call(this);\r\n\r\n\tthis.actions = [];\r\n\r\n\tif ( points ) {\r\n\r\n\t\tthis.fromPoints( points );\r\n\r\n\t}\r\n\r\n};\r\n\r\nTHREE.Path.prototype = Object.create( THREE.CurvePath.prototype );\r\nTHREE.Path.prototype.constructor = THREE.Path;\r\n\r\nTHREE.PathActions = {\r\n\r\n\tMOVE_TO: 'moveTo',\r\n\tLINE_TO: 'lineTo',\r\n\tQUADRATIC_CURVE_TO: 'quadraticCurveTo', // Bezier quadratic curve\r\n\tBEZIER_CURVE_TO: 'bezierCurveTo', \t\t// Bezier cubic curve\r\n\tCSPLINE_THRU: 'splineThru',\t\t\t\t// Catmull-rom spline\r\n\tARC: 'arc',\t\t\t\t\t\t\t\t// Circle\r\n\tELLIPSE: 'ellipse'\r\n};\r\n\r\n// TODO Clean up PATH API\r\n\r\n// Create path using straight lines to connect all points\r\n// - vectors: array of Vector2\r\n\r\nTHREE.Path.prototype.fromPoints = function ( vectors ) {\r\n\r\n\tthis.moveTo( vectors[ 0 ].x, vectors[ 0 ].y );\r\n\r\n\tfor ( var v = 1, vlen = vectors.length; v < vlen; v ++ ) {\r\n\r\n\t\tthis.lineTo( vectors[ v ].x, vectors[ v ].y );\r\n\r\n\t};\r\n\r\n};\r\n\r\n// startPath() endPath()?\r\n\r\nTHREE.Path.prototype.moveTo = function ( x, y ) {\r\n\r\n\tvar args = Array.prototype.slice.call( arguments );\r\n\tthis.actions.push( { action: THREE.PathActions.MOVE_TO, args: args } );\r\n\r\n};\r\n\r\nTHREE.Path.prototype.lineTo = function ( x, y ) {\r\n\r\n\tvar args = Array.prototype.slice.call( arguments );\r\n\r\n\tvar lastargs = this.actions[ this.actions.length - 1 ].args;\r\n\r\n\tvar x0 = lastargs[ lastargs.length - 2 ];\r\n\tvar y0 = lastargs[ lastargs.length - 1 ];\r\n\r\n\tvar curve = new THREE.LineCurve( new THREE.Vector2( x0, y0 ), new THREE.Vector2( x, y ) );\r\n\tthis.curves.push( curve );\r\n\r\n\tthis.actions.push( { action: THREE.PathActions.LINE_TO, args: args } );\r\n\r\n};\r\n\r\nTHREE.Path.prototype.quadraticCurveTo = function( aCPx, aCPy, aX, aY ) {\r\n\r\n\tvar args = Array.prototype.slice.call( arguments );\r\n\r\n\tvar lastargs = this.actions[ this.actions.length - 1 ].args;\r\n\r\n\tvar x0 = lastargs[ lastargs.length - 2 ];\r\n\tvar y0 = lastargs[ lastargs.length - 1 ];\r\n\r\n\tvar curve = new THREE.QuadraticBezierCurve( new THREE.Vector2( x0, y0 ),\r\n\t\t\t\t\t\t\t\t\t\t\t\tnew THREE.Vector2( aCPx, aCPy ),\r\n\t\t\t\t\t\t\t\t\t\t\t\tnew THREE.Vector2( aX, aY ) );\r\n\tthis.curves.push( curve );\r\n\r\n\tthis.actions.push( { action: THREE.PathActions.QUADRATIC_CURVE_TO, args: args } );\r\n\r\n};\r\n\r\nTHREE.Path.prototype.bezierCurveTo = function( aCP1x, aCP1y,\r\n\t\t\t\t\t\t\t\t\t\t\t aCP2x, aCP2y,\r\n\t\t\t\t\t\t\t\t\t\t\t aX, aY ) {\r\n\r\n\tvar args = Array.prototype.slice.call( arguments );\r\n\r\n\tvar lastargs = this.actions[ this.actions.length - 1 ].args;\r\n\r\n\tvar x0 = lastargs[ lastargs.length - 2 ];\r\n\tvar y0 = lastargs[ lastargs.length - 1 ];\r\n\r\n\tvar curve = new THREE.CubicBezierCurve( new THREE.Vector2( x0, y0 ),\r\n\t\t\t\t\t\t\t\t\t\t\tnew THREE.Vector2( aCP1x, aCP1y ),\r\n\t\t\t\t\t\t\t\t\t\t\tnew THREE.Vector2( aCP2x, aCP2y ),\r\n\t\t\t\t\t\t\t\t\t\t\tnew THREE.Vector2( aX, aY ) );\r\n\tthis.curves.push( curve );\r\n\r\n\tthis.actions.push( { action: THREE.PathActions.BEZIER_CURVE_TO, args: args } );\r\n\r\n};\r\n\r\nTHREE.Path.prototype.splineThru = function( pts /*Array of Vector*/ ) {\r\n\r\n\tvar args = Array.prototype.slice.call( arguments );\r\n\tvar lastargs = this.actions[ this.actions.length - 1 ].args;\r\n\r\n\tvar x0 = lastargs[ lastargs.length - 2 ];\r\n\tvar y0 = lastargs[ lastargs.length - 1 ];\r\n//---\r\n\tvar npts = [ new THREE.Vector2( x0, y0 ) ];\r\n\tArray.prototype.push.apply( npts, pts );\r\n\r\n\tvar curve = new THREE.SplineCurve( npts );\r\n\tthis.curves.push( curve );\r\n\r\n\tthis.actions.push( { action: THREE.PathActions.CSPLINE_THRU, args: args } );\r\n\r\n};\r\n\r\n// FUTURE: Change the API or follow canvas API?\r\n\r\nTHREE.Path.prototype.arc = function ( aX, aY, aRadius,\r\n\t\t\t\t\t\t\t\t\t aStartAngle, aEndAngle, aClockwise ) {\r\n\r\n\tvar lastargs = this.actions[ this.actions.length - 1].args;\r\n\tvar x0 = lastargs[ lastargs.length - 2 ];\r\n\tvar y0 = lastargs[ lastargs.length - 1 ];\r\n\r\n\tthis.absarc(aX + x0, aY + y0, aRadius,\r\n\t\taStartAngle, aEndAngle, aClockwise );\r\n\r\n };\r\n\r\n THREE.Path.prototype.absarc = function ( aX, aY, aRadius,\r\n\t\t\t\t\t\t\t\t\t aStartAngle, aEndAngle, aClockwise ) {\r\n\tthis.absellipse(aX, aY, aRadius, aRadius, aStartAngle, aEndAngle, aClockwise);\r\n };\r\n\r\nTHREE.Path.prototype.ellipse = function ( aX, aY, xRadius, yRadius,\r\n\t\t\t\t\t\t\t\t\t aStartAngle, aEndAngle, aClockwise ) {\r\n\r\n\tvar lastargs = this.actions[ this.actions.length - 1].args;\r\n\tvar x0 = lastargs[ lastargs.length - 2 ];\r\n\tvar y0 = lastargs[ lastargs.length - 1 ];\r\n\r\n\tthis.absellipse(aX + x0, aY + y0, xRadius, yRadius,\r\n\t\taStartAngle, aEndAngle, aClockwise );\r\n\r\n };\r\n\r\n\r\nTHREE.Path.prototype.absellipse = function ( aX, aY, xRadius, yRadius,\r\n\t\t\t\t\t\t\t\t\t aStartAngle, aEndAngle, aClockwise ) {\r\n\r\n\tvar args = Array.prototype.slice.call( arguments );\r\n\tvar curve = new THREE.EllipseCurve( aX, aY, xRadius, yRadius,\r\n\t\t\t\t\t\t\t\t\taStartAngle, aEndAngle, aClockwise );\r\n\tthis.curves.push( curve );\r\n\r\n\tvar lastPoint = curve.getPoint(1);\r\n\targs.push(lastPoint.x);\r\n\targs.push(lastPoint.y);\r\n\r\n\tthis.actions.push( { action: THREE.PathActions.ELLIPSE, args: args } );\r\n\r\n };\r\n\r\nTHREE.Path.prototype.getSpacedPoints = function ( divisions, closedPath ) {\r\n\r\n\tif ( ! divisions ) divisions = 40;\r\n\r\n\tvar points = [];\r\n\r\n\tfor ( var i = 0; i < divisions; i ++ ) {\r\n\r\n\t\tpoints.push( this.getPoint( i / divisions ) );\r\n\r\n\t\t//if( !this.getPoint( i / divisions ) ) throw \"DIE\";\r\n\r\n\t}\r\n\r\n\t// if ( closedPath ) {\r\n\t//\r\n\t// \tpoints.push( points[ 0 ] );\r\n\t//\r\n\t// }\r\n\r\n\treturn points;\r\n\r\n};\r\n\r\n/* Return an array of vectors based on contour of the path */\r\n\r\nTHREE.Path.prototype.getPoints = function( divisions, closedPath ) {\r\n\r\n\tif (this.useSpacedPoints) {\r\n\t\tconsole.log('tata');\r\n\t\treturn this.getSpacedPoints( divisions, closedPath );\r\n\t}\r\n\r\n\tdivisions = divisions || 12;\r\n\r\n\tvar points = [];\r\n\r\n\tvar i, il, item, action, args;\r\n\tvar cpx, cpy, cpx2, cpy2, cpx1, cpy1, cpx0, cpy0,\r\n\t\tlaste, j,\r\n\t\tt, tx, ty;\r\n\r\n\tfor ( i = 0, il = this.actions.length; i < il; i ++ ) {\r\n\r\n\t\titem = this.actions[ i ];\r\n\r\n\t\taction = item.action;\r\n\t\targs = item.args;\r\n\r\n\t\tswitch ( action ) {\r\n\r\n\t\tcase THREE.PathActions.MOVE_TO:\r\n\r\n\t\t\tpoints.push( new THREE.Vector2( args[ 0 ], args[ 1 ] ) );\r\n\r\n\t\t\tbreak;\r\n\r\n\t\tcase THREE.PathActions.LINE_TO:\r\n\r\n\t\t\tpoints.push( new THREE.Vector2( args[ 0 ], args[ 1 ] ) );\r\n\r\n\t\t\tbreak;\r\n\r\n\t\tcase THREE.PathActions.QUADRATIC_CURVE_TO:\r\n\r\n\t\t\tcpx = args[ 2 ];\r\n\t\t\tcpy = args[ 3 ];\r\n\r\n\t\t\tcpx1 = args[ 0 ];\r\n\t\t\tcpy1 = args[ 1 ];\r\n\r\n\t\t\tif ( points.length > 0 ) {\r\n\r\n\t\t\t\tlaste = points[ points.length - 1 ];\r\n\r\n\t\t\t\tcpx0 = laste.x;\r\n\t\t\t\tcpy0 = laste.y;\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tlaste = this.actions[ i - 1 ].args;\r\n\r\n\t\t\t\tcpx0 = laste[ laste.length - 2 ];\r\n\t\t\t\tcpy0 = laste[ laste.length - 1 ];\r\n\r\n\t\t\t}\r\n\r\n\t\t\tfor ( j = 1; j <= divisions; j ++ ) {\r\n\r\n\t\t\t\tt = j / divisions;\r\n\r\n\t\t\t\ttx = THREE.Shape.Utils.b2( t, cpx0, cpx1, cpx );\r\n\t\t\t\tty = THREE.Shape.Utils.b2( t, cpy0, cpy1, cpy );\r\n\r\n\t\t\t\tpoints.push( new THREE.Vector2( tx, ty ) );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tbreak;\r\n\r\n\t\tcase THREE.PathActions.BEZIER_CURVE_TO:\r\n\r\n\t\t\tcpx = args[ 4 ];\r\n\t\t\tcpy = args[ 5 ];\r\n\r\n\t\t\tcpx1 = args[ 0 ];\r\n\t\t\tcpy1 = args[ 1 ];\r\n\r\n\t\t\tcpx2 = args[ 2 ];\r\n\t\t\tcpy2 = args[ 3 ];\r\n\r\n\t\t\tif ( points.length > 0 ) {\r\n\r\n\t\t\t\tlaste = points[ points.length - 1 ];\r\n\r\n\t\t\t\tcpx0 = laste.x;\r\n\t\t\t\tcpy0 = laste.y;\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tlaste = this.actions[ i - 1 ].args;\r\n\r\n\t\t\t\tcpx0 = laste[ laste.length - 2 ];\r\n\t\t\t\tcpy0 = laste[ laste.length - 1 ];\r\n\r\n\t\t\t}\r\n\r\n\r\n\t\t\tfor ( j = 1; j <= divisions; j ++ ) {\r\n\r\n\t\t\t\tt = j / divisions;\r\n\r\n\t\t\t\ttx = THREE.Shape.Utils.b3( t, cpx0, cpx1, cpx2, cpx );\r\n\t\t\t\tty = THREE.Shape.Utils.b3( t, cpy0, cpy1, cpy2, cpy );\r\n\r\n\t\t\t\tpoints.push( new THREE.Vector2( tx, ty ) );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tbreak;\r\n\r\n\t\tcase THREE.PathActions.CSPLINE_THRU:\r\n\r\n\t\t\tlaste = this.actions[ i - 1 ].args;\r\n\r\n\t\t\tvar last = new THREE.Vector2( laste[ laste.length - 2 ], laste[ laste.length - 1 ] );\r\n\t\t\tvar spts = [ last ];\r\n\r\n\t\t\tvar n = divisions * args[ 0 ].length;\r\n\r\n\t\t\tspts = spts.concat( args[ 0 ] );\r\n\r\n\t\t\tvar spline = new THREE.SplineCurve( spts );\r\n\r\n\t\t\tfor ( j = 1; j <= n; j ++ ) {\r\n\r\n\t\t\t\tpoints.push( spline.getPointAt( j / n ) ) ;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tbreak;\r\n\r\n\t\tcase THREE.PathActions.ARC:\r\n\r\n\t\t\tvar aX = args[ 0 ], aY = args[ 1 ],\r\n\t\t\t\taRadius = args[ 2 ],\r\n\t\t\t\taStartAngle = args[ 3 ], aEndAngle = args[ 4 ],\r\n\t\t\t\taClockwise = !! args[ 5 ];\r\n\r\n\t\t\tvar deltaAngle = aEndAngle - aStartAngle;\r\n\t\t\tvar angle;\r\n\t\t\tvar tdivisions = divisions * 2;\r\n\r\n\t\t\tfor ( j = 1; j <= tdivisions; j ++ ) {\r\n\r\n\t\t\t\tt = j / tdivisions;\r\n\r\n\t\t\t\tif ( ! aClockwise ) {\r\n\r\n\t\t\t\t\tt = 1 - t;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tangle = aStartAngle + t * deltaAngle;\r\n\r\n\t\t\t\ttx = aX + aRadius * Math.cos( angle );\r\n\t\t\t\tty = aY + aRadius * Math.sin( angle );\r\n\r\n\t\t\t\t//console.log('t', t, 'angle', angle, 'tx', tx, 'ty', ty);\r\n\r\n\t\t\t\tpoints.push( new THREE.Vector2( tx, ty ) );\r\n\r\n\t\t\t}\r\n\r\n\t\t\t//console.log(points);\r\n\r\n\t\t\tbreak;\r\n\t\t \r\n\t\tcase THREE.PathActions.ELLIPSE:\r\n\r\n\t\t\tvar aX = args[ 0 ], aY = args[ 1 ],\r\n\t\t\t\txRadius = args[ 2 ],\r\n\t\t\t\tyRadius = args[ 3 ],\r\n\t\t\t\taStartAngle = args[ 4 ], aEndAngle = args[ 5 ],\r\n\t\t\t\taClockwise = !! args[ 6 ];\r\n\r\n\r\n\t\t\tvar deltaAngle = aEndAngle - aStartAngle;\r\n\t\t\tvar angle;\r\n\t\t\tvar tdivisions = divisions * 2;\r\n\r\n\t\t\tfor ( j = 1; j <= tdivisions; j ++ ) {\r\n\r\n\t\t\t\tt = j / tdivisions;\r\n\r\n\t\t\t\tif ( ! aClockwise ) {\r\n\r\n\t\t\t\t\tt = 1 - t;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tangle = aStartAngle + t * deltaAngle;\r\n\r\n\t\t\t\ttx = aX + xRadius * Math.cos( angle );\r\n\t\t\t\tty = aY + yRadius * Math.sin( angle );\r\n\r\n\t\t\t\t//console.log('t', t, 'angle', angle, 'tx', tx, 'ty', ty);\r\n\r\n\t\t\t\tpoints.push( new THREE.Vector2( tx, ty ) );\r\n\r\n\t\t\t}\r\n\r\n\t\t\t//console.log(points);\r\n\r\n\t\t\tbreak;\r\n\r\n\t\t} // end switch\r\n\r\n\t}\r\n\r\n\r\n\r\n\t// Normalize to remove the closing point by default.\r\n\tvar lastPoint = points[ points.length - 1];\r\n\tvar EPSILON = 0.0000000001;\r\n\tif ( Math.abs(lastPoint.x - points[ 0 ].x) < EPSILON &&\r\n\t\t\t Math.abs(lastPoint.y - points[ 0 ].y) < EPSILON)\r\n\t\tpoints.splice( points.length - 1, 1);\r\n\tif ( closedPath ) {\r\n\r\n\t\tpoints.push( points[ 0 ] );\r\n\r\n\t}\r\n\r\n\treturn points;\r\n\r\n};\r\n\r\n//\r\n// Breaks path into shapes\r\n//\r\n//\tAssumptions (if parameter isCCW==true the opposite holds):\r\n//\t- solid shapes are defined clockwise (CW)\r\n//\t- holes are defined counterclockwise (CCW)\r\n//\r\n//\tIf parameter noHoles==true:\r\n// - all subPaths are regarded as solid shapes\r\n// - definition order CW/CCW has no relevance\r\n//\r\n\r\nTHREE.Path.prototype.toShapes = function( isCCW, noHoles ) {\r\n\r\n\tfunction extractSubpaths( inActions ) {\r\n\r\n\t\tvar i, il, item, action, args;\r\n\r\n\t\tvar subPaths = [], lastPath = new THREE.Path();\r\n\r\n\t\tfor ( i = 0, il = inActions.length; i < il; i ++ ) {\r\n\r\n\t\t\titem = inActions[ i ];\r\n\r\n\t\t\targs = item.args;\r\n\t\t\taction = item.action;\r\n\r\n\t\t\tif ( action == THREE.PathActions.MOVE_TO ) {\r\n\r\n\t\t\t\tif ( lastPath.actions.length != 0 ) {\r\n\r\n\t\t\t\t\tsubPaths.push( lastPath );\r\n\t\t\t\t\tlastPath = new THREE.Path();\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\tlastPath[ action ].apply( lastPath, args );\r\n\r\n\t\t}\r\n\r\n\t\tif ( lastPath.actions.length != 0 ) {\r\n\r\n\t\t\tsubPaths.push( lastPath );\r\n\r\n\t\t}\r\n\r\n\t\t// console.log(subPaths);\r\n\r\n\t\treturn\tsubPaths;\r\n\t}\r\n\r\n\tfunction toShapesNoHoles( inSubpaths ) {\r\n\r\n\t\tvar shapes = [];\r\n\r\n\t\tfor ( var i = 0, il = inSubpaths.length; i < il; i ++ ) {\r\n\r\n\t\t\tvar tmpPath = inSubpaths[ i ];\r\n\r\n\t\t\tvar tmpShape = new THREE.Shape();\r\n\t\t\ttmpShape.actions = tmpPath.actions;\r\n\t\t\ttmpShape.curves = tmpPath.curves;\r\n\r\n\t\t\tshapes.push( tmpShape );\r\n\t\t}\r\n\r\n\t\t//console.log(\"shape\", shapes);\r\n\r\n\t\treturn shapes;\r\n\t};\r\n\r\n\tfunction isPointInsidePolygon( inPt, inPolygon ) {\r\n\t\tvar EPSILON = 0.0000000001;\r\n\r\n\t\tvar polyLen = inPolygon.length;\r\n\r\n\t\t// inPt on polygon contour => immediate success or\r\n\t\t// toggling of inside/outside at every single! intersection point of an edge\r\n\t\t// with the horizontal line through inPt, left of inPt\r\n\t\t// not counting lowerY endpoints of edges and whole edges on that line\r\n\t\tvar inside = false;\r\n\t\tfor ( var p = polyLen - 1, q = 0; q < polyLen; p = q ++ ) {\r\n\t\t\tvar edgeLowPt = inPolygon[ p ];\r\n\t\t\tvar edgeHighPt = inPolygon[ q ];\r\n\r\n\t\t\tvar edgeDx = edgeHighPt.x - edgeLowPt.x;\r\n\t\t\tvar edgeDy = edgeHighPt.y - edgeLowPt.y;\r\n\r\n\t\t\tif ( Math.abs(edgeDy) > EPSILON ) {\t\t\t// not parallel\r\n\t\t\t\tif ( edgeDy < 0 ) {\r\n\t\t\t\t\tedgeLowPt = inPolygon[ q ]; edgeDx = - edgeDx;\r\n\t\t\t\t\tedgeHighPt = inPolygon[ p ]; edgeDy = - edgeDy;\r\n\t\t\t\t}\r\n\t\t\t\tif ( ( inPt.y < edgeLowPt.y ) || ( inPt.y > edgeHighPt.y ) ) \t\tcontinue;\r\n\r\n\t\t\t\tif ( inPt.y == edgeLowPt.y ) {\r\n\t\t\t\t\tif ( inPt.x == edgeLowPt.x )\t\treturn\ttrue;\t\t// inPt is on contour ?\r\n\t\t\t\t\t// continue;\t\t\t\t// no intersection or edgeLowPt => doesn't count !!!\r\n\t\t\t\t} else {\r\n\t\t\t\t\tvar perpEdge = edgeDy * (inPt.x - edgeLowPt.x) - edgeDx * (inPt.y - edgeLowPt.y);\r\n\t\t\t\t\tif ( perpEdge == 0 )\t\t\t\treturn\ttrue;\t\t// inPt is on contour ?\r\n\t\t\t\t\tif ( perpEdge < 0 ) \t\t\t\tcontinue;\r\n\t\t\t\t\tinside = ! inside;\t\t// true intersection left of inPt\r\n\t\t\t\t}\r\n\t\t\t} else {\t\t// parallel or colinear\r\n\t\t\t\tif ( inPt.y != edgeLowPt.y ) \t\tcontinue;\t\t\t// parallel\r\n\t\t\t\t// egde lies on the same horizontal line as inPt\r\n\t\t\t\tif ( ( ( edgeHighPt.x <= inPt.x ) && ( inPt.x <= edgeLowPt.x ) ) ||\r\n\t\t\t\t\t ( ( edgeLowPt.x <= inPt.x ) && ( inPt.x <= edgeHighPt.x ) ) )\t\treturn\ttrue;\t// inPt: Point on contour !\r\n\t\t\t\t// continue;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\treturn\tinside;\r\n\t}\r\n\r\n\r\n\tvar subPaths = extractSubpaths( this.actions );\r\n\tif ( subPaths.length == 0 ) return [];\r\n\r\n\tif ( noHoles === true )\treturn\ttoShapesNoHoles( subPaths );\r\n\r\n\r\n\tvar solid, tmpPath, tmpShape, shapes = [];\r\n\r\n\tif ( subPaths.length == 1) {\r\n\r\n\t\ttmpPath = subPaths[0];\r\n\t\ttmpShape = new THREE.Shape();\r\n\t\ttmpShape.actions = tmpPath.actions;\r\n\t\ttmpShape.curves = tmpPath.curves;\r\n\t\tshapes.push( tmpShape );\r\n\t\treturn shapes;\r\n\r\n\t}\r\n\r\n\tvar holesFirst = ! THREE.Shape.Utils.isClockWise( subPaths[ 0 ].getPoints() );\r\n\tholesFirst = isCCW ? ! holesFirst : holesFirst;\r\n\r\n\t// console.log(\"Holes first\", holesFirst);\r\n\t\r\n\tvar betterShapeHoles = [];\r\n\tvar newShapes = [];\r\n\tvar newShapeHoles = [];\r\n\tvar mainIdx = 0;\r\n\tvar tmpPoints;\r\n\r\n\tnewShapes[mainIdx] = undefined;\r\n\tnewShapeHoles[mainIdx] = [];\r\n\r\n\tvar i, il;\r\n\r\n\tfor ( i = 0, il = subPaths.length; i < il; i ++ ) {\r\n\r\n\t\ttmpPath = subPaths[ i ];\r\n\t\ttmpPoints = tmpPath.getPoints();\r\n\t\tsolid = THREE.Shape.Utils.isClockWise( tmpPoints );\r\n\t\tsolid = isCCW ? ! solid : solid;\r\n\r\n\t\tif ( solid ) {\r\n\r\n\t\t\tif ( (! holesFirst ) && ( newShapes[mainIdx] ) )\tmainIdx ++;\r\n\r\n\t\t\tnewShapes[mainIdx] = { s: new THREE.Shape(), p: tmpPoints };\r\n\t\t\tnewShapes[mainIdx].s.actions = tmpPath.actions;\r\n\t\t\tnewShapes[mainIdx].s.curves = tmpPath.curves;\r\n\t\t\t\r\n\t\t\tif ( holesFirst )\tmainIdx ++;\r\n\t\t\tnewShapeHoles[mainIdx] = [];\r\n\r\n\t\t\t//console.log('cw', i);\r\n\r\n\t\t} else {\r\n\r\n\t\t\tnewShapeHoles[mainIdx].push( { h: tmpPath, p: tmpPoints[0] } );\r\n\r\n\t\t\t//console.log('ccw', i);\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\t// only Holes? -> probably all Shapes with wrong orientation\r\n\tif ( ! newShapes[0] )\treturn\ttoShapesNoHoles( subPaths );\r\n\r\n\r\n\tif ( newShapes.length > 1 ) {\r\n\t\tvar ambigious = false;\r\n\t\tvar toChange = [];\r\n\r\n\t\tfor (var sIdx = 0, sLen = newShapes.length; sIdx < sLen; sIdx ++ ) {\r\n\t\t\tbetterShapeHoles[sIdx] = [];\r\n\t\t}\r\n\t\tfor (var sIdx = 0, sLen = newShapes.length; sIdx < sLen; sIdx ++ ) {\r\n\t\t\tvar sho = newShapeHoles[sIdx];\r\n\t\t\tfor (var hIdx = 0; hIdx < sho.length; hIdx ++ ) {\r\n\t\t\t\tvar ho = sho[hIdx];\r\n\t\t\t\tvar hole_unassigned = true;\r\n\t\t\t\tfor (var s2Idx = 0; s2Idx < newShapes.length; s2Idx ++ ) {\r\n\t\t\t\t\tif ( isPointInsidePolygon( ho.p, newShapes[s2Idx].p ) ) {\r\n\t\t\t\t\t\tif ( sIdx != s2Idx )\t\ttoChange.push( { froms: sIdx, tos: s2Idx, hole: hIdx } );\r\n\t\t\t\t\t\tif ( hole_unassigned ) {\r\n\t\t\t\t\t\t\thole_unassigned = false;\r\n\t\t\t\t\t\t\tbetterShapeHoles[s2Idx].push( ho );\r\n\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\tambigious = true;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tif ( hole_unassigned ) { betterShapeHoles[sIdx].push( ho ); }\r\n\t\t\t}\r\n\t\t}\r\n\t\t// console.log(\"ambigious: \", ambigious);\r\n\t\tif ( toChange.length > 0 ) {\r\n\t\t\t// console.log(\"to change: \", toChange);\r\n\t\t\tif (! ambigious)\tnewShapeHoles = betterShapeHoles;\r\n\t\t}\r\n\t}\r\n\r\n\tvar tmpHoles, j, jl;\r\n\tfor ( i = 0, il = newShapes.length; i < il; i ++ ) {\r\n\t\ttmpShape = newShapes[i].s;\r\n\t\tshapes.push( tmpShape );\r\n\t\ttmpHoles = newShapeHoles[i];\r\n\t\tfor ( j = 0, jl = tmpHoles.length; j < jl; j ++ ) {\r\n\t\t\ttmpShape.holes.push( tmpHoles[j].h );\r\n\t\t}\r\n\t}\r\n\r\n\t//console.log(\"shape\", shapes);\r\n\r\n\treturn shapes;\r\n\r\n};\r\n\r\n// File:src/extras/core/Shape.js\r\n\r\n/**\r\n * @author zz85 / http://www.lab4games.net/zz85/blog\r\n * Defines a 2d shape plane using paths.\r\n **/\r\n\r\n// STEP 1 Create a path.\r\n// STEP 2 Turn path into shape.\r\n// STEP 3 ExtrudeGeometry takes in Shape/Shapes\r\n// STEP 3a - Extract points from each shape, turn to vertices\r\n// STEP 3b - Triangulate each shape, add faces.\r\n\r\nTHREE.Shape = function () {\r\n\r\n\tTHREE.Path.apply( this, arguments );\r\n\tthis.holes = [];\r\n\r\n};\r\n\r\nTHREE.Shape.prototype = Object.create( THREE.Path.prototype );\r\nTHREE.Shape.prototype.constructor = THREE.Shape;\r\n\r\n// Convenience method to return ExtrudeGeometry\r\n\r\nTHREE.Shape.prototype.extrude = function ( options ) {\r\n\r\n\tvar extruded = new THREE.ExtrudeGeometry( this, options );\r\n\treturn extruded;\r\n\r\n};\r\n\r\n// Convenience method to return ShapeGeometry\r\n\r\nTHREE.Shape.prototype.makeGeometry = function ( options ) {\r\n\r\n\tvar geometry = new THREE.ShapeGeometry( this, options );\r\n\treturn geometry;\r\n\r\n};\r\n\r\n// Get points of holes\r\n\r\nTHREE.Shape.prototype.getPointsHoles = function ( divisions ) {\r\n\r\n\tvar i, il = this.holes.length, holesPts = [];\r\n\r\n\tfor ( i = 0; i < il; i ++ ) {\r\n\r\n\t\tholesPts[ i ] = this.holes[ i ].getTransformedPoints( divisions, this.bends );\r\n\r\n\t}\r\n\r\n\treturn holesPts;\r\n\r\n};\r\n\r\n// Get points of holes (spaced by regular distance)\r\n\r\nTHREE.Shape.prototype.getSpacedPointsHoles = function ( divisions ) {\r\n\r\n\tvar i, il = this.holes.length, holesPts = [];\r\n\r\n\tfor ( i = 0; i < il; i ++ ) {\r\n\r\n\t\tholesPts[ i ] = this.holes[ i ].getTransformedSpacedPoints( divisions, this.bends );\r\n\r\n\t}\r\n\r\n\treturn holesPts;\r\n\r\n};\r\n\r\n\r\n// Get points of shape and holes (keypoints based on segments parameter)\r\n\r\nTHREE.Shape.prototype.extractAllPoints = function ( divisions ) {\r\n\r\n\treturn {\r\n\r\n\t\tshape: this.getTransformedPoints( divisions ),\r\n\t\tholes: this.getPointsHoles( divisions )\r\n\r\n\t};\r\n\r\n};\r\n\r\nTHREE.Shape.prototype.extractPoints = function ( divisions ) {\r\n\r\n\tif (this.useSpacedPoints) {\r\n\t\treturn this.extractAllSpacedPoints(divisions);\r\n\t}\r\n\r\n\treturn this.extractAllPoints(divisions);\r\n\r\n};\r\n\r\n//\r\n// THREE.Shape.prototype.extractAllPointsWithBend = function ( divisions, bend ) {\r\n//\r\n// \treturn {\r\n//\r\n// \t\tshape: this.transform( bend, divisions ),\r\n// \t\tholes: this.getPointsHoles( divisions, bend )\r\n//\r\n// \t};\r\n//\r\n// };\r\n\r\n// Get points of shape and holes (spaced by regular distance)\r\n\r\nTHREE.Shape.prototype.extractAllSpacedPoints = function ( divisions ) {\r\n\r\n\treturn {\r\n\r\n\t\tshape: this.getTransformedSpacedPoints( divisions ),\r\n\t\tholes: this.getSpacedPointsHoles( divisions )\r\n\r\n\t};\r\n\r\n};\r\n\r\n/**************************************************************\r\n *\tUtils\r\n **************************************************************/\r\n\r\nTHREE.Shape.Utils = {\r\n\r\n\ttriangulateShape: function ( contour, holes ) {\r\n\r\n\t\tfunction point_in_segment_2D_colin( inSegPt1, inSegPt2, inOtherPt ) {\r\n\t\t\t// inOtherPt needs to be colinear to the inSegment\r\n\t\t\tif ( inSegPt1.x != inSegPt2.x ) {\r\n\t\t\t\tif ( inSegPt1.x < inSegPt2.x ) {\r\n\t\t\t\t\treturn\t( ( inSegPt1.x <= inOtherPt.x ) && ( inOtherPt.x <= inSegPt2.x ) );\r\n\t\t\t\t} else {\r\n\t\t\t\t\treturn\t( ( inSegPt2.x <= inOtherPt.x ) && ( inOtherPt.x <= inSegPt1.x ) );\r\n\t\t\t\t}\r\n\t\t\t} else {\r\n\t\t\t\tif ( inSegPt1.y < inSegPt2.y ) {\r\n\t\t\t\t\treturn\t( ( inSegPt1.y <= inOtherPt.y ) && ( inOtherPt.y <= inSegPt2.y ) );\r\n\t\t\t\t} else {\r\n\t\t\t\t\treturn\t( ( inSegPt2.y <= inOtherPt.y ) && ( inOtherPt.y <= inSegPt1.y ) );\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tfunction intersect_segments_2D( inSeg1Pt1, inSeg1Pt2, inSeg2Pt1, inSeg2Pt2, inExcludeAdjacentSegs ) {\r\n\t\t\tvar EPSILON = 0.0000000001;\r\n\r\n\t\t\tvar seg1dx = inSeg1Pt2.x - inSeg1Pt1.x, seg1dy = inSeg1Pt2.y - inSeg1Pt1.y;\r\n\t\t\tvar seg2dx = inSeg2Pt2.x - inSeg2Pt1.x, seg2dy = inSeg2Pt2.y - inSeg2Pt1.y;\r\n\r\n\t\t\tvar seg1seg2dx = inSeg1Pt1.x - inSeg2Pt1.x;\r\n\t\t\tvar seg1seg2dy = inSeg1Pt1.y - inSeg2Pt1.y;\r\n\r\n\t\t\tvar limit\t\t= seg1dy * seg2dx - seg1dx * seg2dy;\r\n\t\t\tvar perpSeg1\t= seg1dy * seg1seg2dx - seg1dx * seg1seg2dy;\r\n\r\n\t\t\tif ( Math.abs(limit) > EPSILON ) {\t\t\t// not parallel\r\n\r\n\t\t\t\tvar perpSeg2;\r\n\t\t\t\tif ( limit > 0 ) {\r\n\t\t\t\t\tif ( ( perpSeg1 < 0 ) || ( perpSeg1 > limit ) ) \t\treturn [];\r\n\t\t\t\t\tperpSeg2 = seg2dy * seg1seg2dx - seg2dx * seg1seg2dy;\r\n\t\t\t\t\tif ( ( perpSeg2 < 0 ) || ( perpSeg2 > limit ) ) \t\treturn [];\r\n\t\t\t\t} else {\r\n\t\t\t\t\tif ( ( perpSeg1 > 0 ) || ( perpSeg1 < limit ) ) \t\treturn [];\r\n\t\t\t\t\tperpSeg2 = seg2dy * seg1seg2dx - seg2dx * seg1seg2dy;\r\n\t\t\t\t\tif ( ( perpSeg2 > 0 ) || ( perpSeg2 < limit ) ) \t\treturn [];\r\n\t\t\t\t}\r\n\r\n\t\t\t\t// i.e. to reduce rounding errors\r\n\t\t\t\t// intersection at endpoint of segment#1?\r\n\t\t\t\tif ( perpSeg2 == 0 ) {\r\n\t\t\t\t\tif ( ( inExcludeAdjacentSegs ) &&\r\n\t\t\t\t\t\t ( ( perpSeg1 == 0 ) || ( perpSeg1 == limit ) ) )\t\treturn [];\r\n\t\t\t\t\treturn [ inSeg1Pt1 ];\r\n\t\t\t\t}\r\n\t\t\t\tif ( perpSeg2 == limit ) {\r\n\t\t\t\t\tif ( ( inExcludeAdjacentSegs ) &&\r\n\t\t\t\t\t\t ( ( perpSeg1 == 0 ) || ( perpSeg1 == limit ) ) )\t\treturn [];\r\n\t\t\t\t\treturn [ inSeg1Pt2 ];\r\n\t\t\t\t}\r\n\t\t\t\t// intersection at endpoint of segment#2?\r\n\t\t\t\tif ( perpSeg1 == 0 )\t\treturn [ inSeg2Pt1 ];\r\n\t\t\t\tif ( perpSeg1 == limit )\treturn [ inSeg2Pt2 ];\r\n\r\n\t\t\t\t// return real intersection point\r\n\t\t\t\tvar factorSeg1 = perpSeg2 / limit;\r\n\t\t\t\treturn\t[ { x: inSeg1Pt1.x + factorSeg1 * seg1dx,\r\n\t\t\t\t\t\t\ty: inSeg1Pt1.y + factorSeg1 * seg1dy } ];\r\n\r\n\t\t\t} else {\t\t// parallel or colinear\r\n\t\t\t\tif ( ( perpSeg1 != 0 ) ||\r\n\t\t\t\t\t ( seg2dy * seg1seg2dx != seg2dx * seg1seg2dy ) ) \t\t\treturn [];\r\n\r\n\t\t\t\t// they are collinear or degenerate\r\n\t\t\t\tvar seg1Pt = ( (seg1dx == 0) && (seg1dy == 0) );\t// segment1 ist just a point?\r\n\t\t\t\tvar seg2Pt = ( (seg2dx == 0) && (seg2dy == 0) );\t// segment2 ist just a point?\r\n\t\t\t\t// both segments are points\r\n\t\t\t\tif ( seg1Pt && seg2Pt ) {\r\n\t\t\t\t\tif ( (inSeg1Pt1.x != inSeg2Pt1.x) ||\r\n\t\t\t\t\t\t (inSeg1Pt1.y != inSeg2Pt1.y) )\t\treturn []; \t// they are distinct points\r\n\t\t\t\t\treturn [ inSeg1Pt1 ]; \t\t\t\t\t// they are the same point\r\n\t\t\t\t}\r\n\t\t\t\t// segment#1 is a single point\r\n\t\t\t\tif ( seg1Pt ) {\r\n\t\t\t\t\tif (! point_in_segment_2D_colin( inSeg2Pt1, inSeg2Pt2, inSeg1Pt1 ) )\t\treturn [];\t\t// but not in segment#2\r\n\t\t\t\t\treturn [ inSeg1Pt1 ];\r\n\t\t\t\t}\r\n\t\t\t\t// segment#2 is a single point\r\n\t\t\t\tif ( seg2Pt ) {\r\n\t\t\t\t\tif (! point_in_segment_2D_colin( inSeg1Pt1, inSeg1Pt2, inSeg2Pt1 ) )\t\treturn [];\t\t// but not in segment#1\r\n\t\t\t\t\treturn [ inSeg2Pt1 ];\r\n\t\t\t\t}\r\n\r\n\t\t\t\t// they are collinear segments, which might overlap\r\n\t\t\t\tvar seg1min, seg1max, seg1minVal, seg1maxVal;\r\n\t\t\t\tvar seg2min, seg2max, seg2minVal, seg2maxVal;\r\n\t\t\t\tif (seg1dx != 0) {\t\t// the segments are NOT on a vertical line\r\n\t\t\t\t\tif ( inSeg1Pt1.x < inSeg1Pt2.x ) {\r\n\t\t\t\t\t\tseg1min = inSeg1Pt1; seg1minVal = inSeg1Pt1.x;\r\n\t\t\t\t\t\tseg1max = inSeg1Pt2; seg1maxVal = inSeg1Pt2.x;\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tseg1min = inSeg1Pt2; seg1minVal = inSeg1Pt2.x;\r\n\t\t\t\t\t\tseg1max = inSeg1Pt1; seg1maxVal = inSeg1Pt1.x;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif ( inSeg2Pt1.x < inSeg2Pt2.x ) {\r\n\t\t\t\t\t\tseg2min = inSeg2Pt1; seg2minVal = inSeg2Pt1.x;\r\n\t\t\t\t\t\tseg2max = inSeg2Pt2; seg2maxVal = inSeg2Pt2.x;\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tseg2min = inSeg2Pt2; seg2minVal = inSeg2Pt2.x;\r\n\t\t\t\t\t\tseg2max = inSeg2Pt1; seg2maxVal = inSeg2Pt1.x;\r\n\t\t\t\t\t}\r\n\t\t\t\t} else {\t\t\t\t// the segments are on a vertical line\r\n\t\t\t\t\tif ( inSeg1Pt1.y < inSeg1Pt2.y ) {\r\n\t\t\t\t\t\tseg1min = inSeg1Pt1; seg1minVal = inSeg1Pt1.y;\r\n\t\t\t\t\t\tseg1max = inSeg1Pt2; seg1maxVal = inSeg1Pt2.y;\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tseg1min = inSeg1Pt2; seg1minVal = inSeg1Pt2.y;\r\n\t\t\t\t\t\tseg1max = inSeg1Pt1; seg1maxVal = inSeg1Pt1.y;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif ( inSeg2Pt1.y < inSeg2Pt2.y ) {\r\n\t\t\t\t\t\tseg2min = inSeg2Pt1; seg2minVal = inSeg2Pt1.y;\r\n\t\t\t\t\t\tseg2max = inSeg2Pt2; seg2maxVal = inSeg2Pt2.y;\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tseg2min = inSeg2Pt2; seg2minVal = inSeg2Pt2.y;\r\n\t\t\t\t\t\tseg2max = inSeg2Pt1; seg2maxVal = inSeg2Pt1.y;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tif ( seg1minVal <= seg2minVal ) {\r\n\t\t\t\t\tif ( seg1maxVal < seg2minVal )\treturn [];\r\n\t\t\t\t\tif ( seg1maxVal == seg2minVal )\t{\r\n\t\t\t\t\t\tif ( inExcludeAdjacentSegs )\t\treturn [];\r\n\t\t\t\t\t\treturn [ seg2min ];\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif ( seg1maxVal <= seg2maxVal )\treturn [ seg2min, seg1max ];\r\n\t\t\t\t\treturn\t[ seg2min, seg2max ];\r\n\t\t\t\t} else {\r\n\t\t\t\t\tif ( seg1minVal > seg2maxVal )\treturn [];\r\n\t\t\t\t\tif ( seg1minVal == seg2maxVal )\t{\r\n\t\t\t\t\t\tif ( inExcludeAdjacentSegs )\t\treturn [];\r\n\t\t\t\t\t\treturn [ seg1min ];\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif ( seg1maxVal <= seg2maxVal )\treturn [ seg1min, seg1max ];\r\n\t\t\t\t\treturn\t[ seg1min, seg2max ];\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tfunction isPointInsideAngle( inVertex, inLegFromPt, inLegToPt, inOtherPt ) {\r\n\t\t\t// The order of legs is important\r\n\r\n\t\t\tvar EPSILON = 0.0000000001;\r\n\r\n\t\t\t// translation of all points, so that Vertex is at (0,0)\r\n\t\t\tvar legFromPtX\t= inLegFromPt.x - inVertex.x, legFromPtY\t= inLegFromPt.y - inVertex.y;\r\n\t\t\tvar legToPtX\t= inLegToPt.x\t- inVertex.x, legToPtY\t\t= inLegToPt.y\t- inVertex.y;\r\n\t\t\tvar otherPtX\t= inOtherPt.x\t- inVertex.x, otherPtY\t\t= inOtherPt.y\t- inVertex.y;\r\n\r\n\t\t\t// main angle >0: < 180 deg.; 0: 180 deg.; <0: > 180 deg.\r\n\t\t\tvar from2toAngle\t= legFromPtX * legToPtY - legFromPtY * legToPtX;\r\n\t\t\tvar from2otherAngle\t= legFromPtX * otherPtY - legFromPtY * otherPtX;\r\n\r\n\t\t\tif ( Math.abs(from2toAngle) > EPSILON ) {\t\t\t// angle != 180 deg.\r\n\r\n\t\t\t\tvar other2toAngle\t\t= otherPtX * legToPtY - otherPtY * legToPtX;\r\n\t\t\t\t// console.log( \"from2to: \" + from2toAngle + \", from2other: \" + from2otherAngle + \", other2to: \" + other2toAngle );\r\n\r\n\t\t\t\tif ( from2toAngle > 0 ) {\t\t\t\t// main angle < 180 deg.\r\n\t\t\t\t\treturn\t( ( from2otherAngle >= 0 ) && ( other2toAngle >= 0 ) );\r\n\t\t\t\t} else {\t\t\t\t\t\t\t\t// main angle > 180 deg.\r\n\t\t\t\t\treturn\t( ( from2otherAngle >= 0 ) || ( other2toAngle >= 0 ) );\r\n\t\t\t\t}\r\n\t\t\t} else {\t\t\t\t\t\t\t\t\t\t// angle == 180 deg.\r\n\t\t\t\t// console.log( \"from2to: 180 deg., from2other: \" + from2otherAngle );\r\n\t\t\t\treturn\t( from2otherAngle > 0 );\r\n\t\t\t}\r\n\t\t}\r\n\r\n\r\n\t\tfunction removeHoles( contour, holes ) {\r\n\r\n\t\t\tvar shape = contour.concat(); // work on this shape\r\n\t\t\tvar hole;\r\n\r\n\t\t\tfunction isCutLineInsideAngles( inShapeIdx, inHoleIdx ) {\r\n\t\t\t\t// Check if hole point lies within angle around shape point\r\n\t\t\t\tvar lastShapeIdx = shape.length - 1;\r\n\r\n\t\t\t\tvar prevShapeIdx = inShapeIdx - 1;\r\n\t\t\t\tif ( prevShapeIdx < 0 )\t\t\tprevShapeIdx = lastShapeIdx;\r\n\r\n\t\t\t\tvar nextShapeIdx = inShapeIdx + 1;\r\n\t\t\t\tif ( nextShapeIdx > lastShapeIdx )\tnextShapeIdx = 0;\r\n\r\n\t\t\t\tvar insideAngle = isPointInsideAngle( shape[inShapeIdx], shape[ prevShapeIdx ], shape[ nextShapeIdx ], hole[inHoleIdx] );\r\n\t\t\t\tif (! insideAngle ) {\r\n\t\t\t\t\t// console.log( \"Vertex (Shape): \" + inShapeIdx + \", Point: \" + hole[inHoleIdx].x + \"/\" + hole[inHoleIdx].y );\r\n\t\t\t\t\treturn\tfalse;\r\n\t\t\t\t}\r\n\r\n\t\t\t\t// Check if shape point lies within angle around hole point\r\n\t\t\t\tvar lastHoleIdx = hole.length - 1;\r\n\r\n\t\t\t\tvar prevHoleIdx = inHoleIdx - 1;\r\n\t\t\t\tif ( prevHoleIdx < 0 )\t\t\tprevHoleIdx = lastHoleIdx;\r\n\r\n\t\t\t\tvar nextHoleIdx = inHoleIdx + 1;\r\n\t\t\t\tif ( nextHoleIdx > lastHoleIdx )\tnextHoleIdx = 0;\r\n\r\n\t\t\t\tinsideAngle = isPointInsideAngle( hole[inHoleIdx], hole[ prevHoleIdx ], hole[ nextHoleIdx ], shape[inShapeIdx] );\r\n\t\t\t\tif (! insideAngle ) {\r\n\t\t\t\t\t// console.log( \"Vertex (Hole): \" + inHoleIdx + \", Point: \" + shape[inShapeIdx].x + \"/\" + shape[inShapeIdx].y );\r\n\t\t\t\t\treturn\tfalse;\r\n\t\t\t\t}\r\n\r\n\t\t\t\treturn\ttrue;\r\n\t\t\t}\r\n\r\n\t\t\tfunction intersectsShapeEdge( inShapePt, inHolePt ) {\r\n\t\t\t\t// checks for intersections with shape edges\r\n\t\t\t\tvar sIdx, nextIdx, intersection;\r\n\t\t\t\tfor ( sIdx = 0; sIdx < shape.length; sIdx ++ ) {\r\n\t\t\t\t\tnextIdx = sIdx + 1; nextIdx %= shape.length;\r\n\t\t\t\t\tintersection = intersect_segments_2D( inShapePt, inHolePt, shape[sIdx], shape[nextIdx], true );\r\n\t\t\t\t\tif ( intersection.length > 0 )\t\treturn\ttrue;\r\n\t\t\t\t}\r\n\r\n\t\t\t\treturn\tfalse;\r\n\t\t\t}\r\n\r\n\t\t\tvar indepHoles = [];\r\n\r\n\t\t\tfunction intersectsHoleEdge( inShapePt, inHolePt ) {\r\n\t\t\t\t// checks for intersections with hole edges\r\n\t\t\t\tvar ihIdx, chkHole,\r\n\t\t\t\t\thIdx, nextIdx, intersection;\r\n\t\t\t\tfor ( ihIdx = 0; ihIdx < indepHoles.length; ihIdx ++ ) {\r\n\t\t\t\t\tchkHole = holes[indepHoles[ihIdx]];\r\n\t\t\t\t\tfor ( hIdx = 0; hIdx < chkHole.length; hIdx ++ ) {\r\n\t\t\t\t\t\tnextIdx = hIdx + 1; nextIdx %= chkHole.length;\r\n\t\t\t\t\t\tintersection = intersect_segments_2D( inShapePt, inHolePt, chkHole[hIdx], chkHole[nextIdx], true );\r\n\t\t\t\t\t\tif ( intersection.length > 0 )\t\treturn\ttrue;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\treturn\tfalse;\r\n\t\t\t}\r\n\r\n\t\t\tvar holeIndex, shapeIndex,\r\n\t\t\t\tshapePt, holePt,\r\n\t\t\t\tholeIdx, cutKey, failedCuts = [],\r\n\t\t\t\ttmpShape1, tmpShape2,\r\n\t\t\t\ttmpHole1, tmpHole2;\r\n\r\n\t\t\tfor ( var h = 0, hl = holes.length; h < hl; h ++ ) {\r\n\r\n\t\t\t\tindepHoles.push( h );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tvar minShapeIndex = 0;\r\n\t\t\tvar counter = indepHoles.length * 2;\r\n\t\t\twhile ( indepHoles.length > 0 ) {\r\n\t\t\t\tcounter --;\r\n\t\t\t\tif ( counter < 0 ) {\r\n\t\t\t\t\tconsole.log( \"Infinite Loop! Holes left:\" + indepHoles.length + \", Probably Hole outside Shape!\" );\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\r\n\t\t\t\t// search for shape-vertex and hole-vertex,\r\n\t\t\t\t// which can be connected without intersections\r\n\t\t\t\tfor ( shapeIndex = minShapeIndex; shapeIndex < shape.length; shapeIndex ++ ) {\r\n\r\n\t\t\t\t\tshapePt = shape[ shapeIndex ];\r\n\t\t\t\t\tholeIndex\t= - 1;\r\n\r\n\t\t\t\t\t// search for hole which can be reached without intersections\r\n\t\t\t\t\tfor ( var h = 0; h < indepHoles.length; h ++ ) {\r\n\t\t\t\t\t\tholeIdx = indepHoles[h];\r\n\r\n\t\t\t\t\t\t// prevent multiple checks\r\n\t\t\t\t\t\tcutKey = shapePt.x + \":\" + shapePt.y + \":\" + holeIdx;\r\n\t\t\t\t\t\tif ( failedCuts[cutKey] !== undefined )\t\t\tcontinue;\r\n\r\n\t\t\t\t\t\thole = holes[holeIdx];\r\n\t\t\t\t\t\tfor ( var h2 = 0; h2 < hole.length; h2 ++ ) {\r\n\t\t\t\t\t\t\tholePt = hole[ h2 ];\r\n\t\t\t\t\t\t\tif (! isCutLineInsideAngles( shapeIndex, h2 ) )\t\tcontinue;\r\n\t\t\t\t\t\t\tif ( intersectsShapeEdge( shapePt, holePt ) )\t\tcontinue;\r\n\t\t\t\t\t\t\tif ( intersectsHoleEdge( shapePt, holePt ) )\t\tcontinue;\r\n\r\n\t\t\t\t\t\t\tholeIndex = h2;\r\n\t\t\t\t\t\t\tindepHoles.splice(h, 1);\r\n\r\n\t\t\t\t\t\t\ttmpShape1 = shape.slice( 0, shapeIndex + 1 );\r\n\t\t\t\t\t\t\ttmpShape2 = shape.slice( shapeIndex );\r\n\t\t\t\t\t\t\ttmpHole1 = hole.slice( holeIndex );\r\n\t\t\t\t\t\t\ttmpHole2 = hole.slice( 0, holeIndex + 1 );\r\n\r\n\t\t\t\t\t\t\tshape = tmpShape1.concat( tmpHole1 ).concat( tmpHole2 ).concat( tmpShape2 );\r\n\r\n\t\t\t\t\t\t\tminShapeIndex = shapeIndex;\r\n\r\n\t\t\t\t\t\t\t// Debug only, to show the selected cuts\r\n\t\t\t\t\t\t\t// glob_CutLines.push( [ shapePt, holePt ] );\r\n\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tif ( holeIndex >= 0 )\tbreak;\t\t// hole-vertex found\r\n\r\n\t\t\t\t\t\tfailedCuts[cutKey] = true;\t\t\t// remember failure\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif ( holeIndex >= 0 )\tbreak;\t\t// hole-vertex found\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\treturn shape; \t\t\t/* shape with no holes */\r\n\t\t}\r\n\r\n\r\n\t\tvar i, il, f, face,\r\n\t\t\tkey, index,\r\n\t\t\tallPointsMap = {};\r\n\r\n\t\t// To maintain reference to old shape, one must match coordinates, or offset the indices from original arrays. It's probably easier to do the first.\r\n\r\n\t\tvar allpoints = contour.concat();\r\n\r\n\t\tfor ( var h = 0, hl = holes.length; h < hl; h ++ ) {\r\n\r\n\t\t\tArray.prototype.push.apply( allpoints, holes[h] );\r\n\r\n\t\t}\r\n\r\n\t\t//console.log( \"allpoints\",allpoints, allpoints.length );\r\n\r\n\t\t// prepare all points map\r\n\r\n\t\tfor ( i = 0, il = allpoints.length; i < il; i ++ ) {\r\n\r\n\t\t\tkey = allpoints[ i ].x + \":\" + allpoints[ i ].y;\r\n\r\n\t\t\tif ( allPointsMap[ key ] !== undefined ) {\r\n\r\n\t\t\t\tTHREE.warn( \"THREE.Shape: Duplicate point\", key );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tallPointsMap[ key ] = i;\r\n\r\n\t\t}\r\n\r\n\t\t// remove holes by cutting paths to holes and adding them to the shape\r\n\t\tvar shapeWithoutHoles = removeHoles( contour, holes );\r\n\r\n\t\tvar triangles = THREE.FontUtils.Triangulate( shapeWithoutHoles, false ); // True returns indices for points of spooled shape\r\n\t\t//console.log( \"triangles\",triangles, triangles.length );\r\n\r\n\t\t// check all face vertices against all points map\r\n\r\n\t\tfor ( i = 0, il = triangles.length; i < il; i ++ ) {\r\n\r\n\t\t\tface = triangles[ i ];\r\n\r\n\t\t\tfor ( f = 0; f < 3; f ++ ) {\r\n\r\n\t\t\t\tkey = face[ f ].x + \":\" + face[ f ].y;\r\n\r\n\t\t\t\tindex = allPointsMap[ key ];\r\n\r\n\t\t\t\tif ( index !== undefined ) {\r\n\r\n\t\t\t\t\tface[ f ] = index;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn triangles.concat();\r\n\r\n\t},\r\n\r\n\tisClockWise: function ( pts ) {\r\n\r\n\t\treturn THREE.FontUtils.Triangulate.area( pts ) < 0;\r\n\r\n\t},\r\n\r\n\t// Bezier Curves formulas obtained from\r\n\t// http://en.wikipedia.org/wiki/B%C3%A9zier_curve\r\n\r\n\t// Quad Bezier Functions\r\n\r\n\tb2p0: function ( t, p ) {\r\n\r\n\t\tvar k = 1 - t;\r\n\t\treturn k * k * p;\r\n\r\n\t},\r\n\r\n\tb2p1: function ( t, p ) {\r\n\r\n\t\treturn 2 * ( 1 - t ) * t * p;\r\n\r\n\t},\r\n\r\n\tb2p2: function ( t, p ) {\r\n\r\n\t\treturn t * t * p;\r\n\r\n\t},\r\n\r\n\tb2: function ( t, p0, p1, p2 ) {\r\n\r\n\t\treturn this.b2p0( t, p0 ) + this.b2p1( t, p1 ) + this.b2p2( t, p2 );\r\n\r\n\t},\r\n\r\n\t// Cubic Bezier Functions\r\n\r\n\tb3p0: function ( t, p ) {\r\n\r\n\t\tvar k = 1 - t;\r\n\t\treturn k * k * k * p;\r\n\r\n\t},\r\n\r\n\tb3p1: function ( t, p ) {\r\n\r\n\t\tvar k = 1 - t;\r\n\t\treturn 3 * k * k * t * p;\r\n\r\n\t},\r\n\r\n\tb3p2: function ( t, p ) {\r\n\r\n\t\tvar k = 1 - t;\r\n\t\treturn 3 * k * t * t * p;\r\n\r\n\t},\r\n\r\n\tb3p3: function ( t, p ) {\r\n\r\n\t\treturn t * t * t * p;\r\n\r\n\t},\r\n\r\n\tb3: function ( t, p0, p1, p2, p3 ) {\r\n\r\n\t\treturn this.b3p0( t, p0 ) + this.b3p1( t, p1 ) + this.b3p2( t, p2 ) + this.b3p3( t, p3 );\r\n\r\n\t}\r\n\r\n};\r\n\r\n\r\n// File:src/extras/curves/LineCurve.js\r\n\r\n/**************************************************************\r\n *\tLine\r\n **************************************************************/\r\n\r\nTHREE.LineCurve = function ( v1, v2 ) {\r\n\r\n\tthis.v1 = v1;\r\n\tthis.v2 = v2;\r\n\r\n};\r\n\r\nTHREE.LineCurve.prototype = Object.create( THREE.Curve.prototype );\r\nTHREE.LineCurve.prototype.constructor = THREE.LineCurve;\r\n\r\nTHREE.LineCurve.prototype.getPoint = function ( t ) {\r\n\r\n\tvar point = this.v2.clone().sub(this.v1);\r\n\tpoint.multiplyScalar( t ).add( this.v1 );\r\n\r\n\treturn point;\r\n\r\n};\r\n\r\n// Line curve is linear, so we can overwrite default getPointAt\r\n\r\nTHREE.LineCurve.prototype.getPointAt = function ( u ) {\r\n\r\n\treturn this.getPoint( u );\r\n\r\n};\r\n\r\nTHREE.LineCurve.prototype.getTangent = function( t ) {\r\n\r\n\tvar tangent = this.v2.clone().sub(this.v1);\r\n\r\n\treturn tangent.normalize();\r\n\r\n};\r\n\r\n// File:src/extras/curves/QuadraticBezierCurve.js\r\n\r\n/**************************************************************\r\n *\tQuadratic Bezier curve\r\n **************************************************************/\r\n\r\n\r\nTHREE.QuadraticBezierCurve = function ( v0, v1, v2 ) {\r\n\r\n\tthis.v0 = v0;\r\n\tthis.v1 = v1;\r\n\tthis.v2 = v2;\r\n\r\n};\r\n\r\nTHREE.QuadraticBezierCurve.prototype = Object.create( THREE.Curve.prototype );\r\nTHREE.QuadraticBezierCurve.prototype.constructor = THREE.QuadraticBezierCurve;\r\n\r\n\r\nTHREE.QuadraticBezierCurve.prototype.getPoint = function ( t ) {\r\n\r\n\tvar vector = new THREE.Vector2();\r\n\r\n\tvector.x = THREE.Shape.Utils.b2( t, this.v0.x, this.v1.x, this.v2.x );\r\n\tvector.y = THREE.Shape.Utils.b2( t, this.v0.y, this.v1.y, this.v2.y );\r\n\r\n\treturn vector;\r\n\r\n};\r\n\r\n\r\nTHREE.QuadraticBezierCurve.prototype.getTangent = function( t ) {\r\n\r\n\tvar vector = new THREE.Vector2();\r\n\r\n\tvector.x = THREE.Curve.Utils.tangentQuadraticBezier( t, this.v0.x, this.v1.x, this.v2.x );\r\n\tvector.y = THREE.Curve.Utils.tangentQuadraticBezier( t, this.v0.y, this.v1.y, this.v2.y );\r\n\r\n\t// returns unit vector\r\n\r\n\treturn vector.normalize();\r\n\r\n};\r\n\r\n// File:src/extras/curves/CubicBezierCurve.js\r\n\r\n/**************************************************************\r\n *\tCubic Bezier curve\r\n **************************************************************/\r\n\r\nTHREE.CubicBezierCurve = function ( v0, v1, v2, v3 ) {\r\n\r\n\tthis.v0 = v0;\r\n\tthis.v1 = v1;\r\n\tthis.v2 = v2;\r\n\tthis.v3 = v3;\r\n\r\n};\r\n\r\nTHREE.CubicBezierCurve.prototype = Object.create( THREE.Curve.prototype );\r\nTHREE.CubicBezierCurve.prototype.constructor = THREE.CubicBezierCurve;\r\n\r\nTHREE.CubicBezierCurve.prototype.getPoint = function ( t ) {\r\n\r\n\tvar tx, ty;\r\n\r\n\ttx = THREE.Shape.Utils.b3( t, this.v0.x, this.v1.x, this.v2.x, this.v3.x );\r\n\tty = THREE.Shape.Utils.b3( t, this.v0.y, this.v1.y, this.v2.y, this.v3.y );\r\n\r\n\treturn new THREE.Vector2( tx, ty );\r\n\r\n};\r\n\r\nTHREE.CubicBezierCurve.prototype.getTangent = function( t ) {\r\n\r\n\tvar tx, ty;\r\n\r\n\ttx = THREE.Curve.Utils.tangentCubicBezier( t, this.v0.x, this.v1.x, this.v2.x, this.v3.x );\r\n\tty = THREE.Curve.Utils.tangentCubicBezier( t, this.v0.y, this.v1.y, this.v2.y, this.v3.y );\r\n\r\n\tvar tangent = new THREE.Vector2( tx, ty );\r\n\ttangent.normalize();\r\n\r\n\treturn tangent;\r\n\r\n};\r\n\r\n// File:src/extras/curves/SplineCurve.js\r\n\r\n/**************************************************************\r\n *\tSpline curve\r\n **************************************************************/\r\n\r\nTHREE.SplineCurve = function ( points /* array of Vector2 */ ) {\r\n\r\n\tthis.points = ( points == undefined ) ? [] : points;\r\n\r\n};\r\n\r\nTHREE.SplineCurve.prototype = Object.create( THREE.Curve.prototype );\r\nTHREE.SplineCurve.prototype.constructor = THREE.SplineCurve;\r\n\r\nTHREE.SplineCurve.prototype.getPoint = function ( t ) {\r\n\r\n\tvar points = this.points;\r\n\tvar point = ( points.length - 1 ) * t;\r\n\r\n\tvar intPoint = Math.floor( point );\r\n\tvar weight = point - intPoint;\r\n\r\n\tvar point0 = points[ intPoint == 0 ? intPoint : intPoint - 1 ]\r\n\tvar point1 = points[ intPoint ]\r\n\tvar point2 = points[ intPoint > points.length - 2 ? points.length - 1 : intPoint + 1 ]\r\n\tvar point3 = points[ intPoint > points.length - 3 ? points.length - 1 : intPoint + 2 ]\r\n\r\n\tvar vector = new THREE.Vector2();\r\n\r\n\tvector.x = THREE.Curve.Utils.interpolate( point0.x, point1.x, point2.x, point3.x, weight );\r\n\tvector.y = THREE.Curve.Utils.interpolate( point0.y, point1.y, point2.y, point3.y, weight );\r\n\r\n\treturn vector;\r\n\r\n};\r\n\r\n// File:src/extras/curves/EllipseCurve.js\r\n\r\n/**************************************************************\r\n *\tEllipse curve\r\n **************************************************************/\r\n\r\nTHREE.EllipseCurve = function ( aX, aY, xRadius, yRadius, aStartAngle, aEndAngle, aClockwise ) {\r\n\r\n\tthis.aX = aX;\r\n\tthis.aY = aY;\r\n\r\n\tthis.xRadius = xRadius;\r\n\tthis.yRadius = yRadius;\r\n\r\n\tthis.aStartAngle = aStartAngle;\r\n\tthis.aEndAngle = aEndAngle;\r\n\r\n\tthis.aClockwise = aClockwise;\r\n\r\n};\r\n\r\nTHREE.EllipseCurve.prototype = Object.create( THREE.Curve.prototype );\r\nTHREE.EllipseCurve.prototype.constructor = THREE.EllipseCurve;\r\n\r\nTHREE.EllipseCurve.prototype.getPoint = function ( t ) {\r\n\r\n\tvar deltaAngle = this.aEndAngle - this.aStartAngle;\r\n\r\n\tif ( deltaAngle < 0 ) deltaAngle += Math.PI * 2;\r\n\tif ( deltaAngle > Math.PI * 2 ) deltaAngle -= Math.PI * 2;\r\n\r\n\tvar angle;\r\n\r\n\tif ( this.aClockwise === true ) {\r\n\r\n\t\tangle = this.aEndAngle + ( 1 - t ) * ( Math.PI * 2 - deltaAngle );\r\n\r\n\t} else {\r\n\r\n\t\tangle = this.aStartAngle + t * deltaAngle;\r\n\r\n\t}\r\n\t\r\n\tvar vector = new THREE.Vector2();\r\n\r\n\tvector.x = this.aX + this.xRadius * Math.cos( angle );\r\n\tvector.y = this.aY + this.yRadius * Math.sin( angle );\r\n\r\n\treturn vector;\r\n\r\n};\r\n\r\n// File:src/extras/curves/ArcCurve.js\r\n\r\n/**************************************************************\r\n *\tArc curve\r\n **************************************************************/\r\n\r\nTHREE.ArcCurve = function ( aX, aY, aRadius, aStartAngle, aEndAngle, aClockwise ) {\r\n\r\n\tTHREE.EllipseCurve.call( this, aX, aY, aRadius, aRadius, aStartAngle, aEndAngle, aClockwise );\r\n};\r\n\r\nTHREE.ArcCurve.prototype = Object.create( THREE.EllipseCurve.prototype );\r\nTHREE.ArcCurve.prototype.constructor = THREE.ArcCurve;\r\n\r\n// File:src/extras/curves/LineCurve3.js\r\n\r\n/**************************************************************\r\n *\tLine3D\r\n **************************************************************/\r\n\r\nTHREE.LineCurve3 = THREE.Curve.create(\r\n\r\n\tfunction ( v1, v2 ) {\r\n\r\n\t\tthis.v1 = v1;\r\n\t\tthis.v2 = v2;\r\n\r\n\t},\r\n\r\n\tfunction ( t ) {\r\n\r\n\t\tvar vector = new THREE.Vector3();\r\n\r\n\t\tvector.subVectors( this.v2, this.v1 ); // diff\r\n\t\tvector.multiplyScalar( t );\r\n\t\tvector.add( this.v1 );\r\n\r\n\t\treturn vector;\r\n\r\n\t}\r\n\r\n);\r\n\r\n// File:src/extras/curves/QuadraticBezierCurve3.js\r\n\r\n/**************************************************************\r\n *\tQuadratic Bezier 3D curve\r\n **************************************************************/\r\n\r\nTHREE.QuadraticBezierCurve3 = THREE.Curve.create(\r\n\r\n\tfunction ( v0, v1, v2 ) {\r\n\r\n\t\tthis.v0 = v0;\r\n\t\tthis.v1 = v1;\r\n\t\tthis.v2 = v2;\r\n\r\n\t},\r\n\r\n\tfunction ( t ) {\r\n\r\n\t\tvar vector = new THREE.Vector3();\r\n\r\n\t\tvector.x = THREE.Shape.Utils.b2( t, this.v0.x, this.v1.x, this.v2.x );\r\n\t\tvector.y = THREE.Shape.Utils.b2( t, this.v0.y, this.v1.y, this.v2.y );\r\n\t\tvector.z = THREE.Shape.Utils.b2( t, this.v0.z, this.v1.z, this.v2.z );\r\n\r\n\t\treturn vector;\r\n\r\n\t}\r\n\r\n);\r\n\r\n// File:src/extras/curves/CubicBezierCurve3.js\r\n\r\n/**************************************************************\r\n *\tCubic Bezier 3D curve\r\n **************************************************************/\r\n\r\nTHREE.CubicBezierCurve3 = THREE.Curve.create(\r\n\r\n\tfunction ( v0, v1, v2, v3 ) {\r\n\r\n\t\tthis.v0 = v0;\r\n\t\tthis.v1 = v1;\r\n\t\tthis.v2 = v2;\r\n\t\tthis.v3 = v3;\r\n\r\n\t},\r\n\r\n\tfunction ( t ) {\r\n\r\n\t\tvar vector = new THREE.Vector3();\r\n\r\n\t\tvector.x = THREE.Shape.Utils.b3( t, this.v0.x, this.v1.x, this.v2.x, this.v3.x );\r\n\t\tvector.y = THREE.Shape.Utils.b3( t, this.v0.y, this.v1.y, this.v2.y, this.v3.y );\r\n\t\tvector.z = THREE.Shape.Utils.b3( t, this.v0.z, this.v1.z, this.v2.z, this.v3.z );\r\n\r\n\t\treturn vector;\r\n\r\n\t}\r\n\r\n);\r\n\r\n// File:src/extras/curves/SplineCurve3.js\r\n\r\n/**************************************************************\r\n *\tSpline 3D curve\r\n **************************************************************/\r\n\r\n\r\nTHREE.SplineCurve3 = THREE.Curve.create(\r\n\r\n\tfunction ( points /* array of Vector3 */) {\r\n\r\n\t\tthis.points = ( points == undefined ) ? [] : points;\r\n\r\n\t},\r\n\r\n\tfunction ( t ) {\r\n\r\n\t\tvar points = this.points;\r\n\t\tvar point = ( points.length - 1 ) * t;\r\n\r\n\t\tvar intPoint = Math.floor( point );\r\n\t\tvar weight = point - intPoint;\r\n\r\n\t\tvar point0 = points[ intPoint == 0 ? intPoint : intPoint - 1 ];\r\n\t\tvar point1 = points[ intPoint ];\r\n\t\tvar point2 = points[ intPoint > points.length - 2 ? points.length - 1 : intPoint + 1 ];\r\n\t\tvar point3 = points[ intPoint > points.length - 3 ? points.length - 1 : intPoint + 2 ];\r\n\r\n\t\tvar vector = new THREE.Vector3();\r\n\r\n\t\tvector.x = THREE.Curve.Utils.interpolate( point0.x, point1.x, point2.x, point3.x, weight );\r\n\t\tvector.y = THREE.Curve.Utils.interpolate( point0.y, point1.y, point2.y, point3.y, weight );\r\n\t\tvector.z = THREE.Curve.Utils.interpolate( point0.z, point1.z, point2.z, point3.z, weight );\r\n\r\n\t\treturn vector;\r\n\r\n\t}\r\n\r\n);\r\n\r\n// File:src/extras/curves/ClosedSplineCurve3.js\r\n\r\n/**************************************************************\r\n *\tClosed Spline 3D curve\r\n **************************************************************/\r\n\r\n\r\nTHREE.ClosedSplineCurve3 = THREE.Curve.create(\r\n\r\n\tfunction ( points /* array of Vector3 */) {\r\n\r\n\t\tthis.points = ( points == undefined ) ? [] : points;\r\n\r\n\t},\r\n\r\n\tfunction ( t ) {\r\n\r\n\t\tvar points = this.points;\r\n\t\tvar point = ( points.length - 0 ) * t; // This needs to be from 0-length +1\r\n\r\n\t\tvar intPoint = Math.floor( point );\r\n\t\tvar weight = point - intPoint;\r\n\r\n\t\tintPoint += intPoint > 0 ? 0 : ( Math.floor( Math.abs( intPoint ) / points.length ) + 1 ) * points.length;\r\n\r\n\t\tvar point0 = points[ ( intPoint - 1 ) % points.length ];\r\n\t\tvar point1 = points[ ( intPoint ) % points.length ];\r\n\t\tvar point2 = points[ ( intPoint + 1 ) % points.length ];\r\n\t\tvar point3 = points[ ( intPoint + 2 ) % points.length ];\r\n\r\n\t\tvar vector = new THREE.Vector3();\r\n\r\n\t\tvector.x = THREE.Curve.Utils.interpolate( point0.x, point1.x, point2.x, point3.x, weight );\r\n\t\tvector.y = THREE.Curve.Utils.interpolate( point0.y, point1.y, point2.y, point3.y, weight );\r\n\t\tvector.z = THREE.Curve.Utils.interpolate( point0.z, point1.z, point2.z, point3.z, weight );\r\n\r\n\t\treturn vector;\r\n\r\n\t}\r\n\r\n);\r\n\r\n// File:src/extras/animation/AnimationHandler.js\r\n\r\n/**\r\n * @author mikael emtinger / http://gomo.se/\r\n */\r\n\r\nTHREE.AnimationHandler = {\r\n\r\n\tLINEAR: 0,\r\n\tCATMULLROM: 1,\r\n\tCATMULLROM_FORWARD: 2,\r\n\r\n\t//\r\n\r\n\tadd: function () { THREE.warn( 'THREE.AnimationHandler.add() has been deprecated.' ); },\r\n\tget: function () { THREE.warn( 'THREE.AnimationHandler.get() has been deprecated.' ); },\r\n\tremove: function () { THREE.warn( 'THREE.AnimationHandler.remove() has been deprecated.' ); },\r\n\r\n\t//\r\n\r\n\tanimations: [],\r\n\r\n\tinit: function ( data ) {\r\n\r\n\t\tif ( data.initialized === true ) return data;\r\n\r\n\t\t// loop through all keys\r\n\r\n\t\tfor ( var h = 0; h < data.hierarchy.length; h ++ ) {\r\n\r\n\t\t\tfor ( var k = 0; k < data.hierarchy[ h ].keys.length; k ++ ) {\r\n\r\n\t\t\t\t// remove minus times\r\n\r\n\t\t\t\tif ( data.hierarchy[ h ].keys[ k ].time < 0 ) {\r\n\r\n\t\t\t\t\t data.hierarchy[ h ].keys[ k ].time = 0;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\t// create quaternions\r\n\r\n\t\t\t\tif ( data.hierarchy[ h ].keys[ k ].rot !== undefined &&\r\n\t\t\t\t ! ( data.hierarchy[ h ].keys[ k ].rot instanceof THREE.Quaternion ) ) {\r\n\r\n\t\t\t\t\tvar quat = data.hierarchy[ h ].keys[ k ].rot;\r\n\t\t\t\t\tdata.hierarchy[ h ].keys[ k ].rot = new THREE.Quaternion().fromArray( quat );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\t// prepare morph target keys\r\n\r\n\t\t\tif ( data.hierarchy[ h ].keys.length && data.hierarchy[ h ].keys[ 0 ].morphTargets !== undefined ) {\r\n\r\n\t\t\t\t// get all used\r\n\r\n\t\t\t\tvar usedMorphTargets = {};\r\n\r\n\t\t\t\tfor ( var k = 0; k < data.hierarchy[ h ].keys.length; k ++ ) {\r\n\r\n\t\t\t\t\tfor ( var m = 0; m < data.hierarchy[ h ].keys[ k ].morphTargets.length; m ++ ) {\r\n\r\n\t\t\t\t\t\tvar morphTargetName = data.hierarchy[ h ].keys[ k ].morphTargets[ m ];\r\n\t\t\t\t\t\tusedMorphTargets[ morphTargetName ] = - 1;\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tdata.hierarchy[ h ].usedMorphTargets = usedMorphTargets;\r\n\r\n\r\n\t\t\t\t// set all used on all frames\r\n\r\n\t\t\t\tfor ( var k = 0; k < data.hierarchy[ h ].keys.length; k ++ ) {\r\n\r\n\t\t\t\t\tvar influences = {};\r\n\r\n\t\t\t\t\tfor ( var morphTargetName in usedMorphTargets ) {\r\n\r\n\t\t\t\t\t\tfor ( var m = 0; m < data.hierarchy[ h ].keys[ k ].morphTargets.length; m ++ ) {\r\n\r\n\t\t\t\t\t\t\tif ( data.hierarchy[ h ].keys[ k ].morphTargets[ m ] === morphTargetName ) {\r\n\r\n\t\t\t\t\t\t\t\tinfluences[ morphTargetName ] = data.hierarchy[ h ].keys[ k ].morphTargetsInfluences[ m ];\r\n\t\t\t\t\t\t\t\tbreak;\r\n\r\n\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\tif ( m === data.hierarchy[ h ].keys[ k ].morphTargets.length ) {\r\n\r\n\t\t\t\t\t\t\tinfluences[ morphTargetName ] = 0;\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tdata.hierarchy[ h ].keys[ k ].morphTargetsInfluences = influences;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\r\n\t\t\t// remove all keys that are on the same time\r\n\r\n\t\t\tfor ( var k = 1; k < data.hierarchy[ h ].keys.length; k ++ ) {\r\n\r\n\t\t\t\tif ( data.hierarchy[ h ].keys[ k ].time === data.hierarchy[ h ].keys[ k - 1 ].time ) {\r\n\r\n\t\t\t\t\tdata.hierarchy[ h ].keys.splice( k, 1 );\r\n\t\t\t\t\tk --;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\r\n\t\t\t// set index\r\n\r\n\t\t\tfor ( var k = 0; k < data.hierarchy[ h ].keys.length; k ++ ) {\r\n\r\n\t\t\t\tdata.hierarchy[ h ].keys[ k ].index = k;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tdata.initialized = true;\r\n\r\n\t\treturn data;\r\n\r\n\t},\r\n\r\n\tparse: function ( root ) {\r\n\r\n\t\tvar parseRecurseHierarchy = function ( root, hierarchy ) {\r\n\r\n\t\t\thierarchy.push( root );\r\n\r\n\t\t\tfor ( var c = 0; c < root.children.length; c ++ )\r\n\t\t\t\tparseRecurseHierarchy( root.children[ c ], hierarchy );\r\n\r\n\t\t};\r\n\r\n\t\t// setup hierarchy\r\n\r\n\t\tvar hierarchy = [];\r\n\r\n\t\tif ( root instanceof THREE.SkinnedMesh ) {\r\n\r\n\t\t\tfor ( var b = 0; b < root.skeleton.bones.length; b ++ ) {\r\n\r\n\t\t\t\thierarchy.push( root.skeleton.bones[ b ] );\r\n\r\n\t\t\t}\r\n\r\n\t\t} else {\r\n\r\n\t\t\tparseRecurseHierarchy( root, hierarchy );\r\n\r\n\t\t}\r\n\r\n\t\treturn hierarchy;\r\n\r\n\t},\r\n\r\n\tplay: function ( animation ) {\r\n\r\n\t\tif ( this.animations.indexOf( animation ) === - 1 ) {\r\n\r\n\t\t\tthis.animations.push( animation );\r\n\r\n\t\t}\r\n\r\n\t},\r\n\r\n\tstop: function ( animation ) {\r\n\r\n\t\tvar index = this.animations.indexOf( animation );\r\n\r\n\t\tif ( index !== - 1 ) {\r\n\r\n\t\t\tthis.animations.splice( index, 1 );\r\n\r\n\t\t}\r\n\r\n\t},\r\n\r\n\tupdate: function ( deltaTimeMS ) {\r\n\r\n\t\tfor ( var i = 0; i < this.animations.length; i ++ ) {\r\n\r\n\t\t\tthis.animations[ i ].resetBlendWeights( );\r\n\r\n\t\t}\r\n\r\n\t\tfor ( var i = 0; i < this.animations.length; i ++ ) {\r\n\r\n\t\t\tthis.animations[ i ].update( deltaTimeMS );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n};\r\n\r\n// File:src/extras/animation/Animation.js\r\n\r\n/**\r\n * @author mikael emtinger / http://gomo.se/\r\n * @author mrdoob / http://mrdoob.com/\r\n * @author alteredq / http://alteredqualia.com/\r\n */\r\n\r\nTHREE.Animation = function ( root, data ) {\r\n\r\n\tthis.root = root;\r\n\tthis.data = THREE.AnimationHandler.init( data );\r\n\tthis.hierarchy = THREE.AnimationHandler.parse( root );\r\n\r\n\tthis.currentTime = 0;\r\n\tthis.timeScale = 1;\r\n\r\n\tthis.isPlaying = false;\r\n\tthis.loop = true;\r\n\tthis.weight = 0;\r\n\r\n\tthis.interpolationType = THREE.AnimationHandler.LINEAR;\r\n\r\n};\r\n\r\nTHREE.Animation.prototype = {\r\n\r\n\tconstructor: THREE.Animation,\r\n\r\n\tkeyTypes: [ \"pos\", \"rot\", \"scl\" ],\r\n\r\n\tplay: function ( startTime, weight ) {\r\n\r\n\t\tthis.currentTime = startTime !== undefined ? startTime : 0;\r\n\t\tthis.weight = weight !== undefined ? weight : 1;\r\n\r\n\t\tthis.isPlaying = true;\r\n\r\n\t\tthis.reset();\r\n\r\n\t\tTHREE.AnimationHandler.play( this );\r\n\r\n\t},\r\n\r\n\tstop: function() {\r\n\r\n\t\tthis.isPlaying = false;\r\n\r\n\t\tTHREE.AnimationHandler.stop( this );\r\n\r\n\t},\r\n\r\n\treset: function () {\r\n\r\n\t\tfor ( var h = 0, hl = this.hierarchy.length; h < hl; h ++ ) {\r\n\r\n\t\t\tvar object = this.hierarchy[ h ];\r\n\r\n\t\t\tif ( object.animationCache === undefined ) {\r\n\r\n\t\t\t\tobject.animationCache = {\r\n\t\t\t\t\tanimations: {},\r\n\t\t\t\t\tblending: {\r\n\t\t\t\t\t\tpositionWeight: 0.0,\r\n\t\t\t\t\t\tquaternionWeight: 0.0,\r\n\t\t\t\t\t\tscaleWeight: 0.0\r\n\t\t\t\t\t}\r\n\t\t\t\t};\r\n\t\t\t}\r\n\r\n\t\t\tvar name = this.data.name;\r\n\t\t\tvar animations = object.animationCache.animations;\r\n\t\t\tvar animationCache = animations[ name ];\r\n\r\n\t\t\tif ( animationCache === undefined ) {\r\n\r\n\t\t\t\tanimationCache = {\r\n\t\t\t\t\tprevKey: { pos: 0, rot: 0, scl: 0 },\r\n\t\t\t\t\tnextKey: { pos: 0, rot: 0, scl: 0 },\r\n\t\t\t\t\toriginalMatrix: object.matrix\r\n\t\t\t\t};\r\n\r\n\t\t\t\tanimations[ name ] = animationCache;\r\n\r\n\t\t\t}\r\n\r\n\t\t\t// Get keys to match our current time\r\n\r\n\t\t\tfor ( var t = 0; t < 3; t ++ ) {\r\n\r\n\t\t\t\tvar type = this.keyTypes[ t ];\r\n\r\n\t\t\t\tvar prevKey = this.data.hierarchy[ h ].keys[ 0 ];\r\n\t\t\t\tvar nextKey = this.getNextKeyWith( type, h, 1 );\r\n\r\n\t\t\t\twhile ( nextKey.time < this.currentTime && nextKey.index > prevKey.index ) {\r\n\r\n\t\t\t\t\tprevKey = nextKey;\r\n\t\t\t\t\tnextKey = this.getNextKeyWith( type, h, nextKey.index + 1 );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tanimationCache.prevKey[ type ] = prevKey;\r\n\t\t\t\tanimationCache.nextKey[ type ] = nextKey;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t},\r\n\r\n\tresetBlendWeights: function () {\r\n\r\n\t\tfor ( var h = 0, hl = this.hierarchy.length; h < hl; h ++ ) {\r\n\r\n\t\t\tvar object = this.hierarchy[ h ];\r\n\t\t\tvar animationCache = object.animationCache;\r\n\r\n\t\t\tif ( animationCache !== undefined ) {\r\n\r\n\t\t\t\tvar blending = animationCache.blending;\r\n\r\n\t\t\t\tblending.positionWeight = 0.0;\r\n\t\t\t\tblending.quaternionWeight = 0.0;\r\n\t\t\t\tblending.scaleWeight = 0.0;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t},\r\n\r\n\tupdate: ( function() {\r\n\r\n\t\tvar points = [];\r\n\t\tvar target = new THREE.Vector3();\r\n\t\tvar newVector = new THREE.Vector3();\r\n\t\tvar newQuat = new THREE.Quaternion();\r\n\r\n\t\t// Catmull-Rom spline\r\n\r\n\t\tvar interpolateCatmullRom = function ( points, scale ) {\r\n\r\n\t\t\tvar c = [], v3 = [],\r\n\t\t\tpoint, intPoint, weight, w2, w3,\r\n\t\t\tpa, pb, pc, pd;\r\n\r\n\t\t\tpoint = ( points.length - 1 ) * scale;\r\n\t\t\tintPoint = Math.floor( point );\r\n\t\t\tweight = point - intPoint;\r\n\r\n\t\t\tc[ 0 ] = intPoint === 0 ? intPoint : intPoint - 1;\r\n\t\t\tc[ 1 ] = intPoint;\r\n\t\t\tc[ 2 ] = intPoint > points.length - 2 ? intPoint : intPoint + 1;\r\n\t\t\tc[ 3 ] = intPoint > points.length - 3 ? intPoint : intPoint + 2;\r\n\r\n\t\t\tpa = points[ c[ 0 ] ];\r\n\t\t\tpb = points[ c[ 1 ] ];\r\n\t\t\tpc = points[ c[ 2 ] ];\r\n\t\t\tpd = points[ c[ 3 ] ];\r\n\r\n\t\t\tw2 = weight * weight;\r\n\t\t\tw3 = weight * w2;\r\n\r\n\t\t\tv3[ 0 ] = interpolate( pa[ 0 ], pb[ 0 ], pc[ 0 ], pd[ 0 ], weight, w2, w3 );\r\n\t\t\tv3[ 1 ] = interpolate( pa[ 1 ], pb[ 1 ], pc[ 1 ], pd[ 1 ], weight, w2, w3 );\r\n\t\t\tv3[ 2 ] = interpolate( pa[ 2 ], pb[ 2 ], pc[ 2 ], pd[ 2 ], weight, w2, w3 );\r\n\r\n\t\t\treturn v3;\r\n\r\n\t\t};\r\n\r\n\t\tvar interpolate = function ( p0, p1, p2, p3, t, t2, t3 ) {\r\n\r\n\t\t\tvar v0 = ( p2 - p0 ) * 0.5,\r\n\t\t\t\tv1 = ( p3 - p1 ) * 0.5;\r\n\r\n\t\t\treturn ( 2 * ( p1 - p2 ) + v0 + v1 ) * t3 + ( - 3 * ( p1 - p2 ) - 2 * v0 - v1 ) * t2 + v0 * t + p1;\r\n\r\n\t\t};\r\n\r\n\t\treturn function ( delta ) {\r\n\r\n\t\t\tif ( this.isPlaying === false ) return;\r\n\r\n\t\t\tthis.currentTime += delta * this.timeScale;\r\n\r\n\t\t\tif ( this.weight === 0 )\r\n\t\t\t\treturn;\r\n\r\n\t\t\t//\r\n\r\n\t\t\tvar duration = this.data.length;\r\n\r\n\t\t\tif ( this.currentTime > duration || this.currentTime < 0 ) {\r\n\r\n\t\t\t\tif ( this.loop ) {\r\n\r\n\t\t\t\t\tthis.currentTime %= duration;\r\n\r\n\t\t\t\t\tif ( this.currentTime < 0 )\r\n\t\t\t\t\t\tthis.currentTime += duration;\r\n\r\n\t\t\t\t\tthis.reset();\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\tthis.stop();\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\tfor ( var h = 0, hl = this.hierarchy.length; h < hl; h ++ ) {\r\n\r\n\t\t\t\tvar object = this.hierarchy[ h ];\r\n\t\t\t\tvar animationCache = object.animationCache.animations[this.data.name];\r\n\t\t\t\tvar blending = object.animationCache.blending;\r\n\r\n\t\t\t\t// loop through pos/rot/scl\r\n\r\n\t\t\t\tfor ( var t = 0; t < 3; t ++ ) {\r\n\r\n\t\t\t\t\t// get keys\r\n\r\n\t\t\t\t\tvar type = this.keyTypes[ t ];\r\n\t\t\t\t\tvar prevKey = animationCache.prevKey[ type ];\r\n\t\t\t\t\tvar nextKey = animationCache.nextKey[ type ];\r\n\r\n\t\t\t\t\tif ( ( this.timeScale > 0 && nextKey.time <= this.currentTime ) ||\r\n\t\t\t\t\t\t( this.timeScale < 0 && prevKey.time >= this.currentTime ) ) {\r\n\r\n\t\t\t\t\t\tprevKey = this.data.hierarchy[ h ].keys[ 0 ];\r\n\t\t\t\t\t\tnextKey = this.getNextKeyWith( type, h, 1 );\r\n\r\n\t\t\t\t\t\twhile ( nextKey.time < this.currentTime && nextKey.index > prevKey.index ) {\r\n\r\n\t\t\t\t\t\t\tprevKey = nextKey;\r\n\t\t\t\t\t\t\tnextKey = this.getNextKeyWith( type, h, nextKey.index + 1 );\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\tanimationCache.prevKey[ type ] = prevKey;\r\n\t\t\t\t\t\tanimationCache.nextKey[ type ] = nextKey;\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tvar scale = ( this.currentTime - prevKey.time ) / ( nextKey.time - prevKey.time );\r\n\r\n\t\t\t\t\tvar prevXYZ = prevKey[ type ];\r\n\t\t\t\t\tvar nextXYZ = nextKey[ type ];\r\n\r\n\t\t\t\t\tif ( scale < 0 ) scale = 0;\r\n\t\t\t\t\tif ( scale > 1 ) scale = 1;\r\n\r\n\t\t\t\t\t// interpolate\r\n\r\n\t\t\t\t\tif ( type === \"pos\" ) {\r\n\r\n\t\t\t\t\t\tif ( this.interpolationType === THREE.AnimationHandler.LINEAR ) {\r\n\r\n\t\t\t\t\t\t\tnewVector.x = prevXYZ[ 0 ] + ( nextXYZ[ 0 ] - prevXYZ[ 0 ] ) * scale;\r\n\t\t\t\t\t\t\tnewVector.y = prevXYZ[ 1 ] + ( nextXYZ[ 1 ] - prevXYZ[ 1 ] ) * scale;\r\n\t\t\t\t\t\t\tnewVector.z = prevXYZ[ 2 ] + ( nextXYZ[ 2 ] - prevXYZ[ 2 ] ) * scale;\r\n\r\n\t\t\t\t\t\t\t// blend\r\n\t\t\t\t\t\t\tvar proportionalWeight = this.weight / ( this.weight + blending.positionWeight );\r\n\t\t\t\t\t\t\tobject.position.lerp( newVector, proportionalWeight );\r\n\t\t\t\t\t\t\tblending.positionWeight += this.weight;\r\n\r\n\t\t\t\t\t\t} else if ( this.interpolationType === THREE.AnimationHandler.CATMULLROM ||\r\n\t\t\t\t\t\t\t\t\tthis.interpolationType === THREE.AnimationHandler.CATMULLROM_FORWARD ) {\r\n\r\n\t\t\t\t\t\t\tpoints[ 0 ] = this.getPrevKeyWith( \"pos\", h, prevKey.index - 1 )[ \"pos\" ];\r\n\t\t\t\t\t\t\tpoints[ 1 ] = prevXYZ;\r\n\t\t\t\t\t\t\tpoints[ 2 ] = nextXYZ;\r\n\t\t\t\t\t\t\tpoints[ 3 ] = this.getNextKeyWith( \"pos\", h, nextKey.index + 1 )[ \"pos\" ];\r\n\r\n\t\t\t\t\t\t\tscale = scale * 0.33 + 0.33;\r\n\r\n\t\t\t\t\t\t\tvar currentPoint = interpolateCatmullRom( points, scale );\r\n\t\t\t\t\t\t\tvar proportionalWeight = this.weight / ( this.weight + blending.positionWeight );\r\n\t\t\t\t\t\t\tblending.positionWeight += this.weight;\r\n\r\n\t\t\t\t\t\t\t// blend\r\n\r\n\t\t\t\t\t\t\tvar vector = object.position;\r\n\r\n\t\t\t\t\t\t\tvector.x = vector.x + ( currentPoint[ 0 ] - vector.x ) * proportionalWeight;\r\n\t\t\t\t\t\t\tvector.y = vector.y + ( currentPoint[ 1 ] - vector.y ) * proportionalWeight;\r\n\t\t\t\t\t\t\tvector.z = vector.z + ( currentPoint[ 2 ] - vector.z ) * proportionalWeight;\r\n\r\n\t\t\t\t\t\t\tif ( this.interpolationType === THREE.AnimationHandler.CATMULLROM_FORWARD ) {\r\n\r\n\t\t\t\t\t\t\t\tvar forwardPoint = interpolateCatmullRom( points, scale * 1.01 );\r\n\r\n\t\t\t\t\t\t\t\ttarget.set( forwardPoint[ 0 ], forwardPoint[ 1 ], forwardPoint[ 2 ] );\r\n\t\t\t\t\t\t\t\ttarget.sub( vector );\r\n\t\t\t\t\t\t\t\ttarget.y = 0;\r\n\t\t\t\t\t\t\t\ttarget.normalize();\r\n\r\n\t\t\t\t\t\t\t\tvar angle = Math.atan2( target.x, target.z );\r\n\t\t\t\t\t\t\t\tobject.rotation.set( 0, angle, 0 );\r\n\r\n\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t} else if ( type === \"rot\" ) {\r\n\r\n\t\t\t\t\t\tTHREE.Quaternion.slerp( prevXYZ, nextXYZ, newQuat, scale );\r\n\r\n\t\t\t\t\t\t// Avoid paying the cost of an additional slerp if we don't have to\r\n\t\t\t\t\t\tif ( blending.quaternionWeight === 0 ) {\r\n\r\n\t\t\t\t\t\t\tobject.quaternion.copy(newQuat);\r\n\t\t\t\t\t\t\tblending.quaternionWeight = this.weight;\r\n\r\n\t\t\t\t\t\t} else {\r\n\r\n\t\t\t\t\t\t\tvar proportionalWeight = this.weight / ( this.weight + blending.quaternionWeight );\r\n\t\t\t\t\t\t\tTHREE.Quaternion.slerp( object.quaternion, newQuat, object.quaternion, proportionalWeight );\r\n\t\t\t\t\t\t\tblending.quaternionWeight += this.weight;\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t} else if ( type === \"scl\" ) {\r\n\r\n\t\t\t\t\t\tnewVector.x = prevXYZ[ 0 ] + ( nextXYZ[ 0 ] - prevXYZ[ 0 ] ) * scale;\r\n\t\t\t\t\t\tnewVector.y = prevXYZ[ 1 ] + ( nextXYZ[ 1 ] - prevXYZ[ 1 ] ) * scale;\r\n\t\t\t\t\t\tnewVector.z = prevXYZ[ 2 ] + ( nextXYZ[ 2 ] - prevXYZ[ 2 ] ) * scale;\r\n\r\n\t\t\t\t\t\tvar proportionalWeight = this.weight / ( this.weight + blending.scaleWeight );\r\n\t\t\t\t\t\tobject.scale.lerp( newVector, proportionalWeight );\r\n\t\t\t\t\t\tblending.scaleWeight += this.weight;\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\treturn true;\r\n\r\n\t\t};\r\n\r\n\t} )(),\r\n\r\n\tgetNextKeyWith: function ( type, h, key ) {\r\n\r\n\t\tvar keys = this.data.hierarchy[ h ].keys;\r\n\r\n\t\tif ( this.interpolationType === THREE.AnimationHandler.CATMULLROM ||\r\n\t\t\t this.interpolationType === THREE.AnimationHandler.CATMULLROM_FORWARD ) {\r\n\r\n\t\t\tkey = key < keys.length - 1 ? key : keys.length - 1;\r\n\r\n\t\t} else {\r\n\r\n\t\t\tkey = key % keys.length;\r\n\r\n\t\t}\r\n\r\n\t\tfor ( ; key < keys.length; key ++ ) {\r\n\r\n\t\t\tif ( keys[ key ][ type ] !== undefined ) {\r\n\r\n\t\t\t\treturn keys[ key ];\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn this.data.hierarchy[ h ].keys[ 0 ];\r\n\r\n\t},\r\n\r\n\tgetPrevKeyWith: function ( type, h, key ) {\r\n\r\n\t\tvar keys = this.data.hierarchy[ h ].keys;\r\n\r\n\t\tif ( this.interpolationType === THREE.AnimationHandler.CATMULLROM ||\r\n\t\t\tthis.interpolationType === THREE.AnimationHandler.CATMULLROM_FORWARD ) {\r\n\r\n\t\t\tkey = key > 0 ? key : 0;\r\n\r\n\t\t} else {\r\n\r\n\t\t\tkey = key >= 0 ? key : key + keys.length;\r\n\r\n\t\t}\r\n\r\n\r\n\t\tfor ( ; key >= 0; key -- ) {\r\n\r\n\t\t\tif ( keys[ key ][ type ] !== undefined ) {\r\n\r\n\t\t\t\treturn keys[ key ];\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn this.data.hierarchy[ h ].keys[ keys.length - 1 ];\r\n\r\n\t}\r\n\r\n};\r\n\r\n// File:src/extras/animation/KeyFrameAnimation.js\r\n\r\n/**\r\n * @author mikael emtinger / http://gomo.se/\r\n * @author mrdoob / http://mrdoob.com/\r\n * @author alteredq / http://alteredqualia.com/\r\n * @author khang duong\r\n * @author erik kitson\r\n */\r\n\r\nTHREE.KeyFrameAnimation = function ( data ) {\r\n\r\n\tthis.root = data.node;\r\n\tthis.data = THREE.AnimationHandler.init( data );\r\n\tthis.hierarchy = THREE.AnimationHandler.parse( this.root );\r\n\tthis.currentTime = 0;\r\n\tthis.timeScale = 0.001;\r\n\tthis.isPlaying = false;\r\n\tthis.isPaused = true;\r\n\tthis.loop = true;\r\n\r\n\t// initialize to first keyframes\r\n\r\n\tfor ( var h = 0, hl = this.hierarchy.length; h < hl; h ++ ) {\r\n\r\n\t\tvar keys = this.data.hierarchy[h].keys,\r\n\t\t\tsids = this.data.hierarchy[h].sids,\r\n\t\t\tobj = this.hierarchy[h];\r\n\r\n\t\tif ( keys.length && sids ) {\r\n\r\n\t\t\tfor ( var s = 0; s < sids.length; s ++ ) {\r\n\r\n\t\t\t\tvar sid = sids[ s ],\r\n\t\t\t\t\tnext = this.getNextKeyWith( sid, h, 0 );\r\n\r\n\t\t\t\tif ( next ) {\r\n\r\n\t\t\t\t\tnext.apply( sid );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\tobj.matrixAutoUpdate = false;\r\n\t\t\tthis.data.hierarchy[h].node.updateMatrix();\r\n\t\t\tobj.matrixWorldNeedsUpdate = true;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n};\r\n\r\nTHREE.KeyFrameAnimation.prototype = {\r\n\r\n\tconstructor: THREE.KeyFrameAnimation,\r\n\r\n\tplay: function ( startTime ) {\r\n\r\n\t\tthis.currentTime = startTime !== undefined ? startTime : 0;\r\n\r\n\t\tif ( this.isPlaying === false ) {\r\n\r\n\t\t\tthis.isPlaying = true;\r\n\r\n\t\t\t// reset key cache\r\n\r\n\t\t\tvar h, hl = this.hierarchy.length,\r\n\t\t\t\tobject,\r\n\t\t\t\tnode;\r\n\r\n\t\t\tfor ( h = 0; h < hl; h ++ ) {\r\n\r\n\t\t\t\tobject = this.hierarchy[ h ];\r\n\t\t\t\tnode = this.data.hierarchy[ h ];\r\n\r\n\t\t\t\tif ( node.animationCache === undefined ) {\r\n\r\n\t\t\t\t\tnode.animationCache = {};\r\n\t\t\t\t\tnode.animationCache.prevKey = null;\r\n\t\t\t\t\tnode.animationCache.nextKey = null;\r\n\t\t\t\t\tnode.animationCache.originalMatrix = object.matrix;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tvar keys = this.data.hierarchy[h].keys;\r\n\r\n\t\t\t\tif (keys.length) {\r\n\r\n\t\t\t\t\tnode.animationCache.prevKey = keys[ 0 ];\r\n\t\t\t\t\tnode.animationCache.nextKey = keys[ 1 ];\r\n\r\n\t\t\t\t\tthis.startTime = Math.min( keys[0].time, this.startTime );\r\n\t\t\t\t\tthis.endTime = Math.max( keys[keys.length - 1].time, this.endTime );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\tthis.update( 0 );\r\n\r\n\t\t}\r\n\r\n\t\tthis.isPaused = false;\r\n\r\n\t\tTHREE.AnimationHandler.play( this );\r\n\r\n\t},\r\n\r\n\tstop: function () {\r\n\r\n\t\tthis.isPlaying = false;\r\n\t\tthis.isPaused = false;\r\n\r\n\t\tTHREE.AnimationHandler.stop( this );\r\n\r\n\t\t// reset JIT matrix and remove cache\r\n\r\n\t\tfor ( var h = 0; h < this.data.hierarchy.length; h ++ ) {\r\n\r\n\t\t\tvar obj = this.hierarchy[ h ];\r\n\t\t\tvar node = this.data.hierarchy[ h ];\r\n\r\n\t\t\tif ( node.animationCache !== undefined ) {\r\n\r\n\t\t\t\tvar original = node.animationCache.originalMatrix;\r\n\r\n\t\t\t\toriginal.copy( obj.matrix );\r\n\t\t\t\tobj.matrix = original;\r\n\r\n\t\t\t\tdelete node.animationCache;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t},\r\n\r\n\tupdate: function ( delta ) {\r\n\r\n\t\tif ( this.isPlaying === false ) return;\r\n\r\n\t\tthis.currentTime += delta * this.timeScale;\r\n\r\n\t\t//\r\n\r\n\t\tvar duration = this.data.length;\r\n\r\n\t\tif ( this.loop === true && this.currentTime > duration ) {\r\n\r\n\t\t\tthis.currentTime %= duration;\r\n\r\n\t\t}\r\n\r\n\t\tthis.currentTime = Math.min( this.currentTime, duration );\r\n\r\n\t\tfor ( var h = 0, hl = this.hierarchy.length; h < hl; h ++ ) {\r\n\r\n\t\t\tvar object = this.hierarchy[ h ];\r\n\t\t\tvar node = this.data.hierarchy[ h ];\r\n\r\n\t\t\tvar keys = node.keys,\r\n\t\t\t\tanimationCache = node.animationCache;\r\n\r\n\r\n\t\t\tif ( keys.length ) {\r\n\r\n\t\t\t\tvar prevKey = animationCache.prevKey;\r\n\t\t\t\tvar nextKey = animationCache.nextKey;\r\n\r\n\t\t\t\tif ( nextKey.time <= this.currentTime ) {\r\n\r\n\t\t\t\t\twhile ( nextKey.time < this.currentTime && nextKey.index > prevKey.index ) {\r\n\r\n\t\t\t\t\t\tprevKey = nextKey;\r\n\t\t\t\t\t\tnextKey = keys[ prevKey.index + 1 ];\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tanimationCache.prevKey = prevKey;\r\n\t\t\t\t\tanimationCache.nextKey = nextKey;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif ( nextKey.time >= this.currentTime ) {\r\n\r\n\t\t\t\t\tprevKey.interpolate( nextKey, this.currentTime );\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\tprevKey.interpolate( nextKey, nextKey.time );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tthis.data.hierarchy[ h ].node.updateMatrix();\r\n\t\t\t\tobject.matrixWorldNeedsUpdate = true;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t},\r\n\r\n\tgetNextKeyWith: function ( sid, h, key ) {\r\n\r\n\t\tvar keys = this.data.hierarchy[ h ].keys;\r\n\t\tkey = key % keys.length;\r\n\r\n\t\tfor ( ; key < keys.length; key ++ ) {\r\n\r\n\t\t\tif ( keys[ key ].hasTarget( sid ) ) {\r\n\r\n\t\t\t\treturn keys[ key ];\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn keys[ 0 ];\r\n\r\n\t},\r\n\r\n\tgetPrevKeyWith: function ( sid, h, key ) {\r\n\r\n\t\tvar keys = this.data.hierarchy[ h ].keys;\r\n\t\tkey = key >= 0 ? key : key + keys.length;\r\n\r\n\t\tfor ( ; key >= 0; key -- ) {\r\n\r\n\t\t\tif ( keys[ key ].hasTarget( sid ) ) {\r\n\r\n\t\t\t\treturn keys[ key ];\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn keys[ keys.length - 1 ];\r\n\r\n\t}\r\n\r\n};\r\n\r\n// File:src/extras/animation/MorphAnimation.js\r\n\r\n/**\r\n * @author mrdoob / http://mrdoob.com\r\n * @author willy-vvu / http://willy-vvu.github.io\r\n */\r\n\r\nTHREE.MorphAnimation = function ( mesh ) {\r\n\r\n\tthis.mesh = mesh;\r\n\tthis.frames = mesh.morphTargetInfluences.length;\r\n\tthis.currentTime = 0;\r\n\tthis.duration = 1000;\r\n\tthis.loop = true;\r\n\tthis.lastFrame = 0;\r\n\tthis.currentFrame = 0;\r\n\r\n\tthis.isPlaying = false;\r\n\r\n};\r\n\r\nTHREE.MorphAnimation.prototype = {\r\n\r\n\tconstructor: THREE.MorphAnimation,\r\n\r\n\tplay: function () {\r\n\r\n\t\tthis.isPlaying = true;\r\n\r\n\t},\r\n\r\n\tpause: function () {\r\n\r\n\t\tthis.isPlaying = false;\r\n\r\n\t},\r\n\r\n\tupdate: function ( delta ) {\r\n\r\n\t\tif ( this.isPlaying === false ) return;\r\n\r\n\t\tthis.currentTime += delta;\r\n\r\n\t\tif ( this.loop === true && this.currentTime > this.duration ) {\r\n\r\n\t\t\tthis.currentTime %= this.duration;\r\n\r\n\t\t}\r\n\r\n\t\tthis.currentTime = Math.min( this.currentTime, this.duration );\r\n\r\n\t\tvar interpolation = this.duration / this.frames;\r\n\t\tvar frame = Math.floor( this.currentTime / interpolation );\r\n\r\n\t\tvar influences = this.mesh.morphTargetInfluences;\r\n\r\n\t\tif ( frame != this.currentFrame ) {\r\n\r\n\t\t\tinfluences[ this.lastFrame ] = 0;\r\n\t\t\tinfluences[ this.currentFrame ] = 1;\r\n\t\t\tinfluences[ frame ] = 0;\r\n\r\n\t\t\tthis.lastFrame = this.currentFrame;\r\n\t\t\tthis.currentFrame = frame;\r\n\r\n\t\t}\r\n\r\n\t\tinfluences[ frame ] = ( this.currentTime % interpolation ) / interpolation;\r\n\t\tinfluences[ this.lastFrame ] = 1 - influences[ frame ];\r\n\r\n\t}\r\n\r\n};\r\n\r\n// File:src/extras/geometries/BoxGeometry.js\r\n\r\n/**\r\n * @author mrdoob / http://mrdoob.com/\r\n * based on http://papervision3d.googlecode.com/svn/trunk/as3/trunk/src/org/papervision3d/objects/primitives/Cube.as\r\n */\r\n\r\nTHREE.BoxGeometry = function ( width, height, depth, widthSegments, heightSegments, depthSegments ) {\r\n\r\n\tTHREE.Geometry.call( this );\r\n\r\n\tthis.type = 'BoxGeometry';\r\n\r\n\tthis.parameters = {\r\n\t\twidth: width,\r\n\t\theight: height,\r\n\t\tdepth: depth,\r\n\t\twidthSegments: widthSegments,\r\n\t\theightSegments: heightSegments,\r\n\t\tdepthSegments: depthSegments\r\n\t};\r\n\r\n\tthis.widthSegments = widthSegments || 1;\r\n\tthis.heightSegments = heightSegments || 1;\r\n\tthis.depthSegments = depthSegments || 1;\r\n\r\n\tvar scope = this;\r\n\r\n\tvar width_half = width / 2;\r\n\tvar height_half = height / 2;\r\n\tvar depth_half = depth / 2;\r\n\r\n\tbuildPlane( 'z', 'y', - 1, - 1, depth, height, width_half, 0 ); // px\r\n\tbuildPlane( 'z', 'y', 1, - 1, depth, height, - width_half, 1 ); // nx\r\n\tbuildPlane( 'x', 'z', 1, 1, width, depth, height_half, 2 ); // py\r\n\tbuildPlane( 'x', 'z', 1, - 1, width, depth, - height_half, 3 ); // ny\r\n\tbuildPlane( 'x', 'y', 1, - 1, width, height, depth_half, 4 ); // pz\r\n\tbuildPlane( 'x', 'y', - 1, - 1, width, height, - depth_half, 5 ); // nz\r\n\r\n\tfunction buildPlane( u, v, udir, vdir, width, height, depth, materialIndex ) {\r\n\r\n\t\tvar w, ix, iy,\r\n\t\tgridX = scope.widthSegments,\r\n\t\tgridY = scope.heightSegments,\r\n\t\twidth_half = width / 2,\r\n\t\theight_half = height / 2,\r\n\t\toffset = scope.vertices.length;\r\n\r\n\t\tif ( ( u === 'x' && v === 'y' ) || ( u === 'y' && v === 'x' ) ) {\r\n\r\n\t\t\tw = 'z';\r\n\r\n\t\t} else if ( ( u === 'x' && v === 'z' ) || ( u === 'z' && v === 'x' ) ) {\r\n\r\n\t\t\tw = 'y';\r\n\t\t\tgridY = scope.depthSegments;\r\n\r\n\t\t} else if ( ( u === 'z' && v === 'y' ) || ( u === 'y' && v === 'z' ) ) {\r\n\r\n\t\t\tw = 'x';\r\n\t\t\tgridX = scope.depthSegments;\r\n\r\n\t\t}\r\n\r\n\t\tvar gridX1 = gridX + 1,\r\n\t\tgridY1 = gridY + 1,\r\n\t\tsegment_width = width / gridX,\r\n\t\tsegment_height = height / gridY,\r\n\t\tnormal = new THREE.Vector3();\r\n\r\n\t\tnormal[ w ] = depth > 0 ? 1 : - 1;\r\n\r\n\t\tfor ( iy = 0; iy < gridY1; iy ++ ) {\r\n\r\n\t\t\tfor ( ix = 0; ix < gridX1; ix ++ ) {\r\n\r\n\t\t\t\tvar vector = new THREE.Vector3();\r\n\t\t\t\tvector[ u ] = ( ix * segment_width - width_half ) * udir;\r\n\t\t\t\tvector[ v ] = ( iy * segment_height - height_half ) * vdir;\r\n\t\t\t\tvector[ w ] = depth;\r\n\r\n\t\t\t\tscope.vertices.push( vector );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tfor ( iy = 0; iy < gridY; iy ++ ) {\r\n\r\n\t\t\tfor ( ix = 0; ix < gridX; ix ++ ) {\r\n\r\n\t\t\t\tvar a = ix + gridX1 * iy;\r\n\t\t\t\tvar b = ix + gridX1 * ( iy + 1 );\r\n\t\t\t\tvar c = ( ix + 1 ) + gridX1 * ( iy + 1 );\r\n\t\t\t\tvar d = ( ix + 1 ) + gridX1 * iy;\r\n\r\n\t\t\t\tvar uva = new THREE.Vector2( ix / gridX, 1 - iy / gridY );\r\n\t\t\t\tvar uvb = new THREE.Vector2( ix / gridX, 1 - ( iy + 1 ) / gridY );\r\n\t\t\t\tvar uvc = new THREE.Vector2( ( ix + 1 ) / gridX, 1 - ( iy + 1 ) / gridY );\r\n\t\t\t\tvar uvd = new THREE.Vector2( ( ix + 1 ) / gridX, 1 - iy / gridY );\r\n\r\n\t\t\t\tvar face = new THREE.Face3( a + offset, b + offset, d + offset );\r\n\t\t\t\tface.normal.copy( normal );\r\n\t\t\t\tface.vertexNormals.push( normal.clone(), normal.clone(), normal.clone() );\r\n\t\t\t\tface.materialIndex = materialIndex;\r\n\r\n\t\t\t\tscope.faces.push( face );\r\n\t\t\t\tscope.faceVertexUvs[ 0 ].push( [ uva, uvb, uvd ] );\r\n\r\n\t\t\t\tface = new THREE.Face3( b + offset, c + offset, d + offset );\r\n\t\t\t\tface.normal.copy( normal );\r\n\t\t\t\tface.vertexNormals.push( normal.clone(), normal.clone(), normal.clone() );\r\n\t\t\t\tface.materialIndex = materialIndex;\r\n\r\n\t\t\t\tscope.faces.push( face );\r\n\t\t\t\tscope.faceVertexUvs[ 0 ].push( [ uvb.clone(), uvc, uvd.clone() ] );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tthis.mergeVertices();\r\n\r\n};\r\n\r\nTHREE.BoxGeometry.prototype = Object.create( THREE.Geometry.prototype );\r\nTHREE.BoxGeometry.prototype.constructor = THREE.BoxGeometry;\r\n\r\n// File:src/extras/geometries/CircleGeometry.js\r\n\r\n/**\r\n * @author hughes\r\n */\r\n\r\nTHREE.CircleGeometry = function ( radius, segments, thetaStart, thetaLength ) {\r\n\r\n\tTHREE.Geometry.call( this );\r\n\r\n\tthis.type = 'CircleGeometry';\r\n\r\n\tthis.parameters = {\r\n\t\tradius: radius,\r\n\t\tsegments: segments,\r\n\t\tthetaStart: thetaStart,\r\n\t\tthetaLength: thetaLength\r\n\t};\r\n\r\n\tradius = radius || 50;\r\n\tsegments = segments !== undefined ? Math.max( 3, segments ) : 8;\r\n\r\n\tthetaStart = thetaStart !== undefined ? thetaStart : 0;\r\n\tthetaLength = thetaLength !== undefined ? thetaLength : Math.PI * 2;\r\n\r\n\tvar i, uvs = [],\r\n\tcenter = new THREE.Vector3(), centerUV = new THREE.Vector2( 0.5, 0.5 );\r\n\r\n\tthis.vertices.push(center);\r\n\tuvs.push( centerUV );\r\n\r\n\tfor ( i = 0; i <= segments; i ++ ) {\r\n\r\n\t\tvar vertex = new THREE.Vector3();\r\n\t\tvar segment = thetaStart + i / segments * thetaLength;\r\n\r\n\t\tvertex.x = radius * Math.cos( segment );\r\n\t\tvertex.y = radius * Math.sin( segment );\r\n\r\n\t\tthis.vertices.push( vertex );\r\n\t\tuvs.push( new THREE.Vector2( ( vertex.x / radius + 1 ) / 2, ( vertex.y / radius + 1 ) / 2 ) );\r\n\r\n\t}\r\n\r\n\tvar n = new THREE.Vector3( 0, 0, 1 );\r\n\r\n\tfor ( i = 1; i <= segments; i ++ ) {\r\n\r\n\t\tthis.faces.push( new THREE.Face3( i, i + 1, 0, [ n.clone(), n.clone(), n.clone() ] ) );\r\n\t\tthis.faceVertexUvs[ 0 ].push( [ uvs[ i ].clone(), uvs[ i + 1 ].clone(), centerUV.clone() ] );\r\n\r\n\t}\r\n\r\n\tthis.computeFaceNormals();\r\n\r\n\tthis.boundingSphere = new THREE.Sphere( new THREE.Vector3(), radius );\r\n\r\n};\r\n\r\nTHREE.CircleGeometry.prototype = Object.create( THREE.Geometry.prototype );\r\nTHREE.CircleGeometry.prototype.constructor = THREE.CircleGeometry;\r\n\r\n// File:src/extras/geometries/CubeGeometry.js\r\n\r\n/**\r\n * @author mrdoob / http://mrdoob.com/\r\n */\r\n\r\n\r\nTHREE.CubeGeometry = function ( width, height, depth, widthSegments, heightSegments, depthSegments ) {\r\n\r\n\tTHREE.warn( 'THREE.CubeGeometry has been renamed to THREE.BoxGeometry.' );\r\n\treturn new THREE.BoxGeometry( width, height, depth, widthSegments, heightSegments, depthSegments );\r\n\r\n };\r\n\r\n// File:src/extras/geometries/CylinderGeometry.js\r\n\r\n/**\r\n * @author mrdoob / http://mrdoob.com/\r\n */\r\n\r\nTHREE.CylinderGeometry = function ( radiusTop, radiusBottom, height, radialSegments, heightSegments, openEnded, thetaStart, thetaLength ) {\r\n\r\n\tTHREE.Geometry.call( this );\r\n\r\n\tthis.type = 'CylinderGeometry';\r\n\r\n\tthis.parameters = {\r\n\t\tradiusTop: radiusTop,\r\n\t\tradiusBottom: radiusBottom,\r\n\t\theight: height,\r\n\t\tradialSegments: radialSegments,\r\n\t\theightSegments: heightSegments,\r\n\t\topenEnded: openEnded,\r\n\t\tthetaStart: thetaStart,\r\n\t\tthetaLength: thetaLength\r\n\t};\r\n\r\n\tradiusTop = radiusTop !== undefined ? radiusTop : 20;\r\n\tradiusBottom = radiusBottom !== undefined ? radiusBottom : 20;\r\n\theight = height !== undefined ? height : 100;\r\n\r\n\tradialSegments = radialSegments || 8;\r\n\theightSegments = heightSegments || 1;\r\n\r\n\topenEnded = openEnded !== undefined ? openEnded : false;\r\n\tthetaStart = thetaStart !== undefined ? thetaStart : 0;\r\n\tthetaLength = thetaLength !== undefined ? thetaLength : 2 * Math.PI;\r\n\r\n\tvar heightHalf = height / 2;\r\n\r\n\tvar x, y, vertices = [], uvs = [];\r\n\r\n\tfor ( y = 0; y <= heightSegments; y ++ ) {\r\n\r\n\t\tvar verticesRow = [];\r\n\t\tvar uvsRow = [];\r\n\r\n\t\tvar v = y / heightSegments;\r\n\t\tvar radius = v * ( radiusBottom - radiusTop ) + radiusTop;\r\n\r\n\t\tfor ( x = 0; x <= radialSegments; x ++ ) {\r\n\r\n\t\t\tvar u = x / radialSegments;\r\n\r\n\t\t\tvar vertex = new THREE.Vector3();\r\n\t\t\tvertex.x = radius * Math.sin( u * thetaLength + thetaStart );\r\n\t\t\tvertex.y = - v * height + heightHalf;\r\n\t\t\tvertex.z = radius * Math.cos( u * thetaLength + thetaStart );\r\n\r\n\t\t\tthis.vertices.push( vertex );\r\n\r\n\t\t\tverticesRow.push( this.vertices.length - 1 );\r\n\t\t\tuvsRow.push( new THREE.Vector2( u, 1 - v ) );\r\n\r\n\t\t}\r\n\r\n\t\tvertices.push( verticesRow );\r\n\t\tuvs.push( uvsRow );\r\n\r\n\t}\r\n\r\n\tvar tanTheta = ( radiusBottom - radiusTop ) / height;\r\n\tvar na, nb;\r\n\r\n\tfor ( x = 0; x < radialSegments; x ++ ) {\r\n\r\n\t\tif ( radiusTop !== 0 ) {\r\n\r\n\t\t\tna = this.vertices[ vertices[ 0 ][ x ] ].clone();\r\n\t\t\tnb = this.vertices[ vertices[ 0 ][ x + 1 ] ].clone();\r\n\r\n\t\t} else {\r\n\r\n\t\t\tna = this.vertices[ vertices[ 1 ][ x ] ].clone();\r\n\t\t\tnb = this.vertices[ vertices[ 1 ][ x + 1 ] ].clone();\r\n\r\n\t\t}\r\n\r\n\t\tna.setY( Math.sqrt( na.x * na.x + na.z * na.z ) * tanTheta ).normalize();\r\n\t\tnb.setY( Math.sqrt( nb.x * nb.x + nb.z * nb.z ) * tanTheta ).normalize();\r\n\r\n\t\tfor ( y = 0; y < heightSegments; y ++ ) {\r\n\r\n\t\t\tvar v1 = vertices[ y ][ x ];\r\n\t\t\tvar v2 = vertices[ y + 1 ][ x ];\r\n\t\t\tvar v3 = vertices[ y + 1 ][ x + 1 ];\r\n\t\t\tvar v4 = vertices[ y ][ x + 1 ];\r\n\r\n\t\t\tvar n1 = na.clone();\r\n\t\t\tvar n2 = na.clone();\r\n\t\t\tvar n3 = nb.clone();\r\n\t\t\tvar n4 = nb.clone();\r\n\r\n\t\t\tvar uv1 = uvs[ y ][ x ].clone();\r\n\t\t\tvar uv2 = uvs[ y + 1 ][ x ].clone();\r\n\t\t\tvar uv3 = uvs[ y + 1 ][ x + 1 ].clone();\r\n\t\t\tvar uv4 = uvs[ y ][ x + 1 ].clone();\r\n\r\n\t\t\tthis.faces.push( new THREE.Face3( v1, v2, v4, [ n1, n2, n4 ] ) );\r\n\t\t\tthis.faceVertexUvs[ 0 ].push( [ uv1, uv2, uv4 ] );\r\n\r\n\t\t\tthis.faces.push( new THREE.Face3( v2, v3, v4, [ n2.clone(), n3, n4.clone() ] ) );\r\n\t\t\tthis.faceVertexUvs[ 0 ].push( [ uv2.clone(), uv3, uv4.clone() ] );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\t// top cap\r\n\r\n\tif ( openEnded === false && radiusTop > 0 ) {\r\n\r\n\t\tthis.vertices.push( new THREE.Vector3( 0, heightHalf, 0 ) );\r\n\r\n\t\tfor ( x = 0; x < radialSegments; x ++ ) {\r\n\r\n\t\t\tvar v1 = vertices[ 0 ][ x ];\r\n\t\t\tvar v2 = vertices[ 0 ][ x + 1 ];\r\n\t\t\tvar v3 = this.vertices.length - 1;\r\n\r\n\t\t\tvar n1 = new THREE.Vector3( 0, 1, 0 );\r\n\t\t\tvar n2 = new THREE.Vector3( 0, 1, 0 );\r\n\t\t\tvar n3 = new THREE.Vector3( 0, 1, 0 );\r\n\r\n\t\t\tvar uv1 = uvs[ 0 ][ x ].clone();\r\n\t\t\tvar uv2 = uvs[ 0 ][ x + 1 ].clone();\r\n\t\t\tvar uv3 = new THREE.Vector2( uv2.x, 0 );\r\n\r\n\t\t\tthis.faces.push( new THREE.Face3( v1, v2, v3, [ n1, n2, n3 ] ) );\r\n\t\t\tthis.faceVertexUvs[ 0 ].push( [ uv1, uv2, uv3 ] );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\t// bottom cap\r\n\r\n\tif ( openEnded === false && radiusBottom > 0 ) {\r\n\r\n\t\tthis.vertices.push( new THREE.Vector3( 0, - heightHalf, 0 ) );\r\n\r\n\t\tfor ( x = 0; x < radialSegments; x ++ ) {\r\n\r\n\t\t\tvar v1 = vertices[ heightSegments ][ x + 1 ];\r\n\t\t\tvar v2 = vertices[ heightSegments ][ x ];\r\n\t\t\tvar v3 = this.vertices.length - 1;\r\n\r\n\t\t\tvar n1 = new THREE.Vector3( 0, - 1, 0 );\r\n\t\t\tvar n2 = new THREE.Vector3( 0, - 1, 0 );\r\n\t\t\tvar n3 = new THREE.Vector3( 0, - 1, 0 );\r\n\r\n\t\t\tvar uv1 = uvs[ heightSegments ][ x + 1 ].clone();\r\n\t\t\tvar uv2 = uvs[ heightSegments ][ x ].clone();\r\n\t\t\tvar uv3 = new THREE.Vector2( uv2.x, 1 );\r\n\r\n\t\t\tthis.faces.push( new THREE.Face3( v1, v2, v3, [ n1, n2, n3 ] ) );\r\n\t\t\tthis.faceVertexUvs[ 0 ].push( [ uv1, uv2, uv3 ] );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tthis.computeFaceNormals();\r\n\r\n};\r\n\r\nTHREE.CylinderGeometry.prototype = Object.create( THREE.Geometry.prototype );\r\nTHREE.CylinderGeometry.prototype.constructor = THREE.CylinderGeometry;\r\n\r\n// File:src/extras/geometries/ExtrudeGeometry.js\r\n\r\n/**\r\n * @author zz85 / http://www.lab4games.net/zz85/blog\r\n *\r\n * Creates extruded geometry from a path shape.\r\n *\r\n * parameters = {\r\n *\r\n * curveSegments: , // number of points on the curves\r\n * steps: , // number of points for z-side extrusions / used for subdividing segements of extrude spline too\r\n * amount: , // Depth to extrude the shape\r\n *\r\n * bevelEnabled: , // turn on bevel\r\n * bevelThickness: , // how deep into the original shape bevel goes\r\n * bevelSize: , // how far from shape outline is bevel\r\n * bevelSegments: , // number of bevel layers\r\n *\r\n * extrudePath: // 3d spline path to extrude shape along. (creates Frames if .frames aren't defined)\r\n * frames: // containing arrays of tangents, normals, binormals\r\n *\r\n * material: // material index for front and back faces\r\n * extrudeMaterial: // material index for extrusion and beveled faces\r\n * uvGenerator: // object that provides UV generator functions\r\n *\r\n * }\r\n **/\r\n\r\nTHREE.ExtrudeGeometry = function ( shapes, options ) {\r\n\r\n\tif ( typeof( shapes ) === \"undefined\" ) {\r\n\t\tshapes = [];\r\n\t\treturn;\r\n\t}\r\n\r\n\tTHREE.Geometry.call( this );\r\n\r\n\tthis.type = 'ExtrudeGeometry';\r\n\r\n\tshapes = shapes instanceof Array ? shapes : [ shapes ];\r\n\r\n\tthis.addShapeList( shapes, options );\r\n\r\n\tthis.computeFaceNormals();\r\n\r\n\t// can't really use automatic vertex normals\r\n\t// as then front and back sides get smoothed too\r\n\t// should do separate smoothing just for sides\r\n\r\n\t//this.computeVertexNormals();\r\n\r\n\t//console.log( \"took\", ( Date.now() - startTime ) );\r\n\r\n};\r\n\r\nTHREE.ExtrudeGeometry.prototype = Object.create( THREE.Geometry.prototype );\r\nTHREE.ExtrudeGeometry.prototype.constructor = THREE.ExtrudeGeometry;\r\n\r\nTHREE.ExtrudeGeometry.prototype.addShapeList = function ( shapes, options ) {\r\n\tvar sl = shapes.length;\r\n\r\n\tfor ( var s = 0; s < sl; s ++ ) {\r\n\t\tvar shape = shapes[ s ];\r\n\t\tthis.addShape( shape, options );\r\n\t}\r\n};\r\n\r\nTHREE.ExtrudeGeometry.prototype.addShape = function ( shape, options ) {\r\n\r\n\tvar amount = options.amount !== undefined ? options.amount : 100;\r\n\r\n\tvar bevelThickness = options.bevelThickness !== undefined ? options.bevelThickness : 6; // 10\r\n\tvar bevelSize = options.bevelSize !== undefined ? options.bevelSize : bevelThickness - 2; // 8\r\n\tvar bevelSegments = options.bevelSegments !== undefined ? options.bevelSegments : 3;\r\n\r\n\tvar bevelEnabled = options.bevelEnabled !== undefined ? options.bevelEnabled : true; // false\r\n\r\n\tvar curveSegments = options.curveSegments !== undefined ? options.curveSegments : 12;\r\n\r\n\tvar steps = options.steps !== undefined ? options.steps : 1;\r\n\r\n\tvar extrudePath = options.extrudePath;\r\n\tvar extrudePts, extrudeByPath = false;\r\n\r\n\tvar material = options.material;\r\n\tvar extrudeMaterial = options.extrudeMaterial;\r\n\r\n\t// Use default WorldUVGenerator if no UV generators are specified.\r\n\tvar uvgen = options.UVGenerator !== undefined ? options.UVGenerator : THREE.ExtrudeGeometry.WorldUVGenerator;\r\n\r\n\tvar splineTube, binormal, normal, position2;\r\n\tif ( extrudePath ) {\r\n\r\n\t\textrudePts = extrudePath.getSpacedPoints( steps );\r\n\r\n\t\textrudeByPath = true;\r\n\t\tbevelEnabled = false; // bevels not supported for path extrusion\r\n\r\n\t\t// SETUP TNB variables\r\n\r\n\t\t// Reuse TNB from TubeGeomtry for now.\r\n\t\t// TODO1 - have a .isClosed in spline?\r\n\r\n\t\tsplineTube = options.frames !== undefined ? options.frames : new THREE.TubeGeometry.FrenetFrames(extrudePath, steps, false);\r\n\r\n\t\t// console.log(splineTube, 'splineTube', splineTube.normals.length, 'steps', steps, 'extrudePts', extrudePts.length);\r\n\r\n\t\tbinormal = new THREE.Vector3();\r\n\t\tnormal = new THREE.Vector3();\r\n\t\tposition2 = new THREE.Vector3();\r\n\r\n\t}\r\n\r\n\t// Safeguards if bevels are not enabled\r\n\r\n\tif ( ! bevelEnabled ) {\r\n\r\n\t\tbevelSegments = 0;\r\n\t\tbevelThickness = 0;\r\n\t\tbevelSize = 0;\r\n\r\n\t}\r\n\r\n\t// Variables initalization\r\n\r\n\tvar ahole, h, hl; // looping of holes\r\n\tvar scope = this;\r\n\r\n\tvar shapesOffset = this.vertices.length;\r\n\r\n\tvar shapePoints = shape.extractPoints( curveSegments );\r\n\r\n\tvar vertices = shapePoints.shape;\r\n\tvar holes = shapePoints.holes;\r\n\r\n\tvar reverse = ! THREE.Shape.Utils.isClockWise( vertices ) ;\r\n\r\n\tif ( reverse ) {\r\n\r\n\t\tvertices = vertices.reverse();\r\n\r\n\t\t// Maybe we should also check if holes are in the opposite direction, just to be safe ...\r\n\r\n\t\tfor ( h = 0, hl = holes.length; h < hl; h ++ ) {\r\n\r\n\t\t\tahole = holes[ h ];\r\n\r\n\t\t\tif ( THREE.Shape.Utils.isClockWise( ahole ) ) {\r\n\r\n\t\t\t\tholes[ h ] = ahole.reverse();\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treverse = false; // If vertices are in order now, we shouldn't need to worry about them again (hopefully)!\r\n\r\n\t}\r\n\r\n\r\n\tvar faces = THREE.Shape.Utils.triangulateShape ( vertices, holes );\r\n\r\n\t/* Vertices */\r\n\r\n\tvar contour = vertices; // vertices has all points but contour has only points of circumference\r\n\r\n\tfor ( h = 0, hl = holes.length; h < hl; h ++ ) {\r\n\r\n\t\tahole = holes[ h ];\r\n\r\n\t\tvertices = vertices.concat( ahole );\r\n\r\n\t}\r\n\r\n\r\n\tfunction scalePt2 ( pt, vec, size ) {\r\n\r\n\t\tif ( ! vec ) THREE.error( \"THREE.ExtrudeGeometry: vec does not exist\" );\r\n\r\n\t\treturn vec.clone().multiplyScalar( size ).add( pt );\r\n\r\n\t}\r\n\r\n\tvar b, bs, t, z,\r\n\t\tvert, vlen = vertices.length,\r\n\t\tface, flen = faces.length;\r\n\r\n\r\n\t// Find directions for point movement\r\n\r\n\r\n\tfunction getBevelVec( inPt, inPrev, inNext ) {\r\n\r\n\t\tvar EPSILON = 0.0000000001;\r\n\t\t\r\n\t\t// computes for inPt the corresponding point inPt' on a new contour\r\n\t\t// shiftet by 1 unit (length of normalized vector) to the left\r\n\t\t// if we walk along contour clockwise, this new contour is outside the old one\r\n\t\t//\r\n\t\t// inPt' is the intersection of the two lines parallel to the two\r\n\t\t// adjacent edges of inPt at a distance of 1 unit on the left side.\r\n\t\t\r\n\t\tvar v_trans_x, v_trans_y, shrink_by = 1;\t\t// resulting translation vector for inPt\r\n\r\n\t\t// good reading for geometry algorithms (here: line-line intersection)\r\n\t\t// http://geomalgorithms.com/a05-_intersect-1.html\r\n\r\n\t\tvar v_prev_x = inPt.x - inPrev.x, v_prev_y = inPt.y - inPrev.y;\r\n\t\tvar v_next_x = inNext.x - inPt.x, v_next_y = inNext.y - inPt.y;\r\n\t\t\r\n\t\tvar v_prev_lensq = ( v_prev_x * v_prev_x + v_prev_y * v_prev_y );\r\n\t\t\r\n\t\t// check for colinear edges\r\n\t\tvar colinear0 = ( v_prev_x * v_next_y - v_prev_y * v_next_x );\r\n\t\t\r\n\t\tif ( Math.abs( colinear0 ) > EPSILON ) {\t\t// not colinear\r\n\t\t\t\r\n\t\t\t// length of vectors for normalizing\r\n\t\r\n\t\t\tvar v_prev_len = Math.sqrt( v_prev_lensq );\r\n\t\t\tvar v_next_len = Math.sqrt( v_next_x * v_next_x + v_next_y * v_next_y );\r\n\t\t\t\r\n\t\t\t// shift adjacent points by unit vectors to the left\r\n\t\r\n\t\t\tvar ptPrevShift_x = ( inPrev.x - v_prev_y / v_prev_len );\r\n\t\t\tvar ptPrevShift_y = ( inPrev.y + v_prev_x / v_prev_len );\r\n\t\t\t\r\n\t\t\tvar ptNextShift_x = ( inNext.x - v_next_y / v_next_len );\r\n\t\t\tvar ptNextShift_y = ( inNext.y + v_next_x / v_next_len );\r\n\t\r\n\t\t\t// scaling factor for v_prev to intersection point\r\n\t\r\n\t\t\tvar sf = ( ( ptNextShift_x - ptPrevShift_x ) * v_next_y -\r\n\t\t\t\t\t\t( ptNextShift_y - ptPrevShift_y ) * v_next_x ) /\r\n\t\t\t\t\t ( v_prev_x * v_next_y - v_prev_y * v_next_x );\r\n\t\r\n\t\t\t// vector from inPt to intersection point\r\n\t\r\n\t\t\tv_trans_x = ( ptPrevShift_x + v_prev_x * sf - inPt.x );\r\n\t\t\tv_trans_y = ( ptPrevShift_y + v_prev_y * sf - inPt.y );\r\n\t\r\n\t\t\t// Don't normalize!, otherwise sharp corners become ugly\r\n\t\t\t// but prevent crazy spikes\r\n\t\t\tvar v_trans_lensq = ( v_trans_x * v_trans_x + v_trans_y * v_trans_y )\r\n\t\t\tif ( v_trans_lensq <= 2 ) {\r\n\t\t\t\treturn\tnew THREE.Vector2( v_trans_x, v_trans_y );\r\n\t\t\t} else {\r\n\t\t\t\tshrink_by = Math.sqrt( v_trans_lensq / 2 );\r\n\t\t\t}\r\n\t\t\t\r\n\t\t} else {\t\t// handle special case of colinear edges\r\n\r\n\t\t\tvar direction_eq = false;\t\t// assumes: opposite\r\n\t\t\tif ( v_prev_x > EPSILON ) {\r\n\t\t\t\tif ( v_next_x > EPSILON ) { direction_eq = true; }\r\n\t\t\t} else {\r\n\t\t\t\tif ( v_prev_x < - EPSILON ) {\r\n\t\t\t\t\tif ( v_next_x < - EPSILON ) { direction_eq = true; }\r\n\t\t\t\t} else {\r\n\t\t\t\t\tif ( Math.sign(v_prev_y) == Math.sign(v_next_y) ) { direction_eq = true; }\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tif ( direction_eq ) {\r\n\t\t\t\t// console.log(\"Warning: lines are a straight sequence\");\r\n\t\t\t\tv_trans_x = - v_prev_y;\r\n\t\t\t\tv_trans_y = v_prev_x;\r\n\t\t\t\tshrink_by = Math.sqrt( v_prev_lensq );\r\n\t\t\t} else {\r\n\t\t\t\t// console.log(\"Warning: lines are a straight spike\");\r\n\t\t\t\tv_trans_x = v_prev_x;\r\n\t\t\t\tv_trans_y = v_prev_y;\r\n\t\t\t\tshrink_by = Math.sqrt( v_prev_lensq / 2 );\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn\tnew THREE.Vector2( v_trans_x / shrink_by, v_trans_y / shrink_by );\r\n\r\n\t}\r\n\r\n\r\n\tvar contourMovements = [];\r\n\r\n\tfor ( var i = 0, il = contour.length, j = il - 1, k = i + 1; i < il; i ++, j ++, k ++ ) {\r\n\r\n\t\tif ( j === il ) j = 0;\r\n\t\tif ( k === il ) k = 0;\r\n\r\n\t\t// (j)---(i)---(k)\r\n\t\t// console.log('i,j,k', i, j , k)\r\n\r\n\t\tcontourMovements[ i ] = getBevelVec( contour[ i ], contour[ j ], contour[ k ] );\r\n\r\n\t}\r\n\r\n\tvar holesMovements = [], oneHoleMovements, verticesMovements = contourMovements.concat();\r\n\r\n\tfor ( h = 0, hl = holes.length; h < hl; h ++ ) {\r\n\r\n\t\tahole = holes[ h ];\r\n\r\n\t\toneHoleMovements = [];\r\n\r\n\t\tfor ( i = 0, il = ahole.length, j = il - 1, k = i + 1; i < il; i ++, j ++, k ++ ) {\r\n\r\n\t\t\tif ( j === il ) j = 0;\r\n\t\t\tif ( k === il ) k = 0;\r\n\r\n\t\t\t// (j)---(i)---(k)\r\n\t\t\toneHoleMovements[ i ] = getBevelVec( ahole[ i ], ahole[ j ], ahole[ k ] );\r\n\r\n\t\t}\r\n\r\n\t\tholesMovements.push( oneHoleMovements );\r\n\t\tverticesMovements = verticesMovements.concat( oneHoleMovements );\r\n\r\n\t}\r\n\r\n\r\n\t// Loop bevelSegments, 1 for the front, 1 for the back\r\n\r\n\tfor ( b = 0; b < bevelSegments; b ++ ) {\r\n\t//for ( b = bevelSegments; b > 0; b -- ) {\r\n\r\n\t\tt = b / bevelSegments;\r\n\t\tz = bevelThickness * ( 1 - t );\r\n\r\n\t\t//z = bevelThickness * t;\r\n\t\tbs = bevelSize * ( Math.sin ( t * Math.PI / 2 ) ) ; // curved\r\n\t\t//bs = bevelSize * t ; // linear\r\n\r\n\t\t// contract shape\r\n\r\n\t\tfor ( i = 0, il = contour.length; i < il; i ++ ) {\r\n\r\n\t\t\tvert = scalePt2( contour[ i ], contourMovements[ i ], bs );\r\n\r\n\t\t\tv( vert.x, vert.y, - z );\r\n\r\n\t\t}\r\n\r\n\t\t// expand holes\r\n\r\n\t\tfor ( h = 0, hl = holes.length; h < hl; h ++ ) {\r\n\r\n\t\t\tahole = holes[ h ];\r\n\t\t\toneHoleMovements = holesMovements[ h ];\r\n\r\n\t\t\tfor ( i = 0, il = ahole.length; i < il; i ++ ) {\r\n\r\n\t\t\t\tvert = scalePt2( ahole[ i ], oneHoleMovements[ i ], bs );\r\n\r\n\t\t\t\tv( vert.x, vert.y, - z );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tbs = bevelSize;\r\n\r\n\t// Back facing vertices\r\n\r\n\tfor ( i = 0; i < vlen; i ++ ) {\r\n\r\n\t\tvert = bevelEnabled ? scalePt2( vertices[ i ], verticesMovements[ i ], bs ) : vertices[ i ];\r\n\r\n\t\tif ( ! extrudeByPath ) {\r\n\r\n\t\t\tv( vert.x, vert.y, 0 );\r\n\r\n\t\t} else {\r\n\r\n\t\t\t// v( vert.x, vert.y + extrudePts[ 0 ].y, extrudePts[ 0 ].x );\r\n\r\n\t\t\tnormal.copy( splineTube.normals[0] ).multiplyScalar(vert.x);\r\n\t\t\tbinormal.copy( splineTube.binormals[0] ).multiplyScalar(vert.y);\r\n\r\n\t\t\tposition2.copy( extrudePts[0] ).add(normal).add(binormal);\r\n\r\n\t\t\tv( position2.x, position2.y, position2.z );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\t// Add stepped vertices...\r\n\t// Including front facing vertices\r\n\r\n\tvar s;\r\n\r\n\tfor ( s = 1; s <= steps; s ++ ) {\r\n\r\n\t\tfor ( i = 0; i < vlen; i ++ ) {\r\n\r\n\t\t\tvert = bevelEnabled ? scalePt2( vertices[ i ], verticesMovements[ i ], bs ) : vertices[ i ];\r\n\r\n\t\t\tif ( ! extrudeByPath ) {\r\n\r\n\t\t\t\tv( vert.x, vert.y, amount / steps * s );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\t// v( vert.x, vert.y + extrudePts[ s - 1 ].y, extrudePts[ s - 1 ].x );\r\n\r\n\t\t\t\tnormal.copy( splineTube.normals[s] ).multiplyScalar( vert.x );\r\n\t\t\t\tbinormal.copy( splineTube.binormals[s] ).multiplyScalar( vert.y );\r\n\r\n\t\t\t\tposition2.copy( extrudePts[s] ).add( normal ).add( binormal );\r\n\r\n\t\t\t\tv( position2.x, position2.y, position2.z );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\r\n\t// Add bevel segments planes\r\n\r\n\t//for ( b = 1; b <= bevelSegments; b ++ ) {\r\n\tfor ( b = bevelSegments - 1; b >= 0; b -- ) {\r\n\r\n\t\tt = b / bevelSegments;\r\n\t\tz = bevelThickness * ( 1 - t );\r\n\t\t//bs = bevelSize * ( 1-Math.sin ( ( 1 - t ) * Math.PI/2 ) );\r\n\t\tbs = bevelSize * Math.sin ( t * Math.PI / 2 ) ;\r\n\r\n\t\t// contract shape\r\n\r\n\t\tfor ( i = 0, il = contour.length; i < il; i ++ ) {\r\n\r\n\t\t\tvert = scalePt2( contour[ i ], contourMovements[ i ], bs );\r\n\t\t\tv( vert.x, vert.y, amount + z );\r\n\r\n\t\t}\r\n\r\n\t\t// expand holes\r\n\r\n\t\tfor ( h = 0, hl = holes.length; h < hl; h ++ ) {\r\n\r\n\t\t\tahole = holes[ h ];\r\n\t\t\toneHoleMovements = holesMovements[ h ];\r\n\r\n\t\t\tfor ( i = 0, il = ahole.length; i < il; i ++ ) {\r\n\r\n\t\t\t\tvert = scalePt2( ahole[ i ], oneHoleMovements[ i ], bs );\r\n\r\n\t\t\t\tif ( ! extrudeByPath ) {\r\n\r\n\t\t\t\t\tv( vert.x, vert.y, amount + z );\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\tv( vert.x, vert.y + extrudePts[ steps - 1 ].y, extrudePts[ steps - 1 ].x + z );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\t/* Faces */\r\n\r\n\t// Top and bottom faces\r\n\r\n\tbuildLidFaces();\r\n\r\n\t// Sides faces\r\n\r\n\tbuildSideFaces();\r\n\r\n\r\n\t///// Internal functions\r\n\r\n\tfunction buildLidFaces() {\r\n\r\n\t\tif ( bevelEnabled ) {\r\n\r\n\t\t\tvar layer = 0 ; // steps + 1\r\n\t\t\tvar offset = vlen * layer;\r\n\r\n\t\t\t// Bottom faces\r\n\r\n\t\t\tfor ( i = 0; i < flen; i ++ ) {\r\n\r\n\t\t\t\tface = faces[ i ];\r\n\t\t\t\tf3( face[ 2 ] + offset, face[ 1 ] + offset, face[ 0 ] + offset );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tlayer = steps + bevelSegments * 2;\r\n\t\t\toffset = vlen * layer;\r\n\r\n\t\t\t// Top faces\r\n\r\n\t\t\tfor ( i = 0; i < flen; i ++ ) {\r\n\r\n\t\t\t\tface = faces[ i ];\r\n\t\t\t\tf3( face[ 0 ] + offset, face[ 1 ] + offset, face[ 2 ] + offset );\r\n\r\n\t\t\t}\r\n\r\n\t\t} else {\r\n\r\n\t\t\t// Bottom faces\r\n\r\n\t\t\tfor ( i = 0; i < flen; i ++ ) {\r\n\r\n\t\t\t\tface = faces[ i ];\r\n\t\t\t\tf3( face[ 2 ], face[ 1 ], face[ 0 ] );\r\n\r\n\t\t\t}\r\n\r\n\t\t\t// Top faces\r\n\r\n\t\t\tfor ( i = 0; i < flen; i ++ ) {\r\n\r\n\t\t\t\tface = faces[ i ];\r\n\t\t\t\tf3( face[ 0 ] + vlen * steps, face[ 1 ] + vlen * steps, face[ 2 ] + vlen * steps );\r\n\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t}\r\n\r\n\t// Create faces for the z-sides of the shape\r\n\r\n\tfunction buildSideFaces() {\r\n\r\n\t\tvar layeroffset = 0;\r\n\t\tsidewalls( contour, layeroffset );\r\n\t\tlayeroffset += contour.length;\r\n\r\n\t\tfor ( h = 0, hl = holes.length; h < hl; h ++ ) {\r\n\r\n\t\t\tahole = holes[ h ];\r\n\t\t\tsidewalls( ahole, layeroffset );\r\n\r\n\t\t\t//, true\r\n\t\t\tlayeroffset += ahole.length;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tfunction sidewalls( contour, layeroffset ) {\r\n\r\n\t\tvar j, k;\r\n\t\ti = contour.length;\r\n\r\n\t\twhile ( -- i >= 0 ) {\r\n\r\n\t\t\tj = i;\r\n\t\t\tk = i - 1;\r\n\t\t\tif ( k < 0 ) k = contour.length - 1;\r\n\r\n\t\t\t//console.log('b', i,j, i-1, k,vertices.length);\r\n\r\n\t\t\tvar s = 0, sl = steps + bevelSegments * 2;\r\n\r\n\t\t\tfor ( s = 0; s < sl; s ++ ) {\r\n\r\n\t\t\t\tvar slen1 = vlen * s;\r\n\t\t\t\tvar slen2 = vlen * ( s + 1 );\r\n\r\n\t\t\t\tvar a = layeroffset + j + slen1,\r\n\t\t\t\t\tb = layeroffset + k + slen1,\r\n\t\t\t\t\tc = layeroffset + k + slen2,\r\n\t\t\t\t\td = layeroffset + j + slen2;\r\n\r\n\t\t\t\tf4( a, b, c, d, contour, s, sl, j, k );\r\n\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t}\r\n\r\n\r\n\tfunction v( x, y, z ) {\r\n\r\n\t\tscope.vertices.push( new THREE.Vector3( x, y, z ) );\r\n\r\n\t}\r\n\r\n\tfunction f3( a, b, c ) {\r\n\r\n\t\ta += shapesOffset;\r\n\t\tb += shapesOffset;\r\n\t\tc += shapesOffset;\r\n\r\n\t\t// normal, color, material\r\n\t\tscope.faces.push( new THREE.Face3( a, b, c, null, null, material ) );\r\n\r\n\t\tvar uvs = uvgen.generateTopUV( scope, a, b, c );\r\n\r\n\t\tscope.faceVertexUvs[ 0 ].push( uvs );\r\n\r\n\t}\r\n\r\n\tfunction f4( a, b, c, d, wallContour, stepIndex, stepsLength, contourIndex1, contourIndex2 ) {\r\n\r\n\t\ta += shapesOffset;\r\n\t\tb += shapesOffset;\r\n\t\tc += shapesOffset;\r\n\t\td += shapesOffset;\r\n\r\n\t\tscope.faces.push( new THREE.Face3( a, b, d, null, null, extrudeMaterial ) );\r\n\t\tscope.faces.push( new THREE.Face3( b, c, d, null, null, extrudeMaterial ) );\r\n\r\n\t\tvar uvs = uvgen.generateSideWallUV( scope, a, b, c, d );\r\n\r\n\t\tscope.faceVertexUvs[ 0 ].push( [ uvs[ 0 ], uvs[ 1 ], uvs[ 3 ] ] );\r\n\t\tscope.faceVertexUvs[ 0 ].push( [ uvs[ 1 ], uvs[ 2 ], uvs[ 3 ] ] );\r\n\r\n\t}\r\n\r\n};\r\n\r\nTHREE.ExtrudeGeometry.WorldUVGenerator = {\r\n\r\n\tgenerateTopUV: function ( geometry, indexA, indexB, indexC ) {\r\n\r\n\t\tvar vertices = geometry.vertices;\r\n\r\n\t\tvar a = vertices[ indexA ];\r\n\t\tvar b = vertices[ indexB ];\r\n\t\tvar c = vertices[ indexC ];\r\n\r\n\t\treturn [\r\n\t\t\tnew THREE.Vector2( a.x, a.y ),\r\n\t\t\tnew THREE.Vector2( b.x, b.y ),\r\n\t\t\tnew THREE.Vector2( c.x, c.y )\r\n\t\t];\r\n\r\n\t},\r\n\r\n\tgenerateSideWallUV: function ( geometry, indexA, indexB, indexC, indexD ) {\r\n\r\n\t\tvar vertices = geometry.vertices;\r\n\r\n\t\tvar a = vertices[ indexA ];\r\n\t\tvar b = vertices[ indexB ];\r\n\t\tvar c = vertices[ indexC ];\r\n\t\tvar d = vertices[ indexD ];\r\n\r\n\t\tif ( Math.abs( a.y - b.y ) < 0.01 ) {\r\n\t\t\treturn [\r\n\t\t\t\tnew THREE.Vector2( a.x, 1 - a.z ),\r\n\t\t\t\tnew THREE.Vector2( b.x, 1 - b.z ),\r\n\t\t\t\tnew THREE.Vector2( c.x, 1 - c.z ),\r\n\t\t\t\tnew THREE.Vector2( d.x, 1 - d.z )\r\n\t\t\t];\r\n\t\t} else {\r\n\t\t\treturn [\r\n\t\t\t\tnew THREE.Vector2( a.y, 1 - a.z ),\r\n\t\t\t\tnew THREE.Vector2( b.y, 1 - b.z ),\r\n\t\t\t\tnew THREE.Vector2( c.y, 1 - c.z ),\r\n\t\t\t\tnew THREE.Vector2( d.y, 1 - d.z )\r\n\t\t\t];\r\n\t\t}\r\n\t}\r\n};\r\n\r\n// File:src/extras/geometries/ShapeGeometry.js\r\n\r\n/**\r\n * @author jonobr1 / http://jonobr1.com\r\n *\r\n * Creates a one-sided polygonal geometry from a path shape. Similar to\r\n * ExtrudeGeometry.\r\n *\r\n * parameters = {\r\n *\r\n *\tcurveSegments: , // number of points on the curves. NOT USED AT THE MOMENT.\r\n *\r\n *\tmaterial: // material index for front and back faces\r\n *\tuvGenerator: // object that provides UV generator functions\r\n *\r\n * }\r\n **/\r\n\r\nTHREE.ShapeGeometry = function ( shapes, options ) {\r\n\r\n\tTHREE.Geometry.call( this );\r\n\r\n\tthis.type = 'ShapeGeometry';\r\n\r\n\tif ( shapes instanceof Array === false ) shapes = [ shapes ];\r\n\r\n\tthis.addShapeList( shapes, options );\r\n\r\n\tthis.computeFaceNormals();\r\n\r\n};\r\n\r\nTHREE.ShapeGeometry.prototype = Object.create( THREE.Geometry.prototype );\r\nTHREE.ShapeGeometry.prototype.constructor = THREE.ShapeGeometry;\r\n\r\n/**\r\n * Add an array of shapes to THREE.ShapeGeometry.\r\n */\r\nTHREE.ShapeGeometry.prototype.addShapeList = function ( shapes, options ) {\r\n\r\n\tfor ( var i = 0, l = shapes.length; i < l; i ++ ) {\r\n\r\n\t\tthis.addShape( shapes[ i ], options );\r\n\r\n\t}\r\n\r\n\treturn this;\r\n\r\n};\r\n\r\n/**\r\n * Adds a shape to THREE.ShapeGeometry, based on THREE.ExtrudeGeometry.\r\n */\r\nTHREE.ShapeGeometry.prototype.addShape = function ( shape, options ) {\r\n\r\n\tif ( options === undefined ) options = {};\r\n\tvar curveSegments = options.curveSegments !== undefined ? options.curveSegments : 12;\r\n\r\n\tvar material = options.material;\r\n\tvar uvgen = options.UVGenerator === undefined ? THREE.ExtrudeGeometry.WorldUVGenerator : options.UVGenerator;\r\n\r\n\t//\r\n\r\n\tvar i, l, hole;\r\n\r\n\tvar shapesOffset = this.vertices.length;\r\n\tvar shapePoints = shape.extractPoints( curveSegments );\r\n\r\n\tvar vertices = shapePoints.shape;\r\n\tvar holes = shapePoints.holes;\r\n\r\n\tvar reverse = ! THREE.Shape.Utils.isClockWise( vertices );\r\n\r\n\tif ( reverse ) {\r\n\r\n\t\tvertices = vertices.reverse();\r\n\r\n\t\t// Maybe we should also check if holes are in the opposite direction, just to be safe...\r\n\r\n\t\tfor ( i = 0, l = holes.length; i < l; i ++ ) {\r\n\r\n\t\t\thole = holes[ i ];\r\n\r\n\t\t\tif ( THREE.Shape.Utils.isClockWise( hole ) ) {\r\n\r\n\t\t\t\tholes[ i ] = hole.reverse();\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treverse = false;\r\n\r\n\t}\r\n\r\n\tvar faces = THREE.Shape.Utils.triangulateShape( vertices, holes );\r\n\r\n\t// Vertices\r\n\r\n\tvar contour = vertices;\r\n\r\n\tfor ( i = 0, l = holes.length; i < l; i ++ ) {\r\n\r\n\t\thole = holes[ i ];\r\n\t\tvertices = vertices.concat( hole );\r\n\r\n\t}\r\n\r\n\t//\r\n\r\n\tvar vert, vlen = vertices.length;\r\n\tvar face, flen = faces.length;\r\n\r\n\tfor ( i = 0; i < vlen; i ++ ) {\r\n\r\n\t\tvert = vertices[ i ];\r\n\r\n\t\tthis.vertices.push( new THREE.Vector3( vert.x, vert.y, 0 ) );\r\n\r\n\t}\r\n\r\n\tfor ( i = 0; i < flen; i ++ ) {\r\n\r\n\t\tface = faces[ i ];\r\n\r\n\t\tvar a = face[ 0 ] + shapesOffset;\r\n\t\tvar b = face[ 1 ] + shapesOffset;\r\n\t\tvar c = face[ 2 ] + shapesOffset;\r\n\r\n\t\tthis.faces.push( new THREE.Face3( a, b, c, null, null, material ) );\r\n\t\tthis.faceVertexUvs[ 0 ].push( uvgen.generateTopUV( this, a, b, c ) );\r\n\r\n\t}\r\n\r\n};\r\n\r\n// File:src/extras/geometries/LatheGeometry.js\r\n\r\n/**\r\n * @author astrodud / http://astrodud.isgreat.org/\r\n * @author zz85 / https://github.com/zz85\r\n * @author bhouston / http://exocortex.com\r\n */\r\n\r\n// points - to create a closed torus, one must use a set of points \r\n// like so: [ a, b, c, d, a ], see first is the same as last.\r\n// segments - the number of circumference segments to create\r\n// phiStart - the starting radian\r\n// phiLength - the radian (0 to 2*PI) range of the lathed section\r\n// 2*pi is a closed lathe, less than 2PI is a portion.\r\n\r\nTHREE.LatheGeometry = function ( points, segments, phiStart, phiLength ) {\r\n\r\n\tTHREE.Geometry.call( this );\r\n\r\n\tthis.type = 'LatheGeometry';\r\n\r\n\tthis.parameters = {\r\n\t\tpoints: points,\r\n\t\tsegments: segments,\r\n\t\tphiStart: phiStart,\r\n\t\tphiLength: phiLength\r\n\t};\r\n\r\n\tsegments = segments || 12;\r\n\tphiStart = phiStart || 0;\r\n\tphiLength = phiLength || 2 * Math.PI;\r\n\r\n\tvar inversePointLength = 1.0 / ( points.length - 1 );\r\n\tvar inverseSegments = 1.0 / segments;\r\n\r\n\tfor ( var i = 0, il = segments; i <= il; i ++ ) {\r\n\r\n\t\tvar phi = phiStart + i * inverseSegments * phiLength;\r\n\r\n\t\tvar c = Math.cos( phi ),\r\n\t\t\ts = Math.sin( phi );\r\n\r\n\t\tfor ( var j = 0, jl = points.length; j < jl; j ++ ) {\r\n\r\n\t\t\tvar pt = points[ j ];\r\n\r\n\t\t\tvar vertex = new THREE.Vector3();\r\n\r\n\t\t\tvertex.x = c * pt.x - s * pt.y;\r\n\t\t\tvertex.y = s * pt.x + c * pt.y;\r\n\t\t\tvertex.z = pt.z;\r\n\r\n\t\t\tthis.vertices.push( vertex );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tvar np = points.length;\r\n\r\n\tfor ( var i = 0, il = segments; i < il; i ++ ) {\r\n\r\n\t\tfor ( var j = 0, jl = points.length - 1; j < jl; j ++ ) {\r\n\r\n\t\t\tvar base = j + np * i;\r\n\t\t\tvar a = base;\r\n\t\t\tvar b = base + np;\r\n\t\t\tvar c = base + 1 + np;\r\n\t\t\tvar d = base + 1;\r\n\r\n\t\t\tvar u0 = i * inverseSegments;\r\n\t\t\tvar v0 = j * inversePointLength;\r\n\t\t\tvar u1 = u0 + inverseSegments;\r\n\t\t\tvar v1 = v0 + inversePointLength;\r\n\r\n\t\t\tthis.faces.push( new THREE.Face3( a, b, d ) );\r\n\r\n\t\t\tthis.faceVertexUvs[ 0 ].push( [\r\n\r\n\t\t\t\tnew THREE.Vector2( u0, v0 ),\r\n\t\t\t\tnew THREE.Vector2( u1, v0 ),\r\n\t\t\t\tnew THREE.Vector2( u0, v1 )\r\n\r\n\t\t\t] );\r\n\r\n\t\t\tthis.faces.push( new THREE.Face3( b, c, d ) );\r\n\r\n\t\t\tthis.faceVertexUvs[ 0 ].push( [\r\n\r\n\t\t\t\tnew THREE.Vector2( u1, v0 ),\r\n\t\t\t\tnew THREE.Vector2( u1, v1 ),\r\n\t\t\t\tnew THREE.Vector2( u0, v1 )\r\n\r\n\t\t\t] );\r\n\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tthis.mergeVertices();\r\n\tthis.computeFaceNormals();\r\n\tthis.computeVertexNormals();\r\n\r\n};\r\n\r\nTHREE.LatheGeometry.prototype = Object.create( THREE.Geometry.prototype );\r\nTHREE.LatheGeometry.prototype.constructor = THREE.LatheGeometry;\r\n\r\n// File:src/extras/geometries/PlaneGeometry.js\r\n\r\n/**\r\n * @author mrdoob / http://mrdoob.com/\r\n * based on http://papervision3d.googlecode.com/svn/trunk/as3/trunk/src/org/papervision3d/objects/primitives/Plane.as\r\n */\r\n\r\nTHREE.PlaneGeometry = function ( width, height, widthSegments, heightSegments ) {\r\n\r\n\tconsole.info( 'THREE.PlaneGeometry: Consider using THREE.PlaneBufferGeometry for lower memory footprint.' );\r\n\r\n\tTHREE.Geometry.call( this );\r\n\r\n\tthis.type = 'PlaneGeometry';\r\n\r\n\tthis.parameters = {\r\n\t\twidth: width,\r\n\t\theight: height,\r\n\t\twidthSegments: widthSegments,\r\n\t\theightSegments: heightSegments\r\n\t};\r\n\r\n\tthis.fromBufferGeometry( new THREE.PlaneBufferGeometry( width, height, widthSegments, heightSegments ) );\r\n\r\n};\r\n\r\nTHREE.PlaneGeometry.prototype = Object.create( THREE.Geometry.prototype );\r\nTHREE.PlaneGeometry.prototype.constructor = THREE.PlaneGeometry;\r\n\r\n// File:src/extras/geometries/PlaneBufferGeometry.js\r\n\r\n/**\r\n * @author mrdoob / http://mrdoob.com/\r\n * based on http://papervision3d.googlecode.com/svn/trunk/as3/trunk/src/org/papervision3d/objects/primitives/Plane.as\r\n */\r\n\r\nTHREE.PlaneBufferGeometry = function ( width, height, widthSegments, heightSegments ) {\r\n\r\n\tTHREE.BufferGeometry.call( this );\r\n\r\n\tthis.type = 'PlaneBufferGeometry';\r\n\r\n\tthis.parameters = {\r\n\t\twidth: width,\r\n\t\theight: height,\r\n\t\twidthSegments: widthSegments,\r\n\t\theightSegments: heightSegments\r\n\t};\r\n\r\n\tvar width_half = width / 2;\r\n\tvar height_half = height / 2;\r\n\r\n\tvar gridX = widthSegments || 1;\r\n\tvar gridY = heightSegments || 1;\r\n\r\n\tvar gridX1 = gridX + 1;\r\n\tvar gridY1 = gridY + 1;\r\n\r\n\tvar segment_width = width / gridX;\r\n\tvar segment_height = height / gridY;\r\n\r\n\tvar vertices = new Float32Array( gridX1 * gridY1 * 3 );\r\n\tvar normals = new Float32Array( gridX1 * gridY1 * 3 );\r\n\tvar uvs = new Float32Array( gridX1 * gridY1 * 2 );\r\n\r\n\tvar offset = 0;\r\n\tvar offset2 = 0;\r\n\r\n\tfor ( var iy = 0; iy < gridY1; iy ++ ) {\r\n\r\n\t\tvar y = iy * segment_height - height_half;\r\n\r\n\t\tfor ( var ix = 0; ix < gridX1; ix ++ ) {\r\n\r\n\t\t\tvar x = ix * segment_width - width_half;\r\n\r\n\t\t\tvertices[ offset ] = x;\r\n\t\t\tvertices[ offset + 1 ] = - y;\r\n\r\n\t\t\tnormals[ offset + 2 ] = 1;\r\n\r\n\t\t\tuvs[ offset2 ] = ix / gridX;\r\n\t\t\tuvs[ offset2 + 1 ] = 1 - ( iy / gridY );\r\n\r\n\t\t\toffset += 3;\r\n\t\t\toffset2 += 2;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\toffset = 0;\r\n\r\n\tvar indices = new ( ( vertices.length / 3 ) > 65535 ? Uint32Array : Uint16Array )( gridX * gridY * 6 );\r\n\r\n\tfor ( var iy = 0; iy < gridY; iy ++ ) {\r\n\r\n\t\tfor ( var ix = 0; ix < gridX; ix ++ ) {\r\n\r\n\t\t\tvar a = ix + gridX1 * iy;\r\n\t\t\tvar b = ix + gridX1 * ( iy + 1 );\r\n\t\t\tvar c = ( ix + 1 ) + gridX1 * ( iy + 1 );\r\n\t\t\tvar d = ( ix + 1 ) + gridX1 * iy;\r\n\r\n\t\t\tindices[ offset ] = a;\r\n\t\t\tindices[ offset + 1 ] = b;\r\n\t\t\tindices[ offset + 2 ] = d;\r\n\r\n\t\t\tindices[ offset + 3 ] = b;\r\n\t\t\tindices[ offset + 4 ] = c;\r\n\t\t\tindices[ offset + 5 ] = d;\r\n\r\n\t\t\toffset += 6;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tthis.addAttribute( 'index', new THREE.BufferAttribute( indices, 1 ) );\r\n\tthis.addAttribute( 'position', new THREE.BufferAttribute( vertices, 3 ) );\r\n\tthis.addAttribute( 'normal', new THREE.BufferAttribute( normals, 3 ) );\r\n\tthis.addAttribute( 'uv', new THREE.BufferAttribute( uvs, 2 ) );\r\n\r\n};\r\n\r\nTHREE.PlaneBufferGeometry.prototype = Object.create( THREE.BufferGeometry.prototype );\r\nTHREE.PlaneBufferGeometry.prototype.constructor = THREE.PlaneBufferGeometry;\r\n\r\n// File:src/extras/geometries/RingGeometry.js\r\n\r\n/**\r\n * @author Kaleb Murphy\r\n */\r\n\r\nTHREE.RingGeometry = function ( innerRadius, outerRadius, thetaSegments, phiSegments, thetaStart, thetaLength ) {\r\n\r\n\tTHREE.Geometry.call( this );\r\n\r\n\tthis.type = 'RingGeometry';\r\n\r\n\tthis.parameters = {\r\n\t\tinnerRadius: innerRadius,\r\n\t\touterRadius: outerRadius,\r\n\t\tthetaSegments: thetaSegments,\r\n\t\tphiSegments: phiSegments,\r\n\t\tthetaStart: thetaStart,\r\n\t\tthetaLength: thetaLength\r\n\t};\r\n\r\n\tinnerRadius = innerRadius || 0;\r\n\touterRadius = outerRadius || 50;\r\n\r\n\tthetaStart = thetaStart !== undefined ? thetaStart : 0;\r\n\tthetaLength = thetaLength !== undefined ? thetaLength : Math.PI * 2;\r\n\r\n\tthetaSegments = thetaSegments !== undefined ? Math.max( 3, thetaSegments ) : 8;\r\n\tphiSegments = phiSegments !== undefined ? Math.max( 1, phiSegments ) : 8;\r\n\r\n\tvar i, o, uvs = [], radius = innerRadius, radiusStep = ( ( outerRadius - innerRadius ) / phiSegments );\r\n\r\n\tfor ( i = 0; i < phiSegments + 1; i ++ ) { // concentric circles inside ring\r\n\r\n\t\tfor ( o = 0; o < thetaSegments + 1; o ++ ) { // number of segments per circle\r\n\r\n\t\t\tvar vertex = new THREE.Vector3();\r\n\t\t\tvar segment = thetaStart + o / thetaSegments * thetaLength;\r\n\t\t\tvertex.x = radius * Math.cos( segment );\r\n\t\t\tvertex.y = radius * Math.sin( segment );\r\n\r\n\t\t\tthis.vertices.push( vertex );\r\n\t\t\tuvs.push( new THREE.Vector2( ( vertex.x / outerRadius + 1 ) / 2, ( vertex.y / outerRadius + 1 ) / 2 ) );\r\n\t\t}\r\n\r\n\t\tradius += radiusStep;\r\n\r\n\t}\r\n\r\n\tvar n = new THREE.Vector3( 0, 0, 1 );\r\n\r\n\tfor ( i = 0; i < phiSegments; i ++ ) { // concentric circles inside ring\r\n\r\n\t\tvar thetaSegment = i * (thetaSegments + 1);\r\n\r\n\t\tfor ( o = 0; o < thetaSegments ; o ++ ) { // number of segments per circle\r\n\r\n\t\t\tvar segment = o + thetaSegment;\r\n\r\n\t\t\tvar v1 = segment;\r\n\t\t\tvar v2 = segment + thetaSegments + 1;\r\n\t\t\tvar v3 = segment + thetaSegments + 2;\r\n\r\n\t\t\tthis.faces.push( new THREE.Face3( v1, v2, v3, [ n.clone(), n.clone(), n.clone() ] ) );\r\n\t\t\tthis.faceVertexUvs[ 0 ].push( [ uvs[ v1 ].clone(), uvs[ v2 ].clone(), uvs[ v3 ].clone() ]);\r\n\r\n\t\t\tv1 = segment;\r\n\t\t\tv2 = segment + thetaSegments + 2;\r\n\t\t\tv3 = segment + 1;\r\n\r\n\t\t\tthis.faces.push( new THREE.Face3( v1, v2, v3, [ n.clone(), n.clone(), n.clone() ] ) );\r\n\t\t\tthis.faceVertexUvs[ 0 ].push( [ uvs[ v1 ].clone(), uvs[ v2 ].clone(), uvs[ v3 ].clone() ]);\r\n\r\n\t\t}\r\n\t}\r\n\r\n\tthis.computeFaceNormals();\r\n\r\n\tthis.boundingSphere = new THREE.Sphere( new THREE.Vector3(), radius );\r\n\r\n};\r\n\r\nTHREE.RingGeometry.prototype = Object.create( THREE.Geometry.prototype );\r\nTHREE.RingGeometry.prototype.constructor = THREE.RingGeometry;\r\n\r\n\r\n// File:src/extras/geometries/SphereGeometry.js\r\n\r\n/**\r\n * @author mrdoob / http://mrdoob.com/\r\n */\r\n\r\nTHREE.SphereGeometry = function ( radius, widthSegments, heightSegments, phiStart, phiLength, thetaStart, thetaLength ) {\r\n\r\n\tTHREE.Geometry.call( this );\r\n\r\n\tthis.type = 'SphereGeometry';\r\n\r\n\tthis.parameters = {\r\n\t\tradius: radius,\r\n\t\twidthSegments: widthSegments,\r\n\t\theightSegments: heightSegments,\r\n\t\tphiStart: phiStart,\r\n\t\tphiLength: phiLength,\r\n\t\tthetaStart: thetaStart,\r\n\t\tthetaLength: thetaLength \r\n\t};\r\n\r\n\tradius = radius || 50;\r\n\r\n\twidthSegments = Math.max( 3, Math.floor( widthSegments ) || 8 );\r\n\theightSegments = Math.max( 2, Math.floor( heightSegments ) || 6 );\r\n\r\n\tphiStart = phiStart !== undefined ? phiStart : 0;\r\n\tphiLength = phiLength !== undefined ? phiLength : Math.PI * 2;\r\n\r\n\tthetaStart = thetaStart !== undefined ? thetaStart : 0;\r\n\tthetaLength = thetaLength !== undefined ? thetaLength : Math.PI;\r\n\r\n\tvar x, y, vertices = [], uvs = [];\r\n\r\n\tfor ( y = 0; y <= heightSegments; y ++ ) {\r\n\r\n\t\tvar verticesRow = [];\r\n\t\tvar uvsRow = [];\r\n\r\n\t\tfor ( x = 0; x <= widthSegments; x ++ ) {\r\n\r\n\t\t\tvar u = x / widthSegments;\r\n\t\t\tvar v = y / heightSegments;\r\n\r\n\t\t\tvar vertex = new THREE.Vector3();\r\n\t\t\tvertex.x = - radius * Math.cos( phiStart + u * phiLength ) * Math.sin( thetaStart + v * thetaLength );\r\n\t\t\tvertex.y = radius * Math.cos( thetaStart + v * thetaLength );\r\n\t\t\tvertex.z = radius * Math.sin( phiStart + u * phiLength ) * Math.sin( thetaStart + v * thetaLength );\r\n\r\n\t\t\tthis.vertices.push( vertex );\r\n\r\n\t\t\tverticesRow.push( this.vertices.length - 1 );\r\n\t\t\tuvsRow.push( new THREE.Vector2( u, 1 - v ) );\r\n\r\n\t\t}\r\n\r\n\t\tvertices.push( verticesRow );\r\n\t\tuvs.push( uvsRow );\r\n\r\n\t}\r\n\r\n\tfor ( y = 0; y < heightSegments; y ++ ) {\r\n\r\n\t\tfor ( x = 0; x < widthSegments; x ++ ) {\r\n\r\n\t\t\tvar v1 = vertices[ y ][ x + 1 ];\r\n\t\t\tvar v2 = vertices[ y ][ x ];\r\n\t\t\tvar v3 = vertices[ y + 1 ][ x ];\r\n\t\t\tvar v4 = vertices[ y + 1 ][ x + 1 ];\r\n\r\n\t\t\tvar n1 = this.vertices[ v1 ].clone().normalize();\r\n\t\t\tvar n2 = this.vertices[ v2 ].clone().normalize();\r\n\t\t\tvar n3 = this.vertices[ v3 ].clone().normalize();\r\n\t\t\tvar n4 = this.vertices[ v4 ].clone().normalize();\r\n\r\n\t\t\tvar uv1 = uvs[ y ][ x + 1 ].clone();\r\n\t\t\tvar uv2 = uvs[ y ][ x ].clone();\r\n\t\t\tvar uv3 = uvs[ y + 1 ][ x ].clone();\r\n\t\t\tvar uv4 = uvs[ y + 1 ][ x + 1 ].clone();\r\n\r\n\t\t\tif ( Math.abs( this.vertices[ v1 ].y ) === radius ) {\r\n\r\n\t\t\t\tuv1.x = ( uv1.x + uv2.x ) / 2;\r\n\t\t\t\tthis.faces.push( new THREE.Face3( v1, v3, v4, [ n1, n3, n4 ] ) );\r\n\t\t\t\tthis.faceVertexUvs[ 0 ].push( [ uv1, uv3, uv4 ] );\r\n\r\n\t\t\t} else if ( Math.abs( this.vertices[ v3 ].y ) === radius ) {\r\n\r\n\t\t\t\tuv3.x = ( uv3.x + uv4.x ) / 2;\r\n\t\t\t\tthis.faces.push( new THREE.Face3( v1, v2, v3, [ n1, n2, n3 ] ) );\r\n\t\t\t\tthis.faceVertexUvs[ 0 ].push( [ uv1, uv2, uv3 ] );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tthis.faces.push( new THREE.Face3( v1, v2, v4, [ n1, n2, n4 ] ) );\r\n\t\t\t\tthis.faceVertexUvs[ 0 ].push( [ uv1, uv2, uv4 ] );\r\n\r\n\t\t\t\tthis.faces.push( new THREE.Face3( v2, v3, v4, [ n2.clone(), n3, n4.clone() ] ) );\r\n\t\t\t\tthis.faceVertexUvs[ 0 ].push( [ uv2.clone(), uv3, uv4.clone() ] );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tthis.computeFaceNormals();\r\n\r\n\tthis.boundingSphere = new THREE.Sphere( new THREE.Vector3(), radius );\r\n\r\n};\r\n\r\nTHREE.SphereGeometry.prototype = Object.create( THREE.Geometry.prototype );\r\nTHREE.SphereGeometry.prototype.constructor = THREE.SphereGeometry;\r\n\r\n// File:src/extras/geometries/TextGeometry.js\r\n\r\n/**\r\n * @author zz85 / http://www.lab4games.net/zz85/blog\r\n * @author alteredq / http://alteredqualia.com/\r\n *\r\n * For creating 3D text geometry in three.js\r\n *\r\n * Text = 3D Text\r\n *\r\n * parameters = {\r\n * size: \t\t\t, \t// size of the text\r\n * height: \t\t, \t// thickness to extrude text\r\n * curveSegments: \t,\t\t// number of points on the curves\r\n *\r\n * font: \t\t\t,\t\t// font name\r\n * weight: \t\t,\t\t// font weight (normal, bold)\r\n * style: \t\t\t,\t\t// font style (normal, italics)\r\n *\r\n * bevelEnabled:\t,\t\t\t// turn on bevel\r\n * bevelThickness: , \t\t// how deep into text bevel goes\r\n * bevelSize:\t\t, \t\t// how far from text outline is bevel\r\n * }\r\n *\r\n */\r\n\r\n/*\tUsage Examples\r\n\r\n\t// TextGeometry wrapper\r\n\r\n\tvar text3d = new TextGeometry( text, options );\r\n\r\n\t// Complete manner\r\n\r\n\tvar textShapes = THREE.FontUtils.generateShapes( text, options );\r\n\tvar text3d = new ExtrudeGeometry( textShapes, options );\r\n\r\n*/\r\n\r\n\r\nTHREE.TextGeometry = function ( text, parameters ) {\r\n\r\n\tparameters = parameters || {};\r\n\r\n\tvar textShapes = THREE.FontUtils.generateShapes( text, parameters );\r\n\r\n\t// translate parameters to ExtrudeGeometry API\r\n\r\n\tparameters.amount = parameters.height !== undefined ? parameters.height : 50;\r\n\r\n\t// defaults\r\n\r\n\tif ( parameters.bevelThickness === undefined ) parameters.bevelThickness = 10;\r\n\tif ( parameters.bevelSize === undefined ) parameters.bevelSize = 8;\r\n\tif ( parameters.bevelEnabled === undefined ) parameters.bevelEnabled = false;\r\n\r\n\tTHREE.ExtrudeGeometry.call( this, textShapes, parameters );\r\n\r\n\tthis.type = 'TextGeometry';\r\n\r\n};\r\n\r\nTHREE.TextGeometry.prototype = Object.create( THREE.ExtrudeGeometry.prototype );\r\nTHREE.TextGeometry.prototype.constructor = THREE.TextGeometry;\r\n\r\n// File:src/extras/geometries/TorusGeometry.js\r\n\r\n/**\r\n * @author oosmoxiecode\r\n * @author mrdoob / http://mrdoob.com/\r\n * based on http://code.google.com/p/away3d/source/browse/trunk/fp10/Away3DLite/src/away3dlite/primitives/Torus.as?r=2888\r\n */\r\n\r\nTHREE.TorusGeometry = function ( radius, tube, radialSegments, tubularSegments, arc ) {\r\n\r\n\tTHREE.Geometry.call( this );\r\n\r\n\tthis.type = 'TorusGeometry';\r\n\r\n\tthis.parameters = {\r\n\t\tradius: radius,\r\n\t\ttube: tube,\r\n\t\tradialSegments: radialSegments,\r\n\t\ttubularSegments: tubularSegments,\r\n\t\tarc: arc\r\n\t};\r\n\r\n\tradius = radius || 100;\r\n\ttube = tube || 40;\r\n\tradialSegments = radialSegments || 8;\r\n\ttubularSegments = tubularSegments || 6;\r\n\tarc = arc || Math.PI * 2;\r\n\r\n\tvar center = new THREE.Vector3(), uvs = [], normals = [];\r\n\r\n\tfor ( var j = 0; j <= radialSegments; j ++ ) {\r\n\r\n\t\tfor ( var i = 0; i <= tubularSegments; i ++ ) {\r\n\r\n\t\t\tvar u = i / tubularSegments * arc;\r\n\t\t\tvar v = j / radialSegments * Math.PI * 2;\r\n\r\n\t\t\tcenter.x = radius * Math.cos( u );\r\n\t\t\tcenter.y = radius * Math.sin( u );\r\n\r\n\t\t\tvar vertex = new THREE.Vector3();\r\n\t\t\tvertex.x = ( radius + tube * Math.cos( v ) ) * Math.cos( u );\r\n\t\t\tvertex.y = ( radius + tube * Math.cos( v ) ) * Math.sin( u );\r\n\t\t\tvertex.z = tube * Math.sin( v );\r\n\r\n\t\t\tthis.vertices.push( vertex );\r\n\r\n\t\t\tuvs.push( new THREE.Vector2( i / tubularSegments, j / radialSegments ) );\r\n\t\t\tnormals.push( vertex.clone().sub( center ).normalize() );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tfor ( var j = 1; j <= radialSegments; j ++ ) {\r\n\r\n\t\tfor ( var i = 1; i <= tubularSegments; i ++ ) {\r\n\r\n\t\t\tvar a = ( tubularSegments + 1 ) * j + i - 1;\r\n\t\t\tvar b = ( tubularSegments + 1 ) * ( j - 1 ) + i - 1;\r\n\t\t\tvar c = ( tubularSegments + 1 ) * ( j - 1 ) + i;\r\n\t\t\tvar d = ( tubularSegments + 1 ) * j + i;\r\n\r\n\t\t\tvar face = new THREE.Face3( a, b, d, [ normals[ a ].clone(), normals[ b ].clone(), normals[ d ].clone() ] );\r\n\t\t\tthis.faces.push( face );\r\n\t\t\tthis.faceVertexUvs[ 0 ].push( [ uvs[ a ].clone(), uvs[ b ].clone(), uvs[ d ].clone() ] );\r\n\r\n\t\t\tface = new THREE.Face3( b, c, d, [ normals[ b ].clone(), normals[ c ].clone(), normals[ d ].clone() ] );\r\n\t\t\tthis.faces.push( face );\r\n\t\t\tthis.faceVertexUvs[ 0 ].push( [ uvs[ b ].clone(), uvs[ c ].clone(), uvs[ d ].clone() ] );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tthis.computeFaceNormals();\r\n\r\n};\r\n\r\nTHREE.TorusGeometry.prototype = Object.create( THREE.Geometry.prototype );\r\nTHREE.TorusGeometry.prototype.constructor = THREE.TorusGeometry;\r\n\r\n// File:src/extras/geometries/TorusKnotGeometry.js\r\n\r\n/**\r\n * @author oosmoxiecode\r\n * based on http://code.google.com/p/away3d/source/browse/trunk/fp10/Away3D/src/away3d/primitives/TorusKnot.as?spec=svn2473&r=2473\r\n */\r\n\r\nTHREE.TorusKnotGeometry = function ( radius, tube, radialSegments, tubularSegments, p, q, heightScale ) {\r\n\r\n\tTHREE.Geometry.call( this );\r\n\r\n\tthis.type = 'TorusKnotGeometry';\r\n\r\n\tthis.parameters = {\r\n\t\tradius: radius,\r\n\t\ttube: tube,\r\n\t\tradialSegments: radialSegments,\r\n\t\ttubularSegments: tubularSegments,\r\n\t\tp: p,\r\n\t\tq: q,\r\n\t\theightScale: heightScale\r\n\t};\r\n\r\n\tradius = radius || 100;\r\n\ttube = tube || 40;\r\n\tradialSegments = radialSegments || 64;\r\n\ttubularSegments = tubularSegments || 8;\r\n\tp = p || 2;\r\n\tq = q || 3;\r\n\theightScale = heightScale || 1;\r\n\t\r\n\tvar grid = new Array( radialSegments );\r\n\tvar tang = new THREE.Vector3();\r\n\tvar n = new THREE.Vector3();\r\n\tvar bitan = new THREE.Vector3();\r\n\r\n\tfor ( var i = 0; i < radialSegments; ++ i ) {\r\n\r\n\t\tgrid[ i ] = new Array( tubularSegments );\r\n\t\tvar u = i / radialSegments * 2 * p * Math.PI;\r\n\t\tvar p1 = getPos( u, q, p, radius, heightScale );\r\n\t\tvar p2 = getPos( u + 0.01, q, p, radius, heightScale );\r\n\t\ttang.subVectors( p2, p1 );\r\n\t\tn.addVectors( p2, p1 );\r\n\r\n\t\tbitan.crossVectors( tang, n );\r\n\t\tn.crossVectors( bitan, tang );\r\n\t\tbitan.normalize();\r\n\t\tn.normalize();\r\n\r\n\t\tfor ( var j = 0; j < tubularSegments; ++ j ) {\r\n\r\n\t\t\tvar v = j / tubularSegments * 2 * Math.PI;\r\n\t\t\tvar cx = - tube * Math.cos( v ); // TODO: Hack: Negating it so it faces outside.\r\n\t\t\tvar cy = tube * Math.sin( v );\r\n\r\n\t\t\tvar pos = new THREE.Vector3();\r\n\t\t\tpos.x = p1.x + cx * n.x + cy * bitan.x;\r\n\t\t\tpos.y = p1.y + cx * n.y + cy * bitan.y;\r\n\t\t\tpos.z = p1.z + cx * n.z + cy * bitan.z;\r\n\r\n\t\t\tgrid[ i ][ j ] = this.vertices.push( pos ) - 1;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tfor ( var i = 0; i < radialSegments; ++ i ) {\r\n\r\n\t\tfor ( var j = 0; j < tubularSegments; ++ j ) {\r\n\r\n\t\t\tvar ip = ( i + 1 ) % radialSegments;\r\n\t\t\tvar jp = ( j + 1 ) % tubularSegments;\r\n\r\n\t\t\tvar a = grid[ i ][ j ];\r\n\t\t\tvar b = grid[ ip ][ j ];\r\n\t\t\tvar c = grid[ ip ][ jp ];\r\n\t\t\tvar d = grid[ i ][ jp ];\r\n\r\n\t\t\tvar uva = new THREE.Vector2( i / radialSegments, j / tubularSegments );\r\n\t\t\tvar uvb = new THREE.Vector2( ( i + 1 ) / radialSegments, j / tubularSegments );\r\n\t\t\tvar uvc = new THREE.Vector2( ( i + 1 ) / radialSegments, ( j + 1 ) / tubularSegments );\r\n\t\t\tvar uvd = new THREE.Vector2( i / radialSegments, ( j + 1 ) / tubularSegments );\r\n\r\n\t\t\tthis.faces.push( new THREE.Face3( a, b, d ) );\r\n\t\t\tthis.faceVertexUvs[ 0 ].push( [ uva, uvb, uvd ] );\r\n\r\n\t\t\tthis.faces.push( new THREE.Face3( b, c, d ) );\r\n\t\t\tthis.faceVertexUvs[ 0 ].push( [ uvb.clone(), uvc, uvd.clone() ] );\r\n\r\n\t\t}\r\n\t}\r\n\r\n\tthis.computeFaceNormals();\r\n\tthis.computeVertexNormals();\r\n\r\n\tfunction getPos( u, in_q, in_p, radius, heightScale ) {\r\n\r\n\t\tvar cu = Math.cos( u );\r\n\t\tvar su = Math.sin( u );\r\n\t\tvar quOverP = in_q / in_p * u;\r\n\t\tvar cs = Math.cos( quOverP );\r\n\r\n\t\tvar tx = radius * ( 2 + cs ) * 0.5 * cu;\r\n\t\tvar ty = radius * ( 2 + cs ) * su * 0.5;\r\n\t\tvar tz = heightScale * radius * Math.sin( quOverP ) * 0.5;\r\n\r\n\t\treturn new THREE.Vector3( tx, ty, tz );\r\n\r\n\t}\r\n\r\n};\r\n\r\nTHREE.TorusKnotGeometry.prototype = Object.create( THREE.Geometry.prototype );\r\nTHREE.TorusKnotGeometry.prototype.constructor = THREE.TorusKnotGeometry;\r\n\r\n// File:src/extras/geometries/TubeGeometry.js\r\n\r\n/**\r\n * @author WestLangley / https://github.com/WestLangley\r\n * @author zz85 / https://github.com/zz85\r\n * @author miningold / https://github.com/miningold\r\n * @author jonobr1 / https://github.com/jonobr1\r\n *\r\n * Modified from the TorusKnotGeometry by @oosmoxiecode\r\n *\r\n * Creates a tube which extrudes along a 3d spline\r\n *\r\n * Uses parallel transport frames as described in\r\n * http://www.cs.indiana.edu/pub/techreports/TR425.pdf\r\n */\r\n\r\nTHREE.TubeGeometry = function ( path, segments, radius, radialSegments, closed, taper ) {\r\n\r\n\tTHREE.Geometry.call( this );\r\n\r\n\tthis.type = 'TubeGeometry';\r\n\r\n\tthis.parameters = {\r\n\t\tpath: path,\r\n\t\tsegments: segments,\r\n\t\tradius: radius,\r\n\t\tradialSegments: radialSegments,\r\n\t\tclosed: closed\r\n\t};\r\n\r\n\tsegments = segments || 64;\r\n\tradius = radius || 1;\r\n\tradialSegments = radialSegments || 8;\r\n\tclosed = closed || false;\r\n\ttaper = taper || THREE.TubeGeometry.NoTaper;\r\n\r\n\tvar grid = [];\r\n\r\n\tvar scope = this,\r\n\r\n\t\ttangent,\r\n\t\tnormal,\r\n\t\tbinormal,\r\n\r\n\t\tnumpoints = segments + 1,\r\n\r\n\t\tu, v, r,\r\n\r\n\t\tcx, cy,\r\n\t\tpos, pos2 = new THREE.Vector3(),\r\n\t\ti, j,\r\n\t\tip, jp,\r\n\t\ta, b, c, d,\r\n\t\tuva, uvb, uvc, uvd;\r\n\r\n\tvar frames = new THREE.TubeGeometry.FrenetFrames( path, segments, closed ),\r\n\t\ttangents = frames.tangents,\r\n\t\tnormals = frames.normals,\r\n\t\tbinormals = frames.binormals;\r\n\r\n\t// proxy internals\r\n\tthis.tangents = tangents;\r\n\tthis.normals = normals;\r\n\tthis.binormals = binormals;\r\n\r\n\tfunction vert( x, y, z ) {\r\n\r\n\t\treturn scope.vertices.push( new THREE.Vector3( x, y, z ) ) - 1;\r\n\r\n\t}\r\n\r\n\t// consruct the grid\r\n\r\n\tfor ( i = 0; i < numpoints; i ++ ) {\r\n\r\n\t\tgrid[ i ] = [];\r\n\r\n\t\tu = i / ( numpoints - 1 );\r\n\r\n\t\tpos = path.getPointAt( u );\r\n\r\n\t\ttangent = tangents[ i ];\r\n\t\tnormal = normals[ i ];\r\n\t\tbinormal = binormals[ i ];\r\n\r\n\t\tr = radius * taper( u );\r\n\r\n\t\tfor ( j = 0; j < radialSegments; j ++ ) {\r\n\r\n\t\t\tv = j / radialSegments * 2 * Math.PI;\r\n\r\n\t\t\tcx = - r * Math.cos( v ); // TODO: Hack: Negating it so it faces outside.\r\n\t\t\tcy = r * Math.sin( v );\r\n\r\n\t\t\tpos2.copy( pos );\r\n\t\t\tpos2.x += cx * normal.x + cy * binormal.x;\r\n\t\t\tpos2.y += cx * normal.y + cy * binormal.y;\r\n\t\t\tpos2.z += cx * normal.z + cy * binormal.z;\r\n\r\n\t\t\tgrid[ i ][ j ] = vert( pos2.x, pos2.y, pos2.z );\r\n\r\n\t\t}\r\n\t}\r\n\r\n\r\n\t// construct the mesh\r\n\r\n\tfor ( i = 0; i < segments; i ++ ) {\r\n\r\n\t\tfor ( j = 0; j < radialSegments; j ++ ) {\r\n\r\n\t\t\tip = ( closed ) ? (i + 1) % segments : i + 1;\r\n\t\t\tjp = (j + 1) % radialSegments;\r\n\r\n\t\t\ta = grid[ i ][ j ];\t\t// *** NOT NECESSARILY PLANAR ! ***\r\n\t\t\tb = grid[ ip ][ j ];\r\n\t\t\tc = grid[ ip ][ jp ];\r\n\t\t\td = grid[ i ][ jp ];\r\n\r\n\t\t\tuva = new THREE.Vector2( i / segments, j / radialSegments );\r\n\t\t\tuvb = new THREE.Vector2( ( i + 1 ) / segments, j / radialSegments );\r\n\t\t\tuvc = new THREE.Vector2( ( i + 1 ) / segments, ( j + 1 ) / radialSegments );\r\n\t\t\tuvd = new THREE.Vector2( i / segments, ( j + 1 ) / radialSegments );\r\n\r\n\t\t\tthis.faces.push( new THREE.Face3( a, b, d ) );\r\n\t\t\tthis.faceVertexUvs[ 0 ].push( [ uva, uvb, uvd ] );\r\n\r\n\t\t\tthis.faces.push( new THREE.Face3( b, c, d ) );\r\n\t\t\tthis.faceVertexUvs[ 0 ].push( [ uvb.clone(), uvc, uvd.clone() ] );\r\n\r\n\t\t}\r\n\t}\r\n\r\n\tthis.computeFaceNormals();\r\n\tthis.computeVertexNormals();\r\n\r\n};\r\n\r\nTHREE.TubeGeometry.prototype = Object.create( THREE.Geometry.prototype );\r\nTHREE.TubeGeometry.prototype.constructor = THREE.TubeGeometry;\r\n\r\nTHREE.TubeGeometry.NoTaper = function ( u ) {\r\n\r\n\treturn 1;\r\n\r\n};\r\n\r\nTHREE.TubeGeometry.SinusoidalTaper = function ( u ) {\r\n\r\n\treturn Math.sin( Math.PI * u );\r\n\r\n};\r\n\r\n// For computing of Frenet frames, exposing the tangents, normals and binormals the spline\r\nTHREE.TubeGeometry.FrenetFrames = function ( path, segments, closed ) {\r\n\r\n\tvar\tnormal = new THREE.Vector3(),\r\n\r\n\t\ttangents = [],\r\n\t\tnormals = [],\r\n\t\tbinormals = [],\r\n\r\n\t\tvec = new THREE.Vector3(),\r\n\t\tmat = new THREE.Matrix4(),\r\n\r\n\t\tnumpoints = segments + 1,\r\n\t\ttheta,\r\n\t\tepsilon = 0.0001,\r\n\t\tsmallest,\r\n\r\n\t\ttx, ty, tz,\r\n\t\ti, u;\r\n\r\n\r\n\t// expose internals\r\n\tthis.tangents = tangents;\r\n\tthis.normals = normals;\r\n\tthis.binormals = binormals;\r\n\r\n\t// compute the tangent vectors for each segment on the path\r\n\r\n\tfor ( i = 0; i < numpoints; i ++ ) {\r\n\r\n\t\tu = i / ( numpoints - 1 );\r\n\r\n\t\ttangents[ i ] = path.getTangentAt( u );\r\n\t\ttangents[ i ].normalize();\r\n\r\n\t}\r\n\r\n\tinitialNormal3();\r\n\r\n\t/*\r\n\tfunction initialNormal1(lastBinormal) {\r\n\t\t// fixed start binormal. Has dangers of 0 vectors\r\n\t\tnormals[ 0 ] = new THREE.Vector3();\r\n\t\tbinormals[ 0 ] = new THREE.Vector3();\r\n\t\tif (lastBinormal===undefined) lastBinormal = new THREE.Vector3( 0, 0, 1 );\r\n\t\tnormals[ 0 ].crossVectors( lastBinormal, tangents[ 0 ] ).normalize();\r\n\t\tbinormals[ 0 ].crossVectors( tangents[ 0 ], normals[ 0 ] ).normalize();\r\n\t}\r\n\r\n\tfunction initialNormal2() {\r\n\r\n\t\t// This uses the Frenet-Serret formula for deriving binormal\r\n\t\tvar t2 = path.getTangentAt( epsilon );\r\n\r\n\t\tnormals[ 0 ] = new THREE.Vector3().subVectors( t2, tangents[ 0 ] ).normalize();\r\n\t\tbinormals[ 0 ] = new THREE.Vector3().crossVectors( tangents[ 0 ], normals[ 0 ] );\r\n\r\n\t\tnormals[ 0 ].crossVectors( binormals[ 0 ], tangents[ 0 ] ).normalize(); // last binormal x tangent\r\n\t\tbinormals[ 0 ].crossVectors( tangents[ 0 ], normals[ 0 ] ).normalize();\r\n\r\n\t}\r\n\t*/\r\n\r\n\tfunction initialNormal3() {\r\n\t\t// select an initial normal vector perpenicular to the first tangent vector,\r\n\t\t// and in the direction of the smallest tangent xyz component\r\n\r\n\t\tnormals[ 0 ] = new THREE.Vector3();\r\n\t\tbinormals[ 0 ] = new THREE.Vector3();\r\n\t\tsmallest = Number.MAX_VALUE;\r\n\t\ttx = Math.abs( tangents[ 0 ].x );\r\n\t\tty = Math.abs( tangents[ 0 ].y );\r\n\t\ttz = Math.abs( tangents[ 0 ].z );\r\n\r\n\t\tif ( tx <= smallest ) {\r\n\t\t\tsmallest = tx;\r\n\t\t\tnormal.set( 1, 0, 0 );\r\n\t\t}\r\n\r\n\t\tif ( ty <= smallest ) {\r\n\t\t\tsmallest = ty;\r\n\t\t\tnormal.set( 0, 1, 0 );\r\n\t\t}\r\n\r\n\t\tif ( tz <= smallest ) {\r\n\t\t\tnormal.set( 0, 0, 1 );\r\n\t\t}\r\n\r\n\t\tvec.crossVectors( tangents[ 0 ], normal ).normalize();\r\n\r\n\t\tnormals[ 0 ].crossVectors( tangents[ 0 ], vec );\r\n\t\tbinormals[ 0 ].crossVectors( tangents[ 0 ], normals[ 0 ] );\r\n\t}\r\n\r\n\r\n\t// compute the slowly-varying normal and binormal vectors for each segment on the path\r\n\r\n\tfor ( i = 1; i < numpoints; i ++ ) {\r\n\r\n\t\tnormals[ i ] = normals[ i - 1 ].clone();\r\n\r\n\t\tbinormals[ i ] = binormals[ i - 1 ].clone();\r\n\r\n\t\tvec.crossVectors( tangents[ i - 1 ], tangents[ i ] );\r\n\r\n\t\tif ( vec.length() > epsilon ) {\r\n\r\n\t\t\tvec.normalize();\r\n\r\n\t\t\ttheta = Math.acos( THREE.Math.clamp( tangents[ i - 1 ].dot( tangents[ i ] ), - 1, 1 ) ); // clamp for floating pt errors\r\n\r\n\t\t\tnormals[ i ].applyMatrix4( mat.makeRotationAxis( vec, theta ) );\r\n\r\n\t\t}\r\n\r\n\t\tbinormals[ i ].crossVectors( tangents[ i ], normals[ i ] );\r\n\r\n\t}\r\n\r\n\r\n\t// if the curve is closed, postprocess the vectors so the first and last normal vectors are the same\r\n\r\n\tif ( closed ) {\r\n\r\n\t\ttheta = Math.acos( THREE.Math.clamp( normals[ 0 ].dot( normals[ numpoints - 1 ] ), - 1, 1 ) );\r\n\t\ttheta /= ( numpoints - 1 );\r\n\r\n\t\tif ( tangents[ 0 ].dot( vec.crossVectors( normals[ 0 ], normals[ numpoints - 1 ] ) ) > 0 ) {\r\n\r\n\t\t\ttheta = - theta;\r\n\r\n\t\t}\r\n\r\n\t\tfor ( i = 1; i < numpoints; i ++ ) {\r\n\r\n\t\t\t// twist a little...\r\n\t\t\tnormals[ i ].applyMatrix4( mat.makeRotationAxis( tangents[ i ], theta * i ) );\r\n\t\t\tbinormals[ i ].crossVectors( tangents[ i ], normals[ i ] );\r\n\r\n\t\t}\r\n\r\n\t}\r\n};\r\n\r\n// File:src/extras/geometries/PolyhedronGeometry.js\r\n\r\n/**\r\n * @author clockworkgeek / https://github.com/clockworkgeek\r\n * @author timothypratley / https://github.com/timothypratley\r\n * @author WestLangley / http://github.com/WestLangley\r\n*/\r\n\r\nTHREE.PolyhedronGeometry = function ( vertices, indices, radius, detail ) {\r\n\r\n\tTHREE.Geometry.call( this );\r\n\r\n\tthis.type = 'PolyhedronGeometry';\r\n\r\n\tthis.parameters = {\r\n\t\tvertices: vertices,\r\n\t\tindices: indices,\r\n\t\tradius: radius,\r\n\t\tdetail: detail\r\n\t};\r\n\r\n\tradius = radius || 1;\r\n\tdetail = detail || 0;\r\n\r\n\tvar that = this;\r\n\r\n\tfor ( var i = 0, l = vertices.length; i < l; i += 3 ) {\r\n\r\n\t\tprepare( new THREE.Vector3( vertices[ i ], vertices[ i + 1 ], vertices[ i + 2 ] ) );\r\n\r\n\t}\r\n\r\n\tvar p = this.vertices;\r\n\r\n\tvar faces = [];\r\n\r\n\tfor ( var i = 0, j = 0, l = indices.length; i < l; i += 3, j ++ ) {\r\n\r\n\t\tvar v1 = p[ indices[ i ] ];\r\n\t\tvar v2 = p[ indices[ i + 1 ] ];\r\n\t\tvar v3 = p[ indices[ i + 2 ] ];\r\n\r\n\t\tfaces[ j ] = new THREE.Face3( v1.index, v2.index, v3.index, [ v1.clone(), v2.clone(), v3.clone() ] );\r\n\r\n\t}\r\n\r\n\tvar centroid = new THREE.Vector3();\r\n\r\n\tfor ( var i = 0, l = faces.length; i < l; i ++ ) {\r\n\r\n\t\tsubdivide( faces[ i ], detail );\r\n\r\n\t}\r\n\r\n\r\n\t// Handle case when face straddles the seam\r\n\r\n\tfor ( var i = 0, l = this.faceVertexUvs[ 0 ].length; i < l; i ++ ) {\r\n\r\n\t\tvar uvs = this.faceVertexUvs[ 0 ][ i ];\r\n\r\n\t\tvar x0 = uvs[ 0 ].x;\r\n\t\tvar x1 = uvs[ 1 ].x;\r\n\t\tvar x2 = uvs[ 2 ].x;\r\n\r\n\t\tvar max = Math.max( x0, Math.max( x1, x2 ) );\r\n\t\tvar min = Math.min( x0, Math.min( x1, x2 ) );\r\n\r\n\t\tif ( max > 0.9 && min < 0.1 ) { // 0.9 is somewhat arbitrary\r\n\r\n\t\t\tif ( x0 < 0.2 ) uvs[ 0 ].x += 1;\r\n\t\t\tif ( x1 < 0.2 ) uvs[ 1 ].x += 1;\r\n\t\t\tif ( x2 < 0.2 ) uvs[ 2 ].x += 1;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\r\n\t// Apply radius\r\n\r\n\tfor ( var i = 0, l = this.vertices.length; i < l; i ++ ) {\r\n\r\n\t\tthis.vertices[ i ].multiplyScalar( radius );\r\n\r\n\t}\r\n\r\n\r\n\t// Merge vertices\r\n\r\n\tthis.mergeVertices();\r\n\r\n\tthis.computeFaceNormals();\r\n\r\n\tthis.boundingSphere = new THREE.Sphere( new THREE.Vector3(), radius );\r\n\r\n\r\n\t// Project vector onto sphere's surface\r\n\r\n\tfunction prepare( vector ) {\r\n\r\n\t\tvar vertex = vector.normalize().clone();\r\n\t\tvertex.index = that.vertices.push( vertex ) - 1;\r\n\r\n\t\t// Texture coords are equivalent to map coords, calculate angle and convert to fraction of a circle.\r\n\r\n\t\tvar u = azimuth( vector ) / 2 / Math.PI + 0.5;\r\n\t\tvar v = inclination( vector ) / Math.PI + 0.5;\r\n\t\tvertex.uv = new THREE.Vector2( u, 1 - v );\r\n\r\n\t\treturn vertex;\r\n\r\n\t}\r\n\r\n\r\n\t// Approximate a curved face with recursively sub-divided triangles.\r\n\r\n\tfunction make( v1, v2, v3 ) {\r\n\r\n\t\tvar face = new THREE.Face3( v1.index, v2.index, v3.index, [ v1.clone(), v2.clone(), v3.clone() ] );\r\n\t\tthat.faces.push( face );\r\n\r\n\t\tcentroid.copy( v1 ).add( v2 ).add( v3 ).divideScalar( 3 );\r\n\r\n\t\tvar azi = azimuth( centroid );\r\n\r\n\t\tthat.faceVertexUvs[ 0 ].push( [\r\n\t\t\tcorrectUV( v1.uv, v1, azi ),\r\n\t\t\tcorrectUV( v2.uv, v2, azi ),\r\n\t\t\tcorrectUV( v3.uv, v3, azi )\r\n\t\t] );\r\n\r\n\t}\r\n\r\n\r\n\t// Analytically subdivide a face to the required detail level.\r\n\r\n\tfunction subdivide( face, detail ) {\r\n\r\n\t\tvar cols = Math.pow(2, detail);\r\n\t\tvar a = prepare( that.vertices[ face.a ] );\r\n\t\tvar b = prepare( that.vertices[ face.b ] );\r\n\t\tvar c = prepare( that.vertices[ face.c ] );\r\n\t\tvar v = [];\r\n\r\n\t\t// Construct all of the vertices for this subdivision.\r\n\r\n\t\tfor ( var i = 0 ; i <= cols; i ++ ) {\r\n\r\n\t\t\tv[ i ] = [];\r\n\r\n\t\t\tvar aj = prepare( a.clone().lerp( c, i / cols ) );\r\n\t\t\tvar bj = prepare( b.clone().lerp( c, i / cols ) );\r\n\t\t\tvar rows = cols - i;\r\n\r\n\t\t\tfor ( var j = 0; j <= rows; j ++) {\r\n\r\n\t\t\t\tif ( j == 0 && i == cols ) {\r\n\r\n\t\t\t\t\tv[ i ][ j ] = aj;\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\tv[ i ][ j ] = prepare( aj.clone().lerp( bj, j / rows ) );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\t// Construct all of the faces.\r\n\r\n\t\tfor ( var i = 0; i < cols ; i ++ ) {\r\n\r\n\t\t\tfor ( var j = 0; j < 2 * (cols - i) - 1; j ++ ) {\r\n\r\n\t\t\t\tvar k = Math.floor( j / 2 );\r\n\r\n\t\t\t\tif ( j % 2 == 0 ) {\r\n\r\n\t\t\t\t\tmake(\r\n\t\t\t\t\t\tv[ i ][ k + 1],\r\n\t\t\t\t\t\tv[ i + 1 ][ k ],\r\n\t\t\t\t\t\tv[ i ][ k ]\r\n\t\t\t\t\t);\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\tmake(\r\n\t\t\t\t\t\tv[ i ][ k + 1 ],\r\n\t\t\t\t\t\tv[ i + 1][ k + 1],\r\n\t\t\t\t\t\tv[ i + 1 ][ k ]\r\n\t\t\t\t\t);\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\r\n\t// Angle around the Y axis, counter-clockwise when looking from above.\r\n\r\n\tfunction azimuth( vector ) {\r\n\r\n\t\treturn Math.atan2( vector.z, - vector.x );\r\n\r\n\t}\r\n\r\n\r\n\t// Angle above the XZ plane.\r\n\r\n\tfunction inclination( vector ) {\r\n\r\n\t\treturn Math.atan2( - vector.y, Math.sqrt( ( vector.x * vector.x ) + ( vector.z * vector.z ) ) );\r\n\r\n\t}\r\n\r\n\r\n\t// Texture fixing helper. Spheres have some odd behaviours.\r\n\r\n\tfunction correctUV( uv, vector, azimuth ) {\r\n\r\n\t\tif ( ( azimuth < 0 ) && ( uv.x === 1 ) ) uv = new THREE.Vector2( uv.x - 1, uv.y );\r\n\t\tif ( ( vector.x === 0 ) && ( vector.z === 0 ) ) uv = new THREE.Vector2( azimuth / 2 / Math.PI + 0.5, uv.y );\r\n\t\treturn uv.clone();\r\n\r\n\t}\r\n\r\n\r\n};\r\n\r\nTHREE.PolyhedronGeometry.prototype = Object.create( THREE.Geometry.prototype );\r\nTHREE.PolyhedronGeometry.prototype.constructor = THREE.PolyhedronGeometry;\r\n\r\n// File:src/extras/geometries/DodecahedronGeometry.js\r\n\r\n/**\r\n * @author Abe Pazos / https://hamoid.com\r\n */\r\n\r\nTHREE.DodecahedronGeometry = function ( radius, detail ) {\r\n\r\n\tthis.parameters = {\r\n\t\tradius: radius,\r\n\t\tdetail: detail\r\n\t};\r\n\r\n\tvar t = ( 1 + Math.sqrt( 5 ) ) / 2;\r\n\tvar r = 1 / t;\r\n\r\n\tvar vertices = [\r\n\r\n\t\t// (Ā±1, Ā±1, Ā±1)\r\n\t\t-1, -1, -1, -1, -1, 1,\r\n\t\t-1, 1, -1, -1, 1, 1,\r\n\t\t 1, -1, -1, 1, -1, 1,\r\n\t\t 1, 1, -1, 1, 1, 1,\r\n\r\n\t\t// (0, Ā±1/Ļ†, Ā±Ļ†)\r\n\t\t 0, -r, -t, 0, -r, t,\r\n\t\t 0, r, -t, 0, r, t,\r\n\r\n\t\t// (Ā±1/Ļ†, Ā±Ļ†, 0)\r\n\t\t-r, -t, 0, -r, t, 0,\r\n\t\t r, -t, 0, r, t, 0,\r\n\r\n\t\t// (Ā±Ļ†, 0, Ā±1/Ļ†)\r\n\t\t-t, 0, -r, t, 0, -r,\r\n\t\t-t, 0, r, t, 0, r\r\n\t];\r\n\r\n\tvar indices = [\r\n\t\t 3, 11, 7, 3, 7, 15, 3, 15, 13,\r\n\t\t 7, 19, 17, 7, 17, 6, 7, 6, 15,\r\n\t\t17, 4, 8, 17, 8, 10, 17, 10, 6,\r\n\t\t 8, 0, 16, 8, 16, 2, 8, 2, 10,\r\n\t\t 0, 12, 1, 0, 1, 18, 0, 18, 16,\r\n\t\t 6, 10, 2, 6, 2, 13, 6, 13, 15,\r\n\t\t 2, 16, 18, 2, 18, 3, 2, 3, 13,\r\n\t\t18, 1, 9, 18, 9, 11, 18, 11, 3,\r\n\t\t 4, 14, 12, 4, 12, 0, 4, 0, 8,\r\n\t\t11, 9, 5, 11, 5, 19, 11, 19, 7,\r\n\t\t19, 5, 14, 19, 14, 4, 19, 4, 17,\r\n\t\t 1, 12, 14, 1, 14, 5, 1, 5, 9\r\n\t];\r\n\r\n\tTHREE.PolyhedronGeometry.call( this, vertices, indices, radius, detail );\r\n\r\n};\r\n\r\nTHREE.DodecahedronGeometry.prototype = Object.create( THREE.Geometry.prototype );\r\nTHREE.DodecahedronGeometry.prototype.constructor = THREE.DodecahedronGeometry;\r\n\r\n// File:src/extras/geometries/IcosahedronGeometry.js\r\n\r\n/**\r\n * @author timothypratley / https://github.com/timothypratley\r\n */\r\n\r\nTHREE.IcosahedronGeometry = function ( radius, detail ) {\r\n\r\n\tvar t = ( 1 + Math.sqrt( 5 ) ) / 2;\r\n\r\n\tvar vertices = [\r\n\t\t- 1, t, 0, 1, t, 0, - 1, - t, 0, 1, - t, 0,\r\n\t\t 0, - 1, t, 0, 1, t, 0, - 1, - t, 0, 1, - t,\r\n\t\t t, 0, - 1, t, 0, 1, - t, 0, - 1, - t, 0, 1\r\n\t];\r\n\r\n\tvar indices = [\r\n\t\t 0, 11, 5, 0, 5, 1, 0, 1, 7, 0, 7, 10, 0, 10, 11,\r\n\t\t 1, 5, 9, 5, 11, 4, 11, 10, 2, 10, 7, 6, 7, 1, 8,\r\n\t\t 3, 9, 4, 3, 4, 2, 3, 2, 6, 3, 6, 8, 3, 8, 9,\r\n\t\t 4, 9, 5, 2, 4, 11, 6, 2, 10, 8, 6, 7, 9, 8, 1\r\n\t];\r\n\r\n\tTHREE.PolyhedronGeometry.call( this, vertices, indices, radius, detail );\r\n\r\n\tthis.type = 'IcosahedronGeometry';\r\n\r\n\tthis.parameters = {\r\n\t\tradius: radius,\r\n\t\tdetail: detail\r\n\t};\r\n};\r\n\r\nTHREE.IcosahedronGeometry.prototype = Object.create( THREE.Geometry.prototype );\r\nTHREE.IcosahedronGeometry.prototype.constructor = THREE.IcosahedronGeometry;\r\n\r\n// File:src/extras/geometries/OctahedronGeometry.js\r\n\r\n/**\r\n * @author timothypratley / https://github.com/timothypratley\r\n */\r\n\r\nTHREE.OctahedronGeometry = function ( radius, detail ) {\r\n\r\n\tthis.parameters = {\r\n\t\tradius: radius,\r\n\t\tdetail: detail\r\n\t};\r\n\r\n\tvar vertices = [\r\n\t\t1, 0, 0, - 1, 0, 0, 0, 1, 0, 0,- 1, 0, 0, 0, 1, 0, 0,- 1\r\n\t];\r\n\r\n\tvar indices = [\r\n\t\t0, 2, 4, 0, 4, 3, 0, 3, 5, 0, 5, 2, 1, 2, 5, 1, 5, 3, 1, 3, 4, 1, 4, 2\r\n\t];\r\n\r\n\tTHREE.PolyhedronGeometry.call( this, vertices, indices, radius, detail );\r\n\r\n\tthis.type = 'OctahedronGeometry';\r\n\r\n\tthis.parameters = {\r\n\t\tradius: radius,\r\n\t\tdetail: detail\r\n\t};\r\n};\r\n\r\nTHREE.OctahedronGeometry.prototype = Object.create( THREE.Geometry.prototype );\r\nTHREE.OctahedronGeometry.prototype.constructor = THREE.OctahedronGeometry;\r\n\r\n// File:src/extras/geometries/TetrahedronGeometry.js\r\n\r\n/**\r\n * @author timothypratley / https://github.com/timothypratley\r\n */\r\n\r\nTHREE.TetrahedronGeometry = function ( radius, detail ) {\r\n\r\n\tvar vertices = [\r\n\t\t 1, 1, 1, - 1, - 1, 1, - 1, 1, - 1, 1, - 1, - 1\r\n\t];\r\n\r\n\tvar indices = [\r\n\t\t 2, 1, 0, 0, 3, 2, 1, 3, 0, 2, 3, 1\r\n\t];\r\n\r\n\tTHREE.PolyhedronGeometry.call( this, vertices, indices, radius, detail );\r\n\r\n\tthis.type = 'TetrahedronGeometry';\r\n\r\n\tthis.parameters = {\r\n\t\tradius: radius,\r\n\t\tdetail: detail\r\n\t};\r\n\r\n};\r\n\r\nTHREE.TetrahedronGeometry.prototype = Object.create( THREE.Geometry.prototype );\r\nTHREE.TetrahedronGeometry.prototype.constructor = THREE.TetrahedronGeometry;\r\n\r\n// File:src/extras/geometries/ParametricGeometry.js\r\n\r\n/**\r\n * @author zz85 / https://github.com/zz85\r\n * Parametric Surfaces Geometry\r\n * based on the brilliant article by @prideout http://prideout.net/blog/?p=44\r\n *\r\n * new THREE.ParametricGeometry( parametricFunction, uSegments, ySegements );\r\n *\r\n */\r\n\r\nTHREE.ParametricGeometry = function ( func, slices, stacks ) {\r\n\r\n\tTHREE.Geometry.call( this );\r\n\r\n\tthis.type = 'ParametricGeometry';\r\n\r\n\tthis.parameters = {\r\n\t\tfunc: func,\r\n\t\tslices: slices,\r\n\t\tstacks: stacks\r\n\t};\r\n\r\n\tvar verts = this.vertices;\r\n\tvar faces = this.faces;\r\n\tvar uvs = this.faceVertexUvs[ 0 ];\r\n\r\n\tvar i, j, p;\r\n\tvar u, v;\r\n\r\n\tvar sliceCount = slices + 1;\r\n\r\n\tfor ( i = 0; i <= stacks; i ++ ) {\r\n\r\n\t\tv = i / stacks;\r\n\r\n\t\tfor ( j = 0; j <= slices; j ++ ) {\r\n\r\n\t\t\tu = j / slices;\r\n\r\n\t\t\tp = func( u, v );\r\n\t\t\tverts.push( p );\r\n\r\n\t\t}\r\n\t}\r\n\r\n\tvar a, b, c, d;\r\n\tvar uva, uvb, uvc, uvd;\r\n\r\n\tfor ( i = 0; i < stacks; i ++ ) {\r\n\r\n\t\tfor ( j = 0; j < slices; j ++ ) {\r\n\r\n\t\t\ta = i * sliceCount + j;\r\n\t\t\tb = i * sliceCount + j + 1;\r\n\t\t\tc = (i + 1) * sliceCount + j + 1;\r\n\t\t\td = (i + 1) * sliceCount + j;\r\n\r\n\t\t\tuva = new THREE.Vector2( j / slices, i / stacks );\r\n\t\t\tuvb = new THREE.Vector2( ( j + 1 ) / slices, i / stacks );\r\n\t\t\tuvc = new THREE.Vector2( ( j + 1 ) / slices, ( i + 1 ) / stacks );\r\n\t\t\tuvd = new THREE.Vector2( j / slices, ( i + 1 ) / stacks );\r\n\r\n\t\t\tfaces.push( new THREE.Face3( a, b, d ) );\r\n\t\t\tuvs.push( [ uva, uvb, uvd ] );\r\n\r\n\t\t\tfaces.push( new THREE.Face3( b, c, d ) );\r\n\t\t\tuvs.push( [ uvb.clone(), uvc, uvd.clone() ] );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\t// console.log(this);\r\n\r\n\t// magic bullet\r\n\t// var diff = this.mergeVertices();\r\n\t// console.log('removed ', diff, ' vertices by merging');\r\n\r\n\tthis.computeFaceNormals();\r\n\tthis.computeVertexNormals();\r\n\r\n};\r\n\r\nTHREE.ParametricGeometry.prototype = Object.create( THREE.Geometry.prototype );\r\nTHREE.ParametricGeometry.prototype.constructor = THREE.ParametricGeometry;\r\n\r\n// File:src/extras/helpers/AxisHelper.js\r\n\r\n/**\r\n * @author sroucheray / http://sroucheray.org/\r\n * @author mrdoob / http://mrdoob.com/\r\n */\r\n\r\nTHREE.AxisHelper = function ( size ) {\r\n\r\n\tsize = size || 1;\r\n\r\n\tvar vertices = new Float32Array( [\r\n\t\t0, 0, 0, size, 0, 0,\r\n\t\t0, 0, 0, 0, size, 0,\r\n\t\t0, 0, 0, 0, 0, size\r\n\t] );\r\n\r\n\tvar colors = new Float32Array( [\r\n\t\t1, 0, 0, 1, 0.6, 0,\r\n\t\t0, 1, 0, 0.6, 1, 0,\r\n\t\t0, 0, 1, 0, 0.6, 1\r\n\t] );\r\n\r\n\tvar geometry = new THREE.BufferGeometry();\r\n\tgeometry.addAttribute( 'position', new THREE.BufferAttribute( vertices, 3 ) );\r\n\tgeometry.addAttribute( 'color', new THREE.BufferAttribute( colors, 3 ) );\r\n\r\n\tvar material = new THREE.LineBasicMaterial( { vertexColors: THREE.VertexColors } );\r\n\r\n\tTHREE.Line.call( this, geometry, material, THREE.LinePieces );\r\n\r\n};\r\n\r\nTHREE.AxisHelper.prototype = Object.create( THREE.Line.prototype );\r\nTHREE.AxisHelper.prototype.constructor = THREE.AxisHelper;\r\n\r\n// File:src/extras/helpers/ArrowHelper.js\r\n\r\n/**\r\n * @author WestLangley / http://github.com/WestLangley\r\n * @author zz85 / http://github.com/zz85\r\n * @author bhouston / http://exocortex.com\r\n *\r\n * Creates an arrow for visualizing directions\r\n *\r\n * Parameters:\r\n * dir - Vector3\r\n * origin - Vector3\r\n * length - Number\r\n * color - color in hex value\r\n * headLength - Number\r\n * headWidth - Number\r\n */\r\n\r\nTHREE.ArrowHelper = ( function () {\r\n\r\n\tvar lineGeometry = new THREE.Geometry();\r\n\tlineGeometry.vertices.push( new THREE.Vector3( 0, 0, 0 ), new THREE.Vector3( 0, 1, 0 ) );\r\n\r\n\tvar coneGeometry = new THREE.CylinderGeometry( 0, 0.5, 1, 5, 1 );\r\n\tconeGeometry.applyMatrix( new THREE.Matrix4().makeTranslation( 0, - 0.5, 0 ) );\r\n\r\n\treturn function ( dir, origin, length, color, headLength, headWidth ) {\r\n\r\n\t\t// dir is assumed to be normalized\r\n\r\n\t\tTHREE.Object3D.call( this );\r\n\r\n\t\tif ( color === undefined ) color = 0xffff00;\r\n\t\tif ( length === undefined ) length = 1;\r\n\t\tif ( headLength === undefined ) headLength = 0.2 * length;\r\n\t\tif ( headWidth === undefined ) headWidth = 0.2 * headLength;\r\n\r\n\t\tthis.position.copy( origin );\r\n\r\n\t\tthis.line = new THREE.Line( lineGeometry, new THREE.LineBasicMaterial( { color: color } ) );\r\n\t\tthis.line.matrixAutoUpdate = false;\r\n\t\tthis.add( this.line );\r\n\r\n\t\tthis.cone = new THREE.Mesh( coneGeometry, new THREE.MeshBasicMaterial( { color: color } ) );\r\n\t\tthis.cone.matrixAutoUpdate = false;\r\n\t\tthis.add( this.cone );\r\n\r\n\t\tthis.setDirection( dir );\r\n\t\tthis.setLength( length, headLength, headWidth );\r\n\r\n\t}\r\n\r\n}() );\r\n\r\nTHREE.ArrowHelper.prototype = Object.create( THREE.Object3D.prototype );\r\nTHREE.ArrowHelper.prototype.constructor = THREE.ArrowHelper;\r\n\r\nTHREE.ArrowHelper.prototype.setDirection = ( function () {\r\n\r\n\tvar axis = new THREE.Vector3();\r\n\tvar radians;\r\n\r\n\treturn function ( dir ) {\r\n\r\n\t\t// dir is assumed to be normalized\r\n\r\n\t\tif ( dir.y > 0.99999 ) {\r\n\r\n\t\t\tthis.quaternion.set( 0, 0, 0, 1 );\r\n\r\n\t\t} else if ( dir.y < - 0.99999 ) {\r\n\r\n\t\t\tthis.quaternion.set( 1, 0, 0, 0 );\r\n\r\n\t\t} else {\r\n\r\n\t\t\taxis.set( dir.z, 0, - dir.x ).normalize();\r\n\r\n\t\t\tradians = Math.acos( dir.y );\r\n\r\n\t\t\tthis.quaternion.setFromAxisAngle( axis, radians );\r\n\r\n\t\t}\r\n\r\n\t};\r\n\r\n}() );\r\n\r\nTHREE.ArrowHelper.prototype.setLength = function ( length, headLength, headWidth ) {\r\n\r\n\tif ( headLength === undefined ) headLength = 0.2 * length;\r\n\tif ( headWidth === undefined ) headWidth = 0.2 * headLength;\r\n\r\n\tthis.line.scale.set( 1, length - headLength, 1 );\r\n\tthis.line.updateMatrix();\r\n\r\n\tthis.cone.scale.set( headWidth, headLength, headWidth );\r\n\tthis.cone.position.y = length;\r\n\tthis.cone.updateMatrix();\r\n\r\n};\r\n\r\nTHREE.ArrowHelper.prototype.setColor = function ( color ) {\r\n\r\n\tthis.line.material.color.set( color );\r\n\tthis.cone.material.color.set( color );\r\n\r\n};\r\n\r\n// File:src/extras/helpers/BoxHelper.js\r\n\r\n/**\r\n * @author mrdoob / http://mrdoob.com/\r\n */\r\n\r\nTHREE.BoxHelper = function ( object ) {\r\n\r\n\tvar geometry = new THREE.BufferGeometry();\r\n\tgeometry.addAttribute( 'position', new THREE.BufferAttribute( new Float32Array( 72 ), 3 ) );\r\n\r\n\tTHREE.Line.call( this, geometry, new THREE.LineBasicMaterial( { color: 0xffff00 } ), THREE.LinePieces );\r\n\r\n\tif ( object !== undefined ) {\r\n\r\n\t\tthis.update( object );\r\n\r\n\t}\r\n\r\n};\r\n\r\nTHREE.BoxHelper.prototype = Object.create( THREE.Line.prototype );\r\nTHREE.BoxHelper.prototype.constructor = THREE.BoxHelper;\r\n\r\nTHREE.BoxHelper.prototype.update = function ( object ) {\r\n\r\n\tvar geometry = object.geometry;\r\n\r\n\tif ( geometry.boundingBox === null ) {\r\n\r\n\t\tgeometry.computeBoundingBox();\r\n\r\n\t}\r\n\r\n\tvar min = geometry.boundingBox.min;\r\n\tvar max = geometry.boundingBox.max;\r\n\r\n\t/*\r\n\t 5____4\r\n\t1/___0/|\r\n\t| 6__|_7\r\n\t2/___3/\r\n\r\n\t0: max.x, max.y, max.z\r\n\t1: min.x, max.y, max.z\r\n\t2: min.x, min.y, max.z\r\n\t3: max.x, min.y, max.z\r\n\t4: max.x, max.y, min.z\r\n\t5: min.x, max.y, min.z\r\n\t6: min.x, min.y, min.z\r\n\t7: max.x, min.y, min.z\r\n\t*/\r\n\r\n\tvar vertices = this.geometry.attributes.position.array;\r\n\r\n\tvertices[ 0 ] = max.x; vertices[ 1 ] = max.y; vertices[ 2 ] = max.z;\r\n\tvertices[ 3 ] = min.x; vertices[ 4 ] = max.y; vertices[ 5 ] = max.z;\r\n\r\n\tvertices[ 6 ] = min.x; vertices[ 7 ] = max.y; vertices[ 8 ] = max.z;\r\n\tvertices[ 9 ] = min.x; vertices[ 10 ] = min.y; vertices[ 11 ] = max.z;\r\n\r\n\tvertices[ 12 ] = min.x; vertices[ 13 ] = min.y; vertices[ 14 ] = max.z;\r\n\tvertices[ 15 ] = max.x; vertices[ 16 ] = min.y; vertices[ 17 ] = max.z;\r\n\r\n\tvertices[ 18 ] = max.x; vertices[ 19 ] = min.y; vertices[ 20 ] = max.z;\r\n\tvertices[ 21 ] = max.x; vertices[ 22 ] = max.y; vertices[ 23 ] = max.z;\r\n\r\n\t//\r\n\r\n\tvertices[ 24 ] = max.x; vertices[ 25 ] = max.y; vertices[ 26 ] = min.z;\r\n\tvertices[ 27 ] = min.x; vertices[ 28 ] = max.y; vertices[ 29 ] = min.z;\r\n\r\n\tvertices[ 30 ] = min.x; vertices[ 31 ] = max.y; vertices[ 32 ] = min.z;\r\n\tvertices[ 33 ] = min.x; vertices[ 34 ] = min.y; vertices[ 35 ] = min.z;\r\n\r\n\tvertices[ 36 ] = min.x; vertices[ 37 ] = min.y; vertices[ 38 ] = min.z;\r\n\tvertices[ 39 ] = max.x; vertices[ 40 ] = min.y; vertices[ 41 ] = min.z;\r\n\r\n\tvertices[ 42 ] = max.x; vertices[ 43 ] = min.y; vertices[ 44 ] = min.z;\r\n\tvertices[ 45 ] = max.x; vertices[ 46 ] = max.y; vertices[ 47 ] = min.z;\r\n\r\n\t//\r\n\r\n\tvertices[ 48 ] = max.x; vertices[ 49 ] = max.y; vertices[ 50 ] = max.z;\r\n\tvertices[ 51 ] = max.x; vertices[ 52 ] = max.y; vertices[ 53 ] = min.z;\r\n\r\n\tvertices[ 54 ] = min.x; vertices[ 55 ] = max.y; vertices[ 56 ] = max.z;\r\n\tvertices[ 57 ] = min.x; vertices[ 58 ] = max.y; vertices[ 59 ] = min.z;\r\n\r\n\tvertices[ 60 ] = min.x; vertices[ 61 ] = min.y; vertices[ 62 ] = max.z;\r\n\tvertices[ 63 ] = min.x; vertices[ 64 ] = min.y; vertices[ 65 ] = min.z;\r\n\r\n\tvertices[ 66 ] = max.x; vertices[ 67 ] = min.y; vertices[ 68 ] = max.z;\r\n\tvertices[ 69 ] = max.x; vertices[ 70 ] = min.y; vertices[ 71 ] = min.z;\r\n\r\n\tthis.geometry.attributes.position.needsUpdate = true;\r\n\r\n\tthis.geometry.computeBoundingSphere();\r\n\r\n\tthis.matrix = object.matrixWorld;\r\n\tthis.matrixAutoUpdate = false;\r\n\r\n};\r\n\r\n// File:src/extras/helpers/BoundingBoxHelper.js\r\n\r\n/**\r\n * @author WestLangley / http://github.com/WestLangley\r\n */\r\n\r\n// a helper to show the world-axis-aligned bounding box for an object\r\n\r\nTHREE.BoundingBoxHelper = function ( object, hex ) {\r\n\r\n\tvar color = ( hex !== undefined ) ? hex : 0x888888;\r\n\r\n\tthis.object = object;\r\n\r\n\tthis.box = new THREE.Box3();\r\n\r\n\tTHREE.Mesh.call( this, new THREE.BoxGeometry( 1, 1, 1 ), new THREE.MeshBasicMaterial( { color: color, wireframe: true } ) );\r\n\r\n};\r\n\r\nTHREE.BoundingBoxHelper.prototype = Object.create( THREE.Mesh.prototype );\r\nTHREE.BoundingBoxHelper.prototype.constructor = THREE.BoundingBoxHelper;\r\n\r\nTHREE.BoundingBoxHelper.prototype.update = function () {\r\n\r\n\tthis.box.setFromObject( this.object );\r\n\r\n\tthis.box.size( this.scale );\r\n\r\n\tthis.box.center( this.position );\r\n\r\n};\r\n\r\n// File:src/extras/helpers/CameraHelper.js\r\n\r\n/**\r\n * @author alteredq / http://alteredqualia.com/\r\n *\r\n *\t- shows frustum, line of sight and up of the camera\r\n *\t- suitable for fast updates\r\n * \t- based on frustum visualization in lightgl.js shadowmap example\r\n *\t\thttp://evanw.github.com/lightgl.js/tests/shadowmap.html\r\n */\r\n\r\nTHREE.CameraHelper = function ( camera ) {\r\n\r\n\tvar geometry = new THREE.Geometry();\r\n\tvar material = new THREE.LineBasicMaterial( { color: 0xffffff, vertexColors: THREE.FaceColors } );\r\n\r\n\tvar pointMap = {};\r\n\r\n\t// colors\r\n\r\n\tvar hexFrustum = 0xffaa00;\r\n\tvar hexCone = 0xff0000;\r\n\tvar hexUp = 0x00aaff;\r\n\tvar hexTarget = 0xffffff;\r\n\tvar hexCross = 0x333333;\r\n\r\n\t// near\r\n\r\n\taddLine( \"n1\", \"n2\", hexFrustum );\r\n\taddLine( \"n2\", \"n4\", hexFrustum );\r\n\taddLine( \"n4\", \"n3\", hexFrustum );\r\n\taddLine( \"n3\", \"n1\", hexFrustum );\r\n\r\n\t// far\r\n\r\n\taddLine( \"f1\", \"f2\", hexFrustum );\r\n\taddLine( \"f2\", \"f4\", hexFrustum );\r\n\taddLine( \"f4\", \"f3\", hexFrustum );\r\n\taddLine( \"f3\", \"f1\", hexFrustum );\r\n\r\n\t// sides\r\n\r\n\taddLine( \"n1\", \"f1\", hexFrustum );\r\n\taddLine( \"n2\", \"f2\", hexFrustum );\r\n\taddLine( \"n3\", \"f3\", hexFrustum );\r\n\taddLine( \"n4\", \"f4\", hexFrustum );\r\n\r\n\t// cone\r\n\r\n\taddLine( \"p\", \"n1\", hexCone );\r\n\taddLine( \"p\", \"n2\", hexCone );\r\n\taddLine( \"p\", \"n3\", hexCone );\r\n\taddLine( \"p\", \"n4\", hexCone );\r\n\r\n\t// up\r\n\r\n\taddLine( \"u1\", \"u2\", hexUp );\r\n\taddLine( \"u2\", \"u3\", hexUp );\r\n\taddLine( \"u3\", \"u1\", hexUp );\r\n\r\n\t// target\r\n\r\n\taddLine( \"c\", \"t\", hexTarget );\r\n\taddLine( \"p\", \"c\", hexCross );\r\n\r\n\t// cross\r\n\r\n\taddLine( \"cn1\", \"cn2\", hexCross );\r\n\taddLine( \"cn3\", \"cn4\", hexCross );\r\n\r\n\taddLine( \"cf1\", \"cf2\", hexCross );\r\n\taddLine( \"cf3\", \"cf4\", hexCross );\r\n\r\n\tfunction addLine( a, b, hex ) {\r\n\r\n\t\taddPoint( a, hex );\r\n\t\taddPoint( b, hex );\r\n\r\n\t}\r\n\r\n\tfunction addPoint( id, hex ) {\r\n\r\n\t\tgeometry.vertices.push( new THREE.Vector3() );\r\n\t\tgeometry.colors.push( new THREE.Color( hex ) );\r\n\r\n\t\tif ( pointMap[ id ] === undefined ) {\r\n\r\n\t\t\tpointMap[ id ] = [];\r\n\r\n\t\t}\r\n\r\n\t\tpointMap[ id ].push( geometry.vertices.length - 1 );\r\n\r\n\t}\r\n\r\n\tTHREE.Line.call( this, geometry, material, THREE.LinePieces );\r\n\r\n\tthis.camera = camera;\r\n\tthis.matrix = camera.matrixWorld;\r\n\tthis.matrixAutoUpdate = false;\r\n\r\n\tthis.pointMap = pointMap;\r\n\r\n\tthis.update();\r\n\r\n};\r\n\r\nTHREE.CameraHelper.prototype = Object.create( THREE.Line.prototype );\r\nTHREE.CameraHelper.prototype.constructor = THREE.CameraHelper;\r\n\r\nTHREE.CameraHelper.prototype.update = function () {\r\n\r\n\tvar geometry, pointMap;\r\n\t\r\n\tvar vector = new THREE.Vector3();\r\n\tvar camera = new THREE.Camera();\r\n\r\n\tvar setPoint = function ( point, x, y, z ) {\r\n\r\n\t\tvector.set( x, y, z ).unproject( camera );\r\n\r\n\t\tvar points = pointMap[ point ];\r\n\r\n\t\tif ( points !== undefined ) {\r\n\r\n\t\t\tfor ( var i = 0, il = points.length; i < il; i ++ ) {\r\n\r\n\t\t\t\tgeometry.vertices[ points[ i ] ].copy( vector );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t};\r\n\r\n\treturn function () {\r\n\r\n\t\tgeometry = this.geometry;\r\n\t\tpointMap = this.pointMap;\r\n\r\n\t\tvar w = 1, h = 1;\r\n\r\n\t\t// we need just camera projection matrix\r\n\t\t// world matrix must be identity\r\n\r\n\t\tcamera.projectionMatrix.copy( this.camera.projectionMatrix );\r\n\r\n\t\t// center / target\r\n\r\n\t\tsetPoint( \"c\", 0, 0, - 1 );\r\n\t\tsetPoint( \"t\", 0, 0, 1 );\r\n\r\n\t\t// near\r\n\r\n\t\tsetPoint( \"n1\", - w, - h, - 1 );\r\n\t\tsetPoint( \"n2\", w, - h, - 1 );\r\n\t\tsetPoint( \"n3\", - w, h, - 1 );\r\n\t\tsetPoint( \"n4\", w, h, - 1 );\r\n\r\n\t\t// far\r\n\r\n\t\tsetPoint( \"f1\", - w, - h, 1 );\r\n\t\tsetPoint( \"f2\", w, - h, 1 );\r\n\t\tsetPoint( \"f3\", - w, h, 1 );\r\n\t\tsetPoint( \"f4\", w, h, 1 );\r\n\r\n\t\t// up\r\n\r\n\t\tsetPoint( \"u1\", w * 0.7, h * 1.1, - 1 );\r\n\t\tsetPoint( \"u2\", - w * 0.7, h * 1.1, - 1 );\r\n\t\tsetPoint( \"u3\", 0, h * 2, - 1 );\r\n\r\n\t\t// cross\r\n\r\n\t\tsetPoint( \"cf1\", - w, 0, 1 );\r\n\t\tsetPoint( \"cf2\", w, 0, 1 );\r\n\t\tsetPoint( \"cf3\", 0, - h, 1 );\r\n\t\tsetPoint( \"cf4\", 0, h, 1 );\r\n\r\n\t\tsetPoint( \"cn1\", - w, 0, - 1 );\r\n\t\tsetPoint( \"cn2\", w, 0, - 1 );\r\n\t\tsetPoint( \"cn3\", 0, - h, - 1 );\r\n\t\tsetPoint( \"cn4\", 0, h, - 1 );\r\n\r\n\t\tgeometry.verticesNeedUpdate = true;\r\n\r\n\t};\r\n\r\n}();\r\n\r\n// File:src/extras/helpers/DirectionalLightHelper.js\r\n\r\n/**\r\n * @author alteredq / http://alteredqualia.com/\r\n * @author mrdoob / http://mrdoob.com/\r\n * @author WestLangley / http://github.com/WestLangley\r\n */\r\n\r\nTHREE.DirectionalLightHelper = function ( light, size ) {\r\n\r\n\tTHREE.Object3D.call( this );\r\n\r\n\tthis.light = light;\r\n\tthis.light.updateMatrixWorld();\r\n\r\n\tthis.matrix = light.matrixWorld;\r\n\tthis.matrixAutoUpdate = false;\r\n\r\n\tsize = size || 1;\r\n\r\n\tvar geometry = new THREE.Geometry();\r\n\tgeometry.vertices.push(\r\n\t\tnew THREE.Vector3( - size, size, 0 ),\r\n\t\tnew THREE.Vector3( size, size, 0 ),\r\n\t\tnew THREE.Vector3( size, - size, 0 ),\r\n\t\tnew THREE.Vector3( - size, - size, 0 ),\r\n\t\tnew THREE.Vector3( - size, size, 0 )\r\n\t);\r\n\r\n\tvar material = new THREE.LineBasicMaterial( { fog: false } );\r\n\tmaterial.color.copy( this.light.color ).multiplyScalar( this.light.intensity );\r\n\r\n\tthis.lightPlane = new THREE.Line( geometry, material );\r\n\tthis.add( this.lightPlane );\r\n\r\n\tgeometry = new THREE.Geometry();\r\n\tgeometry.vertices.push(\r\n\t\tnew THREE.Vector3(),\r\n\t\tnew THREE.Vector3()\r\n\t);\r\n\r\n\tmaterial = new THREE.LineBasicMaterial( { fog: false } );\r\n\tmaterial.color.copy( this.light.color ).multiplyScalar( this.light.intensity );\r\n\r\n\tthis.targetLine = new THREE.Line( geometry, material );\r\n\tthis.add( this.targetLine );\r\n\r\n\tthis.update();\r\n\r\n};\r\n\r\nTHREE.DirectionalLightHelper.prototype = Object.create( THREE.Object3D.prototype );\r\nTHREE.DirectionalLightHelper.prototype.constructor = THREE.DirectionalLightHelper;\r\n\r\nTHREE.DirectionalLightHelper.prototype.dispose = function () {\r\n\r\n\tthis.lightPlane.geometry.dispose();\r\n\tthis.lightPlane.material.dispose();\r\n\tthis.targetLine.geometry.dispose();\r\n\tthis.targetLine.material.dispose();\r\n};\r\n\r\nTHREE.DirectionalLightHelper.prototype.update = function () {\r\n\r\n\tvar v1 = new THREE.Vector3();\r\n\tvar v2 = new THREE.Vector3();\r\n\tvar v3 = new THREE.Vector3();\r\n\r\n\treturn function () {\r\n\r\n\t\tv1.setFromMatrixPosition( this.light.matrixWorld );\r\n\t\tv2.setFromMatrixPosition( this.light.target.matrixWorld );\r\n\t\tv3.subVectors( v2, v1 );\r\n\r\n\t\tthis.lightPlane.lookAt( v3 );\r\n\t\tthis.lightPlane.material.color.copy( this.light.color ).multiplyScalar( this.light.intensity );\r\n\r\n\t\tthis.targetLine.geometry.vertices[ 1 ].copy( v3 );\r\n\t\tthis.targetLine.geometry.verticesNeedUpdate = true;\r\n\t\tthis.targetLine.material.color.copy( this.lightPlane.material.color );\r\n\r\n\t};\r\n\r\n}();\r\n\r\n// File:src/extras/helpers/EdgesHelper.js\r\n\r\n/**\r\n * @author WestLangley / http://github.com/WestLangley\r\n * @param object THREE.Mesh whose geometry will be used\r\n * @param hex line color\r\n * @param thresholdAngle the minimim angle (in degrees),\r\n * between the face normals of adjacent faces,\r\n * that is required to render an edge. A value of 10 means\r\n * an edge is only rendered if the angle is at least 10 degrees.\r\n */\r\n\r\nTHREE.EdgesHelper = function ( object, hex, thresholdAngle ) {\r\n\r\n\tvar color = ( hex !== undefined ) ? hex : 0xffffff;\r\n\tthresholdAngle = ( thresholdAngle !== undefined ) ? thresholdAngle : 1;\r\n\r\n\tvar thresholdDot = Math.cos( THREE.Math.degToRad( thresholdAngle ) );\r\n\r\n\tvar edge = [ 0, 0 ], hash = {};\r\n\tvar sortFunction = function ( a, b ) { return a - b };\r\n\r\n\tvar keys = [ 'a', 'b', 'c' ];\r\n\tvar geometry = new THREE.BufferGeometry();\r\n\r\n\tvar geometry2;\r\n\r\n\tif ( object.geometry instanceof THREE.BufferGeometry ) {\r\n\r\n\t\tgeometry2 = new THREE.Geometry();\r\n\t\tgeometry2.fromBufferGeometry( object.geometry );\r\n\r\n\t} else {\r\n\r\n\t\tgeometry2 = object.geometry.clone();\r\n\r\n\t}\r\n\r\n\tgeometry2.mergeVertices();\r\n\tgeometry2.computeFaceNormals();\r\n\r\n\tvar vertices = geometry2.vertices;\r\n\tvar faces = geometry2.faces;\r\n\tvar numEdges = 0;\r\n\r\n\tfor ( var i = 0, l = faces.length; i < l; i ++ ) {\r\n\r\n\t\tvar face = faces[ i ];\r\n\r\n\t\tfor ( var j = 0; j < 3; j ++ ) {\r\n\r\n\t\t\tedge[ 0 ] = face[ keys[ j ] ];\r\n\t\t\tedge[ 1 ] = face[ keys[ ( j + 1 ) % 3 ] ];\r\n\t\t\tedge.sort( sortFunction );\r\n\r\n\t\t\tvar key = edge.toString();\r\n\r\n\t\t\tif ( hash[ key ] === undefined ) {\r\n\r\n\t\t\t\thash[ key ] = { vert1: edge[ 0 ], vert2: edge[ 1 ], face1: i, face2: undefined };\r\n\t\t\t\tnumEdges ++;\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\thash[ key ].face2 = i;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tvar coords = new Float32Array( numEdges * 2 * 3 );\r\n\r\n\tvar index = 0;\r\n\r\n\tfor ( var key in hash ) {\r\n\r\n\t\tvar h = hash[ key ];\r\n\r\n\t\tif ( h.face2 === undefined || faces[ h.face1 ].normal.dot( faces[ h.face2 ].normal ) <= thresholdDot ) {\r\n\r\n\t\t\tvar vertex = vertices[ h.vert1 ];\r\n\t\t\tcoords[ index ++ ] = vertex.x;\r\n\t\t\tcoords[ index ++ ] = vertex.y;\r\n\t\t\tcoords[ index ++ ] = vertex.z;\r\n\r\n\t\t\tvertex = vertices[ h.vert2 ];\r\n\t\t\tcoords[ index ++ ] = vertex.x;\r\n\t\t\tcoords[ index ++ ] = vertex.y;\r\n\t\t\tcoords[ index ++ ] = vertex.z;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tgeometry.addAttribute( 'position', new THREE.BufferAttribute( coords, 3 ) );\r\n\r\n\tTHREE.Line.call( this, geometry, new THREE.LineBasicMaterial( { color: color } ), THREE.LinePieces );\r\n\r\n\tthis.matrix = object.matrixWorld;\r\n\tthis.matrixAutoUpdate = false;\r\n\r\n};\r\n\r\nTHREE.EdgesHelper.prototype = Object.create( THREE.Line.prototype );\r\nTHREE.EdgesHelper.prototype.constructor = THREE.EdgesHelper;\r\n\r\n// File:src/extras/helpers/FaceNormalsHelper.js\r\n\r\n/**\r\n * @author mrdoob / http://mrdoob.com/\r\n * @author WestLangley / http://github.com/WestLangley\r\n*/\r\n\r\nTHREE.FaceNormalsHelper = function ( object, size, hex, linewidth ) {\r\n\r\n\tthis.object = object;\r\n\r\n\tthis.size = ( size !== undefined ) ? size : 1;\r\n\r\n\tvar color = ( hex !== undefined ) ? hex : 0xffff00;\r\n\r\n\tvar width = ( linewidth !== undefined ) ? linewidth : 1;\r\n\r\n\tvar geometry = new THREE.Geometry();\r\n\r\n\tvar faces = this.object.geometry.faces;\r\n\r\n\tfor ( var i = 0, l = faces.length; i < l; i ++ ) {\r\n\r\n\t\tgeometry.vertices.push( new THREE.Vector3(), new THREE.Vector3() );\r\n\r\n\t}\r\n\r\n\tTHREE.Line.call( this, geometry, new THREE.LineBasicMaterial( { color: color, linewidth: width } ), THREE.LinePieces );\r\n\r\n\tthis.matrixAutoUpdate = false;\r\n\r\n\tthis.normalMatrix = new THREE.Matrix3();\r\n\r\n\tthis.update();\r\n\r\n};\r\n\r\nTHREE.FaceNormalsHelper.prototype = Object.create( THREE.Line.prototype );\r\nTHREE.FaceNormalsHelper.prototype.constructor = THREE.FaceNormalsHelper;\r\n\r\nTHREE.FaceNormalsHelper.prototype.update = function () {\r\n\r\n\tvar vertices = this.geometry.vertices;\r\n\r\n\tvar object = this.object;\r\n\tvar objectVertices = object.geometry.vertices;\r\n\tvar objectFaces = object.geometry.faces;\r\n\tvar objectWorldMatrix = object.matrixWorld;\r\n\r\n\tobject.updateMatrixWorld( true );\r\n\r\n\tthis.normalMatrix.getNormalMatrix( objectWorldMatrix );\r\n\r\n\tfor ( var i = 0, i2 = 0, l = objectFaces.length; i < l; i ++, i2 += 2 ) {\r\n\r\n\t\tvar face = objectFaces[ i ];\r\n\r\n\t\tvertices[ i2 ].copy( objectVertices[ face.a ] )\r\n\t\t\t.add( objectVertices[ face.b ] )\r\n\t\t\t.add( objectVertices[ face.c ] )\r\n\t\t\t.divideScalar( 3 )\r\n\t\t\t.applyMatrix4( objectWorldMatrix );\r\n\r\n\t\tvertices[ i2 + 1 ].copy( face.normal )\r\n\t\t\t.applyMatrix3( this.normalMatrix )\r\n\t\t\t.normalize()\r\n\t\t\t.multiplyScalar( this.size )\r\n\t\t\t.add( vertices[ i2 ] );\r\n\r\n\t}\r\n\r\n\tthis.geometry.verticesNeedUpdate = true;\r\n\r\n\treturn this;\r\n\r\n};\r\n\r\n\r\n// File:src/extras/helpers/GridHelper.js\r\n\r\n/**\r\n * @author mrdoob / http://mrdoob.com/\r\n */\r\n\r\nTHREE.GridHelper = function ( size, step ) {\r\n\r\n\tvar geometry = new THREE.Geometry();\r\n\tvar material = new THREE.LineBasicMaterial( { vertexColors: THREE.VertexColors } );\r\n\r\n\tthis.color1 = new THREE.Color( 0x444444 );\r\n\tthis.color2 = new THREE.Color( 0x888888 );\r\n\r\n\tfor ( var i = - size; i <= size; i += step ) {\r\n\r\n\t\tgeometry.vertices.push(\r\n\t\t\tnew THREE.Vector3( - size, 0, i ), new THREE.Vector3( size, 0, i ),\r\n\t\t\tnew THREE.Vector3( i, 0, - size ), new THREE.Vector3( i, 0, size )\r\n\t\t);\r\n\r\n\t\tvar color = i === 0 ? this.color1 : this.color2;\r\n\r\n\t\tgeometry.colors.push( color, color, color, color );\r\n\r\n\t}\r\n\r\n\tTHREE.Line.call( this, geometry, material, THREE.LinePieces );\r\n\r\n};\r\n\r\nTHREE.GridHelper.prototype = Object.create( THREE.Line.prototype );\r\nTHREE.GridHelper.prototype.constructor = THREE.GridHelper;\r\n\r\nTHREE.GridHelper.prototype.setColors = function( colorCenterLine, colorGrid ) {\r\n\r\n\tthis.color1.set( colorCenterLine );\r\n\tthis.color2.set( colorGrid );\r\n\r\n\tthis.geometry.colorsNeedUpdate = true;\r\n\r\n}\r\n\r\n// File:src/extras/helpers/HemisphereLightHelper.js\r\n\r\n/**\r\n * @author alteredq / http://alteredqualia.com/\r\n * @author mrdoob / http://mrdoob.com/\r\n */\r\n\r\nTHREE.HemisphereLightHelper = function ( light, sphereSize ) {\r\n\r\n\tTHREE.Object3D.call( this );\r\n\r\n\tthis.light = light;\r\n\tthis.light.updateMatrixWorld();\r\n\r\n\tthis.matrix = light.matrixWorld;\r\n\tthis.matrixAutoUpdate = false;\r\n\r\n\tthis.colors = [ new THREE.Color(), new THREE.Color() ];\r\n\r\n\tvar geometry = new THREE.SphereGeometry( sphereSize, 4, 2 );\r\n\tgeometry.applyMatrix( new THREE.Matrix4().makeRotationX( - Math.PI / 2 ) );\r\n\r\n\tfor ( var i = 0, il = 8; i < il; i ++ ) {\r\n\r\n\t\tgeometry.faces[ i ].color = this.colors[ i < 4 ? 0 : 1 ];\r\n\r\n\t}\r\n\r\n\tvar material = new THREE.MeshBasicMaterial( { vertexColors: THREE.FaceColors, wireframe: true } );\r\n\r\n\tthis.lightSphere = new THREE.Mesh( geometry, material );\r\n\tthis.add( this.lightSphere );\r\n\r\n\tthis.update();\r\n\r\n};\r\n\r\nTHREE.HemisphereLightHelper.prototype = Object.create( THREE.Object3D.prototype );\r\nTHREE.HemisphereLightHelper.prototype.constructor = THREE.HemisphereLightHelper;\r\n\r\nTHREE.HemisphereLightHelper.prototype.dispose = function () {\r\n\tthis.lightSphere.geometry.dispose();\r\n\tthis.lightSphere.material.dispose();\r\n};\r\n\r\nTHREE.HemisphereLightHelper.prototype.update = function () {\r\n\r\n\tvar vector = new THREE.Vector3();\r\n\r\n\treturn function () {\r\n\r\n\t\tthis.colors[ 0 ].copy( this.light.color ).multiplyScalar( this.light.intensity );\r\n\t\tthis.colors[ 1 ].copy( this.light.groundColor ).multiplyScalar( this.light.intensity );\r\n\r\n\t\tthis.lightSphere.lookAt( vector.setFromMatrixPosition( this.light.matrixWorld ).negate() );\r\n\t\tthis.lightSphere.geometry.colorsNeedUpdate = true;\r\n\r\n\t}\r\n\r\n}();\r\n\r\n// File:src/extras/helpers/PointLightHelper.js\r\n\r\n/**\r\n * @author alteredq / http://alteredqualia.com/\r\n * @author mrdoob / http://mrdoob.com/\r\n */\r\n\r\nTHREE.PointLightHelper = function ( light, sphereSize ) {\r\n\r\n\tthis.light = light;\r\n\tthis.light.updateMatrixWorld();\r\n\r\n\tvar geometry = new THREE.SphereGeometry( sphereSize, 4, 2 );\r\n\tvar material = new THREE.MeshBasicMaterial( { wireframe: true, fog: false } );\r\n\tmaterial.color.copy( this.light.color ).multiplyScalar( this.light.intensity );\r\n\r\n\tTHREE.Mesh.call( this, geometry, material );\r\n\r\n\tthis.matrix = this.light.matrixWorld;\r\n\tthis.matrixAutoUpdate = false;\r\n\r\n\t/*\r\n\tvar distanceGeometry = new THREE.IcosahedronGeometry( 1, 2 );\r\n\tvar distanceMaterial = new THREE.MeshBasicMaterial( { color: hexColor, fog: false, wireframe: true, opacity: 0.1, transparent: true } );\r\n\r\n\tthis.lightSphere = new THREE.Mesh( bulbGeometry, bulbMaterial );\r\n\tthis.lightDistance = new THREE.Mesh( distanceGeometry, distanceMaterial );\r\n\r\n\tvar d = light.distance;\r\n\r\n\tif ( d === 0.0 ) {\r\n\r\n\t\tthis.lightDistance.visible = false;\r\n\r\n\t} else {\r\n\r\n\t\tthis.lightDistance.scale.set( d, d, d );\r\n\r\n\t}\r\n\r\n\tthis.add( this.lightDistance );\r\n\t*/\r\n\r\n};\r\n\r\nTHREE.PointLightHelper.prototype = Object.create( THREE.Mesh.prototype );\r\nTHREE.PointLightHelper.prototype.constructor = THREE.PointLightHelper;\r\n\r\nTHREE.PointLightHelper.prototype.dispose = function () {\r\n\r\n\tthis.geometry.dispose();\r\n\tthis.material.dispose();\r\n};\r\n\r\nTHREE.PointLightHelper.prototype.update = function () {\r\n\r\n\tthis.material.color.copy( this.light.color ).multiplyScalar( this.light.intensity );\r\n\r\n\t/*\r\n\tvar d = this.light.distance;\r\n\r\n\tif ( d === 0.0 ) {\r\n\r\n\t\tthis.lightDistance.visible = false;\r\n\r\n\t} else {\r\n\r\n\t\tthis.lightDistance.visible = true;\r\n\t\tthis.lightDistance.scale.set( d, d, d );\r\n\r\n\t}\r\n\t*/\r\n\r\n};\r\n\r\n// File:src/extras/helpers/SkeletonHelper.js\r\n\r\n/**\r\n * @author Sean Griffin / http://twitter.com/sgrif\r\n * @author Michael Guerrero / http://realitymeltdown.com\r\n * @author mrdoob / http://mrdoob.com/\r\n * @author ikerr / http://verold.com\r\n */\r\n\r\nTHREE.SkeletonHelper = function ( object ) {\r\n\r\n\tthis.bones = this.getBoneList( object );\r\n\r\n\tvar geometry = new THREE.Geometry();\r\n\r\n\tfor ( var i = 0; i < this.bones.length; i ++ ) {\r\n\r\n\t\tvar bone = this.bones[ i ];\r\n\r\n\t\tif ( bone.parent instanceof THREE.Bone ) {\r\n\r\n\t\t\tgeometry.vertices.push( new THREE.Vector3() );\r\n\t\t\tgeometry.vertices.push( new THREE.Vector3() );\r\n\t\t\tgeometry.colors.push( new THREE.Color( 0, 0, 1 ) );\r\n\t\t\tgeometry.colors.push( new THREE.Color( 0, 1, 0 ) );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tvar material = new THREE.LineBasicMaterial( { vertexColors: THREE.VertexColors, depthTest: false, depthWrite: false, transparent: true } );\r\n\r\n\tTHREE.Line.call( this, geometry, material, THREE.LinePieces );\r\n\r\n\tthis.root = object;\r\n\r\n\tthis.matrix = object.matrixWorld;\r\n\tthis.matrixAutoUpdate = false;\r\n\r\n\tthis.update();\r\n\r\n};\r\n\r\n\r\nTHREE.SkeletonHelper.prototype = Object.create( THREE.Line.prototype );\r\nTHREE.SkeletonHelper.prototype.constructor = THREE.SkeletonHelper;\r\n\r\nTHREE.SkeletonHelper.prototype.getBoneList = function( object ) {\r\n\r\n\tvar boneList = [];\r\n\r\n\tif ( object instanceof THREE.Bone ) {\r\n\r\n\t\tboneList.push( object );\r\n\r\n\t}\r\n\r\n\tfor ( var i = 0; i < object.children.length; i ++ ) {\r\n\r\n\t\tboneList.push.apply( boneList, this.getBoneList( object.children[ i ] ) );\r\n\r\n\t}\r\n\r\n\treturn boneList;\r\n\r\n};\r\n\r\nTHREE.SkeletonHelper.prototype.update = function () {\r\n\r\n\tvar geometry = this.geometry;\r\n\r\n\tvar matrixWorldInv = new THREE.Matrix4().getInverse( this.root.matrixWorld );\r\n\r\n\tvar boneMatrix = new THREE.Matrix4();\r\n\r\n\tvar j = 0;\r\n\r\n\tfor ( var i = 0; i < this.bones.length; i ++ ) {\r\n\r\n\t\tvar bone = this.bones[ i ];\r\n\r\n\t\tif ( bone.parent instanceof THREE.Bone ) {\r\n\r\n\t\t\tboneMatrix.multiplyMatrices( matrixWorldInv, bone.matrixWorld );\r\n\t\t\tgeometry.vertices[ j ].setFromMatrixPosition( boneMatrix );\r\n\r\n\t\t\tboneMatrix.multiplyMatrices( matrixWorldInv, bone.parent.matrixWorld );\r\n\t\t\tgeometry.vertices[ j + 1 ].setFromMatrixPosition( boneMatrix );\r\n\r\n\t\t\tj += 2;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tgeometry.verticesNeedUpdate = true;\r\n\r\n\tgeometry.computeBoundingSphere();\r\n\r\n};\r\n\r\n// File:src/extras/helpers/SpotLightHelper.js\r\n\r\n/**\r\n * @author alteredq / http://alteredqualia.com/\r\n * @author mrdoob / http://mrdoob.com/\r\n * @author WestLangley / http://github.com/WestLangley\r\n*/\r\n\r\nTHREE.SpotLightHelper = function ( light ) {\r\n\r\n\tTHREE.Object3D.call( this );\r\n\r\n\tthis.light = light;\r\n\tthis.light.updateMatrixWorld();\r\n\r\n\tthis.matrix = light.matrixWorld;\r\n\tthis.matrixAutoUpdate = false;\r\n\r\n\tvar geometry = new THREE.CylinderGeometry( 0, 1, 1, 8, 1, true );\r\n\r\n\tgeometry.applyMatrix( new THREE.Matrix4().makeTranslation( 0, - 0.5, 0 ) );\r\n\tgeometry.applyMatrix( new THREE.Matrix4().makeRotationX( - Math.PI / 2 ) );\r\n\r\n\tvar material = new THREE.MeshBasicMaterial( { wireframe: true, fog: false } );\r\n\r\n\tthis.cone = new THREE.Mesh( geometry, material );\r\n\tthis.add( this.cone );\r\n\r\n\tthis.update();\r\n\r\n};\r\n\r\nTHREE.SpotLightHelper.prototype = Object.create( THREE.Object3D.prototype );\r\nTHREE.SpotLightHelper.prototype.constructor = THREE.SpotLightHelper;\r\n\r\nTHREE.SpotLightHelper.prototype.dispose = function () {\r\n\tthis.cone.geometry.dispose();\r\n\tthis.cone.material.dispose();\r\n};\r\n\r\nTHREE.SpotLightHelper.prototype.update = function () {\r\n\r\n\tvar vector = new THREE.Vector3();\r\n\tvar vector2 = new THREE.Vector3();\r\n\r\n\treturn function () {\r\n\r\n\t\tvar coneLength = this.light.distance ? this.light.distance : 10000;\r\n\t\tvar coneWidth = coneLength * Math.tan( this.light.angle );\r\n\r\n\t\tthis.cone.scale.set( coneWidth, coneWidth, coneLength );\r\n\r\n\t\tvector.setFromMatrixPosition( this.light.matrixWorld );\r\n\t\tvector2.setFromMatrixPosition( this.light.target.matrixWorld );\r\n\r\n\t\tthis.cone.lookAt( vector2.sub( vector ) );\r\n\r\n\t\tthis.cone.material.color.copy( this.light.color ).multiplyScalar( this.light.intensity );\r\n\r\n\t};\r\n\r\n}();\r\n\r\n// File:src/extras/helpers/VertexNormalsHelper.js\r\n\r\n/**\r\n * @author mrdoob / http://mrdoob.com/\r\n * @author WestLangley / http://github.com/WestLangley\r\n*/\r\n\r\nTHREE.VertexNormalsHelper = function ( object, size, hex, linewidth ) {\r\n\r\n\tthis.object = object;\r\n\r\n\tthis.size = ( size !== undefined ) ? size : 1;\r\n\r\n\tvar color = ( hex !== undefined ) ? hex : 0xff0000;\r\n\r\n\tvar width = ( linewidth !== undefined ) ? linewidth : 1;\r\n\r\n\tvar geometry = new THREE.Geometry();\r\n\r\n\tvar faces = object.geometry.faces;\r\n\r\n\tfor ( var i = 0, l = faces.length; i < l; i ++ ) {\r\n\r\n\t\tvar face = faces[ i ];\r\n\r\n\t\tfor ( var j = 0, jl = face.vertexNormals.length; j < jl; j ++ ) {\r\n\r\n\t\t\tgeometry.vertices.push( new THREE.Vector3(), new THREE.Vector3() );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tTHREE.Line.call( this, geometry, new THREE.LineBasicMaterial( { color: color, linewidth: width } ), THREE.LinePieces );\r\n\r\n\tthis.matrixAutoUpdate = false;\r\n\r\n\tthis.normalMatrix = new THREE.Matrix3();\r\n\r\n\tthis.update();\r\n\r\n};\r\n\r\nTHREE.VertexNormalsHelper.prototype = Object.create( THREE.Line.prototype );\r\nTHREE.VertexNormalsHelper.prototype.constructor = THREE.VertexNormalsHelper;\r\n\r\nTHREE.VertexNormalsHelper.prototype.update = ( function ( object ) {\r\n\r\n\tvar v1 = new THREE.Vector3();\r\n\r\n\treturn function( object ) {\r\n\r\n\t\tvar keys = [ 'a', 'b', 'c', 'd' ];\r\n\r\n\t\tthis.object.updateMatrixWorld( true );\r\n\r\n\t\tthis.normalMatrix.getNormalMatrix( this.object.matrixWorld );\r\n\r\n\t\tvar vertices = this.geometry.vertices;\r\n\r\n\t\tvar verts = this.object.geometry.vertices;\r\n\r\n\t\tvar faces = this.object.geometry.faces;\r\n\r\n\t\tvar worldMatrix = this.object.matrixWorld;\r\n\r\n\t\tvar idx = 0;\r\n\r\n\t\tfor ( var i = 0, l = faces.length; i < l; i ++ ) {\r\n\r\n\t\t\tvar face = faces[ i ];\r\n\r\n\t\t\tfor ( var j = 0, jl = face.vertexNormals.length; j < jl; j ++ ) {\r\n\r\n\t\t\t\tvar vertexId = face[ keys[ j ] ];\r\n\t\t\t\tvar vertex = verts[ vertexId ];\r\n\r\n\t\t\t\tvar normal = face.vertexNormals[ j ];\r\n\r\n\t\t\t\tvertices[ idx ].copy( vertex ).applyMatrix4( worldMatrix );\r\n\r\n\t\t\t\tv1.copy( normal ).applyMatrix3( this.normalMatrix ).normalize().multiplyScalar( this.size );\r\n\r\n\t\t\t\tv1.add( vertices[ idx ] );\r\n\t\t\t\tidx = idx + 1;\r\n\r\n\t\t\t\tvertices[ idx ].copy( v1 );\r\n\t\t\t\tidx = idx + 1;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tthis.geometry.verticesNeedUpdate = true;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n}());\r\n\r\n// File:src/extras/helpers/VertexTangentsHelper.js\r\n\r\n/**\r\n * @author mrdoob / http://mrdoob.com/\r\n * @author WestLangley / http://github.com/WestLangley\r\n*/\r\n\r\nTHREE.VertexTangentsHelper = function ( object, size, hex, linewidth ) {\r\n\r\n\tthis.object = object;\r\n\r\n\tthis.size = ( size !== undefined ) ? size : 1;\r\n\r\n\tvar color = ( hex !== undefined ) ? hex : 0x0000ff;\r\n\r\n\tvar width = ( linewidth !== undefined ) ? linewidth : 1;\r\n\r\n\tvar geometry = new THREE.Geometry();\r\n\r\n\tvar faces = object.geometry.faces;\r\n\r\n\tfor ( var i = 0, l = faces.length; i < l; i ++ ) {\r\n\r\n\t\tvar face = faces[ i ];\r\n\r\n\t\tfor ( var j = 0, jl = face.vertexTangents.length; j < jl; j ++ ) {\r\n\r\n\t\t\tgeometry.vertices.push( new THREE.Vector3() );\r\n\t\t\tgeometry.vertices.push( new THREE.Vector3() );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tTHREE.Line.call( this, geometry, new THREE.LineBasicMaterial( { color: color, linewidth: width } ), THREE.LinePieces );\r\n\r\n\tthis.matrixAutoUpdate = false;\r\n\r\n\tthis.update();\r\n\r\n};\r\n\r\nTHREE.VertexTangentsHelper.prototype = Object.create( THREE.Line.prototype );\r\nTHREE.VertexTangentsHelper.prototype.constructor = THREE.VertexTangentsHelper;\r\n\r\nTHREE.VertexTangentsHelper.prototype.update = ( function ( object ) {\r\n\r\n\tvar v1 = new THREE.Vector3();\r\n\r\n\treturn function( object ) {\r\n\r\n\t\tvar keys = [ 'a', 'b', 'c', 'd' ];\r\n\r\n\t\tthis.object.updateMatrixWorld( true );\r\n\r\n\t\tvar vertices = this.geometry.vertices;\r\n\r\n\t\tvar verts = this.object.geometry.vertices;\r\n\r\n\t\tvar faces = this.object.geometry.faces;\r\n\r\n\t\tvar worldMatrix = this.object.matrixWorld;\r\n\r\n\t\tvar idx = 0;\r\n\r\n\t\tfor ( var i = 0, l = faces.length; i < l; i ++ ) {\r\n\r\n\t\t\tvar face = faces[ i ];\r\n\r\n\t\t\tfor ( var j = 0, jl = face.vertexTangents.length; j < jl; j ++ ) {\r\n\r\n\t\t\t\tvar vertexId = face[ keys[ j ] ];\r\n\t\t\t\tvar vertex = verts[ vertexId ];\r\n\r\n\t\t\t\tvar tangent = face.vertexTangents[ j ];\r\n\r\n\t\t\t\tvertices[ idx ].copy( vertex ).applyMatrix4( worldMatrix );\r\n\r\n\t\t\t\tv1.copy( tangent ).transformDirection( worldMatrix ).multiplyScalar( this.size );\r\n\r\n\t\t\t\tv1.add( vertices[ idx ] );\r\n\t\t\t\tidx = idx + 1;\r\n\r\n\t\t\t\tvertices[ idx ].copy( v1 );\r\n\t\t\t\tidx = idx + 1;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tthis.geometry.verticesNeedUpdate = true;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n}());\r\n\r\n// File:src/extras/helpers/WireframeHelper.js\r\n\r\n/**\r\n * @author mrdoob / http://mrdoob.com/\r\n */\r\n\r\nTHREE.WireframeHelper = function ( object, hex ) {\r\n\r\n\tvar color = ( hex !== undefined ) ? hex : 0xffffff;\r\n\r\n\tvar edge = [ 0, 0 ], hash = {};\r\n\tvar sortFunction = function ( a, b ) { return a - b };\r\n\r\n\tvar keys = [ 'a', 'b', 'c' ];\r\n\tvar geometry = new THREE.BufferGeometry();\r\n\r\n\tif ( object.geometry instanceof THREE.Geometry ) {\r\n\r\n\t\tvar vertices = object.geometry.vertices;\r\n\t\tvar faces = object.geometry.faces;\r\n\t\tvar numEdges = 0;\r\n\r\n\t\t// allocate maximal size\r\n\t\tvar edges = new Uint32Array( 6 * faces.length );\r\n\r\n\t\tfor ( var i = 0, l = faces.length; i < l; i ++ ) {\r\n\r\n\t\t\tvar face = faces[ i ];\r\n\r\n\t\t\tfor ( var j = 0; j < 3; j ++ ) {\r\n\r\n\t\t\t\tedge[ 0 ] = face[ keys[ j ] ];\r\n\t\t\t\tedge[ 1 ] = face[ keys[ ( j + 1 ) % 3 ] ];\r\n\t\t\t\tedge.sort( sortFunction );\r\n\r\n\t\t\t\tvar key = edge.toString();\r\n\r\n\t\t\t\tif ( hash[ key ] === undefined ) {\r\n\r\n\t\t\t\t\tedges[ 2 * numEdges ] = edge[ 0 ];\r\n\t\t\t\t\tedges[ 2 * numEdges + 1 ] = edge[ 1 ];\r\n\t\t\t\t\thash[ key ] = true;\r\n\t\t\t\t\tnumEdges ++;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tvar coords = new Float32Array( numEdges * 2 * 3 );\r\n\r\n\t\tfor ( var i = 0, l = numEdges; i < l; i ++ ) {\r\n\r\n\t\t\tfor ( var j = 0; j < 2; j ++ ) {\r\n\r\n\t\t\t\tvar vertex = vertices[ edges [ 2 * i + j] ];\r\n\r\n\t\t\t\tvar index = 6 * i + 3 * j;\r\n\t\t\t\tcoords[ index + 0 ] = vertex.x;\r\n\t\t\t\tcoords[ index + 1 ] = vertex.y;\r\n\t\t\t\tcoords[ index + 2 ] = vertex.z;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tgeometry.addAttribute( 'position', new THREE.BufferAttribute( coords, 3 ) );\r\n\r\n\t} else if ( object.geometry instanceof THREE.BufferGeometry ) {\r\n\r\n\t\tif ( object.geometry.attributes.index !== undefined ) { // Indexed BufferGeometry\r\n\r\n\t\t\tvar vertices = object.geometry.attributes.position.array;\r\n\t\t\tvar indices = object.geometry.attributes.index.array;\r\n\t\t\tvar drawcalls = object.geometry.drawcalls;\r\n\t\t\tvar numEdges = 0;\r\n\r\n\t\t\tif ( drawcalls.length === 0 ) {\r\n\r\n\t\t\t\tdrawcalls = [ { count : indices.length, index : 0, start : 0 } ];\r\n\r\n\t\t\t}\r\n\r\n\t\t\t// allocate maximal size\r\n\t\t\tvar edges = new Uint32Array( 2 * indices.length );\r\n\r\n\t\t\tfor ( var o = 0, ol = drawcalls.length; o < ol; ++ o ) {\r\n\r\n\t\t\t\tvar start = drawcalls[ o ].start;\r\n\t\t\t\tvar count = drawcalls[ o ].count;\r\n\t\t\t\tvar index = drawcalls[ o ].index;\r\n\r\n\t\t\t\tfor ( var i = start, il = start + count; i < il; i += 3 ) {\r\n\r\n\t\t\t\t\tfor ( var j = 0; j < 3; j ++ ) {\r\n\r\n\t\t\t\t\t\tedge[ 0 ] = index + indices[ i + j ];\r\n\t\t\t\t\t\tedge[ 1 ] = index + indices[ i + ( j + 1 ) % 3 ];\r\n\t\t\t\t\t\tedge.sort( sortFunction );\r\n\r\n\t\t\t\t\t\tvar key = edge.toString();\r\n\r\n\t\t\t\t\t\tif ( hash[ key ] === undefined ) {\r\n\r\n\t\t\t\t\t\t\tedges[ 2 * numEdges ] = edge[ 0 ];\r\n\t\t\t\t\t\t\tedges[ 2 * numEdges + 1 ] = edge[ 1 ];\r\n\t\t\t\t\t\t\thash[ key ] = true;\r\n\t\t\t\t\t\t\tnumEdges ++;\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\tvar coords = new Float32Array( numEdges * 2 * 3 );\r\n\r\n\t\t\tfor ( var i = 0, l = numEdges; i < l; i ++ ) {\r\n\r\n\t\t\t\tfor ( var j = 0; j < 2; j ++ ) {\r\n\r\n\t\t\t\t\tvar index = 6 * i + 3 * j;\r\n\t\t\t\t\tvar index2 = 3 * edges[ 2 * i + j];\r\n\t\t\t\t\tcoords[ index + 0 ] = vertices[ index2 ];\r\n\t\t\t\t\tcoords[ index + 1 ] = vertices[ index2 + 1 ];\r\n\t\t\t\t\tcoords[ index + 2 ] = vertices[ index2 + 2 ];\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\tgeometry.addAttribute( 'position', new THREE.BufferAttribute( coords, 3 ) );\r\n\r\n\t\t} else { // non-indexed BufferGeometry\r\n\r\n\t\t\tvar vertices = object.geometry.attributes.position.array;\r\n\t\t\tvar numEdges = vertices.length / 3;\r\n\t\t\tvar numTris = numEdges / 3;\r\n\r\n\t\t\tvar coords = new Float32Array( numEdges * 2 * 3 );\r\n\r\n\t\t\tfor ( var i = 0, l = numTris; i < l; i ++ ) {\r\n\r\n\t\t\t\tfor ( var j = 0; j < 3; j ++ ) {\r\n\r\n\t\t\t\t\tvar index = 18 * i + 6 * j;\r\n\r\n\t\t\t\t\tvar index1 = 9 * i + 3 * j;\r\n\t\t\t\t\tcoords[ index + 0 ] = vertices[ index1 ];\r\n\t\t\t\t\tcoords[ index + 1 ] = vertices[ index1 + 1 ];\r\n\t\t\t\t\tcoords[ index + 2 ] = vertices[ index1 + 2 ];\r\n\r\n\t\t\t\t\tvar index2 = 9 * i + 3 * ( ( j + 1 ) % 3 );\r\n\t\t\t\t\tcoords[ index + 3 ] = vertices[ index2 ];\r\n\t\t\t\t\tcoords[ index + 4 ] = vertices[ index2 + 1 ];\r\n\t\t\t\t\tcoords[ index + 5 ] = vertices[ index2 + 2 ];\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\tgeometry.addAttribute( 'position', new THREE.BufferAttribute( coords, 3 ) );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tTHREE.Line.call( this, geometry, new THREE.LineBasicMaterial( { color: color } ), THREE.LinePieces );\r\n\r\n\tthis.matrix = object.matrixWorld;\r\n\tthis.matrixAutoUpdate = false;\r\n\r\n};\r\n\r\nTHREE.WireframeHelper.prototype = Object.create( THREE.Line.prototype );\r\nTHREE.WireframeHelper.prototype.constructor = THREE.WireframeHelper;\r\n\r\n// File:src/extras/objects/ImmediateRenderObject.js\r\n\r\n/**\r\n * @author alteredq / http://alteredqualia.com/\r\n */\r\n\r\nTHREE.ImmediateRenderObject = function () {\r\n\r\n\tTHREE.Object3D.call( this );\r\n\r\n\tthis.render = function ( renderCallback ) {};\r\n\r\n};\r\n\r\nTHREE.ImmediateRenderObject.prototype = Object.create( THREE.Object3D.prototype );\r\nTHREE.ImmediateRenderObject.prototype.constructor = THREE.ImmediateRenderObject;\r\n\r\n// File:src/extras/objects/MorphBlendMesh.js\r\n\r\n/**\r\n * @author alteredq / http://alteredqualia.com/\r\n */\r\n\r\nTHREE.MorphBlendMesh = function( geometry, material ) {\r\n\r\n\tTHREE.Mesh.call( this, geometry, material );\r\n\r\n\tthis.animationsMap = {};\r\n\tthis.animationsList = [];\r\n\r\n\t// prepare default animation\r\n\t// (all frames played together in 1 second)\r\n\r\n\tvar numFrames = this.geometry.morphTargets.length;\r\n\r\n\tvar name = \"__default\";\r\n\r\n\tvar startFrame = 0;\r\n\tvar endFrame = numFrames - 1;\r\n\r\n\tvar fps = numFrames / 1;\r\n\r\n\tthis.createAnimation( name, startFrame, endFrame, fps );\r\n\tthis.setAnimationWeight( name, 1 );\r\n\r\n};\r\n\r\nTHREE.MorphBlendMesh.prototype = Object.create( THREE.Mesh.prototype );\r\nTHREE.MorphBlendMesh.prototype.constructor = THREE.MorphBlendMesh;\r\n\r\nTHREE.MorphBlendMesh.prototype.createAnimation = function ( name, start, end, fps ) {\r\n\r\n\tvar animation = {\r\n\r\n\t\tstartFrame: start,\r\n\t\tendFrame: end,\r\n\r\n\t\tlength: end - start + 1,\r\n\r\n\t\tfps: fps,\r\n\t\tduration: ( end - start ) / fps,\r\n\r\n\t\tlastFrame: 0,\r\n\t\tcurrentFrame: 0,\r\n\r\n\t\tactive: false,\r\n\r\n\t\ttime: 0,\r\n\t\tdirection: 1,\r\n\t\tweight: 1,\r\n\r\n\t\tdirectionBackwards: false,\r\n\t\tmirroredLoop: false\r\n\r\n\t};\r\n\r\n\tthis.animationsMap[ name ] = animation;\r\n\tthis.animationsList.push( animation );\r\n\r\n};\r\n\r\nTHREE.MorphBlendMesh.prototype.autoCreateAnimations = function ( fps ) {\r\n\r\n\tvar pattern = /([a-z]+)_?(\\d+)/;\r\n\r\n\tvar firstAnimation, frameRanges = {};\r\n\r\n\tvar geometry = this.geometry;\r\n\r\n\tfor ( var i = 0, il = geometry.morphTargets.length; i < il; i ++ ) {\r\n\r\n\t\tvar morph = geometry.morphTargets[ i ];\r\n\t\tvar chunks = morph.name.match( pattern );\r\n\r\n\t\tif ( chunks && chunks.length > 1 ) {\r\n\r\n\t\t\tvar name = chunks[ 1 ];\r\n\r\n\t\t\tif ( ! frameRanges[ name ] ) frameRanges[ name ] = { start: Infinity, end: - Infinity };\r\n\r\n\t\t\tvar range = frameRanges[ name ];\r\n\r\n\t\t\tif ( i < range.start ) range.start = i;\r\n\t\t\tif ( i > range.end ) range.end = i;\r\n\r\n\t\t\tif ( ! firstAnimation ) firstAnimation = name;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tfor ( var name in frameRanges ) {\r\n\r\n\t\tvar range = frameRanges[ name ];\r\n\t\tthis.createAnimation( name, range.start, range.end, fps );\r\n\r\n\t}\r\n\r\n\tthis.firstAnimation = firstAnimation;\r\n\r\n};\r\n\r\nTHREE.MorphBlendMesh.prototype.setAnimationDirectionForward = function ( name ) {\r\n\r\n\tvar animation = this.animationsMap[ name ];\r\n\r\n\tif ( animation ) {\r\n\r\n\t\tanimation.direction = 1;\r\n\t\tanimation.directionBackwards = false;\r\n\r\n\t}\r\n\r\n};\r\n\r\nTHREE.MorphBlendMesh.prototype.setAnimationDirectionBackward = function ( name ) {\r\n\r\n\tvar animation = this.animationsMap[ name ];\r\n\r\n\tif ( animation ) {\r\n\r\n\t\tanimation.direction = - 1;\r\n\t\tanimation.directionBackwards = true;\r\n\r\n\t}\r\n\r\n};\r\n\r\nTHREE.MorphBlendMesh.prototype.setAnimationFPS = function ( name, fps ) {\r\n\r\n\tvar animation = this.animationsMap[ name ];\r\n\r\n\tif ( animation ) {\r\n\r\n\t\tanimation.fps = fps;\r\n\t\tanimation.duration = ( animation.end - animation.start ) / animation.fps;\r\n\r\n\t}\r\n\r\n};\r\n\r\nTHREE.MorphBlendMesh.prototype.setAnimationDuration = function ( name, duration ) {\r\n\r\n\tvar animation = this.animationsMap[ name ];\r\n\r\n\tif ( animation ) {\r\n\r\n\t\tanimation.duration = duration;\r\n\t\tanimation.fps = ( animation.end - animation.start ) / animation.duration;\r\n\r\n\t}\r\n\r\n};\r\n\r\nTHREE.MorphBlendMesh.prototype.setAnimationWeight = function ( name, weight ) {\r\n\r\n\tvar animation = this.animationsMap[ name ];\r\n\r\n\tif ( animation ) {\r\n\r\n\t\tanimation.weight = weight;\r\n\r\n\t}\r\n\r\n};\r\n\r\nTHREE.MorphBlendMesh.prototype.setAnimationTime = function ( name, time ) {\r\n\r\n\tvar animation = this.animationsMap[ name ];\r\n\r\n\tif ( animation ) {\r\n\r\n\t\tanimation.time = time;\r\n\r\n\t}\r\n\r\n};\r\n\r\nTHREE.MorphBlendMesh.prototype.getAnimationTime = function ( name ) {\r\n\r\n\tvar time = 0;\r\n\r\n\tvar animation = this.animationsMap[ name ];\r\n\r\n\tif ( animation ) {\r\n\r\n\t\ttime = animation.time;\r\n\r\n\t}\r\n\r\n\treturn time;\r\n\r\n};\r\n\r\nTHREE.MorphBlendMesh.prototype.getAnimationDuration = function ( name ) {\r\n\r\n\tvar duration = - 1;\r\n\r\n\tvar animation = this.animationsMap[ name ];\r\n\r\n\tif ( animation ) {\r\n\r\n\t\tduration = animation.duration;\r\n\r\n\t}\r\n\r\n\treturn duration;\r\n\r\n};\r\n\r\nTHREE.MorphBlendMesh.prototype.playAnimation = function ( name ) {\r\n\r\n\tvar animation = this.animationsMap[ name ];\r\n\r\n\tif ( animation ) {\r\n\r\n\t\tanimation.time = 0;\r\n\t\tanimation.active = true;\r\n\r\n\t} else {\r\n\r\n\t\tTHREE.warn( \"THREE.MorphBlendMesh: animation[\" + name + \"] undefined in .playAnimation()\" );\r\n\r\n\t}\r\n\r\n};\r\n\r\nTHREE.MorphBlendMesh.prototype.stopAnimation = function ( name ) {\r\n\r\n\tvar animation = this.animationsMap[ name ];\r\n\r\n\tif ( animation ) {\r\n\r\n\t\tanimation.active = false;\r\n\r\n\t}\r\n\r\n};\r\n\r\nTHREE.MorphBlendMesh.prototype.update = function ( delta ) {\r\n\r\n\tfor ( var i = 0, il = this.animationsList.length; i < il; i ++ ) {\r\n\r\n\t\tvar animation = this.animationsList[ i ];\r\n\r\n\t\tif ( ! animation.active ) continue;\r\n\r\n\t\tvar frameTime = animation.duration / animation.length;\r\n\r\n\t\tanimation.time += animation.direction * delta;\r\n\r\n\t\tif ( animation.mirroredLoop ) {\r\n\r\n\t\t\tif ( animation.time > animation.duration || animation.time < 0 ) {\r\n\r\n\t\t\t\tanimation.direction *= - 1;\r\n\r\n\t\t\t\tif ( animation.time > animation.duration ) {\r\n\r\n\t\t\t\t\tanimation.time = animation.duration;\r\n\t\t\t\t\tanimation.directionBackwards = true;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif ( animation.time < 0 ) {\r\n\r\n\t\t\t\t\tanimation.time = 0;\r\n\t\t\t\t\tanimation.directionBackwards = false;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t} else {\r\n\r\n\t\t\tanimation.time = animation.time % animation.duration;\r\n\r\n\t\t\tif ( animation.time < 0 ) animation.time += animation.duration;\r\n\r\n\t\t}\r\n\r\n\t\tvar keyframe = animation.startFrame + THREE.Math.clamp( Math.floor( animation.time / frameTime ), 0, animation.length - 1 );\r\n\t\tvar weight = animation.weight;\r\n\r\n\t\tif ( keyframe !== animation.currentFrame ) {\r\n\r\n\t\t\tthis.morphTargetInfluences[ animation.lastFrame ] = 0;\r\n\t\t\tthis.morphTargetInfluences[ animation.currentFrame ] = 1 * weight;\r\n\r\n\t\t\tthis.morphTargetInfluences[ keyframe ] = 0;\r\n\r\n\t\t\tanimation.lastFrame = animation.currentFrame;\r\n\t\t\tanimation.currentFrame = keyframe;\r\n\r\n\t\t}\r\n\r\n\t\tvar mix = ( animation.time % frameTime ) / frameTime;\r\n\r\n\t\tif ( animation.directionBackwards ) mix = 1 - mix;\r\n\r\n\t\tthis.morphTargetInfluences[ animation.currentFrame ] = mix * weight;\r\n\t\tthis.morphTargetInfluences[ animation.lastFrame ] = ( 1 - mix ) * weight;\r\n\r\n\t}\r\n\r\n};\r\n\r\n\r\n// Export the THREE object for **Node.js**, with\r\n// backwards-compatibility for the old `require()` API. If we're in\r\n// the browser, add `_` as a global object via a string identifier,\r\n// for Closure Compiler \"advanced\" mode.\r\nif (true) {\r\n if (typeof module !== 'undefined' && module.exports) {\r\n exports = module.exports = THREE;\r\n }\r\n exports.THREE = THREE;\r\n} else {\r\n this['THREE'] = THREE;\r\n}\r\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/three/three.js\n ** module id = 8\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/three/three.js?"); + eval("var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;// File:src/Three.js\r\n\r\n/**\r\n * @author mrdoob / http://mrdoob.com/\r\n */\r\n\r\nvar THREE = { REVISION: '72dev' };\r\n\r\n//\r\n\r\nif ( true ) {\r\n\r\n\t\t!(__WEBPACK_AMD_DEFINE_FACTORY__ = (THREE), __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? (__WEBPACK_AMD_DEFINE_FACTORY__.call(exports, __webpack_require__, exports, module)) : __WEBPACK_AMD_DEFINE_FACTORY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\r\n\r\n} else if ( 'undefined' !== typeof exports && 'undefined' !== typeof module ) {\r\n\r\n\t\tmodule.exports = THREE;\r\n\r\n}\r\n\r\n\r\n// polyfills\r\n\r\nif ( self.requestAnimationFrame === undefined || self.cancelAnimationFrame === undefined ) {\r\n\r\n\t// Missing in Android stock browser.\r\n\r\n\t( function () {\r\n\r\n\t\tvar lastTime = 0;\r\n\t\tvar vendors = [ 'ms', 'moz', 'webkit', 'o' ];\r\n\r\n\t\tfor ( var x = 0; x < vendors.length && ! self.requestAnimationFrame; ++ x ) {\r\n\r\n\t\t\tself.requestAnimationFrame = self[ vendors[ x ] + 'RequestAnimationFrame' ];\r\n\t\t\tself.cancelAnimationFrame = self[ vendors[ x ] + 'CancelAnimationFrame' ] || self[ vendors[ x ] + 'CancelRequestAnimationFrame' ];\r\n\r\n\t\t}\r\n\r\n\t\tif ( self.requestAnimationFrame === undefined && self.setTimeout !== undefined ) {\r\n\r\n\t\t\tself.requestAnimationFrame = function ( callback ) {\r\n\r\n\t\t\t\tvar currTime = Date.now(), timeToCall = Math.max( 0, 16 - ( currTime - lastTime ) );\r\n\t\t\t\tvar id = self.setTimeout( function () {\r\n\r\n\t\t\t\t\tcallback( currTime + timeToCall );\r\n\r\n\t\t\t\t}, timeToCall );\r\n\t\t\t\tlastTime = currTime + timeToCall;\r\n\t\t\t\treturn id;\r\n\r\n\t\t\t};\r\n\r\n\t\t}\r\n\r\n\t\tif ( self.cancelAnimationFrame === undefined && self.clearTimeout !== undefined ) {\r\n\r\n\t\t\tself.cancelAnimationFrame = function ( id ) {\r\n\r\n\t\t\t\tself.clearTimeout( id );\r\n\r\n\t\t\t};\r\n\r\n\t\t}\r\n\r\n\t}() );\r\n\r\n}\r\n\r\nif ( Math.sign === undefined ) {\r\n\r\n\t// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/sign\r\n\r\n\tMath.sign = function ( x ) {\r\n\r\n\t\treturn ( x < 0 ) ? - 1 : ( x > 0 ) ? 1 : + x;\r\n\r\n\t};\r\n\r\n}\r\n\r\nif ( Function.prototype.name === undefined && Object.defineProperty !== undefined ) {\r\n\r\n\t// Missing in IE9-11.\r\n\t// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/name\r\n\r\n\tObject.defineProperty( Function.prototype, 'name', {\r\n\r\n\t\tget: function () {\r\n\r\n\t\t\treturn this.toString().match( /^\\s*function\\s*(\\S*)\\s*\\(/ )[ 1 ];\r\n\r\n\t\t}\r\n\r\n\t} );\r\n\r\n}\r\n\r\n// https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent.button\r\n\r\nTHREE.MOUSE = { LEFT: 0, MIDDLE: 1, RIGHT: 2 };\r\n\r\n// GL STATE CONSTANTS\r\n\r\nTHREE.CullFaceNone = 0;\r\nTHREE.CullFaceBack = 1;\r\nTHREE.CullFaceFront = 2;\r\nTHREE.CullFaceFrontBack = 3;\r\n\r\nTHREE.FrontFaceDirectionCW = 0;\r\nTHREE.FrontFaceDirectionCCW = 1;\r\n\r\n// SHADOWING TYPES\r\n\r\nTHREE.BasicShadowMap = 0;\r\nTHREE.PCFShadowMap = 1;\r\nTHREE.PCFSoftShadowMap = 2;\r\n\r\n// MATERIAL CONSTANTS\r\n\r\n// side\r\n\r\nTHREE.FrontSide = 0;\r\nTHREE.BackSide = 1;\r\nTHREE.DoubleSide = 2;\r\n\r\n// shading\r\n\r\nTHREE.FlatShading = 1;\r\nTHREE.SmoothShading = 2;\r\n\r\n// colors\r\n\r\nTHREE.NoColors = 0;\r\nTHREE.FaceColors = 1;\r\nTHREE.VertexColors = 2;\r\n\r\n// blending modes\r\n\r\nTHREE.NoBlending = 0;\r\nTHREE.NormalBlending = 1;\r\nTHREE.AdditiveBlending = 2;\r\nTHREE.SubtractiveBlending = 3;\r\nTHREE.MultiplyBlending = 4;\r\nTHREE.CustomBlending = 5;\r\n\r\n// custom blending equations\r\n// (numbers start from 100 not to clash with other\r\n// mappings to OpenGL constants defined in Texture.js)\r\n\r\nTHREE.AddEquation = 100;\r\nTHREE.SubtractEquation = 101;\r\nTHREE.ReverseSubtractEquation = 102;\r\nTHREE.MinEquation = 103;\r\nTHREE.MaxEquation = 104;\r\n\r\n// custom blending destination factors\r\n\r\nTHREE.ZeroFactor = 200;\r\nTHREE.OneFactor = 201;\r\nTHREE.SrcColorFactor = 202;\r\nTHREE.OneMinusSrcColorFactor = 203;\r\nTHREE.SrcAlphaFactor = 204;\r\nTHREE.OneMinusSrcAlphaFactor = 205;\r\nTHREE.DstAlphaFactor = 206;\r\nTHREE.OneMinusDstAlphaFactor = 207;\r\n\r\n// custom blending source factors\r\n\r\n//THREE.ZeroFactor = 200;\r\n//THREE.OneFactor = 201;\r\n//THREE.SrcAlphaFactor = 204;\r\n//THREE.OneMinusSrcAlphaFactor = 205;\r\n//THREE.DstAlphaFactor = 206;\r\n//THREE.OneMinusDstAlphaFactor = 207;\r\nTHREE.DstColorFactor = 208;\r\nTHREE.OneMinusDstColorFactor = 209;\r\nTHREE.SrcAlphaSaturateFactor = 210;\r\n\r\n// depth modes\r\n\r\nTHREE.NeverDepth = 0;\r\nTHREE.AlwaysDepth = 1;\r\nTHREE.LessDepth = 2;\r\nTHREE.LessEqualDepth = 3;\r\nTHREE.EqualDepth = 4;\r\nTHREE.GreaterEqualDepth = 5;\r\nTHREE.GreaterDepth = 6;\r\nTHREE.NotEqualDepth = 7;\r\n\r\n\r\n// TEXTURE CONSTANTS\r\n\r\nTHREE.MultiplyOperation = 0;\r\nTHREE.MixOperation = 1;\r\nTHREE.AddOperation = 2;\r\n\r\n// Mapping modes\r\n\r\nTHREE.UVMapping = 300;\r\n\r\nTHREE.CubeReflectionMapping = 301;\r\nTHREE.CubeRefractionMapping = 302;\r\n\r\nTHREE.EquirectangularReflectionMapping = 303;\r\nTHREE.EquirectangularRefractionMapping = 304;\r\n\r\nTHREE.SphericalReflectionMapping = 305;\r\n\r\n// Wrapping modes\r\n\r\nTHREE.RepeatWrapping = 1000;\r\nTHREE.ClampToEdgeWrapping = 1001;\r\nTHREE.MirroredRepeatWrapping = 1002;\r\n\r\n// Filters\r\n\r\nTHREE.NearestFilter = 1003;\r\nTHREE.NearestMipMapNearestFilter = 1004;\r\nTHREE.NearestMipMapLinearFilter = 1005;\r\nTHREE.LinearFilter = 1006;\r\nTHREE.LinearMipMapNearestFilter = 1007;\r\nTHREE.LinearMipMapLinearFilter = 1008;\r\n\r\n// Data types\r\n\r\nTHREE.UnsignedByteType = 1009;\r\nTHREE.ByteType = 1010;\r\nTHREE.ShortType = 1011;\r\nTHREE.UnsignedShortType = 1012;\r\nTHREE.IntType = 1013;\r\nTHREE.UnsignedIntType = 1014;\r\nTHREE.FloatType = 1015;\r\nTHREE.HalfFloatType = 1025;\r\n\r\n// Pixel types\r\n\r\n//THREE.UnsignedByteType = 1009;\r\nTHREE.UnsignedShort4444Type = 1016;\r\nTHREE.UnsignedShort5551Type = 1017;\r\nTHREE.UnsignedShort565Type = 1018;\r\n\r\n// Pixel formats\r\n\r\nTHREE.AlphaFormat = 1019;\r\nTHREE.RGBFormat = 1020;\r\nTHREE.RGBAFormat = 1021;\r\nTHREE.LuminanceFormat = 1022;\r\nTHREE.LuminanceAlphaFormat = 1023;\r\n// THREE.RGBEFormat handled as THREE.RGBAFormat in shaders\r\nTHREE.RGBEFormat = THREE.RGBAFormat; //1024;\r\n\r\n// DDS / ST3C Compressed texture formats\r\n\r\nTHREE.RGB_S3TC_DXT1_Format = 2001;\r\nTHREE.RGBA_S3TC_DXT1_Format = 2002;\r\nTHREE.RGBA_S3TC_DXT3_Format = 2003;\r\nTHREE.RGBA_S3TC_DXT5_Format = 2004;\r\n\r\n\r\n// PVRTC compressed texture formats\r\n\r\nTHREE.RGB_PVRTC_4BPPV1_Format = 2100;\r\nTHREE.RGB_PVRTC_2BPPV1_Format = 2101;\r\nTHREE.RGBA_PVRTC_4BPPV1_Format = 2102;\r\nTHREE.RGBA_PVRTC_2BPPV1_Format = 2103;\r\n\r\n\r\n// DEPRECATED\r\n\r\nTHREE.Projector = function () {\r\n\r\n\tconsole.error( 'THREE.Projector has been moved to /examples/js/renderers/Projector.js.' );\r\n\r\n\tthis.projectVector = function ( vector, camera ) {\r\n\r\n\t\tconsole.warn( 'THREE.Projector: .projectVector() is now vector.project().' );\r\n\t\tvector.project( camera );\r\n\r\n\t};\r\n\r\n\tthis.unprojectVector = function ( vector, camera ) {\r\n\r\n\t\tconsole.warn( 'THREE.Projector: .unprojectVector() is now vector.unproject().' );\r\n\t\tvector.unproject( camera );\r\n\r\n\t};\r\n\r\n\tthis.pickingRay = function ( vector, camera ) {\r\n\r\n\t\tconsole.error( 'THREE.Projector: .pickingRay() is now raycaster.setFromCamera().' );\r\n\r\n\t};\r\n\r\n};\r\n\r\nTHREE.CanvasRenderer = function () {\r\n\r\n\tconsole.error( 'THREE.CanvasRenderer has been moved to /examples/js/renderers/CanvasRenderer.js' );\r\n\r\n\tthis.domElement = document.createElement( 'canvas' );\r\n\tthis.clear = function () {};\r\n\tthis.render = function () {};\r\n\tthis.setClearColor = function () {};\r\n\tthis.setSize = function () {};\r\n\r\n};\r\n\r\n// File:src/math/Color.js\r\n\r\n/**\r\n * @author mrdoob / http://mrdoob.com/\r\n */\r\n\r\nTHREE.Color = function ( color ) {\r\n\r\n\tif ( arguments.length === 3 ) {\r\n\r\n\t\treturn this.setRGB( arguments[ 0 ], arguments[ 1 ], arguments[ 2 ] );\r\n\r\n\t}\r\n\r\n\treturn this.set( color );\r\n\r\n};\r\n\r\nTHREE.Color.prototype = {\r\n\r\n\tconstructor: THREE.Color,\r\n\r\n\tr: 1, g: 1, b: 1,\r\n\r\n\tset: function ( value ) {\r\n\r\n\t\tif ( value instanceof THREE.Color ) {\r\n\r\n\t\t\tthis.copy( value );\r\n\r\n\t\t} else if ( typeof value === 'number' ) {\r\n\r\n\t\t\tthis.setHex( value );\r\n\r\n\t\t} else if ( typeof value === 'string' ) {\r\n\r\n\t\t\tthis.setStyle( value );\r\n\r\n\t\t}\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tsetHex: function ( hex ) {\r\n\r\n\t\thex = Math.floor( hex );\r\n\r\n\t\tthis.r = ( hex >> 16 & 255 ) / 255;\r\n\t\tthis.g = ( hex >> 8 & 255 ) / 255;\r\n\t\tthis.b = ( hex & 255 ) / 255;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tsetRGB: function ( r, g, b ) {\r\n\r\n\t\tthis.r = r;\r\n\t\tthis.g = g;\r\n\t\tthis.b = b;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tsetHSL: function () {\r\n\r\n\t\tfunction hue2rgb ( p, q, t ) {\r\n\r\n\t\t\tif ( t < 0 ) t += 1;\r\n\t\t\tif ( t > 1 ) t -= 1;\r\n\t\t\tif ( t < 1 / 6 ) return p + ( q - p ) * 6 * t;\r\n\t\t\tif ( t < 1 / 2 ) return q;\r\n\t\t\tif ( t < 2 / 3 ) return p + ( q - p ) * 6 * ( 2 / 3 - t );\r\n\t\t\treturn p;\r\n\r\n\t\t}\r\n\r\n\t\treturn function ( h, s, l ) {\r\n\r\n\t\t\t// h,s,l ranges are in 0.0 - 1.0\r\n\t\t\th = THREE.Math.euclideanModulo( h, 1 );\r\n\t\t\ts = THREE.Math.clamp( s, 0, 1 );\r\n\t\t\tl = THREE.Math.clamp( l, 0, 1 );\r\n\r\n\t\t\tif ( s === 0 ) {\r\n\r\n\t\t\t\tthis.r = this.g = this.b = l;\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tvar p = l <= 0.5 ? l * ( 1 + s ) : l + s - ( l * s );\r\n\t\t\t\tvar q = ( 2 * l ) - p;\r\n\r\n\t\t\t\tthis.r = hue2rgb( q, p, h + 1 / 3 );\r\n\t\t\t\tthis.g = hue2rgb( q, p, h );\r\n\t\t\t\tthis.b = hue2rgb( q, p, h - 1 / 3 );\r\n\r\n\t\t\t}\r\n\r\n\t\t\treturn this;\r\n\r\n\t\t};\r\n\r\n\t}(),\r\n\r\n\tsetStyle: function ( style ) {\r\n\r\n\t\tvar parseAlpha = function ( strAlpha ) {\r\n\r\n\t\t\tvar alpha = parseFloat( strAlpha );\r\n\r\n\t\t\tif ( alpha < 1 ) {\r\n\r\n\t\t\t\tconsole.warn( 'THREE.Color: Alpha component of color ' + style + ' will be ignored.' );\r\n\r\n\t\t\t}\r\n\r\n\t\t\treturn alpha;\r\n\r\n\t\t}\r\n\r\n\r\n\t\tvar m;\r\n\r\n\t\tif ( m = /^((?:rgb|hsl)a?)\\(\\s*([^\\)]*)\\)/.exec( style ) ) {\r\n\r\n\t\t\t// rgb / hsl\r\n\r\n\t\t\tvar color;\r\n\t\t\tvar name = m[ 1 ];\r\n\t\t\tvar components = m[ 2 ];\r\n\r\n\t\t\tswitch ( name ) {\r\n\r\n\t\t\t\tcase 'rgb':\r\n\r\n\t\t\t\t\tif ( color = /^(\\d+)\\s*,\\s*(\\d+)\\s*,\\s*(\\d+)\\s*$/.exec( components ) ) {\r\n\r\n\t\t\t\t\t\t// rgb(255,0,0)\r\n\t\t\t\t\t\tthis.r = Math.min( 255, parseInt( color[ 1 ], 10 ) ) / 255;\r\n\t\t\t\t\t\tthis.g = Math.min( 255, parseInt( color[ 2 ], 10 ) ) / 255;\r\n\t\t\t\t\t\tthis.b = Math.min( 255, parseInt( color[ 3 ], 10 ) ) / 255;\r\n\r\n\t\t\t\t\t\treturn this;\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tif ( color = /^(\\d+)\\%\\s*,\\s*(\\d+)\\%\\s*,\\s*(\\d+)\\%\\s*$/.exec( components ) ) {\r\n\r\n\t\t\t\t\t\t// rgb(100%,0%,0%)\r\n\t\t\t\t\t\tthis.r = Math.min( 100, parseInt( color[ 1 ], 10 ) ) / 100;\r\n\t\t\t\t\t\tthis.g = Math.min( 100, parseInt( color[ 2 ], 10 ) ) / 100;\r\n\t\t\t\t\t\tthis.b = Math.min( 100, parseInt( color[ 3 ], 10 ) ) / 100;\r\n\r\n\t\t\t\t\t\treturn this;\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase 'rgba':\r\n\r\n\t\t\t\t\tif ( color = /^(\\d+)\\s*,\\s*(\\d+)\\s*,\\s*(\\d+)\\s*,\\s*([0-9]*\\.?[0-9]+)\\s*$/.exec( components ) ) {\r\n\r\n\t\t\t\t\t\t// rgba(255,0,0,0.5)\r\n\t\t\t\t\t\tthis.r = Math.min( 255, parseInt( color[ 1 ], 10 ) ) / 255;\r\n\t\t\t\t\t\tthis.g = Math.min( 255, parseInt( color[ 2 ], 10 ) ) / 255;\r\n\t\t\t\t\t\tthis.b = Math.min( 255, parseInt( color[ 3 ], 10 ) ) / 255;\r\n\t\t\t\t\t\tparseAlpha( color[ 4 ] );\r\n\r\n\t\t\t\t\t\treturn this;\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tif ( color = /^(\\d+)\\%\\s*,\\s*(\\d+)\\%\\s*,\\s*(\\d+)\\%\\s*,\\s*([0-9]*\\.?[0-9]+)\\s*$/.exec( components ) ) {\r\n\r\n\t\t\t\t\t\t// rgba(100%,0%,0%,0.5)\r\n\t\t\t\t\t\tthis.r = Math.min( 100, parseInt( color[ 1 ], 10 ) ) / 100;\r\n\t\t\t\t\t\tthis.g = Math.min( 100, parseInt( color[ 2 ], 10 ) ) / 100;\r\n\t\t\t\t\t\tthis.b = Math.min( 100, parseInt( color[ 3 ], 10 ) ) / 100;\r\n\t\t\t\t\t\tparseAlpha( color[ 4 ] );\r\n\r\n\t\t\t\t\t\treturn this;\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase 'hsl':\r\n\r\n\t\t\t\t\tif ( color = /^([0-9]*\\.?[0-9]+)\\s*,\\s*(\\d+)\\%\\s*,\\s*(\\d+)\\%\\s*$/.exec( components ) ) {\r\n\r\n\t\t\t\t\t\t// hsl(120,50%,50%)\r\n\t\t\t\t\t\tvar h = parseFloat( color[ 1 ] );\r\n\t\t\t\t\t\tvar s = parseInt( color[ 2 ], 10 ) / 100;\r\n\t\t\t\t\t\tvar l = parseInt( color[ 3 ], 10 ) / 100;\r\n\r\n\t\t\t\t\t\treturn this.setHSL( h, s, l );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase 'hsla':\r\n\r\n\t\t\t\t\tif ( color = /^([0-9]*\\.?[0-9]+)\\s*,\\s*(\\d+)\\%\\s*,\\s*(\\d+)\\%\\s*,\\s*([0-9]*\\.?[0-9]+)\\s*$/.exec( components ) ) {\r\n\r\n\t\t\t\t\t\t// hsla(120,50%,50%,0.5)\r\n\t\t\t\t\t\tvar h = parseFloat( color[ 1 ] );\r\n\t\t\t\t\t\tvar s = parseInt( color[ 2 ], 10 ) / 100;\r\n\t\t\t\t\t\tvar l = parseInt( color[ 3 ], 10 ) / 100;\r\n\t\t\t\t\t\tparseAlpha( color[ 4 ] );\r\n\r\n\t\t\t\t\t\treturn this.setHSL( h, s, l );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t}\r\n\r\n\t\t} else if ( m = /^\\#([A-Fa-f0-9]+)$/.exec( style ) ) {\r\n\r\n\t\t\t// hex color\r\n\r\n\t\t\tvar hex = m[ 1 ];\r\n\t\t\tvar size = hex.length;\r\n\r\n\t\t\tif ( size === 3 ) {\r\n\r\n\t\t\t\t// #ff0\r\n\t\t\t\tthis.r = parseInt( hex.charAt( 0 ) + hex.charAt( 0 ), 16 ) / 255;\r\n\t\t\t\tthis.g = parseInt( hex.charAt( 1 ) + hex.charAt( 1 ), 16 ) / 255;\r\n\t\t\t\tthis.b = parseInt( hex.charAt( 2 ) + hex.charAt( 2 ), 16 ) / 255;\r\n\r\n\t\t\t\treturn this;\r\n\r\n\t\t\t} else if ( size === 6 ) {\r\n\r\n\t\t\t\t// #ff0000\r\n\t\t\t\tthis.r = parseInt( hex.charAt( 0 ) + hex.charAt( 1 ), 16 ) / 255;\r\n\t\t\t\tthis.g = parseInt( hex.charAt( 2 ) + hex.charAt( 3 ), 16 ) / 255;\r\n\t\t\t\tthis.b = parseInt( hex.charAt( 4 ) + hex.charAt( 5 ), 16 ) / 255;\r\n\r\n\t\t\t\treturn this;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tif ( style && style.length > 0 ) {\r\n\r\n\t\t\t// color keywords\r\n\t\t\tvar hex = THREE.ColorKeywords[ style ];\r\n\r\n\t\t\tif ( hex !== undefined ) {\r\n\r\n\t\t\t\t// red\r\n\t\t\t\tthis.setHex( hex );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\t// unknown color\r\n\t\t\t\tconsole.warn( 'THREE.Color: Unknown color ' + style );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tclone: function () {\r\n\r\n\t\treturn new this.constructor( this.r, this.g, this.b );\r\n\r\n\t},\r\n\r\n\tcopy: function ( color ) {\r\n\r\n\t\tthis.r = color.r;\r\n\t\tthis.g = color.g;\r\n\t\tthis.b = color.b;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tcopyGammaToLinear: function ( color, gammaFactor ) {\r\n\r\n\t\tif ( gammaFactor === undefined ) gammaFactor = 2.0;\r\n\r\n\t\tthis.r = Math.pow( color.r, gammaFactor );\r\n\t\tthis.g = Math.pow( color.g, gammaFactor );\r\n\t\tthis.b = Math.pow( color.b, gammaFactor );\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tcopyLinearToGamma: function ( color, gammaFactor ) {\r\n\r\n\t\tif ( gammaFactor === undefined ) gammaFactor = 2.0;\r\n\r\n\t\tvar safeInverse = ( gammaFactor > 0 ) ? ( 1.0 / gammaFactor ) : 1.0;\r\n\r\n\t\tthis.r = Math.pow( color.r, safeInverse );\r\n\t\tthis.g = Math.pow( color.g, safeInverse );\r\n\t\tthis.b = Math.pow( color.b, safeInverse );\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tconvertGammaToLinear: function () {\r\n\r\n\t\tvar r = this.r, g = this.g, b = this.b;\r\n\r\n\t\tthis.r = r * r;\r\n\t\tthis.g = g * g;\r\n\t\tthis.b = b * b;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tconvertLinearToGamma: function () {\r\n\r\n\t\tthis.r = Math.sqrt( this.r );\r\n\t\tthis.g = Math.sqrt( this.g );\r\n\t\tthis.b = Math.sqrt( this.b );\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tgetHex: function () {\r\n\r\n\t\treturn ( this.r * 255 ) << 16 ^ ( this.g * 255 ) << 8 ^ ( this.b * 255 ) << 0;\r\n\r\n\t},\r\n\r\n\tgetHexString: function () {\r\n\r\n\t\treturn ( '000000' + this.getHex().toString( 16 ) ).slice( - 6 );\r\n\r\n\t},\r\n\r\n\tgetHSL: function ( optionalTarget ) {\r\n\r\n\t\t// h,s,l ranges are in 0.0 - 1.0\r\n\r\n\t\tvar hsl = optionalTarget || { h: 0, s: 0, l: 0 };\r\n\r\n\t\tvar r = this.r, g = this.g, b = this.b;\r\n\r\n\t\tvar max = Math.max( r, g, b );\r\n\t\tvar min = Math.min( r, g, b );\r\n\r\n\t\tvar hue, saturation;\r\n\t\tvar lightness = ( min + max ) / 2.0;\r\n\r\n\t\tif ( min === max ) {\r\n\r\n\t\t\thue = 0;\r\n\t\t\tsaturation = 0;\r\n\r\n\t\t} else {\r\n\r\n\t\t\tvar delta = max - min;\r\n\r\n\t\t\tsaturation = lightness <= 0.5 ? delta / ( max + min ) : delta / ( 2 - max - min );\r\n\r\n\t\t\tswitch ( max ) {\r\n\r\n\t\t\t\tcase r: hue = ( g - b ) / delta + ( g < b ? 6 : 0 ); break;\r\n\t\t\t\tcase g: hue = ( b - r ) / delta + 2; break;\r\n\t\t\t\tcase b: hue = ( r - g ) / delta + 4; break;\r\n\r\n\t\t\t}\r\n\r\n\t\t\thue /= 6;\r\n\r\n\t\t}\r\n\r\n\t\thsl.h = hue;\r\n\t\thsl.s = saturation;\r\n\t\thsl.l = lightness;\r\n\r\n\t\treturn hsl;\r\n\r\n\t},\r\n\r\n\tgetStyle: function () {\r\n\r\n\t\treturn 'rgb(' + ( ( this.r * 255 ) | 0 ) + ',' + ( ( this.g * 255 ) | 0 ) + ',' + ( ( this.b * 255 ) | 0 ) + ')';\r\n\r\n\t},\r\n\r\n\toffsetHSL: function ( h, s, l ) {\r\n\r\n\t\tvar hsl = this.getHSL();\r\n\r\n\t\thsl.h += h; hsl.s += s; hsl.l += l;\r\n\r\n\t\tthis.setHSL( hsl.h, hsl.s, hsl.l );\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tadd: function ( color ) {\r\n\r\n\t\tthis.r += color.r;\r\n\t\tthis.g += color.g;\r\n\t\tthis.b += color.b;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\taddColors: function ( color1, color2 ) {\r\n\r\n\t\tthis.r = color1.r + color2.r;\r\n\t\tthis.g = color1.g + color2.g;\r\n\t\tthis.b = color1.b + color2.b;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\taddScalar: function ( s ) {\r\n\r\n\t\tthis.r += s;\r\n\t\tthis.g += s;\r\n\t\tthis.b += s;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tmultiply: function ( color ) {\r\n\r\n\t\tthis.r *= color.r;\r\n\t\tthis.g *= color.g;\r\n\t\tthis.b *= color.b;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tmultiplyScalar: function ( s ) {\r\n\r\n\t\tthis.r *= s;\r\n\t\tthis.g *= s;\r\n\t\tthis.b *= s;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tlerp: function ( color, alpha ) {\r\n\r\n\t\tthis.r += ( color.r - this.r ) * alpha;\r\n\t\tthis.g += ( color.g - this.g ) * alpha;\r\n\t\tthis.b += ( color.b - this.b ) * alpha;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tequals: function ( c ) {\r\n\r\n\t\treturn ( c.r === this.r ) && ( c.g === this.g ) && ( c.b === this.b );\r\n\r\n\t},\r\n\r\n\tfromArray: function ( array ) {\r\n\r\n\t\tthis.r = array[ 0 ];\r\n\t\tthis.g = array[ 1 ];\r\n\t\tthis.b = array[ 2 ];\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\ttoArray: function ( array, offset ) {\r\n\r\n\t\tif ( array === undefined ) array = [];\r\n\t\tif ( offset === undefined ) offset = 0;\r\n\r\n\t\tarray[ offset ] = this.r;\r\n\t\tarray[ offset + 1 ] = this.g;\r\n\t\tarray[ offset + 2 ] = this.b;\r\n\r\n\t\treturn array;\r\n\r\n\t}\r\n\r\n};\r\n\r\nTHREE.ColorKeywords = { 'aliceblue': 0xF0F8FF, 'antiquewhite': 0xFAEBD7, 'aqua': 0x00FFFF, 'aquamarine': 0x7FFFD4, 'azure': 0xF0FFFF,\r\n'beige': 0xF5F5DC, 'bisque': 0xFFE4C4, 'black': 0x000000, 'blanchedalmond': 0xFFEBCD, 'blue': 0x0000FF, 'blueviolet': 0x8A2BE2,\r\n'brown': 0xA52A2A, 'burlywood': 0xDEB887, 'cadetblue': 0x5F9EA0, 'chartreuse': 0x7FFF00, 'chocolate': 0xD2691E, 'coral': 0xFF7F50,\r\n'cornflowerblue': 0x6495ED, 'cornsilk': 0xFFF8DC, 'crimson': 0xDC143C, 'cyan': 0x00FFFF, 'darkblue': 0x00008B, 'darkcyan': 0x008B8B,\r\n'darkgoldenrod': 0xB8860B, 'darkgray': 0xA9A9A9, 'darkgreen': 0x006400, 'darkgrey': 0xA9A9A9, 'darkkhaki': 0xBDB76B, 'darkmagenta': 0x8B008B,\r\n'darkolivegreen': 0x556B2F, 'darkorange': 0xFF8C00, 'darkorchid': 0x9932CC, 'darkred': 0x8B0000, 'darksalmon': 0xE9967A, 'darkseagreen': 0x8FBC8F,\r\n'darkslateblue': 0x483D8B, 'darkslategray': 0x2F4F4F, 'darkslategrey': 0x2F4F4F, 'darkturquoise': 0x00CED1, 'darkviolet': 0x9400D3,\r\n'deeppink': 0xFF1493, 'deepskyblue': 0x00BFFF, 'dimgray': 0x696969, 'dimgrey': 0x696969, 'dodgerblue': 0x1E90FF, 'firebrick': 0xB22222,\r\n'floralwhite': 0xFFFAF0, 'forestgreen': 0x228B22, 'fuchsia': 0xFF00FF, 'gainsboro': 0xDCDCDC, 'ghostwhite': 0xF8F8FF, 'gold': 0xFFD700,\r\n'goldenrod': 0xDAA520, 'gray': 0x808080, 'green': 0x008000, 'greenyellow': 0xADFF2F, 'grey': 0x808080, 'honeydew': 0xF0FFF0, 'hotpink': 0xFF69B4,\r\n'indianred': 0xCD5C5C, 'indigo': 0x4B0082, 'ivory': 0xFFFFF0, 'khaki': 0xF0E68C, 'lavender': 0xE6E6FA, 'lavenderblush': 0xFFF0F5, 'lawngreen': 0x7CFC00,\r\n'lemonchiffon': 0xFFFACD, 'lightblue': 0xADD8E6, 'lightcoral': 0xF08080, 'lightcyan': 0xE0FFFF, 'lightgoldenrodyellow': 0xFAFAD2, 'lightgray': 0xD3D3D3,\r\n'lightgreen': 0x90EE90, 'lightgrey': 0xD3D3D3, 'lightpink': 0xFFB6C1, 'lightsalmon': 0xFFA07A, 'lightseagreen': 0x20B2AA, 'lightskyblue': 0x87CEFA,\r\n'lightslategray': 0x778899, 'lightslategrey': 0x778899, 'lightsteelblue': 0xB0C4DE, 'lightyellow': 0xFFFFE0, 'lime': 0x00FF00, 'limegreen': 0x32CD32,\r\n'linen': 0xFAF0E6, 'magenta': 0xFF00FF, 'maroon': 0x800000, 'mediumaquamarine': 0x66CDAA, 'mediumblue': 0x0000CD, 'mediumorchid': 0xBA55D3,\r\n'mediumpurple': 0x9370DB, 'mediumseagreen': 0x3CB371, 'mediumslateblue': 0x7B68EE, 'mediumspringgreen': 0x00FA9A, 'mediumturquoise': 0x48D1CC,\r\n'mediumvioletred': 0xC71585, 'midnightblue': 0x191970, 'mintcream': 0xF5FFFA, 'mistyrose': 0xFFE4E1, 'moccasin': 0xFFE4B5, 'navajowhite': 0xFFDEAD,\r\n'navy': 0x000080, 'oldlace': 0xFDF5E6, 'olive': 0x808000, 'olivedrab': 0x6B8E23, 'orange': 0xFFA500, 'orangered': 0xFF4500, 'orchid': 0xDA70D6,\r\n'palegoldenrod': 0xEEE8AA, 'palegreen': 0x98FB98, 'paleturquoise': 0xAFEEEE, 'palevioletred': 0xDB7093, 'papayawhip': 0xFFEFD5, 'peachpuff': 0xFFDAB9,\r\n'peru': 0xCD853F, 'pink': 0xFFC0CB, 'plum': 0xDDA0DD, 'powderblue': 0xB0E0E6, 'purple': 0x800080, 'red': 0xFF0000, 'rosybrown': 0xBC8F8F,\r\n'royalblue': 0x4169E1, 'saddlebrown': 0x8B4513, 'salmon': 0xFA8072, 'sandybrown': 0xF4A460, 'seagreen': 0x2E8B57, 'seashell': 0xFFF5EE,\r\n'sienna': 0xA0522D, 'silver': 0xC0C0C0, 'skyblue': 0x87CEEB, 'slateblue': 0x6A5ACD, 'slategray': 0x708090, 'slategrey': 0x708090, 'snow': 0xFFFAFA,\r\n'springgreen': 0x00FF7F, 'steelblue': 0x4682B4, 'tan': 0xD2B48C, 'teal': 0x008080, 'thistle': 0xD8BFD8, 'tomato': 0xFF6347, 'turquoise': 0x40E0D0,\r\n'violet': 0xEE82EE, 'wheat': 0xF5DEB3, 'white': 0xFFFFFF, 'whitesmoke': 0xF5F5F5, 'yellow': 0xFFFF00, 'yellowgreen': 0x9ACD32 };\r\n\r\n// File:src/math/Quaternion.js\r\n\r\n/**\r\n * @author mikael emtinger / http://gomo.se/\r\n * @author alteredq / http://alteredqualia.com/\r\n * @author WestLangley / http://github.com/WestLangley\r\n * @author bhouston / http://exocortex.com\r\n */\r\n\r\nTHREE.Quaternion = function ( x, y, z, w ) {\r\n\r\n\tthis._x = x || 0;\r\n\tthis._y = y || 0;\r\n\tthis._z = z || 0;\r\n\tthis._w = ( w !== undefined ) ? w : 1;\r\n\r\n};\r\n\r\nTHREE.Quaternion.prototype = {\r\n\r\n\tconstructor: THREE.Quaternion,\r\n\r\n\tget x () {\r\n\r\n\t\treturn this._x;\r\n\r\n\t},\r\n\r\n\tset x ( value ) {\r\n\r\n\t\tthis._x = value;\r\n\t\tthis.onChangeCallback();\r\n\r\n\t},\r\n\r\n\tget y () {\r\n\r\n\t\treturn this._y;\r\n\r\n\t},\r\n\r\n\tset y ( value ) {\r\n\r\n\t\tthis._y = value;\r\n\t\tthis.onChangeCallback();\r\n\r\n\t},\r\n\r\n\tget z () {\r\n\r\n\t\treturn this._z;\r\n\r\n\t},\r\n\r\n\tset z ( value ) {\r\n\r\n\t\tthis._z = value;\r\n\t\tthis.onChangeCallback();\r\n\r\n\t},\r\n\r\n\tget w () {\r\n\r\n\t\treturn this._w;\r\n\r\n\t},\r\n\r\n\tset w ( value ) {\r\n\r\n\t\tthis._w = value;\r\n\t\tthis.onChangeCallback();\r\n\r\n\t},\r\n\r\n\tset: function ( x, y, z, w ) {\r\n\r\n\t\tthis._x = x;\r\n\t\tthis._y = y;\r\n\t\tthis._z = z;\r\n\t\tthis._w = w;\r\n\r\n\t\tthis.onChangeCallback();\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tclone: function () {\r\n\r\n\t\treturn new this.constructor( this._x, this._y, this._z, this._w );\r\n\r\n\t},\r\n\r\n\tcopy: function ( quaternion ) {\r\n\r\n\t\tthis._x = quaternion.x;\r\n\t\tthis._y = quaternion.y;\r\n\t\tthis._z = quaternion.z;\r\n\t\tthis._w = quaternion.w;\r\n\r\n\t\tthis.onChangeCallback();\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tsetFromEuler: function ( euler, update ) {\r\n\r\n\t\tif ( euler instanceof THREE.Euler === false ) {\r\n\r\n\t\t\tthrow new Error( 'THREE.Quaternion: .setFromEuler() now expects a Euler rotation rather than a Vector3 and order.' );\r\n\r\n\t\t}\r\n\r\n\t\t// http://www.mathworks.com/matlabcentral/fileexchange/\r\n\t\t// \t20696-function-to-convert-between-dcm-euler-angles-quaternions-and-euler-vectors/\r\n\t\t//\tcontent/SpinCalc.m\r\n\r\n\t\tvar c1 = Math.cos( euler._x / 2 );\r\n\t\tvar c2 = Math.cos( euler._y / 2 );\r\n\t\tvar c3 = Math.cos( euler._z / 2 );\r\n\t\tvar s1 = Math.sin( euler._x / 2 );\r\n\t\tvar s2 = Math.sin( euler._y / 2 );\r\n\t\tvar s3 = Math.sin( euler._z / 2 );\r\n\r\n\t\tvar order = euler.order;\r\n\r\n\t\tif ( order === 'XYZ' ) {\r\n\r\n\t\t\tthis._x = s1 * c2 * c3 + c1 * s2 * s3;\r\n\t\t\tthis._y = c1 * s2 * c3 - s1 * c2 * s3;\r\n\t\t\tthis._z = c1 * c2 * s3 + s1 * s2 * c3;\r\n\t\t\tthis._w = c1 * c2 * c3 - s1 * s2 * s3;\r\n\r\n\t\t} else if ( order === 'YXZ' ) {\r\n\r\n\t\t\tthis._x = s1 * c2 * c3 + c1 * s2 * s3;\r\n\t\t\tthis._y = c1 * s2 * c3 - s1 * c2 * s3;\r\n\t\t\tthis._z = c1 * c2 * s3 - s1 * s2 * c3;\r\n\t\t\tthis._w = c1 * c2 * c3 + s1 * s2 * s3;\r\n\r\n\t\t} else if ( order === 'ZXY' ) {\r\n\r\n\t\t\tthis._x = s1 * c2 * c3 - c1 * s2 * s3;\r\n\t\t\tthis._y = c1 * s2 * c3 + s1 * c2 * s3;\r\n\t\t\tthis._z = c1 * c2 * s3 + s1 * s2 * c3;\r\n\t\t\tthis._w = c1 * c2 * c3 - s1 * s2 * s3;\r\n\r\n\t\t} else if ( order === 'ZYX' ) {\r\n\r\n\t\t\tthis._x = s1 * c2 * c3 - c1 * s2 * s3;\r\n\t\t\tthis._y = c1 * s2 * c3 + s1 * c2 * s3;\r\n\t\t\tthis._z = c1 * c2 * s3 - s1 * s2 * c3;\r\n\t\t\tthis._w = c1 * c2 * c3 + s1 * s2 * s3;\r\n\r\n\t\t} else if ( order === 'YZX' ) {\r\n\r\n\t\t\tthis._x = s1 * c2 * c3 + c1 * s2 * s3;\r\n\t\t\tthis._y = c1 * s2 * c3 + s1 * c2 * s3;\r\n\t\t\tthis._z = c1 * c2 * s3 - s1 * s2 * c3;\r\n\t\t\tthis._w = c1 * c2 * c3 - s1 * s2 * s3;\r\n\r\n\t\t} else if ( order === 'XZY' ) {\r\n\r\n\t\t\tthis._x = s1 * c2 * c3 - c1 * s2 * s3;\r\n\t\t\tthis._y = c1 * s2 * c3 - s1 * c2 * s3;\r\n\t\t\tthis._z = c1 * c2 * s3 + s1 * s2 * c3;\r\n\t\t\tthis._w = c1 * c2 * c3 + s1 * s2 * s3;\r\n\r\n\t\t}\r\n\r\n\t\tif ( update !== false ) this.onChangeCallback();\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tsetFromAxisAngle: function ( axis, angle ) {\r\n\r\n\t\t// http://www.euclideanspace.com/maths/geometry/rotations/conversions/angleToQuaternion/index.htm\r\n\r\n\t\t// assumes axis is normalized\r\n\r\n\t\tvar halfAngle = angle / 2, s = Math.sin( halfAngle );\r\n\r\n\t\tthis._x = axis.x * s;\r\n\t\tthis._y = axis.y * s;\r\n\t\tthis._z = axis.z * s;\r\n\t\tthis._w = Math.cos( halfAngle );\r\n\r\n\t\tthis.onChangeCallback();\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tsetFromRotationMatrix: function ( m ) {\r\n\r\n\t\t// http://www.euclideanspace.com/maths/geometry/rotations/conversions/matrixToQuaternion/index.htm\r\n\r\n\t\t// assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled)\r\n\r\n\t\tvar te = m.elements,\r\n\r\n\t\t\tm11 = te[ 0 ], m12 = te[ 4 ], m13 = te[ 8 ],\r\n\t\t\tm21 = te[ 1 ], m22 = te[ 5 ], m23 = te[ 9 ],\r\n\t\t\tm31 = te[ 2 ], m32 = te[ 6 ], m33 = te[ 10 ],\r\n\r\n\t\t\ttrace = m11 + m22 + m33,\r\n\t\t\ts;\r\n\r\n\t\tif ( trace > 0 ) {\r\n\r\n\t\t\ts = 0.5 / Math.sqrt( trace + 1.0 );\r\n\r\n\t\t\tthis._w = 0.25 / s;\r\n\t\t\tthis._x = ( m32 - m23 ) * s;\r\n\t\t\tthis._y = ( m13 - m31 ) * s;\r\n\t\t\tthis._z = ( m21 - m12 ) * s;\r\n\r\n\t\t} else if ( m11 > m22 && m11 > m33 ) {\r\n\r\n\t\t\ts = 2.0 * Math.sqrt( 1.0 + m11 - m22 - m33 );\r\n\r\n\t\t\tthis._w = ( m32 - m23 ) / s;\r\n\t\t\tthis._x = 0.25 * s;\r\n\t\t\tthis._y = ( m12 + m21 ) / s;\r\n\t\t\tthis._z = ( m13 + m31 ) / s;\r\n\r\n\t\t} else if ( m22 > m33 ) {\r\n\r\n\t\t\ts = 2.0 * Math.sqrt( 1.0 + m22 - m11 - m33 );\r\n\r\n\t\t\tthis._w = ( m13 - m31 ) / s;\r\n\t\t\tthis._x = ( m12 + m21 ) / s;\r\n\t\t\tthis._y = 0.25 * s;\r\n\t\t\tthis._z = ( m23 + m32 ) / s;\r\n\r\n\t\t} else {\r\n\r\n\t\t\ts = 2.0 * Math.sqrt( 1.0 + m33 - m11 - m22 );\r\n\r\n\t\t\tthis._w = ( m21 - m12 ) / s;\r\n\t\t\tthis._x = ( m13 + m31 ) / s;\r\n\t\t\tthis._y = ( m23 + m32 ) / s;\r\n\t\t\tthis._z = 0.25 * s;\r\n\r\n\t\t}\r\n\r\n\t\tthis.onChangeCallback();\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tsetFromUnitVectors: function () {\r\n\r\n\t\t// http://lolengine.net/blog/2014/02/24/quaternion-from-two-vectors-final\r\n\r\n\t\t// assumes direction vectors vFrom and vTo are normalized\r\n\r\n\t\tvar v1, r;\r\n\r\n\t\tvar EPS = 0.000001;\r\n\r\n\t\treturn function ( vFrom, vTo ) {\r\n\r\n\t\t\tif ( v1 === undefined ) v1 = new THREE.Vector3();\r\n\r\n\t\t\tr = vFrom.dot( vTo ) + 1;\r\n\r\n\t\t\tif ( r < EPS ) {\r\n\r\n\t\t\t\tr = 0;\r\n\r\n\t\t\t\tif ( Math.abs( vFrom.x ) > Math.abs( vFrom.z ) ) {\r\n\r\n\t\t\t\t\tv1.set( - vFrom.y, vFrom.x, 0 );\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\tv1.set( 0, - vFrom.z, vFrom.y );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tv1.crossVectors( vFrom, vTo );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tthis._x = v1.x;\r\n\t\t\tthis._y = v1.y;\r\n\t\t\tthis._z = v1.z;\r\n\t\t\tthis._w = r;\r\n\r\n\t\t\tthis.normalize();\r\n\r\n\t\t\treturn this;\r\n\r\n\t\t}\r\n\r\n\t}(),\r\n\r\n\tinverse: function () {\r\n\r\n\t\tthis.conjugate().normalize();\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tconjugate: function () {\r\n\r\n\t\tthis._x *= - 1;\r\n\t\tthis._y *= - 1;\r\n\t\tthis._z *= - 1;\r\n\r\n\t\tthis.onChangeCallback();\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tdot: function ( v ) {\r\n\r\n\t\treturn this._x * v._x + this._y * v._y + this._z * v._z + this._w * v._w;\r\n\r\n\t},\r\n\r\n\tlengthSq: function () {\r\n\r\n\t\treturn this._x * this._x + this._y * this._y + this._z * this._z + this._w * this._w;\r\n\r\n\t},\r\n\r\n\tlength: function () {\r\n\r\n\t\treturn Math.sqrt( this._x * this._x + this._y * this._y + this._z * this._z + this._w * this._w );\r\n\r\n\t},\r\n\r\n\tnormalize: function () {\r\n\r\n\t\tvar l = this.length();\r\n\r\n\t\tif ( l === 0 ) {\r\n\r\n\t\t\tthis._x = 0;\r\n\t\t\tthis._y = 0;\r\n\t\t\tthis._z = 0;\r\n\t\t\tthis._w = 1;\r\n\r\n\t\t} else {\r\n\r\n\t\t\tl = 1 / l;\r\n\r\n\t\t\tthis._x = this._x * l;\r\n\t\t\tthis._y = this._y * l;\r\n\t\t\tthis._z = this._z * l;\r\n\t\t\tthis._w = this._w * l;\r\n\r\n\t\t}\r\n\r\n\t\tthis.onChangeCallback();\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tmultiply: function ( q, p ) {\r\n\r\n\t\tif ( p !== undefined ) {\r\n\r\n\t\t\tconsole.warn( 'THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead.' );\r\n\t\t\treturn this.multiplyQuaternions( q, p );\r\n\r\n\t\t}\r\n\r\n\t\treturn this.multiplyQuaternions( this, q );\r\n\r\n\t},\r\n\r\n\tmultiplyQuaternions: function ( a, b ) {\r\n\r\n\t\t// from http://www.euclideanspace.com/maths/algebra/realNormedAlgebra/quaternions/code/index.htm\r\n\r\n\t\tvar qax = a._x, qay = a._y, qaz = a._z, qaw = a._w;\r\n\t\tvar qbx = b._x, qby = b._y, qbz = b._z, qbw = b._w;\r\n\r\n\t\tthis._x = qax * qbw + qaw * qbx + qay * qbz - qaz * qby;\r\n\t\tthis._y = qay * qbw + qaw * qby + qaz * qbx - qax * qbz;\r\n\t\tthis._z = qaz * qbw + qaw * qbz + qax * qby - qay * qbx;\r\n\t\tthis._w = qaw * qbw - qax * qbx - qay * qby - qaz * qbz;\r\n\r\n\t\tthis.onChangeCallback();\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tmultiplyVector3: function ( vector ) {\r\n\r\n\t\tconsole.warn( 'THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead.' );\r\n\t\treturn vector.applyQuaternion( this );\r\n\r\n\t},\r\n\r\n\tslerp: function ( qb, t ) {\r\n\r\n\t\tif ( t === 0 ) return this;\r\n\t\tif ( t === 1 ) return this.copy( qb );\r\n\r\n\t\tvar x = this._x, y = this._y, z = this._z, w = this._w;\r\n\r\n\t\t// http://www.euclideanspace.com/maths/algebra/realNormedAlgebra/quaternions/slerp/\r\n\r\n\t\tvar cosHalfTheta = w * qb._w + x * qb._x + y * qb._y + z * qb._z;\r\n\r\n\t\tif ( cosHalfTheta < 0 ) {\r\n\r\n\t\t\tthis._w = - qb._w;\r\n\t\t\tthis._x = - qb._x;\r\n\t\t\tthis._y = - qb._y;\r\n\t\t\tthis._z = - qb._z;\r\n\r\n\t\t\tcosHalfTheta = - cosHalfTheta;\r\n\r\n\t\t} else {\r\n\r\n\t\t\tthis.copy( qb );\r\n\r\n\t\t}\r\n\r\n\t\tif ( cosHalfTheta >= 1.0 ) {\r\n\r\n\t\t\tthis._w = w;\r\n\t\t\tthis._x = x;\r\n\t\t\tthis._y = y;\r\n\t\t\tthis._z = z;\r\n\r\n\t\t\treturn this;\r\n\r\n\t\t}\r\n\r\n\t\tvar halfTheta = Math.acos( cosHalfTheta );\r\n\t\tvar sinHalfTheta = Math.sqrt( 1.0 - cosHalfTheta * cosHalfTheta );\r\n\r\n\t\tif ( Math.abs( sinHalfTheta ) < 0.001 ) {\r\n\r\n\t\t\tthis._w = 0.5 * ( w + this._w );\r\n\t\t\tthis._x = 0.5 * ( x + this._x );\r\n\t\t\tthis._y = 0.5 * ( y + this._y );\r\n\t\t\tthis._z = 0.5 * ( z + this._z );\r\n\r\n\t\t\treturn this;\r\n\r\n\t\t}\r\n\r\n\t\tvar ratioA = Math.sin( ( 1 - t ) * halfTheta ) / sinHalfTheta,\r\n\t\tratioB = Math.sin( t * halfTheta ) / sinHalfTheta;\r\n\r\n\t\tthis._w = ( w * ratioA + this._w * ratioB );\r\n\t\tthis._x = ( x * ratioA + this._x * ratioB );\r\n\t\tthis._y = ( y * ratioA + this._y * ratioB );\r\n\t\tthis._z = ( z * ratioA + this._z * ratioB );\r\n\r\n\t\tthis.onChangeCallback();\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tequals: function ( quaternion ) {\r\n\r\n\t\treturn ( quaternion._x === this._x ) && ( quaternion._y === this._y ) && ( quaternion._z === this._z ) && ( quaternion._w === this._w );\r\n\r\n\t},\r\n\r\n\tfromArray: function ( array, offset ) {\r\n\r\n\t\tif ( offset === undefined ) offset = 0;\r\n\r\n\t\tthis._x = array[ offset ];\r\n\t\tthis._y = array[ offset + 1 ];\r\n\t\tthis._z = array[ offset + 2 ];\r\n\t\tthis._w = array[ offset + 3 ];\r\n\r\n\t\tthis.onChangeCallback();\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\ttoArray: function ( array, offset ) {\r\n\r\n\t\tif ( array === undefined ) array = [];\r\n\t\tif ( offset === undefined ) offset = 0;\r\n\r\n\t\tarray[ offset ] = this._x;\r\n\t\tarray[ offset + 1 ] = this._y;\r\n\t\tarray[ offset + 2 ] = this._z;\r\n\t\tarray[ offset + 3 ] = this._w;\r\n\r\n\t\treturn array;\r\n\r\n\t},\r\n\r\n\tonChange: function ( callback ) {\r\n\r\n\t\tthis.onChangeCallback = callback;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tonChangeCallback: function () {}\r\n\r\n};\r\n\r\nTHREE.Quaternion.slerp = function ( qa, qb, qm, t ) {\r\n\r\n\treturn qm.copy( qa ).slerp( qb, t );\r\n\r\n};\r\n\r\n// File:src/math/Vector2.js\r\n\r\n/**\r\n * @author mrdoob / http://mrdoob.com/\r\n * @author philogb / http://blog.thejit.org/\r\n * @author egraether / http://egraether.com/\r\n * @author zz85 / http://www.lab4games.net/zz85/blog\r\n */\r\n\r\nTHREE.Vector2 = function ( x, y ) {\r\n\r\n\tthis.x = x || 0;\r\n\tthis.y = y || 0;\r\n\r\n};\r\n\r\nTHREE.Vector2.prototype = {\r\n\r\n\tconstructor: THREE.Vector2,\r\n\r\n\tset: function ( x, y ) {\r\n\r\n\t\tthis.x = x;\r\n\t\tthis.y = y;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tsetX: function ( x ) {\r\n\r\n\t\tthis.x = x;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tsetY: function ( y ) {\r\n\r\n\t\tthis.y = y;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tsetComponent: function ( index, value ) {\r\n\r\n\t\tswitch ( index ) {\r\n\r\n\t\t\tcase 0: this.x = value; break;\r\n\t\t\tcase 1: this.y = value; break;\r\n\t\t\tdefault: throw new Error( 'index is out of range: ' + index );\r\n\r\n\t\t}\r\n\r\n\t},\r\n\r\n\tgetComponent: function ( index ) {\r\n\r\n\t\tswitch ( index ) {\r\n\r\n\t\t\tcase 0: return this.x;\r\n\t\t\tcase 1: return this.y;\r\n\t\t\tdefault: throw new Error( 'index is out of range: ' + index );\r\n\r\n\t\t}\r\n\r\n\t},\r\n\r\n\tclone: function () {\r\n\r\n\t\treturn new this.constructor( this.x, this.y );\r\n\r\n\t},\r\n\r\n\tcopy: function ( v ) {\r\n\r\n\t\tthis.x = v.x;\r\n\t\tthis.y = v.y;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tadd: function ( v, w ) {\r\n\r\n\t\tif ( w !== undefined ) {\r\n\r\n\t\t\tconsole.warn( 'THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead.' );\r\n\t\t\treturn this.addVectors( v, w );\r\n\r\n\t\t}\r\n\r\n\t\tthis.x += v.x;\r\n\t\tthis.y += v.y;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\taddScalar: function ( s ) {\r\n\r\n\t\tthis.x += s;\r\n\t\tthis.y += s;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\taddVectors: function ( a, b ) {\r\n\r\n\t\tthis.x = a.x + b.x;\r\n\t\tthis.y = a.y + b.y;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\taddScaledVector: function ( v, s ) {\r\n\r\n\t\tthis.x += v.x * s;\r\n\t\tthis.y += v.y * s;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tsub: function ( v, w ) {\r\n\r\n\t\tif ( w !== undefined ) {\r\n\r\n\t\t\tconsole.warn( 'THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead.' );\r\n\t\t\treturn this.subVectors( v, w );\r\n\r\n\t\t}\r\n\r\n\t\tthis.x -= v.x;\r\n\t\tthis.y -= v.y;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tsubScalar: function ( s ) {\r\n\r\n\t\tthis.x -= s;\r\n\t\tthis.y -= s;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tsubVectors: function ( a, b ) {\r\n\r\n\t\tthis.x = a.x - b.x;\r\n\t\tthis.y = a.y - b.y;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tmultiply: function ( v ) {\r\n\r\n\t\tthis.x *= v.x;\r\n\t\tthis.y *= v.y;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tmultiplyScalar: function ( s ) {\r\n\r\n\t\tthis.x *= s;\r\n\t\tthis.y *= s;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tdivide: function ( v ) {\r\n\r\n\t\tthis.x /= v.x;\r\n\t\tthis.y /= v.y;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tdivideScalar: function ( scalar ) {\r\n\r\n\t\tif ( scalar !== 0 ) {\r\n\r\n\t\t\tvar invScalar = 1 / scalar;\r\n\r\n\t\t\tthis.x *= invScalar;\r\n\t\t\tthis.y *= invScalar;\r\n\r\n\t\t} else {\r\n\r\n\t\t\tthis.x = 0;\r\n\t\t\tthis.y = 0;\r\n\r\n\t\t}\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tmin: function ( v ) {\r\n\r\n\t\tif ( this.x > v.x ) {\r\n\r\n\t\t\tthis.x = v.x;\r\n\r\n\t\t}\r\n\r\n\t\tif ( this.y > v.y ) {\r\n\r\n\t\t\tthis.y = v.y;\r\n\r\n\t\t}\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tmax: function ( v ) {\r\n\r\n\t\tif ( this.x < v.x ) {\r\n\r\n\t\t\tthis.x = v.x;\r\n\r\n\t\t}\r\n\r\n\t\tif ( this.y < v.y ) {\r\n\r\n\t\t\tthis.y = v.y;\r\n\r\n\t\t}\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tclamp: function ( min, max ) {\r\n\r\n\t\t// This function assumes min < max, if this assumption isn't true it will not operate correctly\r\n\r\n\t\tif ( this.x < min.x ) {\r\n\r\n\t\t\tthis.x = min.x;\r\n\r\n\t\t} else if ( this.x > max.x ) {\r\n\r\n\t\t\tthis.x = max.x;\r\n\r\n\t\t}\r\n\r\n\t\tif ( this.y < min.y ) {\r\n\r\n\t\t\tthis.y = min.y;\r\n\r\n\t\t} else if ( this.y > max.y ) {\r\n\r\n\t\t\tthis.y = max.y;\r\n\r\n\t\t}\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tclampScalar: function () {\r\n\r\n\t\tvar min, max;\r\n\r\n\t\treturn function clampScalar( minVal, maxVal ) {\r\n\r\n\t\t\tif ( min === undefined ) {\r\n\r\n\t\t\t\tmin = new THREE.Vector2();\r\n\t\t\t\tmax = new THREE.Vector2();\r\n\r\n\t\t\t}\r\n\r\n\t\t\tmin.set( minVal, minVal );\r\n\t\t\tmax.set( maxVal, maxVal );\r\n\r\n\t\t\treturn this.clamp( min, max );\r\n\r\n\t\t};\r\n\r\n\t}(),\r\n\r\n\tfloor: function () {\r\n\r\n\t\tthis.x = Math.floor( this.x );\r\n\t\tthis.y = Math.floor( this.y );\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tceil: function () {\r\n\r\n\t\tthis.x = Math.ceil( this.x );\r\n\t\tthis.y = Math.ceil( this.y );\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tround: function () {\r\n\r\n\t\tthis.x = Math.round( this.x );\r\n\t\tthis.y = Math.round( this.y );\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\troundToZero: function () {\r\n\r\n\t\tthis.x = ( this.x < 0 ) ? Math.ceil( this.x ) : Math.floor( this.x );\r\n\t\tthis.y = ( this.y < 0 ) ? Math.ceil( this.y ) : Math.floor( this.y );\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tnegate: function () {\r\n\r\n\t\tthis.x = - this.x;\r\n\t\tthis.y = - this.y;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tdot: function ( v ) {\r\n\r\n\t\treturn this.x * v.x + this.y * v.y;\r\n\r\n\t},\r\n\r\n\tlengthSq: function () {\r\n\r\n\t\treturn this.x * this.x + this.y * this.y;\r\n\r\n\t},\r\n\r\n\tlength: function () {\r\n\r\n\t\treturn Math.sqrt( this.x * this.x + this.y * this.y );\r\n\r\n\t},\r\n\r\n\tlengthManhattan: function() {\r\n\r\n\t\treturn Math.abs( this.x ) + Math.abs( this.y );\r\n\r\n\t},\r\n\r\n\tnormalize: function () {\r\n\r\n\t\treturn this.divideScalar( this.length() );\r\n\r\n\t},\r\n\r\n\tdistanceTo: function ( v ) {\r\n\r\n\t\treturn Math.sqrt( this.distanceToSquared( v ) );\r\n\r\n\t},\r\n\r\n\tdistanceToSquared: function ( v ) {\r\n\r\n\t\tvar dx = this.x - v.x, dy = this.y - v.y;\r\n\t\treturn dx * dx + dy * dy;\r\n\r\n\t},\r\n\r\n\tsetLength: function ( l ) {\r\n\r\n\t\tvar oldLength = this.length();\r\n\r\n\t\tif ( oldLength !== 0 && l !== oldLength ) {\r\n\r\n\t\t\tthis.multiplyScalar( l / oldLength );\r\n\r\n\t\t}\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tlerp: function ( v, alpha ) {\r\n\r\n\t\tthis.x += ( v.x - this.x ) * alpha;\r\n\t\tthis.y += ( v.y - this.y ) * alpha;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tlerpVectors: function ( v1, v2, alpha ) {\r\n\r\n\t\tthis.subVectors( v2, v1 ).multiplyScalar( alpha ).add( v1 );\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tequals: function ( v ) {\r\n\r\n\t\treturn ( ( v.x === this.x ) && ( v.y === this.y ) );\r\n\r\n\t},\r\n\r\n\tfromArray: function ( array, offset ) {\r\n\r\n\t\tif ( offset === undefined ) offset = 0;\r\n\r\n\t\tthis.x = array[ offset ];\r\n\t\tthis.y = array[ offset + 1 ];\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\ttoArray: function ( array, offset ) {\r\n\r\n\t\tif ( array === undefined ) array = [];\r\n\t\tif ( offset === undefined ) offset = 0;\r\n\r\n\t\tarray[ offset ] = this.x;\r\n\t\tarray[ offset + 1 ] = this.y;\r\n\r\n\t\treturn array;\r\n\r\n\t},\r\n\r\n\tfromAttribute: function ( attribute, index, offset ) {\r\n\r\n\t\tif ( offset === undefined ) offset = 0;\r\n\r\n\t\tindex = index * attribute.itemSize + offset;\r\n\r\n\t\tthis.x = attribute.array[ index ];\r\n\t\tthis.y = attribute.array[ index + 1 ];\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n};\r\n\r\n// File:src/math/Vector3.js\r\n\r\n/**\r\n * @author mrdoob / http://mrdoob.com/\r\n * @author *kile / http://kile.stravaganza.org/\r\n * @author philogb / http://blog.thejit.org/\r\n * @author mikael emtinger / http://gomo.se/\r\n * @author egraether / http://egraether.com/\r\n * @author WestLangley / http://github.com/WestLangley\r\n */\r\n\r\nTHREE.Vector3 = function ( x, y, z ) {\r\n\r\n\tthis.x = x || 0;\r\n\tthis.y = y || 0;\r\n\tthis.z = z || 0;\r\n\r\n};\r\n\r\nTHREE.Vector3.prototype = {\r\n\r\n\tconstructor: THREE.Vector3,\r\n\r\n\tset: function ( x, y, z ) {\r\n\r\n\t\tthis.x = x;\r\n\t\tthis.y = y;\r\n\t\tthis.z = z;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tsetX: function ( x ) {\r\n\r\n\t\tthis.x = x;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tsetY: function ( y ) {\r\n\r\n\t\tthis.y = y;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tsetZ: function ( z ) {\r\n\r\n\t\tthis.z = z;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tsetComponent: function ( index, value ) {\r\n\r\n\t\tswitch ( index ) {\r\n\r\n\t\t\tcase 0: this.x = value; break;\r\n\t\t\tcase 1: this.y = value; break;\r\n\t\t\tcase 2: this.z = value; break;\r\n\t\t\tdefault: throw new Error( 'index is out of range: ' + index );\r\n\r\n\t\t}\r\n\r\n\t},\r\n\r\n\tgetComponent: function ( index ) {\r\n\r\n\t\tswitch ( index ) {\r\n\r\n\t\t\tcase 0: return this.x;\r\n\t\t\tcase 1: return this.y;\r\n\t\t\tcase 2: return this.z;\r\n\t\t\tdefault: throw new Error( 'index is out of range: ' + index );\r\n\r\n\t\t}\r\n\r\n\t},\r\n\r\n\tclone: function () {\r\n\r\n\t\treturn new this.constructor( this.x, this.y, this.z );\r\n\r\n\t},\r\n\r\n\tcopy: function ( v ) {\r\n\r\n\t\tthis.x = v.x;\r\n\t\tthis.y = v.y;\r\n\t\tthis.z = v.z;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tadd: function ( v, w ) {\r\n\r\n\t\tif ( w !== undefined ) {\r\n\r\n\t\t\tconsole.warn( 'THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead.' );\r\n\t\t\treturn this.addVectors( v, w );\r\n\r\n\t\t}\r\n\r\n\t\tthis.x += v.x;\r\n\t\tthis.y += v.y;\r\n\t\tthis.z += v.z;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\taddScalar: function ( s ) {\r\n\r\n\t\tthis.x += s;\r\n\t\tthis.y += s;\r\n\t\tthis.z += s;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\taddVectors: function ( a, b ) {\r\n\r\n\t\tthis.x = a.x + b.x;\r\n\t\tthis.y = a.y + b.y;\r\n\t\tthis.z = a.z + b.z;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\taddScaledVector: function ( v, s ) {\r\n\r\n\t\tthis.x += v.x * s;\r\n\t\tthis.y += v.y * s;\r\n\t\tthis.z += v.z * s;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tsub: function ( v, w ) {\r\n\r\n\t\tif ( w !== undefined ) {\r\n\r\n\t\t\tconsole.warn( 'THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead.' );\r\n\t\t\treturn this.subVectors( v, w );\r\n\r\n\t\t}\r\n\r\n\t\tthis.x -= v.x;\r\n\t\tthis.y -= v.y;\r\n\t\tthis.z -= v.z;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tsubScalar: function ( s ) {\r\n\r\n\t\tthis.x -= s;\r\n\t\tthis.y -= s;\r\n\t\tthis.z -= s;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tsubVectors: function ( a, b ) {\r\n\r\n\t\tthis.x = a.x - b.x;\r\n\t\tthis.y = a.y - b.y;\r\n\t\tthis.z = a.z - b.z;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tmultiply: function ( v, w ) {\r\n\r\n\t\tif ( w !== undefined ) {\r\n\r\n\t\t\tconsole.warn( 'THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead.' );\r\n\t\t\treturn this.multiplyVectors( v, w );\r\n\r\n\t\t}\r\n\r\n\t\tthis.x *= v.x;\r\n\t\tthis.y *= v.y;\r\n\t\tthis.z *= v.z;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tmultiplyScalar: function ( scalar ) {\r\n\r\n\t\tthis.x *= scalar;\r\n\t\tthis.y *= scalar;\r\n\t\tthis.z *= scalar;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tmultiplyVectors: function ( a, b ) {\r\n\r\n\t\tthis.x = a.x * b.x;\r\n\t\tthis.y = a.y * b.y;\r\n\t\tthis.z = a.z * b.z;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tapplyEuler: function () {\r\n\r\n\t\tvar quaternion;\r\n\r\n\t\treturn function applyEuler( euler ) {\r\n\r\n\t\t\tif ( euler instanceof THREE.Euler === false ) {\r\n\r\n\t\t\t\tconsole.error( 'THREE.Vector3: .applyEuler() now expects a Euler rotation rather than a Vector3 and order.' );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( quaternion === undefined ) quaternion = new THREE.Quaternion();\r\n\r\n\t\t\tthis.applyQuaternion( quaternion.setFromEuler( euler ) );\r\n\r\n\t\t\treturn this;\r\n\r\n\t\t};\r\n\r\n\t}(),\r\n\r\n\tapplyAxisAngle: function () {\r\n\r\n\t\tvar quaternion;\r\n\r\n\t\treturn function applyAxisAngle( axis, angle ) {\r\n\r\n\t\t\tif ( quaternion === undefined ) quaternion = new THREE.Quaternion();\r\n\r\n\t\t\tthis.applyQuaternion( quaternion.setFromAxisAngle( axis, angle ) );\r\n\r\n\t\t\treturn this;\r\n\r\n\t\t};\r\n\r\n\t}(),\r\n\r\n\tapplyMatrix3: function ( m ) {\r\n\r\n\t\tvar x = this.x;\r\n\t\tvar y = this.y;\r\n\t\tvar z = this.z;\r\n\r\n\t\tvar e = m.elements;\r\n\r\n\t\tthis.x = e[ 0 ] * x + e[ 3 ] * y + e[ 6 ] * z;\r\n\t\tthis.y = e[ 1 ] * x + e[ 4 ] * y + e[ 7 ] * z;\r\n\t\tthis.z = e[ 2 ] * x + e[ 5 ] * y + e[ 8 ] * z;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tapplyMatrix4: function ( m ) {\r\n\r\n\t\t// input: THREE.Matrix4 affine matrix\r\n\r\n\t\tvar x = this.x, y = this.y, z = this.z;\r\n\r\n\t\tvar e = m.elements;\r\n\r\n\t\tthis.x = e[ 0 ] * x + e[ 4 ] * y + e[ 8 ] * z + e[ 12 ];\r\n\t\tthis.y = e[ 1 ] * x + e[ 5 ] * y + e[ 9 ] * z + e[ 13 ];\r\n\t\tthis.z = e[ 2 ] * x + e[ 6 ] * y + e[ 10 ] * z + e[ 14 ];\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tapplyProjection: function ( m ) {\r\n\r\n\t\t// input: THREE.Matrix4 projection matrix\r\n\r\n\t\tvar x = this.x, y = this.y, z = this.z;\r\n\r\n\t\tvar e = m.elements;\r\n\t\tvar d = 1 / ( e[ 3 ] * x + e[ 7 ] * y + e[ 11 ] * z + e[ 15 ] ); // perspective divide\r\n\r\n\t\tthis.x = ( e[ 0 ] * x + e[ 4 ] * y + e[ 8 ] * z + e[ 12 ] ) * d;\r\n\t\tthis.y = ( e[ 1 ] * x + e[ 5 ] * y + e[ 9 ] * z + e[ 13 ] ) * d;\r\n\t\tthis.z = ( e[ 2 ] * x + e[ 6 ] * y + e[ 10 ] * z + e[ 14 ] ) * d;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tapplyQuaternion: function ( q ) {\r\n\r\n\t\tvar x = this.x;\r\n\t\tvar y = this.y;\r\n\t\tvar z = this.z;\r\n\r\n\t\tvar qx = q.x;\r\n\t\tvar qy = q.y;\r\n\t\tvar qz = q.z;\r\n\t\tvar qw = q.w;\r\n\r\n\t\t// calculate quat * vector\r\n\r\n\t\tvar ix = qw * x + qy * z - qz * y;\r\n\t\tvar iy = qw * y + qz * x - qx * z;\r\n\t\tvar iz = qw * z + qx * y - qy * x;\r\n\t\tvar iw = - qx * x - qy * y - qz * z;\r\n\r\n\t\t// calculate result * inverse quat\r\n\r\n\t\tthis.x = ix * qw + iw * - qx + iy * - qz - iz * - qy;\r\n\t\tthis.y = iy * qw + iw * - qy + iz * - qx - ix * - qz;\r\n\t\tthis.z = iz * qw + iw * - qz + ix * - qy - iy * - qx;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tproject: function () {\r\n\r\n\t\tvar matrix;\r\n\r\n\t\treturn function project( camera ) {\r\n\r\n\t\t\tif ( matrix === undefined ) matrix = new THREE.Matrix4();\r\n\r\n\t\t\tmatrix.multiplyMatrices( camera.projectionMatrix, matrix.getInverse( camera.matrixWorld ) );\r\n\t\t\treturn this.applyProjection( matrix );\r\n\r\n\t\t};\r\n\r\n\t}(),\r\n\r\n\tunproject: function () {\r\n\r\n\t\tvar matrix;\r\n\r\n\t\treturn function unproject( camera ) {\r\n\r\n\t\t\tif ( matrix === undefined ) matrix = new THREE.Matrix4();\r\n\r\n\t\t\tmatrix.multiplyMatrices( camera.matrixWorld, matrix.getInverse( camera.projectionMatrix ) );\r\n\t\t\treturn this.applyProjection( matrix );\r\n\r\n\t\t};\r\n\r\n\t}(),\r\n\r\n\ttransformDirection: function ( m ) {\r\n\r\n\t\t// input: THREE.Matrix4 affine matrix\r\n\t\t// vector interpreted as a direction\r\n\r\n\t\tvar x = this.x, y = this.y, z = this.z;\r\n\r\n\t\tvar e = m.elements;\r\n\r\n\t\tthis.x = e[ 0 ] * x + e[ 4 ] * y + e[ 8 ] * z;\r\n\t\tthis.y = e[ 1 ] * x + e[ 5 ] * y + e[ 9 ] * z;\r\n\t\tthis.z = e[ 2 ] * x + e[ 6 ] * y + e[ 10 ] * z;\r\n\r\n\t\tthis.normalize();\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tdivide: function ( v ) {\r\n\r\n\t\tthis.x /= v.x;\r\n\t\tthis.y /= v.y;\r\n\t\tthis.z /= v.z;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tdivideScalar: function ( scalar ) {\r\n\r\n\t\tif ( scalar !== 0 ) {\r\n\r\n\t\t\tvar invScalar = 1 / scalar;\r\n\r\n\t\t\tthis.x *= invScalar;\r\n\t\t\tthis.y *= invScalar;\r\n\t\t\tthis.z *= invScalar;\r\n\r\n\t\t} else {\r\n\r\n\t\t\tthis.x = 0;\r\n\t\t\tthis.y = 0;\r\n\t\t\tthis.z = 0;\r\n\r\n\t\t}\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tmin: function ( v ) {\r\n\r\n\t\tif ( this.x > v.x ) {\r\n\r\n\t\t\tthis.x = v.x;\r\n\r\n\t\t}\r\n\r\n\t\tif ( this.y > v.y ) {\r\n\r\n\t\t\tthis.y = v.y;\r\n\r\n\t\t}\r\n\r\n\t\tif ( this.z > v.z ) {\r\n\r\n\t\t\tthis.z = v.z;\r\n\r\n\t\t}\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tmax: function ( v ) {\r\n\r\n\t\tif ( this.x < v.x ) {\r\n\r\n\t\t\tthis.x = v.x;\r\n\r\n\t\t}\r\n\r\n\t\tif ( this.y < v.y ) {\r\n\r\n\t\t\tthis.y = v.y;\r\n\r\n\t\t}\r\n\r\n\t\tif ( this.z < v.z ) {\r\n\r\n\t\t\tthis.z = v.z;\r\n\r\n\t\t}\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tclamp: function ( min, max ) {\r\n\r\n\t\t// This function assumes min < max, if this assumption isn't true it will not operate correctly\r\n\r\n\t\tif ( this.x < min.x ) {\r\n\r\n\t\t\tthis.x = min.x;\r\n\r\n\t\t} else if ( this.x > max.x ) {\r\n\r\n\t\t\tthis.x = max.x;\r\n\r\n\t\t}\r\n\r\n\t\tif ( this.y < min.y ) {\r\n\r\n\t\t\tthis.y = min.y;\r\n\r\n\t\t} else if ( this.y > max.y ) {\r\n\r\n\t\t\tthis.y = max.y;\r\n\r\n\t\t}\r\n\r\n\t\tif ( this.z < min.z ) {\r\n\r\n\t\t\tthis.z = min.z;\r\n\r\n\t\t} else if ( this.z > max.z ) {\r\n\r\n\t\t\tthis.z = max.z;\r\n\r\n\t\t}\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tclampScalar: function () {\r\n\r\n\t\tvar min, max;\r\n\r\n\t\treturn function clampScalar( minVal, maxVal ) {\r\n\r\n\t\t\tif ( min === undefined ) {\r\n\r\n\t\t\t\tmin = new THREE.Vector3();\r\n\t\t\t\tmax = new THREE.Vector3();\r\n\r\n\t\t\t}\r\n\r\n\t\t\tmin.set( minVal, minVal, minVal );\r\n\t\t\tmax.set( maxVal, maxVal, maxVal );\r\n\r\n\t\t\treturn this.clamp( min, max );\r\n\r\n\t\t};\r\n\r\n\t}(),\r\n\r\n\tfloor: function () {\r\n\r\n\t\tthis.x = Math.floor( this.x );\r\n\t\tthis.y = Math.floor( this.y );\r\n\t\tthis.z = Math.floor( this.z );\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tceil: function () {\r\n\r\n\t\tthis.x = Math.ceil( this.x );\r\n\t\tthis.y = Math.ceil( this.y );\r\n\t\tthis.z = Math.ceil( this.z );\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tround: function () {\r\n\r\n\t\tthis.x = Math.round( this.x );\r\n\t\tthis.y = Math.round( this.y );\r\n\t\tthis.z = Math.round( this.z );\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\troundToZero: function () {\r\n\r\n\t\tthis.x = ( this.x < 0 ) ? Math.ceil( this.x ) : Math.floor( this.x );\r\n\t\tthis.y = ( this.y < 0 ) ? Math.ceil( this.y ) : Math.floor( this.y );\r\n\t\tthis.z = ( this.z < 0 ) ? Math.ceil( this.z ) : Math.floor( this.z );\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tnegate: function () {\r\n\r\n\t\tthis.x = - this.x;\r\n\t\tthis.y = - this.y;\r\n\t\tthis.z = - this.z;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tdot: function ( v ) {\r\n\r\n\t\treturn this.x * v.x + this.y * v.y + this.z * v.z;\r\n\r\n\t},\r\n\r\n\tlengthSq: function () {\r\n\r\n\t\treturn this.x * this.x + this.y * this.y + this.z * this.z;\r\n\r\n\t},\r\n\r\n\tlength: function () {\r\n\r\n\t\treturn Math.sqrt( this.x * this.x + this.y * this.y + this.z * this.z );\r\n\r\n\t},\r\n\r\n\tlengthManhattan: function () {\r\n\r\n\t\treturn Math.abs( this.x ) + Math.abs( this.y ) + Math.abs( this.z );\r\n\r\n\t},\r\n\r\n\tnormalize: function () {\r\n\r\n\t\treturn this.divideScalar( this.length() );\r\n\r\n\t},\r\n\r\n\tsetLength: function ( l ) {\r\n\r\n\t\tvar oldLength = this.length();\r\n\r\n\t\tif ( oldLength !== 0 && l !== oldLength ) {\r\n\r\n\t\t\tthis.multiplyScalar( l / oldLength );\r\n\r\n\t\t}\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tlerp: function ( v, alpha ) {\r\n\r\n\t\tthis.x += ( v.x - this.x ) * alpha;\r\n\t\tthis.y += ( v.y - this.y ) * alpha;\r\n\t\tthis.z += ( v.z - this.z ) * alpha;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tlerpVectors: function ( v1, v2, alpha ) {\r\n\r\n\t\tthis.subVectors( v2, v1 ).multiplyScalar( alpha ).add( v1 );\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tcross: function ( v, w ) {\r\n\r\n\t\tif ( w !== undefined ) {\r\n\r\n\t\t\tconsole.warn( 'THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead.' );\r\n\t\t\treturn this.crossVectors( v, w );\r\n\r\n\t\t}\r\n\r\n\t\tvar x = this.x, y = this.y, z = this.z;\r\n\r\n\t\tthis.x = y * v.z - z * v.y;\r\n\t\tthis.y = z * v.x - x * v.z;\r\n\t\tthis.z = x * v.y - y * v.x;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tcrossVectors: function ( a, b ) {\r\n\r\n\t\tvar ax = a.x, ay = a.y, az = a.z;\r\n\t\tvar bx = b.x, by = b.y, bz = b.z;\r\n\r\n\t\tthis.x = ay * bz - az * by;\r\n\t\tthis.y = az * bx - ax * bz;\r\n\t\tthis.z = ax * by - ay * bx;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tprojectOnVector: function () {\r\n\r\n\t\tvar v1, dot;\r\n\r\n\t\treturn function projectOnVector( vector ) {\r\n\r\n\t\t\tif ( v1 === undefined ) v1 = new THREE.Vector3();\r\n\r\n\t\t\tv1.copy( vector ).normalize();\r\n\r\n\t\t\tdot = this.dot( v1 );\r\n\r\n\t\t\treturn this.copy( v1 ).multiplyScalar( dot );\r\n\r\n\t\t};\r\n\r\n\t}(),\r\n\r\n\tprojectOnPlane: function () {\r\n\r\n\t\tvar v1;\r\n\r\n\t\treturn function projectOnPlane( planeNormal ) {\r\n\r\n\t\t\tif ( v1 === undefined ) v1 = new THREE.Vector3();\r\n\r\n\t\t\tv1.copy( this ).projectOnVector( planeNormal );\r\n\r\n\t\t\treturn this.sub( v1 );\r\n\r\n\t\t}\r\n\r\n\t}(),\r\n\r\n\treflect: function () {\r\n\r\n\t\t// reflect incident vector off plane orthogonal to normal\r\n\t\t// normal is assumed to have unit length\r\n\r\n\t\tvar v1;\r\n\r\n\t\treturn function reflect( normal ) {\r\n\r\n\t\t\tif ( v1 === undefined ) v1 = new THREE.Vector3();\r\n\r\n\t\t\treturn this.sub( v1.copy( normal ).multiplyScalar( 2 * this.dot( normal ) ) );\r\n\r\n\t\t}\r\n\r\n\t}(),\r\n\r\n\tangleTo: function ( v ) {\r\n\r\n\t\tvar theta = this.dot( v ) / ( this.length() * v.length() );\r\n\r\n\t\t// clamp, to handle numerical problems\r\n\r\n\t\treturn Math.acos( THREE.Math.clamp( theta, - 1, 1 ) );\r\n\r\n\t},\r\n\r\n\tdistanceTo: function ( v ) {\r\n\r\n\t\treturn Math.sqrt( this.distanceToSquared( v ) );\r\n\r\n\t},\r\n\r\n\tdistanceToSquared: function ( v ) {\r\n\r\n\t\tvar dx = this.x - v.x;\r\n\t\tvar dy = this.y - v.y;\r\n\t\tvar dz = this.z - v.z;\r\n\r\n\t\treturn dx * dx + dy * dy + dz * dz;\r\n\r\n\t},\r\n\r\n\tsetEulerFromRotationMatrix: function ( m, order ) {\r\n\r\n\t\tconsole.error( 'THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.' );\r\n\r\n\t},\r\n\r\n\tsetEulerFromQuaternion: function ( q, order ) {\r\n\r\n\t\tconsole.error( 'THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.' );\r\n\r\n\t},\r\n\r\n\tgetPositionFromMatrix: function ( m ) {\r\n\r\n\t\tconsole.warn( 'THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition().' );\r\n\r\n\t\treturn this.setFromMatrixPosition( m );\r\n\r\n\t},\r\n\r\n\tgetScaleFromMatrix: function ( m ) {\r\n\r\n\t\tconsole.warn( 'THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale().' );\r\n\r\n\t\treturn this.setFromMatrixScale( m );\r\n\r\n\t},\r\n\r\n\tgetColumnFromMatrix: function ( index, matrix ) {\r\n\r\n\t\tconsole.warn( 'THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn().' );\r\n\r\n\t\treturn this.setFromMatrixColumn( index, matrix );\r\n\r\n\t},\r\n\r\n\tsetFromMatrixPosition: function ( m ) {\r\n\r\n\t\tthis.x = m.elements[ 12 ];\r\n\t\tthis.y = m.elements[ 13 ];\r\n\t\tthis.z = m.elements[ 14 ];\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tsetFromMatrixScale: function ( m ) {\r\n\r\n\t\tvar sx = this.set( m.elements[ 0 ], m.elements[ 1 ], m.elements[ 2 ] ).length();\r\n\t\tvar sy = this.set( m.elements[ 4 ], m.elements[ 5 ], m.elements[ 6 ] ).length();\r\n\t\tvar sz = this.set( m.elements[ 8 ], m.elements[ 9 ], m.elements[ 10 ] ).length();\r\n\r\n\t\tthis.x = sx;\r\n\t\tthis.y = sy;\r\n\t\tthis.z = sz;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tsetFromMatrixColumn: function ( index, matrix ) {\r\n\r\n\t\tvar offset = index * 4;\r\n\r\n\t\tvar me = matrix.elements;\r\n\r\n\t\tthis.x = me[ offset ];\r\n\t\tthis.y = me[ offset + 1 ];\r\n\t\tthis.z = me[ offset + 2 ];\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tequals: function ( v ) {\r\n\r\n\t\treturn ( ( v.x === this.x ) && ( v.y === this.y ) && ( v.z === this.z ) );\r\n\r\n\t},\r\n\r\n\tfromArray: function ( array, offset ) {\r\n\r\n\t\tif ( offset === undefined ) offset = 0;\r\n\r\n\t\tthis.x = array[ offset ];\r\n\t\tthis.y = array[ offset + 1 ];\r\n\t\tthis.z = array[ offset + 2 ];\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\ttoArray: function ( array, offset ) {\r\n\r\n\t\tif ( array === undefined ) array = [];\r\n\t\tif ( offset === undefined ) offset = 0;\r\n\r\n\t\tarray[ offset ] = this.x;\r\n\t\tarray[ offset + 1 ] = this.y;\r\n\t\tarray[ offset + 2 ] = this.z;\r\n\r\n\t\treturn array;\r\n\r\n\t},\r\n\r\n\tfromAttribute: function ( attribute, index, offset ) {\r\n\r\n\t\tif ( offset === undefined ) offset = 0;\r\n\r\n\t\tindex = index * attribute.itemSize + offset;\r\n\r\n\t\tthis.x = attribute.array[ index ];\r\n\t\tthis.y = attribute.array[ index + 1 ];\r\n\t\tthis.z = attribute.array[ index + 2 ];\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n};\r\n\r\n// File:src/math/Vector4.js\r\n\r\n/**\r\n * @author supereggbert / http://www.paulbrunt.co.uk/\r\n * @author philogb / http://blog.thejit.org/\r\n * @author mikael emtinger / http://gomo.se/\r\n * @author egraether / http://egraether.com/\r\n * @author WestLangley / http://github.com/WestLangley\r\n */\r\n\r\nTHREE.Vector4 = function ( x, y, z, w ) {\r\n\r\n\tthis.x = x || 0;\r\n\tthis.y = y || 0;\r\n\tthis.z = z || 0;\r\n\tthis.w = ( w !== undefined ) ? w : 1;\r\n\r\n};\r\n\r\nTHREE.Vector4.prototype = {\r\n\r\n\tconstructor: THREE.Vector4,\r\n\r\n\tset: function ( x, y, z, w ) {\r\n\r\n\t\tthis.x = x;\r\n\t\tthis.y = y;\r\n\t\tthis.z = z;\r\n\t\tthis.w = w;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tsetX: function ( x ) {\r\n\r\n\t\tthis.x = x;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tsetY: function ( y ) {\r\n\r\n\t\tthis.y = y;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tsetZ: function ( z ) {\r\n\r\n\t\tthis.z = z;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tsetW: function ( w ) {\r\n\r\n\t\tthis.w = w;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tsetComponent: function ( index, value ) {\r\n\r\n\t\tswitch ( index ) {\r\n\r\n\t\t\tcase 0: this.x = value; break;\r\n\t\t\tcase 1: this.y = value; break;\r\n\t\t\tcase 2: this.z = value; break;\r\n\t\t\tcase 3: this.w = value; break;\r\n\t\t\tdefault: throw new Error( 'index is out of range: ' + index );\r\n\r\n\t\t}\r\n\r\n\t},\r\n\r\n\tgetComponent: function ( index ) {\r\n\r\n\t\tswitch ( index ) {\r\n\r\n\t\t\tcase 0: return this.x;\r\n\t\t\tcase 1: return this.y;\r\n\t\t\tcase 2: return this.z;\r\n\t\t\tcase 3: return this.w;\r\n\t\t\tdefault: throw new Error( 'index is out of range: ' + index );\r\n\r\n\t\t}\r\n\r\n\t},\r\n\r\n\tclone: function () {\r\n\r\n\t\treturn new this.constructor( this.x, this.y, this.z, this.w );\r\n\r\n\t},\r\n\r\n\tcopy: function ( v ) {\r\n\r\n\t\tthis.x = v.x;\r\n\t\tthis.y = v.y;\r\n\t\tthis.z = v.z;\r\n\t\tthis.w = ( v.w !== undefined ) ? v.w : 1;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tadd: function ( v, w ) {\r\n\r\n\t\tif ( w !== undefined ) {\r\n\r\n\t\t\tconsole.warn( 'THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead.' );\r\n\t\t\treturn this.addVectors( v, w );\r\n\r\n\t\t}\r\n\r\n\t\tthis.x += v.x;\r\n\t\tthis.y += v.y;\r\n\t\tthis.z += v.z;\r\n\t\tthis.w += v.w;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\taddScalar: function ( s ) {\r\n\r\n\t\tthis.x += s;\r\n\t\tthis.y += s;\r\n\t\tthis.z += s;\r\n\t\tthis.w += s;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\taddVectors: function ( a, b ) {\r\n\r\n\t\tthis.x = a.x + b.x;\r\n\t\tthis.y = a.y + b.y;\r\n\t\tthis.z = a.z + b.z;\r\n\t\tthis.w = a.w + b.w;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\taddScaledVector: function ( v, s ) {\r\n\r\n\t\tthis.x += v.x * s;\r\n\t\tthis.y += v.y * s;\r\n\t\tthis.z += v.z * s;\r\n\t\tthis.w += v.w * s;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tsub: function ( v, w ) {\r\n\r\n\t\tif ( w !== undefined ) {\r\n\r\n\t\t\tconsole.warn( 'THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead.' );\r\n\t\t\treturn this.subVectors( v, w );\r\n\r\n\t\t}\r\n\r\n\t\tthis.x -= v.x;\r\n\t\tthis.y -= v.y;\r\n\t\tthis.z -= v.z;\r\n\t\tthis.w -= v.w;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tsubScalar: function ( s ) {\r\n\r\n\t\tthis.x -= s;\r\n\t\tthis.y -= s;\r\n\t\tthis.z -= s;\r\n\t\tthis.w -= s;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tsubVectors: function ( a, b ) {\r\n\r\n\t\tthis.x = a.x - b.x;\r\n\t\tthis.y = a.y - b.y;\r\n\t\tthis.z = a.z - b.z;\r\n\t\tthis.w = a.w - b.w;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tmultiplyScalar: function ( scalar ) {\r\n\r\n\t\tthis.x *= scalar;\r\n\t\tthis.y *= scalar;\r\n\t\tthis.z *= scalar;\r\n\t\tthis.w *= scalar;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tapplyMatrix4: function ( m ) {\r\n\r\n\t\tvar x = this.x;\r\n\t\tvar y = this.y;\r\n\t\tvar z = this.z;\r\n\t\tvar w = this.w;\r\n\r\n\t\tvar e = m.elements;\r\n\r\n\t\tthis.x = e[ 0 ] * x + e[ 4 ] * y + e[ 8 ] * z + e[ 12 ] * w;\r\n\t\tthis.y = e[ 1 ] * x + e[ 5 ] * y + e[ 9 ] * z + e[ 13 ] * w;\r\n\t\tthis.z = e[ 2 ] * x + e[ 6 ] * y + e[ 10 ] * z + e[ 14 ] * w;\r\n\t\tthis.w = e[ 3 ] * x + e[ 7 ] * y + e[ 11 ] * z + e[ 15 ] * w;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tdivideScalar: function ( scalar ) {\r\n\r\n\t\tif ( scalar !== 0 ) {\r\n\r\n\t\t\tvar invScalar = 1 / scalar;\r\n\r\n\t\t\tthis.x *= invScalar;\r\n\t\t\tthis.y *= invScalar;\r\n\t\t\tthis.z *= invScalar;\r\n\t\t\tthis.w *= invScalar;\r\n\r\n\t\t} else {\r\n\r\n\t\t\tthis.x = 0;\r\n\t\t\tthis.y = 0;\r\n\t\t\tthis.z = 0;\r\n\t\t\tthis.w = 1;\r\n\r\n\t\t}\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tsetAxisAngleFromQuaternion: function ( q ) {\r\n\r\n\t\t// http://www.euclideanspace.com/maths/geometry/rotations/conversions/quaternionToAngle/index.htm\r\n\r\n\t\t// q is assumed to be normalized\r\n\r\n\t\tthis.w = 2 * Math.acos( q.w );\r\n\r\n\t\tvar s = Math.sqrt( 1 - q.w * q.w );\r\n\r\n\t\tif ( s < 0.0001 ) {\r\n\r\n\t\t\t this.x = 1;\r\n\t\t\t this.y = 0;\r\n\t\t\t this.z = 0;\r\n\r\n\t\t} else {\r\n\r\n\t\t\t this.x = q.x / s;\r\n\t\t\t this.y = q.y / s;\r\n\t\t\t this.z = q.z / s;\r\n\r\n\t\t}\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tsetAxisAngleFromRotationMatrix: function ( m ) {\r\n\r\n\t\t// http://www.euclideanspace.com/maths/geometry/rotations/conversions/matrixToAngle/index.htm\r\n\r\n\t\t// assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled)\r\n\r\n\t\tvar angle, x, y, z,\t\t// variables for result\r\n\t\t\tepsilon = 0.01,\t\t// margin to allow for rounding errors\r\n\t\t\tepsilon2 = 0.1,\t\t// margin to distinguish between 0 and 180 degrees\r\n\r\n\t\t\tte = m.elements,\r\n\r\n\t\t\tm11 = te[ 0 ], m12 = te[ 4 ], m13 = te[ 8 ],\r\n\t\t\tm21 = te[ 1 ], m22 = te[ 5 ], m23 = te[ 9 ],\r\n\t\t\tm31 = te[ 2 ], m32 = te[ 6 ], m33 = te[ 10 ];\r\n\r\n\t\tif ( ( Math.abs( m12 - m21 ) < epsilon )\r\n\t\t && ( Math.abs( m13 - m31 ) < epsilon )\r\n\t\t && ( Math.abs( m23 - m32 ) < epsilon ) ) {\r\n\r\n\t\t\t// singularity found\r\n\t\t\t// first check for identity matrix which must have +1 for all terms\r\n\t\t\t// in leading diagonal and zero in other terms\r\n\r\n\t\t\tif ( ( Math.abs( m12 + m21 ) < epsilon2 )\r\n\t\t\t && ( Math.abs( m13 + m31 ) < epsilon2 )\r\n\t\t\t && ( Math.abs( m23 + m32 ) < epsilon2 )\r\n\t\t\t && ( Math.abs( m11 + m22 + m33 - 3 ) < epsilon2 ) ) {\r\n\r\n\t\t\t\t// this singularity is identity matrix so angle = 0\r\n\r\n\t\t\t\tthis.set( 1, 0, 0, 0 );\r\n\r\n\t\t\t\treturn this; // zero angle, arbitrary axis\r\n\r\n\t\t\t}\r\n\r\n\t\t\t// otherwise this singularity is angle = 180\r\n\r\n\t\t\tangle = Math.PI;\r\n\r\n\t\t\tvar xx = ( m11 + 1 ) / 2;\r\n\t\t\tvar yy = ( m22 + 1 ) / 2;\r\n\t\t\tvar zz = ( m33 + 1 ) / 2;\r\n\t\t\tvar xy = ( m12 + m21 ) / 4;\r\n\t\t\tvar xz = ( m13 + m31 ) / 4;\r\n\t\t\tvar yz = ( m23 + m32 ) / 4;\r\n\r\n\t\t\tif ( ( xx > yy ) && ( xx > zz ) ) {\r\n\r\n\t\t\t\t// m11 is the largest diagonal term\r\n\r\n\t\t\t\tif ( xx < epsilon ) {\r\n\r\n\t\t\t\t\tx = 0;\r\n\t\t\t\t\ty = 0.707106781;\r\n\t\t\t\t\tz = 0.707106781;\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\tx = Math.sqrt( xx );\r\n\t\t\t\t\ty = xy / x;\r\n\t\t\t\t\tz = xz / x;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t} else if ( yy > zz ) {\r\n\r\n\t\t\t\t// m22 is the largest diagonal term\r\n\r\n\t\t\t\tif ( yy < epsilon ) {\r\n\r\n\t\t\t\t\tx = 0.707106781;\r\n\t\t\t\t\ty = 0;\r\n\t\t\t\t\tz = 0.707106781;\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\ty = Math.sqrt( yy );\r\n\t\t\t\t\tx = xy / y;\r\n\t\t\t\t\tz = yz / y;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\t// m33 is the largest diagonal term so base result on this\r\n\r\n\t\t\t\tif ( zz < epsilon ) {\r\n\r\n\t\t\t\t\tx = 0.707106781;\r\n\t\t\t\t\ty = 0.707106781;\r\n\t\t\t\t\tz = 0;\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\tz = Math.sqrt( zz );\r\n\t\t\t\t\tx = xz / z;\r\n\t\t\t\t\ty = yz / z;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\tthis.set( x, y, z, angle );\r\n\r\n\t\t\treturn this; // return 180 deg rotation\r\n\r\n\t\t}\r\n\r\n\t\t// as we have reached here there are no singularities so we can handle normally\r\n\r\n\t\tvar s = Math.sqrt( ( m32 - m23 ) * ( m32 - m23 )\r\n\t\t\t\t\t\t + ( m13 - m31 ) * ( m13 - m31 )\r\n\t\t\t\t\t\t + ( m21 - m12 ) * ( m21 - m12 ) ); // used to normalize\r\n\r\n\t\tif ( Math.abs( s ) < 0.001 ) s = 1;\r\n\r\n\t\t// prevent divide by zero, should not happen if matrix is orthogonal and should be\r\n\t\t// caught by singularity test above, but I've left it in just in case\r\n\r\n\t\tthis.x = ( m32 - m23 ) / s;\r\n\t\tthis.y = ( m13 - m31 ) / s;\r\n\t\tthis.z = ( m21 - m12 ) / s;\r\n\t\tthis.w = Math.acos( ( m11 + m22 + m33 - 1 ) / 2 );\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tmin: function ( v ) {\r\n\r\n\t\tif ( this.x > v.x ) {\r\n\r\n\t\t\tthis.x = v.x;\r\n\r\n\t\t}\r\n\r\n\t\tif ( this.y > v.y ) {\r\n\r\n\t\t\tthis.y = v.y;\r\n\r\n\t\t}\r\n\r\n\t\tif ( this.z > v.z ) {\r\n\r\n\t\t\tthis.z = v.z;\r\n\r\n\t\t}\r\n\r\n\t\tif ( this.w > v.w ) {\r\n\r\n\t\t\tthis.w = v.w;\r\n\r\n\t\t}\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tmax: function ( v ) {\r\n\r\n\t\tif ( this.x < v.x ) {\r\n\r\n\t\t\tthis.x = v.x;\r\n\r\n\t\t}\r\n\r\n\t\tif ( this.y < v.y ) {\r\n\r\n\t\t\tthis.y = v.y;\r\n\r\n\t\t}\r\n\r\n\t\tif ( this.z < v.z ) {\r\n\r\n\t\t\tthis.z = v.z;\r\n\r\n\t\t}\r\n\r\n\t\tif ( this.w < v.w ) {\r\n\r\n\t\t\tthis.w = v.w;\r\n\r\n\t\t}\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tclamp: function ( min, max ) {\r\n\r\n\t\t// This function assumes min < max, if this assumption isn't true it will not operate correctly\r\n\r\n\t\tif ( this.x < min.x ) {\r\n\r\n\t\t\tthis.x = min.x;\r\n\r\n\t\t} else if ( this.x > max.x ) {\r\n\r\n\t\t\tthis.x = max.x;\r\n\r\n\t\t}\r\n\r\n\t\tif ( this.y < min.y ) {\r\n\r\n\t\t\tthis.y = min.y;\r\n\r\n\t\t} else if ( this.y > max.y ) {\r\n\r\n\t\t\tthis.y = max.y;\r\n\r\n\t\t}\r\n\r\n\t\tif ( this.z < min.z ) {\r\n\r\n\t\t\tthis.z = min.z;\r\n\r\n\t\t} else if ( this.z > max.z ) {\r\n\r\n\t\t\tthis.z = max.z;\r\n\r\n\t\t}\r\n\r\n\t\tif ( this.w < min.w ) {\r\n\r\n\t\t\tthis.w = min.w;\r\n\r\n\t\t} else if ( this.w > max.w ) {\r\n\r\n\t\t\tthis.w = max.w;\r\n\r\n\t\t}\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tclampScalar: function () {\r\n\r\n\t\tvar min, max;\r\n\r\n\t\treturn function clampScalar( minVal, maxVal ) {\r\n\r\n\t\t\tif ( min === undefined ) {\r\n\r\n\t\t\t\tmin = new THREE.Vector4();\r\n\t\t\t\tmax = new THREE.Vector4();\r\n\r\n\t\t\t}\r\n\r\n\t\t\tmin.set( minVal, minVal, minVal, minVal );\r\n\t\t\tmax.set( maxVal, maxVal, maxVal, maxVal );\r\n\r\n\t\t\treturn this.clamp( min, max );\r\n\r\n\t\t};\r\n\r\n\t}(),\r\n\r\n\tfloor: function () {\r\n\r\n\t\tthis.x = Math.floor( this.x );\r\n\t\tthis.y = Math.floor( this.y );\r\n\t\tthis.z = Math.floor( this.z );\r\n\t\tthis.w = Math.floor( this.w );\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tceil: function () {\r\n\r\n\t\tthis.x = Math.ceil( this.x );\r\n\t\tthis.y = Math.ceil( this.y );\r\n\t\tthis.z = Math.ceil( this.z );\r\n\t\tthis.w = Math.ceil( this.w );\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tround: function () {\r\n\r\n\t\tthis.x = Math.round( this.x );\r\n\t\tthis.y = Math.round( this.y );\r\n\t\tthis.z = Math.round( this.z );\r\n\t\tthis.w = Math.round( this.w );\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\troundToZero: function () {\r\n\r\n\t\tthis.x = ( this.x < 0 ) ? Math.ceil( this.x ) : Math.floor( this.x );\r\n\t\tthis.y = ( this.y < 0 ) ? Math.ceil( this.y ) : Math.floor( this.y );\r\n\t\tthis.z = ( this.z < 0 ) ? Math.ceil( this.z ) : Math.floor( this.z );\r\n\t\tthis.w = ( this.w < 0 ) ? Math.ceil( this.w ) : Math.floor( this.w );\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tnegate: function () {\r\n\r\n\t\tthis.x = - this.x;\r\n\t\tthis.y = - this.y;\r\n\t\tthis.z = - this.z;\r\n\t\tthis.w = - this.w;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tdot: function ( v ) {\r\n\r\n\t\treturn this.x * v.x + this.y * v.y + this.z * v.z + this.w * v.w;\r\n\r\n\t},\r\n\r\n\tlengthSq: function () {\r\n\r\n\t\treturn this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w;\r\n\r\n\t},\r\n\r\n\tlength: function () {\r\n\r\n\t\treturn Math.sqrt( this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w );\r\n\r\n\t},\r\n\r\n\tlengthManhattan: function () {\r\n\r\n\t\treturn Math.abs( this.x ) + Math.abs( this.y ) + Math.abs( this.z ) + Math.abs( this.w );\r\n\r\n\t},\r\n\r\n\tnormalize: function () {\r\n\r\n\t\treturn this.divideScalar( this.length() );\r\n\r\n\t},\r\n\r\n\tsetLength: function ( l ) {\r\n\r\n\t\tvar oldLength = this.length();\r\n\r\n\t\tif ( oldLength !== 0 && l !== oldLength ) {\r\n\r\n\t\t\tthis.multiplyScalar( l / oldLength );\r\n\r\n\t\t}\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tlerp: function ( v, alpha ) {\r\n\r\n\t\tthis.x += ( v.x - this.x ) * alpha;\r\n\t\tthis.y += ( v.y - this.y ) * alpha;\r\n\t\tthis.z += ( v.z - this.z ) * alpha;\r\n\t\tthis.w += ( v.w - this.w ) * alpha;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tlerpVectors: function ( v1, v2, alpha ) {\r\n\r\n\t\tthis.subVectors( v2, v1 ).multiplyScalar( alpha ).add( v1 );\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tequals: function ( v ) {\r\n\r\n\t\treturn ( ( v.x === this.x ) && ( v.y === this.y ) && ( v.z === this.z ) && ( v.w === this.w ) );\r\n\r\n\t},\r\n\r\n\tfromArray: function ( array, offset ) {\r\n\r\n\t\tif ( offset === undefined ) offset = 0;\r\n\r\n\t\tthis.x = array[ offset ];\r\n\t\tthis.y = array[ offset + 1 ];\r\n\t\tthis.z = array[ offset + 2 ];\r\n\t\tthis.w = array[ offset + 3 ];\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\ttoArray: function ( array, offset ) {\r\n\r\n\t\tif ( array === undefined ) array = [];\r\n\t\tif ( offset === undefined ) offset = 0;\r\n\r\n\t\tarray[ offset ] = this.x;\r\n\t\tarray[ offset + 1 ] = this.y;\r\n\t\tarray[ offset + 2 ] = this.z;\r\n\t\tarray[ offset + 3 ] = this.w;\r\n\r\n\t\treturn array;\r\n\r\n\t},\r\n\r\n\tfromAttribute: function ( attribute, index, offset ) {\r\n\r\n\t\tif ( offset === undefined ) offset = 0;\r\n\r\n\t\tindex = index * attribute.itemSize + offset;\r\n\r\n\t\tthis.x = attribute.array[ index ];\r\n\t\tthis.y = attribute.array[ index + 1 ];\r\n\t\tthis.z = attribute.array[ index + 2 ];\r\n\t\tthis.w = attribute.array[ index + 3 ];\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n};\r\n\r\n// File:src/math/Euler.js\r\n\r\n/**\r\n * @author mrdoob / http://mrdoob.com/\r\n * @author WestLangley / http://github.com/WestLangley\r\n * @author bhouston / http://exocortex.com\r\n */\r\n\r\nTHREE.Euler = function ( x, y, z, order ) {\r\n\r\n\tthis._x = x || 0;\r\n\tthis._y = y || 0;\r\n\tthis._z = z || 0;\r\n\tthis._order = order || THREE.Euler.DefaultOrder;\r\n\r\n};\r\n\r\nTHREE.Euler.RotationOrders = [ 'XYZ', 'YZX', 'ZXY', 'XZY', 'YXZ', 'ZYX' ];\r\n\r\nTHREE.Euler.DefaultOrder = 'XYZ';\r\n\r\nTHREE.Euler.prototype = {\r\n\r\n\tconstructor: THREE.Euler,\r\n\r\n\tget x () {\r\n\r\n\t\treturn this._x;\r\n\r\n\t},\r\n\r\n\tset x ( value ) {\r\n\r\n\t\tthis._x = value;\r\n\t\tthis.onChangeCallback();\r\n\r\n\t},\r\n\r\n\tget y () {\r\n\r\n\t\treturn this._y;\r\n\r\n\t},\r\n\r\n\tset y ( value ) {\r\n\r\n\t\tthis._y = value;\r\n\t\tthis.onChangeCallback();\r\n\r\n\t},\r\n\r\n\tget z () {\r\n\r\n\t\treturn this._z;\r\n\r\n\t},\r\n\r\n\tset z ( value ) {\r\n\r\n\t\tthis._z = value;\r\n\t\tthis.onChangeCallback();\r\n\r\n\t},\r\n\r\n\tget order () {\r\n\r\n\t\treturn this._order;\r\n\r\n\t},\r\n\r\n\tset order ( value ) {\r\n\r\n\t\tthis._order = value;\r\n\t\tthis.onChangeCallback();\r\n\r\n\t},\r\n\r\n\tset: function ( x, y, z, order ) {\r\n\r\n\t\tthis._x = x;\r\n\t\tthis._y = y;\r\n\t\tthis._z = z;\r\n\t\tthis._order = order || this._order;\r\n\r\n\t\tthis.onChangeCallback();\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tclone: function () {\r\n\r\n\t\treturn new this.constructor( this._x, this._y, this._z, this._order);\r\n\r\n\t},\r\n\r\n\tcopy: function ( euler ) {\r\n\r\n\t\tthis._x = euler._x;\r\n\t\tthis._y = euler._y;\r\n\t\tthis._z = euler._z;\r\n\t\tthis._order = euler._order;\r\n\r\n\t\tthis.onChangeCallback();\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tsetFromRotationMatrix: function ( m, order, update ) {\r\n\r\n\t\tvar clamp = THREE.Math.clamp;\r\n\r\n\t\t// assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled)\r\n\r\n\t\tvar te = m.elements;\r\n\t\tvar m11 = te[ 0 ], m12 = te[ 4 ], m13 = te[ 8 ];\r\n\t\tvar m21 = te[ 1 ], m22 = te[ 5 ], m23 = te[ 9 ];\r\n\t\tvar m31 = te[ 2 ], m32 = te[ 6 ], m33 = te[ 10 ];\r\n\r\n\t\torder = order || this._order;\r\n\r\n\t\tif ( order === 'XYZ' ) {\r\n\r\n\t\t\tthis._y = Math.asin( clamp( m13, - 1, 1 ) );\r\n\r\n\t\t\tif ( Math.abs( m13 ) < 0.99999 ) {\r\n\r\n\t\t\t\tthis._x = Math.atan2( - m23, m33 );\r\n\t\t\t\tthis._z = Math.atan2( - m12, m11 );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tthis._x = Math.atan2( m32, m22 );\r\n\t\t\t\tthis._z = 0;\r\n\r\n\t\t\t}\r\n\r\n\t\t} else if ( order === 'YXZ' ) {\r\n\r\n\t\t\tthis._x = Math.asin( - clamp( m23, - 1, 1 ) );\r\n\r\n\t\t\tif ( Math.abs( m23 ) < 0.99999 ) {\r\n\r\n\t\t\t\tthis._y = Math.atan2( m13, m33 );\r\n\t\t\t\tthis._z = Math.atan2( m21, m22 );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tthis._y = Math.atan2( - m31, m11 );\r\n\t\t\t\tthis._z = 0;\r\n\r\n\t\t\t}\r\n\r\n\t\t} else if ( order === 'ZXY' ) {\r\n\r\n\t\t\tthis._x = Math.asin( clamp( m32, - 1, 1 ) );\r\n\r\n\t\t\tif ( Math.abs( m32 ) < 0.99999 ) {\r\n\r\n\t\t\t\tthis._y = Math.atan2( - m31, m33 );\r\n\t\t\t\tthis._z = Math.atan2( - m12, m22 );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tthis._y = 0;\r\n\t\t\t\tthis._z = Math.atan2( m21, m11 );\r\n\r\n\t\t\t}\r\n\r\n\t\t} else if ( order === 'ZYX' ) {\r\n\r\n\t\t\tthis._y = Math.asin( - clamp( m31, - 1, 1 ) );\r\n\r\n\t\t\tif ( Math.abs( m31 ) < 0.99999 ) {\r\n\r\n\t\t\t\tthis._x = Math.atan2( m32, m33 );\r\n\t\t\t\tthis._z = Math.atan2( m21, m11 );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tthis._x = 0;\r\n\t\t\t\tthis._z = Math.atan2( - m12, m22 );\r\n\r\n\t\t\t}\r\n\r\n\t\t} else if ( order === 'YZX' ) {\r\n\r\n\t\t\tthis._z = Math.asin( clamp( m21, - 1, 1 ) );\r\n\r\n\t\t\tif ( Math.abs( m21 ) < 0.99999 ) {\r\n\r\n\t\t\t\tthis._x = Math.atan2( - m23, m22 );\r\n\t\t\t\tthis._y = Math.atan2( - m31, m11 );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tthis._x = 0;\r\n\t\t\t\tthis._y = Math.atan2( m13, m33 );\r\n\r\n\t\t\t}\r\n\r\n\t\t} else if ( order === 'XZY' ) {\r\n\r\n\t\t\tthis._z = Math.asin( - clamp( m12, - 1, 1 ) );\r\n\r\n\t\t\tif ( Math.abs( m12 ) < 0.99999 ) {\r\n\r\n\t\t\t\tthis._x = Math.atan2( m32, m22 );\r\n\t\t\t\tthis._y = Math.atan2( m13, m11 );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tthis._x = Math.atan2( - m23, m33 );\r\n\t\t\t\tthis._y = 0;\r\n\r\n\t\t\t}\r\n\r\n\t\t} else {\r\n\r\n\t\t\tconsole.warn( 'THREE.Euler: .setFromRotationMatrix() given unsupported order: ' + order )\r\n\r\n\t\t}\r\n\r\n\t\tthis._order = order;\r\n\r\n\t\tif ( update !== false ) this.onChangeCallback();\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tsetFromQuaternion: function () {\r\n\r\n\t\tvar matrix;\r\n\r\n\t\treturn function ( q, order, update ) {\r\n\r\n\t\t\tif ( matrix === undefined ) matrix = new THREE.Matrix4();\r\n\t\t\tmatrix.makeRotationFromQuaternion( q );\r\n\t\t\tthis.setFromRotationMatrix( matrix, order, update );\r\n\r\n\t\t\treturn this;\r\n\r\n\t\t};\r\n\r\n\t}(),\r\n\r\n\tsetFromVector3: function ( v, order ) {\r\n\r\n\t\treturn this.set( v.x, v.y, v.z, order || this._order );\r\n\r\n\t},\r\n\r\n\treorder: function () {\r\n\r\n\t\t// WARNING: this discards revolution information -bhouston\r\n\r\n\t\tvar q = new THREE.Quaternion();\r\n\r\n\t\treturn function ( newOrder ) {\r\n\r\n\t\t\tq.setFromEuler( this );\r\n\t\t\tthis.setFromQuaternion( q, newOrder );\r\n\r\n\t\t};\r\n\r\n\t}(),\r\n\r\n\tequals: function ( euler ) {\r\n\r\n\t\treturn ( euler._x === this._x ) && ( euler._y === this._y ) && ( euler._z === this._z ) && ( euler._order === this._order );\r\n\r\n\t},\r\n\r\n\tfromArray: function ( array ) {\r\n\r\n\t\tthis._x = array[ 0 ];\r\n\t\tthis._y = array[ 1 ];\r\n\t\tthis._z = array[ 2 ];\r\n\t\tif ( array[ 3 ] !== undefined ) this._order = array[ 3 ];\r\n\r\n\t\tthis.onChangeCallback();\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\ttoArray: function ( array, offset ) {\r\n\r\n\t\tif ( array === undefined ) array = [];\r\n\t\tif ( offset === undefined ) offset = 0;\r\n\r\n\t\tarray[ offset ] = this._x;\r\n\t\tarray[ offset + 1 ] = this._y;\r\n\t\tarray[ offset + 2 ] = this._z;\r\n\t\tarray[ offset + 3 ] = this._order;\r\n\r\n\t\treturn array;\r\n\r\n\t},\r\n\r\n\ttoVector3: function ( optionalResult ) {\r\n\r\n\t\tif ( optionalResult ) {\r\n\r\n\t\t\treturn optionalResult.set( this._x, this._y, this._z );\r\n\r\n\t\t} else {\r\n\r\n\t\t\treturn new THREE.Vector3( this._x, this._y, this._z );\r\n\r\n\t\t}\r\n\r\n\t},\r\n\r\n\tonChange: function ( callback ) {\r\n\r\n\t\tthis.onChangeCallback = callback;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tonChangeCallback: function () {}\r\n\r\n};\r\n\r\n// File:src/math/Line3.js\r\n\r\n/**\r\n * @author bhouston / http://exocortex.com\r\n */\r\n\r\nTHREE.Line3 = function ( start, end ) {\r\n\r\n\tthis.start = ( start !== undefined ) ? start : new THREE.Vector3();\r\n\tthis.end = ( end !== undefined ) ? end : new THREE.Vector3();\r\n\r\n};\r\n\r\nTHREE.Line3.prototype = {\r\n\r\n\tconstructor: THREE.Line3,\r\n\r\n\tset: function ( start, end ) {\r\n\r\n\t\tthis.start.copy( start );\r\n\t\tthis.end.copy( end );\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tclone: function () {\r\n\r\n\t\treturn new this.constructor().copy( this );\r\n\r\n\t},\r\n\r\n\tcopy: function ( line ) {\r\n\r\n\t\tthis.start.copy( line.start );\r\n\t\tthis.end.copy( line.end );\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tcenter: function ( optionalTarget ) {\r\n\r\n\t\tvar result = optionalTarget || new THREE.Vector3();\r\n\t\treturn result.addVectors( this.start, this.end ).multiplyScalar( 0.5 );\r\n\r\n\t},\r\n\r\n\tdelta: function ( optionalTarget ) {\r\n\r\n\t\tvar result = optionalTarget || new THREE.Vector3();\r\n\t\treturn result.subVectors( this.end, this.start );\r\n\r\n\t},\r\n\r\n\tdistanceSq: function () {\r\n\r\n\t\treturn this.start.distanceToSquared( this.end );\r\n\r\n\t},\r\n\r\n\tdistance: function () {\r\n\r\n\t\treturn this.start.distanceTo( this.end );\r\n\r\n\t},\r\n\r\n\tat: function ( t, optionalTarget ) {\r\n\r\n\t\tvar result = optionalTarget || new THREE.Vector3();\r\n\r\n\t\treturn this.delta( result ).multiplyScalar( t ).add( this.start );\r\n\r\n\t},\r\n\r\n\tclosestPointToPointParameter: function () {\r\n\r\n\t\tvar startP = new THREE.Vector3();\r\n\t\tvar startEnd = new THREE.Vector3();\r\n\r\n\t\treturn function ( point, clampToLine ) {\r\n\r\n\t\t\tstartP.subVectors( point, this.start );\r\n\t\t\tstartEnd.subVectors( this.end, this.start );\r\n\r\n\t\t\tvar startEnd2 = startEnd.dot( startEnd );\r\n\t\t\tvar startEnd_startP = startEnd.dot( startP );\r\n\r\n\t\t\tvar t = startEnd_startP / startEnd2;\r\n\r\n\t\t\tif ( clampToLine ) {\r\n\r\n\t\t\t\tt = THREE.Math.clamp( t, 0, 1 );\r\n\r\n\t\t\t}\r\n\r\n\t\t\treturn t;\r\n\r\n\t\t};\r\n\r\n\t}(),\r\n\r\n\tclosestPointToPoint: function ( point, clampToLine, optionalTarget ) {\r\n\r\n\t\tvar t = this.closestPointToPointParameter( point, clampToLine );\r\n\r\n\t\tvar result = optionalTarget || new THREE.Vector3();\r\n\r\n\t\treturn this.delta( result ).multiplyScalar( t ).add( this.start );\r\n\r\n\t},\r\n\r\n\tapplyMatrix4: function ( matrix ) {\r\n\r\n\t\tthis.start.applyMatrix4( matrix );\r\n\t\tthis.end.applyMatrix4( matrix );\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tequals: function ( line ) {\r\n\r\n\t\treturn line.start.equals( this.start ) && line.end.equals( this.end );\r\n\r\n\t}\r\n\r\n};\r\n\r\n// File:src/math/Box2.js\r\n\r\n/**\r\n * @author bhouston / http://exocortex.com\r\n */\r\n\r\nTHREE.Box2 = function ( min, max ) {\r\n\r\n\tthis.min = ( min !== undefined ) ? min : new THREE.Vector2( Infinity, Infinity );\r\n\tthis.max = ( max !== undefined ) ? max : new THREE.Vector2( - Infinity, - Infinity );\r\n\r\n};\r\n\r\nTHREE.Box2.prototype = {\r\n\r\n\tconstructor: THREE.Box2,\r\n\r\n\tset: function ( min, max ) {\r\n\r\n\t\tthis.min.copy( min );\r\n\t\tthis.max.copy( max );\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tsetFromPoints: function ( points ) {\r\n\r\n\t\tthis.makeEmpty();\r\n\r\n\t\tfor ( var i = 0, il = points.length; i < il; i ++ ) {\r\n\r\n\t\t\tthis.expandByPoint( points[ i ] )\r\n\r\n\t\t}\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tsetFromCenterAndSize: function () {\r\n\r\n\t\tvar v1 = new THREE.Vector2();\r\n\r\n\t\treturn function ( center, size ) {\r\n\r\n\t\t\tvar halfSize = v1.copy( size ).multiplyScalar( 0.5 );\r\n\t\t\tthis.min.copy( center ).sub( halfSize );\r\n\t\t\tthis.max.copy( center ).add( halfSize );\r\n\r\n\t\t\treturn this;\r\n\r\n\t\t};\r\n\r\n\t}(),\r\n\t\r\n\tclone: function () {\r\n\r\n\t\treturn new this.constructor().copy( this );\r\n\r\n\t},\r\n\r\n\tcopy: function ( box ) {\r\n\r\n\t\tthis.min.copy( box.min );\r\n\t\tthis.max.copy( box.max );\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tmakeEmpty: function () {\r\n\r\n\t\tthis.min.x = this.min.y = Infinity;\r\n\t\tthis.max.x = this.max.y = - Infinity;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tempty: function () {\r\n\r\n\t\t// this is a more robust check for empty than ( volume <= 0 ) because volume can get positive with two negative axes\r\n\r\n\t\treturn ( this.max.x < this.min.x ) || ( this.max.y < this.min.y );\r\n\r\n\t},\r\n\r\n\tcenter: function ( optionalTarget ) {\r\n\r\n\t\tvar result = optionalTarget || new THREE.Vector2();\r\n\t\treturn result.addVectors( this.min, this.max ).multiplyScalar( 0.5 );\r\n\r\n\t},\r\n\r\n\tsize: function ( optionalTarget ) {\r\n\r\n\t\tvar result = optionalTarget || new THREE.Vector2();\r\n\t\treturn result.subVectors( this.max, this.min );\r\n\r\n\t},\r\n\r\n\texpandByPoint: function ( point ) {\r\n\r\n\t\tthis.min.min( point );\r\n\t\tthis.max.max( point );\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\texpandByVector: function ( vector ) {\r\n\r\n\t\tthis.min.sub( vector );\r\n\t\tthis.max.add( vector );\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\texpandByScalar: function ( scalar ) {\r\n\r\n\t\tthis.min.addScalar( - scalar );\r\n\t\tthis.max.addScalar( scalar );\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tcontainsPoint: function ( point ) {\r\n\r\n\t\tif ( point.x < this.min.x || point.x > this.max.x ||\r\n\t\t point.y < this.min.y || point.y > this.max.y ) {\r\n\r\n\t\t\treturn false;\r\n\r\n\t\t}\r\n\r\n\t\treturn true;\r\n\r\n\t},\r\n\r\n\tcontainsBox: function ( box ) {\r\n\r\n\t\tif ( ( this.min.x <= box.min.x ) && ( box.max.x <= this.max.x ) &&\r\n\t\t ( this.min.y <= box.min.y ) && ( box.max.y <= this.max.y ) ) {\r\n\r\n\t\t\treturn true;\r\n\r\n\t\t}\r\n\r\n\t\treturn false;\r\n\r\n\t},\r\n\r\n\tgetParameter: function ( point, optionalTarget ) {\r\n\r\n\t\t// This can potentially have a divide by zero if the box\r\n\t\t// has a size dimension of 0.\r\n\r\n\t\tvar result = optionalTarget || new THREE.Vector2();\r\n\r\n\t\treturn result.set(\r\n\t\t\t( point.x - this.min.x ) / ( this.max.x - this.min.x ),\r\n\t\t\t( point.y - this.min.y ) / ( this.max.y - this.min.y )\r\n\t\t);\r\n\r\n\t},\r\n\r\n\tisIntersectionBox: function ( box ) {\r\n\r\n\t\t// using 6 splitting planes to rule out intersections.\r\n\r\n\t\tif ( box.max.x < this.min.x || box.min.x > this.max.x ||\r\n\t\t box.max.y < this.min.y || box.min.y > this.max.y ) {\r\n\r\n\t\t\treturn false;\r\n\r\n\t\t}\r\n\r\n\t\treturn true;\r\n\r\n\t},\r\n\r\n\tclampPoint: function ( point, optionalTarget ) {\r\n\r\n\t\tvar result = optionalTarget || new THREE.Vector2();\r\n\t\treturn result.copy( point ).clamp( this.min, this.max );\r\n\r\n\t},\r\n\r\n\tdistanceToPoint: function () {\r\n\r\n\t\tvar v1 = new THREE.Vector2();\r\n\r\n\t\treturn function ( point ) {\r\n\r\n\t\t\tvar clampedPoint = v1.copy( point ).clamp( this.min, this.max );\r\n\t\t\treturn clampedPoint.sub( point ).length();\r\n\r\n\t\t};\r\n\r\n\t}(),\r\n\r\n\tintersect: function ( box ) {\r\n\r\n\t\tthis.min.max( box.min );\r\n\t\tthis.max.min( box.max );\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tunion: function ( box ) {\r\n\r\n\t\tthis.min.min( box.min );\r\n\t\tthis.max.max( box.max );\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\ttranslate: function ( offset ) {\r\n\r\n\t\tthis.min.add( offset );\r\n\t\tthis.max.add( offset );\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tequals: function ( box ) {\r\n\r\n\t\treturn box.min.equals( this.min ) && box.max.equals( this.max );\r\n\r\n\t}\r\n\r\n};\r\n\r\n// File:src/math/Box3.js\r\n\r\n/**\r\n * @author bhouston / http://exocortex.com\r\n * @author WestLangley / http://github.com/WestLangley\r\n */\r\n\r\nTHREE.Box3 = function ( min, max ) {\r\n\r\n\tthis.min = ( min !== undefined ) ? min : new THREE.Vector3( Infinity, Infinity, Infinity );\r\n\tthis.max = ( max !== undefined ) ? max : new THREE.Vector3( - Infinity, - Infinity, - Infinity );\r\n\r\n};\r\n\r\nTHREE.Box3.prototype = {\r\n\r\n\tconstructor: THREE.Box3,\r\n\r\n\tset: function ( min, max ) {\r\n\r\n\t\tthis.min.copy( min );\r\n\t\tthis.max.copy( max );\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tsetFromPoints: function ( points ) {\r\n\r\n\t\tthis.makeEmpty();\r\n\r\n\t\tfor ( var i = 0, il = points.length; i < il; i ++ ) {\r\n\r\n\t\t\tthis.expandByPoint( points[ i ] );\r\n\r\n\t\t}\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tsetFromCenterAndSize: function () {\r\n\r\n\t\tvar v1 = new THREE.Vector3();\r\n\r\n\t\treturn function ( center, size ) {\r\n\r\n\t\t\tvar halfSize = v1.copy( size ).multiplyScalar( 0.5 );\r\n\r\n\t\t\tthis.min.copy( center ).sub( halfSize );\r\n\t\t\tthis.max.copy( center ).add( halfSize );\r\n\r\n\t\t\treturn this;\r\n\r\n\t\t};\r\n\r\n\t}(),\r\n\r\n\tsetFromObject: function () {\r\n\r\n\t\t// Computes the world-axis-aligned bounding box of an object (including its children),\r\n\t\t// accounting for both the object's, and children's, world transforms\r\n\r\n\t\tvar v1 = new THREE.Vector3();\r\n\r\n\t\treturn function ( object ) {\r\n\r\n\t\t\tvar scope = this;\r\n\r\n\t\t\tobject.updateMatrixWorld( true );\r\n\r\n\t\t\tthis.makeEmpty();\r\n\r\n\t\t\tobject.traverse( function ( node ) {\r\n\r\n\t\t\t\tvar geometry = node.geometry;\r\n\r\n\t\t\t\tif ( geometry !== undefined ) {\r\n\r\n\t\t\t\t\tif ( geometry instanceof THREE.Geometry ) {\r\n\r\n\t\t\t\t\t\tvar vertices = geometry.vertices;\r\n\r\n\t\t\t\t\t\tfor ( var i = 0, il = vertices.length; i < il; i ++ ) {\r\n\r\n\t\t\t\t\t\t\tv1.copy( vertices[ i ] );\r\n\r\n\t\t\t\t\t\t\tv1.applyMatrix4( node.matrixWorld );\r\n\r\n\t\t\t\t\t\t\tscope.expandByPoint( v1 );\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t} else if ( geometry instanceof THREE.BufferGeometry && geometry.attributes[ 'position' ] !== undefined ) {\r\n\r\n\t\t\t\t\t\tvar positions = geometry.attributes[ 'position' ].array;\r\n\r\n\t\t\t\t\t\tfor ( var i = 0, il = positions.length; i < il; i += 3 ) {\r\n\r\n\t\t\t\t\t\t\tv1.set( positions[ i ], positions[ i + 1 ], positions[ i + 2 ] );\r\n\r\n\t\t\t\t\t\t\tv1.applyMatrix4( node.matrixWorld );\r\n\r\n\t\t\t\t\t\t\tscope.expandByPoint( v1 );\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t} );\r\n\r\n\t\t\treturn this;\r\n\r\n\t\t};\r\n\r\n\t}(),\r\n\r\n\tclone: function () {\r\n\r\n\t\treturn new this.constructor().copy( this );\r\n\r\n\t},\r\n\r\n\tcopy: function ( box ) {\r\n\r\n\t\tthis.min.copy( box.min );\r\n\t\tthis.max.copy( box.max );\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tmakeEmpty: function () {\r\n\r\n\t\tthis.min.x = this.min.y = this.min.z = Infinity;\r\n\t\tthis.max.x = this.max.y = this.max.z = - Infinity;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tempty: function () {\r\n\r\n\t\t// this is a more robust check for empty than ( volume <= 0 ) because volume can get positive with two negative axes\r\n\r\n\t\treturn ( this.max.x < this.min.x ) || ( this.max.y < this.min.y ) || ( this.max.z < this.min.z );\r\n\r\n\t},\r\n\r\n\tcenter: function ( optionalTarget ) {\r\n\r\n\t\tvar result = optionalTarget || new THREE.Vector3();\r\n\t\treturn result.addVectors( this.min, this.max ).multiplyScalar( 0.5 );\r\n\r\n\t},\r\n\r\n\tsize: function ( optionalTarget ) {\r\n\r\n\t\tvar result = optionalTarget || new THREE.Vector3();\r\n\t\treturn result.subVectors( this.max, this.min );\r\n\r\n\t},\r\n\r\n\texpandByPoint: function ( point ) {\r\n\r\n\t\tthis.min.min( point );\r\n\t\tthis.max.max( point );\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\texpandByVector: function ( vector ) {\r\n\r\n\t\tthis.min.sub( vector );\r\n\t\tthis.max.add( vector );\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\texpandByScalar: function ( scalar ) {\r\n\r\n\t\tthis.min.addScalar( - scalar );\r\n\t\tthis.max.addScalar( scalar );\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tcontainsPoint: function ( point ) {\r\n\r\n\t\tif ( point.x < this.min.x || point.x > this.max.x ||\r\n\t\t point.y < this.min.y || point.y > this.max.y ||\r\n\t\t point.z < this.min.z || point.z > this.max.z ) {\r\n\r\n\t\t\treturn false;\r\n\r\n\t\t}\r\n\r\n\t\treturn true;\r\n\r\n\t},\r\n\r\n\tcontainsBox: function ( box ) {\r\n\r\n\t\tif ( ( this.min.x <= box.min.x ) && ( box.max.x <= this.max.x ) &&\r\n\t\t\t ( this.min.y <= box.min.y ) && ( box.max.y <= this.max.y ) &&\r\n\t\t\t ( this.min.z <= box.min.z ) && ( box.max.z <= this.max.z ) ) {\r\n\r\n\t\t\treturn true;\r\n\r\n\t\t}\r\n\r\n\t\treturn false;\r\n\r\n\t},\r\n\r\n\tgetParameter: function ( point, optionalTarget ) {\r\n\r\n\t\t// This can potentially have a divide by zero if the box\r\n\t\t// has a size dimension of 0.\r\n\r\n\t\tvar result = optionalTarget || new THREE.Vector3();\r\n\r\n\t\treturn result.set(\r\n\t\t\t( point.x - this.min.x ) / ( this.max.x - this.min.x ),\r\n\t\t\t( point.y - this.min.y ) / ( this.max.y - this.min.y ),\r\n\t\t\t( point.z - this.min.z ) / ( this.max.z - this.min.z )\r\n\t\t);\r\n\r\n\t},\r\n\r\n\tisIntersectionBox: function ( box ) {\r\n\r\n\t\t// using 6 splitting planes to rule out intersections.\r\n\r\n\t\tif ( box.max.x < this.min.x || box.min.x > this.max.x ||\r\n\t\t box.max.y < this.min.y || box.min.y > this.max.y ||\r\n\t\t box.max.z < this.min.z || box.min.z > this.max.z ) {\r\n\r\n\t\t\treturn false;\r\n\r\n\t\t}\r\n\r\n\t\treturn true;\r\n\r\n\t},\r\n\r\n\tclampPoint: function ( point, optionalTarget ) {\r\n\r\n\t\tvar result = optionalTarget || new THREE.Vector3();\r\n\t\treturn result.copy( point ).clamp( this.min, this.max );\r\n\r\n\t},\r\n\r\n\tdistanceToPoint: function () {\r\n\r\n\t\tvar v1 = new THREE.Vector3();\r\n\r\n\t\treturn function ( point ) {\r\n\r\n\t\t\tvar clampedPoint = v1.copy( point ).clamp( this.min, this.max );\r\n\t\t\treturn clampedPoint.sub( point ).length();\r\n\r\n\t\t};\r\n\r\n\t}(),\r\n\r\n\tgetBoundingSphere: function () {\r\n\r\n\t\tvar v1 = new THREE.Vector3();\r\n\r\n\t\treturn function ( optionalTarget ) {\r\n\r\n\t\t\tvar result = optionalTarget || new THREE.Sphere();\r\n\r\n\t\t\tresult.center = this.center();\r\n\t\t\tresult.radius = this.size( v1 ).length() * 0.5;\r\n\r\n\t\t\treturn result;\r\n\r\n\t\t};\r\n\r\n\t}(),\r\n\r\n\tintersect: function ( box ) {\r\n\r\n\t\tthis.min.max( box.min );\r\n\t\tthis.max.min( box.max );\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tunion: function ( box ) {\r\n\r\n\t\tthis.min.min( box.min );\r\n\t\tthis.max.max( box.max );\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tapplyMatrix4: function () {\r\n\r\n\t\tvar points = [\r\n\t\t\tnew THREE.Vector3(),\r\n\t\t\tnew THREE.Vector3(),\r\n\t\t\tnew THREE.Vector3(),\r\n\t\t\tnew THREE.Vector3(),\r\n\t\t\tnew THREE.Vector3(),\r\n\t\t\tnew THREE.Vector3(),\r\n\t\t\tnew THREE.Vector3(),\r\n\t\t\tnew THREE.Vector3()\r\n\t\t];\r\n\r\n\t\treturn function ( matrix ) {\r\n\r\n\t\t\t// NOTE: I am using a binary pattern to specify all 2^3 combinations below\r\n\t\t\tpoints[ 0 ].set( this.min.x, this.min.y, this.min.z ).applyMatrix4( matrix ); // 000\r\n\t\t\tpoints[ 1 ].set( this.min.x, this.min.y, this.max.z ).applyMatrix4( matrix ); // 001\r\n\t\t\tpoints[ 2 ].set( this.min.x, this.max.y, this.min.z ).applyMatrix4( matrix ); // 010\r\n\t\t\tpoints[ 3 ].set( this.min.x, this.max.y, this.max.z ).applyMatrix4( matrix ); // 011\r\n\t\t\tpoints[ 4 ].set( this.max.x, this.min.y, this.min.z ).applyMatrix4( matrix ); // 100\r\n\t\t\tpoints[ 5 ].set( this.max.x, this.min.y, this.max.z ).applyMatrix4( matrix ); // 101\r\n\t\t\tpoints[ 6 ].set( this.max.x, this.max.y, this.min.z ).applyMatrix4( matrix ); // 110\r\n\t\t\tpoints[ 7 ].set( this.max.x, this.max.y, this.max.z ).applyMatrix4( matrix ); // 111\r\n\r\n\t\t\tthis.makeEmpty();\r\n\t\t\tthis.setFromPoints( points );\r\n\r\n\t\t\treturn this;\r\n\r\n\t\t};\r\n\r\n\t}(),\r\n\r\n\ttranslate: function ( offset ) {\r\n\r\n\t\tthis.min.add( offset );\r\n\t\tthis.max.add( offset );\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tequals: function ( box ) {\r\n\r\n\t\treturn box.min.equals( this.min ) && box.max.equals( this.max );\r\n\r\n\t}\r\n\r\n};\r\n\r\n// File:src/math/Matrix3.js\r\n\r\n/**\r\n * @author alteredq / http://alteredqualia.com/\r\n * @author WestLangley / http://github.com/WestLangley\r\n * @author bhouston / http://exocortex.com\r\n */\r\n\r\nTHREE.Matrix3 = function () {\r\n\r\n\tthis.elements = new Float32Array( [\r\n\r\n\t\t1, 0, 0,\r\n\t\t0, 1, 0,\r\n\t\t0, 0, 1\r\n\r\n\t] );\r\n\r\n\tif ( arguments.length > 0 ) {\r\n\r\n\t\tconsole.error( 'THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.' );\r\n\r\n\t}\r\n\r\n};\r\n\r\nTHREE.Matrix3.prototype = {\r\n\r\n\tconstructor: THREE.Matrix3,\r\n\r\n\tset: function ( n11, n12, n13, n21, n22, n23, n31, n32, n33 ) {\r\n\r\n\t\tvar te = this.elements;\r\n\r\n\t\tte[ 0 ] = n11; te[ 3 ] = n12; te[ 6 ] = n13;\r\n\t\tte[ 1 ] = n21; te[ 4 ] = n22; te[ 7 ] = n23;\r\n\t\tte[ 2 ] = n31; te[ 5 ] = n32; te[ 8 ] = n33;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tidentity: function () {\r\n\r\n\t\tthis.set(\r\n\r\n\t\t\t1, 0, 0,\r\n\t\t\t0, 1, 0,\r\n\t\t\t0, 0, 1\r\n\r\n\t\t);\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tclone: function () {\r\n\r\n\t\treturn new this.constructor().fromArray( this.elements );\r\n\r\n\t},\r\n\r\n\tcopy: function ( m ) {\r\n\r\n\t\tvar me = m.elements;\r\n\r\n\t\tthis.set(\r\n\r\n\t\t\tme[ 0 ], me[ 3 ], me[ 6 ],\r\n\t\t\tme[ 1 ], me[ 4 ], me[ 7 ],\r\n\t\t\tme[ 2 ], me[ 5 ], me[ 8 ]\r\n\r\n\t\t);\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tmultiplyVector3: function ( vector ) {\r\n\r\n\t\tconsole.warn( 'THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead.' );\r\n\t\treturn vector.applyMatrix3( this );\r\n\r\n\t},\r\n\r\n\tmultiplyVector3Array: function ( a ) {\r\n\r\n\t\tconsole.warn( 'THREE.Matrix3: .multiplyVector3Array() has been renamed. Use matrix.applyToVector3Array( array ) instead.' );\r\n\t\treturn this.applyToVector3Array( a );\r\n\r\n\t},\r\n\r\n\tapplyToVector3Array: function () {\r\n\r\n\t\tvar v1;\r\n\r\n\t\treturn function ( array, offset, length ) {\r\n\r\n\t\t\tif ( v1 === undefined ) v1 = new THREE.Vector3();\r\n\t\t\tif ( offset === undefined ) offset = 0;\r\n\t\t\tif ( length === undefined ) length = array.length;\r\n\r\n\t\t\tfor ( var i = 0, j = offset; i < length; i += 3, j += 3 ) {\r\n\r\n\t\t\t\tv1.fromArray( array, j );\r\n\t\t\t\tv1.applyMatrix3( this );\r\n\t\t\t\tv1.toArray( array, j );\r\n\r\n\t\t\t}\r\n\r\n\t\t\treturn array;\r\n\r\n\t\t};\r\n\r\n\t}(),\r\n\r\n\tapplyToBuffer: function () {\r\n\r\n\t\tvar v1;\r\n\r\n\t\treturn function applyToBuffer( buffer, offset, length ) {\r\n\r\n\t\t\tif ( v1 === undefined ) v1 = new THREE.Vector3();\r\n\t\t\tif ( offset === undefined ) offset = 0;\r\n\t\t\tif ( length === undefined ) length = buffer.length / buffer.itemSize;\r\n\r\n\t\t\tfor ( var i = 0, j = offset; i < length; i ++, j ++ ) {\r\n\r\n\t\t\t\tv1.x = buffer.getX( j );\r\n\t\t\t\tv1.y = buffer.getY( j );\r\n\t\t\t\tv1.z = buffer.getZ( j );\r\n\r\n\t\t\t\tv1.applyMatrix3( this );\r\n\r\n\t\t\t\tbuffer.setXYZ( v1.x, v1.y, v1.z );\r\n\r\n\t\t\t}\r\n\r\n\t\t\treturn buffer;\r\n\r\n\t\t};\r\n\r\n\t}(),\r\n\r\n\tmultiplyScalar: function ( s ) {\r\n\r\n\t\tvar te = this.elements;\r\n\r\n\t\tte[ 0 ] *= s; te[ 3 ] *= s; te[ 6 ] *= s;\r\n\t\tte[ 1 ] *= s; te[ 4 ] *= s; te[ 7 ] *= s;\r\n\t\tte[ 2 ] *= s; te[ 5 ] *= s; te[ 8 ] *= s;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tdeterminant: function () {\r\n\r\n\t\tvar te = this.elements;\r\n\r\n\t\tvar a = te[ 0 ], b = te[ 1 ], c = te[ 2 ],\r\n\t\t\td = te[ 3 ], e = te[ 4 ], f = te[ 5 ],\r\n\t\t\tg = te[ 6 ], h = te[ 7 ], i = te[ 8 ];\r\n\r\n\t\treturn a * e * i - a * f * h - b * d * i + b * f * g + c * d * h - c * e * g;\r\n\r\n\t},\r\n\r\n\tgetInverse: function ( matrix, throwOnInvertible ) {\r\n\r\n\t\t// input: THREE.Matrix4\r\n\t\t// ( based on http://code.google.com/p/webgl-mjs/ )\r\n\r\n\t\tvar me = matrix.elements;\r\n\t\tvar te = this.elements;\r\n\r\n\t\tte[ 0 ] = me[ 10 ] * me[ 5 ] - me[ 6 ] * me[ 9 ];\r\n\t\tte[ 1 ] = - me[ 10 ] * me[ 1 ] + me[ 2 ] * me[ 9 ];\r\n\t\tte[ 2 ] = me[ 6 ] * me[ 1 ] - me[ 2 ] * me[ 5 ];\r\n\t\tte[ 3 ] = - me[ 10 ] * me[ 4 ] + me[ 6 ] * me[ 8 ];\r\n\t\tte[ 4 ] = me[ 10 ] * me[ 0 ] - me[ 2 ] * me[ 8 ];\r\n\t\tte[ 5 ] = - me[ 6 ] * me[ 0 ] + me[ 2 ] * me[ 4 ];\r\n\t\tte[ 6 ] = me[ 9 ] * me[ 4 ] - me[ 5 ] * me[ 8 ];\r\n\t\tte[ 7 ] = - me[ 9 ] * me[ 0 ] + me[ 1 ] * me[ 8 ];\r\n\t\tte[ 8 ] = me[ 5 ] * me[ 0 ] - me[ 1 ] * me[ 4 ];\r\n\r\n\t\tvar det = me[ 0 ] * te[ 0 ] + me[ 1 ] * te[ 3 ] + me[ 2 ] * te[ 6 ];\r\n\r\n\t\t// no inverse\r\n\r\n\t\tif ( det === 0 ) {\r\n\r\n\t\t\tvar msg = \"Matrix3.getInverse(): can't invert matrix, determinant is 0\";\r\n\r\n\t\t\tif ( throwOnInvertible || false ) {\r\n\r\n\t\t\t\tthrow new Error( msg );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tconsole.warn( msg );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tthis.identity();\r\n\r\n\t\t\treturn this;\r\n\r\n\t\t}\r\n\r\n\t\tthis.multiplyScalar( 1.0 / det );\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\ttranspose: function () {\r\n\r\n\t\tvar tmp, m = this.elements;\r\n\r\n\t\ttmp = m[ 1 ]; m[ 1 ] = m[ 3 ]; m[ 3 ] = tmp;\r\n\t\ttmp = m[ 2 ]; m[ 2 ] = m[ 6 ]; m[ 6 ] = tmp;\r\n\t\ttmp = m[ 5 ]; m[ 5 ] = m[ 7 ]; m[ 7 ] = tmp;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tflattenToArrayOffset: function ( array, offset ) {\r\n\r\n\t\tvar te = this.elements;\r\n\r\n\t\tarray[ offset ] = te[ 0 ];\r\n\t\tarray[ offset + 1 ] = te[ 1 ];\r\n\t\tarray[ offset + 2 ] = te[ 2 ];\r\n\r\n\t\tarray[ offset + 3 ] = te[ 3 ];\r\n\t\tarray[ offset + 4 ] = te[ 4 ];\r\n\t\tarray[ offset + 5 ] = te[ 5 ];\r\n\r\n\t\tarray[ offset + 6 ] = te[ 6 ];\r\n\t\tarray[ offset + 7 ] = te[ 7 ];\r\n\t\tarray[ offset + 8 ] = te[ 8 ];\r\n\r\n\t\treturn array;\r\n\r\n\t},\r\n\r\n\tgetNormalMatrix: function ( m ) {\r\n\r\n\t\t// input: THREE.Matrix4\r\n\r\n\t\tthis.getInverse( m ).transpose();\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\ttransposeIntoArray: function ( r ) {\r\n\r\n\t\tvar m = this.elements;\r\n\r\n\t\tr[ 0 ] = m[ 0 ];\r\n\t\tr[ 1 ] = m[ 3 ];\r\n\t\tr[ 2 ] = m[ 6 ];\r\n\t\tr[ 3 ] = m[ 1 ];\r\n\t\tr[ 4 ] = m[ 4 ];\r\n\t\tr[ 5 ] = m[ 7 ];\r\n\t\tr[ 6 ] = m[ 2 ];\r\n\t\tr[ 7 ] = m[ 5 ];\r\n\t\tr[ 8 ] = m[ 8 ];\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tfromArray: function ( array ) {\r\n\r\n\t\tthis.elements.set( array );\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\ttoArray: function () {\r\n\r\n\t\tvar te = this.elements;\r\n\r\n\t\treturn [\r\n\t\t\tte[ 0 ], te[ 1 ], te[ 2 ],\r\n\t\t\tte[ 3 ], te[ 4 ], te[ 5 ],\r\n\t\t\tte[ 6 ], te[ 7 ], te[ 8 ]\r\n\t\t];\r\n\r\n\t}\r\n\r\n};\r\n\r\n// File:src/math/Matrix4.js\r\n\r\n/**\r\n * @author mrdoob / http://mrdoob.com/\r\n * @author supereggbert / http://www.paulbrunt.co.uk/\r\n * @author philogb / http://blog.thejit.org/\r\n * @author jordi_ros / http://plattsoft.com\r\n * @author D1plo1d / http://github.com/D1plo1d\r\n * @author alteredq / http://alteredqualia.com/\r\n * @author mikael emtinger / http://gomo.se/\r\n * @author timknip / http://www.floorplanner.com/\r\n * @author bhouston / http://exocortex.com\r\n * @author WestLangley / http://github.com/WestLangley\r\n */\r\n\r\nTHREE.Matrix4 = function () {\r\n\r\n\tthis.elements = new Float32Array( [\r\n\r\n\t\t1, 0, 0, 0,\r\n\t\t0, 1, 0, 0,\r\n\t\t0, 0, 1, 0,\r\n\t\t0, 0, 0, 1\r\n\r\n\t] );\r\n\r\n\tif ( arguments.length > 0 ) {\r\n\r\n\t\tconsole.error( 'THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.' );\r\n\r\n\t}\r\n\r\n};\r\n\r\nTHREE.Matrix4.prototype = {\r\n\r\n\tconstructor: THREE.Matrix4,\r\n\r\n\tset: function ( n11, n12, n13, n14, n21, n22, n23, n24, n31, n32, n33, n34, n41, n42, n43, n44 ) {\r\n\r\n\t\tvar te = this.elements;\r\n\r\n\t\tte[ 0 ] = n11; te[ 4 ] = n12; te[ 8 ] = n13; te[ 12 ] = n14;\r\n\t\tte[ 1 ] = n21; te[ 5 ] = n22; te[ 9 ] = n23; te[ 13 ] = n24;\r\n\t\tte[ 2 ] = n31; te[ 6 ] = n32; te[ 10 ] = n33; te[ 14 ] = n34;\r\n\t\tte[ 3 ] = n41; te[ 7 ] = n42; te[ 11 ] = n43; te[ 15 ] = n44;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tidentity: function () {\r\n\r\n\t\tthis.set(\r\n\r\n\t\t\t1, 0, 0, 0,\r\n\t\t\t0, 1, 0, 0,\r\n\t\t\t0, 0, 1, 0,\r\n\t\t\t0, 0, 0, 1\r\n\r\n\t\t);\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tclone: function () {\r\n\r\n\t\treturn new THREE.Matrix4().fromArray( this.elements );\r\n\r\n\t},\r\n\r\n\tcopy: function ( m ) {\r\n\r\n\t\tthis.elements.set( m.elements );\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\textractPosition: function ( m ) {\r\n\r\n\t\tconsole.warn( 'THREE.Matrix4: .extractPosition() has been renamed to .copyPosition().' );\r\n\t\treturn this.copyPosition( m );\r\n\r\n\t},\r\n\r\n\tcopyPosition: function ( m ) {\r\n\r\n\t\tvar te = this.elements;\r\n\t\tvar me = m.elements;\r\n\r\n\t\tte[ 12 ] = me[ 12 ];\r\n\t\tte[ 13 ] = me[ 13 ];\r\n\t\tte[ 14 ] = me[ 14 ];\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\textractBasis: function ( xAxis, yAxis, zAxis ) {\r\n\r\n\t\tvar te = this.elements;\r\n\r\n\t\txAxis.set( te[ 0 ], te[ 1 ], te[ 2 ] );\r\n\t\tyAxis.set( te[ 4 ], te[ 5 ], te[ 6 ] );\r\n\t\tzAxis.set( te[ 8 ], te[ 9 ], te[ 10 ] );\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tmakeBasis: function ( xAxis, yAxis, zAxis ) {\r\n\r\n\t\tthis.set(\r\n\t\t\txAxis.x, yAxis.x, zAxis.x, 0,\r\n\t\t\txAxis.y, yAxis.y, zAxis.y, 0,\r\n\t\t\txAxis.z, yAxis.z, zAxis.z, 0,\r\n\t\t\t0, 0, 0, 1\r\n\t\t);\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\textractRotation: function () {\r\n\r\n\t\tvar v1;\r\n\r\n\t\treturn function ( m ) {\r\n\r\n\t\t\tif ( v1 === undefined ) v1 = new THREE.Vector3();\r\n\r\n\t\t\tvar te = this.elements;\r\n\t\t\tvar me = m.elements;\r\n\r\n\t\t\tvar scaleX = 1 / v1.set( me[ 0 ], me[ 1 ], me[ 2 ] ).length();\r\n\t\t\tvar scaleY = 1 / v1.set( me[ 4 ], me[ 5 ], me[ 6 ] ).length();\r\n\t\t\tvar scaleZ = 1 / v1.set( me[ 8 ], me[ 9 ], me[ 10 ] ).length();\r\n\r\n\t\t\tte[ 0 ] = me[ 0 ] * scaleX;\r\n\t\t\tte[ 1 ] = me[ 1 ] * scaleX;\r\n\t\t\tte[ 2 ] = me[ 2 ] * scaleX;\r\n\r\n\t\t\tte[ 4 ] = me[ 4 ] * scaleY;\r\n\t\t\tte[ 5 ] = me[ 5 ] * scaleY;\r\n\t\t\tte[ 6 ] = me[ 6 ] * scaleY;\r\n\r\n\t\t\tte[ 8 ] = me[ 8 ] * scaleZ;\r\n\t\t\tte[ 9 ] = me[ 9 ] * scaleZ;\r\n\t\t\tte[ 10 ] = me[ 10 ] * scaleZ;\r\n\r\n\t\t\treturn this;\r\n\r\n\t\t};\r\n\r\n\t}(),\r\n\r\n\tmakeRotationFromEuler: function ( euler ) {\r\n\r\n\t\tif ( euler instanceof THREE.Euler === false ) {\r\n\r\n\t\t\tconsole.error( 'THREE.Matrix: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.' );\r\n\r\n\t\t}\r\n\r\n\t\tvar te = this.elements;\r\n\r\n\t\tvar x = euler.x, y = euler.y, z = euler.z;\r\n\t\tvar a = Math.cos( x ), b = Math.sin( x );\r\n\t\tvar c = Math.cos( y ), d = Math.sin( y );\r\n\t\tvar e = Math.cos( z ), f = Math.sin( z );\r\n\r\n\t\tif ( euler.order === 'XYZ' ) {\r\n\r\n\t\t\tvar ae = a * e, af = a * f, be = b * e, bf = b * f;\r\n\r\n\t\t\tte[ 0 ] = c * e;\r\n\t\t\tte[ 4 ] = - c * f;\r\n\t\t\tte[ 8 ] = d;\r\n\r\n\t\t\tte[ 1 ] = af + be * d;\r\n\t\t\tte[ 5 ] = ae - bf * d;\r\n\t\t\tte[ 9 ] = - b * c;\r\n\r\n\t\t\tte[ 2 ] = bf - ae * d;\r\n\t\t\tte[ 6 ] = be + af * d;\r\n\t\t\tte[ 10 ] = a * c;\r\n\r\n\t\t} else if ( euler.order === 'YXZ' ) {\r\n\r\n\t\t\tvar ce = c * e, cf = c * f, de = d * e, df = d * f;\r\n\r\n\t\t\tte[ 0 ] = ce + df * b;\r\n\t\t\tte[ 4 ] = de * b - cf;\r\n\t\t\tte[ 8 ] = a * d;\r\n\r\n\t\t\tte[ 1 ] = a * f;\r\n\t\t\tte[ 5 ] = a * e;\r\n\t\t\tte[ 9 ] = - b;\r\n\r\n\t\t\tte[ 2 ] = cf * b - de;\r\n\t\t\tte[ 6 ] = df + ce * b;\r\n\t\t\tte[ 10 ] = a * c;\r\n\r\n\t\t} else if ( euler.order === 'ZXY' ) {\r\n\r\n\t\t\tvar ce = c * e, cf = c * f, de = d * e, df = d * f;\r\n\r\n\t\t\tte[ 0 ] = ce - df * b;\r\n\t\t\tte[ 4 ] = - a * f;\r\n\t\t\tte[ 8 ] = de + cf * b;\r\n\r\n\t\t\tte[ 1 ] = cf + de * b;\r\n\t\t\tte[ 5 ] = a * e;\r\n\t\t\tte[ 9 ] = df - ce * b;\r\n\r\n\t\t\tte[ 2 ] = - a * d;\r\n\t\t\tte[ 6 ] = b;\r\n\t\t\tte[ 10 ] = a * c;\r\n\r\n\t\t} else if ( euler.order === 'ZYX' ) {\r\n\r\n\t\t\tvar ae = a * e, af = a * f, be = b * e, bf = b * f;\r\n\r\n\t\t\tte[ 0 ] = c * e;\r\n\t\t\tte[ 4 ] = be * d - af;\r\n\t\t\tte[ 8 ] = ae * d + bf;\r\n\r\n\t\t\tte[ 1 ] = c * f;\r\n\t\t\tte[ 5 ] = bf * d + ae;\r\n\t\t\tte[ 9 ] = af * d - be;\r\n\r\n\t\t\tte[ 2 ] = - d;\r\n\t\t\tte[ 6 ] = b * c;\r\n\t\t\tte[ 10 ] = a * c;\r\n\r\n\t\t} else if ( euler.order === 'YZX' ) {\r\n\r\n\t\t\tvar ac = a * c, ad = a * d, bc = b * c, bd = b * d;\r\n\r\n\t\t\tte[ 0 ] = c * e;\r\n\t\t\tte[ 4 ] = bd - ac * f;\r\n\t\t\tte[ 8 ] = bc * f + ad;\r\n\r\n\t\t\tte[ 1 ] = f;\r\n\t\t\tte[ 5 ] = a * e;\r\n\t\t\tte[ 9 ] = - b * e;\r\n\r\n\t\t\tte[ 2 ] = - d * e;\r\n\t\t\tte[ 6 ] = ad * f + bc;\r\n\t\t\tte[ 10 ] = ac - bd * f;\r\n\r\n\t\t} else if ( euler.order === 'XZY' ) {\r\n\r\n\t\t\tvar ac = a * c, ad = a * d, bc = b * c, bd = b * d;\r\n\r\n\t\t\tte[ 0 ] = c * e;\r\n\t\t\tte[ 4 ] = - f;\r\n\t\t\tte[ 8 ] = d * e;\r\n\r\n\t\t\tte[ 1 ] = ac * f + bd;\r\n\t\t\tte[ 5 ] = a * e;\r\n\t\t\tte[ 9 ] = ad * f - bc;\r\n\r\n\t\t\tte[ 2 ] = bc * f - ad;\r\n\t\t\tte[ 6 ] = b * e;\r\n\t\t\tte[ 10 ] = bd * f + ac;\r\n\r\n\t\t}\r\n\r\n\t\t// last column\r\n\t\tte[ 3 ] = 0;\r\n\t\tte[ 7 ] = 0;\r\n\t\tte[ 11 ] = 0;\r\n\r\n\t\t// bottom row\r\n\t\tte[ 12 ] = 0;\r\n\t\tte[ 13 ] = 0;\r\n\t\tte[ 14 ] = 0;\r\n\t\tte[ 15 ] = 1;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tsetRotationFromQuaternion: function ( q ) {\r\n\r\n\t\tconsole.warn( 'THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion().' );\r\n\r\n\t\treturn this.makeRotationFromQuaternion( q );\r\n\r\n\t},\r\n\r\n\tmakeRotationFromQuaternion: function ( q ) {\r\n\r\n\t\tvar te = this.elements;\r\n\r\n\t\tvar x = q.x, y = q.y, z = q.z, w = q.w;\r\n\t\tvar x2 = x + x, y2 = y + y, z2 = z + z;\r\n\t\tvar xx = x * x2, xy = x * y2, xz = x * z2;\r\n\t\tvar yy = y * y2, yz = y * z2, zz = z * z2;\r\n\t\tvar wx = w * x2, wy = w * y2, wz = w * z2;\r\n\r\n\t\tte[ 0 ] = 1 - ( yy + zz );\r\n\t\tte[ 4 ] = xy - wz;\r\n\t\tte[ 8 ] = xz + wy;\r\n\r\n\t\tte[ 1 ] = xy + wz;\r\n\t\tte[ 5 ] = 1 - ( xx + zz );\r\n\t\tte[ 9 ] = yz - wx;\r\n\r\n\t\tte[ 2 ] = xz - wy;\r\n\t\tte[ 6 ] = yz + wx;\r\n\t\tte[ 10 ] = 1 - ( xx + yy );\r\n\r\n\t\t// last column\r\n\t\tte[ 3 ] = 0;\r\n\t\tte[ 7 ] = 0;\r\n\t\tte[ 11 ] = 0;\r\n\r\n\t\t// bottom row\r\n\t\tte[ 12 ] = 0;\r\n\t\tte[ 13 ] = 0;\r\n\t\tte[ 14 ] = 0;\r\n\t\tte[ 15 ] = 1;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tlookAt: function () {\r\n\r\n\t\tvar x, y, z;\r\n\r\n\t\treturn function ( eye, target, up ) {\r\n\r\n\t\t\tif ( x === undefined ) x = new THREE.Vector3();\r\n\t\t\tif ( y === undefined ) y = new THREE.Vector3();\r\n\t\t\tif ( z === undefined ) z = new THREE.Vector3();\r\n\r\n\t\t\tvar te = this.elements;\r\n\r\n\t\t\tz.subVectors( eye, target ).normalize();\r\n\r\n\t\t\tif ( z.length() === 0 ) {\r\n\r\n\t\t\t\tz.z = 1;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tx.crossVectors( up, z ).normalize();\r\n\r\n\t\t\tif ( x.length() === 0 ) {\r\n\r\n\t\t\t\tz.x += 0.0001;\r\n\t\t\t\tx.crossVectors( up, z ).normalize();\r\n\r\n\t\t\t}\r\n\r\n\t\t\ty.crossVectors( z, x );\r\n\r\n\r\n\t\t\tte[ 0 ] = x.x; te[ 4 ] = y.x; te[ 8 ] = z.x;\r\n\t\t\tte[ 1 ] = x.y; te[ 5 ] = y.y; te[ 9 ] = z.y;\r\n\t\t\tte[ 2 ] = x.z; te[ 6 ] = y.z; te[ 10 ] = z.z;\r\n\r\n\t\t\treturn this;\r\n\r\n\t\t};\r\n\r\n\t}(),\r\n\r\n\tmultiply: function ( m, n ) {\r\n\r\n\t\tif ( n !== undefined ) {\r\n\r\n\t\t\tconsole.warn( 'THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead.' );\r\n\t\t\treturn this.multiplyMatrices( m, n );\r\n\r\n\t\t}\r\n\r\n\t\treturn this.multiplyMatrices( this, m );\r\n\r\n\t},\r\n\r\n\tmultiplyMatrices: function ( a, b ) {\r\n\r\n\t\tvar ae = a.elements;\r\n\t\tvar be = b.elements;\r\n\t\tvar te = this.elements;\r\n\r\n\t\tvar a11 = ae[ 0 ], a12 = ae[ 4 ], a13 = ae[ 8 ], a14 = ae[ 12 ];\r\n\t\tvar a21 = ae[ 1 ], a22 = ae[ 5 ], a23 = ae[ 9 ], a24 = ae[ 13 ];\r\n\t\tvar a31 = ae[ 2 ], a32 = ae[ 6 ], a33 = ae[ 10 ], a34 = ae[ 14 ];\r\n\t\tvar a41 = ae[ 3 ], a42 = ae[ 7 ], a43 = ae[ 11 ], a44 = ae[ 15 ];\r\n\r\n\t\tvar b11 = be[ 0 ], b12 = be[ 4 ], b13 = be[ 8 ], b14 = be[ 12 ];\r\n\t\tvar b21 = be[ 1 ], b22 = be[ 5 ], b23 = be[ 9 ], b24 = be[ 13 ];\r\n\t\tvar b31 = be[ 2 ], b32 = be[ 6 ], b33 = be[ 10 ], b34 = be[ 14 ];\r\n\t\tvar b41 = be[ 3 ], b42 = be[ 7 ], b43 = be[ 11 ], b44 = be[ 15 ];\r\n\r\n\t\tte[ 0 ] = a11 * b11 + a12 * b21 + a13 * b31 + a14 * b41;\r\n\t\tte[ 4 ] = a11 * b12 + a12 * b22 + a13 * b32 + a14 * b42;\r\n\t\tte[ 8 ] = a11 * b13 + a12 * b23 + a13 * b33 + a14 * b43;\r\n\t\tte[ 12 ] = a11 * b14 + a12 * b24 + a13 * b34 + a14 * b44;\r\n\r\n\t\tte[ 1 ] = a21 * b11 + a22 * b21 + a23 * b31 + a24 * b41;\r\n\t\tte[ 5 ] = a21 * b12 + a22 * b22 + a23 * b32 + a24 * b42;\r\n\t\tte[ 9 ] = a21 * b13 + a22 * b23 + a23 * b33 + a24 * b43;\r\n\t\tte[ 13 ] = a21 * b14 + a22 * b24 + a23 * b34 + a24 * b44;\r\n\r\n\t\tte[ 2 ] = a31 * b11 + a32 * b21 + a33 * b31 + a34 * b41;\r\n\t\tte[ 6 ] = a31 * b12 + a32 * b22 + a33 * b32 + a34 * b42;\r\n\t\tte[ 10 ] = a31 * b13 + a32 * b23 + a33 * b33 + a34 * b43;\r\n\t\tte[ 14 ] = a31 * b14 + a32 * b24 + a33 * b34 + a34 * b44;\r\n\r\n\t\tte[ 3 ] = a41 * b11 + a42 * b21 + a43 * b31 + a44 * b41;\r\n\t\tte[ 7 ] = a41 * b12 + a42 * b22 + a43 * b32 + a44 * b42;\r\n\t\tte[ 11 ] = a41 * b13 + a42 * b23 + a43 * b33 + a44 * b43;\r\n\t\tte[ 15 ] = a41 * b14 + a42 * b24 + a43 * b34 + a44 * b44;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tmultiplyToArray: function ( a, b, r ) {\r\n\r\n\t\tvar te = this.elements;\r\n\r\n\t\tthis.multiplyMatrices( a, b );\r\n\r\n\t\tr[ 0 ] = te[ 0 ]; r[ 1 ] = te[ 1 ]; r[ 2 ] = te[ 2 ]; r[ 3 ] = te[ 3 ];\r\n\t\tr[ 4 ] = te[ 4 ]; r[ 5 ] = te[ 5 ]; r[ 6 ] = te[ 6 ]; r[ 7 ] = te[ 7 ];\r\n\t\tr[ 8 ] = te[ 8 ]; r[ 9 ] = te[ 9 ]; r[ 10 ] = te[ 10 ]; r[ 11 ] = te[ 11 ];\r\n\t\tr[ 12 ] = te[ 12 ]; r[ 13 ] = te[ 13 ]; r[ 14 ] = te[ 14 ]; r[ 15 ] = te[ 15 ];\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tmultiplyScalar: function ( s ) {\r\n\r\n\t\tvar te = this.elements;\r\n\r\n\t\tte[ 0 ] *= s; te[ 4 ] *= s; te[ 8 ] *= s; te[ 12 ] *= s;\r\n\t\tte[ 1 ] *= s; te[ 5 ] *= s; te[ 9 ] *= s; te[ 13 ] *= s;\r\n\t\tte[ 2 ] *= s; te[ 6 ] *= s; te[ 10 ] *= s; te[ 14 ] *= s;\r\n\t\tte[ 3 ] *= s; te[ 7 ] *= s; te[ 11 ] *= s; te[ 15 ] *= s;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tmultiplyVector3: function ( vector ) {\r\n\r\n\t\tconsole.warn( 'THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) or vector.applyProjection( matrix ) instead.' );\r\n\t\treturn vector.applyProjection( this );\r\n\r\n\t},\r\n\r\n\tmultiplyVector4: function ( vector ) {\r\n\r\n\t\tconsole.warn( 'THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead.' );\r\n\t\treturn vector.applyMatrix4( this );\r\n\r\n\t},\r\n\r\n\tmultiplyVector3Array: function ( a ) {\r\n\r\n\t\tconsole.warn( 'THREE.Matrix4: .multiplyVector3Array() has been renamed. Use matrix.applyToVector3Array( array ) instead.' );\r\n\t\treturn this.applyToVector3Array( a );\r\n\r\n\t},\r\n\r\n\tapplyToVector3Array: function () {\r\n\r\n\t\tvar v1;\r\n\r\n\t\treturn function ( array, offset, length ) {\r\n\r\n\t\t\tif ( v1 === undefined ) v1 = new THREE.Vector3();\r\n\t\t\tif ( offset === undefined ) offset = 0;\r\n\t\t\tif ( length === undefined ) length = array.length;\r\n\r\n\t\t\tfor ( var i = 0, j = offset; i < length; i += 3, j += 3 ) {\r\n\r\n\t\t\t\tv1.fromArray( array, j );\r\n\t\t\t\tv1.applyMatrix4( this );\r\n\t\t\t\tv1.toArray( array, j );\r\n\r\n\t\t\t}\r\n\r\n\t\t\treturn array;\r\n\r\n\t\t};\r\n\r\n\t}(),\r\n\r\n\tapplyToBuffer: function () {\r\n\r\n\t\tvar v1;\r\n\r\n\t\treturn function applyToBuffer( buffer, offset, length ) {\r\n\r\n\t\t\tif ( v1 === undefined ) v1 = new THREE.Vector3();\r\n\t\t\tif ( offset === undefined ) offset = 0;\r\n\t\t\tif ( length === undefined ) length = buffer.length / buffer.itemSize;\r\n\r\n\t\t\tfor ( var i = 0, j = offset; i < length; i ++, j ++ ) {\r\n\r\n\t\t\t\tv1.x = buffer.getX( j );\r\n\t\t\t\tv1.y = buffer.getY( j );\r\n\t\t\t\tv1.z = buffer.getZ( j );\r\n\r\n\t\t\t\tv1.applyMatrix4( this );\r\n\r\n\t\t\t\tbuffer.setXYZ( v1.x, v1.y, v1.z );\r\n\r\n\t\t\t}\r\n\r\n\t\t\treturn buffer;\r\n\r\n\t\t};\r\n\r\n\t}(),\r\n\r\n\trotateAxis: function ( v ) {\r\n\r\n\t\tconsole.warn( 'THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead.' );\r\n\r\n\t\tv.transformDirection( this );\r\n\r\n\t},\r\n\r\n\tcrossVector: function ( vector ) {\r\n\r\n\t\tconsole.warn( 'THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead.' );\r\n\t\treturn vector.applyMatrix4( this );\r\n\r\n\t},\r\n\r\n\tdeterminant: function () {\r\n\r\n\t\tvar te = this.elements;\r\n\r\n\t\tvar n11 = te[ 0 ], n12 = te[ 4 ], n13 = te[ 8 ], n14 = te[ 12 ];\r\n\t\tvar n21 = te[ 1 ], n22 = te[ 5 ], n23 = te[ 9 ], n24 = te[ 13 ];\r\n\t\tvar n31 = te[ 2 ], n32 = te[ 6 ], n33 = te[ 10 ], n34 = te[ 14 ];\r\n\t\tvar n41 = te[ 3 ], n42 = te[ 7 ], n43 = te[ 11 ], n44 = te[ 15 ];\r\n\r\n\t\t//TODO: make this more efficient\r\n\t\t//( based on http://www.euclideanspace.com/maths/algebra/matrix/functions/inverse/fourD/index.htm )\r\n\r\n\t\treturn (\r\n\t\t\tn41 * (\r\n\t\t\t\t+ n14 * n23 * n32\r\n\t\t\t\t - n13 * n24 * n32\r\n\t\t\t\t - n14 * n22 * n33\r\n\t\t\t\t + n12 * n24 * n33\r\n\t\t\t\t + n13 * n22 * n34\r\n\t\t\t\t - n12 * n23 * n34\r\n\t\t\t) +\r\n\t\t\tn42 * (\r\n\t\t\t\t+ n11 * n23 * n34\r\n\t\t\t\t - n11 * n24 * n33\r\n\t\t\t\t + n14 * n21 * n33\r\n\t\t\t\t - n13 * n21 * n34\r\n\t\t\t\t + n13 * n24 * n31\r\n\t\t\t\t - n14 * n23 * n31\r\n\t\t\t) +\r\n\t\t\tn43 * (\r\n\t\t\t\t+ n11 * n24 * n32\r\n\t\t\t\t - n11 * n22 * n34\r\n\t\t\t\t - n14 * n21 * n32\r\n\t\t\t\t + n12 * n21 * n34\r\n\t\t\t\t + n14 * n22 * n31\r\n\t\t\t\t - n12 * n24 * n31\r\n\t\t\t) +\r\n\t\t\tn44 * (\r\n\t\t\t\t- n13 * n22 * n31\r\n\t\t\t\t - n11 * n23 * n32\r\n\t\t\t\t + n11 * n22 * n33\r\n\t\t\t\t + n13 * n21 * n32\r\n\t\t\t\t - n12 * n21 * n33\r\n\t\t\t\t + n12 * n23 * n31\r\n\t\t\t)\r\n\r\n\t\t);\r\n\r\n\t},\r\n\r\n\ttranspose: function () {\r\n\r\n\t\tvar te = this.elements;\r\n\t\tvar tmp;\r\n\r\n\t\ttmp = te[ 1 ]; te[ 1 ] = te[ 4 ]; te[ 4 ] = tmp;\r\n\t\ttmp = te[ 2 ]; te[ 2 ] = te[ 8 ]; te[ 8 ] = tmp;\r\n\t\ttmp = te[ 6 ]; te[ 6 ] = te[ 9 ]; te[ 9 ] = tmp;\r\n\r\n\t\ttmp = te[ 3 ]; te[ 3 ] = te[ 12 ]; te[ 12 ] = tmp;\r\n\t\ttmp = te[ 7 ]; te[ 7 ] = te[ 13 ]; te[ 13 ] = tmp;\r\n\t\ttmp = te[ 11 ]; te[ 11 ] = te[ 14 ]; te[ 14 ] = tmp;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tflattenToArrayOffset: function ( array, offset ) {\r\n\r\n\t\tvar te = this.elements;\r\n\r\n\t\tarray[ offset ] = te[ 0 ];\r\n\t\tarray[ offset + 1 ] = te[ 1 ];\r\n\t\tarray[ offset + 2 ] = te[ 2 ];\r\n\t\tarray[ offset + 3 ] = te[ 3 ];\r\n\r\n\t\tarray[ offset + 4 ] = te[ 4 ];\r\n\t\tarray[ offset + 5 ] = te[ 5 ];\r\n\t\tarray[ offset + 6 ] = te[ 6 ];\r\n\t\tarray[ offset + 7 ] = te[ 7 ];\r\n\r\n\t\tarray[ offset + 8 ] = te[ 8 ];\r\n\t\tarray[ offset + 9 ] = te[ 9 ];\r\n\t\tarray[ offset + 10 ] = te[ 10 ];\r\n\t\tarray[ offset + 11 ] = te[ 11 ];\r\n\r\n\t\tarray[ offset + 12 ] = te[ 12 ];\r\n\t\tarray[ offset + 13 ] = te[ 13 ];\r\n\t\tarray[ offset + 14 ] = te[ 14 ];\r\n\t\tarray[ offset + 15 ] = te[ 15 ];\r\n\r\n\t\treturn array;\r\n\r\n\t},\r\n\r\n\tgetPosition: function () {\r\n\r\n\t\tvar v1;\r\n\r\n\t\treturn function () {\r\n\r\n\t\t\tif ( v1 === undefined ) v1 = new THREE.Vector3();\r\n\t\t\tconsole.warn( 'THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead.' );\r\n\r\n\t\t\tvar te = this.elements;\r\n\t\t\treturn v1.set( te[ 12 ], te[ 13 ], te[ 14 ] );\r\n\r\n\t\t};\r\n\r\n\t}(),\r\n\r\n\tsetPosition: function ( v ) {\r\n\r\n\t\tvar te = this.elements;\r\n\r\n\t\tte[ 12 ] = v.x;\r\n\t\tte[ 13 ] = v.y;\r\n\t\tte[ 14 ] = v.z;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tgetInverse: function ( m, throwOnInvertible ) {\r\n\r\n\t\t// based on http://www.euclideanspace.com/maths/algebra/matrix/functions/inverse/fourD/index.htm\r\n\t\tvar te = this.elements;\r\n\t\tvar me = m.elements;\r\n\r\n\t\tvar n11 = me[ 0 ], n12 = me[ 4 ], n13 = me[ 8 ], n14 = me[ 12 ];\r\n\t\tvar n21 = me[ 1 ], n22 = me[ 5 ], n23 = me[ 9 ], n24 = me[ 13 ];\r\n\t\tvar n31 = me[ 2 ], n32 = me[ 6 ], n33 = me[ 10 ], n34 = me[ 14 ];\r\n\t\tvar n41 = me[ 3 ], n42 = me[ 7 ], n43 = me[ 11 ], n44 = me[ 15 ];\r\n\r\n\t\tte[ 0 ] = n23 * n34 * n42 - n24 * n33 * n42 + n24 * n32 * n43 - n22 * n34 * n43 - n23 * n32 * n44 + n22 * n33 * n44;\r\n\t\tte[ 4 ] = n14 * n33 * n42 - n13 * n34 * n42 - n14 * n32 * n43 + n12 * n34 * n43 + n13 * n32 * n44 - n12 * n33 * n44;\r\n\t\tte[ 8 ] = n13 * n24 * n42 - n14 * n23 * n42 + n14 * n22 * n43 - n12 * n24 * n43 - n13 * n22 * n44 + n12 * n23 * n44;\r\n\t\tte[ 12 ] = n14 * n23 * n32 - n13 * n24 * n32 - n14 * n22 * n33 + n12 * n24 * n33 + n13 * n22 * n34 - n12 * n23 * n34;\r\n\t\tte[ 1 ] = n24 * n33 * n41 - n23 * n34 * n41 - n24 * n31 * n43 + n21 * n34 * n43 + n23 * n31 * n44 - n21 * n33 * n44;\r\n\t\tte[ 5 ] = n13 * n34 * n41 - n14 * n33 * n41 + n14 * n31 * n43 - n11 * n34 * n43 - n13 * n31 * n44 + n11 * n33 * n44;\r\n\t\tte[ 9 ] = n14 * n23 * n41 - n13 * n24 * n41 - n14 * n21 * n43 + n11 * n24 * n43 + n13 * n21 * n44 - n11 * n23 * n44;\r\n\t\tte[ 13 ] = n13 * n24 * n31 - n14 * n23 * n31 + n14 * n21 * n33 - n11 * n24 * n33 - n13 * n21 * n34 + n11 * n23 * n34;\r\n\t\tte[ 2 ] = n22 * n34 * n41 - n24 * n32 * n41 + n24 * n31 * n42 - n21 * n34 * n42 - n22 * n31 * n44 + n21 * n32 * n44;\r\n\t\tte[ 6 ] = n14 * n32 * n41 - n12 * n34 * n41 - n14 * n31 * n42 + n11 * n34 * n42 + n12 * n31 * n44 - n11 * n32 * n44;\r\n\t\tte[ 10 ] = n12 * n24 * n41 - n14 * n22 * n41 + n14 * n21 * n42 - n11 * n24 * n42 - n12 * n21 * n44 + n11 * n22 * n44;\r\n\t\tte[ 14 ] = n14 * n22 * n31 - n12 * n24 * n31 - n14 * n21 * n32 + n11 * n24 * n32 + n12 * n21 * n34 - n11 * n22 * n34;\r\n\t\tte[ 3 ] = n23 * n32 * n41 - n22 * n33 * n41 - n23 * n31 * n42 + n21 * n33 * n42 + n22 * n31 * n43 - n21 * n32 * n43;\r\n\t\tte[ 7 ] = n12 * n33 * n41 - n13 * n32 * n41 + n13 * n31 * n42 - n11 * n33 * n42 - n12 * n31 * n43 + n11 * n32 * n43;\r\n\t\tte[ 11 ] = n13 * n22 * n41 - n12 * n23 * n41 - n13 * n21 * n42 + n11 * n23 * n42 + n12 * n21 * n43 - n11 * n22 * n43;\r\n\t\tte[ 15 ] = n12 * n23 * n31 - n13 * n22 * n31 + n13 * n21 * n32 - n11 * n23 * n32 - n12 * n21 * n33 + n11 * n22 * n33;\r\n\r\n\t\tvar det = n11 * te[ 0 ] + n21 * te[ 4 ] + n31 * te[ 8 ] + n41 * te[ 12 ];\r\n\r\n\t\tif ( det === 0 ) {\r\n\r\n\t\t\tvar msg = \"THREE.Matrix4.getInverse(): can't invert matrix, determinant is 0\";\r\n\r\n\t\t\tif ( throwOnInvertible || false ) {\r\n\r\n\t\t\t\tthrow new Error( msg );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tconsole.warn( msg );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tthis.identity();\r\n\r\n\t\t\treturn this;\r\n\r\n\t\t}\r\n\r\n\t\tthis.multiplyScalar( 1 / det );\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\ttranslate: function ( v ) {\r\n\r\n\t\tconsole.error( 'THREE.Matrix4: .translate() has been removed.' );\r\n\r\n\t},\r\n\r\n\trotateX: function ( angle ) {\r\n\r\n\t\tconsole.error( 'THREE.Matrix4: .rotateX() has been removed.' );\r\n\r\n\t},\r\n\r\n\trotateY: function ( angle ) {\r\n\r\n\t\tconsole.error( 'THREE.Matrix4: .rotateY() has been removed.' );\r\n\r\n\t},\r\n\r\n\trotateZ: function ( angle ) {\r\n\r\n\t\tconsole.error( 'THREE.Matrix4: .rotateZ() has been removed.' );\r\n\r\n\t},\r\n\r\n\trotateByAxis: function ( axis, angle ) {\r\n\r\n\t\tconsole.error( 'THREE.Matrix4: .rotateByAxis() has been removed.' );\r\n\r\n\t},\r\n\r\n\tscale: function ( v ) {\r\n\r\n\t\tvar te = this.elements;\r\n\t\tvar x = v.x, y = v.y, z = v.z;\r\n\r\n\t\tte[ 0 ] *= x; te[ 4 ] *= y; te[ 8 ] *= z;\r\n\t\tte[ 1 ] *= x; te[ 5 ] *= y; te[ 9 ] *= z;\r\n\t\tte[ 2 ] *= x; te[ 6 ] *= y; te[ 10 ] *= z;\r\n\t\tte[ 3 ] *= x; te[ 7 ] *= y; te[ 11 ] *= z;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tgetMaxScaleOnAxis: function () {\r\n\r\n\t\tvar te = this.elements;\r\n\r\n\t\tvar scaleXSq = te[ 0 ] * te[ 0 ] + te[ 1 ] * te[ 1 ] + te[ 2 ] * te[ 2 ];\r\n\t\tvar scaleYSq = te[ 4 ] * te[ 4 ] + te[ 5 ] * te[ 5 ] + te[ 6 ] * te[ 6 ];\r\n\t\tvar scaleZSq = te[ 8 ] * te[ 8 ] + te[ 9 ] * te[ 9 ] + te[ 10 ] * te[ 10 ];\r\n\r\n\t\treturn Math.sqrt( Math.max( scaleXSq, Math.max( scaleYSq, scaleZSq ) ) );\r\n\r\n\t},\r\n\r\n\tmakeTranslation: function ( x, y, z ) {\r\n\r\n\t\tthis.set(\r\n\r\n\t\t\t1, 0, 0, x,\r\n\t\t\t0, 1, 0, y,\r\n\t\t\t0, 0, 1, z,\r\n\t\t\t0, 0, 0, 1\r\n\r\n\t\t);\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tmakeRotationX: function ( theta ) {\r\n\r\n\t\tvar c = Math.cos( theta ), s = Math.sin( theta );\r\n\r\n\t\tthis.set(\r\n\r\n\t\t\t1, 0, 0, 0,\r\n\t\t\t0, c, - s, 0,\r\n\t\t\t0, s, c, 0,\r\n\t\t\t0, 0, 0, 1\r\n\r\n\t\t);\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tmakeRotationY: function ( theta ) {\r\n\r\n\t\tvar c = Math.cos( theta ), s = Math.sin( theta );\r\n\r\n\t\tthis.set(\r\n\r\n\t\t\t c, 0, s, 0,\r\n\t\t\t 0, 1, 0, 0,\r\n\t\t\t- s, 0, c, 0,\r\n\t\t\t 0, 0, 0, 1\r\n\r\n\t\t);\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tmakeRotationZ: function ( theta ) {\r\n\r\n\t\tvar c = Math.cos( theta ), s = Math.sin( theta );\r\n\r\n\t\tthis.set(\r\n\r\n\t\t\tc, - s, 0, 0,\r\n\t\t\ts, c, 0, 0,\r\n\t\t\t0, 0, 1, 0,\r\n\t\t\t0, 0, 0, 1\r\n\r\n\t\t);\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tmakeRotationAxis: function ( axis, angle ) {\r\n\r\n\t\t// Based on http://www.gamedev.net/reference/articles/article1199.asp\r\n\r\n\t\tvar c = Math.cos( angle );\r\n\t\tvar s = Math.sin( angle );\r\n\t\tvar t = 1 - c;\r\n\t\tvar x = axis.x, y = axis.y, z = axis.z;\r\n\t\tvar tx = t * x, ty = t * y;\r\n\r\n\t\tthis.set(\r\n\r\n\t\t\ttx * x + c, tx * y - s * z, tx * z + s * y, 0,\r\n\t\t\ttx * y + s * z, ty * y + c, ty * z - s * x, 0,\r\n\t\t\ttx * z - s * y, ty * z + s * x, t * z * z + c, 0,\r\n\t\t\t0, 0, 0, 1\r\n\r\n\t\t);\r\n\r\n\t\t return this;\r\n\r\n\t},\r\n\r\n\tmakeScale: function ( x, y, z ) {\r\n\r\n\t\tthis.set(\r\n\r\n\t\t\tx, 0, 0, 0,\r\n\t\t\t0, y, 0, 0,\r\n\t\t\t0, 0, z, 0,\r\n\t\t\t0, 0, 0, 1\r\n\r\n\t\t);\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tcompose: function ( position, quaternion, scale ) {\r\n\r\n\t\tthis.makeRotationFromQuaternion( quaternion );\r\n\t\tthis.scale( scale );\r\n\t\tthis.setPosition( position );\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tdecompose: function () {\r\n\r\n\t\tvar vector, matrix;\r\n\r\n\t\treturn function ( position, quaternion, scale ) {\r\n\r\n\t\t\tif ( vector === undefined ) vector = new THREE.Vector3();\r\n\t\t\tif ( matrix === undefined ) matrix = new THREE.Matrix4();\r\n\r\n\t\t\tvar te = this.elements;\r\n\r\n\t\t\tvar sx = vector.set( te[ 0 ], te[ 1 ], te[ 2 ] ).length();\r\n\t\t\tvar sy = vector.set( te[ 4 ], te[ 5 ], te[ 6 ] ).length();\r\n\t\t\tvar sz = vector.set( te[ 8 ], te[ 9 ], te[ 10 ] ).length();\r\n\r\n\t\t\t// if determine is negative, we need to invert one scale\r\n\t\t\tvar det = this.determinant();\r\n\t\t\tif ( det < 0 ) {\r\n\r\n\t\t\t\tsx = - sx;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tposition.x = te[ 12 ];\r\n\t\t\tposition.y = te[ 13 ];\r\n\t\t\tposition.z = te[ 14 ];\r\n\r\n\t\t\t// scale the rotation part\r\n\r\n\t\t\tmatrix.elements.set( this.elements ); // at this point matrix is incomplete so we can't use .copy()\r\n\r\n\t\t\tvar invSX = 1 / sx;\r\n\t\t\tvar invSY = 1 / sy;\r\n\t\t\tvar invSZ = 1 / sz;\r\n\r\n\t\t\tmatrix.elements[ 0 ] *= invSX;\r\n\t\t\tmatrix.elements[ 1 ] *= invSX;\r\n\t\t\tmatrix.elements[ 2 ] *= invSX;\r\n\r\n\t\t\tmatrix.elements[ 4 ] *= invSY;\r\n\t\t\tmatrix.elements[ 5 ] *= invSY;\r\n\t\t\tmatrix.elements[ 6 ] *= invSY;\r\n\r\n\t\t\tmatrix.elements[ 8 ] *= invSZ;\r\n\t\t\tmatrix.elements[ 9 ] *= invSZ;\r\n\t\t\tmatrix.elements[ 10 ] *= invSZ;\r\n\r\n\t\t\tquaternion.setFromRotationMatrix( matrix );\r\n\r\n\t\t\tscale.x = sx;\r\n\t\t\tscale.y = sy;\r\n\t\t\tscale.z = sz;\r\n\r\n\t\t\treturn this;\r\n\r\n\t\t};\r\n\r\n\t}(),\r\n\r\n\tmakeFrustum: function ( left, right, bottom, top, near, far ) {\r\n\r\n\t\tvar te = this.elements;\r\n\t\tvar x = 2 * near / ( right - left );\r\n\t\tvar y = 2 * near / ( top - bottom );\r\n\r\n\t\tvar a = ( right + left ) / ( right - left );\r\n\t\tvar b = ( top + bottom ) / ( top - bottom );\r\n\t\tvar c = - ( far + near ) / ( far - near );\r\n\t\tvar d = - 2 * far * near / ( far - near );\r\n\r\n\t\tte[ 0 ] = x;\tte[ 4 ] = 0;\tte[ 8 ] = a;\tte[ 12 ] = 0;\r\n\t\tte[ 1 ] = 0;\tte[ 5 ] = y;\tte[ 9 ] = b;\tte[ 13 ] = 0;\r\n\t\tte[ 2 ] = 0;\tte[ 6 ] = 0;\tte[ 10 ] = c;\tte[ 14 ] = d;\r\n\t\tte[ 3 ] = 0;\tte[ 7 ] = 0;\tte[ 11 ] = - 1;\tte[ 15 ] = 0;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tmakePerspective: function ( fov, aspect, near, far ) {\r\n\r\n\t\tvar ymax = near * Math.tan( THREE.Math.degToRad( fov * 0.5 ) );\r\n\t\tvar ymin = - ymax;\r\n\t\tvar xmin = ymin * aspect;\r\n\t\tvar xmax = ymax * aspect;\r\n\r\n\t\treturn this.makeFrustum( xmin, xmax, ymin, ymax, near, far );\r\n\r\n\t},\r\n\r\n\tmakeOrthographic: function ( left, right, top, bottom, near, far ) {\r\n\r\n\t\tvar te = this.elements;\r\n\t\tvar w = right - left;\r\n\t\tvar h = top - bottom;\r\n\t\tvar p = far - near;\r\n\r\n\t\tvar x = ( right + left ) / w;\r\n\t\tvar y = ( top + bottom ) / h;\r\n\t\tvar z = ( far + near ) / p;\r\n\r\n\t\tte[ 0 ] = 2 / w;\tte[ 4 ] = 0;\tte[ 8 ] = 0;\tte[ 12 ] = - x;\r\n\t\tte[ 1 ] = 0;\tte[ 5 ] = 2 / h;\tte[ 9 ] = 0;\tte[ 13 ] = - y;\r\n\t\tte[ 2 ] = 0;\tte[ 6 ] = 0;\tte[ 10 ] = - 2 / p;\tte[ 14 ] = - z;\r\n\t\tte[ 3 ] = 0;\tte[ 7 ] = 0;\tte[ 11 ] = 0;\tte[ 15 ] = 1;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tequals: function ( matrix ) {\r\n\r\n\t\tvar te = this.elements;\r\n\t\tvar me = matrix.elements;\r\n\r\n\t\tfor ( var i = 0; i < 16; i ++ ) {\r\n\r\n\t\t\tif ( te[ i ] !== me[ i ] ) return false;\r\n\r\n\t\t}\r\n\r\n\t\treturn true;\r\n\r\n\t},\r\n\r\n\tfromArray: function ( array ) {\r\n\r\n\t\tthis.elements.set( array );\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\ttoArray: function () {\r\n\r\n\t\tvar te = this.elements;\r\n\r\n\t\treturn [\r\n\t\t\tte[ 0 ], te[ 1 ], te[ 2 ], te[ 3 ],\r\n\t\t\tte[ 4 ], te[ 5 ], te[ 6 ], te[ 7 ],\r\n\t\t\tte[ 8 ], te[ 9 ], te[ 10 ], te[ 11 ],\r\n\t\t\tte[ 12 ], te[ 13 ], te[ 14 ], te[ 15 ]\r\n\t\t];\r\n\r\n\t}\r\n\r\n};\r\n\r\n// File:src/math/Ray.js\r\n\r\n/**\r\n * @author bhouston / http://exocortex.com\r\n */\r\n\r\nTHREE.Ray = function ( origin, direction ) {\r\n\r\n\tthis.origin = ( origin !== undefined ) ? origin : new THREE.Vector3();\r\n\tthis.direction = ( direction !== undefined ) ? direction : new THREE.Vector3();\r\n\r\n};\r\n\r\nTHREE.Ray.prototype = {\r\n\r\n\tconstructor: THREE.Ray,\r\n\r\n\tset: function ( origin, direction ) {\r\n\r\n\t\tthis.origin.copy( origin );\r\n\t\tthis.direction.copy( direction );\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tclone: function () {\r\n\r\n\t\treturn new this.constructor().copy( this );\r\n\r\n\t},\r\n\r\n\tcopy: function ( ray ) {\r\n\r\n\t\tthis.origin.copy( ray.origin );\r\n\t\tthis.direction.copy( ray.direction );\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tat: function ( t, optionalTarget ) {\r\n\r\n\t\tvar result = optionalTarget || new THREE.Vector3();\r\n\r\n\t\treturn result.copy( this.direction ).multiplyScalar( t ).add( this.origin );\r\n\r\n\t},\r\n\r\n\trecast: function () {\r\n\r\n\t\tvar v1 = new THREE.Vector3();\r\n\r\n\t\treturn function ( t ) {\r\n\r\n\t\t\tthis.origin.copy( this.at( t, v1 ) );\r\n\r\n\t\t\treturn this;\r\n\r\n\t\t};\r\n\r\n\t}(),\r\n\r\n\tclosestPointToPoint: function ( point, optionalTarget ) {\r\n\r\n\t\tvar result = optionalTarget || new THREE.Vector3();\r\n\t\tresult.subVectors( point, this.origin );\r\n\t\tvar directionDistance = result.dot( this.direction );\r\n\r\n\t\tif ( directionDistance < 0 ) {\r\n\r\n\t\t\treturn result.copy( this.origin );\r\n\r\n\t\t}\r\n\r\n\t\treturn result.copy( this.direction ).multiplyScalar( directionDistance ).add( this.origin );\r\n\r\n\t},\r\n\r\n\tdistanceToPoint: function ( point ) {\r\n\r\n\t\treturn Math.sqrt( this.distanceSqToPoint( point ) );\r\n\r\n\t},\r\n\r\n\tdistanceSqToPoint: function () {\r\n\r\n\t\tvar v1 = new THREE.Vector3();\r\n\r\n\t\treturn function ( point ) {\r\n\r\n\t\t\tvar directionDistance = v1.subVectors( point, this.origin ).dot( this.direction );\r\n\r\n\t\t\t// point behind the ray\r\n\r\n\t\t\tif ( directionDistance < 0 ) {\r\n\r\n\t\t\t\treturn this.origin.distanceToSquared( point );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tv1.copy( this.direction ).multiplyScalar( directionDistance ).add( this.origin );\r\n\r\n\t\t\treturn v1.distanceToSquared( point );\r\n\r\n\t\t};\r\n\r\n\t}(),\r\n\r\n\tdistanceSqToSegment: function () {\r\n\r\n\t\tvar segCenter = new THREE.Vector3();\r\n\t\tvar segDir = new THREE.Vector3();\r\n\t\tvar diff = new THREE.Vector3();\r\n\r\n\t\treturn function ( v0, v1, optionalPointOnRay, optionalPointOnSegment ) {\r\n\r\n\t\t\t// from http://www.geometrictools.com/LibMathematics/Distance/Wm5DistRay3Segment3.cpp\r\n\t\t\t// It returns the min distance between the ray and the segment\r\n\t\t\t// defined by v0 and v1\r\n\t\t\t// It can also set two optional targets :\r\n\t\t\t// - The closest point on the ray\r\n\t\t\t// - The closest point on the segment\r\n\r\n\t\t\tsegCenter.copy( v0 ).add( v1 ).multiplyScalar( 0.5 );\r\n\t\t\tsegDir.copy( v1 ).sub( v0 ).normalize();\r\n\t\t\tdiff.copy( this.origin ).sub( segCenter );\r\n\r\n\t\t\tvar segExtent = v0.distanceTo( v1 ) * 0.5;\r\n\t\t\tvar a01 = - this.direction.dot( segDir );\r\n\t\t\tvar b0 = diff.dot( this.direction );\r\n\t\t\tvar b1 = - diff.dot( segDir );\r\n\t\t\tvar c = diff.lengthSq();\r\n\t\t\tvar det = Math.abs( 1 - a01 * a01 );\r\n\t\t\tvar s0, s1, sqrDist, extDet;\r\n\r\n\t\t\tif ( det > 0 ) {\r\n\r\n\t\t\t\t// The ray and segment are not parallel.\r\n\r\n\t\t\t\ts0 = a01 * b1 - b0;\r\n\t\t\t\ts1 = a01 * b0 - b1;\r\n\t\t\t\textDet = segExtent * det;\r\n\r\n\t\t\t\tif ( s0 >= 0 ) {\r\n\r\n\t\t\t\t\tif ( s1 >= - extDet ) {\r\n\r\n\t\t\t\t\t\tif ( s1 <= extDet ) {\r\n\r\n\t\t\t\t\t\t\t// region 0\r\n\t\t\t\t\t\t\t// Minimum at interior points of ray and segment.\r\n\r\n\t\t\t\t\t\t\tvar invDet = 1 / det;\r\n\t\t\t\t\t\t\ts0 *= invDet;\r\n\t\t\t\t\t\t\ts1 *= invDet;\r\n\t\t\t\t\t\t\tsqrDist = s0 * ( s0 + a01 * s1 + 2 * b0 ) + s1 * ( a01 * s0 + s1 + 2 * b1 ) + c;\r\n\r\n\t\t\t\t\t\t} else {\r\n\r\n\t\t\t\t\t\t\t// region 1\r\n\r\n\t\t\t\t\t\t\ts1 = segExtent;\r\n\t\t\t\t\t\t\ts0 = Math.max( 0, - ( a01 * s1 + b0 ) );\r\n\t\t\t\t\t\t\tsqrDist = - s0 * s0 + s1 * ( s1 + 2 * b1 ) + c;\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t} else {\r\n\r\n\t\t\t\t\t\t// region 5\r\n\r\n\t\t\t\t\t\ts1 = - segExtent;\r\n\t\t\t\t\t\ts0 = Math.max( 0, - ( a01 * s1 + b0 ) );\r\n\t\t\t\t\t\tsqrDist = - s0 * s0 + s1 * ( s1 + 2 * b1 ) + c;\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\tif ( s1 <= - extDet ) {\r\n\r\n\t\t\t\t\t\t// region 4\r\n\r\n\t\t\t\t\t\ts0 = Math.max( 0, - ( - a01 * segExtent + b0 ) );\r\n\t\t\t\t\t\ts1 = ( s0 > 0 ) ? - segExtent : Math.min( Math.max( - segExtent, - b1 ), segExtent );\r\n\t\t\t\t\t\tsqrDist = - s0 * s0 + s1 * ( s1 + 2 * b1 ) + c;\r\n\r\n\t\t\t\t\t} else if ( s1 <= extDet ) {\r\n\r\n\t\t\t\t\t\t// region 3\r\n\r\n\t\t\t\t\t\ts0 = 0;\r\n\t\t\t\t\t\ts1 = Math.min( Math.max( - segExtent, - b1 ), segExtent );\r\n\t\t\t\t\t\tsqrDist = s1 * ( s1 + 2 * b1 ) + c;\r\n\r\n\t\t\t\t\t} else {\r\n\r\n\t\t\t\t\t\t// region 2\r\n\r\n\t\t\t\t\t\ts0 = Math.max( 0, - ( a01 * segExtent + b0 ) );\r\n\t\t\t\t\t\ts1 = ( s0 > 0 ) ? segExtent : Math.min( Math.max( - segExtent, - b1 ), segExtent );\r\n\t\t\t\t\t\tsqrDist = - s0 * s0 + s1 * ( s1 + 2 * b1 ) + c;\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\t// Ray and segment are parallel.\r\n\r\n\t\t\t\ts1 = ( a01 > 0 ) ? - segExtent : segExtent;\r\n\t\t\t\ts0 = Math.max( 0, - ( a01 * s1 + b0 ) );\r\n\t\t\t\tsqrDist = - s0 * s0 + s1 * ( s1 + 2 * b1 ) + c;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( optionalPointOnRay ) {\r\n\r\n\t\t\t\toptionalPointOnRay.copy( this.direction ).multiplyScalar( s0 ).add( this.origin );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( optionalPointOnSegment ) {\r\n\r\n\t\t\t\toptionalPointOnSegment.copy( segDir ).multiplyScalar( s1 ).add( segCenter );\r\n\r\n\t\t\t}\r\n\r\n\t\t\treturn sqrDist;\r\n\r\n\t\t};\r\n\r\n\t}(),\r\n\r\n\r\n\tisIntersectionSphere: function ( sphere ) {\r\n\r\n\t\treturn this.distanceToPoint( sphere.center ) <= sphere.radius;\r\n\r\n\t},\r\n\r\n\tintersectSphere: function () {\r\n\r\n\t\t// from http://www.scratchapixel.com/lessons/3d-basic-lessons/lesson-7-intersecting-simple-shapes/ray-sphere-intersection/\r\n\r\n\t\tvar v1 = new THREE.Vector3();\r\n\r\n\t\treturn function ( sphere, optionalTarget ) {\r\n\r\n\t\t\tv1.subVectors( sphere.center, this.origin );\r\n\r\n\t\t\tvar tca = v1.dot( this.direction );\r\n\r\n\t\t\tvar d2 = v1.dot( v1 ) - tca * tca;\r\n\r\n\t\t\tvar radius2 = sphere.radius * sphere.radius;\r\n\r\n\t\t\tif ( d2 > radius2 ) return null;\r\n\r\n\t\t\tvar thc = Math.sqrt( radius2 - d2 );\r\n\r\n\t\t\t// t0 = first intersect point - entrance on front of sphere\r\n\t\t\tvar t0 = tca - thc;\r\n\r\n\t\t\t// t1 = second intersect point - exit point on back of sphere\r\n\t\t\tvar t1 = tca + thc;\r\n\r\n\t\t\t// test to see if both t0 and t1 are behind the ray - if so, return null\r\n\t\t\tif ( t0 < 0 && t1 < 0 ) return null;\r\n\r\n\t\t\t// test to see if t0 is behind the ray:\r\n\t\t\t// if it is, the ray is inside the sphere, so return the second exit point scaled by t1,\r\n\t\t\t// in order to always return an intersect point that is in front of the ray.\r\n\t\t\tif ( t0 < 0 ) return this.at( t1, optionalTarget );\r\n\r\n\t\t\t// else t0 is in front of the ray, so return the first collision point scaled by t0\r\n\t\t\treturn this.at( t0, optionalTarget );\r\n\r\n\t\t}\r\n\r\n\t}(),\r\n\r\n\tisIntersectionPlane: function ( plane ) {\r\n\r\n\t\t// check if the ray lies on the plane first\r\n\r\n\t\tvar distToPoint = plane.distanceToPoint( this.origin );\r\n\r\n\t\tif ( distToPoint === 0 ) {\r\n\r\n\t\t\treturn true;\r\n\r\n\t\t}\r\n\r\n\t\tvar denominator = plane.normal.dot( this.direction );\r\n\r\n\t\tif ( denominator * distToPoint < 0 ) {\r\n\r\n\t\t\treturn true;\r\n\r\n\t\t}\r\n\r\n\t\t// ray origin is behind the plane (and is pointing behind it)\r\n\r\n\t\treturn false;\r\n\r\n\t},\r\n\r\n\tdistanceToPlane: function ( plane ) {\r\n\r\n\t\tvar denominator = plane.normal.dot( this.direction );\r\n\t\tif ( denominator === 0 ) {\r\n\r\n\t\t\t// line is coplanar, return origin\r\n\t\t\tif ( plane.distanceToPoint( this.origin ) === 0 ) {\r\n\r\n\t\t\t\treturn 0;\r\n\r\n\t\t\t}\r\n\r\n\t\t\t// Null is preferable to undefined since undefined means.... it is undefined\r\n\r\n\t\t\treturn null;\r\n\r\n\t\t}\r\n\r\n\t\tvar t = - ( this.origin.dot( plane.normal ) + plane.constant ) / denominator;\r\n\r\n\t\t// Return if the ray never intersects the plane\r\n\r\n\t\treturn t >= 0 ? t : null;\r\n\r\n\t},\r\n\r\n\tintersectPlane: function ( plane, optionalTarget ) {\r\n\r\n\t\tvar t = this.distanceToPlane( plane );\r\n\r\n\t\tif ( t === null ) {\r\n\r\n\t\t\treturn null;\r\n\r\n\t\t}\r\n\r\n\t\treturn this.at( t, optionalTarget );\r\n\r\n\t},\r\n\r\n\tisIntersectionBox: function () {\r\n\r\n\t\tvar v = new THREE.Vector3();\r\n\r\n\t\treturn function ( box ) {\r\n\r\n\t\t\treturn this.intersectBox( box, v ) !== null;\r\n\r\n\t\t};\r\n\r\n\t}(),\r\n\r\n\tintersectBox: function ( box, optionalTarget ) {\r\n\r\n\t\t// http://www.scratchapixel.com/lessons/3d-basic-lessons/lesson-7-intersecting-simple-shapes/ray-box-intersection/\r\n\r\n\t\tvar tmin, tmax, tymin, tymax, tzmin, tzmax;\r\n\r\n\t\tvar invdirx = 1 / this.direction.x,\r\n\t\t\tinvdiry = 1 / this.direction.y,\r\n\t\t\tinvdirz = 1 / this.direction.z;\r\n\r\n\t\tvar origin = this.origin;\r\n\r\n\t\tif ( invdirx >= 0 ) {\r\n\r\n\t\t\ttmin = ( box.min.x - origin.x ) * invdirx;\r\n\t\t\ttmax = ( box.max.x - origin.x ) * invdirx;\r\n\r\n\t\t} else {\r\n\r\n\t\t\ttmin = ( box.max.x - origin.x ) * invdirx;\r\n\t\t\ttmax = ( box.min.x - origin.x ) * invdirx;\r\n\r\n\t\t}\r\n\r\n\t\tif ( invdiry >= 0 ) {\r\n\r\n\t\t\ttymin = ( box.min.y - origin.y ) * invdiry;\r\n\t\t\ttymax = ( box.max.y - origin.y ) * invdiry;\r\n\r\n\t\t} else {\r\n\r\n\t\t\ttymin = ( box.max.y - origin.y ) * invdiry;\r\n\t\t\ttymax = ( box.min.y - origin.y ) * invdiry;\r\n\r\n\t\t}\r\n\r\n\t\tif ( ( tmin > tymax ) || ( tymin > tmax ) ) return null;\r\n\r\n\t\t// These lines also handle the case where tmin or tmax is NaN\r\n\t\t// (result of 0 * Infinity). x !== x returns true if x is NaN\r\n\r\n\t\tif ( tymin > tmin || tmin !== tmin ) tmin = tymin;\r\n\r\n\t\tif ( tymax < tmax || tmax !== tmax ) tmax = tymax;\r\n\r\n\t\tif ( invdirz >= 0 ) {\r\n\r\n\t\t\ttzmin = ( box.min.z - origin.z ) * invdirz;\r\n\t\t\ttzmax = ( box.max.z - origin.z ) * invdirz;\r\n\r\n\t\t} else {\r\n\r\n\t\t\ttzmin = ( box.max.z - origin.z ) * invdirz;\r\n\t\t\ttzmax = ( box.min.z - origin.z ) * invdirz;\r\n\r\n\t\t}\r\n\r\n\t\tif ( ( tmin > tzmax ) || ( tzmin > tmax ) ) return null;\r\n\r\n\t\tif ( tzmin > tmin || tmin !== tmin ) tmin = tzmin;\r\n\r\n\t\tif ( tzmax < tmax || tmax !== tmax ) tmax = tzmax;\r\n\r\n\t\t//return point closest to the ray (positive side)\r\n\r\n\t\tif ( tmax < 0 ) return null;\r\n\r\n\t\treturn this.at( tmin >= 0 ? tmin : tmax, optionalTarget );\r\n\r\n\t},\r\n\r\n\tintersectTriangle: function () {\r\n\r\n\t\t// Compute the offset origin, edges, and normal.\r\n\t\tvar diff = new THREE.Vector3();\r\n\t\tvar edge1 = new THREE.Vector3();\r\n\t\tvar edge2 = new THREE.Vector3();\r\n\t\tvar normal = new THREE.Vector3();\r\n\r\n\t\treturn function ( a, b, c, backfaceCulling, optionalTarget ) {\r\n\r\n\t\t\t// from http://www.geometrictools.com/LibMathematics/Intersection/Wm5IntrRay3Triangle3.cpp\r\n\r\n\t\t\tedge1.subVectors( b, a );\r\n\t\t\tedge2.subVectors( c, a );\r\n\t\t\tnormal.crossVectors( edge1, edge2 );\r\n\r\n\t\t\t// Solve Q + t*D = b1*E1 + b2*E2 (Q = kDiff, D = ray direction,\r\n\t\t\t// E1 = kEdge1, E2 = kEdge2, N = Cross(E1,E2)) by\r\n\t\t\t// |Dot(D,N)|*b1 = sign(Dot(D,N))*Dot(D,Cross(Q,E2))\r\n\t\t\t// |Dot(D,N)|*b2 = sign(Dot(D,N))*Dot(D,Cross(E1,Q))\r\n\t\t\t// |Dot(D,N)|*t = -sign(Dot(D,N))*Dot(Q,N)\r\n\t\t\tvar DdN = this.direction.dot( normal );\r\n\t\t\tvar sign;\r\n\r\n\t\t\tif ( DdN > 0 ) {\r\n\r\n\t\t\t\tif ( backfaceCulling ) return null;\r\n\t\t\t\tsign = 1;\r\n\r\n\t\t\t} else if ( DdN < 0 ) {\r\n\r\n\t\t\t\tsign = - 1;\r\n\t\t\t\tDdN = - DdN;\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\treturn null;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tdiff.subVectors( this.origin, a );\r\n\t\t\tvar DdQxE2 = sign * this.direction.dot( edge2.crossVectors( diff, edge2 ) );\r\n\r\n\t\t\t// b1 < 0, no intersection\r\n\t\t\tif ( DdQxE2 < 0 ) {\r\n\r\n\t\t\t\treturn null;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tvar DdE1xQ = sign * this.direction.dot( edge1.cross( diff ) );\r\n\r\n\t\t\t// b2 < 0, no intersection\r\n\t\t\tif ( DdE1xQ < 0 ) {\r\n\r\n\t\t\t\treturn null;\r\n\r\n\t\t\t}\r\n\r\n\t\t\t// b1+b2 > 1, no intersection\r\n\t\t\tif ( DdQxE2 + DdE1xQ > DdN ) {\r\n\r\n\t\t\t\treturn null;\r\n\r\n\t\t\t}\r\n\r\n\t\t\t// Line intersects triangle, check if ray does.\r\n\t\t\tvar QdN = - sign * diff.dot( normal );\r\n\r\n\t\t\t// t < 0, no intersection\r\n\t\t\tif ( QdN < 0 ) {\r\n\r\n\t\t\t\treturn null;\r\n\r\n\t\t\t}\r\n\r\n\t\t\t// Ray intersects triangle.\r\n\t\t\treturn this.at( QdN / DdN, optionalTarget );\r\n\r\n\t\t};\r\n\r\n\t}(),\r\n\r\n\tapplyMatrix4: function ( matrix4 ) {\r\n\r\n\t\tthis.direction.add( this.origin ).applyMatrix4( matrix4 );\r\n\t\tthis.origin.applyMatrix4( matrix4 );\r\n\t\tthis.direction.sub( this.origin );\r\n\t\tthis.direction.normalize();\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tequals: function ( ray ) {\r\n\r\n\t\treturn ray.origin.equals( this.origin ) && ray.direction.equals( this.direction );\r\n\r\n\t}\r\n\r\n};\r\n\r\n// File:src/math/Sphere.js\r\n\r\n/**\r\n * @author bhouston / http://exocortex.com\r\n * @author mrdoob / http://mrdoob.com/\r\n */\r\n\r\nTHREE.Sphere = function ( center, radius ) {\r\n\r\n\tthis.center = ( center !== undefined ) ? center : new THREE.Vector3();\r\n\tthis.radius = ( radius !== undefined ) ? radius : 0;\r\n\r\n};\r\n\r\nTHREE.Sphere.prototype = {\r\n\r\n\tconstructor: THREE.Sphere,\r\n\r\n\tset: function ( center, radius ) {\r\n\r\n\t\tthis.center.copy( center );\r\n\t\tthis.radius = radius;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tsetFromPoints: function () {\r\n\r\n\t\tvar box = new THREE.Box3();\r\n\r\n\t\treturn function ( points, optionalCenter ) {\r\n\r\n\t\t\tvar center = this.center;\r\n\r\n\t\t\tif ( optionalCenter !== undefined ) {\r\n\r\n\t\t\t\tcenter.copy( optionalCenter );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tbox.setFromPoints( points ).center( center );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tvar maxRadiusSq = 0;\r\n\r\n\t\t\tfor ( var i = 0, il = points.length; i < il; i ++ ) {\r\n\r\n\t\t\t\tmaxRadiusSq = Math.max( maxRadiusSq, center.distanceToSquared( points[ i ] ) );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tthis.radius = Math.sqrt( maxRadiusSq );\r\n\r\n\t\t\treturn this;\r\n\r\n\t\t};\r\n\r\n\t}(),\r\n\r\n\tclone: function () {\r\n\r\n\t\treturn new this.constructor().copy( this );\r\n\r\n\t},\r\n\r\n\tcopy: function ( sphere ) {\r\n\r\n\t\tthis.center.copy( sphere.center );\r\n\t\tthis.radius = sphere.radius;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tempty: function () {\r\n\r\n\t\treturn ( this.radius <= 0 );\r\n\r\n\t},\r\n\r\n\tcontainsPoint: function ( point ) {\r\n\r\n\t\treturn ( point.distanceToSquared( this.center ) <= ( this.radius * this.radius ) );\r\n\r\n\t},\r\n\r\n\tdistanceToPoint: function ( point ) {\r\n\r\n\t\treturn ( point.distanceTo( this.center ) - this.radius );\r\n\r\n\t},\r\n\r\n\tintersectsSphere: function ( sphere ) {\r\n\r\n\t\tvar radiusSum = this.radius + sphere.radius;\r\n\r\n\t\treturn sphere.center.distanceToSquared( this.center ) <= ( radiusSum * radiusSum );\r\n\r\n\t},\r\n\r\n\tclampPoint: function ( point, optionalTarget ) {\r\n\r\n\t\tvar deltaLengthSq = this.center.distanceToSquared( point );\r\n\r\n\t\tvar result = optionalTarget || new THREE.Vector3();\r\n\t\tresult.copy( point );\r\n\r\n\t\tif ( deltaLengthSq > ( this.radius * this.radius ) ) {\r\n\r\n\t\t\tresult.sub( this.center ).normalize();\r\n\t\t\tresult.multiplyScalar( this.radius ).add( this.center );\r\n\r\n\t\t}\r\n\r\n\t\treturn result;\r\n\r\n\t},\r\n\r\n\tgetBoundingBox: function ( optionalTarget ) {\r\n\r\n\t\tvar box = optionalTarget || new THREE.Box3();\r\n\r\n\t\tbox.set( this.center, this.center );\r\n\t\tbox.expandByScalar( this.radius );\r\n\r\n\t\treturn box;\r\n\r\n\t},\r\n\r\n\tapplyMatrix4: function ( matrix ) {\r\n\r\n\t\tthis.center.applyMatrix4( matrix );\r\n\t\tthis.radius = this.radius * matrix.getMaxScaleOnAxis();\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\ttranslate: function ( offset ) {\r\n\r\n\t\tthis.center.add( offset );\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tequals: function ( sphere ) {\r\n\r\n\t\treturn sphere.center.equals( this.center ) && ( sphere.radius === this.radius );\r\n\r\n\t}\r\n\r\n};\r\n\r\n// File:src/math/Frustum.js\r\n\r\n/**\r\n * @author mrdoob / http://mrdoob.com/\r\n * @author alteredq / http://alteredqualia.com/\r\n * @author bhouston / http://exocortex.com\r\n */\r\n\r\nTHREE.Frustum = function ( p0, p1, p2, p3, p4, p5 ) {\r\n\r\n\tthis.planes = [\r\n\r\n\t\t( p0 !== undefined ) ? p0 : new THREE.Plane(),\r\n\t\t( p1 !== undefined ) ? p1 : new THREE.Plane(),\r\n\t\t( p2 !== undefined ) ? p2 : new THREE.Plane(),\r\n\t\t( p3 !== undefined ) ? p3 : new THREE.Plane(),\r\n\t\t( p4 !== undefined ) ? p4 : new THREE.Plane(),\r\n\t\t( p5 !== undefined ) ? p5 : new THREE.Plane()\r\n\r\n\t];\r\n\r\n};\r\n\r\nTHREE.Frustum.prototype = {\r\n\r\n\tconstructor: THREE.Frustum,\r\n\r\n\tset: function ( p0, p1, p2, p3, p4, p5 ) {\r\n\r\n\t\tvar planes = this.planes;\r\n\r\n\t\tplanes[ 0 ].copy( p0 );\r\n\t\tplanes[ 1 ].copy( p1 );\r\n\t\tplanes[ 2 ].copy( p2 );\r\n\t\tplanes[ 3 ].copy( p3 );\r\n\t\tplanes[ 4 ].copy( p4 );\r\n\t\tplanes[ 5 ].copy( p5 );\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tclone: function () {\r\n\r\n\t\treturn new this.constructor().copy( this );\r\n\r\n\t},\r\n\r\n\tcopy: function ( frustum ) {\r\n\r\n\t\tvar planes = this.planes;\r\n\r\n\t\tfor ( var i = 0; i < 6; i ++ ) {\r\n\r\n\t\t\tplanes[ i ].copy( frustum.planes[ i ] );\r\n\r\n\t\t}\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tsetFromMatrix: function ( m ) {\r\n\r\n\t\tvar planes = this.planes;\r\n\t\tvar me = m.elements;\r\n\t\tvar me0 = me[ 0 ], me1 = me[ 1 ], me2 = me[ 2 ], me3 = me[ 3 ];\r\n\t\tvar me4 = me[ 4 ], me5 = me[ 5 ], me6 = me[ 6 ], me7 = me[ 7 ];\r\n\t\tvar me8 = me[ 8 ], me9 = me[ 9 ], me10 = me[ 10 ], me11 = me[ 11 ];\r\n\t\tvar me12 = me[ 12 ], me13 = me[ 13 ], me14 = me[ 14 ], me15 = me[ 15 ];\r\n\r\n\t\tplanes[ 0 ].setComponents( me3 - me0, me7 - me4, me11 - me8, me15 - me12 ).normalize();\r\n\t\tplanes[ 1 ].setComponents( me3 + me0, me7 + me4, me11 + me8, me15 + me12 ).normalize();\r\n\t\tplanes[ 2 ].setComponents( me3 + me1, me7 + me5, me11 + me9, me15 + me13 ).normalize();\r\n\t\tplanes[ 3 ].setComponents( me3 - me1, me7 - me5, me11 - me9, me15 - me13 ).normalize();\r\n\t\tplanes[ 4 ].setComponents( me3 - me2, me7 - me6, me11 - me10, me15 - me14 ).normalize();\r\n\t\tplanes[ 5 ].setComponents( me3 + me2, me7 + me6, me11 + me10, me15 + me14 ).normalize();\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tintersectsObject: function () {\r\n\r\n\t\tvar sphere = new THREE.Sphere();\r\n\r\n\t\treturn function ( object ) {\r\n\r\n\t\t\tvar geometry = object.geometry;\r\n\r\n\t\t\tif ( geometry.boundingSphere === null ) geometry.computeBoundingSphere();\r\n\r\n\t\t\tsphere.copy( geometry.boundingSphere );\r\n\t\t\tsphere.applyMatrix4( object.matrixWorld );\r\n\r\n\t\t\treturn this.intersectsSphere( sphere );\r\n\r\n\t\t};\r\n\r\n\t}(),\r\n\r\n\tintersectsSphere: function ( sphere ) {\r\n\r\n\t\tvar planes = this.planes;\r\n\t\tvar center = sphere.center;\r\n\t\tvar negRadius = - sphere.radius;\r\n\r\n\t\tfor ( var i = 0; i < 6; i ++ ) {\r\n\r\n\t\t\tvar distance = planes[ i ].distanceToPoint( center );\r\n\r\n\t\t\tif ( distance < negRadius ) {\r\n\r\n\t\t\t\treturn false;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn true;\r\n\r\n\t},\r\n\r\n\tintersectsBox: function () {\r\n\r\n\t\tvar p1 = new THREE.Vector3(),\r\n\t\t\tp2 = new THREE.Vector3();\r\n\r\n\t\treturn function ( box ) {\r\n\r\n\t\t\tvar planes = this.planes;\r\n\r\n\t\t\tfor ( var i = 0; i < 6 ; i ++ ) {\r\n\r\n\t\t\t\tvar plane = planes[ i ];\r\n\r\n\t\t\t\tp1.x = plane.normal.x > 0 ? box.min.x : box.max.x;\r\n\t\t\t\tp2.x = plane.normal.x > 0 ? box.max.x : box.min.x;\r\n\t\t\t\tp1.y = plane.normal.y > 0 ? box.min.y : box.max.y;\r\n\t\t\t\tp2.y = plane.normal.y > 0 ? box.max.y : box.min.y;\r\n\t\t\t\tp1.z = plane.normal.z > 0 ? box.min.z : box.max.z;\r\n\t\t\t\tp2.z = plane.normal.z > 0 ? box.max.z : box.min.z;\r\n\r\n\t\t\t\tvar d1 = plane.distanceToPoint( p1 );\r\n\t\t\t\tvar d2 = plane.distanceToPoint( p2 );\r\n\r\n\t\t\t\t// if both outside plane, no intersection\r\n\r\n\t\t\t\tif ( d1 < 0 && d2 < 0 ) {\r\n\r\n\t\t\t\t\treturn false;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\treturn true;\r\n\r\n\t\t};\r\n\r\n\t}(),\r\n\r\n\r\n\tcontainsPoint: function ( point ) {\r\n\r\n\t\tvar planes = this.planes;\r\n\r\n\t\tfor ( var i = 0; i < 6; i ++ ) {\r\n\r\n\t\t\tif ( planes[ i ].distanceToPoint( point ) < 0 ) {\r\n\r\n\t\t\t\treturn false;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn true;\r\n\r\n\t}\r\n\r\n};\r\n\r\n// File:src/math/Plane.js\r\n\r\n/**\r\n * @author bhouston / http://exocortex.com\r\n */\r\n\r\nTHREE.Plane = function ( normal, constant ) {\r\n\r\n\tthis.normal = ( normal !== undefined ) ? normal : new THREE.Vector3( 1, 0, 0 );\r\n\tthis.constant = ( constant !== undefined ) ? constant : 0;\r\n\r\n};\r\n\r\nTHREE.Plane.prototype = {\r\n\r\n\tconstructor: THREE.Plane,\r\n\r\n\tset: function ( normal, constant ) {\r\n\r\n\t\tthis.normal.copy( normal );\r\n\t\tthis.constant = constant;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tsetComponents: function ( x, y, z, w ) {\r\n\r\n\t\tthis.normal.set( x, y, z );\r\n\t\tthis.constant = w;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tsetFromNormalAndCoplanarPoint: function ( normal, point ) {\r\n\r\n\t\tthis.normal.copy( normal );\r\n\t\tthis.constant = - point.dot( this.normal );\t// must be this.normal, not normal, as this.normal is normalized\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tsetFromCoplanarPoints: function () {\r\n\r\n\t\tvar v1 = new THREE.Vector3();\r\n\t\tvar v2 = new THREE.Vector3();\r\n\r\n\t\treturn function ( a, b, c ) {\r\n\r\n\t\t\tvar normal = v1.subVectors( c, b ).cross( v2.subVectors( a, b ) ).normalize();\r\n\r\n\t\t\t// Q: should an error be thrown if normal is zero (e.g. degenerate plane)?\r\n\r\n\t\t\tthis.setFromNormalAndCoplanarPoint( normal, a );\r\n\r\n\t\t\treturn this;\r\n\r\n\t\t};\r\n\r\n\t}(),\r\n\r\n\tclone: function () {\r\n\r\n\t\treturn new this.constructor().copy( this );\r\n\r\n\t},\r\n\r\n\tcopy: function ( plane ) {\r\n\r\n\t\tthis.normal.copy( plane.normal );\r\n\t\tthis.constant = plane.constant;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tnormalize: function () {\r\n\r\n\t\t// Note: will lead to a divide by zero if the plane is invalid.\r\n\r\n\t\tvar inverseNormalLength = 1.0 / this.normal.length();\r\n\t\tthis.normal.multiplyScalar( inverseNormalLength );\r\n\t\tthis.constant *= inverseNormalLength;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tnegate: function () {\r\n\r\n\t\tthis.constant *= - 1;\r\n\t\tthis.normal.negate();\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tdistanceToPoint: function ( point ) {\r\n\r\n\t\treturn this.normal.dot( point ) + this.constant;\r\n\r\n\t},\r\n\r\n\tdistanceToSphere: function ( sphere ) {\r\n\r\n\t\treturn this.distanceToPoint( sphere.center ) - sphere.radius;\r\n\r\n\t},\r\n\r\n\tprojectPoint: function ( point, optionalTarget ) {\r\n\r\n\t\treturn this.orthoPoint( point, optionalTarget ).sub( point ).negate();\r\n\r\n\t},\r\n\r\n\torthoPoint: function ( point, optionalTarget ) {\r\n\r\n\t\tvar perpendicularMagnitude = this.distanceToPoint( point );\r\n\r\n\t\tvar result = optionalTarget || new THREE.Vector3();\r\n\t\treturn result.copy( this.normal ).multiplyScalar( perpendicularMagnitude );\r\n\r\n\t},\r\n\r\n\tisIntersectionLine: function ( line ) {\r\n\r\n\t\t// Note: this tests if a line intersects the plane, not whether it (or its end-points) are coplanar with it.\r\n\r\n\t\tvar startSign = this.distanceToPoint( line.start );\r\n\t\tvar endSign = this.distanceToPoint( line.end );\r\n\r\n\t\treturn ( startSign < 0 && endSign > 0 ) || ( endSign < 0 && startSign > 0 );\r\n\r\n\t},\r\n\r\n\tintersectLine: function () {\r\n\r\n\t\tvar v1 = new THREE.Vector3();\r\n\r\n\t\treturn function ( line, optionalTarget ) {\r\n\r\n\t\t\tvar result = optionalTarget || new THREE.Vector3();\r\n\r\n\t\t\tvar direction = line.delta( v1 );\r\n\r\n\t\t\tvar denominator = this.normal.dot( direction );\r\n\r\n\t\t\tif ( denominator === 0 ) {\r\n\r\n\t\t\t\t// line is coplanar, return origin\r\n\t\t\t\tif ( this.distanceToPoint( line.start ) === 0 ) {\r\n\r\n\t\t\t\t\treturn result.copy( line.start );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\t// Unsure if this is the correct method to handle this case.\r\n\t\t\t\treturn undefined;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tvar t = - ( line.start.dot( this.normal ) + this.constant ) / denominator;\r\n\r\n\t\t\tif ( t < 0 || t > 1 ) {\r\n\r\n\t\t\t\treturn undefined;\r\n\r\n\t\t\t}\r\n\r\n\t\t\treturn result.copy( direction ).multiplyScalar( t ).add( line.start );\r\n\r\n\t\t};\r\n\r\n\t}(),\r\n\r\n\r\n\tcoplanarPoint: function ( optionalTarget ) {\r\n\r\n\t\tvar result = optionalTarget || new THREE.Vector3();\r\n\t\treturn result.copy( this.normal ).multiplyScalar( - this.constant );\r\n\r\n\t},\r\n\r\n\tapplyMatrix4: function () {\r\n\r\n\t\tvar v1 = new THREE.Vector3();\r\n\t\tvar v2 = new THREE.Vector3();\r\n\t\tvar m1 = new THREE.Matrix3();\r\n\r\n\t\treturn function ( matrix, optionalNormalMatrix ) {\r\n\r\n\t\t\t// compute new normal based on theory here:\r\n\t\t\t// http://www.songho.ca/opengl/gl_normaltransform.html\r\n\t\t\tvar normalMatrix = optionalNormalMatrix || m1.getNormalMatrix( matrix );\r\n\t\t\tvar newNormal = v1.copy( this.normal ).applyMatrix3( normalMatrix );\r\n\r\n\t\t\tvar newCoplanarPoint = this.coplanarPoint( v2 );\r\n\t\t\tnewCoplanarPoint.applyMatrix4( matrix );\r\n\r\n\t\t\tthis.setFromNormalAndCoplanarPoint( newNormal, newCoplanarPoint );\r\n\r\n\t\t\treturn this;\r\n\r\n\t\t};\r\n\r\n\t}(),\r\n\r\n\ttranslate: function ( offset ) {\r\n\r\n\t\tthis.constant = this.constant - offset.dot( this.normal );\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tequals: function ( plane ) {\r\n\r\n\t\treturn plane.normal.equals( this.normal ) && ( plane.constant === this.constant );\r\n\r\n\t}\r\n\r\n};\r\n\r\n// File:src/math/Math.js\r\n\r\n/**\r\n * @author alteredq / http://alteredqualia.com/\r\n * @author mrdoob / http://mrdoob.com/\r\n */\r\n\r\nTHREE.Math = {\r\n\r\n\tgenerateUUID: function () {\r\n\r\n\t\t// http://www.broofa.com/Tools/Math.uuid.htm\r\n\r\n\t\tvar chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'.split( '' );\r\n\t\tvar uuid = new Array( 36 );\r\n\t\tvar rnd = 0, r;\r\n\r\n\t\treturn function () {\r\n\r\n\t\t\tfor ( var i = 0; i < 36; i ++ ) {\r\n\r\n\t\t\t\tif ( i === 8 || i === 13 || i === 18 || i === 23 ) {\r\n\r\n\t\t\t\t\tuuid[ i ] = '-';\r\n\r\n\t\t\t\t} else if ( i === 14 ) {\r\n\r\n\t\t\t\t\tuuid[ i ] = '4';\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\tif ( rnd <= 0x02 ) rnd = 0x2000000 + ( Math.random() * 0x1000000 ) | 0;\r\n\t\t\t\t\tr = rnd & 0xf;\r\n\t\t\t\t\trnd = rnd >> 4;\r\n\t\t\t\t\tuuid[ i ] = chars[ ( i === 19 ) ? ( r & 0x3 ) | 0x8 : r ];\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\treturn uuid.join( '' );\r\n\r\n\t\t};\r\n\r\n\t}(),\r\n\r\n\t// Clamp value to range \r\n\r\n\tclamp: function ( x, a, b ) {\r\n\r\n\t\treturn ( x < a ) ? a : ( ( x > b ) ? b : x );\r\n\r\n\t},\r\n\r\n\t// Clamp value to range to range \r\n\r\n\tmapLinear: function ( x, a1, a2, b1, b2 ) {\r\n\r\n\t\treturn b1 + ( x - a1 ) * ( b2 - b1 ) / ( a2 - a1 );\r\n\r\n\t},\r\n\r\n\t// http://en.wikipedia.org/wiki/Smoothstep\r\n\r\n\tsmoothstep: function ( x, min, max ) {\r\n\r\n\t\tif ( x <= min ) return 0;\r\n\t\tif ( x >= max ) return 1;\r\n\r\n\t\tx = ( x - min ) / ( max - min );\r\n\r\n\t\treturn x * x * ( 3 - 2 * x );\r\n\r\n\t},\r\n\r\n\tsmootherstep: function ( x, min, max ) {\r\n\r\n\t\tif ( x <= min ) return 0;\r\n\t\tif ( x >= max ) return 1;\r\n\r\n\t\tx = ( x - min ) / ( max - min );\r\n\r\n\t\treturn x * x * x * ( x * ( x * 6 - 15 ) + 10 );\r\n\r\n\t},\r\n\r\n\t// Random float from <0, 1> with 16 bits of randomness\r\n\t// (standard Math.random() creates repetitive patterns when applied over larger space)\r\n\r\n\trandom16: function () {\r\n\r\n\t\treturn ( 65280 * Math.random() + 255 * Math.random() ) / 65535;\r\n\r\n\t},\r\n\r\n\t// Random integer from interval\r\n\r\n\trandInt: function ( low, high ) {\r\n\r\n\t\treturn low + Math.floor( Math.random() * ( high - low + 1 ) );\r\n\r\n\t},\r\n\r\n\t// Random float from interval\r\n\r\n\trandFloat: function ( low, high ) {\r\n\r\n\t\treturn low + Math.random() * ( high - low );\r\n\r\n\t},\r\n\r\n\t// Random float from <-range/2, range/2> interval\r\n\r\n\trandFloatSpread: function ( range ) {\r\n\r\n\t\treturn range * ( 0.5 - Math.random() );\r\n\r\n\t},\r\n\r\n\tdegToRad: function () {\r\n\r\n\t\tvar degreeToRadiansFactor = Math.PI / 180;\r\n\r\n\t\treturn function ( degrees ) {\r\n\r\n\t\t\treturn degrees * degreeToRadiansFactor;\r\n\r\n\t\t};\r\n\r\n\t}(),\r\n\r\n\tradToDeg: function () {\r\n\r\n\t\tvar radianToDegreesFactor = 180 / Math.PI;\r\n\r\n\t\treturn function ( radians ) {\r\n\r\n\t\t\treturn radians * radianToDegreesFactor;\r\n\r\n\t\t};\r\n\r\n\t}(),\r\n\r\n\tisPowerOfTwo: function ( value ) {\r\n\r\n\t\treturn ( value & ( value - 1 ) ) === 0 && value !== 0;\r\n\r\n\t},\r\n\r\n\tnextPowerOfTwo: function ( value ) {\r\n\r\n\t\tvalue --;\r\n\t\tvalue |= value >> 1;\r\n\t\tvalue |= value >> 2;\r\n\t\tvalue |= value >> 4;\r\n\t\tvalue |= value >> 8;\r\n\t\tvalue |= value >> 16;\r\n\t\tvalue ++;\r\n\r\n\t\treturn value;\r\n\r\n\t}\r\n\r\n};\r\n\r\n// File:src/math/Spline.js\r\n\r\n/**\r\n * Spline from Tween.js, slightly optimized (and trashed)\r\n * http://sole.github.com/tween.js/examples/05_spline.html\r\n *\r\n * @author mrdoob / http://mrdoob.com/\r\n * @author alteredq / http://alteredqualia.com/\r\n */\r\n\r\nTHREE.Spline = function ( points ) {\r\n\r\n\tthis.points = points;\r\n\r\n\tvar c = [], v3 = { x: 0, y: 0, z: 0 },\r\n\tpoint, intPoint, weight, w2, w3,\r\n\tpa, pb, pc, pd;\r\n\r\n\tthis.initFromArray = function ( a ) {\r\n\r\n\t\tthis.points = [];\r\n\r\n\t\tfor ( var i = 0; i < a.length; i ++ ) {\r\n\r\n\t\t\tthis.points[ i ] = { x: a[ i ][ 0 ], y: a[ i ][ 1 ], z: a[ i ][ 2 ] };\r\n\r\n\t\t}\r\n\r\n\t};\r\n\r\n\tthis.getPoint = function ( k ) {\r\n\r\n\t\tpoint = ( this.points.length - 1 ) * k;\r\n\t\tintPoint = Math.floor( point );\r\n\t\tweight = point - intPoint;\r\n\r\n\t\tc[ 0 ] = intPoint === 0 ? intPoint : intPoint - 1;\r\n\t\tc[ 1 ] = intPoint;\r\n\t\tc[ 2 ] = intPoint > this.points.length - 2 ? this.points.length - 1 : intPoint + 1;\r\n\t\tc[ 3 ] = intPoint > this.points.length - 3 ? this.points.length - 1 : intPoint + 2;\r\n\r\n\t\tpa = this.points[ c[ 0 ] ];\r\n\t\tpb = this.points[ c[ 1 ] ];\r\n\t\tpc = this.points[ c[ 2 ] ];\r\n\t\tpd = this.points[ c[ 3 ] ];\r\n\r\n\t\tw2 = weight * weight;\r\n\t\tw3 = weight * w2;\r\n\r\n\t\tv3.x = interpolate( pa.x, pb.x, pc.x, pd.x, weight, w2, w3 );\r\n\t\tv3.y = interpolate( pa.y, pb.y, pc.y, pd.y, weight, w2, w3 );\r\n\t\tv3.z = interpolate( pa.z, pb.z, pc.z, pd.z, weight, w2, w3 );\r\n\r\n\t\treturn v3;\r\n\r\n\t};\r\n\r\n\tthis.getControlPointsArray = function () {\r\n\r\n\t\tvar i, p, l = this.points.length,\r\n\t\t\tcoords = [];\r\n\r\n\t\tfor ( i = 0; i < l; i ++ ) {\r\n\r\n\t\t\tp = this.points[ i ];\r\n\t\t\tcoords[ i ] = [ p.x, p.y, p.z ];\r\n\r\n\t\t}\r\n\r\n\t\treturn coords;\r\n\r\n\t};\r\n\r\n\t// approximate length by summing linear segments\r\n\r\n\tthis.getLength = function ( nSubDivisions ) {\r\n\r\n\t\tvar i, index, nSamples, position,\r\n\t\t\tpoint = 0, intPoint = 0, oldIntPoint = 0,\r\n\t\t\toldPosition = new THREE.Vector3(),\r\n\t\t\ttmpVec = new THREE.Vector3(),\r\n\t\t\tchunkLengths = [],\r\n\t\t\ttotalLength = 0;\r\n\r\n\t\t// first point has 0 length\r\n\r\n\t\tchunkLengths[ 0 ] = 0;\r\n\r\n\t\tif ( ! nSubDivisions ) nSubDivisions = 100;\r\n\r\n\t\tnSamples = this.points.length * nSubDivisions;\r\n\r\n\t\toldPosition.copy( this.points[ 0 ] );\r\n\r\n\t\tfor ( i = 1; i < nSamples; i ++ ) {\r\n\r\n\t\t\tindex = i / nSamples;\r\n\r\n\t\t\tposition = this.getPoint( index );\r\n\t\t\ttmpVec.copy( position );\r\n\r\n\t\t\ttotalLength += tmpVec.distanceTo( oldPosition );\r\n\r\n\t\t\toldPosition.copy( position );\r\n\r\n\t\t\tpoint = ( this.points.length - 1 ) * index;\r\n\t\t\tintPoint = Math.floor( point );\r\n\r\n\t\t\tif ( intPoint !== oldIntPoint ) {\r\n\r\n\t\t\t\tchunkLengths[ intPoint ] = totalLength;\r\n\t\t\t\toldIntPoint = intPoint;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\t// last point ends with total length\r\n\r\n\t\tchunkLengths[ chunkLengths.length ] = totalLength;\r\n\r\n\t\treturn { chunks: chunkLengths, total: totalLength };\r\n\r\n\t};\r\n\r\n\tthis.reparametrizeByArcLength = function ( samplingCoef ) {\r\n\r\n\t\tvar i, j,\r\n\t\t\tindex, indexCurrent, indexNext,\r\n\t\t\trealDistance,\r\n\t\t\tsampling, position,\r\n\t\t\tnewpoints = [],\r\n\t\t\ttmpVec = new THREE.Vector3(),\r\n\t\t\tsl = this.getLength();\r\n\r\n\t\tnewpoints.push( tmpVec.copy( this.points[ 0 ] ).clone() );\r\n\r\n\t\tfor ( i = 1; i < this.points.length; i ++ ) {\r\n\r\n\t\t\t//tmpVec.copy( this.points[ i - 1 ] );\r\n\t\t\t//linearDistance = tmpVec.distanceTo( this.points[ i ] );\r\n\r\n\t\t\trealDistance = sl.chunks[ i ] - sl.chunks[ i - 1 ];\r\n\r\n\t\t\tsampling = Math.ceil( samplingCoef * realDistance / sl.total );\r\n\r\n\t\t\tindexCurrent = ( i - 1 ) / ( this.points.length - 1 );\r\n\t\t\tindexNext = i / ( this.points.length - 1 );\r\n\r\n\t\t\tfor ( j = 1; j < sampling - 1; j ++ ) {\r\n\r\n\t\t\t\tindex = indexCurrent + j * ( 1 / sampling ) * ( indexNext - indexCurrent );\r\n\r\n\t\t\t\tposition = this.getPoint( index );\r\n\t\t\t\tnewpoints.push( tmpVec.copy( position ).clone() );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tnewpoints.push( tmpVec.copy( this.points[ i ] ).clone() );\r\n\r\n\t\t}\r\n\r\n\t\tthis.points = newpoints;\r\n\r\n\t};\r\n\r\n\t// Catmull-Rom\r\n\r\n\tfunction interpolate( p0, p1, p2, p3, t, t2, t3 ) {\r\n\r\n\t\tvar v0 = ( p2 - p0 ) * 0.5,\r\n\t\t\tv1 = ( p3 - p1 ) * 0.5;\r\n\r\n\t\treturn ( 2 * ( p1 - p2 ) + v0 + v1 ) * t3 + ( - 3 * ( p1 - p2 ) - 2 * v0 - v1 ) * t2 + v0 * t + p1;\r\n\r\n\t}\r\n\r\n};\r\n\r\n// File:src/math/Triangle.js\r\n\r\n/**\r\n * @author bhouston / http://exocortex.com\r\n * @author mrdoob / http://mrdoob.com/\r\n */\r\n\r\nTHREE.Triangle = function ( a, b, c ) {\r\n\r\n\tthis.a = ( a !== undefined ) ? a : new THREE.Vector3();\r\n\tthis.b = ( b !== undefined ) ? b : new THREE.Vector3();\r\n\tthis.c = ( c !== undefined ) ? c : new THREE.Vector3();\r\n\r\n};\r\n\r\nTHREE.Triangle.normal = function () {\r\n\r\n\tvar v0 = new THREE.Vector3();\r\n\r\n\treturn function ( a, b, c, optionalTarget ) {\r\n\r\n\t\tvar result = optionalTarget || new THREE.Vector3();\r\n\r\n\t\tresult.subVectors( c, b );\r\n\t\tv0.subVectors( a, b );\r\n\t\tresult.cross( v0 );\r\n\r\n\t\tvar resultLengthSq = result.lengthSq();\r\n\t\tif ( resultLengthSq > 0 ) {\r\n\r\n\t\t\treturn result.multiplyScalar( 1 / Math.sqrt( resultLengthSq ) );\r\n\r\n\t\t}\r\n\r\n\t\treturn result.set( 0, 0, 0 );\r\n\r\n\t};\r\n\r\n}();\r\n\r\n// static/instance method to calculate barycentric coordinates\r\n// based on: http://www.blackpawn.com/texts/pointinpoly/default.html\r\nTHREE.Triangle.barycoordFromPoint = function () {\r\n\r\n\tvar v0 = new THREE.Vector3();\r\n\tvar v1 = new THREE.Vector3();\r\n\tvar v2 = new THREE.Vector3();\r\n\r\n\treturn function ( point, a, b, c, optionalTarget ) {\r\n\r\n\t\tv0.subVectors( c, a );\r\n\t\tv1.subVectors( b, a );\r\n\t\tv2.subVectors( point, a );\r\n\r\n\t\tvar dot00 = v0.dot( v0 );\r\n\t\tvar dot01 = v0.dot( v1 );\r\n\t\tvar dot02 = v0.dot( v2 );\r\n\t\tvar dot11 = v1.dot( v1 );\r\n\t\tvar dot12 = v1.dot( v2 );\r\n\r\n\t\tvar denom = ( dot00 * dot11 - dot01 * dot01 );\r\n\r\n\t\tvar result = optionalTarget || new THREE.Vector3();\r\n\r\n\t\t// collinear or singular triangle\r\n\t\tif ( denom === 0 ) {\r\n\r\n\t\t\t// arbitrary location outside of triangle?\r\n\t\t\t// not sure if this is the best idea, maybe should be returning undefined\r\n\t\t\treturn result.set( - 2, - 1, - 1 );\r\n\r\n\t\t}\r\n\r\n\t\tvar invDenom = 1 / denom;\r\n\t\tvar u = ( dot11 * dot02 - dot01 * dot12 ) * invDenom;\r\n\t\tvar v = ( dot00 * dot12 - dot01 * dot02 ) * invDenom;\r\n\r\n\t\t// barycentric coordinates must always sum to 1\r\n\t\treturn result.set( 1 - u - v, v, u );\r\n\r\n\t};\r\n\r\n}();\r\n\r\nTHREE.Triangle.containsPoint = function () {\r\n\r\n\tvar v1 = new THREE.Vector3();\r\n\r\n\treturn function ( point, a, b, c ) {\r\n\r\n\t\tvar result = THREE.Triangle.barycoordFromPoint( point, a, b, c, v1 );\r\n\r\n\t\treturn ( result.x >= 0 ) && ( result.y >= 0 ) && ( ( result.x + result.y ) <= 1 );\r\n\r\n\t};\r\n\r\n}();\r\n\r\nTHREE.Triangle.prototype = {\r\n\r\n\tconstructor: THREE.Triangle,\r\n\r\n\tset: function ( a, b, c ) {\r\n\r\n\t\tthis.a.copy( a );\r\n\t\tthis.b.copy( b );\r\n\t\tthis.c.copy( c );\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tsetFromPointsAndIndices: function ( points, i0, i1, i2 ) {\r\n\r\n\t\tthis.a.copy( points[ i0 ] );\r\n\t\tthis.b.copy( points[ i1 ] );\r\n\t\tthis.c.copy( points[ i2 ] );\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tclone: function () {\r\n\r\n\t\treturn new this.constructor().copy( this );\r\n\r\n\t},\r\n\r\n\tcopy: function ( triangle ) {\r\n\r\n\t\tthis.a.copy( triangle.a );\r\n\t\tthis.b.copy( triangle.b );\r\n\t\tthis.c.copy( triangle.c );\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tarea: function () {\r\n\r\n\t\tvar v0 = new THREE.Vector3();\r\n\t\tvar v1 = new THREE.Vector3();\r\n\r\n\t\treturn function () {\r\n\r\n\t\t\tv0.subVectors( this.c, this.b );\r\n\t\t\tv1.subVectors( this.a, this.b );\r\n\r\n\t\t\treturn v0.cross( v1 ).length() * 0.5;\r\n\r\n\t\t};\r\n\r\n\t}(),\r\n\r\n\tmidpoint: function ( optionalTarget ) {\r\n\r\n\t\tvar result = optionalTarget || new THREE.Vector3();\r\n\t\treturn result.addVectors( this.a, this.b ).add( this.c ).multiplyScalar( 1 / 3 );\r\n\r\n\t},\r\n\r\n\tnormal: function ( optionalTarget ) {\r\n\r\n\t\treturn THREE.Triangle.normal( this.a, this.b, this.c, optionalTarget );\r\n\r\n\t},\r\n\r\n\tplane: function ( optionalTarget ) {\r\n\r\n\t\tvar result = optionalTarget || new THREE.Plane();\r\n\r\n\t\treturn result.setFromCoplanarPoints( this.a, this.b, this.c );\r\n\r\n\t},\r\n\r\n\tbarycoordFromPoint: function ( point, optionalTarget ) {\r\n\r\n\t\treturn THREE.Triangle.barycoordFromPoint( point, this.a, this.b, this.c, optionalTarget );\r\n\r\n\t},\r\n\r\n\tcontainsPoint: function ( point ) {\r\n\r\n\t\treturn THREE.Triangle.containsPoint( point, this.a, this.b, this.c );\r\n\r\n\t},\r\n\r\n\tequals: function ( triangle ) {\r\n\r\n\t\treturn triangle.a.equals( this.a ) && triangle.b.equals( this.b ) && triangle.c.equals( this.c );\r\n\r\n\t}\r\n\r\n};\r\n\r\n// File:src/core/Clock.js\r\n\r\n/**\r\n * @author alteredq / http://alteredqualia.com/\r\n */\r\n\r\nTHREE.Clock = function ( autoStart ) {\r\n\r\n\tthis.autoStart = ( autoStart !== undefined ) ? autoStart : true;\r\n\r\n\tthis.startTime = 0;\r\n\tthis.oldTime = 0;\r\n\tthis.elapsedTime = 0;\r\n\r\n\tthis.running = false;\r\n\r\n};\r\n\r\nTHREE.Clock.prototype = {\r\n\r\n\tconstructor: THREE.Clock,\r\n\r\n\tstart: function () {\r\n\r\n\t\tthis.startTime = self.performance !== undefined && self.performance.now !== undefined\r\n\t\t\t\t\t ? self.performance.now()\r\n\t\t\t\t\t : Date.now();\r\n\r\n\t\tthis.oldTime = this.startTime;\r\n\t\tthis.running = true;\r\n\r\n\t},\r\n\r\n\tstop: function () {\r\n\r\n\t\tthis.getElapsedTime();\r\n\t\tthis.running = false;\r\n\r\n\t},\r\n\r\n\tgetElapsedTime: function () {\r\n\r\n\t\tthis.getDelta();\r\n\t\treturn this.elapsedTime;\r\n\r\n\t},\r\n\r\n\tgetDelta: function () {\r\n\r\n\t\tvar diff = 0;\r\n\r\n\t\tif ( this.autoStart && ! this.running ) {\r\n\r\n\t\t\tthis.start();\r\n\r\n\t\t}\r\n\r\n\t\tif ( this.running ) {\r\n\r\n\t\t\tvar newTime = self.performance !== undefined && self.performance.now !== undefined\r\n\t\t\t\t\t ? self.performance.now()\r\n\t\t\t\t\t : Date.now();\r\n\r\n\t\t\tdiff = 0.001 * ( newTime - this.oldTime );\r\n\t\t\tthis.oldTime = newTime;\r\n\r\n\t\t\tthis.elapsedTime += diff;\r\n\r\n\t\t}\r\n\r\n\t\treturn diff;\r\n\r\n\t}\r\n\r\n};\r\n\r\n// File:src/core/EventDispatcher.js\r\n\r\n/**\r\n * https://github.com/mrdoob/eventdispatcher.js/\r\n */\r\n\r\nTHREE.EventDispatcher = function () {};\r\n\r\nTHREE.EventDispatcher.prototype = {\r\n\r\n\tconstructor: THREE.EventDispatcher,\r\n\r\n\tapply: function ( object ) {\r\n\r\n\t\tobject.addEventListener = THREE.EventDispatcher.prototype.addEventListener;\r\n\t\tobject.hasEventListener = THREE.EventDispatcher.prototype.hasEventListener;\r\n\t\tobject.removeEventListener = THREE.EventDispatcher.prototype.removeEventListener;\r\n\t\tobject.dispatchEvent = THREE.EventDispatcher.prototype.dispatchEvent;\r\n\r\n\t},\r\n\r\n\taddEventListener: function ( type, listener ) {\r\n\r\n\t\tif ( this._listeners === undefined ) this._listeners = {};\r\n\r\n\t\tvar listeners = this._listeners;\r\n\r\n\t\tif ( listeners[ type ] === undefined ) {\r\n\r\n\t\t\tlisteners[ type ] = [];\r\n\r\n\t\t}\r\n\r\n\t\tif ( listeners[ type ].indexOf( listener ) === - 1 ) {\r\n\r\n\t\t\tlisteners[ type ].push( listener );\r\n\r\n\t\t}\r\n\r\n\t},\r\n\r\n\thasEventListener: function ( type, listener ) {\r\n\r\n\t\tif ( this._listeners === undefined ) return false;\r\n\r\n\t\tvar listeners = this._listeners;\r\n\r\n\t\tif ( listeners[ type ] !== undefined && listeners[ type ].indexOf( listener ) !== - 1 ) {\r\n\r\n\t\t\treturn true;\r\n\r\n\t\t}\r\n\r\n\t\treturn false;\r\n\r\n\t},\r\n\r\n\tremoveEventListener: function ( type, listener ) {\r\n\r\n\t\tif ( this._listeners === undefined ) return;\r\n\r\n\t\tvar listeners = this._listeners;\r\n\t\tvar listenerArray = listeners[ type ];\r\n\r\n\t\tif ( listenerArray !== undefined ) {\r\n\r\n\t\t\tvar index = listenerArray.indexOf( listener );\r\n\r\n\t\t\tif ( index !== - 1 ) {\r\n\r\n\t\t\t\tlistenerArray.splice( index, 1 );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t},\r\n\r\n\tdispatchEvent: function ( event ) {\r\n\r\n\t\tif ( this._listeners === undefined ) return;\r\n\r\n\t\tvar listeners = this._listeners;\r\n\t\tvar listenerArray = listeners[ event.type ];\r\n\r\n\t\tif ( listenerArray !== undefined ) {\r\n\r\n\t\t\tevent.target = this;\r\n\r\n\t\t\tvar array = [];\r\n\t\t\tvar length = listenerArray.length;\r\n\r\n\t\t\tfor ( var i = 0; i < length; i ++ ) {\r\n\r\n\t\t\t\tarray[ i ] = listenerArray[ i ];\r\n\r\n\t\t\t}\r\n\r\n\t\t\tfor ( var i = 0; i < length; i ++ ) {\r\n\r\n\t\t\t\tarray[ i ].call( this, event );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n};\r\n\r\n// File:src/core/Raycaster.js\r\n\r\n/**\r\n * @author mrdoob / http://mrdoob.com/\r\n * @author bhouston / http://exocortex.com/\r\n * @author stephomi / http://stephaneginier.com/\r\n */\r\n\r\n( function ( THREE ) {\r\n\r\n\tTHREE.Raycaster = function ( origin, direction, near, far ) {\r\n\r\n\t\tthis.ray = new THREE.Ray( origin, direction );\r\n\t\t// direction is assumed to be normalized (for accurate distance calculations)\r\n\r\n\t\tthis.near = near || 0;\r\n\t\tthis.far = far || Infinity;\r\n\r\n\t\tthis.params = {\r\n\t\t\tMesh: {},\r\n\t\t\tLine: {},\r\n\t\t\tLOD: {},\r\n\t\t\tPoints: { threshold: 1 },\r\n\t\t\tSprite: {}\r\n\t\t};\r\n\r\n\t\tObject.defineProperties( this.params, {\r\n\t\t\tPointCloud: {\r\n\t\t\t\tget: function () {\r\n\t\t\t\t\tconsole.warn( 'THREE.Raycaster: params.PointCloud has been renamed to params.Points.' );\r\n\t\t\t\t\treturn this.Points;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t} );\r\n\r\n\t};\r\n\r\n\tfunction descSort( a, b ) {\r\n\r\n\t\treturn a.distance - b.distance;\r\n\r\n\t}\r\n\r\n\tvar intersectObject = function ( object, raycaster, intersects, recursive ) {\r\n\r\n\t\tif ( object.visible === false ) return;\r\n\r\n\t\tobject.raycast( raycaster, intersects );\r\n\r\n\t\tif ( recursive === true ) {\r\n\r\n\t\t\tvar children = object.children;\r\n\r\n\t\t\tfor ( var i = 0, l = children.length; i < l; i ++ ) {\r\n\r\n\t\t\t\tintersectObject( children[ i ], raycaster, intersects, true );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t};\r\n\r\n\t//\r\n\r\n\tTHREE.Raycaster.prototype = {\r\n\r\n\t\tconstructor: THREE.Raycaster,\r\n\r\n\t\tlinePrecision: 1,\r\n\r\n\t\tset: function ( origin, direction ) {\r\n\r\n\t\t\t// direction is assumed to be normalized (for accurate distance calculations)\r\n\r\n\t\t\tthis.ray.set( origin, direction );\r\n\r\n\t\t},\r\n\r\n\t\tsetFromCamera: function ( coords, camera ) {\r\n\r\n\t\t\tif ( camera instanceof THREE.PerspectiveCamera ) {\r\n\r\n\t\t\t\tthis.ray.origin.setFromMatrixPosition( camera.matrixWorld );\r\n\t\t\t\tthis.ray.direction.set( coords.x, coords.y, 0.5 ).unproject( camera ).sub( this.ray.origin ).normalize();\r\n\r\n\t\t\t} else if ( camera instanceof THREE.OrthographicCamera ) {\r\n\r\n\t\t\t\tthis.ray.origin.set( coords.x, coords.y, - 1 ).unproject( camera );\r\n\t\t\t\tthis.ray.direction.set( 0, 0, - 1 ).transformDirection( camera.matrixWorld );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tconsole.error( 'THREE.Raycaster: Unsupported camera type.' );\r\n\r\n\t\t\t}\r\n\r\n\t\t},\r\n\r\n\t\tintersectObject: function ( object, recursive ) {\r\n\r\n\t\t\tvar intersects = [];\r\n\r\n\t\t\tintersectObject( object, this, intersects, recursive );\r\n\r\n\t\t\tintersects.sort( descSort );\r\n\r\n\t\t\treturn intersects;\r\n\r\n\t\t},\r\n\r\n\t\tintersectObjects: function ( objects, recursive ) {\r\n\r\n\t\t\tvar intersects = [];\r\n\r\n\t\t\tif ( Array.isArray( objects ) === false ) {\r\n\r\n\t\t\t\tconsole.warn( 'THREE.Raycaster.intersectObjects: objects is not an Array.' );\r\n\t\t\t\treturn intersects;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tfor ( var i = 0, l = objects.length; i < l; i ++ ) {\r\n\r\n\t\t\t\tintersectObject( objects[ i ], this, intersects, recursive );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tintersects.sort( descSort );\r\n\r\n\t\t\treturn intersects;\r\n\r\n\t\t}\r\n\r\n\t};\r\n\r\n}( THREE ) );\r\n\r\n// File:src/core/Object3D.js\r\n\r\n/**\r\n * @author mrdoob / http://mrdoob.com/\r\n * @author mikael emtinger / http://gomo.se/\r\n * @author alteredq / http://alteredqualia.com/\r\n * @author WestLangley / http://github.com/WestLangley\r\n * @author elephantatwork / www.elephantatwork.ch\r\n */\r\n\r\nTHREE.Object3D = function () {\r\n\r\n\tObject.defineProperty( this, 'id', { value: THREE.Object3DIdCount ++ } );\r\n\r\n\tthis.uuid = THREE.Math.generateUUID();\r\n\r\n\tthis.name = '';\r\n\tthis.type = 'Object3D';\r\n\r\n\tthis.parent = null;\r\n\tthis.children = [];\r\n\r\n\tthis.up = THREE.Object3D.DefaultUp.clone();\r\n\r\n\tvar position = new THREE.Vector3();\r\n\tvar rotation = new THREE.Euler();\r\n\tvar quaternion = new THREE.Quaternion();\r\n\tvar scale = new THREE.Vector3( 1, 1, 1 );\r\n\r\n\tvar onRotationChange = function () {\r\n\r\n\t\tquaternion.setFromEuler( rotation, false );\r\n\r\n\t};\r\n\r\n\tvar onQuaternionChange = function () {\r\n\r\n\t\trotation.setFromQuaternion( quaternion, undefined, false );\r\n\r\n\t};\r\n\r\n\trotation.onChange( onRotationChange );\r\n\tquaternion.onChange( onQuaternionChange );\r\n\r\n\tObject.defineProperties( this, {\r\n\t\tposition: {\r\n\t\t\tenumerable: true,\r\n\t\t\tvalue: position\r\n\t\t},\r\n\t\trotation: {\r\n\t\t\tenumerable: true,\r\n\t\t\tvalue: rotation\r\n\t\t},\r\n\t\tquaternion: {\r\n\t\t\tenumerable: true,\r\n\t\t\tvalue: quaternion\r\n\t\t},\r\n\t\tscale: {\r\n\t\t\tenumerable: true,\r\n\t\t\tvalue: scale\r\n\t\t},\r\n\t\tmodelViewMatrix: {\r\n\t\t\tvalue: new THREE.Matrix4()\r\n\t\t},\r\n\t\tnormalMatrix: {\r\n\t\t\tvalue: new THREE.Matrix3()\r\n\t\t}\r\n\t} );\r\n\r\n\tthis.rotationAutoUpdate = true;\r\n\r\n\tthis.matrix = new THREE.Matrix4();\r\n\tthis.matrixWorld = new THREE.Matrix4();\r\n\r\n\tthis.matrixAutoUpdate = THREE.Object3D.DefaultMatrixAutoUpdate;\r\n\tthis.matrixWorldNeedsUpdate = false;\r\n\r\n\tthis.visible = true;\r\n\r\n\tthis.castShadow = false;\r\n\tthis.receiveShadow = false;\r\n\r\n\tthis.frustumCulled = true;\r\n\tthis.renderOrder = 0;\r\n\r\n\tthis.userData = {};\r\n\r\n};\r\n\r\nTHREE.Object3D.DefaultUp = new THREE.Vector3( 0, 1, 0 );\r\nTHREE.Object3D.DefaultMatrixAutoUpdate = true;\r\n\r\nTHREE.Object3D.prototype = {\r\n\r\n\tconstructor: THREE.Object3D,\r\n\r\n\tget eulerOrder () {\r\n\r\n\t\tconsole.warn( 'THREE.Object3D: .eulerOrder has been moved to .rotation.order.' );\r\n\r\n\t\treturn this.rotation.order;\r\n\r\n\t},\r\n\r\n\tset eulerOrder ( value ) {\r\n\r\n\t\tconsole.warn( 'THREE.Object3D: .eulerOrder has been moved to .rotation.order.' );\r\n\r\n\t\tthis.rotation.order = value;\r\n\r\n\t},\r\n\r\n\tget useQuaternion () {\r\n\r\n\t\tconsole.warn( 'THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.' );\r\n\r\n\t},\r\n\r\n\tset useQuaternion ( value ) {\r\n\r\n\t\tconsole.warn( 'THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.' );\r\n\r\n\t},\r\n\r\n\tset renderDepth ( value ) {\r\n\r\n\t\tconsole.warn( 'THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead.' );\r\n\r\n\t},\r\n\r\n\tapplyMatrix: function ( matrix ) {\r\n\r\n\t\tthis.matrix.multiplyMatrices( matrix, this.matrix );\r\n\r\n\t\tthis.matrix.decompose( this.position, this.quaternion, this.scale );\r\n\r\n\t},\r\n\r\n\tsetRotationFromAxisAngle: function ( axis, angle ) {\r\n\r\n\t\t// assumes axis is normalized\r\n\r\n\t\tthis.quaternion.setFromAxisAngle( axis, angle );\r\n\r\n\t},\r\n\r\n\tsetRotationFromEuler: function ( euler ) {\r\n\r\n\t\tthis.quaternion.setFromEuler( euler, true );\r\n\r\n\t},\r\n\r\n\tsetRotationFromMatrix: function ( m ) {\r\n\r\n\t\t// assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled)\r\n\r\n\t\tthis.quaternion.setFromRotationMatrix( m );\r\n\r\n\t},\r\n\r\n\tsetRotationFromQuaternion: function ( q ) {\r\n\r\n\t\t// assumes q is normalized\r\n\r\n\t\tthis.quaternion.copy( q );\r\n\r\n\t},\r\n\r\n\trotateOnAxis: function () {\r\n\r\n\t\t// rotate object on axis in object space\r\n\t\t// axis is assumed to be normalized\r\n\r\n\t\tvar q1 = new THREE.Quaternion();\r\n\r\n\t\treturn function ( axis, angle ) {\r\n\r\n\t\t\tq1.setFromAxisAngle( axis, angle );\r\n\r\n\t\t\tthis.quaternion.multiply( q1 );\r\n\r\n\t\t\treturn this;\r\n\r\n\t\t};\r\n\r\n\t}(),\r\n\r\n\trotateX: function () {\r\n\r\n\t\tvar v1 = new THREE.Vector3( 1, 0, 0 );\r\n\r\n\t\treturn function ( angle ) {\r\n\r\n\t\t\treturn this.rotateOnAxis( v1, angle );\r\n\r\n\t\t};\r\n\r\n\t}(),\r\n\r\n\trotateY: function () {\r\n\r\n\t\tvar v1 = new THREE.Vector3( 0, 1, 0 );\r\n\r\n\t\treturn function ( angle ) {\r\n\r\n\t\t\treturn this.rotateOnAxis( v1, angle );\r\n\r\n\t\t};\r\n\r\n\t}(),\r\n\r\n\trotateZ: function () {\r\n\r\n\t\tvar v1 = new THREE.Vector3( 0, 0, 1 );\r\n\r\n\t\treturn function ( angle ) {\r\n\r\n\t\t\treturn this.rotateOnAxis( v1, angle );\r\n\r\n\t\t};\r\n\r\n\t}(),\r\n\r\n\ttranslateOnAxis: function () {\r\n\r\n\t\t// translate object by distance along axis in object space\r\n\t\t// axis is assumed to be normalized\r\n\r\n\t\tvar v1 = new THREE.Vector3();\r\n\r\n\t\treturn function ( axis, distance ) {\r\n\r\n\t\t\tv1.copy( axis ).applyQuaternion( this.quaternion );\r\n\r\n\t\t\tthis.position.add( v1.multiplyScalar( distance ) );\r\n\r\n\t\t\treturn this;\r\n\r\n\t\t};\r\n\r\n\t}(),\r\n\r\n\ttranslate: function ( distance, axis ) {\r\n\r\n\t\tconsole.warn( 'THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead.' );\r\n\t\treturn this.translateOnAxis( axis, distance );\r\n\r\n\t},\r\n\r\n\ttranslateX: function () {\r\n\r\n\t\tvar v1 = new THREE.Vector3( 1, 0, 0 );\r\n\r\n\t\treturn function ( distance ) {\r\n\r\n\t\t\treturn this.translateOnAxis( v1, distance );\r\n\r\n\t\t};\r\n\r\n\t}(),\r\n\r\n\ttranslateY: function () {\r\n\r\n\t\tvar v1 = new THREE.Vector3( 0, 1, 0 );\r\n\r\n\t\treturn function ( distance ) {\r\n\r\n\t\t\treturn this.translateOnAxis( v1, distance );\r\n\r\n\t\t};\r\n\r\n\t}(),\r\n\r\n\ttranslateZ: function () {\r\n\r\n\t\tvar v1 = new THREE.Vector3( 0, 0, 1 );\r\n\r\n\t\treturn function ( distance ) {\r\n\r\n\t\t\treturn this.translateOnAxis( v1, distance );\r\n\r\n\t\t};\r\n\r\n\t}(),\r\n\r\n\tlocalToWorld: function ( vector ) {\r\n\r\n\t\treturn vector.applyMatrix4( this.matrixWorld );\r\n\r\n\t},\r\n\r\n\tworldToLocal: function () {\r\n\r\n\t\tvar m1 = new THREE.Matrix4();\r\n\r\n\t\treturn function ( vector ) {\r\n\r\n\t\t\treturn vector.applyMatrix4( m1.getInverse( this.matrixWorld ) );\r\n\r\n\t\t};\r\n\r\n\t}(),\r\n\r\n\tlookAt: function () {\r\n\r\n\t\t// This routine does not support objects with rotated and/or translated parent(s)\r\n\r\n\t\tvar m1 = new THREE.Matrix4();\r\n\r\n\t\treturn function ( vector ) {\r\n\r\n\t\t\tm1.lookAt( vector, this.position, this.up );\r\n\r\n\t\t\tthis.quaternion.setFromRotationMatrix( m1 );\r\n\r\n\t\t};\r\n\r\n\t}(),\r\n\r\n\tadd: function ( object ) {\r\n\r\n\t\tif ( arguments.length > 1 ) {\r\n\r\n\t\t\tfor ( var i = 0; i < arguments.length; i ++ ) {\r\n\r\n\t\t\t\tthis.add( arguments[ i ] );\r\n\r\n\t\t\t}\r\n\r\n\t\t\treturn this;\r\n\r\n\t\t}\r\n\r\n\t\tif ( object === this ) {\r\n\r\n\t\t\tconsole.error( \"THREE.Object3D.add: object can't be added as a child of itself.\", object );\r\n\t\t\treturn this;\r\n\r\n\t\t}\r\n\r\n\t\tif ( object instanceof THREE.Object3D ) {\r\n\r\n\t\t\tif ( object.parent !== null ) {\r\n\r\n\t\t\t\tobject.parent.remove( object );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tobject.parent = this;\r\n\t\t\tobject.dispatchEvent( { type: 'added' } );\r\n\r\n\t\t\tthis.children.push( object );\r\n\r\n\t\t} else {\r\n\r\n\t\t\tconsole.error( \"THREE.Object3D.add: object not an instance of THREE.Object3D.\", object );\r\n\r\n\t\t}\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tremove: function ( object ) {\r\n\r\n\t\tif ( arguments.length > 1 ) {\r\n\r\n\t\t\tfor ( var i = 0; i < arguments.length; i ++ ) {\r\n\r\n\t\t\t\tthis.remove( arguments[ i ] );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tvar index = this.children.indexOf( object );\r\n\r\n\t\tif ( index !== - 1 ) {\r\n\r\n\t\t\tobject.parent = null;\r\n\r\n\t\t\tobject.dispatchEvent( { type: 'removed' } );\r\n\r\n\t\t\tthis.children.splice( index, 1 );\r\n\r\n\t\t}\r\n\r\n\t},\r\n\r\n\tgetChildByName: function ( name ) {\r\n\r\n\t\tconsole.warn( 'THREE.Object3D: .getChildByName() has been renamed to .getObjectByName().' );\r\n\t\treturn this.getObjectByName( name );\r\n\r\n\t},\r\n\r\n\tgetObjectById: function ( id ) {\r\n\r\n\t\treturn this.getObjectByProperty( 'id', id );\r\n\r\n\t},\r\n\r\n\tgetObjectByName: function ( name ) {\r\n\r\n\t\treturn this.getObjectByProperty( 'name', name );\r\n\r\n\t},\r\n\r\n\tgetObjectByProperty: function ( name, value ) {\r\n\r\n\t\tif ( this[ name ] === value ) return this;\r\n\r\n\t\tfor ( var i = 0, l = this.children.length; i < l; i ++ ) {\r\n\r\n\t\t\tvar child = this.children[ i ];\r\n\t\t\tvar object = child.getObjectByProperty( name, value );\r\n\r\n\t\t\tif ( object !== undefined ) {\r\n\r\n\t\t\t\treturn object;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn undefined;\r\n\r\n\t},\r\n\r\n\tgetWorldPosition: function ( optionalTarget ) {\r\n\r\n\t\tvar result = optionalTarget || new THREE.Vector3();\r\n\r\n\t\tthis.updateMatrixWorld( true );\r\n\r\n\t\treturn result.setFromMatrixPosition( this.matrixWorld );\r\n\r\n\t},\r\n\r\n\tgetWorldQuaternion: function () {\r\n\r\n\t\tvar position = new THREE.Vector3();\r\n\t\tvar scale = new THREE.Vector3();\r\n\r\n\t\treturn function ( optionalTarget ) {\r\n\r\n\t\t\tvar result = optionalTarget || new THREE.Quaternion();\r\n\r\n\t\t\tthis.updateMatrixWorld( true );\r\n\r\n\t\t\tthis.matrixWorld.decompose( position, result, scale );\r\n\r\n\t\t\treturn result;\r\n\r\n\t\t};\r\n\r\n\t}(),\r\n\r\n\tgetWorldRotation: function () {\r\n\r\n\t\tvar quaternion = new THREE.Quaternion();\r\n\r\n\t\treturn function ( optionalTarget ) {\r\n\r\n\t\t\tvar result = optionalTarget || new THREE.Euler();\r\n\r\n\t\t\tthis.getWorldQuaternion( quaternion );\r\n\r\n\t\t\treturn result.setFromQuaternion( quaternion, this.rotation.order, false );\r\n\r\n\t\t};\r\n\r\n\t}(),\r\n\r\n\tgetWorldScale: function () {\r\n\r\n\t\tvar position = new THREE.Vector3();\r\n\t\tvar quaternion = new THREE.Quaternion();\r\n\r\n\t\treturn function ( optionalTarget ) {\r\n\r\n\t\t\tvar result = optionalTarget || new THREE.Vector3();\r\n\r\n\t\t\tthis.updateMatrixWorld( true );\r\n\r\n\t\t\tthis.matrixWorld.decompose( position, quaternion, result );\r\n\r\n\t\t\treturn result;\r\n\r\n\t\t};\r\n\r\n\t}(),\r\n\r\n\tgetWorldDirection: function () {\r\n\r\n\t\tvar quaternion = new THREE.Quaternion();\r\n\r\n\t\treturn function ( optionalTarget ) {\r\n\r\n\t\t\tvar result = optionalTarget || new THREE.Vector3();\r\n\r\n\t\t\tthis.getWorldQuaternion( quaternion );\r\n\r\n\t\t\treturn result.set( 0, 0, 1 ).applyQuaternion( quaternion );\r\n\r\n\t\t};\r\n\r\n\t}(),\r\n\r\n\traycast: function () {},\r\n\r\n\ttraverse: function ( callback ) {\r\n\r\n\t\tcallback( this );\r\n\r\n\t\tvar children = this.children;\r\n\r\n\t\tfor ( var i = 0, l = children.length; i < l; i ++ ) {\r\n\r\n\t\t\tchildren[ i ].traverse( callback );\r\n\r\n\t\t}\r\n\r\n\t},\r\n\r\n\ttraverseVisible: function ( callback ) {\r\n\r\n\t\tif ( this.visible === false ) return;\r\n\r\n\t\tcallback( this );\r\n\r\n\t\tvar children = this.children;\r\n\r\n\t\tfor ( var i = 0, l = children.length; i < l; i ++ ) {\r\n\r\n\t\t\tchildren[ i ].traverseVisible( callback );\r\n\r\n\t\t}\r\n\r\n\t},\r\n\r\n\ttraverseAncestors: function ( callback ) {\r\n\r\n\t\tvar parent = this.parent;\r\n\r\n\t\tif ( parent !== null ) {\r\n\r\n\t\t\tcallback( parent );\r\n\r\n\t\t\tparent.traverseAncestors( callback );\r\n\r\n\t\t}\r\n\r\n\t},\r\n\r\n\tupdateMatrix: function () {\r\n\r\n\t\tthis.matrix.compose( this.position, this.quaternion, this.scale );\r\n\r\n\t\tthis.matrixWorldNeedsUpdate = true;\r\n\r\n\t},\r\n\r\n\tupdateMatrixWorld: function ( force ) {\r\n\r\n\t\tif ( this.matrixAutoUpdate === true ) this.updateMatrix();\r\n\r\n\t\tif ( this.matrixWorldNeedsUpdate === true || force === true ) {\r\n\r\n\t\t\tif ( this.parent === null ) {\r\n\r\n\t\t\t\tthis.matrixWorld.copy( this.matrix );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tthis.matrixWorld.multiplyMatrices( this.parent.matrixWorld, this.matrix );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tthis.matrixWorldNeedsUpdate = false;\r\n\r\n\t\t\tforce = true;\r\n\r\n\t\t}\r\n\r\n\t\t// update children\r\n\r\n\t\tfor ( var i = 0, l = this.children.length; i < l; i ++ ) {\r\n\r\n\t\t\tthis.children[ i ].updateMatrixWorld( force );\r\n\r\n\t\t}\r\n\r\n\t},\r\n\r\n\ttoJSON: function ( meta ) {\r\n\r\n\t\tvar isRootObject = ( meta === undefined );\r\n\r\n\t\tvar data = {};\r\n\r\n\t\t// meta is a hash used to collect geometries, materials.\r\n\t\t// not providing it implies that this is the root object\r\n\t\t// being serialized.\r\n\t\tif ( isRootObject ) {\r\n\r\n\t\t\t// initialize meta obj\r\n\t\t\tmeta = {\r\n\t\t\t\tgeometries: {},\r\n\t\t\t\tmaterials: {},\r\n\t\t\t\ttextures: {},\r\n\t\t\t\timages: {}\r\n\t\t\t};\r\n\r\n\t\t\tdata.metadata = {\r\n\t\t\t\tversion: 4.4,\r\n\t\t\t\ttype: 'Object',\r\n\t\t\t\tgenerator: 'Object3D.toJSON'\r\n\t\t\t};\r\n\r\n\t\t}\r\n\r\n\t\t// standard Object3D serialization\r\n\r\n\t\tdata.uuid = this.uuid;\r\n\t\tdata.type = this.type;\r\n\r\n\t\tif ( this.name !== '' ) data.name = this.name;\r\n\t\tif ( JSON.stringify( this.userData ) !== '{}' ) data.userData = this.userData;\r\n\t\tif ( this.visible !== true ) data.visible = this.visible;\r\n\r\n\t\tdata.matrix = this.matrix.toArray();\r\n\r\n\t\tif ( this.children.length > 0 ) {\r\n\r\n\t\t\tdata.children = [];\r\n\r\n\t\t\tfor ( var i = 0; i < this.children.length; i ++ ) {\r\n\r\n\t\t\t\tdata.children.push( this.children[ i ].toJSON( meta ).object );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tvar output = {};\r\n\r\n\t\tif ( isRootObject ) {\r\n\r\n\t\t\tvar geometries = extractFromCache( meta.geometries );\r\n\t\t\tvar materials = extractFromCache( meta.materials );\r\n\t\t\tvar textures = extractFromCache( meta.textures );\r\n\t\t\tvar images = extractFromCache( meta.images );\r\n\r\n\t\t\tif ( geometries.length > 0 ) output.geometries = geometries;\r\n\t\t\tif ( materials.length > 0 ) output.materials = materials;\r\n\t\t\tif ( textures.length > 0 ) output.textures = textures;\r\n\t\t\tif ( images.length > 0 ) output.images = images;\r\n\r\n\t\t}\r\n\r\n\t\toutput.object = data;\r\n\r\n\t\treturn output;\r\n\r\n\t\t// extract data from the cache hash\r\n\t\t// remove metadata on each item\r\n\t\t// and return as array\r\n\t\tfunction extractFromCache ( cache ) {\r\n\r\n\t\t\tvar values = [];\r\n\t\t\tfor ( var key in cache ) {\r\n\r\n\t\t\t\tvar data = cache[ key ];\r\n\t\t\t\tdelete data.metadata;\r\n\t\t\t\tvalues.push( data );\r\n\r\n\t\t\t}\r\n\t\t\treturn values;\r\n\r\n\t\t}\r\n\r\n\t},\r\n\r\n\tclone: function ( recursive ) {\r\n\r\n\t\treturn new this.constructor().copy( this, recursive );\r\n\r\n\t},\r\n\r\n\tcopy: function ( source, recursive ) {\r\n\r\n\t\tif ( recursive === undefined ) recursive = true;\r\n\r\n\t\tthis.name = source.name;\r\n\r\n\t\tthis.up.copy( source.up );\r\n\r\n\t\tthis.position.copy( source.position );\r\n\t\tthis.quaternion.copy( source.quaternion );\r\n\t\tthis.scale.copy( source.scale );\r\n\r\n\t\tthis.rotationAutoUpdate = source.rotationAutoUpdate;\r\n\r\n\t\tthis.matrix.copy( source.matrix );\r\n\t\tthis.matrixWorld.copy( source.matrixWorld );\r\n\r\n\t\tthis.matrixAutoUpdate = source.matrixAutoUpdate;\r\n\t\tthis.matrixWorldNeedsUpdate = source.matrixWorldNeedsUpdate;\r\n\r\n\t\tthis.visible = source.visible;\r\n\r\n\t\tthis.castShadow = source.castShadow;\r\n\t\tthis.receiveShadow = source.receiveShadow;\r\n\r\n\t\tthis.frustumCulled = source.frustumCulled;\r\n\t\tthis.renderOrder = source.renderOrder;\r\n\r\n\t\tthis.userData = JSON.parse( JSON.stringify( source.userData ) );\r\n\r\n\t\tif ( recursive === true ) {\r\n\r\n\t\t\tfor ( var i = 0; i < source.children.length; i ++ ) {\r\n\r\n\t\t\t\tvar child = source.children[ i ];\r\n\t\t\t\tthis.add( child.clone() );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n};\r\n\r\nTHREE.EventDispatcher.prototype.apply( THREE.Object3D.prototype );\r\n\r\nTHREE.Object3DIdCount = 0;\r\n\r\n// File:src/core/Face3.js\r\n\r\n/**\r\n * @author mrdoob / http://mrdoob.com/\r\n * @author alteredq / http://alteredqualia.com/\r\n */\r\n\r\nTHREE.Face3 = function ( a, b, c, normal, color, materialIndex ) {\r\n\r\n\tthis.a = a;\r\n\tthis.b = b;\r\n\tthis.c = c;\r\n\r\n\tthis.normal = normal instanceof THREE.Vector3 ? normal : new THREE.Vector3();\r\n\tthis.vertexNormals = Array.isArray( normal ) ? normal : [];\r\n\r\n\tthis.color = color instanceof THREE.Color ? color : new THREE.Color();\r\n\tthis.vertexColors = Array.isArray( color ) ? color : [];\r\n\r\n\tthis.materialIndex = materialIndex !== undefined ? materialIndex : 0;\r\n\r\n};\r\n\r\nTHREE.Face3.prototype = {\r\n\r\n\tconstructor: THREE.Face3,\r\n\r\n\tclone: function () {\r\n\r\n\t\treturn new this.constructor().copy( this );\r\n\r\n\t},\r\n\r\n\tcopy: function ( source ) {\r\n\r\n\t\tthis.a = source.a;\r\n\t\tthis.b = source.b;\r\n\t\tthis.c = source.c;\r\n\r\n\t\tthis.normal.copy( source.normal );\r\n\t\tthis.color.copy( source.color );\r\n\r\n\t\tthis.materialIndex = source.materialIndex;\r\n\r\n\t\tfor ( var i = 0, il = source.vertexNormals.length; i < il; i ++ ) {\r\n\r\n\t\t\tthis.vertexNormals[ i ] = source.vertexNormals[ i ].clone();\r\n\r\n\t\t}\r\n\r\n\t\tfor ( var i = 0, il = source.vertexColors.length; i < il; i ++ ) {\r\n\r\n\t\t\tthis.vertexColors[ i ] = source.vertexColors[ i ].clone();\r\n\r\n\t\t}\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n};\r\n\r\n// File:src/core/Face4.js\r\n\r\n/**\r\n * @author mrdoob / http://mrdoob.com/\r\n */\r\n\r\nTHREE.Face4 = function ( a, b, c, d, normal, color, materialIndex ) {\r\n\r\n\tconsole.warn( 'THREE.Face4 has been removed. A THREE.Face3 will be created instead.' );\r\n\treturn new THREE.Face3( a, b, c, normal, color, materialIndex );\r\n\r\n};\r\n\r\n// File:src/core/BufferAttribute.js\r\n\r\n/**\r\n * @author mrdoob / http://mrdoob.com/\r\n */\r\n\r\nTHREE.BufferAttribute = function ( array, itemSize ) {\r\n\r\n\tthis.uuid = THREE.Math.generateUUID();\r\n\r\n\tthis.array = array;\r\n\tthis.itemSize = itemSize;\r\n\r\n\tthis.dynamic = false;\r\n\tthis.updateRange = { offset: 0, count: - 1 };\r\n\r\n\tthis.version = 0;\r\n\r\n};\r\n\r\nTHREE.BufferAttribute.prototype = {\r\n\r\n\tconstructor: THREE.BufferAttribute,\r\n\r\n\tget length() {\r\n\r\n\t\tconsole.warn( 'THREE.BufferAttribute: .length has been deprecated. Please use .count.' );\r\n\t\treturn this.array.length;\r\n\r\n\t},\r\n\r\n\tget count() {\r\n\r\n\t\treturn this.array.length / this.itemSize;\r\n\r\n\t},\r\n\r\n\tset needsUpdate( value ) {\r\n\r\n\t\tif ( value === true ) this.version ++;\r\n\r\n\t},\r\n\r\n\tsetDynamic: function ( value ) {\r\n\r\n\t\tthis.dynamic = value;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tcopy: function ( source ) {\r\n\r\n\t\tthis.array = new source.array.constructor( source.array );\r\n\t\tthis.itemSize = source.itemSize;\r\n\r\n\t\tthis.dynamic = source.dynamic;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tcopyAt: function ( index1, attribute, index2 ) {\r\n\r\n\t\tindex1 *= this.itemSize;\r\n\t\tindex2 *= attribute.itemSize;\r\n\r\n\t\tfor ( var i = 0, l = this.itemSize; i < l; i ++ ) {\r\n\r\n\t\t\tthis.array[ index1 + i ] = attribute.array[ index2 + i ];\r\n\r\n\t\t}\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tcopyArray: function ( array ) {\r\n\r\n\t\tthis.array.set( array );\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tcopyColorsArray: function ( colors ) {\r\n\r\n\t\tvar array = this.array, offset = 0;\r\n\r\n\t\tfor ( var i = 0, l = colors.length; i < l; i ++ ) {\r\n\r\n\t\t\tvar color = colors[ i ];\r\n\r\n\t\t\tif ( color === undefined ) {\r\n\r\n\t\t\t\tconsole.warn( 'THREE.BufferAttribute.copyColorsArray(): color is undefined', i );\r\n\t\t\t\tcolor = new THREE.Color();\r\n\r\n\t\t\t}\r\n\r\n\t\t\tarray[ offset ++ ] = color.r;\r\n\t\t\tarray[ offset ++ ] = color.g;\r\n\t\t\tarray[ offset ++ ] = color.b;\r\n\r\n\t\t}\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tcopyIndicesArray: function ( indices ) {\r\n\r\n\t\tvar array = this.array, offset = 0;\r\n\r\n\t\tfor ( var i = 0, l = indices.length; i < l; i ++ ) {\r\n\r\n\t\t\tvar index = indices[ i ];\r\n\r\n\t\t\tarray[ offset ++ ] = index.a;\r\n\t\t\tarray[ offset ++ ] = index.b;\r\n\t\t\tarray[ offset ++ ] = index.c;\r\n\r\n\t\t}\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tcopyVector2sArray: function ( vectors ) {\r\n\r\n\t\tvar array = this.array, offset = 0;\r\n\r\n\t\tfor ( var i = 0, l = vectors.length; i < l; i ++ ) {\r\n\r\n\t\t\tvar vector = vectors[ i ];\r\n\r\n\t\t\tif ( vector === undefined ) {\r\n\r\n\t\t\t\tconsole.warn( 'THREE.BufferAttribute.copyVector2sArray(): vector is undefined', i );\r\n\t\t\t\tvector = new THREE.Vector2();\r\n\r\n\t\t\t}\r\n\r\n\t\t\tarray[ offset ++ ] = vector.x;\r\n\t\t\tarray[ offset ++ ] = vector.y;\r\n\r\n\t\t}\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tcopyVector3sArray: function ( vectors ) {\r\n\r\n\t\tvar array = this.array, offset = 0;\r\n\r\n\t\tfor ( var i = 0, l = vectors.length; i < l; i ++ ) {\r\n\r\n\t\t\tvar vector = vectors[ i ];\r\n\r\n\t\t\tif ( vector === undefined ) {\r\n\r\n\t\t\t\tconsole.warn( 'THREE.BufferAttribute.copyVector3sArray(): vector is undefined', i );\r\n\t\t\t\tvector = new THREE.Vector3();\r\n\r\n\t\t\t}\r\n\r\n\t\t\tarray[ offset ++ ] = vector.x;\r\n\t\t\tarray[ offset ++ ] = vector.y;\r\n\t\t\tarray[ offset ++ ] = vector.z;\r\n\r\n\t\t}\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tcopyVector4sArray: function ( vectors ) {\r\n\r\n\t\tvar array = this.array, offset = 0;\r\n\r\n\t\tfor ( var i = 0, l = vectors.length; i < l; i ++ ) {\r\n\r\n\t\t\tvar vector = vectors[ i ];\r\n\r\n\t\t\tif ( vector === undefined ) {\r\n\r\n\t\t\t\tconsole.warn( 'THREE.BufferAttribute.copyVector4sArray(): vector is undefined', i );\r\n\t\t\t\tvector = new THREE.Vector4();\r\n\r\n\t\t\t}\r\n\r\n\t\t\tarray[ offset ++ ] = vector.x;\r\n\t\t\tarray[ offset ++ ] = vector.y;\r\n\t\t\tarray[ offset ++ ] = vector.z;\r\n\t\t\tarray[ offset ++ ] = vector.w;\r\n\r\n\t\t}\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tset: function ( value, offset ) {\r\n\r\n\t\tif ( offset === undefined ) offset = 0;\r\n\r\n\t\tthis.array.set( value, offset );\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tgetX: function ( index ) {\r\n\r\n\t\treturn this.array[ index * this.itemSize ];\r\n\r\n\t},\r\n\r\n\tsetX: function ( index, x ) {\r\n\r\n\t\tthis.array[ index * this.itemSize ] = x;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tgetY: function ( index ) {\r\n\r\n\t\treturn this.array[ index * this.itemSize + 1 ];\r\n\r\n\t},\r\n\r\n\tsetY: function ( index, y ) {\r\n\r\n\t\tthis.array[ index * this.itemSize + 1 ] = y;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tgetZ: function ( index ) {\r\n\r\n\t\treturn this.array[ index * this.itemSize + 2 ];\r\n\r\n\t},\r\n\r\n\tsetZ: function ( index, z ) {\r\n\r\n\t\tthis.array[ index * this.itemSize + 2 ] = z;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tgetW: function ( index ) {\r\n\r\n\t\treturn this.array[ index * this.itemSize + 3 ];\r\n\r\n\t},\r\n\r\n\tsetW: function ( index, w ) {\r\n\r\n\t\tthis.array[ index * this.itemSize + 3 ] = w;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tsetXY: function ( index, x, y ) {\r\n\r\n\t\tindex *= this.itemSize;\r\n\r\n\t\tthis.array[ index + 0 ] = x;\r\n\t\tthis.array[ index + 1 ] = y;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tsetXYZ: function ( index, x, y, z ) {\r\n\r\n\t\tindex *= this.itemSize;\r\n\r\n\t\tthis.array[ index + 0 ] = x;\r\n\t\tthis.array[ index + 1 ] = y;\r\n\t\tthis.array[ index + 2 ] = z;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tsetXYZW: function ( index, x, y, z, w ) {\r\n\r\n\t\tindex *= this.itemSize;\r\n\r\n\t\tthis.array[ index + 0 ] = x;\r\n\t\tthis.array[ index + 1 ] = y;\r\n\t\tthis.array[ index + 2 ] = z;\r\n\t\tthis.array[ index + 3 ] = w;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tclone: function () {\r\n\r\n\t\treturn new this.constructor().copy( this );\r\n\r\n\t}\r\n\r\n};\r\n\r\n//\r\n\r\nTHREE.Int8Attribute = function ( array, itemSize ) {\r\n\r\n\treturn new THREE.BufferAttribute( new Int8Array( array ), itemSize );\r\n\r\n};\r\n\r\nTHREE.Uint8Attribute = function ( array, itemSize ) {\r\n\r\n\treturn new THREE.BufferAttribute( new Uint8Array( array ), itemSize );\r\n\r\n};\r\n\r\nTHREE.Uint8ClampedAttribute = function ( array, itemSize ) {\r\n\r\n\treturn new THREE.BufferAttribute( new Uint8ClampedArray( array ), itemSize );\r\n\r\n};\r\n\r\nTHREE.Int16Attribute = function ( array, itemSize ) {\r\n\r\n\treturn new THREE.BufferAttribute( new Int16Array( array ), itemSize );\r\n\r\n};\r\n\r\nTHREE.Uint16Attribute = function ( array, itemSize ) {\r\n\r\n\treturn new THREE.BufferAttribute( new Uint16Array( array ), itemSize );\r\n\r\n};\r\n\r\nTHREE.Int32Attribute = function ( array, itemSize ) {\r\n\r\n\treturn new THREE.BufferAttribute( new Int32Array( array ), itemSize );\r\n\r\n};\r\n\r\nTHREE.Uint32Attribute = function ( array, itemSize ) {\r\n\r\n\treturn new THREE.BufferAttribute( new Uint32Array( array ), itemSize );\r\n\r\n};\r\n\r\nTHREE.Float32Attribute = function ( array, itemSize ) {\r\n\r\n\treturn new THREE.BufferAttribute( new Float32Array( array ), itemSize );\r\n\r\n};\r\n\r\nTHREE.Float64Attribute = function ( array, itemSize ) {\r\n\r\n\treturn new THREE.BufferAttribute( new Float64Array( array ), itemSize );\r\n\r\n};\r\n\r\n\r\n// Deprecated\r\n\r\nTHREE.DynamicBufferAttribute = function ( array, itemSize ) {\r\n\r\n\tconsole.warn( 'THREE.DynamicBufferAttribute has been removed. Use new THREE.BufferAttribute().setDynamic( true ) instead.' );\r\n\treturn new THREE.BufferAttribute( array, itemSize ).setDynamic( true );\r\n\r\n};\r\n\r\n// File:src/core/InstancedBufferAttribute.js\r\n\r\n/**\r\n * @author benaadams / https://twitter.com/ben_a_adams\r\n */\r\n\r\nTHREE.InstancedBufferAttribute = function ( array, itemSize, meshPerAttribute ) {\r\n\r\n\tTHREE.BufferAttribute.call( this, array, itemSize );\r\n\r\n\tthis.meshPerAttribute = meshPerAttribute || 1;\r\n\r\n};\r\n\r\nTHREE.InstancedBufferAttribute.prototype = Object.create( THREE.BufferAttribute.prototype );\r\nTHREE.InstancedBufferAttribute.prototype.constructor = THREE.InstancedBufferAttribute;\r\n\r\nTHREE.InstancedBufferAttribute.prototype.copy = function ( source ) {\r\n\r\n\tTHREE.BufferAttribute.prototype.copy.call( this, source );\r\n\r\n\tthis.meshPerAttribute = source.meshPerAttribute;\r\n\r\n\treturn this;\r\n\r\n};\r\n\r\n// File:src/core/InterleavedBuffer.js\r\n\r\n/**\r\n * @author benaadams / https://twitter.com/ben_a_adams\r\n */\r\n\r\nTHREE.InterleavedBuffer = function ( array, stride ) {\r\n\r\n\tthis.uuid = THREE.Math.generateUUID();\r\n\r\n\tthis.array = array;\r\n\tthis.stride = stride;\r\n\r\n\tthis.dynamic = false;\r\n\tthis.updateRange = { offset: 0, count: - 1 };\r\n\r\n\tthis.version = 0;\r\n\r\n};\r\n\r\nTHREE.InterleavedBuffer.prototype = {\r\n\r\n\tconstructor: THREE.InterleavedBuffer,\r\n\r\n\tget length () {\r\n\r\n\t\treturn this.array.length;\r\n\r\n\t},\r\n\r\n\tget count () {\r\n\r\n\t\treturn this.array.length / this.stride;\r\n\r\n\t},\r\n\r\n\tset needsUpdate( value ) {\r\n\r\n\t\tif ( value === true ) this.version ++;\r\n\r\n\t},\r\n\r\n\tsetDynamic: function ( value ) {\r\n\r\n\t\tthis.dynamic = value;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tcopy: function ( source ) {\r\n\r\n\t\tthis.array = new source.array.constructor( source.array );\r\n\t\tthis.stride = source.stride;\r\n\t\tthis.dynamic = source.dynamic;\r\n\r\n\t},\r\n\r\n\tcopyAt: function ( index1, attribute, index2 ) {\r\n\r\n\t\tindex1 *= this.stride;\r\n\t\tindex2 *= attribute.stride;\r\n\r\n\t\tfor ( var i = 0, l = this.stride; i < l; i ++ ) {\r\n\r\n\t\t\tthis.array[ index1 + i ] = attribute.array[ index2 + i ];\r\n\r\n\t\t}\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tset: function ( value, offset ) {\r\n\r\n\t\tif ( offset === undefined ) offset = 0;\r\n\r\n\t\tthis.array.set( value, offset );\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tclone: function () {\r\n\r\n\t\treturn new this.constructor().copy( this );\r\n\r\n\t}\r\n\r\n};\r\n\r\n// File:src/core/InstancedInterleavedBuffer.js\r\n\r\n/**\r\n * @author benaadams / https://twitter.com/ben_a_adams\r\n */\r\n\r\nTHREE.InstancedInterleavedBuffer = function ( array, stride, meshPerAttribute ) {\r\n\r\n\tTHREE.InterleavedBuffer.call( this, array, stride );\r\n\r\n\tthis.meshPerAttribute = meshPerAttribute || 1;\r\n\r\n};\r\n\r\nTHREE.InstancedInterleavedBuffer.prototype = Object.create( THREE.InterleavedBuffer.prototype );\r\nTHREE.InstancedInterleavedBuffer.prototype.constructor = THREE.InstancedInterleavedBuffer;\r\n\r\nTHREE.InstancedInterleavedBuffer.prototype.copy = function ( source ) {\r\n\r\n\tTHREE.InterleavedBuffer.prototype.copy.call( this, source );\r\n\r\n\tthis.meshPerAttribute = source.meshPerAttribute;\r\n\r\n\treturn this;\r\n\r\n};\r\n\r\n// File:src/core/InterleavedBufferAttribute.js\r\n\r\n/**\r\n * @author benaadams / https://twitter.com/ben_a_adams\r\n */\r\n\r\nTHREE.InterleavedBufferAttribute = function ( interleavedBuffer, itemSize, offset ) {\r\n\r\n\tthis.uuid = THREE.Math.generateUUID();\r\n\r\n\tthis.data = interleavedBuffer;\r\n\tthis.itemSize = itemSize;\r\n\tthis.offset = offset;\r\n\r\n};\r\n\r\n\r\nTHREE.InterleavedBufferAttribute.prototype = {\r\n\r\n\tconstructor: THREE.InterleavedBufferAttribute,\r\n\r\n\tget length() {\r\n\r\n\t\tconsole.warn( 'THREE.BufferAttribute: .length has been deprecated. Please use .count.' );\r\n\t\treturn this.array.length;\r\n\r\n\t},\r\n\r\n\tget count() {\r\n\r\n\t\treturn this.data.array.length / this.data.stride;\r\n\r\n\t},\r\n\r\n\tsetX: function ( index, x ) {\r\n\r\n\t\tthis.data.array[ index * this.data.stride + this.offset ] = x;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tsetY: function ( index, y ) {\r\n\r\n\t\tthis.data.array[ index * this.data.stride + this.offset + 1 ] = y;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tsetZ: function ( index, z ) {\r\n\r\n\t\tthis.data.array[ index * this.data.stride + this.offset + 2 ] = z;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tsetW: function ( index, w ) {\r\n\r\n\t\tthis.data.array[ index * this.data.stride + this.offset + 3 ] = w;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tgetX: function ( index ) {\r\n\r\n\t\treturn this.data.array[ index * this.data.stride + this.offset ];\r\n\r\n\t},\r\n\r\n\tgetY: function ( index ) {\r\n\r\n\t\treturn this.data.array[ index * this.data.stride + this.offset + 1 ];\r\n\r\n\t},\r\n\r\n\tgetZ: function ( index ) {\r\n\r\n\t\treturn this.data.array[ index * this.data.stride + this.offset + 2 ];\r\n\r\n\t},\r\n\r\n\tgetW: function ( index ) {\r\n\r\n\t\treturn this.data.array[ index * this.data.stride + this.offset + 3 ];\r\n\r\n\t},\r\n\r\n\tsetXY: function ( index, x, y ) {\r\n\r\n\t\tindex = index * this.data.stride + this.offset;\r\n\r\n\t\tthis.data.array[ index + 0 ] = x;\r\n\t\tthis.data.array[ index + 1 ] = y;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tsetXYZ: function ( index, x, y, z ) {\r\n\r\n\t\tindex = index * this.data.stride + this.offset;\r\n\r\n\t\tthis.data.array[ index + 0 ] = x;\r\n\t\tthis.data.array[ index + 1 ] = y;\r\n\t\tthis.data.array[ index + 2 ] = z;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tsetXYZW: function ( index, x, y, z, w ) {\r\n\r\n\t\tindex = index * this.data.stride + this.offset;\r\n\r\n\t\tthis.data.array[ index + 0 ] = x;\r\n\t\tthis.data.array[ index + 1 ] = y;\r\n\t\tthis.data.array[ index + 2 ] = z;\r\n\t\tthis.data.array[ index + 3 ] = w;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n};\r\n\r\n// File:src/core/Geometry.js\r\n\r\n/**\r\n * @author mrdoob / http://mrdoob.com/\r\n * @author kile / http://kile.stravaganza.org/\r\n * @author alteredq / http://alteredqualia.com/\r\n * @author mikael emtinger / http://gomo.se/\r\n * @author zz85 / http://www.lab4games.net/zz85/blog\r\n * @author bhouston / http://exocortex.com\r\n */\r\n\r\nTHREE.Geometry = function () {\r\n\r\n\tObject.defineProperty( this, 'id', { value: THREE.GeometryIdCount ++ } );\r\n\r\n\tthis.uuid = THREE.Math.generateUUID();\r\n\r\n\tthis.name = '';\r\n\tthis.type = 'Geometry';\r\n\r\n\tthis.vertices = [];\r\n\tthis.colors = [];\r\n\tthis.faces = [];\r\n\tthis.faceVertexUvs = [ [] ];\r\n\r\n\tthis.morphTargets = [];\r\n\tthis.morphColors = [];\r\n\tthis.morphNormals = [];\r\n\r\n\tthis.skinWeights = [];\r\n\tthis.skinIndices = [];\r\n\r\n\tthis.lineDistances = [];\r\n\r\n\tthis.boundingBox = null;\r\n\tthis.boundingSphere = null;\r\n\r\n\t// update flags\r\n\r\n\tthis.verticesNeedUpdate = false;\r\n\tthis.elementsNeedUpdate = false;\r\n\tthis.uvsNeedUpdate = false;\r\n\tthis.normalsNeedUpdate = false;\r\n\tthis.colorsNeedUpdate = false;\r\n\tthis.lineDistancesNeedUpdate = false;\r\n\tthis.groupsNeedUpdate = false;\r\n\r\n};\r\n\r\nTHREE.Geometry.prototype = {\r\n\r\n\tconstructor: THREE.Geometry,\r\n\r\n\tapplyMatrix: function ( matrix ) {\r\n\r\n\t\tvar normalMatrix = new THREE.Matrix3().getNormalMatrix( matrix );\r\n\r\n\t\tfor ( var i = 0, il = this.vertices.length; i < il; i ++ ) {\r\n\r\n\t\t\tvar vertex = this.vertices[ i ];\r\n\t\t\tvertex.applyMatrix4( matrix );\r\n\r\n\t\t}\r\n\r\n\t\tfor ( var i = 0, il = this.faces.length; i < il; i ++ ) {\r\n\r\n\t\t\tvar face = this.faces[ i ];\r\n\t\t\tface.normal.applyMatrix3( normalMatrix ).normalize();\r\n\r\n\t\t\tfor ( var j = 0, jl = face.vertexNormals.length; j < jl; j ++ ) {\r\n\r\n\t\t\t\tface.vertexNormals[ j ].applyMatrix3( normalMatrix ).normalize();\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tif ( this.boundingBox !== null ) {\r\n\r\n\t\t\tthis.computeBoundingBox();\r\n\r\n\t\t}\r\n\r\n\t\tif ( this.boundingSphere !== null ) {\r\n\r\n\t\t\tthis.computeBoundingSphere();\r\n\r\n\t\t}\r\n\r\n\t\tthis.verticesNeedUpdate = true;\r\n\t\tthis.normalsNeedUpdate = true;\r\n\r\n\t},\r\n\r\n\trotateX: function () {\r\n\r\n\t\t// rotate geometry around world x-axis\r\n\r\n\t\tvar m1;\r\n\r\n\t\treturn function rotateX( angle ) {\r\n\r\n\t\t\tif ( m1 === undefined ) m1 = new THREE.Matrix4();\r\n\r\n\t\t\tm1.makeRotationX( angle );\r\n\r\n\t\t\tthis.applyMatrix( m1 );\r\n\r\n\t\t\treturn this;\r\n\r\n\t\t};\r\n\r\n\t}(),\r\n\r\n\trotateY: function () {\r\n\r\n\t\t// rotate geometry around world y-axis\r\n\r\n\t\tvar m1;\r\n\r\n\t\treturn function rotateY( angle ) {\r\n\r\n\t\t\tif ( m1 === undefined ) m1 = new THREE.Matrix4();\r\n\r\n\t\t\tm1.makeRotationY( angle );\r\n\r\n\t\t\tthis.applyMatrix( m1 );\r\n\r\n\t\t\treturn this;\r\n\r\n\t\t};\r\n\r\n\t}(),\r\n\r\n\trotateZ: function () {\r\n\r\n\t\t// rotate geometry around world z-axis\r\n\r\n\t\tvar m1;\r\n\r\n\t\treturn function rotateZ( angle ) {\r\n\r\n\t\t\tif ( m1 === undefined ) m1 = new THREE.Matrix4();\r\n\r\n\t\t\tm1.makeRotationZ( angle );\r\n\r\n\t\t\tthis.applyMatrix( m1 );\r\n\r\n\t\t\treturn this;\r\n\r\n\t\t};\r\n\r\n\t}(),\r\n\r\n\ttranslate: function () {\r\n\r\n\t\t// translate geometry\r\n\r\n\t\tvar m1;\r\n\r\n\t\treturn function translate( x, y, z ) {\r\n\r\n\t\t\tif ( m1 === undefined ) m1 = new THREE.Matrix4();\r\n\r\n\t\t\tm1.makeTranslation( x, y, z );\r\n\r\n\t\t\tthis.applyMatrix( m1 );\r\n\r\n\t\t\treturn this;\r\n\r\n\t\t};\r\n\r\n\t}(),\r\n\r\n\tscale: function () {\r\n\r\n\t\t// scale geometry\r\n\r\n\t\tvar m1;\r\n\r\n\t\treturn function scale( x, y, z ) {\r\n\r\n\t\t\tif ( m1 === undefined ) m1 = new THREE.Matrix4();\r\n\r\n\t\t\tm1.makeScale( x, y, z );\r\n\r\n\t\t\tthis.applyMatrix( m1 );\r\n\r\n\t\t\treturn this;\r\n\r\n\t\t};\r\n\r\n\t}(),\r\n\r\n\tlookAt: function () {\r\n\r\n\t\tvar obj;\r\n\r\n\t\treturn function lookAt( vector ) {\r\n\r\n\t\t\tif ( obj === undefined ) obj = new THREE.Object3D();\r\n\r\n\t\t\tobj.lookAt( vector );\r\n\r\n\t\t\tobj.updateMatrix();\r\n\r\n\t\t\tthis.applyMatrix( obj.matrix );\r\n\r\n\t\t};\r\n\r\n\t}(),\r\n\r\n\tfromBufferGeometry: function ( geometry ) {\r\n\r\n\t\tvar scope = this;\r\n\r\n\t\tvar indices = geometry.index !== null ? geometry.index.array : undefined;\r\n\t\tvar attributes = geometry.attributes;\r\n\r\n\t\tvar vertices = attributes.position.array;\r\n\t\tvar normals = attributes.normal !== undefined ? attributes.normal.array : undefined;\r\n\t\tvar colors = attributes.color !== undefined ? attributes.color.array : undefined;\r\n\t\tvar uvs = attributes.uv !== undefined ? attributes.uv.array : undefined;\r\n\t\tvar uvs2 = attributes.uv2 !== undefined ? attributes.uv2.array : undefined;\r\n\r\n\t\tif ( uvs2 !== undefined ) this.faceVertexUvs[ 1 ] = [];\r\n\r\n\t\tvar tempNormals = [];\r\n\t\tvar tempUVs = [];\r\n\t\tvar tempUVs2 = [];\r\n\r\n\t\tfor ( var i = 0, j = 0, k = 0; i < vertices.length; i += 3, j += 2, k += 4 ) {\r\n\r\n\t\t\tscope.vertices.push( new THREE.Vector3( vertices[ i ], vertices[ i + 1 ], vertices[ i + 2 ] ) );\r\n\r\n\t\t\tif ( normals !== undefined ) {\r\n\r\n\t\t\t\ttempNormals.push( new THREE.Vector3( normals[ i ], normals[ i + 1 ], normals[ i + 2 ] ) );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( colors !== undefined ) {\r\n\r\n\t\t\t\tscope.colors.push( new THREE.Color( colors[ i ], colors[ i + 1 ], colors[ i + 2 ] ) );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( uvs !== undefined ) {\r\n\r\n\t\t\t\ttempUVs.push( new THREE.Vector2( uvs[ j ], uvs[ j + 1 ] ) );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( uvs2 !== undefined ) {\r\n\r\n\t\t\t\ttempUVs2.push( new THREE.Vector2( uvs2[ j ], uvs2[ j + 1 ] ) );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tvar addFace = function ( a, b, c ) {\r\n\r\n\t\t\tvar vertexNormals = normals !== undefined ? [ tempNormals[ a ].clone(), tempNormals[ b ].clone(), tempNormals[ c ].clone() ] : [];\r\n\t\t\tvar vertexColors = colors !== undefined ? [ scope.colors[ a ].clone(), scope.colors[ b ].clone(), scope.colors[ c ].clone() ] : [];\r\n\r\n\t\t\tvar face = new THREE.Face3( a, b, c, vertexNormals, vertexColors );\r\n\r\n\t\t\tscope.faces.push( face );\r\n\r\n\t\t\tif ( uvs !== undefined ) {\r\n\r\n\t\t\t\tscope.faceVertexUvs[ 0 ].push( [ tempUVs[ a ].clone(), tempUVs[ b ].clone(), tempUVs[ c ].clone() ] );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( uvs2 !== undefined ) {\r\n\r\n\t\t\t\tscope.faceVertexUvs[ 1 ].push( [ tempUVs2[ a ].clone(), tempUVs2[ b ].clone(), tempUVs2[ c ].clone() ] );\r\n\r\n\t\t\t}\r\n\r\n\t\t};\r\n\r\n\t\tif ( indices !== undefined ) {\r\n\r\n\t\t\tvar groups = geometry.groups;\r\n\r\n\t\t\tif ( groups.length > 0 ) {\r\n\r\n\t\t\t\tfor ( var i = 0; i < groups.length; i ++ ) {\r\n\r\n\t\t\t\t\tvar group = groups[ i ];\r\n\r\n\t\t\t\t\tvar start = group.start;\r\n\t\t\t\t\tvar count = group.count;\r\n\r\n\t\t\t\t\tfor ( var j = start, jl = start + count; j < jl; j += 3 ) {\r\n\r\n\t\t\t\t\t\taddFace( indices[ j ], indices[ j + 1 ], indices[ j + 2 ] );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tfor ( var i = 0; i < indices.length; i += 3 ) {\r\n\r\n\t\t\t\t\taddFace( indices[ i ], indices[ i + 1 ], indices[ i + 2 ] );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t} else {\r\n\r\n\t\t\tfor ( var i = 0; i < vertices.length / 3; i += 3 ) {\r\n\r\n\t\t\t\taddFace( i, i + 1, i + 2 );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tthis.computeFaceNormals();\r\n\r\n\t\tif ( geometry.boundingBox !== null ) {\r\n\r\n\t\t\tthis.boundingBox = geometry.boundingBox.clone();\r\n\r\n\t\t}\r\n\r\n\t\tif ( geometry.boundingSphere !== null ) {\r\n\r\n\t\t\tthis.boundingSphere = geometry.boundingSphere.clone();\r\n\r\n\t\t}\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tcenter: function () {\r\n\r\n\t\tthis.computeBoundingBox();\r\n\r\n\t\tvar offset = this.boundingBox.center().negate();\r\n\r\n\t\tthis.translate( offset.x, offset.y, offset.z );\r\n\r\n\t\treturn offset;\r\n\r\n\t},\r\n\r\n\tnormalize: function () {\r\n\r\n\t\tthis.computeBoundingSphere();\r\n\r\n\t\tvar center = this.boundingSphere.center;\r\n\t\tvar radius = this.boundingSphere.radius;\r\n\r\n\t\tvar s = radius === 0 ? 1 : 1.0 / radius;\r\n\r\n\t\tvar matrix = new THREE.Matrix4();\r\n\t\tmatrix.set(\r\n\t\t\ts, 0, 0, - s * center.x,\r\n\t\t\t0, s, 0, - s * center.y,\r\n\t\t\t0, 0, s, - s * center.z,\r\n\t\t\t0, 0, 0, 1\r\n\t\t);\r\n\r\n\t\tthis.applyMatrix( matrix );\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tcomputeFaceNormals: function () {\r\n\r\n\t\tvar cb = new THREE.Vector3(), ab = new THREE.Vector3();\r\n\r\n\t\tfor ( var f = 0, fl = this.faces.length; f < fl; f ++ ) {\r\n\r\n\t\t\tvar face = this.faces[ f ];\r\n\r\n\t\t\tvar vA = this.vertices[ face.a ];\r\n\t\t\tvar vB = this.vertices[ face.b ];\r\n\t\t\tvar vC = this.vertices[ face.c ];\r\n\r\n\t\t\tcb.subVectors( vC, vB );\r\n\t\t\tab.subVectors( vA, vB );\r\n\t\t\tcb.cross( ab );\r\n\r\n\t\t\tcb.normalize();\r\n\r\n\t\t\tface.normal.copy( cb );\r\n\r\n\t\t}\r\n\r\n\t},\r\n\r\n\tcomputeVertexNormals: function ( areaWeighted ) {\r\n\r\n\t\tvar v, vl, f, fl, face, vertices;\r\n\r\n\t\tvertices = new Array( this.vertices.length );\r\n\r\n\t\tfor ( v = 0, vl = this.vertices.length; v < vl; v ++ ) {\r\n\r\n\t\t\tvertices[ v ] = new THREE.Vector3();\r\n\r\n\t\t}\r\n\r\n\t\tif ( areaWeighted ) {\r\n\r\n\t\t\t// vertex normals weighted by triangle areas\r\n\t\t\t// http://www.iquilezles.org/www/articles/normals/normals.htm\r\n\r\n\t\t\tvar vA, vB, vC;\r\n\t\t\tvar cb = new THREE.Vector3(), ab = new THREE.Vector3();\r\n\r\n\t\t\tfor ( f = 0, fl = this.faces.length; f < fl; f ++ ) {\r\n\r\n\t\t\t\tface = this.faces[ f ];\r\n\r\n\t\t\t\tvA = this.vertices[ face.a ];\r\n\t\t\t\tvB = this.vertices[ face.b ];\r\n\t\t\t\tvC = this.vertices[ face.c ];\r\n\r\n\t\t\t\tcb.subVectors( vC, vB );\r\n\t\t\t\tab.subVectors( vA, vB );\r\n\t\t\t\tcb.cross( ab );\r\n\r\n\t\t\t\tvertices[ face.a ].add( cb );\r\n\t\t\t\tvertices[ face.b ].add( cb );\r\n\t\t\t\tvertices[ face.c ].add( cb );\r\n\r\n\t\t\t}\r\n\r\n\t\t} else {\r\n\r\n\t\t\tfor ( f = 0, fl = this.faces.length; f < fl; f ++ ) {\r\n\r\n\t\t\t\tface = this.faces[ f ];\r\n\r\n\t\t\t\tvertices[ face.a ].add( face.normal );\r\n\t\t\t\tvertices[ face.b ].add( face.normal );\r\n\t\t\t\tvertices[ face.c ].add( face.normal );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tfor ( v = 0, vl = this.vertices.length; v < vl; v ++ ) {\r\n\r\n\t\t\tvertices[ v ].normalize();\r\n\r\n\t\t}\r\n\r\n\t\tfor ( f = 0, fl = this.faces.length; f < fl; f ++ ) {\r\n\r\n\t\t\tface = this.faces[ f ];\r\n\r\n\t\t\tvar vertexNormals = face.vertexNormals;\r\n\r\n\t\t\tif ( vertexNormals.length === 3 ) {\r\n\r\n\t\t\t\tvertexNormals[ 0 ].copy( vertices[ face.a ] );\r\n\t\t\t\tvertexNormals[ 1 ].copy( vertices[ face.b ] );\r\n\t\t\t\tvertexNormals[ 2 ].copy( vertices[ face.c ] );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tvertexNormals[ 0 ] = vertices[ face.a ].clone();\r\n\t\t\t\tvertexNormals[ 1 ] = vertices[ face.b ].clone();\r\n\t\t\t\tvertexNormals[ 2 ] = vertices[ face.c ].clone();\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t},\r\n\r\n\tcomputeMorphNormals: function () {\r\n\r\n\t\tvar i, il, f, fl, face;\r\n\r\n\t\t// save original normals\r\n\t\t// - create temp variables on first access\r\n\t\t// otherwise just copy (for faster repeated calls)\r\n\r\n\t\tfor ( f = 0, fl = this.faces.length; f < fl; f ++ ) {\r\n\r\n\t\t\tface = this.faces[ f ];\r\n\r\n\t\t\tif ( ! face.__originalFaceNormal ) {\r\n\r\n\t\t\t\tface.__originalFaceNormal = face.normal.clone();\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tface.__originalFaceNormal.copy( face.normal );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( ! face.__originalVertexNormals ) face.__originalVertexNormals = [];\r\n\r\n\t\t\tfor ( i = 0, il = face.vertexNormals.length; i < il; i ++ ) {\r\n\r\n\t\t\t\tif ( ! face.__originalVertexNormals[ i ] ) {\r\n\r\n\t\t\t\t\tface.__originalVertexNormals[ i ] = face.vertexNormals[ i ].clone();\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\tface.__originalVertexNormals[ i ].copy( face.vertexNormals[ i ] );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\t// use temp geometry to compute face and vertex normals for each morph\r\n\r\n\t\tvar tmpGeo = new THREE.Geometry();\r\n\t\ttmpGeo.faces = this.faces;\r\n\r\n\t\tfor ( i = 0, il = this.morphTargets.length; i < il; i ++ ) {\r\n\r\n\t\t\t// create on first access\r\n\r\n\t\t\tif ( ! this.morphNormals[ i ] ) {\r\n\r\n\t\t\t\tthis.morphNormals[ i ] = {};\r\n\t\t\t\tthis.morphNormals[ i ].faceNormals = [];\r\n\t\t\t\tthis.morphNormals[ i ].vertexNormals = [];\r\n\r\n\t\t\t\tvar dstNormalsFace = this.morphNormals[ i ].faceNormals;\r\n\t\t\t\tvar dstNormalsVertex = this.morphNormals[ i ].vertexNormals;\r\n\r\n\t\t\t\tvar faceNormal, vertexNormals;\r\n\r\n\t\t\t\tfor ( f = 0, fl = this.faces.length; f < fl; f ++ ) {\r\n\r\n\t\t\t\t\tfaceNormal = new THREE.Vector3();\r\n\t\t\t\t\tvertexNormals = { a: new THREE.Vector3(), b: new THREE.Vector3(), c: new THREE.Vector3() };\r\n\r\n\t\t\t\t\tdstNormalsFace.push( faceNormal );\r\n\t\t\t\t\tdstNormalsVertex.push( vertexNormals );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\tvar morphNormals = this.morphNormals[ i ];\r\n\r\n\t\t\t// set vertices to morph target\r\n\r\n\t\t\ttmpGeo.vertices = this.morphTargets[ i ].vertices;\r\n\r\n\t\t\t// compute morph normals\r\n\r\n\t\t\ttmpGeo.computeFaceNormals();\r\n\t\t\ttmpGeo.computeVertexNormals();\r\n\r\n\t\t\t// store morph normals\r\n\r\n\t\t\tvar faceNormal, vertexNormals;\r\n\r\n\t\t\tfor ( f = 0, fl = this.faces.length; f < fl; f ++ ) {\r\n\r\n\t\t\t\tface = this.faces[ f ];\r\n\r\n\t\t\t\tfaceNormal = morphNormals.faceNormals[ f ];\r\n\t\t\t\tvertexNormals = morphNormals.vertexNormals[ f ];\r\n\r\n\t\t\t\tfaceNormal.copy( face.normal );\r\n\r\n\t\t\t\tvertexNormals.a.copy( face.vertexNormals[ 0 ] );\r\n\t\t\t\tvertexNormals.b.copy( face.vertexNormals[ 1 ] );\r\n\t\t\t\tvertexNormals.c.copy( face.vertexNormals[ 2 ] );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\t// restore original normals\r\n\r\n\t\tfor ( f = 0, fl = this.faces.length; f < fl; f ++ ) {\r\n\r\n\t\t\tface = this.faces[ f ];\r\n\r\n\t\t\tface.normal = face.__originalFaceNormal;\r\n\t\t\tface.vertexNormals = face.__originalVertexNormals;\r\n\r\n\t\t}\r\n\r\n\t},\r\n\r\n\tcomputeTangents: function () {\r\n\r\n\t\tconsole.warn( 'THREE.Geometry: .computeTangents() has been removed.' );\r\n\r\n\t},\r\n\r\n\tcomputeLineDistances: function () {\r\n\r\n\t\tvar d = 0;\r\n\t\tvar vertices = this.vertices;\r\n\r\n\t\tfor ( var i = 0, il = vertices.length; i < il; i ++ ) {\r\n\r\n\t\t\tif ( i > 0 ) {\r\n\r\n\t\t\t\td += vertices[ i ].distanceTo( vertices[ i - 1 ] );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tthis.lineDistances[ i ] = d;\r\n\r\n\t\t}\r\n\r\n\t},\r\n\r\n\tcomputeBoundingBox: function () {\r\n\r\n\t\tif ( this.boundingBox === null ) {\r\n\r\n\t\t\tthis.boundingBox = new THREE.Box3();\r\n\r\n\t\t}\r\n\r\n\t\tthis.boundingBox.setFromPoints( this.vertices );\r\n\r\n\t},\r\n\r\n\tcomputeBoundingSphere: function () {\r\n\r\n\t\tif ( this.boundingSphere === null ) {\r\n\r\n\t\t\tthis.boundingSphere = new THREE.Sphere();\r\n\r\n\t\t}\r\n\r\n\t\tthis.boundingSphere.setFromPoints( this.vertices );\r\n\r\n\t},\r\n\r\n\tmerge: function ( geometry, matrix, materialIndexOffset ) {\r\n\r\n\t\tif ( geometry instanceof THREE.Geometry === false ) {\r\n\r\n\t\t\tconsole.error( 'THREE.Geometry.merge(): geometry not an instance of THREE.Geometry.', geometry );\r\n\t\t\treturn;\r\n\r\n\t\t}\r\n\r\n\t\tvar normalMatrix,\r\n\t\tvertexOffset = this.vertices.length,\r\n\t\tvertices1 = this.vertices,\r\n\t\tvertices2 = geometry.vertices,\r\n\t\tfaces1 = this.faces,\r\n\t\tfaces2 = geometry.faces,\r\n\t\tuvs1 = this.faceVertexUvs[ 0 ],\r\n\t\tuvs2 = geometry.faceVertexUvs[ 0 ];\r\n\r\n\t\tif ( materialIndexOffset === undefined ) materialIndexOffset = 0;\r\n\r\n\t\tif ( matrix !== undefined ) {\r\n\r\n\t\t\tnormalMatrix = new THREE.Matrix3().getNormalMatrix( matrix );\r\n\r\n\t\t}\r\n\r\n\t\t// vertices\r\n\r\n\t\tfor ( var i = 0, il = vertices2.length; i < il; i ++ ) {\r\n\r\n\t\t\tvar vertex = vertices2[ i ];\r\n\r\n\t\t\tvar vertexCopy = vertex.clone();\r\n\r\n\t\t\tif ( matrix !== undefined ) vertexCopy.applyMatrix4( matrix );\r\n\r\n\t\t\tvertices1.push( vertexCopy );\r\n\r\n\t\t}\r\n\r\n\t\t// faces\r\n\r\n\t\tfor ( i = 0, il = faces2.length; i < il; i ++ ) {\r\n\r\n\t\t\tvar face = faces2[ i ], faceCopy, normal, color,\r\n\t\t\tfaceVertexNormals = face.vertexNormals,\r\n\t\t\tfaceVertexColors = face.vertexColors;\r\n\r\n\t\t\tfaceCopy = new THREE.Face3( face.a + vertexOffset, face.b + vertexOffset, face.c + vertexOffset );\r\n\t\t\tfaceCopy.normal.copy( face.normal );\r\n\r\n\t\t\tif ( normalMatrix !== undefined ) {\r\n\r\n\t\t\t\tfaceCopy.normal.applyMatrix3( normalMatrix ).normalize();\r\n\r\n\t\t\t}\r\n\r\n\t\t\tfor ( var j = 0, jl = faceVertexNormals.length; j < jl; j ++ ) {\r\n\r\n\t\t\t\tnormal = faceVertexNormals[ j ].clone();\r\n\r\n\t\t\t\tif ( normalMatrix !== undefined ) {\r\n\r\n\t\t\t\t\tnormal.applyMatrix3( normalMatrix ).normalize();\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tfaceCopy.vertexNormals.push( normal );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tfaceCopy.color.copy( face.color );\r\n\r\n\t\t\tfor ( var j = 0, jl = faceVertexColors.length; j < jl; j ++ ) {\r\n\r\n\t\t\t\tcolor = faceVertexColors[ j ];\r\n\t\t\t\tfaceCopy.vertexColors.push( color.clone() );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tfaceCopy.materialIndex = face.materialIndex + materialIndexOffset;\r\n\r\n\t\t\tfaces1.push( faceCopy );\r\n\r\n\t\t}\r\n\r\n\t\t// uvs\r\n\r\n\t\tfor ( i = 0, il = uvs2.length; i < il; i ++ ) {\r\n\r\n\t\t\tvar uv = uvs2[ i ], uvCopy = [];\r\n\r\n\t\t\tif ( uv === undefined ) {\r\n\r\n\t\t\t\tcontinue;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tfor ( var j = 0, jl = uv.length; j < jl; j ++ ) {\r\n\r\n\t\t\t\tuvCopy.push( uv[ j ].clone() );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tuvs1.push( uvCopy );\r\n\r\n\t\t}\r\n\r\n\t},\r\n\r\n\tmergeMesh: function ( mesh ) {\r\n\r\n\t\tif ( mesh instanceof THREE.Mesh === false ) {\r\n\r\n\t\t\tconsole.error( 'THREE.Geometry.mergeMesh(): mesh not an instance of THREE.Mesh.', mesh );\r\n\t\t\treturn;\r\n\r\n\t\t}\r\n\r\n\t\tmesh.matrixAutoUpdate && mesh.updateMatrix();\r\n\r\n\t\tthis.merge( mesh.geometry, mesh.matrix );\r\n\r\n\t},\r\n\r\n\t/*\r\n\t * Checks for duplicate vertices with hashmap.\r\n\t * Duplicated vertices are removed\r\n\t * and faces' vertices are updated.\r\n\t */\r\n\r\n\tmergeVertices: function () {\r\n\r\n\t\tvar verticesMap = {}; // Hashmap for looking up vertices by position coordinates (and making sure they are unique)\r\n\t\tvar unique = [], changes = [];\r\n\r\n\t\tvar v, key;\r\n\t\tvar precisionPoints = 4; // number of decimal points, e.g. 4 for epsilon of 0.0001\r\n\t\tvar precision = Math.pow( 10, precisionPoints );\r\n\t\tvar i, il, face;\r\n\t\tvar indices, j, jl;\r\n\r\n\t\tfor ( i = 0, il = this.vertices.length; i < il; i ++ ) {\r\n\r\n\t\t\tv = this.vertices[ i ];\r\n\t\t\tkey = Math.round( v.x * precision ) + '_' + Math.round( v.y * precision ) + '_' + Math.round( v.z * precision );\r\n\r\n\t\t\tif ( verticesMap[ key ] === undefined ) {\r\n\r\n\t\t\t\tverticesMap[ key ] = i;\r\n\t\t\t\tunique.push( this.vertices[ i ] );\r\n\t\t\t\tchanges[ i ] = unique.length - 1;\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\t//console.log('Duplicate vertex found. ', i, ' could be using ', verticesMap[key]);\r\n\t\t\t\tchanges[ i ] = changes[ verticesMap[ key ] ];\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\r\n\t\t// if faces are completely degenerate after merging vertices, we\r\n\t\t// have to remove them from the geometry.\r\n\t\tvar faceIndicesToRemove = [];\r\n\r\n\t\tfor ( i = 0, il = this.faces.length; i < il; i ++ ) {\r\n\r\n\t\t\tface = this.faces[ i ];\r\n\r\n\t\t\tface.a = changes[ face.a ];\r\n\t\t\tface.b = changes[ face.b ];\r\n\t\t\tface.c = changes[ face.c ];\r\n\r\n\t\t\tindices = [ face.a, face.b, face.c ];\r\n\r\n\t\t\tvar dupIndex = - 1;\r\n\r\n\t\t\t// if any duplicate vertices are found in a Face3\r\n\t\t\t// we have to remove the face as nothing can be saved\r\n\t\t\tfor ( var n = 0; n < 3; n ++ ) {\r\n\r\n\t\t\t\tif ( indices[ n ] === indices[ ( n + 1 ) % 3 ] ) {\r\n\r\n\t\t\t\t\tdupIndex = n;\r\n\t\t\t\t\tfaceIndicesToRemove.push( i );\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tfor ( i = faceIndicesToRemove.length - 1; i >= 0; i -- ) {\r\n\r\n\t\t\tvar idx = faceIndicesToRemove[ i ];\r\n\r\n\t\t\tthis.faces.splice( idx, 1 );\r\n\r\n\t\t\tfor ( j = 0, jl = this.faceVertexUvs.length; j < jl; j ++ ) {\r\n\r\n\t\t\t\tthis.faceVertexUvs[ j ].splice( idx, 1 );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\t// Use unique set of vertices\r\n\r\n\t\tvar diff = this.vertices.length - unique.length;\r\n\t\tthis.vertices = unique;\r\n\t\treturn diff;\r\n\r\n\t},\r\n\r\n\ttoJSON: function () {\r\n\r\n\t\tvar data = {\r\n\t\t\tmetadata: {\r\n\t\t\t\tversion: 4.4,\r\n\t\t\t\ttype: 'Geometry',\r\n\t\t\t\tgenerator: 'Geometry.toJSON'\r\n\t\t\t}\r\n\t\t};\r\n\r\n\t\t// standard Geometry serialization\r\n\r\n\t\tdata.uuid = this.uuid;\r\n\t\tdata.type = this.type;\r\n\t\tif ( this.name !== '' ) data.name = this.name;\r\n\r\n\t\tif ( this.parameters !== undefined ) {\r\n\r\n\t\t\tvar parameters = this.parameters;\r\n\r\n\t\t\tfor ( var key in parameters ) {\r\n\r\n\t\t\t\tif ( parameters[ key ] !== undefined ) data[ key ] = parameters[ key ];\r\n\r\n\t\t\t}\r\n\r\n\t\t\treturn data;\r\n\r\n\t\t}\r\n\r\n\t\tvar vertices = [];\r\n\r\n\t\tfor ( var i = 0; i < this.vertices.length; i ++ ) {\r\n\r\n\t\t\tvar vertex = this.vertices[ i ];\r\n\t\t\tvertices.push( vertex.x, vertex.y, vertex.z );\r\n\r\n\t\t}\r\n\r\n\t\tvar faces = [];\r\n\t\tvar normals = [];\r\n\t\tvar normalsHash = {};\r\n\t\tvar colors = [];\r\n\t\tvar colorsHash = {};\r\n\t\tvar uvs = [];\r\n\t\tvar uvsHash = {};\r\n\r\n\t\tfor ( var i = 0; i < this.faces.length; i ++ ) {\r\n\r\n\t\t\tvar face = this.faces[ i ];\r\n\r\n\t\t\tvar hasMaterial = false; // face.materialIndex !== undefined;\r\n\t\t\tvar hasFaceUv = false; // deprecated\r\n\t\t\tvar hasFaceVertexUv = this.faceVertexUvs[ 0 ][ i ] !== undefined;\r\n\t\t\tvar hasFaceNormal = face.normal.length() > 0;\r\n\t\t\tvar hasFaceVertexNormal = face.vertexNormals.length > 0;\r\n\t\t\tvar hasFaceColor = face.color.r !== 1 || face.color.g !== 1 || face.color.b !== 1;\r\n\t\t\tvar hasFaceVertexColor = face.vertexColors.length > 0;\r\n\r\n\t\t\tvar faceType = 0;\r\n\r\n\t\t\tfaceType = setBit( faceType, 0, 0 );\r\n\t\t\tfaceType = setBit( faceType, 1, hasMaterial );\r\n\t\t\tfaceType = setBit( faceType, 2, hasFaceUv );\r\n\t\t\tfaceType = setBit( faceType, 3, hasFaceVertexUv );\r\n\t\t\tfaceType = setBit( faceType, 4, hasFaceNormal );\r\n\t\t\tfaceType = setBit( faceType, 5, hasFaceVertexNormal );\r\n\t\t\tfaceType = setBit( faceType, 6, hasFaceColor );\r\n\t\t\tfaceType = setBit( faceType, 7, hasFaceVertexColor );\r\n\r\n\t\t\tfaces.push( faceType );\r\n\t\t\tfaces.push( face.a, face.b, face.c );\r\n\r\n\t\t\tif ( hasFaceVertexUv ) {\r\n\r\n\t\t\t\tvar faceVertexUvs = this.faceVertexUvs[ 0 ][ i ];\r\n\r\n\t\t\t\tfaces.push(\r\n\t\t\t\t\tgetUvIndex( faceVertexUvs[ 0 ] ),\r\n\t\t\t\t\tgetUvIndex( faceVertexUvs[ 1 ] ),\r\n\t\t\t\t\tgetUvIndex( faceVertexUvs[ 2 ] )\r\n\t\t\t\t);\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( hasFaceNormal ) {\r\n\r\n\t\t\t\tfaces.push( getNormalIndex( face.normal ) );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( hasFaceVertexNormal ) {\r\n\r\n\t\t\t\tvar vertexNormals = face.vertexNormals;\r\n\r\n\t\t\t\tfaces.push(\r\n\t\t\t\t\tgetNormalIndex( vertexNormals[ 0 ] ),\r\n\t\t\t\t\tgetNormalIndex( vertexNormals[ 1 ] ),\r\n\t\t\t\t\tgetNormalIndex( vertexNormals[ 2 ] )\r\n\t\t\t\t);\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( hasFaceColor ) {\r\n\r\n\t\t\t\tfaces.push( getColorIndex( face.color ) );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( hasFaceVertexColor ) {\r\n\r\n\t\t\t\tvar vertexColors = face.vertexColors;\r\n\r\n\t\t\t\tfaces.push(\r\n\t\t\t\t\tgetColorIndex( vertexColors[ 0 ] ),\r\n\t\t\t\t\tgetColorIndex( vertexColors[ 1 ] ),\r\n\t\t\t\t\tgetColorIndex( vertexColors[ 2 ] )\r\n\t\t\t\t);\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tfunction setBit( value, position, enabled ) {\r\n\r\n\t\t\treturn enabled ? value | ( 1 << position ) : value & ( ~ ( 1 << position ) );\r\n\r\n\t\t}\r\n\r\n\t\tfunction getNormalIndex( normal ) {\r\n\r\n\t\t\tvar hash = normal.x.toString() + normal.y.toString() + normal.z.toString();\r\n\r\n\t\t\tif ( normalsHash[ hash ] !== undefined ) {\r\n\r\n\t\t\t\treturn normalsHash[ hash ];\r\n\r\n\t\t\t}\r\n\r\n\t\t\tnormalsHash[ hash ] = normals.length / 3;\r\n\t\t\tnormals.push( normal.x, normal.y, normal.z );\r\n\r\n\t\t\treturn normalsHash[ hash ];\r\n\r\n\t\t}\r\n\r\n\t\tfunction getColorIndex( color ) {\r\n\r\n\t\t\tvar hash = color.r.toString() + color.g.toString() + color.b.toString();\r\n\r\n\t\t\tif ( colorsHash[ hash ] !== undefined ) {\r\n\r\n\t\t\t\treturn colorsHash[ hash ];\r\n\r\n\t\t\t}\r\n\r\n\t\t\tcolorsHash[ hash ] = colors.length;\r\n\t\t\tcolors.push( color.getHex() );\r\n\r\n\t\t\treturn colorsHash[ hash ];\r\n\r\n\t\t}\r\n\r\n\t\tfunction getUvIndex( uv ) {\r\n\r\n\t\t\tvar hash = uv.x.toString() + uv.y.toString();\r\n\r\n\t\t\tif ( uvsHash[ hash ] !== undefined ) {\r\n\r\n\t\t\t\treturn uvsHash[ hash ];\r\n\r\n\t\t\t}\r\n\r\n\t\t\tuvsHash[ hash ] = uvs.length / 2;\r\n\t\t\tuvs.push( uv.x, uv.y );\r\n\r\n\t\t\treturn uvsHash[ hash ];\r\n\r\n\t\t}\r\n\r\n\t\tdata.data = {};\r\n\r\n\t\tdata.data.vertices = vertices;\r\n\t\tdata.data.normals = normals;\r\n\t\tif ( colors.length > 0 ) data.data.colors = colors;\r\n\t\tif ( uvs.length > 0 ) data.data.uvs = [ uvs ]; // temporal backward compatibility\r\n\t\tdata.data.faces = faces;\r\n\r\n\t\treturn data;\r\n\r\n\t},\r\n\r\n\tclone: function () {\r\n\r\n\t\treturn new this.constructor().copy( this );\r\n\r\n\t},\r\n\r\n\tcopy: function ( source ) {\r\n\r\n\t\tthis.vertices = [];\r\n\t\tthis.faces = [];\r\n\t\tthis.faceVertexUvs = [ [] ];\r\n\r\n\t\tvar vertices = source.vertices;\r\n\r\n\t\tfor ( var i = 0, il = vertices.length; i < il; i ++ ) {\r\n\r\n\t\t\tthis.vertices.push( vertices[ i ].clone() );\r\n\r\n\t\t}\r\n\r\n\t\tvar faces = source.faces;\r\n\r\n\t\tfor ( var i = 0, il = faces.length; i < il; i ++ ) {\r\n\r\n\t\t\tthis.faces.push( faces[ i ].clone() );\r\n\r\n\t\t}\r\n\r\n\t\tfor ( var i = 0, il = source.faceVertexUvs.length; i < il; i ++ ) {\r\n\r\n\t\t\tvar faceVertexUvs = source.faceVertexUvs[ i ];\r\n\r\n\t\t\tif ( this.faceVertexUvs[ i ] === undefined ) {\r\n\r\n\t\t\t\tthis.faceVertexUvs[ i ] = [];\r\n\r\n\t\t\t}\r\n\r\n\t\t\tfor ( var j = 0, jl = faceVertexUvs.length; j < jl; j ++ ) {\r\n\r\n\t\t\t\tvar uvs = faceVertexUvs[ j ], uvsCopy = [];\r\n\r\n\t\t\t\tfor ( var k = 0, kl = uvs.length; k < kl; k ++ ) {\r\n\r\n\t\t\t\t\tvar uv = uvs[ k ];\r\n\r\n\t\t\t\t\tuvsCopy.push( uv.clone() );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tthis.faceVertexUvs[ i ].push( uvsCopy );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tdispose: function () {\r\n\r\n\t\tthis.dispatchEvent( { type: 'dispose' } );\r\n\r\n\t}\r\n\r\n};\r\n\r\nTHREE.EventDispatcher.prototype.apply( THREE.Geometry.prototype );\r\n\r\nTHREE.GeometryIdCount = 0;\r\n\r\n// File:src/core/DirectGeometry.js\r\n\r\n/**\r\n * @author mrdoob / http://mrdoob.com/\r\n */\r\n\r\nTHREE.DirectGeometry = function () {\r\n\r\n\tObject.defineProperty( this, 'id', { value: THREE.GeometryIdCount ++ } );\r\n\r\n\tthis.uuid = THREE.Math.generateUUID();\r\n\r\n\tthis.name = '';\r\n\tthis.type = 'DirectGeometry';\r\n\r\n\tthis.indices = [];\r\n\tthis.vertices = [];\r\n\tthis.normals = [];\r\n\tthis.colors = [];\r\n\tthis.uvs = [];\r\n\tthis.uvs2 = [];\r\n\r\n\tthis.groups = [];\r\n\r\n\tthis.morphTargets = {};\r\n\r\n\tthis.skinWeights = [];\r\n\tthis.skinIndices = [];\r\n\r\n\t// this.lineDistances = [];\r\n\r\n\tthis.boundingBox = null;\r\n\tthis.boundingSphere = null;\r\n\r\n\t// update flags\r\n\r\n\tthis.verticesNeedUpdate = false;\r\n\tthis.normalsNeedUpdate = false;\r\n\tthis.colorsNeedUpdate = false;\r\n\tthis.uvsNeedUpdate = false;\r\n\tthis.groupsNeedUpdate = false;\r\n\r\n};\r\n\r\nTHREE.DirectGeometry.prototype = {\r\n\r\n\tconstructor: THREE.DirectGeometry,\r\n\r\n\tcomputeBoundingBox: THREE.Geometry.prototype.computeBoundingBox,\r\n\tcomputeBoundingSphere: THREE.Geometry.prototype.computeBoundingSphere,\r\n\r\n\tcomputeFaceNormals: function () {\r\n\r\n\t\tconsole.warn( 'THREE.DirectGeometry: computeFaceNormals() is not a method of this type of geometry.' );\r\n\r\n\t},\r\n\r\n\tcomputeVertexNormals: function () {\r\n\r\n\t\tconsole.warn( 'THREE.DirectGeometry: computeVertexNormals() is not a method of this type of geometry.' );\r\n\r\n\t},\r\n\r\n\tcomputeGroups: function ( geometry ) {\r\n\r\n\t\tvar group;\r\n\t\tvar groups = [];\r\n\t\tvar materialIndex;\r\n\r\n\t\tvar faces = geometry.faces;\r\n\r\n\t\tfor ( var i = 0; i < faces.length; i ++ ) {\r\n\r\n\t\t\tvar face = faces[ i ];\r\n\r\n\t\t\t// materials\r\n\r\n\t\t\tif ( face.materialIndex !== materialIndex ) {\r\n\r\n\t\t\t\tmaterialIndex = face.materialIndex;\r\n\r\n\t\t\t\tif ( group !== undefined ) {\r\n\r\n\t\t\t\t\tgroup.count = ( i * 3 ) - group.start;\r\n\t\t\t\t\tgroups.push( group );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tgroup = {\r\n\t\t\t\t\tstart: i * 3,\r\n\t\t\t\t\tmaterialIndex: materialIndex\r\n\t\t\t\t};\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tif ( group !== undefined ) {\r\n\r\n\t\t\tgroup.count = ( i * 3 ) - group.start;\r\n\t\t\tgroups.push( group );\r\n\r\n\t\t}\r\n\r\n\t\tthis.groups = groups;\r\n\r\n\t},\r\n\r\n\tfromGeometry: function ( geometry ) {\r\n\r\n\t\tvar faces = geometry.faces;\r\n\t\tvar vertices = geometry.vertices;\r\n\t\tvar faceVertexUvs = geometry.faceVertexUvs;\r\n\r\n\t\tvar hasFaceVertexUv = faceVertexUvs[ 0 ] && faceVertexUvs[ 0 ].length > 0;\r\n\t\tvar hasFaceVertexUv2 = faceVertexUvs[ 1 ] && faceVertexUvs[ 1 ].length > 0;\r\n\r\n\t\t// morphs\r\n\r\n\t\tvar morphTargets = geometry.morphTargets;\r\n\t\tvar morphTargetsLength = morphTargets.length;\r\n\r\n\t\tif ( morphTargetsLength > 0 ) {\r\n\r\n\t\t\tvar morphTargetsPosition = [];\r\n\r\n\t\t\tfor ( var i = 0; i < morphTargetsLength; i ++ ) {\r\n\r\n\t\t\t\tmorphTargetsPosition[ i ] = [];\r\n\r\n\t\t\t}\r\n\r\n\t\t\tthis.morphTargets.position = morphTargetsPosition;\r\n\r\n\t\t}\r\n\r\n\t\tvar morphNormals = geometry.morphNormals;\r\n\t\tvar morphNormalsLength = morphNormals.length;\r\n\r\n\t\tif ( morphNormalsLength > 0 ) {\r\n\r\n\t\t\tvar morphTargetsNormal = [];\r\n\r\n\t\t\tfor ( var i = 0; i < morphNormalsLength; i ++ ) {\r\n\r\n\t\t\t\tmorphTargetsNormal[ i ] = [];\r\n\r\n\t\t\t}\r\n\r\n\t\t\tthis.morphTargets.normal = morphTargetsNormal;\r\n\r\n\t\t}\r\n\r\n\t\t// skins\r\n\r\n\t\tvar skinIndices = geometry.skinIndices;\r\n\t\tvar skinWeights = geometry.skinWeights;\r\n\r\n\t\tvar hasSkinIndices = skinIndices.length === vertices.length;\r\n\t\tvar hasSkinWeights = skinWeights.length === vertices.length;\r\n\r\n\t\t//\r\n\r\n\t\tfor ( var i = 0; i < faces.length; i ++ ) {\r\n\r\n\t\t\tvar face = faces[ i ];\r\n\r\n\t\t\tthis.vertices.push( vertices[ face.a ], vertices[ face.b ], vertices[ face.c ] );\r\n\r\n\t\t\tvar vertexNormals = face.vertexNormals;\r\n\r\n\t\t\tif ( vertexNormals.length === 3 ) {\r\n\r\n\t\t\t\tthis.normals.push( vertexNormals[ 0 ], vertexNormals[ 1 ], vertexNormals[ 2 ] );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tvar normal = face.normal;\r\n\r\n\t\t\t\tthis.normals.push( normal, normal, normal );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tvar vertexColors = face.vertexColors;\r\n\r\n\t\t\tif ( vertexColors.length === 3 ) {\r\n\r\n\t\t\t\tthis.colors.push( vertexColors[ 0 ], vertexColors[ 1 ], vertexColors[ 2 ] );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tvar color = face.color;\r\n\r\n\t\t\t\tthis.colors.push( color, color, color );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( hasFaceVertexUv === true ) {\r\n\r\n\t\t\t\tvar vertexUvs = faceVertexUvs[ 0 ][ i ];\r\n\r\n\t\t\t\tif ( vertexUvs !== undefined ) {\r\n\r\n\t\t\t\t\tthis.uvs.push( vertexUvs[ 0 ], vertexUvs[ 1 ], vertexUvs[ 2 ] );\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\tconsole.warn( 'THREE.DirectGeometry.fromGeometry(): Undefined vertexUv ', i );\r\n\r\n\t\t\t\t\tthis.uvs.push( new THREE.Vector2(), new THREE.Vector2(), new THREE.Vector2() );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( hasFaceVertexUv2 === true ) {\r\n\r\n\t\t\t\tvar vertexUvs = faceVertexUvs[ 1 ][ i ];\r\n\r\n\t\t\t\tif ( vertexUvs !== undefined ) {\r\n\r\n\t\t\t\t\tthis.uvs2.push( vertexUvs[ 0 ], vertexUvs[ 1 ], vertexUvs[ 2 ] );\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\tconsole.warn( 'THREE.DirectGeometry.fromGeometry(): Undefined vertexUv2 ', i );\r\n\r\n\t\t\t\t\tthis.uvs2.push( new THREE.Vector2(), new THREE.Vector2(), new THREE.Vector2() );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\t// morphs\r\n\r\n\t\t\tfor ( var j = 0; j < morphTargetsLength; j ++ ) {\r\n\r\n\t\t\t\tvar morphTarget = morphTargets[ j ].vertices;\r\n\r\n\t\t\t\tmorphTargetsPosition[ j ].push( morphTarget[ face.a ], morphTarget[ face.b ], morphTarget[ face.c ] );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tfor ( var j = 0; j < morphNormalsLength; j ++ ) {\r\n\r\n\t\t\t\tvar morphNormal = morphNormals[ j ].vertexNormals[ i ];\r\n\r\n\t\t\t\tmorphTargetsNormal[ j ].push( morphNormal.a, morphNormal.b, morphNormal.c );\r\n\r\n\t\t\t}\r\n\r\n\t\t\t// skins\r\n\r\n\t\t\tif ( hasSkinIndices ) {\r\n\r\n\t\t\t\tthis.skinIndices.push( skinIndices[ face.a ], skinIndices[ face.b ], skinIndices[ face.c ] );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( hasSkinWeights ) {\r\n\r\n\t\t\t\tthis.skinWeights.push( skinWeights[ face.a ], skinWeights[ face.b ], skinWeights[ face.c ] );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tthis.computeGroups( geometry );\r\n\r\n\t\tthis.verticesNeedUpdate = geometry.verticesNeedUpdate;\r\n\t\tthis.normalsNeedUpdate = geometry.normalsNeedUpdate;\r\n\t\tthis.colorsNeedUpdate = geometry.colorsNeedUpdate;\r\n\t\tthis.uvsNeedUpdate = geometry.uvsNeedUpdate;\r\n\t\tthis.groupsNeedUpdate = geometry.groupsNeedUpdate;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tdispose: function () {\r\n\r\n\t\tthis.dispatchEvent( { type: 'dispose' } );\r\n\r\n\t}\r\n\r\n};\r\n\r\nTHREE.EventDispatcher.prototype.apply( THREE.DirectGeometry.prototype );\r\n\r\n// File:src/core/BufferGeometry.js\r\n\r\n/**\r\n * @author alteredq / http://alteredqualia.com/\r\n * @author mrdoob / http://mrdoob.com/\r\n */\r\n\r\nTHREE.BufferGeometry = function () {\r\n\r\n\tObject.defineProperty( this, 'id', { value: THREE.GeometryIdCount ++ } );\r\n\r\n\tthis.uuid = THREE.Math.generateUUID();\r\n\r\n\tthis.name = '';\r\n\tthis.type = 'BufferGeometry';\r\n\r\n\tthis.index = null;\r\n\tthis.attributes = {};\r\n\r\n\tthis.morphAttributes = {};\r\n\r\n\tthis.groups = [];\r\n\r\n\tthis.boundingBox = null;\r\n\tthis.boundingSphere = null;\r\n\r\n\tthis.drawRange = { start: 0, count: Infinity };\r\n\r\n};\r\n\r\nTHREE.BufferGeometry.prototype = {\r\n\r\n\tconstructor: THREE.BufferGeometry,\r\n\r\n\taddIndex: function ( attribute ) {\r\n\r\n\t\tthis.index = attribute;\r\n\r\n\t},\r\n\r\n\taddAttribute: function ( name, attribute ) {\r\n\r\n\t\tif ( attribute instanceof THREE.BufferAttribute === false && attribute instanceof THREE.InterleavedBufferAttribute === false ) {\r\n\r\n\t\t\tconsole.warn( 'THREE.BufferGeometry: .addAttribute() now expects ( name, attribute ).' );\r\n\r\n\t\t\tthis.addAttribute( name, new THREE.BufferAttribute( arguments[ 1 ], arguments[ 2 ] ) );\r\n\r\n\t\t\treturn;\r\n\r\n\t\t}\r\n\r\n\t\tif ( name === 'index' ) {\r\n\r\n\t\t\tconsole.warn( 'THREE.BufferGeometry.addAttribute: Use .addIndex() for index attribute.' );\r\n\t\t\tthis.addIndex( attribute );\r\n\r\n\t\t}\r\n\r\n\t\tthis.attributes[ name ] = attribute;\r\n\r\n\t},\r\n\r\n\tgetAttribute: function ( name ) {\r\n\r\n\t\treturn this.attributes[ name ];\r\n\r\n\t},\r\n\r\n\tremoveAttribute: function ( name ) {\r\n\r\n\t\tdelete this.attributes[ name ];\r\n\r\n\t},\r\n\r\n\tget drawcalls() {\r\n\r\n\t\tconsole.error( 'THREE.BufferGeometry: .drawcalls has been renamed to .groups.' );\r\n\t\treturn this.groups;\r\n\r\n\t},\r\n\r\n\tget offsets() {\r\n\r\n\t\tconsole.warn( 'THREE.BufferGeometry: .offsets has been renamed to .groups.' );\r\n\t\treturn this.groups;\r\n\r\n\t},\r\n\r\n\taddDrawCall: function ( start, count, indexOffset ) {\r\n\r\n\t\tif ( indexOffset !== undefined ) {\r\n\r\n\t\t\tconsole.warn( 'THREE.BufferGeometry: .addDrawCall() no longer supports indexOffset.' );\r\n\r\n\t\t}\r\n\r\n\t\tconsole.warn( 'THREE.BufferGeometry: .addDrawCall() is now .addGroup().' );\r\n\t\tthis.addGroup( start, count );\r\n\r\n\t},\r\n\r\n\tclearDrawCalls: function () {\r\n\r\n\t\tconsole.warn( 'THREE.BufferGeometry: .clearDrawCalls() is now .clearGroups().' );\r\n\t\tthis.clearGroups();\r\n\r\n\t},\r\n\r\n\taddGroup: function ( start, count, materialIndex ) {\r\n\r\n\t\tthis.groups.push( {\r\n\r\n\t\t\tstart: start,\r\n\t\t\tcount: count,\r\n\t\t\tmaterialIndex: materialIndex !== undefined ? materialIndex : 0\r\n\r\n\t\t} );\r\n\r\n\t},\r\n\r\n\tclearGroups: function () {\r\n\r\n\t\tthis.groups = [];\r\n\r\n\t},\r\n\r\n\tsetDrawRange: function ( start, count ) {\r\n\r\n\t\tthis.drawRange.start = start;\r\n\t\tthis.drawRange.count = count;\r\n\r\n\t},\r\n\r\n\tapplyMatrix: function ( matrix ) {\r\n\r\n\t\tvar position = this.attributes.position;\r\n\r\n\t\tif ( position !== undefined ) {\r\n\r\n\t\t\tmatrix.applyToVector3Array( position.array );\r\n\t\t\tposition.needsUpdate = true;\r\n\r\n\t\t}\r\n\r\n\t\tvar normal = this.attributes.normal;\r\n\r\n\t\tif ( normal !== undefined ) {\r\n\r\n\t\t\tvar normalMatrix = new THREE.Matrix3().getNormalMatrix( matrix );\r\n\r\n\t\t\tnormalMatrix.applyToVector3Array( normal.array );\r\n\t\t\tnormal.needsUpdate = true;\r\n\r\n\t\t}\r\n\r\n\t\tif ( this.boundingBox !== null ) {\r\n\r\n\t\t\tthis.computeBoundingBox();\r\n\r\n\t\t}\r\n\r\n\t\tif ( this.boundingSphere !== null ) {\r\n\r\n\t\t\tthis.computeBoundingSphere();\r\n\r\n\t\t}\r\n\r\n\t},\r\n\r\n\trotateX: function () {\r\n\r\n\t\t// rotate geometry around world x-axis\r\n\r\n\t\tvar m1;\r\n\r\n\t\treturn function rotateX( angle ) {\r\n\r\n\t\t\tif ( m1 === undefined ) m1 = new THREE.Matrix4();\r\n\r\n\t\t\tm1.makeRotationX( angle );\r\n\r\n\t\t\tthis.applyMatrix( m1 );\r\n\r\n\t\t\treturn this;\r\n\r\n\t\t};\r\n\r\n\t}(),\r\n\r\n\trotateY: function () {\r\n\r\n\t\t// rotate geometry around world y-axis\r\n\r\n\t\tvar m1;\r\n\r\n\t\treturn function rotateY( angle ) {\r\n\r\n\t\t\tif ( m1 === undefined ) m1 = new THREE.Matrix4();\r\n\r\n\t\t\tm1.makeRotationY( angle );\r\n\r\n\t\t\tthis.applyMatrix( m1 );\r\n\r\n\t\t\treturn this;\r\n\r\n\t\t};\r\n\r\n\t}(),\r\n\r\n\trotateZ: function () {\r\n\r\n\t\t// rotate geometry around world z-axis\r\n\r\n\t\tvar m1;\r\n\r\n\t\treturn function rotateZ( angle ) {\r\n\r\n\t\t\tif ( m1 === undefined ) m1 = new THREE.Matrix4();\r\n\r\n\t\t\tm1.makeRotationZ( angle );\r\n\r\n\t\t\tthis.applyMatrix( m1 );\r\n\r\n\t\t\treturn this;\r\n\r\n\t\t};\r\n\r\n\t}(),\r\n\r\n\ttranslate: function () {\r\n\r\n\t\t// translate geometry\r\n\r\n\t\tvar m1;\r\n\r\n\t\treturn function translate( x, y, z ) {\r\n\r\n\t\t\tif ( m1 === undefined ) m1 = new THREE.Matrix4();\r\n\r\n\t\t\tm1.makeTranslation( x, y, z );\r\n\r\n\t\t\tthis.applyMatrix( m1 );\r\n\r\n\t\t\treturn this;\r\n\r\n\t\t};\r\n\r\n\t}(),\r\n\r\n\tscale: function () {\r\n\r\n\t\t// scale geometry\r\n\r\n\t\tvar m1;\r\n\r\n\t\treturn function scale( x, y, z ) {\r\n\r\n\t\t\tif ( m1 === undefined ) m1 = new THREE.Matrix4();\r\n\r\n\t\t\tm1.makeScale( x, y, z );\r\n\r\n\t\t\tthis.applyMatrix( m1 );\r\n\r\n\t\t\treturn this;\r\n\r\n\t\t};\r\n\r\n\t}(),\r\n\r\n\tlookAt: function () {\r\n\r\n\t\tvar obj;\r\n\r\n\t\treturn function lookAt( vector ) {\r\n\r\n\t\t\tif ( obj === undefined ) obj = new THREE.Object3D();\r\n\r\n\t\t\tobj.lookAt( vector );\r\n\r\n\t\t\tobj.updateMatrix();\r\n\r\n\t\t\tthis.applyMatrix( obj.matrix );\r\n\r\n\t\t};\r\n\r\n\t}(),\r\n\r\n\tcenter: function () {\r\n\r\n\t\tthis.computeBoundingBox();\r\n\r\n\t\tvar offset = this.boundingBox.center().negate();\r\n\r\n\t\tthis.translate( offset.x, offset.y, offset.z );\r\n\r\n\t\treturn offset;\r\n\r\n\t},\r\n\r\n\tsetFromObject: function ( object ) {\r\n\r\n\t\t// console.log( 'THREE.BufferGeometry.setFromObject(). Converting', object, this );\r\n\r\n\t\tvar geometry = object.geometry;\r\n\r\n\t\tif ( object instanceof THREE.Points || object instanceof THREE.Line ) {\r\n\r\n\t\t\tvar positions = new THREE.Float32Attribute( geometry.vertices.length * 3, 3 );\r\n\t\t\tvar colors = new THREE.Float32Attribute( geometry.colors.length * 3, 3 );\r\n\r\n\t\t\tthis.addAttribute( 'position', positions.copyVector3sArray( geometry.vertices ) );\r\n\t\t\tthis.addAttribute( 'color', colors.copyColorsArray( geometry.colors ) );\r\n\r\n\t\t\tif ( geometry.lineDistances && geometry.lineDistances.length === geometry.vertices.length ) {\r\n\r\n\t\t\t\tvar lineDistances = new THREE.Float32Attribute( geometry.lineDistances.length, 1 );\r\n\r\n\t\t\t\tthis.addAttribute( 'lineDistance', lineDistances.copyArray( geometry.lineDistances ) );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( geometry.boundingSphere !== null ) {\r\n\r\n\t\t\t\tthis.boundingSphere = geometry.boundingSphere.clone();\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( geometry.boundingBox !== null ) {\r\n\r\n\t\t\t\tthis.boundingBox = geometry.boundingBox.clone();\r\n\r\n\t\t\t}\r\n\r\n\t\t} else if ( object instanceof THREE.Mesh ) {\r\n\r\n\t\t\tif ( geometry instanceof THREE.Geometry ) {\r\n\r\n\t\t\t\tthis.fromGeometry( geometry );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tupdateFromObject: function ( object ) {\r\n\r\n\t\tvar geometry = object.geometry;\r\n\r\n\t\tif ( object instanceof THREE.Mesh ) {\r\n\r\n\t\t\tvar direct = geometry.__directGeometry;\r\n\r\n\t\t\tif ( direct === undefined ) {\r\n\r\n\t\t\t\treturn this.fromGeometry( geometry );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tdirect.verticesNeedUpdate = geometry.verticesNeedUpdate;\r\n\t\t\tdirect.normalsNeedUpdate = geometry.normalsNeedUpdate;\r\n\t\t\tdirect.colorsNeedUpdate = geometry.colorsNeedUpdate;\r\n\t\t\tdirect.uvsNeedUpdate = geometry.uvsNeedUpdate;\r\n\t\t\tdirect.groupsNeedUpdate = geometry.groupsNeedUpdate;\r\n\r\n\t\t\tgeometry.verticesNeedUpdate = false;\r\n\t\t\tgeometry.normalsNeedUpdate = false;\r\n\t\t\tgeometry.colorsNeedUpdate = false;\r\n\t\t\tgeometry.uvsNeedUpdate = false;\r\n\t\t\tgeometry.groupsNeedUpdate = false;\r\n\r\n\t\t\tgeometry = direct;\r\n\r\n\t\t}\r\n\r\n\t\tif ( geometry.verticesNeedUpdate === true ) {\r\n\r\n\t\t\tvar attribute = this.attributes.position;\r\n\r\n\t\t\tif ( attribute !== undefined ) {\r\n\r\n\t\t\t\tattribute.copyVector3sArray( geometry.vertices );\r\n\t\t\t\tattribute.needsUpdate = true;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tgeometry.verticesNeedUpdate = false;\r\n\r\n\t\t}\r\n\r\n\t\tif ( geometry.normalsNeedUpdate === true ) {\r\n\r\n\t\t\tvar attribute = this.attributes.normal;\r\n\r\n\t\t\tif ( attribute !== undefined ) {\r\n\r\n\t\t\t\tattribute.copyVector3sArray( geometry.normals );\r\n\t\t\t\tattribute.needsUpdate = true;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tgeometry.normalsNeedUpdate = false;\r\n\r\n\t\t}\r\n\r\n\t\tif ( geometry.colorsNeedUpdate === true ) {\r\n\r\n\t\t\tvar attribute = this.attributes.color;\r\n\r\n\t\t\tif ( attribute !== undefined ) {\r\n\r\n\t\t\t\tattribute.copyColorsArray( geometry.colors );\r\n\t\t\t\tattribute.needsUpdate = true;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tgeometry.colorsNeedUpdate = false;\r\n\r\n\t\t}\r\n\r\n\t\tif ( geometry.lineDistancesNeedUpdate ) {\r\n\r\n\t\t\tvar attribute = this.attributes.lineDistance;\r\n\r\n\t\t\tif ( attribute !== undefined ) {\r\n\r\n\t\t\t\tattribute.copyArray( geometry.lineDistances );\r\n\t\t\t\tattribute.needsUpdate = true;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tgeometry.lineDistancesNeedUpdate = false;\r\n\r\n\t\t}\r\n\r\n\t\tif ( geometry.groupsNeedUpdate ) {\r\n\r\n\t\t\tgeometry.computeGroups( object.geometry );\r\n\t\t\tthis.groups = geometry.groups;\r\n\r\n\t\t\tgeometry.groupsNeedUpdate = false;\r\n\r\n\t\t}\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tfromGeometry: function ( geometry ) {\r\n\r\n\t\tgeometry.__directGeometry = new THREE.DirectGeometry().fromGeometry( geometry );\r\n\r\n\t\treturn this.fromDirectGeometry( geometry.__directGeometry );\r\n\r\n\t},\r\n\r\n\tfromDirectGeometry: function ( geometry ) {\r\n\r\n\t\tvar positions = new Float32Array( geometry.vertices.length * 3 );\r\n\t\tthis.addAttribute( 'position', new THREE.BufferAttribute( positions, 3 ).copyVector3sArray( geometry.vertices ) );\r\n\r\n\t\tif ( geometry.normals.length > 0 ) {\r\n\r\n\t\t\tvar normals = new Float32Array( geometry.normals.length * 3 );\r\n\t\t\tthis.addAttribute( 'normal', new THREE.BufferAttribute( normals, 3 ).copyVector3sArray( geometry.normals ) );\r\n\r\n\t\t}\r\n\r\n\t\tif ( geometry.colors.length > 0 ) {\r\n\r\n\t\t\tvar colors = new Float32Array( geometry.colors.length * 3 );\r\n\t\t\tthis.addAttribute( 'color', new THREE.BufferAttribute( colors, 3 ).copyColorsArray( geometry.colors ) );\r\n\r\n\t\t}\r\n\r\n\t\tif ( geometry.uvs.length > 0 ) {\r\n\r\n\t\t\tvar uvs = new Float32Array( geometry.uvs.length * 2 );\r\n\t\t\tthis.addAttribute( 'uv', new THREE.BufferAttribute( uvs, 2 ).copyVector2sArray( geometry.uvs ) );\r\n\r\n\t\t}\r\n\r\n\t\tif ( geometry.uvs2.length > 0 ) {\r\n\r\n\t\t\tvar uvs2 = new Float32Array( geometry.uvs2.length * 2 );\r\n\t\t\tthis.addAttribute( 'uv2', new THREE.BufferAttribute( uvs2, 2 ).copyVector2sArray( geometry.uvs2 ) );\r\n\r\n\t\t}\r\n\r\n\t\tif ( geometry.indices.length > 0 ) {\r\n\r\n\t\t\tvar TypeArray = geometry.vertices.length > 65535 ? Uint32Array : Uint16Array;\r\n\t\t\tvar indices = new TypeArray( geometry.indices.length * 3 );\r\n\t\t\tthis.addIndex( new THREE.BufferAttribute( indices, 1 ).copyIndicesArray( geometry.indices ) );\r\n\r\n\t\t}\r\n\r\n\t\t// groups\r\n\r\n\t\tthis.groups = geometry.groups;\r\n\r\n\t\t// morphs\r\n\r\n\t\tfor ( var name in geometry.morphTargets ) {\r\n\r\n\t\t\tvar array = [];\r\n\t\t\tvar morphTargets = geometry.morphTargets[ name ];\r\n\r\n\t\t\tfor ( var i = 0, l = morphTargets.length; i < l; i ++ ) {\r\n\r\n\t\t\t\tvar morphTarget = morphTargets[ i ];\r\n\r\n\t\t\t\tvar attribute = new THREE.Float32Attribute( morphTarget.length * 3, 3 );\r\n\r\n\t\t\t\tarray.push( attribute.copyVector3sArray( morphTarget ) );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tthis.morphAttributes[ name ] = array;\r\n\r\n\t\t}\r\n\r\n\t\t// skinning\r\n\r\n\t\tif ( geometry.skinIndices.length > 0 ) {\r\n\r\n\t\t\tvar skinIndices = new THREE.Float32Attribute( geometry.skinIndices.length * 4, 4 );\r\n\t\t\tthis.addAttribute( 'skinIndex', skinIndices.copyVector4sArray( geometry.skinIndices ) );\r\n\r\n\t\t}\r\n\r\n\t\tif ( geometry.skinWeights.length > 0 ) {\r\n\r\n\t\t\tvar skinWeights = new THREE.Float32Attribute( geometry.skinWeights.length * 4, 4 );\r\n\t\t\tthis.addAttribute( 'skinWeight', skinWeights.copyVector4sArray( geometry.skinWeights ) );\r\n\r\n\t\t}\r\n\r\n\t\t//\r\n\r\n\t\tif ( geometry.boundingSphere !== null ) {\r\n\r\n\t\t\tthis.boundingSphere = geometry.boundingSphere.clone();\r\n\r\n\t\t}\r\n\r\n\t\tif ( geometry.boundingBox !== null ) {\r\n\r\n\t\t\tthis.boundingBox = geometry.boundingBox.clone();\r\n\r\n\t\t}\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tcomputeBoundingBox: function () {\r\n\r\n\t\tvar vector = new THREE.Vector3();\r\n\r\n\t\treturn function () {\r\n\r\n\t\t\tif ( this.boundingBox === null ) {\r\n\r\n\t\t\t\tthis.boundingBox = new THREE.Box3();\r\n\r\n\t\t\t}\r\n\r\n\t\t\tvar positions = this.attributes.position.array;\r\n\r\n\t\t\tif ( positions ) {\r\n\r\n\t\t\t\tvar bb = this.boundingBox;\r\n\t\t\t\tbb.makeEmpty();\r\n\r\n\t\t\t\tfor ( var i = 0, il = positions.length; i < il; i += 3 ) {\r\n\r\n\t\t\t\t\tvector.fromArray( positions, i );\r\n\t\t\t\t\tbb.expandByPoint( vector );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( positions === undefined || positions.length === 0 ) {\r\n\r\n\t\t\t\tthis.boundingBox.min.set( 0, 0, 0 );\r\n\t\t\t\tthis.boundingBox.max.set( 0, 0, 0 );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( isNaN( this.boundingBox.min.x ) || isNaN( this.boundingBox.min.y ) || isNaN( this.boundingBox.min.z ) ) {\r\n\r\n\t\t\t\tconsole.error( 'THREE.BufferGeometry.computeBoundingBox: Computed min/max have NaN values. The \"position\" attribute is likely to have NaN values.', this );\r\n\r\n\t\t\t}\r\n\r\n\t\t};\r\n\r\n\t}(),\r\n\r\n\tcomputeBoundingSphere: function () {\r\n\r\n\t\tvar box = new THREE.Box3();\r\n\t\tvar vector = new THREE.Vector3();\r\n\r\n\t\treturn function () {\r\n\r\n\t\t\tif ( this.boundingSphere === null ) {\r\n\r\n\t\t\t\tthis.boundingSphere = new THREE.Sphere();\r\n\r\n\t\t\t}\r\n\r\n\t\t\tvar positions = this.attributes.position.array;\r\n\r\n\t\t\tif ( positions ) {\r\n\r\n\t\t\t\tbox.makeEmpty();\r\n\r\n\t\t\t\tvar center = this.boundingSphere.center;\r\n\r\n\t\t\t\tfor ( var i = 0, il = positions.length; i < il; i += 3 ) {\r\n\r\n\t\t\t\t\tvector.fromArray( positions, i );\r\n\t\t\t\t\tbox.expandByPoint( vector );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tbox.center( center );\r\n\r\n\t\t\t\t// hoping to find a boundingSphere with a radius smaller than the\r\n\t\t\t\t// boundingSphere of the boundingBox: sqrt(3) smaller in the best case\r\n\r\n\t\t\t\tvar maxRadiusSq = 0;\r\n\r\n\t\t\t\tfor ( var i = 0, il = positions.length; i < il; i += 3 ) {\r\n\r\n\t\t\t\t\tvector.fromArray( positions, i );\r\n\t\t\t\t\tmaxRadiusSq = Math.max( maxRadiusSq, center.distanceToSquared( vector ) );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tthis.boundingSphere.radius = Math.sqrt( maxRadiusSq );\r\n\r\n\t\t\t\tif ( isNaN( this.boundingSphere.radius ) ) {\r\n\r\n\t\t\t\t\tconsole.error( 'THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The \"position\" attribute is likely to have NaN values.', this );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t};\r\n\r\n\t}(),\r\n\r\n\tcomputeFaceNormals: function () {\r\n\r\n\t\t// backwards compatibility\r\n\r\n\t},\r\n\r\n\tcomputeVertexNormals: function () {\r\n\r\n\t\tvar index = this.index;\r\n\t\tvar attributes = this.attributes;\r\n\t\tvar groups = this.groups;\r\n\r\n\t\tif ( attributes.position ) {\r\n\r\n\t\t\tvar positions = attributes.position.array;\r\n\r\n\t\t\tif ( attributes.normal === undefined ) {\r\n\r\n\t\t\t\tthis.addAttribute( 'normal', new THREE.BufferAttribute( new Float32Array( positions.length ), 3 ) );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\t// reset existing normals to zero\r\n\r\n\t\t\t\tvar normals = attributes.normal.array;\r\n\r\n\t\t\t\tfor ( var i = 0, il = normals.length; i < il; i ++ ) {\r\n\r\n\t\t\t\t\tnormals[ i ] = 0;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\tvar normals = attributes.normal.array;\r\n\r\n\t\t\tvar vA, vB, vC,\r\n\r\n\t\t\tpA = new THREE.Vector3(),\r\n\t\t\tpB = new THREE.Vector3(),\r\n\t\t\tpC = new THREE.Vector3(),\r\n\r\n\t\t\tcb = new THREE.Vector3(),\r\n\t\t\tab = new THREE.Vector3();\r\n\r\n\t\t\t// indexed elements\r\n\r\n\t\t\tif ( index ) {\r\n\r\n\t\t\t\tvar indices = index.array;\r\n\r\n\t\t\t\tif ( groups.length === 0 ) {\r\n\r\n\t\t\t\t\tthis.addGroup( 0, indices.length );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tfor ( var j = 0, jl = groups.length; j < jl; ++ j ) {\r\n\r\n\t\t\t\t\tvar group = groups[ j ];\r\n\r\n\t\t\t\t\tvar start = group.start;\r\n\t\t\t\t\tvar count = group.count;\r\n\r\n\t\t\t\t\tfor ( var i = start, il = start + count; i < il; i += 3 ) {\r\n\r\n\t\t\t\t\t\tvA = indices[ i + 0 ] * 3;\r\n\t\t\t\t\t\tvB = indices[ i + 1 ] * 3;\r\n\t\t\t\t\t\tvC = indices[ i + 2 ] * 3;\r\n\r\n\t\t\t\t\t\tpA.fromArray( positions, vA );\r\n\t\t\t\t\t\tpB.fromArray( positions, vB );\r\n\t\t\t\t\t\tpC.fromArray( positions, vC );\r\n\r\n\t\t\t\t\t\tcb.subVectors( pC, pB );\r\n\t\t\t\t\t\tab.subVectors( pA, pB );\r\n\t\t\t\t\t\tcb.cross( ab );\r\n\r\n\t\t\t\t\t\tnormals[ vA ] += cb.x;\r\n\t\t\t\t\t\tnormals[ vA + 1 ] += cb.y;\r\n\t\t\t\t\t\tnormals[ vA + 2 ] += cb.z;\r\n\r\n\t\t\t\t\t\tnormals[ vB ] += cb.x;\r\n\t\t\t\t\t\tnormals[ vB + 1 ] += cb.y;\r\n\t\t\t\t\t\tnormals[ vB + 2 ] += cb.z;\r\n\r\n\t\t\t\t\t\tnormals[ vC ] += cb.x;\r\n\t\t\t\t\t\tnormals[ vC + 1 ] += cb.y;\r\n\t\t\t\t\t\tnormals[ vC + 2 ] += cb.z;\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\t// non-indexed elements (unconnected triangle soup)\r\n\r\n\t\t\t\tfor ( var i = 0, il = positions.length; i < il; i += 9 ) {\r\n\r\n\t\t\t\t\tpA.fromArray( positions, i );\r\n\t\t\t\t\tpB.fromArray( positions, i + 3 );\r\n\t\t\t\t\tpC.fromArray( positions, i + 6 );\r\n\r\n\t\t\t\t\tcb.subVectors( pC, pB );\r\n\t\t\t\t\tab.subVectors( pA, pB );\r\n\t\t\t\t\tcb.cross( ab );\r\n\r\n\t\t\t\t\tnormals[ i ] = cb.x;\r\n\t\t\t\t\tnormals[ i + 1 ] = cb.y;\r\n\t\t\t\t\tnormals[ i + 2 ] = cb.z;\r\n\r\n\t\t\t\t\tnormals[ i + 3 ] = cb.x;\r\n\t\t\t\t\tnormals[ i + 4 ] = cb.y;\r\n\t\t\t\t\tnormals[ i + 5 ] = cb.z;\r\n\r\n\t\t\t\t\tnormals[ i + 6 ] = cb.x;\r\n\t\t\t\t\tnormals[ i + 7 ] = cb.y;\r\n\t\t\t\t\tnormals[ i + 8 ] = cb.z;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\tthis.normalizeNormals();\r\n\r\n\t\t\tattributes.normal.needsUpdate = true;\r\n\r\n\t\t}\r\n\r\n\t},\r\n\r\n\tcomputeTangents: function () {\r\n\r\n\t\tconsole.warn( 'THREE.BufferGeometry: .computeTangents() has been removed.' );\r\n\r\n\t},\r\n\r\n\tcomputeOffsets: function ( size ) {\r\n\r\n\t\tconsole.warn( 'THREE.BufferGeometry: .computeOffsets() has been removed.')\r\n\r\n\t},\r\n\r\n\tmerge: function ( geometry, offset ) {\r\n\r\n\t\tif ( geometry instanceof THREE.BufferGeometry === false ) {\r\n\r\n\t\t\tconsole.error( 'THREE.BufferGeometry.merge(): geometry not an instance of THREE.BufferGeometry.', geometry );\r\n\t\t\treturn;\r\n\r\n\t\t}\r\n\r\n\t\tif ( offset === undefined ) offset = 0;\r\n\r\n\t\tvar attributes = this.attributes;\r\n\r\n\t\tfor ( var key in attributes ) {\r\n\r\n\t\t\tif ( geometry.attributes[ key ] === undefined ) continue;\r\n\r\n\t\t\tvar attribute1 = attributes[ key ];\r\n\t\t\tvar attributeArray1 = attribute1.array;\r\n\r\n\t\t\tvar attribute2 = geometry.attributes[ key ];\r\n\t\t\tvar attributeArray2 = attribute2.array;\r\n\r\n\t\t\tvar attributeSize = attribute2.itemSize;\r\n\r\n\t\t\tfor ( var i = 0, j = attributeSize * offset; i < attributeArray2.length; i ++, j ++ ) {\r\n\r\n\t\t\t\tattributeArray1[ j ] = attributeArray2[ i ];\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tnormalizeNormals: function () {\r\n\r\n\t\tvar normals = this.attributes.normal.array;\r\n\r\n\t\tvar x, y, z, n;\r\n\r\n\t\tfor ( var i = 0, il = normals.length; i < il; i += 3 ) {\r\n\r\n\t\t\tx = normals[ i ];\r\n\t\t\ty = normals[ i + 1 ];\r\n\t\t\tz = normals[ i + 2 ];\r\n\r\n\t\t\tn = 1.0 / Math.sqrt( x * x + y * y + z * z );\r\n\r\n\t\t\tnormals[ i ] *= n;\r\n\t\t\tnormals[ i + 1 ] *= n;\r\n\t\t\tnormals[ i + 2 ] *= n;\r\n\r\n\t\t}\r\n\r\n\t},\r\n\r\n\ttoJSON: function () {\r\n\r\n\t\tvar data = {\r\n\t\t\tmetadata: {\r\n\t\t\t\tversion: 4.4,\r\n\t\t\t\ttype: 'BufferGeometry',\r\n\t\t\t\tgenerator: 'BufferGeometry.toJSON'\r\n\t\t\t}\r\n\t\t};\r\n\r\n\t\t// standard BufferGeometry serialization\r\n\r\n\t\tdata.uuid = this.uuid;\r\n\t\tdata.type = this.type;\r\n\t\tif ( this.name !== '' ) data.name = this.name;\r\n\r\n\t\tif ( this.parameters !== undefined ) {\r\n\r\n\t\t\tvar parameters = this.parameters;\r\n\r\n\t\t\tfor ( var key in parameters ) {\r\n\r\n\t\t\t\tif ( parameters[ key ] !== undefined ) data[ key ] = parameters[ key ];\r\n\r\n\t\t\t}\r\n\r\n\t\t\treturn data;\r\n\r\n\t\t}\r\n\r\n\t\tdata.data = { attributes: {} };\r\n\r\n\t\tvar index = this.index;\r\n\r\n\t\tif ( index !== null ) {\r\n\r\n\t\t\tvar array = Array.prototype.slice.call( index.array );\r\n\r\n\t\t\tdata.data.index = {\r\n\t\t\t\ttype: index.array.constructor.name,\r\n\t\t\t\tarray: array\r\n\t\t\t};\r\n\r\n\t\t}\r\n\r\n\t\tvar attributes = this.attributes;\r\n\r\n\t\tfor ( var key in attributes ) {\r\n\r\n\t\t\tvar attribute = attributes[ key ];\r\n\r\n\t\t\tvar array = Array.prototype.slice.call( attribute.array );\r\n\r\n\t\t\tdata.data.attributes[ key ] = {\r\n\t\t\t\titemSize: attribute.itemSize,\r\n\t\t\t\ttype: attribute.array.constructor.name,\r\n\t\t\t\tarray: array\r\n\t\t\t};\r\n\r\n\t\t}\r\n\r\n\t\tvar groups = this.groups;\r\n\r\n\t\tif ( groups.length > 0 ) {\r\n\r\n\t\t\tdata.data.groups = JSON.parse( JSON.stringify( groups ) );\r\n\r\n\t\t}\r\n\r\n\t\tvar boundingSphere = this.boundingSphere;\r\n\r\n\t\tif ( boundingSphere !== null ) {\r\n\r\n\t\t\tdata.data.boundingSphere = {\r\n\t\t\t\tcenter: boundingSphere.center.toArray(),\r\n\t\t\t\tradius: boundingSphere.radius\r\n\t\t\t};\r\n\r\n\t\t}\r\n\r\n\t\treturn data;\r\n\r\n\t},\r\n\r\n\tclone: function () {\r\n\r\n\t\treturn new this.constructor().copy( this );\r\n\r\n\t},\r\n\r\n\tcopy: function ( source ) {\r\n\r\n\t\tvar index = source.index;\r\n\r\n\t\tif ( index !== null ) {\r\n\r\n\t\t\tthis.addIndex( index.clone() );\r\n\r\n\t\t}\r\n\r\n\t\tvar attributes = source.attributes;\r\n\r\n\t\tfor ( var name in attributes ) {\r\n\r\n\t\t\tvar attribute = attributes[ name ];\r\n\t\t\tthis.addAttribute( name, attribute.clone() );\r\n\r\n\t\t}\r\n\r\n\t\tvar groups = source.groups;\r\n\r\n\t\tfor ( var i = 0, l = groups.length; i < l; i ++ ) {\r\n\r\n\t\t\tvar group = groups[ i ];\r\n\t\t\tthis.addGroup( group.start, group.count );\r\n\r\n\t\t}\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tdispose: function () {\r\n\r\n\t\tthis.dispatchEvent( { type: 'dispose' } );\r\n\r\n\t}\r\n\r\n};\r\n\r\nTHREE.EventDispatcher.prototype.apply( THREE.BufferGeometry.prototype );\r\n\r\nTHREE.BufferGeometry.MaxIndex = 65535;\r\n\r\n// File:src/core/InstancedBufferGeometry.js\r\n\r\n/**\r\n * @author benaadams / https://twitter.com/ben_a_adams\r\n */\r\n\r\nTHREE.InstancedBufferGeometry = function () {\r\n\r\n\tTHREE.BufferGeometry.call( this );\r\n\r\n\tthis.type = 'InstancedBufferGeometry';\r\n\tthis.maxInstancedCount = undefined;\r\n\r\n};\r\n\r\nTHREE.InstancedBufferGeometry.prototype = Object.create( THREE.BufferGeometry.prototype );\r\nTHREE.InstancedBufferGeometry.prototype.constructor = THREE.InstancedBufferGeometry;\r\n\r\nTHREE.InstancedBufferGeometry.prototype.addGroup = function ( start, count, instances ) {\r\n\r\n\tthis.groups.push( {\r\n\r\n\t\tstart: start,\r\n\t\tcount: count,\r\n\t\tinstances: instances\r\n\r\n\t} );\r\n\r\n};\r\n\r\nTHREE.InstancedBufferGeometry.prototype.copy = function ( source ) {\r\n\r\n\tvar index = source.index;\r\n\r\n\tif ( index !== null ) {\r\n\r\n\t\tthis.addIndex( index.clone() );\r\n\r\n\t}\r\n\r\n\tvar attributes = source.attributes;\r\n\r\n\tfor ( var name in attributes ) {\r\n\r\n\t\tvar attribute = attributes[ name ];\r\n\t\tthis.addAttribute( name, attribute.clone() );\r\n\r\n\t}\r\n\r\n\tvar groups = source.groups;\r\n\r\n\tfor ( var i = 0, l = groups.length; i < l; i ++ ) {\r\n\r\n\t\tvar group = groups[ i ];\r\n\t\tthis.addGroup( group.start, group.count, group.instances );\r\n\r\n\t}\r\n\r\n\treturn this;\r\n\r\n};\r\n\r\nTHREE.EventDispatcher.prototype.apply( THREE.InstancedBufferGeometry.prototype );\r\n\r\n// File:src/cameras/Camera.js\r\n\r\n/**\r\n * @author mrdoob / http://mrdoob.com/\r\n * @author mikael emtinger / http://gomo.se/\r\n * @author WestLangley / http://github.com/WestLangley\r\n*/\r\n\r\nTHREE.Camera = function () {\r\n\r\n\tTHREE.Object3D.call( this );\r\n\r\n\tthis.type = 'Camera';\r\n\r\n\tthis.matrixWorldInverse = new THREE.Matrix4();\r\n\tthis.projectionMatrix = new THREE.Matrix4();\r\n\r\n};\r\n\r\nTHREE.Camera.prototype = Object.create( THREE.Object3D.prototype );\r\nTHREE.Camera.prototype.constructor = THREE.Camera;\r\n\r\nTHREE.Camera.prototype.getWorldDirection = function () {\r\n\r\n\tvar quaternion = new THREE.Quaternion();\r\n\r\n\treturn function ( optionalTarget ) {\r\n\r\n\t\tvar result = optionalTarget || new THREE.Vector3();\r\n\r\n\t\tthis.getWorldQuaternion( quaternion );\r\n\r\n\t\treturn result.set( 0, 0, - 1 ).applyQuaternion( quaternion );\r\n\r\n\t};\r\n\r\n}();\r\n\r\nTHREE.Camera.prototype.lookAt = function () {\r\n\r\n\t// This routine does not support cameras with rotated and/or translated parent(s)\r\n\r\n\tvar m1 = new THREE.Matrix4();\r\n\r\n\treturn function ( vector ) {\r\n\r\n\t\tm1.lookAt( this.position, vector, this.up );\r\n\r\n\t\tthis.quaternion.setFromRotationMatrix( m1 );\r\n\r\n\t};\r\n\r\n}();\r\n\r\nTHREE.Camera.prototype.clone = function () {\r\n\r\n\treturn new this.constructor().copy( this );\r\n\r\n};\r\n\r\nTHREE.Camera.prototype.copy = function ( source ) {\r\n\r\n\tTHREE.Object3D.prototype.copy.call( this, source );\r\n\r\n\tthis.matrixWorldInverse.copy( source.matrixWorldInverse );\r\n\tthis.projectionMatrix.copy( source.projectionMatrix );\r\n\r\n\treturn this;\r\n\r\n};\r\n\r\n// File:src/cameras/CubeCamera.js\r\n\r\n/**\r\n * Camera for rendering cube maps\r\n *\t- renders scene into axis-aligned cube\r\n *\r\n * @author alteredq / http://alteredqualia.com/\r\n */\r\n\r\nTHREE.CubeCamera = function ( near, far, cubeResolution ) {\r\n\r\n\tTHREE.Object3D.call( this );\r\n\r\n\tthis.type = 'CubeCamera';\r\n\r\n\tvar fov = 90, aspect = 1;\r\n\r\n\tvar cameraPX = new THREE.PerspectiveCamera( fov, aspect, near, far );\r\n\tcameraPX.up.set( 0, - 1, 0 );\r\n\tcameraPX.lookAt( new THREE.Vector3( 1, 0, 0 ) );\r\n\tthis.add( cameraPX );\r\n\r\n\tvar cameraNX = new THREE.PerspectiveCamera( fov, aspect, near, far );\r\n\tcameraNX.up.set( 0, - 1, 0 );\r\n\tcameraNX.lookAt( new THREE.Vector3( - 1, 0, 0 ) );\r\n\tthis.add( cameraNX );\r\n\r\n\tvar cameraPY = new THREE.PerspectiveCamera( fov, aspect, near, far );\r\n\tcameraPY.up.set( 0, 0, 1 );\r\n\tcameraPY.lookAt( new THREE.Vector3( 0, 1, 0 ) );\r\n\tthis.add( cameraPY );\r\n\r\n\tvar cameraNY = new THREE.PerspectiveCamera( fov, aspect, near, far );\r\n\tcameraNY.up.set( 0, 0, - 1 );\r\n\tcameraNY.lookAt( new THREE.Vector3( 0, - 1, 0 ) );\r\n\tthis.add( cameraNY );\r\n\r\n\tvar cameraPZ = new THREE.PerspectiveCamera( fov, aspect, near, far );\r\n\tcameraPZ.up.set( 0, - 1, 0 );\r\n\tcameraPZ.lookAt( new THREE.Vector3( 0, 0, 1 ) );\r\n\tthis.add( cameraPZ );\r\n\r\n\tvar cameraNZ = new THREE.PerspectiveCamera( fov, aspect, near, far );\r\n\tcameraNZ.up.set( 0, - 1, 0 );\r\n\tcameraNZ.lookAt( new THREE.Vector3( 0, 0, - 1 ) );\r\n\tthis.add( cameraNZ );\r\n\r\n\tthis.renderTarget = new THREE.WebGLRenderTargetCube( cubeResolution, cubeResolution, { format: THREE.RGBFormat, magFilter: THREE.LinearFilter, minFilter: THREE.LinearFilter } );\r\n\r\n\tthis.updateCubeMap = function ( renderer, scene ) {\r\n\r\n\t\tif ( this.parent === null ) this.updateMatrixWorld();\r\n\r\n\t\tvar renderTarget = this.renderTarget;\r\n\t\tvar generateMipmaps = renderTarget.generateMipmaps;\r\n\r\n\t\trenderTarget.generateMipmaps = false;\r\n\r\n\t\trenderTarget.activeCubeFace = 0;\r\n\t\trenderer.render( scene, cameraPX, renderTarget );\r\n\r\n\t\trenderTarget.activeCubeFace = 1;\r\n\t\trenderer.render( scene, cameraNX, renderTarget );\r\n\r\n\t\trenderTarget.activeCubeFace = 2;\r\n\t\trenderer.render( scene, cameraPY, renderTarget );\r\n\r\n\t\trenderTarget.activeCubeFace = 3;\r\n\t\trenderer.render( scene, cameraNY, renderTarget );\r\n\r\n\t\trenderTarget.activeCubeFace = 4;\r\n\t\trenderer.render( scene, cameraPZ, renderTarget );\r\n\r\n\t\trenderTarget.generateMipmaps = generateMipmaps;\r\n\r\n\t\trenderTarget.activeCubeFace = 5;\r\n\t\trenderer.render( scene, cameraNZ, renderTarget );\r\n\r\n\t\trenderer.setRenderTarget( null );\r\n\r\n\t};\r\n\r\n};\r\n\r\nTHREE.CubeCamera.prototype = Object.create( THREE.Object3D.prototype );\r\nTHREE.CubeCamera.prototype.constructor = THREE.CubeCamera;\r\n\r\n// File:src/cameras/OrthographicCamera.js\r\n\r\n/**\r\n * @author alteredq / http://alteredqualia.com/\r\n */\r\n\r\nTHREE.OrthographicCamera = function ( left, right, top, bottom, near, far ) {\r\n\r\n\tTHREE.Camera.call( this );\r\n\r\n\tthis.type = 'OrthographicCamera';\r\n\r\n\tthis.zoom = 1;\r\n\r\n\tthis.left = left;\r\n\tthis.right = right;\r\n\tthis.top = top;\r\n\tthis.bottom = bottom;\r\n\r\n\tthis.near = ( near !== undefined ) ? near : 0.1;\r\n\tthis.far = ( far !== undefined ) ? far : 2000;\r\n\r\n\tthis.updateProjectionMatrix();\r\n\r\n};\r\n\r\nTHREE.OrthographicCamera.prototype = Object.create( THREE.Camera.prototype );\r\nTHREE.OrthographicCamera.prototype.constructor = THREE.OrthographicCamera;\r\n\r\nTHREE.OrthographicCamera.prototype.updateProjectionMatrix = function () {\r\n\r\n\tvar dx = ( this.right - this.left ) / ( 2 * this.zoom );\r\n\tvar dy = ( this.top - this.bottom ) / ( 2 * this.zoom );\r\n\tvar cx = ( this.right + this.left ) / 2;\r\n\tvar cy = ( this.top + this.bottom ) / 2;\r\n\r\n\tthis.projectionMatrix.makeOrthographic( cx - dx, cx + dx, cy + dy, cy - dy, this.near, this.far );\r\n\r\n};\r\n\r\nTHREE.OrthographicCamera.prototype.copy = function ( source ) {\r\n\t\r\n\tTHREE.Camera.prototype.copy.call( this, source );\r\n\t\r\n\tthis.left = source.left;\r\n\tthis.right = source.right;\r\n\tthis.top = source.top;\r\n\tthis.bottom = source.bottom;\r\n\tthis.near = source.near;\r\n\tthis.far = source.far;\r\n\t\r\n\tthis.zoom = source.zoom;\r\n\t\r\n\treturn this;\r\n\t\t\r\n};\r\n\r\nTHREE.OrthographicCamera.prototype.toJSON = function ( meta ) {\r\n\r\n\tvar data = THREE.Object3D.prototype.toJSON.call( this, meta );\r\n\r\n\tdata.object.zoom = this.zoom;\r\n\tdata.object.left = this.left;\r\n\tdata.object.right = this.right;\r\n\tdata.object.top = this.top;\r\n\tdata.object.bottom = this.bottom;\r\n\tdata.object.near = this.near;\r\n\tdata.object.far = this.far;\r\n\r\n\treturn data;\r\n\r\n};\r\n\r\n// File:src/cameras/PerspectiveCamera.js\r\n\r\n/**\r\n * @author mrdoob / http://mrdoob.com/\r\n * @author greggman / http://games.greggman.com/\r\n * @author zz85 / http://www.lab4games.net/zz85/blog\r\n */\r\n\r\nTHREE.PerspectiveCamera = function ( fov, aspect, near, far ) {\r\n\r\n\tTHREE.Camera.call( this );\r\n\r\n\tthis.type = 'PerspectiveCamera';\r\n\r\n\tthis.zoom = 1;\r\n\r\n\tthis.fov = fov !== undefined ? fov : 50;\r\n\tthis.aspect = aspect !== undefined ? aspect : 1;\r\n\tthis.near = near !== undefined ? near : 0.1;\r\n\tthis.far = far !== undefined ? far : 2000;\r\n\r\n\tthis.updateProjectionMatrix();\r\n\r\n};\r\n\r\nTHREE.PerspectiveCamera.prototype = Object.create( THREE.Camera.prototype );\r\nTHREE.PerspectiveCamera.prototype.constructor = THREE.PerspectiveCamera;\r\n\r\n\r\n/**\r\n * Uses Focal Length (in mm) to estimate and set FOV\r\n * 35mm (full-frame) camera is used if frame size is not specified;\r\n * Formula based on http://www.bobatkins.com/photography/technical/field_of_view.html\r\n */\r\n\r\nTHREE.PerspectiveCamera.prototype.setLens = function ( focalLength, frameHeight ) {\r\n\r\n\tif ( frameHeight === undefined ) frameHeight = 24;\r\n\r\n\tthis.fov = 2 * THREE.Math.radToDeg( Math.atan( frameHeight / ( focalLength * 2 ) ) );\r\n\tthis.updateProjectionMatrix();\r\n\r\n};\r\n\r\n\r\n/**\r\n * Sets an offset in a larger frustum. This is useful for multi-window or\r\n * multi-monitor/multi-machine setups.\r\n *\r\n * For example, if you have 3x2 monitors and each monitor is 1920x1080 and\r\n * the monitors are in grid like this\r\n *\r\n * +---+---+---+\r\n * | A | B | C |\r\n * +---+---+---+\r\n * | D | E | F |\r\n * +---+---+---+\r\n *\r\n * then for each monitor you would call it like this\r\n *\r\n * var w = 1920;\r\n * var h = 1080;\r\n * var fullWidth = w * 3;\r\n * var fullHeight = h * 2;\r\n *\r\n * --A--\r\n * camera.setOffset( fullWidth, fullHeight, w * 0, h * 0, w, h );\r\n * --B--\r\n * camera.setOffset( fullWidth, fullHeight, w * 1, h * 0, w, h );\r\n * --C--\r\n * camera.setOffset( fullWidth, fullHeight, w * 2, h * 0, w, h );\r\n * --D--\r\n * camera.setOffset( fullWidth, fullHeight, w * 0, h * 1, w, h );\r\n * --E--\r\n * camera.setOffset( fullWidth, fullHeight, w * 1, h * 1, w, h );\r\n * --F--\r\n * camera.setOffset( fullWidth, fullHeight, w * 2, h * 1, w, h );\r\n *\r\n * Note there is no reason monitors have to be the same size or in a grid.\r\n */\r\n\r\nTHREE.PerspectiveCamera.prototype.setViewOffset = function ( fullWidth, fullHeight, x, y, width, height ) {\r\n\r\n\tthis.fullWidth = fullWidth;\r\n\tthis.fullHeight = fullHeight;\r\n\tthis.x = x;\r\n\tthis.y = y;\r\n\tthis.width = width;\r\n\tthis.height = height;\r\n\r\n\tthis.updateProjectionMatrix();\r\n\r\n};\r\n\r\n\r\nTHREE.PerspectiveCamera.prototype.updateProjectionMatrix = function () {\r\n\r\n\tvar fov = THREE.Math.radToDeg( 2 * Math.atan( Math.tan( THREE.Math.degToRad( this.fov ) * 0.5 ) / this.zoom ) );\r\n\r\n\tif ( this.fullWidth ) {\r\n\r\n\t\tvar aspect = this.fullWidth / this.fullHeight;\r\n\t\tvar top = Math.tan( THREE.Math.degToRad( fov * 0.5 ) ) * this.near;\r\n\t\tvar bottom = - top;\r\n\t\tvar left = aspect * bottom;\r\n\t\tvar right = aspect * top;\r\n\t\tvar width = Math.abs( right - left );\r\n\t\tvar height = Math.abs( top - bottom );\r\n\r\n\t\tthis.projectionMatrix.makeFrustum(\r\n\t\t\tleft + this.x * width / this.fullWidth,\r\n\t\t\tleft + ( this.x + this.width ) * width / this.fullWidth,\r\n\t\t\ttop - ( this.y + this.height ) * height / this.fullHeight,\r\n\t\t\ttop - this.y * height / this.fullHeight,\r\n\t\t\tthis.near,\r\n\t\t\tthis.far\r\n\t\t);\r\n\r\n\t} else {\r\n\r\n\t\tthis.projectionMatrix.makePerspective( fov, this.aspect, this.near, this.far );\r\n\r\n\t}\r\n\r\n};\r\n\r\nTHREE.PerspectiveCamera.prototype.copy = function ( source ) {\r\n\t\r\n\tTHREE.Camera.prototype.copy.call( this, source );\r\n\t\r\n\tthis.fov = source.fov;\r\n\tthis.aspect = source.aspect;\r\n\tthis.near = source.near;\r\n\tthis.far = source.far;\r\n\t\r\n\tthis.zoom = source.zoom;\r\n\t\r\n\treturn this;\r\n\t\t\r\n};\r\n\r\nTHREE.PerspectiveCamera.prototype.toJSON = function ( meta ) {\r\n\r\n\tvar data = THREE.Object3D.prototype.toJSON.call( this, meta );\r\n\r\n\tdata.object.zoom = this.zoom;\r\n\tdata.object.fov = this.fov;\r\n\tdata.object.aspect = this.aspect;\r\n\tdata.object.near = this.near;\r\n\tdata.object.far = this.far;\r\n\r\n\treturn data;\r\n\r\n};\r\n\r\n// File:src/lights/Light.js\r\n\r\n/**\r\n * @author mrdoob / http://mrdoob.com/\r\n * @author alteredq / http://alteredqualia.com/\r\n */\r\n\r\nTHREE.Light = function ( color ) {\r\n\r\n\tTHREE.Object3D.call( this );\r\n\r\n\tthis.type = 'Light';\r\n\r\n\tthis.color = new THREE.Color( color );\r\n\r\n};\r\n\r\nTHREE.Light.prototype = Object.create( THREE.Object3D.prototype );\r\nTHREE.Light.prototype.constructor = THREE.Light;\r\n\r\nTHREE.Light.prototype.copy = function ( source ) {\r\n\t\r\n\tTHREE.Object3D.prototype.copy.call( this, source );\r\n\t\r\n\tthis.color.copy( source.color );\r\n\t\r\n\treturn this;\r\n\r\n};\r\n// File:src/lights/AmbientLight.js\r\n\r\n/**\r\n * @author mrdoob / http://mrdoob.com/\r\n */\r\n\r\nTHREE.AmbientLight = function ( color ) {\r\n\r\n\tTHREE.Light.call( this, color );\r\n\r\n\tthis.type = 'AmbientLight';\r\n\r\n};\r\n\r\nTHREE.AmbientLight.prototype = Object.create( THREE.Light.prototype );\r\nTHREE.AmbientLight.prototype.constructor = THREE.AmbientLight;\r\n\r\nTHREE.AmbientLight.prototype.toJSON = function ( meta ) {\r\n\r\n\tvar data = THREE.Object3D.prototype.toJSON.call( this, meta );\r\n\r\n\tdata.object.color = this.color.getHex();\r\n\r\n\treturn data;\r\n\r\n};\r\n\r\n// File:src/lights/DirectionalLight.js\r\n\r\n/**\r\n * @author mrdoob / http://mrdoob.com/\r\n * @author alteredq / http://alteredqualia.com/\r\n */\r\n\r\nTHREE.DirectionalLight = function ( color, intensity ) {\r\n\r\n\tTHREE.Light.call( this, color );\r\n\r\n\tthis.type = 'DirectionalLight';\r\n\r\n\tthis.position.set( 0, 1, 0 );\r\n\tthis.updateMatrix();\r\n\r\n\tthis.target = new THREE.Object3D();\r\n\r\n\tthis.intensity = ( intensity !== undefined ) ? intensity : 1;\r\n\r\n\tthis.castShadow = false;\r\n\tthis.onlyShadow = false;\r\n\r\n\tthis.shadowCameraNear = 50;\r\n\tthis.shadowCameraFar = 5000;\r\n\r\n\tthis.shadowCameraLeft = - 500;\r\n\tthis.shadowCameraRight = 500;\r\n\tthis.shadowCameraTop = 500;\r\n\tthis.shadowCameraBottom = - 500;\r\n\r\n\tthis.shadowCameraVisible = false;\r\n\r\n\tthis.shadowBias = 0;\r\n\tthis.shadowDarkness = 0.5;\r\n\r\n\tthis.shadowMapWidth = 512;\r\n\tthis.shadowMapHeight = 512;\r\n\r\n\tthis.shadowMap = null;\r\n\tthis.shadowMapSize = null;\r\n\tthis.shadowCamera = null;\r\n\tthis.shadowMatrix = null;\r\n\r\n};\r\n\r\nTHREE.DirectionalLight.prototype = Object.create( THREE.Light.prototype );\r\nTHREE.DirectionalLight.prototype.constructor = THREE.DirectionalLight;\r\n\r\nTHREE.DirectionalLight.prototype.copy = function ( source ) {\r\n\r\n\tTHREE.Light.prototype.copy.call( this, source );\r\n\r\n\tthis.intensity = source.intensity;\r\n\tthis.target = source.target.clone();\r\n\r\n\tthis.castShadow = source.castShadow;\r\n\tthis.onlyShadow = source.onlyShadow;\r\n\r\n\tthis.shadowCameraNear = source.shadowCameraNear;\r\n\tthis.shadowCameraFar = source.shadowCameraFar;\r\n\r\n\tthis.shadowCameraLeft = source.shadowCameraLeft;\r\n\tthis.shadowCameraRight = source.shadowCameraRight;\r\n\tthis.shadowCameraTop = source.shadowCameraTop;\r\n\tthis.shadowCameraBottom = source.shadowCameraBottom;\r\n\r\n\tthis.shadowCameraVisible = source.shadowCameraVisible;\r\n\r\n\tthis.shadowBias = source.shadowBias;\r\n\tthis.shadowDarkness = source.shadowDarkness;\r\n\r\n\tthis.shadowMapWidth = source.shadowMapWidth;\r\n\tthis.shadowMapHeight = source.shadowMapHeight;\r\n\r\n\treturn this;\r\n\r\n};\r\n\r\nTHREE.DirectionalLight.prototype.toJSON = function ( meta ) {\r\n\r\n\tvar data = THREE.Object3D.prototype.toJSON.call( this, meta );\r\n\r\n\tdata.object.color = this.color.getHex();\r\n\tdata.object.intensity = this.intensity;\r\n\r\n\treturn data;\r\n\r\n};\r\n\r\n// File:src/lights/HemisphereLight.js\r\n\r\n/**\r\n * @author alteredq / http://alteredqualia.com/\r\n */\r\n\r\nTHREE.HemisphereLight = function ( skyColor, groundColor, intensity ) {\r\n\r\n\tTHREE.Light.call( this, skyColor );\r\n\r\n\tthis.type = 'HemisphereLight';\r\n\r\n\tthis.position.set( 0, 100, 0 );\r\n\tthis.updateMatrix();\r\n\r\n\tthis.groundColor = new THREE.Color( groundColor );\r\n\tthis.intensity = ( intensity !== undefined ) ? intensity : 1;\r\n\r\n};\r\n\r\nTHREE.HemisphereLight.prototype = Object.create( THREE.Light.prototype );\r\nTHREE.HemisphereLight.prototype.constructor = THREE.HemisphereLight;\r\n\r\nTHREE.HemisphereLight.prototype.copy = function ( source ) {\r\n\r\n\tTHREE.Light.prototype.copy.call( this, source );\r\n\r\n\tthis.groundColor.copy( source.groundColor );\r\n\tthis.intensity = source.intensity;\r\n\r\n\treturn this;\r\n\r\n};\r\n\r\nTHREE.HemisphereLight.prototype.toJSON = function ( meta ) {\r\n\r\n\tvar data = THREE.Object3D.prototype.toJSON.call( this, meta );\r\n\r\n\tdata.object.color = this.color.getHex();\r\n\tdata.object.groundColor = this.groundColor.getHex();\r\n\tdata.object.intensity = this.intensity;\r\n\r\n\treturn data;\r\n\r\n};\r\n\r\n// File:src/lights/PointLight.js\r\n\r\n/**\r\n * @author mrdoob / http://mrdoob.com/\r\n */\r\n\r\nTHREE.PointLight = function ( color, intensity, distance, decay ) {\r\n\r\n\tTHREE.Light.call( this, color );\r\n\r\n\tthis.type = 'PointLight';\r\n\r\n\tthis.intensity = ( intensity !== undefined ) ? intensity : 1;\r\n\tthis.distance = ( distance !== undefined ) ? distance : 0;\r\n\tthis.decay = ( decay !== undefined ) ? decay : 1;\t// for physically correct lights, should be 2.\r\n\r\n};\r\n\r\nTHREE.PointLight.prototype = Object.create( THREE.Light.prototype );\r\nTHREE.PointLight.prototype.constructor = THREE.PointLight;\r\n\r\nTHREE.PointLight.prototype.copy = function ( source ) {\r\n\r\n\tTHREE.Light.prototype.copy.call( this, source );\r\n\r\n\tthis.intensity = source.intensity;\r\n\tthis.distance = source.distance;\r\n\tthis.decay = source.decay;\r\n\r\n\treturn this;\r\n\r\n};\r\n\r\nTHREE.PointLight.prototype.toJSON = function ( meta ) {\r\n\r\n\tvar data = THREE.Object3D.prototype.toJSON.call( this, meta );\r\n\r\n\tdata.object.color = this.color.getHex();\r\n\tdata.object.intensity = this.intensity;\r\n\tdata.object.distance = this.distance;\r\n\tdata.object.decay = this.decay;\r\n\r\n\treturn data;\r\n\r\n};\r\n\r\n// File:src/lights/SpotLight.js\r\n\r\n/**\r\n * @author alteredq / http://alteredqualia.com/\r\n */\r\n\r\nTHREE.SpotLight = function ( color, intensity, distance, angle, exponent, decay ) {\r\n\r\n\tTHREE.Light.call( this, color );\r\n\r\n\tthis.type = 'SpotLight';\r\n\r\n\tthis.position.set( 0, 1, 0 );\r\n\tthis.updateMatrix();\r\n\r\n\tthis.target = new THREE.Object3D();\r\n\r\n\tthis.intensity = ( intensity !== undefined ) ? intensity : 1;\r\n\tthis.distance = ( distance !== undefined ) ? distance : 0;\r\n\tthis.angle = ( angle !== undefined ) ? angle : Math.PI / 3;\r\n\tthis.exponent = ( exponent !== undefined ) ? exponent : 10;\r\n\tthis.decay = ( decay !== undefined ) ? decay : 1;\t// for physically correct lights, should be 2.\r\n\r\n\tthis.castShadow = false;\r\n\tthis.onlyShadow = false;\r\n\r\n\tthis.shadowCameraNear = 50;\r\n\tthis.shadowCameraFar = 5000;\r\n\tthis.shadowCameraFov = 50;\r\n\r\n\tthis.shadowCameraVisible = false;\r\n\r\n\tthis.shadowBias = 0;\r\n\tthis.shadowDarkness = 0.5;\r\n\r\n\tthis.shadowMapWidth = 512;\r\n\tthis.shadowMapHeight = 512;\r\n\r\n\tthis.shadowMap = null;\r\n\tthis.shadowMapSize = null;\r\n\tthis.shadowCamera = null;\r\n\tthis.shadowMatrix = null;\r\n\r\n};\r\n\r\nTHREE.SpotLight.prototype = Object.create( THREE.Light.prototype );\r\nTHREE.SpotLight.prototype.constructor = THREE.SpotLight;\r\n\r\nTHREE.SpotLight.prototype.copy = function ( source ) {\r\n\r\n\tTHREE.Light.prototype.copy.call( this, source );\r\n\r\n\tthis.intensity = source.intensity;\r\n\tthis.distance = source.distance;\r\n\tthis.angle = source.angle;\r\n\tthis.exponent = source.exponent;\r\n\tthis.decay = source.decay;\r\n\r\n\tthis.target = source.target.clone();\r\n\r\n\tthis.castShadow = source.castShadow;\r\n\tthis.onlyShadow = source.onlyShadow;\r\n\r\n\tthis.shadowCameraNear = source.shadowCameraNear;\r\n\tthis.shadowCameraFar = source.shadowCameraFar;\r\n\tthis.shadowCameraFov = source.shadowCameraFov;\r\n\r\n\tthis.shadowCameraVisible = source.shadowCameraVisible;\r\n\r\n\tthis.shadowBias = source.shadowBias;\r\n\tthis.shadowDarkness = source.shadowDarkness;\r\n\r\n\tthis.shadowMapWidth = source.shadowMapWidth;\r\n\tthis.shadowMapHeight = source.shadowMapHeight;\r\n\r\n\treturn this;\r\n}\r\n\r\nTHREE.SpotLight.prototype.toJSON = function ( meta ) {\r\n\r\n\tvar data = THREE.Object3D.prototype.toJSON.call( this, meta );\r\n\r\n\tdata.object.color = this.color.getHex();\r\n\tdata.object.intensity = this.intensity;\r\n\tdata.object.distance = this.distance;\r\n\tdata.object.angle = this.angle;\r\n\tdata.object.exponent = this.exponent;\r\n\tdata.object.decay = this.decay;\r\n\r\n\treturn data;\r\n\r\n};\r\n\r\n// File:src/loaders/Cache.js\r\n\r\n/**\r\n * @author mrdoob / http://mrdoob.com/\r\n */\r\n\r\nTHREE.Cache = {\r\n\r\n\tenabled: false,\r\n\r\n\tfiles: {},\r\n\r\n\tadd: function ( key, file ) {\r\n\r\n\t\tif ( this.enabled === false ) return;\r\n\r\n\t\t// console.log( 'THREE.Cache', 'Adding key:', key );\r\n\r\n\t\tthis.files[ key ] = file;\r\n\r\n\t},\r\n\r\n\tget: function ( key ) {\r\n\r\n\t\tif ( this.enabled === false ) return;\r\n\r\n\t\t// console.log( 'THREE.Cache', 'Checking key:', key );\r\n\r\n\t\treturn this.files[ key ];\r\n\r\n\t},\r\n\r\n\tremove: function ( key ) {\r\n\r\n\t\tdelete this.files[ key ];\r\n\r\n\t},\r\n\r\n\tclear: function () {\r\n\r\n\t\tthis.files = {};\r\n\r\n\t}\r\n\r\n};\r\n\r\n// File:src/loaders/Loader.js\r\n\r\n/**\r\n * @author alteredq / http://alteredqualia.com/\r\n */\r\n\r\nTHREE.Loader = function () {\r\n\r\n\tthis.onLoadStart = function () {};\r\n\tthis.onLoadProgress = function () {};\r\n\tthis.onLoadComplete = function () {};\r\n\r\n};\r\n\r\nTHREE.Loader.prototype = {\r\n\r\n\tconstructor: THREE.Loader,\r\n\r\n\tcrossOrigin: undefined,\r\n\r\n\textractUrlBase: function ( url ) {\r\n\r\n\t\tvar parts = url.split( '/' );\r\n\r\n\t\tif ( parts.length === 1 ) return './';\r\n\r\n\t\tparts.pop();\r\n\r\n\t\treturn parts.join( '/' ) + '/';\r\n\r\n\t},\r\n\r\n\tinitMaterials: function ( materials, texturePath, crossOrigin ) {\r\n\r\n\t\tvar array = [];\r\n\r\n\t\tfor ( var i = 0; i < materials.length; ++ i ) {\r\n\r\n\t\t\tarray[ i ] = this.createMaterial( materials[ i ], texturePath, crossOrigin );\r\n\r\n\t\t}\r\n\r\n\t\treturn array;\r\n\r\n\t},\r\n\r\n\tcreateMaterial: ( function () {\r\n\r\n\t\tvar imageLoader;\r\n\r\n\t\treturn function createMaterial( m, texturePath, crossOrigin ) {\r\n\r\n\t\t\tvar scope = this;\r\n\r\n\t\t\tif ( crossOrigin === undefined && scope.crossOrigin !== undefined ) crossOrigin = scope.crossOrigin;\r\n\r\n\t\t\tif ( imageLoader === undefined ) imageLoader = new THREE.ImageLoader();\r\n\r\n\t\t\tfunction nearest_pow2( n ) {\r\n\r\n\t\t\t\tvar l = Math.log( n ) / Math.LN2;\r\n\t\t\t\treturn Math.pow( 2, Math.round( l ) );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tfunction create_texture( where, name, sourceFile, repeat, offset, wrap, anisotropy ) {\r\n\r\n\t\t\t\tvar fullPath = texturePath + sourceFile;\r\n\r\n\t\t\t\tvar texture;\r\n\r\n\t\t\t\tvar loader = THREE.Loader.Handlers.get( fullPath );\r\n\r\n\t\t\t\tif ( loader !== null ) {\r\n\r\n\t\t\t\t\ttexture = loader.load( fullPath );\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\ttexture = new THREE.Texture();\r\n\r\n\t\t\t\t\tloader = imageLoader;\r\n\t\t\t\t\tloader.setCrossOrigin( crossOrigin );\r\n\t\t\t\t\tloader.load( fullPath, function ( image ) {\r\n\r\n\t\t\t\t\t\tif ( THREE.Math.isPowerOfTwo( image.width ) === false ||\r\n\t\t\t\t\t\t\tTHREE.Math.isPowerOfTwo( image.height ) === false ) {\r\n\r\n\t\t\t\t\t\t\tvar width = nearest_pow2( image.width );\r\n\t\t\t\t\t\t\tvar height = nearest_pow2( image.height );\r\n\r\n\t\t\t\t\t\t\tvar canvas = document.createElement( 'canvas' );\r\n\t\t\t\t\t\t\tcanvas.width = width;\r\n\t\t\t\t\t\t\tcanvas.height = height;\r\n\r\n\t\t\t\t\t\t\tvar context = canvas.getContext( '2d' );\r\n\t\t\t\t\t\t\tcontext.drawImage( image, 0, 0, width, height );\r\n\r\n\t\t\t\t\t\t\ttexture.image = canvas;\r\n\r\n\t\t\t\t\t\t} else {\r\n\r\n\t\t\t\t\t\t\ttexture.image = image;\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\ttexture.needsUpdate = true;\r\n\r\n\t\t\t\t\t} );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\ttexture.sourceFile = sourceFile;\r\n\r\n\t\t\t\tif ( repeat ) {\r\n\r\n\t\t\t\t\ttexture.repeat.set( repeat[ 0 ], repeat[ 1 ] );\r\n\r\n\t\t\t\t\tif ( repeat[ 0 ] !== 1 ) texture.wrapS = THREE.RepeatWrapping;\r\n\t\t\t\t\tif ( repeat[ 1 ] !== 1 ) texture.wrapT = THREE.RepeatWrapping;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif ( offset ) {\r\n\r\n\t\t\t\t\ttexture.offset.set( offset[ 0 ], offset[ 1 ] );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif ( wrap ) {\r\n\r\n\t\t\t\t\tvar wrapMap = {\r\n\t\t\t\t\t\t'repeat': THREE.RepeatWrapping,\r\n\t\t\t\t\t\t'mirror': THREE.MirroredRepeatWrapping\r\n\t\t\t\t\t};\r\n\r\n\t\t\t\t\tif ( wrapMap[ wrap[ 0 ] ] !== undefined ) texture.wrapS = wrapMap[ wrap[ 0 ] ];\r\n\t\t\t\t\tif ( wrapMap[ wrap[ 1 ] ] !== undefined ) texture.wrapT = wrapMap[ wrap[ 1 ] ];\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif ( anisotropy ) {\r\n\r\n\t\t\t\t\ttexture.anisotropy = anisotropy;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\twhere[ name ] = texture;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tfunction rgb2hex( rgb ) {\r\n\r\n\t\t\t\treturn ( rgb[ 0 ] * 255 << 16 ) + ( rgb[ 1 ] * 255 << 8 ) + rgb[ 2 ] * 255;\r\n\r\n\t\t\t}\r\n\r\n\t\t\t// defaults\r\n\r\n\t\t\tvar mtype = 'MeshLambertMaterial';\r\n\t\t\tvar mpars = {};\r\n\r\n\t\t\t// parameters from model file\r\n\r\n\t\t\tif ( m.shading ) {\r\n\r\n\t\t\t\tvar shading = m.shading.toLowerCase();\r\n\r\n\t\t\t\tif ( shading === 'phong' ) mtype = 'MeshPhongMaterial';\r\n\t\t\t\telse if ( shading === 'basic' ) mtype = 'MeshBasicMaterial';\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( m.blending !== undefined && THREE[ m.blending ] !== undefined ) {\r\n\r\n\t\t\t\tmpars.blending = THREE[ m.blending ];\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( m.transparent !== undefined ) {\r\n\r\n\t\t\t\tmpars.transparent = m.transparent;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( m.opacity !== undefined && m.opacity < 1.0 ) {\r\n\r\n\t\t\t\tmpars.transparent = true;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( m.depthTest !== undefined ) {\r\n\r\n\t\t\t\tmpars.depthTest = m.depthTest;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( m.depthWrite !== undefined ) {\r\n\r\n\t\t\t\tmpars.depthWrite = m.depthWrite;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( m.visible !== undefined ) {\r\n\r\n\t\t\t\tmpars.visible = m.visible;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( m.flipSided !== undefined ) {\r\n\r\n\t\t\t\tmpars.side = THREE.BackSide;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( m.doubleSided !== undefined ) {\r\n\r\n\t\t\t\tmpars.side = THREE.DoubleSide;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( m.wireframe !== undefined ) {\r\n\r\n\t\t\t\tmpars.wireframe = m.wireframe;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( m.vertexColors !== undefined ) {\r\n\r\n\t\t\t\tif ( m.vertexColors === 'face' ) {\r\n\r\n\t\t\t\t\tmpars.vertexColors = THREE.FaceColors;\r\n\r\n\t\t\t\t} else if ( m.vertexColors ) {\r\n\r\n\t\t\t\t\tmpars.vertexColors = THREE.VertexColors;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\t// colors\r\n\r\n\t\t\tif ( m.colorDiffuse ) {\r\n\r\n\t\t\t\tmpars.color = rgb2hex( m.colorDiffuse );\r\n\r\n\t\t\t} else if ( m.DbgColor ) {\r\n\r\n\t\t\t\tmpars.color = m.DbgColor;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( m.colorEmissive ) {\r\n\r\n\t\t\t\tmpars.emissive = rgb2hex( m.colorEmissive );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( mtype === 'MeshPhongMaterial' ) {\r\n\r\n\t\t\t\tif ( m.colorSpecular ) {\r\n\r\n\t\t\t\t\tmpars.specular = rgb2hex( m.colorSpecular );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif ( m.specularCoef ) {\r\n\r\n\t\t\t\t\tmpars.shininess = m.specularCoef;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\t// modifiers\r\n\r\n\t\t\tif ( m.transparency !== undefined ) {\r\n\r\n\t\t\t\tconsole.warn( 'THREE.Loader: transparency has been renamed to opacity' );\r\n\t\t\t\tm.opacity = m.transparency;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( m.opacity !== undefined ) {\r\n\r\n\t\t\t\tmpars.opacity = m.opacity;\r\n\r\n\t\t\t}\r\n\r\n\t\t\t// textures\r\n\r\n\t\t\tif ( texturePath ) {\r\n\r\n\t\t\t\tif ( m.mapDiffuse ) {\r\n\r\n\t\t\t\t\tcreate_texture( mpars, 'map', m.mapDiffuse, m.mapDiffuseRepeat, m.mapDiffuseOffset, m.mapDiffuseWrap, m.mapDiffuseAnisotropy );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif ( m.mapLight ) {\r\n\r\n\t\t\t\t\tcreate_texture( mpars, 'lightMap', m.mapLight, m.mapLightRepeat, m.mapLightOffset, m.mapLightWrap, m.mapLightAnisotropy );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif ( m.mapAO ) {\r\n\r\n\t\t\t\t\tcreate_texture( mpars, 'aoMap', m.mapAO, m.mapAORepeat, m.mapAOOffset, m.mapAOWrap, m.mapAOAnisotropy );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif ( m.mapBump ) {\r\n\r\n\t\t\t\t\tcreate_texture( mpars, 'bumpMap', m.mapBump, m.mapBumpRepeat, m.mapBumpOffset, m.mapBumpWrap, m.mapBumpAnisotropy );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif ( m.mapNormal ) {\r\n\r\n\t\t\t\t\tcreate_texture( mpars, 'normalMap', m.mapNormal, m.mapNormalRepeat, m.mapNormalOffset, m.mapNormalWrap, m.mapNormalAnisotropy );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif ( m.mapSpecular ) {\r\n\r\n\t\t\t\t\tcreate_texture( mpars, 'specularMap', m.mapSpecular, m.mapSpecularRepeat, m.mapSpecularOffset, m.mapSpecularWrap, m.mapSpecularAnisotropy );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif ( m.mapAlpha ) {\r\n\r\n\t\t\t\t\tcreate_texture( mpars, 'alphaMap', m.mapAlpha, m.mapAlphaRepeat, m.mapAlphaOffset, m.mapAlphaWrap, m.mapAlphaAnisotropy );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\t//\r\n\r\n\t\t\tif ( m.mapBumpScale ) {\r\n\r\n\t\t\t\tmpars.bumpScale = m.mapBumpScale;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( m.mapNormalFactor ) {\r\n\r\n\t\t\t\tmpars.normalScale = new THREE.Vector2( m.mapNormalFactor, m.mapNormalFactor );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tvar material = new THREE[ mtype ]( mpars );\r\n\r\n\t\t\tif ( m.DbgName !== undefined ) material.name = m.DbgName;\r\n\r\n\t\t\treturn material;\r\n\r\n\t\t};\r\n\r\n\t} )()\r\n\r\n};\r\n\r\nTHREE.Loader.Handlers = {\r\n\r\n\thandlers: [],\r\n\r\n\tadd: function ( regex, loader ) {\r\n\r\n\t\tthis.handlers.push( regex, loader );\r\n\r\n\t},\r\n\r\n\tget: function ( file ) {\r\n\r\n\t\tfor ( var i = 0, l = this.handlers.length; i < l; i += 2 ) {\r\n\r\n\t\t\tvar regex = this.handlers[ i ];\r\n\t\t\tvar loader = this.handlers[ i + 1 ];\r\n\r\n\t\t\tif ( regex.test( file ) ) {\r\n\r\n\t\t\t\treturn loader;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn null;\r\n\r\n\t}\r\n\r\n};\r\n\r\n// File:src/loaders/XHRLoader.js\r\n\r\n/**\r\n * @author mrdoob / http://mrdoob.com/\r\n */\r\n\r\nTHREE.XHRLoader = function ( manager ) {\r\n\r\n\tthis.manager = ( manager !== undefined ) ? manager : THREE.DefaultLoadingManager;\r\n\r\n};\r\n\r\nTHREE.XHRLoader.prototype = {\r\n\r\n\tconstructor: THREE.XHRLoader,\r\n\r\n\tload: function ( url, onLoad, onProgress, onError ) {\r\n\r\n\t\tvar scope = this;\r\n\r\n\t\tvar cached = THREE.Cache.get( url );\r\n\r\n\t\tif ( cached !== undefined ) {\r\n\r\n\t\t\tif ( onLoad ) {\r\n\r\n\t\t\t\tsetTimeout( function () {\r\n\r\n\t\t\t\t\tonLoad( cached );\r\n\r\n\t\t\t\t}, 0 );\r\n\r\n\t\t\t}\r\n\r\n\t\t\treturn cached;\r\n\r\n\t\t}\r\n\r\n\t\tvar request = new XMLHttpRequest();\r\n\t\trequest.open( 'GET', url, true );\r\n\r\n\t\trequest.addEventListener( 'load', function ( event ) {\r\n\r\n\t\t\tTHREE.Cache.add( url, this.response );\r\n\r\n\t\t\tif ( onLoad ) onLoad( this.response );\r\n\r\n\t\t\tscope.manager.itemEnd( url );\r\n\r\n\t\t}, false );\r\n\r\n\t\tif ( onProgress !== undefined ) {\r\n\r\n\t\t\trequest.addEventListener( 'progress', function ( event ) {\r\n\r\n\t\t\t\tonProgress( event );\r\n\r\n\t\t\t}, false );\r\n\r\n\t\t}\r\n\r\n\t\trequest.addEventListener( 'error', function ( event ) {\r\n\r\n\t\t\tif ( onError ) onError( event );\r\n\r\n\t\t\tscope.manager.itemError( url );\r\n\r\n\t\t}, false );\r\n\r\n\t\tif ( this.crossOrigin !== undefined ) request.crossOrigin = this.crossOrigin;\r\n\t\tif ( this.responseType !== undefined ) request.responseType = this.responseType;\r\n\t\tif ( this.withCredentials !== undefined ) request.withCredentials = this.withCredentials;\r\n\r\n\t\trequest.send( null );\r\n\r\n\t\tscope.manager.itemStart( url );\r\n\r\n\t\treturn request;\r\n\r\n\t},\r\n\r\n\tsetResponseType: function ( value ) {\r\n\r\n\t\tthis.responseType = value;\r\n\r\n\t},\r\n\r\n\tsetCrossOrigin: function ( value ) {\r\n\r\n\t\tthis.crossOrigin = value;\r\n\r\n\t},\r\n\r\n\tsetWithCredentials: function ( value ) {\r\n\r\n\t\tthis.withCredentials = value;\r\n\r\n\t}\r\n\r\n};\r\n\r\n// File:src/loaders/ImageLoader.js\r\n\r\n/**\r\n * @author mrdoob / http://mrdoob.com/\r\n */\r\n\r\nTHREE.ImageLoader = function ( manager ) {\r\n\r\n\tthis.manager = ( manager !== undefined ) ? manager : THREE.DefaultLoadingManager;\r\n\r\n};\r\n\r\nTHREE.ImageLoader.prototype = {\r\n\r\n\tconstructor: THREE.ImageLoader,\r\n\r\n\tload: function ( url, onLoad, onProgress, onError ) {\r\n\r\n\t\tvar scope = this;\r\n\r\n\t\tvar cached = THREE.Cache.get( url );\r\n\r\n\t\tif ( cached !== undefined ) {\r\n\r\n\t\t\tif ( onLoad ) {\r\n\r\n\t\t\t\tsetTimeout( function () {\r\n\r\n\t\t\t\t\tonLoad( cached );\r\n\r\n\t\t\t\t}, 0 );\r\n\r\n\t\t\t}\r\n\r\n\t\t\treturn cached;\r\n\r\n\t\t}\r\n\r\n\t\tvar image = document.createElement( 'img' );\r\n\r\n\t\timage.addEventListener( 'load', function ( event ) {\r\n\r\n\t\t\tTHREE.Cache.add( url, this );\r\n\r\n\t\t\tif ( onLoad ) onLoad( this );\r\n\r\n\t\t\tscope.manager.itemEnd( url );\r\n\r\n\t\t}, false );\r\n\r\n\t\tif ( onProgress !== undefined ) {\r\n\r\n\t\t\timage.addEventListener( 'progress', function ( event ) {\r\n\r\n\t\t\t\tonProgress( event );\r\n\r\n\t\t\t}, false );\r\n\r\n\t\t}\r\n\r\n\t\timage.addEventListener( 'error', function ( event ) {\r\n\r\n\t\t\tif ( onError ) onError( event );\r\n\r\n\t\t\tscope.manager.itemError( url );\r\n\r\n\t\t}, false );\r\n\r\n\t\tif ( this.crossOrigin !== undefined ) image.crossOrigin = this.crossOrigin;\r\n\r\n\t\tscope.manager.itemStart( url );\r\n\r\n\t\timage.src = url;\r\n\r\n\t\treturn image;\r\n\r\n\t},\r\n\r\n\tsetCrossOrigin: function ( value ) {\r\n\r\n\t\tthis.crossOrigin = value;\r\n\r\n\t}\r\n\r\n};\r\n\r\n// File:src/loaders/JSONLoader.js\r\n\r\n/**\r\n * @author mrdoob / http://mrdoob.com/\r\n * @author alteredq / http://alteredqualia.com/\r\n */\r\n\r\nTHREE.JSONLoader = function ( manager ) {\r\n\r\n\tif ( typeof manager === 'boolean' ) {\r\n\r\n\t\tconsole.warn( 'THREE.JSONLoader: showStatus parameter has been removed from constructor.' );\r\n\t\tmanager = undefined;\r\n\r\n\t}\r\n\r\n\tthis.manager = ( manager !== undefined ) ? manager : THREE.DefaultLoadingManager;\r\n\r\n\tthis.withCredentials = false;\r\n\r\n};\r\n\r\nTHREE.JSONLoader.prototype = {\r\n\r\n\tconstructor: THREE.JSONLoader,\r\n\r\n\t// Deprecated\r\n\t\r\n\tget statusDomElement () {\r\n\r\n\t\tif ( this._statusDomElement === undefined ) {\r\n\r\n\t\t\tthis._statusDomElement = document.createElement( 'div' );\r\n\r\n\t\t}\r\n\r\n\t\tconsole.warn( 'THREE.JSONLoader: .statusDomElement has been removed.' );\r\n\t\treturn this._statusDomElement;\r\n\r\n\t},\r\n\r\n\tload: function( url, onLoad, onProgress, onError ) {\r\n\r\n\t\tvar scope = this;\r\n\r\n\t\tvar texturePath = this.texturePath && ( typeof this.texturePath === \"string\" ) ? this.texturePath : THREE.Loader.prototype.extractUrlBase( url );\r\n\r\n\t\tvar loader = new THREE.XHRLoader( this.manager );\r\n\t\tloader.setCrossOrigin( this.crossOrigin );\r\n\t\tloader.setWithCredentials( this.withCredentials );\r\n\t\tloader.load( url, function ( text ) {\r\n\r\n\t\t\tvar json = JSON.parse( text );\r\n\t\t\tvar metadata = json.metadata;\r\n\r\n\t\t\tif ( metadata !== undefined ) {\r\n\r\n\t\t\t\tif ( metadata.type === 'object' ) {\r\n\r\n\t\t\t\t\tconsole.error( 'THREE.JSONLoader: ' + url + ' should be loaded with THREE.ObjectLoader instead.' );\r\n\t\t\t\t\treturn;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif ( metadata.type === 'scene' ) {\r\n\r\n\t\t\t\t\tconsole.error( 'THREE.JSONLoader: ' + url + ' should be loaded with THREE.SceneLoader instead.' );\r\n\t\t\t\t\treturn;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\tvar object = scope.parse( json, texturePath );\r\n\t\t\tonLoad( object.geometry, object.materials );\r\n\r\n\t\t} );\r\n\r\n\t},\r\n\r\n\tsetCrossOrigin: function ( value ) {\r\n\r\n\t\tthis.crossOrigin = value;\r\n\r\n\t},\r\n\r\n\tsetTexturePath: function ( value ) {\r\n\r\n\t\tthis.texturePath = value;\r\n\r\n\t},\r\n\r\n\tparse: function ( json, texturePath ) {\r\n\r\n\t\tvar geometry = new THREE.Geometry(),\r\n\t\tscale = ( json.scale !== undefined ) ? 1.0 / json.scale : 1.0;\r\n\r\n\t\tparseModel( scale );\r\n\r\n\t\tparseSkin();\r\n\t\tparseMorphing( scale );\r\n\r\n\t\tgeometry.computeFaceNormals();\r\n\t\tgeometry.computeBoundingSphere();\r\n\r\n\t\tfunction parseModel( scale ) {\r\n\r\n\t\t\tfunction isBitSet( value, position ) {\r\n\r\n\t\t\t\treturn value & ( 1 << position );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tvar i, j, fi,\r\n\r\n\t\t\toffset, zLength,\r\n\r\n\t\tcolorIndex, normalIndex, uvIndex, materialIndex,\r\n\r\n\t\t\ttype,\r\n\t\t\tisQuad,\r\n\t\t\thasMaterial,\r\n\t\t\thasFaceVertexUv,\r\n\t\t\thasFaceNormal, hasFaceVertexNormal,\r\n\t\t\thasFaceColor, hasFaceVertexColor,\r\n\r\n\t\tvertex, face, faceA, faceB, hex, normal,\r\n\r\n\t\t\tuvLayer, uv, u, v,\r\n\r\n\t\t\tfaces = json.faces,\r\n\t\t\tvertices = json.vertices,\r\n\t\t\tnormals = json.normals,\r\n\t\t\tcolors = json.colors,\r\n\r\n\t\t\tnUvLayers = 0;\r\n\r\n\t\t\tif ( json.uvs !== undefined ) {\r\n\r\n\t\t\t\t// disregard empty arrays\r\n\r\n\t\t\t\tfor ( i = 0; i < json.uvs.length; i ++ ) {\r\n\r\n\t\t\t\t\tif ( json.uvs[ i ].length ) nUvLayers ++;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tfor ( i = 0; i < nUvLayers; i ++ ) {\r\n\r\n\t\t\t\t\tgeometry.faceVertexUvs[ i ] = [];\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\toffset = 0;\r\n\t\t\tzLength = vertices.length;\r\n\r\n\t\t\twhile ( offset < zLength ) {\r\n\r\n\t\t\t\tvertex = new THREE.Vector3();\r\n\r\n\t\t\t\tvertex.x = vertices[ offset ++ ] * scale;\r\n\t\t\t\tvertex.y = vertices[ offset ++ ] * scale;\r\n\t\t\t\tvertex.z = vertices[ offset ++ ] * scale;\r\n\r\n\t\t\t\tgeometry.vertices.push( vertex );\r\n\r\n\t\t\t}\r\n\r\n\t\t\toffset = 0;\r\n\t\t\tzLength = faces.length;\r\n\r\n\t\t\twhile ( offset < zLength ) {\r\n\r\n\t\t\t\ttype = faces[ offset ++ ];\r\n\r\n\r\n\t\t\t\tisQuad = isBitSet( type, 0 );\r\n\t\t\t\thasMaterial = isBitSet( type, 1 );\r\n\t\t\t\thasFaceVertexUv = isBitSet( type, 3 );\r\n\t\t\t\thasFaceNormal = isBitSet( type, 4 );\r\n\t\t\t\thasFaceVertexNormal = isBitSet( type, 5 );\r\n\t\t\t\thasFaceColor\t = isBitSet( type, 6 );\r\n\t\t\t\thasFaceVertexColor = isBitSet( type, 7 );\r\n\r\n\t\t\t\t// console.log(\"type\", type, \"bits\", isQuad, hasMaterial, hasFaceVertexUv, hasFaceNormal, hasFaceVertexNormal, hasFaceColor, hasFaceVertexColor);\r\n\r\n\t\t\t\tif ( isQuad ) {\r\n\r\n\t\t\t\t\tfaceA = new THREE.Face3();\r\n\t\t\t\t\tfaceA.a = faces[ offset ];\r\n\t\t\t\t\tfaceA.b = faces[ offset + 1 ];\r\n\t\t\t\t\tfaceA.c = faces[ offset + 3 ];\r\n\r\n\t\t\t\t\tfaceB = new THREE.Face3();\r\n\t\t\t\t\tfaceB.a = faces[ offset + 1 ];\r\n\t\t\t\t\tfaceB.b = faces[ offset + 2 ];\r\n\t\t\t\t\tfaceB.c = faces[ offset + 3 ];\r\n\r\n\t\t\t\t\toffset += 4;\r\n\r\n\t\t\t\t\tif ( hasMaterial ) {\r\n\r\n\t\t\t\t\t\tmaterialIndex = faces[ offset ++ ];\r\n\t\t\t\t\t\tfaceA.materialIndex = materialIndex;\r\n\t\t\t\t\t\tfaceB.materialIndex = materialIndex;\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\t// to get face <=> uv index correspondence\r\n\r\n\t\t\t\t\tfi = geometry.faces.length;\r\n\r\n\t\t\t\t\tif ( hasFaceVertexUv ) {\r\n\r\n\t\t\t\t\t\tfor ( i = 0; i < nUvLayers; i ++ ) {\r\n\r\n\t\t\t\t\t\t\tuvLayer = json.uvs[ i ];\r\n\r\n\t\t\t\t\t\t\tgeometry.faceVertexUvs[ i ][ fi ] = [];\r\n\t\t\t\t\t\t\tgeometry.faceVertexUvs[ i ][ fi + 1 ] = [];\r\n\r\n\t\t\t\t\t\t\tfor ( j = 0; j < 4; j ++ ) {\r\n\r\n\t\t\t\t\t\t\t\tuvIndex = faces[ offset ++ ];\r\n\r\n\t\t\t\t\t\t\t\tu = uvLayer[ uvIndex * 2 ];\r\n\t\t\t\t\t\t\t\tv = uvLayer[ uvIndex * 2 + 1 ];\r\n\r\n\t\t\t\t\t\t\t\tuv = new THREE.Vector2( u, v );\r\n\r\n\t\t\t\t\t\t\t\tif ( j !== 2 ) geometry.faceVertexUvs[ i ][ fi ].push( uv );\r\n\t\t\t\t\t\t\t\tif ( j !== 0 ) geometry.faceVertexUvs[ i ][ fi + 1 ].push( uv );\r\n\r\n\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tif ( hasFaceNormal ) {\r\n\r\n\t\t\t\t\t\tnormalIndex = faces[ offset ++ ] * 3;\r\n\r\n\t\t\t\t\t\tfaceA.normal.set(\r\n\t\t\t\t\t\t\tnormals[ normalIndex ++ ],\r\n\t\t\t\t\t\t\tnormals[ normalIndex ++ ],\r\n\t\t\t\t\t\t\tnormals[ normalIndex ]\r\n\t\t\t\t\t\t);\r\n\r\n\t\t\t\t\t\tfaceB.normal.copy( faceA.normal );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tif ( hasFaceVertexNormal ) {\r\n\r\n\t\t\t\t\t\tfor ( i = 0; i < 4; i ++ ) {\r\n\r\n\t\t\t\t\t\t\tnormalIndex = faces[ offset ++ ] * 3;\r\n\r\n\t\t\t\t\t\t\tnormal = new THREE.Vector3(\r\n\t\t\t\t\t\t\t\tnormals[ normalIndex ++ ],\r\n\t\t\t\t\t\t\t\tnormals[ normalIndex ++ ],\r\n\t\t\t\t\t\t\t\tnormals[ normalIndex ]\r\n\t\t\t\t\t\t\t);\r\n\r\n\r\n\t\t\t\t\t\t\tif ( i !== 2 ) faceA.vertexNormals.push( normal );\r\n\t\t\t\t\t\t\tif ( i !== 0 ) faceB.vertexNormals.push( normal );\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t}\r\n\r\n\r\n\t\t\t\t\tif ( hasFaceColor ) {\r\n\r\n\t\t\t\t\t\tcolorIndex = faces[ offset ++ ];\r\n\t\t\t\t\t\thex = colors[ colorIndex ];\r\n\r\n\t\t\t\t\t\tfaceA.color.setHex( hex );\r\n\t\t\t\t\t\tfaceB.color.setHex( hex );\r\n\r\n\t\t\t\t\t}\r\n\r\n\r\n\t\t\t\t\tif ( hasFaceVertexColor ) {\r\n\r\n\t\t\t\t\t\tfor ( i = 0; i < 4; i ++ ) {\r\n\r\n\t\t\t\t\t\t\tcolorIndex = faces[ offset ++ ];\r\n\t\t\t\t\t\t\thex = colors[ colorIndex ];\r\n\r\n\t\t\t\t\t\t\tif ( i !== 2 ) faceA.vertexColors.push( new THREE.Color( hex ) );\r\n\t\t\t\t\t\t\tif ( i !== 0 ) faceB.vertexColors.push( new THREE.Color( hex ) );\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tgeometry.faces.push( faceA );\r\n\t\t\t\t\tgeometry.faces.push( faceB );\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\tface = new THREE.Face3();\r\n\t\t\t\t\tface.a = faces[ offset ++ ];\r\n\t\t\t\t\tface.b = faces[ offset ++ ];\r\n\t\t\t\t\tface.c = faces[ offset ++ ];\r\n\r\n\t\t\t\t\tif ( hasMaterial ) {\r\n\r\n\t\t\t\t\t\tmaterialIndex = faces[ offset ++ ];\r\n\t\t\t\t\t\tface.materialIndex = materialIndex;\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\t// to get face <=> uv index correspondence\r\n\r\n\t\t\t\t\tfi = geometry.faces.length;\r\n\r\n\t\t\t\t\tif ( hasFaceVertexUv ) {\r\n\r\n\t\t\t\t\t\tfor ( i = 0; i < nUvLayers; i ++ ) {\r\n\r\n\t\t\t\t\t\t\tuvLayer = json.uvs[ i ];\r\n\r\n\t\t\t\t\t\t\tgeometry.faceVertexUvs[ i ][ fi ] = [];\r\n\r\n\t\t\t\t\t\t\tfor ( j = 0; j < 3; j ++ ) {\r\n\r\n\t\t\t\t\t\t\t\tuvIndex = faces[ offset ++ ];\r\n\r\n\t\t\t\t\t\t\t\tu = uvLayer[ uvIndex * 2 ];\r\n\t\t\t\t\t\t\t\tv = uvLayer[ uvIndex * 2 + 1 ];\r\n\r\n\t\t\t\t\t\t\t\tuv = new THREE.Vector2( u, v );\r\n\r\n\t\t\t\t\t\t\t\tgeometry.faceVertexUvs[ i ][ fi ].push( uv );\r\n\r\n\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tif ( hasFaceNormal ) {\r\n\r\n\t\t\t\t\t\tnormalIndex = faces[ offset ++ ] * 3;\r\n\r\n\t\t\t\t\t\tface.normal.set(\r\n\t\t\t\t\t\t\tnormals[ normalIndex ++ ],\r\n\t\t\t\t\t\t\tnormals[ normalIndex ++ ],\r\n\t\t\t\t\t\t\tnormals[ normalIndex ]\r\n\t\t\t\t\t\t);\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tif ( hasFaceVertexNormal ) {\r\n\r\n\t\t\t\t\t\tfor ( i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\t\t\t\t\tnormalIndex = faces[ offset ++ ] * 3;\r\n\r\n\t\t\t\t\t\t\tnormal = new THREE.Vector3(\r\n\t\t\t\t\t\t\t\tnormals[ normalIndex ++ ],\r\n\t\t\t\t\t\t\t\tnormals[ normalIndex ++ ],\r\n\t\t\t\t\t\t\t\tnormals[ normalIndex ]\r\n\t\t\t\t\t\t\t);\r\n\r\n\t\t\t\t\t\t\tface.vertexNormals.push( normal );\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t}\r\n\r\n\r\n\t\t\t\t\tif ( hasFaceColor ) {\r\n\r\n\t\t\t\t\t\tcolorIndex = faces[ offset ++ ];\r\n\t\t\t\t\t\tface.color.setHex( colors[ colorIndex ] );\r\n\r\n\t\t\t\t\t}\r\n\r\n\r\n\t\t\t\t\tif ( hasFaceVertexColor ) {\r\n\r\n\t\t\t\t\t\tfor ( i = 0; i < 3; i ++ ) {\r\n\r\n\t\t\t\t\t\t\tcolorIndex = faces[ offset ++ ];\r\n\t\t\t\t\t\t\tface.vertexColors.push( new THREE.Color( colors[ colorIndex ] ) );\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tgeometry.faces.push( face );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t};\r\n\r\n\t\tfunction parseSkin() {\r\n\r\n\t\t\tvar influencesPerVertex = ( json.influencesPerVertex !== undefined ) ? json.influencesPerVertex : 2;\r\n\r\n\t\t\tif ( json.skinWeights ) {\r\n\r\n\t\t\t\tfor ( var i = 0, l = json.skinWeights.length; i < l; i += influencesPerVertex ) {\r\n\r\n\t\t\t\t\tvar x = json.skinWeights[ i ];\r\n\t\t\t\t\tvar y = ( influencesPerVertex > 1 ) ? json.skinWeights[ i + 1 ] : 0;\r\n\t\t\t\t\tvar z = ( influencesPerVertex > 2 ) ? json.skinWeights[ i + 2 ] : 0;\r\n\t\t\t\t\tvar w = ( influencesPerVertex > 3 ) ? json.skinWeights[ i + 3 ] : 0;\r\n\r\n\t\t\t\t\tgeometry.skinWeights.push( new THREE.Vector4( x, y, z, w ) );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( json.skinIndices ) {\r\n\r\n\t\t\t\tfor ( var i = 0, l = json.skinIndices.length; i < l; i += influencesPerVertex ) {\r\n\r\n\t\t\t\t\tvar a = json.skinIndices[ i ];\r\n\t\t\t\t\tvar b = ( influencesPerVertex > 1 ) ? json.skinIndices[ i + 1 ] : 0;\r\n\t\t\t\t\tvar c = ( influencesPerVertex > 2 ) ? json.skinIndices[ i + 2 ] : 0;\r\n\t\t\t\t\tvar d = ( influencesPerVertex > 3 ) ? json.skinIndices[ i + 3 ] : 0;\r\n\r\n\t\t\t\t\tgeometry.skinIndices.push( new THREE.Vector4( a, b, c, d ) );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\tgeometry.bones = json.bones;\r\n\r\n\t\t\tif ( geometry.bones && geometry.bones.length > 0 && ( geometry.skinWeights.length !== geometry.skinIndices.length || geometry.skinIndices.length !== geometry.vertices.length ) ) {\r\n\r\n\t\t\t\tconsole.warn( 'When skinning, number of vertices (' + geometry.vertices.length + '), skinIndices (' +\r\n\t\t\t\t\tgeometry.skinIndices.length + '), and skinWeights (' + geometry.skinWeights.length + ') should match.' );\r\n\r\n\t\t\t}\r\n\r\n\r\n\t\t\t// could change this to json.animations[0] or remove completely\r\n\r\n\t\t\tgeometry.animation = json.animation;\r\n\t\t\tgeometry.animations = json.animations;\r\n\r\n\t\t};\r\n\r\n\t\tfunction parseMorphing( scale ) {\r\n\r\n\t\t\tif ( json.morphTargets !== undefined ) {\r\n\r\n\t\t\t\tvar i, l, v, vl, dstVertices, srcVertices;\r\n\r\n\t\t\t\tfor ( i = 0, l = json.morphTargets.length; i < l; i ++ ) {\r\n\r\n\t\t\t\t\tgeometry.morphTargets[ i ] = {};\r\n\t\t\t\t\tgeometry.morphTargets[ i ].name = json.morphTargets[ i ].name;\r\n\t\t\t\t\tgeometry.morphTargets[ i ].vertices = [];\r\n\r\n\t\t\t\t\tdstVertices = geometry.morphTargets[ i ].vertices;\r\n\t\t\t\t\tsrcVertices = json.morphTargets[ i ].vertices;\r\n\r\n\t\t\t\t\tfor ( v = 0, vl = srcVertices.length; v < vl; v += 3 ) {\r\n\r\n\t\t\t\t\t\tvar vertex = new THREE.Vector3();\r\n\t\t\t\t\t\tvertex.x = srcVertices[ v ] * scale;\r\n\t\t\t\t\t\tvertex.y = srcVertices[ v + 1 ] * scale;\r\n\t\t\t\t\t\tvertex.z = srcVertices[ v + 2 ] * scale;\r\n\r\n\t\t\t\t\t\tdstVertices.push( vertex );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( json.morphColors !== undefined ) {\r\n\r\n\t\t\t\tvar i, l, c, cl, dstColors, srcColors, color;\r\n\r\n\t\t\t\tfor ( i = 0, l = json.morphColors.length; i < l; i ++ ) {\r\n\r\n\t\t\t\t\tgeometry.morphColors[ i ] = {};\r\n\t\t\t\t\tgeometry.morphColors[ i ].name = json.morphColors[ i ].name;\r\n\t\t\t\t\tgeometry.morphColors[ i ].colors = [];\r\n\r\n\t\t\t\t\tdstColors = geometry.morphColors[ i ].colors;\r\n\t\t\t\t\tsrcColors = json.morphColors[ i ].colors;\r\n\r\n\t\t\t\t\tfor ( c = 0, cl = srcColors.length; c < cl; c += 3 ) {\r\n\r\n\t\t\t\t\t\tcolor = new THREE.Color( 0xffaa00 );\r\n\t\t\t\t\t\tcolor.setRGB( srcColors[ c ], srcColors[ c + 1 ], srcColors[ c + 2 ] );\r\n\t\t\t\t\t\tdstColors.push( color );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t};\r\n\r\n\t\tif ( json.materials === undefined || json.materials.length === 0 ) {\r\n\r\n\t\t\treturn { geometry: geometry };\r\n\r\n\t\t} else {\r\n\r\n\t\t\tvar materials = THREE.Loader.prototype.initMaterials( json.materials, texturePath, this.crossOrigin );\r\n\r\n\t\t\treturn { geometry: geometry, materials: materials };\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n};\r\n\r\n// File:src/loaders/LoadingManager.js\r\n\r\n/**\r\n * @author mrdoob / http://mrdoob.com/\r\n */\r\n\r\nTHREE.LoadingManager = function ( onLoad, onProgress, onError ) {\r\n\r\n\tvar scope = this;\r\n\r\n\tvar isLoading = false, itemsLoaded = 0, itemsTotal = 0;\r\n\r\n\tthis.onStart = undefined;\r\n\tthis.onLoad = onLoad;\r\n\tthis.onProgress = onProgress;\r\n\tthis.onError = onError;\r\n\r\n\tthis.itemStart = function ( url ) {\r\n\r\n\t\titemsTotal ++;\r\n\r\n\t\tif ( isLoading === false ) {\r\n\r\n\t\t\tif ( scope.onStart !== undefined ) {\r\n\r\n\t\t\t\tscope.onStart( url, itemsLoaded, itemsTotal );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tisLoading = true;\r\n\r\n\t};\r\n\r\n\tthis.itemEnd = function ( url ) {\r\n\r\n\t\titemsLoaded ++;\r\n\r\n\t\tif ( scope.onProgress !== undefined ) {\r\n\r\n\t\t\tscope.onProgress( url, itemsLoaded, itemsTotal );\r\n\r\n\t\t}\r\n\r\n\t\tif ( itemsLoaded === itemsTotal ) {\r\n\r\n\t\t\tisLoading = false;\r\n\r\n\t\t\tif ( scope.onLoad !== undefined ) {\r\n\r\n\t\t\t\tscope.onLoad();\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t};\r\n\r\n\tthis.itemError = function ( url ) {\r\n\r\n\t\tif ( scope.onError !== undefined ) {\r\n\r\n\t\t\tscope.onError( url );\r\n\r\n\t\t}\r\n\r\n\t};\r\n\r\n};\r\n\r\nTHREE.DefaultLoadingManager = new THREE.LoadingManager();\r\n\r\n// File:src/loaders/BufferGeometryLoader.js\r\n\r\n/**\r\n * @author mrdoob / http://mrdoob.com/\r\n */\r\n\r\nTHREE.BufferGeometryLoader = function ( manager ) {\r\n\r\n\tthis.manager = ( manager !== undefined ) ? manager : THREE.DefaultLoadingManager;\r\n\r\n};\r\n\r\nTHREE.BufferGeometryLoader.prototype = {\r\n\r\n\tconstructor: THREE.BufferGeometryLoader,\r\n\r\n\tload: function ( url, onLoad, onProgress, onError ) {\r\n\r\n\t\tvar scope = this;\r\n\r\n\t\tvar loader = new THREE.XHRLoader( scope.manager );\r\n\t\tloader.setCrossOrigin( this.crossOrigin );\r\n\t\tloader.load( url, function ( text ) {\r\n\r\n\t\t\tonLoad( scope.parse( JSON.parse( text ) ) );\r\n\r\n\t\t}, onProgress, onError );\r\n\r\n\t},\r\n\r\n\tsetCrossOrigin: function ( value ) {\r\n\r\n\t\tthis.crossOrigin = value;\r\n\r\n\t},\r\n\r\n\tparse: function ( json ) {\r\n\r\n\t\tvar geometry = new THREE.BufferGeometry();\r\n\r\n\t\tvar index = json.data.index;\r\n\r\n\t\tif ( index !== undefined ) {\r\n\r\n\t\t\tvar typedArray = new self[ index.type ]( index.array );\r\n\t\t\tgeometry.addIndex( new THREE.BufferAttribute( typedArray, 1 ) );\r\n\r\n\t\t}\r\n\r\n\t\tvar attributes = json.data.attributes;\r\n\r\n\t\tfor ( var key in attributes ) {\r\n\r\n\t\t\tvar attribute = attributes[ key ];\r\n\t\t\tvar typedArray = new self[ attribute.type ]( attribute.array );\r\n\r\n\t\t\tgeometry.addAttribute( key, new THREE.BufferAttribute( typedArray, attribute.itemSize ) );\r\n\r\n\t\t}\r\n\r\n\t\tvar groups = json.data.groups || json.data.drawcalls || json.data.offsets;\r\n\r\n\t\tif ( groups !== undefined ) {\r\n\r\n\t\t\tfor ( var i = 0, n = groups.length; i !== n; ++ i ) {\r\n\r\n\t\t\t\tvar group = groups[ i ];\r\n\r\n\t\t\t\tgeometry.addGroup( group.start, group.count );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tvar boundingSphere = json.data.boundingSphere;\r\n\r\n\t\tif ( boundingSphere !== undefined ) {\r\n\r\n\t\t\tvar center = new THREE.Vector3();\r\n\r\n\t\t\tif ( boundingSphere.center !== undefined ) {\r\n\r\n\t\t\t\tcenter.fromArray( boundingSphere.center );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tgeometry.boundingSphere = new THREE.Sphere( center, boundingSphere.radius );\r\n\r\n\t\t}\r\n\r\n\t\treturn geometry;\r\n\r\n\t}\r\n\r\n};\r\n\r\n// File:src/loaders/MaterialLoader.js\r\n\r\n/**\r\n * @author mrdoob / http://mrdoob.com/\r\n */\r\n\r\nTHREE.MaterialLoader = function ( manager ) {\r\n\r\n\tthis.manager = ( manager !== undefined ) ? manager : THREE.DefaultLoadingManager;\r\n\tthis.textures = {};\r\n\r\n};\r\n\r\nTHREE.MaterialLoader.prototype = {\r\n\r\n\tconstructor: THREE.MaterialLoader,\r\n\r\n\tload: function ( url, onLoad, onProgress, onError ) {\r\n\r\n\t\tvar scope = this;\r\n\r\n\t\tvar loader = new THREE.XHRLoader( scope.manager );\r\n\t\tloader.setCrossOrigin( this.crossOrigin );\r\n\t\tloader.load( url, function ( text ) {\r\n\r\n\t\t\tonLoad( scope.parse( JSON.parse( text ) ) );\r\n\r\n\t\t}, onProgress, onError );\r\n\r\n\t},\r\n\r\n\tsetCrossOrigin: function ( value ) {\r\n\r\n\t\tthis.crossOrigin = value;\r\n\r\n\t},\r\n\r\n\tsetTextures: function ( value ) {\r\n\r\n\t\tthis.textures = value;\r\n\r\n\t},\r\n\r\n\tgetTexture: function ( name ) {\r\n\r\n\t\tvar textures = this.textures;\r\n\r\n\t\tif ( textures[ name ] === undefined ) {\r\n\r\n\t\t\tconsole.warn( 'THREE.MaterialLoader: Undefined texture', name );\r\n\r\n\t\t}\r\n\r\n\t\treturn textures[ name ];\r\n\r\n\t},\r\n\r\n\tparse: function ( json ) {\r\n\r\n\t\tvar material = new THREE[ json.type ];\r\n\t\tmaterial.uuid = json.uuid;\r\n\r\n\t\tif ( json.name !== undefined ) material.name = json.name;\r\n\t\tif ( json.color !== undefined ) material.color.setHex( json.color );\r\n\t\tif ( json.emissive !== undefined ) material.emissive.setHex( json.emissive );\r\n\t\tif ( json.specular !== undefined ) material.specular.setHex( json.specular );\r\n\t\tif ( json.shininess !== undefined ) material.shininess = json.shininess;\r\n\t\tif ( json.uniforms !== undefined ) material.uniforms = json.uniforms;\r\n\t\tif ( json.vertexShader !== undefined ) material.vertexShader = json.vertexShader;\r\n\t\tif ( json.fragmentShader !== undefined ) material.fragmentShader = json.fragmentShader;\r\n\t\tif ( json.vertexColors !== undefined ) material.vertexColors = json.vertexColors;\r\n\t\tif ( json.shading !== undefined ) material.shading = json.shading;\r\n\t\tif ( json.blending !== undefined ) material.blending = json.blending;\r\n\t\tif ( json.side !== undefined ) material.side = json.side;\r\n\t\tif ( json.opacity !== undefined ) material.opacity = json.opacity;\r\n\t\tif ( json.transparent !== undefined ) material.transparent = json.transparent;\r\n\t\tif ( json.alphaTest !== undefined ) material.alphaTest = json.alphaTest;\r\n\t\tif ( json.depthTest !== undefined ) material.depthTest = json.depthTest;\r\n\t\tif ( json.depthWrite !== undefined ) material.depthWrite = json.depthWrite;\r\n\t\tif ( json.wireframe !== undefined ) material.wireframe = json.wireframe;\r\n\t\tif ( json.wireframeLinewidth !== undefined ) material.wireframeLinewidth = json.wireframeLinewidth;\r\n\r\n\t\t// for PointsMaterial\r\n\t\tif ( json.size !== undefined ) material.size = json.size;\r\n\t\tif ( json.sizeAttenuation !== undefined ) material.sizeAttenuation = json.sizeAttenuation;\r\n\r\n\t\t// maps\r\n\r\n\t\tif ( json.map !== undefined ) material.map = this.getTexture( json.map );\r\n\r\n\t\tif ( json.alphaMap !== undefined ) {\r\n\r\n\t\t\tmaterial.alphaMap = this.getTexture( json.alphaMap );\r\n\t\t\tmaterial.transparent = true;\r\n\r\n\t\t}\r\n\r\n\t\tif ( json.bumpMap !== undefined ) material.bumpMap = this.getTexture( json.bumpMap );\r\n\t\tif ( json.bumpScale !== undefined ) material.bumpScale = json.bumpScale;\r\n\r\n\t\tif ( json.normalMap !== undefined ) material.normalMap = this.getTexture( json.normalMap );\r\n\t\tif ( json.normalScale )\tmaterial.normalScale = new THREE.Vector2( json.normalScale, json.normalScale );\r\n\r\n\t\tif ( json.displacementMap !== undefined ) material.displacementMap = this.getTexture( json.displacementMap );\r\n\t\tif ( json.displacementScale !== undefined ) material.displacementScale = json.displacementScale;\r\n\t\tif ( json.displacementBias !== undefined ) material.displacementBias = json.displacementBias;\r\n\r\n\t\tif ( json.specularMap !== undefined ) material.specularMap = this.getTexture( json.specularMap );\r\n\r\n\t\tif ( json.envMap !== undefined ) {\r\n\r\n\t\t\tmaterial.envMap = this.getTexture( json.envMap );\r\n\t\t\tmaterial.combine = THREE.MultiplyOperation;\r\n\r\n\t\t}\r\n\r\n\t\tif ( json.reflectivity ) material.reflectivity = json.reflectivity;\r\n\r\n\t\tif ( json.lightMap !== undefined ) material.lightMap = this.getTexture( json.lightMap );\r\n\t\tif ( json.lightMapIntensity !== undefined ) material.lightMapIntensity = json.lightMapIntensity;\r\n\r\n\t\tif ( json.aoMap !== undefined ) material.aoMap = this.getTexture( json.aoMap );\r\n\t\tif ( json.aoMapIntensity !== undefined ) material.aoMapIntensity = json.aoMapIntensity;\r\n\r\n\t\t// MeshFaceMaterial\r\n\r\n\t\tif ( json.materials !== undefined ) {\r\n\r\n\t\t\tfor ( var i = 0, l = json.materials.length; i < l; i ++ ) {\r\n\r\n\t\t\t\tmaterial.materials.push( this.parse( json.materials[ i ] ) );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn material;\r\n\r\n\t}\r\n\r\n};\r\n\r\n// File:src/loaders/ObjectLoader.js\r\n\r\n/**\r\n * @author mrdoob / http://mrdoob.com/\r\n */\r\n\r\nTHREE.ObjectLoader = function ( manager ) {\r\n\r\n\tthis.manager = ( manager !== undefined ) ? manager : THREE.DefaultLoadingManager;\r\n\tthis.texturePath = '';\r\n\r\n};\r\n\r\nTHREE.ObjectLoader.prototype = {\r\n\r\n\tconstructor: THREE.ObjectLoader,\r\n\r\n\tload: function ( url, onLoad, onProgress, onError ) {\r\n\r\n\t\tif ( this.texturePath === '' ) {\r\n\r\n\t\t\tthis.texturePath = url.substring( 0, url.lastIndexOf( '/' ) + 1 );\r\n\r\n\t\t}\r\n\r\n\t\tvar scope = this;\r\n\r\n\t\tvar loader = new THREE.XHRLoader( scope.manager );\r\n\t\tloader.setCrossOrigin( this.crossOrigin );\r\n\t\tloader.load( url, function ( text ) {\r\n\r\n\t\t\tscope.parse( JSON.parse( text ), onLoad );\r\n\r\n\t\t}, onProgress, onError );\r\n\r\n\t},\r\n\r\n\tsetTexturePath: function ( value ) {\r\n\r\n\t\tthis.texturePath = value;\r\n\r\n\t},\r\n\r\n\tsetCrossOrigin: function ( value ) {\r\n\r\n\t\tthis.crossOrigin = value;\r\n\r\n\t},\r\n\r\n\tparse: function ( json, onLoad ) {\r\n\r\n\t\tvar geometries = this.parseGeometries( json.geometries );\r\n\r\n\t\tvar images = this.parseImages( json.images, function () {\r\n\r\n\t\t\tif ( onLoad !== undefined ) onLoad( object );\r\n\r\n\t\t} );\r\n\r\n\t\tvar textures = this.parseTextures( json.textures, images );\r\n\t\tvar materials = this.parseMaterials( json.materials, textures );\r\n\t\tvar object = this.parseObject( json.object, geometries, materials );\r\n\r\n\t\tif ( json.images === undefined || json.images.length === 0 ) {\r\n\r\n\t\t\tif ( onLoad !== undefined ) onLoad( object );\r\n\r\n\t\t}\r\n\r\n\t\treturn object;\r\n\r\n\t},\r\n\r\n\tparseGeometries: function ( json ) {\r\n\r\n\t\tvar geometries = {};\r\n\r\n\t\tif ( json !== undefined ) {\r\n\r\n\t\t\tvar geometryLoader = new THREE.JSONLoader();\r\n\t\t\tvar bufferGeometryLoader = new THREE.BufferGeometryLoader();\r\n\r\n\t\t\tfor ( var i = 0, l = json.length; i < l; i ++ ) {\r\n\r\n\t\t\t\tvar geometry;\r\n\t\t\t\tvar data = json[ i ];\r\n\r\n\t\t\t\tswitch ( data.type ) {\r\n\r\n\t\t\t\t\tcase 'PlaneGeometry':\r\n\t\t\t\t\tcase 'PlaneBufferGeometry':\r\n\r\n\t\t\t\t\t\tgeometry = new THREE[ data.type ](\r\n\t\t\t\t\t\t\tdata.width,\r\n\t\t\t\t\t\t\tdata.height,\r\n\t\t\t\t\t\t\tdata.widthSegments,\r\n\t\t\t\t\t\t\tdata.heightSegments\r\n\t\t\t\t\t\t);\r\n\r\n\t\t\t\t\t\tbreak;\r\n\r\n\t\t\t\t\tcase 'BoxGeometry':\r\n\t\t\t\t\tcase 'CubeGeometry': // backwards compatible\r\n\r\n\t\t\t\t\t\tgeometry = new THREE.BoxGeometry(\r\n\t\t\t\t\t\t\tdata.width,\r\n\t\t\t\t\t\t\tdata.height,\r\n\t\t\t\t\t\t\tdata.depth,\r\n\t\t\t\t\t\t\tdata.widthSegments,\r\n\t\t\t\t\t\t\tdata.heightSegments,\r\n\t\t\t\t\t\t\tdata.depthSegments\r\n\t\t\t\t\t\t);\r\n\r\n\t\t\t\t\t\tbreak;\r\n\r\n\t\t\t\t\tcase 'CircleBufferGeometry':\r\n\r\n\t\t\t\t\t\tgeometry = new THREE.CircleBufferGeometry(\r\n\t\t\t\t\t\t\tdata.radius,\r\n\t\t\t\t\t\t\tdata.segments,\r\n\t\t\t\t\t\t\tdata.thetaStart,\r\n\t\t\t\t\t\t\tdata.thetaLength\r\n\t\t\t\t\t\t);\r\n\r\n\t\t\t\t\t\tbreak;\r\n\r\n\t\t\t\t\tcase 'CircleGeometry':\r\n\r\n\t\t\t\t\t\tgeometry = new THREE.CircleGeometry(\r\n\t\t\t\t\t\t\tdata.radius,\r\n\t\t\t\t\t\t\tdata.segments,\r\n\t\t\t\t\t\t\tdata.thetaStart,\r\n\t\t\t\t\t\t\tdata.thetaLength\r\n\t\t\t\t\t\t);\r\n\r\n\t\t\t\t\t\tbreak;\r\n\r\n\t\t\t\t\tcase 'CylinderGeometry':\r\n\r\n\t\t\t\t\t\tgeometry = new THREE.CylinderGeometry(\r\n\t\t\t\t\t\t\tdata.radiusTop,\r\n\t\t\t\t\t\t\tdata.radiusBottom,\r\n\t\t\t\t\t\t\tdata.height,\r\n\t\t\t\t\t\t\tdata.radialSegments,\r\n\t\t\t\t\t\t\tdata.heightSegments,\r\n\t\t\t\t\t\t\tdata.openEnded,\r\n\t\t\t\t\t\t\tdata.thetaStart,\r\n\t\t\t\t\t\t\tdata.thetaLength\r\n\t\t\t\t\t\t);\r\n\r\n\t\t\t\t\t\tbreak;\r\n\r\n\t\t\t\t\tcase 'SphereGeometry':\r\n\r\n\t\t\t\t\t\tgeometry = new THREE.SphereGeometry(\r\n\t\t\t\t\t\t\tdata.radius,\r\n\t\t\t\t\t\t\tdata.widthSegments,\r\n\t\t\t\t\t\t\tdata.heightSegments,\r\n\t\t\t\t\t\t\tdata.phiStart,\r\n\t\t\t\t\t\t\tdata.phiLength,\r\n\t\t\t\t\t\t\tdata.thetaStart,\r\n\t\t\t\t\t\t\tdata.thetaLength\r\n\t\t\t\t\t\t);\r\n\r\n\t\t\t\t\t\tbreak;\r\n\r\n\t\t\t\t\tcase 'SphereBufferGeometry':\r\n\r\n\t\t\t\t\t\tgeometry = new THREE.SphereBufferGeometry(\r\n\t\t\t\t\t\t\tdata.radius,\r\n\t\t\t\t\t\t\tdata.widthSegments,\r\n\t\t\t\t\t\t\tdata.heightSegments,\r\n\t\t\t\t\t\t\tdata.phiStart,\r\n\t\t\t\t\t\t\tdata.phiLength,\r\n\t\t\t\t\t\t\tdata.thetaStart,\r\n\t\t\t\t\t\t\tdata.thetaLength\r\n\t\t\t\t\t\t);\r\n\r\n\t\t\t\t\t\tbreak;\r\n\r\n\t\t\t\t\tcase 'DodecahedronGeometry':\r\n\r\n\t\t\t\t\t\tgeometry = new THREE.DodecahedronGeometry(\r\n\t\t\t\t\t\t\tdata.radius,\r\n\t\t\t\t\t\t\tdata.detail\r\n\t\t\t\t\t\t);\r\n\r\n\t\t\t\t\t\tbreak;\r\n\r\n\t\t\t\t\tcase 'IcosahedronGeometry':\r\n\r\n\t\t\t\t\t\tgeometry = new THREE.IcosahedronGeometry(\r\n\t\t\t\t\t\t\tdata.radius,\r\n\t\t\t\t\t\t\tdata.detail\r\n\t\t\t\t\t\t);\r\n\r\n\t\t\t\t\t\tbreak;\r\n\r\n\t\t\t\t\tcase 'OctahedronGeometry':\r\n\r\n\t\t\t\t\t\tgeometry = new THREE.OctahedronGeometry(\r\n\t\t\t\t\t\t\tdata.radius,\r\n\t\t\t\t\t\t\tdata.detail\r\n\t\t\t\t\t\t);\r\n\r\n\t\t\t\t\t\tbreak;\r\n\r\n\t\t\t\t\tcase 'TetrahedronGeometry':\r\n\r\n\t\t\t\t\t\tgeometry = new THREE.TetrahedronGeometry(\r\n\t\t\t\t\t\t\tdata.radius,\r\n\t\t\t\t\t\t\tdata.detail\r\n\t\t\t\t\t\t);\r\n\r\n\t\t\t\t\t\tbreak;\r\n\r\n\t\t\t\t\tcase 'RingGeometry':\r\n\r\n\t\t\t\t\t\tgeometry = new THREE.RingGeometry(\r\n\t\t\t\t\t\t\tdata.innerRadius,\r\n\t\t\t\t\t\t\tdata.outerRadius,\r\n\t\t\t\t\t\t\tdata.thetaSegments,\r\n\t\t\t\t\t\t\tdata.phiSegments,\r\n\t\t\t\t\t\t\tdata.thetaStart,\r\n\t\t\t\t\t\t\tdata.thetaLength\r\n\t\t\t\t\t\t);\r\n\r\n\t\t\t\t\t\tbreak;\r\n\r\n\t\t\t\t\tcase 'TorusGeometry':\r\n\r\n\t\t\t\t\t\tgeometry = new THREE.TorusGeometry(\r\n\t\t\t\t\t\t\tdata.radius,\r\n\t\t\t\t\t\t\tdata.tube,\r\n\t\t\t\t\t\t\tdata.radialSegments,\r\n\t\t\t\t\t\t\tdata.tubularSegments,\r\n\t\t\t\t\t\t\tdata.arc\r\n\t\t\t\t\t\t);\r\n\r\n\t\t\t\t\t\tbreak;\r\n\r\n\t\t\t\t\tcase 'TorusKnotGeometry':\r\n\r\n\t\t\t\t\t\tgeometry = new THREE.TorusKnotGeometry(\r\n\t\t\t\t\t\t\tdata.radius,\r\n\t\t\t\t\t\t\tdata.tube,\r\n\t\t\t\t\t\t\tdata.radialSegments,\r\n\t\t\t\t\t\t\tdata.tubularSegments,\r\n\t\t\t\t\t\t\tdata.p,\r\n\t\t\t\t\t\t\tdata.q,\r\n\t\t\t\t\t\t\tdata.heightScale\r\n\t\t\t\t\t\t);\r\n\r\n\t\t\t\t\t\tbreak;\r\n\r\n\t\t\t\t\tcase 'TextGeometry':\r\n\r\n\t\t\t\t\t\tgeometry = new THREE.TextGeometry(\r\n\t\t\t\t\t\t\tdata.text,\r\n\t\t\t\t\t\t\tdata.data\r\n\t\t\t\t\t\t);\r\n\r\n\t\t\t\t\t\tbreak;\r\n\r\n\t\t\t\t\tcase 'BufferGeometry':\r\n\r\n\t\t\t\t\t\tgeometry = bufferGeometryLoader.parse( data );\r\n\r\n\t\t\t\t\t\tbreak;\r\n\r\n\t\t\t\t\tcase 'Geometry':\r\n\r\n\t\t\t\t\t\tgeometry = geometryLoader.parse( data.data, this.texturePath ).geometry;\r\n\r\n\t\t\t\t\t\tbreak;\r\n\r\n\t\t\t\t\tdefault:\r\n\r\n\t\t\t\t\t\tconsole.warn( 'THREE.ObjectLoader: Unsupported geometry type \"' + data.type + '\"' );\r\n\r\n\t\t\t\t\t\tcontinue;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tgeometry.uuid = data.uuid;\r\n\r\n\t\t\t\tif ( data.name !== undefined ) geometry.name = data.name;\r\n\r\n\t\t\t\tgeometries[ data.uuid ] = geometry;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn geometries;\r\n\r\n\t},\r\n\r\n\tparseMaterials: function ( json, textures ) {\r\n\r\n\t\tvar materials = {};\r\n\r\n\t\tif ( json !== undefined ) {\r\n\r\n\t\t\tvar loader = new THREE.MaterialLoader();\r\n\t\t\tloader.setTextures( textures );\r\n\r\n\t\t\tfor ( var i = 0, l = json.length; i < l; i ++ ) {\r\n\r\n\t\t\t\tvar material = loader.parse( json[ i ] );\r\n\t\t\t\tmaterials[ material.uuid ] = material;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn materials;\r\n\r\n\t},\r\n\r\n\tparseImages: function ( json, onLoad ) {\r\n\r\n\t\tvar scope = this;\r\n\t\tvar images = {};\r\n\r\n\t\tif ( json !== undefined && json.length > 0 ) {\r\n\r\n\t\t\tvar manager = new THREE.LoadingManager( onLoad );\r\n\r\n\t\t\tvar loader = new THREE.ImageLoader( manager );\r\n\t\t\tloader.setCrossOrigin( this.crossOrigin );\r\n\r\n\t\t\tvar loadImage = function ( url ) {\r\n\r\n\t\t\t\turl = scope.texturePath + url;\r\n\r\n\t\t\t\tscope.manager.itemStart( url );\r\n\r\n\t\t\t\treturn loader.load( url, function () {\r\n\r\n\t\t\t\t\tscope.manager.itemEnd( url );\r\n\r\n\t\t\t\t} );\r\n\r\n\t\t\t};\r\n\r\n\t\t\tfor ( var i = 0, l = json.length; i < l; i ++ ) {\r\n\r\n\t\t\t\tvar image = json[ i ];\r\n\t\t\t\timages[ image.uuid ] = loadImage( image.url );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn images;\r\n\r\n\t},\r\n\r\n\tparseTextures: function ( json, images ) {\r\n\r\n\t\tfunction parseConstant( value ) {\r\n\r\n\t\t\tif ( typeof( value ) === 'number' ) return value;\r\n\r\n\t\t\tconsole.warn( 'THREE.ObjectLoader.parseTexture: Constant should be in numeric form.', value );\r\n\r\n\t\t\treturn THREE[ value ];\r\n\r\n\t\t}\r\n\r\n\t\tvar textures = {};\r\n\r\n\t\tif ( json !== undefined ) {\r\n\r\n\t\t\tfor ( var i = 0, l = json.length; i < l; i ++ ) {\r\n\r\n\t\t\t\tvar data = json[ i ];\r\n\r\n\t\t\t\tif ( data.image === undefined ) {\r\n\r\n\t\t\t\t\tconsole.warn( 'THREE.ObjectLoader: No \"image\" specified for', data.uuid );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif ( images[ data.image ] === undefined ) {\r\n\r\n\t\t\t\t\tconsole.warn( 'THREE.ObjectLoader: Undefined image', data.image );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tvar texture = new THREE.Texture( images[ data.image ] );\r\n\t\t\t\ttexture.needsUpdate = true;\r\n\r\n\t\t\t\ttexture.uuid = data.uuid;\r\n\r\n\t\t\t\tif ( data.name !== undefined ) texture.name = data.name;\r\n\t\t\t\tif ( data.mapping !== undefined ) texture.mapping = parseConstant( data.mapping );\r\n\t\t\t\tif ( data.offset !== undefined ) texture.offset = new THREE.Vector2( data.offset[ 0 ], data.offset[ 1 ] );\r\n\t\t\t\tif ( data.repeat !== undefined ) texture.repeat = new THREE.Vector2( data.repeat[ 0 ], data.repeat[ 1 ] );\r\n\t\t\t\tif ( data.minFilter !== undefined ) texture.minFilter = parseConstant( data.minFilter );\r\n\t\t\t\tif ( data.magFilter !== undefined ) texture.magFilter = parseConstant( data.magFilter );\r\n\t\t\t\tif ( data.anisotropy !== undefined ) texture.anisotropy = data.anisotropy;\r\n\t\t\t\tif ( Array.isArray( data.wrap ) ) {\r\n\r\n\t\t\t\t\ttexture.wrapS = parseConstant( data.wrap[ 0 ] );\r\n\t\t\t\t\ttexture.wrapT = parseConstant( data.wrap[ 1 ] );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\ttextures[ data.uuid ] = texture;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn textures;\r\n\r\n\t},\r\n\r\n\tparseObject: function () {\r\n\r\n\t\tvar matrix = new THREE.Matrix4();\r\n\r\n\t\treturn function ( data, geometries, materials ) {\r\n\r\n\t\t\tvar object;\r\n\r\n\t\t\tvar getGeometry = function ( name ) {\r\n\r\n\t\t\t\tif ( geometries[ name ] === undefined ) {\r\n\r\n\t\t\t\t\tconsole.warn( 'THREE.ObjectLoader: Undefined geometry', name );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\treturn geometries[ name ];\r\n\r\n\t\t\t};\r\n\r\n\t\t\tvar getMaterial = function ( name ) {\r\n\r\n\t\t\t\tif ( materials[ name ] === undefined ) {\r\n\r\n\t\t\t\t\tconsole.warn( 'THREE.ObjectLoader: Undefined material', name );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\treturn materials[ name ];\r\n\r\n\t\t\t};\r\n\r\n\t\t\tswitch ( data.type ) {\r\n\r\n\t\t\t\tcase 'Scene':\r\n\r\n\t\t\t\t\tobject = new THREE.Scene();\r\n\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase 'PerspectiveCamera':\r\n\r\n\t\t\t\t\tobject = new THREE.PerspectiveCamera( data.fov, data.aspect, data.near, data.far );\r\n\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase 'OrthographicCamera':\r\n\r\n\t\t\t\t\tobject = new THREE.OrthographicCamera( data.left, data.right, data.top, data.bottom, data.near, data.far );\r\n\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase 'AmbientLight':\r\n\r\n\t\t\t\t\tobject = new THREE.AmbientLight( data.color );\r\n\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase 'DirectionalLight':\r\n\r\n\t\t\t\t\tobject = new THREE.DirectionalLight( data.color, data.intensity );\r\n\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase 'PointLight':\r\n\r\n\t\t\t\t\tobject = new THREE.PointLight( data.color, data.intensity, data.distance, data.decay );\r\n\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase 'SpotLight':\r\n\r\n\t\t\t\t\tobject = new THREE.SpotLight( data.color, data.intensity, data.distance, data.angle, data.exponent, data.decay );\r\n\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase 'HemisphereLight':\r\n\r\n\t\t\t\t\tobject = new THREE.HemisphereLight( data.color, data.groundColor, data.intensity );\r\n\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase 'Mesh':\r\n\r\n\t\t\t\t\tobject = new THREE.Mesh( getGeometry( data.geometry ), getMaterial( data.material ) );\r\n\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase 'LOD':\r\n\r\n\t\t\t\t\tobject = new THREE.LOD();\r\n\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase 'Line':\r\n\r\n\t\t\t\t\tobject = new THREE.Line( getGeometry( data.geometry ), getMaterial( data.material ), data.mode );\r\n\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase 'PointCloud':\r\n\t\t\t\tcase 'Points':\r\n\r\n\t\t\t\t\tobject = new THREE.Points( getGeometry( data.geometry ), getMaterial( data.material ) );\r\n\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase 'Sprite':\r\n\r\n\t\t\t\t\tobject = new THREE.Sprite( getMaterial( data.material ) );\r\n\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase 'Group':\r\n\r\n\t\t\t\t\tobject = new THREE.Group();\r\n\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tdefault:\r\n\r\n\t\t\t\t\tobject = new THREE.Object3D();\r\n\r\n\t\t\t}\r\n\r\n\t\t\tobject.uuid = data.uuid;\r\n\r\n\t\t\tif ( data.name !== undefined ) object.name = data.name;\r\n\t\t\tif ( data.matrix !== undefined ) {\r\n\r\n\t\t\t\tmatrix.fromArray( data.matrix );\r\n\t\t\t\tmatrix.decompose( object.position, object.quaternion, object.scale );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tif ( data.position !== undefined ) object.position.fromArray( data.position );\r\n\t\t\t\tif ( data.rotation !== undefined ) object.rotation.fromArray( data.rotation );\r\n\t\t\t\tif ( data.scale !== undefined ) object.scale.fromArray( data.scale );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( data.castShadow !== undefined ) object.castShadow = data.castShadow;\r\n\t\t\tif ( data.receiveShadow !== undefined ) object.receiveShadow = data.receiveShadow;\r\n\r\n\t\t\tif ( data.visible !== undefined ) object.visible = data.visible;\r\n\t\t\tif ( data.userData !== undefined ) object.userData = data.userData;\r\n\r\n\t\t\tif ( data.children !== undefined ) {\r\n\r\n\t\t\t\tfor ( var child in data.children ) {\r\n\r\n\t\t\t\t\tobject.add( this.parseObject( data.children[ child ], geometries, materials ) );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( data.type === 'LOD' ) {\r\n\r\n\t\t\t\tvar levels = data.levels;\r\n\r\n\t\t\t\tfor ( var l = 0; l < levels.length; l ++ ) {\r\n\r\n\t\t\t\t\tvar level = levels[ l ];\r\n\t\t\t\t\tvar child = object.getObjectByProperty( 'uuid', level.object );\r\n\r\n\t\t\t\t\tif ( child !== undefined ) {\r\n\r\n\t\t\t\t\t\tobject.addLevel( child, level.distance );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\treturn object;\r\n\r\n\t\t}\r\n\r\n\t}()\r\n\r\n};\r\n\r\n// File:src/loaders/TextureLoader.js\r\n\r\n/**\r\n * @author mrdoob / http://mrdoob.com/\r\n */\r\n\r\nTHREE.TextureLoader = function ( manager ) {\r\n\r\n\tthis.manager = ( manager !== undefined ) ? manager : THREE.DefaultLoadingManager;\r\n\r\n};\r\n\r\nTHREE.TextureLoader.prototype = {\r\n\r\n\tconstructor: THREE.TextureLoader,\r\n\r\n\tload: function ( url, onLoad, onProgress, onError ) {\r\n\r\n\t\tvar scope = this;\r\n\r\n\t\tvar loader = new THREE.ImageLoader( scope.manager );\r\n\t\tloader.setCrossOrigin( this.crossOrigin );\r\n\t\tloader.load( url, function ( image ) {\r\n\r\n\t\t\tvar texture = new THREE.Texture( image );\r\n\t\t\ttexture.needsUpdate = true;\r\n\r\n\t\t\tif ( onLoad !== undefined ) {\r\n\r\n\t\t\t\tonLoad( texture );\r\n\r\n\t\t\t}\r\n\r\n\t\t}, onProgress, onError );\r\n\r\n\t},\r\n\r\n\tsetCrossOrigin: function ( value ) {\r\n\r\n\t\tthis.crossOrigin = value;\r\n\r\n\t}\r\n\r\n};\r\n\r\n// File:src/loaders/BinaryTextureLoader.js\r\n\r\n/**\r\n * @author Nikos M. / https://github.com/foo123/\r\n *\r\n * Abstract Base class to load generic binary textures formats (rgbe, hdr, ...)\r\n */\r\n\r\nTHREE.DataTextureLoader = THREE.BinaryTextureLoader = function ( manager ) {\r\n\r\n\tthis.manager = ( manager !== undefined ) ? manager : THREE.DefaultLoadingManager;\r\n\r\n\t// override in sub classes\r\n\tthis._parser = null;\r\n\r\n};\r\n\r\nTHREE.BinaryTextureLoader.prototype = {\r\n\r\n\tconstructor: THREE.BinaryTextureLoader,\r\n\r\n\tload: function ( url, onLoad, onProgress, onError ) {\r\n\r\n\t\tvar scope = this;\r\n\r\n\t\tvar texture = new THREE.DataTexture();\r\n\r\n\t\tvar loader = new THREE.XHRLoader( this.manager );\r\n\t\tloader.setCrossOrigin( this.crossOrigin );\r\n\t\tloader.setResponseType( 'arraybuffer' );\r\n\r\n\t\tloader.load( url, function ( buffer ) {\r\n\r\n\t\t\tvar texData = scope._parser( buffer );\r\n\r\n\t\t\tif ( ! texData ) return;\r\n\r\n\t\t\tif ( undefined !== texData.image ) {\r\n\r\n\t\t\t\ttexture.image = texData.image;\r\n\r\n\t\t\t} else if ( undefined !== texData.data ) {\r\n\r\n\t\t\t\ttexture.image.width = texData.width;\r\n\t\t\t\ttexture.image.height = texData.height;\r\n\t\t\t\ttexture.image.data = texData.data;\r\n\r\n\t\t\t}\r\n\r\n\t\t\ttexture.wrapS = undefined !== texData.wrapS ? texData.wrapS : THREE.ClampToEdgeWrapping;\r\n\t\t\ttexture.wrapT = undefined !== texData.wrapT ? texData.wrapT : THREE.ClampToEdgeWrapping;\r\n\r\n\t\t\ttexture.magFilter = undefined !== texData.magFilter ? texData.magFilter : THREE.LinearFilter;\r\n\t\t\ttexture.minFilter = undefined !== texData.minFilter ? texData.minFilter : THREE.LinearMipMapLinearFilter;\r\n\r\n\t\t\ttexture.anisotropy = undefined !== texData.anisotropy ? texData.anisotropy : 1;\r\n\r\n\t\t\tif ( undefined !== texData.format ) {\r\n\r\n\t\t\t\ttexture.format = texData.format;\r\n\r\n\t\t\t}\r\n\t\t\tif ( undefined !== texData.type ) {\r\n\r\n\t\t\t\ttexture.type = texData.type;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( undefined !== texData.mipmaps ) {\r\n\r\n\t\t\t\ttexture.mipmaps = texData.mipmaps;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( 1 === texData.mipmapCount ) {\r\n\r\n\t\t\t\ttexture.minFilter = THREE.LinearFilter;\r\n\r\n\t\t\t}\r\n\r\n\t\t\ttexture.needsUpdate = true;\r\n\r\n\t\t\tif ( onLoad ) onLoad( texture, texData );\r\n\r\n\t\t}, onProgress, onError );\r\n\r\n\r\n\t\treturn texture;\r\n\r\n\t},\r\n\r\n\tsetCrossOrigin: function ( value ) {\r\n\r\n\t\tthis.crossOrigin = value;\r\n\r\n\t}\r\n\r\n};\r\n\r\n// File:src/loaders/CompressedTextureLoader.js\r\n\r\n/**\r\n * @author mrdoob / http://mrdoob.com/\r\n *\r\n * Abstract Base class to block based textures loader (dds, pvr, ...)\r\n */\r\n\r\nTHREE.CompressedTextureLoader = function ( manager ) {\r\n\r\n\tthis.manager = ( manager !== undefined ) ? manager : THREE.DefaultLoadingManager;\r\n\r\n\t// override in sub classes\r\n\tthis._parser = null;\r\n\r\n};\r\n\r\n\r\nTHREE.CompressedTextureLoader.prototype = {\r\n\r\n\tconstructor: THREE.CompressedTextureLoader,\r\n\r\n\tload: function ( url, onLoad, onProgress, onError ) {\r\n\r\n\t\tvar scope = this;\r\n\r\n\t\tvar images = [];\r\n\r\n\t\tvar texture = new THREE.CompressedTexture();\r\n\t\ttexture.image = images;\r\n\r\n\t\tvar loader = new THREE.XHRLoader( this.manager );\r\n\t\tloader.setCrossOrigin( this.crossOrigin );\r\n\t\tloader.setResponseType( 'arraybuffer' );\r\n\r\n\t\tif ( Array.isArray( url ) ) {\r\n\r\n\t\t\tvar loaded = 0;\r\n\r\n\t\t\tvar loadTexture = function ( i ) {\r\n\r\n\t\t\t\tloader.load( url[ i ], function ( buffer ) {\r\n\r\n\t\t\t\t\tvar texDatas = scope._parser( buffer, true );\r\n\r\n\t\t\t\t\timages[ i ] = {\r\n\t\t\t\t\t\twidth: texDatas.width,\r\n\t\t\t\t\t\theight: texDatas.height,\r\n\t\t\t\t\t\tformat: texDatas.format,\r\n\t\t\t\t\t\tmipmaps: texDatas.mipmaps\r\n\t\t\t\t\t};\r\n\r\n\t\t\t\t\tloaded += 1;\r\n\r\n\t\t\t\t\tif ( loaded === 6 ) {\r\n\r\n\t\t\t\t\t\tif ( texDatas.mipmapCount === 1 )\r\n \t\t\t\t\t\t\ttexture.minFilter = THREE.LinearFilter;\r\n\r\n\t\t\t\t\t\ttexture.format = texDatas.format;\r\n\t\t\t\t\t\ttexture.needsUpdate = true;\r\n\r\n\t\t\t\t\t\tif ( onLoad ) onLoad( texture );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}, onProgress, onError );\r\n\r\n\t\t\t};\r\n\r\n\t\t\tfor ( var i = 0, il = url.length; i < il; ++ i ) {\r\n\r\n\t\t\t\tloadTexture( i );\r\n\r\n\t\t\t}\r\n\r\n\t\t} else {\r\n\r\n\t\t\t// compressed cubemap texture stored in a single DDS file\r\n\r\n\t\t\tloader.load( url, function ( buffer ) {\r\n\r\n\t\t\t\tvar texDatas = scope._parser( buffer, true );\r\n\r\n\t\t\t\tif ( texDatas.isCubemap ) {\r\n\r\n\t\t\t\t\tvar faces = texDatas.mipmaps.length / texDatas.mipmapCount;\r\n\r\n\t\t\t\t\tfor ( var f = 0; f < faces; f ++ ) {\r\n\r\n\t\t\t\t\t\timages[ f ] = { mipmaps : [] };\r\n\r\n\t\t\t\t\t\tfor ( var i = 0; i < texDatas.mipmapCount; i ++ ) {\r\n\r\n\t\t\t\t\t\t\timages[ f ].mipmaps.push( texDatas.mipmaps[ f * texDatas.mipmapCount + i ] );\r\n\t\t\t\t\t\t\timages[ f ].format = texDatas.format;\r\n\t\t\t\t\t\t\timages[ f ].width = texDatas.width;\r\n\t\t\t\t\t\t\timages[ f ].height = texDatas.height;\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\ttexture.image.width = texDatas.width;\r\n\t\t\t\t\ttexture.image.height = texDatas.height;\r\n\t\t\t\t\ttexture.mipmaps = texDatas.mipmaps;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif ( texDatas.mipmapCount === 1 ) {\r\n\r\n\t\t\t\t\ttexture.minFilter = THREE.LinearFilter;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\ttexture.format = texDatas.format;\r\n\t\t\t\ttexture.needsUpdate = true;\r\n\r\n\t\t\t\tif ( onLoad ) onLoad( texture );\r\n\r\n\t\t\t}, onProgress, onError );\r\n\r\n\t\t}\r\n\r\n\t\treturn texture;\r\n\r\n\t},\r\n\r\n\tsetCrossOrigin: function ( value ) {\r\n\r\n\t\tthis.crossOrigin = value;\r\n\r\n\t}\r\n\r\n};\r\n\r\n// File:src/materials/Material.js\r\n\r\n/**\r\n * @author mrdoob / http://mrdoob.com/\r\n * @author alteredq / http://alteredqualia.com/\r\n */\r\n\r\nTHREE.Material = function () {\r\n\r\n\tObject.defineProperty( this, 'id', { value: THREE.MaterialIdCount ++ } );\r\n\r\n\tthis.uuid = THREE.Math.generateUUID();\r\n\r\n\tthis.name = '';\r\n\tthis.type = 'Material';\r\n\r\n\tthis.side = THREE.FrontSide;\r\n\r\n\tthis.opacity = 1;\r\n\tthis.transparent = false;\r\n\r\n\tthis.blending = THREE.NormalBlending;\r\n\r\n\tthis.blendSrc = THREE.SrcAlphaFactor;\r\n\tthis.blendDst = THREE.OneMinusSrcAlphaFactor;\r\n\tthis.blendEquation = THREE.AddEquation;\r\n\tthis.blendSrcAlpha = null;\r\n\tthis.blendDstAlpha = null;\r\n\tthis.blendEquationAlpha = null;\r\n\r\n\tthis.depthFunc = THREE.LessEqualDepth;\r\n\tthis.depthTest = true;\r\n\tthis.depthWrite = true;\r\n\r\n\tthis.colorWrite = true;\r\n\r\n\tthis.precision = null; // override the renderer's default precision for this material\r\n\r\n\tthis.polygonOffset = false;\r\n\tthis.polygonOffsetFactor = 0;\r\n\tthis.polygonOffsetUnits = 0;\r\n\r\n\tthis.alphaTest = 0;\r\n\r\n\tthis.overdraw = 0; // Overdrawn pixels (typically between 0 and 1) for fixing antialiasing gaps in CanvasRenderer\r\n\r\n\tthis.visible = true;\r\n\r\n\tthis._needsUpdate = true;\r\n\r\n};\r\n\r\nTHREE.Material.prototype = {\r\n\r\n\tconstructor: THREE.Material,\r\n\r\n\tget needsUpdate () {\r\n\r\n\t\treturn this._needsUpdate;\r\n\r\n\t},\r\n\r\n\tset needsUpdate ( value ) {\r\n\r\n\t\tif ( value === true ) this.update();\r\n\r\n\t\tthis._needsUpdate = value;\r\n\r\n\t},\r\n\r\n\tsetValues: function ( values ) {\r\n\r\n\t\tif ( values === undefined ) return;\r\n\r\n\t\tfor ( var key in values ) {\r\n\r\n\t\t\tvar newValue = values[ key ];\r\n\r\n\t\t\tif ( newValue === undefined ) {\r\n\r\n\t\t\t\tconsole.warn( \"THREE.Material: '\" + key + \"' parameter is undefined.\" );\r\n\t\t\t\tcontinue;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tvar currentValue = this[ key ];\r\n\r\n\t\t\tif ( currentValue === undefined ) {\r\n\r\n\t\t\t\tconsole.warn( \"THREE.\" + this.type + \": '\" + key + \"' is not a property of this material.\" );\r\n\t\t\t\tcontinue;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( currentValue instanceof THREE.Color ) {\r\n\r\n\t\t\t\tcurrentValue.set( newValue );\r\n\r\n\t\t\t} else if ( currentValue instanceof THREE.Vector3 && newValue instanceof THREE.Vector3 ) {\r\n\r\n\t\t\t\tcurrentValue.copy( newValue );\r\n\r\n\t\t\t} else if ( key === 'overdraw' ) {\r\n\r\n\t\t\t\t// ensure overdraw is backwards-compatible with legacy boolean type\r\n\t\t\t\tthis[ key ] = Number( newValue );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tthis[ key ] = newValue;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t},\r\n\r\n\ttoJSON: function ( meta ) {\r\n\r\n\t\tvar data = {\r\n\t\t\tmetadata: {\r\n\t\t\t\tversion: 4.4,\r\n\t\t\t\ttype: 'Material',\r\n\t\t\t\tgenerator: 'Material.toJSON'\r\n\t\t\t}\r\n\t\t};\r\n\r\n\t\t// standard Material serialization\r\n\t\tdata.uuid = this.uuid;\r\n\t\tdata.type = this.type;\r\n\t\tif ( this.name !== '' ) data.name = this.name;\r\n\r\n\t\tif ( this.color instanceof THREE.Color ) data.color = this.color.getHex();\r\n\t\tif ( this.emissive instanceof THREE.Color ) data.emissive = this.emissive.getHex();\r\n\t\tif ( this.specular instanceof THREE.Color ) data.specular = this.specular.getHex();\r\n\t\tif ( this.shininess !== undefined ) data.shininess = this.shininess;\r\n\r\n\t\tif ( this.map instanceof THREE.Texture ) data.map = this.map.toJSON( meta ).uuid;\r\n\t\tif ( this.alphaMap instanceof THREE.Texture ) data.alphaMap = this.alphaMap.toJSON( meta ).uuid;\r\n\t\tif ( this.lightMap instanceof THREE.Texture ) data.lightMap = this.lightMap.toJSON( meta ).uuid;\r\n\t\tif ( this.bumpMap instanceof THREE.Texture ) {\r\n\r\n\t\t\tdata.bumpMap = this.bumpMap.toJSON( meta ).uuid;\r\n\t\t\tdata.bumpScale = this.bumpScale;\r\n\r\n\t\t}\r\n\t\tif ( this.normalMap instanceof THREE.Texture ) {\r\n\r\n\t\t\tdata.normalMap = this.normalMap.toJSON( meta ).uuid;\r\n\t\t\tdata.normalScale = this.normalScale; // Removed for now, causes issue in editor ui.js\r\n\r\n\t\t}\r\n\t\tif ( this.displacementMap instanceof THREE.Texture ) {\r\n\r\n\t\t\tdata.displacementMap = this.displacementMap.toJSON( meta ).uuid;\r\n\t\t\tdata.displacementScale = this.displacementScale;\r\n\t\t\tdata.displacementBias = this.displacementBias;\r\n\r\n\t\t}\r\n\t\tif ( this.specularMap instanceof THREE.Texture ) data.specularMap = this.specularMap.toJSON( meta ).uuid;\r\n\t\tif ( this.envMap instanceof THREE.Texture ) {\r\n\r\n\t\t\tdata.envMap = this.envMap.toJSON( meta ).uuid;\r\n\t\t\tdata.reflectivity = this.reflectivity; // Scale behind envMap\r\n\r\n\t\t}\r\n\r\n\t\tif ( this.size !== undefined ) data.size = this.size;\r\n\t\tif ( this.sizeAttenuation !== undefined ) data.sizeAttenuation = this.sizeAttenuation;\r\n\r\n\t\tif ( this.vertexColors !== undefined && this.vertexColors !== THREE.NoColors ) data.vertexColors = this.vertexColors;\r\n\t\tif ( this.shading !== undefined && this.shading !== THREE.SmoothShading ) data.shading = this.shading;\r\n\t\tif ( this.blending !== undefined && this.blending !== THREE.NormalBlending ) data.blending = this.blending;\r\n\t\tif ( this.side !== undefined && this.side !== THREE.FrontSide ) data.side = this.side;\r\n\r\n\t\tif ( this.opacity < 1 ) data.opacity = this.opacity;\r\n\t\tif ( this.transparent === true ) data.transparent = this.transparent;\r\n\t\tif ( this.alphaTest > 0 ) data.alphaTest = this.alphaTest;\r\n\t\tif ( this.wireframe === true ) data.wireframe = this.wireframe;\r\n\t\tif ( this.wireframeLinewidth > 1 ) data.wireframeLinewidth = this.wireframeLinewidth;\r\n\r\n\t\treturn data;\r\n\r\n\t},\r\n\r\n\tclone: function () {\r\n\r\n\t\treturn new this.constructor().copy( this );\r\n\r\n\t},\r\n\r\n\tcopy: function ( source ) {\r\n\r\n\t\tthis.name = source.name;\r\n\r\n\t\tthis.side = source.side;\r\n\r\n\t\tthis.opacity = source.opacity;\r\n\t\tthis.transparent = source.transparent;\r\n\r\n\t\tthis.blending = source.blending;\r\n\r\n\t\tthis.blendSrc = source.blendSrc;\r\n\t\tthis.blendDst = source.blendDst;\r\n\t\tthis.blendEquation = source.blendEquation;\r\n\t\tthis.blendSrcAlpha = source.blendSrcAlpha;\r\n\t\tthis.blendDstAlpha = source.blendDstAlpha;\r\n\t\tthis.blendEquationAlpha = source.blendEquationAlpha;\r\n\r\n\t\tthis.depthFunc = source.depthFunc;\r\n\t\tthis.depthTest = source.depthTest;\r\n\t\tthis.depthWrite = source.depthWrite;\r\n\r\n\t\tthis.precision = source.precision;\r\n\r\n\t\tthis.polygonOffset = source.polygonOffset;\r\n\t\tthis.polygonOffsetFactor = source.polygonOffsetFactor;\r\n\t\tthis.polygonOffsetUnits = source.polygonOffsetUnits;\r\n\r\n\t\tthis.alphaTest = source.alphaTest;\r\n\r\n\t\tthis.overdraw = source.overdraw;\r\n\r\n\t\tthis.visible = source.visible;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tupdate: function () {\r\n\r\n\t\tthis.dispatchEvent( { type: 'update' } );\r\n\r\n\t},\r\n\r\n\tdispose: function () {\r\n\r\n\t\tthis.dispatchEvent( { type: 'dispose' } );\r\n\r\n\t},\r\n\r\n\t// Deprecated\r\n\r\n\tget wrapAround () {\r\n\r\n\t\tconsole.warn( 'THREE.' + this.type + ': .wrapAround has been removed.' );\r\n\r\n\t},\r\n\r\n\tset wrapAround ( boolean ) {\r\n\r\n\t\tconsole.warn( 'THREE.' + this.type + ': .wrapAround has been removed.' );\r\n\r\n\t},\r\n\r\n\tget wrapRGB () {\r\n\r\n\t\tconsole.warn( 'THREE.' + this.type + ': .wrapRGB has been removed.' );\r\n\t\treturn new THREE.Color();\r\n\r\n\t}\r\n\r\n};\r\n\r\nTHREE.EventDispatcher.prototype.apply( THREE.Material.prototype );\r\n\r\nTHREE.MaterialIdCount = 0;\r\n\r\n// File:src/materials/LineBasicMaterial.js\r\n\r\n/**\r\n * @author mrdoob / http://mrdoob.com/\r\n * @author alteredq / http://alteredqualia.com/\r\n *\r\n * parameters = {\r\n * color: ,\r\n * opacity: ,\r\n *\r\n * blending: THREE.NormalBlending,\r\n * depthTest: ,\r\n * depthWrite: ,\r\n *\r\n * linewidth: ,\r\n * linecap: \"round\",\r\n * linejoin: \"round\",\r\n *\r\n * vertexColors: \r\n *\r\n * fog: \r\n * }\r\n */\r\n\r\nTHREE.LineBasicMaterial = function ( parameters ) {\r\n\r\n\tTHREE.Material.call( this );\r\n\r\n\tthis.type = 'LineBasicMaterial';\r\n\r\n\tthis.color = new THREE.Color( 0xffffff );\r\n\r\n\tthis.linewidth = 1;\r\n\tthis.linecap = 'round';\r\n\tthis.linejoin = 'round';\r\n\r\n\tthis.vertexColors = THREE.NoColors;\r\n\r\n\tthis.fog = true;\r\n\r\n\tthis.setValues( parameters );\r\n\r\n};\r\n\r\nTHREE.LineBasicMaterial.prototype = Object.create( THREE.Material.prototype );\r\nTHREE.LineBasicMaterial.prototype.constructor = THREE.LineBasicMaterial;\r\n\r\nTHREE.LineBasicMaterial.prototype.copy = function ( source ) {\r\n\r\n\tTHREE.Material.prototype.copy.call( this, source );\r\n\r\n\tthis.color.copy( source.color );\r\n\r\n\tthis.linewidth = source.linewidth;\r\n\tthis.linecap = source.linecap;\r\n\tthis.linejoin = source.linejoin;\r\n\r\n\tthis.vertexColors = source.vertexColors;\r\n\r\n\tthis.fog = source.fog;\r\n\r\n\treturn this;\r\n\r\n};\r\n\r\n// File:src/materials/LineDashedMaterial.js\r\n\r\n/**\r\n * @author alteredq / http://alteredqualia.com/\r\n *\r\n * parameters = {\r\n * color: ,\r\n * opacity: ,\r\n *\r\n * blending: THREE.NormalBlending,\r\n * depthTest: ,\r\n * depthWrite: ,\r\n *\r\n * linewidth: ,\r\n *\r\n * scale: ,\r\n * dashSize: ,\r\n * gapSize: ,\r\n *\r\n * vertexColors: \r\n *\r\n * fog: \r\n * }\r\n */\r\n\r\nTHREE.LineDashedMaterial = function ( parameters ) {\r\n\r\n\tTHREE.Material.call( this );\r\n\r\n\tthis.type = 'LineDashedMaterial';\r\n\r\n\tthis.color = new THREE.Color( 0xffffff );\r\n\r\n\tthis.linewidth = 1;\r\n\r\n\tthis.scale = 1;\r\n\tthis.dashSize = 3;\r\n\tthis.gapSize = 1;\r\n\r\n\tthis.vertexColors = false;\r\n\r\n\tthis.fog = true;\r\n\r\n\tthis.setValues( parameters );\r\n\r\n};\r\n\r\nTHREE.LineDashedMaterial.prototype = Object.create( THREE.Material.prototype );\r\nTHREE.LineDashedMaterial.prototype.constructor = THREE.LineDashedMaterial;\r\n\r\nTHREE.LineDashedMaterial.prototype.copy = function ( source ) {\r\n\r\n\tTHREE.Material.prototype.copy.call( this, source );\r\n\r\n\tthis.color.copy( source.color );\r\n\t\r\n\tthis.linewidth = source.linewidth;\r\n\r\n\tthis.scale = source.scale;\r\n\tthis.dashSize = source.dashSize;\r\n\tthis.gapSize = source.gapSize;\r\n\r\n\tthis.vertexColors = source.vertexColors;\r\n\r\n\tthis.fog = source.fog;\r\n\r\n\treturn this;\r\n\r\n};\r\n\r\n// File:src/materials/MeshBasicMaterial.js\r\n\r\n/**\r\n * @author mrdoob / http://mrdoob.com/\r\n * @author alteredq / http://alteredqualia.com/\r\n *\r\n * parameters = {\r\n * color: ,\r\n * opacity: ,\r\n * map: new THREE.Texture( ),\r\n *\r\n * aoMap: new THREE.Texture( ),\r\n * aoMapIntensity: \r\n *\r\n * specularMap: new THREE.Texture( ),\r\n *\r\n * alphaMap: new THREE.Texture( ),\r\n *\r\n * envMap: new THREE.TextureCube( [posx, negx, posy, negy, posz, negz] ),\r\n * combine: THREE.Multiply,\r\n * reflectivity: ,\r\n * refractionRatio: ,\r\n *\r\n * shading: THREE.SmoothShading,\r\n * blending: THREE.NormalBlending,\r\n * depthTest: ,\r\n * depthWrite: ,\r\n *\r\n * wireframe: ,\r\n * wireframeLinewidth: ,\r\n *\r\n * vertexColors: THREE.NoColors / THREE.VertexColors / THREE.FaceColors,\r\n *\r\n * skinning: ,\r\n * morphTargets: ,\r\n *\r\n * fog: \r\n * }\r\n */\r\n\r\nTHREE.MeshBasicMaterial = function ( parameters ) {\r\n\r\n\tTHREE.Material.call( this );\r\n\r\n\tthis.type = 'MeshBasicMaterial';\r\n\r\n\tthis.color = new THREE.Color( 0xffffff ); // emissive\r\n\r\n\tthis.map = null;\r\n\r\n\tthis.aoMap = null;\r\n\tthis.aoMapIntensity = 1.0;\r\n\r\n\tthis.specularMap = null;\r\n\r\n\tthis.alphaMap = null;\r\n\r\n\tthis.envMap = null;\r\n\tthis.combine = THREE.MultiplyOperation;\r\n\tthis.reflectivity = 1;\r\n\tthis.refractionRatio = 0.98;\r\n\r\n\tthis.fog = true;\r\n\r\n\tthis.shading = THREE.SmoothShading;\r\n\r\n\tthis.wireframe = false;\r\n\tthis.wireframeLinewidth = 1;\r\n\tthis.wireframeLinecap = 'round';\r\n\tthis.wireframeLinejoin = 'round';\r\n\r\n\tthis.vertexColors = THREE.NoColors;\r\n\r\n\tthis.skinning = false;\r\n\tthis.morphTargets = false;\r\n\r\n\tthis.setValues( parameters );\r\n\r\n};\r\n\r\nTHREE.MeshBasicMaterial.prototype = Object.create( THREE.Material.prototype );\r\nTHREE.MeshBasicMaterial.prototype.constructor = THREE.MeshBasicMaterial;\r\n\r\nTHREE.MeshBasicMaterial.prototype.copy = function ( source ) {\r\n\t\r\n\tTHREE.Material.prototype.copy.call( this, source );\r\n\r\n\tthis.color.copy( source.color );\r\n\r\n\tthis.map = source.map;\r\n\r\n\tthis.aoMap = source.aoMap;\r\n\tthis.aoMapIntensity = source.aoMapIntensity;\r\n\r\n\tthis.specularMap = source.specularMap;\r\n\r\n\tthis.alphaMap = source.alphaMap;\r\n\r\n\tthis.envMap = source.envMap;\r\n\tthis.combine = source.combine;\r\n\tthis.reflectivity = source.reflectivity;\r\n\tthis.refractionRatio = source.refractionRatio;\r\n\r\n\tthis.fog = source.fog;\r\n\r\n\tthis.shading = source.shading;\r\n\r\n\tthis.wireframe = source.wireframe;\r\n\tthis.wireframeLinewidth = source.wireframeLinewidth;\r\n\tthis.wireframeLinecap = source.wireframeLinecap;\r\n\tthis.wireframeLinejoin = source.wireframeLinejoin;\r\n\r\n\tthis.vertexColors = source.vertexColors;\r\n\r\n\tthis.skinning = source.skinning;\r\n\tthis.morphTargets = source.morphTargets;\r\n\t\r\n\treturn this;\r\n\r\n};\r\n\r\n// File:src/materials/MeshLambertMaterial.js\r\n\r\n/**\r\n * @author mrdoob / http://mrdoob.com/\r\n * @author alteredq / http://alteredqualia.com/\r\n *\r\n * parameters = {\r\n * color: ,\r\n * emissive: ,\r\n * opacity: ,\r\n *\r\n * map: new THREE.Texture( ),\r\n *\r\n * specularMap: new THREE.Texture( ),\r\n *\r\n * alphaMap: new THREE.Texture( ),\r\n *\r\n * envMap: new THREE.TextureCube( [posx, negx, posy, negy, posz, negz] ),\r\n * combine: THREE.Multiply,\r\n * reflectivity: ,\r\n * refractionRatio: ,\r\n *\r\n * blending: THREE.NormalBlending,\r\n * depthTest: ,\r\n * depthWrite: ,\r\n *\r\n * wireframe: ,\r\n * wireframeLinewidth: ,\r\n *\r\n * vertexColors: THREE.NoColors / THREE.VertexColors / THREE.FaceColors,\r\n *\r\n * skinning: ,\r\n * morphTargets: ,\r\n * morphNormals: ,\r\n *\r\n *\tfog: \r\n * }\r\n */\r\n\r\nTHREE.MeshLambertMaterial = function ( parameters ) {\r\n\r\n\tTHREE.Material.call( this );\r\n\r\n\tthis.type = 'MeshLambertMaterial';\r\n\r\n\tthis.color = new THREE.Color( 0xffffff ); // diffuse\r\n\tthis.emissive = new THREE.Color( 0x000000 );\r\n\r\n\tthis.map = null;\r\n\r\n\tthis.specularMap = null;\r\n\r\n\tthis.alphaMap = null;\r\n\r\n\tthis.envMap = null;\r\n\tthis.combine = THREE.MultiplyOperation;\r\n\tthis.reflectivity = 1;\r\n\tthis.refractionRatio = 0.98;\r\n\r\n\tthis.fog = true;\r\n\r\n\tthis.wireframe = false;\r\n\tthis.wireframeLinewidth = 1;\r\n\tthis.wireframeLinecap = 'round';\r\n\tthis.wireframeLinejoin = 'round';\r\n\r\n\tthis.vertexColors = THREE.NoColors;\r\n\r\n\tthis.skinning = false;\r\n\tthis.morphTargets = false;\r\n\tthis.morphNormals = false;\r\n\r\n\tthis.setValues( parameters );\r\n\r\n};\r\n\r\nTHREE.MeshLambertMaterial.prototype = Object.create( THREE.Material.prototype );\r\nTHREE.MeshLambertMaterial.prototype.constructor = THREE.MeshLambertMaterial;\r\n\r\nTHREE.MeshLambertMaterial.prototype.copy = function ( source ) {\r\n\r\n\tTHREE.Material.prototype.copy.call( this, source );\r\n\r\n\tthis.color.copy( source.color );\r\n\tthis.emissive.copy( source.emissive );\r\n\r\n\tthis.map = source.map;\r\n\r\n\tthis.specularMap = source.specularMap;\r\n\r\n\tthis.alphaMap = source.alphaMap;\r\n\r\n\tthis.envMap = source.envMap;\r\n\tthis.combine = source.combine;\r\n\tthis.reflectivity = source.reflectivity;\r\n\tthis.refractionRatio = source.refractionRatio;\r\n\r\n\tthis.fog = source.fog;\r\n\r\n\tthis.wireframe = source.wireframe;\r\n\tthis.wireframeLinewidth = source.wireframeLinewidth;\r\n\tthis.wireframeLinecap = source.wireframeLinecap;\r\n\tthis.wireframeLinejoin = source.wireframeLinejoin;\r\n\r\n\tthis.vertexColors = source.vertexColors;\r\n\r\n\tthis.skinning = source.skinning;\r\n\tthis.morphTargets = source.morphTargets;\r\n\tthis.morphNormals = source.morphNormals;\r\n\r\n\treturn this;\r\n\r\n};\r\n\r\n// File:src/materials/MeshPhongMaterial.js\r\n\r\n/**\r\n * @author mrdoob / http://mrdoob.com/\r\n * @author alteredq / http://alteredqualia.com/\r\n *\r\n * parameters = {\r\n * color: ,\r\n * emissive: ,\r\n * specular: ,\r\n * shininess: ,\r\n * opacity: ,\r\n *\r\n * map: new THREE.Texture( ),\r\n *\r\n * lightMap: new THREE.Texture( ),\r\n * lightMapIntensity: \r\n *\r\n * aoMap: new THREE.Texture( ),\r\n * aoMapIntensity: \r\n *\r\n * emissiveMap: new THREE.Texture( ),\r\n *\r\n * bumpMap: new THREE.Texture( ),\r\n * bumpScale: ,\r\n *\r\n * normalMap: new THREE.Texture( ),\r\n * normalScale: ,\r\n *\r\n * displacementMap: new THREE.Texture( ),\r\n * displacementScale: ,\r\n * displacementBias: ,\r\n *\r\n * specularMap: new THREE.Texture( ),\r\n *\r\n * alphaMap: new THREE.Texture( ),\r\n *\r\n * envMap: new THREE.TextureCube( [posx, negx, posy, negy, posz, negz] ),\r\n * combine: THREE.Multiply,\r\n * reflectivity: ,\r\n * refractionRatio: ,\r\n *\r\n * shading: THREE.SmoothShading,\r\n * blending: THREE.NormalBlending,\r\n * depthTest: ,\r\n * depthWrite: ,\r\n *\r\n * wireframe: ,\r\n * wireframeLinewidth: ,\r\n *\r\n * vertexColors: THREE.NoColors / THREE.VertexColors / THREE.FaceColors,\r\n *\r\n * skinning: ,\r\n * morphTargets: ,\r\n * morphNormals: ,\r\n *\r\n *\tfog: \r\n * }\r\n */\r\n\r\nTHREE.MeshPhongMaterial = function ( parameters ) {\r\n\r\n\tTHREE.Material.call( this );\r\n\r\n\tthis.type = 'MeshPhongMaterial';\r\n\r\n\tthis.color = new THREE.Color( 0xffffff ); // diffuse\r\n\tthis.emissive = new THREE.Color( 0x000000 );\r\n\tthis.specular = new THREE.Color( 0x111111 );\r\n\tthis.shininess = 30;\r\n\r\n\tthis.metal = false;\r\n\r\n\tthis.map = null;\r\n\r\n\tthis.lightMap = null;\r\n\tthis.lightMapIntensity = 1.0;\r\n\r\n\tthis.aoMap = null;\r\n\tthis.aoMapIntensity = 1.0;\r\n\r\n\tthis.emissiveMap = null;\r\n\r\n\tthis.bumpMap = null;\r\n\tthis.bumpScale = 1;\r\n\r\n\tthis.normalMap = null;\r\n\tthis.normalScale = new THREE.Vector2( 1, 1 );\r\n\r\n\tthis.displacementMap = null;\r\n\tthis.displacementScale = 1;\r\n\tthis.displacementBias = 0;\r\n\r\n\tthis.specularMap = null;\r\n\r\n\tthis.alphaMap = null;\r\n\r\n\tthis.envMap = null;\r\n\tthis.combine = THREE.MultiplyOperation;\r\n\tthis.reflectivity = 1;\r\n\tthis.refractionRatio = 0.98;\r\n\r\n\tthis.fog = true;\r\n\r\n\tthis.shading = THREE.SmoothShading;\r\n\r\n\tthis.wireframe = false;\r\n\tthis.wireframeLinewidth = 1;\r\n\tthis.wireframeLinecap = 'round';\r\n\tthis.wireframeLinejoin = 'round';\r\n\r\n\tthis.vertexColors = THREE.NoColors;\r\n\r\n\tthis.skinning = false;\r\n\tthis.morphTargets = false;\r\n\tthis.morphNormals = false;\r\n\r\n\tthis.setValues( parameters );\r\n\r\n};\r\n\r\nTHREE.MeshPhongMaterial.prototype = Object.create( THREE.Material.prototype );\r\nTHREE.MeshPhongMaterial.prototype.constructor = THREE.MeshPhongMaterial;\r\n\r\nTHREE.MeshPhongMaterial.prototype.copy = function ( source ) {\r\n\r\n\tTHREE.Material.prototype.copy.call( this, source );\r\n\r\n\tthis.color.copy( source.color );\r\n\tthis.emissive.copy( source.emissive );\r\n\tthis.specular.copy( source.specular );\r\n\tthis.shininess = source.shininess;\r\n\r\n\tthis.metal = source.metal;\r\n\r\n\tthis.map = source.map;\r\n\r\n\tthis.lightMap = source.lightMap;\r\n\tthis.lightMapIntensity = source.lightMapIntensity;\r\n\r\n\tthis.aoMap = source.aoMap;\r\n\tthis.aoMapIntensity = source.aoMapIntensity;\r\n\r\n\tthis.emissiveMap = source.emissiveMap;\r\n\r\n\tthis.bumpMap = source.bumpMap;\r\n\tthis.bumpScale = source.bumpScale;\r\n\r\n\tthis.normalMap = source.normalMap;\r\n\tthis.normalScale.copy( source.normalScale );\r\n\r\n\tthis.displacementMap = source.displacementMap;\r\n\tthis.displacementScale = source.displacementScale;\r\n\tthis.displacementBias = source.displacementBias;\r\n\r\n\tthis.specularMap = source.specularMap;\r\n\r\n\tthis.alphaMap = source.alphaMap;\r\n\r\n\tthis.envMap = source.envMap;\r\n\tthis.combine = source.combine;\r\n\tthis.reflectivity = source.reflectivity;\r\n\tthis.refractionRatio = source.refractionRatio;\r\n\r\n\tthis.fog = source.fog;\r\n\r\n\tthis.shading = source.shading;\r\n\r\n\tthis.wireframe = source.wireframe;\r\n\tthis.wireframeLinewidth = source.wireframeLinewidth;\r\n\tthis.wireframeLinecap = source.wireframeLinecap;\r\n\tthis.wireframeLinejoin = source.wireframeLinejoin;\r\n\r\n\tthis.vertexColors = source.vertexColors;\r\n\r\n\tthis.skinning = source.skinning;\r\n\tthis.morphTargets = source.morphTargets;\r\n\tthis.morphNormals = source.morphNormals;\r\n\r\n\treturn this;\r\n\r\n};\r\n\r\n// File:src/materials/MeshDepthMaterial.js\r\n\r\n/**\r\n * @author mrdoob / http://mrdoob.com/\r\n * @author alteredq / http://alteredqualia.com/\r\n *\r\n * parameters = {\r\n * opacity: ,\r\n *\r\n * blending: THREE.NormalBlending,\r\n * depthTest: ,\r\n * depthWrite: ,\r\n *\r\n * wireframe: ,\r\n * wireframeLinewidth: \r\n * }\r\n */\r\n\r\nTHREE.MeshDepthMaterial = function ( parameters ) {\r\n\r\n\tTHREE.Material.call( this );\r\n\r\n\tthis.type = 'MeshDepthMaterial';\r\n\r\n\tthis.morphTargets = false;\r\n\tthis.wireframe = false;\r\n\tthis.wireframeLinewidth = 1;\r\n\r\n\tthis.setValues( parameters );\r\n\r\n};\r\n\r\nTHREE.MeshDepthMaterial.prototype = Object.create( THREE.Material.prototype );\r\nTHREE.MeshDepthMaterial.prototype.constructor = THREE.MeshDepthMaterial;\r\n\r\nTHREE.MeshDepthMaterial.prototype.copy = function ( source ) {\r\n\r\n\tTHREE.Material.prototype.copy.call( this, source );\r\n\r\n\tthis.wireframe = source.wireframe;\r\n\tthis.wireframeLinewidth = source.wireframeLinewidth;\r\n\r\n\treturn this;\r\n\r\n};\r\n\r\n// File:src/materials/MeshNormalMaterial.js\r\n\r\n/**\r\n * @author mrdoob / http://mrdoob.com/\r\n *\r\n * parameters = {\r\n * opacity: ,\r\n *\r\n * shading: THREE.FlatShading,\r\n * blending: THREE.NormalBlending,\r\n * depthTest: ,\r\n * depthWrite: ,\r\n *\r\n * wireframe: ,\r\n * wireframeLinewidth: \r\n * }\r\n */\r\n\r\nTHREE.MeshNormalMaterial = function ( parameters ) {\r\n\r\n\tTHREE.Material.call( this, parameters );\r\n\r\n\tthis.type = 'MeshNormalMaterial';\r\n\r\n\tthis.wireframe = false;\r\n\tthis.wireframeLinewidth = 1;\r\n\r\n\tthis.morphTargets = false;\r\n\r\n\tthis.setValues( parameters );\r\n\r\n};\r\n\r\nTHREE.MeshNormalMaterial.prototype = Object.create( THREE.Material.prototype );\r\nTHREE.MeshNormalMaterial.prototype.constructor = THREE.MeshNormalMaterial;\r\n\r\nTHREE.MeshNormalMaterial.prototype.copy = function ( source ) {\r\n\r\n\tTHREE.Material.prototype.copy.call( this, source );\r\n\r\n\tthis.wireframe = source.wireframe;\r\n\tthis.wireframeLinewidth = source.wireframeLinewidth;\r\n\r\n\treturn this;\r\n\r\n};\r\n\r\n// File:src/materials/MultiMaterial.js\r\n\r\n/**\r\n * @author mrdoob / http://mrdoob.com/\r\n */\r\n\r\nTHREE.MultiMaterial = function ( materials ) {\r\n\r\n\tthis.uuid = THREE.Math.generateUUID();\r\n\r\n\tthis.type = 'MultiMaterial';\r\n\r\n\tthis.materials = materials instanceof Array ? materials : [];\r\n\r\n\tthis.visible = true;\r\n\r\n};\r\n\r\nTHREE.MultiMaterial.prototype = {\r\n\r\n\tconstructor: THREE.MultiMaterial,\r\n\r\n\ttoJSON: function () {\r\n\r\n\t\tvar output = {\r\n\t\t\tmetadata: {\r\n\t\t\t\tversion: 4.2,\r\n\t\t\t\ttype: 'material',\r\n\t\t\t\tgenerator: 'MaterialExporter'\r\n\t\t\t},\r\n\t\t\tuuid: this.uuid,\r\n\t\t\ttype: this.type,\r\n\t\t\tmaterials: []\r\n\t\t};\r\n\r\n\t\tfor ( var i = 0, l = this.materials.length; i < l; i ++ ) {\r\n\r\n\t\t\toutput.materials.push( this.materials[ i ].toJSON() );\r\n\r\n\t\t}\r\n\r\n\t\toutput.visible = this.visible;\r\n\r\n\t\treturn output;\r\n\r\n\t},\r\n\r\n\tclone: function () {\r\n\r\n\t\tvar material = new this.constructor();\r\n\r\n\t\tfor ( var i = 0; i < this.materials.length; i ++ ) {\r\n\r\n\t\t\tmaterial.materials.push( this.materials[ i ].clone() );\r\n\r\n\t\t}\r\n\r\n\t\tmaterial.visible = this.visible;\r\n\r\n\t\treturn material;\r\n\r\n\t}\r\n\r\n};\r\n\r\n// backwards compatibility\r\n\r\nTHREE.MeshFaceMaterial = THREE.MultiMaterial;\r\n\r\n// File:src/materials/PointsMaterial.js\r\n\r\n/**\r\n * @author mrdoob / http://mrdoob.com/\r\n * @author alteredq / http://alteredqualia.com/\r\n *\r\n * parameters = {\r\n * color: ,\r\n * opacity: ,\r\n * map: new THREE.Texture( ),\r\n *\r\n * size: ,\r\n * sizeAttenuation: ,\r\n *\r\n * blending: THREE.NormalBlending,\r\n * depthTest: ,\r\n * depthWrite: ,\r\n *\r\n * vertexColors: ,\r\n *\r\n * fog: \r\n * }\r\n */\r\n\r\nTHREE.PointsMaterial = function ( parameters ) {\r\n\r\n\tTHREE.Material.call( this );\r\n\r\n\tthis.type = 'PointsMaterial';\r\n\r\n\tthis.color = new THREE.Color( 0xffffff );\r\n\r\n\tthis.map = null;\r\n\r\n\tthis.size = 1;\r\n\tthis.sizeAttenuation = true;\r\n\r\n\tthis.vertexColors = THREE.NoColors;\r\n\r\n\tthis.fog = true;\r\n\r\n\tthis.setValues( parameters );\r\n\r\n};\r\n\r\nTHREE.PointsMaterial.prototype = Object.create( THREE.Material.prototype );\r\nTHREE.PointsMaterial.prototype.constructor = THREE.PointsMaterial;\r\n\r\nTHREE.PointsMaterial.prototype.copy = function ( source ) {\r\n\r\n\tTHREE.Material.prototype.copy.call( this, source );\r\n\r\n\tthis.color.copy( source.color );\r\n\r\n\tthis.map = source.map;\r\n\r\n\tthis.size = source.size;\r\n\tthis.sizeAttenuation = source.sizeAttenuation;\r\n\r\n\tthis.vertexColors = source.vertexColors;\r\n\r\n\tthis.fog = source.fog;\r\n\r\n\treturn this;\r\n\r\n};\r\n\r\n// backwards compatibility\r\n\r\nTHREE.PointCloudMaterial = function ( parameters ) {\r\n\r\n\tconsole.warn( 'THREE.PointCloudMaterial has been renamed to THREE.PointsMaterial.' );\r\n\treturn new THREE.PointsMaterial( parameters );\r\n\r\n};\r\n\r\nTHREE.ParticleBasicMaterial = function ( parameters ) {\r\n\r\n\tconsole.warn( 'THREE.ParticleBasicMaterial has been renamed to THREE.PointsMaterial.' );\r\n\treturn new THREE.PointsMaterial( parameters );\r\n\r\n};\r\n\r\nTHREE.ParticleSystemMaterial = function ( parameters ) {\r\n\r\n\tconsole.warn( 'THREE.ParticleSystemMaterial has been renamed to THREE.PointsMaterial.' );\r\n\treturn new THREE.PointsMaterial( parameters );\r\n\r\n};\r\n\r\n// File:src/materials/ShaderMaterial.js\r\n\r\n/**\r\n * @author alteredq / http://alteredqualia.com/\r\n *\r\n * parameters = {\r\n * defines: { \"label\" : \"value\" },\r\n * uniforms: { \"parameter1\": { type: \"f\", value: 1.0 }, \"parameter2\": { type: \"i\" value2: 2 } },\r\n *\r\n * fragmentShader: ,\r\n * vertexShader: ,\r\n *\r\n * shading: THREE.SmoothShading,\r\n * blending: THREE.NormalBlending,\r\n * depthTest: ,\r\n * depthWrite: ,\r\n *\r\n * wireframe: ,\r\n * wireframeLinewidth: ,\r\n *\r\n * lights: ,\r\n *\r\n * vertexColors: THREE.NoColors / THREE.VertexColors / THREE.FaceColors,\r\n *\r\n * skinning: ,\r\n * morphTargets: ,\r\n * morphNormals: ,\r\n *\r\n *\tfog: \r\n * }\r\n */\r\n\r\nTHREE.ShaderMaterial = function ( parameters ) {\r\n\r\n\tTHREE.Material.call( this );\r\n\r\n\tthis.type = 'ShaderMaterial';\r\n\r\n\tthis.defines = {};\r\n\tthis.uniforms = {};\r\n\r\n\tthis.vertexShader = 'void main() {\\n\\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\\n}';\r\n\tthis.fragmentShader = 'void main() {\\n\\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\\n}';\r\n\r\n\tthis.shading = THREE.SmoothShading;\r\n\r\n\tthis.linewidth = 1;\r\n\r\n\tthis.wireframe = false;\r\n\tthis.wireframeLinewidth = 1;\r\n\r\n\tthis.fog = false; // set to use scene fog\r\n\r\n\tthis.lights = false; // set to use scene lights\r\n\r\n\tthis.vertexColors = THREE.NoColors; // set to use \"color\" attribute stream\r\n\r\n\tthis.skinning = false; // set to use skinning attribute streams\r\n\r\n\tthis.morphTargets = false; // set to use morph targets\r\n\tthis.morphNormals = false; // set to use morph normals\r\n\r\n\tthis.derivatives = false; // set to use derivatives\r\n\r\n\t// When rendered geometry doesn't include these attributes but the material does,\r\n\t// use these default values in WebGL. This avoids errors when buffer data is missing.\r\n\tthis.defaultAttributeValues = {\r\n\t\t'color': [ 1, 1, 1 ],\r\n\t\t'uv': [ 0, 0 ],\r\n\t\t'uv2': [ 0, 0 ]\r\n\t};\r\n\r\n\tthis.index0AttributeName = undefined;\r\n\r\n\tif ( parameters !== undefined ) {\r\n\r\n\t\tif ( parameters.attributes !== undefined ) {\r\n\r\n\t\t\tconsole.error( 'THREE.ShaderMaterial: attributes should now be defined in THREE.BufferGeometry instead.' );\r\n\r\n\t\t}\r\n\r\n\t\tthis.setValues( parameters );\r\n\r\n\t}\r\n\r\n};\r\n\r\nTHREE.ShaderMaterial.prototype = Object.create( THREE.Material.prototype );\r\nTHREE.ShaderMaterial.prototype.constructor = THREE.ShaderMaterial;\r\n\r\nTHREE.ShaderMaterial.prototype.copy = function ( source ) {\r\n\r\n\tTHREE.Material.prototype.copy.call( this, source );\r\n\r\n\tthis.fragmentShader = source.fragmentShader;\r\n\tthis.vertexShader = source.vertexShader;\r\n\r\n\tthis.uniforms = THREE.UniformsUtils.clone( source.uniforms );\r\n\r\n\tthis.attributes = source.attributes;\r\n\tthis.defines = source.defines;\r\n\r\n\tthis.shading = source.shading;\r\n\r\n\tthis.wireframe = source.wireframe;\r\n\tthis.wireframeLinewidth = source.wireframeLinewidth;\r\n\r\n\tthis.fog = source.fog;\r\n\r\n\tthis.lights = source.lights;\r\n\r\n\tthis.vertexColors = source.vertexColors;\r\n\r\n\tthis.skinning = source.skinning;\r\n\r\n\tthis.morphTargets = source.morphTargets;\r\n\tthis.morphNormals = source.morphNormals;\r\n\r\n\tthis.derivatives = source.derivatives;\r\n\r\n\treturn this;\r\n\r\n};\r\n\r\nTHREE.ShaderMaterial.prototype.toJSON = function ( meta ) {\r\n\r\n\tvar data = THREE.Material.prototype.toJSON.call( this, meta );\r\n\r\n\tdata.uniforms = this.uniforms;\r\n\tdata.attributes = this.attributes;\r\n\tdata.vertexShader = this.vertexShader;\r\n\tdata.fragmentShader = this.fragmentShader;\r\n\r\n\treturn data;\r\n\r\n};\r\n\r\n// File:src/materials/RawShaderMaterial.js\r\n\r\n/**\r\n * @author mrdoob / http://mrdoob.com/\r\n */\r\n\r\nTHREE.RawShaderMaterial = function ( parameters ) {\r\n\r\n\tTHREE.ShaderMaterial.call( this, parameters );\r\n\r\n\tthis.type = 'RawShaderMaterial';\r\n\r\n};\r\n\r\nTHREE.RawShaderMaterial.prototype = Object.create( THREE.ShaderMaterial.prototype );\r\nTHREE.RawShaderMaterial.prototype.constructor = THREE.RawShaderMaterial;\r\n// File:src/materials/SpriteMaterial.js\r\n\r\n/**\r\n * @author alteredq / http://alteredqualia.com/\r\n *\r\n * parameters = {\r\n * color: ,\r\n * opacity: ,\r\n * map: new THREE.Texture( ),\r\n *\r\n * blending: THREE.NormalBlending,\r\n * depthTest: ,\r\n * depthWrite: ,\r\n *\r\n *\tuvOffset: new THREE.Vector2(),\r\n *\tuvScale: new THREE.Vector2(),\r\n *\r\n * fog: \r\n * }\r\n */\r\n\r\nTHREE.SpriteMaterial = function ( parameters ) {\r\n\r\n\tTHREE.Material.call( this );\r\n\r\n\tthis.type = 'SpriteMaterial';\r\n\r\n\tthis.color = new THREE.Color( 0xffffff );\r\n\tthis.map = null;\r\n\r\n\tthis.rotation = 0;\r\n\r\n\tthis.fog = false;\r\n\r\n\t// set parameters\r\n\r\n\tthis.setValues( parameters );\r\n\r\n};\r\n\r\nTHREE.SpriteMaterial.prototype = Object.create( THREE.Material.prototype );\r\nTHREE.SpriteMaterial.prototype.constructor = THREE.SpriteMaterial;\r\n\r\nTHREE.SpriteMaterial.prototype.copy = function ( source ) {\r\n\r\n\tTHREE.Material.prototype.copy.call( this, source );\r\n\r\n\tthis.color.copy( source.color );\r\n\tthis.map = source.map;\r\n\r\n\tthis.rotation = source.rotation;\r\n\r\n\tthis.fog = source.fog;\r\n\r\n\treturn this;\r\n\r\n};\r\n\r\n// File:src/textures/Texture.js\r\n\r\n/**\r\n * @author mrdoob / http://mrdoob.com/\r\n * @author alteredq / http://alteredqualia.com/\r\n * @author szimek / https://github.com/szimek/\r\n */\r\n\r\nTHREE.Texture = function ( image, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy ) {\r\n\r\n\tObject.defineProperty( this, 'id', { value: THREE.TextureIdCount ++ } );\r\n\r\n\tthis.uuid = THREE.Math.generateUUID();\r\n\r\n\tthis.name = '';\r\n\tthis.sourceFile = '';\r\n\r\n\tthis.image = image !== undefined ? image : THREE.Texture.DEFAULT_IMAGE;\r\n\tthis.mipmaps = [];\r\n\r\n\tthis.mapping = mapping !== undefined ? mapping : THREE.Texture.DEFAULT_MAPPING;\r\n\r\n\tthis.wrapS = wrapS !== undefined ? wrapS : THREE.ClampToEdgeWrapping;\r\n\tthis.wrapT = wrapT !== undefined ? wrapT : THREE.ClampToEdgeWrapping;\r\n\r\n\tthis.magFilter = magFilter !== undefined ? magFilter : THREE.LinearFilter;\r\n\tthis.minFilter = minFilter !== undefined ? minFilter : THREE.LinearMipMapLinearFilter;\r\n\r\n\tthis.anisotropy = anisotropy !== undefined ? anisotropy : 1;\r\n\r\n\tthis.format = format !== undefined ? format : THREE.RGBAFormat;\r\n\tthis.type = type !== undefined ? type : THREE.UnsignedByteType;\r\n\r\n\tthis.offset = new THREE.Vector2( 0, 0 );\r\n\tthis.repeat = new THREE.Vector2( 1, 1 );\r\n\r\n\tthis.generateMipmaps = true;\r\n\tthis.premultiplyAlpha = false;\r\n\tthis.flipY = true;\r\n\tthis.unpackAlignment = 4; // valid values: 1, 2, 4, 8 (see http://www.khronos.org/opengles/sdk/docs/man/xhtml/glPixelStorei.xml)\r\n\r\n\tthis.version = 0;\r\n\tthis.onUpdate = null;\r\n\r\n};\r\n\r\nTHREE.Texture.DEFAULT_IMAGE = undefined;\r\nTHREE.Texture.DEFAULT_MAPPING = THREE.UVMapping;\r\n\r\nTHREE.Texture.prototype = {\r\n\r\n\tconstructor: THREE.Texture,\r\n\r\n\tset needsUpdate ( value ) {\r\n\r\n\t\tif ( value === true ) this.version ++;\r\n\r\n\t},\r\n\r\n\tclone: function () {\r\n\r\n\t\treturn new this.constructor().copy( this );\r\n\r\n\t},\r\n\r\n\tcopy: function ( source ) {\r\n\r\n\t\tthis.image = source.image;\r\n\t\tthis.mipmaps = source.mipmaps.slice( 0 );\r\n\r\n\t\tthis.mapping = source.mapping;\r\n\r\n\t\tthis.wrapS = source.wrapS;\r\n\t\tthis.wrapT = source.wrapT;\r\n\r\n\t\tthis.magFilter = source.magFilter;\r\n\t\tthis.minFilter = source.minFilter;\r\n\r\n\t\tthis.anisotropy = source.anisotropy;\r\n\r\n\t\tthis.format = source.format;\r\n\t\tthis.type = source.type;\r\n\r\n\t\tthis.offset.copy( source.offset );\r\n\t\tthis.repeat.copy( source.repeat );\r\n\r\n\t\tthis.generateMipmaps = source.generateMipmaps;\r\n\t\tthis.premultiplyAlpha = source.premultiplyAlpha;\r\n\t\tthis.flipY = source.flipY;\r\n\t\tthis.unpackAlignment = source.unpackAlignment;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\ttoJSON: function ( meta ) {\r\n\r\n\t\tif ( meta.textures[ this.uuid ] !== undefined ) {\r\n\r\n\t\t\treturn meta.textures[ this.uuid ];\r\n\r\n\t\t}\r\n\r\n\t\tfunction getDataURL( image ) {\r\n\r\n\t\t\tvar canvas;\r\n\r\n\t\t\tif ( image.toDataURL !== undefined ) {\r\n\r\n\t\t\t\tcanvas = image;\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tcanvas = document.createElement( 'canvas' );\r\n\t\t\t\tcanvas.width = image.width;\r\n\t\t\t\tcanvas.height = image.height;\r\n\r\n\t\t\t\tcanvas.getContext( '2d' ).drawImage( image, 0, 0, image.width, image.height );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( canvas.width > 2048 || canvas.height > 2048 ) {\r\n\r\n\t\t\t\treturn canvas.toDataURL( 'image/jpeg', 0.6 );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\treturn canvas.toDataURL( 'image/png' );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tvar output = {\r\n\t\t\tmetadata: {\r\n\t\t\t\tversion: 4.4,\r\n\t\t\t\ttype: 'Texture',\r\n\t\t\t\tgenerator: 'Texture.toJSON'\r\n\t\t\t},\r\n\r\n\t\t\tuuid: this.uuid,\r\n\t\t\tname: this.name,\r\n\r\n\t\t\tmapping: this.mapping,\r\n\r\n\t\t\trepeat: [ this.repeat.x, this.repeat.y ],\r\n\t\t\toffset: [ this.offset.x, this.offset.y ],\r\n\t\t\twrap: [ this.wrapS, this.wrapT ],\r\n\r\n\t\t\tminFilter: this.minFilter,\r\n\t\t\tmagFilter: this.magFilter,\r\n\t\t\tanisotropy: this.anisotropy\r\n\t\t};\r\n\r\n\t\tif ( this.image !== undefined ) {\r\n\r\n\t\t\t// TODO: Move to THREE.Image\r\n\r\n\t\t\tvar image = this.image;\r\n\r\n\t\t\tif ( image.uuid === undefined ) {\r\n\r\n\t\t\t\timage.uuid = THREE.Math.generateUUID(); // UGH\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( meta.images[ image.uuid ] === undefined ) {\r\n\r\n\t\t\t\tmeta.images[ image.uuid ] = {\r\n\t\t\t\t\tuuid: image.uuid,\r\n\t\t\t\t\turl: getDataURL( image )\r\n\t\t\t\t};\r\n\r\n\t\t\t}\r\n\r\n\t\t\toutput.image = image.uuid;\r\n\r\n\t\t}\r\n\r\n\t\tmeta.textures[ this.uuid ] = output;\r\n\r\n\t\treturn output;\r\n\r\n\t},\r\n\r\n\tdispose: function () {\r\n\r\n\t\tthis.dispatchEvent( { type: 'dispose' } );\r\n\r\n\t},\r\n\r\n\ttransformUv: function ( uv ) {\r\n\r\n\t\tif ( this.mapping !== THREE.UVMapping ) return;\r\n\r\n\t\tuv.multiply( this.repeat );\r\n\t\tuv.add( this.offset );\r\n\r\n\t\tif ( uv.x < 0 || uv.x > 1 ) {\r\n\r\n\t\t\tswitch ( this.wrapS ) {\r\n\r\n\t\t\t\tcase THREE.RepeatWrapping:\r\n\r\n\t\t\t\t\tuv.x = uv.x - Math.floor( uv.x );\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase THREE.ClampToEdgeWrapping:\r\n\r\n\t\t\t\t\tuv.x = uv.x < 0 ? 0 : 1;\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase THREE.MirroredRepeatWrapping:\r\n\r\n\t\t\t\t\tif ( Math.abs( Math.floor( uv.x ) % 2 ) === 1 ) {\r\n\r\n\t\t\t\t\t\tuv.x = Math.ceil( uv.x ) - uv.x;\r\n\r\n\t\t\t\t\t} else {\r\n\r\n\t\t\t\t\t\tuv.x = uv.x - Math.floor( uv.x );\r\n\r\n\t\t\t\t\t}\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tif ( uv.y < 0 || uv.y > 1 ) {\r\n\r\n\t\t\tswitch ( this.wrapT ) {\r\n\r\n\t\t\t\tcase THREE.RepeatWrapping:\r\n\r\n\t\t\t\t\tuv.y = uv.y - Math.floor( uv.y );\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase THREE.ClampToEdgeWrapping:\r\n\r\n\t\t\t\t\tuv.y = uv.y < 0 ? 0 : 1;\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase THREE.MirroredRepeatWrapping:\r\n\r\n\t\t\t\t\tif ( Math.abs( Math.floor( uv.y ) % 2 ) === 1 ) {\r\n\r\n\t\t\t\t\t\tuv.y = Math.ceil( uv.y ) - uv.y;\r\n\r\n\t\t\t\t\t} else {\r\n\r\n\t\t\t\t\t\tuv.y = uv.y - Math.floor( uv.y );\r\n\r\n\t\t\t\t\t}\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tif ( this.flipY ) {\r\n\r\n\t\t\tuv.y = 1 - uv.y;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n};\r\n\r\nTHREE.EventDispatcher.prototype.apply( THREE.Texture.prototype );\r\n\r\nTHREE.TextureIdCount = 0;\r\n\r\n// File:src/textures/CanvasTexture.js\r\n\r\n/**\r\n * @author mrdoob / http://mrdoob.com/\r\n */\r\n\r\nTHREE.CanvasTexture = function ( canvas, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy ) {\r\n\r\n\tTHREE.Texture.call( this, canvas, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy );\r\n\r\n\tthis.needsUpdate = true;\r\n\r\n};\r\n\r\nTHREE.CanvasTexture.prototype = Object.create( THREE.Texture.prototype );\r\nTHREE.CanvasTexture.prototype.constructor = THREE.CanvasTexture;\r\n\r\n// File:src/textures/CubeTexture.js\r\n\r\n/**\r\n * @author mrdoob / http://mrdoob.com/\r\n */\r\n\r\nTHREE.CubeTexture = function ( images, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy ) {\r\n\r\n\tmapping = mapping !== undefined ? mapping : THREE.CubeReflectionMapping;\r\n\r\n\tTHREE.Texture.call( this, images, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy );\r\n\r\n\tthis.images = images;\r\n\tthis.flipY = false;\r\n\r\n};\r\n\r\nTHREE.CubeTexture.prototype = Object.create( THREE.Texture.prototype );\r\nTHREE.CubeTexture.prototype.constructor = THREE.CubeTexture;\r\n\r\nTHREE.CubeTexture.prototype.copy = function ( source ) {\r\n\r\n\tTHREE.Texture.prototype.copy.call( this, source );\r\n\t\r\n\tthis.images = source.images;\r\n\t\r\n\treturn this;\r\n\r\n};\r\n// File:src/textures/CompressedTexture.js\r\n\r\n/**\r\n * @author alteredq / http://alteredqualia.com/\r\n */\r\n\r\nTHREE.CompressedTexture = function ( mipmaps, width, height, format, type, mapping, wrapS, wrapT, magFilter, minFilter, anisotropy ) {\r\n\r\n\tTHREE.Texture.call( this, null, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy );\r\n\r\n\tthis.image = { width: width, height: height };\r\n\tthis.mipmaps = mipmaps;\r\n\r\n\t// no flipping for cube textures\r\n\t// (also flipping doesn't work for compressed textures )\r\n\r\n\tthis.flipY = false;\r\n\r\n\t// can't generate mipmaps for compressed textures\r\n\t// mips must be embedded in DDS files\r\n\r\n\tthis.generateMipmaps = false;\r\n\r\n};\r\n\r\nTHREE.CompressedTexture.prototype = Object.create( THREE.Texture.prototype );\r\nTHREE.CompressedTexture.prototype.constructor = THREE.CompressedTexture;\r\n\r\n// File:src/textures/DataTexture.js\r\n\r\n/**\r\n * @author alteredq / http://alteredqualia.com/\r\n */\r\n\r\nTHREE.DataTexture = function ( data, width, height, format, type, mapping, wrapS, wrapT, magFilter, minFilter, anisotropy ) {\r\n\r\n\tTHREE.Texture.call( this, null, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy );\r\n\r\n\tthis.image = { data: data, width: width, height: height };\r\n\r\n\tthis.magFilter = magFilter !== undefined ? magFilter : THREE.NearestFilter;\r\n\tthis.minFilter = minFilter !== undefined ? minFilter : THREE.NearestFilter;\r\n\t\r\n\tthis.flipY = false;\r\n\tthis.generateMipmaps = false;\r\n\r\n};\r\n\r\nTHREE.DataTexture.prototype = Object.create( THREE.Texture.prototype );\r\nTHREE.DataTexture.prototype.constructor = THREE.DataTexture;\r\n\r\n// File:src/textures/VideoTexture.js\r\n\r\n/**\r\n * @author mrdoob / http://mrdoob.com/\r\n */\r\n\r\nTHREE.VideoTexture = function ( video, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy ) {\r\n\r\n\tTHREE.Texture.call( this, video, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy );\r\n\r\n\tthis.generateMipmaps = false;\r\n\r\n\tvar scope = this;\r\n\r\n\tvar update = function () {\r\n\r\n\t\trequestAnimationFrame( update );\r\n\r\n\t\tif ( video.readyState === video.HAVE_ENOUGH_DATA ) {\r\n\r\n\t\t\tscope.needsUpdate = true;\r\n\r\n\t\t}\r\n\r\n\t};\r\n\r\n\tupdate();\r\n\r\n};\r\n\r\nTHREE.VideoTexture.prototype = Object.create( THREE.Texture.prototype );\r\nTHREE.VideoTexture.prototype.constructor = THREE.VideoTexture;\r\n\r\n// File:src/objects/Group.js\r\n\r\n/**\r\n * @author mrdoob / http://mrdoob.com/\r\n */\r\n\r\nTHREE.Group = function () {\r\n\r\n\tTHREE.Object3D.call( this );\r\n\r\n\tthis.type = 'Group';\r\n\r\n};\r\n\r\nTHREE.Group.prototype = Object.create( THREE.Object3D.prototype );\r\nTHREE.Group.prototype.constructor = THREE.Group;\r\n// File:src/objects/Points.js\r\n\r\n/**\r\n * @author alteredq / http://alteredqualia.com/\r\n */\r\n\r\nTHREE.Points = function ( geometry, material ) {\r\n\r\n\tTHREE.Object3D.call( this );\r\n\r\n\tthis.type = 'Points';\r\n\r\n\tthis.geometry = geometry !== undefined ? geometry : new THREE.Geometry();\r\n\tthis.material = material !== undefined ? material : new THREE.PointsMaterial( { color: Math.random() * 0xffffff } );\r\n\r\n};\r\n\r\nTHREE.Points.prototype = Object.create( THREE.Object3D.prototype );\r\nTHREE.Points.prototype.constructor = THREE.Points;\r\n\r\nTHREE.Points.prototype.raycast = ( function () {\r\n\r\n\tvar inverseMatrix = new THREE.Matrix4();\r\n\tvar ray = new THREE.Ray();\r\n\r\n\treturn function raycast( raycaster, intersects ) {\r\n\r\n\t\tvar object = this;\r\n\t\tvar geometry = object.geometry;\r\n\t\tvar threshold = raycaster.params.Points.threshold;\r\n\r\n\t\tinverseMatrix.getInverse( this.matrixWorld );\r\n\t\tray.copy( raycaster.ray ).applyMatrix4( inverseMatrix );\r\n\r\n\t\tif ( geometry.boundingBox !== null ) {\r\n\r\n\t\t\tif ( ray.isIntersectionBox( geometry.boundingBox ) === false ) {\r\n\r\n\t\t\t\treturn;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tvar localThreshold = threshold / ( ( this.scale.x + this.scale.y + this.scale.z ) / 3 );\r\n\t\tvar localThresholdSq = localThreshold * localThreshold;\r\n\t\tvar position = new THREE.Vector3();\r\n\r\n\t\tfunction testPoint( point, index ) {\r\n\r\n\t\t\tvar rayPointDistanceSq = ray.distanceSqToPoint( point );\r\n\r\n\t\t\tif ( rayPointDistanceSq < localThresholdSq ) {\r\n\r\n\t\t\t\tvar intersectPoint = ray.closestPointToPoint( point );\r\n\t\t\t\tintersectPoint.applyMatrix4( object.matrixWorld );\r\n\r\n\t\t\t\tvar distance = raycaster.ray.origin.distanceTo( intersectPoint );\r\n\r\n\t\t\t\tif ( distance < raycaster.near || distance > raycaster.far ) return;\r\n\r\n\t\t\t\tintersects.push( {\r\n\r\n\t\t\t\t\tdistance: distance,\r\n\t\t\t\t\tdistanceToRay: Math.sqrt( rayPointDistanceSq ),\r\n\t\t\t\t\tpoint: intersectPoint.clone(),\r\n\t\t\t\t\tindex: index,\r\n\t\t\t\t\tface: null,\r\n\t\t\t\t\tobject: object\r\n\r\n\t\t\t\t} );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tif ( geometry instanceof THREE.BufferGeometry ) {\r\n\r\n\t\t\tvar index = geometry.index;\r\n\t\t\tvar attributes = geometry.attributes;\r\n\t\t\tvar positions = attributes.position.array;\r\n\r\n\t\t\tif ( index !== null ) {\r\n\r\n\t\t\t\tvar indices = index.array;\r\n\r\n\t\t\t\tfor ( var i = 0, il = indices.length; i < il; i ++ ) {\r\n\r\n\t\t\t\t\tvar a = indices[ i ];\r\n\r\n\t\t\t\t\tposition.fromArray( positions, a * 3 );\r\n\r\n\t\t\t\t\ttestPoint( position, a );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tfor ( var i = 0, l = positions.length / 3; i < l; i ++ ) {\r\n\r\n\t\t\t\t\tposition.fromArray( positions, i * 3 );\r\n\r\n\t\t\t\t\ttestPoint( position, i );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t} else {\r\n\r\n\t\t\tvar vertices = geometry.vertices;\r\n\r\n\t\t\tfor ( var i = 0, l = vertices.length; i < l; i ++ ) {\r\n\r\n\t\t\t\ttestPoint( vertices[ i ], i );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t};\r\n\r\n}() );\r\n\r\nTHREE.Points.prototype.clone = function () {\r\n\r\n\treturn new this.constructor( this.geometry, this.material ).copy( this );\r\n\r\n};\r\n\r\nTHREE.Points.prototype.toJSON = function ( meta ) {\r\n\r\n\tvar data = THREE.Object3D.prototype.toJSON.call( this, meta );\r\n\r\n\t// only serialize if not in meta geometries cache\r\n\tif ( meta.geometries[ this.geometry.uuid ] === undefined ) {\r\n\r\n\t\tmeta.geometries[ this.geometry.uuid ] = this.geometry.toJSON();\r\n\r\n\t}\r\n\r\n\t// only serialize if not in meta materials cache\r\n\tif ( meta.materials[ this.material.uuid ] === undefined ) {\r\n\r\n\t\tmeta.materials[ this.material.uuid ] = this.material.toJSON();\r\n\r\n\t}\r\n\r\n\tdata.object.geometry = this.geometry.uuid;\r\n\tdata.object.material = this.material.uuid;\r\n\r\n\treturn data;\r\n\r\n};\r\n\r\n// Backwards compatibility\r\n\r\nTHREE.PointCloud = function ( geometry, material ) {\r\n\r\n\tconsole.warn( 'THREE.PointCloud has been renamed to THREE.Points.' );\r\n\treturn new THREE.Points( geometry, material );\r\n\r\n};\r\n\r\nTHREE.ParticleSystem = function ( geometry, material ) {\r\n\r\n\tconsole.warn( 'THREE.ParticleSystem has been renamed to THREE.Points.' );\r\n\treturn new THREE.Points( geometry, material );\r\n\r\n};\r\n\r\n// File:src/objects/Line.js\r\n\r\n/**\r\n * @author mrdoob / http://mrdoob.com/\r\n */\r\n\r\nTHREE.Line = function ( geometry, material, mode ) {\r\n\r\n\tif ( mode === 1 ) {\r\n\r\n\t\tconsole.warn( 'THREE.Line: parameter THREE.LinePieces no longer supported. Created THREE.LineSegments instead.' );\r\n\t\treturn new THREE.LineSegments( geometry, material );\r\n\r\n\t}\r\n\r\n\tTHREE.Object3D.call( this );\r\n\r\n\tthis.type = 'Line';\r\n\r\n\tthis.geometry = geometry !== undefined ? geometry : new THREE.Geometry();\r\n\tthis.material = material !== undefined ? material : new THREE.LineBasicMaterial( { color: Math.random() * 0xffffff } );\r\n\r\n};\r\n\r\nTHREE.Line.prototype = Object.create( THREE.Object3D.prototype );\r\nTHREE.Line.prototype.constructor = THREE.Line;\r\n\r\nTHREE.Line.prototype.raycast = ( function () {\r\n\r\n\tvar inverseMatrix = new THREE.Matrix4();\r\n\tvar ray = new THREE.Ray();\r\n\tvar sphere = new THREE.Sphere();\r\n\r\n\treturn function raycast( raycaster, intersects ) {\r\n\r\n\t\tvar precision = raycaster.linePrecision;\r\n\t\tvar precisionSq = precision * precision;\r\n\r\n\t\tvar geometry = this.geometry;\r\n\r\n\t\tif ( geometry.boundingSphere === null ) geometry.computeBoundingSphere();\r\n\r\n\t\t// Checking boundingSphere distance to ray\r\n\r\n\t\tsphere.copy( geometry.boundingSphere );\r\n\t\tsphere.applyMatrix4( this.matrixWorld );\r\n\r\n\t\tif ( raycaster.ray.isIntersectionSphere( sphere ) === false ) {\r\n\r\n\t\t\treturn;\r\n\r\n\t\t}\r\n\r\n\t\tinverseMatrix.getInverse( this.matrixWorld );\r\n\t\tray.copy( raycaster.ray ).applyMatrix4( inverseMatrix );\r\n\r\n\t\tvar vStart = new THREE.Vector3();\r\n\t\tvar vEnd = new THREE.Vector3();\r\n\t\tvar interSegment = new THREE.Vector3();\r\n\t\tvar interRay = new THREE.Vector3();\r\n\t\tvar step = this instanceof THREE.LineSegments ? 2 : 1;\r\n\r\n\t\tif ( geometry instanceof THREE.BufferGeometry ) {\r\n\r\n\t\t\tvar index = geometry.index;\r\n\t\t\tvar attributes = geometry.attributes;\r\n\r\n\t\t\tif ( index !== null ) {\r\n\r\n\t\t\t\tvar indices = index.array;\r\n\t\t\t\tvar positions = attributes.position.array;\r\n\r\n\t\t\t\tfor ( var i = 0, l = indices.length - 1; i < l; i += step ) {\r\n\r\n\t\t\t\t\tvar a = indices[ i ];\r\n\t\t\t\t\tvar b = indices[ i + 1 ];\r\n\r\n\t\t\t\t\tvStart.fromArray( positions, a * 3 );\r\n\t\t\t\t\tvEnd.fromArray( positions, b * 3 );\r\n\r\n\t\t\t\t\tvar distSq = ray.distanceSqToSegment( vStart, vEnd, interRay, interSegment );\r\n\r\n\t\t\t\t\tif ( distSq > precisionSq ) continue;\r\n\r\n\t\t\t\t\tinterRay.applyMatrix4( this.matrixWorld ); //Move back to world space for distance calculation\r\n\r\n\t\t\t\t\tvar distance = raycaster.ray.origin.distanceTo( interRay );\r\n\r\n\t\t\t\t\tif ( distance < raycaster.near || distance > raycaster.far ) continue;\r\n\r\n\t\t\t\t\tintersects.push( {\r\n\r\n\t\t\t\t\t\tdistance: distance,\r\n\t\t\t\t\t\t// What do we want? intersection point on the ray or on the segment??\r\n\t\t\t\t\t\t// point: raycaster.ray.at( distance ),\r\n\t\t\t\t\t\tpoint: interSegment.clone().applyMatrix4( this.matrixWorld ),\r\n\t\t\t\t\t\tindex: i,\r\n\t\t\t\t\t\tface: null,\r\n\t\t\t\t\t\tfaceIndex: null,\r\n\t\t\t\t\t\tobject: this\r\n\r\n\t\t\t\t\t} );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tvar positions = attributes.position.array;\r\n\r\n\t\t\t\tfor ( var i = 0, l = positions.length / 3 - 1; i < l; i += step ) {\r\n\r\n\t\t\t\t\tvStart.fromArray( positions, 3 * i );\r\n\t\t\t\t\tvEnd.fromArray( positions, 3 * i + 3 );\r\n\r\n\t\t\t\t\tvar distSq = ray.distanceSqToSegment( vStart, vEnd, interRay, interSegment );\r\n\r\n\t\t\t\t\tif ( distSq > precisionSq ) continue;\r\n\r\n\t\t\t\t\tinterRay.applyMatrix4( this.matrixWorld ); //Move back to world space for distance calculation\r\n\r\n\t\t\t\t\tvar distance = raycaster.ray.origin.distanceTo( interRay );\r\n\r\n\t\t\t\t\tif ( distance < raycaster.near || distance > raycaster.far ) continue;\r\n\r\n\t\t\t\t\tintersects.push( {\r\n\r\n\t\t\t\t\t\tdistance: distance,\r\n\t\t\t\t\t\t// What do we want? intersection point on the ray or on the segment??\r\n\t\t\t\t\t\t// point: raycaster.ray.at( distance ),\r\n\t\t\t\t\t\tpoint: interSegment.clone().applyMatrix4( this.matrixWorld ),\r\n\t\t\t\t\t\tindex: i,\r\n\t\t\t\t\t\tface: null,\r\n\t\t\t\t\t\tfaceIndex: null,\r\n\t\t\t\t\t\tobject: this\r\n\r\n\t\t\t\t\t} );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t} else if ( geometry instanceof THREE.Geometry ) {\r\n\r\n\t\t\tvar vertices = geometry.vertices;\r\n\t\t\tvar nbVertices = vertices.length;\r\n\r\n\t\t\tfor ( var i = 0; i < nbVertices - 1; i += step ) {\r\n\r\n\t\t\t\tvar distSq = ray.distanceSqToSegment( vertices[ i ], vertices[ i + 1 ], interRay, interSegment );\r\n\r\n\t\t\t\tif ( distSq > precisionSq ) continue;\r\n\r\n\t\t\t\tinterRay.applyMatrix4( this.matrixWorld ); //Move back to world space for distance calculation\r\n\r\n\t\t\t\tvar distance = raycaster.ray.origin.distanceTo( interRay );\r\n\r\n\t\t\t\tif ( distance < raycaster.near || distance > raycaster.far ) continue;\r\n\r\n\t\t\t\tintersects.push( {\r\n\r\n\t\t\t\t\tdistance: distance,\r\n\t\t\t\t\t// What do we want? intersection point on the ray or on the segment??\r\n\t\t\t\t\t// point: raycaster.ray.at( distance ),\r\n\t\t\t\t\tpoint: interSegment.clone().applyMatrix4( this.matrixWorld ),\r\n\t\t\t\t\tindex: i,\r\n\t\t\t\t\tface: null,\r\n\t\t\t\t\tfaceIndex: null,\r\n\t\t\t\t\tobject: this\r\n\r\n\t\t\t\t} );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t};\r\n\r\n}() );\r\n\r\nTHREE.Line.prototype.clone = function () {\r\n\r\n\treturn new this.constructor( this.geometry, this.material ).copy( this );\r\n\r\n};\r\n\r\nTHREE.Line.prototype.toJSON = function ( meta ) {\r\n\r\n\tvar data = THREE.Object3D.prototype.toJSON.call( this, meta );\r\n\r\n\t// only serialize if not in meta geometries cache\r\n\tif ( meta.geometries[ this.geometry.uuid ] === undefined ) {\r\n\r\n\t\tmeta.geometries[ this.geometry.uuid ] = this.geometry.toJSON();\r\n\r\n\t}\r\n\r\n\t// only serialize if not in meta materials cache\r\n\tif ( meta.materials[ this.material.uuid ] === undefined ) {\r\n\r\n\t\tmeta.materials[ this.material.uuid ] = this.material.toJSON();\r\n\r\n\t}\r\n\r\n\tdata.object.geometry = this.geometry.uuid;\r\n\tdata.object.material = this.material.uuid;\r\n\r\n\treturn data;\r\n\r\n};\r\n\r\n// DEPRECATED\r\n\r\nTHREE.LineStrip = 0;\r\nTHREE.LinePieces = 1;\r\n\r\n// File:src/objects/LineSegments.js\r\n\r\n/**\r\n * @author mrdoob / http://mrdoob.com/\r\n */\r\n\r\nTHREE.LineSegments = function ( geometry, material ) {\r\n\r\n\tTHREE.Line.call( this, geometry, material );\r\n\r\n\tthis.type = 'LineSegments';\r\n\r\n};\r\n\r\nTHREE.LineSegments.prototype = Object.create( THREE.Line.prototype );\r\nTHREE.LineSegments.prototype.constructor = THREE.LineSegments;\r\n\r\n// File:src/objects/Mesh.js\r\n\r\n/**\r\n * @author mrdoob / http://mrdoob.com/\r\n * @author alteredq / http://alteredqualia.com/\r\n * @author mikael emtinger / http://gomo.se/\r\n * @author jonobr1 / http://jonobr1.com/\r\n */\r\n\r\nTHREE.Mesh = function ( geometry, material ) {\r\n\r\n\tTHREE.Object3D.call( this );\r\n\r\n\tthis.type = 'Mesh';\r\n\r\n\tthis.geometry = geometry !== undefined ? geometry : new THREE.Geometry();\r\n\tthis.material = material !== undefined ? material : new THREE.MeshBasicMaterial( { color: Math.random() * 0xffffff } );\r\n\r\n\tthis.updateMorphTargets();\r\n\r\n};\r\n\r\nTHREE.Mesh.prototype = Object.create( THREE.Object3D.prototype );\r\nTHREE.Mesh.prototype.constructor = THREE.Mesh;\r\n\r\nTHREE.Mesh.prototype.updateMorphTargets = function () {\r\n\r\n\tif ( this.geometry.morphTargets !== undefined && this.geometry.morphTargets.length > 0 ) {\r\n\r\n\t\tthis.morphTargetBase = - 1;\r\n\t\tthis.morphTargetInfluences = [];\r\n\t\tthis.morphTargetDictionary = {};\r\n\r\n\t\tfor ( var m = 0, ml = this.geometry.morphTargets.length; m < ml; m ++ ) {\r\n\r\n\t\t\tthis.morphTargetInfluences.push( 0 );\r\n\t\t\tthis.morphTargetDictionary[ this.geometry.morphTargets[ m ].name ] = m;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n};\r\n\r\nTHREE.Mesh.prototype.getMorphTargetIndexByName = function ( name ) {\r\n\r\n\tif ( this.morphTargetDictionary[ name ] !== undefined ) {\r\n\r\n\t\treturn this.morphTargetDictionary[ name ];\r\n\r\n\t}\r\n\r\n\tconsole.warn( 'THREE.Mesh.getMorphTargetIndexByName: morph target ' + name + ' does not exist. Returning 0.' );\r\n\r\n\treturn 0;\r\n\r\n};\r\n\r\n\r\nTHREE.Mesh.prototype.raycast = ( function () {\r\n\r\n\tvar inverseMatrix = new THREE.Matrix4();\r\n\tvar ray = new THREE.Ray();\r\n\tvar sphere = new THREE.Sphere();\r\n\r\n\tvar vA = new THREE.Vector3();\r\n\tvar vB = new THREE.Vector3();\r\n\tvar vC = new THREE.Vector3();\r\n\r\n\tvar tempA = new THREE.Vector3();\r\n\tvar tempB = new THREE.Vector3();\r\n\tvar tempC = new THREE.Vector3();\r\n\r\n\tvar uvA = new THREE.Vector2();\r\n\tvar uvB = new THREE.Vector2();\r\n\tvar uvC = new THREE.Vector2();\r\n\r\n\tvar barycoord = new THREE.Vector3();\r\n\r\n\tvar intersectionPoint = new THREE.Vector3();\r\n\tvar intersectionPointWorld = new THREE.Vector3();\r\n\r\n\tfunction uvIntersection( point, p1, p2, p3, uv1, uv2, uv3 ) {\r\n\r\n\t\tTHREE.Triangle.barycoordFromPoint( point, p1, p2, p3, barycoord );\r\n\r\n\t\tuv1.multiplyScalar( barycoord.x );\r\n\t\tuv2.multiplyScalar( barycoord.y );\r\n\t\tuv3.multiplyScalar( barycoord.z );\r\n\r\n\t\tuv1.add( uv2 ).add( uv3 );\r\n\r\n\t\treturn uv1.clone();\r\n\r\n\t}\r\n\r\n\treturn function raycast( raycaster, intersects ) {\r\n\r\n\t\tvar geometry = this.geometry;\r\n\t\tvar material = this.material;\r\n\r\n\t\tif ( material === undefined ) return;\r\n\r\n\t\t// Checking boundingSphere distance to ray\r\n\r\n\t\tif ( geometry.boundingSphere === null ) geometry.computeBoundingSphere();\r\n\r\n\t\tsphere.copy( geometry.boundingSphere );\r\n\t\tsphere.applyMatrix4( this.matrixWorld );\r\n\r\n\t\tif ( raycaster.ray.isIntersectionSphere( sphere ) === false ) {\r\n\r\n\t\t\treturn;\r\n\r\n\t\t}\r\n\r\n\t\t// Check boundingBox before continuing\r\n\r\n\t\tinverseMatrix.getInverse( this.matrixWorld );\r\n\t\tray.copy( raycaster.ray ).applyMatrix4( inverseMatrix );\r\n\r\n\t\tif ( geometry.boundingBox !== null ) {\r\n\r\n\t\t\tif ( ray.isIntersectionBox( geometry.boundingBox ) === false ) {\r\n\r\n\t\t\t\treturn;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tvar a, b, c;\r\n\r\n\t\tif ( geometry instanceof THREE.BufferGeometry ) {\r\n\r\n\t\t\tvar index = geometry.index;\r\n\t\t\tvar attributes = geometry.attributes;\r\n\r\n\t\t\tif ( index !== null ) {\r\n\r\n\t\t\t\tvar indices = index.array;\r\n\t\t\t\tvar positions = attributes.position.array;\r\n\r\n\t\t\t\tfor ( var i = 0, l = indices.length; i < l; i += 3 ) {\r\n\r\n\t\t\t\t\ta = indices[ i ];\r\n\t\t\t\t\tb = indices[ i + 1 ];\r\n\t\t\t\t\tc = indices[ i + 2 ];\r\n\r\n\t\t\t\t\tvA.fromArray( positions, a * 3 );\r\n\t\t\t\t\tvB.fromArray( positions, b * 3 );\r\n\t\t\t\t\tvC.fromArray( positions, c * 3 );\r\n\r\n\t\t\t\t\tif ( material.side === THREE.BackSide ) {\r\n\r\n\t\t\t\t\t\tif ( ray.intersectTriangle( vC, vB, vA, true, intersectionPoint ) === null ) continue;\r\n\r\n\t\t\t\t\t} else {\r\n\r\n\t\t\t\t\t\tif ( ray.intersectTriangle( vA, vB, vC, material.side !== THREE.DoubleSide, intersectionPoint ) === null ) continue;\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tintersectionPointWorld.copy( intersectionPoint );\r\n\t\t\t\t\tintersectionPointWorld.applyMatrix4( this.matrixWorld );\r\n\r\n\t\t\t\t\tvar distance = raycaster.ray.origin.distanceTo( intersectionPointWorld );\r\n\r\n\t\t\t\t\tif ( distance < raycaster.near || distance > raycaster.far ) continue;\r\n\r\n\t\t\t\t\tvar uv;\r\n\r\n\t\t\t\t\tif ( attributes.uv !== undefined ) {\r\n\r\n\t\t\t\t\t\tvar uvs = attributes.uv.array;\r\n\t\t\t\t\t\tuvA.fromArray( uvs, a * 2 );\r\n\t\t\t\t\t\tuvB.fromArray( uvs, b * 2 );\r\n\t\t\t\t\t\tuvC.fromArray( uvs, c * 2 );\r\n\t\t\t\t\t\tuv = uvIntersection( intersectionPoint, vA, vB, vC, uvA, uvB, uvC );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tintersects.push( {\r\n\r\n\t\t\t\t\t\tdistance: distance,\r\n\t\t\t\t\t\tpoint: intersectionPointWorld.clone(),\r\n\t\t\t\t\t\tuv: uv,\r\n\t\t\t\t\t\tface: new THREE.Face3( a, b, c, THREE.Triangle.normal( vA, vB, vC ) ),\r\n\t\t\t\t\t\tfaceIndex: Math.floor( i / 3 ), // triangle number in indices buffer semantics\r\n\t\t\t\t\t\tobject: this\r\n\r\n\t\t\t\t\t} );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tvar positions = attributes.position.array;\r\n\r\n\t\t\t\tfor ( var i = 0, l = positions.length; i < l; i += 9 ) {\r\n\r\n\t\t\t\t\tvA.fromArray( positions, i );\r\n\t\t\t\t\tvB.fromArray( positions, i + 3 );\r\n\t\t\t\t\tvC.fromArray( positions, i + 6 );\r\n\r\n\t\t\t\t\tif ( material.side === THREE.BackSide ) {\r\n\r\n\t\t\t\t\t\tif ( ray.intersectTriangle( vC, vB, vA, true, intersectionPoint ) === null ) continue;\r\n\r\n\t\t\t\t\t} else {\r\n\r\n\t\t\t\t\t\tif ( ray.intersectTriangle( vA, vB, vC, material.side !== THREE.DoubleSide, intersectionPoint ) === null ) continue;\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tintersectionPointWorld.copy( intersectionPoint );\r\n\t\t\t\t\tintersectionPointWorld.applyMatrix4( this.matrixWorld );\r\n\r\n\t\t\t\t\tvar distance = raycaster.ray.origin.distanceTo( intersectionPointWorld );\r\n\r\n\t\t\t\t\tif ( distance < raycaster.near || distance > raycaster.far ) continue;\r\n\r\n\t\t\t\t\tvar uv;\r\n\r\n\t\t\t\t\tif ( attributes.uv !== undefined ) {\r\n\r\n\t\t\t\t\t\tvar uvs = attributes.uv.array;\r\n\t\t\t\t\t\tuvA.fromArray( uvs, i );\r\n\t\t\t\t\t\tuvB.fromArray( uvs, i + 2 );\r\n\t\t\t\t\t\tuvC.fromArray( uvs, i + 4 );\r\n\t\t\t\t\t\tuv = uvIntersection( intersectionPoint, vA, vB, vC, uvA, uvB, uvC );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\ta = i / 3;\r\n\t\t\t\t\tb = a + 1;\r\n\t\t\t\t\tc = a + 2;\r\n\r\n\t\t\t\t\tintersects.push( {\r\n\r\n\t\t\t\t\t\tdistance: distance,\r\n\t\t\t\t\t\tpoint: intersectionPointWorld.clone(),\r\n\t\t\t\t\t\tuv: uv,\r\n\t\t\t\t\t\tface: new THREE.Face3( a, b, c, THREE.Triangle.normal( vA, vB, vC ) ),\r\n\t\t\t\t\t\tindex: a, // triangle number in positions buffer semantics\r\n\t\t\t\t\t\tobject: this\r\n\r\n\t\t\t\t\t} );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t} else if ( geometry instanceof THREE.Geometry ) {\r\n\r\n\t\t\tvar isFaceMaterial = material instanceof THREE.MeshFaceMaterial;\r\n\t\t\tvar materials = isFaceMaterial === true ? material.materials : null;\r\n\r\n\t\t\tvar vertices = geometry.vertices;\r\n\t\t\tvar faces = geometry.faces;\r\n\r\n\t\t\tfor ( var f = 0, fl = faces.length; f < fl; f ++ ) {\r\n\r\n\t\t\t\tvar face = faces[ f ];\r\n\t\t\t\tvar faceMaterial = isFaceMaterial === true ? materials[ face.materialIndex ] : material;\r\n\r\n\t\t\t\tif ( faceMaterial === undefined ) continue;\r\n\r\n\t\t\t\ta = vertices[ face.a ];\r\n\t\t\t\tb = vertices[ face.b ];\r\n\t\t\t\tc = vertices[ face.c ];\r\n\r\n\t\t\t\tif ( faceMaterial.morphTargets === true ) {\r\n\r\n\t\t\t\t\tvar morphTargets = geometry.morphTargets;\r\n\t\t\t\t\tvar morphInfluences = this.morphTargetInfluences;\r\n\r\n\t\t\t\t\tvA.set( 0, 0, 0 );\r\n\t\t\t\t\tvB.set( 0, 0, 0 );\r\n\t\t\t\t\tvC.set( 0, 0, 0 );\r\n\r\n\t\t\t\t\tfor ( var t = 0, tl = morphTargets.length; t < tl; t ++ ) {\r\n\r\n\t\t\t\t\t\tvar influence = morphInfluences[ t ];\r\n\r\n\t\t\t\t\t\tif ( influence === 0 ) continue;\r\n\r\n\t\t\t\t\t\tvar targets = morphTargets[ t ].vertices;\r\n\r\n\t\t\t\t\t\tvA.addScaledVector( tempA.subVectors( targets[ face.a ], a ), influence );\r\n\t\t\t\t\t\tvB.addScaledVector( tempB.subVectors( targets[ face.b ], b ), influence );\r\n\t\t\t\t\t\tvC.addScaledVector( tempC.subVectors( targets[ face.c ], c ), influence );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tvA.add( a );\r\n\t\t\t\t\tvB.add( b );\r\n\t\t\t\t\tvC.add( c );\r\n\r\n\t\t\t\t\ta = vA;\r\n\t\t\t\t\tb = vB;\r\n\t\t\t\t\tc = vC;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif ( faceMaterial.side === THREE.BackSide ) {\r\n\r\n\t\t\t\t\tif ( ray.intersectTriangle( c, b, a, true, intersectionPoint ) === null ) continue;\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\tif ( ray.intersectTriangle( a, b, c, faceMaterial.side !== THREE.DoubleSide, intersectionPoint ) === null ) continue;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tintersectionPointWorld.copy( intersectionPoint );\r\n\t\t\t\tintersectionPointWorld.applyMatrix4( this.matrixWorld );\r\n\r\n\t\t\t\tvar distance = raycaster.ray.origin.distanceTo( intersectionPointWorld );\r\n\r\n\t\t\t\tif ( distance < raycaster.near || distance > raycaster.far ) continue;\r\n\r\n\t\t\t\tvar uv;\r\n\r\n\t\t\t\tif ( geometry.faceVertexUvs[ 0 ].length > 0 ) {\r\n\r\n\t\t\t\t\tvar uvs = geometry.faceVertexUvs[ 0 ][ f ];\r\n\t\t\t\t\tuvA.copy( uvs[ 0 ] );\r\n\t\t\t\t\tuvB.copy( uvs[ 1 ] );\r\n\t\t\t\t\tuvC.copy( uvs[ 2 ] );\r\n\t\t\t\t\tuv = uvIntersection( intersectionPoint, a, b, c, uvA, uvB, uvC );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tintersects.push( {\r\n\r\n\t\t\t\t\tdistance: distance,\r\n\t\t\t\t\tpoint: intersectionPointWorld.clone(),\r\n\t\t\t\t\tuv: uv,\r\n\t\t\t\t\tface: face,\r\n\t\t\t\t\tfaceIndex: f,\r\n\t\t\t\t\tobject: this\r\n\r\n\t\t\t\t} );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t};\r\n\r\n}() );\r\n\r\nTHREE.Mesh.prototype.clone = function () {\r\n\r\n\treturn new this.constructor( this.geometry, this.material ).copy( this );\r\n\r\n};\r\n\r\nTHREE.Mesh.prototype.toJSON = function ( meta ) {\r\n\r\n\tvar data = THREE.Object3D.prototype.toJSON.call( this, meta );\r\n\r\n\t// only serialize if not in meta geometries cache\r\n\tif ( meta.geometries[ this.geometry.uuid ] === undefined ) {\r\n\r\n\t\tmeta.geometries[ this.geometry.uuid ] = this.geometry.toJSON( meta );\r\n\r\n\t}\r\n\r\n\t// only serialize if not in meta materials cache\r\n\tif ( meta.materials[ this.material.uuid ] === undefined ) {\r\n\r\n\t\tmeta.materials[ this.material.uuid ] = this.material.toJSON( meta );\r\n\r\n\t}\r\n\r\n\tdata.object.geometry = this.geometry.uuid;\r\n\tdata.object.material = this.material.uuid;\r\n\r\n\treturn data;\r\n\r\n};\r\n\r\n// File:src/objects/Bone.js\r\n\r\n/**\r\n * @author mikael emtinger / http://gomo.se/\r\n * @author alteredq / http://alteredqualia.com/\r\n * @author ikerr / http://verold.com\r\n */\r\n\r\nTHREE.Bone = function ( skin ) {\r\n\r\n\tTHREE.Object3D.call( this );\r\n\r\n\tthis.type = 'Bone';\r\n\r\n\tthis.skin = skin;\r\n\r\n};\r\n\r\nTHREE.Bone.prototype = Object.create( THREE.Object3D.prototype );\r\nTHREE.Bone.prototype.constructor = THREE.Bone;\r\n\r\nTHREE.Bone.prototype.copy = function ( source ) {\r\n\t\r\n\tTHREE.Object3D.prototype.copy.call( this, source );\r\n\t\r\n\tthis.skin = source.skin;\r\n\t\r\n\treturn this;\r\n\r\n};\r\n\r\n// File:src/objects/Skeleton.js\r\n\r\n/**\r\n * @author mikael emtinger / http://gomo.se/\r\n * @author alteredq / http://alteredqualia.com/\r\n * @author michael guerrero / http://realitymeltdown.com\r\n * @author ikerr / http://verold.com\r\n */\r\n\r\nTHREE.Skeleton = function ( bones, boneInverses, useVertexTexture ) {\r\n\r\n\tthis.useVertexTexture = useVertexTexture !== undefined ? useVertexTexture : true;\r\n\r\n\tthis.identityMatrix = new THREE.Matrix4();\r\n\r\n\t// copy the bone array\r\n\r\n\tbones = bones || [];\r\n\r\n\tthis.bones = bones.slice( 0 );\r\n\r\n\t// create a bone texture or an array of floats\r\n\r\n\tif ( this.useVertexTexture ) {\r\n\r\n\t\t// layout (1 matrix = 4 pixels)\r\n\t\t// RGBA RGBA RGBA RGBA (=> column1, column2, column3, column4)\r\n\t\t// with 8x8 pixel texture max 16 bones * 4 pixels = (8 * 8)\r\n\t\t// 16x16 pixel texture max 64 bones * 4 pixels = (16 * 16)\r\n\t\t// 32x32 pixel texture max 256 bones * 4 pixels = (32 * 32)\r\n\t\t// 64x64 pixel texture max 1024 bones * 4 pixels = (64 * 64)\r\n\r\n\t\t\r\n\t\tvar size = Math.sqrt( this.bones.length * 4 ); // 4 pixels needed for 1 matrix\r\n\t\tsize = THREE.Math.nextPowerOfTwo( Math.ceil( size ) );\r\n\t\tsize = Math.max( size, 4 );\r\n\r\n\t\tthis.boneTextureWidth = size;\r\n\t\tthis.boneTextureHeight = size;\r\n\r\n\t\tthis.boneMatrices = new Float32Array( this.boneTextureWidth * this.boneTextureHeight * 4 ); // 4 floats per RGBA pixel\r\n\t\tthis.boneTexture = new THREE.DataTexture( this.boneMatrices, this.boneTextureWidth, this.boneTextureHeight, THREE.RGBAFormat, THREE.FloatType );\r\n\r\n\t} else {\r\n\r\n\t\tthis.boneMatrices = new Float32Array( 16 * this.bones.length );\r\n\r\n\t}\r\n\r\n\t// use the supplied bone inverses or calculate the inverses\r\n\r\n\tif ( boneInverses === undefined ) {\r\n\r\n\t\tthis.calculateInverses();\r\n\r\n\t} else {\r\n\r\n\t\tif ( this.bones.length === boneInverses.length ) {\r\n\r\n\t\t\tthis.boneInverses = boneInverses.slice( 0 );\r\n\r\n\t\t} else {\r\n\r\n\t\t\tconsole.warn( 'THREE.Skeleton bonInverses is the wrong length.' );\r\n\r\n\t\t\tthis.boneInverses = [];\r\n\r\n\t\t\tfor ( var b = 0, bl = this.bones.length; b < bl; b ++ ) {\r\n\r\n\t\t\t\tthis.boneInverses.push( new THREE.Matrix4() );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n};\r\n\r\nTHREE.Skeleton.prototype.calculateInverses = function () {\r\n\r\n\tthis.boneInverses = [];\r\n\r\n\tfor ( var b = 0, bl = this.bones.length; b < bl; b ++ ) {\r\n\r\n\t\tvar inverse = new THREE.Matrix4();\r\n\r\n\t\tif ( this.bones[ b ] ) {\r\n\r\n\t\t\tinverse.getInverse( this.bones[ b ].matrixWorld );\r\n\r\n\t\t}\r\n\r\n\t\tthis.boneInverses.push( inverse );\r\n\r\n\t}\r\n\r\n};\r\n\r\nTHREE.Skeleton.prototype.pose = function () {\r\n\r\n\tvar bone;\r\n\r\n\t// recover the bind-time world matrices\r\n\r\n\tfor ( var b = 0, bl = this.bones.length; b < bl; b ++ ) {\r\n\r\n\t\tbone = this.bones[ b ];\r\n\r\n\t\tif ( bone ) {\r\n\r\n\t\t\tbone.matrixWorld.getInverse( this.boneInverses[ b ] );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\t// compute the local matrices, positions, rotations and scales\r\n\r\n\tfor ( var b = 0, bl = this.bones.length; b < bl; b ++ ) {\r\n\r\n\t\tbone = this.bones[ b ];\r\n\r\n\t\tif ( bone ) {\r\n\r\n\t\t\tif ( bone.parent ) {\r\n\r\n\t\t\t\tbone.matrix.getInverse( bone.parent.matrixWorld );\r\n\t\t\t\tbone.matrix.multiply( bone.matrixWorld );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tbone.matrix.copy( bone.matrixWorld );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tbone.matrix.decompose( bone.position, bone.quaternion, bone.scale );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n};\r\n\r\nTHREE.Skeleton.prototype.update = ( function () {\r\n\r\n\tvar offsetMatrix = new THREE.Matrix4();\r\n\r\n\treturn function update() {\r\n\r\n\t\t// flatten bone matrices to array\r\n\r\n\t\tfor ( var b = 0, bl = this.bones.length; b < bl; b ++ ) {\r\n\r\n\t\t\t// compute the offset between the current and the original transform\r\n\r\n\t\t\tvar matrix = this.bones[ b ] ? this.bones[ b ].matrixWorld : this.identityMatrix;\r\n\r\n\t\t\toffsetMatrix.multiplyMatrices( matrix, this.boneInverses[ b ] );\r\n\t\t\toffsetMatrix.flattenToArrayOffset( this.boneMatrices, b * 16 );\r\n\r\n\t\t}\r\n\r\n\t\tif ( this.useVertexTexture ) {\r\n\r\n\t\t\tthis.boneTexture.needsUpdate = true;\r\n\r\n\t\t}\r\n\r\n\t};\r\n\r\n} )();\r\n\r\nTHREE.Skeleton.prototype.clone = function () {\r\n\r\n\treturn new THREE.Skeleton( this.bones, this.boneInverses, this.useVertexTexture );\r\n\r\n};\r\n\r\n// File:src/objects/SkinnedMesh.js\r\n\r\n/**\r\n * @author mikael emtinger / http://gomo.se/\r\n * @author alteredq / http://alteredqualia.com/\r\n * @author ikerr / http://verold.com\r\n */\r\n\r\nTHREE.SkinnedMesh = function ( geometry, material, useVertexTexture ) {\r\n\r\n\tTHREE.Mesh.call( this, geometry, material );\r\n\r\n\tthis.type = 'SkinnedMesh';\r\n\r\n\tthis.bindMode = \"attached\";\r\n\tthis.bindMatrix = new THREE.Matrix4();\r\n\tthis.bindMatrixInverse = new THREE.Matrix4();\r\n\r\n\t// init bones\r\n\r\n\t// TODO: remove bone creation as there is no reason (other than\r\n\t// convenience) for THREE.SkinnedMesh to do this.\r\n\r\n\tvar bones = [];\r\n\r\n\tif ( this.geometry && this.geometry.bones !== undefined ) {\r\n\r\n\t\tvar bone, gbone;\r\n\r\n\t\tfor ( var b = 0, bl = this.geometry.bones.length; b < bl; ++ b ) {\r\n\r\n\t\t\tgbone = this.geometry.bones[ b ];\r\n\r\n\t\t\tbone = new THREE.Bone( this );\r\n\t\t\tbones.push( bone );\r\n\r\n\t\t\tbone.name = gbone.name;\r\n\t\t\tbone.position.fromArray( gbone.pos );\r\n\t\t\tbone.quaternion.fromArray( gbone.rotq );\r\n\t\t\tif ( gbone.scl !== undefined ) bone.scale.fromArray( gbone.scl );\r\n\r\n\t\t}\r\n\r\n\t\tfor ( var b = 0, bl = this.geometry.bones.length; b < bl; ++ b ) {\r\n\r\n\t\t\tgbone = this.geometry.bones[ b ];\r\n\r\n\t\t\tif ( gbone.parent !== - 1 ) {\r\n\r\n\t\t\t\tbones[ gbone.parent ].add( bones[ b ] );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tthis.add( bones[ b ] );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tthis.normalizeSkinWeights();\r\n\r\n\tthis.updateMatrixWorld( true );\r\n\tthis.bind( new THREE.Skeleton( bones, undefined, useVertexTexture ), this.matrixWorld );\r\n\r\n};\r\n\r\n\r\nTHREE.SkinnedMesh.prototype = Object.create( THREE.Mesh.prototype );\r\nTHREE.SkinnedMesh.prototype.constructor = THREE.SkinnedMesh;\r\n\r\nTHREE.SkinnedMesh.prototype.bind = function( skeleton, bindMatrix ) {\r\n\r\n\tthis.skeleton = skeleton;\r\n\r\n\tif ( bindMatrix === undefined ) {\r\n\r\n\t\tthis.updateMatrixWorld( true );\r\n\t\t\r\n\t\tthis.skeleton.calculateInverses();\r\n\r\n\t\tbindMatrix = this.matrixWorld;\r\n\r\n\t}\r\n\r\n\tthis.bindMatrix.copy( bindMatrix );\r\n\tthis.bindMatrixInverse.getInverse( bindMatrix );\r\n\r\n};\r\n\r\nTHREE.SkinnedMesh.prototype.pose = function () {\r\n\r\n\tthis.skeleton.pose();\r\n\r\n};\r\n\r\nTHREE.SkinnedMesh.prototype.normalizeSkinWeights = function () {\r\n\r\n\tif ( this.geometry instanceof THREE.Geometry ) {\r\n\r\n\t\tfor ( var i = 0; i < this.geometry.skinIndices.length; i ++ ) {\r\n\r\n\t\t\tvar sw = this.geometry.skinWeights[ i ];\r\n\r\n\t\t\tvar scale = 1.0 / sw.lengthManhattan();\r\n\r\n\t\t\tif ( scale !== Infinity ) {\r\n\r\n\t\t\t\tsw.multiplyScalar( scale );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tsw.set( 1 ); // this will be normalized by the shader anyway\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t} else {\r\n\r\n\t\t// skinning weights assumed to be normalized for THREE.BufferGeometry\r\n\r\n\t}\r\n\r\n};\r\n\r\nTHREE.SkinnedMesh.prototype.updateMatrixWorld = function( force ) {\r\n\r\n\tTHREE.Mesh.prototype.updateMatrixWorld.call( this, true );\r\n\r\n\tif ( this.bindMode === \"attached\" ) {\r\n\r\n\t\tthis.bindMatrixInverse.getInverse( this.matrixWorld );\r\n\r\n\t} else if ( this.bindMode === \"detached\" ) {\r\n\r\n\t\tthis.bindMatrixInverse.getInverse( this.bindMatrix );\r\n\r\n\t} else {\r\n\r\n\t\tconsole.warn( 'THREE.SkinnedMesh unrecognized bindMode: ' + this.bindMode );\r\n\r\n\t}\r\n\r\n};\r\n\r\nTHREE.SkinnedMesh.prototype.clone = function() {\r\n\r\n\treturn new this.constructor( this.geometry, this.material, this.useVertexTexture ).copy( this );\r\n\r\n};\r\n\r\n// File:src/objects/MorphAnimMesh.js\r\n\r\n/**\r\n * @author alteredq / http://alteredqualia.com/\r\n */\r\n\r\nTHREE.MorphAnimMesh = function ( geometry, material ) {\r\n\r\n\tTHREE.Mesh.call( this, geometry, material );\r\n\r\n\tthis.type = 'MorphAnimMesh';\r\n\r\n\t// API\r\n\r\n\tthis.duration = 1000; // milliseconds\r\n\tthis.mirroredLoop = false;\r\n\tthis.time = 0;\r\n\r\n\t// internals\r\n\r\n\tthis.lastKeyframe = 0;\r\n\tthis.currentKeyframe = 0;\r\n\r\n\tthis.direction = 1;\r\n\tthis.directionBackwards = false;\r\n\r\n\tthis.setFrameRange( 0, geometry.morphTargets.length - 1 );\r\n\r\n};\r\n\r\nTHREE.MorphAnimMesh.prototype = Object.create( THREE.Mesh.prototype );\r\nTHREE.MorphAnimMesh.prototype.constructor = THREE.MorphAnimMesh;\r\n\r\nTHREE.MorphAnimMesh.prototype.setFrameRange = function ( start, end ) {\r\n\r\n\tthis.startKeyframe = start;\r\n\tthis.endKeyframe = end;\r\n\r\n\tthis.length = this.endKeyframe - this.startKeyframe + 1;\r\n\r\n};\r\n\r\nTHREE.MorphAnimMesh.prototype.setDirectionForward = function () {\r\n\r\n\tthis.direction = 1;\r\n\tthis.directionBackwards = false;\r\n\r\n};\r\n\r\nTHREE.MorphAnimMesh.prototype.setDirectionBackward = function () {\r\n\r\n\tthis.direction = - 1;\r\n\tthis.directionBackwards = true;\r\n\r\n};\r\n\r\nTHREE.MorphAnimMesh.prototype.parseAnimations = function () {\r\n\r\n\tvar geometry = this.geometry;\r\n\r\n\tif ( ! geometry.animations ) geometry.animations = {};\r\n\r\n\tvar firstAnimation, animations = geometry.animations;\r\n\r\n\tvar pattern = /([a-z]+)_?(\\d+)/;\r\n\r\n\tfor ( var i = 0, il = geometry.morphTargets.length; i < il; i ++ ) {\r\n\r\n\t\tvar morph = geometry.morphTargets[ i ];\r\n\t\tvar parts = morph.name.match( pattern );\r\n\r\n\t\tif ( parts && parts.length > 1 ) {\r\n\r\n\t\t\tvar label = parts[ 1 ];\r\n\r\n\t\t\tif ( ! animations[ label ] ) animations[ label ] = { start: Infinity, end: - Infinity };\r\n\r\n\t\t\tvar animation = animations[ label ];\r\n\r\n\t\t\tif ( i < animation.start ) animation.start = i;\r\n\t\t\tif ( i > animation.end ) animation.end = i;\r\n\r\n\t\t\tif ( ! firstAnimation ) firstAnimation = label;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tgeometry.firstAnimation = firstAnimation;\r\n\r\n};\r\n\r\nTHREE.MorphAnimMesh.prototype.setAnimationLabel = function ( label, start, end ) {\r\n\r\n\tif ( ! this.geometry.animations ) this.geometry.animations = {};\r\n\r\n\tthis.geometry.animations[ label ] = { start: start, end: end };\r\n\r\n};\r\n\r\nTHREE.MorphAnimMesh.prototype.playAnimation = function ( label, fps ) {\r\n\r\n\tvar animation = this.geometry.animations[ label ];\r\n\r\n\tif ( animation ) {\r\n\r\n\t\tthis.setFrameRange( animation.start, animation.end );\r\n\t\tthis.duration = 1000 * ( ( animation.end - animation.start ) / fps );\r\n\t\tthis.time = 0;\r\n\r\n\t} else {\r\n\r\n\t\tconsole.warn( 'THREE.MorphAnimMesh: animation[' + label + '] undefined in .playAnimation()' );\r\n\r\n\t}\r\n\r\n};\r\n\r\nTHREE.MorphAnimMesh.prototype.updateAnimation = function ( delta ) {\r\n\r\n\tvar frameTime = this.duration / this.length;\r\n\r\n\tthis.time += this.direction * delta;\r\n\r\n\tif ( this.mirroredLoop ) {\r\n\r\n\t\tif ( this.time > this.duration || this.time < 0 ) {\r\n\r\n\t\t\tthis.direction *= - 1;\r\n\r\n\t\t\tif ( this.time > this.duration ) {\r\n\r\n\t\t\t\tthis.time = this.duration;\r\n\t\t\t\tthis.directionBackwards = true;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( this.time < 0 ) {\r\n\r\n\t\t\t\tthis.time = 0;\r\n\t\t\t\tthis.directionBackwards = false;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t} else {\r\n\r\n\t\tthis.time = this.time % this.duration;\r\n\r\n\t\tif ( this.time < 0 ) this.time += this.duration;\r\n\r\n\t}\r\n\r\n\tvar keyframe = this.startKeyframe + THREE.Math.clamp( Math.floor( this.time / frameTime ), 0, this.length - 1 );\r\n\r\n\tvar influences = this.morphTargetInfluences;\r\n\r\n\tif ( keyframe !== this.currentKeyframe ) {\r\n\r\n\t\tinfluences[ this.lastKeyframe ] = 0;\r\n\t\tinfluences[ this.currentKeyframe ] = 1;\r\n\t\tinfluences[ keyframe ] = 0;\r\n\r\n\t\tthis.lastKeyframe = this.currentKeyframe;\r\n\t\tthis.currentKeyframe = keyframe;\r\n\r\n\t}\r\n\r\n\tvar mix = ( this.time % frameTime ) / frameTime;\r\n\r\n\tif ( this.directionBackwards ) {\r\n\r\n\t\tmix = 1 - mix;\r\n\r\n\t}\r\n\r\n\tinfluences[ this.currentKeyframe ] = mix;\r\n\tinfluences[ this.lastKeyframe ] = 1 - mix;\r\n\r\n};\r\n\r\nTHREE.MorphAnimMesh.prototype.interpolateTargets = function ( a, b, t ) {\r\n\r\n\tvar influences = this.morphTargetInfluences;\r\n\r\n\tfor ( var i = 0, l = influences.length; i < l; i ++ ) {\r\n\r\n\t\tinfluences[ i ] = 0;\r\n\r\n\t}\r\n\r\n\tif ( a > - 1 ) influences[ a ] = 1 - t;\r\n\tif ( b > - 1 ) influences[ b ] = t;\r\n\r\n};\r\n\r\nTHREE.MorphAnimMesh.prototype.copy = function ( source ) {\r\n\r\n\tTHREE.Mesh.prototype.copy.call( this, source );\r\n\r\n\tthis.duration = source.duration;\r\n\tthis.mirroredLoop = source.mirroredLoop;\r\n\tthis.time = source.time;\r\n\r\n\tthis.lastKeyframe = source.lastKeyframe;\r\n\tthis.currentKeyframe = source.currentKeyframe;\r\n\r\n\tthis.direction = source.direction;\r\n\tthis.directionBackwards = source.directionBackwards;\r\n\r\n\treturn this;\r\n\r\n};\r\n\r\n// File:src/objects/LOD.js\r\n\r\n/**\r\n * @author mikael emtinger / http://gomo.se/\r\n * @author alteredq / http://alteredqualia.com/\r\n * @author mrdoob / http://mrdoob.com/\r\n */\r\n\r\nTHREE.LOD = function () {\r\n\r\n\tTHREE.Object3D.call( this );\r\n\r\n\tthis.type = 'LOD';\r\n\r\n\tObject.defineProperties( this, {\r\n\t\tlevels: {\r\n\t\t\tenumerable: true,\r\n\t\t\tvalue: []\r\n\t\t},\r\n\t\tobjects: {\r\n\t\t\tget: function () {\r\n\r\n\t\t\t\tconsole.warn( 'THREE.LOD: .objects has been renamed to .levels.' );\r\n\t\t\t\treturn this.levels;\r\n\r\n\t\t\t}\r\n\t\t}\r\n\t} );\r\n\r\n};\r\n\r\n\r\nTHREE.LOD.prototype = Object.create( THREE.Object3D.prototype );\r\nTHREE.LOD.prototype.constructor = THREE.LOD;\r\n\r\nTHREE.LOD.prototype.addLevel = function ( object, distance ) {\r\n\r\n\tif ( distance === undefined ) distance = 0;\r\n\r\n\tdistance = Math.abs( distance );\r\n\r\n\tvar levels = this.levels;\r\n\r\n\tfor ( var l = 0; l < levels.length; l ++ ) {\r\n\r\n\t\tif ( distance < levels[ l ].distance ) {\r\n\r\n\t\t\tbreak;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tlevels.splice( l, 0, { distance: distance, object: object } );\r\n\r\n\tthis.add( object );\r\n\r\n};\r\n\r\nTHREE.LOD.prototype.getObjectForDistance = function ( distance ) {\r\n\r\n\tvar levels = this.levels;\r\n\r\n\tfor ( var i = 1, l = levels.length; i < l; i ++ ) {\r\n\r\n\t\tif ( distance < levels[ i ].distance ) {\r\n\r\n\t\t\tbreak;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\treturn levels[ i - 1 ].object;\r\n\r\n};\r\n\r\nTHREE.LOD.prototype.raycast = ( function () {\r\n\r\n\tvar matrixPosition = new THREE.Vector3();\r\n\r\n\treturn function raycast( raycaster, intersects ) {\r\n\r\n\t\tmatrixPosition.setFromMatrixPosition( this.matrixWorld );\r\n\r\n\t\tvar distance = raycaster.ray.origin.distanceTo( matrixPosition );\r\n\r\n\t\tthis.getObjectForDistance( distance ).raycast( raycaster, intersects );\r\n\r\n\t};\r\n\r\n}() );\r\n\r\nTHREE.LOD.prototype.update = function () {\r\n\r\n\tvar v1 = new THREE.Vector3();\r\n\tvar v2 = new THREE.Vector3();\r\n\r\n\treturn function update( camera ) {\r\n\r\n\t\tvar levels = this.levels;\r\n\r\n\t\tif ( levels.length > 1 ) {\r\n\r\n\t\t\tv1.setFromMatrixPosition( camera.matrixWorld );\r\n\t\t\tv2.setFromMatrixPosition( this.matrixWorld );\r\n\r\n\t\t\tvar distance = v1.distanceTo( v2 );\r\n\r\n\t\t\tlevels[ 0 ].object.visible = true;\r\n\r\n\t\t\tfor ( var i = 1, l = levels.length; i < l; i ++ ) {\r\n\r\n\t\t\t\tif ( distance >= levels[ i ].distance ) {\r\n\r\n\t\t\t\t\tlevels[ i - 1 ].object.visible = false;\r\n\t\t\t\t\tlevels[ i ].object.visible = true;\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\tfor ( ; i < l; i ++ ) {\r\n\r\n\t\t\t\tlevels[ i ].object.visible = false;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t};\r\n\r\n}();\r\n\r\nTHREE.LOD.prototype.copy = function ( source ) {\r\n\r\n\tTHREE.Object3D.prototype.copy.call( this, source, false );\r\n\r\n\tvar levels = source.levels;\r\n\r\n\tfor ( var i = 0, l = levels.length; i < l; i ++ ) {\r\n\r\n\t\tvar level = levels[ i ];\r\n\r\n\t\tthis.addLevel( level.object.clone(), level.distance );\r\n\r\n\t}\r\n\r\n\treturn this;\r\n\r\n};\r\n\r\nTHREE.LOD.prototype.toJSON = function ( meta ) {\r\n\r\n\tvar data = THREE.Object3D.prototype.toJSON.call( this, meta );\r\n\r\n\tdata.object.levels = [];\r\n\r\n\tvar levels = this.levels;\r\n\r\n\tfor ( var i = 0, l = levels.length; i < l; i ++ ) {\r\n\r\n\t\tvar level = levels[ i ];\r\n\r\n\t\tdata.object.levels.push( {\r\n\t\t\tobject: level.object.uuid,\r\n\t\t\tdistance: level.distance\r\n\t\t} );\r\n\r\n\t}\r\n\r\n\treturn data;\r\n\r\n};\r\n\r\n// File:src/objects/Sprite.js\r\n\r\n/**\r\n * @author mikael emtinger / http://gomo.se/\r\n * @author alteredq / http://alteredqualia.com/\r\n */\r\n\r\nTHREE.Sprite = ( function () {\r\n\r\n\tvar indices = new Uint16Array( [ 0, 1, 2, 0, 2, 3 ] );\r\n\tvar vertices = new Float32Array( [ - 0.5, - 0.5, 0, 0.5, - 0.5, 0, 0.5, 0.5, 0, - 0.5, 0.5, 0 ] );\r\n\tvar uvs = new Float32Array( [ 0, 0, 1, 0, 1, 1, 0, 1 ] );\r\n\r\n\tvar geometry = new THREE.BufferGeometry();\r\n\tgeometry.addIndex( new THREE.BufferAttribute( indices, 1 ) );\r\n\tgeometry.addAttribute( 'position', new THREE.BufferAttribute( vertices, 3 ) );\r\n\tgeometry.addAttribute( 'uv', new THREE.BufferAttribute( uvs, 2 ) );\r\n\r\n\treturn function Sprite( material ) {\r\n\r\n\t\tTHREE.Object3D.call( this );\r\n\r\n\t\tthis.type = 'Sprite';\r\n\r\n\t\tthis.geometry = geometry;\r\n\t\tthis.material = ( material !== undefined ) ? material : new THREE.SpriteMaterial();\r\n\r\n\t};\r\n\r\n} )();\r\n\r\nTHREE.Sprite.prototype = Object.create( THREE.Object3D.prototype );\r\nTHREE.Sprite.prototype.constructor = THREE.Sprite;\r\n\r\nTHREE.Sprite.prototype.raycast = ( function () {\r\n\r\n\tvar matrixPosition = new THREE.Vector3();\r\n\r\n\treturn function raycast( raycaster, intersects ) {\r\n\r\n\t\tmatrixPosition.setFromMatrixPosition( this.matrixWorld );\r\n\r\n\t\tvar distanceSq = raycaster.ray.distanceSqToPoint( matrixPosition );\r\n\t\tvar guessSizeSq = this.scale.x * this.scale.y;\r\n\r\n\t\tif ( distanceSq > guessSizeSq ) {\r\n\r\n\t\t\treturn;\r\n\r\n\t\t}\r\n\r\n\t\tintersects.push( {\r\n\r\n\t\t\tdistance: Math.sqrt( distanceSq ),\r\n\t\t\tpoint: this.position,\r\n\t\t\tface: null,\r\n\t\t\tobject: this\r\n\r\n\t\t} );\r\n\r\n\t};\r\n\r\n}() );\r\n\r\nTHREE.Sprite.prototype.clone = function () {\r\n\r\n\treturn new this.constructor( this.material ).copy( this );\r\n\r\n};\r\n\r\nTHREE.Sprite.prototype.toJSON = function ( meta ) {\r\n\r\n\tvar data = THREE.Object3D.prototype.toJSON.call( this, meta );\r\n\r\n\t// only serialize if not in meta materials cache\r\n\tif ( meta.materials[ this.material.uuid ] === undefined ) {\r\n\r\n\t\tmeta.materials[ this.material.uuid ] = this.material.toJSON();\r\n\r\n\t}\r\n\r\n\tdata.object.material = this.material.uuid;\r\n\r\n\treturn data;\r\n\r\n};\r\n\r\n// Backwards compatibility\r\n\r\nTHREE.Particle = THREE.Sprite;\r\n\r\n// File:src/objects/LensFlare.js\r\n\r\n/**\r\n * @author mikael emtinger / http://gomo.se/\r\n * @author alteredq / http://alteredqualia.com/\r\n */\r\n\r\nTHREE.LensFlare = function ( texture, size, distance, blending, color ) {\r\n\r\n\tTHREE.Object3D.call( this );\r\n\r\n\tthis.lensFlares = [];\r\n\r\n\tthis.positionScreen = new THREE.Vector3();\r\n\tthis.customUpdateCallback = undefined;\r\n\r\n\tif ( texture !== undefined ) {\r\n\r\n\t\tthis.add( texture, size, distance, blending, color );\r\n\r\n\t}\r\n\r\n};\r\n\r\nTHREE.LensFlare.prototype = Object.create( THREE.Object3D.prototype );\r\nTHREE.LensFlare.prototype.constructor = THREE.LensFlare;\r\n\r\n\r\n/*\r\n * Add: adds another flare\r\n */\r\n\r\nTHREE.LensFlare.prototype.add = function ( texture, size, distance, blending, color, opacity ) {\r\n\r\n\tif ( size === undefined ) size = - 1;\r\n\tif ( distance === undefined ) distance = 0;\r\n\tif ( opacity === undefined ) opacity = 1;\r\n\tif ( color === undefined ) color = new THREE.Color( 0xffffff );\r\n\tif ( blending === undefined ) blending = THREE.NormalBlending;\r\n\r\n\tdistance = Math.min( distance, Math.max( 0, distance ) );\r\n\r\n\tthis.lensFlares.push( {\r\n\t\ttexture: texture,\t// THREE.Texture\r\n\t\tsize: size, \t\t// size in pixels (-1 = use texture.width)\r\n\t\tdistance: distance, \t// distance (0-1) from light source (0=at light source)\r\n\t\tx: 0, y: 0, z: 0,\t// screen position (-1 => 1) z = 0 is in front z = 1 is back\r\n\t\tscale: 1, \t\t// scale\r\n\t\trotation: 0, \t\t// rotation\r\n\t\topacity: opacity,\t// opacity\r\n\t\tcolor: color,\t\t// color\r\n\t\tblending: blending\t// blending\r\n\t} );\r\n\r\n};\r\n\r\n/*\r\n * Update lens flares update positions on all flares based on the screen position\r\n * Set myLensFlare.customUpdateCallback to alter the flares in your project specific way.\r\n */\r\n\r\nTHREE.LensFlare.prototype.updateLensFlares = function () {\r\n\r\n\tvar f, fl = this.lensFlares.length;\r\n\tvar flare;\r\n\tvar vecX = - this.positionScreen.x * 2;\r\n\tvar vecY = - this.positionScreen.y * 2;\r\n\r\n\tfor ( f = 0; f < fl; f ++ ) {\r\n\r\n\t\tflare = this.lensFlares[ f ];\r\n\r\n\t\tflare.x = this.positionScreen.x + vecX * flare.distance;\r\n\t\tflare.y = this.positionScreen.y + vecY * flare.distance;\r\n\r\n\t\tflare.wantedRotation = flare.x * Math.PI * 0.25;\r\n\t\tflare.rotation += ( flare.wantedRotation - flare.rotation ) * 0.25;\r\n\r\n\t}\r\n\r\n};\r\n\r\nTHREE.LensFlare.prototype.copy = function ( source ) {\r\n\r\n\tTHREE.Object3D.prototype.copy.call( this, source );\r\n\r\n\tthis.positionScreen.copy( source.positionScreen );\r\n\tthis.customUpdateCallback = source.customUpdateCallback;\r\n\r\n\tfor ( var i = 0, l = source.lensFlares.length; i < l; i ++ ) {\r\n\r\n\t\tthis.lensFlares.push( source.lensFlares[ i ] );\r\n\r\n\t}\r\n\r\n\treturn this;\r\n\r\n};\r\n\r\n// File:src/scenes/Scene.js\r\n\r\n/**\r\n * @author mrdoob / http://mrdoob.com/\r\n */\r\n\r\nTHREE.Scene = function () {\r\n\r\n\tTHREE.Object3D.call( this );\r\n\r\n\tthis.type = 'Scene';\r\n\r\n\tthis.fog = null;\r\n\tthis.overrideMaterial = null;\r\n\r\n\tthis.autoUpdate = true; // checked by the renderer\r\n\r\n};\r\n\r\nTHREE.Scene.prototype = Object.create( THREE.Object3D.prototype );\r\nTHREE.Scene.prototype.constructor = THREE.Scene;\r\n\r\nTHREE.Scene.prototype.copy = function ( source ) {\r\n\r\n\tTHREE.Object3D.prototype.copy.call( this, source );\r\n\r\n\tif ( source.fog !== null ) this.fog = source.fog.clone();\r\n\tif ( source.overrideMaterial !== null ) this.overrideMaterial = source.overrideMaterial.clone();\r\n\r\n\tthis.autoUpdate = source.autoUpdate;\r\n\tthis.matrixAutoUpdate = source.matrixAutoUpdate;\r\n\r\n\treturn this;\r\n\r\n};\r\n\r\n// File:src/scenes/Fog.js\r\n\r\n/**\r\n * @author mrdoob / http://mrdoob.com/\r\n * @author alteredq / http://alteredqualia.com/\r\n */\r\n\r\nTHREE.Fog = function ( color, near, far ) {\r\n\r\n\tthis.name = '';\r\n\r\n\tthis.color = new THREE.Color( color );\r\n\r\n\tthis.near = ( near !== undefined ) ? near : 1;\r\n\tthis.far = ( far !== undefined ) ? far : 1000;\r\n\r\n};\r\n\r\nTHREE.Fog.prototype.clone = function () {\r\n\r\n\treturn new THREE.Fog( this.color.getHex(), this.near, this.far );\r\n\r\n};\r\n\r\n// File:src/scenes/FogExp2.js\r\n\r\n/**\r\n * @author mrdoob / http://mrdoob.com/\r\n * @author alteredq / http://alteredqualia.com/\r\n */\r\n\r\nTHREE.FogExp2 = function ( color, density ) {\r\n\r\n\tthis.name = '';\r\n\r\n\tthis.color = new THREE.Color( color );\r\n\tthis.density = ( density !== undefined ) ? density : 0.00025;\r\n\r\n};\r\n\r\nTHREE.FogExp2.prototype.clone = function () {\r\n\r\n\treturn new THREE.FogExp2( this.color.getHex(), this.density );\r\n\r\n};\r\n\r\n// File:src/renderers/shaders/ShaderChunk.js\r\n\r\nTHREE.ShaderChunk = {};\r\n\r\n// File:src/renderers/shaders/ShaderChunk/alphamap_fragment.glsl\r\n\r\nTHREE.ShaderChunk[ 'alphamap_fragment'] = \"#ifdef USE_ALPHAMAP\\n\\n\tdiffuseColor.a *= texture2D( alphaMap, vUv ).g;\\n\\n#endif\\n\";\r\n\r\n// File:src/renderers/shaders/ShaderChunk/alphamap_pars_fragment.glsl\r\n\r\nTHREE.ShaderChunk[ 'alphamap_pars_fragment'] = \"#ifdef USE_ALPHAMAP\\n\\n\tuniform sampler2D alphaMap;\\n\\n#endif\\n\";\r\n\r\n// File:src/renderers/shaders/ShaderChunk/alphatest_fragment.glsl\r\n\r\nTHREE.ShaderChunk[ 'alphatest_fragment'] = \"#ifdef ALPHATEST\\n\\n\tif ( diffuseColor.a < ALPHATEST ) discard;\\n\\n#endif\\n\";\r\n\r\n// File:src/renderers/shaders/ShaderChunk/aomap_fragment.glsl\r\n\r\nTHREE.ShaderChunk[ 'aomap_fragment'] = \"#ifdef USE_AOMAP\\n\\n\ttotalAmbientLight *= ( texture2D( aoMap, vUv2 ).r - 1.0 ) * aoMapIntensity + 1.0;\\n\\n#endif\\n\";\r\n\r\n// File:src/renderers/shaders/ShaderChunk/aomap_pars_fragment.glsl\r\n\r\nTHREE.ShaderChunk[ 'aomap_pars_fragment'] = \"#ifdef USE_AOMAP\\n\\n\tuniform sampler2D aoMap;\\n\tuniform float aoMapIntensity;\\n\\n#endif\";\r\n\r\n// File:src/renderers/shaders/ShaderChunk/begin_vertex.glsl\r\n\r\nTHREE.ShaderChunk[ 'begin_vertex'] = \"\\nvec3 transformed = vec3( position );\\n\";\r\n\r\n// File:src/renderers/shaders/ShaderChunk/beginnormal_vertex.glsl\r\n\r\nTHREE.ShaderChunk[ 'beginnormal_vertex'] = \"\\nvec3 objectNormal = vec3( normal );\\n\";\r\n\r\n// File:src/renderers/shaders/ShaderChunk/bumpmap_pars_fragment.glsl\r\n\r\nTHREE.ShaderChunk[ 'bumpmap_pars_fragment'] = \"#ifdef USE_BUMPMAP\\n\\n\tuniform sampler2D bumpMap;\\n\tuniform float bumpScale;\\n\\n\t// Derivative maps - bump mapping unparametrized surfaces by Morten Mikkelsen\\n\t// http://mmikkelsen3d.blogspot.sk/2011/07/derivative-maps.html\\n\\n\t// Evaluate the derivative of the height w.r.t. screen-space using forward differencing (listing 2)\\n\\n\tvec2 dHdxy_fwd() {\\n\\n\t\tvec2 dSTdx = dFdx( vUv );\\n\t\tvec2 dSTdy = dFdy( vUv );\\n\\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vUv ).x;\\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;\\n\\n\t\treturn vec2( dBx, dBy );\\n\\n\t}\\n\\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy ) {\\n\\n\t\tvec3 vSigmaX = dFdx( surf_pos );\\n\t\tvec3 vSigmaY = dFdy( surf_pos );\\n\t\tvec3 vN = surf_norm;\t\t// normalized\\n\\n\t\tvec3 R1 = cross( vSigmaY, vN );\\n\t\tvec3 R2 = cross( vN, vSigmaX );\\n\\n\t\tfloat fDet = dot( vSigmaX, R1 );\\n\\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\\n\\n\t}\\n\\n#endif\\n\";\r\n\r\n// File:src/renderers/shaders/ShaderChunk/color_fragment.glsl\r\n\r\nTHREE.ShaderChunk[ 'color_fragment'] = \"#ifdef USE_COLOR\\n\\n\tdiffuseColor.rgb *= vColor;\\n\\n#endif\";\r\n\r\n// File:src/renderers/shaders/ShaderChunk/color_pars_fragment.glsl\r\n\r\nTHREE.ShaderChunk[ 'color_pars_fragment'] = \"#ifdef USE_COLOR\\n\\n\tvarying vec3 vColor;\\n\\n#endif\\n\";\r\n\r\n// File:src/renderers/shaders/ShaderChunk/color_pars_vertex.glsl\r\n\r\nTHREE.ShaderChunk[ 'color_pars_vertex'] = \"#ifdef USE_COLOR\\n\\n\tvarying vec3 vColor;\\n\\n#endif\";\r\n\r\n// File:src/renderers/shaders/ShaderChunk/color_vertex.glsl\r\n\r\nTHREE.ShaderChunk[ 'color_vertex'] = \"#ifdef USE_COLOR\\n\\n\tvColor.xyz = color.xyz;\\n\\n#endif\";\r\n\r\n// File:src/renderers/shaders/ShaderChunk/common.glsl\r\n\r\nTHREE.ShaderChunk[ 'common'] = \"#define PI 3.14159\\n#define PI2 6.28318\\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\\nvec3 transformDirection( in vec3 normal, in mat4 matrix ) {\\n\\n\treturn normalize( ( matrix * vec4( normal, 0.0 ) ).xyz );\\n\\n}\\n\\n// http://en.wikibooks.org/wiki/GLSL_Programming/Applying_Matrix_Transformations\\nvec3 inverseTransformDirection( in vec3 normal, in mat4 matrix ) {\\n\\n\treturn normalize( ( vec4( normal, 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\\nfloat calcLightAttenuation( float lightDistance, float cutoffDistance, float decayExponent ) {\\n\\n\tif ( decayExponent > 0.0 ) {\\n\\n\t return pow( saturate( -lightDistance / cutoffDistance + 1.0 ), decayExponent );\\n\\n\t}\\n\\n\treturn 1.0;\\n\\n}\\n\\nvec3 F_Schlick( in vec3 specularColor, in float dotLH ) {\\n\\n\t// Original approximation by Christophe Schlick '94\\n\t//;float fresnel = pow( 1.0 - dotLH, 5.0 );\\n\\n\t// Optimized variant (presented by Epic at SIGGRAPH '13)\\n\tfloat fresnel = exp2( ( -5.55437 * dotLH - 6.98316 ) * dotLH );\\n\\n\treturn ( 1.0 - specularColor ) * fresnel + specularColor;\\n\\n}\\n\\nfloat G_BlinnPhong_Implicit( /* in float dotNL, in float dotNV */ ) {\\n\\n\t// geometry term is (nā‹…l)(nā‹…v) / 4(nā‹…l)(nā‹…v)\\n\\n\treturn 0.25;\\n\\n}\\n\\nfloat D_BlinnPhong( in float shininess, in float dotNH ) {\\n\\n\t// factor of 1/PI in distribution term omitted\\n\\n\treturn ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\\n\\n}\\n\\nvec3 BRDF_BlinnPhong( in vec3 specularColor, in float shininess, in vec3 normal, in vec3 lightDir, in vec3 viewDir ) {\\n\\n\tvec3 halfDir = normalize( lightDir + viewDir );\\n\\n\t//float dotNL = saturate( dot( normal, lightDir ) );\\n\t//float dotNV = saturate( dot( normal, viewDir ) );\\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\\n\tfloat dotLH = saturate( dot( lightDir, halfDir ) );\\n\\n\tvec3 F = F_Schlick( specularColor, dotLH );\\n\\n\tfloat G = G_BlinnPhong_Implicit( /* dotNL, dotNV */ );\\n\\n\tfloat D = D_BlinnPhong( shininess, dotNH );\\n\\n\treturn F * G * D;\\n\\n}\\n\\nvec3 inputToLinear( in vec3 a ) {\\n\\n\t#ifdef GAMMA_INPUT\\n\\n\t\treturn pow( a, vec3( float( GAMMA_FACTOR ) ) );\\n\\n\t#else\\n\\n\t\treturn a;\\n\\n\t#endif\\n\\n}\\n\\nvec3 linearToOutput( in vec3 a ) {\\n\\n\t#ifdef GAMMA_OUTPUT\\n\\n\t\treturn pow( a, vec3( 1.0 / float( GAMMA_FACTOR ) ) );\\n\\n\t#else\\n\\n\t\treturn a;\\n\\n\t#endif\\n\\n}\\n\";\r\n\r\n// File:src/renderers/shaders/ShaderChunk/defaultnormal_vertex.glsl\r\n\r\nTHREE.ShaderChunk[ 'defaultnormal_vertex'] = \"#ifdef FLIP_SIDED\\n\\n\tobjectNormal = -objectNormal;\\n\\n#endif\\n\\nvec3 transformedNormal = normalMatrix * objectNormal;\\n\";\r\n\r\n// File:src/renderers/shaders/ShaderChunk/displacementmap_vertex.glsl\r\n\r\nTHREE.ShaderChunk[ 'displacementmap_vertex'] = \"#ifdef USE_DISPLACEMENTMAP\\n\\n\ttransformed += normal * ( texture2D( displacementMap, uv ).x * displacementScale + displacementBias );\\n\\n#endif\\n\";\r\n\r\n// File:src/renderers/shaders/ShaderChunk/displacementmap_pars_vertex.glsl\r\n\r\nTHREE.ShaderChunk[ 'displacementmap_pars_vertex'] = \"#ifdef USE_DISPLACEMENTMAP\\n\\n\tuniform sampler2D displacementMap;\\n\tuniform float displacementScale;\\n\tuniform float displacementBias;\\n\\n#endif\\n\";\r\n\r\n// File:src/renderers/shaders/ShaderChunk/emissivemap_fragment.glsl\r\n\r\nTHREE.ShaderChunk[ 'emissivemap_fragment'] = \"#ifdef USE_EMISSIVEMAP\\n\\n\tvec4 emissiveColor = texture2D( emissiveMap, vUv );\\n\\n\temissiveColor.rgb = inputToLinear( emissiveColor.rgb );\\n\\n\ttotalEmissiveLight *= emissiveColor.rgb;\\n\\n#endif\\n\";\r\n\r\n// File:src/renderers/shaders/ShaderChunk/emissivemap_pars_fragment.glsl\r\n\r\nTHREE.ShaderChunk[ 'emissivemap_pars_fragment'] = \"#ifdef USE_EMISSIVEMAP\\n\\n\tuniform sampler2D emissiveMap;\\n\\n#endif\\n\";\r\n\r\n// File:src/renderers/shaders/ShaderChunk/envmap_fragment.glsl\r\n\r\nTHREE.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\t\tvec4 envColor = textureCube( envMap, flipNormal * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\\n\\n\t#elif defined( ENVMAP_TYPE_EQUIREC )\\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\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\t#endif\\n\\n\tenvColor.xyz = inputToLinear( envColor.xyz );\\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\";\r\n\r\n// File:src/renderers/shaders/ShaderChunk/envmap_pars_fragment.glsl\r\n\r\nTHREE.ShaderChunk[ 'envmap_pars_fragment'] = \"#ifdef USE_ENVMAP\\n\\n\tuniform float reflectivity;\\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 )\\n\\n\t\tuniform float refractionRatio;\\n\\n\t#else\\n\\n\t\tvarying vec3 vReflect;\\n\\n\t#endif\\n\\n#endif\\n\";\r\n\r\n// File:src/renderers/shaders/ShaderChunk/envmap_pars_vertex.glsl\r\n\r\nTHREE.ShaderChunk[ 'envmap_pars_vertex'] = \"#if defined( USE_ENVMAP ) && ! defined( USE_BUMPMAP ) && ! defined( USE_NORMALMAP ) && ! defined( PHONG )\\n\\n\tvarying vec3 vReflect;\\n\\n\tuniform float refractionRatio;\\n\\n#endif\\n\";\r\n\r\n// File:src/renderers/shaders/ShaderChunk/envmap_vertex.glsl\r\n\r\nTHREE.ShaderChunk[ 'envmap_vertex'] = \"#if defined( USE_ENVMAP ) && ! defined( USE_BUMPMAP ) && ! defined( USE_NORMALMAP ) && ! defined( PHONG )\\n\\n\tvec3 worldNormal = transformDirection( objectNormal, modelMatrix );\\n\\n\tvec3 cameraToVertex = normalize( worldPosition.xyz - cameraPosition );\\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\";\r\n\r\n// File:src/renderers/shaders/ShaderChunk/fog_fragment.glsl\r\n\r\nTHREE.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\t\\n\toutgoingLight = mix( outgoingLight, fogColor, fogFactor );\\n\\n#endif\";\r\n\r\n// File:src/renderers/shaders/ShaderChunk/fog_pars_fragment.glsl\r\n\r\nTHREE.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\";\r\n\r\n// File:src/renderers/shaders/ShaderChunk/lightmap_fragment.glsl\r\n\r\nTHREE.ShaderChunk[ 'lightmap_fragment'] = \"#ifdef USE_LIGHTMAP\\n\\n\ttotalAmbientLight += texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\\n\\n#endif\\n\";\r\n\r\n// File:src/renderers/shaders/ShaderChunk/lightmap_pars_fragment.glsl\r\n\r\nTHREE.ShaderChunk[ 'lightmap_pars_fragment'] = \"#ifdef USE_LIGHTMAP\\n\\n\tuniform sampler2D lightMap;\\n\tuniform float lightMapIntensity;\\n\\n#endif\";\r\n\r\n// File:src/renderers/shaders/ShaderChunk/lights_lambert_pars_vertex.glsl\r\n\r\nTHREE.ShaderChunk[ 'lights_lambert_pars_vertex'] = \"uniform vec3 ambientLightColor;\\n\\n#if MAX_DIR_LIGHTS > 0\\n\\n\tuniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];\\n\tuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\\n\\n#endif\\n\\n#if MAX_HEMI_LIGHTS > 0\\n\\n\tuniform vec3 hemisphereLightSkyColor[ MAX_HEMI_LIGHTS ];\\n\tuniform vec3 hemisphereLightGroundColor[ MAX_HEMI_LIGHTS ];\\n\tuniform vec3 hemisphereLightDirection[ MAX_HEMI_LIGHTS ];\\n\\n#endif\\n\\n#if MAX_POINT_LIGHTS > 0\\n\\n\tuniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];\\n\tuniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\\n\tuniform float pointLightDistance[ MAX_POINT_LIGHTS ];\\n\tuniform float pointLightDecay[ MAX_POINT_LIGHTS ];\\n\\n#endif\\n\\n#if MAX_SPOT_LIGHTS > 0\\n\\n\tuniform vec3 spotLightColor[ MAX_SPOT_LIGHTS ];\\n\tuniform vec3 spotLightPosition[ MAX_SPOT_LIGHTS ];\\n\tuniform vec3 spotLightDirection[ MAX_SPOT_LIGHTS ];\\n\tuniform float spotLightDistance[ MAX_SPOT_LIGHTS ];\\n\tuniform float spotLightAngleCos[ MAX_SPOT_LIGHTS ];\\n\tuniform float spotLightExponent[ MAX_SPOT_LIGHTS ];\\n\tuniform float spotLightDecay[ MAX_SPOT_LIGHTS ];\\n\\n#endif\\n\";\r\n\r\n// File:src/renderers/shaders/ShaderChunk/lights_lambert_vertex.glsl\r\n\r\nTHREE.ShaderChunk[ 'lights_lambert_vertex'] = \"vLightFront = vec3( 0.0 );\\n\\n#ifdef DOUBLE_SIDED\\n\\n\tvLightBack = vec3( 0.0 );\\n\\n#endif\\n\\nvec3 normal = normalize( transformedNormal );\\n\\n#if MAX_POINT_LIGHTS > 0\\n\\n\tfor ( int i = 0; i < MAX_POINT_LIGHTS; i ++ ) {\\n\\n\t\tvec3 lightColor = pointLightColor[ i ];\\n\\n\t\tvec3 lVector = pointLightPosition[ i ] - mvPosition.xyz;\\n\t\tvec3 lightDir = normalize( lVector );\\n\\n\t\t// attenuation\\n\\n\t\tfloat attenuation = calcLightAttenuation( length( lVector ), pointLightDistance[ i ], pointLightDecay[ i ] );\\n\\n\t\t// diffuse\\n\\n\t\tfloat dotProduct = dot( normal, lightDir );\\n\\n\t\tvLightFront += lightColor * attenuation * saturate( dotProduct );\\n\\n\t\t#ifdef DOUBLE_SIDED\\n\\n\t\t\tvLightBack += lightColor * attenuation * saturate( - dotProduct );\\n\\n\t\t#endif\\n\\n\t}\\n\\n#endif\\n\\n#if MAX_SPOT_LIGHTS > 0\\n\\n\tfor ( int i = 0; i < MAX_SPOT_LIGHTS; i ++ ) {\\n\\n\t\tvec3 lightColor = spotLightColor[ i ];\\n\\n\t\tvec3 lightPosition = spotLightPosition[ i ];\\n\t\tvec3 lVector = lightPosition - mvPosition.xyz;\\n\t\tvec3 lightDir = normalize( lVector );\\n\\n\t\tfloat spotEffect = dot( spotLightDirection[ i ], lightDir );\\n\\n\t\tif ( spotEffect > spotLightAngleCos[ i ] ) {\\n\\n\t\t\tspotEffect = saturate( pow( saturate( spotEffect ), spotLightExponent[ i ] ) );\\n\\n\t\t\t// attenuation\\n\\n\t\t\tfloat attenuation = calcLightAttenuation( length( lVector ), spotLightDistance[ i ], spotLightDecay[ i ] );\\n\\n\t\t\tattenuation *= spotEffect;\\n\\n\t\t\t// diffuse\\n\\n\t\t\tfloat dotProduct = dot( normal, lightDir );\\n\\n\t\t\tvLightFront += lightColor * attenuation * saturate( dotProduct );\\n\\n\t\t\t#ifdef DOUBLE_SIDED\\n\\n\t\t\t\tvLightBack += lightColor * attenuation * saturate( - dotProduct );\\n\\n\t\t\t#endif\\n\\n\t\t}\\n\\n\t}\\n\\n#endif\\n\\n#if MAX_DIR_LIGHTS > 0\\n\\n\tfor ( int i = 0; i < MAX_DIR_LIGHTS; i ++ ) {\\n\\n\t\tvec3 lightColor = directionalLightColor[ i ];\\n\\n\t\tvec3 lightDir = directionalLightDirection[ i ];\\n\\n\t\t// diffuse\\n\\n\t\tfloat dotProduct = dot( normal, lightDir );\\n\\n\t\tvLightFront += lightColor * saturate( dotProduct );\\n\\n\t\t#ifdef DOUBLE_SIDED\\n\\n\t\t\tvLightBack += lightColor * saturate( - dotProduct );\\n\\n\t\t#endif\\n\\n\t}\\n\\n#endif\\n\\n#if MAX_HEMI_LIGHTS > 0\\n\\n\tfor ( int i = 0; i < MAX_HEMI_LIGHTS; i ++ ) {\\n\\n\t\tvec3 lightDir = hemisphereLightDirection[ i ];\\n\\n\t\t// diffuse\\n\\n\t\tfloat dotProduct = dot( normal, lightDir );\\n\\n\t\tfloat hemiDiffuseWeight = 0.5 * dotProduct + 0.5;\\n\\n\t\tvLightFront += mix( hemisphereLightGroundColor[ i ], hemisphereLightSkyColor[ i ], hemiDiffuseWeight );\\n\\n\t\t#ifdef DOUBLE_SIDED\\n\\n\t\t\tfloat hemiDiffuseWeightBack = - 0.5 * dotProduct + 0.5;\\n\\n\t\t\tvLightBack += mix( hemisphereLightGroundColor[ i ], hemisphereLightSkyColor[ i ], hemiDiffuseWeightBack );\\n\\n\t\t#endif\\n\\n\t}\\n\\n#endif\\n\\nvLightFront += ambientLightColor;\\n\\n#ifdef DOUBLE_SIDED\\n\\n\tvLightBack += ambientLightColor;\\n\\n#endif\\n\";\r\n\r\n// File:src/renderers/shaders/ShaderChunk/lights_phong_fragment.glsl\r\n\r\nTHREE.ShaderChunk[ 'lights_phong_fragment'] = \"#ifndef FLAT_SHADED\\n\\n\tvec3 normal = normalize( vNormal );\\n\\n\t#ifdef DOUBLE_SIDED\\n\\n\t\tnormal = normal * ( -1.0 + 2.0 * float( gl_FrontFacing ) );\\n\\n\t#endif\\n\\n#else\\n\\n\tvec3 fdx = dFdx( vViewPosition );\\n\tvec3 fdy = dFdy( vViewPosition );\\n\tvec3 normal = normalize( cross( fdx, fdy ) );\\n\\n#endif\\n\\n#ifdef USE_NORMALMAP\\n\\n\tnormal = perturbNormal2Arb( -vViewPosition, normal );\\n\\n#elif defined( USE_BUMPMAP )\\n\\n\tnormal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd() );\\n\\n#endif\\n\\nvec3 viewDir = normalize( vViewPosition );\\n\\nvec3 totalDiffuseLight = vec3( 0.0 );\\nvec3 totalSpecularLight = vec3( 0.0 );\\n\\n#if MAX_POINT_LIGHTS > 0\\n\\n\tfor ( int i = 0; i < MAX_POINT_LIGHTS; i ++ ) {\\n\\n\t\tvec3 lightColor = pointLightColor[ i ];\\n\\n\t\tvec3 lightPosition = pointLightPosition[ i ];\\n\t\tvec3 lVector = lightPosition + vViewPosition.xyz;\\n\t\tvec3 lightDir = normalize( lVector );\\n\\n\t\t// attenuation\\n\\n\t\tfloat attenuation = calcLightAttenuation( length( lVector ), pointLightDistance[ i ], pointLightDecay[ i ] );\\n\\n\t\t// diffuse\\n\\n\t\tfloat cosineTerm = saturate( dot( normal, lightDir ) );\\n\\n\t\ttotalDiffuseLight += lightColor * attenuation * cosineTerm;\\n\\n\t\t// specular\\n\\n\t\tvec3 brdf = BRDF_BlinnPhong( specular, shininess, normal, lightDir, viewDir );\\n\\n\t\ttotalSpecularLight += brdf * specularStrength * lightColor * attenuation * cosineTerm;\\n\\n\\n\t}\\n\\n#endif\\n\\n#if MAX_SPOT_LIGHTS > 0\\n\\n\tfor ( int i = 0; i < MAX_SPOT_LIGHTS; i ++ ) {\\n\\n\t\tvec3 lightColor = spotLightColor[ i ];\\n\\n\t\tvec3 lightPosition = spotLightPosition[ i ];\\n\t\tvec3 lVector = lightPosition + vViewPosition.xyz;\\n\t\tvec3 lightDir = normalize( lVector );\\n\\n\t\tfloat spotEffect = dot( spotLightDirection[ i ], lightDir );\\n\\n\t\tif ( spotEffect > spotLightAngleCos[ i ] ) {\\n\\n\t\t\tspotEffect = saturate( pow( saturate( spotEffect ), spotLightExponent[ i ] ) );\\n\\n\t\t\t// attenuation\\n\\n\t\t\tfloat attenuation = calcLightAttenuation( length( lVector ), spotLightDistance[ i ], spotLightDecay[ i ] );\\n\\n\t\t\tattenuation *= spotEffect;\\n\\n\t\t\t// diffuse\\n\\n\t\t\tfloat cosineTerm = saturate( dot( normal, lightDir ) );\\n\\n\t\t\ttotalDiffuseLight += lightColor * attenuation * cosineTerm;\\n\\n\t\t\t// specular\\n\\n\t\t\tvec3 brdf = BRDF_BlinnPhong( specular, shininess, normal, lightDir, viewDir );\\n\\n\t\t\ttotalSpecularLight += brdf * specularStrength * lightColor * attenuation * cosineTerm;\\n\\n\t\t}\\n\\n\t}\\n\\n#endif\\n\\n#if MAX_DIR_LIGHTS > 0\\n\\n\tfor( int i = 0; i < MAX_DIR_LIGHTS; i ++ ) {\\n\\n\t\tvec3 lightColor = directionalLightColor[ i ];\\n\\n\t\tvec3 lightDir = directionalLightDirection[ i ];\\n\\n\t\t// diffuse\\n\\n\t\tfloat cosineTerm = saturate( dot( normal, lightDir ) );\\n\\n\t\ttotalDiffuseLight += lightColor * cosineTerm;\\n\\n\t\t// specular\\n\\n\t\tvec3 brdf = BRDF_BlinnPhong( specular, shininess, normal, lightDir, viewDir );\\n\\n\t\ttotalSpecularLight += brdf * specularStrength * lightColor * cosineTerm;\\n\\n\t}\\n\\n#endif\\n\\n#if MAX_HEMI_LIGHTS > 0\\n\\n\tfor( int i = 0; i < MAX_HEMI_LIGHTS; i ++ ) {\\n\\n\t\tvec3 lightDir = hemisphereLightDirection[ i ];\\n\\n\t\t// diffuse\\n\\n\t\tfloat dotProduct = dot( normal, lightDir );\\n\\n\t\tfloat hemiDiffuseWeight = 0.5 * dotProduct + 0.5;\\n\\n\t\tvec3 lightColor = mix( hemisphereLightGroundColor[ i ], hemisphereLightSkyColor[ i ], hemiDiffuseWeight );\\n\\n\t\ttotalDiffuseLight += lightColor;\\n\\n\t\t// specular (sky term only)\\n\\n\t\tvec3 brdf = BRDF_BlinnPhong( specular, shininess, normal, lightDir, viewDir );\\n\\n\t\ttotalSpecularLight += brdf * specularStrength * lightColor * max( dotProduct, 0.0 );\\n\\n\t}\\n\\n#endif\\n\\n#ifdef METAL\\n\\n\toutgoingLight += diffuseColor.rgb * ( totalDiffuseLight + totalAmbientLight ) * specular + totalSpecularLight + totalEmissiveLight;\\n\\n#else\\n\\n\toutgoingLight += diffuseColor.rgb * ( totalDiffuseLight + totalAmbientLight ) + totalSpecularLight + totalEmissiveLight;\\n\\n#endif\\n\";\r\n\r\n// File:src/renderers/shaders/ShaderChunk/lights_phong_pars_fragment.glsl\r\n\r\nTHREE.ShaderChunk[ 'lights_phong_pars_fragment'] = \"uniform vec3 ambientLightColor;\\n\\n#if MAX_DIR_LIGHTS > 0\\n\\n\tuniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];\\n\tuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\\n\\n#endif\\n\\n#if MAX_HEMI_LIGHTS > 0\\n\\n\tuniform vec3 hemisphereLightSkyColor[ MAX_HEMI_LIGHTS ];\\n\tuniform vec3 hemisphereLightGroundColor[ MAX_HEMI_LIGHTS ];\\n\tuniform vec3 hemisphereLightDirection[ MAX_HEMI_LIGHTS ];\\n\\n#endif\\n\\n#if MAX_POINT_LIGHTS > 0\\n\\n\tuniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];\\n\\n\tuniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\\n\tuniform float pointLightDistance[ MAX_POINT_LIGHTS ];\\n\tuniform float pointLightDecay[ MAX_POINT_LIGHTS ];\\n\\n#endif\\n\\n#if MAX_SPOT_LIGHTS > 0\\n\\n\tuniform vec3 spotLightColor[ MAX_SPOT_LIGHTS ];\\n\tuniform vec3 spotLightPosition[ MAX_SPOT_LIGHTS ];\\n\tuniform vec3 spotLightDirection[ MAX_SPOT_LIGHTS ];\\n\tuniform float spotLightAngleCos[ MAX_SPOT_LIGHTS ];\\n\tuniform float spotLightExponent[ MAX_SPOT_LIGHTS ];\\n\tuniform float spotLightDistance[ MAX_SPOT_LIGHTS ];\\n\tuniform float spotLightDecay[ MAX_SPOT_LIGHTS ];\\n\\n#endif\\n\\n#if MAX_SPOT_LIGHTS > 0 || defined( USE_ENVMAP )\\n\\n\tvarying vec3 vWorldPosition;\\n\\n#endif\\n\\nvarying vec3 vViewPosition;\\n\\n#ifndef FLAT_SHADED\\n\\n\tvarying vec3 vNormal;\\n\\n#endif\\n\";\r\n\r\n// File:src/renderers/shaders/ShaderChunk/lights_phong_pars_vertex.glsl\r\n\r\nTHREE.ShaderChunk[ 'lights_phong_pars_vertex'] = \"#if MAX_SPOT_LIGHTS > 0 || defined( USE_ENVMAP )\\n\\n\tvarying vec3 vWorldPosition;\\n\\n#endif\\n\";\r\n\r\n// File:src/renderers/shaders/ShaderChunk/lights_phong_vertex.glsl\r\n\r\nTHREE.ShaderChunk[ 'lights_phong_vertex'] = \"#if MAX_SPOT_LIGHTS > 0 || defined( USE_ENVMAP )\\n\\n\tvWorldPosition = worldPosition.xyz;\\n\\n#endif\\n\";\r\n\r\n// File:src/renderers/shaders/ShaderChunk/linear_to_gamma_fragment.glsl\r\n\r\nTHREE.ShaderChunk[ 'linear_to_gamma_fragment'] = \"\\n\toutgoingLight = linearToOutput( outgoingLight );\\n\";\r\n\r\n// File:src/renderers/shaders/ShaderChunk/logdepthbuf_fragment.glsl\r\n\r\nTHREE.ShaderChunk[ 'logdepthbuf_fragment'] = \"#if defined(USE_LOGDEPTHBUF) && defined(USE_LOGDEPTHBUF_EXT)\\n\\n\tgl_FragDepthEXT = log2(vFragDepth) * logDepthBufFC * 0.5;\\n\\n#endif\";\r\n\r\n// File:src/renderers/shaders/ShaderChunk/logdepthbuf_pars_fragment.glsl\r\n\r\nTHREE.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\";\r\n\r\n// File:src/renderers/shaders/ShaderChunk/logdepthbuf_pars_vertex.glsl\r\n\r\nTHREE.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\";\r\n\r\n// File:src/renderers/shaders/ShaderChunk/logdepthbuf_vertex.glsl\r\n\r\nTHREE.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#else\\n\\n\t\tgl_Position.z = (gl_Position.z - 1.0) * gl_Position.w;\\n\\n\t#endif\\n\\n#endif\";\r\n\r\n// File:src/renderers/shaders/ShaderChunk/map_fragment.glsl\r\n\r\nTHREE.ShaderChunk[ 'map_fragment'] = \"#ifdef USE_MAP\\n\\n\tvec4 texelColor = texture2D( map, vUv );\\n\\n\ttexelColor.xyz = inputToLinear( texelColor.xyz );\\n\\n\tdiffuseColor *= texelColor;\\n\\n#endif\\n\";\r\n\r\n// File:src/renderers/shaders/ShaderChunk/map_pars_fragment.glsl\r\n\r\nTHREE.ShaderChunk[ 'map_pars_fragment'] = \"#ifdef USE_MAP\\n\\n\tuniform sampler2D map;\\n\\n#endif\";\r\n\r\n// File:src/renderers/shaders/ShaderChunk/map_particle_fragment.glsl\r\n\r\nTHREE.ShaderChunk[ 'map_particle_fragment'] = \"#ifdef USE_MAP\\n\\n\tdiffuseColor *= texture2D( map, vec2( gl_PointCoord.x, 1.0 - gl_PointCoord.y ) * offsetRepeat.zw + offsetRepeat.xy );\\n\\n#endif\\n\";\r\n\r\n// File:src/renderers/shaders/ShaderChunk/map_particle_pars_fragment.glsl\r\n\r\nTHREE.ShaderChunk[ 'map_particle_pars_fragment'] = \"#ifdef USE_MAP\\n\\n\tuniform vec4 offsetRepeat;\\n\tuniform sampler2D map;\\n\\n#endif\\n\";\r\n\r\n// File:src/renderers/shaders/ShaderChunk/morphnormal_vertex.glsl\r\n\r\nTHREE.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\";\r\n\r\n// File:src/renderers/shaders/ShaderChunk/morphtarget_pars_vertex.glsl\r\n\r\nTHREE.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\";\r\n\r\n// File:src/renderers/shaders/ShaderChunk/morphtarget_vertex.glsl\r\n\r\nTHREE.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\";\r\n\r\n// File:src/renderers/shaders/ShaderChunk/normalmap_pars_fragment.glsl\r\n\r\nTHREE.ShaderChunk[ 'normalmap_pars_fragment'] = \"#ifdef USE_NORMALMAP\\n\\n\tuniform sampler2D normalMap;\\n\tuniform vec2 normalScale;\\n\\n\t// Per-Pixel Tangent Space Normal Mapping\\n\t// http://hacksoflife.blogspot.ch/2009/11/per-pixel-tangent-space-normal-mapping.html\\n\\n\tvec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm ) {\\n\\n\t\tvec3 q0 = dFdx( eye_pos.xyz );\\n\t\tvec3 q1 = dFdy( eye_pos.xyz );\\n\t\tvec2 st0 = dFdx( vUv.st );\\n\t\tvec2 st1 = dFdy( vUv.st );\\n\\n\t\tvec3 S = normalize( q0 * st1.t - q1 * st0.t );\\n\t\tvec3 T = normalize( -q0 * st1.s + q1 * st0.s );\\n\t\tvec3 N = normalize( surf_norm );\\n\\n\t\tvec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\\n\t\tmapN.xy = normalScale * mapN.xy;\\n\t\tmat3 tsn = mat3( S, T, N );\\n\t\treturn normalize( tsn * mapN );\\n\\n\t}\\n\\n#endif\\n\";\r\n\r\n// File:src/renderers/shaders/ShaderChunk/project_vertex.glsl\r\n\r\nTHREE.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\";\r\n\r\n// File:src/renderers/shaders/ShaderChunk/shadowmap_fragment.glsl\r\n\r\nTHREE.ShaderChunk[ 'shadowmap_fragment'] = \"#ifdef USE_SHADOWMAP\\n\\n\t#ifdef SHADOWMAP_DEBUG\\n\\n\t\tvec3 frustumColors[3];\\n\t\tfrustumColors[0] = vec3( 1.0, 0.5, 0.0 );\\n\t\tfrustumColors[1] = vec3( 0.0, 1.0, 0.8 );\\n\t\tfrustumColors[2] = vec3( 0.0, 0.5, 1.0 );\\n\\n\t#endif\\n\\n\tfloat fDepth;\\n\tvec3 shadowColor = vec3( 1.0 );\\n\\n\tfor( int i = 0; i < MAX_SHADOWS; i ++ ) {\\n\\n\t\tvec3 shadowCoord = vShadowCoord[ i ].xyz / vShadowCoord[ i ].w;\\n\\n\t\t\t\t// if ( something && something ) breaks ATI OpenGL shader compiler\\n\t\t\t\t// if ( all( something, something ) ) using this instead\\n\\n\t\tbvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\\n\t\tbool inFrustum = all( inFrustumVec );\\n\\n\t\tbvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\\n\\n\t\tbool frustumTest = all( frustumTestVec );\\n\\n\t\tif ( frustumTest ) {\\n\\n\t\t\tshadowCoord.z += shadowBias[ i ];\\n\\n\t\t\t#if defined( SHADOWMAP_TYPE_PCF )\\n\\n\t\t\t\t\t\t// Percentage-close filtering\\n\t\t\t\t\t\t// (9 pixel kernel)\\n\t\t\t\t\t\t// http://fabiensanglard.net/shadowmappingPCF/\\n\\n\t\t\t\tfloat shadow = 0.0;\\n\\n\t\t/*\\n\t\t\t\t\t\t// nested loops breaks shader compiler / validator on some ATI cards when using OpenGL\\n\t\t\t\t\t\t// must enroll loop manually\\n\\n\t\t\t\tfor ( float y = -1.25; y <= 1.25; y += 1.25 )\\n\t\t\t\t\tfor ( float x = -1.25; x <= 1.25; x += 1.25 ) {\\n\\n\t\t\t\t\t\tvec4 rgbaDepth = texture2D( shadowMap[ i ], vec2( x * xPixelOffset, y * yPixelOffset ) + shadowCoord.xy );\\n\\n\t\t\t\t\t\t\t\t// doesn't seem to produce any noticeable visual difference compared to simple texture2D lookup\\n\t\t\t\t\t\t\t\t//vec4 rgbaDepth = texture2DProj( shadowMap[ i ], vec4( vShadowCoord[ i ].w * ( vec2( x * xPixelOffset, y * yPixelOffset ) + shadowCoord.xy ), 0.05, vShadowCoord[ i ].w ) );\\n\\n\t\t\t\t\t\tfloat fDepth = unpackDepth( rgbaDepth );\\n\\n\t\t\t\t\t\tif ( fDepth < shadowCoord.z )\\n\t\t\t\t\t\t\tshadow += 1.0;\\n\\n\t\t\t\t}\\n\\n\t\t\t\tshadow /= 9.0;\\n\\n\t\t*/\\n\\n\t\t\t\tconst float shadowDelta = 1.0 / 9.0;\\n\\n\t\t\t\tfloat xPixelOffset = 1.0 / shadowMapSize[ i ].x;\\n\t\t\t\tfloat yPixelOffset = 1.0 / shadowMapSize[ i ].y;\\n\\n\t\t\t\tfloat dx0 = -1.25 * xPixelOffset;\\n\t\t\t\tfloat dy0 = -1.25 * yPixelOffset;\\n\t\t\t\tfloat dx1 = 1.25 * xPixelOffset;\\n\t\t\t\tfloat dy1 = 1.25 * yPixelOffset;\\n\\n\t\t\t\tfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, dy0 ) ) );\\n\t\t\t\tif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\\n\\n\t\t\t\tfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( 0.0, dy0 ) ) );\\n\t\t\t\tif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\\n\\n\t\t\t\tfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, dy0 ) ) );\\n\t\t\t\tif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\\n\\n\t\t\t\tfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, 0.0 ) ) );\\n\t\t\t\tif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\\n\\n\t\t\t\tfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy ) );\\n\t\t\t\tif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\\n\\n\t\t\t\tfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, 0.0 ) ) );\\n\t\t\t\tif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\\n\\n\t\t\t\tfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, dy1 ) ) );\\n\t\t\t\tif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\\n\\n\t\t\t\tfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( 0.0, dy1 ) ) );\\n\t\t\t\tif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\\n\\n\t\t\t\tfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, dy1 ) ) );\\n\t\t\t\tif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\\n\\n\t\t\t\tshadowColor = shadowColor * vec3( ( 1.0 - shadowDarkness[ i ] * shadow ) );\\n\\n\t\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\\n\\n\t\t\t\t\t\t// Percentage-close filtering\\n\t\t\t\t\t\t// (9 pixel kernel)\\n\t\t\t\t\t\t// http://fabiensanglard.net/shadowmappingPCF/\\n\\n\t\t\t\tfloat shadow = 0.0;\\n\\n\t\t\t\tfloat xPixelOffset = 1.0 / shadowMapSize[ i ].x;\\n\t\t\t\tfloat yPixelOffset = 1.0 / shadowMapSize[ i ].y;\\n\\n\t\t\t\tfloat dx0 = -1.0 * xPixelOffset;\\n\t\t\t\tfloat dy0 = -1.0 * yPixelOffset;\\n\t\t\t\tfloat dx1 = 1.0 * xPixelOffset;\\n\t\t\t\tfloat dy1 = 1.0 * yPixelOffset;\\n\\n\t\t\t\tmat3 shadowKernel;\\n\t\t\t\tmat3 depthKernel;\\n\\n\t\t\t\tdepthKernel[0][0] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, dy0 ) ) );\\n\t\t\t\tdepthKernel[0][1] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, 0.0 ) ) );\\n\t\t\t\tdepthKernel[0][2] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, dy1 ) ) );\\n\t\t\t\tdepthKernel[1][0] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( 0.0, dy0 ) ) );\\n\t\t\t\tdepthKernel[1][1] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy ) );\\n\t\t\t\tdepthKernel[1][2] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( 0.0, dy1 ) ) );\\n\t\t\t\tdepthKernel[2][0] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, dy0 ) ) );\\n\t\t\t\tdepthKernel[2][1] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, 0.0 ) ) );\\n\t\t\t\tdepthKernel[2][2] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, dy1 ) ) );\\n\\n\t\t\t\tvec3 shadowZ = vec3( shadowCoord.z );\\n\t\t\t\tshadowKernel[0] = vec3(lessThan(depthKernel[0], shadowZ ));\\n\t\t\t\tshadowKernel[0] *= vec3(0.25);\\n\\n\t\t\t\tshadowKernel[1] = vec3(lessThan(depthKernel[1], shadowZ ));\\n\t\t\t\tshadowKernel[1] *= vec3(0.25);\\n\\n\t\t\t\tshadowKernel[2] = vec3(lessThan(depthKernel[2], shadowZ ));\\n\t\t\t\tshadowKernel[2] *= vec3(0.25);\\n\\n\t\t\t\tvec2 fractionalCoord = 1.0 - fract( shadowCoord.xy * shadowMapSize[i].xy );\\n\\n\t\t\t\tshadowKernel[0] = mix( shadowKernel[1], shadowKernel[0], fractionalCoord.x );\\n\t\t\t\tshadowKernel[1] = mix( shadowKernel[2], shadowKernel[1], fractionalCoord.x );\\n\\n\t\t\t\tvec4 shadowValues;\\n\t\t\t\tshadowValues.x = mix( shadowKernel[0][1], shadowKernel[0][0], fractionalCoord.y );\\n\t\t\t\tshadowValues.y = mix( shadowKernel[0][2], shadowKernel[0][1], fractionalCoord.y );\\n\t\t\t\tshadowValues.z = mix( shadowKernel[1][1], shadowKernel[1][0], fractionalCoord.y );\\n\t\t\t\tshadowValues.w = mix( shadowKernel[1][2], shadowKernel[1][1], fractionalCoord.y );\\n\\n\t\t\t\tshadow = dot( shadowValues, vec4( 1.0 ) );\\n\\n\t\t\t\tshadowColor = shadowColor * vec3( ( 1.0 - shadowDarkness[ i ] * shadow ) );\\n\\n\t\t\t#else\\n\\n\t\t\t\tvec4 rgbaDepth = texture2D( shadowMap[ i ], shadowCoord.xy );\\n\t\t\t\tfloat fDepth = unpackDepth( rgbaDepth );\\n\\n\t\t\t\tif ( fDepth < shadowCoord.z )\\n\\n\t\t// spot with multiple shadows is darker\\n\\n\t\t\t\t\tshadowColor = shadowColor * vec3( 1.0 - shadowDarkness[ i ] );\\n\\n\t\t// spot with multiple shadows has the same color as single shadow spot\\n\\n\t\t// \t\t\t\t\tshadowColor = min( shadowColor, vec3( shadowDarkness[ i ] ) );\\n\\n\t\t\t#endif\\n\\n\t\t}\\n\\n\\n\t\t#ifdef SHADOWMAP_DEBUG\\n\\n\t\t\tif ( inFrustum ) outgoingLight *= frustumColors[ i ];\\n\\n\t\t#endif\\n\\n\t}\\n\\n\toutgoingLight = outgoingLight * shadowColor;\\n\\n#endif\\n\";\r\n\r\n// File:src/renderers/shaders/ShaderChunk/shadowmap_pars_fragment.glsl\r\n\r\nTHREE.ShaderChunk[ 'shadowmap_pars_fragment'] = \"#ifdef USE_SHADOWMAP\\n\\n\tuniform sampler2D shadowMap[ MAX_SHADOWS ];\\n\tuniform vec2 shadowMapSize[ MAX_SHADOWS ];\\n\\n\tuniform float shadowDarkness[ MAX_SHADOWS ];\\n\tuniform float shadowBias[ MAX_SHADOWS ];\\n\\n\tvarying vec4 vShadowCoord[ MAX_SHADOWS ];\\n\\n\tfloat unpackDepth( const in vec4 rgba_depth ) {\\n\\n\t\tconst vec4 bit_shift = vec4( 1.0 / ( 256.0 * 256.0 * 256.0 ), 1.0 / ( 256.0 * 256.0 ), 1.0 / 256.0, 1.0 );\\n\t\tfloat depth = dot( rgba_depth, bit_shift );\\n\t\treturn depth;\\n\\n\t}\\n\\n#endif\";\r\n\r\n// File:src/renderers/shaders/ShaderChunk/shadowmap_pars_vertex.glsl\r\n\r\nTHREE.ShaderChunk[ 'shadowmap_pars_vertex'] = \"#ifdef USE_SHADOWMAP\\n\\n\tvarying vec4 vShadowCoord[ MAX_SHADOWS ];\\n\tuniform mat4 shadowMatrix[ MAX_SHADOWS ];\\n\\n#endif\";\r\n\r\n// File:src/renderers/shaders/ShaderChunk/shadowmap_vertex.glsl\r\n\r\nTHREE.ShaderChunk[ 'shadowmap_vertex'] = \"#ifdef USE_SHADOWMAP\\n\\n\tfor( int i = 0; i < MAX_SHADOWS; i ++ ) {\\n\\n\t\tvShadowCoord[ i ] = shadowMatrix[ i ] * worldPosition;\\n\\n\t}\\n\\n#endif\";\r\n\r\n// File:src/renderers/shaders/ShaderChunk/skinbase_vertex.glsl\r\n\r\nTHREE.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\";\r\n\r\n// File:src/renderers/shaders/ShaderChunk/skinning_pars_vertex.glsl\r\n\r\nTHREE.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\";\r\n\r\n// File:src/renderers/shaders/ShaderChunk/skinning_vertex.glsl\r\n\r\nTHREE.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\";\r\n\r\n// File:src/renderers/shaders/ShaderChunk/skinnormal_vertex.glsl\r\n\r\nTHREE.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\";\r\n\r\n// File:src/renderers/shaders/ShaderChunk/specularmap_fragment.glsl\r\n\r\nTHREE.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\";\r\n\r\n// File:src/renderers/shaders/ShaderChunk/specularmap_pars_fragment.glsl\r\n\r\nTHREE.ShaderChunk[ 'specularmap_pars_fragment'] = \"#ifdef USE_SPECULARMAP\\n\\n\tuniform sampler2D specularMap;\\n\\n#endif\";\r\n\r\n// File:src/renderers/shaders/ShaderChunk/uv2_pars_fragment.glsl\r\n\r\nTHREE.ShaderChunk[ 'uv2_pars_fragment'] = \"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\\n\\n\tvarying vec2 vUv2;\\n\\n#endif\";\r\n\r\n// File:src/renderers/shaders/ShaderChunk/uv2_pars_vertex.glsl\r\n\r\nTHREE.ShaderChunk[ 'uv2_pars_vertex'] = \"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\\n\\n\tattribute vec2 uv2;\\n\tvarying vec2 vUv2;\\n\\n#endif\";\r\n\r\n// File:src/renderers/shaders/ShaderChunk/uv2_vertex.glsl\r\n\r\nTHREE.ShaderChunk[ 'uv2_vertex'] = \"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\\n\\n\tvUv2 = uv2;\\n\\n#endif\";\r\n\r\n// File:src/renderers/shaders/ShaderChunk/uv_pars_fragment.glsl\r\n\r\nTHREE.ShaderChunk[ 'uv_pars_fragment'] = \"#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP )\\n\\n\tvarying vec2 vUv;\\n\\n#endif\";\r\n\r\n// File:src/renderers/shaders/ShaderChunk/uv_pars_vertex.glsl\r\n\r\nTHREE.ShaderChunk[ 'uv_pars_vertex'] = \"#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP )\\n\\n\tvarying vec2 vUv;\\n\tuniform vec4 offsetRepeat;\\n\\n#endif\\n\";\r\n\r\n// File:src/renderers/shaders/ShaderChunk/uv_vertex.glsl\r\n\r\nTHREE.ShaderChunk[ 'uv_vertex'] = \"#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP )\\n\\n\tvUv = uv * offsetRepeat.zw + offsetRepeat.xy;\\n\\n#endif\";\r\n\r\n// File:src/renderers/shaders/ShaderChunk/worldpos_vertex.glsl\r\n\r\nTHREE.ShaderChunk[ 'worldpos_vertex'] = \"#if defined( USE_ENVMAP ) || defined( PHONG ) || 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\";\r\n\r\n// File:src/renderers/shaders/UniformsUtils.js\r\n\r\n/**\r\n * Uniform Utilities\r\n */\r\n\r\nTHREE.UniformsUtils = {\r\n\r\n\tmerge: function ( uniforms ) {\r\n\r\n\t\tvar merged = {};\r\n\r\n\t\tfor ( var u = 0; u < uniforms.length; u ++ ) {\r\n\r\n\t\t\tvar tmp = this.clone( uniforms[ u ] );\r\n\r\n\t\t\tfor ( var p in tmp ) {\r\n\r\n\t\t\t\tmerged[ p ] = tmp[ p ];\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn merged;\r\n\r\n\t},\r\n\r\n\tclone: function ( uniforms_src ) {\r\n\r\n\t\tvar uniforms_dst = {};\r\n\r\n\t\tfor ( var u in uniforms_src ) {\r\n\r\n\t\t\tuniforms_dst[ u ] = {};\r\n\r\n\t\t\tfor ( var p in uniforms_src[ u ] ) {\r\n\r\n\t\t\t\tvar parameter_src = uniforms_src[ u ][ p ];\r\n\r\n\t\t\t\tif ( parameter_src instanceof THREE.Color ||\r\n\t\t\t\t\t parameter_src instanceof THREE.Vector2 ||\r\n\t\t\t\t\t parameter_src instanceof THREE.Vector3 ||\r\n\t\t\t\t\t parameter_src instanceof THREE.Vector4 ||\r\n\t\t\t\t\t parameter_src instanceof THREE.Matrix3 ||\r\n\t\t\t\t\t parameter_src instanceof THREE.Matrix4 ||\r\n\t\t\t\t\t parameter_src instanceof THREE.Texture ) {\r\n\r\n\t\t\t\t\tuniforms_dst[ u ][ p ] = parameter_src.clone();\r\n\r\n\t\t\t\t} else if ( Array.isArray( parameter_src ) ) {\r\n\r\n\t\t\t\t\tuniforms_dst[ u ][ p ] = parameter_src.slice();\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\tuniforms_dst[ u ][ p ] = parameter_src;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn uniforms_dst;\r\n\r\n\t}\r\n\r\n};\r\n\r\n// File:src/renderers/shaders/UniformsLib.js\r\n\r\n/**\r\n * Uniforms library for shared webgl shaders\r\n */\r\n\r\nTHREE.UniformsLib = {\r\n\r\n\tcommon: {\r\n\r\n\t\t\"diffuse\" : { type: \"c\", value: new THREE.Color( 0xeeeeee ) },\r\n\t\t\"opacity\" : { type: \"f\", value: 1.0 },\r\n\r\n\t\t\"map\" : { type: \"t\", value: null },\r\n\t\t\"offsetRepeat\" : { type: \"v4\", value: new THREE.Vector4( 0, 0, 1, 1 ) },\r\n\r\n\t\t\"specularMap\" : { type: \"t\", value: null },\r\n\t\t\"alphaMap\" : { type: \"t\", value: null },\r\n\r\n\t\t\"envMap\" : { type: \"t\", value: null },\r\n\t\t\"flipEnvMap\" : { type: \"f\", value: - 1 },\r\n\t\t\"reflectivity\" : { type: \"f\", value: 1.0 },\r\n\t\t\"refractionRatio\" : { type: \"f\", value: 0.98 }\r\n\r\n\t},\r\n\r\n\taomap: {\r\n\r\n\t\t\"aoMap\" : { type: \"t\", value: null },\r\n\t\t\"aoMapIntensity\" : { type: \"f\", value: 1 },\r\n\r\n\t},\r\n\r\n\tlightmap: {\r\n\r\n\t\t\"lightMap\" : { type: \"t\", value: null },\r\n\t\t\"lightMapIntensity\" : { type: \"f\", value: 1 },\r\n\r\n\t},\r\n\r\n\temissivemap: {\r\n\r\n\t\t\"emissiveMap\" : { type: \"t\", value: null },\r\n\r\n\t},\r\n\r\n\tbumpmap: {\r\n\r\n\t\t\"bumpMap\" : { type: \"t\", value: null },\r\n\t\t\"bumpScale\" : { type: \"f\", value: 1 }\r\n\r\n\t},\r\n\r\n\tnormalmap: {\r\n\r\n\t\t\"normalMap\" : { type: \"t\", value: null },\r\n\t\t\"normalScale\" : { type: \"v2\", value: new THREE.Vector2( 1, 1 ) }\r\n\r\n\t},\r\n\r\n\tdisplacementmap: {\r\n\r\n\t\t\"displacementMap\" : { type: \"t\", value: null },\r\n\t\t\"displacementScale\" : { type: \"f\", value: 1 },\r\n\t\t\"displacementBias\" : { type: \"f\", value: 0 }\r\n\r\n\t},\r\n\r\n\tfog : {\r\n\r\n\t\t\"fogDensity\" : { type: \"f\", value: 0.00025 },\r\n\t\t\"fogNear\" : { type: \"f\", value: 1 },\r\n\t\t\"fogFar\" : { type: \"f\", value: 2000 },\r\n\t\t\"fogColor\" : { type: \"c\", value: new THREE.Color( 0xffffff ) }\r\n\r\n\t},\r\n\r\n\tlights: {\r\n\r\n\t\t\"ambientLightColor\" : { type: \"fv\", value: [] },\r\n\r\n\t\t\"directionalLightDirection\" : { type: \"fv\", value: [] },\r\n\t\t\"directionalLightColor\" : { type: \"fv\", value: [] },\r\n\r\n\t\t\"hemisphereLightDirection\" : { type: \"fv\", value: [] },\r\n\t\t\"hemisphereLightSkyColor\" : { type: \"fv\", value: [] },\r\n\t\t\"hemisphereLightGroundColor\" : { type: \"fv\", value: [] },\r\n\r\n\t\t\"pointLightColor\" : { type: \"fv\", value: [] },\r\n\t\t\"pointLightPosition\" : { type: \"fv\", value: [] },\r\n\t\t\"pointLightDistance\" : { type: \"fv1\", value: [] },\r\n\t\t\"pointLightDecay\" : { type: \"fv1\", value: [] },\r\n\r\n\t\t\"spotLightColor\" : { type: \"fv\", value: [] },\r\n\t\t\"spotLightPosition\" : { type: \"fv\", value: [] },\r\n\t\t\"spotLightDirection\" : { type: \"fv\", value: [] },\r\n\t\t\"spotLightDistance\" : { type: \"fv1\", value: [] },\r\n\t\t\"spotLightAngleCos\" : { type: \"fv1\", value: [] },\r\n\t\t\"spotLightExponent\" : { type: \"fv1\", value: [] },\r\n\t\t\"spotLightDecay\" : { type: \"fv1\", value: [] }\r\n\r\n\t},\r\n\r\n\tpoints: {\r\n\r\n\t\t\"psColor\" : { type: \"c\", value: new THREE.Color( 0xeeeeee ) },\r\n\t\t\"opacity\" : { type: \"f\", value: 1.0 },\r\n\t\t\"size\" : { type: \"f\", value: 1.0 },\r\n\t\t\"scale\" : { type: \"f\", value: 1.0 },\r\n\t\t\"map\" : { type: \"t\", value: null },\r\n\t\t\"offsetRepeat\" : { type: \"v4\", value: new THREE.Vector4( 0, 0, 1, 1 ) },\r\n\r\n\t\t\"fogDensity\" : { type: \"f\", value: 0.00025 },\r\n\t\t\"fogNear\" : { type: \"f\", value: 1 },\r\n\t\t\"fogFar\" : { type: \"f\", value: 2000 },\r\n\t\t\"fogColor\" : { type: \"c\", value: new THREE.Color( 0xffffff ) }\r\n\r\n\t},\r\n\r\n\tshadowmap: {\r\n\r\n\t\t\"shadowMap\": { type: \"tv\", value: [] },\r\n\t\t\"shadowMapSize\": { type: \"v2v\", value: [] },\r\n\r\n\t\t\"shadowBias\" : { type: \"fv1\", value: [] },\r\n\t\t\"shadowDarkness\": { type: \"fv1\", value: [] },\r\n\r\n\t\t\"shadowMatrix\" : { type: \"m4v\", value: [] }\r\n\r\n\t}\r\n\r\n};\r\n\r\n// File:src/renderers/shaders/ShaderLib.js\r\n\r\n/**\r\n * Webgl Shader Library for three.js\r\n *\r\n * @author alteredq / http://alteredqualia.com/\r\n * @author mrdoob / http://mrdoob.com/\r\n * @author mikael emtinger / http://gomo.se/\r\n */\r\n\r\n\r\nTHREE.ShaderLib = {\r\n\r\n\t'basic': {\r\n\r\n\t\tuniforms: THREE.UniformsUtils.merge( [\r\n\r\n\t\t\tTHREE.UniformsLib[ \"common\" ],\r\n\t\t\tTHREE.UniformsLib[ \"aomap\" ],\r\n\t\t\tTHREE.UniformsLib[ \"fog\" ],\r\n\t\t\tTHREE.UniformsLib[ \"shadowmap\" ]\r\n\r\n\t\t] ),\r\n\r\n\t\tvertexShader: [\r\n\r\n\t\t\tTHREE.ShaderChunk[ \"common\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"uv_pars_vertex\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"uv2_pars_vertex\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"envmap_pars_vertex\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"color_pars_vertex\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"morphtarget_pars_vertex\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"skinning_pars_vertex\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"shadowmap_pars_vertex\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"logdepthbuf_pars_vertex\" ],\r\n\r\n\t\t\t\"void main() {\",\r\n\r\n\t\t\t\tTHREE.ShaderChunk[ \"uv_vertex\" ],\r\n\t\t\t\tTHREE.ShaderChunk[ \"uv2_vertex\" ],\r\n\t\t\t\tTHREE.ShaderChunk[ \"color_vertex\" ],\r\n\t\t\t\tTHREE.ShaderChunk[ \"skinbase_vertex\" ],\r\n\r\n\t\t\t\"\t#ifdef USE_ENVMAP\",\r\n\r\n\t\t\t\tTHREE.ShaderChunk[ \"beginnormal_vertex\" ],\r\n\t\t\t\tTHREE.ShaderChunk[ \"morphnormal_vertex\" ],\r\n\t\t\t\tTHREE.ShaderChunk[ \"skinnormal_vertex\" ],\r\n\t\t\t\tTHREE.ShaderChunk[ \"defaultnormal_vertex\" ],\r\n\r\n\t\t\t\"\t#endif\",\r\n\r\n\t\t\t\tTHREE.ShaderChunk[ \"begin_vertex\" ],\r\n\t\t\t\tTHREE.ShaderChunk[ \"morphtarget_vertex\" ],\r\n\t\t\t\tTHREE.ShaderChunk[ \"skinning_vertex\" ],\r\n\t\t\t\tTHREE.ShaderChunk[ \"project_vertex\" ],\r\n\t\t\t\tTHREE.ShaderChunk[ \"logdepthbuf_vertex\" ],\r\n\r\n\t\t\t\tTHREE.ShaderChunk[ \"worldpos_vertex\" ],\r\n\t\t\t\tTHREE.ShaderChunk[ \"envmap_vertex\" ],\r\n\t\t\t\tTHREE.ShaderChunk[ \"shadowmap_vertex\" ],\r\n\r\n\t\t\t\"}\"\r\n\r\n\t\t].join( \"\\n\" ),\r\n\r\n\t\tfragmentShader: [\r\n\r\n\t\t\t\"uniform vec3 diffuse;\",\r\n\t\t\t\"uniform float opacity;\",\r\n\r\n\t\t\tTHREE.ShaderChunk[ \"common\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"color_pars_fragment\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"uv_pars_fragment\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"uv2_pars_fragment\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"map_pars_fragment\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"alphamap_pars_fragment\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"aomap_pars_fragment\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"envmap_pars_fragment\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"fog_pars_fragment\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"shadowmap_pars_fragment\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"specularmap_pars_fragment\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"logdepthbuf_pars_fragment\" ],\r\n\r\n\t\t\t\"void main() {\",\r\n\r\n\t\t\t\"\tvec3 outgoingLight = vec3( 0.0 );\",\r\n\t\t\t\"\tvec4 diffuseColor = vec4( diffuse, opacity );\",\r\n\t\t\t\"\tvec3 totalAmbientLight = vec3( 1.0 );\", // hardwired\r\n\r\n\t\t\t\tTHREE.ShaderChunk[ \"logdepthbuf_fragment\" ],\r\n\t\t\t\tTHREE.ShaderChunk[ \"map_fragment\" ],\r\n\t\t\t\tTHREE.ShaderChunk[ \"color_fragment\" ],\r\n\t\t\t\tTHREE.ShaderChunk[ \"alphamap_fragment\" ],\r\n\t\t\t\tTHREE.ShaderChunk[ \"alphatest_fragment\" ],\r\n\t\t\t\tTHREE.ShaderChunk[ \"specularmap_fragment\" ],\r\n\t\t\t\tTHREE.ShaderChunk[ \"aomap_fragment\" ],\r\n\r\n\t\t\t\"\toutgoingLight = diffuseColor.rgb * totalAmbientLight;\", // simple shader\r\n\r\n\t\t\t\tTHREE.ShaderChunk[ \"envmap_fragment\" ],\r\n\t\t\t\tTHREE.ShaderChunk[ \"shadowmap_fragment\" ],\t\t// TODO: Shadows on an otherwise unlit surface doesn't make sense.\r\n\r\n\t\t\t\tTHREE.ShaderChunk[ \"linear_to_gamma_fragment\" ],\r\n\r\n\t\t\t\tTHREE.ShaderChunk[ \"fog_fragment\" ],\r\n\r\n\t\t\t\"\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\",\r\n\r\n\t\t\t\"}\"\r\n\r\n\t\t].join( \"\\n\" )\r\n\r\n\t},\r\n\r\n\t'lambert': {\r\n\r\n\t\tuniforms: THREE.UniformsUtils.merge( [\r\n\r\n\t\t\tTHREE.UniformsLib[ \"common\" ],\r\n\t\t\tTHREE.UniformsLib[ \"fog\" ],\r\n\t\t\tTHREE.UniformsLib[ \"lights\" ],\r\n\t\t\tTHREE.UniformsLib[ \"shadowmap\" ],\r\n\r\n\t\t\t{\r\n\t\t\t\t\"emissive\" : { type: \"c\", value: new THREE.Color( 0x000000 ) }\r\n\t\t\t}\r\n\r\n\t\t] ),\r\n\r\n\t\tvertexShader: [\r\n\r\n\t\t\t\"#define LAMBERT\",\r\n\r\n\t\t\t\"varying vec3 vLightFront;\",\r\n\r\n\t\t\t\"#ifdef DOUBLE_SIDED\",\r\n\r\n\t\t\t\"\tvarying vec3 vLightBack;\",\r\n\r\n\t\t\t\"#endif\",\r\n\r\n\t\t\tTHREE.ShaderChunk[ \"common\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"uv_pars_vertex\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"uv2_pars_vertex\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"envmap_pars_vertex\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"lights_lambert_pars_vertex\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"color_pars_vertex\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"morphtarget_pars_vertex\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"skinning_pars_vertex\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"shadowmap_pars_vertex\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"logdepthbuf_pars_vertex\" ],\r\n\r\n\t\t\t\"void main() {\",\r\n\r\n\t\t\t\tTHREE.ShaderChunk[ \"uv_vertex\" ],\r\n\t\t\t\tTHREE.ShaderChunk[ \"uv2_vertex\" ],\r\n\t\t\t\tTHREE.ShaderChunk[ \"color_vertex\" ],\r\n\r\n\t\t\t\tTHREE.ShaderChunk[ \"beginnormal_vertex\" ],\r\n\t\t\t\tTHREE.ShaderChunk[ \"morphnormal_vertex\" ],\r\n\t\t\t\tTHREE.ShaderChunk[ \"skinbase_vertex\" ],\r\n\t\t\t\tTHREE.ShaderChunk[ \"skinnormal_vertex\" ],\r\n\t\t\t\tTHREE.ShaderChunk[ \"defaultnormal_vertex\" ],\r\n\r\n\t\t\t\tTHREE.ShaderChunk[ \"begin_vertex\" ],\r\n\t\t\t\tTHREE.ShaderChunk[ \"morphtarget_vertex\" ],\r\n\t\t\t\tTHREE.ShaderChunk[ \"skinning_vertex\" ],\r\n\t\t\t\tTHREE.ShaderChunk[ \"project_vertex\" ],\r\n\t\t\t\tTHREE.ShaderChunk[ \"logdepthbuf_vertex\" ],\r\n\r\n\t\t\t\tTHREE.ShaderChunk[ \"worldpos_vertex\" ],\r\n\t\t\t\tTHREE.ShaderChunk[ \"envmap_vertex\" ],\r\n\t\t\t\tTHREE.ShaderChunk[ \"lights_lambert_vertex\" ],\r\n\t\t\t\tTHREE.ShaderChunk[ \"shadowmap_vertex\" ],\r\n\r\n\t\t\t\"}\"\r\n\r\n\t\t].join( \"\\n\" ),\r\n\r\n\t\tfragmentShader: [\r\n\r\n\t\t\t\"uniform vec3 diffuse;\",\r\n\t\t\t\"uniform vec3 emissive;\",\r\n\t\t\t\"uniform float opacity;\",\r\n\r\n\t\t\t\"varying vec3 vLightFront;\",\r\n\r\n\t\t\t\"#ifdef DOUBLE_SIDED\",\r\n\r\n\t\t\t\"\tvarying vec3 vLightBack;\",\r\n\r\n\t\t\t\"#endif\",\r\n\r\n\t\t\tTHREE.ShaderChunk[ \"common\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"color_pars_fragment\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"uv_pars_fragment\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"uv2_pars_fragment\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"map_pars_fragment\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"alphamap_pars_fragment\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"envmap_pars_fragment\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"fog_pars_fragment\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"shadowmap_pars_fragment\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"specularmap_pars_fragment\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"logdepthbuf_pars_fragment\" ],\r\n\r\n\t\t\t\"void main() {\",\r\n\r\n\t\t\t\"\tvec3 outgoingLight = vec3( 0.0 );\",\t// outgoing light does not have an alpha, the surface does\r\n\t\t\t\"\tvec4 diffuseColor = vec4( diffuse, opacity );\",\r\n\r\n\t\t\t\tTHREE.ShaderChunk[ \"logdepthbuf_fragment\" ],\r\n\t\t\t\tTHREE.ShaderChunk[ \"map_fragment\" ],\r\n\t\t\t\tTHREE.ShaderChunk[ \"color_fragment\" ],\r\n\t\t\t\tTHREE.ShaderChunk[ \"alphamap_fragment\" ],\r\n\t\t\t\tTHREE.ShaderChunk[ \"alphatest_fragment\" ],\r\n\t\t\t\tTHREE.ShaderChunk[ \"specularmap_fragment\" ],\r\n\r\n\t\t\t\"\t#ifdef DOUBLE_SIDED\",\r\n\r\n\t\t\t\"\t\tif ( gl_FrontFacing )\",\r\n\t\t\t\"\t\t\toutgoingLight += diffuseColor.rgb * vLightFront + emissive;\",\r\n\t\t\t\"\t\telse\",\r\n\t\t\t\"\t\t\toutgoingLight += diffuseColor.rgb * vLightBack + emissive;\",\r\n\r\n\t\t\t\"\t#else\",\r\n\r\n\t\t\t\"\t\toutgoingLight += diffuseColor.rgb * vLightFront + emissive;\",\r\n\r\n\t\t\t\"\t#endif\",\r\n\r\n\t\t\t\tTHREE.ShaderChunk[ \"envmap_fragment\" ],\r\n\t\t\t\tTHREE.ShaderChunk[ \"shadowmap_fragment\" ],\r\n\r\n\t\t\t\tTHREE.ShaderChunk[ \"linear_to_gamma_fragment\" ],\r\n\r\n\t\t\t\tTHREE.ShaderChunk[ \"fog_fragment\" ],\r\n\r\n\t\t\t\"\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\",\r\n\r\n\t\t\t\"}\"\r\n\r\n\t\t].join( \"\\n\" )\r\n\r\n\t},\r\n\r\n\t'phong': {\r\n\r\n\t\tuniforms: THREE.UniformsUtils.merge( [\r\n\r\n\t\t\tTHREE.UniformsLib[ \"common\" ],\r\n\t\t\tTHREE.UniformsLib[ \"aomap\" ],\r\n\t\t\tTHREE.UniformsLib[ \"lightmap\" ],\r\n\t\t\tTHREE.UniformsLib[ \"emissivemap\" ],\r\n\t\t\tTHREE.UniformsLib[ \"bumpmap\" ],\r\n\t\t\tTHREE.UniformsLib[ \"normalmap\" ],\r\n\t\t\tTHREE.UniformsLib[ \"displacementmap\" ],\r\n\t\t\tTHREE.UniformsLib[ \"fog\" ],\r\n\t\t\tTHREE.UniformsLib[ \"lights\" ],\r\n\t\t\tTHREE.UniformsLib[ \"shadowmap\" ],\r\n\r\n\t\t\t{\r\n\t\t\t\t\"emissive\" : { type: \"c\", value: new THREE.Color( 0x000000 ) },\r\n\t\t\t\t\"specular\" : { type: \"c\", value: new THREE.Color( 0x111111 ) },\r\n\t\t\t\t\"shininess\": { type: \"f\", value: 30 }\r\n\t\t\t}\r\n\r\n\t\t] ),\r\n\r\n\t\tvertexShader: [\r\n\r\n\t\t\t\"#define PHONG\",\r\n\r\n\t\t\t\"varying vec3 vViewPosition;\",\r\n\r\n\t\t\t\"#ifndef FLAT_SHADED\",\r\n\r\n\t\t\t\"\tvarying vec3 vNormal;\",\r\n\r\n\t\t\t\"#endif\",\r\n\r\n\t\t\tTHREE.ShaderChunk[ \"common\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"uv_pars_vertex\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"uv2_pars_vertex\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"displacementmap_pars_vertex\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"envmap_pars_vertex\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"lights_phong_pars_vertex\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"color_pars_vertex\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"morphtarget_pars_vertex\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"skinning_pars_vertex\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"shadowmap_pars_vertex\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"logdepthbuf_pars_vertex\" ],\r\n\r\n\t\t\t\"void main() {\",\r\n\r\n\t\t\t\tTHREE.ShaderChunk[ \"uv_vertex\" ],\r\n\t\t\t\tTHREE.ShaderChunk[ \"uv2_vertex\" ],\r\n\t\t\t\tTHREE.ShaderChunk[ \"color_vertex\" ],\r\n\r\n\t\t\t\tTHREE.ShaderChunk[ \"beginnormal_vertex\" ],\r\n\t\t\t\tTHREE.ShaderChunk[ \"morphnormal_vertex\" ],\r\n\t\t\t\tTHREE.ShaderChunk[ \"skinbase_vertex\" ],\r\n\t\t\t\tTHREE.ShaderChunk[ \"skinnormal_vertex\" ],\r\n\t\t\t\tTHREE.ShaderChunk[ \"defaultnormal_vertex\" ],\r\n\r\n\t\t\t\"#ifndef FLAT_SHADED\", // Normal computed with derivatives when FLAT_SHADED\r\n\r\n\t\t\t\"\tvNormal = normalize( transformedNormal );\",\r\n\r\n\t\t\t\"#endif\",\r\n\r\n\t\t\t\tTHREE.ShaderChunk[ \"begin_vertex\" ],\r\n\t\t\t\tTHREE.ShaderChunk[ \"displacementmap_vertex\" ],\r\n\t\t\t\tTHREE.ShaderChunk[ \"morphtarget_vertex\" ],\r\n\t\t\t\tTHREE.ShaderChunk[ \"skinning_vertex\" ],\r\n\t\t\t\tTHREE.ShaderChunk[ \"project_vertex\" ],\r\n\t\t\t\tTHREE.ShaderChunk[ \"logdepthbuf_vertex\" ],\r\n\r\n\t\t\t\"\tvViewPosition = - mvPosition.xyz;\",\r\n\r\n\t\t\t\tTHREE.ShaderChunk[ \"worldpos_vertex\" ],\r\n\t\t\t\tTHREE.ShaderChunk[ \"envmap_vertex\" ],\r\n\t\t\t\tTHREE.ShaderChunk[ \"lights_phong_vertex\" ],\r\n\t\t\t\tTHREE.ShaderChunk[ \"shadowmap_vertex\" ],\r\n\r\n\t\t\t\"}\"\r\n\r\n\t\t].join( \"\\n\" ),\r\n\r\n\t\tfragmentShader: [\r\n\r\n\t\t\t\"#define PHONG\",\r\n\r\n\t\t\t\"uniform vec3 diffuse;\",\r\n\t\t\t\"uniform vec3 emissive;\",\r\n\t\t\t\"uniform vec3 specular;\",\r\n\t\t\t\"uniform float shininess;\",\r\n\t\t\t\"uniform float opacity;\",\r\n\r\n\t\t\tTHREE.ShaderChunk[ \"common\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"color_pars_fragment\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"uv_pars_fragment\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"uv2_pars_fragment\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"map_pars_fragment\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"alphamap_pars_fragment\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"aomap_pars_fragment\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"lightmap_pars_fragment\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"emissivemap_pars_fragment\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"envmap_pars_fragment\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"fog_pars_fragment\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"lights_phong_pars_fragment\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"shadowmap_pars_fragment\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"bumpmap_pars_fragment\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"normalmap_pars_fragment\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"specularmap_pars_fragment\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"logdepthbuf_pars_fragment\" ],\r\n\r\n\t\t\t\"void main() {\",\r\n\r\n\t\t\t\"\tvec3 outgoingLight = vec3( 0.0 );\",\r\n\t\t\t\"\tvec4 diffuseColor = vec4( diffuse, opacity );\",\r\n\t\t\t\"\tvec3 totalAmbientLight = ambientLightColor;\",\r\n\t\t\t\"\tvec3 totalEmissiveLight = emissive;\",\r\n\r\n\t\t\t\tTHREE.ShaderChunk[ \"logdepthbuf_fragment\" ],\r\n\t\t\t\tTHREE.ShaderChunk[ \"map_fragment\" ],\r\n\t\t\t\tTHREE.ShaderChunk[ \"color_fragment\" ],\r\n\t\t\t\tTHREE.ShaderChunk[ \"alphamap_fragment\" ],\r\n\t\t\t\tTHREE.ShaderChunk[ \"alphatest_fragment\" ],\r\n\t\t\t\tTHREE.ShaderChunk[ \"specularmap_fragment\" ],\r\n\t\t\t\tTHREE.ShaderChunk[ \"lightmap_fragment\" ],\r\n\t\t\t\tTHREE.ShaderChunk[ \"aomap_fragment\" ],\r\n\t\t\t\tTHREE.ShaderChunk[ \"emissivemap_fragment\" ],\r\n\r\n\t\t\t\tTHREE.ShaderChunk[ \"lights_phong_fragment\" ],\r\n\r\n\t\t\t\tTHREE.ShaderChunk[ \"envmap_fragment\" ],\r\n\t\t\t\tTHREE.ShaderChunk[ \"shadowmap_fragment\" ],\r\n\r\n\t\t\t\tTHREE.ShaderChunk[ \"linear_to_gamma_fragment\" ],\r\n\r\n\t\t\t\tTHREE.ShaderChunk[ \"fog_fragment\" ],\r\n\r\n\t\t\t\"\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\",\r\n\r\n\t\t\t\"}\"\r\n\r\n\t\t].join( \"\\n\" )\r\n\r\n\t},\r\n\r\n\t'points': {\r\n\r\n\t\tuniforms: THREE.UniformsUtils.merge( [\r\n\r\n\t\t\tTHREE.UniformsLib[ \"points\" ],\r\n\t\t\tTHREE.UniformsLib[ \"shadowmap\" ]\r\n\r\n\t\t] ),\r\n\r\n\t\tvertexShader: [\r\n\r\n\t\t\t\"uniform float size;\",\r\n\t\t\t\"uniform float scale;\",\r\n\r\n\t\t\tTHREE.ShaderChunk[ \"common\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"color_pars_vertex\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"shadowmap_pars_vertex\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"logdepthbuf_pars_vertex\" ],\r\n\r\n\t\t\t\"void main() {\",\r\n\r\n\t\t\t\tTHREE.ShaderChunk[ \"color_vertex\" ],\r\n\r\n\t\t\t\"\tvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\",\r\n\r\n\t\t\t\"\t#ifdef USE_SIZEATTENUATION\",\r\n\t\t\t\"\t\tgl_PointSize = size * ( scale / length( mvPosition.xyz ) );\",\r\n\t\t\t\"\t#else\",\r\n\t\t\t\"\t\tgl_PointSize = size;\",\r\n\t\t\t\"\t#endif\",\r\n\r\n\t\t\t\"\tgl_Position = projectionMatrix * mvPosition;\",\r\n\r\n\t\t\t\tTHREE.ShaderChunk[ \"logdepthbuf_vertex\" ],\r\n\t\t\t\tTHREE.ShaderChunk[ \"worldpos_vertex\" ],\r\n\t\t\t\tTHREE.ShaderChunk[ \"shadowmap_vertex\" ],\r\n\r\n\t\t\t\"}\"\r\n\r\n\t\t].join( \"\\n\" ),\r\n\r\n\t\tfragmentShader: [\r\n\r\n\t\t\t\"uniform vec3 psColor;\",\r\n\t\t\t\"uniform float opacity;\",\r\n\r\n\t\t\tTHREE.ShaderChunk[ \"common\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"color_pars_fragment\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"map_particle_pars_fragment\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"fog_pars_fragment\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"shadowmap_pars_fragment\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"logdepthbuf_pars_fragment\" ],\r\n\r\n\t\t\t\"void main() {\",\r\n\r\n\t\t\t\"\tvec3 outgoingLight = vec3( 0.0 );\",\r\n\t\t\t\"\tvec4 diffuseColor = vec4( psColor, opacity );\",\r\n\r\n\t\t\t\tTHREE.ShaderChunk[ \"logdepthbuf_fragment\" ],\r\n\t\t\t\tTHREE.ShaderChunk[ \"map_particle_fragment\" ],\r\n\t\t\t\tTHREE.ShaderChunk[ \"color_fragment\" ],\r\n\t\t\t\tTHREE.ShaderChunk[ \"alphatest_fragment\" ],\r\n\r\n\t\t\t\"\toutgoingLight = diffuseColor.rgb;\", // simple shader\r\n\r\n\t\t\t\tTHREE.ShaderChunk[ \"shadowmap_fragment\" ],\r\n\t\t\t\tTHREE.ShaderChunk[ \"fog_fragment\" ],\r\n\r\n\t\t\t\"\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\",\r\n\r\n\t\t\t\"}\"\r\n\r\n\t\t].join( \"\\n\" )\r\n\r\n\t},\r\n\r\n\t'dashed': {\r\n\r\n\t\tuniforms: THREE.UniformsUtils.merge( [\r\n\r\n\t\t\tTHREE.UniformsLib[ \"common\" ],\r\n\t\t\tTHREE.UniformsLib[ \"fog\" ],\r\n\r\n\t\t\t{\r\n\t\t\t\t\"scale\" : { type: \"f\", value: 1 },\r\n\t\t\t\t\"dashSize\" : { type: \"f\", value: 1 },\r\n\t\t\t\t\"totalSize\": { type: \"f\", value: 2 }\r\n\t\t\t}\r\n\r\n\t\t] ),\r\n\r\n\t\tvertexShader: [\r\n\r\n\t\t\t\"uniform float scale;\",\r\n\t\t\t\"attribute float lineDistance;\",\r\n\r\n\t\t\t\"varying float vLineDistance;\",\r\n\r\n\t\t\tTHREE.ShaderChunk[ \"common\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"color_pars_vertex\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"logdepthbuf_pars_vertex\" ],\r\n\r\n\t\t\t\"void main() {\",\r\n\r\n\t\t\t\tTHREE.ShaderChunk[ \"color_vertex\" ],\r\n\r\n\t\t\t\"\tvLineDistance = scale * lineDistance;\",\r\n\r\n\t\t\t\"\tvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\",\r\n\t\t\t\"\tgl_Position = projectionMatrix * mvPosition;\",\r\n\r\n\t\t\t\tTHREE.ShaderChunk[ \"logdepthbuf_vertex\" ],\r\n\r\n\t\t\t\"}\"\r\n\r\n\t\t].join( \"\\n\" ),\r\n\r\n\t\tfragmentShader: [\r\n\r\n\t\t\t\"uniform vec3 diffuse;\",\r\n\t\t\t\"uniform float opacity;\",\r\n\r\n\t\t\t\"uniform float dashSize;\",\r\n\t\t\t\"uniform float totalSize;\",\r\n\r\n\t\t\t\"varying float vLineDistance;\",\r\n\r\n\t\t\tTHREE.ShaderChunk[ \"common\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"color_pars_fragment\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"fog_pars_fragment\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"logdepthbuf_pars_fragment\" ],\r\n\r\n\t\t\t\"void main() {\",\r\n\r\n\t\t\t\"\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\",\r\n\r\n\t\t\t\"\t\tdiscard;\",\r\n\r\n\t\t\t\"\t}\",\r\n\r\n\t\t\t\"\tvec3 outgoingLight = vec3( 0.0 );\",\r\n\t\t\t\"\tvec4 diffuseColor = vec4( diffuse, opacity );\",\r\n\r\n\t\t\t\tTHREE.ShaderChunk[ \"logdepthbuf_fragment\" ],\r\n\t\t\t\tTHREE.ShaderChunk[ \"color_fragment\" ],\r\n\r\n\t\t\t\"\toutgoingLight = diffuseColor.rgb;\", // simple shader\r\n\r\n\t\t\t\tTHREE.ShaderChunk[ \"fog_fragment\" ],\r\n\r\n\t\t\t\"\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\",\r\n\r\n\t\t\t\"}\"\r\n\r\n\t\t].join( \"\\n\" )\r\n\r\n\t},\r\n\r\n\t'depth': {\r\n\r\n\t\tuniforms: {\r\n\r\n\t\t\t\"mNear\": { type: \"f\", value: 1.0 },\r\n\t\t\t\"mFar\" : { type: \"f\", value: 2000.0 },\r\n\t\t\t\"opacity\" : { type: \"f\", value: 1.0 }\r\n\r\n\t\t},\r\n\r\n\t\tvertexShader: [\r\n\r\n\t\t\tTHREE.ShaderChunk[ \"common\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"morphtarget_pars_vertex\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"logdepthbuf_pars_vertex\" ],\r\n\r\n\t\t\t\"void main() {\",\r\n\r\n\t\t\t\tTHREE.ShaderChunk[ \"begin_vertex\" ],\r\n\t\t\t\tTHREE.ShaderChunk[ \"morphtarget_vertex\" ],\r\n\t\t\t\tTHREE.ShaderChunk[ \"project_vertex\" ],\r\n\t\t\t\tTHREE.ShaderChunk[ \"logdepthbuf_vertex\" ],\r\n\r\n\t\t\t\"}\"\r\n\r\n\t\t].join( \"\\n\" ),\r\n\r\n\t\tfragmentShader: [\r\n\r\n\t\t\t\"uniform float mNear;\",\r\n\t\t\t\"uniform float mFar;\",\r\n\t\t\t\"uniform float opacity;\",\r\n\r\n\t\t\tTHREE.ShaderChunk[ \"common\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"logdepthbuf_pars_fragment\" ],\r\n\r\n\t\t\t\"void main() {\",\r\n\r\n\t\t\t\tTHREE.ShaderChunk[ \"logdepthbuf_fragment\" ],\r\n\r\n\t\t\t\"\t#ifdef USE_LOGDEPTHBUF_EXT\",\r\n\r\n\t\t\t\"\t\tfloat depth = gl_FragDepthEXT / gl_FragCoord.w;\",\r\n\r\n\t\t\t\"\t#else\",\r\n\r\n\t\t\t\"\t\tfloat depth = gl_FragCoord.z / gl_FragCoord.w;\",\r\n\r\n\t\t\t\"\t#endif\",\r\n\r\n\t\t\t\"\tfloat color = 1.0 - smoothstep( mNear, mFar, depth );\",\r\n\t\t\t\"\tgl_FragColor = vec4( vec3( color ), opacity );\",\r\n\r\n\t\t\t\"}\"\r\n\r\n\t\t].join( \"\\n\" )\r\n\r\n\t},\r\n\r\n\t'normal': {\r\n\r\n\t\tuniforms: {\r\n\r\n\t\t\t\"opacity\" : { type: \"f\", value: 1.0 }\r\n\r\n\t\t},\r\n\r\n\t\tvertexShader: [\r\n\r\n\t\t\t\"varying vec3 vNormal;\",\r\n\r\n\t\t\tTHREE.ShaderChunk[ \"common\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"morphtarget_pars_vertex\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"logdepthbuf_pars_vertex\" ],\r\n\r\n\t\t\t\"void main() {\",\r\n\r\n\t\t\t\"\tvNormal = normalize( normalMatrix * normal );\",\r\n\r\n\t\t\t\tTHREE.ShaderChunk[ \"begin_vertex\" ],\r\n\t\t\t\tTHREE.ShaderChunk[ \"morphtarget_vertex\" ],\r\n\t\t\t\tTHREE.ShaderChunk[ \"project_vertex\" ],\r\n\t\t\t\tTHREE.ShaderChunk[ \"logdepthbuf_vertex\" ],\r\n\r\n\t\t\t\"}\"\r\n\r\n\t\t].join( \"\\n\" ),\r\n\r\n\t\tfragmentShader: [\r\n\r\n\t\t\t\"uniform float opacity;\",\r\n\t\t\t\"varying vec3 vNormal;\",\r\n\r\n\t\t\tTHREE.ShaderChunk[ \"common\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"logdepthbuf_pars_fragment\" ],\r\n\r\n\t\t\t\"void main() {\",\r\n\r\n\t\t\t\"\tgl_FragColor = vec4( 0.5 * normalize( vNormal ) + 0.5, opacity );\",\r\n\r\n\t\t\t\tTHREE.ShaderChunk[ \"logdepthbuf_fragment\" ],\r\n\r\n\t\t\t\"}\"\r\n\r\n\t\t].join( \"\\n\" )\r\n\r\n\t},\r\n\r\n\t/* -------------------------------------------------------------------------\r\n\t//\tCube map shader\r\n\t ------------------------------------------------------------------------- */\r\n\r\n\t'cube': {\r\n\r\n\t\tuniforms: { \"tCube\": { type: \"t\", value: null },\r\n\t\t\t\t\t\"tFlip\": { type: \"f\", value: - 1 } },\r\n\r\n\t\tvertexShader: [\r\n\r\n\t\t\t\"varying vec3 vWorldPosition;\",\r\n\r\n\t\t\tTHREE.ShaderChunk[ \"common\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"logdepthbuf_pars_vertex\" ],\r\n\r\n\t\t\t\"void main() {\",\r\n\r\n\t\t\t\"\tvWorldPosition = transformDirection( position, modelMatrix );\",\r\n\r\n\t\t\t\"\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\",\r\n\r\n\t\t\t\tTHREE.ShaderChunk[ \"logdepthbuf_vertex\" ],\r\n\r\n\t\t\t\"}\"\r\n\r\n\t\t].join( \"\\n\" ),\r\n\r\n\t\tfragmentShader: [\r\n\r\n\t\t\t\"uniform samplerCube tCube;\",\r\n\t\t\t\"uniform float tFlip;\",\r\n\r\n\t\t\t\"varying vec3 vWorldPosition;\",\r\n\r\n\t\t\tTHREE.ShaderChunk[ \"common\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"logdepthbuf_pars_fragment\" ],\r\n\r\n\t\t\t\"void main() {\",\r\n\r\n\t\t\t\"\tgl_FragColor = textureCube( tCube, vec3( tFlip * vWorldPosition.x, vWorldPosition.yz ) );\",\r\n\r\n\t\t\t\tTHREE.ShaderChunk[ \"logdepthbuf_fragment\" ],\r\n\r\n\t\t\t\"}\"\r\n\r\n\t\t].join( \"\\n\" )\r\n\r\n\t},\r\n\r\n\t/* -------------------------------------------------------------------------\r\n\t//\tCube map shader\r\n\t ------------------------------------------------------------------------- */\r\n\r\n\t'equirect': {\r\n\r\n\t\tuniforms: { \"tEquirect\": { type: \"t\", value: null },\r\n\t\t\t\t\t\"tFlip\": { type: \"f\", value: - 1 } },\r\n\r\n\t\tvertexShader: [\r\n\r\n\t\t\t\"varying vec3 vWorldPosition;\",\r\n\r\n\t\t\tTHREE.ShaderChunk[ \"common\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"logdepthbuf_pars_vertex\" ],\r\n\r\n\t\t\t\"void main() {\",\r\n\r\n\t\t\t\"\tvWorldPosition = transformDirection( position, modelMatrix );\",\r\n\r\n\t\t\t\"\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\",\r\n\r\n\t\t\t\tTHREE.ShaderChunk[ \"logdepthbuf_vertex\" ],\r\n\r\n\t\t\t\"}\"\r\n\r\n\t\t].join( \"\\n\" ),\r\n\r\n\t\tfragmentShader: [\r\n\r\n\t\t\t\"uniform sampler2D tEquirect;\",\r\n\t\t\t\"uniform float tFlip;\",\r\n\r\n\t\t\t\"varying vec3 vWorldPosition;\",\r\n\r\n\t\t\tTHREE.ShaderChunk[ \"common\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"logdepthbuf_pars_fragment\" ],\r\n\r\n\t\t\t\"void main() {\",\r\n\r\n\t\t\t\t// \"\tgl_FragColor = textureCube( tCube, vec3( tFlip * vWorldPosition.x, vWorldPosition.yz ) );\",\r\n\t\t\t\t\"vec3 direction = normalize( vWorldPosition );\",\r\n\t\t\t\t\"vec2 sampleUV;\",\r\n\t\t\t\t\"sampleUV.y = saturate( tFlip * direction.y * -0.5 + 0.5 );\",\r\n\t\t\t\t\"sampleUV.x = atan( direction.z, direction.x ) * RECIPROCAL_PI2 + 0.5;\",\r\n\t\t\t\t\"gl_FragColor = texture2D( tEquirect, sampleUV );\",\r\n\r\n\t\t\t\tTHREE.ShaderChunk[ \"logdepthbuf_fragment\" ],\r\n\r\n\t\t\t\"}\"\r\n\r\n\t\t].join( \"\\n\" )\r\n\r\n\t},\r\n\r\n\t/* Depth encoding into RGBA texture\r\n\t *\r\n\t * based on SpiderGL shadow map example\r\n\t * http://spidergl.org/example.php?id=6\r\n\t *\r\n\t * originally from\r\n\t * http://www.gamedev.net/topic/442138-packing-a-float-into-a-a8r8g8b8-texture-shader/page__whichpage__1%25EF%25BF%25BD\r\n\t *\r\n\t * see also\r\n\t * http://aras-p.info/blog/2009/07/30/encoding-floats-to-rgba-the-final/\r\n\t */\r\n\r\n\t'depthRGBA': {\r\n\r\n\t\tuniforms: {},\r\n\r\n\t\tvertexShader: [\r\n\r\n\t\t\tTHREE.ShaderChunk[ \"common\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"morphtarget_pars_vertex\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"skinning_pars_vertex\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"logdepthbuf_pars_vertex\" ],\r\n\r\n\t\t\t\"void main() {\",\r\n\r\n\t\t\t\tTHREE.ShaderChunk[ \"skinbase_vertex\" ],\r\n\r\n\t\t\t\tTHREE.ShaderChunk[ \"begin_vertex\" ],\r\n\t\t\t\tTHREE.ShaderChunk[ \"morphtarget_vertex\" ],\r\n\t\t\t\tTHREE.ShaderChunk[ \"skinning_vertex\" ],\r\n\t\t\t\tTHREE.ShaderChunk[ \"project_vertex\" ],\r\n\t\t\t\tTHREE.ShaderChunk[ \"logdepthbuf_vertex\" ],\r\n\r\n\t\t\t\"}\"\r\n\r\n\t\t].join( \"\\n\" ),\r\n\r\n\t\tfragmentShader: [\r\n\r\n\t\t\tTHREE.ShaderChunk[ \"common\" ],\r\n\t\t\tTHREE.ShaderChunk[ \"logdepthbuf_pars_fragment\" ],\r\n\r\n\t\t\t\"vec4 pack_depth( const in float depth ) {\",\r\n\r\n\t\t\t\"\tconst vec4 bit_shift = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );\",\r\n\t\t\t\"\tconst vec4 bit_mask = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );\",\r\n\t\t\t\"\tvec4 res = mod( depth * bit_shift * vec4( 255 ), vec4( 256 ) ) / vec4( 255 );\", // \"\tvec4 res = fract( depth * bit_shift );\",\r\n\t\t\t\"\tres -= res.xxyz * bit_mask;\",\r\n\t\t\t\"\treturn res;\",\r\n\r\n\t\t\t\"}\",\r\n\r\n\t\t\t\"void main() {\",\r\n\r\n\t\t\t\tTHREE.ShaderChunk[ \"logdepthbuf_fragment\" ],\r\n\r\n\t\t\t\"\t#ifdef USE_LOGDEPTHBUF_EXT\",\r\n\r\n\t\t\t\"\t\tgl_FragData[ 0 ] = pack_depth( gl_FragDepthEXT );\",\r\n\r\n\t\t\t\"\t#else\",\r\n\r\n\t\t\t\"\t\tgl_FragData[ 0 ] = pack_depth( gl_FragCoord.z );\",\r\n\r\n\t\t\t\"\t#endif\",\r\n\r\n\t\t\t\t//\"gl_FragData[ 0 ] = pack_depth( gl_FragCoord.z / gl_FragCoord.w );\",\r\n\t\t\t\t//\"float z = ( ( gl_FragCoord.z / gl_FragCoord.w ) - 3.0 ) / ( 4000.0 - 3.0 );\",\r\n\t\t\t\t//\"gl_FragData[ 0 ] = pack_depth( z );\",\r\n\t\t\t\t//\"gl_FragData[ 0 ] = vec4( z, z, z, 1.0 );\",\r\n\r\n\t\t\t\"}\"\r\n\r\n\t\t].join( \"\\n\" )\r\n\r\n\t}\r\n\r\n};\r\n\r\n// File:src/renderers/WebGLRenderer.js\r\n\r\n/**\r\n * @author supereggbert / http://www.paulbrunt.co.uk/\r\n * @author mrdoob / http://mrdoob.com/\r\n * @author alteredq / http://alteredqualia.com/\r\n * @author szimek / https://github.com/szimek/\r\n */\r\n\r\nTHREE.WebGLRenderer = function ( parameters ) {\r\n\r\n\tconsole.log( 'THREE.WebGLRenderer', THREE.REVISION );\r\n\r\n\tparameters = parameters || {};\r\n\r\n\tvar _canvas = parameters.canvas !== undefined ? parameters.canvas : document.createElement( 'canvas' ),\r\n\t_context = parameters.context !== undefined ? parameters.context : null,\r\n\r\n\t_width = _canvas.width,\r\n\t_height = _canvas.height,\r\n\r\n\tpixelRatio = 1,\r\n\r\n\t_alpha = parameters.alpha !== undefined ? parameters.alpha : false,\r\n\t_depth = parameters.depth !== undefined ? parameters.depth : true,\r\n\t_stencil = parameters.stencil !== undefined ? parameters.stencil : true,\r\n\t_antialias = parameters.antialias !== undefined ? parameters.antialias : false,\r\n\t_premultipliedAlpha = parameters.premultipliedAlpha !== undefined ? parameters.premultipliedAlpha : true,\r\n\t_preserveDrawingBuffer = parameters.preserveDrawingBuffer !== undefined ? parameters.preserveDrawingBuffer : false,\r\n\r\n\t_clearColor = new THREE.Color( 0x000000 ),\r\n\t_clearAlpha = 0;\r\n\r\n\tvar lights = [];\r\n\r\n\tvar opaqueObjects = [];\r\n\tvar opaqueObjectsLastIndex = -1;\r\n\tvar transparentObjects = [];\r\n\tvar transparentObjectsLastIndex = -1;\r\n\r\n\tvar opaqueImmediateObjects = [];\r\n\tvar opaqueImmediateObjectsLastIndex = -1;\r\n\tvar transparentImmediateObjects = [];\r\n\tvar transparentImmediateObjectsLastIndex = -1;\r\n\r\n\tvar morphInfluences = new Float32Array( 8 );\r\n\r\n\r\n\tvar sprites = [];\r\n\tvar lensFlares = [];\r\n\r\n\t// public properties\r\n\r\n\tthis.domElement = _canvas;\r\n\tthis.context = null;\r\n\r\n\t// clearing\r\n\r\n\tthis.autoClear = true;\r\n\tthis.autoClearColor = true;\r\n\tthis.autoClearDepth = true;\r\n\tthis.autoClearStencil = true;\r\n\r\n\t// scene graph\r\n\r\n\tthis.sortObjects = true;\r\n\r\n\t// physically based shading\r\n\r\n\tthis.gammaFactor = 2.0;\t// for backwards compatibility\r\n\tthis.gammaInput = false;\r\n\tthis.gammaOutput = false;\r\n\r\n\t// morphs\r\n\r\n\tthis.maxMorphTargets = 8;\r\n\tthis.maxMorphNormals = 4;\r\n\r\n\t// flags\r\n\r\n\tthis.autoScaleCubemaps = true;\r\n\r\n\t// internal properties\r\n\r\n\tvar _this = this,\r\n\r\n\t_programs = [],\r\n\r\n\t// internal state cache\r\n\r\n\t_currentProgram = null,\r\n\t_currentFramebuffer = null,\r\n\t_currentMaterialId = - 1,\r\n\t_currentGeometryProgram = '',\r\n\t_currentCamera = null,\r\n\r\n\t_usedTextureUnits = 0,\r\n\r\n\t_viewportX = 0,\r\n\t_viewportY = 0,\r\n\t_viewportWidth = _canvas.width,\r\n\t_viewportHeight = _canvas.height,\r\n\t_currentWidth = 0,\r\n\t_currentHeight = 0,\r\n\r\n\t// frustum\r\n\r\n\t_frustum = new THREE.Frustum(),\r\n\r\n\t // camera matrices cache\r\n\r\n\t_projScreenMatrix = new THREE.Matrix4(),\r\n\r\n\t_vector3 = new THREE.Vector3(),\r\n\r\n\t// light arrays cache\r\n\r\n\t_direction = new THREE.Vector3(),\r\n\r\n\t_lightsNeedUpdate = true,\r\n\r\n\t_lights = {\r\n\r\n\t\tambient: [ 0, 0, 0 ],\r\n\t\tdirectional: { length: 0, colors: [], positions: [] },\r\n\t\tpoint: { length: 0, colors: [], positions: [], distances: [], decays: [] },\r\n\t\tspot: { length: 0, colors: [], positions: [], distances: [], directions: [], anglesCos: [], exponents: [], decays: [] },\r\n\t\themi: { length: 0, skyColors: [], groundColors: [], positions: [] }\r\n\r\n\t},\r\n\r\n\t// info\r\n\r\n\t_infoMemory = {\r\n\r\n\t\tprograms: 0,\r\n\t\tgeometries: 0,\r\n\t\ttextures: 0\r\n\r\n\t},\r\n\r\n\t_infoRender = {\r\n\r\n\t\tcalls: 0,\r\n\t\tvertices: 0,\r\n\t\tfaces: 0,\r\n\t\tpoints: 0\r\n\r\n\t};\r\n\r\n\tthis.info = {\r\n\r\n\t\trender: _infoRender,\r\n\t\tmemory: _infoMemory,\r\n\t\tprograms: _programs\r\n\r\n\t};\r\n\r\n\t// initialize\r\n\r\n\tvar _gl;\r\n\r\n\ttry {\r\n\r\n\t\tvar attributes = {\r\n\t\t\talpha: _alpha,\r\n\t\t\tdepth: _depth,\r\n\t\t\tstencil: _stencil,\r\n\t\t\tantialias: _antialias,\r\n\t\t\tpremultipliedAlpha: _premultipliedAlpha,\r\n\t\t\tpreserveDrawingBuffer: _preserveDrawingBuffer\r\n\t\t};\r\n\r\n\t\t_gl = _context || _canvas.getContext( 'webgl', attributes ) || _canvas.getContext( 'experimental-webgl', attributes );\r\n\r\n\t\tif ( _gl === null ) {\r\n\r\n\t\t\tif ( _canvas.getContext( 'webgl' ) !== null ) {\r\n\r\n\t\t\t\tthrow 'Error creating WebGL context with your selected attributes.';\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tthrow 'Error creating WebGL context.';\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\t_canvas.addEventListener( 'webglcontextlost', onContextLost, false );\r\n\r\n\t} catch ( error ) {\r\n\r\n\t\tconsole.error( 'THREE.WebGLRenderer: ' + error );\r\n\r\n\t}\r\n\r\n\tvar extensions = new THREE.WebGLExtensions( _gl );\r\n\r\n\textensions.get( 'OES_texture_float' );\r\n\textensions.get( 'OES_texture_float_linear' );\r\n\textensions.get( 'OES_texture_half_float' );\r\n\textensions.get( 'OES_texture_half_float_linear' );\r\n\textensions.get( 'OES_standard_derivatives' );\r\n\textensions.get( 'ANGLE_instanced_arrays' );\r\n\r\n\tif ( extensions.get( 'OES_element_index_uint' ) ) {\r\n\r\n\t\tTHREE.BufferGeometry.MaxIndex = 4294967296;\r\n\r\n\t}\r\n\r\n\tvar capabilities = new THREE.WebGLCapabilities( _gl, extensions, parameters );\r\n\r\n\tvar state = new THREE.WebGLState( _gl, extensions, paramThreeToGL );\r\n\tvar properties = new THREE.WebGLProperties();\r\n\tvar objects = new THREE.WebGLObjects( _gl, properties, this.info );\r\n\tvar programCache = new THREE.WebGLPrograms( this, capabilities );\r\n\r\n\tvar bufferRenderer = new THREE.WebGLBufferRenderer( _gl, extensions, _infoRender );\r\n\tvar indexedBufferRenderer = new THREE.WebGLIndexedBufferRenderer( _gl, extensions, _infoRender );\r\n\r\n\t//\r\n\r\n\tfunction glClearColor( r, g, b, a ) {\r\n\r\n\t\tif ( _premultipliedAlpha === true ) {\r\n\r\n\t\t\tr *= a; g *= a; b *= a;\r\n\r\n\t\t}\r\n\r\n\t\t_gl.clearColor( r, g, b, a );\r\n\r\n\t}\r\n\r\n\tfunction setDefaultGLState() {\r\n\r\n\t\tstate.init();\r\n\r\n\t\t_gl.viewport( _viewportX, _viewportY, _viewportWidth, _viewportHeight );\r\n\r\n\t\tglClearColor( _clearColor.r, _clearColor.g, _clearColor.b, _clearAlpha );\r\n\r\n\t}\r\n\r\n\tfunction resetGLState() {\r\n\r\n\t\t_currentProgram = null;\r\n\t\t_currentCamera = null;\r\n\r\n\t\t_currentGeometryProgram = '';\r\n\t\t_currentMaterialId = - 1;\r\n\r\n\t\t_lightsNeedUpdate = true;\r\n\r\n\t\tstate.reset();\r\n\r\n\t}\r\n\r\n\tsetDefaultGLState();\r\n\r\n\tthis.context = _gl;\r\n\tthis.capabilities = capabilities;\r\n\tthis.extensions = extensions;\r\n\tthis.state = state;\r\n\r\n\t// shadow map\r\n\r\n\tvar shadowMap = new THREE.WebGLShadowMap( this, lights, objects );\r\n\r\n\tthis.shadowMap = shadowMap;\r\n\r\n\r\n\t// Plugins\r\n\r\n\tvar spritePlugin = new THREE.SpritePlugin( this, sprites );\r\n\tvar lensFlarePlugin = new THREE.LensFlarePlugin( this, lensFlares );\r\n\r\n\t// API\r\n\r\n\tthis.getContext = function () {\r\n\r\n\t\treturn _gl;\r\n\r\n\t};\r\n\r\n\tthis.getContextAttributes = function () {\r\n\r\n\t\treturn _gl.getContextAttributes();\r\n\r\n\t};\r\n\r\n\tthis.forceContextLoss = function () {\r\n\r\n\t\textensions.get( 'WEBGL_lose_context' ).loseContext();\r\n\r\n\t};\r\n\r\n\tthis.getMaxAnisotropy = ( function () {\r\n\r\n\t\tvar value;\r\n\r\n\t\treturn function getMaxAnisotropy() {\r\n\r\n\t\t\tif ( value !== undefined ) return value;\r\n\r\n\t\t\tvar extension = extensions.get( 'EXT_texture_filter_anisotropic' );\r\n\r\n\t\t\tif ( extension !== null ) {\r\n\r\n\t\t\t\tvalue = _gl.getParameter( extension.MAX_TEXTURE_MAX_ANISOTROPY_EXT );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tvalue = 0;\r\n\r\n\t\t\t}\r\n\r\n\t\t\treturn value;\r\n\r\n\t\t}\r\n\r\n\t} )();\r\n\r\n\tthis.getPrecision = function () {\r\n\r\n\t\treturn capabilities.precision;\r\n\r\n\t};\r\n\r\n\tthis.getPixelRatio = function () {\r\n\r\n\t\treturn pixelRatio;\r\n\r\n\t};\r\n\r\n\tthis.setPixelRatio = function ( value ) {\r\n\r\n\t\tif ( value !== undefined ) pixelRatio = value;\r\n\r\n\t};\r\n\r\n\tthis.getSize = function () {\r\n\r\n\t\treturn {\r\n\t\t\twidth: _width,\r\n\t\t\theight: _height\r\n\t\t};\r\n\r\n\t};\r\n\r\n\tthis.setSize = function ( width, height, updateStyle ) {\r\n\r\n\t\t_width = width;\r\n\t\t_height = height;\r\n\r\n\t\t_canvas.width = width * pixelRatio;\r\n\t\t_canvas.height = height * pixelRatio;\r\n\r\n\t\tif ( updateStyle !== false ) {\r\n\r\n\t\t\t_canvas.style.width = width + 'px';\r\n\t\t\t_canvas.style.height = height + 'px';\r\n\r\n\t\t}\r\n\r\n\t\tthis.setViewport( 0, 0, width, height );\r\n\r\n\t};\r\n\r\n\tthis.setViewport = function ( x, y, width, height ) {\r\n\r\n\t\t_viewportX = x * pixelRatio;\r\n\t\t_viewportY = y * pixelRatio;\r\n\r\n\t\t_viewportWidth = width * pixelRatio;\r\n\t\t_viewportHeight = height * pixelRatio;\r\n\r\n\t\t_gl.viewport( _viewportX, _viewportY, _viewportWidth, _viewportHeight );\r\n\r\n\t};\r\n\r\n\tthis.setScissor = function ( x, y, width, height ) {\r\n\r\n\t\t_gl.scissor(\r\n\t\t\tx * pixelRatio,\r\n\t\t\ty * pixelRatio,\r\n\t\t\twidth * pixelRatio,\r\n\t\t\theight * pixelRatio\r\n\t\t);\r\n\r\n\t};\r\n\r\n\tthis.enableScissorTest = function ( boolean ) {\r\n\r\n\t\tstate.setScissorTest( boolean );\r\n\r\n\t};\r\n\r\n\t// Clearing\r\n\r\n\tthis.getClearColor = function () {\r\n\r\n\t\treturn _clearColor;\r\n\r\n\t};\r\n\r\n\tthis.setClearColor = function ( color, alpha ) {\r\n\r\n\t\t_clearColor.set( color );\r\n\r\n\t\t_clearAlpha = alpha !== undefined ? alpha : 1;\r\n\r\n\t\tglClearColor( _clearColor.r, _clearColor.g, _clearColor.b, _clearAlpha );\r\n\r\n\t};\r\n\r\n\tthis.getClearAlpha = function () {\r\n\r\n\t\treturn _clearAlpha;\r\n\r\n\t};\r\n\r\n\tthis.setClearAlpha = function ( alpha ) {\r\n\r\n\t\t_clearAlpha = alpha;\r\n\r\n\t\tglClearColor( _clearColor.r, _clearColor.g, _clearColor.b, _clearAlpha );\r\n\r\n\t};\r\n\r\n\tthis.clear = function ( color, depth, stencil ) {\r\n\r\n\t\tvar bits = 0;\r\n\r\n\t\tif ( color === undefined || color ) bits |= _gl.COLOR_BUFFER_BIT;\r\n\t\tif ( depth === undefined || depth ) bits |= _gl.DEPTH_BUFFER_BIT;\r\n\t\tif ( stencil === undefined || stencil ) bits |= _gl.STENCIL_BUFFER_BIT;\r\n\r\n\t\t_gl.clear( bits );\r\n\r\n\t};\r\n\r\n\tthis.clearColor = function () {\r\n\r\n\t\t_gl.clear( _gl.COLOR_BUFFER_BIT );\r\n\r\n\t};\r\n\r\n\tthis.clearDepth = function () {\r\n\r\n\t\t_gl.clear( _gl.DEPTH_BUFFER_BIT );\r\n\r\n\t};\r\n\r\n\tthis.clearStencil = function () {\r\n\r\n\t\t_gl.clear( _gl.STENCIL_BUFFER_BIT );\r\n\r\n\t};\r\n\r\n\tthis.clearTarget = function ( renderTarget, color, depth, stencil ) {\r\n\r\n\t\tthis.setRenderTarget( renderTarget );\r\n\t\tthis.clear( color, depth, stencil );\r\n\r\n\t};\r\n\r\n\t// Reset\r\n\r\n\tthis.resetGLState = resetGLState;\r\n\r\n\tthis.dispose = function() {\r\n\r\n\t\t_canvas.removeEventListener( 'webglcontextlost', onContextLost, false );\r\n\r\n\t};\r\n\r\n\t// Events\r\n\r\n\tfunction onContextLost( event ) {\r\n\r\n\t\tevent.preventDefault();\r\n\r\n\t\tresetGLState();\r\n\t\tsetDefaultGLState();\r\n\r\n\t\tproperties.clear();\r\n\r\n\t};\r\n\r\n\tfunction onTextureDispose( event ) {\r\n\r\n\t\tvar texture = event.target;\r\n\r\n\t\ttexture.removeEventListener( 'dispose', onTextureDispose );\r\n\r\n\t\tdeallocateTexture( texture );\r\n\r\n\t\t_infoMemory.textures --;\r\n\r\n\r\n\t}\r\n\r\n\tfunction onRenderTargetDispose( event ) {\r\n\r\n\t\tvar renderTarget = event.target;\r\n\r\n\t\trenderTarget.removeEventListener( 'dispose', onRenderTargetDispose );\r\n\r\n\t\tdeallocateRenderTarget( renderTarget );\r\n\r\n\t\t_infoMemory.textures --;\r\n\r\n\t}\r\n\r\n\tfunction onMaterialDispose( event ) {\r\n\r\n\t\tvar material = event.target;\r\n\r\n\t\tmaterial.removeEventListener( 'dispose', onMaterialDispose );\r\n\r\n\t\tdeallocateMaterial( material );\r\n\r\n\t}\r\n\r\n\t// Buffer deallocation\r\n\r\n\tfunction deallocateTexture( texture ) {\r\n\r\n\t\tvar textureProperties = properties.get( texture );\r\n\r\n\t\tif ( texture.image && textureProperties.__image__webglTextureCube ) {\r\n\r\n\t\t\t// cube texture\r\n\r\n\t\t\t_gl.deleteTexture( textureProperties.__image__webglTextureCube );\r\n\r\n\t\t} else {\r\n\r\n\t\t\t// 2D texture\r\n\r\n\t\t\tif ( textureProperties.__webglInit === undefined ) return;\r\n\r\n\t\t\t_gl.deleteTexture( textureProperties.__webglTexture );\r\n\r\n\t\t}\r\n\r\n\t\t// remove all webgl properties\r\n\t\tproperties.delete( texture );\r\n\r\n\t}\r\n\r\n\tfunction deallocateRenderTarget( renderTarget ) {\r\n\r\n\t\tvar renderTargetProperties = properties.get( renderTarget );\r\n\r\n\t\tif ( ! renderTarget || renderTargetProperties.__webglTexture === undefined ) return;\r\n\r\n\t\t_gl.deleteTexture( renderTargetProperties.__webglTexture );\r\n\r\n\t\tif ( renderTarget instanceof THREE.WebGLRenderTargetCube ) {\r\n\r\n\t\t\tfor ( var i = 0; i < 6; i ++ ) {\r\n\r\n\t\t\t\t_gl.deleteFramebuffer( renderTargetProperties.__webglFramebuffer[ i ] );\r\n\t\t\t\t_gl.deleteRenderbuffer( renderTargetProperties.__webglRenderbuffer[ i ] );\r\n\r\n\t\t\t}\r\n\r\n\t\t} else {\r\n\r\n\t\t\t_gl.deleteFramebuffer( renderTargetProperties.__webglFramebuffer );\r\n\t\t\t_gl.deleteRenderbuffer( renderTargetProperties.__webglRenderbuffer );\r\n\r\n\t\t}\r\n\r\n\t\tproperties.delete( renderTarget );\r\n\r\n\t}\r\n\r\n\tfunction deallocateMaterial( material ) {\r\n\r\n\t\treleaseMaterialProgramReference( material );\r\n\r\n\t\tproperties.delete( material );\r\n\r\n\t}\r\n\r\n\r\n\tfunction releaseMaterialProgramReference( material ) {\r\n\r\n\t\tvar program = properties.get( material ).program.program;\r\n\r\n\t\tif ( program === undefined ) return;\r\n\r\n\t\tmaterial.program = undefined;\r\n\r\n\t\tfor ( var i = 0, n = _programs.length; i !== n; ++ i ) {\r\n\r\n\t\t\tvar programInfo = _programs[ i ];\r\n\r\n\t\t\tif ( programInfo.program === program ) {\r\n\r\n\t\t\t\tvar newReferenceCount = -- programInfo.usedTimes;\r\n\r\n\t\t\t\tif ( newReferenceCount === 0 ) {\r\n\r\n\t\t\t\t\t// the last material that has been using the program let\r\n\t\t\t\t\t// go of it, so remove it from the (unordered) _programs\r\n\t\t\t\t\t// set and deallocate the GL resource\r\n\r\n\t\t\t\t\tvar newLength = n - 1;\r\n\r\n\t\t\t\t\t_programs[ i ] = _programs[ newLength ];\r\n\t\t\t\t\t_programs.pop();\r\n\r\n\t\t\t\t\t_gl.deleteProgram( program );\r\n\r\n\t\t\t\t\t_infoMemory.programs = newLength;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tbreak;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\t// Buffer rendering\r\n\r\n\tthis.renderBufferImmediate = function ( object, program, material ) {\r\n\r\n\t\tstate.initAttributes();\r\n\r\n\t\tvar buffers = properties.get( object );\r\n\r\n\t\tif ( object.hasPositions && ! buffers.position ) buffers.position = _gl.createBuffer();\r\n\t\tif ( object.hasNormals && ! buffers.normal ) buffers.normal = _gl.createBuffer();\r\n\t\tif ( object.hasUvs && ! buffers.uv ) buffers.uv = _gl.createBuffer();\r\n\t\tif ( object.hasColors && ! buffers.color ) buffers.color = _gl.createBuffer();\r\n\r\n\t\tvar attributes = program.getAttributes();\r\n\r\n\t\tif ( object.hasPositions ) {\r\n\r\n\t\t\t_gl.bindBuffer( _gl.ARRAY_BUFFER, buffers.position );\r\n\t\t\t_gl.bufferData( _gl.ARRAY_BUFFER, object.positionArray, _gl.DYNAMIC_DRAW );\r\n\r\n\t\t\tstate.enableAttribute( attributes.position );\r\n\t\t\t_gl.vertexAttribPointer( attributes.position, 3, _gl.FLOAT, false, 0, 0 );\r\n\r\n\t\t}\r\n\r\n\t\tif ( object.hasNormals ) {\r\n\r\n\t\t\t_gl.bindBuffer( _gl.ARRAY_BUFFER, buffers.normal );\r\n\r\n\t\t\tif ( material.type !== 'MeshPhongMaterial' && material.shading === THREE.FlatShading ) {\r\n\r\n\t\t\t\tfor ( var i = 0, l = object.count * 3; i < l; i += 9 ) {\r\n\r\n\t\t\t\t\tvar array = object.normalArray;\r\n\r\n\t\t\t\t\tvar nx = ( array[ i + 0 ] + array[ i + 3 ] + array[ i + 6 ] ) / 3;\r\n\t\t\t\t\tvar ny = ( array[ i + 1 ] + array[ i + 4 ] + array[ i + 7 ] ) / 3;\r\n\t\t\t\t\tvar nz = ( array[ i + 2 ] + array[ i + 5 ] + array[ i + 8 ] ) / 3;\r\n\r\n\t\t\t\t\tarray[ i + 0 ] = nx;\r\n\t\t\t\t\tarray[ i + 1 ] = ny;\r\n\t\t\t\t\tarray[ i + 2 ] = nz;\r\n\r\n\t\t\t\t\tarray[ i + 3 ] = nx;\r\n\t\t\t\t\tarray[ i + 4 ] = ny;\r\n\t\t\t\t\tarray[ i + 5 ] = nz;\r\n\r\n\t\t\t\t\tarray[ i + 6 ] = nx;\r\n\t\t\t\t\tarray[ i + 7 ] = ny;\r\n\t\t\t\t\tarray[ i + 8 ] = nz;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\t_gl.bufferData( _gl.ARRAY_BUFFER, object.normalArray, _gl.DYNAMIC_DRAW );\r\n\r\n\t\t\tstate.enableAttribute( attributes.normal );\r\n\r\n\t\t\t_gl.vertexAttribPointer( attributes.normal, 3, _gl.FLOAT, false, 0, 0 );\r\n\r\n\t\t}\r\n\r\n\t\tif ( object.hasUvs && material.map ) {\r\n\r\n\t\t\t_gl.bindBuffer( _gl.ARRAY_BUFFER, buffers.uv );\r\n\t\t\t_gl.bufferData( _gl.ARRAY_BUFFER, object.uvArray, _gl.DYNAMIC_DRAW );\r\n\r\n\t\t\tstate.enableAttribute( attributes.uv );\r\n\r\n\t\t\t_gl.vertexAttribPointer( attributes.uv, 2, _gl.FLOAT, false, 0, 0 );\r\n\r\n\t\t}\r\n\r\n\t\tif ( object.hasColors && material.vertexColors !== THREE.NoColors ) {\r\n\r\n\t\t\t_gl.bindBuffer( _gl.ARRAY_BUFFER, buffers.color );\r\n\t\t\t_gl.bufferData( _gl.ARRAY_BUFFER, object.colorArray, _gl.DYNAMIC_DRAW );\r\n\r\n\t\t\tstate.enableAttribute( attributes.color );\r\n\r\n\t\t\t_gl.vertexAttribPointer( attributes.color, 3, _gl.FLOAT, false, 0, 0 );\r\n\r\n\t\t}\r\n\r\n\t\tstate.disableUnusedAttributes();\r\n\r\n\t\t_gl.drawArrays( _gl.TRIANGLES, 0, object.count );\r\n\r\n\t\tobject.count = 0;\r\n\r\n\t};\r\n\r\n\tthis.renderBufferDirect = function ( camera, lights, fog, geometry, material, object, group ) {\r\n\r\n\t\tsetMaterial( material );\r\n\r\n\t\tvar program = setProgram( camera, lights, fog, material, object );\r\n\r\n\t\tvar updateBuffers = false;\r\n\t\tvar geometryProgram = geometry.id + '_' + program.id + '_' + material.wireframe;\r\n\r\n\t\tif ( geometryProgram !== _currentGeometryProgram ) {\r\n\r\n\t\t\t_currentGeometryProgram = geometryProgram;\r\n\t\t\tupdateBuffers = true;\r\n\r\n\t\t}\r\n\r\n\t\t// morph targets\r\n\r\n\t\tvar morphTargetInfluences = object.morphTargetInfluences;\r\n\r\n\t\tif ( morphTargetInfluences !== undefined ) {\r\n\r\n\t\t\tvar activeInfluences = [];\r\n\r\n\t\t\tfor ( var i = 0, l = morphTargetInfluences.length; i < l; i ++ ) {\r\n\r\n\t\t\t\tvar influence = morphTargetInfluences[ i ];\r\n\t\t\t\tactiveInfluences.push( [ influence, i ] );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tactiveInfluences.sort( numericalSort );\r\n\r\n\t\t\tif ( activeInfluences.length > 8 ) {\r\n\r\n\t\t\t\tactiveInfluences.length = 8;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tvar morphAttributes = geometry.morphAttributes;\r\n\r\n\t\t\tfor ( var i = 0, l = activeInfluences.length; i < l; i ++ ) {\r\n\r\n\t\t\t\tvar influence = activeInfluences[ i ];\r\n\t\t\t\tmorphInfluences[ i ] = influence[ 0 ];\r\n\r\n\t\t\t\tif ( influence[ 0 ] !== 0 ) {\r\n\r\n\t\t\t\t\tvar index = influence[ 1 ];\r\n\r\n\t\t\t\t\tif ( material.morphTargets === true && morphAttributes.position ) geometry.addAttribute( 'morphTarget' + i, morphAttributes.position[ index ] );\r\n\t\t\t\t\tif ( material.morphNormals === true && morphAttributes.normal ) geometry.addAttribute( 'morphNormal' + i, morphAttributes.normal[ index ] );\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\tif ( material.morphTargets === true ) geometry.removeAttribute( 'morphTarget' + i );\r\n\t\t\t\t\tif ( material.morphNormals === true ) geometry.removeAttribute( 'morphNormal' + i );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\tvar uniforms = program.getUniforms();\r\n\r\n\t\t\tif ( uniforms.morphTargetInfluences !== null ) {\r\n\r\n\t\t\t\t_gl.uniform1fv( uniforms.morphTargetInfluences, morphInfluences );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tupdateBuffers = true;\r\n\r\n\t\t}\r\n\r\n\t\t//\r\n\r\n\t\tvar index = geometry.index;\r\n\t\tvar position = geometry.attributes.position;\r\n\r\n\t\tif ( material.wireframe === true ) {\r\n\r\n\t\t\tindex = objects.getWireframeAttribute( geometry );\r\n\r\n\t\t}\r\n\r\n\t\tvar renderer;\r\n\r\n\t\tif ( index !== null ) {\r\n\r\n\t\t\trenderer = indexedBufferRenderer;\r\n\t\t\trenderer.setIndex( index );\r\n\r\n\t\t} else {\r\n\r\n\t\t\trenderer = bufferRenderer;\r\n\r\n\t\t}\r\n\r\n\t\tif ( updateBuffers ) {\r\n\r\n\t\t\tsetupVertexAttributes( material, program, geometry );\r\n\r\n\t\t\tif ( index !== null ) {\r\n\r\n\t\t\t\t_gl.bindBuffer( _gl.ELEMENT_ARRAY_BUFFER, objects.getAttributeBuffer( index ) );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tif ( group === undefined ) {\r\n\r\n\t\t\tvar count;\r\n\r\n\t\t\tif ( index !== null ) {\r\n\r\n\t\t\t\tcount = index.count;\r\n\r\n\t\t\t} else if ( position instanceof THREE.InterleavedBufferAttribute ) {\r\n\r\n\t\t\t\tcount = position.data.array.length / 3;\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tcount = position.count;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tvar drawRange = geometry.drawRange;\r\n\r\n\t\t\tgroup = {\r\n\t\t\t\tstart: drawRange.start,\r\n\t\t\t\tcount: Math.min( drawRange.count, count )\r\n\t\t\t};\r\n\r\n\t\t}\r\n\r\n\t\tif ( object instanceof THREE.Mesh ) {\r\n\r\n\t\t\tif ( material.wireframe === true ) {\r\n\r\n\t\t\t\tstate.setLineWidth( material.wireframeLinewidth * pixelRatio );\r\n\t\t\t\trenderer.setMode( _gl.LINES );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\trenderer.setMode( _gl.TRIANGLES );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( geometry instanceof THREE.InstancedBufferGeometry && geometry.maxInstancedCount > 0 ) {\r\n\r\n\t\t\t\trenderer.renderInstances( geometry );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\trenderer.render( group.start, group.count );\r\n\r\n\t\t\t}\r\n\r\n\t\t} else if ( object instanceof THREE.Line ) {\r\n\r\n\t\t\tvar lineWidth = material.linewidth;\r\n\r\n\t\t\tif ( lineWidth === undefined ) lineWidth = 1; // Not using Line*Material\r\n\r\n\t\t\tstate.setLineWidth( lineWidth * pixelRatio );\r\n\r\n\t\t\tif ( object instanceof THREE.LineSegments ) {\r\n\r\n\t\t\t\trenderer.setMode( _gl.LINES );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\trenderer.setMode( _gl.LINE_STRIP );\r\n\r\n\t\t\t}\r\n\r\n\t\t\trenderer.render( group.start, group.count );\r\n\r\n\t\t} else if ( object instanceof THREE.Points ) {\r\n\r\n\t\t\trenderer.setMode( _gl.POINTS );\r\n\t\t\trenderer.render( group.start, group.count );\r\n\r\n\t\t}\r\n\r\n\t};\r\n\r\n\tfunction setupVertexAttributes( material, program, geometry, startIndex ) {\r\n\r\n\t\tvar extension;\r\n\r\n\t\tif ( geometry instanceof THREE.InstancedBufferGeometry ) {\r\n\r\n\t\t\textension = extensions.get( 'ANGLE_instanced_arrays' );\r\n\r\n\t\t\tif ( extension === null ) {\r\n\r\n\t\t\t\tconsole.error( 'THREE.WebGLRenderer.setupVertexAttributes: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.' );\r\n\t\t\t\treturn;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tif ( startIndex === undefined ) startIndex = 0;\r\n\r\n\t\tstate.initAttributes();\r\n\r\n\t\tvar geometryAttributes = geometry.attributes;\r\n\r\n\t\tvar programAttributes = program.getAttributes();\r\n\r\n\t\tvar materialDefaultAttributeValues = material.defaultAttributeValues;\r\n\r\n\t\tfor ( var name in programAttributes ) {\r\n\r\n\t\t\tvar programAttribute = programAttributes[ name ];\r\n\r\n\t\t\tif ( programAttribute >= 0 ) {\r\n\r\n\t\t\t\tvar geometryAttribute = geometryAttributes[ name ];\r\n\r\n\t\t\t\tif ( geometryAttribute !== undefined ) {\r\n\r\n\t\t\t\t\tstate.enableAttribute( programAttribute );\r\n\r\n\t\t\t\t\tvar size = geometryAttribute.itemSize;\r\n\t\t\t\t\tvar buffer = objects.getAttributeBuffer( geometryAttribute );\r\n\r\n\t\t\t\t\tif ( geometryAttribute instanceof THREE.InterleavedBufferAttribute ) {\r\n\r\n\t\t\t\t\t\tvar data = geometryAttribute.data;\r\n\t\t\t\t\t\tvar stride = data.stride;\r\n\t\t\t\t\t\tvar offset = geometryAttribute.offset;\r\n\r\n\t\t\t\t\t\t_gl.bindBuffer( _gl.ARRAY_BUFFER, buffer );\r\n\t\t\t\t\t\t_gl.vertexAttribPointer( programAttribute, size, _gl.FLOAT, false, stride * data.array.BYTES_PER_ELEMENT, ( startIndex * stride + offset ) * data.array.BYTES_PER_ELEMENT );\r\n\r\n\t\t\t\t\t\tif ( data instanceof THREE.InstancedInterleavedBuffer ) {\r\n\r\n\t\t\t\t\t\t\tif ( extension === null ) {\r\n\r\n\t\t\t\t\t\t\t\tconsole.error( 'THREE.WebGLRenderer.setupVertexAttributes: using THREE.InstancedBufferAttribute but hardware does not support extension ANGLE_instanced_arrays.' );\r\n\t\t\t\t\t\t\t\treturn;\r\n\r\n\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\textension.vertexAttribDivisorANGLE( programAttribute, data.meshPerAttribute );\r\n\r\n\t\t\t\t\t\t\tif ( geometry.maxInstancedCount === undefined ) {\r\n\r\n\t\t\t\t\t\t\t\tgeometry.maxInstancedCount = data.meshPerAttribute * data.count;\r\n\r\n\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t} else {\r\n\r\n\t\t\t\t\t\t_gl.bindBuffer( _gl.ARRAY_BUFFER, buffer );\r\n\t\t\t\t\t\t_gl.vertexAttribPointer( programAttribute, size, _gl.FLOAT, false, 0, startIndex * size * 4 ); // 4 bytes per Float32\r\n\r\n\t\t\t\t\t\tif ( geometryAttribute instanceof THREE.InstancedBufferAttribute ) {\r\n\r\n\t\t\t\t\t\t\tif ( extension === null ) {\r\n\r\n\t\t\t\t\t\t\t\tconsole.error( 'THREE.WebGLRenderer.setupVertexAttributes: using THREE.InstancedBufferAttribute but hardware does not support extension ANGLE_instanced_arrays.' );\r\n\t\t\t\t\t\t\t\treturn;\r\n\r\n\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\textension.vertexAttribDivisorANGLE( programAttribute, geometryAttribute.meshPerAttribute );\r\n\r\n\t\t\t\t\t\t\tif ( geometry.maxInstancedCount === undefined ) {\r\n\r\n\t\t\t\t\t\t\t\tgeometry.maxInstancedCount = geometryAttribute.meshPerAttribute * geometryAttribute.count;\r\n\r\n\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t} else if ( materialDefaultAttributeValues !== undefined ) {\r\n\r\n\t\t\t\t\tvar value = materialDefaultAttributeValues[ name ];\r\n\r\n\t\t\t\t\tif ( value !== undefined ) {\r\n\r\n\t\t\t\t\t\tswitch ( value.length ) {\r\n\r\n\t\t\t\t\t\t\tcase 2:\r\n\t\t\t\t\t\t\t\t_gl.vertexAttrib2fv( programAttribute, value );\r\n\t\t\t\t\t\t\t\tbreak;\r\n\r\n\t\t\t\t\t\t\tcase 3:\r\n\t\t\t\t\t\t\t\t_gl.vertexAttrib3fv( programAttribute, value );\r\n\t\t\t\t\t\t\t\tbreak;\r\n\r\n\t\t\t\t\t\t\tcase 4:\r\n\t\t\t\t\t\t\t\t_gl.vertexAttrib4fv( programAttribute, value );\r\n\t\t\t\t\t\t\t\tbreak;\r\n\r\n\t\t\t\t\t\t\tdefault:\r\n\t\t\t\t\t\t\t\t_gl.vertexAttrib1fv( programAttribute, value );\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tstate.disableUnusedAttributes();\r\n\r\n\t}\r\n\r\n\t// Sorting\r\n\r\n\tfunction numericalSort ( a, b ) {\r\n\r\n\t\treturn b[ 0 ] - a[ 0 ];\r\n\r\n\t}\r\n\r\n\tfunction painterSortStable ( a, b ) {\r\n\r\n\t\tif ( a.object.renderOrder !== b.object.renderOrder ) {\r\n\r\n\t\t\treturn a.object.renderOrder - b.object.renderOrder;\r\n\r\n\t\t} else if ( a.material.id !== b.material.id ) {\r\n\r\n\t\t\treturn a.material.id - b.material.id;\r\n\r\n\t\t} else if ( a.z !== b.z ) {\r\n\r\n\t\t\treturn a.z - b.z;\r\n\r\n\t\t} else {\r\n\r\n\t\t\treturn a.id - b.id;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tfunction reversePainterSortStable ( a, b ) {\r\n\r\n\t\tif ( a.object.renderOrder !== b.object.renderOrder ) {\r\n\r\n\t\t\treturn a.object.renderOrder - b.object.renderOrder;\r\n\r\n\t\t} if ( a.z !== b.z ) {\r\n\r\n\t\t\treturn b.z - a.z;\r\n\r\n\t\t} else {\r\n\r\n\t\t\treturn a.id - b.id;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\t// Rendering\r\n\r\n\tthis.render = function ( scene, camera, renderTarget, forceClear ) {\r\n\r\n\t\t// if ( camera instanceof THREE.Camera === false ) {\r\n\r\n\t\t// \tconsole.error( 'THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.' );\r\n\t\t// \treturn;\r\n\r\n\t\t// }\r\n\r\n\t\tvar fog = scene.fog;\r\n\r\n\t\t// reset caching for this frame\r\n\r\n\t\t_currentGeometryProgram = '';\r\n\t\t_currentMaterialId = - 1;\r\n\t\t_currentCamera = null;\r\n\t\t_lightsNeedUpdate = true;\r\n\r\n\t\t// update scene graph\r\n\r\n\t\tif ( scene.autoUpdate === true ) scene.updateMatrixWorld();\r\n\r\n\t\t// update camera matrices and frustum\r\n\r\n\t\tif ( camera.parent === null ) camera.updateMatrixWorld();\r\n\r\n\t\tcamera.matrixWorldInverse.getInverse( camera.matrixWorld );\r\n\r\n\t\t_projScreenMatrix.multiplyMatrices( camera.projectionMatrix, camera.matrixWorldInverse );\r\n\t\t_frustum.setFromMatrix( _projScreenMatrix );\r\n\r\n\t\tlights.length = 0;\r\n\r\n\t\topaqueObjectsLastIndex = -1;\r\n\t\ttransparentObjectsLastIndex = -1;\r\n\r\n\t\topaqueImmediateObjectsLastIndex = -1;\r\n\t\ttransparentImmediateObjectsLastIndex = -1;\r\n\r\n\t\tsprites.length = 0;\r\n\t\tlensFlares.length = 0;\r\n\r\n\t\tprojectObject( scene );\r\n\r\n\t\topaqueObjects.length = opaqueObjectsLastIndex + 1;\r\n\t\ttransparentObjects.length = transparentObjectsLastIndex + 1;\r\n\r\n\t\topaqueImmediateObjects.length = opaqueImmediateObjectsLastIndex + 1;\r\n\t\ttransparentImmediateObjects.length = transparentImmediateObjectsLastIndex + 1;\r\n\r\n\t\tif ( _this.sortObjects === true ) {\r\n\r\n\t\t\topaqueObjects.sort( painterSortStable );\r\n\t\t\ttransparentObjects.sort( reversePainterSortStable );\r\n\r\n\t\t}\r\n\r\n\t\t//\r\n\r\n\t\tshadowMap.render( scene, camera );\r\n\r\n\t\t//\r\n\r\n\t\t_infoRender.calls = 0;\r\n\t\t_infoRender.vertices = 0;\r\n\t\t_infoRender.faces = 0;\r\n\t\t_infoRender.points = 0;\r\n\r\n\t\tthis.setRenderTarget( renderTarget );\r\n\r\n\t\tif ( this.autoClear || forceClear ) {\r\n\r\n\t\t\tthis.clear( this.autoClearColor, this.autoClearDepth, this.autoClearStencil );\r\n\r\n\t\t}\r\n\r\n\t\t//\r\n\r\n\t\tif ( scene.overrideMaterial ) {\r\n\r\n\t\t\tvar overrideMaterial = scene.overrideMaterial;\r\n\r\n\t\t\trenderObjects( opaqueObjects, camera, lights, fog, overrideMaterial );\r\n\t\t\trenderObjects( transparentObjects, camera, lights, fog, overrideMaterial );\r\n\r\n\t\t\trenderObjectsImmediate( opaqueImmediateObjects, camera, lights, fog, overrideMaterial );\r\n\t\t\trenderObjectsImmediate( transparentImmediateObjects, camera, lights, fog, overrideMaterial );\r\n\r\n\t\t} else {\r\n\r\n\t\t\t// opaque pass (front-to-back order)\r\n\r\n\t\t\tstate.setBlending( THREE.NoBlending );\r\n\r\n\t\t\trenderObjects( opaqueObjects, camera, lights, fog );\r\n\t\t\trenderObjectsImmediate( opaqueImmediateObjects, camera, lights, fog );\r\n\r\n\t\t\t// transparent pass (back-to-front order)\r\n\r\n\t\t\trenderObjects( transparentObjects, camera, lights, fog );\r\n\t\t\trenderObjectsImmediate( transparentImmediateObjects, camera, lights, fog );\r\n\r\n\t\t}\r\n\r\n\t\t// custom render plugins (post pass)\r\n\r\n\t\tspritePlugin.render( scene, camera );\r\n\t\tlensFlarePlugin.render( scene, camera, _currentWidth, _currentHeight );\r\n\r\n\t\t// Generate mipmap if we're using any kind of mipmap filtering\r\n\r\n\t\tif ( renderTarget && renderTarget.generateMipmaps && renderTarget.minFilter !== THREE.NearestFilter && renderTarget.minFilter !== THREE.LinearFilter ) {\r\n\r\n\t\t\tupdateRenderTargetMipmap( renderTarget );\r\n\r\n\t\t}\r\n\r\n\t\t// Ensure depth buffer writing is enabled so it can be cleared on next render\r\n\r\n\t\tstate.setDepthTest( true );\r\n\t\tstate.setDepthWrite( true );\r\n\t\tstate.setColorWrite( true );\r\n\r\n\t\t// _gl.finish();\r\n\r\n\t};\r\n\r\n\tfunction pushImmediateRenderItem( object ) {\r\n\r\n\t\tvar array, index;\r\n\r\n\t\t// allocate the next position in the appropriate array\r\n\r\n\t\tif ( object.material.transparent ) {\r\n\r\n\t\t\tarray = transparentImmediateObjects;\r\n\t\t\tindex = ++ transparentImmediateObjectsLastIndex;\r\n\r\n\t\t} else {\r\n\r\n\t\t\tarray = opaqueImmediateObjects;\r\n\t\t\tindex = ++ opaqueImmediateObjectsLastIndex;\r\n\r\n\t\t}\r\n\r\n\t\t// recycle existing position or grow the array\r\n\r\n\t\tif ( index < array.length ) {\r\n\r\n\t\t\tarray[ index ] = object;\r\n\r\n\t\t} else {\r\n\r\n\t\t\t// assert( index === array.length );\r\n\t\t\tarray.push( object );\r\n\r\n\t\t}\r\n\r\n\r\n\t}\r\n\r\n\tfunction pushRenderItem( object, geometry, material, z, group ) {\r\n\r\n\t\tvar array, index;\r\n\r\n\t\t// allocate the next position in the appropriate array\r\n\r\n\t\tif ( material.transparent ) {\r\n\r\n\t\t\tarray = transparentObjects;\r\n\t\t\tindex = ++ transparentObjectsLastIndex;\r\n\r\n\t\t} else {\r\n\r\n\t\t\tarray = opaqueObjects;\r\n\t\t\tindex = ++ opaqueObjectsLastIndex;\r\n\r\n\t\t}\r\n\r\n\t\t// recycle existing render item or grow the array\r\n\r\n\t\tvar renderItem = array[ index ];\r\n\r\n\t\tif ( renderItem !== undefined ) {\r\n\r\n\t\t\trenderItem.id = object.id;\r\n\t\t\trenderItem.object = object;\r\n\t\t\trenderItem.geometry = geometry;\r\n\t\t\trenderItem.material = material;\r\n\t\t\trenderItem.z = _vector3.z;\r\n\t\t\trenderItem.group = group;\r\n\r\n\t\t} else {\r\n\r\n\t\t\trenderItem = {\r\n\t\t\t\tid: object.id,\r\n\t\t\t\tobject: object,\r\n\t\t\t\tgeometry: geometry,\r\n\t\t\t\tmaterial: material,\r\n\t\t\t\tz: _vector3.z,\r\n\t\t\t\tgroup: group\r\n\t\t\t};\r\n\r\n\t\t\t// assert( index === array.length );\r\n\t\t\tarray.push( renderItem );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tfunction projectObject( object ) {\r\n\r\n\t\tif ( object.visible === false ) return;\r\n\r\n\t\tif ( object instanceof THREE.Light ) {\r\n\r\n\t\t\tlights.push( object );\r\n\r\n\t\t} else if ( object instanceof THREE.Sprite ) {\r\n\r\n\t\t\tsprites.push( object );\r\n\r\n\t\t} else if ( object instanceof THREE.LensFlare ) {\r\n\r\n\t\t\tlensFlares.push( object );\r\n\r\n\t\t} else if ( object instanceof THREE.ImmediateRenderObject ) {\r\n\r\n\t\t\tpushImmediateRenderItem( object );\r\n\r\n\t\t} else if ( object instanceof THREE.Mesh || object instanceof THREE.Line || object instanceof THREE.Points ) {\r\n\r\n\t\t\tif ( object instanceof THREE.SkinnedMesh ) {\r\n\r\n\t\t\t\tobject.skeleton.update();\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( object.frustumCulled === false || _frustum.intersectsObject( object ) === true ) {\r\n\r\n\t\t\t\tvar material = object.material;\r\n\r\n\t\t\t\tif ( material.visible === true ) {\r\n\r\n\t\t\t\t\tif ( _this.sortObjects === true ) {\r\n\r\n\t\t\t\t\t\t_vector3.setFromMatrixPosition( object.matrixWorld );\r\n\t\t\t\t\t\t_vector3.applyProjection( _projScreenMatrix );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tvar geometry = objects.update( object );\r\n\r\n\t\t\t\t\tif ( material instanceof THREE.MeshFaceMaterial ) {\r\n\r\n\t\t\t\t\t\tvar groups = geometry.groups;\r\n\t\t\t\t\t\tvar materials = material.materials;\r\n\r\n\t\t\t\t\t\tfor ( var i = 0, l = groups.length; i < l; i ++ ) {\r\n\r\n\t\t\t\t\t\t\tvar group = groups[ i ];\r\n\t\t\t\t\t\t\tvar groupMaterial = materials[ group.materialIndex ];\r\n\r\n\t\t\t\t\t\t\tif ( groupMaterial.visible === true ) {\r\n\r\n\t\t\t\t\t\t\t\tpushRenderItem( object, geometry, groupMaterial, _vector3.z, group );\r\n\r\n\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t} else {\r\n\r\n\t\t\t\t\t\tpushRenderItem( object, geometry, material, _vector3.z );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tvar children = object.children;\r\n\r\n\t\tfor ( var i = 0, l = children.length; i < l; i ++ ) {\r\n\r\n\t\t\tprojectObject( children[ i ] );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tfunction renderObjects( renderList, camera, lights, fog, overrideMaterial ) {\r\n\r\n\t\tfor ( var i = 0, l = renderList.length; i < l; i ++ ) {\r\n\r\n\t\t\tvar renderItem = renderList[ i ];\r\n\r\n\t\t\tvar object = renderItem.object;\r\n\t\t\tvar geometry = renderItem.geometry;\r\n\t\t\tvar material = overrideMaterial === undefined ? renderItem.material : overrideMaterial;\r\n\t\t\tvar group = renderItem.group;\r\n\r\n\t\t\tobject.modelViewMatrix.multiplyMatrices( camera.matrixWorldInverse, object.matrixWorld );\r\n\t\t\tobject.normalMatrix.getNormalMatrix( object.modelViewMatrix );\r\n\r\n\t\t\t_this.renderBufferDirect( camera, lights, fog, geometry, material, object, group );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tfunction renderObjectsImmediate( renderList, camera, lights, fog, overrideMaterial ) {\r\n\r\n\t\tvar material = overrideMaterial;\r\n\r\n\t\tfor ( var i = 0, l = renderList.length; i < l; i ++ ) {\r\n\r\n\t\t\tvar object = renderList[ i ];\r\n\r\n\t\t\tobject.modelViewMatrix.multiplyMatrices( camera.matrixWorldInverse, object.matrixWorld );\r\n\t\t\tobject.normalMatrix.getNormalMatrix( object.modelViewMatrix );\r\n\r\n\t\t\tif ( overrideMaterial === undefined ) material = object.material;\r\n\r\n\t\t\tsetMaterial( material );\r\n\r\n\t\t\tvar program = setProgram( camera, lights, fog, material, object );\r\n\r\n\t\t\t_currentGeometryProgram = '';\r\n\r\n\t\t\tobject.render( function ( object ) {\r\n\r\n\t\t\t\t_this.renderBufferImmediate( object, program, material );\r\n\r\n\t\t\t} );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tfunction initMaterial( material, lights, fog, object ) {\r\n\r\n\t\tvar materialProperties = properties.get( material );\r\n\r\n\t\tvar parameters = programCache.getParameters( material, lights, fog, object );\r\n\t\tvar code = programCache.getProgramCode( material, parameters );\r\n\r\n\r\n\t\tvar programChange = true;\r\n\r\n\t\tif ( ! materialProperties.program ) {\r\n\r\n\t\t\t// new material\r\n\t\t\tmaterial.addEventListener( 'dispose', onMaterialDispose );\r\n\r\n\t\t} else if ( materialProperties.program.code !== code ) {\r\n\r\n\t\t\t// changed glsl or parameters\r\n\t\t\treleaseMaterialProgramReference( material );\r\n\r\n\t\t} else if ( parameters.shaderID !== undefined ) {\r\n\r\n\t\t\t// same glsl and uniform list\r\n\t\t\treturn;\r\n\r\n\t\t} else {\r\n\r\n\t\t\t// only rebuild uniform list\r\n\t\t\tprogramChange = false;\r\n\r\n\t\t}\r\n\r\n\t\tif ( parameters.shaderID ) {\r\n\r\n\t\t\tvar shader = THREE.ShaderLib[ parameters.shaderID ];\r\n\r\n\t\t\tmaterialProperties.__webglShader = {\r\n\t\t\t\tname: material.type,\r\n\t\t\t\tuniforms: THREE.UniformsUtils.clone( shader.uniforms ),\r\n\t\t\t\tvertexShader: shader.vertexShader,\r\n\t\t\t\tfragmentShader: shader.fragmentShader\r\n\t\t\t};\r\n\r\n\t\t} else {\r\n\r\n\t\t\tmaterialProperties.__webglShader = {\r\n\t\t\t\tname: material.type,\r\n\t\t\t\tuniforms: material.uniforms,\r\n\t\t\t\tvertexShader: material.vertexShader,\r\n\t\t\t\tfragmentShader: material.fragmentShader\r\n\t\t\t};\r\n\r\n\t\t}\r\n\r\n\t\tmaterial.__webglShader = materialProperties.__webglShader;\r\n\r\n\t\tvar program = programCache.getProgram( material, parameters, code );\r\n\r\n\t\tif ( programChange ) {\r\n\r\n\t\t\tprogram.usedTimes ++;\r\n\r\n\t\t}\r\n\r\n\t\tmaterialProperties.program = program;\r\n\t\tmaterial.program = program;\r\n\r\n\t\tvar attributes = program.getAttributes();\r\n\r\n\t\tif ( material.morphTargets ) {\r\n\r\n\t\t\tmaterial.numSupportedMorphTargets = 0;\r\n\r\n\t\t\tfor ( var i = 0; i < _this.maxMorphTargets; i ++ ) {\r\n\r\n\t\t\t\tif ( attributes[ 'morphTarget' + i ] >= 0 ) {\r\n\r\n\t\t\t\t\tmaterial.numSupportedMorphTargets ++;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tif ( material.morphNormals ) {\r\n\r\n\t\t\tmaterial.numSupportedMorphNormals = 0;\r\n\r\n\t\t\tfor ( i = 0; i < _this.maxMorphNormals; i ++ ) {\r\n\r\n\t\t\t\tif ( attributes[ 'morphNormal' + i ] >= 0 ) {\r\n\r\n\t\t\t\t\tmaterial.numSupportedMorphNormals ++;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tmaterialProperties.uniformsList = [];\r\n\r\n\t\tvar uniformLocations = materialProperties.program.getUniforms();\r\n\r\n\t\tfor ( var u in materialProperties.__webglShader.uniforms ) {\r\n\r\n\t\t\tvar location = uniformLocations[ u ];\r\n\r\n\t\t\tif ( location ) {\r\n\r\n\t\t\t\tmaterialProperties.uniformsList.push( [ materialProperties.__webglShader.uniforms[ u ], location ] );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tfunction setMaterial( material ) {\r\n\r\n\t\tsetMaterialFaces( material );\r\n\r\n\t\tif ( material.transparent === true ) {\r\n\r\n\t\t\tstate.setBlending( material.blending, material.blendEquation, material.blendSrc, material.blendDst, material.blendEquationAlpha, material.blendSrcAlpha, material.blendDstAlpha );\r\n\r\n\t\t} else {\r\n\r\n\t\t\tstate.setBlending( THREE.NoBlending );\r\n\r\n\t\t}\r\n\r\n\t\tstate.setDepthFunc( material.depthFunc );\r\n\t\tstate.setDepthTest( material.depthTest );\r\n\t\tstate.setDepthWrite( material.depthWrite );\r\n\t\tstate.setColorWrite( material.colorWrite );\r\n\t\tstate.setPolygonOffset( material.polygonOffset, material.polygonOffsetFactor, material.polygonOffsetUnits );\r\n\r\n\t}\r\n\r\n\tfunction setMaterialFaces( material ) {\r\n\r\n\t\tmaterial.side !== THREE.DoubleSide ? state.enable( _gl.CULL_FACE ) : state.disable( _gl.CULL_FACE );\r\n\t\tstate.setFlipSided( material.side === THREE.BackSide );\r\n\r\n\t}\r\n\r\n\tfunction setProgram( camera, lights, fog, material, object ) {\r\n\r\n\t\t_usedTextureUnits = 0;\r\n\r\n\t\tvar materialProperties = properties.get( material );\r\n\r\n\t\tif ( material.needsUpdate || ! materialProperties.program ) {\r\n\r\n\t\t\tinitMaterial( material, lights, fog, object );\r\n\t\t\tmaterial.needsUpdate = false;\r\n\r\n\t\t}\r\n\r\n\t\tvar refreshProgram = false;\r\n\t\tvar refreshMaterial = false;\r\n\t\tvar refreshLights = false;\r\n\r\n\t\tvar program = materialProperties.program,\r\n\t\t\tp_uniforms = program.getUniforms(),\r\n\t\t\tm_uniforms = materialProperties.__webglShader.uniforms;\r\n\r\n\t\tif ( program.id !== _currentProgram ) {\r\n\r\n\t\t\t_gl.useProgram( program.program );\r\n\t\t\t_currentProgram = program.id;\r\n\r\n\t\t\trefreshProgram = true;\r\n\t\t\trefreshMaterial = true;\r\n\t\t\trefreshLights = true;\r\n\r\n\t\t}\r\n\r\n\t\tif ( material.id !== _currentMaterialId ) {\r\n\r\n\t\t\tif ( _currentMaterialId === - 1 ) refreshLights = true;\r\n\t\t\t_currentMaterialId = material.id;\r\n\r\n\t\t\trefreshMaterial = true;\r\n\r\n\t\t}\r\n\r\n\t\tif ( refreshProgram || camera !== _currentCamera ) {\r\n\r\n\t\t\t_gl.uniformMatrix4fv( p_uniforms.projectionMatrix, false, camera.projectionMatrix.elements );\r\n\r\n\t\t\tif ( capabilities.logarithmicDepthBuffer ) {\r\n\r\n\t\t\t\t_gl.uniform1f( p_uniforms.logDepthBufFC, 2.0 / ( Math.log( camera.far + 1.0 ) / Math.LN2 ) );\r\n\r\n\t\t\t}\r\n\r\n\r\n\t\t\tif ( camera !== _currentCamera ) _currentCamera = camera;\r\n\r\n\t\t\t// load material specific uniforms\r\n\t\t\t// (shader material also gets them for the sake of genericity)\r\n\r\n\t\t\tif ( material instanceof THREE.ShaderMaterial ||\r\n\t\t\t\t material instanceof THREE.MeshPhongMaterial ||\r\n\t\t\t\t material.envMap ) {\r\n\r\n\t\t\t\tif ( p_uniforms.cameraPosition !== undefined ) {\r\n\r\n\t\t\t\t\t_vector3.setFromMatrixPosition( camera.matrixWorld );\r\n\t\t\t\t\t_gl.uniform3f( p_uniforms.cameraPosition, _vector3.x, _vector3.y, _vector3.z );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( material instanceof THREE.MeshPhongMaterial ||\r\n\t\t\t\t material instanceof THREE.MeshLambertMaterial ||\r\n\t\t\t\t material instanceof THREE.MeshBasicMaterial ||\r\n\t\t\t\t material instanceof THREE.ShaderMaterial ||\r\n\t\t\t\t material.skinning ) {\r\n\r\n\t\t\t\tif ( p_uniforms.viewMatrix !== undefined ) {\r\n\r\n\t\t\t\t\t_gl.uniformMatrix4fv( p_uniforms.viewMatrix, false, camera.matrixWorldInverse.elements );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\t// skinning uniforms must be set even if material didn't change\r\n\t\t// auto-setting of texture unit for bone texture must go before other textures\r\n\t\t// not sure why, but otherwise weird things happen\r\n\r\n\t\tif ( material.skinning ) {\r\n\r\n\t\t\tif ( object.bindMatrix && p_uniforms.bindMatrix !== undefined ) {\r\n\r\n\t\t\t\t_gl.uniformMatrix4fv( p_uniforms.bindMatrix, false, object.bindMatrix.elements );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( object.bindMatrixInverse && p_uniforms.bindMatrixInverse !== undefined ) {\r\n\r\n\t\t\t\t_gl.uniformMatrix4fv( p_uniforms.bindMatrixInverse, false, object.bindMatrixInverse.elements );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( capabilities.floatVertexTextures && object.skeleton && object.skeleton.useVertexTexture ) {\r\n\r\n\t\t\t\tif ( p_uniforms.boneTexture !== undefined ) {\r\n\r\n\t\t\t\t\tvar textureUnit = getTextureUnit();\r\n\r\n\t\t\t\t\t_gl.uniform1i( p_uniforms.boneTexture, textureUnit );\r\n\t\t\t\t\t_this.setTexture( object.skeleton.boneTexture, textureUnit );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif ( p_uniforms.boneTextureWidth !== undefined ) {\r\n\r\n\t\t\t\t\t_gl.uniform1i( p_uniforms.boneTextureWidth, object.skeleton.boneTextureWidth );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif ( p_uniforms.boneTextureHeight !== undefined ) {\r\n\r\n\t\t\t\t\t_gl.uniform1i( p_uniforms.boneTextureHeight, object.skeleton.boneTextureHeight );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t} else if ( object.skeleton && object.skeleton.boneMatrices ) {\r\n\r\n\t\t\t\tif ( p_uniforms.boneGlobalMatrices !== undefined ) {\r\n\r\n\t\t\t\t\t_gl.uniformMatrix4fv( p_uniforms.boneGlobalMatrices, false, object.skeleton.boneMatrices );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tif ( refreshMaterial ) {\r\n\r\n\t\t\t// refresh uniforms common to several materials\r\n\r\n\t\t\tif ( fog && material.fog ) {\r\n\r\n\t\t\t\trefreshUniformsFog( m_uniforms, fog );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( material instanceof THREE.MeshPhongMaterial ||\r\n\t\t\t\t material instanceof THREE.MeshLambertMaterial ||\r\n\t\t\t\t material.lights ) {\r\n\r\n\t\t\t\tif ( _lightsNeedUpdate ) {\r\n\r\n\t\t\t\t\trefreshLights = true;\r\n\t\t\t\t\tsetupLights( lights, camera );\r\n\t\t\t\t\t_lightsNeedUpdate = false;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif ( refreshLights ) {\r\n\r\n\t\t\t\t\trefreshUniformsLights( m_uniforms, _lights );\r\n\t\t\t\t\tmarkUniformsLightsNeedsUpdate( m_uniforms, true );\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\tmarkUniformsLightsNeedsUpdate( m_uniforms, false );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( material instanceof THREE.MeshBasicMaterial ||\r\n\t\t\t\t material instanceof THREE.MeshLambertMaterial ||\r\n\t\t\t\t material instanceof THREE.MeshPhongMaterial ) {\r\n\r\n\t\t\t\trefreshUniformsCommon( m_uniforms, material );\r\n\r\n\t\t\t}\r\n\r\n\t\t\t// refresh single material specific uniforms\r\n\r\n\t\t\tif ( material instanceof THREE.LineBasicMaterial ) {\r\n\r\n\t\t\t\trefreshUniformsLine( m_uniforms, material );\r\n\r\n\t\t\t} else if ( material instanceof THREE.LineDashedMaterial ) {\r\n\r\n\t\t\t\trefreshUniformsLine( m_uniforms, material );\r\n\t\t\t\trefreshUniformsDash( m_uniforms, material );\r\n\r\n\t\t\t} else if ( material instanceof THREE.PointsMaterial ) {\r\n\r\n\t\t\t\trefreshUniformsParticle( m_uniforms, material );\r\n\r\n\t\t\t} else if ( material instanceof THREE.MeshPhongMaterial ) {\r\n\r\n\t\t\t\trefreshUniformsPhong( m_uniforms, material );\r\n\r\n\t\t\t} else if ( material instanceof THREE.MeshDepthMaterial ) {\r\n\r\n\t\t\t\tm_uniforms.mNear.value = camera.near;\r\n\t\t\t\tm_uniforms.mFar.value = camera.far;\r\n\t\t\t\tm_uniforms.opacity.value = material.opacity;\r\n\r\n\t\t\t} else if ( material instanceof THREE.MeshNormalMaterial ) {\r\n\r\n\t\t\t\tm_uniforms.opacity.value = material.opacity;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( object.receiveShadow && ! material._shadowPass ) {\r\n\r\n\t\t\t\trefreshUniformsShadow( m_uniforms, lights );\r\n\r\n\t\t\t}\r\n\r\n\t\t\t// load common uniforms\r\n\r\n\t\t\tloadUniformsGeneric( materialProperties.uniformsList );\r\n\r\n\t\t}\r\n\r\n\t\tloadUniformsMatrices( p_uniforms, object );\r\n\r\n\t\tif ( p_uniforms.modelMatrix !== undefined ) {\r\n\r\n\t\t\t_gl.uniformMatrix4fv( p_uniforms.modelMatrix, false, object.matrixWorld.elements );\r\n\r\n\t\t}\r\n\r\n\t\treturn program;\r\n\r\n\t}\r\n\r\n\t// Uniforms (refresh uniforms objects)\r\n\r\n\tfunction refreshUniformsCommon ( uniforms, material ) {\r\n\r\n\t\tuniforms.opacity.value = material.opacity;\r\n\r\n\t\tuniforms.diffuse.value = material.color;\r\n\r\n\t\tif ( material.emissive ) {\r\n\r\n\t\t\tuniforms.emissive.value = material.emissive;\r\n\r\n\t\t}\r\n\r\n\t\tuniforms.map.value = material.map;\r\n\t\tuniforms.specularMap.value = material.specularMap;\r\n\t\tuniforms.alphaMap.value = material.alphaMap;\r\n\r\n\t\tif ( material.aoMap ) {\r\n\r\n\t\t\tuniforms.aoMap.value = material.aoMap;\r\n\t\t\tuniforms.aoMapIntensity.value = material.aoMapIntensity;\r\n\r\n\t\t}\r\n\r\n\t\t// uv repeat and offset setting priorities\r\n\t\t// 1. color map\r\n\t\t// 2. specular map\r\n\t\t// 3. normal map\r\n\t\t// 4. bump map\r\n\t\t// 5. alpha map\r\n\t\t// 6. emissive map\r\n\r\n\t\tvar uvScaleMap;\r\n\r\n\t\tif ( material.map ) {\r\n\r\n\t\t\tuvScaleMap = material.map;\r\n\r\n\t\t} else if ( material.specularMap ) {\r\n\r\n\t\t\tuvScaleMap = material.specularMap;\r\n\r\n\t\t} else if ( material.displacementMap ) {\r\n\r\n\t\t\tuvScaleMap = material.displacementMap;\r\n\r\n\t\t} else if ( material.normalMap ) {\r\n\r\n\t\t\tuvScaleMap = material.normalMap;\r\n\r\n\t\t} else if ( material.bumpMap ) {\r\n\r\n\t\t\tuvScaleMap = material.bumpMap;\r\n\r\n\t\t} else if ( material.alphaMap ) {\r\n\r\n\t\t\tuvScaleMap = material.alphaMap;\r\n\r\n\t\t} else if ( material.emissiveMap ) {\r\n\r\n\t\t\tuvScaleMap = material.emissiveMap;\r\n\r\n\t\t}\r\n\r\n\t\tif ( uvScaleMap !== undefined ) {\r\n\r\n\t\t\tvar offset = uvScaleMap.offset;\r\n\t\t\tvar repeat = uvScaleMap.repeat;\r\n\r\n\t\t\tuniforms.offsetRepeat.value.set( offset.x, offset.y, repeat.x, repeat.y );\r\n\r\n\t\t}\r\n\r\n\t\tuniforms.envMap.value = material.envMap;\r\n\t\tuniforms.flipEnvMap.value = ( material.envMap instanceof THREE.WebGLRenderTargetCube ) ? 1 : - 1;\r\n\r\n\t\tuniforms.reflectivity.value = material.reflectivity;\r\n\t\tuniforms.refractionRatio.value = material.refractionRatio;\r\n\r\n\t}\r\n\r\n\tfunction refreshUniformsLine ( uniforms, material ) {\r\n\r\n\t\tuniforms.diffuse.value = material.color;\r\n\t\tuniforms.opacity.value = material.opacity;\r\n\r\n\t}\r\n\r\n\tfunction refreshUniformsDash ( uniforms, material ) {\r\n\r\n\t\tuniforms.dashSize.value = material.dashSize;\r\n\t\tuniforms.totalSize.value = material.dashSize + material.gapSize;\r\n\t\tuniforms.scale.value = material.scale;\r\n\r\n\t}\r\n\r\n\tfunction refreshUniformsParticle ( uniforms, material ) {\r\n\r\n\t\tuniforms.psColor.value = material.color;\r\n\t\tuniforms.opacity.value = material.opacity;\r\n\t\tuniforms.size.value = material.size;\r\n\t\tuniforms.scale.value = _canvas.height / 2.0; // TODO: Cache this.\r\n\r\n\t\tuniforms.map.value = material.map;\r\n\r\n\t\tif ( material.map !== null ) {\r\n\r\n\t\t\tvar offset = material.map.offset;\r\n\t\t\tvar repeat = material.map.repeat;\r\n\r\n\t\t\tuniforms.offsetRepeat.value.set( offset.x, offset.y, repeat.x, repeat.y );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tfunction refreshUniformsFog ( uniforms, fog ) {\r\n\r\n\t\tuniforms.fogColor.value = fog.color;\r\n\r\n\t\tif ( fog instanceof THREE.Fog ) {\r\n\r\n\t\t\tuniforms.fogNear.value = fog.near;\r\n\t\t\tuniforms.fogFar.value = fog.far;\r\n\r\n\t\t} else if ( fog instanceof THREE.FogExp2 ) {\r\n\r\n\t\t\tuniforms.fogDensity.value = fog.density;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tfunction refreshUniformsPhong ( uniforms, material ) {\r\n\r\n\t\tuniforms.specular.value = material.specular;\r\n\t\tuniforms.shininess.value = material.shininess;\r\n\r\n\t\tif ( material.lightMap ) {\r\n\r\n\t\t\tuniforms.lightMap.value = material.lightMap;\r\n\t\t\tuniforms.lightMapIntensity.value = material.lightMapIntensity;\r\n\r\n\t\t}\r\n\r\n\t\tif ( material.emissiveMap ) {\r\n\r\n\t\t\tuniforms.emissiveMap.value = material.emissiveMap;\r\n\r\n\t\t}\r\n\r\n\t\tif ( material.bumpMap ) {\r\n\r\n\t\t\tuniforms.bumpMap.value = material.bumpMap;\r\n\t\t\tuniforms.bumpScale.value = material.bumpScale;\r\n\r\n\t\t}\r\n\r\n\t\tif ( material.normalMap ) {\r\n\r\n\t\t\tuniforms.normalMap.value = material.normalMap;\r\n\t\t\tuniforms.normalScale.value.copy( material.normalScale );\r\n\r\n\t\t}\r\n\r\n\t\tif ( material.displacementMap ) {\r\n\r\n\t\t\tuniforms.displacementMap.value = material.displacementMap;\r\n\t\t\tuniforms.displacementScale.value = material.displacementScale;\r\n\t\t\tuniforms.displacementBias.value = material.displacementBias;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tfunction refreshUniformsLights ( uniforms, lights ) {\r\n\r\n\t\tuniforms.ambientLightColor.value = lights.ambient;\r\n\r\n\t\tuniforms.directionalLightColor.value = lights.directional.colors;\r\n\t\tuniforms.directionalLightDirection.value = lights.directional.positions;\r\n\r\n\t\tuniforms.pointLightColor.value = lights.point.colors;\r\n\t\tuniforms.pointLightPosition.value = lights.point.positions;\r\n\t\tuniforms.pointLightDistance.value = lights.point.distances;\r\n\t\tuniforms.pointLightDecay.value = lights.point.decays;\r\n\r\n\t\tuniforms.spotLightColor.value = lights.spot.colors;\r\n\t\tuniforms.spotLightPosition.value = lights.spot.positions;\r\n\t\tuniforms.spotLightDistance.value = lights.spot.distances;\r\n\t\tuniforms.spotLightDirection.value = lights.spot.directions;\r\n\t\tuniforms.spotLightAngleCos.value = lights.spot.anglesCos;\r\n\t\tuniforms.spotLightExponent.value = lights.spot.exponents;\r\n\t\tuniforms.spotLightDecay.value = lights.spot.decays;\r\n\r\n\t\tuniforms.hemisphereLightSkyColor.value = lights.hemi.skyColors;\r\n\t\tuniforms.hemisphereLightGroundColor.value = lights.hemi.groundColors;\r\n\t\tuniforms.hemisphereLightDirection.value = lights.hemi.positions;\r\n\r\n\t}\r\n\r\n\t// If uniforms are marked as clean, they don't need to be loaded to the GPU.\r\n\r\n\tfunction markUniformsLightsNeedsUpdate ( uniforms, value ) {\r\n\r\n\t\tuniforms.ambientLightColor.needsUpdate = value;\r\n\r\n\t\tuniforms.directionalLightColor.needsUpdate = value;\r\n\t\tuniforms.directionalLightDirection.needsUpdate = value;\r\n\r\n\t\tuniforms.pointLightColor.needsUpdate = value;\r\n\t\tuniforms.pointLightPosition.needsUpdate = value;\r\n\t\tuniforms.pointLightDistance.needsUpdate = value;\r\n\t\tuniforms.pointLightDecay.needsUpdate = value;\r\n\r\n\t\tuniforms.spotLightColor.needsUpdate = value;\r\n\t\tuniforms.spotLightPosition.needsUpdate = value;\r\n\t\tuniforms.spotLightDistance.needsUpdate = value;\r\n\t\tuniforms.spotLightDirection.needsUpdate = value;\r\n\t\tuniforms.spotLightAngleCos.needsUpdate = value;\r\n\t\tuniforms.spotLightExponent.needsUpdate = value;\r\n\t\tuniforms.spotLightDecay.needsUpdate = value;\r\n\r\n\t\tuniforms.hemisphereLightSkyColor.needsUpdate = value;\r\n\t\tuniforms.hemisphereLightGroundColor.needsUpdate = value;\r\n\t\tuniforms.hemisphereLightDirection.needsUpdate = value;\r\n\r\n\t}\r\n\r\n\tfunction refreshUniformsShadow ( uniforms, lights ) {\r\n\r\n\t\tif ( uniforms.shadowMatrix ) {\r\n\r\n\t\t\tvar j = 0;\r\n\r\n\t\t\tfor ( var i = 0, il = lights.length; i < il; i ++ ) {\r\n\r\n\t\t\t\tvar light = lights[ i ];\r\n\r\n\t\t\t\tif ( ! light.castShadow ) continue;\r\n\r\n\t\t\t\tif ( light instanceof THREE.SpotLight || ( light instanceof THREE.DirectionalLight ) ) {\r\n\r\n\t\t\t\t\tuniforms.shadowMap.value[ j ] = light.shadowMap;\r\n\t\t\t\t\tuniforms.shadowMapSize.value[ j ] = light.shadowMapSize;\r\n\r\n\t\t\t\t\tuniforms.shadowMatrix.value[ j ] = light.shadowMatrix;\r\n\r\n\t\t\t\t\tuniforms.shadowDarkness.value[ j ] = light.shadowDarkness;\r\n\t\t\t\t\tuniforms.shadowBias.value[ j ] = light.shadowBias;\r\n\r\n\t\t\t\t\tj ++;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\t// Uniforms (load to GPU)\r\n\r\n\tfunction loadUniformsMatrices ( uniforms, object ) {\r\n\r\n\t\t_gl.uniformMatrix4fv( uniforms.modelViewMatrix, false, object.modelViewMatrix.elements );\r\n\r\n\t\tif ( uniforms.normalMatrix ) {\r\n\r\n\t\t\t_gl.uniformMatrix3fv( uniforms.normalMatrix, false, object.normalMatrix.elements );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tfunction getTextureUnit() {\r\n\r\n\t\tvar textureUnit = _usedTextureUnits;\r\n\r\n\t\tif ( textureUnit >= capabilities.maxTextures ) {\r\n\r\n\t\t\tconsole.warn( 'WebGLRenderer: trying to use ' + textureUnit + ' texture units while this GPU supports only ' + capabilities.maxTextures );\r\n\r\n\t\t}\r\n\r\n\t\t_usedTextureUnits += 1;\r\n\r\n\t\treturn textureUnit;\r\n\r\n\t}\r\n\r\n\tfunction loadUniformsGeneric ( uniforms ) {\r\n\r\n\t\tvar texture, textureUnit;\r\n\r\n\t\tfor ( var j = 0, jl = uniforms.length; j < jl; j ++ ) {\r\n\r\n\t\t\tvar uniform = uniforms[ j ][ 0 ];\r\n\r\n\t\t\t// needsUpdate property is not added to all uniforms.\r\n\t\t\tif ( uniform.needsUpdate === false ) continue;\r\n\r\n\t\t\tvar type = uniform.type;\r\n\t\t\tvar value = uniform.value;\r\n\t\t\tvar location = uniforms[ j ][ 1 ];\r\n\r\n\t\t\tswitch ( type ) {\r\n\r\n\t\t\t\tcase '1i':\r\n\t\t\t\t\t_gl.uniform1i( location, value );\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase '1f':\r\n\t\t\t\t\t_gl.uniform1f( location, value );\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase '2f':\r\n\t\t\t\t\t_gl.uniform2f( location, value[ 0 ], value[ 1 ] );\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase '3f':\r\n\t\t\t\t\t_gl.uniform3f( location, value[ 0 ], value[ 1 ], value[ 2 ] );\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase '4f':\r\n\t\t\t\t\t_gl.uniform4f( location, value[ 0 ], value[ 1 ], value[ 2 ], value[ 3 ] );\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase '1iv':\r\n\t\t\t\t\t_gl.uniform1iv( location, value );\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase '3iv':\r\n\t\t\t\t\t_gl.uniform3iv( location, value );\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase '1fv':\r\n\t\t\t\t\t_gl.uniform1fv( location, value );\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase '2fv':\r\n\t\t\t\t\t_gl.uniform2fv( location, value );\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase '3fv':\r\n\t\t\t\t\t_gl.uniform3fv( location, value );\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase '4fv':\r\n\t\t\t\t\t_gl.uniform4fv( location, value );\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase 'Matrix3fv':\r\n\t\t\t\t\t_gl.uniformMatrix3fv( location, false, value );\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase 'Matrix4fv':\r\n\t\t\t\t\t_gl.uniformMatrix4fv( location, false, value );\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\t//\r\n\r\n\t\t\t\tcase 'i':\r\n\r\n\t\t\t\t\t// single integer\r\n\t\t\t\t\t_gl.uniform1i( location, value );\r\n\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase 'f':\r\n\r\n\t\t\t\t\t// single float\r\n\t\t\t\t\t_gl.uniform1f( location, value );\r\n\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase 'v2':\r\n\r\n\t\t\t\t\t// single THREE.Vector2\r\n\t\t\t\t\t_gl.uniform2f( location, value.x, value.y );\r\n\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase 'v3':\r\n\r\n\t\t\t\t\t// single THREE.Vector3\r\n\t\t\t\t\t_gl.uniform3f( location, value.x, value.y, value.z );\r\n\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase 'v4':\r\n\r\n\t\t\t\t\t// single THREE.Vector4\r\n\t\t\t\t\t_gl.uniform4f( location, value.x, value.y, value.z, value.w );\r\n\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase 'c':\r\n\r\n\t\t\t\t\t// single THREE.Color\r\n\t\t\t\t\t_gl.uniform3f( location, value.r, value.g, value.b );\r\n\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase 'iv1':\r\n\r\n\t\t\t\t\t// flat array of integers (JS or typed array)\r\n\t\t\t\t\t_gl.uniform1iv( location, value );\r\n\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase 'iv':\r\n\r\n\t\t\t\t\t// flat array of integers with 3 x N size (JS or typed array)\r\n\t\t\t\t\t_gl.uniform3iv( location, value );\r\n\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase 'fv1':\r\n\r\n\t\t\t\t\t// flat array of floats (JS or typed array)\r\n\t\t\t\t\t_gl.uniform1fv( location, value );\r\n\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase 'fv':\r\n\r\n\t\t\t\t\t// flat array of floats with 3 x N size (JS or typed array)\r\n\t\t\t\t\t_gl.uniform3fv( location, value );\r\n\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase 'v2v':\r\n\r\n\t\t\t\t\t// array of THREE.Vector2\r\n\r\n\t\t\t\t\tif ( uniform._array === undefined ) {\r\n\r\n\t\t\t\t\t\tuniform._array = new Float32Array( 2 * value.length );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tfor ( var i = 0, i2 = 0, il = value.length; i < il; i ++, i2 += 2 ) {\r\n\r\n\t\t\t\t\t\tuniform._array[ i2 + 0 ] = value[ i ].x;\r\n\t\t\t\t\t\tuniform._array[ i2 + 1 ] = value[ i ].y;\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\t_gl.uniform2fv( location, uniform._array );\r\n\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase 'v3v':\r\n\r\n\t\t\t\t\t// array of THREE.Vector3\r\n\r\n\t\t\t\t\tif ( uniform._array === undefined ) {\r\n\r\n\t\t\t\t\t\tuniform._array = new Float32Array( 3 * value.length );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tfor ( var i = 0, i3 = 0, il = value.length; i < il; i ++, i3 += 3 ) {\r\n\r\n\t\t\t\t\t\tuniform._array[ i3 + 0 ] = value[ i ].x;\r\n\t\t\t\t\t\tuniform._array[ i3 + 1 ] = value[ i ].y;\r\n\t\t\t\t\t\tuniform._array[ i3 + 2 ] = value[ i ].z;\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\t_gl.uniform3fv( location, uniform._array );\r\n\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase 'v4v':\r\n\r\n\t\t\t\t\t// array of THREE.Vector4\r\n\r\n\t\t\t\t\tif ( uniform._array === undefined ) {\r\n\r\n\t\t\t\t\t\tuniform._array = new Float32Array( 4 * value.length );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tfor ( var i = 0, i4 = 0, il = value.length; i < il; i ++, i4 += 4 ) {\r\n\r\n\t\t\t\t\t\tuniform._array[ i4 + 0 ] = value[ i ].x;\r\n\t\t\t\t\t\tuniform._array[ i4 + 1 ] = value[ i ].y;\r\n\t\t\t\t\t\tuniform._array[ i4 + 2 ] = value[ i ].z;\r\n\t\t\t\t\t\tuniform._array[ i4 + 3 ] = value[ i ].w;\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\t_gl.uniform4fv( location, uniform._array );\r\n\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase 'm3':\r\n\r\n\t\t\t\t\t// single THREE.Matrix3\r\n\t\t\t\t\t_gl.uniformMatrix3fv( location, false, value.elements );\r\n\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase 'm3v':\r\n\r\n\t\t\t\t\t// array of THREE.Matrix3\r\n\r\n\t\t\t\t\tif ( uniform._array === undefined ) {\r\n\r\n\t\t\t\t\t\tuniform._array = new Float32Array( 9 * value.length );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tfor ( var i = 0, il = value.length; i < il; i ++ ) {\r\n\r\n\t\t\t\t\t\tvalue[ i ].flattenToArrayOffset( uniform._array, i * 9 );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\t_gl.uniformMatrix3fv( location, false, uniform._array );\r\n\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase 'm4':\r\n\r\n\t\t\t\t\t// single THREE.Matrix4\r\n\t\t\t\t\t_gl.uniformMatrix4fv( location, false, value.elements );\r\n\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase 'm4v':\r\n\r\n\t\t\t\t\t// array of THREE.Matrix4\r\n\r\n\t\t\t\t\tif ( uniform._array === undefined ) {\r\n\r\n\t\t\t\t\t\tuniform._array = new Float32Array( 16 * value.length );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tfor ( var i = 0, il = value.length; i < il; i ++ ) {\r\n\r\n\t\t\t\t\t\tvalue[ i ].flattenToArrayOffset( uniform._array, i * 16 );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\t_gl.uniformMatrix4fv( location, false, uniform._array );\r\n\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase 't':\r\n\r\n\t\t\t\t\t// single THREE.Texture (2d or cube)\r\n\r\n\t\t\t\t\ttexture = value;\r\n\t\t\t\t\ttextureUnit = getTextureUnit();\r\n\r\n\t\t\t\t\t_gl.uniform1i( location, textureUnit );\r\n\r\n\t\t\t\t\tif ( ! texture ) continue;\r\n\r\n\t\t\t\t\tif ( texture instanceof THREE.CubeTexture ||\r\n\t\t\t\t\t\t ( Array.isArray( texture.image ) && texture.image.length === 6 ) ) {\r\n\r\n\t\t\t\t\t\t// CompressedTexture can have Array in image :/\r\n\r\n\t\t\t\t\t\tsetCubeTexture( texture, textureUnit );\r\n\r\n\t\t\t\t\t} else if ( texture instanceof THREE.WebGLRenderTargetCube ) {\r\n\r\n\t\t\t\t\t\tsetCubeTextureDynamic( texture, textureUnit );\r\n\r\n\t\t\t\t\t} else {\r\n\r\n\t\t\t\t\t\t_this.setTexture( texture, textureUnit );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase 'tv':\r\n\r\n\t\t\t\t\t// array of THREE.Texture (2d)\r\n\r\n\t\t\t\t\tif ( uniform._array === undefined ) {\r\n\r\n\t\t\t\t\t\tuniform._array = [];\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tfor ( var i = 0, il = uniform.value.length; i < il; i ++ ) {\r\n\r\n\t\t\t\t\t\tuniform._array[ i ] = getTextureUnit();\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\t_gl.uniform1iv( location, uniform._array );\r\n\r\n\t\t\t\t\tfor ( var i = 0, il = uniform.value.length; i < il; i ++ ) {\r\n\r\n\t\t\t\t\t\ttexture = uniform.value[ i ];\r\n\t\t\t\t\t\ttextureUnit = uniform._array[ i ];\r\n\r\n\t\t\t\t\t\tif ( ! texture ) continue;\r\n\r\n\t\t\t\t\t\t_this.setTexture( texture, textureUnit );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tdefault:\r\n\r\n\t\t\t\t\tconsole.warn( 'THREE.WebGLRenderer: Unknown uniform type: ' + type );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tfunction setColorLinear( array, offset, color, intensity ) {\r\n\r\n\t\tarray[ offset + 0 ] = color.r * intensity;\r\n\t\tarray[ offset + 1 ] = color.g * intensity;\r\n\t\tarray[ offset + 2 ] = color.b * intensity;\r\n\r\n\t}\r\n\r\n\tfunction setupLights ( lights, camera ) {\r\n\r\n\t\tvar l, ll, light,\r\n\t\tr = 0, g = 0, b = 0,\r\n\t\tcolor, skyColor, groundColor,\r\n\t\tintensity,\r\n\t\tdistance,\r\n\r\n\t\tzlights = _lights,\r\n\r\n\t\tviewMatrix = camera.matrixWorldInverse,\r\n\r\n\t\tdirColors = zlights.directional.colors,\r\n\t\tdirPositions = zlights.directional.positions,\r\n\r\n\t\tpointColors = zlights.point.colors,\r\n\t\tpointPositions = zlights.point.positions,\r\n\t\tpointDistances = zlights.point.distances,\r\n\t\tpointDecays = zlights.point.decays,\r\n\r\n\t\tspotColors = zlights.spot.colors,\r\n\t\tspotPositions = zlights.spot.positions,\r\n\t\tspotDistances = zlights.spot.distances,\r\n\t\tspotDirections = zlights.spot.directions,\r\n\t\tspotAnglesCos = zlights.spot.anglesCos,\r\n\t\tspotExponents = zlights.spot.exponents,\r\n\t\tspotDecays = zlights.spot.decays,\r\n\r\n\t\themiSkyColors = zlights.hemi.skyColors,\r\n\t\themiGroundColors = zlights.hemi.groundColors,\r\n\t\themiPositions = zlights.hemi.positions,\r\n\r\n\t\tdirLength = 0,\r\n\t\tpointLength = 0,\r\n\t\tspotLength = 0,\r\n\t\themiLength = 0,\r\n\r\n\t\tdirCount = 0,\r\n\t\tpointCount = 0,\r\n\t\tspotCount = 0,\r\n\t\themiCount = 0,\r\n\r\n\t\tdirOffset = 0,\r\n\t\tpointOffset = 0,\r\n\t\tspotOffset = 0,\r\n\t\themiOffset = 0;\r\n\r\n\t\tfor ( l = 0, ll = lights.length; l < ll; l ++ ) {\r\n\r\n\t\t\tlight = lights[ l ];\r\n\r\n\t\t\tif ( light.onlyShadow ) continue;\r\n\r\n\t\t\tcolor = light.color;\r\n\t\t\tintensity = light.intensity;\r\n\t\t\tdistance = light.distance;\r\n\r\n\t\t\tif ( light instanceof THREE.AmbientLight ) {\r\n\r\n\t\t\t\tif ( ! light.visible ) continue;\r\n\r\n\t\t\t\tr += color.r;\r\n\t\t\t\tg += color.g;\r\n\t\t\t\tb += color.b;\r\n\r\n\t\t\t} else if ( light instanceof THREE.DirectionalLight ) {\r\n\r\n\t\t\t\tdirCount += 1;\r\n\r\n\t\t\t\tif ( ! light.visible ) continue;\r\n\r\n\t\t\t\t_direction.setFromMatrixPosition( light.matrixWorld );\r\n\t\t\t\t_vector3.setFromMatrixPosition( light.target.matrixWorld );\r\n\t\t\t\t_direction.sub( _vector3 );\r\n\t\t\t\t_direction.transformDirection( viewMatrix );\r\n\r\n\t\t\t\tdirOffset = dirLength * 3;\r\n\r\n\t\t\t\tdirPositions[ dirOffset + 0 ] = _direction.x;\r\n\t\t\t\tdirPositions[ dirOffset + 1 ] = _direction.y;\r\n\t\t\t\tdirPositions[ dirOffset + 2 ] = _direction.z;\r\n\r\n\t\t\t\tsetColorLinear( dirColors, dirOffset, color, intensity );\r\n\r\n\t\t\t\tdirLength += 1;\r\n\r\n\t\t\t} else if ( light instanceof THREE.PointLight ) {\r\n\r\n\t\t\t\tpointCount += 1;\r\n\r\n\t\t\t\tif ( ! light.visible ) continue;\r\n\r\n\t\t\t\tpointOffset = pointLength * 3;\r\n\r\n\t\t\t\tsetColorLinear( pointColors, pointOffset, color, intensity );\r\n\r\n\t\t\t\t_vector3.setFromMatrixPosition( light.matrixWorld );\r\n\t\t\t\t_vector3.applyMatrix4( viewMatrix );\r\n\r\n\t\t\t\tpointPositions[ pointOffset + 0 ] = _vector3.x;\r\n\t\t\t\tpointPositions[ pointOffset + 1 ] = _vector3.y;\r\n\t\t\t\tpointPositions[ pointOffset + 2 ] = _vector3.z;\r\n\r\n\t\t\t\t// distance is 0 if decay is 0, because there is no attenuation at all.\r\n\t\t\t\tpointDistances[ pointLength ] = distance;\r\n\t\t\t\tpointDecays[ pointLength ] = ( light.distance === 0 ) ? 0.0 : light.decay;\r\n\r\n\t\t\t\tpointLength += 1;\r\n\r\n\t\t\t} else if ( light instanceof THREE.SpotLight ) {\r\n\r\n\t\t\t\tspotCount += 1;\r\n\r\n\t\t\t\tif ( ! light.visible ) continue;\r\n\r\n\t\t\t\tspotOffset = spotLength * 3;\r\n\r\n\t\t\t\tsetColorLinear( spotColors, spotOffset, color, intensity );\r\n\r\n\t\t\t\t_direction.setFromMatrixPosition( light.matrixWorld );\r\n\t\t\t\t_vector3.copy( _direction ).applyMatrix4( viewMatrix );\r\n\r\n\t\t\t\tspotPositions[ spotOffset + 0 ] = _vector3.x;\r\n\t\t\t\tspotPositions[ spotOffset + 1 ] = _vector3.y;\r\n\t\t\t\tspotPositions[ spotOffset + 2 ] = _vector3.z;\r\n\r\n\t\t\t\tspotDistances[ spotLength ] = distance;\r\n\r\n\t\t\t\t_vector3.setFromMatrixPosition( light.target.matrixWorld );\r\n\t\t\t\t_direction.sub( _vector3 );\r\n\t\t\t\t_direction.transformDirection( viewMatrix );\r\n\r\n\t\t\t\tspotDirections[ spotOffset + 0 ] = _direction.x;\r\n\t\t\t\tspotDirections[ spotOffset + 1 ] = _direction.y;\r\n\t\t\t\tspotDirections[ spotOffset + 2 ] = _direction.z;\r\n\r\n\t\t\t\tspotAnglesCos[ spotLength ] = Math.cos( light.angle );\r\n\t\t\t\tspotExponents[ spotLength ] = light.exponent;\r\n\t\t\t\tspotDecays[ spotLength ] = ( light.distance === 0 ) ? 0.0 : light.decay;\r\n\r\n\t\t\t\tspotLength += 1;\r\n\r\n\t\t\t} else if ( light instanceof THREE.HemisphereLight ) {\r\n\r\n\t\t\t\themiCount += 1;\r\n\r\n\t\t\t\tif ( ! light.visible ) continue;\r\n\r\n\t\t\t\t_direction.setFromMatrixPosition( light.matrixWorld );\r\n\t\t\t\t_direction.transformDirection( viewMatrix );\r\n\r\n\t\t\t\themiOffset = hemiLength * 3;\r\n\r\n\t\t\t\themiPositions[ hemiOffset + 0 ] = _direction.x;\r\n\t\t\t\themiPositions[ hemiOffset + 1 ] = _direction.y;\r\n\t\t\t\themiPositions[ hemiOffset + 2 ] = _direction.z;\r\n\r\n\t\t\t\tskyColor = light.color;\r\n\t\t\t\tgroundColor = light.groundColor;\r\n\r\n\t\t\t\tsetColorLinear( hemiSkyColors, hemiOffset, skyColor, intensity );\r\n\t\t\t\tsetColorLinear( hemiGroundColors, hemiOffset, groundColor, intensity );\r\n\r\n\t\t\t\themiLength += 1;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\t// null eventual remains from removed lights\r\n\t\t// (this is to avoid if in shader)\r\n\r\n\t\tfor ( l = dirLength * 3, ll = Math.max( dirColors.length, dirCount * 3 ); l < ll; l ++ ) dirColors[ l ] = 0.0;\r\n\t\tfor ( l = pointLength * 3, ll = Math.max( pointColors.length, pointCount * 3 ); l < ll; l ++ ) pointColors[ l ] = 0.0;\r\n\t\tfor ( l = spotLength * 3, ll = Math.max( spotColors.length, spotCount * 3 ); l < ll; l ++ ) spotColors[ l ] = 0.0;\r\n\t\tfor ( l = hemiLength * 3, ll = Math.max( hemiSkyColors.length, hemiCount * 3 ); l < ll; l ++ ) hemiSkyColors[ l ] = 0.0;\r\n\t\tfor ( l = hemiLength * 3, ll = Math.max( hemiGroundColors.length, hemiCount * 3 ); l < ll; l ++ ) hemiGroundColors[ l ] = 0.0;\r\n\r\n\t\tzlights.directional.length = dirLength;\r\n\t\tzlights.point.length = pointLength;\r\n\t\tzlights.spot.length = spotLength;\r\n\t\tzlights.hemi.length = hemiLength;\r\n\r\n\t\tzlights.ambient[ 0 ] = r;\r\n\t\tzlights.ambient[ 1 ] = g;\r\n\t\tzlights.ambient[ 2 ] = b;\r\n\r\n\t}\r\n\r\n\t// GL state setting\r\n\r\n\tthis.setFaceCulling = function ( cullFace, frontFaceDirection ) {\r\n\r\n\t\tif ( cullFace === THREE.CullFaceNone ) {\r\n\r\n\t\t\tstate.disable( _gl.CULL_FACE );\r\n\r\n\t\t} else {\r\n\r\n\t\t\tif ( frontFaceDirection === THREE.FrontFaceDirectionCW ) {\r\n\r\n\t\t\t\t_gl.frontFace( _gl.CW );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\t_gl.frontFace( _gl.CCW );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( cullFace === THREE.CullFaceBack ) {\r\n\r\n\t\t\t\t_gl.cullFace( _gl.BACK );\r\n\r\n\t\t\t} else if ( cullFace === THREE.CullFaceFront ) {\r\n\r\n\t\t\t\t_gl.cullFace( _gl.FRONT );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\t_gl.cullFace( _gl.FRONT_AND_BACK );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tstate.enable( _gl.CULL_FACE );\r\n\r\n\t\t}\r\n\r\n\t};\r\n\r\n\t// Textures\r\n\r\n\tfunction setTextureParameters ( textureType, texture, isImagePowerOfTwo ) {\r\n\r\n\t\tvar extension;\r\n\r\n\t\tif ( isImagePowerOfTwo ) {\r\n\r\n\t\t\t_gl.texParameteri( textureType, _gl.TEXTURE_WRAP_S, paramThreeToGL( texture.wrapS ) );\r\n\t\t\t_gl.texParameteri( textureType, _gl.TEXTURE_WRAP_T, paramThreeToGL( texture.wrapT ) );\r\n\r\n\t\t\t_gl.texParameteri( textureType, _gl.TEXTURE_MAG_FILTER, paramThreeToGL( texture.magFilter ) );\r\n\t\t\t_gl.texParameteri( textureType, _gl.TEXTURE_MIN_FILTER, paramThreeToGL( texture.minFilter ) );\r\n\r\n\t\t} else {\r\n\r\n\t\t\t_gl.texParameteri( textureType, _gl.TEXTURE_WRAP_S, _gl.CLAMP_TO_EDGE );\r\n\t\t\t_gl.texParameteri( textureType, _gl.TEXTURE_WRAP_T, _gl.CLAMP_TO_EDGE );\r\n\r\n\t\t\tif ( texture.wrapS !== THREE.ClampToEdgeWrapping || texture.wrapT !== THREE.ClampToEdgeWrapping ) {\r\n\r\n\t\t\t\tconsole.warn( 'THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping. ( ' + texture.sourceFile + ' )' );\r\n\r\n\t\t\t}\r\n\r\n\t\t\t_gl.texParameteri( textureType, _gl.TEXTURE_MAG_FILTER, filterFallback( texture.magFilter ) );\r\n\t\t\t_gl.texParameteri( textureType, _gl.TEXTURE_MIN_FILTER, filterFallback( texture.minFilter ) );\r\n\r\n\t\t\tif ( texture.minFilter !== THREE.NearestFilter && texture.minFilter !== THREE.LinearFilter ) {\r\n\r\n\t\t\t\tconsole.warn( 'THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter. ( ' + texture.sourceFile + ' )' );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\textension = extensions.get( 'EXT_texture_filter_anisotropic' );\r\n\r\n\t\tif ( extension ) {\r\n\r\n\t\t\tif ( texture.type === THREE.FloatType && extensions.get( 'OES_texture_float_linear' ) === null ) return;\r\n\t\t\tif ( texture.type === THREE.HalfFloatType && extensions.get( 'OES_texture_half_float_linear' ) === null ) return;\r\n\r\n\t\t\tif ( texture.anisotropy > 1 || properties.get( texture ).__currentAnisotropy ) {\r\n\r\n\t\t\t\t_gl.texParameterf( textureType, extension.TEXTURE_MAX_ANISOTROPY_EXT, Math.min( texture.anisotropy, _this.getMaxAnisotropy() ) );\r\n\t\t\t\tproperties.get( texture ).__currentAnisotropy = texture.anisotropy;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tfunction uploadTexture( textureProperties, texture, slot ) {\r\n\r\n\t\tif ( textureProperties.__webglInit === undefined ) {\r\n\r\n\t\t\ttextureProperties.__webglInit = true;\r\n\r\n\t\t\ttexture.__webglInit = true;\r\n\r\n\t\t\ttexture.addEventListener( 'dispose', onTextureDispose );\r\n\r\n\t\t\ttextureProperties.__webglTexture = _gl.createTexture();\r\n\r\n\t\t\t_infoMemory.textures ++;\r\n\r\n\t\t}\r\n\r\n\t\tstate.activeTexture( _gl.TEXTURE0 + slot );\r\n\t\tstate.bindTexture( _gl.TEXTURE_2D, textureProperties.__webglTexture );\r\n\r\n\t\t_gl.pixelStorei( _gl.UNPACK_FLIP_Y_WEBGL, texture.flipY );\r\n\t\t_gl.pixelStorei( _gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, texture.premultiplyAlpha );\r\n\t\t_gl.pixelStorei( _gl.UNPACK_ALIGNMENT, texture.unpackAlignment );\r\n\r\n\t\ttexture.image = clampToMaxSize( texture.image, capabilities.maxTextureSize );\r\n\r\n\t\tvar image = texture.image,\r\n\t\tisImagePowerOfTwo = THREE.Math.isPowerOfTwo( image.width ) && THREE.Math.isPowerOfTwo( image.height ),\r\n\t\tglFormat = paramThreeToGL( texture.format ),\r\n\t\tglType = paramThreeToGL( texture.type );\r\n\r\n\t\tsetTextureParameters( _gl.TEXTURE_2D, texture, isImagePowerOfTwo );\r\n\r\n\t\tvar mipmap, mipmaps = texture.mipmaps;\r\n\r\n\t\tif ( texture instanceof THREE.DataTexture ) {\r\n\r\n\t\t\t// use manually created mipmaps if available\r\n\t\t\t// if there are no manual mipmaps\r\n\t\t\t// set 0 level mipmap and then use GL to generate other mipmap levels\r\n\r\n\t\t\tif ( mipmaps.length > 0 && isImagePowerOfTwo ) {\r\n\r\n\t\t\t\tfor ( var i = 0, il = mipmaps.length; i < il; i ++ ) {\r\n\r\n\t\t\t\t\tmipmap = mipmaps[ i ];\r\n\t\t\t\t\tstate.texImage2D( _gl.TEXTURE_2D, i, glFormat, mipmap.width, mipmap.height, 0, glFormat, glType, mipmap.data );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\ttexture.generateMipmaps = false;\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tstate.texImage2D( _gl.TEXTURE_2D, 0, glFormat, image.width, image.height, 0, glFormat, glType, image.data );\r\n\r\n\t\t\t}\r\n\r\n\t\t} else if ( texture instanceof THREE.CompressedTexture ) {\r\n\r\n\t\t\tfor ( var i = 0, il = mipmaps.length; i < il; i ++ ) {\r\n\r\n\t\t\t\tmipmap = mipmaps[ i ];\r\n\r\n\t\t\t\tif ( texture.format !== THREE.RGBAFormat && texture.format !== THREE.RGBFormat ) {\r\n\r\n\t\t\t\t\tif ( state.getCompressedTextureFormats().indexOf( glFormat ) > - 1 ) {\r\n\r\n\t\t\t\t\t\tstate.compressedTexImage2D( _gl.TEXTURE_2D, i, glFormat, mipmap.width, mipmap.height, 0, mipmap.data );\r\n\r\n\t\t\t\t\t} else {\r\n\r\n\t\t\t\t\t\tconsole.warn( \"THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()\" );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\tstate.texImage2D( _gl.TEXTURE_2D, i, glFormat, mipmap.width, mipmap.height, 0, glFormat, glType, mipmap.data );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t} else {\r\n\r\n\t\t\t// regular Texture (image, video, canvas)\r\n\r\n\t\t\t// use manually created mipmaps if available\r\n\t\t\t// if there are no manual mipmaps\r\n\t\t\t// set 0 level mipmap and then use GL to generate other mipmap levels\r\n\r\n\t\t\tif ( mipmaps.length > 0 && isImagePowerOfTwo ) {\r\n\r\n\t\t\t\tfor ( var i = 0, il = mipmaps.length; i < il; i ++ ) {\r\n\r\n\t\t\t\t\tmipmap = mipmaps[ i ];\r\n\t\t\t\t\tstate.texImage2D( _gl.TEXTURE_2D, i, glFormat, glFormat, glType, mipmap );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\ttexture.generateMipmaps = false;\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tstate.texImage2D( _gl.TEXTURE_2D, 0, glFormat, glFormat, glType, texture.image );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tif ( texture.generateMipmaps && isImagePowerOfTwo ) _gl.generateMipmap( _gl.TEXTURE_2D );\r\n\r\n\t\ttextureProperties.__version = texture.version;\r\n\r\n\t\tif ( texture.onUpdate ) texture.onUpdate( texture );\r\n\r\n\t}\r\n\r\n\tthis.setTexture = function ( texture, slot ) {\r\n\r\n\t\tvar textureProperties = properties.get( texture );\r\n\r\n\t\tif ( texture.version > 0 && textureProperties.__version !== texture.version ) {\r\n\r\n\t\t\tvar image = texture.image;\r\n\r\n\t\t\tif ( image === undefined ) {\r\n\r\n\t\t\t\tconsole.warn( 'THREE.WebGLRenderer: Texture marked for update but image is undefined', texture );\r\n\t\t\t\treturn;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( image.complete === false ) {\r\n\r\n\t\t\t\tconsole.warn( 'THREE.WebGLRenderer: Texture marked for update but image is incomplete', texture );\r\n\t\t\t\treturn;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tuploadTexture( textureProperties, texture, slot );\r\n\t\t\treturn;\r\n\r\n\t\t}\r\n\r\n\t\tstate.activeTexture( _gl.TEXTURE0 + slot );\r\n\t\tstate.bindTexture( _gl.TEXTURE_2D, textureProperties.__webglTexture );\r\n\r\n\t};\r\n\r\n\tfunction clampToMaxSize ( image, maxSize ) {\r\n\r\n\t\tif ( image.width > maxSize || image.height > maxSize ) {\r\n\r\n\t\t\t// Warning: Scaling through the canvas will only work with images that use\r\n\t\t\t// premultiplied alpha.\r\n\r\n\t\t\tvar scale = maxSize / Math.max( image.width, image.height );\r\n\r\n\t\t\tvar canvas = document.createElement( 'canvas' );\r\n\t\t\tcanvas.width = Math.floor( image.width * scale );\r\n\t\t\tcanvas.height = Math.floor( image.height * scale );\r\n\r\n\t\t\tvar context = canvas.getContext( '2d' );\r\n\t\t\tcontext.drawImage( image, 0, 0, image.width, image.height, 0, 0, canvas.width, canvas.height );\r\n\r\n\t\t\tconsole.warn( 'THREE.WebGLRenderer: image is too big (' + image.width + 'x' + image.height + '). Resized to ' + canvas.width + 'x' + canvas.height, image );\r\n\r\n\t\t\treturn canvas;\r\n\r\n\t\t}\r\n\r\n\t\treturn image;\r\n\r\n\t}\r\n\r\n\tfunction setCubeTexture ( texture, slot ) {\r\n\r\n\t\tvar textureProperties = properties.get( texture );\r\n\r\n\t\tif ( texture.image.length === 6 ) {\r\n\r\n\t\t\tif ( texture.version > 0 && textureProperties.__version !== texture.version ) {\r\n\r\n\t\t\t\tif ( ! textureProperties.__image__webglTextureCube ) {\r\n\r\n\t\t\t\t\ttexture.addEventListener( 'dispose', onTextureDispose );\r\n\r\n\t\t\t\t\ttextureProperties.__image__webglTextureCube = _gl.createTexture();\r\n\r\n\t\t\t\t\t_infoMemory.textures ++;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tstate.activeTexture( _gl.TEXTURE0 + slot );\r\n\t\t\t\tstate.bindTexture( _gl.TEXTURE_CUBE_MAP, textureProperties.__image__webglTextureCube );\r\n\r\n\t\t\t\t_gl.pixelStorei( _gl.UNPACK_FLIP_Y_WEBGL, texture.flipY );\r\n\r\n\t\t\t\tvar isCompressed = texture instanceof THREE.CompressedTexture;\r\n\t\t\t\tvar isDataTexture = texture.image[ 0 ] instanceof THREE.DataTexture;\r\n\r\n\t\t\t\tvar cubeImage = [];\r\n\r\n\t\t\t\tfor ( var i = 0; i < 6; i ++ ) {\r\n\r\n\t\t\t\t\tif ( _this.autoScaleCubemaps && ! isCompressed && ! isDataTexture ) {\r\n\r\n\t\t\t\t\t\tcubeImage[ i ] = clampToMaxSize( texture.image[ i ], capabilities.maxCubemapSize );\r\n\r\n\t\t\t\t\t} else {\r\n\r\n\t\t\t\t\t\tcubeImage[ i ] = isDataTexture ? texture.image[ i ].image : texture.image[ i ];\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tvar image = cubeImage[ 0 ],\r\n\t\t\t\tisImagePowerOfTwo = THREE.Math.isPowerOfTwo( image.width ) && THREE.Math.isPowerOfTwo( image.height ),\r\n\t\t\t\tglFormat = paramThreeToGL( texture.format ),\r\n\t\t\t\tglType = paramThreeToGL( texture.type );\r\n\r\n\t\t\t\tsetTextureParameters( _gl.TEXTURE_CUBE_MAP, texture, isImagePowerOfTwo );\r\n\r\n\t\t\t\tfor ( var i = 0; i < 6; i ++ ) {\r\n\r\n\t\t\t\t\tif ( ! isCompressed ) {\r\n\r\n\t\t\t\t\t\tif ( isDataTexture ) {\r\n\r\n\t\t\t\t\t\t\tstate.texImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, glFormat, cubeImage[ i ].width, cubeImage[ i ].height, 0, glFormat, glType, cubeImage[ i ].data );\r\n\r\n\t\t\t\t\t\t} else {\r\n\r\n\t\t\t\t\t\t\tstate.texImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, glFormat, glFormat, glType, cubeImage[ i ] );\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t} else {\r\n\r\n\t\t\t\t\t\tvar mipmap, mipmaps = cubeImage[ i ].mipmaps;\r\n\r\n\t\t\t\t\t\tfor ( var j = 0, jl = mipmaps.length; j < jl; j ++ ) {\r\n\r\n\t\t\t\t\t\t\tmipmap = mipmaps[ j ];\r\n\r\n\t\t\t\t\t\t\tif ( texture.format !== THREE.RGBAFormat && texture.format !== THREE.RGBFormat ) {\r\n\r\n\t\t\t\t\t\t\t\tif ( state.getCompressedTextureFormats().indexOf( glFormat ) > - 1 ) {\r\n\r\n\t\t\t\t\t\t\t\t\tstate.compressedTexImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, j, glFormat, mipmap.width, mipmap.height, 0, mipmap.data );\r\n\r\n\t\t\t\t\t\t\t\t} else {\r\n\r\n\t\t\t\t\t\t\t\t\tconsole.warn( \"THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setCubeTexture()\" );\r\n\r\n\t\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\t} else {\r\n\r\n\t\t\t\t\t\t\t\tstate.texImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, j, glFormat, mipmap.width, mipmap.height, 0, glFormat, glType, mipmap.data );\r\n\r\n\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif ( texture.generateMipmaps && isImagePowerOfTwo ) {\r\n\r\n\t\t\t\t\t_gl.generateMipmap( _gl.TEXTURE_CUBE_MAP );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\ttextureProperties.__version = texture.version;\r\n\r\n\t\t\t\tif ( texture.onUpdate ) texture.onUpdate( texture );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tstate.activeTexture( _gl.TEXTURE0 + slot );\r\n\t\t\t\tstate.bindTexture( _gl.TEXTURE_CUBE_MAP, textureProperties.__image__webglTextureCube );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tfunction setCubeTextureDynamic ( texture, slot ) {\r\n\r\n\t\tstate.activeTexture( _gl.TEXTURE0 + slot );\r\n\t\tstate.bindTexture( _gl.TEXTURE_CUBE_MAP, properties.get( texture ).__webglTexture );\r\n\r\n\t}\r\n\r\n\t// Render targets\r\n\r\n\tfunction setupFrameBuffer ( framebuffer, renderTarget, textureTarget ) {\r\n\r\n\t\t_gl.bindFramebuffer( _gl.FRAMEBUFFER, framebuffer );\r\n\t\t_gl.framebufferTexture2D( _gl.FRAMEBUFFER, _gl.COLOR_ATTACHMENT0, textureTarget, properties.get( renderTarget ).__webglTexture, 0 );\r\n\r\n\t}\r\n\r\n\tfunction setupRenderBuffer ( renderbuffer, renderTarget ) {\r\n\r\n\t\t_gl.bindRenderbuffer( _gl.RENDERBUFFER, renderbuffer );\r\n\r\n\t\tif ( renderTarget.depthBuffer && ! renderTarget.stencilBuffer ) {\r\n\r\n\t\t\t_gl.renderbufferStorage( _gl.RENDERBUFFER, _gl.DEPTH_COMPONENT16, renderTarget.width, renderTarget.height );\r\n\t\t\t_gl.framebufferRenderbuffer( _gl.FRAMEBUFFER, _gl.DEPTH_ATTACHMENT, _gl.RENDERBUFFER, renderbuffer );\r\n\r\n\t\t/* For some reason this is not working. Defaulting to RGBA4.\r\n\t\t} else if ( ! renderTarget.depthBuffer && renderTarget.stencilBuffer ) {\r\n\r\n\t\t\t_gl.renderbufferStorage( _gl.RENDERBUFFER, _gl.STENCIL_INDEX8, renderTarget.width, renderTarget.height );\r\n\t\t\t_gl.framebufferRenderbuffer( _gl.FRAMEBUFFER, _gl.STENCIL_ATTACHMENT, _gl.RENDERBUFFER, renderbuffer );\r\n\t\t*/\r\n\r\n\t\t} else if ( renderTarget.depthBuffer && renderTarget.stencilBuffer ) {\r\n\r\n\t\t\t_gl.renderbufferStorage( _gl.RENDERBUFFER, _gl.DEPTH_STENCIL, renderTarget.width, renderTarget.height );\r\n\t\t\t_gl.framebufferRenderbuffer( _gl.FRAMEBUFFER, _gl.DEPTH_STENCIL_ATTACHMENT, _gl.RENDERBUFFER, renderbuffer );\r\n\r\n\t\t} else {\r\n\r\n\t\t\t_gl.renderbufferStorage( _gl.RENDERBUFFER, _gl.RGBA4, renderTarget.width, renderTarget.height );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tthis.setRenderTarget = function ( renderTarget ) {\r\n\r\n\t\tvar isCube = ( renderTarget instanceof THREE.WebGLRenderTargetCube );\r\n\r\n\t\tif ( renderTarget && properties.get( renderTarget ).__webglFramebuffer === undefined ) {\r\n\r\n\t\t\tvar renderTargetProperties = properties.get( renderTarget );\r\n\r\n\t\t\tif ( renderTarget.depthBuffer === undefined ) renderTarget.depthBuffer = true;\r\n\t\t\tif ( renderTarget.stencilBuffer === undefined ) renderTarget.stencilBuffer = true;\r\n\r\n\t\t\trenderTarget.addEventListener( 'dispose', onRenderTargetDispose );\r\n\r\n\t\t\trenderTargetProperties.__webglTexture = _gl.createTexture();\r\n\r\n\t\t\t_infoMemory.textures ++;\r\n\r\n\t\t\t// Setup texture, create render and frame buffers\r\n\r\n\t\t\tvar isTargetPowerOfTwo = THREE.Math.isPowerOfTwo( renderTarget.width ) && THREE.Math.isPowerOfTwo( renderTarget.height ),\r\n\t\t\t\tglFormat = paramThreeToGL( renderTarget.format ),\r\n\t\t\t\tglType = paramThreeToGL( renderTarget.type );\r\n\r\n\t\t\tif ( isCube ) {\r\n\r\n\t\t\t\trenderTargetProperties.__webglFramebuffer = [];\r\n\t\t\t\trenderTargetProperties.__webglRenderbuffer = [];\r\n\r\n\t\t\t\tstate.bindTexture( _gl.TEXTURE_CUBE_MAP, renderTargetProperties.__webglTexture );\r\n\r\n\t\t\t\tsetTextureParameters( _gl.TEXTURE_CUBE_MAP, renderTarget, isTargetPowerOfTwo );\r\n\r\n\t\t\t\tfor ( var i = 0; i < 6; i ++ ) {\r\n\r\n\t\t\t\t\trenderTargetProperties.__webglFramebuffer[ i ] = _gl.createFramebuffer();\r\n\t\t\t\t\trenderTargetProperties.__webglRenderbuffer[ i ] = _gl.createRenderbuffer();\r\n\r\n\t\t\t\t\tstate.texImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, glFormat, renderTarget.width, renderTarget.height, 0, glFormat, glType, null );\r\n\r\n\t\t\t\t\tsetupFrameBuffer( renderTargetProperties.__webglFramebuffer[ i ], renderTarget, _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i );\r\n\t\t\t\t\tsetupRenderBuffer( renderTargetProperties.__webglRenderbuffer[ i ], renderTarget );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif ( renderTarget.generateMipmaps && isTargetPowerOfTwo ) _gl.generateMipmap( _gl.TEXTURE_CUBE_MAP );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\trenderTargetProperties.__webglFramebuffer = _gl.createFramebuffer();\r\n\r\n\t\t\t\tif ( renderTarget.shareDepthFrom ) {\r\n\r\n\t\t\t\t\trenderTargetProperties.__webglRenderbuffer = renderTarget.shareDepthFrom.__webglRenderbuffer;\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\trenderTargetProperties.__webglRenderbuffer = _gl.createRenderbuffer();\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tstate.bindTexture( _gl.TEXTURE_2D, renderTargetProperties.__webglTexture );\r\n\t\t\t\tsetTextureParameters( _gl.TEXTURE_2D, renderTarget, isTargetPowerOfTwo );\r\n\r\n\t\t\t\tstate.texImage2D( _gl.TEXTURE_2D, 0, glFormat, renderTarget.width, renderTarget.height, 0, glFormat, glType, null );\r\n\r\n\t\t\t\tsetupFrameBuffer( renderTargetProperties.__webglFramebuffer, renderTarget, _gl.TEXTURE_2D );\r\n\r\n\t\t\t\tif ( renderTarget.shareDepthFrom ) {\r\n\r\n\t\t\t\t\tif ( renderTarget.depthBuffer && ! renderTarget.stencilBuffer ) {\r\n\r\n\t\t\t\t\t\t_gl.framebufferRenderbuffer( _gl.FRAMEBUFFER, _gl.DEPTH_ATTACHMENT, _gl.RENDERBUFFER, renderTargetProperties.__webglRenderbuffer );\r\n\r\n\t\t\t\t\t} else if ( renderTarget.depthBuffer && renderTarget.stencilBuffer ) {\r\n\r\n\t\t\t\t\t\t_gl.framebufferRenderbuffer( _gl.FRAMEBUFFER, _gl.DEPTH_STENCIL_ATTACHMENT, _gl.RENDERBUFFER, renderTargetProperties.__webglRenderbuffer );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\tsetupRenderBuffer( renderTargetProperties.__webglRenderbuffer, renderTarget );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif ( renderTarget.generateMipmaps && isTargetPowerOfTwo ) _gl.generateMipmap( _gl.TEXTURE_2D );\r\n\r\n\t\t\t}\r\n\r\n\t\t\t// Release everything\r\n\r\n\t\t\tif ( isCube ) {\r\n\r\n\t\t\t\tstate.bindTexture( _gl.TEXTURE_CUBE_MAP, null );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tstate.bindTexture( _gl.TEXTURE_2D, null );\r\n\r\n\t\t\t}\r\n\r\n\t\t\t_gl.bindRenderbuffer( _gl.RENDERBUFFER, null );\r\n\t\t\t_gl.bindFramebuffer( _gl.FRAMEBUFFER, null );\r\n\r\n\t\t}\r\n\r\n\t\tvar framebuffer, width, height, vx, vy;\r\n\r\n\t\tif ( renderTarget ) {\r\n\r\n\t\t\tvar renderTargetProperties = properties.get( renderTarget );\r\n\r\n\t\t\tif ( isCube ) {\r\n\r\n\t\t\t\tframebuffer = renderTargetProperties.__webglFramebuffer[ renderTarget.activeCubeFace ];\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tframebuffer = renderTargetProperties.__webglFramebuffer;\r\n\r\n\t\t\t}\r\n\r\n\t\t\twidth = renderTarget.width;\r\n\t\t\theight = renderTarget.height;\r\n\r\n\t\t\tvx = 0;\r\n\t\t\tvy = 0;\r\n\r\n\t\t} else {\r\n\r\n\t\t\tframebuffer = null;\r\n\r\n\t\t\twidth = _viewportWidth;\r\n\t\t\theight = _viewportHeight;\r\n\r\n\t\t\tvx = _viewportX;\r\n\t\t\tvy = _viewportY;\r\n\r\n\t\t}\r\n\r\n\t\tif ( framebuffer !== _currentFramebuffer ) {\r\n\r\n\t\t\t_gl.bindFramebuffer( _gl.FRAMEBUFFER, framebuffer );\r\n\t\t\t_gl.viewport( vx, vy, width, height );\r\n\r\n\t\t\t_currentFramebuffer = framebuffer;\r\n\r\n\t\t}\r\n\r\n\t\t_currentWidth = width;\r\n\t\t_currentHeight = height;\r\n\r\n\t};\r\n\r\n\tthis.readRenderTargetPixels = function( renderTarget, x, y, width, height, buffer ) {\r\n\r\n\t\tif ( ! ( renderTarget instanceof THREE.WebGLRenderTarget ) ) {\r\n\r\n\t\t\tconsole.error( 'THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.' );\r\n\t\t\treturn;\r\n\r\n\t\t}\r\n\r\n\t\tif ( properties.get( renderTarget ).__webglFramebuffer ) {\r\n\r\n\t\t\tif ( renderTarget.format !== THREE.RGBAFormat ) {\r\n\r\n\t\t\t\tconsole.error( 'THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA format. readPixels can read only RGBA format.' );\r\n\t\t\t\treturn;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tvar restore = false;\r\n\r\n\t\t\tif ( properties.get( renderTarget ).__webglFramebuffer !== _currentFramebuffer ) {\r\n\r\n\t\t\t\t_gl.bindFramebuffer( _gl.FRAMEBUFFER, properties.get( renderTarget ).__webglFramebuffer );\r\n\r\n\t\t\t\trestore = true;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( _gl.checkFramebufferStatus( _gl.FRAMEBUFFER ) === _gl.FRAMEBUFFER_COMPLETE ) {\r\n\r\n\t\t\t\t_gl.readPixels( x, y, width, height, _gl.RGBA, _gl.UNSIGNED_BYTE, buffer );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tconsole.error( 'THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.' );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( restore ) {\r\n\r\n\t\t\t\t_gl.bindFramebuffer( _gl.FRAMEBUFFER, _currentFramebuffer );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t};\r\n\r\n\tfunction updateRenderTargetMipmap ( renderTarget ) {\r\n\r\n\t\tif ( renderTarget instanceof THREE.WebGLRenderTargetCube ) {\r\n\r\n\t\t\tstate.bindTexture( _gl.TEXTURE_CUBE_MAP, properties.get( renderTarget ).__webglTexture );\r\n\t\t\t_gl.generateMipmap( _gl.TEXTURE_CUBE_MAP );\r\n\t\t\tstate.bindTexture( _gl.TEXTURE_CUBE_MAP, null );\r\n\r\n\t\t} else {\r\n\r\n\t\t\tstate.bindTexture( _gl.TEXTURE_2D, properties.get( renderTarget ).__webglTexture );\r\n\t\t\t_gl.generateMipmap( _gl.TEXTURE_2D );\r\n\t\t\tstate.bindTexture( _gl.TEXTURE_2D, null );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\t// Fallback filters for non-power-of-2 textures\r\n\r\n\tfunction filterFallback ( f ) {\r\n\r\n\t\tif ( f === THREE.NearestFilter || f === THREE.NearestMipMapNearestFilter || f === THREE.NearestMipMapLinearFilter ) {\r\n\r\n\t\t\treturn _gl.NEAREST;\r\n\r\n\t\t}\r\n\r\n\t\treturn _gl.LINEAR;\r\n\r\n\t}\r\n\r\n\t// Map three.js constants to WebGL constants\r\n\r\n\tfunction paramThreeToGL ( p ) {\r\n\r\n\t\tvar extension;\r\n\r\n\t\tif ( p === THREE.RepeatWrapping ) return _gl.REPEAT;\r\n\t\tif ( p === THREE.ClampToEdgeWrapping ) return _gl.CLAMP_TO_EDGE;\r\n\t\tif ( p === THREE.MirroredRepeatWrapping ) return _gl.MIRRORED_REPEAT;\r\n\r\n\t\tif ( p === THREE.NearestFilter ) return _gl.NEAREST;\r\n\t\tif ( p === THREE.NearestMipMapNearestFilter ) return _gl.NEAREST_MIPMAP_NEAREST;\r\n\t\tif ( p === THREE.NearestMipMapLinearFilter ) return _gl.NEAREST_MIPMAP_LINEAR;\r\n\r\n\t\tif ( p === THREE.LinearFilter ) return _gl.LINEAR;\r\n\t\tif ( p === THREE.LinearMipMapNearestFilter ) return _gl.LINEAR_MIPMAP_NEAREST;\r\n\t\tif ( p === THREE.LinearMipMapLinearFilter ) return _gl.LINEAR_MIPMAP_LINEAR;\r\n\r\n\t\tif ( p === THREE.UnsignedByteType ) return _gl.UNSIGNED_BYTE;\r\n\t\tif ( p === THREE.UnsignedShort4444Type ) return _gl.UNSIGNED_SHORT_4_4_4_4;\r\n\t\tif ( p === THREE.UnsignedShort5551Type ) return _gl.UNSIGNED_SHORT_5_5_5_1;\r\n\t\tif ( p === THREE.UnsignedShort565Type ) return _gl.UNSIGNED_SHORT_5_6_5;\r\n\r\n\t\tif ( p === THREE.ByteType ) return _gl.BYTE;\r\n\t\tif ( p === THREE.ShortType ) return _gl.SHORT;\r\n\t\tif ( p === THREE.UnsignedShortType ) return _gl.UNSIGNED_SHORT;\r\n\t\tif ( p === THREE.IntType ) return _gl.INT;\r\n\t\tif ( p === THREE.UnsignedIntType ) return _gl.UNSIGNED_INT;\r\n\t\tif ( p === THREE.FloatType ) return _gl.FLOAT;\r\n\r\n\t\textension = extensions.get( 'OES_texture_half_float' );\r\n\r\n\t\tif ( extension !== null ) {\r\n\r\n\t\t\tif ( p === THREE.HalfFloatType ) return extension.HALF_FLOAT_OES;\r\n\r\n\t\t}\r\n\r\n\t\tif ( p === THREE.AlphaFormat ) return _gl.ALPHA;\r\n\t\tif ( p === THREE.RGBFormat ) return _gl.RGB;\r\n\t\tif ( p === THREE.RGBAFormat ) return _gl.RGBA;\r\n\t\tif ( p === THREE.LuminanceFormat ) return _gl.LUMINANCE;\r\n\t\tif ( p === THREE.LuminanceAlphaFormat ) return _gl.LUMINANCE_ALPHA;\r\n\r\n\t\tif ( p === THREE.AddEquation ) return _gl.FUNC_ADD;\r\n\t\tif ( p === THREE.SubtractEquation ) return _gl.FUNC_SUBTRACT;\r\n\t\tif ( p === THREE.ReverseSubtractEquation ) return _gl.FUNC_REVERSE_SUBTRACT;\r\n\r\n\t\tif ( p === THREE.ZeroFactor ) return _gl.ZERO;\r\n\t\tif ( p === THREE.OneFactor ) return _gl.ONE;\r\n\t\tif ( p === THREE.SrcColorFactor ) return _gl.SRC_COLOR;\r\n\t\tif ( p === THREE.OneMinusSrcColorFactor ) return _gl.ONE_MINUS_SRC_COLOR;\r\n\t\tif ( p === THREE.SrcAlphaFactor ) return _gl.SRC_ALPHA;\r\n\t\tif ( p === THREE.OneMinusSrcAlphaFactor ) return _gl.ONE_MINUS_SRC_ALPHA;\r\n\t\tif ( p === THREE.DstAlphaFactor ) return _gl.DST_ALPHA;\r\n\t\tif ( p === THREE.OneMinusDstAlphaFactor ) return _gl.ONE_MINUS_DST_ALPHA;\r\n\r\n\t\tif ( p === THREE.DstColorFactor ) return _gl.DST_COLOR;\r\n\t\tif ( p === THREE.OneMinusDstColorFactor ) return _gl.ONE_MINUS_DST_COLOR;\r\n\t\tif ( p === THREE.SrcAlphaSaturateFactor ) return _gl.SRC_ALPHA_SATURATE;\r\n\r\n\t\textension = extensions.get( 'WEBGL_compressed_texture_s3tc' );\r\n\r\n\t\tif ( extension !== null ) {\r\n\r\n\t\t\tif ( p === THREE.RGB_S3TC_DXT1_Format ) return extension.COMPRESSED_RGB_S3TC_DXT1_EXT;\r\n\t\t\tif ( p === THREE.RGBA_S3TC_DXT1_Format ) return extension.COMPRESSED_RGBA_S3TC_DXT1_EXT;\r\n\t\t\tif ( p === THREE.RGBA_S3TC_DXT3_Format ) return extension.COMPRESSED_RGBA_S3TC_DXT3_EXT;\r\n\t\t\tif ( p === THREE.RGBA_S3TC_DXT5_Format ) return extension.COMPRESSED_RGBA_S3TC_DXT5_EXT;\r\n\r\n\t\t}\r\n\r\n\t\textension = extensions.get( 'WEBGL_compressed_texture_pvrtc' );\r\n\r\n\t\tif ( extension !== null ) {\r\n\r\n\t\t\tif ( p === THREE.RGB_PVRTC_4BPPV1_Format ) return extension.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;\r\n\t\t\tif ( p === THREE.RGB_PVRTC_2BPPV1_Format ) return extension.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;\r\n\t\t\tif ( p === THREE.RGBA_PVRTC_4BPPV1_Format ) return extension.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;\r\n\t\t\tif ( p === THREE.RGBA_PVRTC_2BPPV1_Format ) return extension.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG;\r\n\r\n\t\t}\r\n\r\n\t\textension = extensions.get( 'EXT_blend_minmax' );\r\n\r\n\t\tif ( extension !== null ) {\r\n\r\n\t\t\tif ( p === THREE.MinEquation ) return extension.MIN_EXT;\r\n\t\t\tif ( p === THREE.MaxEquation ) return extension.MAX_EXT;\r\n\r\n\t\t}\r\n\r\n\t\treturn 0;\r\n\r\n\t}\r\n\r\n\t// DEPRECATED\r\n\r\n\tthis.supportsFloatTextures = function () {\r\n\r\n\t\tconsole.warn( 'THREE.WebGLRenderer: .supportsFloatTextures() is now .extensions.get( \\'OES_texture_float\\' ).' );\r\n\t\treturn extensions.get( 'OES_texture_float' );\r\n\r\n\t};\r\n\r\n\tthis.supportsHalfFloatTextures = function () {\r\n\r\n\t\tconsole.warn( 'THREE.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get( \\'OES_texture_half_float\\' ).' );\r\n\t\treturn extensions.get( 'OES_texture_half_float' );\r\n\r\n\t};\r\n\r\n\tthis.supportsStandardDerivatives = function () {\r\n\r\n\t\tconsole.warn( 'THREE.WebGLRenderer: .supportsStandardDerivatives() is now .extensions.get( \\'OES_standard_derivatives\\' ).' );\r\n\t\treturn extensions.get( 'OES_standard_derivatives' );\r\n\r\n\t};\r\n\r\n\tthis.supportsCompressedTextureS3TC = function () {\r\n\r\n\t\tconsole.warn( 'THREE.WebGLRenderer: .supportsCompressedTextureS3TC() is now .extensions.get( \\'WEBGL_compressed_texture_s3tc\\' ).' );\r\n\t\treturn extensions.get( 'WEBGL_compressed_texture_s3tc' );\r\n\r\n\t};\r\n\r\n\tthis.supportsCompressedTexturePVRTC = function () {\r\n\r\n\t\tconsole.warn( 'THREE.WebGLRenderer: .supportsCompressedTexturePVRTC() is now .extensions.get( \\'WEBGL_compressed_texture_pvrtc\\' ).' );\r\n\t\treturn extensions.get( 'WEBGL_compressed_texture_pvrtc' );\r\n\r\n\t};\r\n\r\n\tthis.supportsBlendMinMax = function () {\r\n\r\n\t\tconsole.warn( 'THREE.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get( \\'EXT_blend_minmax\\' ).' );\r\n\t\treturn extensions.get( 'EXT_blend_minmax' );\r\n\r\n\t};\r\n\r\n\tthis.supportsVertexTextures = function () {\r\n\r\n\t\treturn capabilities.vertexTextures;\r\n\r\n\t};\r\n\r\n\tthis.supportsInstancedArrays = function () {\r\n\r\n\t\tconsole.warn( 'THREE.WebGLRenderer: .supportsInstancedArrays() is now .extensions.get( \\'ANGLE_instanced_arrays\\' ).' );\r\n\t\treturn extensions.get( 'ANGLE_instanced_arrays' );\r\n\r\n\t};\r\n\r\n\t//\r\n\r\n\tthis.initMaterial = function () {\r\n\r\n\t\tconsole.warn( 'THREE.WebGLRenderer: .initMaterial() has been removed.' );\r\n\r\n\t};\r\n\r\n\tthis.addPrePlugin = function () {\r\n\r\n\t\tconsole.warn( 'THREE.WebGLRenderer: .addPrePlugin() has been removed.' );\r\n\r\n\t};\r\n\r\n\tthis.addPostPlugin = function () {\r\n\r\n\t\tconsole.warn( 'THREE.WebGLRenderer: .addPostPlugin() has been removed.' );\r\n\r\n\t};\r\n\r\n\tthis.updateShadowMap = function () {\r\n\r\n\t\tconsole.warn( 'THREE.WebGLRenderer: .updateShadowMap() has been removed.' );\r\n\r\n\t};\r\n\r\n\tObject.defineProperties( this, {\r\n\t\tshadowMapEnabled: {\r\n\t\t\tget: function () {\r\n\r\n\t\t\t\treturn shadowMap.enabled;\r\n\r\n\t\t\t},\r\n\t\t\tset: function ( value ) {\r\n\r\n\t\t\t\tconsole.warn( 'THREE.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled.' );\r\n\t\t\t\tshadowMap.enabled = value;\r\n\r\n\t\t\t}\r\n\t\t},\r\n\t\tshadowMapType: {\r\n\t\t\tget: function () {\r\n\r\n\t\t\t\treturn shadowMap.type;\r\n\r\n\t\t\t},\r\n\t\t\tset: function ( value ) {\r\n\r\n\t\t\t\tconsole.warn( 'THREE.WebGLRenderer: .shadowMapType is now .shadowMap.type.' );\r\n\t\t\t\tshadowMap.type = value;\r\n\r\n\t\t\t}\r\n\t\t},\r\n\t\tshadowMapCullFace: {\r\n\t\t\tget: function () {\r\n\r\n\t\t\t\treturn shadowMap.cullFace;\r\n\r\n\t\t\t},\r\n\t\t\tset: function ( value ) {\r\n\r\n\t\t\t\tconsole.warn( 'THREE.WebGLRenderer: .shadowMapCullFace is now .shadowMap.cullFace.' );\r\n\t\t\t\tshadowMap.cullFace = value;\r\n\r\n\t\t\t}\r\n\t\t},\r\n\t\tshadowMapDebug: {\r\n\t\t\tget: function () {\r\n\r\n\t\t\t\treturn shadowMap.debug;\r\n\r\n\t\t\t},\r\n\t\t\tset: function ( value ) {\r\n\r\n\t\t\t\tconsole.warn( 'THREE.WebGLRenderer: .shadowMapDebug is now .shadowMap.debug.' );\r\n\t\t\t\tshadowMap.debug = value;\r\n\r\n\t\t\t}\r\n\t\t}\r\n\t} );\r\n\r\n};\r\n\r\n// File:src/renderers/WebGLRenderTarget.js\r\n\r\n/**\r\n * @author szimek / https://github.com/szimek/\r\n * @author alteredq / http://alteredqualia.com/\r\n */\r\n\r\nTHREE.WebGLRenderTarget = function ( width, height, options ) {\r\n\r\n\tthis.uuid = THREE.Math.generateUUID();\r\n\r\n\tthis.width = width;\r\n\tthis.height = height;\r\n\r\n\toptions = options || {};\r\n\r\n\tthis.wrapS = options.wrapS !== undefined ? options.wrapS : THREE.ClampToEdgeWrapping;\r\n\tthis.wrapT = options.wrapT !== undefined ? options.wrapT : THREE.ClampToEdgeWrapping;\r\n\r\n\tthis.magFilter = options.magFilter !== undefined ? options.magFilter : THREE.LinearFilter;\r\n\tthis.minFilter = options.minFilter !== undefined ? options.minFilter : THREE.LinearMipMapLinearFilter;\r\n\r\n\tthis.anisotropy = options.anisotropy !== undefined ? options.anisotropy : 1;\r\n\r\n\tthis.offset = new THREE.Vector2( 0, 0 );\r\n\tthis.repeat = new THREE.Vector2( 1, 1 );\r\n\r\n\tthis.format = options.format !== undefined ? options.format : THREE.RGBAFormat;\r\n\tthis.type = options.type !== undefined ? options.type : THREE.UnsignedByteType;\r\n\r\n\tthis.depthBuffer = options.depthBuffer !== undefined ? options.depthBuffer : true;\r\n\tthis.stencilBuffer = options.stencilBuffer !== undefined ? options.stencilBuffer : true;\r\n\r\n\tthis.generateMipmaps = true;\r\n\r\n\tthis.shareDepthFrom = options.shareDepthFrom !== undefined ? options.shareDepthFrom : null;\r\n\r\n};\r\n\r\nTHREE.WebGLRenderTarget.prototype = {\r\n\r\n\tconstructor: THREE.WebGLRenderTarget,\r\n\r\n\tsetSize: function ( width, height ) {\r\n\r\n\t\tif ( this.width !== width || this.height !== height ) {\r\n\r\n\t\t\tthis.width = width;\r\n\t\t\tthis.height = height;\r\n\r\n\t\t\tthis.dispose();\r\n\r\n\t\t}\r\n\r\n\t},\r\n\r\n\tclone: function () {\r\n\r\n\t\treturn new this.constructor().copy( this );\r\n\r\n\t},\r\n\r\n\tcopy: function ( source ) {\r\n\r\n\t\tthis.width = source.width;\r\n\t\tthis.height = source.height;\r\n\r\n\t\tthis.wrapS = source.wrapS;\r\n\t\tthis.wrapT = source.wrapT;\r\n\r\n\t\tthis.magFilter = source.magFilter;\r\n\t\tthis.minFilter = source.minFilter;\r\n\r\n\t\tthis.anisotropy = source.anisotropy;\r\n\r\n\t\tthis.offset.copy( source.offset );\r\n\t\tthis.repeat.copy( source.repeat );\r\n\r\n\t\tthis.format = source.format;\r\n\t\tthis.type = source.type;\r\n\r\n\t\tthis.depthBuffer = source.depthBuffer;\r\n\t\tthis.stencilBuffer = source.stencilBuffer;\r\n\r\n\t\tthis.generateMipmaps = source.generateMipmaps;\r\n\r\n\t\tthis.shareDepthFrom = source.shareDepthFrom;\r\n\r\n\t\treturn this;\r\n\r\n\t},\r\n\r\n\tdispose: function () {\r\n\r\n\t\tthis.dispatchEvent( { type: 'dispose' } );\r\n\r\n\t}\r\n\r\n};\r\n\r\nTHREE.EventDispatcher.prototype.apply( THREE.WebGLRenderTarget.prototype );\r\n\r\n// File:src/renderers/WebGLRenderTargetCube.js\r\n\r\n/**\r\n * @author alteredq / http://alteredqualia.com\r\n */\r\n\r\nTHREE.WebGLRenderTargetCube = function ( width, height, options ) {\r\n\r\n\tTHREE.WebGLRenderTarget.call( this, width, height, options );\r\n\r\n\tthis.activeCubeFace = 0; // PX 0, NX 1, PY 2, NY 3, PZ 4, NZ 5\r\n\r\n};\r\n\r\nTHREE.WebGLRenderTargetCube.prototype = Object.create( THREE.WebGLRenderTarget.prototype );\r\nTHREE.WebGLRenderTargetCube.prototype.constructor = THREE.WebGLRenderTargetCube;\r\n\r\n// File:src/renderers/webgl/WebGLBufferRenderer.js\r\n\r\n/**\r\n* @author mrdoob / http://mrdoob.com/\r\n*/\r\n\r\nTHREE.WebGLBufferRenderer = function ( _gl, extensions, _infoRender ) {\r\n\r\n\tvar mode;\r\n\r\n\tfunction setMode( value ) {\r\n\r\n\t\tmode = value;\r\n\r\n\t}\r\n\r\n\tfunction render( start, count ) {\r\n\r\n\t\t_gl.drawArrays( mode, start, count );\r\n\r\n\t\t_infoRender.calls ++;\r\n\t\t_infoRender.vertices += count;\r\n\t\tif ( mode === _gl.TRIANGLES ) _infoRender.faces += count / 3;\r\n\r\n\t}\r\n\r\n\tfunction renderInstances( geometry ) {\r\n\r\n\t\tvar extension = extensions.get( 'ANGLE_instanced_arrays' );\r\n\r\n\t\tif ( extension === null ) {\r\n\r\n\t\t\tconsole.error( 'THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.' );\r\n\t\t\treturn;\r\n\r\n\t\t}\r\n\r\n\t\tvar position = geometry.attributes.position;\r\n\r\n\t\tif ( position instanceof THREE.InterleavedBufferAttribute ) {\r\n\r\n\t\t\textension.drawArraysInstancedANGLE( mode, 0, position.data.count, geometry.maxInstancedCount );\r\n\r\n\t\t} else {\r\n\r\n\t\t\textension.drawArraysInstancedANGLE( mode, 0, position.count, geometry.maxInstancedCount );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tthis.setMode = setMode;\r\n\tthis.render = render;\r\n\tthis.renderInstances = renderInstances;\r\n\r\n};\r\n\r\n// File:src/renderers/webgl/WebGLIndexedBufferRenderer.js\r\n\r\n/**\r\n* @author mrdoob / http://mrdoob.com/\r\n*/\r\n\r\nTHREE.WebGLIndexedBufferRenderer = function ( _gl, extensions, _infoRender ) {\r\n\r\n\tvar mode;\r\n\r\n\tfunction setMode( value ) {\r\n\r\n\t\tmode = value;\r\n\r\n\t}\r\n\r\n\tvar type, size;\r\n\r\n\tfunction setIndex( index ) {\r\n\r\n\t\tif ( index.array instanceof Uint32Array && extensions.get( 'OES_element_index_uint' ) ) {\r\n\r\n\t\t\ttype = _gl.UNSIGNED_INT;\r\n\t\t\tsize = 4;\r\n\r\n\t\t} else {\r\n\r\n\t\t\ttype = _gl.UNSIGNED_SHORT;\r\n\t\t\tsize = 2;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tfunction render( start, count ) {\r\n\r\n\t\t_gl.drawElements( mode, count, type, start * size );\r\n\r\n\t\t_infoRender.calls ++;\r\n\t\t_infoRender.vertices += count;\r\n\t\tif ( mode === _gl.TRIANGLES ) _infoRender.faces += count / 3;\r\n\r\n\t}\r\n\r\n\tfunction renderInstances( geometry ) {\r\n\r\n\t\tvar extension = extensions.get( 'ANGLE_instanced_arrays' );\r\n\r\n\t\tif ( extension === null ) {\r\n\r\n\t\t\tconsole.error( 'THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.' );\r\n\t\t\treturn;\r\n\r\n\t\t}\r\n\r\n\t\tvar index = geometry.index;\r\n\r\n\t\textension.drawElementsInstancedANGLE( mode, index.array.length, type, 0, geometry.maxInstancedCount );\r\n\r\n\t}\r\n\r\n\tthis.setMode = setMode;\r\n\tthis.setIndex = setIndex;\r\n\tthis.render = render;\r\n\tthis.renderInstances = renderInstances;\r\n\r\n};\r\n\r\n// File:src/renderers/webgl/WebGLExtensions.js\r\n\r\n/**\r\n* @author mrdoob / http://mrdoob.com/\r\n*/\r\n\r\nTHREE.WebGLExtensions = function ( gl ) {\r\n\r\n\tvar extensions = {};\r\n\r\n\tthis.get = function ( name ) {\r\n\r\n\t\tif ( extensions[ name ] !== undefined ) {\r\n\r\n\t\t\treturn extensions[ name ];\r\n\r\n\t\t}\r\n\r\n\t\tvar extension;\r\n\r\n\t\tswitch ( name ) {\r\n\r\n\t\t\tcase 'EXT_texture_filter_anisotropic':\r\n\t\t\t\textension = gl.getExtension( 'EXT_texture_filter_anisotropic' ) || gl.getExtension( 'MOZ_EXT_texture_filter_anisotropic' ) || gl.getExtension( 'WEBKIT_EXT_texture_filter_anisotropic' );\r\n\t\t\t\tbreak;\r\n\r\n\t\t\tcase 'WEBGL_compressed_texture_s3tc':\r\n\t\t\t\textension = gl.getExtension( 'WEBGL_compressed_texture_s3tc' ) || gl.getExtension( 'MOZ_WEBGL_compressed_texture_s3tc' ) || gl.getExtension( 'WEBKIT_WEBGL_compressed_texture_s3tc' );\r\n\t\t\t\tbreak;\r\n\r\n\t\t\tcase 'WEBGL_compressed_texture_pvrtc':\r\n\t\t\t\textension = gl.getExtension( 'WEBGL_compressed_texture_pvrtc' ) || gl.getExtension( 'WEBKIT_WEBGL_compressed_texture_pvrtc' );\r\n\t\t\t\tbreak;\r\n\r\n\t\t\tdefault:\r\n\t\t\t\textension = gl.getExtension( name );\r\n\r\n\t\t}\r\n\r\n\t\tif ( extension === null ) {\r\n\r\n\t\t\tconsole.warn( 'THREE.WebGLRenderer: ' + name + ' extension not supported.' );\r\n\r\n\t\t}\r\n\r\n\t\textensions[ name ] = extension;\r\n\r\n\t\treturn extension;\r\n\r\n\t};\r\n\r\n};\r\n\r\n// File:src/renderers/webgl/WebGLCapabilities.js\r\n\r\nTHREE.WebGLCapabilities = function ( gl, extensions, parameters ) {\r\n\r\n\tfunction getMaxPrecision( precision ) {\r\n\r\n\t\tif ( precision === 'highp' ) {\r\n\r\n\t\t\tif ( gl.getShaderPrecisionFormat( gl.VERTEX_SHADER, gl.HIGH_FLOAT ).precision > 0 &&\r\n\t\t\t gl.getShaderPrecisionFormat( gl.FRAGMENT_SHADER, gl.HIGH_FLOAT ).precision > 0 ) {\r\n\r\n\t\t\t\treturn 'highp';\r\n\r\n\t\t\t}\r\n\r\n\t\t\tprecision = 'mediump';\r\n\r\n\t\t}\r\n\r\n\t\tif ( precision === 'mediump' ) {\r\n\r\n\t\t\tif ( gl.getShaderPrecisionFormat( gl.VERTEX_SHADER, gl.MEDIUM_FLOAT ).precision > 0 &&\r\n\t\t\t gl.getShaderPrecisionFormat( gl.FRAGMENT_SHADER, gl.MEDIUM_FLOAT ).precision > 0 ) {\r\n\r\n\t\t\t\treturn 'mediump';\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn 'lowp';\r\n\r\n\t}\r\n\r\n\tthis.getMaxPrecision = getMaxPrecision;\r\n\r\n\tthis.precision = parameters.precision !== undefined ? parameters.precision : 'highp',\r\n\tthis.logarithmicDepthBuffer = parameters.logarithmicDepthBuffer !== undefined ? parameters.logarithmicDepthBuffer : false;\r\n\r\n\tthis.maxTextures = gl.getParameter( gl.MAX_TEXTURE_IMAGE_UNITS );\r\n\tthis.maxVertexTextures = gl.getParameter( gl.MAX_VERTEX_TEXTURE_IMAGE_UNITS );\r\n\tthis.maxTextureSize = gl.getParameter( gl.MAX_TEXTURE_SIZE );\r\n\tthis.maxCubemapSize = gl.getParameter( gl.MAX_CUBE_MAP_TEXTURE_SIZE );\r\n\r\n\tthis.maxAttributes = gl.getParameter( gl.MAX_VERTEX_ATTRIBS );\r\n\tthis.maxVertexUniforms = gl.getParameter( gl.MAX_VERTEX_UNIFORM_VECTORS );\r\n\tthis.maxVaryings = gl.getParameter( gl.MAX_VARYING_VECTORS );\r\n\tthis.maxFragmentUniforms = gl.getParameter( gl.MAX_FRAGMENT_UNIFORM_VECTORS );\r\n\r\n\tthis.vertexTextures = this.maxVertexTextures > 0;\r\n\tthis.floatFragmentTextures = !! extensions.get( 'OES_texture_float' );\r\n\tthis.floatVertexTextures = this.vertexTextures && this.floatFragmentTextures;\r\n\r\n\tvar _maxPrecision = getMaxPrecision( this.precision );\r\n\r\n\tif ( _maxPrecision !== this.precision ) {\r\n\r\n\t\tconsole.warn( 'THREE.WebGLRenderer:', this.precision, 'not supported, using', _maxPrecision, 'instead.' );\r\n\t\tthis.precision = _maxPrecision;\r\n\r\n\t}\r\n\r\n\tif ( this.logarithmicDepthBuffer ) {\r\n\r\n\t\tthis.logarithmicDepthBuffer = !! extensions.get( 'EXT_frag_depth' );\r\n\r\n\t}\r\n\r\n};\r\n\r\n// File:src/renderers/webgl/WebGLGeometries.js\r\n\r\n/**\r\n* @author mrdoob / http://mrdoob.com/\r\n*/\r\n\r\nTHREE.WebGLGeometries = function ( gl, properties, info ) {\r\n\r\n\tvar geometries = {};\r\n\r\n\tfunction get( object ) {\r\n\r\n\t\tvar geometry = object.geometry;\r\n\r\n\t\tif ( geometries[ geometry.id ] !== undefined ) {\r\n\r\n\t\t\treturn geometries[ geometry.id ];\r\n\r\n\t\t}\r\n\r\n\t\tgeometry.addEventListener( 'dispose', onGeometryDispose );\r\n\r\n\t\tvar buffergeometry;\r\n\r\n\t\tif ( geometry instanceof THREE.BufferGeometry ) {\r\n\r\n\t\t\tbuffergeometry = geometry;\r\n\r\n\t\t} else if ( geometry instanceof THREE.Geometry ) {\r\n\r\n\t\t\tif ( geometry._bufferGeometry === undefined ) {\r\n\r\n\t\t\t\tgeometry._bufferGeometry = new THREE.BufferGeometry().setFromObject( object );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tbuffergeometry = geometry._bufferGeometry;\r\n\r\n\t\t}\r\n\r\n\t\tgeometries[ geometry.id ] = buffergeometry;\r\n\r\n\t\tinfo.memory.geometries ++;\r\n\r\n\t\treturn buffergeometry;\r\n\r\n\t}\r\n\r\n\tfunction onGeometryDispose( event ) {\r\n\r\n\t\tvar geometry = event.target;\r\n\t\tvar buffergeometry = geometries[ geometry.id ];\r\n\r\n\t\tdeleteAttributes( buffergeometry.attributes );\r\n\r\n\t\tgeometry.removeEventListener( 'dispose', onGeometryDispose );\r\n\r\n\t\tdelete geometries[ geometry.id ];\r\n\r\n\t\tvar property = properties.get( geometry );\r\n\t\tif ( property.wireframe ) deleteAttribute( property.wireframe );\r\n\r\n\t\tinfo.memory.geometries --;\r\n\r\n\t}\r\n\r\n\tfunction getAttributeBuffer( attribute ) {\r\n\r\n\t\tif ( attribute instanceof THREE.InterleavedBufferAttribute ) {\r\n\r\n\t\t\treturn properties.get( attribute.data ).__webglBuffer;\r\n\r\n\t\t}\r\n\r\n\t\treturn properties.get( attribute ).__webglBuffer;\r\n\r\n\t}\r\n\r\n\tfunction deleteAttribute( attribute ) {\r\n\r\n\t\tvar buffer = getAttributeBuffer( attribute );\r\n\r\n\t\tif ( buffer !== undefined ) {\r\n\r\n\t\t\tgl.deleteBuffer( buffer );\r\n\t\t\tremoveAttributeBuffer( attribute );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tfunction deleteAttributes( attributes ) {\r\n\r\n\t\tfor ( var name in attributes ) {\r\n\r\n\t\t\tdeleteAttribute( attributes[ name ] );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tfunction removeAttributeBuffer( attribute ) {\r\n\r\n\t\tif ( attribute instanceof THREE.InterleavedBufferAttribute ) {\r\n\r\n\t\t\tproperties.delete( attribute.data );\r\n\r\n\t\t} else {\r\n\r\n\t\t\tproperties.delete( attribute );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tthis.get = get;\r\n\r\n};\r\n\r\n// File:src/renderers/webgl/WebGLObjects.js\r\n\r\n/**\r\n* @author mrdoob / http://mrdoob.com/\r\n*/\r\n\r\nTHREE.WebGLObjects = function ( gl, properties, info ) {\r\n\r\n\tvar geometries = new THREE.WebGLGeometries( gl, properties, info );\r\n\r\n\t//\r\n\r\n\tfunction update( object ) {\r\n\r\n\t\t// TODO: Avoid updating twice (when using shadowMap). Maybe add frame counter.\r\n\r\n\t\tvar geometry = geometries.get( object );\r\n\r\n\t\tif ( object.geometry instanceof THREE.Geometry ) {\r\n\r\n\t\t\tgeometry.updateFromObject( object );\r\n\r\n\t\t}\r\n\r\n\t\tvar index = geometry.index;\r\n\t\tvar attributes = geometry.attributes;\r\n\r\n\t\tif ( index !== null ) {\r\n\r\n\t\t\tupdateAttribute( index, gl.ELEMENT_ARRAY_BUFFER );\r\n\r\n\t\t}\r\n\r\n\t\tfor ( var name in attributes ) {\r\n\r\n\t\t\tupdateAttribute( attributes[ name ], gl.ARRAY_BUFFER );\r\n\r\n\t\t}\r\n\r\n\t\t// morph targets\r\n\r\n\t\tvar morphAttributes = geometry.morphAttributes;\r\n\r\n\t\tfor ( var name in morphAttributes ) {\r\n\r\n\t\t\tvar array = morphAttributes[ name ];\r\n\r\n\t\t\tfor ( var i = 0, l = array.length; i < l; i ++ ) {\r\n\r\n\t\t\t\tupdateAttribute( array[ i ], gl.ARRAY_BUFFER );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn geometry;\r\n\r\n\t}\r\n\r\n\tfunction updateAttribute( attribute, bufferType ) {\r\n\r\n\t\tvar data = ( attribute instanceof THREE.InterleavedBufferAttribute ) ? attribute.data : attribute;\r\n\r\n\t\tvar attributeProperties = properties.get( data );\r\n\r\n\t\tif ( attributeProperties.__webglBuffer === undefined ) {\r\n\r\n\t\t\tcreateBuffer( attributeProperties, data, bufferType );\r\n\r\n\t\t} else if ( attributeProperties.version !== data.version ) {\r\n\r\n\t\t\tupdateBuffer( attributeProperties, data, bufferType );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tfunction createBuffer( attributeProperties, data, bufferType ) {\r\n\r\n\t\tattributeProperties.__webglBuffer = gl.createBuffer();\r\n\t\tgl.bindBuffer( bufferType, attributeProperties.__webglBuffer );\r\n\r\n\t\tvar usage = data.dynamic ? gl.DYNAMIC_DRAW : gl.STATIC_DRAW;\r\n\r\n\t\tgl.bufferData( bufferType, data.array, usage );\r\n\r\n\t\tattributeProperties.version = data.version;\r\n\r\n\t}\r\n\r\n\tfunction updateBuffer( attributeProperties, data, bufferType ) {\r\n\r\n\t\tgl.bindBuffer( bufferType, attributeProperties.__webglBuffer );\r\n\r\n\t\tif ( data.dynamic === false || data.updateRange.count === - 1 ) {\r\n\r\n\t\t\t// Not using update ranges\r\n\r\n\t\t\tgl.bufferSubData( bufferType, 0, data.array );\r\n\r\n\t\t} else if ( data.updateRange.count === 0 ) {\r\n\r\n\t\t\tconsole.error( 'THREE.WebGLObjects.updateBuffer: dynamic THREE.BufferAttribute marked as needsUpdate but updateRange.count is 0, ensure you are using set methods or updating manually.' );\r\n\r\n\t\t} else {\r\n\r\n\t\t\tgl.bufferSubData( bufferType, data.updateRange.offset * data.array.BYTES_PER_ELEMENT,\r\n\t\t\t\t\t\t\t data.array.subarray( data.updateRange.offset, data.updateRange.offset + data.updateRange.count ) );\r\n\r\n\t\t\tdata.updateRange.count = 0; // reset range\r\n\r\n\t\t}\r\n\r\n\t\tattributeProperties.version = data.version;\r\n\r\n\t}\r\n\r\n\tfunction getAttributeBuffer( attribute ) {\r\n\r\n\t\tif ( attribute instanceof THREE.InterleavedBufferAttribute ) {\r\n\r\n\t\t\treturn properties.get( attribute.data ).__webglBuffer;\r\n\r\n\t\t}\r\n\r\n\t\treturn properties.get( attribute ).__webglBuffer;\r\n\r\n\t}\r\n\r\n\tfunction getWireframeAttribute( geometry ) {\r\n\r\n\t\tvar property = properties.get( geometry );\r\n\r\n\t\tif ( property.wireframe !== undefined ) {\r\n\r\n\t\t\treturn property.wireframe;\r\n\r\n\t\t}\r\n\r\n\t\tvar indices = [];\r\n\r\n\t\tvar index = geometry.index;\r\n\t\tvar attributes = geometry.attributes;\r\n\t\tvar position = attributes.position;\r\n\r\n\t\t// console.time( 'wireframe' );\r\n\r\n\t\tif ( index !== null ) {\r\n\r\n\t\t\tvar edges = {};\r\n\t\t\tvar array = index.array;\r\n\r\n\t\t\tfor ( var i = 0, l = array.length; i < l; i += 3 ) {\r\n\r\n\t\t\t\tvar a = array[ i + 0 ];\r\n\t\t\t\tvar b = array[ i + 1 ];\r\n\t\t\t\tvar c = array[ i + 2 ];\r\n\r\n\t\t\t\tif ( checkEdge( edges, a, b ) ) indices.push( a, b );\r\n\t\t\t\tif ( checkEdge( edges, b, c ) ) indices.push( b, c );\r\n\t\t\t\tif ( checkEdge( edges, c, a ) ) indices.push( c, a );\r\n\r\n\t\t\t}\r\n\r\n\t\t} else {\r\n\r\n\t\t\tvar array = attributes.position.array;\r\n\r\n\t\t\tfor ( var i = 0, l = ( array.length / 3 ) - 1; i < l; i += 3 ) {\r\n\r\n\t\t\t\tvar a = i + 0;\r\n\t\t\t\tvar b = i + 1;\r\n\t\t\t\tvar c = i + 2;\r\n\r\n\t\t\t\tindices.push( a, b, b, c, c, a );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\t// console.timeEnd( 'wireframe' );\r\n\r\n\t\tvar TypeArray = position.count > 65535 ? Uint32Array : Uint16Array;\r\n\t\tvar attribute = new THREE.BufferAttribute( new TypeArray( indices ), 1 );\r\n\r\n\t\tupdateAttribute( attribute, gl.ELEMENT_ARRAY_BUFFER );\r\n\r\n\t\tproperty.wireframe = attribute;\r\n\r\n\t\treturn attribute;\r\n\r\n\t}\r\n\r\n\tfunction checkEdge( edges, a, b ) {\r\n\r\n\t\tif ( a > b ) {\r\n\r\n\t\t\tvar tmp = a;\r\n\t\t\ta = b;\r\n\t\t\tb = tmp;\r\n\r\n\t\t}\r\n\r\n\t\tvar list = edges[ a ];\r\n\r\n\t\tif ( list === undefined ) {\r\n\r\n\t\t\tedges[ a ] = [ b ];\r\n\t\t\treturn true;\r\n\r\n\t\t} else if ( list.indexOf( b ) === -1 ) {\r\n\r\n\t\t\tlist.push( b );\r\n\t\t\treturn true;\r\n\r\n\t\t}\r\n\r\n\t\treturn false;\r\n\r\n\t}\r\n\r\n\tthis.getAttributeBuffer = getAttributeBuffer;\r\n\tthis.getWireframeAttribute = getWireframeAttribute;\r\n\r\n\tthis.update = update;\r\n\r\n};\r\n\r\n// File:src/renderers/webgl/WebGLProgram.js\r\n\r\nTHREE.WebGLProgram = ( function () {\r\n\r\n\tvar programIdCount = 0;\r\n\r\n\tfunction generateDefines( defines ) {\r\n\r\n\t\tvar chunks = [];\r\n\r\n\t\tfor ( var name in defines ) {\r\n\r\n\t\t\tvar value = defines[ name ];\r\n\r\n\t\t\tif ( value === false ) continue;\r\n\r\n\t\t\tchunks.push( '#define ' + name + ' ' + value );\r\n\r\n\t\t}\r\n\r\n\t\treturn chunks.join( '\\n' );\r\n\r\n\t}\r\n\r\n\tfunction fetchUniformLocations( gl, program, identifiers ) {\r\n\r\n\t\tvar uniforms = {};\r\n\r\n\t\tvar n = gl.getProgramParameter( program, gl.ACTIVE_UNIFORMS );\r\n\r\n\t\tfor ( var i = 0; i < n; i ++ ) {\r\n\r\n\t\t\tvar info = gl.getActiveUniform( program, i );\r\n\t\t\tvar name = info.name;\r\n\t\t\tvar location = gl.getUniformLocation( program, name );\r\n\r\n\t\t\t// console.log(\"THREE.WebGLProgram: ACTIVE UNIFORM:\", name);\r\n\r\n\t\t\tvar suffixPos = name.lastIndexOf( '[0]' );\r\n\t\t\tif ( suffixPos !== - 1 && suffixPos === name.length - 3 ) {\r\n\r\n\t\t\t\tuniforms[ name.substr( 0, suffixPos ) ] = location;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tuniforms[ name ] = location;\r\n\r\n\t\t}\r\n\r\n\t\treturn uniforms;\r\n\r\n\t}\r\n\r\n\tfunction fetchAttributeLocations( gl, program, identifiers ) {\r\n\r\n\t\tvar attributes = {};\r\n\r\n\t\tvar n = gl.getProgramParameter( program, gl.ACTIVE_ATTRIBUTES );\r\n\r\n\t\tfor ( var i = 0; i < n; i ++ ) {\r\n\r\n\t\t\tvar info = gl.getActiveAttrib( program, i );\r\n\t\t\tvar name = info.name;\r\n\r\n\t\t\t// console.log(\"THREE.WebGLProgram: ACTIVE VERTEX ATTRIBUTE:\", name, i );\r\n\r\n\t\t\tattributes[ name ] = gl.getAttribLocation( program, name );\r\n\r\n\t\t}\r\n\r\n\t\treturn attributes;\r\n\r\n\t}\r\n\r\n\tfunction filterEmptyLine( string ) {\r\n\r\n\t\treturn string !== '';\r\n\r\n\t}\r\n\r\n\treturn function WebGLProgram( renderer, code, material, parameters ) {\r\n\r\n\t\tvar gl = renderer.context;\r\n\r\n\t\tvar defines = material.defines;\r\n\r\n\t\tvar vertexShader = material.__webglShader.vertexShader;\r\n\t\tvar fragmentShader = material.__webglShader.fragmentShader;\r\n\r\n\t\tvar shadowMapTypeDefine = 'SHADOWMAP_TYPE_BASIC';\r\n\r\n\t\tif ( parameters.shadowMapType === THREE.PCFShadowMap ) {\r\n\r\n\t\t\tshadowMapTypeDefine = 'SHADOWMAP_TYPE_PCF';\r\n\r\n\t\t} else if ( parameters.shadowMapType === THREE.PCFSoftShadowMap ) {\r\n\r\n\t\t\tshadowMapTypeDefine = 'SHADOWMAP_TYPE_PCF_SOFT';\r\n\r\n\t\t}\r\n\r\n\t\tvar envMapTypeDefine = 'ENVMAP_TYPE_CUBE';\r\n\t\tvar envMapModeDefine = 'ENVMAP_MODE_REFLECTION';\r\n\t\tvar envMapBlendingDefine = 'ENVMAP_BLENDING_MULTIPLY';\r\n\r\n\t\tif ( parameters.envMap ) {\r\n\r\n\t\t\tswitch ( material.envMap.mapping ) {\r\n\r\n\t\t\t\tcase THREE.CubeReflectionMapping:\r\n\t\t\t\tcase THREE.CubeRefractionMapping:\r\n\t\t\t\t\tenvMapTypeDefine = 'ENVMAP_TYPE_CUBE';\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase THREE.EquirectangularReflectionMapping:\r\n\t\t\t\tcase THREE.EquirectangularRefractionMapping:\r\n\t\t\t\t\tenvMapTypeDefine = 'ENVMAP_TYPE_EQUIREC';\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase THREE.SphericalReflectionMapping:\r\n\t\t\t\t\tenvMapTypeDefine = 'ENVMAP_TYPE_SPHERE';\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tswitch ( material.envMap.mapping ) {\r\n\r\n\t\t\t\tcase THREE.CubeRefractionMapping:\r\n\t\t\t\tcase THREE.EquirectangularRefractionMapping:\r\n\t\t\t\t\tenvMapModeDefine = 'ENVMAP_MODE_REFRACTION';\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tswitch ( material.combine ) {\r\n\r\n\t\t\t\tcase THREE.MultiplyOperation:\r\n\t\t\t\t\tenvMapBlendingDefine = 'ENVMAP_BLENDING_MULTIPLY';\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase THREE.MixOperation:\r\n\t\t\t\t\tenvMapBlendingDefine = 'ENVMAP_BLENDING_MIX';\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase THREE.AddOperation:\r\n\t\t\t\t\tenvMapBlendingDefine = 'ENVMAP_BLENDING_ADD';\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tvar gammaFactorDefine = ( renderer.gammaFactor > 0 ) ? renderer.gammaFactor : 1.0;\r\n\r\n\t\t// console.log( 'building new program ' );\r\n\r\n\t\t//\r\n\r\n\t\tvar customDefines = generateDefines( defines );\r\n\r\n\t\t//\r\n\r\n\t\tvar program = gl.createProgram();\r\n\r\n\t\tvar prefixVertex, prefixFragment;\r\n\r\n\t\tif ( material instanceof THREE.RawShaderMaterial ) {\r\n\r\n\t\t\tprefixVertex = '';\r\n\t\t\tprefixFragment = '';\r\n\r\n\t\t} else {\r\n\r\n\t\t\tprefixVertex = [\r\n\r\n\t\t\t\t'precision ' + parameters.precision + ' float;',\r\n\t\t\t\t'precision ' + parameters.precision + ' int;',\r\n\r\n\t\t\t\t'#define SHADER_NAME ' + material.__webglShader.name,\r\n\r\n\t\t\t\tcustomDefines,\r\n\r\n\t\t\t\tparameters.supportsVertexTextures ? '#define VERTEX_TEXTURES' : '',\r\n\r\n\t\t\t\trenderer.gammaInput ? '#define GAMMA_INPUT' : '',\r\n\t\t\t\trenderer.gammaOutput ? '#define GAMMA_OUTPUT' : '',\r\n\t\t\t\t'#define GAMMA_FACTOR ' + gammaFactorDefine,\r\n\r\n\t\t\t\t'#define MAX_DIR_LIGHTS ' + parameters.maxDirLights,\r\n\t\t\t\t'#define MAX_POINT_LIGHTS ' + parameters.maxPointLights,\r\n\t\t\t\t'#define MAX_SPOT_LIGHTS ' + parameters.maxSpotLights,\r\n\t\t\t\t'#define MAX_HEMI_LIGHTS ' + parameters.maxHemiLights,\r\n\r\n\t\t\t\t'#define MAX_SHADOWS ' + parameters.maxShadows,\r\n\r\n\t\t\t\t'#define MAX_BONES ' + parameters.maxBones,\r\n\r\n\t\t\t\tparameters.map ? '#define USE_MAP' : '',\r\n\t\t\t\tparameters.envMap ? '#define USE_ENVMAP' : '',\r\n\t\t\t\tparameters.envMap ? '#define ' + envMapModeDefine : '',\r\n\t\t\t\tparameters.lightMap ? '#define USE_LIGHTMAP' : '',\r\n\t\t\t\tparameters.aoMap ? '#define USE_AOMAP' : '',\r\n\t\t\t\tparameters.emissiveMap ? '#define USE_EMISSIVEMAP' : '',\r\n\t\t\t\tparameters.bumpMap ? '#define USE_BUMPMAP' : '',\r\n\t\t\t\tparameters.normalMap ? '#define USE_NORMALMAP' : '',\r\n\t\t\t\tparameters.displacementMap && parameters.supportsVertexTextures ? '#define USE_DISPLACEMENTMAP' : '',\r\n\t\t\t\tparameters.specularMap ? '#define USE_SPECULARMAP' : '',\r\n\t\t\t\tparameters.alphaMap ? '#define USE_ALPHAMAP' : '',\r\n\t\t\t\tparameters.vertexColors ? '#define USE_COLOR' : '',\r\n\r\n\t\t\t\tparameters.flatShading ? '#define FLAT_SHADED' : '',\r\n\r\n\t\t\t\tparameters.skinning ? '#define USE_SKINNING' : '',\r\n\t\t\t\tparameters.useVertexTexture ? '#define BONE_TEXTURE' : '',\r\n\r\n\t\t\t\tparameters.morphTargets ? '#define USE_MORPHTARGETS' : '',\r\n\t\t\t\tparameters.morphNormals && parameters.flatShading === false ? '#define USE_MORPHNORMALS' : '',\r\n\t\t\t\tparameters.doubleSided ? '#define DOUBLE_SIDED' : '',\r\n\t\t\t\tparameters.flipSided ? '#define FLIP_SIDED' : '',\r\n\r\n\t\t\t\tparameters.shadowMapEnabled ? '#define USE_SHADOWMAP' : '',\r\n\t\t\t\tparameters.shadowMapEnabled ? '#define ' + shadowMapTypeDefine : '',\r\n\t\t\t\tparameters.shadowMapDebug ? '#define SHADOWMAP_DEBUG' : '',\r\n\r\n\t\t\t\tparameters.sizeAttenuation ? '#define USE_SIZEATTENUATION' : '',\r\n\r\n\t\t\t\tparameters.logarithmicDepthBuffer ? '#define USE_LOGDEPTHBUF' : '',\r\n\t\t\t\tparameters.logarithmicDepthBuffer && renderer.extensions.get( 'EXT_frag_depth' ) ? '#define USE_LOGDEPTHBUF_EXT' : '',\r\n\r\n\r\n\t\t\t\t'uniform mat4 modelMatrix;',\r\n\t\t\t\t'uniform mat4 modelViewMatrix;',\r\n\t\t\t\t'uniform mat4 projectionMatrix;',\r\n\t\t\t\t'uniform mat4 viewMatrix;',\r\n\t\t\t\t'uniform mat3 normalMatrix;',\r\n\t\t\t\t'uniform vec3 cameraPosition;',\r\n\r\n\t\t\t\t'attribute vec3 position;',\r\n\t\t\t\t'attribute vec3 normal;',\r\n\t\t\t\t'attribute vec2 uv;',\r\n\r\n\t\t\t\t'#ifdef USE_COLOR',\r\n\r\n\t\t\t\t'\tattribute vec3 color;',\r\n\r\n\t\t\t\t'#endif',\r\n\r\n\t\t\t\t'#ifdef USE_MORPHTARGETS',\r\n\r\n\t\t\t\t'\tattribute vec3 morphTarget0;',\r\n\t\t\t\t'\tattribute vec3 morphTarget1;',\r\n\t\t\t\t'\tattribute vec3 morphTarget2;',\r\n\t\t\t\t'\tattribute vec3 morphTarget3;',\r\n\r\n\t\t\t\t'\t#ifdef USE_MORPHNORMALS',\r\n\r\n\t\t\t\t'\t\tattribute vec3 morphNormal0;',\r\n\t\t\t\t'\t\tattribute vec3 morphNormal1;',\r\n\t\t\t\t'\t\tattribute vec3 morphNormal2;',\r\n\t\t\t\t'\t\tattribute vec3 morphNormal3;',\r\n\r\n\t\t\t\t'\t#else',\r\n\r\n\t\t\t\t'\t\tattribute vec3 morphTarget4;',\r\n\t\t\t\t'\t\tattribute vec3 morphTarget5;',\r\n\t\t\t\t'\t\tattribute vec3 morphTarget6;',\r\n\t\t\t\t'\t\tattribute vec3 morphTarget7;',\r\n\r\n\t\t\t\t'\t#endif',\r\n\r\n\t\t\t\t'#endif',\r\n\r\n\t\t\t\t'#ifdef USE_SKINNING',\r\n\r\n\t\t\t\t'\tattribute vec4 skinIndex;',\r\n\t\t\t\t'\tattribute vec4 skinWeight;',\r\n\r\n\t\t\t\t'#endif',\r\n\r\n\t\t\t\t'\\n'\r\n\r\n\t\t\t].filter( filterEmptyLine ).join( '\\n' );\r\n\r\n\t\t\tprefixFragment = [\r\n\r\n\t\t\t\tparameters.bumpMap || parameters.normalMap || parameters.flatShading || material.derivatives ? '#extension GL_OES_standard_derivatives : enable' : '',\r\n\t\t\t\tparameters.logarithmicDepthBuffer && renderer.extensions.get( 'EXT_frag_depth' ) ? '#extension GL_EXT_frag_depth : enable' : '',\r\n\r\n\t\t\t\t'precision ' + parameters.precision + ' float;',\r\n\t\t\t\t'precision ' + parameters.precision + ' int;',\r\n\r\n\t\t\t\t'#define SHADER_NAME ' + material.__webglShader.name,\r\n\r\n\t\t\t\tcustomDefines,\r\n\r\n\t\t\t\t'#define MAX_DIR_LIGHTS ' + parameters.maxDirLights,\r\n\t\t\t\t'#define MAX_POINT_LIGHTS ' + parameters.maxPointLights,\r\n\t\t\t\t'#define MAX_SPOT_LIGHTS ' + parameters.maxSpotLights,\r\n\t\t\t\t'#define MAX_HEMI_LIGHTS ' + parameters.maxHemiLights,\r\n\r\n\t\t\t\t'#define MAX_SHADOWS ' + parameters.maxShadows,\r\n\r\n\t\t\t\tparameters.alphaTest ? '#define ALPHATEST ' + parameters.alphaTest : '',\r\n\r\n\t\t\t\trenderer.gammaInput ? '#define GAMMA_INPUT' : '',\r\n\t\t\t\trenderer.gammaOutput ? '#define GAMMA_OUTPUT' : '',\r\n\t\t\t\t'#define GAMMA_FACTOR ' + gammaFactorDefine,\r\n\r\n\t\t\t\t( parameters.useFog && parameters.fog ) ? '#define USE_FOG' : '',\r\n\t\t\t\t( parameters.useFog && parameters.fogExp ) ? '#define FOG_EXP2' : '',\r\n\r\n\t\t\t\tparameters.map ? '#define USE_MAP' : '',\r\n\t\t\t\tparameters.envMap ? '#define USE_ENVMAP' : '',\r\n\t\t\t\tparameters.envMap ? '#define ' + envMapTypeDefine : '',\r\n\t\t\t\tparameters.envMap ? '#define ' + envMapModeDefine : '',\r\n\t\t\t\tparameters.envMap ? '#define ' + envMapBlendingDefine : '',\r\n\t\t\t\tparameters.lightMap ? '#define USE_LIGHTMAP' : '',\r\n\t\t\t\tparameters.aoMap ? '#define USE_AOMAP' : '',\r\n\t\t\t\tparameters.emissiveMap ? '#define USE_EMISSIVEMAP' : '',\r\n\t\t\t\tparameters.bumpMap ? '#define USE_BUMPMAP' : '',\r\n\t\t\t\tparameters.normalMap ? '#define USE_NORMALMAP' : '',\r\n\t\t\t\tparameters.specularMap ? '#define USE_SPECULARMAP' : '',\r\n\t\t\t\tparameters.alphaMap ? '#define USE_ALPHAMAP' : '',\r\n\t\t\t\tparameters.vertexColors ? '#define USE_COLOR' : '',\r\n\r\n\t\t\t\tparameters.flatShading ? '#define FLAT_SHADED' : '',\r\n\r\n\t\t\t\tparameters.metal ? '#define METAL' : '',\r\n\t\t\t\tparameters.doubleSided ? '#define DOUBLE_SIDED' : '',\r\n\t\t\t\tparameters.flipSided ? '#define FLIP_SIDED' : '',\r\n\r\n\t\t\t\tparameters.shadowMapEnabled ? '#define USE_SHADOWMAP' : '',\r\n\t\t\t\tparameters.shadowMapEnabled ? '#define ' + shadowMapTypeDefine : '',\r\n\t\t\t\tparameters.shadowMapDebug ? '#define SHADOWMAP_DEBUG' : '',\r\n\r\n\t\t\t\tparameters.logarithmicDepthBuffer ? '#define USE_LOGDEPTHBUF' : '',\r\n\t\t\t\tparameters.logarithmicDepthBuffer && renderer.extensions.get( 'EXT_frag_depth' ) ? '#define USE_LOGDEPTHBUF_EXT' : '',\r\n\r\n\t\t\t\t'uniform mat4 viewMatrix;',\r\n\t\t\t\t'uniform vec3 cameraPosition;',\r\n\r\n\t\t\t\t'\\n'\r\n\r\n\t\t\t].filter( filterEmptyLine ).join( '\\n' );\r\n\r\n\t\t}\r\n\r\n\t\tvar vertexGlsl = prefixVertex + vertexShader;\r\n\t\tvar fragmentGlsl = prefixFragment + fragmentShader;\r\n\r\n\t\tvar glVertexShader = THREE.WebGLShader( gl, gl.VERTEX_SHADER, vertexGlsl );\r\n\t\tvar glFragmentShader = THREE.WebGLShader( gl, gl.FRAGMENT_SHADER, fragmentGlsl );\r\n\r\n\t\tgl.attachShader( program, glVertexShader );\r\n\t\tgl.attachShader( program, glFragmentShader );\r\n\r\n\t\t// Force a particular attribute to index 0.\r\n\r\n\t\tif ( material.index0AttributeName !== undefined ) {\r\n\r\n\t\t\tgl.bindAttribLocation( program, 0, material.index0AttributeName );\r\n\r\n\t\t} else if ( parameters.morphTargets === true ) {\r\n\r\n\t\t\t// programs with morphTargets displace position out of attribute 0\r\n\t\t\tgl.bindAttribLocation( program, 0, 'position' );\r\n\r\n\t\t}\r\n\r\n\t\tgl.linkProgram( program );\r\n\r\n\t\tvar programLog = gl.getProgramInfoLog( program );\r\n\t\tvar vertexLog = gl.getShaderInfoLog( glVertexShader );\r\n\t\tvar fragmentLog = gl.getShaderInfoLog( glFragmentShader );\r\n\r\n\t\tvar runnable = true;\r\n\t\tvar haveDiagnostics = true;\r\n\r\n\t\tif ( gl.getProgramParameter( program, gl.LINK_STATUS ) === false ) {\r\n\r\n\t\t\trunnable = false;\r\n\r\n\t\t\tconsole.error( 'THREE.WebGLProgram: shader error: ', gl.getError(), 'gl.VALIDATE_STATUS', gl.getProgramParameter( program, gl.VALIDATE_STATUS ), 'gl.getProgramInfoLog', programLog, vertexLog, fragmentLog );\r\n\r\n\t\t} else if ( programLog !== '' ) {\r\n\r\n\t\t\tconsole.warn( 'THREE.WebGLProgram: gl.getProgramInfoLog()', programLog );\r\n\r\n\t\t} else if ( vertexLog === '' || fragmentLog === '' ) {\r\n\r\n\t\t\thaveDiagnostics = false;\r\n\r\n\t\t}\r\n\r\n\t\tif ( haveDiagnostics ) {\r\n\r\n\t\t\tthis.diagnostics = {\r\n\r\n\t\t\t\trunnable: runnable,\r\n\t\t\t\tmaterial: material,\r\n\r\n\t\t\t\tprogramLog: programLog,\r\n\r\n\t\t\t\tvertexShader: {\r\n\r\n\t\t\t\t\tlog: vertexLog,\r\n\t\t\t\t\tprefix: prefixVertex\r\n\r\n\t\t\t\t},\r\n\r\n\t\t\t\tfragmentShader: {\r\n\r\n\t\t\t\t\tlog: fragmentLog,\r\n\t\t\t\t\tprefix: prefixFragment\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t};\r\n\r\n\t\t}\r\n\r\n\t\t// clean up\r\n\r\n\t\tgl.deleteShader( glVertexShader );\r\n\t\tgl.deleteShader( glFragmentShader );\r\n\r\n\t\t// set up caching for uniform locations\r\n\r\n\t\tvar cachedUniforms;\r\n\r\n\t\tthis.getUniforms = function() {\r\n\r\n\t\t\tif ( cachedUniforms === undefined ) {\r\n\r\n\t\t\t\tcachedUniforms = fetchUniformLocations( gl, program );\r\n\r\n\t\t\t}\r\n\r\n\t\t\treturn cachedUniforms;\r\n\r\n\t\t};\r\n\r\n\t\t// set up caching for attribute locations\r\n\r\n\t\tvar cachedAttributes;\r\n\r\n\t\tthis.getAttributes = function() {\r\n\r\n\t\t\tif ( cachedAttributes === undefined ) {\r\n\r\n\t\t\t\tcachedAttributes = fetchAttributeLocations( gl, program );\r\n\r\n\t\t\t}\r\n\r\n\t\t\treturn cachedAttributes;\r\n\r\n\t\t};\r\n\r\n\t\t// DEPRECATED\r\n\r\n\t\tObject.defineProperties( this, {\r\n\r\n\t\t\tuniforms: {\r\n\t\t\t\tget: function() {\r\n\r\n\t\t\t\t\tconsole.warn( 'THREE.WebGLProgram: .uniforms is now .getUniforms().' );\r\n\t\t\t\t\treturn this.getUniforms();\r\n\r\n\t\t\t\t}\r\n\t\t\t},\r\n\r\n\t\t\tattributes: {\r\n\t\t\t\tget: function() {\r\n\r\n\t\t\t\t\tconsole.warn( 'THREE.WebGLProgram: .attributes is now .getAttributes().' );\r\n\t\t\t\t\treturn this.getAttributes();\r\n\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t} );\r\n\r\n\r\n\t\t//\r\n\r\n\t\tthis.id = programIdCount ++;\r\n\t\tthis.code = code;\r\n\t\tthis.usedTimes = 1;\r\n\t\tthis.program = program;\r\n\t\tthis.vertexShader = glVertexShader;\r\n\t\tthis.fragmentShader = glFragmentShader;\r\n\r\n\t\treturn this;\r\n\r\n\t};\r\n\r\n} )();\r\n\r\n// File:src/renderers/webgl/WebGLPrograms.js\r\n\r\nTHREE.WebGLPrograms = function ( renderer, capabilities ) {\r\n\r\n\tvar programs = [];\r\n\r\n\tvar shaderIDs = {\r\n\t\tMeshDepthMaterial: 'depth',\r\n\t\tMeshNormalMaterial: 'normal',\r\n\t\tMeshBasicMaterial: 'basic',\r\n\t\tMeshLambertMaterial: 'lambert',\r\n\t\tMeshPhongMaterial: 'phong',\r\n\t\tLineBasicMaterial: 'basic',\r\n\t\tLineDashedMaterial: 'dashed',\r\n\t\tPointsMaterial: 'points'\r\n\t};\r\n\r\n\tvar parameterNames = [\r\n\t\t\"precision\", \"supportsVertexTextures\", \"map\", \"envMap\", \"envMapMode\",\r\n\t\t\"lightMap\", \"aoMap\", \"emissiveMap\", \"bumpMap\", \"normalMap\", \"specularMap\",\r\n\t\t\"alphaMap\", \"combine\", \"vertexColors\", \"fog\", \"useFog\", \"fogExp\",\r\n\t\t\"flatShading\", \"sizeAttenuation\", \"logarithmicDepthBuffer\", \"skinning\",\r\n\t\t\"maxBones\", \"useVertexTexture\", \"morphTargets\", \"morphNormals\",\r\n\t\t\"maxMorphTargets\", \"maxMorphNormals\", \"maxDirLights\", \"maxPointLights\",\r\n\t\t\"maxSpotLights\", \"maxHemiLights\", \"maxShadows\", \"shadowMapEnabled\",\r\n\t\t\"shadowMapType\", \"shadowMapDebug\", \"alphaTest\", \"metal\", \"doubleSided\",\r\n\t\t\"flipSided\"\r\n\t];\r\n\r\n\r\n\tfunction allocateBones ( object ) {\r\n\r\n\t\tif ( capabilities.floatVertexTextures && object && object.skeleton && object.skeleton.useVertexTexture ) {\r\n\r\n\t\t\treturn 1024;\r\n\r\n\t\t} else {\r\n\r\n\t\t\t// default for when object is not specified\r\n\t\t\t// ( for example when prebuilding shader to be used with multiple objects )\r\n\t\t\t//\r\n\t\t\t// - leave some extra space for other uniforms\r\n\t\t\t// - limit here is ANGLE's 254 max uniform vectors\r\n\t\t\t// (up to 54 should be safe)\r\n\r\n\t\t\tvar nVertexUniforms = capabilities.maxVertexUniforms;\r\n\t\t\tvar nVertexMatrices = Math.floor( ( nVertexUniforms - 20 ) / 4 );\r\n\r\n\t\t\tvar maxBones = nVertexMatrices;\r\n\r\n\t\t\tif ( object !== undefined && object instanceof THREE.SkinnedMesh ) {\r\n\r\n\t\t\t\tmaxBones = Math.min( object.skeleton.bones.length, maxBones );\r\n\r\n\t\t\t\tif ( maxBones < object.skeleton.bones.length ) {\r\n\r\n\t\t\t\t\tconsole.warn( 'WebGLRenderer: too many bones - ' + object.skeleton.bones.length + ', this GPU supports just ' + maxBones + ' (try OpenGL instead of ANGLE)' );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\treturn maxBones;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tfunction allocateLights( lights ) {\r\n\r\n\t\tvar dirLights = 0;\r\n\t\tvar pointLights = 0;\r\n\t\tvar spotLights = 0;\r\n\t\tvar hemiLights = 0;\r\n\r\n\t\tfor ( var l = 0, ll = lights.length; l < ll; l ++ ) {\r\n\r\n\t\t\tvar light = lights[ l ];\r\n\r\n\t\t\tif ( light.onlyShadow || light.visible === false ) continue;\r\n\r\n\t\t\tif ( light instanceof THREE.DirectionalLight ) dirLights ++;\r\n\t\t\tif ( light instanceof THREE.PointLight ) pointLights ++;\r\n\t\t\tif ( light instanceof THREE.SpotLight ) spotLights ++;\r\n\t\t\tif ( light instanceof THREE.HemisphereLight ) hemiLights ++;\r\n\r\n\t\t}\r\n\r\n\t\treturn { 'directional': dirLights, 'point': pointLights, 'spot': spotLights, 'hemi': hemiLights };\r\n\r\n\t}\r\n\r\n\tfunction allocateShadows( lights ) {\r\n\r\n\t\tvar maxShadows = 0;\r\n\r\n\t\tfor ( var l = 0, ll = lights.length; l < ll; l ++ ) {\r\n\r\n\t\t\tvar light = lights[ l ];\r\n\r\n\t\t\tif ( ! light.castShadow ) continue;\r\n\r\n\t\t\tif ( light instanceof THREE.SpotLight ) maxShadows ++;\r\n\t\t\tif ( light instanceof THREE.DirectionalLight ) maxShadows ++;\r\n\r\n\t\t}\r\n\r\n\t\treturn maxShadows;\r\n\r\n\t}\r\n\r\n\tthis.getParameters = function ( material, lights, fog, object ) {\r\n\r\n\t\tvar shaderID = shaderIDs[ material.type ];\r\n\t\t// heuristics to create shader parameters according to lights in the scene\r\n\t\t// (not to blow over maxLights budget)\r\n\r\n\t\tvar maxLightCount = allocateLights( lights );\r\n\t\tvar maxShadows = allocateShadows( lights );\r\n\t\tvar maxBones = allocateBones( object );\r\n\t\tvar precision = renderer.getPrecision();\r\n\r\n\t\tif ( material.precision !== null ) {\r\n\r\n\t\t\tprecision = capabilities.getMaxPrecision( material.precision );\r\n\r\n\t\t\tif ( precision !== material.precision ) {\r\n\r\n\t\t\t\tconsole.warn( 'THREE.WebGLRenderer.initMaterial:', material.precision, 'not supported, using', precision, 'instead.' );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tvar parameters = {\r\n\r\n\t\t\tshaderID: shaderID,\r\n\r\n\t\t\tprecision: precision,\r\n\t\t\tsupportsVertexTextures: capabilities.vertexTextures,\r\n\r\n\t\t\tmap: !! material.map,\r\n\t\t\tenvMap: !! material.envMap,\r\n\t\t\tenvMapMode: material.envMap && material.envMap.mapping,\r\n\t\t\tlightMap: !! material.lightMap,\r\n\t\t\taoMap: !! material.aoMap,\r\n\t\t\temissiveMap: !! material.emissiveMap,\r\n\t\t\tbumpMap: !! material.bumpMap,\r\n\t\t\tnormalMap: !! material.normalMap,\r\n\t\t\tdisplacementMap: !! material.displacementMap,\r\n\t\t\tspecularMap: !! material.specularMap,\r\n\t\t\talphaMap: !! material.alphaMap,\r\n\r\n\t\t\tcombine: material.combine,\r\n\r\n\t\t\tvertexColors: material.vertexColors,\r\n\r\n\t\t\tfog: fog,\r\n\t\t\tuseFog: material.fog,\r\n\t\t\tfogExp: fog instanceof THREE.FogExp2,\r\n\r\n\t\t\tflatShading: material.shading === THREE.FlatShading,\r\n\r\n\t\t\tsizeAttenuation: material.sizeAttenuation,\r\n\t\t\tlogarithmicDepthBuffer: renderer.logarithmicDepthBuffer,\r\n\r\n\t\t\tskinning: material.skinning,\r\n\t\t\tmaxBones: maxBones,\r\n\t\t\tuseVertexTexture: capabilities.floatVertexTextures && object && object.skeleton && object.skeleton.useVertexTexture,\r\n\r\n\t\t\tmorphTargets: material.morphTargets,\r\n\t\t\tmorphNormals: material.morphNormals,\r\n\t\t\tmaxMorphTargets: renderer.maxMorphTargets,\r\n\t\t\tmaxMorphNormals: renderer.maxMorphNormals,\r\n\r\n\t\t\tmaxDirLights: maxLightCount.directional,\r\n\t\t\tmaxPointLights: maxLightCount.point,\r\n\t\t\tmaxSpotLights: maxLightCount.spot,\r\n\t\t\tmaxHemiLights: maxLightCount.hemi,\r\n\r\n\t\t\tmaxShadows: maxShadows,\r\n\t\t\tshadowMapEnabled: renderer.shadowMap.enabled && object.receiveShadow && maxShadows > 0,\r\n\t\t\tshadowMapType: renderer.shadowMap.type,\r\n\t\t\tshadowMapDebug: renderer.shadowMap.debug,\r\n\r\n\t\t\talphaTest: material.alphaTest,\r\n\t\t\tmetal: material.metal,\r\n\t\t\tdoubleSided: material.side === THREE.DoubleSide,\r\n\t\t\tflipSided: material.side === THREE.BackSide\r\n\r\n\t\t};\r\n\r\n\t\treturn parameters;\r\n\r\n\t};\r\n\r\n\tthis.getProgramCode = function ( material, parameters ) {\r\n\r\n\t\tvar chunks = [];\r\n\r\n\t\tif ( parameters.shaderID ) {\r\n\r\n\t\t\tchunks.push( parameters.shaderID );\r\n\r\n\t\t} else {\r\n\r\n\t\t\tchunks.push( material.fragmentShader );\r\n\t\t\tchunks.push( material.vertexShader );\r\n\r\n\t\t}\r\n\r\n\t\tif ( material.defines !== undefined ) {\r\n\r\n\t\t\tfor ( var name in material.defines ) {\r\n\r\n\t\t\t\tchunks.push( name );\r\n\t\t\t\tchunks.push( material.defines[ name ] );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tfor ( var i = 0; i < parameterNames.length; i ++ ) {\r\n\r\n\t\t\tvar parameterName = parameterNames[ i ];\r\n\t\t\tchunks.push( parameterName );\r\n\t\t\tchunks.push( parameters[ parameterName ] );\r\n\r\n\t\t}\r\n\r\n\t\treturn chunks.join();\r\n\r\n\t};\r\n\r\n\tthis.getProgram = function ( material, parameters, code ) {\r\n\r\n\t\tvar program;\r\n\r\n\t\t// Check if code has been already compiled\r\n\t\tfor ( var p = 0, pl = programs.length; p < pl; p ++ ) {\r\n\r\n\t\t\tvar programInfo = programs[ p ];\r\n\r\n\t\t\tif ( programInfo.code === code ) {\r\n\r\n\t\t\t\tprogram = programInfo;\r\n\r\n\t\t\t\tbreak;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tif ( program === undefined ) {\r\n\r\n\t\t\tprogram = new THREE.WebGLProgram( renderer, code, material, parameters );\r\n\t\t\tprograms.push( program );\r\n\r\n\t\t}\r\n\r\n\t\treturn program ;\r\n\r\n\t}\r\n\r\n};\r\n\r\n// File:src/renderers/webgl/WebGLProperties.js\r\n\r\n/**\r\n* @author fordacious / fordacious.github.io\r\n*/\r\n\r\nTHREE.WebGLProperties = function () {\r\n\r\n\tvar properties = {};\r\n\r\n\tthis.get = function ( object ) {\r\n\r\n\t\tvar uuid = object.uuid;\r\n\t\tvar map = properties[ uuid ];\r\n\r\n\t\tif ( map === undefined ) {\r\n\r\n\t\t\tmap = {};\r\n\t\t\tproperties[ uuid ] = map;\r\n\r\n\t\t}\r\n\r\n\t\treturn map;\r\n\r\n\t};\r\n\r\n\tthis.delete = function ( object ) {\r\n\r\n\t\tdelete properties[ object.uuid ];\r\n\r\n\t};\r\n\r\n\tthis.clear = function () {\r\n\r\n\t\tproperties = {};\r\n\r\n\t};\r\n\r\n};\r\n\r\n// File:src/renderers/webgl/WebGLShader.js\r\n\r\nTHREE.WebGLShader = ( function () {\r\n\r\n\tvar addLineNumbers = function ( string ) {\r\n\r\n\t\tvar lines = string.split( '\\n' );\r\n\r\n\t\tfor ( var i = 0; i < lines.length; i ++ ) {\r\n\r\n\t\t\tlines[ i ] = ( i + 1 ) + ': ' + lines[ i ];\r\n\r\n\t\t}\r\n\r\n\t\treturn lines.join( '\\n' );\r\n\r\n\t};\r\n\r\n\treturn function WebGLShader( gl, type, string ) {\r\n\r\n\t\tvar shader = gl.createShader( type );\r\n\r\n\t\tgl.shaderSource( shader, string );\r\n\t\tgl.compileShader( shader );\r\n\r\n\t\tif ( gl.getShaderParameter( shader, gl.COMPILE_STATUS ) === false ) {\r\n\r\n\t\t\tconsole.error( 'THREE.WebGLShader: Shader couldn\\'t compile.' );\r\n\r\n\t\t}\r\n\r\n\t\tif ( gl.getShaderInfoLog( shader ) !== '' ) {\r\n\r\n\t\t\tconsole.warn( 'THREE.WebGLShader: gl.getShaderInfoLog()', type === gl.VERTEX_SHADER ? 'vertex' : 'fragment', gl.getShaderInfoLog( shader ), addLineNumbers( string ) );\r\n\r\n\t\t}\r\n\r\n\t\t// --enable-privileged-webgl-extension\r\n\t\t// console.log( type, gl.getExtension( 'WEBGL_debug_shaders' ).getTranslatedShaderSource( shader ) );\r\n\r\n\t\treturn shader;\r\n\r\n\t};\r\n\r\n} )();\r\n\r\n// File:src/renderers/webgl/WebGLShadowMap.js\r\n\r\n/**\r\n * @author alteredq / http://alteredqualia.com/\r\n * @author mrdoob / http://mrdoob.com/\r\n */\r\n\r\nTHREE.WebGLShadowMap = function ( _renderer, _lights, _objects ) {\r\n\r\n\tvar _gl = _renderer.context,\r\n\t_state = _renderer.state,\r\n\t_frustum = new THREE.Frustum(),\r\n\t_projScreenMatrix = new THREE.Matrix4(),\r\n\r\n\t_min = new THREE.Vector3(),\r\n\t_max = new THREE.Vector3(),\r\n\r\n\t_matrixPosition = new THREE.Vector3(),\r\n\r\n\t_renderList = [];\r\n\r\n\t// init\r\n\r\n\tvar depthShader = THREE.ShaderLib[ \"depthRGBA\" ];\r\n\tvar depthUniforms = THREE.UniformsUtils.clone( depthShader.uniforms );\r\n\r\n\tvar _depthMaterial = new THREE.ShaderMaterial( {\r\n\t\tuniforms: depthUniforms,\r\n\t\tvertexShader: depthShader.vertexShader,\r\n\t\tfragmentShader: depthShader.fragmentShader\r\n\t } );\r\n\r\n\tvar _depthMaterialMorph = new THREE.ShaderMaterial( {\r\n\t\tuniforms: depthUniforms,\r\n\t\tvertexShader: depthShader.vertexShader,\r\n\t\tfragmentShader: depthShader.fragmentShader,\r\n\t\tmorphTargets: true\r\n\t} );\r\n\r\n\tvar _depthMaterialSkin = new THREE.ShaderMaterial( {\r\n\t\tuniforms: depthUniforms,\r\n\t\tvertexShader: depthShader.vertexShader,\r\n\t\tfragmentShader: depthShader.fragmentShader,\r\n\t\tskinning: true\r\n\t} );\r\n\r\n\tvar _depthMaterialMorphSkin = new THREE.ShaderMaterial( {\r\n\t\tuniforms: depthUniforms,\r\n\t\tvertexShader: depthShader.vertexShader,\r\n\t\tfragmentShader: depthShader.fragmentShader,\r\n\t\tmorphTargets: true,\r\n\t\tskinning: true\r\n\t} );\r\n\r\n\t_depthMaterial._shadowPass = true;\r\n\t_depthMaterialMorph._shadowPass = true;\r\n\t_depthMaterialSkin._shadowPass = true;\r\n\t_depthMaterialMorphSkin._shadowPass = true;\r\n\r\n\t//\r\n\r\n\tvar scope = this;\r\n\r\n\tthis.enabled = false;\r\n\r\n\tthis.autoUpdate = true;\r\n\tthis.needsUpdate = false;\r\n\r\n\tthis.type = THREE.PCFShadowMap;\r\n\tthis.cullFace = THREE.CullFaceFront;\r\n\r\n\tthis.render = function ( scene, camera ) {\r\n\r\n\t\tif ( scope.enabled === false ) return;\r\n\t\tif ( scope.autoUpdate === false && scope.needsUpdate === false ) return;\r\n\r\n\t\t// set GL state for depth map\r\n\r\n\t\t_gl.clearColor( 1, 1, 1, 1 );\r\n\t\t_state.disable( _gl.BLEND );\r\n\r\n\t\t_state.enable( _gl.CULL_FACE );\r\n\t\t_gl.frontFace( _gl.CCW );\r\n\r\n\t\tif ( scope.cullFace === THREE.CullFaceFront ) {\r\n\r\n\t\t\t_gl.cullFace( _gl.FRONT );\r\n\r\n\t\t} else {\r\n\r\n\t\t\t_gl.cullFace( _gl.BACK );\r\n\r\n\t\t}\r\n\r\n\t\t_state.setDepthTest( true );\r\n\r\n\t\t// render depth map\r\n\r\n\t\tfor ( var i = 0, il = _lights.length; i < il; i ++ ) {\r\n\r\n\t\t\tvar light = _lights[ i ];\r\n\r\n\t\t\tif ( ! light.castShadow ) continue;\r\n\r\n\t\t\tif ( ! light.shadowMap ) {\r\n\r\n\t\t\t\tvar shadowFilter = THREE.LinearFilter;\r\n\r\n\t\t\t\tif ( scope.type === THREE.PCFSoftShadowMap ) {\r\n\r\n\t\t\t\t\tshadowFilter = THREE.NearestFilter;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tvar pars = { minFilter: shadowFilter, magFilter: shadowFilter, format: THREE.RGBAFormat };\r\n\r\n\t\t\t\tlight.shadowMap = new THREE.WebGLRenderTarget( light.shadowMapWidth, light.shadowMapHeight, pars );\r\n\t\t\t\tlight.shadowMapSize = new THREE.Vector2( light.shadowMapWidth, light.shadowMapHeight );\r\n\r\n\t\t\t\tlight.shadowMatrix = new THREE.Matrix4();\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( ! light.shadowCamera ) {\r\n\r\n\t\t\t\tif ( light instanceof THREE.SpotLight ) {\r\n\r\n\t\t\t\t\tlight.shadowCamera = new THREE.PerspectiveCamera( light.shadowCameraFov, light.shadowMapWidth / light.shadowMapHeight, light.shadowCameraNear, light.shadowCameraFar );\r\n\r\n\t\t\t\t} else if ( light instanceof THREE.DirectionalLight ) {\r\n\r\n\t\t\t\t\tlight.shadowCamera = new THREE.OrthographicCamera( light.shadowCameraLeft, light.shadowCameraRight, light.shadowCameraTop, light.shadowCameraBottom, light.shadowCameraNear, light.shadowCameraFar );\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\tconsole.error( \"THREE.ShadowMapPlugin: Unsupported light type for shadow\", light );\r\n\t\t\t\t\tcontinue;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tscene.add( light.shadowCamera );\r\n\r\n\t\t\t\tif ( scene.autoUpdate === true ) scene.updateMatrixWorld();\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( light.shadowCameraVisible && ! light.cameraHelper ) {\r\n\r\n\t\t\t\tlight.cameraHelper = new THREE.CameraHelper( light.shadowCamera );\r\n\t\t\t\tscene.add( light.cameraHelper );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tvar shadowMap = light.shadowMap;\r\n\t\t\tvar shadowMatrix = light.shadowMatrix;\r\n\t\t\tvar shadowCamera = light.shadowCamera;\r\n\r\n\t\t\t//\r\n\r\n\t\t\tshadowCamera.position.setFromMatrixPosition( light.matrixWorld );\r\n\t\t\t_matrixPosition.setFromMatrixPosition( light.target.matrixWorld );\r\n\t\t\tshadowCamera.lookAt( _matrixPosition );\r\n\t\t\tshadowCamera.updateMatrixWorld();\r\n\r\n\t\t\tshadowCamera.matrixWorldInverse.getInverse( shadowCamera.matrixWorld );\r\n\r\n\t\t\t//\r\n\r\n\t\t\tif ( light.cameraHelper ) light.cameraHelper.visible = light.shadowCameraVisible;\r\n\t\t\tif ( light.shadowCameraVisible ) light.cameraHelper.update();\r\n\r\n\t\t\t// compute shadow matrix\r\n\r\n\t\t\tshadowMatrix.set(\r\n\t\t\t\t0.5, 0.0, 0.0, 0.5,\r\n\t\t\t\t0.0, 0.5, 0.0, 0.5,\r\n\t\t\t\t0.0, 0.0, 0.5, 0.5,\r\n\t\t\t\t0.0, 0.0, 0.0, 1.0\r\n\t\t\t);\r\n\r\n\t\t\tshadowMatrix.multiply( shadowCamera.projectionMatrix );\r\n\t\t\tshadowMatrix.multiply( shadowCamera.matrixWorldInverse );\r\n\r\n\t\t\t// update camera matrices and frustum\r\n\r\n\t\t\t_projScreenMatrix.multiplyMatrices( shadowCamera.projectionMatrix, shadowCamera.matrixWorldInverse );\r\n\t\t\t_frustum.setFromMatrix( _projScreenMatrix );\r\n\r\n\t\t\t// render shadow map\r\n\r\n\t\t\t_renderer.setRenderTarget( shadowMap );\r\n\t\t\t_renderer.clear();\r\n\r\n\t\t\t// set object matrices & frustum culling\r\n\r\n\t\t\t_renderList.length = 0;\r\n\r\n\t\t\tprojectObject( scene, shadowCamera );\r\n\r\n\r\n\t\t\t// render regular objects\r\n\r\n\t\t\tfor ( var j = 0, jl = _renderList.length; j < jl; j ++ ) {\r\n\r\n\t\t\t\tvar object = _renderList[ j ];\r\n\t\t\t\tvar geometry = _objects.update( object );\r\n\t\t\t\tvar material = object.material;\r\n\r\n\t\t\t\tif ( material instanceof THREE.MeshFaceMaterial ) {\r\n\r\n\t\t\t\t\tvar groups = geometry.groups;\r\n\t\t\t\t\tvar materials = material.materials;\r\n\r\n\t\t\t\t\tfor ( var k = 0, kl = groups.length; k < kl; k ++ ) {\r\n\r\n\t\t\t\t\t\tvar group = groups[ k ];\r\n\t\t\t\t\t\tvar groupMaterial = materials[ group.materialIndex ];\r\n\r\n\t\t\t\t\t\tif ( groupMaterial.visible === true ) {\r\n\r\n\t\t\t\t\t\t\t_renderer.renderBufferDirect( shadowCamera, _lights, null, geometry, getDepthMaterial( object, groupMaterial ), object, group );\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\t_renderer.renderBufferDirect( shadowCamera, _lights, null, geometry, getDepthMaterial( object, material ), object );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\t// restore GL state\r\n\r\n\t\tvar clearColor = _renderer.getClearColor(),\r\n\t\tclearAlpha = _renderer.getClearAlpha();\r\n\r\n\t\t_renderer.setClearColor( clearColor, clearAlpha );\r\n\t\t_state.enable( _gl.BLEND );\r\n\r\n\t\tif ( scope.cullFace === THREE.CullFaceFront ) {\r\n\r\n\t\t\t_gl.cullFace( _gl.BACK );\r\n\r\n\t\t}\r\n\r\n\t\t_renderer.resetGLState();\r\n\r\n\t\tscope.needsUpdate = false;\r\n\r\n\t};\r\n\r\n\tfunction getDepthMaterial( object, material ) {\r\n\r\n\t\tvar geometry = object.geometry;\r\n\r\n\t\tvar useMorphing = geometry.morphTargets !== undefined && geometry.morphTargets.length > 0 && material.morphTargets;\r\n\t\tvar useSkinning = object instanceof THREE.SkinnedMesh && material.skinning;\r\n\r\n\t\tvar depthMaterial;\r\n\r\n\t\tif ( object.customDepthMaterial ) {\r\n\r\n\t\t\tdepthMaterial = object.customDepthMaterial;\r\n\r\n\t\t} else if ( useSkinning ) {\r\n\r\n\t\t\tdepthMaterial = useMorphing ? _depthMaterialMorphSkin : _depthMaterialSkin;\r\n\r\n\t\t} else if ( useMorphing ) {\r\n\r\n\t\t\tdepthMaterial = _depthMaterialMorph;\r\n\r\n\t\t} else {\r\n\r\n\t\t\tdepthMaterial = _depthMaterial;\r\n\r\n\t\t}\r\n\r\n\t\tdepthMaterial.visible = material.visible;\r\n\t\tdepthMaterial.wireframe = material.wireframe;\r\n\t\tdepthMaterial.wireframeLinewidth = material.wireframeLinewidth;\r\n\r\n\t\treturn depthMaterial;\r\n\r\n\t}\r\n\r\n\tfunction projectObject( object, camera ) {\r\n\r\n\t\tif ( object.visible === false ) return;\r\n\r\n\t\tif ( object instanceof THREE.Mesh || object instanceof THREE.Line || object instanceof THREE.Points ) {\r\n\r\n\t\t\tif ( object.castShadow && ( object.frustumCulled === false || _frustum.intersectsObject( object ) === true ) ) {\r\n\r\n\t\t\t\tvar material = object.material;\r\n\r\n\t\t\t\tif ( material.visible === true ) {\r\n\r\n\t\t\t\t\tobject.modelViewMatrix.multiplyMatrices( camera.matrixWorldInverse, object.matrixWorld );\r\n\t\t\t\t\t_renderList.push( object );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tvar children = object.children;\r\n\r\n\t\tfor ( var i = 0, l = children.length; i < l; i ++ ) {\r\n\r\n\t\t\tprojectObject( children[ i ], camera );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n};\r\n\r\n// File:src/renderers/webgl/WebGLState.js\r\n\r\n/**\r\n* @author mrdoob / http://mrdoob.com/\r\n*/\r\n\r\nTHREE.WebGLState = function ( gl, extensions, paramThreeToGL ) {\r\n\r\n\tvar _this = this;\r\n\r\n\tvar newAttributes = new Uint8Array( 16 );\r\n\tvar enabledAttributes = new Uint8Array( 16 );\r\n\r\n\tvar capabilities = {};\r\n\r\n\tvar compressedTextureFormats = null;\r\n\r\n\tvar currentBlending = null;\r\n\tvar currentBlendEquation = null;\r\n\tvar currentBlendSrc = null;\r\n\tvar currentBlendDst = null;\r\n\tvar currentBlendEquationAlpha = null;\r\n\tvar currentBlendSrcAlpha = null;\r\n\tvar currentBlendDstAlpha = null;\r\n\r\n\tvar currentDepthFunc = null;\r\n\tvar currentDepthWrite = null;\r\n\r\n\tvar currentColorWrite = null;\r\n\r\n\tvar currentFlipSided = null;\r\n\r\n\tvar currentLineWidth = null;\r\n\r\n\tvar currentPolygonOffsetFactor = null;\r\n\tvar currentPolygonOffsetUnits = null;\r\n\r\n\tvar maxTextures = gl.getParameter( gl.MAX_TEXTURE_IMAGE_UNITS );\r\n\r\n\tvar currentTextureSlot = undefined;\r\n\tvar currentBoundTextures = {};\r\n\r\n\tthis.init = function () {\r\n\r\n\t\tgl.clearColor( 0, 0, 0, 1 );\r\n\t\tgl.clearDepth( 1 );\r\n\t\tgl.clearStencil( 0 );\r\n\r\n\t\tthis.enable( gl.DEPTH_TEST );\r\n\t\tgl.depthFunc( gl.LEQUAL );\r\n\r\n\t\tgl.frontFace( gl.CCW );\r\n\t\tgl.cullFace( gl.BACK );\r\n\t\tthis.enable( gl.CULL_FACE );\r\n\r\n\t\tthis.enable( gl.BLEND );\r\n\t\tgl.blendEquation( gl.FUNC_ADD );\r\n\t\tgl.blendFunc( gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA );\r\n\r\n\t};\r\n\r\n\tthis.initAttributes = function () {\r\n\r\n\t\tfor ( var i = 0, l = newAttributes.length; i < l; i ++ ) {\r\n\r\n\t\t\tnewAttributes[ i ] = 0;\r\n\r\n\t\t}\r\n\r\n\t};\r\n\r\n\tthis.enableAttribute = function ( attribute ) {\r\n\r\n\t\tnewAttributes[ attribute ] = 1;\r\n\r\n\t\tif ( enabledAttributes[ attribute ] === 0 ) {\r\n\r\n\t\t\tgl.enableVertexAttribArray( attribute );\r\n\t\t\tenabledAttributes[ attribute ] = 1;\r\n\r\n\t\t}\r\n\r\n\t};\r\n\r\n\tthis.disableUnusedAttributes = function () {\r\n\r\n\t\tfor ( var i = 0, l = enabledAttributes.length; i < l; i ++ ) {\r\n\r\n\t\t\tif ( enabledAttributes[ i ] !== newAttributes[ i ] ) {\r\n\r\n\t\t\t\tgl.disableVertexAttribArray( i );\r\n\t\t\t\tenabledAttributes[ i ] = 0;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t};\r\n\r\n\tthis.enable = function ( id ) {\r\n\r\n\t\tif ( capabilities[ id ] !== true ) {\r\n\r\n\t\t\tgl.enable( id );\r\n\t\t\tcapabilities[ id ] = true;\r\n\r\n\t\t}\r\n\r\n\t};\r\n\r\n\tthis.disable = function ( id ) {\r\n\r\n\t\tif ( capabilities[ id ] !== false ) {\r\n\r\n\t\t\tgl.disable( id );\r\n\t\t\tcapabilities[ id ] = false;\r\n\r\n\t\t}\r\n\r\n\t};\r\n\r\n\tthis.getCompressedTextureFormats = function () {\r\n\r\n\t\tif ( compressedTextureFormats === null ) {\r\n\r\n\t\t\tcompressedTextureFormats = [];\r\n\r\n\t\t\tif ( extensions.get( 'WEBGL_compressed_texture_pvrtc' ) ||\r\n\t\t\t extensions.get( 'WEBGL_compressed_texture_s3tc' ) ) {\r\n\r\n\t\t\t\tvar formats = gl.getParameter( gl.COMPRESSED_TEXTURE_FORMATS );\r\n\r\n\t\t\t\tfor ( var i = 0; i < formats.length; i ++ ) {\r\n\r\n\t\t\t\t\tcompressedTextureFormats.push( formats[ i ] );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn compressedTextureFormats;\r\n\r\n\t};\r\n\r\n\tthis.setBlending = function ( blending, blendEquation, blendSrc, blendDst, blendEquationAlpha, blendSrcAlpha, blendDstAlpha ) {\r\n\r\n\t\tif ( blending !== currentBlending ) {\r\n\r\n\t\t\tif ( blending === THREE.NoBlending ) {\r\n\r\n\t\t\t\tthis.disable( gl.BLEND );\r\n\r\n\t\t\t} else if ( blending === THREE.AdditiveBlending ) {\r\n\r\n\t\t\t\tthis.enable( gl.BLEND );\r\n\t\t\t\tgl.blendEquation( gl.FUNC_ADD );\r\n\t\t\t\tgl.blendFunc( gl.SRC_ALPHA, gl.ONE );\r\n\r\n\t\t\t} else if ( blending === THREE.SubtractiveBlending ) {\r\n\r\n\t\t\t\t// TODO: Find blendFuncSeparate() combination\r\n\r\n\t\t\t\tthis.enable( gl.BLEND );\r\n\t\t\t\tgl.blendEquation( gl.FUNC_ADD );\r\n\t\t\t\tgl.blendFunc( gl.ZERO, gl.ONE_MINUS_SRC_COLOR );\r\n\r\n\t\t\t} else if ( blending === THREE.MultiplyBlending ) {\r\n\r\n\t\t\t\t// TODO: Find blendFuncSeparate() combination\r\n\r\n\t\t\t\tthis.enable( gl.BLEND );\r\n\t\t\t\tgl.blendEquation( gl.FUNC_ADD );\r\n\t\t\t\tgl.blendFunc( gl.ZERO, gl.SRC_COLOR );\r\n\r\n\t\t\t} else if ( blending === THREE.CustomBlending ) {\r\n\r\n\t\t\t\tthis.enable( gl.BLEND );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tthis.enable( gl.BLEND );\r\n\t\t\t\tgl.blendEquationSeparate( gl.FUNC_ADD, gl.FUNC_ADD );\r\n\t\t\t\tgl.blendFuncSeparate( gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA, gl.ONE, gl.ONE_MINUS_SRC_ALPHA );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tcurrentBlending = blending;\r\n\r\n\t\t}\r\n\r\n\t\tif ( blending === THREE.CustomBlending ) {\r\n\r\n\t\t\tblendEquationAlpha = blendEquationAlpha || blendEquation;\r\n\t\t\tblendSrcAlpha = blendSrcAlpha || blendSrc;\r\n\t\t\tblendDstAlpha = blendDstAlpha || blendDst;\r\n\r\n\t\t\tif ( blendEquation !== currentBlendEquation || blendEquationAlpha !== currentBlendEquationAlpha ) {\r\n\r\n\t\t\t\tgl.blendEquationSeparate( paramThreeToGL( blendEquation ), paramThreeToGL( blendEquationAlpha ) );\r\n\r\n\t\t\t\tcurrentBlendEquation = blendEquation;\r\n\t\t\t\tcurrentBlendEquationAlpha = blendEquationAlpha;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( blendSrc !== currentBlendSrc || blendDst !== currentBlendDst || blendSrcAlpha !== currentBlendSrcAlpha || blendDstAlpha !== currentBlendDstAlpha ) {\r\n\r\n\t\t\t\tgl.blendFuncSeparate( paramThreeToGL( blendSrc ), paramThreeToGL( blendDst ), paramThreeToGL( blendSrcAlpha ), paramThreeToGL( blendDstAlpha ) );\r\n\r\n\t\t\t\tcurrentBlendSrc = blendSrc;\r\n\t\t\t\tcurrentBlendDst = blendDst;\r\n\t\t\t\tcurrentBlendSrcAlpha = blendSrcAlpha;\r\n\t\t\t\tcurrentBlendDstAlpha = blendDstAlpha;\r\n\r\n\t\t\t}\r\n\r\n\t\t} else {\r\n\r\n\t\t\tcurrentBlendEquation = null;\r\n\t\t\tcurrentBlendSrc = null;\r\n\t\t\tcurrentBlendDst = null;\r\n\t\t\tcurrentBlendEquationAlpha = null;\r\n\t\t\tcurrentBlendSrcAlpha = null;\r\n\t\t\tcurrentBlendDstAlpha = null;\r\n\r\n\t\t}\r\n\r\n\t};\r\n\r\n\tthis.setDepthFunc = function ( depthFunc ) {\r\n\r\n\t\tif ( currentDepthFunc !== depthFunc ) {\r\n\r\n\t\t\tif ( depthFunc ) {\r\n\r\n\t\t\t\tswitch ( depthFunc ) {\r\n\r\n\t\t\t\t\tcase THREE.NeverDepth:\r\n\r\n\t\t\t\t\t\tgl.depthFunc( gl.NEVER );\r\n\t\t\t\t\t\tbreak;\r\n\r\n\t\t\t\t\tcase THREE.AlwaysDepth:\r\n\r\n\t\t\t\t\t\tgl.depthFunc( gl.ALWAYS );\r\n\t\t\t\t\t\tbreak;\r\n\r\n\t\t\t\t\tcase THREE.LessDepth:\r\n\r\n\t\t\t\t\t\tgl.depthFunc( gl.LESS );\r\n\t\t\t\t\t\tbreak;\r\n\r\n\t\t\t\t\tcase THREE.LessEqualDepth:\r\n\r\n\t\t\t\t\t\tgl.depthFunc( gl.LEQUAL );\r\n\t\t\t\t\t\tbreak;\r\n\r\n\t\t\t\t\tcase THREE.EqualDepth:\r\n\r\n\t\t\t\t\t\tgl.depthFunc( gl.EQUAL );\r\n\t\t\t\t\t\tbreak;\r\n\r\n\t\t\t\t\tcase THREE.GreaterEqualDepth:\r\n\r\n\t\t\t\t\t\tgl.depthFunc( gl.GEQUAL );\r\n\t\t\t\t\t\tbreak;\r\n\r\n\t\t\t\t\tcase THREE.GreaterDepth:\r\n\r\n\t\t\t\t\t\tgl.depthFunc( gl.GREATER );\r\n\t\t\t\t\t\tbreak;\r\n\r\n\t\t\t\t\tcase THREE.NotEqualDepth:\r\n\r\n\t\t\t\t\t\tgl.depthFunc( gl.NOTEQUAL );\r\n\t\t\t\t\t\tbreak;\r\n\r\n\t\t\t\t\tdefault:\r\n\r\n\t\t\t\t\t\tgl.depthFunc( gl.LEQUAL );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tgl.depthFunc( gl.LEQUAL );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tcurrentDepthFunc = depthFunc;\r\n\r\n\t\t}\r\n\r\n\t};\r\n\r\n\tthis.setDepthTest = function ( depthTest ) {\r\n\r\n\t\tif ( depthTest ) {\r\n\r\n\t\t\tthis.enable( gl.DEPTH_TEST );\r\n\r\n\t\t} else {\r\n\r\n\t\t\tthis.disable( gl.DEPTH_TEST );\r\n\r\n\t\t}\r\n\r\n\t};\r\n\r\n\tthis.setDepthWrite = function ( depthWrite ) {\r\n\r\n\t\tif ( currentDepthWrite !== depthWrite ) {\r\n\r\n\t\t\tgl.depthMask( depthWrite );\r\n\t\t\tcurrentDepthWrite = depthWrite;\r\n\r\n\t\t}\r\n\r\n\t};\r\n\r\n\tthis.setColorWrite = function ( colorWrite ) {\r\n\r\n\t\tif ( currentColorWrite !== colorWrite ) {\r\n\r\n\t\t\tgl.colorMask( colorWrite, colorWrite, colorWrite, colorWrite );\r\n\t\t\tcurrentColorWrite = colorWrite;\r\n\r\n\t\t}\r\n\r\n\t};\r\n\r\n\tthis.setFlipSided = function ( flipSided ) {\r\n\r\n\t\tif ( currentFlipSided !== flipSided ) {\r\n\r\n\t\t\tif ( flipSided ) {\r\n\r\n\t\t\t\tgl.frontFace( gl.CW );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tgl.frontFace( gl.CCW );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tcurrentFlipSided = flipSided;\r\n\r\n\t\t}\r\n\r\n\t};\r\n\r\n\tthis.setLineWidth = function ( width ) {\r\n\r\n\t\tif ( width !== currentLineWidth ) {\r\n\r\n\t\t\tgl.lineWidth( width );\r\n\r\n\t\t\tcurrentLineWidth = width;\r\n\r\n\t\t}\r\n\r\n\t};\r\n\r\n\tthis.setPolygonOffset = function ( polygonOffset, factor, units ) {\r\n\r\n\t\tif ( polygonOffset ) {\r\n\r\n\t\t\tthis.enable( gl.POLYGON_OFFSET_FILL );\r\n\r\n\t\t} else {\r\n\r\n\t\t\tthis.disable( gl.POLYGON_OFFSET_FILL );\r\n\r\n\t\t}\r\n\r\n\t\tif ( polygonOffset && ( currentPolygonOffsetFactor !== factor || currentPolygonOffsetUnits !== units ) ) {\r\n\r\n\t\t\tgl.polygonOffset( factor, units );\r\n\r\n\t\t\tcurrentPolygonOffsetFactor = factor;\r\n\t\t\tcurrentPolygonOffsetUnits = units;\r\n\r\n\t\t}\r\n\r\n\t};\r\n\r\n\tthis.setScissorTest = function ( scissorTest ) {\r\n\r\n\t\tif ( scissorTest ) {\r\n\r\n\t\t\tthis.enable( gl.SCISSOR_TEST );\r\n\r\n\t\t} else {\r\n\r\n\t\t\tthis.disable( gl.SCISSOR_TEST );\r\n\r\n\t\t}\r\n\r\n\t};\r\n\r\n\t// texture\r\n\r\n\tthis.activeTexture = function ( webglSlot ) {\r\n\r\n\t\tif ( webglSlot === undefined ) webglSlot = gl.TEXTURE0 + maxTextures - 1;\r\n\r\n\t\tif ( currentTextureSlot !== webglSlot ) {\r\n\r\n\t\t\tgl.activeTexture( webglSlot );\r\n\t\t\tcurrentTextureSlot = webglSlot;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tthis.bindTexture = function ( webglType, webglTexture ) {\r\n\r\n\t\tif ( currentTextureSlot === undefined ) {\r\n\r\n\t\t\t_this.activeTexture();\r\n\r\n\t\t}\r\n\r\n\t\tvar boundTexture = currentBoundTextures[ currentTextureSlot ];\r\n\r\n\t\tif ( boundTexture === undefined ) {\r\n\r\n\t\t\tboundTexture = { type: undefined, texture: undefined };\r\n\t\t\tcurrentBoundTextures[ currentTextureSlot ] = boundTexture;\r\n\r\n\t\t}\r\n\r\n\t\tif ( boundTexture.type !== webglType || boundTexture.texture !== webglTexture ) {\r\n\r\n\t\t\tgl.bindTexture( webglType, webglTexture );\r\n\r\n\t\t\tboundTexture.type = webglType;\r\n\t\t\tboundTexture.texture = webglTexture;\r\n\r\n\t\t}\r\n\r\n\t};\r\n\r\n\tthis.compressedTexImage2D = function () {\r\n\r\n\t\ttry {\r\n\r\n\t\t\tgl.compressedTexImage2D.apply( gl, arguments );\r\n\r\n\t\t} catch ( error ) {\r\n\r\n\t\t\tconsole.error( error );\r\n\r\n\t\t}\r\n\r\n\t};\r\n\r\n\tthis.texImage2D = function () {\r\n\r\n\t\ttry {\r\n\r\n\t\t\tgl.texImage2D.apply( gl, arguments );\r\n\r\n\t\t} catch ( error ) {\r\n\r\n\t\t\tconsole.error( error );\r\n\r\n\t\t}\r\n\r\n\t};\r\n\r\n\t//\r\n\r\n\tthis.reset = function () {\r\n\r\n\t\tfor ( var i = 0; i < enabledAttributes.length; i ++ ) {\r\n\r\n\t\t\tif ( enabledAttributes[ i ] === 1 ) {\r\n\r\n\t\t\t\tgl.disableVertexAttribArray( i );\r\n\t\t\t\tenabledAttributes[ i ] = 0;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tcapabilities = {};\r\n\r\n\t\tcompressedTextureFormats = null;\r\n\r\n\t\tcurrentBlending = null;\r\n\r\n\t\tcurrentDepthWrite = null;\r\n\t\tcurrentColorWrite = null;\r\n\r\n\t\tcurrentFlipSided = null;\r\n\r\n\t};\r\n\r\n};\r\n\r\n// File:src/renderers/webgl/plugins/LensFlarePlugin.js\r\n\r\n/**\r\n * @author mikael emtinger / http://gomo.se/\r\n * @author alteredq / http://alteredqualia.com/\r\n */\r\n\r\nTHREE.LensFlarePlugin = function ( renderer, flares ) {\r\n\r\n\tvar gl = renderer.context;\r\n\tvar state = renderer.state;\r\n\r\n\tvar vertexBuffer, elementBuffer;\r\n\tvar program, attributes, uniforms;\r\n\tvar hasVertexTexture;\r\n\r\n\tvar tempTexture, occlusionTexture;\r\n\r\n\tvar init = function () {\r\n\r\n\t\tvar vertices = new Float32Array( [\r\n\t\t\t- 1, - 1, 0, 0,\r\n\t\t\t 1, - 1, 1, 0,\r\n\t\t\t 1, 1, 1, 1,\r\n\t\t\t- 1, 1, 0, 1\r\n\t\t] );\r\n\r\n\t\tvar faces = new Uint16Array( [\r\n\t\t\t0, 1, 2,\r\n\t\t\t0, 2, 3\r\n\t\t] );\r\n\r\n\t\t// buffers\r\n\r\n\t\tvertexBuffer = gl.createBuffer();\r\n\t\telementBuffer = gl.createBuffer();\r\n\r\n\t\tgl.bindBuffer( gl.ARRAY_BUFFER, vertexBuffer );\r\n\t\tgl.bufferData( gl.ARRAY_BUFFER, vertices, gl.STATIC_DRAW );\r\n\r\n\t\tgl.bindBuffer( gl.ELEMENT_ARRAY_BUFFER, elementBuffer );\r\n\t\tgl.bufferData( gl.ELEMENT_ARRAY_BUFFER, faces, gl.STATIC_DRAW );\r\n\r\n\t\t// textures\r\n\r\n\t\ttempTexture = gl.createTexture();\r\n\t\tocclusionTexture = gl.createTexture();\r\n\r\n\t\tstate.bindTexture( gl.TEXTURE_2D, tempTexture );\r\n\t\tgl.texImage2D( gl.TEXTURE_2D, 0, gl.RGB, 16, 16, 0, gl.RGB, gl.UNSIGNED_BYTE, null );\r\n\t\tgl.texParameteri( gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE );\r\n\t\tgl.texParameteri( gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE );\r\n\t\tgl.texParameteri( gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST );\r\n\t\tgl.texParameteri( gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST );\r\n\r\n\t\tstate.bindTexture( gl.TEXTURE_2D, occlusionTexture );\r\n\t\tgl.texImage2D( gl.TEXTURE_2D, 0, gl.RGBA, 16, 16, 0, gl.RGBA, gl.UNSIGNED_BYTE, null );\r\n\t\tgl.texParameteri( gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE );\r\n\t\tgl.texParameteri( gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE );\r\n\t\tgl.texParameteri( gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST );\r\n\t\tgl.texParameteri( gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST );\r\n\r\n\t\thasVertexTexture = gl.getParameter( gl.MAX_VERTEX_TEXTURE_IMAGE_UNITS ) > 0;\r\n\r\n\t\tvar shader;\r\n\r\n\t\tif ( hasVertexTexture ) {\r\n\r\n\t\t\tshader = {\r\n\r\n\t\t\t\tvertexShader: [\r\n\r\n\t\t\t\t\t\"uniform lowp int renderType;\",\r\n\r\n\t\t\t\t\t\"uniform vec3 screenPosition;\",\r\n\t\t\t\t\t\"uniform vec2 scale;\",\r\n\t\t\t\t\t\"uniform float rotation;\",\r\n\r\n\t\t\t\t\t\"uniform sampler2D occlusionMap;\",\r\n\r\n\t\t\t\t\t\"attribute vec2 position;\",\r\n\t\t\t\t\t\"attribute vec2 uv;\",\r\n\r\n\t\t\t\t\t\"varying vec2 vUV;\",\r\n\t\t\t\t\t\"varying float vVisibility;\",\r\n\r\n\t\t\t\t\t\"void main() {\",\r\n\r\n\t\t\t\t\t\t\"vUV = uv;\",\r\n\r\n\t\t\t\t\t\t\"vec2 pos = position;\",\r\n\r\n\t\t\t\t\t\t\"if( renderType == 2 ) {\",\r\n\r\n\t\t\t\t\t\t\t\"vec4 visibility = texture2D( occlusionMap, vec2( 0.1, 0.1 ) );\",\r\n\t\t\t\t\t\t\t\"visibility += texture2D( occlusionMap, vec2( 0.5, 0.1 ) );\",\r\n\t\t\t\t\t\t\t\"visibility += texture2D( occlusionMap, vec2( 0.9, 0.1 ) );\",\r\n\t\t\t\t\t\t\t\"visibility += texture2D( occlusionMap, vec2( 0.9, 0.5 ) );\",\r\n\t\t\t\t\t\t\t\"visibility += texture2D( occlusionMap, vec2( 0.9, 0.9 ) );\",\r\n\t\t\t\t\t\t\t\"visibility += texture2D( occlusionMap, vec2( 0.5, 0.9 ) );\",\r\n\t\t\t\t\t\t\t\"visibility += texture2D( occlusionMap, vec2( 0.1, 0.9 ) );\",\r\n\t\t\t\t\t\t\t\"visibility += texture2D( occlusionMap, vec2( 0.1, 0.5 ) );\",\r\n\t\t\t\t\t\t\t\"visibility += texture2D( occlusionMap, vec2( 0.5, 0.5 ) );\",\r\n\r\n\t\t\t\t\t\t\t\"vVisibility = visibility.r / 9.0;\",\r\n\t\t\t\t\t\t\t\"vVisibility *= 1.0 - visibility.g / 9.0;\",\r\n\t\t\t\t\t\t\t\"vVisibility *= visibility.b / 9.0;\",\r\n\t\t\t\t\t\t\t\"vVisibility *= 1.0 - visibility.a / 9.0;\",\r\n\r\n\t\t\t\t\t\t\t\"pos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;\",\r\n\t\t\t\t\t\t\t\"pos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;\",\r\n\r\n\t\t\t\t\t\t\"}\",\r\n\r\n\t\t\t\t\t\t\"gl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );\",\r\n\r\n\t\t\t\t\t\"}\"\r\n\r\n\t\t\t\t].join( \"\\n\" ),\r\n\r\n\t\t\t\tfragmentShader: [\r\n\r\n\t\t\t\t\t\"uniform lowp int renderType;\",\r\n\r\n\t\t\t\t\t\"uniform sampler2D map;\",\r\n\t\t\t\t\t\"uniform float opacity;\",\r\n\t\t\t\t\t\"uniform vec3 color;\",\r\n\r\n\t\t\t\t\t\"varying vec2 vUV;\",\r\n\t\t\t\t\t\"varying float vVisibility;\",\r\n\r\n\t\t\t\t\t\"void main() {\",\r\n\r\n\t\t\t\t\t\t// pink square\r\n\r\n\t\t\t\t\t\t\"if( renderType == 0 ) {\",\r\n\r\n\t\t\t\t\t\t\t\"gl_FragColor = vec4( 1.0, 0.0, 1.0, 0.0 );\",\r\n\r\n\t\t\t\t\t\t// restore\r\n\r\n\t\t\t\t\t\t\"} else if( renderType == 1 ) {\",\r\n\r\n\t\t\t\t\t\t\t\"gl_FragColor = texture2D( map, vUV );\",\r\n\r\n\t\t\t\t\t\t// flare\r\n\r\n\t\t\t\t\t\t\"} else {\",\r\n\r\n\t\t\t\t\t\t\t\"vec4 texture = texture2D( map, vUV );\",\r\n\t\t\t\t\t\t\t\"texture.a *= opacity * vVisibility;\",\r\n\t\t\t\t\t\t\t\"gl_FragColor = texture;\",\r\n\t\t\t\t\t\t\t\"gl_FragColor.rgb *= color;\",\r\n\r\n\t\t\t\t\t\t\"}\",\r\n\r\n\t\t\t\t\t\"}\"\r\n\r\n\t\t\t\t].join( \"\\n\" )\r\n\r\n\t\t\t};\r\n\r\n\t\t} else {\r\n\r\n\t\t\tshader = {\r\n\r\n\t\t\t\tvertexShader: [\r\n\r\n\t\t\t\t\t\"uniform lowp int renderType;\",\r\n\r\n\t\t\t\t\t\"uniform vec3 screenPosition;\",\r\n\t\t\t\t\t\"uniform vec2 scale;\",\r\n\t\t\t\t\t\"uniform float rotation;\",\r\n\r\n\t\t\t\t\t\"attribute vec2 position;\",\r\n\t\t\t\t\t\"attribute vec2 uv;\",\r\n\r\n\t\t\t\t\t\"varying vec2 vUV;\",\r\n\r\n\t\t\t\t\t\"void main() {\",\r\n\r\n\t\t\t\t\t\t\"vUV = uv;\",\r\n\r\n\t\t\t\t\t\t\"vec2 pos = position;\",\r\n\r\n\t\t\t\t\t\t\"if( renderType == 2 ) {\",\r\n\r\n\t\t\t\t\t\t\t\"pos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;\",\r\n\t\t\t\t\t\t\t\"pos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;\",\r\n\r\n\t\t\t\t\t\t\"}\",\r\n\r\n\t\t\t\t\t\t\"gl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );\",\r\n\r\n\t\t\t\t\t\"}\"\r\n\r\n\t\t\t\t].join( \"\\n\" ),\r\n\r\n\t\t\t\tfragmentShader: [\r\n\r\n\t\t\t\t\t\"precision mediump float;\",\r\n\r\n\t\t\t\t\t\"uniform lowp int renderType;\",\r\n\r\n\t\t\t\t\t\"uniform sampler2D map;\",\r\n\t\t\t\t\t\"uniform sampler2D occlusionMap;\",\r\n\t\t\t\t\t\"uniform float opacity;\",\r\n\t\t\t\t\t\"uniform vec3 color;\",\r\n\r\n\t\t\t\t\t\"varying vec2 vUV;\",\r\n\r\n\t\t\t\t\t\"void main() {\",\r\n\r\n\t\t\t\t\t\t// pink square\r\n\r\n\t\t\t\t\t\t\"if( renderType == 0 ) {\",\r\n\r\n\t\t\t\t\t\t\t\"gl_FragColor = vec4( texture2D( map, vUV ).rgb, 0.0 );\",\r\n\r\n\t\t\t\t\t\t// restore\r\n\r\n\t\t\t\t\t\t\"} else if( renderType == 1 ) {\",\r\n\r\n\t\t\t\t\t\t\t\"gl_FragColor = texture2D( map, vUV );\",\r\n\r\n\t\t\t\t\t\t// flare\r\n\r\n\t\t\t\t\t\t\"} else {\",\r\n\r\n\t\t\t\t\t\t\t\"float visibility = texture2D( occlusionMap, vec2( 0.5, 0.1 ) ).a;\",\r\n\t\t\t\t\t\t\t\"visibility += texture2D( occlusionMap, vec2( 0.9, 0.5 ) ).a;\",\r\n\t\t\t\t\t\t\t\"visibility += texture2D( occlusionMap, vec2( 0.5, 0.9 ) ).a;\",\r\n\t\t\t\t\t\t\t\"visibility += texture2D( occlusionMap, vec2( 0.1, 0.5 ) ).a;\",\r\n\t\t\t\t\t\t\t\"visibility = ( 1.0 - visibility / 4.0 );\",\r\n\r\n\t\t\t\t\t\t\t\"vec4 texture = texture2D( map, vUV );\",\r\n\t\t\t\t\t\t\t\"texture.a *= opacity * visibility;\",\r\n\t\t\t\t\t\t\t\"gl_FragColor = texture;\",\r\n\t\t\t\t\t\t\t\"gl_FragColor.rgb *= color;\",\r\n\r\n\t\t\t\t\t\t\"}\",\r\n\r\n\t\t\t\t\t\"}\"\r\n\r\n\t\t\t\t].join( \"\\n\" )\r\n\r\n\t\t\t};\r\n\r\n\t\t}\r\n\r\n\t\tprogram = createProgram( shader );\r\n\r\n\t\tattributes = {\r\n\t\t\tvertex: gl.getAttribLocation ( program, \"position\" ),\r\n\t\t\tuv: gl.getAttribLocation ( program, \"uv\" )\r\n\t\t};\r\n\r\n\t\tuniforms = {\r\n\t\t\trenderType: gl.getUniformLocation( program, \"renderType\" ),\r\n\t\t\tmap: gl.getUniformLocation( program, \"map\" ),\r\n\t\t\tocclusionMap: gl.getUniformLocation( program, \"occlusionMap\" ),\r\n\t\t\topacity: gl.getUniformLocation( program, \"opacity\" ),\r\n\t\t\tcolor: gl.getUniformLocation( program, \"color\" ),\r\n\t\t\tscale: gl.getUniformLocation( program, \"scale\" ),\r\n\t\t\trotation: gl.getUniformLocation( program, \"rotation\" ),\r\n\t\t\tscreenPosition: gl.getUniformLocation( program, \"screenPosition\" )\r\n\t\t};\r\n\r\n\t};\r\n\r\n\t/*\r\n\t * Render lens flares\r\n\t * Method: renders 16x16 0xff00ff-colored points scattered over the light source area,\r\n\t * reads these back and calculates occlusion.\r\n\t */\r\n\r\n\tthis.render = function ( scene, camera, viewportWidth, viewportHeight ) {\r\n\r\n\t\tif ( flares.length === 0 ) return;\r\n\r\n\t\tvar tempPosition = new THREE.Vector3();\r\n\r\n\t\tvar invAspect = viewportHeight / viewportWidth,\r\n\t\t\thalfViewportWidth = viewportWidth * 0.5,\r\n\t\t\thalfViewportHeight = viewportHeight * 0.5;\r\n\r\n\t\tvar size = 16 / viewportHeight,\r\n\t\t\tscale = new THREE.Vector2( size * invAspect, size );\r\n\r\n\t\tvar screenPosition = new THREE.Vector3( 1, 1, 0 ),\r\n\t\t\tscreenPositionPixels = new THREE.Vector2( 1, 1 );\r\n\r\n\t\tif ( program === undefined ) {\r\n\r\n\t\t\tinit();\r\n\r\n\t\t}\r\n\r\n\t\tgl.useProgram( program );\r\n\r\n\t\tstate.initAttributes();\r\n\t\tstate.enableAttribute( attributes.vertex );\r\n\t\tstate.enableAttribute( attributes.uv );\r\n\t\tstate.disableUnusedAttributes();\r\n\r\n\t\t// loop through all lens flares to update their occlusion and positions\r\n\t\t// setup gl and common used attribs/uniforms\r\n\r\n\t\tgl.uniform1i( uniforms.occlusionMap, 0 );\r\n\t\tgl.uniform1i( uniforms.map, 1 );\r\n\r\n\t\tgl.bindBuffer( gl.ARRAY_BUFFER, vertexBuffer );\r\n\t\tgl.vertexAttribPointer( attributes.vertex, 2, gl.FLOAT, false, 2 * 8, 0 );\r\n\t\tgl.vertexAttribPointer( attributes.uv, 2, gl.FLOAT, false, 2 * 8, 8 );\r\n\r\n\t\tgl.bindBuffer( gl.ELEMENT_ARRAY_BUFFER, elementBuffer );\r\n\r\n\t\tstate.disable( gl.CULL_FACE );\r\n\t\tgl.depthMask( false );\r\n\r\n\t\tfor ( var i = 0, l = flares.length; i < l; i ++ ) {\r\n\r\n\t\t\tsize = 16 / viewportHeight;\r\n\t\t\tscale.set( size * invAspect, size );\r\n\r\n\t\t\t// calc object screen position\r\n\r\n\t\t\tvar flare = flares[ i ];\r\n\r\n\t\t\ttempPosition.set( flare.matrixWorld.elements[ 12 ], flare.matrixWorld.elements[ 13 ], flare.matrixWorld.elements[ 14 ] );\r\n\r\n\t\t\ttempPosition.applyMatrix4( camera.matrixWorldInverse );\r\n\t\t\ttempPosition.applyProjection( camera.projectionMatrix );\r\n\r\n\t\t\t// setup arrays for gl programs\r\n\r\n\t\t\tscreenPosition.copy( tempPosition );\r\n\r\n\t\t\tscreenPositionPixels.x = screenPosition.x * halfViewportWidth + halfViewportWidth;\r\n\t\t\tscreenPositionPixels.y = screenPosition.y * halfViewportHeight + halfViewportHeight;\r\n\r\n\t\t\t// screen cull\r\n\r\n\t\t\tif ( hasVertexTexture || (\r\n\t\t\t\tscreenPositionPixels.x > 0 &&\r\n\t\t\t\tscreenPositionPixels.x < viewportWidth &&\r\n\t\t\t\tscreenPositionPixels.y > 0 &&\r\n\t\t\t\tscreenPositionPixels.y < viewportHeight ) ) {\r\n\r\n\t\t\t\t// save current RGB to temp texture\r\n\r\n\t\t\t\tstate.activeTexture( gl.TEXTURE0 );\r\n\t\t\t\tstate.bindTexture( gl.TEXTURE_2D, null );\r\n\t\t\t\tstate.activeTexture( gl.TEXTURE1 );\r\n\t\t\t\tstate.bindTexture( gl.TEXTURE_2D, tempTexture );\r\n\t\t\t\tgl.copyTexImage2D( gl.TEXTURE_2D, 0, gl.RGB, screenPositionPixels.x - 8, screenPositionPixels.y - 8, 16, 16, 0 );\r\n\r\n\r\n\t\t\t\t// render pink quad\r\n\r\n\t\t\t\tgl.uniform1i( uniforms.renderType, 0 );\r\n\t\t\t\tgl.uniform2f( uniforms.scale, scale.x, scale.y );\r\n\t\t\t\tgl.uniform3f( uniforms.screenPosition, screenPosition.x, screenPosition.y, screenPosition.z );\r\n\r\n\t\t\t\tstate.disable( gl.BLEND );\r\n\t\t\t\tstate.enable( gl.DEPTH_TEST );\r\n\r\n\t\t\t\tgl.drawElements( gl.TRIANGLES, 6, gl.UNSIGNED_SHORT, 0 );\r\n\r\n\r\n\t\t\t\t// copy result to occlusionMap\r\n\r\n\t\t\t\tstate.activeTexture( gl.TEXTURE0 );\r\n\t\t\t\tstate.bindTexture( gl.TEXTURE_2D, occlusionTexture );\r\n\t\t\t\tgl.copyTexImage2D( gl.TEXTURE_2D, 0, gl.RGBA, screenPositionPixels.x - 8, screenPositionPixels.y - 8, 16, 16, 0 );\r\n\r\n\r\n\t\t\t\t// restore graphics\r\n\r\n\t\t\t\tgl.uniform1i( uniforms.renderType, 1 );\r\n\t\t\t\tstate.disable( gl.DEPTH_TEST );\r\n\r\n\t\t\t\tstate.activeTexture( gl.TEXTURE1 );\r\n\t\t\t\tstate.bindTexture( gl.TEXTURE_2D, tempTexture );\r\n\t\t\t\tgl.drawElements( gl.TRIANGLES, 6, gl.UNSIGNED_SHORT, 0 );\r\n\r\n\r\n\t\t\t\t// update object positions\r\n\r\n\t\t\t\tflare.positionScreen.copy( screenPosition );\r\n\r\n\t\t\t\tif ( flare.customUpdateCallback ) {\r\n\r\n\t\t\t\t\tflare.customUpdateCallback( flare );\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\tflare.updateLensFlares();\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\t// render flares\r\n\r\n\t\t\t\tgl.uniform1i( uniforms.renderType, 2 );\r\n\t\t\t\tstate.enable( gl.BLEND );\r\n\r\n\t\t\t\tfor ( var j = 0, jl = flare.lensFlares.length; j < jl; j ++ ) {\r\n\r\n\t\t\t\t\tvar sprite = flare.lensFlares[ j ];\r\n\r\n\t\t\t\t\tif ( sprite.opacity > 0.001 && sprite.scale > 0.001 ) {\r\n\r\n\t\t\t\t\t\tscreenPosition.x = sprite.x;\r\n\t\t\t\t\t\tscreenPosition.y = sprite.y;\r\n\t\t\t\t\t\tscreenPosition.z = sprite.z;\r\n\r\n\t\t\t\t\t\tsize = sprite.size * sprite.scale / viewportHeight;\r\n\r\n\t\t\t\t\t\tscale.x = size * invAspect;\r\n\t\t\t\t\t\tscale.y = size;\r\n\r\n\t\t\t\t\t\tgl.uniform3f( uniforms.screenPosition, screenPosition.x, screenPosition.y, screenPosition.z );\r\n\t\t\t\t\t\tgl.uniform2f( uniforms.scale, scale.x, scale.y );\r\n\t\t\t\t\t\tgl.uniform1f( uniforms.rotation, sprite.rotation );\r\n\r\n\t\t\t\t\t\tgl.uniform1f( uniforms.opacity, sprite.opacity );\r\n\t\t\t\t\t\tgl.uniform3f( uniforms.color, sprite.color.r, sprite.color.g, sprite.color.b );\r\n\r\n\t\t\t\t\t\tstate.setBlending( sprite.blending, sprite.blendEquation, sprite.blendSrc, sprite.blendDst );\r\n\t\t\t\t\t\trenderer.setTexture( sprite.texture, 1 );\r\n\r\n\t\t\t\t\t\tgl.drawElements( gl.TRIANGLES, 6, gl.UNSIGNED_SHORT, 0 );\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\t// restore gl\r\n\r\n\t\tstate.enable( gl.CULL_FACE );\r\n\t\tstate.enable( gl.DEPTH_TEST );\r\n\t\tgl.depthMask( true );\r\n\r\n\t\trenderer.resetGLState();\r\n\r\n\t};\r\n\r\n\tfunction createProgram ( shader ) {\r\n\r\n\t\tvar program = gl.createProgram();\r\n\r\n\t\tvar fragmentShader = gl.createShader( gl.FRAGMENT_SHADER );\r\n\t\tvar vertexShader = gl.createShader( gl.VERTEX_SHADER );\r\n\r\n\t\tvar prefix = \"precision \" + renderer.getPrecision() + \" float;\\n\";\r\n\r\n\t\tgl.shaderSource( fragmentShader, prefix + shader.fragmentShader );\r\n\t\tgl.shaderSource( vertexShader, prefix + shader.vertexShader );\r\n\r\n\t\tgl.compileShader( fragmentShader );\r\n\t\tgl.compileShader( vertexShader );\r\n\r\n\t\tgl.attachShader( program, fragmentShader );\r\n\t\tgl.attachShader( program, vertexShader );\r\n\r\n\t\tgl.linkProgram( program );\r\n\r\n\t\treturn program;\r\n\r\n\t}\r\n\r\n};\r\n\r\n// File:src/renderers/webgl/plugins/SpritePlugin.js\r\n\r\n/**\r\n * @author mikael emtinger / http://gomo.se/\r\n * @author alteredq / http://alteredqualia.com/\r\n */\r\n\r\nTHREE.SpritePlugin = function ( renderer, sprites ) {\r\n\r\n\tvar gl = renderer.context;\r\n\tvar state = renderer.state;\r\n\r\n\tvar vertexBuffer, elementBuffer;\r\n\tvar program, attributes, uniforms;\r\n\r\n\tvar texture;\r\n\r\n\t// decompose matrixWorld\r\n\r\n\tvar spritePosition = new THREE.Vector3();\r\n\tvar spriteRotation = new THREE.Quaternion();\r\n\tvar spriteScale = new THREE.Vector3();\r\n\r\n\tvar init = function () {\r\n\r\n\t\tvar vertices = new Float32Array( [\r\n\t\t\t- 0.5, - 0.5, 0, 0,\r\n\t\t\t 0.5, - 0.5, 1, 0,\r\n\t\t\t 0.5, 0.5, 1, 1,\r\n\t\t\t- 0.5, 0.5, 0, 1\r\n\t\t] );\r\n\r\n\t\tvar faces = new Uint16Array( [\r\n\t\t\t0, 1, 2,\r\n\t\t\t0, 2, 3\r\n\t\t] );\r\n\r\n\t\tvertexBuffer = gl.createBuffer();\r\n\t\telementBuffer = gl.createBuffer();\r\n\r\n\t\tgl.bindBuffer( gl.ARRAY_BUFFER, vertexBuffer );\r\n\t\tgl.bufferData( gl.ARRAY_BUFFER, vertices, gl.STATIC_DRAW );\r\n\r\n\t\tgl.bindBuffer( gl.ELEMENT_ARRAY_BUFFER, elementBuffer );\r\n\t\tgl.bufferData( gl.ELEMENT_ARRAY_BUFFER, faces, gl.STATIC_DRAW );\r\n\r\n\t\tprogram = createProgram();\r\n\r\n\t\tattributes = {\r\n\t\t\tposition:\t\t\tgl.getAttribLocation ( program, 'position' ),\r\n\t\t\tuv:\t\t\t\t\tgl.getAttribLocation ( program, 'uv' )\r\n\t\t};\r\n\r\n\t\tuniforms = {\r\n\t\t\tuvOffset:\t\t\tgl.getUniformLocation( program, 'uvOffset' ),\r\n\t\t\tuvScale:\t\t\tgl.getUniformLocation( program, 'uvScale' ),\r\n\r\n\t\t\trotation:\t\t\tgl.getUniformLocation( program, 'rotation' ),\r\n\t\t\tscale:\t\t\t\tgl.getUniformLocation( program, 'scale' ),\r\n\r\n\t\t\tcolor:\t\t\t\tgl.getUniformLocation( program, 'color' ),\r\n\t\t\tmap:\t\t\t\tgl.getUniformLocation( program, 'map' ),\r\n\t\t\topacity:\t\t\tgl.getUniformLocation( program, 'opacity' ),\r\n\r\n\t\t\tmodelViewMatrix: \tgl.getUniformLocation( program, 'modelViewMatrix' ),\r\n\t\t\tprojectionMatrix:\tgl.getUniformLocation( program, 'projectionMatrix' ),\r\n\r\n\t\t\tfogType:\t\t\tgl.getUniformLocation( program, 'fogType' ),\r\n\t\t\tfogDensity:\t\t\tgl.getUniformLocation( program, 'fogDensity' ),\r\n\t\t\tfogNear:\t\t\tgl.getUniformLocation( program, 'fogNear' ),\r\n\t\t\tfogFar:\t\t\t\tgl.getUniformLocation( program, 'fogFar' ),\r\n\t\t\tfogColor:\t\t\tgl.getUniformLocation( program, 'fogColor' ),\r\n\r\n\t\t\talphaTest:\t\t\tgl.getUniformLocation( program, 'alphaTest' )\r\n\t\t};\r\n\r\n\t\tvar canvas = document.createElement( 'canvas' );\r\n\t\tcanvas.width = 8;\r\n\t\tcanvas.height = 8;\r\n\r\n\t\tvar context = canvas.getContext( '2d' );\r\n\t\tcontext.fillStyle = 'white';\r\n\t\tcontext.fillRect( 0, 0, 8, 8 );\r\n\r\n\t\ttexture = new THREE.Texture( canvas );\r\n\t\ttexture.needsUpdate = true;\r\n\r\n\t};\r\n\r\n\tthis.render = function ( scene, camera ) {\r\n\r\n\t\tif ( sprites.length === 0 ) return;\r\n\r\n\t\t// setup gl\r\n\r\n\t\tif ( program === undefined ) {\r\n\r\n\t\t\tinit();\r\n\r\n\t\t}\r\n\r\n\t\tgl.useProgram( program );\r\n\r\n\t\tstate.initAttributes();\r\n\t\tstate.enableAttribute( attributes.position );\r\n\t\tstate.enableAttribute( attributes.uv );\r\n\t\tstate.disableUnusedAttributes();\r\n\r\n\t\tstate.disable( gl.CULL_FACE );\r\n\t\tstate.enable( gl.BLEND );\r\n\r\n\t\tgl.bindBuffer( gl.ARRAY_BUFFER, vertexBuffer );\r\n\t\tgl.vertexAttribPointer( attributes.position, 2, gl.FLOAT, false, 2 * 8, 0 );\r\n\t\tgl.vertexAttribPointer( attributes.uv, 2, gl.FLOAT, false, 2 * 8, 8 );\r\n\r\n\t\tgl.bindBuffer( gl.ELEMENT_ARRAY_BUFFER, elementBuffer );\r\n\r\n\t\tgl.uniformMatrix4fv( uniforms.projectionMatrix, false, camera.projectionMatrix.elements );\r\n\r\n\t\tstate.activeTexture( gl.TEXTURE0 );\r\n\t\tgl.uniform1i( uniforms.map, 0 );\r\n\r\n\t\tvar oldFogType = 0;\r\n\t\tvar sceneFogType = 0;\r\n\t\tvar fog = scene.fog;\r\n\r\n\t\tif ( fog ) {\r\n\r\n\t\t\tgl.uniform3f( uniforms.fogColor, fog.color.r, fog.color.g, fog.color.b );\r\n\r\n\t\t\tif ( fog instanceof THREE.Fog ) {\r\n\r\n\t\t\t\tgl.uniform1f( uniforms.fogNear, fog.near );\r\n\t\t\t\tgl.uniform1f( uniforms.fogFar, fog.far );\r\n\r\n\t\t\t\tgl.uniform1i( uniforms.fogType, 1 );\r\n\t\t\t\toldFogType = 1;\r\n\t\t\t\tsceneFogType = 1;\r\n\r\n\t\t\t} else if ( fog instanceof THREE.FogExp2 ) {\r\n\r\n\t\t\t\tgl.uniform1f( uniforms.fogDensity, fog.density );\r\n\r\n\t\t\t\tgl.uniform1i( uniforms.fogType, 2 );\r\n\t\t\t\toldFogType = 2;\r\n\t\t\t\tsceneFogType = 2;\r\n\r\n\t\t\t}\r\n\r\n\t\t} else {\r\n\r\n\t\t\tgl.uniform1i( uniforms.fogType, 0 );\r\n\t\t\toldFogType = 0;\r\n\t\t\tsceneFogType = 0;\r\n\r\n\t\t}\r\n\r\n\r\n\t\t// update positions and sort\r\n\r\n\t\tfor ( var i = 0, l = sprites.length; i < l; i ++ ) {\r\n\r\n\t\t\tvar sprite = sprites[ i ];\r\n\r\n\t\t\tsprite.modelViewMatrix.multiplyMatrices( camera.matrixWorldInverse, sprite.matrixWorld );\r\n\t\t\tsprite.z = - sprite.modelViewMatrix.elements[ 14 ];\r\n\r\n\t\t}\r\n\r\n\t\tsprites.sort( painterSortStable );\r\n\r\n\t\t// render all sprites\r\n\r\n\t\tvar scale = [];\r\n\r\n\t\tfor ( var i = 0, l = sprites.length; i < l; i ++ ) {\r\n\r\n\t\t\tvar sprite = sprites[ i ];\r\n\t\t\tvar material = sprite.material;\r\n\r\n\t\t\tgl.uniform1f( uniforms.alphaTest, material.alphaTest );\r\n\t\t\tgl.uniformMatrix4fv( uniforms.modelViewMatrix, false, sprite.modelViewMatrix.elements );\r\n\r\n\t\t\tsprite.matrixWorld.decompose( spritePosition, spriteRotation, spriteScale );\r\n\r\n\t\t\tscale[ 0 ] = spriteScale.x;\r\n\t\t\tscale[ 1 ] = spriteScale.y;\r\n\r\n\t\t\tvar fogType = 0;\r\n\r\n\t\t\tif ( scene.fog && material.fog ) {\r\n\r\n\t\t\t\tfogType = sceneFogType;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( oldFogType !== fogType ) {\r\n\r\n\t\t\t\tgl.uniform1i( uniforms.fogType, fogType );\r\n\t\t\t\toldFogType = fogType;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( material.map !== null ) {\r\n\r\n\t\t\t\tgl.uniform2f( uniforms.uvOffset, material.map.offset.x, material.map.offset.y );\r\n\t\t\t\tgl.uniform2f( uniforms.uvScale, material.map.repeat.x, material.map.repeat.y );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tgl.uniform2f( uniforms.uvOffset, 0, 0 );\r\n\t\t\t\tgl.uniform2f( uniforms.uvScale, 1, 1 );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tgl.uniform1f( uniforms.opacity, material.opacity );\r\n\t\t\tgl.uniform3f( uniforms.color, material.color.r, material.color.g, material.color.b );\r\n\r\n\t\t\tgl.uniform1f( uniforms.rotation, material.rotation );\r\n\t\t\tgl.uniform2fv( uniforms.scale, scale );\r\n\r\n\t\t\tstate.setBlending( material.blending, material.blendEquation, material.blendSrc, material.blendDst );\r\n\t\t\tstate.setDepthTest( material.depthTest );\r\n\t\t\tstate.setDepthWrite( material.depthWrite );\r\n\r\n\t\t\tif ( material.map && material.map.image && material.map.image.width ) {\r\n\r\n\t\t\t\trenderer.setTexture( material.map, 0 );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\trenderer.setTexture( texture, 0 );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tgl.drawElements( gl.TRIANGLES, 6, gl.UNSIGNED_SHORT, 0 );\r\n\r\n\t\t}\r\n\r\n\t\t// restore gl\r\n\r\n\t\tstate.enable( gl.CULL_FACE );\r\n\r\n\t\trenderer.resetGLState();\r\n\r\n\t};\r\n\r\n\tfunction createProgram () {\r\n\r\n\t\tvar program = gl.createProgram();\r\n\r\n\t\tvar vertexShader = gl.createShader( gl.VERTEX_SHADER );\r\n\t\tvar fragmentShader = gl.createShader( gl.FRAGMENT_SHADER );\r\n\r\n\t\tgl.shaderSource( vertexShader, [\r\n\r\n\t\t\t'precision ' + renderer.getPrecision() + ' float;',\r\n\r\n\t\t\t'uniform mat4 modelViewMatrix;',\r\n\t\t\t'uniform mat4 projectionMatrix;',\r\n\t\t\t'uniform float rotation;',\r\n\t\t\t'uniform vec2 scale;',\r\n\t\t\t'uniform vec2 uvOffset;',\r\n\t\t\t'uniform vec2 uvScale;',\r\n\r\n\t\t\t'attribute vec2 position;',\r\n\t\t\t'attribute vec2 uv;',\r\n\r\n\t\t\t'varying vec2 vUV;',\r\n\r\n\t\t\t'void main() {',\r\n\r\n\t\t\t\t'vUV = uvOffset + uv * uvScale;',\r\n\r\n\t\t\t\t'vec2 alignedPosition = position * scale;',\r\n\r\n\t\t\t\t'vec2 rotatedPosition;',\r\n\t\t\t\t'rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;',\r\n\t\t\t\t'rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;',\r\n\r\n\t\t\t\t'vec4 finalPosition;',\r\n\r\n\t\t\t\t'finalPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );',\r\n\t\t\t\t'finalPosition.xy += rotatedPosition;',\r\n\t\t\t\t'finalPosition = projectionMatrix * finalPosition;',\r\n\r\n\t\t\t\t'gl_Position = finalPosition;',\r\n\r\n\t\t\t'}'\r\n\r\n\t\t].join( '\\n' ) );\r\n\r\n\t\tgl.shaderSource( fragmentShader, [\r\n\r\n\t\t\t'precision ' + renderer.getPrecision() + ' float;',\r\n\r\n\t\t\t'uniform vec3 color;',\r\n\t\t\t'uniform sampler2D map;',\r\n\t\t\t'uniform float opacity;',\r\n\r\n\t\t\t'uniform int fogType;',\r\n\t\t\t'uniform vec3 fogColor;',\r\n\t\t\t'uniform float fogDensity;',\r\n\t\t\t'uniform float fogNear;',\r\n\t\t\t'uniform float fogFar;',\r\n\t\t\t'uniform float alphaTest;',\r\n\r\n\t\t\t'varying vec2 vUV;',\r\n\r\n\t\t\t'void main() {',\r\n\r\n\t\t\t\t'vec4 texture = texture2D( map, vUV );',\r\n\r\n\t\t\t\t'if ( texture.a < alphaTest ) discard;',\r\n\r\n\t\t\t\t'gl_FragColor = vec4( color * texture.xyz, texture.a * opacity );',\r\n\r\n\t\t\t\t'if ( fogType > 0 ) {',\r\n\r\n\t\t\t\t\t'float depth = gl_FragCoord.z / gl_FragCoord.w;',\r\n\t\t\t\t\t'float fogFactor = 0.0;',\r\n\r\n\t\t\t\t\t'if ( fogType == 1 ) {',\r\n\r\n\t\t\t\t\t\t'fogFactor = smoothstep( fogNear, fogFar, depth );',\r\n\r\n\t\t\t\t\t'} else {',\r\n\r\n\t\t\t\t\t\t'const float LOG2 = 1.442695;',\r\n\t\t\t\t\t\t'fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );',\r\n\t\t\t\t\t\t'fogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );',\r\n\r\n\t\t\t\t\t'}',\r\n\r\n\t\t\t\t\t'gl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );',\r\n\r\n\t\t\t\t'}',\r\n\r\n\t\t\t'}'\r\n\r\n\t\t].join( '\\n' ) );\r\n\r\n\t\tgl.compileShader( vertexShader );\r\n\t\tgl.compileShader( fragmentShader );\r\n\r\n\t\tgl.attachShader( program, vertexShader );\r\n\t\tgl.attachShader( program, fragmentShader );\r\n\r\n\t\tgl.linkProgram( program );\r\n\r\n\t\treturn program;\r\n\r\n\t}\r\n\r\n\tfunction painterSortStable ( a, b ) {\r\n\r\n\t\tif ( a.z !== b.z ) {\r\n\r\n\t\t\treturn b.z - a.z;\r\n\r\n\t\t} else {\r\n\r\n\t\t\treturn b.id - a.id;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n};\r\n\r\n// File:src/extras/GeometryUtils.js\r\n\r\n/**\r\n * @author mrdoob / http://mrdoob.com/\r\n */\r\n\r\nTHREE.GeometryUtils = {\r\n\r\n\tmerge: function ( geometry1, geometry2, materialIndexOffset ) {\r\n\r\n\t\tconsole.warn( 'THREE.GeometryUtils: .merge() has been moved to Geometry. Use geometry.merge( geometry2, matrix, materialIndexOffset ) instead.' );\r\n\r\n\t\tvar matrix;\r\n\r\n\t\tif ( geometry2 instanceof THREE.Mesh ) {\r\n\r\n\t\t\tgeometry2.matrixAutoUpdate && geometry2.updateMatrix();\r\n\r\n\t\t\tmatrix = geometry2.matrix;\r\n\t\t\tgeometry2 = geometry2.geometry;\r\n\r\n\t\t}\r\n\r\n\t\tgeometry1.merge( geometry2, matrix, materialIndexOffset );\r\n\r\n\t},\r\n\r\n\tcenter: function ( geometry ) {\r\n\r\n\t\tconsole.warn( 'THREE.GeometryUtils: .center() has been moved to Geometry. Use geometry.center() instead.' );\r\n\t\treturn geometry.center();\r\n\r\n\t}\r\n\r\n};\r\n\r\n// File:src/extras/ImageUtils.js\r\n\r\n/**\r\n * @author alteredq / http://alteredqualia.com/\r\n * @author mrdoob / http://mrdoob.com/\r\n * @author Daosheng Mu / https://github.com/DaoshengMu/\r\n */\r\n\r\nTHREE.ImageUtils = {\r\n\r\n\tcrossOrigin: undefined,\r\n\r\n\tloadTexture: function ( url, mapping, onLoad, onError ) {\r\n\r\n\t\tvar loader = new THREE.ImageLoader();\r\n\t\tloader.crossOrigin = this.crossOrigin;\r\n\r\n\t\tvar texture = new THREE.Texture( undefined, mapping );\r\n\r\n\t\tloader.load( url, function ( image ) {\r\n\r\n\t\t\ttexture.image = image;\r\n\t\t\ttexture.needsUpdate = true;\r\n\r\n\t\t\tif ( onLoad ) onLoad( texture );\r\n\r\n\t\t}, undefined, function ( event ) {\r\n\r\n\t\t\tif ( onError ) onError( event );\r\n\r\n\t\t} );\r\n\r\n\t\ttexture.sourceFile = url;\r\n\r\n\t\treturn texture;\r\n\r\n\t},\r\n\r\n\tloadTextureCube: function ( array, mapping, onLoad, onError ) {\r\n\r\n\t\tvar images = [];\r\n\r\n\t\tvar loader = new THREE.ImageLoader();\r\n\t\tloader.crossOrigin = this.crossOrigin;\r\n\r\n\t\tvar texture = new THREE.CubeTexture( images, mapping );\r\n\r\n\t\tvar loaded = 0;\r\n\r\n\t\tvar loadTexture = function ( i ) {\r\n\r\n\t\t\tloader.load( array[ i ], function ( image ) {\r\n\r\n\t\t\t\ttexture.images[ i ] = image;\r\n\r\n\t\t\t\tloaded += 1;\r\n\r\n\t\t\t\tif ( loaded === 6 ) {\r\n\r\n\t\t\t\t\ttexture.needsUpdate = true;\r\n\r\n\t\t\t\t\tif ( onLoad ) onLoad( texture );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}, undefined, onError );\r\n\r\n\t\t};\r\n\r\n\t\tfor ( var i = 0, il = array.length; i < il; ++ i ) {\r\n\r\n\t\t\tloadTexture( i );\r\n\r\n\t\t}\r\n\r\n\t\treturn texture;\r\n\r\n\t},\r\n\r\n\tloadCompressedTexture: function () {\r\n\r\n\t\tconsole.error( 'THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.' )\r\n\r\n\t},\r\n\r\n\tloadCompressedTextureCube: function () {\r\n\r\n\t\tconsole.error( 'THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead.' )\r\n\r\n\t},\r\n\r\n\tgetNormalMap: function ( image, depth ) {\r\n\r\n\t\t// Adapted from http://www.paulbrunt.co.uk/lab/heightnormal/\r\n\r\n\t\tvar cross = function ( a, b ) {\r\n\r\n\t\t\treturn [ a[ 1 ] * b[ 2 ] - a[ 2 ] * b[ 1 ], a[ 2 ] * b[ 0 ] - a[ 0 ] * b[ 2 ], a[ 0 ] * b[ 1 ] - a[ 1 ] * b[ 0 ] ];\r\n\r\n\t\t};\r\n\r\n\t\tvar subtract = function ( a, b ) {\r\n\r\n\t\t\treturn [ a[ 0 ] - b[ 0 ], a[ 1 ] - b[ 1 ], a[ 2 ] - b[ 2 ] ];\r\n\r\n\t\t};\r\n\r\n\t\tvar normalize = function ( a ) {\r\n\r\n\t\t\tvar l = Math.sqrt( a[ 0 ] * a[ 0 ] + a[ 1 ] * a[ 1 ] + a[ 2 ] * a[ 2 ] );\r\n\t\t\treturn [ a[ 0 ] / l, a[ 1 ] / l, a[ 2 ] / l ];\r\n\r\n\t\t};\r\n\r\n\t\tdepth = depth | 1;\r\n\r\n\t\tvar width = image.width;\r\n\t\tvar height = image.height;\r\n\r\n\t\tvar canvas = document.createElement( 'canvas' );\r\n\t\tcanvas.width = width;\r\n\t\tcanvas.height = height;\r\n\r\n\t\tvar context = canvas.getContext( '2d' );\r\n\t\tcontext.drawImage( image, 0, 0 );\r\n\r\n\t\tvar data = context.getImageData( 0, 0, width, height ).data;\r\n\t\tvar imageData = context.createImageData( width, height );\r\n\t\tvar output = imageData.data;\r\n\r\n\t\tfor ( var x = 0; x < width; x ++ ) {\r\n\r\n\t\t\tfor ( var y = 0; y < height; y ++ ) {\r\n\r\n\t\t\t\tvar ly = y - 1 < 0 ? 0 : y - 1;\r\n\t\t\t\tvar uy = y + 1 > height - 1 ? height - 1 : y + 1;\r\n\t\t\t\tvar lx = x - 1 < 0 ? 0 : x - 1;\r\n\t\t\t\tvar ux = x + 1 > width - 1 ? width - 1 : x + 1;\r\n\r\n\t\t\t\tvar points = [];\r\n\t\t\t\tvar origin = [ 0, 0, data[ ( y * width + x ) * 4 ] / 255 * depth ];\r\n\t\t\t\tpoints.push( [ - 1, 0, data[ ( y * width + lx ) * 4 ] / 255 * depth ] );\r\n\t\t\t\tpoints.push( [ - 1, - 1, data[ ( ly * width + lx ) * 4 ] / 255 * depth ] );\r\n\t\t\t\tpoints.push( [ 0, - 1, data[ ( ly * width + x ) * 4 ] / 255 * depth ] );\r\n\t\t\t\tpoints.push( [ 1, - 1, data[ ( ly * width + ux ) * 4 ] / 255 * depth ] );\r\n\t\t\t\tpoints.push( [ 1, 0, data[ ( y * width + ux ) * 4 ] / 255 * depth ] );\r\n\t\t\t\tpoints.push( [ 1, 1, data[ ( uy * width + ux ) * 4 ] / 255 * depth ] );\r\n\t\t\t\tpoints.push( [ 0, 1, data[ ( uy * width + x ) * 4 ] / 255 * depth ] );\r\n\t\t\t\tpoints.push( [ - 1, 1, data[ ( uy * width + lx ) * 4 ] / 255 * depth ] );\r\n\r\n\t\t\t\tvar normals = [];\r\n\t\t\t\tvar num_points = points.length;\r\n\r\n\t\t\t\tfor ( var i = 0; i < num_points; i ++ ) {\r\n\r\n\t\t\t\t\tvar v1 = points[ i ];\r\n\t\t\t\t\tvar v2 = points[ ( i + 1 ) % num_points ];\r\n\t\t\t\t\tv1 = subtract( v1, origin );\r\n\t\t\t\t\tv2 = subtract( v2, origin );\r\n\t\t\t\t\tnormals.push( normalize( cross( v1, v2 ) ) );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tvar normal = [ 0, 0, 0 ];\r\n\r\n\t\t\t\tfor ( var i = 0; i < normals.length; i ++ ) {\r\n\r\n\t\t\t\t\tnormal[ 0 ] += normals[ i ][ 0 ];\r\n\t\t\t\t\tnormal[ 1 ] += normals[ i ][ 1 ];\r\n\t\t\t\t\tnormal[ 2 ] += normals[ i ][ 2 ];\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tnormal[ 0 ] /= normals.length;\r\n\t\t\t\tnormal[ 1 ] /= normals.length;\r\n\t\t\t\tnormal[ 2 ] /= normals.length;\r\n\r\n\t\t\t\tvar idx = ( y * width + x ) * 4;\r\n\r\n\t\t\t\toutput[ idx ] = ( ( normal[ 0 ] + 1.0 ) / 2.0 * 255 ) | 0;\r\n\t\t\t\toutput[ idx + 1 ] = ( ( normal[ 1 ] + 1.0 ) / 2.0 * 255 ) | 0;\r\n\t\t\t\toutput[ idx + 2 ] = ( normal[ 2 ] * 255 ) | 0;\r\n\t\t\t\toutput[ idx + 3 ] = 255;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tcontext.putImageData( imageData, 0, 0 );\r\n\r\n\t\treturn canvas;\r\n\r\n\t},\r\n\r\n\tgenerateDataTexture: function ( width, height, color ) {\r\n\r\n\t\tvar size = width * height;\r\n\t\tvar data = new Uint8Array( 3 * size );\r\n\r\n\t\tvar r = Math.floor( color.r * 255 );\r\n\t\tvar g = Math.floor( color.g * 255 );\r\n\t\tvar b = Math.floor( color.b * 255 );\r\n\r\n\t\tfor ( var i = 0; i < size; i ++ ) {\r\n\r\n\t\t\tdata[ i * 3 ] \t = r;\r\n\t\t\tdata[ i * 3 + 1 ] = g;\r\n\t\t\tdata[ i * 3 + 2 ] = b;\r\n\r\n\t\t}\r\n\r\n\t\tvar texture = new THREE.DataTexture( data, width, height, THREE.RGBFormat );\r\n\t\ttexture.needsUpdate = true;\r\n\r\n\t\treturn texture;\r\n\r\n\t}\r\n\r\n};\r\n\r\n// File:src/extras/SceneUtils.js\r\n\r\n/**\r\n * @author alteredq / http://alteredqualia.com/\r\n */\r\n\r\nTHREE.SceneUtils = {\r\n\r\n\tcreateMultiMaterialObject: function ( geometry, materials ) {\r\n\r\n\t\tvar group = new THREE.Group();\r\n\r\n\t\tfor ( var i = 0, l = materials.length; i < l; i ++ ) {\r\n\r\n\t\t\tgroup.add( new THREE.Mesh( geometry, materials[ i ] ) );\r\n\r\n\t\t}\r\n\r\n\t\treturn group;\r\n\r\n\t},\r\n\r\n\tdetach: function ( child, parent, scene ) {\r\n\r\n\t\tchild.applyMatrix( parent.matrixWorld );\r\n\t\tparent.remove( child );\r\n\t\tscene.add( child );\r\n\r\n\t},\r\n\r\n\tattach: function ( child, scene, parent ) {\r\n\r\n\t\tvar matrixWorldInverse = new THREE.Matrix4();\r\n\t\tmatrixWorldInverse.getInverse( parent.matrixWorld );\r\n\t\tchild.applyMatrix( matrixWorldInverse );\r\n\r\n\t\tscene.remove( child );\r\n\t\tparent.add( child );\r\n\r\n\t}\r\n\r\n};\r\n\r\n// File:src/extras/FontUtils.js\r\n\r\n/**\r\n * @author zz85 / http://www.lab4games.net/zz85/blog\r\n * @author alteredq / http://alteredqualia.com/\r\n *\r\n * For Text operations in three.js (See TextGeometry)\r\n *\r\n * It uses techniques used in:\r\n *\r\n *\tTriangulation ported from AS3\r\n *\t\tSimple Polygon Triangulation\r\n *\t\thttp://actionsnippet.com/?p=1462\r\n *\r\n * \tA Method to triangulate shapes with holes\r\n *\t\thttp://www.sakri.net/blog/2009/06/12/an-approach-to-triangulating-polygons-with-holes/\r\n *\r\n */\r\n\r\nTHREE.FontUtils = {\r\n\r\n\tfaces: {},\r\n\r\n\t// Just for now. face[weight][style]\r\n\r\n\tface: 'helvetiker',\r\n\tweight: 'normal',\r\n\tstyle: 'normal',\r\n\tsize: 150,\r\n\tdivisions: 10,\r\n\r\n\tgetFace: function () {\r\n\r\n\t\ttry {\r\n\r\n\t\t\treturn this.faces[ this.face.toLowerCase() ][ this.weight ][ this.style ];\r\n\r\n\t\t} catch ( e ) {\r\n\r\n\t\t\tthrow \"The font \" + this.face + \" with \" + this.weight + \" weight and \" + this.style + \" style is missing.\"\r\n\r\n\t\t}\r\n\r\n\t},\r\n\r\n\tloadFace: function ( data ) {\r\n\r\n\t\tvar family = data.familyName.toLowerCase();\r\n\r\n\t\tvar ThreeFont = this;\r\n\r\n\t\tThreeFont.faces[ family ] = ThreeFont.faces[ family ] || {};\r\n\r\n\t\tThreeFont.faces[ family ][ data.cssFontWeight ] = ThreeFont.faces[ family ][ data.cssFontWeight ] || {};\r\n\t\tThreeFont.faces[ family ][ data.cssFontWeight ][ data.cssFontStyle ] = data;\r\n\r\n\t\tThreeFont.faces[ family ][ data.cssFontWeight ][ data.cssFontStyle ] = data;\r\n\r\n\t\treturn data;\r\n\r\n\t},\r\n\r\n\tdrawText: function ( text ) {\r\n\r\n\t\t// RenderText\r\n\r\n\t\tvar i,\r\n\t\t\tface = this.getFace(),\r\n\t\t\tscale = this.size / face.resolution,\r\n\t\t\toffset = 0,\r\n\t\t\tchars = String( text ).split( '' ),\r\n\t\t\tlength = chars.length;\r\n\r\n\t\tvar fontPaths = [];\r\n\r\n\t\tfor ( i = 0; i < length; i ++ ) {\r\n\r\n\t\t\tvar path = new THREE.Path();\r\n\r\n\t\t\tvar ret = this.extractGlyphPoints( chars[ i ], face, scale, offset, path );\r\n\t\t\toffset += ret.offset;\r\n\r\n\t\t\tfontPaths.push( ret.path );\r\n\r\n\t\t}\r\n\r\n\t\t// get the width\r\n\r\n\t\tvar width = offset / 2;\r\n\t\t//\r\n\t\t// for ( p = 0; p < allPts.length; p++ ) {\r\n\t\t//\r\n\t\t// \tallPts[ p ].x -= width;\r\n\t\t//\r\n\t\t// }\r\n\r\n\t\t//var extract = this.extractPoints( allPts, characterPts );\r\n\t\t//extract.contour = allPts;\r\n\r\n\t\t//extract.paths = fontPaths;\r\n\t\t//extract.offset = width;\r\n\r\n\t\treturn { paths: fontPaths, offset: width };\r\n\r\n\t},\r\n\r\n\r\n\r\n\r\n\textractGlyphPoints: function ( c, face, scale, offset, path ) {\r\n\r\n\t\tvar pts = [];\r\n\r\n\t\tvar i, i2, divisions,\r\n\t\t\toutline, action, length,\r\n\t\t\tscaleX, scaleY,\r\n\t\t\tx, y, cpx, cpy, cpx0, cpy0, cpx1, cpy1, cpx2, cpy2,\r\n\t\t\tlaste,\r\n\t\t\tglyph = face.glyphs[ c ] || face.glyphs[ '?' ];\r\n\r\n\t\tif ( ! glyph ) return;\r\n\r\n\t\tif ( glyph.o ) {\r\n\r\n\t\t\toutline = glyph._cachedOutline || ( glyph._cachedOutline = glyph.o.split( ' ' ) );\r\n\t\t\tlength = outline.length;\r\n\r\n\t\t\tscaleX = scale;\r\n\t\t\tscaleY = scale;\r\n\r\n\t\t\tfor ( i = 0; i < length; ) {\r\n\r\n\t\t\t\taction = outline[ i ++ ];\r\n\r\n\t\t\t\t//console.log( action );\r\n\r\n\t\t\t\tswitch ( action ) {\r\n\r\n\t\t\t\tcase 'm':\r\n\r\n\t\t\t\t\t// Move To\r\n\r\n\t\t\t\t\tx = outline[ i ++ ] * scaleX + offset;\r\n\t\t\t\t\ty = outline[ i ++ ] * scaleY;\r\n\r\n\t\t\t\t\tpath.moveTo( x, y );\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase 'l':\r\n\r\n\t\t\t\t\t// Line To\r\n\r\n\t\t\t\t\tx = outline[ i ++ ] * scaleX + offset;\r\n\t\t\t\t\ty = outline[ i ++ ] * scaleY;\r\n\t\t\t\t\tpath.lineTo( x, y );\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase 'q':\r\n\r\n\t\t\t\t\t// QuadraticCurveTo\r\n\r\n\t\t\t\t\tcpx = outline[ i ++ ] * scaleX + offset;\r\n\t\t\t\t\tcpy = outline[ i ++ ] * scaleY;\r\n\t\t\t\t\tcpx1 = outline[ i ++ ] * scaleX + offset;\r\n\t\t\t\t\tcpy1 = outline[ i ++ ] * scaleY;\r\n\r\n\t\t\t\t\tpath.quadraticCurveTo( cpx1, cpy1, cpx, cpy );\r\n\r\n\t\t\t\t\tlaste = pts[ pts.length - 1 ];\r\n\r\n\t\t\t\t\tif ( laste ) {\r\n\r\n\t\t\t\t\t\tcpx0 = laste.x;\r\n\t\t\t\t\t\tcpy0 = laste.y;\r\n\r\n\t\t\t\t\t\tfor ( i2 = 1, divisions = this.divisions; i2 <= divisions; i2 ++ ) {\r\n\r\n\t\t\t\t\t\t\tvar t = i2 / divisions;\r\n\t\t\t\t\t\t\tTHREE.Shape.Utils.b2( t, cpx0, cpx1, cpx );\r\n\t\t\t\t\t\t\tTHREE.Shape.Utils.b2( t, cpy0, cpy1, cpy );\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase 'b':\r\n\r\n\t\t\t\t\t// Cubic Bezier Curve\r\n\r\n\t\t\t\t\tcpx = outline[ i ++ ] * scaleX + offset;\r\n\t\t\t\t\tcpy = outline[ i ++ ] * scaleY;\r\n\t\t\t\t\tcpx1 = outline[ i ++ ] * scaleX + offset;\r\n\t\t\t\t\tcpy1 = outline[ i ++ ] * scaleY;\r\n\t\t\t\t\tcpx2 = outline[ i ++ ] * scaleX + offset;\r\n\t\t\t\t\tcpy2 = outline[ i ++ ] * scaleY;\r\n\r\n\t\t\t\t\tpath.bezierCurveTo( cpx1, cpy1, cpx2, cpy2, cpx, cpy );\r\n\r\n\t\t\t\t\tlaste = pts[ pts.length - 1 ];\r\n\r\n\t\t\t\t\tif ( laste ) {\r\n\r\n\t\t\t\t\t\tcpx0 = laste.x;\r\n\t\t\t\t\t\tcpy0 = laste.y;\r\n\r\n\t\t\t\t\t\tfor ( i2 = 1, divisions = this.divisions; i2 <= divisions; i2 ++ ) {\r\n\r\n\t\t\t\t\t\t\tvar t = i2 / divisions;\r\n\t\t\t\t\t\t\tTHREE.Shape.Utils.b3( t, cpx0, cpx1, cpx2, cpx );\r\n\t\t\t\t\t\t\tTHREE.Shape.Utils.b3( t, cpy0, cpy1, cpy2, cpy );\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\r\n\r\n\t\treturn { offset: glyph.ha * scale, path: path };\r\n\r\n\t}\r\n\r\n};\r\n\r\n\r\nTHREE.FontUtils.generateShapes = function ( text, parameters ) {\r\n\r\n\t// Parameters\r\n\r\n\tparameters = parameters || {};\r\n\r\n\tvar size = parameters.size !== undefined ? parameters.size : 100;\r\n\tvar curveSegments = parameters.curveSegments !== undefined ? parameters.curveSegments : 4;\r\n\r\n\tvar font = parameters.font !== undefined ? parameters.font : 'helvetiker';\r\n\tvar weight = parameters.weight !== undefined ? parameters.weight : 'normal';\r\n\tvar style = parameters.style !== undefined ? parameters.style : 'normal';\r\n\r\n\tTHREE.FontUtils.size = size;\r\n\tTHREE.FontUtils.divisions = curveSegments;\r\n\r\n\tTHREE.FontUtils.face = font;\r\n\tTHREE.FontUtils.weight = weight;\r\n\tTHREE.FontUtils.style = style;\r\n\r\n\t// Get a Font data json object\r\n\r\n\tvar data = THREE.FontUtils.drawText( text );\r\n\r\n\tvar paths = data.paths;\r\n\tvar shapes = [];\r\n\r\n\tfor ( var p = 0, pl = paths.length; p < pl; p ++ ) {\r\n\r\n\t\tArray.prototype.push.apply( shapes, paths[ p ].toShapes() );\r\n\r\n\t}\r\n\r\n\treturn shapes;\r\n\r\n};\r\n\r\n\r\n/**\r\n * This code is a quick port of code written in C++ which was submitted to\r\n * flipcode.com by John W. Ratcliff // July 22, 2000\r\n * See original code and more information here:\r\n * http://www.flipcode.com/archives/Efficient_Polygon_Triangulation.shtml\r\n *\r\n * ported to actionscript by Zevan Rosser\r\n * www.actionsnippet.com\r\n *\r\n * ported to javascript by Joshua Koo\r\n * http://www.lab4games.net/zz85/blog\r\n *\r\n */\r\n\r\n\r\n( function ( namespace ) {\r\n\r\n\tvar EPSILON = 0.0000000001;\r\n\r\n\t// takes in an contour array and returns\r\n\r\n\tvar process = function ( contour, indices ) {\r\n\r\n\t\tvar n = contour.length;\r\n\r\n\t\tif ( n < 3 ) return null;\r\n\r\n\t\tvar result = [],\r\n\t\t\tverts = [],\r\n\t\t\tvertIndices = [];\r\n\r\n\t\t/* we want a counter-clockwise polygon in verts */\r\n\r\n\t\tvar u, v, w;\r\n\r\n\t\tif ( area( contour ) > 0.0 ) {\r\n\r\n\t\t\tfor ( v = 0; v < n; v ++ ) verts[ v ] = v;\r\n\r\n\t\t} else {\r\n\r\n\t\t\tfor ( v = 0; v < n; v ++ ) verts[ v ] = ( n - 1 ) - v;\r\n\r\n\t\t}\r\n\r\n\t\tvar nv = n;\r\n\r\n\t\t/* remove nv - 2 vertices, creating 1 triangle every time */\r\n\r\n\t\tvar count = 2 * nv; /* error detection */\r\n\r\n\t\tfor ( v = nv - 1; nv > 2; ) {\r\n\r\n\t\t\t/* if we loop, it is probably a non-simple polygon */\r\n\r\n\t\t\tif ( ( count -- ) <= 0 ) {\r\n\r\n\t\t\t\t//** Triangulate: ERROR - probable bad polygon!\r\n\r\n\t\t\t\t//throw ( \"Warning, unable to triangulate polygon!\" );\r\n\t\t\t\t//return null;\r\n\t\t\t\t// Sometimes warning is fine, especially polygons are triangulated in reverse.\r\n\t\t\t\tconsole.warn( 'THREE.FontUtils: Warning, unable to triangulate polygon! in Triangulate.process()' );\r\n\r\n\t\t\t\tif ( indices ) return vertIndices;\r\n\t\t\t\treturn result;\r\n\r\n\t\t\t}\r\n\r\n\t\t\t/* three consecutive vertices in current polygon, */\r\n\r\n\t\t\tu = v; \t \tif ( nv <= u ) u = 0; /* previous */\r\n\t\t\tv = u + 1; if ( nv <= v ) v = 0; /* new v */\r\n\t\t\tw = v + 1; if ( nv <= w ) w = 0; /* next */\r\n\r\n\t\t\tif ( snip( contour, u, v, w, nv, verts ) ) {\r\n\r\n\t\t\t\tvar a, b, c, s, t;\r\n\r\n\t\t\t\t/* true names of the vertices */\r\n\r\n\t\t\t\ta = verts[ u ];\r\n\t\t\t\tb = verts[ v ];\r\n\t\t\t\tc = verts[ w ];\r\n\r\n\t\t\t\t/* output Triangle */\r\n\r\n\t\t\t\tresult.push( [ contour[ a ],\r\n\t\t\t\t\tcontour[ b ],\r\n\t\t\t\t\tcontour[ c ] ] );\r\n\r\n\r\n\t\t\t\tvertIndices.push( [ verts[ u ], verts[ v ], verts[ w ] ] );\r\n\r\n\t\t\t\t/* remove v from the remaining polygon */\r\n\r\n\t\t\t\tfor ( s = v, t = v + 1; t < nv; s ++, t ++ ) {\r\n\r\n\t\t\t\t\tverts[ s ] = verts[ t ];\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tnv --;\r\n\r\n\t\t\t\t/* reset error detection counter */\r\n\r\n\t\t\t\tcount = 2 * nv;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tif ( indices ) return vertIndices;\r\n\t\treturn result;\r\n\r\n\t};\r\n\r\n\t// calculate area of the contour polygon\r\n\r\n\tvar area = function ( contour ) {\r\n\r\n\t\tvar n = contour.length;\r\n\t\tvar a = 0.0;\r\n\r\n\t\tfor ( var p = n - 1, q = 0; q < n; p = q ++ ) {\r\n\r\n\t\t\ta += contour[ p ].x * contour[ q ].y - contour[ q ].x * contour[ p ].y;\r\n\r\n\t\t}\r\n\r\n\t\treturn a * 0.5;\r\n\r\n\t};\r\n\r\n\tvar snip = function ( contour, u, v, w, n, verts ) {\r\n\r\n\t\tvar p;\r\n\t\tvar ax, ay, bx, by;\r\n\t\tvar cx, cy, px, py;\r\n\r\n\t\tax = contour[ verts[ u ] ].x;\r\n\t\tay = contour[ verts[ u ] ].y;\r\n\r\n\t\tbx = contour[ verts[ v ] ].x;\r\n\t\tby = contour[ verts[ v ] ].y;\r\n\r\n\t\tcx = contour[ verts[ w ] ].x;\r\n\t\tcy = contour[ verts[ w ] ].y;\r\n\r\n\t\tif ( EPSILON > ( ( ( bx - ax ) * ( cy - ay ) ) - ( ( by - ay ) * ( cx - ax ) ) ) ) return false;\r\n\r\n\t\tvar aX, aY, bX, bY, cX, cY;\r\n\t\tvar apx, apy, bpx, bpy, cpx, cpy;\r\n\t\tvar cCROSSap, bCROSScp, aCROSSbp;\r\n\r\n\t\taX = cx - bx; aY = cy - by;\r\n\t\tbX = ax - cx; bY = ay - cy;\r\n\t\tcX = bx - ax; cY = by - ay;\r\n\r\n\t\tfor ( p = 0; p < n; p ++ ) {\r\n\r\n\t\t\tpx = contour[ verts[ p ] ].x;\r\n\t\t\tpy = contour[ verts[ p ] ].y;\r\n\r\n\t\t\tif ( ( ( px === ax ) && ( py === ay ) ) ||\r\n\t\t\t\t ( ( px === bx ) && ( py === by ) ) ||\r\n\t\t\t\t ( ( px === cx ) && ( py === cy ) ) )\tcontinue;\r\n\r\n\t\t\tapx = px - ax; apy = py - ay;\r\n\t\t\tbpx = px - bx; bpy = py - by;\r\n\t\t\tcpx = px - cx; cpy = py - cy;\r\n\r\n\t\t\t// see if p is inside triangle abc\r\n\r\n\t\t\taCROSSbp = aX * bpy - aY * bpx;\r\n\t\t\tcCROSSap = cX * apy - cY * apx;\r\n\t\t\tbCROSScp = bX * cpy - bY * cpx;\r\n\r\n\t\t\tif ( ( aCROSSbp >= - EPSILON ) && ( bCROSScp >= - EPSILON ) && ( cCROSSap >= - EPSILON ) ) return false;\r\n\r\n\t\t}\r\n\r\n\t\treturn true;\r\n\r\n\t};\r\n\r\n\r\n\tnamespace.Triangulate = process;\r\n\tnamespace.Triangulate.area = area;\r\n\r\n\treturn namespace;\r\n\r\n} )( THREE.FontUtils );\r\n\r\n// To use the typeface.js face files, hook up the API\r\n\r\nTHREE.typeface_js = { faces: THREE.FontUtils.faces, loadFace: THREE.FontUtils.loadFace };\r\nif ( typeof self !== 'undefined' ) self._typeface_js = THREE.typeface_js;\r\n\r\n// File:src/extras/audio/Audio.js\r\n\r\n/**\r\n * @author mrdoob / http://mrdoob.com/\r\n */\r\n\r\nTHREE.Audio = function ( listener ) {\r\n\r\n\tTHREE.Object3D.call( this );\r\n\r\n\tthis.type = 'Audio';\r\n\r\n\tthis.context = listener.context;\r\n\tthis.source = this.context.createBufferSource();\r\n\tthis.source.onended = this.onEnded.bind( this );\r\n\r\n\tthis.gain = this.context.createGain();\r\n\tthis.gain.connect( this.context.destination );\r\n\r\n\tthis.panner = this.context.createPanner();\r\n\tthis.panner.connect( this.gain );\r\n\r\n\tthis.autoplay = false;\r\n\r\n\tthis.startTime = 0;\r\n\tthis.playbackRate = 1;\r\n\tthis.isPlaying = false;\r\n\r\n};\r\n\r\nTHREE.Audio.prototype = Object.create( THREE.Object3D.prototype );\r\nTHREE.Audio.prototype.constructor = THREE.Audio;\r\n\r\nTHREE.Audio.prototype.load = function ( file ) {\r\n\r\n\tvar scope = this;\r\n\r\n\tvar request = new XMLHttpRequest();\r\n\trequest.open( 'GET', file, true );\r\n\trequest.responseType = 'arraybuffer';\r\n\trequest.onload = function ( e ) {\r\n\r\n\t\tscope.context.decodeAudioData( this.response, function ( buffer ) {\r\n\r\n\t\t\tscope.source.buffer = buffer;\r\n\r\n\t\t\tif ( scope.autoplay ) scope.play();\r\n\r\n\t\t} );\r\n\r\n\t};\r\n\trequest.send();\r\n\r\n\treturn this;\r\n\r\n};\r\n\r\nTHREE.Audio.prototype.play = function () {\r\n\r\n\tif ( this.isPlaying === true ) {\r\n\r\n\t\tconsole.warn( 'THREE.Audio: Audio is already playing.' );\r\n\t\treturn;\r\n\r\n\t}\r\n\r\n\tvar source = this.context.createBufferSource();\r\n\r\n\tsource.buffer = this.source.buffer;\r\n\tsource.loop = this.source.loop;\r\n\tsource.onended = this.source.onended;\r\n\tsource.start( 0, this.startTime );\r\n\tsource.playbackRate.value = this.playbackRate;\r\n\r\n\tthis.isPlaying = true;\r\n\r\n\tthis.source = source;\r\n\r\n\tthis.connect();\r\n\r\n};\r\n\r\nTHREE.Audio.prototype.pause = function () {\r\n\r\n\tthis.source.stop();\r\n\tthis.startTime = this.context.currentTime;\r\n\r\n};\r\n\r\nTHREE.Audio.prototype.stop = function () {\r\n\r\n\tthis.source.stop();\r\n\tthis.startTime = 0;\r\n\r\n};\r\n\r\nTHREE.Audio.prototype.connect = function () {\r\n\r\n\tif ( this.filter !== undefined ) {\r\n\r\n\t\tthis.source.connect( this.filter );\r\n\t\tthis.filter.connect( this.panner );\r\n\r\n\t} else {\r\n\r\n\t\tthis.source.connect( this.panner );\r\n\r\n\t}\r\n\r\n};\r\n\r\nTHREE.Audio.prototype.disconnect = function () {\r\n\r\n\tif ( this.filter !== undefined ) {\r\n\r\n\t\tthis.source.disconnect( this.filter );\r\n\t\tthis.filter.disconnect( this.panner );\r\n\r\n\t} else {\r\n\r\n\t\tthis.source.disconnect( this.panner );\r\n\r\n\t}\r\n\r\n};\r\n\r\nTHREE.Audio.prototype.setFilter = function ( value ) {\r\n\r\n\tif ( this.isPlaying === true ) {\r\n\r\n\t\tthis.disconnect();\r\n\t\tthis.filter = value;\r\n\t\tthis.connect();\r\n\r\n\t} else {\r\n\r\n\t\tthis.filter = value;\r\n\r\n\t}\r\n\r\n};\r\n\r\nTHREE.Audio.prototype.getFilter = function () {\r\n\r\n\treturn this.filter;\r\n\r\n};\r\n\r\nTHREE.Audio.prototype.setPlaybackRate = function ( value ) {\r\n\r\n\tthis.playbackRate = value;\r\n\r\n\tif ( this.isPlaying === true ) {\r\n\r\n\t\tthis.source.playbackRate.value = this.playbackRate;\r\n\r\n\t}\r\n\r\n};\r\n\r\nTHREE.Audio.prototype.getPlaybackRate = function () {\r\n\r\n\treturn this.playbackRate;\r\n\r\n};\r\n\r\nTHREE.Audio.prototype.onEnded = function() {\r\n\r\n\tthis.isPlaying = false;\r\n\r\n};\r\n\r\nTHREE.Audio.prototype.setLoop = function ( value ) {\r\n\r\n\tthis.source.loop = value;\r\n\r\n};\r\n\r\nTHREE.Audio.prototype.getLoop = function () {\r\n\r\n\treturn this.source.loop;\r\n\r\n};\r\n\r\nTHREE.Audio.prototype.setRefDistance = function ( value ) {\r\n\r\n\tthis.panner.refDistance = value;\r\n\r\n};\r\n\r\nTHREE.Audio.prototype.getRefDistance = function () {\r\n\r\n\treturn this.panner.refDistance;\r\n\r\n};\r\n\r\nTHREE.Audio.prototype.setRolloffFactor = function ( value ) {\r\n\r\n\tthis.panner.rolloffFactor = value;\r\n\r\n};\r\n\r\nTHREE.Audio.prototype.getRolloffFactor = function () {\r\n\r\n\treturn this.panner.rolloffFactor;\r\n\r\n};\r\n\r\nTHREE.Audio.prototype.setVolume = function ( value ) {\r\n\r\n\tthis.gain.gain.value = value;\r\n\r\n};\r\n\r\nTHREE.Audio.prototype.getVolume = function () {\r\n\r\n\treturn this.gain.gain.value;\r\n\r\n};\r\n\r\nTHREE.Audio.prototype.updateMatrixWorld = ( function () {\r\n\r\n\tvar position = new THREE.Vector3();\r\n\r\n\treturn function updateMatrixWorld( force ) {\r\n\r\n\t\tTHREE.Object3D.prototype.updateMatrixWorld.call( this, force );\r\n\r\n\t\tposition.setFromMatrixPosition( this.matrixWorld );\r\n\r\n\t\tthis.panner.setPosition( position.x, position.y, position.z );\r\n\r\n\t};\r\n\r\n} )();\r\n\r\n// File:src/extras/audio/AudioListener.js\r\n\r\n/**\r\n * @author mrdoob / http://mrdoob.com/\r\n */\r\n\r\nTHREE.AudioListener = function () {\r\n\r\n\tTHREE.Object3D.call( this );\r\n\r\n\tthis.type = 'AudioListener';\r\n\r\n\tthis.context = new ( window.AudioContext || window.webkitAudioContext )();\r\n\r\n};\r\n\r\nTHREE.AudioListener.prototype = Object.create( THREE.Object3D.prototype );\r\nTHREE.AudioListener.prototype.constructor = THREE.AudioListener;\r\n\r\nTHREE.AudioListener.prototype.updateMatrixWorld = ( function () {\r\n\r\n\tvar position = new THREE.Vector3();\r\n\tvar quaternion = new THREE.Quaternion();\r\n\tvar scale = new THREE.Vector3();\r\n\r\n\tvar orientation = new THREE.Vector3();\r\n\r\n\treturn function updateMatrixWorld( force ) {\r\n\r\n\t\tTHREE.Object3D.prototype.updateMatrixWorld.call( this, force );\r\n\r\n\t\tvar listener = this.context.listener;\r\n\t\tvar up = this.up;\r\n\r\n\t\tthis.matrixWorld.decompose( position, quaternion, scale );\r\n\r\n\t\torientation.set( 0, 0, - 1 ).applyQuaternion( quaternion );\r\n\r\n\t\tlistener.setPosition( position.x, position.y, position.z );\r\n\t\tlistener.setOrientation( orientation.x, orientation.y, orientation.z, up.x, up.y, up.z );\r\n\r\n\t};\r\n\r\n} )();\r\n\r\n// File:src/extras/core/Curve.js\r\n\r\n/**\r\n * @author zz85 / http://www.lab4games.net/zz85/blog\r\n * Extensible curve object\r\n *\r\n * Some common of Curve methods\r\n * .getPoint(t), getTangent(t)\r\n * .getPointAt(u), getTagentAt(u)\r\n * .getPoints(), .getSpacedPoints()\r\n * .getLength()\r\n * .updateArcLengths()\r\n *\r\n * This following classes subclasses THREE.Curve:\r\n *\r\n * -- 2d classes --\r\n * THREE.LineCurve\r\n * THREE.QuadraticBezierCurve\r\n * THREE.CubicBezierCurve\r\n * THREE.SplineCurve\r\n * THREE.ArcCurve\r\n * THREE.EllipseCurve\r\n *\r\n * -- 3d classes --\r\n * THREE.LineCurve3\r\n * THREE.QuadraticBezierCurve3\r\n * THREE.CubicBezierCurve3\r\n * THREE.SplineCurve3\r\n * THREE.ClosedSplineCurve3\r\n *\r\n * A series of curves can be represented as a THREE.CurvePath\r\n *\r\n **/\r\n\r\n/**************************************************************\r\n *\tAbstract Curve base class\r\n **************************************************************/\r\n\r\nTHREE.Curve = function () {\r\n\r\n};\r\n\r\n// Virtual base class method to overwrite and implement in subclasses\r\n//\t- t [0 .. 1]\r\n\r\nTHREE.Curve.prototype.getPoint = function ( t ) {\r\n\r\n\tconsole.warn( \"THREE.Curve: Warning, getPoint() not implemented!\" );\r\n\treturn null;\r\n\r\n};\r\n\r\n// Get point at relative position in curve according to arc length\r\n// - u [0 .. 1]\r\n\r\nTHREE.Curve.prototype.getPointAt = function ( u ) {\r\n\r\n\tvar t = this.getUtoTmapping( u );\r\n\treturn this.getPoint( t );\r\n\r\n};\r\n\r\n// Get sequence of points using getPoint( t )\r\n\r\nTHREE.Curve.prototype.getPoints = function ( divisions ) {\r\n\r\n\tif ( ! divisions ) divisions = 5;\r\n\r\n\tvar d, pts = [];\r\n\r\n\tfor ( d = 0; d <= divisions; d ++ ) {\r\n\r\n\t\tpts.push( this.getPoint( d / divisions ) );\r\n\r\n\t}\r\n\r\n\treturn pts;\r\n\r\n};\r\n\r\n// Get sequence of points using getPointAt( u )\r\n\r\nTHREE.Curve.prototype.getSpacedPoints = function ( divisions ) {\r\n\r\n\tif ( ! divisions ) divisions = 5;\r\n\r\n\tvar d, pts = [];\r\n\r\n\tfor ( d = 0; d <= divisions; d ++ ) {\r\n\r\n\t\tpts.push( this.getPointAt( d / divisions ) );\r\n\r\n\t}\r\n\r\n\treturn pts;\r\n\r\n};\r\n\r\n// Get total curve arc length\r\n\r\nTHREE.Curve.prototype.getLength = function () {\r\n\r\n\tvar lengths = this.getLengths();\r\n\treturn lengths[ lengths.length - 1 ];\r\n\r\n};\r\n\r\n// Get list of cumulative segment lengths\r\n\r\nTHREE.Curve.prototype.getLengths = function ( divisions ) {\r\n\r\n\tif ( ! divisions ) divisions = ( this.__arcLengthDivisions ) ? ( this.__arcLengthDivisions ) : 200;\r\n\r\n\tif ( this.cacheArcLengths\r\n\t\t&& ( this.cacheArcLengths.length === divisions + 1 )\r\n\t\t&& ! this.needsUpdate ) {\r\n\r\n\t\t//console.log( \"cached\", this.cacheArcLengths );\r\n\t\treturn this.cacheArcLengths;\r\n\r\n\t}\r\n\r\n\tthis.needsUpdate = false;\r\n\r\n\tvar cache = [];\r\n\tvar current, last = this.getPoint( 0 );\r\n\tvar p, sum = 0;\r\n\r\n\tcache.push( 0 );\r\n\r\n\tfor ( p = 1; p <= divisions; p ++ ) {\r\n\r\n\t\tcurrent = this.getPoint ( p / divisions );\r\n\t\tsum += current.distanceTo( last );\r\n\t\tcache.push( sum );\r\n\t\tlast = current;\r\n\r\n\t}\r\n\r\n\tthis.cacheArcLengths = cache;\r\n\r\n\treturn cache; // { sums: cache, sum:sum }; Sum is in the last element.\r\n\r\n};\r\n\r\n\r\nTHREE.Curve.prototype.updateArcLengths = function() {\r\n\r\n\tthis.needsUpdate = true;\r\n\tthis.getLengths();\r\n\r\n};\r\n\r\n// Given u ( 0 .. 1 ), get a t to find p. This gives you points which are equidistant\r\n\r\nTHREE.Curve.prototype.getUtoTmapping = function ( u, distance ) {\r\n\r\n\tvar arcLengths = this.getLengths();\r\n\r\n\tvar i = 0, il = arcLengths.length;\r\n\r\n\tvar targetArcLength; // The targeted u distance value to get\r\n\r\n\tif ( distance ) {\r\n\r\n\t\ttargetArcLength = distance;\r\n\r\n\t} else {\r\n\r\n\t\ttargetArcLength = u * arcLengths[ il - 1 ];\r\n\r\n\t}\r\n\r\n\t//var time = Date.now();\r\n\r\n\t// binary search for the index with largest value smaller than target u distance\r\n\r\n\tvar low = 0, high = il - 1, comparison;\r\n\r\n\twhile ( low <= high ) {\r\n\r\n\t\ti = Math.floor( low + ( high - low ) / 2 ); // less likely to overflow, though probably not issue here, JS doesn't really have integers, all numbers are floats\r\n\r\n\t\tcomparison = arcLengths[ i ] - targetArcLength;\r\n\r\n\t\tif ( comparison < 0 ) {\r\n\r\n\t\t\tlow = i + 1;\r\n\r\n\t\t} else if ( comparison > 0 ) {\r\n\r\n\t\t\thigh = i - 1;\r\n\r\n\t\t} else {\r\n\r\n\t\t\thigh = i;\r\n\t\t\tbreak;\r\n\r\n\t\t\t// DONE\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\ti = high;\r\n\r\n\t//console.log('b' , i, low, high, Date.now()- time);\r\n\r\n\tif ( arcLengths[ i ] === targetArcLength ) {\r\n\r\n\t\tvar t = i / ( il - 1 );\r\n\t\treturn t;\r\n\r\n\t}\r\n\r\n\t// we could get finer grain at lengths, or use simple interpolation between two points\r\n\r\n\tvar lengthBefore = arcLengths[ i ];\r\n\tvar lengthAfter = arcLengths[ i + 1 ];\r\n\r\n\tvar segmentLength = lengthAfter - lengthBefore;\r\n\r\n\t// determine where we are between the 'before' and 'after' points\r\n\r\n\tvar segmentFraction = ( targetArcLength - lengthBefore ) / segmentLength;\r\n\r\n\t// add that fractional amount to t\r\n\r\n\tvar t = ( i + segmentFraction ) / ( il - 1 );\r\n\r\n\treturn t;\r\n\r\n};\r\n\r\n// Returns a unit vector tangent at t\r\n// In case any sub curve does not implement its tangent derivation,\r\n// 2 points a small delta apart will be used to find its gradient\r\n// which seems to give a reasonable approximation\r\n\r\nTHREE.Curve.prototype.getTangent = function( t ) {\r\n\r\n\tvar delta = 0.0001;\r\n\tvar t1 = t - delta;\r\n\tvar t2 = t + delta;\r\n\r\n\t// Capping in case of danger\r\n\r\n\tif ( t1 < 0 ) t1 = 0;\r\n\tif ( t2 > 1 ) t2 = 1;\r\n\r\n\tvar pt1 = this.getPoint( t1 );\r\n\tvar pt2 = this.getPoint( t2 );\r\n\r\n\tvar vec = pt2.clone().sub( pt1 );\r\n\treturn vec.normalize();\r\n\r\n};\r\n\r\n\r\nTHREE.Curve.prototype.getTangentAt = function ( u ) {\r\n\r\n\tvar t = this.getUtoTmapping( u );\r\n\treturn this.getTangent( t );\r\n\r\n};\r\n\r\n\r\n\r\n\r\n\r\n/**************************************************************\r\n *\tUtils\r\n **************************************************************/\r\n\r\nTHREE.Curve.Utils = {\r\n\r\n\ttangentQuadraticBezier: function ( t, p0, p1, p2 ) {\r\n\r\n\t\treturn 2 * ( 1 - t ) * ( p1 - p0 ) + 2 * t * ( p2 - p1 );\r\n\r\n\t},\r\n\r\n\t// Puay Bing, thanks for helping with this derivative!\r\n\r\n\ttangentCubicBezier: function ( t, p0, p1, p2, p3 ) {\r\n\r\n\t\treturn - 3 * p0 * ( 1 - t ) * ( 1 - t ) +\r\n\t\t\t3 * p1 * ( 1 - t ) * ( 1 - t ) - 6 * t * p1 * ( 1 - t ) +\r\n\t\t\t6 * t * p2 * ( 1 - t ) - 3 * t * t * p2 +\r\n\t\t\t3 * t * t * p3;\r\n\r\n\t},\r\n\r\n\ttangentSpline: function ( t, p0, p1, p2, p3 ) {\r\n\r\n\t\t// To check if my formulas are correct\r\n\r\n\t\tvar h00 = 6 * t * t - 6 * t; \t// derived from 2t^3 āˆ’ 3t^2 + 1\r\n\t\tvar h10 = 3 * t * t - 4 * t + 1; // t^3 āˆ’ 2t^2 + t\r\n\t\tvar h01 = - 6 * t * t + 6 * t; \t// āˆ’ 2t3 + 3t2\r\n\t\tvar h11 = 3 * t * t - 2 * t;\t// t3 āˆ’ t2\r\n\r\n\t\treturn h00 + h10 + h01 + h11;\r\n\r\n\t},\r\n\r\n\t// Catmull-Rom\r\n\r\n\tinterpolate: function( p0, p1, p2, p3, t ) {\r\n\r\n\t\tvar v0 = ( p2 - p0 ) * 0.5;\r\n\t\tvar v1 = ( p3 - p1 ) * 0.5;\r\n\t\tvar t2 = t * t;\r\n\t\tvar t3 = t * t2;\r\n\t\treturn ( 2 * p1 - 2 * p2 + v0 + v1 ) * t3 + ( - 3 * p1 + 3 * p2 - 2 * v0 - v1 ) * t2 + v0 * t + p1;\r\n\r\n\t}\r\n\r\n};\r\n\r\n\r\n// TODO: Transformation for Curves?\r\n\r\n/**************************************************************\r\n *\t3D Curves\r\n **************************************************************/\r\n\r\n// A Factory method for creating new curve subclasses\r\n\r\nTHREE.Curve.create = function ( constructor, getPointFunc ) {\r\n\r\n\tconstructor.prototype = Object.create( THREE.Curve.prototype );\r\n\tconstructor.prototype.constructor = constructor;\r\n\tconstructor.prototype.getPoint = getPointFunc;\r\n\r\n\treturn constructor;\r\n\r\n};\r\n\r\n// File:src/extras/core/CurvePath.js\r\n\r\n/**\r\n * @author zz85 / http://www.lab4games.net/zz85/blog\r\n *\r\n **/\r\n\r\n/**************************************************************\r\n *\tCurved Path - a curve path is simply a array of connected\r\n * curves, but retains the api of a curve\r\n **************************************************************/\r\n\r\nTHREE.CurvePath = function () {\r\n\r\n\tthis.curves = [];\r\n\tthis.bends = [];\r\n\r\n\tthis.autoClose = false; // Automatically closes the path\r\n\r\n};\r\n\r\nTHREE.CurvePath.prototype = Object.create( THREE.Curve.prototype );\r\nTHREE.CurvePath.prototype.constructor = THREE.CurvePath;\r\n\r\nTHREE.CurvePath.prototype.add = function ( curve ) {\r\n\r\n\tthis.curves.push( curve );\r\n\r\n};\r\n\r\nTHREE.CurvePath.prototype.checkConnection = function() {\r\n\t// TODO\r\n\t// If the ending of curve is not connected to the starting\r\n\t// or the next curve, then, this is not a real path\r\n};\r\n\r\nTHREE.CurvePath.prototype.closePath = function() {\r\n\r\n\t// TODO Test\r\n\t// and verify for vector3 (needs to implement equals)\r\n\t// Add a line curve if start and end of lines are not connected\r\n\tvar startPoint = this.curves[ 0 ].getPoint( 0 );\r\n\tvar endPoint = this.curves[ this.curves.length - 1 ].getPoint( 1 );\r\n\r\n\tif ( ! startPoint.equals( endPoint ) ) {\r\n\r\n\t\tthis.curves.push( new THREE.LineCurve( endPoint, startPoint ) );\r\n\r\n\t}\r\n\r\n};\r\n\r\n// To get accurate point with reference to\r\n// entire path distance at time t,\r\n// following has to be done:\r\n\r\n// 1. Length of each sub path have to be known\r\n// 2. Locate and identify type of curve\r\n// 3. Get t for the curve\r\n// 4. Return curve.getPointAt(t')\r\n\r\nTHREE.CurvePath.prototype.getPoint = function( t ) {\r\n\r\n\tvar d = t * this.getLength();\r\n\tvar curveLengths = this.getCurveLengths();\r\n\tvar i = 0, diff, curve;\r\n\r\n\t// To think about boundaries points.\r\n\r\n\twhile ( i < curveLengths.length ) {\r\n\r\n\t\tif ( curveLengths[ i ] >= d ) {\r\n\r\n\t\t\tdiff = curveLengths[ i ] - d;\r\n\t\t\tcurve = this.curves[ i ];\r\n\r\n\t\t\tvar u = 1 - diff / curve.getLength();\r\n\r\n\t\t\treturn curve.getPointAt( u );\r\n\r\n\t\t}\r\n\r\n\t\ti ++;\r\n\r\n\t}\r\n\r\n\treturn null;\r\n\r\n\t// loop where sum != 0, sum > d , sum+1 maxX ) maxX = p.x;\r\n\t\telse if ( p.x < minX ) minX = p.x;\r\n\r\n\t\tif ( p.y > maxY ) maxY = p.y;\r\n\t\telse if ( p.y < minY ) minY = p.y;\r\n\r\n\t\tif ( v3 ) {\r\n\r\n\t\t\tif ( p.z > maxZ ) maxZ = p.z;\r\n\t\t\telse if ( p.z < minZ ) minZ = p.z;\r\n\r\n\t\t}\r\n\r\n\t\tsum.add( p );\r\n\r\n\t}\r\n\r\n\tvar ret = {\r\n\r\n\t\tminX: minX,\r\n\t\tminY: minY,\r\n\t\tmaxX: maxX,\r\n\t\tmaxY: maxY\r\n\r\n\t};\r\n\r\n\tif ( v3 ) {\r\n\r\n\t\tret.maxZ = maxZ;\r\n\t\tret.minZ = minZ;\r\n\r\n\t}\r\n\r\n\treturn ret;\r\n\r\n};\r\n\r\n/**************************************************************\r\n *\tCreate Geometries Helpers\r\n **************************************************************/\r\n\r\n/// Generate geometry from path points (for Line or Points objects)\r\n\r\nTHREE.CurvePath.prototype.createPointsGeometry = function( divisions ) {\r\n\r\n\tvar pts = this.getPoints( divisions, true );\r\n\treturn this.createGeometry( pts );\r\n\r\n};\r\n\r\n// Generate geometry from equidistant sampling along the path\r\n\r\nTHREE.CurvePath.prototype.createSpacedPointsGeometry = function( divisions ) {\r\n\r\n\tvar pts = this.getSpacedPoints( divisions, true );\r\n\treturn this.createGeometry( pts );\r\n\r\n};\r\n\r\nTHREE.CurvePath.prototype.createGeometry = function( points ) {\r\n\r\n\tvar geometry = new THREE.Geometry();\r\n\r\n\tfor ( var i = 0; i < points.length; i ++ ) {\r\n\r\n\t\tgeometry.vertices.push( new THREE.Vector3( points[ i ].x, points[ i ].y, points[ i ].z || 0 ) );\r\n\r\n\t}\r\n\r\n\treturn geometry;\r\n\r\n};\r\n\r\n\r\n/**************************************************************\r\n *\tBend / Wrap Helper Methods\r\n **************************************************************/\r\n\r\n// Wrap path / Bend modifiers?\r\n\r\nTHREE.CurvePath.prototype.addWrapPath = function ( bendpath ) {\r\n\r\n\tthis.bends.push( bendpath );\r\n\r\n};\r\n\r\nTHREE.CurvePath.prototype.getTransformedPoints = function( segments, bends ) {\r\n\r\n\tvar oldPts = this.getPoints( segments ); // getPoints getSpacedPoints\r\n\tvar i, il;\r\n\r\n\tif ( ! bends ) {\r\n\r\n\t\tbends = this.bends;\r\n\r\n\t}\r\n\r\n\tfor ( i = 0, il = bends.length; i < il; i ++ ) {\r\n\r\n\t\toldPts = this.getWrapPoints( oldPts, bends[ i ] );\r\n\r\n\t}\r\n\r\n\treturn oldPts;\r\n\r\n};\r\n\r\nTHREE.CurvePath.prototype.getTransformedSpacedPoints = function( segments, bends ) {\r\n\r\n\tvar oldPts = this.getSpacedPoints( segments );\r\n\r\n\tvar i, il;\r\n\r\n\tif ( ! bends ) {\r\n\r\n\t\tbends = this.bends;\r\n\r\n\t}\r\n\r\n\tfor ( i = 0, il = bends.length; i < il; i ++ ) {\r\n\r\n\t\toldPts = this.getWrapPoints( oldPts, bends[ i ] );\r\n\r\n\t}\r\n\r\n\treturn oldPts;\r\n\r\n};\r\n\r\n// This returns getPoints() bend/wrapped around the contour of a path.\r\n// Read http://www.planetclegg.com/projects/WarpingTextToSplines.html\r\n\r\nTHREE.CurvePath.prototype.getWrapPoints = function ( oldPts, path ) {\r\n\r\n\tvar bounds = this.getBoundingBox();\r\n\r\n\tvar i, il, p, oldX, oldY, xNorm;\r\n\r\n\tfor ( i = 0, il = oldPts.length; i < il; i ++ ) {\r\n\r\n\t\tp = oldPts[ i ];\r\n\r\n\t\toldX = p.x;\r\n\t\toldY = p.y;\r\n\r\n\t\txNorm = oldX / bounds.maxX;\r\n\r\n\t\t// If using actual distance, for length > path, requires line extrusions\r\n\t\t//xNorm = path.getUtoTmapping(xNorm, oldX); // 3 styles. 1) wrap stretched. 2) wrap stretch by arc length 3) warp by actual distance\r\n\r\n\t\txNorm = path.getUtoTmapping( xNorm, oldX );\r\n\r\n\t\t// check for out of bounds?\r\n\r\n\t\tvar pathPt = path.getPoint( xNorm );\r\n\t\tvar normal = path.getTangent( xNorm );\r\n\t\tnormal.set( - normal.y, normal.x ).multiplyScalar( oldY );\r\n\r\n\t\tp.x = pathPt.x + normal.x;\r\n\t\tp.y = pathPt.y + normal.y;\r\n\r\n\t}\r\n\r\n\treturn oldPts;\r\n\r\n};\r\n\r\n// File:src/extras/core/Path.js\r\n\r\n/**\r\n * @author zz85 / http://www.lab4games.net/zz85/blog\r\n * Creates free form 2d path using series of points, lines or curves.\r\n *\r\n **/\r\n\r\nTHREE.Path = function ( points ) {\r\n\r\n\tTHREE.CurvePath.call( this );\r\n\r\n\tthis.actions = [];\r\n\r\n\tif ( points ) {\r\n\r\n\t\tthis.fromPoints( points );\r\n\r\n\t}\r\n\r\n};\r\n\r\nTHREE.Path.prototype = Object.create( THREE.CurvePath.prototype );\r\nTHREE.Path.prototype.constructor = THREE.Path;\r\n\r\nTHREE.PathActions = {\r\n\r\n\tMOVE_TO: 'moveTo',\r\n\tLINE_TO: 'lineTo',\r\n\tQUADRATIC_CURVE_TO: 'quadraticCurveTo', // Bezier quadratic curve\r\n\tBEZIER_CURVE_TO: 'bezierCurveTo', \t\t// Bezier cubic curve\r\n\tCSPLINE_THRU: 'splineThru',\t\t\t\t// Catmull-Rom spline\r\n\tARC: 'arc',\t\t\t\t\t\t\t\t// Circle\r\n\tELLIPSE: 'ellipse'\r\n};\r\n\r\n// TODO Clean up PATH API\r\n\r\n// Create path using straight lines to connect all points\r\n// - vectors: array of Vector2\r\n\r\nTHREE.Path.prototype.fromPoints = function ( vectors ) {\r\n\r\n\tthis.moveTo( vectors[ 0 ].x, vectors[ 0 ].y );\r\n\r\n\tfor ( var v = 1, vlen = vectors.length; v < vlen; v ++ ) {\r\n\r\n\t\tthis.lineTo( vectors[ v ].x, vectors[ v ].y );\r\n\r\n\t}\r\n\r\n};\r\n\r\n// startPath() endPath()?\r\n\r\nTHREE.Path.prototype.moveTo = function ( x, y ) {\r\n\r\n\tvar args = Array.prototype.slice.call( arguments );\r\n\tthis.actions.push( { action: THREE.PathActions.MOVE_TO, args: args } );\r\n\r\n};\r\n\r\nTHREE.Path.prototype.lineTo = function ( x, y ) {\r\n\r\n\tvar args = Array.prototype.slice.call( arguments );\r\n\r\n\tvar lastargs = this.actions[ this.actions.length - 1 ].args;\r\n\r\n\tvar x0 = lastargs[ lastargs.length - 2 ];\r\n\tvar y0 = lastargs[ lastargs.length - 1 ];\r\n\r\n\tvar curve = new THREE.LineCurve( new THREE.Vector2( x0, y0 ), new THREE.Vector2( x, y ) );\r\n\tthis.curves.push( curve );\r\n\r\n\tthis.actions.push( { action: THREE.PathActions.LINE_TO, args: args } );\r\n\r\n};\r\n\r\nTHREE.Path.prototype.quadraticCurveTo = function( aCPx, aCPy, aX, aY ) {\r\n\r\n\tvar args = Array.prototype.slice.call( arguments );\r\n\r\n\tvar lastargs = this.actions[ this.actions.length - 1 ].args;\r\n\r\n\tvar x0 = lastargs[ lastargs.length - 2 ];\r\n\tvar y0 = lastargs[ lastargs.length - 1 ];\r\n\r\n\tvar curve = new THREE.QuadraticBezierCurve( new THREE.Vector2( x0, y0 ),\r\n\t\t\t\t\t\t\t\t\t\t\t\tnew THREE.Vector2( aCPx, aCPy ),\r\n\t\t\t\t\t\t\t\t\t\t\t\tnew THREE.Vector2( aX, aY ) );\r\n\tthis.curves.push( curve );\r\n\r\n\tthis.actions.push( { action: THREE.PathActions.QUADRATIC_CURVE_TO, args: args } );\r\n\r\n};\r\n\r\nTHREE.Path.prototype.bezierCurveTo = function( aCP1x, aCP1y,\r\n\t\t\t\t\t\t\t\t\t\t\t aCP2x, aCP2y,\r\n\t\t\t\t\t\t\t\t\t\t\t aX, aY ) {\r\n\r\n\tvar args = Array.prototype.slice.call( arguments );\r\n\r\n\tvar lastargs = this.actions[ this.actions.length - 1 ].args;\r\n\r\n\tvar x0 = lastargs[ lastargs.length - 2 ];\r\n\tvar y0 = lastargs[ lastargs.length - 1 ];\r\n\r\n\tvar curve = new THREE.CubicBezierCurve( new THREE.Vector2( x0, y0 ),\r\n\t\t\t\t\t\t\t\t\t\t\tnew THREE.Vector2( aCP1x, aCP1y ),\r\n\t\t\t\t\t\t\t\t\t\t\tnew THREE.Vector2( aCP2x, aCP2y ),\r\n\t\t\t\t\t\t\t\t\t\t\tnew THREE.Vector2( aX, aY ) );\r\n\tthis.curves.push( curve );\r\n\r\n\tthis.actions.push( { action: THREE.PathActions.BEZIER_CURVE_TO, args: args } );\r\n\r\n};\r\n\r\nTHREE.Path.prototype.splineThru = function( pts /*Array of Vector*/ ) {\r\n\r\n\tvar args = Array.prototype.slice.call( arguments );\r\n\tvar lastargs = this.actions[ this.actions.length - 1 ].args;\r\n\r\n\tvar x0 = lastargs[ lastargs.length - 2 ];\r\n\tvar y0 = lastargs[ lastargs.length - 1 ];\r\n\t//---\r\n\tvar npts = [ new THREE.Vector2( x0, y0 ) ];\r\n\tArray.prototype.push.apply( npts, pts );\r\n\r\n\tvar curve = new THREE.SplineCurve( npts );\r\n\tthis.curves.push( curve );\r\n\r\n\tthis.actions.push( { action: THREE.PathActions.CSPLINE_THRU, args: args } );\r\n\r\n};\r\n\r\n// FUTURE: Change the API or follow canvas API?\r\n\r\nTHREE.Path.prototype.arc = function ( aX, aY, aRadius,\r\n\t\t\t\t\t\t\t\t\t aStartAngle, aEndAngle, aClockwise ) {\r\n\r\n\tvar lastargs = this.actions[ this.actions.length - 1 ].args;\r\n\tvar x0 = lastargs[ lastargs.length - 2 ];\r\n\tvar y0 = lastargs[ lastargs.length - 1 ];\r\n\r\n\tthis.absarc( aX + x0, aY + y0, aRadius,\r\n\t\taStartAngle, aEndAngle, aClockwise );\r\n\r\n };\r\n\r\n THREE.Path.prototype.absarc = function ( aX, aY, aRadius,\r\n\t\t\t\t\t\t\t\t\t aStartAngle, aEndAngle, aClockwise ) {\r\n\r\n\tthis.absellipse( aX, aY, aRadius, aRadius, aStartAngle, aEndAngle, aClockwise );\r\n\r\n };\r\n\r\nTHREE.Path.prototype.ellipse = function ( aX, aY, xRadius, yRadius,\r\n\t\t\t\t\t\t\t\t\t aStartAngle, aEndAngle, aClockwise, aRotation ) {\r\n\r\n\tvar lastargs = this.actions[ this.actions.length - 1 ].args;\r\n\tvar x0 = lastargs[ lastargs.length - 2 ];\r\n\tvar y0 = lastargs[ lastargs.length - 1 ];\r\n\r\n\tthis.absellipse( aX + x0, aY + y0, xRadius, yRadius,\r\n\t\taStartAngle, aEndAngle, aClockwise, aRotation );\r\n\r\n };\r\n\r\n\r\nTHREE.Path.prototype.absellipse = function ( aX, aY, xRadius, yRadius,\r\n\t\t\t\t\t\t\t\t\t aStartAngle, aEndAngle, aClockwise, aRotation ) {\r\n\r\n\tvar args = [\r\n\t\taX, aY,\r\n\t\txRadius, yRadius,\r\n\t\taStartAngle, aEndAngle,\r\n\t\taClockwise,\r\n\t\taRotation || 0 // aRotation is optional.\r\n\t];\r\n\tvar curve = new THREE.EllipseCurve( aX, aY, xRadius, yRadius,\r\n\t\t\t\t\t\t\t\t\taStartAngle, aEndAngle, aClockwise, aRotation );\r\n\tthis.curves.push( curve );\r\n\r\n\tvar lastPoint = curve.getPoint( 1 );\r\n\targs.push( lastPoint.x );\r\n\targs.push( lastPoint.y );\r\n\r\n\tthis.actions.push( { action: THREE.PathActions.ELLIPSE, args: args } );\r\n\r\n };\r\n\r\nTHREE.Path.prototype.getSpacedPoints = function ( divisions, closedPath ) {\r\n\r\n\tif ( ! divisions ) divisions = 40;\r\n\r\n\tvar points = [];\r\n\r\n\tfor ( var i = 0; i < divisions; i ++ ) {\r\n\r\n\t\tpoints.push( this.getPoint( i / divisions ) );\r\n\r\n\t\t//if( !this.getPoint( i / divisions ) ) throw \"DIE\";\r\n\r\n\t}\r\n\r\n\t// if ( closedPath ) {\r\n\t//\r\n\t// \tpoints.push( points[ 0 ] );\r\n\t//\r\n\t// }\r\n\r\n\treturn points;\r\n\r\n};\r\n\r\n/* Return an array of vectors based on contour of the path */\r\n\r\nTHREE.Path.prototype.getPoints = function( divisions, closedPath ) {\r\n\r\n\tif ( this.useSpacedPoints ) {\r\n\r\n\t\treturn this.getSpacedPoints( divisions, closedPath );\r\n\r\n\t}\r\n\r\n\tdivisions = divisions || 12;\r\n\r\n\tvar points = [];\r\n\r\n\tvar i, il, item, action, args;\r\n\tvar cpx, cpy, cpx2, cpy2, cpx1, cpy1, cpx0, cpy0,\r\n\t\tlaste, j,\r\n\t\tt, tx, ty;\r\n\r\n\tfor ( i = 0, il = this.actions.length; i < il; i ++ ) {\r\n\r\n\t\titem = this.actions[ i ];\r\n\r\n\t\taction = item.action;\r\n\t\targs = item.args;\r\n\r\n\t\tswitch ( action ) {\r\n\r\n\t\tcase THREE.PathActions.MOVE_TO:\r\n\r\n\t\t\tpoints.push( new THREE.Vector2( args[ 0 ], args[ 1 ] ) );\r\n\r\n\t\t\tbreak;\r\n\r\n\t\tcase THREE.PathActions.LINE_TO:\r\n\r\n\t\t\tpoints.push( new THREE.Vector2( args[ 0 ], args[ 1 ] ) );\r\n\r\n\t\t\tbreak;\r\n\r\n\t\tcase THREE.PathActions.QUADRATIC_CURVE_TO:\r\n\r\n\t\t\tcpx = args[ 2 ];\r\n\t\t\tcpy = args[ 3 ];\r\n\r\n\t\t\tcpx1 = args[ 0 ];\r\n\t\t\tcpy1 = args[ 1 ];\r\n\r\n\t\t\tif ( points.length > 0 ) {\r\n\r\n\t\t\t\tlaste = points[ points.length - 1 ];\r\n\r\n\t\t\t\tcpx0 = laste.x;\r\n\t\t\t\tcpy0 = laste.y;\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tlaste = this.actions[ i - 1 ].args;\r\n\r\n\t\t\t\tcpx0 = laste[ laste.length - 2 ];\r\n\t\t\t\tcpy0 = laste[ laste.length - 1 ];\r\n\r\n\t\t\t}\r\n\r\n\t\t\tfor ( j = 1; j <= divisions; j ++ ) {\r\n\r\n\t\t\t\tt = j / divisions;\r\n\r\n\t\t\t\ttx = THREE.Shape.Utils.b2( t, cpx0, cpx1, cpx );\r\n\t\t\t\tty = THREE.Shape.Utils.b2( t, cpy0, cpy1, cpy );\r\n\r\n\t\t\t\tpoints.push( new THREE.Vector2( tx, ty ) );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tbreak;\r\n\r\n\t\tcase THREE.PathActions.BEZIER_CURVE_TO:\r\n\r\n\t\t\tcpx = args[ 4 ];\r\n\t\t\tcpy = args[ 5 ];\r\n\r\n\t\t\tcpx1 = args[ 0 ];\r\n\t\t\tcpy1 = args[ 1 ];\r\n\r\n\t\t\tcpx2 = args[ 2 ];\r\n\t\t\tcpy2 = args[ 3 ];\r\n\r\n\t\t\tif ( points.length > 0 ) {\r\n\r\n\t\t\t\tlaste = points[ points.length - 1 ];\r\n\r\n\t\t\t\tcpx0 = laste.x;\r\n\t\t\t\tcpy0 = laste.y;\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tlaste = this.actions[ i - 1 ].args;\r\n\r\n\t\t\t\tcpx0 = laste[ laste.length - 2 ];\r\n\t\t\t\tcpy0 = laste[ laste.length - 1 ];\r\n\r\n\t\t\t}\r\n\r\n\r\n\t\t\tfor ( j = 1; j <= divisions; j ++ ) {\r\n\r\n\t\t\t\tt = j / divisions;\r\n\r\n\t\t\t\ttx = THREE.Shape.Utils.b3( t, cpx0, cpx1, cpx2, cpx );\r\n\t\t\t\tty = THREE.Shape.Utils.b3( t, cpy0, cpy1, cpy2, cpy );\r\n\r\n\t\t\t\tpoints.push( new THREE.Vector2( tx, ty ) );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tbreak;\r\n\r\n\t\tcase THREE.PathActions.CSPLINE_THRU:\r\n\r\n\t\t\tlaste = this.actions[ i - 1 ].args;\r\n\r\n\t\t\tvar last = new THREE.Vector2( laste[ laste.length - 2 ], laste[ laste.length - 1 ] );\r\n\t\t\tvar spts = [ last ];\r\n\r\n\t\t\tvar n = divisions * args[ 0 ].length;\r\n\r\n\t\t\tspts = spts.concat( args[ 0 ] );\r\n\r\n\t\t\tvar spline = new THREE.SplineCurve( spts );\r\n\r\n\t\t\tfor ( j = 1; j <= n; j ++ ) {\r\n\r\n\t\t\t\tpoints.push( spline.getPointAt( j / n ) );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tbreak;\r\n\r\n\t\tcase THREE.PathActions.ARC:\r\n\r\n\t\t\tvar aX = args[ 0 ], aY = args[ 1 ],\r\n\t\t\t\taRadius = args[ 2 ],\r\n\t\t\t\taStartAngle = args[ 3 ], aEndAngle = args[ 4 ],\r\n\t\t\t\taClockwise = !! args[ 5 ];\r\n\r\n\t\t\tvar deltaAngle = aEndAngle - aStartAngle;\r\n\t\t\tvar angle;\r\n\t\t\tvar tdivisions = divisions * 2;\r\n\r\n\t\t\tfor ( j = 1; j <= tdivisions; j ++ ) {\r\n\r\n\t\t\t\tt = j / tdivisions;\r\n\r\n\t\t\t\tif ( ! aClockwise ) {\r\n\r\n\t\t\t\t\tt = 1 - t;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tangle = aStartAngle + t * deltaAngle;\r\n\r\n\t\t\t\ttx = aX + aRadius * Math.cos( angle );\r\n\t\t\t\tty = aY + aRadius * Math.sin( angle );\r\n\r\n\t\t\t\t//console.log('t', t, 'angle', angle, 'tx', tx, 'ty', ty);\r\n\r\n\t\t\t\tpoints.push( new THREE.Vector2( tx, ty ) );\r\n\r\n\t\t\t}\r\n\r\n\t\t\t//console.log(points);\r\n\r\n\t\t\tbreak;\r\n\r\n\t\tcase THREE.PathActions.ELLIPSE:\r\n\r\n\t\t\tvar aX = args[ 0 ], aY = args[ 1 ],\r\n\t\t\t\txRadius = args[ 2 ],\r\n\t\t\t\tyRadius = args[ 3 ],\r\n\t\t\t\taStartAngle = args[ 4 ], aEndAngle = args[ 5 ],\r\n\t\t\t\taClockwise = !! args[ 6 ],\r\n\t\t\t\taRotation = args[ 7 ];\r\n\r\n\r\n\t\t\tvar deltaAngle = aEndAngle - aStartAngle;\r\n\t\t\tvar angle;\r\n\t\t\tvar tdivisions = divisions * 2;\r\n\r\n\t\t\tvar cos, sin;\r\n\t\t\tif ( aRotation !== 0 ) {\r\n\t\t\r\n\t\t\t\tcos = Math.cos( aRotation );\r\n\t\t\t\tsin = Math.sin( aRotation );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tfor ( j = 1; j <= tdivisions; j ++ ) {\r\n\r\n\t\t\t\tt = j / tdivisions;\r\n\r\n\t\t\t\tif ( ! aClockwise ) {\r\n\r\n\t\t\t\t\tt = 1 - t;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tangle = aStartAngle + t * deltaAngle;\r\n\r\n\t\t\t\ttx = aX + xRadius * Math.cos( angle );\r\n\t\t\t\tty = aY + yRadius * Math.sin( angle );\r\n\r\n\t\t\t\tif ( aRotation !== 0 ) {\r\n\r\n\t\t\t\t\tvar x = tx, y = ty;\r\n\r\n\t\t\t\t\t// Rotate the point about the center of the ellipse.\r\n\t\t\t\t\ttx = ( x - aX ) * cos - ( y - aY ) * sin + aX;\r\n\t\t\t\t\tty = ( x - aX ) * sin + ( y - aY ) * cos + aY;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\t//console.log('t', t, 'angle', angle, 'tx', tx, 'ty', ty);\r\n\r\n\t\t\t\tpoints.push( new THREE.Vector2( tx, ty ) );\r\n\r\n\t\t\t}\r\n\r\n\t\t\t//console.log(points);\r\n\r\n\t\t\tbreak;\r\n\r\n\t\t} // end switch\r\n\r\n\t}\r\n\r\n\r\n\r\n\t// Normalize to remove the closing point by default.\r\n\tvar lastPoint = points[ points.length - 1 ];\r\n\tvar EPSILON = 0.0000000001;\r\n\tif ( Math.abs( lastPoint.x - points[ 0 ].x ) < EPSILON &&\r\n\t\t\t Math.abs( lastPoint.y - points[ 0 ].y ) < EPSILON )\r\n\t\tpoints.splice( points.length - 1, 1 );\r\n\tif ( closedPath ) {\r\n\r\n\t\tpoints.push( points[ 0 ] );\r\n\r\n\t}\r\n\r\n\treturn points;\r\n\r\n};\r\n\r\n//\r\n// Breaks path into shapes\r\n//\r\n//\tAssumptions (if parameter isCCW==true the opposite holds):\r\n//\t- solid shapes are defined clockwise (CW)\r\n//\t- holes are defined counterclockwise (CCW)\r\n//\r\n//\tIf parameter noHoles==true:\r\n// - all subPaths are regarded as solid shapes\r\n// - definition order CW/CCW has no relevance\r\n//\r\n\r\nTHREE.Path.prototype.toShapes = function( isCCW, noHoles ) {\r\n\r\n\tfunction extractSubpaths( inActions ) {\r\n\r\n\t\tvar i, il, item, action, args;\r\n\r\n\t\tvar subPaths = [], lastPath = new THREE.Path();\r\n\r\n\t\tfor ( i = 0, il = inActions.length; i < il; i ++ ) {\r\n\r\n\t\t\titem = inActions[ i ];\r\n\r\n\t\t\targs = item.args;\r\n\t\t\taction = item.action;\r\n\r\n\t\t\tif ( action === THREE.PathActions.MOVE_TO ) {\r\n\r\n\t\t\t\tif ( lastPath.actions.length !== 0 ) {\r\n\r\n\t\t\t\t\tsubPaths.push( lastPath );\r\n\t\t\t\t\tlastPath = new THREE.Path();\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\tlastPath[ action ].apply( lastPath, args );\r\n\r\n\t\t}\r\n\r\n\t\tif ( lastPath.actions.length !== 0 ) {\r\n\r\n\t\t\tsubPaths.push( lastPath );\r\n\r\n\t\t}\r\n\r\n\t\t// console.log(subPaths);\r\n\r\n\t\treturn\tsubPaths;\r\n\r\n\t}\r\n\r\n\tfunction toShapesNoHoles( inSubpaths ) {\r\n\r\n\t\tvar shapes = [];\r\n\r\n\t\tfor ( var i = 0, il = inSubpaths.length; i < il; i ++ ) {\r\n\r\n\t\t\tvar tmpPath = inSubpaths[ i ];\r\n\r\n\t\t\tvar tmpShape = new THREE.Shape();\r\n\t\t\ttmpShape.actions = tmpPath.actions;\r\n\t\t\ttmpShape.curves = tmpPath.curves;\r\n\r\n\t\t\tshapes.push( tmpShape );\r\n\r\n\t\t}\r\n\r\n\t\t//console.log(\"shape\", shapes);\r\n\r\n\t\treturn shapes;\r\n\r\n\t}\r\n\r\n\tfunction isPointInsidePolygon( inPt, inPolygon ) {\r\n\r\n\t\tvar EPSILON = 0.0000000001;\r\n\r\n\t\tvar polyLen = inPolygon.length;\r\n\r\n\t\t// inPt on polygon contour => immediate success or\r\n\t\t// toggling of inside/outside at every single! intersection point of an edge\r\n\t\t// with the horizontal line through inPt, left of inPt\r\n\t\t// not counting lowerY endpoints of edges and whole edges on that line\r\n\t\tvar inside = false;\r\n\t\tfor ( var p = polyLen - 1, q = 0; q < polyLen; p = q ++ ) {\r\n\r\n\t\t\tvar edgeLowPt = inPolygon[ p ];\r\n\t\t\tvar edgeHighPt = inPolygon[ q ];\r\n\r\n\t\t\tvar edgeDx = edgeHighPt.x - edgeLowPt.x;\r\n\t\t\tvar edgeDy = edgeHighPt.y - edgeLowPt.y;\r\n\r\n\t\t\tif ( Math.abs( edgeDy ) > EPSILON ) {\r\n\r\n\t\t\t\t// not parallel\r\n\t\t\t\tif ( edgeDy < 0 ) {\r\n\r\n\t\t\t\t\tedgeLowPt = inPolygon[ q ]; edgeDx = - edgeDx;\r\n\t\t\t\t\tedgeHighPt = inPolygon[ p ]; edgeDy = - edgeDy;\r\n\r\n\t\t\t\t}\r\n\t\t\t\tif ( ( inPt.y < edgeLowPt.y ) || ( inPt.y > edgeHighPt.y ) ) \t\tcontinue;\r\n\r\n\t\t\t\tif ( inPt.y === edgeLowPt.y ) {\r\n\r\n\t\t\t\t\tif ( inPt.x === edgeLowPt.x )\t\treturn\ttrue;\t\t// inPt is on contour ?\r\n\t\t\t\t\t// continue;\t\t\t\t// no intersection or edgeLowPt => doesn't count !!!\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\tvar perpEdge = edgeDy * ( inPt.x - edgeLowPt.x ) - edgeDx * ( inPt.y - edgeLowPt.y );\r\n\t\t\t\t\tif ( perpEdge === 0 )\t\t\t\treturn\ttrue;\t\t// inPt is on contour ?\r\n\t\t\t\t\tif ( perpEdge < 0 ) \t\t\t\tcontinue;\r\n\t\t\t\t\tinside = ! inside;\t\t// true intersection left of inPt\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\t// parallel or collinear\r\n\t\t\t\tif ( inPt.y !== edgeLowPt.y ) \t\tcontinue;\t\t\t// parallel\r\n\t\t\t\t// edge lies on the same horizontal line as inPt\r\n\t\t\t\tif ( ( ( edgeHighPt.x <= inPt.x ) && ( inPt.x <= edgeLowPt.x ) ) ||\r\n\t\t\t\t\t ( ( edgeLowPt.x <= inPt.x ) && ( inPt.x <= edgeHighPt.x ) ) )\t\treturn\ttrue;\t// inPt: Point on contour !\r\n\t\t\t\t// continue;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn\tinside;\r\n\r\n\t}\r\n\r\n\r\n\tvar subPaths = extractSubpaths( this.actions );\r\n\tif ( subPaths.length === 0 ) return [];\r\n\r\n\tif ( noHoles === true )\treturn\ttoShapesNoHoles( subPaths );\r\n\r\n\r\n\tvar solid, tmpPath, tmpShape, shapes = [];\r\n\r\n\tif ( subPaths.length === 1 ) {\r\n\r\n\t\ttmpPath = subPaths[ 0 ];\r\n\t\ttmpShape = new THREE.Shape();\r\n\t\ttmpShape.actions = tmpPath.actions;\r\n\t\ttmpShape.curves = tmpPath.curves;\r\n\t\tshapes.push( tmpShape );\r\n\t\treturn shapes;\r\n\r\n\t}\r\n\r\n\tvar holesFirst = ! THREE.Shape.Utils.isClockWise( subPaths[ 0 ].getPoints() );\r\n\tholesFirst = isCCW ? ! holesFirst : holesFirst;\r\n\r\n\t// console.log(\"Holes first\", holesFirst);\r\n\r\n\tvar betterShapeHoles = [];\r\n\tvar newShapes = [];\r\n\tvar newShapeHoles = [];\r\n\tvar mainIdx = 0;\r\n\tvar tmpPoints;\r\n\r\n\tnewShapes[ mainIdx ] = undefined;\r\n\tnewShapeHoles[ mainIdx ] = [];\r\n\r\n\tvar i, il;\r\n\r\n\tfor ( i = 0, il = subPaths.length; i < il; i ++ ) {\r\n\r\n\t\ttmpPath = subPaths[ i ];\r\n\t\ttmpPoints = tmpPath.getPoints();\r\n\t\tsolid = THREE.Shape.Utils.isClockWise( tmpPoints );\r\n\t\tsolid = isCCW ? ! solid : solid;\r\n\r\n\t\tif ( solid ) {\r\n\r\n\t\t\tif ( ( ! holesFirst ) && ( newShapes[ mainIdx ] ) )\tmainIdx ++;\r\n\r\n\t\t\tnewShapes[ mainIdx ] = { s: new THREE.Shape(), p: tmpPoints };\r\n\t\t\tnewShapes[ mainIdx ].s.actions = tmpPath.actions;\r\n\t\t\tnewShapes[ mainIdx ].s.curves = tmpPath.curves;\r\n\r\n\t\t\tif ( holesFirst )\tmainIdx ++;\r\n\t\t\tnewShapeHoles[ mainIdx ] = [];\r\n\r\n\t\t\t//console.log('cw', i);\r\n\r\n\t\t} else {\r\n\r\n\t\t\tnewShapeHoles[ mainIdx ].push( { h: tmpPath, p: tmpPoints[ 0 ] } );\r\n\r\n\t\t\t//console.log('ccw', i);\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\t// only Holes? -> probably all Shapes with wrong orientation\r\n\tif ( ! newShapes[ 0 ] )\treturn\ttoShapesNoHoles( subPaths );\r\n\r\n\r\n\tif ( newShapes.length > 1 ) {\r\n\r\n\t\tvar ambiguous = false;\r\n\t\tvar toChange = [];\r\n\r\n\t\tfor ( var sIdx = 0, sLen = newShapes.length; sIdx < sLen; sIdx ++ ) {\r\n\r\n\t\t\tbetterShapeHoles[ sIdx ] = [];\r\n\r\n\t\t}\r\n\t\tfor ( var sIdx = 0, sLen = newShapes.length; sIdx < sLen; sIdx ++ ) {\r\n\r\n\t\t\tvar sho = newShapeHoles[ sIdx ];\r\n\t\t\tfor ( var hIdx = 0; hIdx < sho.length; hIdx ++ ) {\r\n\r\n\t\t\t\tvar ho = sho[ hIdx ];\r\n\t\t\t\tvar hole_unassigned = true;\r\n\t\t\t\tfor ( var s2Idx = 0; s2Idx < newShapes.length; s2Idx ++ ) {\r\n\r\n\t\t\t\t\tif ( isPointInsidePolygon( ho.p, newShapes[ s2Idx ].p ) ) {\r\n\r\n\t\t\t\t\t\tif ( sIdx !== s2Idx )\ttoChange.push( { froms: sIdx, tos: s2Idx, hole: hIdx } );\r\n\t\t\t\t\t\tif ( hole_unassigned ) {\r\n\r\n\t\t\t\t\t\t\thole_unassigned = false;\r\n\t\t\t\t\t\t\tbetterShapeHoles[ s2Idx ].push( ho );\r\n\r\n\t\t\t\t\t\t} else {\r\n\r\n\t\t\t\t\t\t\tambiguous = true;\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\t\t\t\tif ( hole_unassigned ) {\r\n\r\n\t\t\t\t\tbetterShapeHoles[ sIdx ].push( ho );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\t\t// console.log(\"ambiguous: \", ambiguous);\r\n\t\tif ( toChange.length > 0 ) {\r\n\r\n\t\t\t// console.log(\"to change: \", toChange);\r\n\t\t\tif ( ! ambiguous )\tnewShapeHoles = betterShapeHoles;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tvar tmpHoles, j, jl;\r\n\tfor ( i = 0, il = newShapes.length; i < il; i ++ ) {\r\n\r\n\t\ttmpShape = newShapes[ i ].s;\r\n\t\tshapes.push( tmpShape );\r\n\t\ttmpHoles = newShapeHoles[ i ];\r\n\t\tfor ( j = 0, jl = tmpHoles.length; j < jl; j ++ ) {\r\n\r\n\t\t\ttmpShape.holes.push( tmpHoles[ j ].h );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\t//console.log(\"shape\", shapes);\r\n\r\n\treturn shapes;\r\n\r\n};\r\n\r\n// File:src/extras/core/Shape.js\r\n\r\n/**\r\n * @author zz85 / http://www.lab4games.net/zz85/blog\r\n * Defines a 2d shape plane using paths.\r\n **/\r\n\r\n// STEP 1 Create a path.\r\n// STEP 2 Turn path into shape.\r\n// STEP 3 ExtrudeGeometry takes in Shape/Shapes\r\n// STEP 3a - Extract points from each shape, turn to vertices\r\n// STEP 3b - Triangulate each shape, add faces.\r\n\r\nTHREE.Shape = function () {\r\n\r\n\tTHREE.Path.apply( this, arguments );\r\n\tthis.holes = [];\r\n\r\n};\r\n\r\nTHREE.Shape.prototype = Object.create( THREE.Path.prototype );\r\nTHREE.Shape.prototype.constructor = THREE.Shape;\r\n\r\n// Convenience method to return ExtrudeGeometry\r\n\r\nTHREE.Shape.prototype.extrude = function ( options ) {\r\n\r\n\tvar extruded = new THREE.ExtrudeGeometry( this, options );\r\n\treturn extruded;\r\n\r\n};\r\n\r\n// Convenience method to return ShapeGeometry\r\n\r\nTHREE.Shape.prototype.makeGeometry = function ( options ) {\r\n\r\n\tvar geometry = new THREE.ShapeGeometry( this, options );\r\n\treturn geometry;\r\n\r\n};\r\n\r\n// Get points of holes\r\n\r\nTHREE.Shape.prototype.getPointsHoles = function ( divisions ) {\r\n\r\n\tvar i, il = this.holes.length, holesPts = [];\r\n\r\n\tfor ( i = 0; i < il; i ++ ) {\r\n\r\n\t\tholesPts[ i ] = this.holes[ i ].getTransformedPoints( divisions, this.bends );\r\n\r\n\t}\r\n\r\n\treturn holesPts;\r\n\r\n};\r\n\r\n// Get points of holes (spaced by regular distance)\r\n\r\nTHREE.Shape.prototype.getSpacedPointsHoles = function ( divisions ) {\r\n\r\n\tvar i, il = this.holes.length, holesPts = [];\r\n\r\n\tfor ( i = 0; i < il; i ++ ) {\r\n\r\n\t\tholesPts[ i ] = this.holes[ i ].getTransformedSpacedPoints( divisions, this.bends );\r\n\r\n\t}\r\n\r\n\treturn holesPts;\r\n\r\n};\r\n\r\n\r\n// Get points of shape and holes (keypoints based on segments parameter)\r\n\r\nTHREE.Shape.prototype.extractAllPoints = function ( divisions ) {\r\n\r\n\treturn {\r\n\r\n\t\tshape: this.getTransformedPoints( divisions ),\r\n\t\tholes: this.getPointsHoles( divisions )\r\n\r\n\t};\r\n\r\n};\r\n\r\nTHREE.Shape.prototype.extractPoints = function ( divisions ) {\r\n\r\n\tif ( this.useSpacedPoints ) {\r\n\r\n\t\treturn this.extractAllSpacedPoints( divisions );\r\n\r\n\t}\r\n\r\n\treturn this.extractAllPoints( divisions );\r\n\r\n};\r\n\r\n//\r\n// THREE.Shape.prototype.extractAllPointsWithBend = function ( divisions, bend ) {\r\n//\r\n// \treturn {\r\n//\r\n// \t\tshape: this.transform( bend, divisions ),\r\n// \t\tholes: this.getPointsHoles( divisions, bend )\r\n//\r\n// \t};\r\n//\r\n// };\r\n\r\n// Get points of shape and holes (spaced by regular distance)\r\n\r\nTHREE.Shape.prototype.extractAllSpacedPoints = function ( divisions ) {\r\n\r\n\treturn {\r\n\r\n\t\tshape: this.getTransformedSpacedPoints( divisions ),\r\n\t\tholes: this.getSpacedPointsHoles( divisions )\r\n\r\n\t};\r\n\r\n};\r\n\r\n/**************************************************************\r\n *\tUtils\r\n **************************************************************/\r\n\r\nTHREE.Shape.Utils = {\r\n\r\n\ttriangulateShape: function ( contour, holes ) {\r\n\r\n\t\tfunction point_in_segment_2D_colin( inSegPt1, inSegPt2, inOtherPt ) {\r\n\r\n\t\t\t// inOtherPt needs to be collinear to the inSegment\r\n\t\t\tif ( inSegPt1.x !== inSegPt2.x ) {\r\n\r\n\t\t\t\tif ( inSegPt1.x < inSegPt2.x ) {\r\n\r\n\t\t\t\t\treturn\t( ( inSegPt1.x <= inOtherPt.x ) && ( inOtherPt.x <= inSegPt2.x ) );\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\treturn\t( ( inSegPt2.x <= inOtherPt.x ) && ( inOtherPt.x <= inSegPt1.x ) );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tif ( inSegPt1.y < inSegPt2.y ) {\r\n\r\n\t\t\t\t\treturn\t( ( inSegPt1.y <= inOtherPt.y ) && ( inOtherPt.y <= inSegPt2.y ) );\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\treturn\t( ( inSegPt2.y <= inOtherPt.y ) && ( inOtherPt.y <= inSegPt1.y ) );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tfunction intersect_segments_2D( inSeg1Pt1, inSeg1Pt2, inSeg2Pt1, inSeg2Pt2, inExcludeAdjacentSegs ) {\r\n\r\n\t\t\tvar EPSILON = 0.0000000001;\r\n\r\n\t\t\tvar seg1dx = inSeg1Pt2.x - inSeg1Pt1.x, seg1dy = inSeg1Pt2.y - inSeg1Pt1.y;\r\n\t\t\tvar seg2dx = inSeg2Pt2.x - inSeg2Pt1.x, seg2dy = inSeg2Pt2.y - inSeg2Pt1.y;\r\n\r\n\t\t\tvar seg1seg2dx = inSeg1Pt1.x - inSeg2Pt1.x;\r\n\t\t\tvar seg1seg2dy = inSeg1Pt1.y - inSeg2Pt1.y;\r\n\r\n\t\t\tvar limit\t\t= seg1dy * seg2dx - seg1dx * seg2dy;\r\n\t\t\tvar perpSeg1\t= seg1dy * seg1seg2dx - seg1dx * seg1seg2dy;\r\n\r\n\t\t\tif ( Math.abs( limit ) > EPSILON ) {\r\n\r\n\t\t\t\t// not parallel\r\n\r\n\t\t\t\tvar perpSeg2;\r\n\t\t\t\tif ( limit > 0 ) {\r\n\r\n\t\t\t\t\tif ( ( perpSeg1 < 0 ) || ( perpSeg1 > limit ) ) \t\treturn [];\r\n\t\t\t\t\tperpSeg2 = seg2dy * seg1seg2dx - seg2dx * seg1seg2dy;\r\n\t\t\t\t\tif ( ( perpSeg2 < 0 ) || ( perpSeg2 > limit ) ) \t\treturn [];\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\tif ( ( perpSeg1 > 0 ) || ( perpSeg1 < limit ) ) \t\treturn [];\r\n\t\t\t\t\tperpSeg2 = seg2dy * seg1seg2dx - seg2dx * seg1seg2dy;\r\n\t\t\t\t\tif ( ( perpSeg2 > 0 ) || ( perpSeg2 < limit ) ) \t\treturn [];\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\t// i.e. to reduce rounding errors\r\n\t\t\t\t// intersection at endpoint of segment#1?\r\n\t\t\t\tif ( perpSeg2 === 0 ) {\r\n\r\n\t\t\t\t\tif ( ( inExcludeAdjacentSegs ) &&\r\n\t\t\t\t\t\t ( ( perpSeg1 === 0 ) || ( perpSeg1 === limit ) ) )\t\treturn [];\r\n\t\t\t\t\treturn [ inSeg1Pt1 ];\r\n\r\n\t\t\t\t}\r\n\t\t\t\tif ( perpSeg2 === limit ) {\r\n\r\n\t\t\t\t\tif ( ( inExcludeAdjacentSegs ) &&\r\n\t\t\t\t\t\t ( ( perpSeg1 === 0 ) || ( perpSeg1 === limit ) ) )\t\treturn [];\r\n\t\t\t\t\treturn [ inSeg1Pt2 ];\r\n\r\n\t\t\t\t}\r\n\t\t\t\t// intersection at endpoint of segment#2?\r\n\t\t\t\tif ( perpSeg1 === 0 )\t\treturn [ inSeg2Pt1 ];\r\n\t\t\t\tif ( perpSeg1 === limit )\treturn [ inSeg2Pt2 ];\r\n\r\n\t\t\t\t// return real intersection point\r\n\t\t\t\tvar factorSeg1 = perpSeg2 / limit;\r\n\t\t\t\treturn\t[ { x: inSeg1Pt1.x + factorSeg1 * seg1dx,\r\n\t\t\t\t\t\t\ty: inSeg1Pt1.y + factorSeg1 * seg1dy } ];\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\t// parallel or collinear\r\n\t\t\t\tif ( ( perpSeg1 !== 0 ) ||\r\n\t\t\t\t\t ( seg2dy * seg1seg2dx !== seg2dx * seg1seg2dy ) ) \t\t\treturn [];\r\n\r\n\t\t\t\t// they are collinear or degenerate\r\n\t\t\t\tvar seg1Pt = ( ( seg1dx === 0 ) && ( seg1dy === 0 ) );\t// segment1 is just a point?\r\n\t\t\t\tvar seg2Pt = ( ( seg2dx === 0 ) && ( seg2dy === 0 ) );\t// segment2 is just a point?\r\n\t\t\t\t// both segments are points\r\n\t\t\t\tif ( seg1Pt && seg2Pt ) {\r\n\r\n\t\t\t\t\tif ( ( inSeg1Pt1.x !== inSeg2Pt1.x ) ||\r\n\t\t\t\t\t\t ( inSeg1Pt1.y !== inSeg2Pt1.y ) )\t\treturn [];\t// they are distinct points\r\n\t\t\t\t\treturn [ inSeg1Pt1 ]; \t\t\t\t\t\t// they are the same point\r\n\r\n\t\t\t\t}\r\n\t\t\t\t// segment#1 is a single point\r\n\t\t\t\tif ( seg1Pt ) {\r\n\r\n\t\t\t\t\tif ( ! point_in_segment_2D_colin( inSeg2Pt1, inSeg2Pt2, inSeg1Pt1 ) )\t\treturn [];\t\t// but not in segment#2\r\n\t\t\t\t\treturn [ inSeg1Pt1 ];\r\n\r\n\t\t\t\t}\r\n\t\t\t\t// segment#2 is a single point\r\n\t\t\t\tif ( seg2Pt ) {\r\n\r\n\t\t\t\t\tif ( ! point_in_segment_2D_colin( inSeg1Pt1, inSeg1Pt2, inSeg2Pt1 ) )\t\treturn [];\t\t// but not in segment#1\r\n\t\t\t\t\treturn [ inSeg2Pt1 ];\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\t// they are collinear segments, which might overlap\r\n\t\t\t\tvar seg1min, seg1max, seg1minVal, seg1maxVal;\r\n\t\t\t\tvar seg2min, seg2max, seg2minVal, seg2maxVal;\r\n\t\t\t\tif ( seg1dx !== 0 ) {\r\n\r\n\t\t\t\t\t// the segments are NOT on a vertical line\r\n\t\t\t\t\tif ( inSeg1Pt1.x < inSeg1Pt2.x ) {\r\n\r\n\t\t\t\t\t\tseg1min = inSeg1Pt1; seg1minVal = inSeg1Pt1.x;\r\n\t\t\t\t\t\tseg1max = inSeg1Pt2; seg1maxVal = inSeg1Pt2.x;\r\n\r\n\t\t\t\t\t} else {\r\n\r\n\t\t\t\t\t\tseg1min = inSeg1Pt2; seg1minVal = inSeg1Pt2.x;\r\n\t\t\t\t\t\tseg1max = inSeg1Pt1; seg1maxVal = inSeg1Pt1.x;\r\n\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif ( inSeg2Pt1.x < inSeg2Pt2.x ) {\r\n\r\n\t\t\t\t\t\tseg2min = inSeg2Pt1; seg2minVal = inSeg2Pt1.x;\r\n\t\t\t\t\t\tseg2max = inSeg2Pt2; seg2maxVal = inSeg2Pt2.x;\r\n\r\n\t\t\t\t\t} else {\r\n\r\n\t\t\t\t\t\tseg2min = inSeg2Pt2; seg2minVal = inSeg2Pt2.x;\r\n\t\t\t\t\t\tseg2max = inSeg2Pt1; seg2maxVal = inSeg2Pt1.x;\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\t// the segments are on a vertical line\r\n\t\t\t\t\tif ( inSeg1Pt1.y < inSeg1Pt2.y ) {\r\n\r\n\t\t\t\t\t\tseg1min = inSeg1Pt1; seg1minVal = inSeg1Pt1.y;\r\n\t\t\t\t\t\tseg1max = inSeg1Pt2; seg1maxVal = inSeg1Pt2.y;\r\n\r\n\t\t\t\t\t} else {\r\n\r\n\t\t\t\t\t\tseg1min = inSeg1Pt2; seg1minVal = inSeg1Pt2.y;\r\n\t\t\t\t\t\tseg1max = inSeg1Pt1; seg1maxVal = inSeg1Pt1.y;\r\n\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif ( inSeg2Pt1.y < inSeg2Pt2.y ) {\r\n\r\n\t\t\t\t\t\tseg2min = inSeg2Pt1; seg2minVal = inSeg2Pt1.y;\r\n\t\t\t\t\t\tseg2max = inSeg2Pt2; seg2maxVal = inSeg2Pt2.y;\r\n\r\n\t\t\t\t\t} else {\r\n\r\n\t\t\t\t\t\tseg2min = inSeg2Pt2; seg2minVal = inSeg2Pt2.y;\r\n\t\t\t\t\t\tseg2max = inSeg2Pt1; seg2maxVal = inSeg2Pt1.y;\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\t\t\t\tif ( seg1minVal <= seg2minVal ) {\r\n\r\n\t\t\t\t\tif ( seg1maxVal < seg2minVal )\treturn [];\r\n\t\t\t\t\tif ( seg1maxVal === seg2minVal )\t{\r\n\r\n\t\t\t\t\t\tif ( inExcludeAdjacentSegs )\t\treturn [];\r\n\t\t\t\t\t\treturn [ seg2min ];\r\n\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif ( seg1maxVal <= seg2maxVal )\treturn [ seg2min, seg1max ];\r\n\t\t\t\t\treturn\t[ seg2min, seg2max ];\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\tif ( seg1minVal > seg2maxVal )\treturn [];\r\n\t\t\t\t\tif ( seg1minVal === seg2maxVal )\t{\r\n\r\n\t\t\t\t\t\tif ( inExcludeAdjacentSegs )\t\treturn [];\r\n\t\t\t\t\t\treturn [ seg1min ];\r\n\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif ( seg1maxVal <= seg2maxVal )\treturn [ seg1min, seg1max ];\r\n\t\t\t\t\treturn\t[ seg1min, seg2max ];\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tfunction isPointInsideAngle( inVertex, inLegFromPt, inLegToPt, inOtherPt ) {\r\n\r\n\t\t\t// The order of legs is important\r\n\r\n\t\t\tvar EPSILON = 0.0000000001;\r\n\r\n\t\t\t// translation of all points, so that Vertex is at (0,0)\r\n\t\t\tvar legFromPtX\t= inLegFromPt.x - inVertex.x, legFromPtY\t= inLegFromPt.y - inVertex.y;\r\n\t\t\tvar legToPtX\t= inLegToPt.x\t- inVertex.x, legToPtY\t\t= inLegToPt.y\t- inVertex.y;\r\n\t\t\tvar otherPtX\t= inOtherPt.x\t- inVertex.x, otherPtY\t\t= inOtherPt.y\t- inVertex.y;\r\n\r\n\t\t\t// main angle >0: < 180 deg.; 0: 180 deg.; <0: > 180 deg.\r\n\t\t\tvar from2toAngle\t= legFromPtX * legToPtY - legFromPtY * legToPtX;\r\n\t\t\tvar from2otherAngle\t= legFromPtX * otherPtY - legFromPtY * otherPtX;\r\n\r\n\t\t\tif ( Math.abs( from2toAngle ) > EPSILON ) {\r\n\r\n\t\t\t\t// angle != 180 deg.\r\n\r\n\t\t\t\tvar other2toAngle\t\t= otherPtX * legToPtY - otherPtY * legToPtX;\r\n\t\t\t\t// console.log( \"from2to: \" + from2toAngle + \", from2other: \" + from2otherAngle + \", other2to: \" + other2toAngle );\r\n\r\n\t\t\t\tif ( from2toAngle > 0 ) {\r\n\r\n\t\t\t\t\t// main angle < 180 deg.\r\n\t\t\t\t\treturn\t( ( from2otherAngle >= 0 ) && ( other2toAngle >= 0 ) );\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\t// main angle > 180 deg.\r\n\t\t\t\t\treturn\t( ( from2otherAngle >= 0 ) || ( other2toAngle >= 0 ) );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\t// angle == 180 deg.\r\n\t\t\t\t// console.log( \"from2to: 180 deg., from2other: \" + from2otherAngle );\r\n\t\t\t\treturn\t( from2otherAngle > 0 );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\r\n\t\tfunction removeHoles( contour, holes ) {\r\n\r\n\t\t\tvar shape = contour.concat(); // work on this shape\r\n\t\t\tvar hole;\r\n\r\n\t\t\tfunction isCutLineInsideAngles( inShapeIdx, inHoleIdx ) {\r\n\r\n\t\t\t\t// Check if hole point lies within angle around shape point\r\n\t\t\t\tvar lastShapeIdx = shape.length - 1;\r\n\r\n\t\t\t\tvar prevShapeIdx = inShapeIdx - 1;\r\n\t\t\t\tif ( prevShapeIdx < 0 )\t\t\tprevShapeIdx = lastShapeIdx;\r\n\r\n\t\t\t\tvar nextShapeIdx = inShapeIdx + 1;\r\n\t\t\t\tif ( nextShapeIdx > lastShapeIdx )\tnextShapeIdx = 0;\r\n\r\n\t\t\t\tvar insideAngle = isPointInsideAngle( shape[ inShapeIdx ], shape[ prevShapeIdx ], shape[ nextShapeIdx ], hole[ inHoleIdx ] );\r\n\t\t\t\tif ( ! insideAngle ) {\r\n\r\n\t\t\t\t\t// console.log( \"Vertex (Shape): \" + inShapeIdx + \", Point: \" + hole[inHoleIdx].x + \"/\" + hole[inHoleIdx].y );\r\n\t\t\t\t\treturn\tfalse;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\t// Check if shape point lies within angle around hole point\r\n\t\t\t\tvar lastHoleIdx = hole.length - 1;\r\n\r\n\t\t\t\tvar prevHoleIdx = inHoleIdx - 1;\r\n\t\t\t\tif ( prevHoleIdx < 0 )\t\t\tprevHoleIdx = lastHoleIdx;\r\n\r\n\t\t\t\tvar nextHoleIdx = inHoleIdx + 1;\r\n\t\t\t\tif ( nextHoleIdx > lastHoleIdx )\tnextHoleIdx = 0;\r\n\r\n\t\t\t\tinsideAngle = isPointInsideAngle( hole[ inHoleIdx ], hole[ prevHoleIdx ], hole[ nextHoleIdx ], shape[ inShapeIdx ] );\r\n\t\t\t\tif ( ! insideAngle ) {\r\n\r\n\t\t\t\t\t// console.log( \"Vertex (Hole): \" + inHoleIdx + \", Point: \" + shape[inShapeIdx].x + \"/\" + shape[inShapeIdx].y );\r\n\t\t\t\t\treturn\tfalse;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\treturn\ttrue;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tfunction intersectsShapeEdge( inShapePt, inHolePt ) {\r\n\r\n\t\t\t\t// checks for intersections with shape edges\r\n\t\t\t\tvar sIdx, nextIdx, intersection;\r\n\t\t\t\tfor ( sIdx = 0; sIdx < shape.length; sIdx ++ ) {\r\n\r\n\t\t\t\t\tnextIdx = sIdx + 1; nextIdx %= shape.length;\r\n\t\t\t\t\tintersection = intersect_segments_2D( inShapePt, inHolePt, shape[ sIdx ], shape[ nextIdx ], true );\r\n\t\t\t\t\tif ( intersection.length > 0 )\t\treturn\ttrue;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\treturn\tfalse;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tvar indepHoles = [];\r\n\r\n\t\t\tfunction intersectsHoleEdge( inShapePt, inHolePt ) {\r\n\r\n\t\t\t\t// checks for intersections with hole edges\r\n\t\t\t\tvar ihIdx, chkHole,\r\n\t\t\t\t\thIdx, nextIdx, intersection;\r\n\t\t\t\tfor ( ihIdx = 0; ihIdx < indepHoles.length; ihIdx ++ ) {\r\n\r\n\t\t\t\t\tchkHole = holes[ indepHoles[ ihIdx ]];\r\n\t\t\t\t\tfor ( hIdx = 0; hIdx < chkHole.length; hIdx ++ ) {\r\n\r\n\t\t\t\t\t\tnextIdx = hIdx + 1; nextIdx %= chkHole.length;\r\n\t\t\t\t\t\tintersection = intersect_segments_2D( inShapePt, inHolePt, chkHole[ hIdx ], chkHole[ nextIdx ], true );\r\n\t\t\t\t\t\tif ( intersection.length > 0 )\t\treturn\ttrue;\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\t\t\t\treturn\tfalse;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tvar holeIndex, shapeIndex,\r\n\t\t\t\tshapePt, holePt,\r\n\t\t\t\tholeIdx, cutKey, failedCuts = [],\r\n\t\t\t\ttmpShape1, tmpShape2,\r\n\t\t\t\ttmpHole1, tmpHole2;\r\n\r\n\t\t\tfor ( var h = 0, hl = holes.length; h < hl; h ++ ) {\r\n\r\n\t\t\t\tindepHoles.push( h );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tvar minShapeIndex = 0;\r\n\t\t\tvar counter = indepHoles.length * 2;\r\n\t\t\twhile ( indepHoles.length > 0 ) {\r\n\r\n\t\t\t\tcounter --;\r\n\t\t\t\tif ( counter < 0 ) {\r\n\r\n\t\t\t\t\tconsole.log( \"Infinite Loop! Holes left:\" + indepHoles.length + \", Probably Hole outside Shape!\" );\r\n\t\t\t\t\tbreak;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\t// search for shape-vertex and hole-vertex,\r\n\t\t\t\t// which can be connected without intersections\r\n\t\t\t\tfor ( shapeIndex = minShapeIndex; shapeIndex < shape.length; shapeIndex ++ ) {\r\n\r\n\t\t\t\t\tshapePt = shape[ shapeIndex ];\r\n\t\t\t\t\tholeIndex\t= - 1;\r\n\r\n\t\t\t\t\t// search for hole which can be reached without intersections\r\n\t\t\t\t\tfor ( var h = 0; h < indepHoles.length; h ++ ) {\r\n\r\n\t\t\t\t\t\tholeIdx = indepHoles[ h ];\r\n\r\n\t\t\t\t\t\t// prevent multiple checks\r\n\t\t\t\t\t\tcutKey = shapePt.x + \":\" + shapePt.y + \":\" + holeIdx;\r\n\t\t\t\t\t\tif ( failedCuts[ cutKey ] !== undefined )\t\t\tcontinue;\r\n\r\n\t\t\t\t\t\thole = holes[ holeIdx ];\r\n\t\t\t\t\t\tfor ( var h2 = 0; h2 < hole.length; h2 ++ ) {\r\n\r\n\t\t\t\t\t\t\tholePt = hole[ h2 ];\r\n\t\t\t\t\t\t\tif ( ! isCutLineInsideAngles( shapeIndex, h2 ) )\t\tcontinue;\r\n\t\t\t\t\t\t\tif ( intersectsShapeEdge( shapePt, holePt ) )\t\tcontinue;\r\n\t\t\t\t\t\t\tif ( intersectsHoleEdge( shapePt, holePt ) )\t\tcontinue;\r\n\r\n\t\t\t\t\t\t\tholeIndex = h2;\r\n\t\t\t\t\t\t\tindepHoles.splice( h, 1 );\r\n\r\n\t\t\t\t\t\t\ttmpShape1 = shape.slice( 0, shapeIndex + 1 );\r\n\t\t\t\t\t\t\ttmpShape2 = shape.slice( shapeIndex );\r\n\t\t\t\t\t\t\ttmpHole1 = hole.slice( holeIndex );\r\n\t\t\t\t\t\t\ttmpHole2 = hole.slice( 0, holeIndex + 1 );\r\n\r\n\t\t\t\t\t\t\tshape = tmpShape1.concat( tmpHole1 ).concat( tmpHole2 ).concat( tmpShape2 );\r\n\r\n\t\t\t\t\t\t\tminShapeIndex = shapeIndex;\r\n\r\n\t\t\t\t\t\t\t// Debug only, to show the selected cuts\r\n\t\t\t\t\t\t\t// glob_CutLines.push( [ shapePt, holePt ] );\r\n\r\n\t\t\t\t\t\t\tbreak;\r\n\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tif ( holeIndex >= 0 )\tbreak;\t\t// hole-vertex found\r\n\r\n\t\t\t\t\t\tfailedCuts[ cutKey ] = true;\t\t\t// remember failure\r\n\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif ( holeIndex >= 0 )\tbreak;\t\t// hole-vertex found\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\treturn shape; \t\t\t/* shape with no holes */\r\n\r\n\t\t}\r\n\r\n\r\n\t\tvar i, il, f, face,\r\n\t\t\tkey, index,\r\n\t\t\tallPointsMap = {};\r\n\r\n\t\t// To maintain reference to old shape, one must match coordinates, or offset the indices from original arrays. It's probably easier to do the first.\r\n\r\n\t\tvar allpoints = contour.concat();\r\n\r\n\t\tfor ( var h = 0, hl = holes.length; h < hl; h ++ ) {\r\n\r\n\t\t\tArray.prototype.push.apply( allpoints, holes[ h ] );\r\n\r\n\t\t}\r\n\r\n\t\t//console.log( \"allpoints\",allpoints, allpoints.length );\r\n\r\n\t\t// prepare all points map\r\n\r\n\t\tfor ( i = 0, il = allpoints.length; i < il; i ++ ) {\r\n\r\n\t\t\tkey = allpoints[ i ].x + \":\" + allpoints[ i ].y;\r\n\r\n\t\t\tif ( allPointsMap[ key ] !== undefined ) {\r\n\r\n\t\t\t\tconsole.warn( \"THREE.Shape: Duplicate point\", key );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tallPointsMap[ key ] = i;\r\n\r\n\t\t}\r\n\r\n\t\t// remove holes by cutting paths to holes and adding them to the shape\r\n\t\tvar shapeWithoutHoles = removeHoles( contour, holes );\r\n\r\n\t\tvar triangles = THREE.FontUtils.Triangulate( shapeWithoutHoles, false ); // True returns indices for points of spooled shape\r\n\t\t//console.log( \"triangles\",triangles, triangles.length );\r\n\r\n\t\t// check all face vertices against all points map\r\n\r\n\t\tfor ( i = 0, il = triangles.length; i < il; i ++ ) {\r\n\r\n\t\t\tface = triangles[ i ];\r\n\r\n\t\t\tfor ( f = 0; f < 3; f ++ ) {\r\n\r\n\t\t\t\tkey = face[ f ].x + \":\" + face[ f ].y;\r\n\r\n\t\t\t\tindex = allPointsMap[ key ];\r\n\r\n\t\t\t\tif ( index !== undefined ) {\r\n\r\n\t\t\t\t\tface[ f ] = index;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn triangles.concat();\r\n\r\n\t},\r\n\r\n\tisClockWise: function ( pts ) {\r\n\r\n\t\treturn THREE.FontUtils.Triangulate.area( pts ) < 0;\r\n\r\n\t},\r\n\r\n\t// Bezier Curves formulas obtained from\r\n\t// http://en.wikipedia.org/wiki/B%C3%A9zier_curve\r\n\r\n\t// Quad Bezier Functions\r\n\r\n\tb2p0: function ( t, p ) {\r\n\r\n\t\tvar k = 1 - t;\r\n\t\treturn k * k * p;\r\n\r\n\t},\r\n\r\n\tb2p1: function ( t, p ) {\r\n\r\n\t\treturn 2 * ( 1 - t ) * t * p;\r\n\r\n\t},\r\n\r\n\tb2p2: function ( t, p ) {\r\n\r\n\t\treturn t * t * p;\r\n\r\n\t},\r\n\r\n\tb2: function ( t, p0, p1, p2 ) {\r\n\r\n\t\treturn this.b2p0( t, p0 ) + this.b2p1( t, p1 ) + this.b2p2( t, p2 );\r\n\r\n\t},\r\n\r\n\t// Cubic Bezier Functions\r\n\r\n\tb3p0: function ( t, p ) {\r\n\r\n\t\tvar k = 1 - t;\r\n\t\treturn k * k * k * p;\r\n\r\n\t},\r\n\r\n\tb3p1: function ( t, p ) {\r\n\r\n\t\tvar k = 1 - t;\r\n\t\treturn 3 * k * k * t * p;\r\n\r\n\t},\r\n\r\n\tb3p2: function ( t, p ) {\r\n\r\n\t\tvar k = 1 - t;\r\n\t\treturn 3 * k * t * t * p;\r\n\r\n\t},\r\n\r\n\tb3p3: function ( t, p ) {\r\n\r\n\t\treturn t * t * t * p;\r\n\r\n\t},\r\n\r\n\tb3: function ( t, p0, p1, p2, p3 ) {\r\n\r\n\t\treturn this.b3p0( t, p0 ) + this.b3p1( t, p1 ) + this.b3p2( t, p2 ) + this.b3p3( t, p3 );\r\n\r\n\t}\r\n\r\n};\r\n\r\n// File:src/extras/curves/LineCurve.js\r\n\r\n/**************************************************************\r\n *\tLine\r\n **************************************************************/\r\n\r\nTHREE.LineCurve = function ( v1, v2 ) {\r\n\r\n\tthis.v1 = v1;\r\n\tthis.v2 = v2;\r\n\r\n};\r\n\r\nTHREE.LineCurve.prototype = Object.create( THREE.Curve.prototype );\r\nTHREE.LineCurve.prototype.constructor = THREE.LineCurve;\r\n\r\nTHREE.LineCurve.prototype.getPoint = function ( t ) {\r\n\r\n\tvar point = this.v2.clone().sub( this.v1 );\r\n\tpoint.multiplyScalar( t ).add( this.v1 );\r\n\r\n\treturn point;\r\n\r\n};\r\n\r\n// Line curve is linear, so we can overwrite default getPointAt\r\n\r\nTHREE.LineCurve.prototype.getPointAt = function ( u ) {\r\n\r\n\treturn this.getPoint( u );\r\n\r\n};\r\n\r\nTHREE.LineCurve.prototype.getTangent = function( t ) {\r\n\r\n\tvar tangent = this.v2.clone().sub( this.v1 );\r\n\r\n\treturn tangent.normalize();\r\n\r\n};\r\n\r\n// File:src/extras/curves/QuadraticBezierCurve.js\r\n\r\n/**************************************************************\r\n *\tQuadratic Bezier curve\r\n **************************************************************/\r\n\r\n\r\nTHREE.QuadraticBezierCurve = function ( v0, v1, v2 ) {\r\n\r\n\tthis.v0 = v0;\r\n\tthis.v1 = v1;\r\n\tthis.v2 = v2;\r\n\r\n};\r\n\r\nTHREE.QuadraticBezierCurve.prototype = Object.create( THREE.Curve.prototype );\r\nTHREE.QuadraticBezierCurve.prototype.constructor = THREE.QuadraticBezierCurve;\r\n\r\n\r\nTHREE.QuadraticBezierCurve.prototype.getPoint = function ( t ) {\r\n\r\n\tvar vector = new THREE.Vector2();\r\n\r\n\tvector.x = THREE.Shape.Utils.b2( t, this.v0.x, this.v1.x, this.v2.x );\r\n\tvector.y = THREE.Shape.Utils.b2( t, this.v0.y, this.v1.y, this.v2.y );\r\n\r\n\treturn vector;\r\n\r\n};\r\n\r\n\r\nTHREE.QuadraticBezierCurve.prototype.getTangent = function( t ) {\r\n\r\n\tvar vector = new THREE.Vector2();\r\n\r\n\tvector.x = THREE.Curve.Utils.tangentQuadraticBezier( t, this.v0.x, this.v1.x, this.v2.x );\r\n\tvector.y = THREE.Curve.Utils.tangentQuadraticBezier( t, this.v0.y, this.v1.y, this.v2.y );\r\n\r\n\t// returns unit vector\r\n\r\n\treturn vector.normalize();\r\n\r\n};\r\n\r\n// File:src/extras/curves/CubicBezierCurve.js\r\n\r\n/**************************************************************\r\n *\tCubic Bezier curve\r\n **************************************************************/\r\n\r\nTHREE.CubicBezierCurve = function ( v0, v1, v2, v3 ) {\r\n\r\n\tthis.v0 = v0;\r\n\tthis.v1 = v1;\r\n\tthis.v2 = v2;\r\n\tthis.v3 = v3;\r\n\r\n};\r\n\r\nTHREE.CubicBezierCurve.prototype = Object.create( THREE.Curve.prototype );\r\nTHREE.CubicBezierCurve.prototype.constructor = THREE.CubicBezierCurve;\r\n\r\nTHREE.CubicBezierCurve.prototype.getPoint = function ( t ) {\r\n\r\n\tvar tx, ty;\r\n\r\n\ttx = THREE.Shape.Utils.b3( t, this.v0.x, this.v1.x, this.v2.x, this.v3.x );\r\n\tty = THREE.Shape.Utils.b3( t, this.v0.y, this.v1.y, this.v2.y, this.v3.y );\r\n\r\n\treturn new THREE.Vector2( tx, ty );\r\n\r\n};\r\n\r\nTHREE.CubicBezierCurve.prototype.getTangent = function( t ) {\r\n\r\n\tvar tx, ty;\r\n\r\n\ttx = THREE.Curve.Utils.tangentCubicBezier( t, this.v0.x, this.v1.x, this.v2.x, this.v3.x );\r\n\tty = THREE.Curve.Utils.tangentCubicBezier( t, this.v0.y, this.v1.y, this.v2.y, this.v3.y );\r\n\r\n\tvar tangent = new THREE.Vector2( tx, ty );\r\n\ttangent.normalize();\r\n\r\n\treturn tangent;\r\n\r\n};\r\n\r\n// File:src/extras/curves/SplineCurve.js\r\n\r\n/**************************************************************\r\n *\tSpline curve\r\n **************************************************************/\r\n\r\nTHREE.SplineCurve = function ( points /* array of Vector2 */ ) {\r\n\r\n\tthis.points = ( points == undefined ) ? [] : points;\r\n\r\n};\r\n\r\nTHREE.SplineCurve.prototype = Object.create( THREE.Curve.prototype );\r\nTHREE.SplineCurve.prototype.constructor = THREE.SplineCurve;\r\n\r\nTHREE.SplineCurve.prototype.getPoint = function ( t ) {\r\n\r\n\tvar points = this.points;\r\n\tvar point = ( points.length - 1 ) * t;\r\n\r\n\tvar intPoint = Math.floor( point );\r\n\tvar weight = point - intPoint;\r\n\r\n\tvar point0 = points[ intPoint === 0 ? intPoint : intPoint - 1 ];\r\n\tvar point1 = points[ intPoint ];\r\n\tvar point2 = points[ intPoint > points.length - 2 ? points.length - 1 : intPoint + 1 ];\r\n\tvar point3 = points[ intPoint > points.length - 3 ? points.length - 1 : intPoint + 2 ];\r\n\r\n\tvar vector = new THREE.Vector2();\r\n\r\n\tvector.x = THREE.Curve.Utils.interpolate( point0.x, point1.x, point2.x, point3.x, weight );\r\n\tvector.y = THREE.Curve.Utils.interpolate( point0.y, point1.y, point2.y, point3.y, weight );\r\n\r\n\treturn vector;\r\n\r\n};\r\n\r\n// File:src/extras/curves/EllipseCurve.js\r\n\r\n/**************************************************************\r\n *\tEllipse curve\r\n **************************************************************/\r\n\r\nTHREE.EllipseCurve = function ( aX, aY, xRadius, yRadius, aStartAngle, aEndAngle, aClockwise, aRotation ) {\r\n\r\n\tthis.aX = aX;\r\n\tthis.aY = aY;\r\n\r\n\tthis.xRadius = xRadius;\r\n\tthis.yRadius = yRadius;\r\n\r\n\tthis.aStartAngle = aStartAngle;\r\n\tthis.aEndAngle = aEndAngle;\r\n\r\n\tthis.aClockwise = aClockwise;\r\n\t\r\n\tthis.aRotation = aRotation || 0;\r\n\r\n};\r\n\r\nTHREE.EllipseCurve.prototype = Object.create( THREE.Curve.prototype );\r\nTHREE.EllipseCurve.prototype.constructor = THREE.EllipseCurve;\r\n\r\nTHREE.EllipseCurve.prototype.getPoint = function ( t ) {\r\n\r\n\tvar deltaAngle = this.aEndAngle - this.aStartAngle;\r\n\r\n\tif ( deltaAngle < 0 ) deltaAngle += Math.PI * 2;\r\n\tif ( deltaAngle > Math.PI * 2 ) deltaAngle -= Math.PI * 2;\r\n\r\n\tvar angle;\r\n\r\n\tif ( this.aClockwise === true ) {\r\n\r\n\t\tangle = this.aEndAngle + ( 1 - t ) * ( Math.PI * 2 - deltaAngle );\r\n\r\n\t} else {\r\n\r\n\t\tangle = this.aStartAngle + t * deltaAngle;\r\n\r\n\t}\r\n\t\r\n\tvar x = this.aX + this.xRadius * Math.cos( angle );\r\n\tvar y = this.aY + this.yRadius * Math.sin( angle );\r\n\r\n\tif ( this.aRotation !== 0 ) {\r\n\r\n\t\tvar cos = Math.cos( this.aRotation );\r\n\t\tvar sin = Math.sin( this.aRotation );\r\n\r\n\t\tvar tx = x, ty = y;\r\n\r\n\t\t// Rotate the point about the center of the ellipse.\r\n\t\tx = ( tx - this.aX ) * cos - ( ty - this.aY ) * sin + this.aX;\r\n\t\ty = ( tx - this.aX ) * sin + ( ty - this.aY ) * cos + this.aY;\r\n\r\n\t}\r\n\r\n\treturn new THREE.Vector2( x, y );\r\n\r\n};\r\n\r\n// File:src/extras/curves/ArcCurve.js\r\n\r\n/**************************************************************\r\n *\tArc curve\r\n **************************************************************/\r\n\r\nTHREE.ArcCurve = function ( aX, aY, aRadius, aStartAngle, aEndAngle, aClockwise ) {\r\n\r\n\tTHREE.EllipseCurve.call( this, aX, aY, aRadius, aRadius, aStartAngle, aEndAngle, aClockwise );\r\n\r\n};\r\n\r\nTHREE.ArcCurve.prototype = Object.create( THREE.EllipseCurve.prototype );\r\nTHREE.ArcCurve.prototype.constructor = THREE.ArcCurve;\r\n\r\n// File:src/extras/curves/LineCurve3.js\r\n\r\n/**************************************************************\r\n *\tLine3D\r\n **************************************************************/\r\n\r\nTHREE.LineCurve3 = THREE.Curve.create(\r\n\r\n\tfunction ( v1, v2 ) {\r\n\r\n\t\tthis.v1 = v1;\r\n\t\tthis.v2 = v2;\r\n\r\n\t},\r\n\r\n\tfunction ( t ) {\r\n\r\n\t\tvar vector = new THREE.Vector3();\r\n\r\n\t\tvector.subVectors( this.v2, this.v1 ); // diff\r\n\t\tvector.multiplyScalar( t );\r\n\t\tvector.add( this.v1 );\r\n\r\n\t\treturn vector;\r\n\r\n\t}\r\n\r\n);\r\n\r\n// File:src/extras/curves/QuadraticBezierCurve3.js\r\n\r\n/**************************************************************\r\n *\tQuadratic Bezier 3D curve\r\n **************************************************************/\r\n\r\nTHREE.QuadraticBezierCurve3 = THREE.Curve.create(\r\n\r\n\tfunction ( v0, v1, v2 ) {\r\n\r\n\t\tthis.v0 = v0;\r\n\t\tthis.v1 = v1;\r\n\t\tthis.v2 = v2;\r\n\r\n\t},\r\n\r\n\tfunction ( t ) {\r\n\r\n\t\tvar vector = new THREE.Vector3();\r\n\r\n\t\tvector.x = THREE.Shape.Utils.b2( t, this.v0.x, this.v1.x, this.v2.x );\r\n\t\tvector.y = THREE.Shape.Utils.b2( t, this.v0.y, this.v1.y, this.v2.y );\r\n\t\tvector.z = THREE.Shape.Utils.b2( t, this.v0.z, this.v1.z, this.v2.z );\r\n\r\n\t\treturn vector;\r\n\r\n\t}\r\n\r\n);\r\n\r\n// File:src/extras/curves/CubicBezierCurve3.js\r\n\r\n/**************************************************************\r\n *\tCubic Bezier 3D curve\r\n **************************************************************/\r\n\r\nTHREE.CubicBezierCurve3 = THREE.Curve.create(\r\n\r\n\tfunction ( v0, v1, v2, v3 ) {\r\n\r\n\t\tthis.v0 = v0;\r\n\t\tthis.v1 = v1;\r\n\t\tthis.v2 = v2;\r\n\t\tthis.v3 = v3;\r\n\r\n\t},\r\n\r\n\tfunction ( t ) {\r\n\r\n\t\tvar vector = new THREE.Vector3();\r\n\r\n\t\tvector.x = THREE.Shape.Utils.b3( t, this.v0.x, this.v1.x, this.v2.x, this.v3.x );\r\n\t\tvector.y = THREE.Shape.Utils.b3( t, this.v0.y, this.v1.y, this.v2.y, this.v3.y );\r\n\t\tvector.z = THREE.Shape.Utils.b3( t, this.v0.z, this.v1.z, this.v2.z, this.v3.z );\r\n\r\n\t\treturn vector;\r\n\r\n\t}\r\n\r\n);\r\n\r\n// File:src/extras/curves/SplineCurve3.js\r\n\r\n/**************************************************************\r\n *\tSpline 3D curve\r\n **************************************************************/\r\n\r\n\r\nTHREE.SplineCurve3 = THREE.Curve.create(\r\n\r\n\tfunction ( points /* array of Vector3 */ ) {\r\n\r\n\t\tconsole.warn( 'THREE.SplineCurve3 will be deprecated. Please use THREE.CatmullRomCurve3' );\r\n\t\tthis.points = ( points == undefined ) ? [] : points;\r\n\r\n\t},\r\n\r\n\tfunction ( t ) {\r\n\r\n\t\tvar points = this.points;\r\n\t\tvar point = ( points.length - 1 ) * t;\r\n\r\n\t\tvar intPoint = Math.floor( point );\r\n\t\tvar weight = point - intPoint;\r\n\r\n\t\tvar point0 = points[ intPoint == 0 ? intPoint : intPoint - 1 ];\r\n\t\tvar point1 = points[ intPoint ];\r\n\t\tvar point2 = points[ intPoint > points.length - 2 ? points.length - 1 : intPoint + 1 ];\r\n\t\tvar point3 = points[ intPoint > points.length - 3 ? points.length - 1 : intPoint + 2 ];\r\n\r\n\t\tvar vector = new THREE.Vector3();\r\n\r\n\t\tvector.x = THREE.Curve.Utils.interpolate( point0.x, point1.x, point2.x, point3.x, weight );\r\n\t\tvector.y = THREE.Curve.Utils.interpolate( point0.y, point1.y, point2.y, point3.y, weight );\r\n\t\tvector.z = THREE.Curve.Utils.interpolate( point0.z, point1.z, point2.z, point3.z, weight );\r\n\r\n\t\treturn vector;\r\n\r\n\t}\r\n\r\n);\r\n\r\n// File:src/extras/curves/CatmullRomCurve3.js\r\n\r\n/**\r\n * @author zz85 https://github.com/zz85\r\n *\r\n * Centripetal CatmullRom Curve - which is useful for avoiding\r\n * cusps and self-intersections in non-uniform catmull rom curves.\r\n * http://www.cemyuksel.com/research/catmullrom_param/catmullrom.pdf\r\n *\r\n * curve.type accepts centripetal(default), chordal and catmullrom\r\n * curve.tension is used for catmullrom which defaults to 0.5\r\n */\r\n\r\nTHREE.CatmullRomCurve3 = ( function() {\r\n\r\n\tvar\r\n\t\ttmp = new THREE.Vector3(),\r\n\t\tpx = new CubicPoly(),\r\n\t\tpy = new CubicPoly(),\r\n\t\tpz = new CubicPoly();\r\n\r\n\t/*\r\n\tBased on an optimized c++ solution in\r\n\t - http://stackoverflow.com/questions/9489736/catmull-rom-curve-with-no-cusps-and-no-self-intersections/\r\n\t - http://ideone.com/NoEbVM\r\n\r\n\tThis CubicPoly class could be used for reusing some variables and calculations,\r\n\tbut for three.js curve use, it could be possible inlined and flatten into a single function call\r\n\twhich can be placed in CurveUtils.\r\n\t*/\r\n\r\n\tfunction CubicPoly() {\r\n\r\n\t}\r\n\r\n\t/*\r\n\t * Compute coefficients for a cubic polynomial\r\n\t * p(s) = c0 + c1*s + c2*s^2 + c3*s^3\r\n\t * such that\r\n\t * p(0) = x0, p(1) = x1\r\n\t * and\r\n\t * p'(0) = t0, p'(1) = t1.\r\n\t */\r\n\tCubicPoly.prototype.init = function( x0, x1, t0, t1 ) {\r\n\r\n\t\tthis.c0 = x0;\r\n\t\tthis.c1 = t0;\r\n\t\tthis.c2 = - 3 * x0 + 3 * x1 - 2 * t0 - t1;\r\n\t\tthis.c3 = 2 * x0 - 2 * x1 + t0 + t1;\r\n\r\n\t};\r\n\r\n\tCubicPoly.prototype.initNonuniformCatmullRom = function( x0, x1, x2, x3, dt0, dt1, dt2 ) {\r\n\r\n\t\t// compute tangents when parameterized in [t1,t2]\r\n\t\tvar t1 = ( x1 - x0 ) / dt0 - ( x2 - x0 ) / ( dt0 + dt1 ) + ( x2 - x1 ) / dt1;\r\n\t\tvar t2 = ( x2 - x1 ) / dt1 - ( x3 - x1 ) / ( dt1 + dt2 ) + ( x3 - x2 ) / dt2;\r\n\r\n\t\t// rescale tangents for parametrization in [0,1]\r\n\t\tt1 *= dt1;\r\n\t\tt2 *= dt1;\r\n\r\n\t\t// initCubicPoly\r\n\t\tthis.init( x1, x2, t1, t2 );\r\n\r\n\t};\r\n\r\n\t// standard Catmull-Rom spline: interpolate between x1 and x2 with previous/following points x1/x4\r\n\tCubicPoly.prototype.initCatmullRom = function( x0, x1, x2, x3, tension ) {\r\n\r\n\t\tthis.init( x1, x2, tension * ( x2 - x0 ), tension * ( x3 - x1 ) );\r\n\r\n\t};\r\n\r\n\tCubicPoly.prototype.calc = function( t ) {\r\n\r\n\t\tvar t2 = t * t;\r\n\t\tvar t3 = t2 * t;\r\n\t\treturn this.c0 + this.c1 * t + this.c2 * t2 + this.c3 * t3;\r\n\r\n\t};\r\n\r\n\t// Subclass Three.js curve\r\n\treturn THREE.Curve.create(\r\n\r\n\t\tfunction ( p /* array of Vector3 */ ) {\r\n\r\n\t\t\tthis.points = p || [];\r\n\r\n\t\t},\r\n\r\n\t\tfunction ( t ) {\r\n\r\n\t\t\tvar points = this.points,\r\n\t\t\t\tpoint, intPoint, weight, l;\r\n\r\n\t\t\tl = points.length;\r\n\r\n\t\t\tif ( l < 2 ) console.log( 'duh, you need at least 2 points' );\r\n\r\n\t\t\tpoint = ( l - 1 ) * t;\r\n\t\t\tintPoint = Math.floor( point );\r\n\t\t\tweight = point - intPoint;\r\n\r\n\t\t\tif ( weight === 0 && intPoint === l - 1 ) {\r\n\r\n\t\t\t\tintPoint = l - 2;\r\n\t\t\t\tweight = 1;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tvar p0, p1, p2, p3;\r\n\r\n\t\t\tif ( intPoint === 0 ) {\r\n\r\n\t\t\t\t// extrapolate first point\r\n\t\t\t\ttmp.subVectors( points[ 0 ], points[ 1 ] ).add( points[ 0 ] );\r\n\t\t\t\tp0 = tmp;\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tp0 = points[ intPoint - 1 ];\r\n\r\n\t\t\t}\r\n\r\n\t\t\tp1 = points[ intPoint ];\r\n\t\t\tp2 = points[ intPoint + 1 ];\r\n\r\n\t\t\tif ( intPoint + 2 < l ) {\r\n\r\n\t\t\t\tp3 = points[ intPoint + 2 ]\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\t// extrapolate last point\r\n\t\t\t\ttmp.subVectors( points[ l - 1 ], points[ l - 2 ] ).add( points[ l - 2 ] );\r\n\t\t\t\tp3 = tmp;\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( this.type === undefined || this.type === 'centripetal' || this.type === 'chordal' ) {\r\n\r\n\t\t\t\t// init Centripetal / Chordal Catmull-Rom\r\n\t\t\t\tvar pow = this.type === 'chordal' ? 0.5 : 0.25;\r\n\t\t\t\tvar dt0 = Math.pow( p0.distanceToSquared( p1 ), pow );\r\n\t\t\t\tvar dt1 = Math.pow( p1.distanceToSquared( p2 ), pow );\r\n\t\t\t\tvar dt2 = Math.pow( p2.distanceToSquared( p3 ), pow );\r\n\r\n\t\t\t\t// safety check for repeated points\r\n\t\t\t\tif ( dt1 < 1e-4 ) dt1 = 1.0;\r\n\t\t\t\tif ( dt0 < 1e-4 ) dt0 = dt1;\r\n\t\t\t\tif ( dt2 < 1e-4 ) dt2 = dt1;\r\n\r\n\t\t\t\tpx.initNonuniformCatmullRom( p0.x, p1.x, p2.x, p3.x, dt0, dt1, dt2 );\r\n\t\t\t\tpy.initNonuniformCatmullRom( p0.y, p1.y, p2.y, p3.y, dt0, dt1, dt2 );\r\n\t\t\t\tpz.initNonuniformCatmullRom( p0.z, p1.z, p2.z, p3.z, dt0, dt1, dt2 );\r\n\r\n\t\t\t} else if ( this.type === 'catmullrom' ) {\r\n\r\n\t\t\t\tvar tension = this.tension !== undefined ? this.tension : 0.5;\r\n\t\t\t\tpx.initCatmullRom( p0.x, p1.x, p2.x, p3.x, tension );\r\n\t\t\t\tpy.initCatmullRom( p0.y, p1.y, p2.y, p3.y, tension );\r\n\t\t\t\tpz.initCatmullRom( p0.z, p1.z, p2.z, p3.z, tension );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tvar v = new THREE.Vector3(\r\n\t\t\t\tpx.calc( weight ),\r\n\t\t\t\tpy.calc( weight ),\r\n\t\t\t\tpz.calc( weight )\r\n\t\t\t);\r\n\r\n\t\t\treturn v;\r\n\r\n\t\t}\r\n\r\n\t);\r\n\r\n} )();\r\n\r\n// File:src/extras/curves/ClosedSplineCurve3.js\r\n\r\n/**************************************************************\r\n *\tClosed Spline 3D curve\r\n **************************************************************/\r\n\r\n\r\nTHREE.ClosedSplineCurve3 = THREE.Curve.create(\r\n\r\n\tfunction ( points /* array of Vector3 */ ) {\r\n\r\n\t\tthis.points = ( points == undefined ) ? [] : points;\r\n\r\n\t},\r\n\r\n\tfunction ( t ) {\r\n\r\n\t\tvar points = this.points;\r\n\t\tvar point = ( points.length - 0 ) * t; // This needs to be from 0-length +1\r\n\r\n\t\tvar intPoint = Math.floor( point );\r\n\t\tvar weight = point - intPoint;\r\n\r\n\t\tintPoint += intPoint > 0 ? 0 : ( Math.floor( Math.abs( intPoint ) / points.length ) + 1 ) * points.length;\r\n\r\n\t\tvar point0 = points[ ( intPoint - 1 ) % points.length ];\r\n\t\tvar point1 = points[ ( intPoint ) % points.length ];\r\n\t\tvar point2 = points[ ( intPoint + 1 ) % points.length ];\r\n\t\tvar point3 = points[ ( intPoint + 2 ) % points.length ];\r\n\r\n\t\tvar vector = new THREE.Vector3();\r\n\r\n\t\tvector.x = THREE.Curve.Utils.interpolate( point0.x, point1.x, point2.x, point3.x, weight );\r\n\t\tvector.y = THREE.Curve.Utils.interpolate( point0.y, point1.y, point2.y, point3.y, weight );\r\n\t\tvector.z = THREE.Curve.Utils.interpolate( point0.z, point1.z, point2.z, point3.z, weight );\r\n\r\n\t\treturn vector;\r\n\r\n\t}\r\n\r\n);\r\n\r\n// File:src/extras/animation/AnimationHandler.js\r\n\r\n/**\r\n * @author mikael emtinger / http://gomo.se/\r\n */\r\n\r\nTHREE.AnimationHandler = {\r\n\r\n\tLINEAR: 0,\r\n\tCATMULLROM: 1,\r\n\tCATMULLROM_FORWARD: 2,\r\n\r\n\t//\r\n\r\n\tadd: function () {\r\n\r\n\t\tconsole.warn( 'THREE.AnimationHandler.add() has been deprecated.' );\r\n\r\n\t},\r\n\tget: function () {\r\n\r\n\t\tconsole.warn( 'THREE.AnimationHandler.get() has been deprecated.' );\r\n\r\n\t},\r\n\tremove: function () {\r\n\r\n\t\tconsole.warn( 'THREE.AnimationHandler.remove() has been deprecated.' );\r\n\r\n\t},\r\n\r\n\t//\r\n\r\n\tanimations: [],\r\n\r\n\tinit: function ( data ) {\r\n\r\n\t\tif ( data.initialized === true ) return data;\r\n\r\n\t\t// loop through all keys\r\n\r\n\t\tfor ( var h = 0; h < data.hierarchy.length; h ++ ) {\r\n\r\n\t\t\tfor ( var k = 0; k < data.hierarchy[ h ].keys.length; k ++ ) {\r\n\r\n\t\t\t\t// remove minus times\r\n\r\n\t\t\t\tif ( data.hierarchy[ h ].keys[ k ].time < 0 ) {\r\n\r\n\t\t\t\t\t data.hierarchy[ h ].keys[ k ].time = 0;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\t// create quaternions\r\n\r\n\t\t\t\tif ( data.hierarchy[ h ].keys[ k ].rot !== undefined &&\r\n\t\t\t\t ! ( data.hierarchy[ h ].keys[ k ].rot instanceof THREE.Quaternion ) ) {\r\n\r\n\t\t\t\t\tvar quat = data.hierarchy[ h ].keys[ k ].rot;\r\n\t\t\t\t\tdata.hierarchy[ h ].keys[ k ].rot = new THREE.Quaternion().fromArray( quat );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\t// prepare morph target keys\r\n\r\n\t\t\tif ( data.hierarchy[ h ].keys.length && data.hierarchy[ h ].keys[ 0 ].morphTargets !== undefined ) {\r\n\r\n\t\t\t\t// get all used\r\n\r\n\t\t\t\tvar usedMorphTargets = {};\r\n\r\n\t\t\t\tfor ( var k = 0; k < data.hierarchy[ h ].keys.length; k ++ ) {\r\n\r\n\t\t\t\t\tfor ( var m = 0; m < data.hierarchy[ h ].keys[ k ].morphTargets.length; m ++ ) {\r\n\r\n\t\t\t\t\t\tvar morphTargetName = data.hierarchy[ h ].keys[ k ].morphTargets[ m ];\r\n\t\t\t\t\t\tusedMorphTargets[ morphTargetName ] = - 1;\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tdata.hierarchy[ h ].usedMorphTargets = usedMorphTargets;\r\n\r\n\r\n\t\t\t\t// set all used on all frames\r\n\r\n\t\t\t\tfor ( var k = 0; k < data.hierarchy[ h ].keys.length; k ++ ) {\r\n\r\n\t\t\t\t\tvar influences = {};\r\n\r\n\t\t\t\t\tfor ( var morphTargetName in usedMorphTargets ) {\r\n\r\n\t\t\t\t\t\tfor ( var m = 0; m < data.hierarchy[ h ].keys[ k ].morphTargets.length; m ++ ) {\r\n\r\n\t\t\t\t\t\t\tif ( data.hierarchy[ h ].keys[ k ].morphTargets[ m ] === morphTargetName ) {\r\n\r\n\t\t\t\t\t\t\t\tinfluences[ morphTargetName ] = data.hierarchy[ h ].keys[ k ].morphTargetsInfluences[ m ];\r\n\t\t\t\t\t\t\t\tbreak;\r\n\r\n\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\tif ( m === data.hierarchy[ h ].keys[ k ].morphTargets.length ) {\r\n\r\n\t\t\t\t\t\t\tinfluences[ morphTargetName ] = 0;\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tdata.hierarchy[ h ].keys[ k ].morphTargetsInfluences = influences;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\r\n\t\t\t// remove all keys that are on the same time\r\n\r\n\t\t\tfor ( var k = 1; k < data.hierarchy[ h ].keys.length; k ++ ) {\r\n\r\n\t\t\t\tif ( data.hierarchy[ h ].keys[ k ].time === data.hierarchy[ h ].keys[ k - 1 ].time ) {\r\n\r\n\t\t\t\t\tdata.hierarchy[ h ].keys.splice( k, 1 );\r\n\t\t\t\t\tk --;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\r\n\t\t\t// set index\r\n\r\n\t\t\tfor ( var k = 0; k < data.hierarchy[ h ].keys.length; k ++ ) {\r\n\r\n\t\t\t\tdata.hierarchy[ h ].keys[ k ].index = k;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tdata.initialized = true;\r\n\r\n\t\treturn data;\r\n\r\n\t},\r\n\r\n\tparse: function ( root ) {\r\n\r\n\t\tvar parseRecurseHierarchy = function ( root, hierarchy ) {\r\n\r\n\t\t\thierarchy.push( root );\r\n\r\n\t\t\tfor ( var c = 0; c < root.children.length; c ++ )\r\n\t\t\t\tparseRecurseHierarchy( root.children[ c ], hierarchy );\r\n\r\n\t\t};\r\n\r\n\t\t// setup hierarchy\r\n\r\n\t\tvar hierarchy = [];\r\n\r\n\t\tif ( root instanceof THREE.SkinnedMesh ) {\r\n\r\n\t\t\tfor ( var b = 0; b < root.skeleton.bones.length; b ++ ) {\r\n\r\n\t\t\t\thierarchy.push( root.skeleton.bones[ b ] );\r\n\r\n\t\t\t}\r\n\r\n\t\t} else {\r\n\r\n\t\t\tparseRecurseHierarchy( root, hierarchy );\r\n\r\n\t\t}\r\n\r\n\t\treturn hierarchy;\r\n\r\n\t},\r\n\r\n\tplay: function ( animation ) {\r\n\r\n\t\tif ( this.animations.indexOf( animation ) === - 1 ) {\r\n\r\n\t\t\tthis.animations.push( animation );\r\n\r\n\t\t}\r\n\r\n\t},\r\n\r\n\tstop: function ( animation ) {\r\n\r\n\t\tvar index = this.animations.indexOf( animation );\r\n\r\n\t\tif ( index !== - 1 ) {\r\n\r\n\t\t\tthis.animations.splice( index, 1 );\r\n\r\n\t\t}\r\n\r\n\t},\r\n\r\n\tupdate: function ( deltaTimeMS ) {\r\n\r\n\t\tfor ( var i = 0; i < this.animations.length; i ++ ) {\r\n\r\n\t\t\tthis.animations[ i ].resetBlendWeights();\r\n\r\n\t\t}\r\n\r\n\t\tfor ( var i = 0; i < this.animations.length; i ++ ) {\r\n\r\n\t\t\tthis.animations[ i ].update( deltaTimeMS );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n};\r\n\r\n// File:src/extras/animation/Animation.js\r\n\r\n/**\r\n * @author mikael emtinger / http://gomo.se/\r\n * @author mrdoob / http://mrdoob.com/\r\n * @author alteredq / http://alteredqualia.com/\r\n */\r\n\r\nTHREE.Animation = function ( root, data ) {\r\n\r\n\tthis.root = root;\r\n\tthis.data = THREE.AnimationHandler.init( data );\r\n\tthis.hierarchy = THREE.AnimationHandler.parse( root );\r\n\r\n\tthis.currentTime = 0;\r\n\tthis.timeScale = 1;\r\n\r\n\tthis.isPlaying = false;\r\n\tthis.loop = true;\r\n\tthis.weight = 0;\r\n\r\n\tthis.interpolationType = THREE.AnimationHandler.LINEAR;\r\n\r\n};\r\n\r\nTHREE.Animation.prototype = {\r\n\r\n\tconstructor: THREE.Animation,\r\n\r\n\tkeyTypes: [ \"pos\", \"rot\", \"scl\" ],\r\n\r\n\tplay: function ( startTime, weight ) {\r\n\r\n\t\tthis.currentTime = startTime !== undefined ? startTime : 0;\r\n\t\tthis.weight = weight !== undefined ? weight : 1;\r\n\r\n\t\tthis.isPlaying = true;\r\n\r\n\t\tthis.reset();\r\n\r\n\t\tTHREE.AnimationHandler.play( this );\r\n\r\n\t},\r\n\r\n\tstop: function() {\r\n\r\n\t\tthis.isPlaying = false;\r\n\r\n\t\tTHREE.AnimationHandler.stop( this );\r\n\r\n\t},\r\n\r\n\treset: function () {\r\n\r\n\t\tfor ( var h = 0, hl = this.hierarchy.length; h < hl; h ++ ) {\r\n\r\n\t\t\tvar object = this.hierarchy[ h ];\r\n\r\n\t\t\tif ( object.animationCache === undefined ) {\r\n\r\n\t\t\t\tobject.animationCache = {\r\n\t\t\t\t\tanimations: {},\r\n\t\t\t\t\tblending: {\r\n\t\t\t\t\t\tpositionWeight: 0.0,\r\n\t\t\t\t\t\tquaternionWeight: 0.0,\r\n\t\t\t\t\t\tscaleWeight: 0.0\r\n\t\t\t\t\t}\r\n\t\t\t\t};\r\n\r\n\t\t\t}\r\n\r\n\t\t\tvar name = this.data.name;\r\n\t\t\tvar animations = object.animationCache.animations;\r\n\t\t\tvar animationCache = animations[ name ];\r\n\r\n\t\t\tif ( animationCache === undefined ) {\r\n\r\n\t\t\t\tanimationCache = {\r\n\t\t\t\t\tprevKey: { pos: 0, rot: 0, scl: 0 },\r\n\t\t\t\t\tnextKey: { pos: 0, rot: 0, scl: 0 },\r\n\t\t\t\t\toriginalMatrix: object.matrix\r\n\t\t\t\t};\r\n\r\n\t\t\t\tanimations[ name ] = animationCache;\r\n\r\n\t\t\t}\r\n\r\n\t\t\t// Get keys to match our current time\r\n\r\n\t\t\tfor ( var t = 0; t < 3; t ++ ) {\r\n\r\n\t\t\t\tvar type = this.keyTypes[ t ];\r\n\r\n\t\t\t\tvar prevKey = this.data.hierarchy[ h ].keys[ 0 ];\r\n\t\t\t\tvar nextKey = this.getNextKeyWith( type, h, 1 );\r\n\r\n\t\t\t\twhile ( nextKey.time < this.currentTime && nextKey.index > prevKey.index ) {\r\n\r\n\t\t\t\t\tprevKey = nextKey;\r\n\t\t\t\t\tnextKey = this.getNextKeyWith( type, h, nextKey.index + 1 );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tanimationCache.prevKey[ type ] = prevKey;\r\n\t\t\t\tanimationCache.nextKey[ type ] = nextKey;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t},\r\n\r\n\tresetBlendWeights: function () {\r\n\r\n\t\tfor ( var h = 0, hl = this.hierarchy.length; h < hl; h ++ ) {\r\n\r\n\t\t\tvar object = this.hierarchy[ h ];\r\n\t\t\tvar animationCache = object.animationCache;\r\n\r\n\t\t\tif ( animationCache !== undefined ) {\r\n\r\n\t\t\t\tvar blending = animationCache.blending;\r\n\r\n\t\t\t\tblending.positionWeight = 0.0;\r\n\t\t\t\tblending.quaternionWeight = 0.0;\r\n\t\t\t\tblending.scaleWeight = 0.0;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t},\r\n\r\n\tupdate: ( function() {\r\n\r\n\t\tvar points = [];\r\n\t\tvar target = new THREE.Vector3();\r\n\t\tvar newVector = new THREE.Vector3();\r\n\t\tvar newQuat = new THREE.Quaternion();\r\n\r\n\t\t// Catmull-Rom spline\r\n\r\n\t\tvar interpolateCatmullRom = function ( points, scale ) {\r\n\r\n\t\t\tvar c = [], v3 = [],\r\n\t\t\tpoint, intPoint, weight, w2, w3,\r\n\t\t\tpa, pb, pc, pd;\r\n\r\n\t\t\tpoint = ( points.length - 1 ) * scale;\r\n\t\t\tintPoint = Math.floor( point );\r\n\t\t\tweight = point - intPoint;\r\n\r\n\t\t\tc[ 0 ] = intPoint === 0 ? intPoint : intPoint - 1;\r\n\t\t\tc[ 1 ] = intPoint;\r\n\t\t\tc[ 2 ] = intPoint > points.length - 2 ? intPoint : intPoint + 1;\r\n\t\t\tc[ 3 ] = intPoint > points.length - 3 ? intPoint : intPoint + 2;\r\n\r\n\t\t\tpa = points[ c[ 0 ] ];\r\n\t\t\tpb = points[ c[ 1 ] ];\r\n\t\t\tpc = points[ c[ 2 ] ];\r\n\t\t\tpd = points[ c[ 3 ] ];\r\n\r\n\t\t\tw2 = weight * weight;\r\n\t\t\tw3 = weight * w2;\r\n\r\n\t\t\tv3[ 0 ] = interpolate( pa[ 0 ], pb[ 0 ], pc[ 0 ], pd[ 0 ], weight, w2, w3 );\r\n\t\t\tv3[ 1 ] = interpolate( pa[ 1 ], pb[ 1 ], pc[ 1 ], pd[ 1 ], weight, w2, w3 );\r\n\t\t\tv3[ 2 ] = interpolate( pa[ 2 ], pb[ 2 ], pc[ 2 ], pd[ 2 ], weight, w2, w3 );\r\n\r\n\t\t\treturn v3;\r\n\r\n\t\t};\r\n\r\n\t\tvar interpolate = function ( p0, p1, p2, p3, t, t2, t3 ) {\r\n\r\n\t\t\tvar v0 = ( p2 - p0 ) * 0.5,\r\n\t\t\t\tv1 = ( p3 - p1 ) * 0.5;\r\n\r\n\t\t\treturn ( 2 * ( p1 - p2 ) + v0 + v1 ) * t3 + ( - 3 * ( p1 - p2 ) - 2 * v0 - v1 ) * t2 + v0 * t + p1;\r\n\r\n\t\t};\r\n\r\n\t\treturn function ( delta ) {\r\n\r\n\t\t\tif ( this.isPlaying === false ) return;\r\n\r\n\t\t\tthis.currentTime += delta * this.timeScale;\r\n\r\n\t\t\tif ( this.weight === 0 )\r\n\t\t\t\treturn;\r\n\r\n\t\t\t//\r\n\r\n\t\t\tvar duration = this.data.length;\r\n\r\n\t\t\tif ( this.currentTime > duration || this.currentTime < 0 ) {\r\n\r\n\t\t\t\tif ( this.loop ) {\r\n\r\n\t\t\t\t\tthis.currentTime %= duration;\r\n\r\n\t\t\t\t\tif ( this.currentTime < 0 )\r\n\t\t\t\t\t\tthis.currentTime += duration;\r\n\r\n\t\t\t\t\tthis.reset();\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\tthis.stop();\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\tfor ( var h = 0, hl = this.hierarchy.length; h < hl; h ++ ) {\r\n\r\n\t\t\t\tvar object = this.hierarchy[ h ];\r\n\t\t\t\tvar animationCache = object.animationCache.animations[ this.data.name ];\r\n\t\t\t\tvar blending = object.animationCache.blending;\r\n\r\n\t\t\t\t// loop through pos/rot/scl\r\n\r\n\t\t\t\tfor ( var t = 0; t < 3; t ++ ) {\r\n\r\n\t\t\t\t\t// get keys\r\n\r\n\t\t\t\t\tvar type = this.keyTypes[ t ];\r\n\t\t\t\t\tvar prevKey = animationCache.prevKey[ type ];\r\n\t\t\t\t\tvar nextKey = animationCache.nextKey[ type ];\r\n\r\n\t\t\t\t\tif ( ( this.timeScale > 0 && nextKey.time <= this.currentTime ) ||\r\n\t\t\t\t\t\t( this.timeScale < 0 && prevKey.time >= this.currentTime ) ) {\r\n\r\n\t\t\t\t\t\tprevKey = this.data.hierarchy[ h ].keys[ 0 ];\r\n\t\t\t\t\t\tnextKey = this.getNextKeyWith( type, h, 1 );\r\n\r\n\t\t\t\t\t\twhile ( nextKey.time < this.currentTime && nextKey.index > prevKey.index ) {\r\n\r\n\t\t\t\t\t\t\tprevKey = nextKey;\r\n\t\t\t\t\t\t\tnextKey = this.getNextKeyWith( type, h, nextKey.index + 1 );\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\tanimationCache.prevKey[ type ] = prevKey;\r\n\t\t\t\t\t\tanimationCache.nextKey[ type ] = nextKey;\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tvar scale = ( this.currentTime - prevKey.time ) / ( nextKey.time - prevKey.time );\r\n\r\n\t\t\t\t\tvar prevXYZ = prevKey[ type ];\r\n\t\t\t\t\tvar nextXYZ = nextKey[ type ];\r\n\r\n\t\t\t\t\tif ( scale < 0 ) scale = 0;\r\n\t\t\t\t\tif ( scale > 1 ) scale = 1;\r\n\r\n\t\t\t\t\t// interpolate\r\n\r\n\t\t\t\t\tif ( type === \"pos\" ) {\r\n\r\n\t\t\t\t\t\tif ( this.interpolationType === THREE.AnimationHandler.LINEAR ) {\r\n\r\n\t\t\t\t\t\t\tnewVector.x = prevXYZ[ 0 ] + ( nextXYZ[ 0 ] - prevXYZ[ 0 ] ) * scale;\r\n\t\t\t\t\t\t\tnewVector.y = prevXYZ[ 1 ] + ( nextXYZ[ 1 ] - prevXYZ[ 1 ] ) * scale;\r\n\t\t\t\t\t\t\tnewVector.z = prevXYZ[ 2 ] + ( nextXYZ[ 2 ] - prevXYZ[ 2 ] ) * scale;\r\n\r\n\t\t\t\t\t\t\t// blend\r\n\t\t\t\t\t\t\tvar proportionalWeight = this.weight / ( this.weight + blending.positionWeight );\r\n\t\t\t\t\t\t\tobject.position.lerp( newVector, proportionalWeight );\r\n\t\t\t\t\t\t\tblending.positionWeight += this.weight;\r\n\r\n\t\t\t\t\t\t} else if ( this.interpolationType === THREE.AnimationHandler.CATMULLROM ||\r\n\t\t\t\t\t\t\t\t\tthis.interpolationType === THREE.AnimationHandler.CATMULLROM_FORWARD ) {\r\n\r\n\t\t\t\t\t\t\tpoints[ 0 ] = this.getPrevKeyWith( \"pos\", h, prevKey.index - 1 )[ \"pos\" ];\r\n\t\t\t\t\t\t\tpoints[ 1 ] = prevXYZ;\r\n\t\t\t\t\t\t\tpoints[ 2 ] = nextXYZ;\r\n\t\t\t\t\t\t\tpoints[ 3 ] = this.getNextKeyWith( \"pos\", h, nextKey.index + 1 )[ \"pos\" ];\r\n\r\n\t\t\t\t\t\t\tscale = scale * 0.33 + 0.33;\r\n\r\n\t\t\t\t\t\t\tvar currentPoint = interpolateCatmullRom( points, scale );\r\n\t\t\t\t\t\t\tvar proportionalWeight = this.weight / ( this.weight + blending.positionWeight );\r\n\t\t\t\t\t\t\tblending.positionWeight += this.weight;\r\n\r\n\t\t\t\t\t\t\t// blend\r\n\r\n\t\t\t\t\t\t\tvar vector = object.position;\r\n\r\n\t\t\t\t\t\t\tvector.x = vector.x + ( currentPoint[ 0 ] - vector.x ) * proportionalWeight;\r\n\t\t\t\t\t\t\tvector.y = vector.y + ( currentPoint[ 1 ] - vector.y ) * proportionalWeight;\r\n\t\t\t\t\t\t\tvector.z = vector.z + ( currentPoint[ 2 ] - vector.z ) * proportionalWeight;\r\n\r\n\t\t\t\t\t\t\tif ( this.interpolationType === THREE.AnimationHandler.CATMULLROM_FORWARD ) {\r\n\r\n\t\t\t\t\t\t\t\tvar forwardPoint = interpolateCatmullRom( points, scale * 1.01 );\r\n\r\n\t\t\t\t\t\t\t\ttarget.set( forwardPoint[ 0 ], forwardPoint[ 1 ], forwardPoint[ 2 ] );\r\n\t\t\t\t\t\t\t\ttarget.sub( vector );\r\n\t\t\t\t\t\t\t\ttarget.y = 0;\r\n\t\t\t\t\t\t\t\ttarget.normalize();\r\n\r\n\t\t\t\t\t\t\t\tvar angle = Math.atan2( target.x, target.z );\r\n\t\t\t\t\t\t\t\tobject.rotation.set( 0, angle, 0 );\r\n\r\n\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t} else if ( type === \"rot\" ) {\r\n\r\n\t\t\t\t\t\tTHREE.Quaternion.slerp( prevXYZ, nextXYZ, newQuat, scale );\r\n\r\n\t\t\t\t\t\t// Avoid paying the cost of an additional slerp if we don't have to\r\n\t\t\t\t\t\tif ( blending.quaternionWeight === 0 ) {\r\n\r\n\t\t\t\t\t\t\tobject.quaternion.copy( newQuat );\r\n\t\t\t\t\t\t\tblending.quaternionWeight = this.weight;\r\n\r\n\t\t\t\t\t\t} else {\r\n\r\n\t\t\t\t\t\t\tvar proportionalWeight = this.weight / ( this.weight + blending.quaternionWeight );\r\n\t\t\t\t\t\t\tTHREE.Quaternion.slerp( object.quaternion, newQuat, object.quaternion, proportionalWeight );\r\n\t\t\t\t\t\t\tblending.quaternionWeight += this.weight;\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t} else if ( type === \"scl\" ) {\r\n\r\n\t\t\t\t\t\tnewVector.x = prevXYZ[ 0 ] + ( nextXYZ[ 0 ] - prevXYZ[ 0 ] ) * scale;\r\n\t\t\t\t\t\tnewVector.y = prevXYZ[ 1 ] + ( nextXYZ[ 1 ] - prevXYZ[ 1 ] ) * scale;\r\n\t\t\t\t\t\tnewVector.z = prevXYZ[ 2 ] + ( nextXYZ[ 2 ] - prevXYZ[ 2 ] ) * scale;\r\n\r\n\t\t\t\t\t\tvar proportionalWeight = this.weight / ( this.weight + blending.scaleWeight );\r\n\t\t\t\t\t\tobject.scale.lerp( newVector, proportionalWeight );\r\n\t\t\t\t\t\tblending.scaleWeight += this.weight;\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\treturn true;\r\n\r\n\t\t};\r\n\r\n\t} )(),\r\n\r\n\tgetNextKeyWith: function ( type, h, key ) {\r\n\r\n\t\tvar keys = this.data.hierarchy[ h ].keys;\r\n\r\n\t\tif ( this.interpolationType === THREE.AnimationHandler.CATMULLROM ||\r\n\t\t\t this.interpolationType === THREE.AnimationHandler.CATMULLROM_FORWARD ) {\r\n\r\n\t\t\tkey = key < keys.length - 1 ? key : keys.length - 1;\r\n\r\n\t\t} else {\r\n\r\n\t\t\tkey = key % keys.length;\r\n\r\n\t\t}\r\n\r\n\t\tfor ( ; key < keys.length; key ++ ) {\r\n\r\n\t\t\tif ( keys[ key ][ type ] !== undefined ) {\r\n\r\n\t\t\t\treturn keys[ key ];\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn this.data.hierarchy[ h ].keys[ 0 ];\r\n\r\n\t},\r\n\r\n\tgetPrevKeyWith: function ( type, h, key ) {\r\n\r\n\t\tvar keys = this.data.hierarchy[ h ].keys;\r\n\r\n\t\tif ( this.interpolationType === THREE.AnimationHandler.CATMULLROM ||\r\n\t\t\tthis.interpolationType === THREE.AnimationHandler.CATMULLROM_FORWARD ) {\r\n\r\n\t\t\tkey = key > 0 ? key : 0;\r\n\r\n\t\t} else {\r\n\r\n\t\t\tkey = key >= 0 ? key : key + keys.length;\r\n\r\n\t\t}\r\n\r\n\r\n\t\tfor ( ; key >= 0; key -- ) {\r\n\r\n\t\t\tif ( keys[ key ][ type ] !== undefined ) {\r\n\r\n\t\t\t\treturn keys[ key ];\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn this.data.hierarchy[ h ].keys[ keys.length - 1 ];\r\n\r\n\t}\r\n\r\n};\r\n\r\n// File:src/extras/animation/KeyFrameAnimation.js\r\n\r\n/**\r\n * @author mikael emtinger / http://gomo.se/\r\n * @author mrdoob / http://mrdoob.com/\r\n * @author alteredq / http://alteredqualia.com/\r\n * @author khang duong\r\n * @author erik kitson\r\n */\r\n\r\nTHREE.KeyFrameAnimation = function ( data ) {\r\n\r\n\tthis.root = data.node;\r\n\tthis.data = THREE.AnimationHandler.init( data );\r\n\tthis.hierarchy = THREE.AnimationHandler.parse( this.root );\r\n\tthis.currentTime = 0;\r\n\tthis.timeScale = 0.001;\r\n\tthis.isPlaying = false;\r\n\tthis.isPaused = true;\r\n\tthis.loop = true;\r\n\r\n\t// initialize to first keyframes\r\n\r\n\tfor ( var h = 0, hl = this.hierarchy.length; h < hl; h ++ ) {\r\n\r\n\t\tvar keys = this.data.hierarchy[ h ].keys,\r\n\t\t\tsids = this.data.hierarchy[ h ].sids,\r\n\t\t\tobj = this.hierarchy[ h ];\r\n\r\n\t\tif ( keys.length && sids ) {\r\n\r\n\t\t\tfor ( var s = 0; s < sids.length; s ++ ) {\r\n\r\n\t\t\t\tvar sid = sids[ s ],\r\n\t\t\t\t\tnext = this.getNextKeyWith( sid, h, 0 );\r\n\r\n\t\t\t\tif ( next ) {\r\n\r\n\t\t\t\t\tnext.apply( sid );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\tobj.matrixAutoUpdate = false;\r\n\t\t\tthis.data.hierarchy[ h ].node.updateMatrix();\r\n\t\t\tobj.matrixWorldNeedsUpdate = true;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n};\r\n\r\nTHREE.KeyFrameAnimation.prototype = {\r\n\r\n\tconstructor: THREE.KeyFrameAnimation,\r\n\r\n\tplay: function ( startTime ) {\r\n\r\n\t\tthis.currentTime = startTime !== undefined ? startTime : 0;\r\n\r\n\t\tif ( this.isPlaying === false ) {\r\n\r\n\t\t\tthis.isPlaying = true;\r\n\r\n\t\t\t// reset key cache\r\n\r\n\t\t\tvar h, hl = this.hierarchy.length,\r\n\t\t\t\tobject,\r\n\t\t\t\tnode;\r\n\r\n\t\t\tfor ( h = 0; h < hl; h ++ ) {\r\n\r\n\t\t\t\tobject = this.hierarchy[ h ];\r\n\t\t\t\tnode = this.data.hierarchy[ h ];\r\n\r\n\t\t\t\tif ( node.animationCache === undefined ) {\r\n\r\n\t\t\t\t\tnode.animationCache = {};\r\n\t\t\t\t\tnode.animationCache.prevKey = null;\r\n\t\t\t\t\tnode.animationCache.nextKey = null;\r\n\t\t\t\t\tnode.animationCache.originalMatrix = object.matrix;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tvar keys = this.data.hierarchy[ h ].keys;\r\n\r\n\t\t\t\tif ( keys.length ) {\r\n\r\n\t\t\t\t\tnode.animationCache.prevKey = keys[ 0 ];\r\n\t\t\t\t\tnode.animationCache.nextKey = keys[ 1 ];\r\n\r\n\t\t\t\t\tthis.startTime = Math.min( keys[ 0 ].time, this.startTime );\r\n\t\t\t\t\tthis.endTime = Math.max( keys[ keys.length - 1 ].time, this.endTime );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\tthis.update( 0 );\r\n\r\n\t\t}\r\n\r\n\t\tthis.isPaused = false;\r\n\r\n\t\tTHREE.AnimationHandler.play( this );\r\n\r\n\t},\r\n\r\n\tstop: function () {\r\n\r\n\t\tthis.isPlaying = false;\r\n\t\tthis.isPaused = false;\r\n\r\n\t\tTHREE.AnimationHandler.stop( this );\r\n\r\n\t\t// reset JIT matrix and remove cache\r\n\r\n\t\tfor ( var h = 0; h < this.data.hierarchy.length; h ++ ) {\r\n\r\n\t\t\tvar obj = this.hierarchy[ h ];\r\n\t\t\tvar node = this.data.hierarchy[ h ];\r\n\r\n\t\t\tif ( node.animationCache !== undefined ) {\r\n\r\n\t\t\t\tvar original = node.animationCache.originalMatrix;\r\n\r\n\t\t\t\toriginal.copy( obj.matrix );\r\n\t\t\t\tobj.matrix = original;\r\n\r\n\t\t\t\tdelete node.animationCache;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t},\r\n\r\n\tupdate: function ( delta ) {\r\n\r\n\t\tif ( this.isPlaying === false ) return;\r\n\r\n\t\tthis.currentTime += delta * this.timeScale;\r\n\r\n\t\t//\r\n\r\n\t\tvar duration = this.data.length;\r\n\r\n\t\tif ( this.loop === true && this.currentTime > duration ) {\r\n\r\n\t\t\tthis.currentTime %= duration;\r\n\r\n\t\t}\r\n\r\n\t\tthis.currentTime = Math.min( this.currentTime, duration );\r\n\r\n\t\tfor ( var h = 0, hl = this.hierarchy.length; h < hl; h ++ ) {\r\n\r\n\t\t\tvar object = this.hierarchy[ h ];\r\n\t\t\tvar node = this.data.hierarchy[ h ];\r\n\r\n\t\t\tvar keys = node.keys,\r\n\t\t\t\tanimationCache = node.animationCache;\r\n\r\n\r\n\t\t\tif ( keys.length ) {\r\n\r\n\t\t\t\tvar prevKey = animationCache.prevKey;\r\n\t\t\t\tvar nextKey = animationCache.nextKey;\r\n\r\n\t\t\t\tif ( nextKey.time <= this.currentTime ) {\r\n\r\n\t\t\t\t\twhile ( nextKey.time < this.currentTime && nextKey.index > prevKey.index ) {\r\n\r\n\t\t\t\t\t\tprevKey = nextKey;\r\n\t\t\t\t\t\tnextKey = keys[ prevKey.index + 1 ];\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tanimationCache.prevKey = prevKey;\r\n\t\t\t\t\tanimationCache.nextKey = nextKey;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif ( nextKey.time >= this.currentTime ) {\r\n\r\n\t\t\t\t\tprevKey.interpolate( nextKey, this.currentTime );\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\tprevKey.interpolate( nextKey, nextKey.time );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tthis.data.hierarchy[ h ].node.updateMatrix();\r\n\t\t\t\tobject.matrixWorldNeedsUpdate = true;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t},\r\n\r\n\tgetNextKeyWith: function ( sid, h, key ) {\r\n\r\n\t\tvar keys = this.data.hierarchy[ h ].keys;\r\n\t\tkey = key % keys.length;\r\n\r\n\t\tfor ( ; key < keys.length; key ++ ) {\r\n\r\n\t\t\tif ( keys[ key ].hasTarget( sid ) ) {\r\n\r\n\t\t\t\treturn keys[ key ];\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn keys[ 0 ];\r\n\r\n\t},\r\n\r\n\tgetPrevKeyWith: function ( sid, h, key ) {\r\n\r\n\t\tvar keys = this.data.hierarchy[ h ].keys;\r\n\t\tkey = key >= 0 ? key : key + keys.length;\r\n\r\n\t\tfor ( ; key >= 0; key -- ) {\r\n\r\n\t\t\tif ( keys[ key ].hasTarget( sid ) ) {\r\n\r\n\t\t\t\treturn keys[ key ];\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn keys[ keys.length - 1 ];\r\n\r\n\t}\r\n\r\n};\r\n\r\n// File:src/extras/animation/MorphAnimation.js\r\n\r\n/**\r\n * @author mrdoob / http://mrdoob.com\r\n * @author willy-vvu / http://willy-vvu.github.io\r\n */\r\n\r\nTHREE.MorphAnimation = function ( mesh ) {\r\n\r\n\tthis.mesh = mesh;\r\n\tthis.frames = mesh.morphTargetInfluences.length;\r\n\tthis.currentTime = 0;\r\n\tthis.duration = 1000;\r\n\tthis.loop = true;\r\n\tthis.lastFrame = 0;\r\n\tthis.currentFrame = 0;\r\n\r\n\tthis.isPlaying = false;\r\n\r\n};\r\n\r\nTHREE.MorphAnimation.prototype = {\r\n\r\n\tconstructor: THREE.MorphAnimation,\r\n\r\n\tplay: function () {\r\n\r\n\t\tthis.isPlaying = true;\r\n\r\n\t},\r\n\r\n\tpause: function () {\r\n\r\n\t\tthis.isPlaying = false;\r\n\r\n\t},\r\n\r\n\tupdate: function ( delta ) {\r\n\r\n\t\tif ( this.isPlaying === false ) return;\r\n\r\n\t\tthis.currentTime += delta;\r\n\r\n\t\tif ( this.loop === true && this.currentTime > this.duration ) {\r\n\r\n\t\t\tthis.currentTime %= this.duration;\r\n\r\n\t\t}\r\n\r\n\t\tthis.currentTime = Math.min( this.currentTime, this.duration );\r\n\r\n\t\tvar frameTime = this.duration / this.frames;\r\n\t\tvar frame = Math.floor( this.currentTime / frameTime );\r\n\r\n\t\tvar influences = this.mesh.morphTargetInfluences;\r\n\r\n\t\tif ( frame !== this.currentFrame ) {\r\n\r\n\t\t\tinfluences[ this.lastFrame ] = 0;\r\n\t\t\tinfluences[ this.currentFrame ] = 1;\r\n\t\t\tinfluences[ frame ] = 0;\r\n\r\n\t\t\tthis.lastFrame = this.currentFrame;\r\n\t\t\tthis.currentFrame = frame;\r\n\r\n\t\t}\r\n\r\n\t\tvar mix = ( this.currentTime % frameTime ) / frameTime;\r\n\r\n\t\tinfluences[ frame ] = mix;\r\n\t\tinfluences[ this.lastFrame ] = 1 - mix;\r\n\r\n\t}\r\n\r\n};\r\n\r\n// File:src/extras/geometries/BoxGeometry.js\r\n\r\n/**\r\n * @author mrdoob / http://mrdoob.com/\r\n * based on http://papervision3d.googlecode.com/svn/trunk/as3/trunk/src/org/papervision3d/objects/primitives/Cube.as\r\n */\r\n\r\nTHREE.BoxGeometry = function ( width, height, depth, widthSegments, heightSegments, depthSegments ) {\r\n\r\n\tTHREE.Geometry.call( this );\r\n\r\n\tthis.type = 'BoxGeometry';\r\n\r\n\tthis.parameters = {\r\n\t\twidth: width,\r\n\t\theight: height,\r\n\t\tdepth: depth,\r\n\t\twidthSegments: widthSegments,\r\n\t\theightSegments: heightSegments,\r\n\t\tdepthSegments: depthSegments\r\n\t};\r\n\r\n\tthis.widthSegments = widthSegments || 1;\r\n\tthis.heightSegments = heightSegments || 1;\r\n\tthis.depthSegments = depthSegments || 1;\r\n\r\n\tvar scope = this;\r\n\r\n\tvar width_half = width / 2;\r\n\tvar height_half = height / 2;\r\n\tvar depth_half = depth / 2;\r\n\r\n\tbuildPlane( 'z', 'y', - 1, - 1, depth, height, width_half, 0 ); // px\r\n\tbuildPlane( 'z', 'y', 1, - 1, depth, height, - width_half, 1 ); // nx\r\n\tbuildPlane( 'x', 'z', 1, 1, width, depth, height_half, 2 ); // py\r\n\tbuildPlane( 'x', 'z', 1, - 1, width, depth, - height_half, 3 ); // ny\r\n\tbuildPlane( 'x', 'y', 1, - 1, width, height, depth_half, 4 ); // pz\r\n\tbuildPlane( 'x', 'y', - 1, - 1, width, height, - depth_half, 5 ); // nz\r\n\r\n\tfunction buildPlane( u, v, udir, vdir, width, height, depth, materialIndex ) {\r\n\r\n\t\tvar w, ix, iy,\r\n\t\tgridX = scope.widthSegments,\r\n\t\tgridY = scope.heightSegments,\r\n\t\twidth_half = width / 2,\r\n\t\theight_half = height / 2,\r\n\t\toffset = scope.vertices.length;\r\n\r\n\t\tif ( ( u === 'x' && v === 'y' ) || ( u === 'y' && v === 'x' ) ) {\r\n\r\n\t\t\tw = 'z';\r\n\r\n\t\t} else if ( ( u === 'x' && v === 'z' ) || ( u === 'z' && v === 'x' ) ) {\r\n\r\n\t\t\tw = 'y';\r\n\t\t\tgridY = scope.depthSegments;\r\n\r\n\t\t} else if ( ( u === 'z' && v === 'y' ) || ( u === 'y' && v === 'z' ) ) {\r\n\r\n\t\t\tw = 'x';\r\n\t\t\tgridX = scope.depthSegments;\r\n\r\n\t\t}\r\n\r\n\t\tvar gridX1 = gridX + 1,\r\n\t\tgridY1 = gridY + 1,\r\n\t\tsegment_width = width / gridX,\r\n\t\tsegment_height = height / gridY,\r\n\t\tnormal = new THREE.Vector3();\r\n\r\n\t\tnormal[ w ] = depth > 0 ? 1 : - 1;\r\n\r\n\t\tfor ( iy = 0; iy < gridY1; iy ++ ) {\r\n\r\n\t\t\tfor ( ix = 0; ix < gridX1; ix ++ ) {\r\n\r\n\t\t\t\tvar vector = new THREE.Vector3();\r\n\t\t\t\tvector[ u ] = ( ix * segment_width - width_half ) * udir;\r\n\t\t\t\tvector[ v ] = ( iy * segment_height - height_half ) * vdir;\r\n\t\t\t\tvector[ w ] = depth;\r\n\r\n\t\t\t\tscope.vertices.push( vector );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tfor ( iy = 0; iy < gridY; iy ++ ) {\r\n\r\n\t\t\tfor ( ix = 0; ix < gridX; ix ++ ) {\r\n\r\n\t\t\t\tvar a = ix + gridX1 * iy;\r\n\t\t\t\tvar b = ix + gridX1 * ( iy + 1 );\r\n\t\t\t\tvar c = ( ix + 1 ) + gridX1 * ( iy + 1 );\r\n\t\t\t\tvar d = ( ix + 1 ) + gridX1 * iy;\r\n\r\n\t\t\t\tvar uva = new THREE.Vector2( ix / gridX, 1 - iy / gridY );\r\n\t\t\t\tvar uvb = new THREE.Vector2( ix / gridX, 1 - ( iy + 1 ) / gridY );\r\n\t\t\t\tvar uvc = new THREE.Vector2( ( ix + 1 ) / gridX, 1 - ( iy + 1 ) / gridY );\r\n\t\t\t\tvar uvd = new THREE.Vector2( ( ix + 1 ) / gridX, 1 - iy / gridY );\r\n\r\n\t\t\t\tvar face = new THREE.Face3( a + offset, b + offset, d + offset );\r\n\t\t\t\tface.normal.copy( normal );\r\n\t\t\t\tface.vertexNormals.push( normal.clone(), normal.clone(), normal.clone() );\r\n\t\t\t\tface.materialIndex = materialIndex;\r\n\r\n\t\t\t\tscope.faces.push( face );\r\n\t\t\t\tscope.faceVertexUvs[ 0 ].push( [ uva, uvb, uvd ] );\r\n\r\n\t\t\t\tface = new THREE.Face3( b + offset, c + offset, d + offset );\r\n\t\t\t\tface.normal.copy( normal );\r\n\t\t\t\tface.vertexNormals.push( normal.clone(), normal.clone(), normal.clone() );\r\n\t\t\t\tface.materialIndex = materialIndex;\r\n\r\n\t\t\t\tscope.faces.push( face );\r\n\t\t\t\tscope.faceVertexUvs[ 0 ].push( [ uvb.clone(), uvc, uvd.clone() ] );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tthis.mergeVertices();\r\n\r\n};\r\n\r\nTHREE.BoxGeometry.prototype = Object.create( THREE.Geometry.prototype );\r\nTHREE.BoxGeometry.prototype.constructor = THREE.BoxGeometry;\r\n\r\nTHREE.BoxGeometry.prototype.clone = function () {\r\n\r\n\tvar geometry = new THREE.BoxGeometry(\r\n\t\tthis.parameters.width,\r\n\t\tthis.parameters.height,\r\n\t\tthis.parameters.depth,\r\n\t\tthis.parameters.widthSegments,\r\n\t\tthis.parameters.heightSegments,\r\n\t\tthis.parameters.depthSegments\r\n\t);\r\n\r\n\treturn geometry;\r\n\r\n};\r\n\r\nTHREE.CubeGeometry = THREE.BoxGeometry; // backwards compatibility\r\n\r\n// File:src/extras/geometries/CircleGeometry.js\r\n\r\n/**\r\n * @author hughes\r\n */\r\n\r\nTHREE.CircleGeometry = function ( radius, segments, thetaStart, thetaLength ) {\r\n\r\n\tTHREE.Geometry.call( this );\r\n\r\n\tthis.type = 'CircleGeometry';\r\n\r\n\tthis.parameters = {\r\n\t\tradius: radius,\r\n\t\tsegments: segments,\r\n\t\tthetaStart: thetaStart,\r\n\t\tthetaLength: thetaLength\r\n\t};\r\n\r\n\tradius = radius || 50;\r\n\tsegments = segments !== undefined ? Math.max( 3, segments ) : 8;\r\n\r\n\tthetaStart = thetaStart !== undefined ? thetaStart : 0;\r\n\tthetaLength = thetaLength !== undefined ? thetaLength : Math.PI * 2;\r\n\r\n\tvar i, uvs = [],\r\n\tcenter = new THREE.Vector3(), centerUV = new THREE.Vector2( 0.5, 0.5 );\r\n\r\n\tthis.vertices.push( center );\r\n\tuvs.push( centerUV );\r\n\r\n\tfor ( i = 0; i <= segments; i ++ ) {\r\n\r\n\t\tvar vertex = new THREE.Vector3();\r\n\t\tvar segment = thetaStart + i / segments * thetaLength;\r\n\r\n\t\tvertex.x = radius * Math.cos( segment );\r\n\t\tvertex.y = radius * Math.sin( segment );\r\n\r\n\t\tthis.vertices.push( vertex );\r\n\t\tuvs.push( new THREE.Vector2( ( vertex.x / radius + 1 ) / 2, ( vertex.y / radius + 1 ) / 2 ) );\r\n\r\n\t}\r\n\r\n\tvar n = new THREE.Vector3( 0, 0, 1 );\r\n\r\n\tfor ( i = 1; i <= segments; i ++ ) {\r\n\r\n\t\tthis.faces.push( new THREE.Face3( i, i + 1, 0, [ n.clone(), n.clone(), n.clone() ] ) );\r\n\t\tthis.faceVertexUvs[ 0 ].push( [ uvs[ i ].clone(), uvs[ i + 1 ].clone(), centerUV.clone() ] );\r\n\r\n\t}\r\n\r\n\tthis.computeFaceNormals();\r\n\r\n\tthis.boundingSphere = new THREE.Sphere( new THREE.Vector3(), radius );\r\n\r\n};\r\n\r\nTHREE.CircleGeometry.prototype = Object.create( THREE.Geometry.prototype );\r\nTHREE.CircleGeometry.prototype.constructor = THREE.CircleGeometry;\r\n\r\nTHREE.CircleGeometry.prototype.clone = function () {\r\n\r\n\tvar geometry = new THREE.CircleGeometry(\r\n\t\tthis.parameters.radius,\r\n\t\tthis.parameters.segments,\r\n\t\tthis.parameters.thetaStart,\r\n\t\tthis.parameters.thetaLength\r\n\t);\r\n\r\n\treturn geometry;\r\n\r\n};\r\n\r\n// File:src/extras/geometries/CircleBufferGeometry.js\r\n\r\n/**\r\n * @author benaadams / https://twitter.com/ben_a_adams\r\n */\r\n\r\nTHREE.CircleBufferGeometry = function ( radius, segments, thetaStart, thetaLength ) {\r\n\r\n\tTHREE.BufferGeometry.call( this );\r\n\r\n\tthis.type = 'CircleBufferGeometry';\r\n\r\n\tthis.parameters = {\r\n\t\tradius: radius,\r\n\t\tsegments: segments,\r\n\t\tthetaStart: thetaStart,\r\n\t\tthetaLength: thetaLength\r\n\t};\r\n\r\n\tradius = radius || 50;\r\n\tsegments = segments !== undefined ? Math.max( 3, segments ) : 8;\r\n\r\n\tthetaStart = thetaStart !== undefined ? thetaStart : 0;\r\n\tthetaLength = thetaLength !== undefined ? thetaLength : Math.PI * 2;\r\n\r\n\tvar vertices = segments + 2;\r\n\r\n\tvar positions = new Float32Array( vertices * 3 );\r\n\tvar normals = new Float32Array( vertices * 3 );\r\n\tvar uvs = new Float32Array( vertices * 2 );\r\n\r\n\t// center data is already zero, but need to set a few extras\r\n\tnormals[ 3 ] = 1.0;\r\n\tuvs[ 0 ] = 0.5;\r\n\tuvs[ 1 ] = 0.5;\r\n\r\n\tfor ( var s = 0, i = 3, ii = 2 ; s <= segments; s ++, i += 3, ii += 2 ) {\r\n\r\n\t\tvar segment = thetaStart + s / segments * thetaLength;\r\n\r\n\t\tpositions[ i ] = radius * Math.cos( segment );\r\n\t\tpositions[ i + 1 ] = radius * Math.sin( segment );\r\n\r\n\t\tnormals[ i + 2 ] = 1; // normal z\r\n\r\n\t\tuvs[ ii ] = ( positions[ i ] / radius + 1 ) / 2;\r\n\t\tuvs[ ii + 1 ] = ( positions[ i + 1 ] / radius + 1 ) / 2;\r\n\r\n\t}\r\n\r\n\tvar indices = [];\r\n\r\n\tfor ( var i = 1; i <= segments; i ++ ) {\r\n\r\n\t\tindices.push( i );\r\n\t\tindices.push( i + 1 );\r\n\t\tindices.push( 0 );\r\n\r\n\t}\r\n\r\n\tthis.addIndex( new THREE.BufferAttribute( new Uint16Array( indices ), 1 ) );\r\n\tthis.addAttribute( 'position', new THREE.BufferAttribute( positions, 3 ) );\r\n\tthis.addAttribute( 'normal', new THREE.BufferAttribute( normals, 3 ) );\r\n\tthis.addAttribute( 'uv', new THREE.BufferAttribute( uvs, 2 ) );\r\n\r\n\tthis.boundingSphere = new THREE.Sphere( new THREE.Vector3(), radius );\r\n\r\n};\r\n\r\nTHREE.CircleBufferGeometry.prototype = Object.create( THREE.BufferGeometry.prototype );\r\nTHREE.CircleBufferGeometry.prototype.constructor = THREE.CircleBufferGeometry;\r\n\r\nTHREE.CircleBufferGeometry.prototype.clone = function () {\r\n\r\n\tvar geometry = new THREE.CircleBufferGeometry(\r\n\t\tthis.parameters.radius,\r\n\t\tthis.parameters.segments,\r\n\t\tthis.parameters.thetaStart,\r\n\t\tthis.parameters.thetaLength\r\n\t);\r\n\r\n\tgeometry.copy( this );\r\n\r\n\treturn geometry;\r\n\r\n};\r\n\r\n// File:src/extras/geometries/CylinderGeometry.js\r\n\r\n/**\r\n * @author mrdoob / http://mrdoob.com/\r\n */\r\n\r\nTHREE.CylinderGeometry = function ( radiusTop, radiusBottom, height, radialSegments, heightSegments, openEnded, thetaStart, thetaLength ) {\r\n\r\n\tTHREE.Geometry.call( this );\r\n\r\n\tthis.type = 'CylinderGeometry';\r\n\r\n\tthis.parameters = {\r\n\t\tradiusTop: radiusTop,\r\n\t\tradiusBottom: radiusBottom,\r\n\t\theight: height,\r\n\t\tradialSegments: radialSegments,\r\n\t\theightSegments: heightSegments,\r\n\t\topenEnded: openEnded,\r\n\t\tthetaStart: thetaStart,\r\n\t\tthetaLength: thetaLength\r\n\t};\r\n\r\n\tradiusTop = radiusTop !== undefined ? radiusTop : 20;\r\n\tradiusBottom = radiusBottom !== undefined ? radiusBottom : 20;\r\n\theight = height !== undefined ? height : 100;\r\n\r\n\tradialSegments = radialSegments || 8;\r\n\theightSegments = heightSegments || 1;\r\n\r\n\topenEnded = openEnded !== undefined ? openEnded : false;\r\n\tthetaStart = thetaStart !== undefined ? thetaStart : 0;\r\n\tthetaLength = thetaLength !== undefined ? thetaLength : 2 * Math.PI;\r\n\r\n\tvar heightHalf = height / 2;\r\n\r\n\tvar x, y, vertices = [], uvs = [];\r\n\r\n\tfor ( y = 0; y <= heightSegments; y ++ ) {\r\n\r\n\t\tvar verticesRow = [];\r\n\t\tvar uvsRow = [];\r\n\r\n\t\tvar v = y / heightSegments;\r\n\t\tvar radius = v * ( radiusBottom - radiusTop ) + radiusTop;\r\n\r\n\t\tfor ( x = 0; x <= radialSegments; x ++ ) {\r\n\r\n\t\t\tvar u = x / radialSegments;\r\n\r\n\t\t\tvar vertex = new THREE.Vector3();\r\n\t\t\tvertex.x = radius * Math.sin( u * thetaLength + thetaStart );\r\n\t\t\tvertex.y = - v * height + heightHalf;\r\n\t\t\tvertex.z = radius * Math.cos( u * thetaLength + thetaStart );\r\n\r\n\t\t\tthis.vertices.push( vertex );\r\n\r\n\t\t\tverticesRow.push( this.vertices.length - 1 );\r\n\t\t\tuvsRow.push( new THREE.Vector2( u, 1 - v ) );\r\n\r\n\t\t}\r\n\r\n\t\tvertices.push( verticesRow );\r\n\t\tuvs.push( uvsRow );\r\n\r\n\t}\r\n\r\n\tvar tanTheta = ( radiusBottom - radiusTop ) / height;\r\n\tvar na, nb;\r\n\r\n\tfor ( x = 0; x < radialSegments; x ++ ) {\r\n\r\n\t\tif ( radiusTop !== 0 ) {\r\n\r\n\t\t\tna = this.vertices[ vertices[ 0 ][ x ] ].clone();\r\n\t\t\tnb = this.vertices[ vertices[ 0 ][ x + 1 ] ].clone();\r\n\r\n\t\t} else {\r\n\r\n\t\t\tna = this.vertices[ vertices[ 1 ][ x ] ].clone();\r\n\t\t\tnb = this.vertices[ vertices[ 1 ][ x + 1 ] ].clone();\r\n\r\n\t\t}\r\n\r\n\t\tna.setY( Math.sqrt( na.x * na.x + na.z * na.z ) * tanTheta ).normalize();\r\n\t\tnb.setY( Math.sqrt( nb.x * nb.x + nb.z * nb.z ) * tanTheta ).normalize();\r\n\r\n\t\tfor ( y = 0; y < heightSegments; y ++ ) {\r\n\r\n\t\t\tvar v1 = vertices[ y ][ x ];\r\n\t\t\tvar v2 = vertices[ y + 1 ][ x ];\r\n\t\t\tvar v3 = vertices[ y + 1 ][ x + 1 ];\r\n\t\t\tvar v4 = vertices[ y ][ x + 1 ];\r\n\r\n\t\t\tvar n1 = na.clone();\r\n\t\t\tvar n2 = na.clone();\r\n\t\t\tvar n3 = nb.clone();\r\n\t\t\tvar n4 = nb.clone();\r\n\r\n\t\t\tvar uv1 = uvs[ y ][ x ].clone();\r\n\t\t\tvar uv2 = uvs[ y + 1 ][ x ].clone();\r\n\t\t\tvar uv3 = uvs[ y + 1 ][ x + 1 ].clone();\r\n\t\t\tvar uv4 = uvs[ y ][ x + 1 ].clone();\r\n\r\n\t\t\tthis.faces.push( new THREE.Face3( v1, v2, v4, [ n1, n2, n4 ] ) );\r\n\t\t\tthis.faceVertexUvs[ 0 ].push( [ uv1, uv2, uv4 ] );\r\n\r\n\t\t\tthis.faces.push( new THREE.Face3( v2, v3, v4, [ n2.clone(), n3, n4.clone() ] ) );\r\n\t\t\tthis.faceVertexUvs[ 0 ].push( [ uv2.clone(), uv3, uv4.clone() ] );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\t// top cap\r\n\r\n\tif ( openEnded === false && radiusTop > 0 ) {\r\n\r\n\t\tthis.vertices.push( new THREE.Vector3( 0, heightHalf, 0 ) );\r\n\r\n\t\tfor ( x = 0; x < radialSegments; x ++ ) {\r\n\r\n\t\t\tvar v1 = vertices[ 0 ][ x ];\r\n\t\t\tvar v2 = vertices[ 0 ][ x + 1 ];\r\n\t\t\tvar v3 = this.vertices.length - 1;\r\n\r\n\t\t\tvar n1 = new THREE.Vector3( 0, 1, 0 );\r\n\t\t\tvar n2 = new THREE.Vector3( 0, 1, 0 );\r\n\t\t\tvar n3 = new THREE.Vector3( 0, 1, 0 );\r\n\r\n\t\t\tvar uv1 = uvs[ 0 ][ x ].clone();\r\n\t\t\tvar uv2 = uvs[ 0 ][ x + 1 ].clone();\r\n\t\t\tvar uv3 = new THREE.Vector2( uv2.x, 0 );\r\n\r\n\t\t\tthis.faces.push( new THREE.Face3( v1, v2, v3, [ n1, n2, n3 ], undefined, 1 ) );\r\n\t\t\tthis.faceVertexUvs[ 0 ].push( [ uv1, uv2, uv3 ] );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\t// bottom cap\r\n\r\n\tif ( openEnded === false && radiusBottom > 0 ) {\r\n\r\n\t\tthis.vertices.push( new THREE.Vector3( 0, - heightHalf, 0 ) );\r\n\r\n\t\tfor ( x = 0; x < radialSegments; x ++ ) {\r\n\r\n\t\t\tvar v1 = vertices[ heightSegments ][ x + 1 ];\r\n\t\t\tvar v2 = vertices[ heightSegments ][ x ];\r\n\t\t\tvar v3 = this.vertices.length - 1;\r\n\r\n\t\t\tvar n1 = new THREE.Vector3( 0, - 1, 0 );\r\n\t\t\tvar n2 = new THREE.Vector3( 0, - 1, 0 );\r\n\t\t\tvar n3 = new THREE.Vector3( 0, - 1, 0 );\r\n\r\n\t\t\tvar uv1 = uvs[ heightSegments ][ x + 1 ].clone();\r\n\t\t\tvar uv2 = uvs[ heightSegments ][ x ].clone();\r\n\t\t\tvar uv3 = new THREE.Vector2( uv2.x, 1 );\r\n\r\n\t\t\tthis.faces.push( new THREE.Face3( v1, v2, v3, [ n1, n2, n3 ], undefined, 2 ) );\r\n\t\t\tthis.faceVertexUvs[ 0 ].push( [ uv1, uv2, uv3 ] );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tthis.computeFaceNormals();\r\n\r\n};\r\n\r\nTHREE.CylinderGeometry.prototype = Object.create( THREE.Geometry.prototype );\r\nTHREE.CylinderGeometry.prototype.constructor = THREE.CylinderGeometry;\r\n\r\nTHREE.CylinderGeometry.prototype.clone = function () {\r\n\r\n\tvar geometry = new THREE.CylinderGeometry(\r\n\t\tthis.parameters.radiusTop,\r\n\t\tthis.parameters.radiusBottom,\r\n\t\tthis.parameters.height,\r\n\t\tthis.parameters.radialSegments,\r\n\t\tthis.parameters.heightSegments,\r\n\t\tthis.parameters.openEnded,\r\n\t\tthis.parameters.thetaStart,\r\n\t\tthis.parameters.thetaLength\r\n\t);\r\n\r\n\treturn geometry;\r\n\r\n};\r\n\r\n// File:src/extras/geometries/EdgesGeometry.js\r\n\r\n/**\r\n * @author WestLangley / http://github.com/WestLangley\r\n */\r\n\r\nTHREE.EdgesGeometry = function ( geometry, thresholdAngle ) {\r\n\r\n\tTHREE.BufferGeometry.call( this );\r\n\r\n\tthresholdAngle = ( thresholdAngle !== undefined ) ? thresholdAngle : 1;\r\n\r\n\tvar thresholdDot = Math.cos( THREE.Math.degToRad( thresholdAngle ) );\r\n\r\n\tvar edge = [ 0, 0 ], hash = {};\r\n\tvar sortFunction = function ( a, b ) {\r\n\r\n\t\treturn a - b;\r\n\r\n\t};\r\n\r\n\tvar keys = [ 'a', 'b', 'c' ];\r\n\r\n\tvar geometry2;\r\n\r\n\tif ( geometry instanceof THREE.BufferGeometry ) {\r\n\r\n\t\tgeometry2 = new THREE.Geometry();\r\n\t\tgeometry2.fromBufferGeometry( geometry );\r\n\r\n\t} else {\r\n\r\n\t\tgeometry2 = geometry.clone();\r\n\r\n\t}\r\n\r\n\tgeometry2.mergeVertices();\r\n\tgeometry2.computeFaceNormals();\r\n\r\n\tvar vertices = geometry2.vertices;\r\n\tvar faces = geometry2.faces;\r\n\r\n\tfor ( var i = 0, l = faces.length; i < l; i ++ ) {\r\n\r\n\t\tvar face = faces[ i ];\r\n\r\n\t\tfor ( var j = 0; j < 3; j ++ ) {\r\n\r\n\t\t\tedge[ 0 ] = face[ keys[ j ] ];\r\n\t\t\tedge[ 1 ] = face[ keys[ ( j + 1 ) % 3 ] ];\r\n\t\t\tedge.sort( sortFunction );\r\n\r\n\t\t\tvar key = edge.toString();\r\n\r\n\t\t\tif ( hash[ key ] === undefined ) {\r\n\r\n\t\t\t\thash[ key ] = { vert1: edge[ 0 ], vert2: edge[ 1 ], face1: i, face2: undefined };\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\thash[ key ].face2 = i;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tvar coords = [];\r\n\r\n\tfor ( var key in hash ) {\r\n\r\n\t\tvar h = hash[ key ];\r\n\r\n\t\tif ( h.face2 === undefined || faces[ h.face1 ].normal.dot( faces[ h.face2 ].normal ) <= thresholdDot ) {\r\n\r\n\t\t\tvar vertex = vertices[ h.vert1 ];\r\n\t\t\tcoords.push( vertex.x );\r\n\t\t\tcoords.push( vertex.y );\r\n\t\t\tcoords.push( vertex.z );\r\n\r\n\t\t\tvertex = vertices[ h.vert2 ];\r\n\t\t\tcoords.push( vertex.x );\r\n\t\t\tcoords.push( vertex.y );\r\n\t\t\tcoords.push( vertex.z );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tthis.addAttribute( 'position', new THREE.BufferAttribute( new Float32Array( coords ), 3 ) );\r\n\r\n};\r\n\r\nTHREE.EdgesGeometry.prototype = Object.create( THREE.BufferGeometry.prototype );\r\nTHREE.EdgesGeometry.prototype.constructor = THREE.EdgesGeometry;\r\n\r\n// File:src/extras/geometries/ExtrudeGeometry.js\r\n\r\n/**\r\n * @author zz85 / http://www.lab4games.net/zz85/blog\r\n *\r\n * Creates extruded geometry from a path shape.\r\n *\r\n * parameters = {\r\n *\r\n * curveSegments: , // number of points on the curves\r\n * steps: , // number of points for z-side extrusions / used for subdividing segments of extrude spline too\r\n * amount: , // Depth to extrude the shape\r\n *\r\n * bevelEnabled: , // turn on bevel\r\n * bevelThickness: , // how deep into the original shape bevel goes\r\n * bevelSize: , // how far from shape outline is bevel\r\n * bevelSegments: , // number of bevel layers\r\n *\r\n * extrudePath: // 3d spline path to extrude shape along. (creates Frames if .frames aren't defined)\r\n * frames: // containing arrays of tangents, normals, binormals\r\n *\r\n * uvGenerator: // object that provides UV generator functions\r\n *\r\n * }\r\n **/\r\n\r\nTHREE.ExtrudeGeometry = function ( shapes, options ) {\r\n\r\n\tif ( typeof( shapes ) === \"undefined\" ) {\r\n\r\n\t\tshapes = [];\r\n\t\treturn;\r\n\r\n\t}\r\n\r\n\tTHREE.Geometry.call( this );\r\n\r\n\tthis.type = 'ExtrudeGeometry';\r\n\r\n\tshapes = Array.isArray( shapes ) ? shapes : [ shapes ];\r\n\r\n\tthis.addShapeList( shapes, options );\r\n\r\n\tthis.computeFaceNormals();\r\n\r\n\t// can't really use automatic vertex normals\r\n\t// as then front and back sides get smoothed too\r\n\t// should do separate smoothing just for sides\r\n\r\n\t//this.computeVertexNormals();\r\n\r\n\t//console.log( \"took\", ( Date.now() - startTime ) );\r\n\r\n};\r\n\r\nTHREE.ExtrudeGeometry.prototype = Object.create( THREE.Geometry.prototype );\r\nTHREE.ExtrudeGeometry.prototype.constructor = THREE.ExtrudeGeometry;\r\n\r\nTHREE.ExtrudeGeometry.prototype.addShapeList = function ( shapes, options ) {\r\n\r\n\tvar sl = shapes.length;\r\n\r\n\tfor ( var s = 0; s < sl; s ++ ) {\r\n\r\n\t\tvar shape = shapes[ s ];\r\n\t\tthis.addShape( shape, options );\r\n\r\n\t}\r\n\r\n};\r\n\r\nTHREE.ExtrudeGeometry.prototype.addShape = function ( shape, options ) {\r\n\r\n\tvar amount = options.amount !== undefined ? options.amount : 100;\r\n\r\n\tvar bevelThickness = options.bevelThickness !== undefined ? options.bevelThickness : 6; // 10\r\n\tvar bevelSize = options.bevelSize !== undefined ? options.bevelSize : bevelThickness - 2; // 8\r\n\tvar bevelSegments = options.bevelSegments !== undefined ? options.bevelSegments : 3;\r\n\r\n\tvar bevelEnabled = options.bevelEnabled !== undefined ? options.bevelEnabled : true; // false\r\n\r\n\tvar curveSegments = options.curveSegments !== undefined ? options.curveSegments : 12;\r\n\r\n\tvar steps = options.steps !== undefined ? options.steps : 1;\r\n\r\n\tvar extrudePath = options.extrudePath;\r\n\tvar extrudePts, extrudeByPath = false;\r\n\r\n\t// Use default WorldUVGenerator if no UV generators are specified.\r\n\tvar uvgen = options.UVGenerator !== undefined ? options.UVGenerator : THREE.ExtrudeGeometry.WorldUVGenerator;\r\n\r\n\tvar splineTube, binormal, normal, position2;\r\n\tif ( extrudePath ) {\r\n\r\n\t\textrudePts = extrudePath.getSpacedPoints( steps );\r\n\r\n\t\textrudeByPath = true;\r\n\t\tbevelEnabled = false; // bevels not supported for path extrusion\r\n\r\n\t\t// SETUP TNB variables\r\n\r\n\t\t// Reuse TNB from TubeGeomtry for now.\r\n\t\t// TODO1 - have a .isClosed in spline?\r\n\r\n\t\tsplineTube = options.frames !== undefined ? options.frames : new THREE.TubeGeometry.FrenetFrames( extrudePath, steps, false );\r\n\r\n\t\t// console.log(splineTube, 'splineTube', splineTube.normals.length, 'steps', steps, 'extrudePts', extrudePts.length);\r\n\r\n\t\tbinormal = new THREE.Vector3();\r\n\t\tnormal = new THREE.Vector3();\r\n\t\tposition2 = new THREE.Vector3();\r\n\r\n\t}\r\n\r\n\t// Safeguards if bevels are not enabled\r\n\r\n\tif ( ! bevelEnabled ) {\r\n\r\n\t\tbevelSegments = 0;\r\n\t\tbevelThickness = 0;\r\n\t\tbevelSize = 0;\r\n\r\n\t}\r\n\r\n\t// Variables initialization\r\n\r\n\tvar ahole, h, hl; // looping of holes\r\n\tvar scope = this;\r\n\r\n\tvar shapesOffset = this.vertices.length;\r\n\r\n\tvar shapePoints = shape.extractPoints( curveSegments );\r\n\r\n\tvar vertices = shapePoints.shape;\r\n\tvar holes = shapePoints.holes;\r\n\r\n\tvar reverse = ! THREE.Shape.Utils.isClockWise( vertices );\r\n\r\n\tif ( reverse ) {\r\n\r\n\t\tvertices = vertices.reverse();\r\n\r\n\t\t// Maybe we should also check if holes are in the opposite direction, just to be safe ...\r\n\r\n\t\tfor ( h = 0, hl = holes.length; h < hl; h ++ ) {\r\n\r\n\t\t\tahole = holes[ h ];\r\n\r\n\t\t\tif ( THREE.Shape.Utils.isClockWise( ahole ) ) {\r\n\r\n\t\t\t\tholes[ h ] = ahole.reverse();\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treverse = false; // If vertices are in order now, we shouldn't need to worry about them again (hopefully)!\r\n\r\n\t}\r\n\r\n\r\n\tvar faces = THREE.Shape.Utils.triangulateShape ( vertices, holes );\r\n\r\n\t/* Vertices */\r\n\r\n\tvar contour = vertices; // vertices has all points but contour has only points of circumference\r\n\r\n\tfor ( h = 0, hl = holes.length; h < hl; h ++ ) {\r\n\r\n\t\tahole = holes[ h ];\r\n\r\n\t\tvertices = vertices.concat( ahole );\r\n\r\n\t}\r\n\r\n\r\n\tfunction scalePt2 ( pt, vec, size ) {\r\n\r\n\t\tif ( ! vec ) console.error( \"THREE.ExtrudeGeometry: vec does not exist\" );\r\n\r\n\t\treturn vec.clone().multiplyScalar( size ).add( pt );\r\n\r\n\t}\r\n\r\n\tvar b, bs, t, z,\r\n\t\tvert, vlen = vertices.length,\r\n\t\tface, flen = faces.length;\r\n\r\n\r\n\t// Find directions for point movement\r\n\r\n\r\n\tfunction getBevelVec( inPt, inPrev, inNext ) {\r\n\r\n\t\tvar EPSILON = 0.0000000001;\r\n\r\n\t\t// computes for inPt the corresponding point inPt' on a new contour\r\n\t\t// shifted by 1 unit (length of normalized vector) to the left\r\n\t\t// if we walk along contour clockwise, this new contour is outside the old one\r\n\t\t//\r\n\t\t// inPt' is the intersection of the two lines parallel to the two\r\n\t\t// adjacent edges of inPt at a distance of 1 unit on the left side.\r\n\r\n\t\tvar v_trans_x, v_trans_y, shrink_by = 1;\t\t// resulting translation vector for inPt\r\n\r\n\t\t// good reading for geometry algorithms (here: line-line intersection)\r\n\t\t// http://geomalgorithms.com/a05-_intersect-1.html\r\n\r\n\t\tvar v_prev_x = inPt.x - inPrev.x, v_prev_y = inPt.y - inPrev.y;\r\n\t\tvar v_next_x = inNext.x - inPt.x, v_next_y = inNext.y - inPt.y;\r\n\r\n\t\tvar v_prev_lensq = ( v_prev_x * v_prev_x + v_prev_y * v_prev_y );\r\n\r\n\t\t// check for collinear edges\r\n\t\tvar collinear0 = ( v_prev_x * v_next_y - v_prev_y * v_next_x );\r\n\r\n\t\tif ( Math.abs( collinear0 ) > EPSILON ) {\r\n\r\n\t\t\t// not collinear\r\n\r\n\t\t\t// length of vectors for normalizing\r\n\r\n\t\t\tvar v_prev_len = Math.sqrt( v_prev_lensq );\r\n\t\t\tvar v_next_len = Math.sqrt( v_next_x * v_next_x + v_next_y * v_next_y );\r\n\r\n\t\t\t// shift adjacent points by unit vectors to the left\r\n\r\n\t\t\tvar ptPrevShift_x = ( inPrev.x - v_prev_y / v_prev_len );\r\n\t\t\tvar ptPrevShift_y = ( inPrev.y + v_prev_x / v_prev_len );\r\n\r\n\t\t\tvar ptNextShift_x = ( inNext.x - v_next_y / v_next_len );\r\n\t\t\tvar ptNextShift_y = ( inNext.y + v_next_x / v_next_len );\r\n\r\n\t\t\t// scaling factor for v_prev to intersection point\r\n\r\n\t\t\tvar sf = ( ( ptNextShift_x - ptPrevShift_x ) * v_next_y -\r\n\t\t\t\t\t\t( ptNextShift_y - ptPrevShift_y ) * v_next_x ) /\r\n\t\t\t\t\t ( v_prev_x * v_next_y - v_prev_y * v_next_x );\r\n\r\n\t\t\t// vector from inPt to intersection point\r\n\r\n\t\t\tv_trans_x = ( ptPrevShift_x + v_prev_x * sf - inPt.x );\r\n\t\t\tv_trans_y = ( ptPrevShift_y + v_prev_y * sf - inPt.y );\r\n\r\n\t\t\t// Don't normalize!, otherwise sharp corners become ugly\r\n\t\t\t// but prevent crazy spikes\r\n\t\t\tvar v_trans_lensq = ( v_trans_x * v_trans_x + v_trans_y * v_trans_y );\r\n\t\t\tif ( v_trans_lensq <= 2 ) {\r\n\r\n\t\t\t\treturn\tnew THREE.Vector2( v_trans_x, v_trans_y );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tshrink_by = Math.sqrt( v_trans_lensq / 2 );\r\n\r\n\t\t\t}\r\n\r\n\t\t} else {\r\n\r\n\t\t\t// handle special case of collinear edges\r\n\r\n\t\t\tvar direction_eq = false;\t\t// assumes: opposite\r\n\t\t\tif ( v_prev_x > EPSILON ) {\r\n\r\n\t\t\t\tif ( v_next_x > EPSILON ) {\r\n\r\n\t\t\t\t\tdirection_eq = true;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\tif ( v_prev_x < - EPSILON ) {\r\n\r\n\t\t\t\t\tif ( v_next_x < - EPSILON ) {\r\n\r\n\t\t\t\t\t\tdirection_eq = true;\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\tif ( Math.sign( v_prev_y ) === Math.sign( v_next_y ) ) {\r\n\r\n\t\t\t\t\t\tdirection_eq = true;\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif ( direction_eq ) {\r\n\r\n\t\t\t\t// console.log(\"Warning: lines are a straight sequence\");\r\n\t\t\t\tv_trans_x = - v_prev_y;\r\n\t\t\t\tv_trans_y = v_prev_x;\r\n\t\t\t\tshrink_by = Math.sqrt( v_prev_lensq );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\t// console.log(\"Warning: lines are a straight spike\");\r\n\t\t\t\tv_trans_x = v_prev_x;\r\n\t\t\t\tv_trans_y = v_prev_y;\r\n\t\t\t\tshrink_by = Math.sqrt( v_prev_lensq / 2 );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn\tnew THREE.Vector2( v_trans_x / shrink_by, v_trans_y / shrink_by );\r\n\r\n\t}\r\n\r\n\r\n\tvar contourMovements = [];\r\n\r\n\tfor ( var i = 0, il = contour.length, j = il - 1, k = i + 1; i < il; i ++, j ++, k ++ ) {\r\n\r\n\t\tif ( j === il ) j = 0;\r\n\t\tif ( k === il ) k = 0;\r\n\r\n\t\t// (j)---(i)---(k)\r\n\t\t// console.log('i,j,k', i, j , k)\r\n\r\n\t\tcontourMovements[ i ] = getBevelVec( contour[ i ], contour[ j ], contour[ k ] );\r\n\r\n\t}\r\n\r\n\tvar holesMovements = [], oneHoleMovements, verticesMovements = contourMovements.concat();\r\n\r\n\tfor ( h = 0, hl = holes.length; h < hl; h ++ ) {\r\n\r\n\t\tahole = holes[ h ];\r\n\r\n\t\toneHoleMovements = [];\r\n\r\n\t\tfor ( i = 0, il = ahole.length, j = il - 1, k = i + 1; i < il; i ++, j ++, k ++ ) {\r\n\r\n\t\t\tif ( j === il ) j = 0;\r\n\t\t\tif ( k === il ) k = 0;\r\n\r\n\t\t\t// (j)---(i)---(k)\r\n\t\t\toneHoleMovements[ i ] = getBevelVec( ahole[ i ], ahole[ j ], ahole[ k ] );\r\n\r\n\t\t}\r\n\r\n\t\tholesMovements.push( oneHoleMovements );\r\n\t\tverticesMovements = verticesMovements.concat( oneHoleMovements );\r\n\r\n\t}\r\n\r\n\r\n\t// Loop bevelSegments, 1 for the front, 1 for the back\r\n\r\n\tfor ( b = 0; b < bevelSegments; b ++ ) {\r\n\r\n\t\t//for ( b = bevelSegments; b > 0; b -- ) {\r\n\r\n\t\tt = b / bevelSegments;\r\n\t\tz = bevelThickness * ( 1 - t );\r\n\r\n\t\t//z = bevelThickness * t;\r\n\t\tbs = bevelSize * ( Math.sin ( t * Math.PI / 2 ) ); // curved\r\n\t\t//bs = bevelSize * t; // linear\r\n\r\n\t\t// contract shape\r\n\r\n\t\tfor ( i = 0, il = contour.length; i < il; i ++ ) {\r\n\r\n\t\t\tvert = scalePt2( contour[ i ], contourMovements[ i ], bs );\r\n\r\n\t\t\tv( vert.x, vert.y, - z );\r\n\r\n\t\t}\r\n\r\n\t\t// expand holes\r\n\r\n\t\tfor ( h = 0, hl = holes.length; h < hl; h ++ ) {\r\n\r\n\t\t\tahole = holes[ h ];\r\n\t\t\toneHoleMovements = holesMovements[ h ];\r\n\r\n\t\t\tfor ( i = 0, il = ahole.length; i < il; i ++ ) {\r\n\r\n\t\t\t\tvert = scalePt2( ahole[ i ], oneHoleMovements[ i ], bs );\r\n\r\n\t\t\t\tv( vert.x, vert.y, - z );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tbs = bevelSize;\r\n\r\n\t// Back facing vertices\r\n\r\n\tfor ( i = 0; i < vlen; i ++ ) {\r\n\r\n\t\tvert = bevelEnabled ? scalePt2( vertices[ i ], verticesMovements[ i ], bs ) : vertices[ i ];\r\n\r\n\t\tif ( ! extrudeByPath ) {\r\n\r\n\t\t\tv( vert.x, vert.y, 0 );\r\n\r\n\t\t} else {\r\n\r\n\t\t\t// v( vert.x, vert.y + extrudePts[ 0 ].y, extrudePts[ 0 ].x );\r\n\r\n\t\t\tnormal.copy( splineTube.normals[ 0 ] ).multiplyScalar( vert.x );\r\n\t\t\tbinormal.copy( splineTube.binormals[ 0 ] ).multiplyScalar( vert.y );\r\n\r\n\t\t\tposition2.copy( extrudePts[ 0 ] ).add( normal ).add( binormal );\r\n\r\n\t\t\tv( position2.x, position2.y, position2.z );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\t// Add stepped vertices...\r\n\t// Including front facing vertices\r\n\r\n\tvar s;\r\n\r\n\tfor ( s = 1; s <= steps; s ++ ) {\r\n\r\n\t\tfor ( i = 0; i < vlen; i ++ ) {\r\n\r\n\t\t\tvert = bevelEnabled ? scalePt2( vertices[ i ], verticesMovements[ i ], bs ) : vertices[ i ];\r\n\r\n\t\t\tif ( ! extrudeByPath ) {\r\n\r\n\t\t\t\tv( vert.x, vert.y, amount / steps * s );\r\n\r\n\t\t\t} else {\r\n\r\n\t\t\t\t// v( vert.x, vert.y + extrudePts[ s - 1 ].y, extrudePts[ s - 1 ].x );\r\n\r\n\t\t\t\tnormal.copy( splineTube.normals[ s ] ).multiplyScalar( vert.x );\r\n\t\t\t\tbinormal.copy( splineTube.binormals[ s ] ).multiplyScalar( vert.y );\r\n\r\n\t\t\t\tposition2.copy( extrudePts[ s ] ).add( normal ).add( binormal );\r\n\r\n\t\t\t\tv( position2.x, position2.y, position2.z );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\r\n\t// Add bevel segments planes\r\n\r\n\t//for ( b = 1; b <= bevelSegments; b ++ ) {\r\n\tfor ( b = bevelSegments - 1; b >= 0; b -- ) {\r\n\r\n\t\tt = b / bevelSegments;\r\n\t\tz = bevelThickness * ( 1 - t );\r\n\t\t//bs = bevelSize * ( 1-Math.sin ( ( 1 - t ) * Math.PI/2 ) );\r\n\t\tbs = bevelSize * Math.sin ( t * Math.PI / 2 );\r\n\r\n\t\t// contract shape\r\n\r\n\t\tfor ( i = 0, il = contour.length; i < il; i ++ ) {\r\n\r\n\t\t\tvert = scalePt2( contour[ i ], contourMovements[ i ], bs );\r\n\t\t\tv( vert.x, vert.y, amount + z );\r\n\r\n\t\t}\r\n\r\n\t\t// expand holes\r\n\r\n\t\tfor ( h = 0, hl = holes.length; h < hl; h ++ ) {\r\n\r\n\t\t\tahole = holes[ h ];\r\n\t\t\toneHoleMovements = holesMovements[ h ];\r\n\r\n\t\t\tfor ( i = 0, il = ahole.length; i < il; i ++ ) {\r\n\r\n\t\t\t\tvert = scalePt2( ahole[ i ], oneHoleMovements[ i ], bs );\r\n\r\n\t\t\t\tif ( ! extrudeByPath ) {\r\n\r\n\t\t\t\t\tv( vert.x, vert.y, amount + z );\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\tv( vert.x, vert.y + extrudePts[ steps - 1 ].y, extrudePts[ steps - 1 ].x + z );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\t/* Faces */\r\n\r\n\t// Top and bottom faces\r\n\r\n\tbuildLidFaces();\r\n\r\n\t// Sides faces\r\n\r\n\tbuildSideFaces();\r\n\r\n\r\n\t///// Internal functions\r\n\r\n\tfunction buildLidFaces() {\r\n\r\n\t\tif ( bevelEnabled ) {\r\n\r\n\t\t\tvar layer = 0; // steps + 1\r\n\t\t\tvar offset = vlen * layer;\r\n\r\n\t\t\t// Bottom faces\r\n\r\n\t\t\tfor ( i = 0; i < flen; i ++ ) {\r\n\r\n\t\t\t\tface = faces[ i ];\r\n\t\t\t\tf3( face[ 2 ] + offset, face[ 1 ] + offset, face[ 0 ] + offset );\r\n\r\n\t\t\t}\r\n\r\n\t\t\tlayer = steps + bevelSegments * 2;\r\n\t\t\toffset = vlen * layer;\r\n\r\n\t\t\t// Top faces\r\n\r\n\t\t\tfor ( i = 0; i < flen; i ++ ) {\r\n\r\n\t\t\t\tface = faces[ i ];\r\n\t\t\t\tf3( face[ 0 ] + offset, face[ 1 ] + offset, face[ 2 ] + offset );\r\n\r\n\t\t\t}\r\n\r\n\t\t} else {\r\n\r\n\t\t\t// Bottom faces\r\n\r\n\t\t\tfor ( i = 0; i < flen; i ++ ) {\r\n\r\n\t\t\t\tface = faces[ i ];\r\n\t\t\t\tf3( face[ 2 ], face[ 1 ], face[ 0 ] );\r\n\r\n\t\t\t}\r\n\r\n\t\t\t// Top faces\r\n\r\n\t\t\tfor ( i = 0; i < flen; i ++ ) {\r\n\r\n\t\t\t\tface = faces[ i ];\r\n\t\t\t\tf3( face[ 0 ] + vlen * steps, face[ 1 ] + vlen * steps, face[ 2 ] + vlen * steps );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\t// Create faces for the z-sides of the shape\r\n\r\n\tfunction buildSideFaces() {\r\n\r\n\t\tvar layeroffset = 0;\r\n\t\tsidewalls( contour, layeroffset );\r\n\t\tlayeroffset += contour.length;\r\n\r\n\t\tfor ( h = 0, hl = holes.length; h < hl; h ++ ) {\r\n\r\n\t\t\tahole = holes[ h ];\r\n\t\t\tsidewalls( ahole, layeroffset );\r\n\r\n\t\t\t//, true\r\n\t\t\tlayeroffset += ahole.length;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tfunction sidewalls( contour, layeroffset ) {\r\n\r\n\t\tvar j, k;\r\n\t\ti = contour.length;\r\n\r\n\t\twhile ( -- i >= 0 ) {\r\n\r\n\t\t\tj = i;\r\n\t\t\tk = i - 1;\r\n\t\t\tif ( k < 0 ) k = contour.length - 1;\r\n\r\n\t\t\t//console.log('b', i,j, i-1, k,vertices.length);\r\n\r\n\t\t\tvar s = 0, sl = steps + bevelSegments * 2;\r\n\r\n\t\t\tfor ( s = 0; s < sl; s ++ ) {\r\n\r\n\t\t\t\tvar slen1 = vlen * s;\r\n\t\t\t\tvar slen2 = vlen * ( s + 1 );\r\n\r\n\t\t\t\tvar a = layeroffset + j + slen1,\r\n\t\t\t\t\tb = layeroffset + k + slen1,\r\n\t\t\t\t\tc = layeroffset + k + slen2,\r\n\t\t\t\t\td = layeroffset + j + slen2;\r\n\r\n\t\t\t\tf4( a, b, c, d, contour, s, sl, j, k );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\r\n\tfunction v( x, y, z ) {\r\n\r\n\t\tscope.vertices.push( new THREE.Vector3( x, y, z ) );\r\n\r\n\t}\r\n\r\n\tfunction f3( a, b, c ) {\r\n\r\n\t\ta += shapesOffset;\r\n\t\tb += shapesOffset;\r\n\t\tc += shapesOffset;\r\n\r\n\t\tscope.faces.push( new THREE.Face3( a, b, c ) );\r\n\r\n\t\tvar uvs = uvgen.generateTopUV( scope, a, b, c );\r\n\r\n\t\tscope.faceVertexUvs[ 0 ].push( uvs );\r\n\r\n\t}\r\n\r\n\tfunction f4( a, b, c, d, wallContour, stepIndex, stepsLength, contourIndex1, contourIndex2 ) {\r\n\r\n\t\ta += shapesOffset;\r\n\t\tb += shapesOffset;\r\n\t\tc += shapesOffset;\r\n\t\td += shapesOffset;\r\n\r\n\t\tscope.faces.push( new THREE.Face3( a, b, d ) );\r\n\t\tscope.faces.push( new THREE.Face3( b, c, d ) );\r\n\r\n\t\tvar uvs = uvgen.generateSideWallUV( scope, a, b, c, d );\r\n\r\n\t\tscope.faceVertexUvs[ 0 ].push( [ uvs[ 0 ], uvs[ 1 ], uvs[ 3 ] ] );\r\n\t\tscope.faceVertexUvs[ 0 ].push( [ uvs[ 1 ], uvs[ 2 ], uvs[ 3 ] ] );\r\n\r\n\t}\r\n\r\n};\r\n\r\nTHREE.ExtrudeGeometry.WorldUVGenerator = {\r\n\r\n\tgenerateTopUV: function ( geometry, indexA, indexB, indexC ) {\r\n\r\n\t\tvar vertices = geometry.vertices;\r\n\r\n\t\tvar a = vertices[ indexA ];\r\n\t\tvar b = vertices[ indexB ];\r\n\t\tvar c = vertices[ indexC ];\r\n\r\n\t\treturn [\r\n\t\t\tnew THREE.Vector2( a.x, a.y ),\r\n\t\t\tnew THREE.Vector2( b.x, b.y ),\r\n\t\t\tnew THREE.Vector2( c.x, c.y )\r\n\t\t];\r\n\r\n\t},\r\n\r\n\tgenerateSideWallUV: function ( geometry, indexA, indexB, indexC, indexD ) {\r\n\r\n\t\tvar vertices = geometry.vertices;\r\n\r\n\t\tvar a = vertices[ indexA ];\r\n\t\tvar b = vertices[ indexB ];\r\n\t\tvar c = vertices[ indexC ];\r\n\t\tvar d = vertices[ indexD ];\r\n\r\n\t\tif ( Math.abs( a.y - b.y ) < 0.01 ) {\r\n\r\n\t\t\treturn [\r\n\t\t\t\tnew THREE.Vector2( a.x, 1 - a.z ),\r\n\t\t\t\tnew THREE.Vector2( b.x, 1 - b.z ),\r\n\t\t\t\tnew THREE.Vector2( c.x, 1 - c.z ),\r\n\t\t\t\tnew THREE.Vector2( d.x, 1 - d.z )\r\n\t\t\t];\r\n\r\n\t\t} else {\r\n\r\n\t\t\treturn [\r\n\t\t\t\tnew THREE.Vector2( a.y, 1 - a.z ),\r\n\t\t\t\tnew THREE.Vector2( b.y, 1 - b.z ),\r\n\t\t\t\tnew THREE.Vector2( c.y, 1 - c.z ),\r\n\t\t\t\tnew THREE.Vector2( d.y, 1 - d.z )\r\n\t\t\t];\r\n\r\n\t\t}\r\n\r\n\t}\r\n};\r\n\r\n// File:src/extras/geometries/ShapeGeometry.js\r\n\r\n/**\r\n * @author jonobr1 / http://jonobr1.com\r\n *\r\n * Creates a one-sided polygonal geometry from a path shape. Similar to\r\n * ExtrudeGeometry.\r\n *\r\n * parameters = {\r\n *\r\n *\tcurveSegments: , // number of points on the curves. NOT USED AT THE MOMENT.\r\n *\r\n *\tmaterial: // material index for front and back faces\r\n *\tuvGenerator: // object that provides UV generator functions\r\n *\r\n * }\r\n **/\r\n\r\nTHREE.ShapeGeometry = function ( shapes, options ) {\r\n\r\n\tTHREE.Geometry.call( this );\r\n\r\n\tthis.type = 'ShapeGeometry';\r\n\r\n\tif ( Array.isArray( shapes ) === false ) shapes = [ shapes ];\r\n\r\n\tthis.addShapeList( shapes, options );\r\n\r\n\tthis.computeFaceNormals();\r\n\r\n};\r\n\r\nTHREE.ShapeGeometry.prototype = Object.create( THREE.Geometry.prototype );\r\nTHREE.ShapeGeometry.prototype.constructor = THREE.ShapeGeometry;\r\n\r\n/**\r\n * Add an array of shapes to THREE.ShapeGeometry.\r\n */\r\nTHREE.ShapeGeometry.prototype.addShapeList = function ( shapes, options ) {\r\n\r\n\tfor ( var i = 0, l = shapes.length; i < l; i ++ ) {\r\n\r\n\t\tthis.addShape( shapes[ i ], options );\r\n\r\n\t}\r\n\r\n\treturn this;\r\n\r\n};\r\n\r\n/**\r\n * Adds a shape to THREE.ShapeGeometry, based on THREE.ExtrudeGeometry.\r\n */\r\nTHREE.ShapeGeometry.prototype.addShape = function ( shape, options ) {\r\n\r\n\tif ( options === undefined ) options = {};\r\n\tvar curveSegments = options.curveSegments !== undefined ? options.curveSegments : 12;\r\n\r\n\tvar material = options.material;\r\n\tvar uvgen = options.UVGenerator === undefined ? THREE.ExtrudeGeometry.WorldUVGenerator : options.UVGenerator;\r\n\r\n\t//\r\n\r\n\tvar i, l, hole;\r\n\r\n\tvar shapesOffset = this.vertices.length;\r\n\tvar shapePoints = shape.extractPoints( curveSegments );\r\n\r\n\tvar vertices = shapePoints.shape;\r\n\tvar holes = shapePoints.holes;\r\n\r\n\tvar reverse = ! THREE.Shape.Utils.isClockWise( vertices );\r\n\r\n\tif ( reverse ) {\r\n\r\n\t\tvertices = vertices.reverse();\r\n\r\n\t\t// Maybe we should also check if holes are in the opposite direction, just to be safe...\r\n\r\n\t\tfor ( i = 0, l = holes.length; i < l; i ++ ) {\r\n\r\n\t\t\thole = holes[ i ];\r\n\r\n\t\t\tif ( THREE.Shape.Utils.isClockWise( hole ) ) {\r\n\r\n\t\t\t\tholes[ i ] = hole.reverse();\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treverse = false;\r\n\r\n\t}\r\n\r\n\tvar faces = THREE.Shape.Utils.triangulateShape( vertices, holes );\r\n\r\n\t// Vertices\r\n\r\n\tfor ( i = 0, l = holes.length; i < l; i ++ ) {\r\n\r\n\t\thole = holes[ i ];\r\n\t\tvertices = vertices.concat( hole );\r\n\r\n\t}\r\n\r\n\t//\r\n\r\n\tvar vert, vlen = vertices.length;\r\n\tvar face, flen = faces.length;\r\n\r\n\tfor ( i = 0; i < vlen; i ++ ) {\r\n\r\n\t\tvert = vertices[ i ];\r\n\r\n\t\tthis.vertices.push( new THREE.Vector3( vert.x, vert.y, 0 ) );\r\n\r\n\t}\r\n\r\n\tfor ( i = 0; i < flen; i ++ ) {\r\n\r\n\t\tface = faces[ i ];\r\n\r\n\t\tvar a = face[ 0 ] + shapesOffset;\r\n\t\tvar b = face[ 1 ] + shapesOffset;\r\n\t\tvar c = face[ 2 ] + shapesOffset;\r\n\r\n\t\tthis.faces.push( new THREE.Face3( a, b, c, null, null, material ) );\r\n\t\tthis.faceVertexUvs[ 0 ].push( uvgen.generateTopUV( this, a, b, c ) );\r\n\r\n\t}\r\n\r\n};\r\n\r\n// File:src/extras/geometries/LatheGeometry.js\r\n\r\n/**\r\n * @author astrodud / http://astrodud.isgreat.org/\r\n * @author zz85 / https://github.com/zz85\r\n * @author bhouston / http://exocortex.com\r\n */\r\n\r\n// points - to create a closed torus, one must use a set of points \r\n// like so: [ a, b, c, d, a ], see first is the same as last.\r\n// segments - the number of circumference segments to create\r\n// phiStart - the starting radian\r\n// phiLength - the radian (0 to 2*PI) range of the lathed section\r\n// 2*pi is a closed lathe, less than 2PI is a portion.\r\n\r\nTHREE.LatheGeometry = function ( points, segments, phiStart, phiLength ) {\r\n\r\n\tTHREE.Geometry.call( this );\r\n\r\n\tthis.type = 'LatheGeometry';\r\n\r\n\tthis.parameters = {\r\n\t\tpoints: points,\r\n\t\tsegments: segments,\r\n\t\tphiStart: phiStart,\r\n\t\tphiLength: phiLength\r\n\t};\r\n\r\n\tsegments = segments || 12;\r\n\tphiStart = phiStart || 0;\r\n\tphiLength = phiLength || 2 * Math.PI;\r\n\r\n\tvar inversePointLength = 1.0 / ( points.length - 1 );\r\n\tvar inverseSegments = 1.0 / segments;\r\n\r\n\tfor ( var i = 0, il = segments; i <= il; i ++ ) {\r\n\r\n\t\tvar phi = phiStart + i * inverseSegments * phiLength;\r\n\r\n\t\tvar c = Math.cos( phi ),\r\n\t\t\ts = Math.sin( phi );\r\n\r\n\t\tfor ( var j = 0, jl = points.length; j < jl; j ++ ) {\r\n\r\n\t\t\tvar pt = points[ j ];\r\n\r\n\t\t\tvar vertex = new THREE.Vector3();\r\n\r\n\t\t\tvertex.x = c * pt.x - s * pt.y;\r\n\t\t\tvertex.y = s * pt.x + c * pt.y;\r\n\t\t\tvertex.z = pt.z;\r\n\r\n\t\t\tthis.vertices.push( vertex );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tvar np = points.length;\r\n\r\n\tfor ( var i = 0, il = segments; i < il; i ++ ) {\r\n\r\n\t\tfor ( var j = 0, jl = points.length - 1; j < jl; j ++ ) {\r\n\r\n\t\t\tvar base = j + np * i;\r\n\t\t\tvar a = base;\r\n\t\t\tvar b = base + np;\r\n\t\t\tvar c = base + 1 + np;\r\n\t\t\tvar d = base + 1;\r\n\r\n\t\t\tvar u0 = i * inverseSegments;\r\n\t\t\tvar v0 = j * inversePointLength;\r\n\t\t\tvar u1 = u0 + inverseSegments;\r\n\t\t\tvar v1 = v0 + inversePointLength;\r\n\r\n\t\t\tthis.faces.push( new THREE.Face3( a, b, d ) );\r\n\r\n\t\t\tthis.faceVertexUvs[ 0 ].push( [\r\n\r\n\t\t\t\tnew THREE.Vector2( u0, v0 ),\r\n\t\t\t\tnew THREE.Vector2( u1, v0 ),\r\n\t\t\t\tnew THREE.Vector2( u0, v1 )\r\n\r\n\t\t\t] );\r\n\r\n\t\t\tthis.faces.push( new THREE.Face3( b, c, d ) );\r\n\r\n\t\t\tthis.faceVertexUvs[ 0 ].push( [\r\n\r\n\t\t\t\tnew THREE.Vector2( u1, v0 ),\r\n\t\t\t\tnew THREE.Vector2( u1, v1 ),\r\n\t\t\t\tnew THREE.Vector2( u0, v1 )\r\n\r\n\t\t\t] );\r\n\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tthis.mergeVertices();\r\n\tthis.computeFaceNormals();\r\n\tthis.computeVertexNormals();\r\n\r\n};\r\n\r\nTHREE.LatheGeometry.prototype = Object.create( THREE.Geometry.prototype );\r\nTHREE.LatheGeometry.prototype.constructor = THREE.LatheGeometry;\r\n\r\n// File:src/extras/geometries/PlaneGeometry.js\r\n\r\n/**\r\n * @author mrdoob / http://mrdoob.com/\r\n * based on http://papervision3d.googlecode.com/svn/trunk/as3/trunk/src/org/papervision3d/objects/primitives/Plane.as\r\n */\r\n\r\nTHREE.PlaneGeometry = function ( width, height, widthSegments, heightSegments ) {\r\n\r\n\tTHREE.Geometry.call( this );\r\n\r\n\tthis.type = 'PlaneGeometry';\r\n\r\n\tthis.parameters = {\r\n\t\twidth: width,\r\n\t\theight: height,\r\n\t\twidthSegments: widthSegments,\r\n\t\theightSegments: heightSegments\r\n\t};\r\n\r\n\tthis.fromBufferGeometry( new THREE.PlaneBufferGeometry( width, height, widthSegments, heightSegments ) );\r\n\r\n};\r\n\r\nTHREE.PlaneGeometry.prototype = Object.create( THREE.Geometry.prototype );\r\nTHREE.PlaneGeometry.prototype.constructor = THREE.PlaneGeometry;\r\n\r\nTHREE.PlaneGeometry.prototype.clone = function () {\r\n\r\n\tvar geometry = new THREE.PlaneGeometry(\r\n\t\tthis.parameters.width,\r\n\t\tthis.parameters.height,\r\n\t\tthis.parameters.widthSegments,\r\n\t\tthis.parameters.heightSegments\r\n\t);\r\n\r\n\treturn geometry;\r\n\r\n};\r\n\r\n// File:src/extras/geometries/PlaneBufferGeometry.js\r\n\r\n/**\r\n * @author mrdoob / http://mrdoob.com/\r\n * based on http://papervision3d.googlecode.com/svn/trunk/as3/trunk/src/org/papervision3d/objects/primitives/Plane.as\r\n */\r\n\r\nTHREE.PlaneBufferGeometry = function ( width, height, widthSegments, heightSegments ) {\r\n\r\n\tTHREE.BufferGeometry.call( this );\r\n\r\n\tthis.type = 'PlaneBufferGeometry';\r\n\r\n\tthis.parameters = {\r\n\t\twidth: width,\r\n\t\theight: height,\r\n\t\twidthSegments: widthSegments,\r\n\t\theightSegments: heightSegments\r\n\t};\r\n\r\n\tvar width_half = width / 2;\r\n\tvar height_half = height / 2;\r\n\r\n\tvar gridX = Math.floor( widthSegments ) || 1;\r\n\tvar gridY = Math.floor( heightSegments ) || 1;\r\n\r\n\tvar gridX1 = gridX + 1;\r\n\tvar gridY1 = gridY + 1;\r\n\r\n\tvar segment_width = width / gridX;\r\n\tvar segment_height = height / gridY;\r\n\r\n\tvar vertices = new Float32Array( gridX1 * gridY1 * 3 );\r\n\tvar normals = new Float32Array( gridX1 * gridY1 * 3 );\r\n\tvar uvs = new Float32Array( gridX1 * gridY1 * 2 );\r\n\r\n\tvar offset = 0;\r\n\tvar offset2 = 0;\r\n\r\n\tfor ( var iy = 0; iy < gridY1; iy ++ ) {\r\n\r\n\t\tvar y = iy * segment_height - height_half;\r\n\r\n\t\tfor ( var ix = 0; ix < gridX1; ix ++ ) {\r\n\r\n\t\t\tvar x = ix * segment_width - width_half;\r\n\r\n\t\t\tvertices[ offset ] = x;\r\n\t\t\tvertices[ offset + 1 ] = - y;\r\n\r\n\t\t\tnormals[ offset + 2 ] = 1;\r\n\r\n\t\t\tuvs[ offset2 ] = ix / gridX;\r\n\t\t\tuvs[ offset2 + 1 ] = 1 - ( iy / gridY );\r\n\r\n\t\t\toffset += 3;\r\n\t\t\toffset2 += 2;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\toffset = 0;\r\n\r\n\tvar indices = new ( ( vertices.length / 3 ) > 65535 ? Uint32Array : Uint16Array )( gridX * gridY * 6 );\r\n\r\n\tfor ( var iy = 0; iy < gridY; iy ++ ) {\r\n\r\n\t\tfor ( var ix = 0; ix < gridX; ix ++ ) {\r\n\r\n\t\t\tvar a = ix + gridX1 * iy;\r\n\t\t\tvar b = ix + gridX1 * ( iy + 1 );\r\n\t\t\tvar c = ( ix + 1 ) + gridX1 * ( iy + 1 );\r\n\t\t\tvar d = ( ix + 1 ) + gridX1 * iy;\r\n\r\n\t\t\tindices[ offset ] = a;\r\n\t\t\tindices[ offset + 1 ] = b;\r\n\t\t\tindices[ offset + 2 ] = d;\r\n\r\n\t\t\tindices[ offset + 3 ] = b;\r\n\t\t\tindices[ offset + 4 ] = c;\r\n\t\t\tindices[ offset + 5 ] = d;\r\n\r\n\t\t\toffset += 6;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tthis.addIndex( new THREE.BufferAttribute( indices, 1 ) );\r\n\tthis.addAttribute( 'position', new THREE.BufferAttribute( vertices, 3 ) );\r\n\tthis.addAttribute( 'normal', new THREE.BufferAttribute( normals, 3 ) );\r\n\tthis.addAttribute( 'uv', new THREE.BufferAttribute( uvs, 2 ) );\r\n\r\n};\r\n\r\nTHREE.PlaneBufferGeometry.prototype = Object.create( THREE.BufferGeometry.prototype );\r\nTHREE.PlaneBufferGeometry.prototype.constructor = THREE.PlaneBufferGeometry;\r\n\r\nTHREE.PlaneBufferGeometry.prototype.clone = function () {\r\n\r\n\tvar geometry = new THREE.PlaneBufferGeometry(\r\n\t\tthis.parameters.width,\r\n\t\tthis.parameters.height,\r\n\t\tthis.parameters.widthSegments,\r\n\t\tthis.parameters.heightSegments\r\n\t);\r\n\r\n\tgeometry.copy( this );\r\n\r\n\treturn geometry;\r\n\r\n};\r\n\r\n// File:src/extras/geometries/RingGeometry.js\r\n\r\n/**\r\n * @author Kaleb Murphy\r\n */\r\n\r\nTHREE.RingGeometry = function ( innerRadius, outerRadius, thetaSegments, phiSegments, thetaStart, thetaLength ) {\r\n\r\n\tTHREE.Geometry.call( this );\r\n\r\n\tthis.type = 'RingGeometry';\r\n\r\n\tthis.parameters = {\r\n\t\tinnerRadius: innerRadius,\r\n\t\touterRadius: outerRadius,\r\n\t\tthetaSegments: thetaSegments,\r\n\t\tphiSegments: phiSegments,\r\n\t\tthetaStart: thetaStart,\r\n\t\tthetaLength: thetaLength\r\n\t};\r\n\r\n\tinnerRadius = innerRadius || 0;\r\n\touterRadius = outerRadius || 50;\r\n\r\n\tthetaStart = thetaStart !== undefined ? thetaStart : 0;\r\n\tthetaLength = thetaLength !== undefined ? thetaLength : Math.PI * 2;\r\n\r\n\tthetaSegments = thetaSegments !== undefined ? Math.max( 3, thetaSegments ) : 8;\r\n\tphiSegments = phiSegments !== undefined ? Math.max( 1, phiSegments ) : 8;\r\n\r\n\tvar i, o, uvs = [], radius = innerRadius, radiusStep = ( ( outerRadius - innerRadius ) / phiSegments );\r\n\r\n\tfor ( i = 0; i < phiSegments + 1; i ++ ) {\r\n\r\n\t\t// concentric circles inside ring\r\n\r\n\t\tfor ( o = 0; o < thetaSegments + 1; o ++ ) {\r\n\r\n\t\t\t// number of segments per circle\r\n\r\n\t\t\tvar vertex = new THREE.Vector3();\r\n\t\t\tvar segment = thetaStart + o / thetaSegments * thetaLength;\r\n\t\t\tvertex.x = radius * Math.cos( segment );\r\n\t\t\tvertex.y = radius * Math.sin( segment );\r\n\r\n\t\t\tthis.vertices.push( vertex );\r\n\t\t\tuvs.push( new THREE.Vector2( ( vertex.x / outerRadius + 1 ) / 2, ( vertex.y / outerRadius + 1 ) / 2 ) );\r\n\r\n\t\t}\r\n\r\n\t\tradius += radiusStep;\r\n\r\n\t}\r\n\r\n\tvar n = new THREE.Vector3( 0, 0, 1 );\r\n\r\n\tfor ( i = 0; i < phiSegments; i ++ ) {\r\n\r\n\t\t// concentric circles inside ring\r\n\r\n\t\tvar thetaSegment = i * ( thetaSegments + 1 );\r\n\r\n\t\tfor ( o = 0; o < thetaSegments ; o ++ ) {\r\n\r\n\t\t\t// number of segments per circle\r\n\r\n\t\t\tvar segment = o + thetaSegment;\r\n\r\n\t\t\tvar v1 = segment;\r\n\t\t\tvar v2 = segment + thetaSegments + 1;\r\n\t\t\tvar v3 = segment + thetaSegments + 2;\r\n\r\n\t\t\tthis.faces.push( new THREE.Face3( v1, v2, v3, [ n.clone(), n.clone(), n.clone() ] ) );\r\n\t\t\tthis.faceVertexUvs[ 0 ].push( [ uvs[ v1 ].clone(), uvs[ v2 ].clone(), uvs[ v3 ].clone() ] );\r\n\r\n\t\t\tv1 = segment;\r\n\t\t\tv2 = segment + thetaSegments + 2;\r\n\t\t\tv3 = segment + 1;\r\n\r\n\t\t\tthis.faces.push( new THREE.Face3( v1, v2, v3, [ n.clone(), n.clone(), n.clone() ] ) );\r\n\t\t\tthis.faceVertexUvs[ 0 ].push( [ uvs[ v1 ].clone(), uvs[ v2 ].clone(), uvs[ v3 ].clone() ] );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tthis.computeFaceNormals();\r\n\r\n\tthis.boundingSphere = new THREE.Sphere( new THREE.Vector3(), radius );\r\n\r\n};\r\n\r\nTHREE.RingGeometry.prototype = Object.create( THREE.Geometry.prototype );\r\nTHREE.RingGeometry.prototype.constructor = THREE.RingGeometry;\r\n\r\nTHREE.RingGeometry.prototype.clone = function () {\r\n\r\n\tvar geometry = new THREE.RingGeometry(\r\n\t\tthis.parameters.innerRadius,\r\n\t\tthis.parameters.outerRadius,\r\n\t\tthis.parameters.thetaSegments,\r\n\t\tthis.parameters.phiSegments,\r\n\t\tthis.parameters.thetaStart,\r\n\t\tthis.parameters.thetaLength\r\n\t);\r\n\r\n\treturn geometry;\r\n\r\n};\r\n\r\n// File:src/extras/geometries/SphereGeometry.js\r\n\r\n/**\r\n * @author mrdoob / http://mrdoob.com/\r\n */\r\n\r\nTHREE.SphereGeometry = function ( radius, widthSegments, heightSegments, phiStart, phiLength, thetaStart, thetaLength ) {\r\n\r\n\tTHREE.Geometry.call( this );\r\n\r\n\tthis.type = 'SphereGeometry';\r\n\r\n\tthis.parameters = {\r\n\t\tradius: radius,\r\n\t\twidthSegments: widthSegments,\r\n\t\theightSegments: heightSegments,\r\n\t\tphiStart: phiStart,\r\n\t\tphiLength: phiLength,\r\n\t\tthetaStart: thetaStart,\r\n\t\tthetaLength: thetaLength\r\n\t};\r\n\r\n\tthis.fromBufferGeometry( new THREE.SphereBufferGeometry( radius, widthSegments, heightSegments, phiStart, phiLength, thetaStart, thetaLength ) );\r\n\r\n};\r\n\r\nTHREE.SphereGeometry.prototype = Object.create( THREE.Geometry.prototype );\r\nTHREE.SphereGeometry.prototype.constructor = THREE.SphereGeometry;\r\n\r\nTHREE.SphereGeometry.prototype.clone = function () {\r\n\r\n\tvar geometry = new THREE.SphereGeometry(\r\n\t\tthis.parameters.radius,\r\n\t\tthis.parameters.widthSegments,\r\n\t\tthis.parameters.heightSegments,\r\n\t\tthis.parameters.phiStart,\r\n\t\tthis.parameters.phiLength,\r\n\t\tthis.parameters.thetaStart,\r\n\t\tthis.parameters.thetaLength\r\n\t);\r\n\r\n\treturn geometry;\r\n\r\n};\r\n\r\n// File:src/extras/geometries/SphereBufferGeometry.js\r\n\r\n/**\r\n * @author benaadams / https://twitter.com/ben_a_adams\r\n * based on THREE.SphereGeometry\r\n */\r\n\r\nTHREE.SphereBufferGeometry = function ( radius, widthSegments, heightSegments, phiStart, phiLength, thetaStart, thetaLength ) {\r\n\r\n\tTHREE.BufferGeometry.call( this );\r\n\r\n\tthis.type = 'SphereBufferGeometry';\r\n\r\n\tthis.parameters = {\r\n\t\tradius: radius,\r\n\t\twidthSegments: widthSegments,\r\n\t\theightSegments: heightSegments,\r\n\t\tphiStart: phiStart,\r\n\t\tphiLength: phiLength,\r\n\t\tthetaStart: thetaStart,\r\n\t\tthetaLength: thetaLength\r\n\t};\r\n\r\n\tradius = radius || 50;\r\n\r\n\twidthSegments = Math.max( 3, Math.floor( widthSegments ) || 8 );\r\n\theightSegments = Math.max( 2, Math.floor( heightSegments ) || 6 );\r\n\r\n\tphiStart = phiStart !== undefined ? phiStart : 0;\r\n\tphiLength = phiLength !== undefined ? phiLength : Math.PI * 2;\r\n\r\n\tthetaStart = thetaStart !== undefined ? thetaStart : 0;\r\n\tthetaLength = thetaLength !== undefined ? thetaLength : Math.PI;\r\n\r\n\tvar thetaEnd = thetaStart + thetaLength;\r\n\r\n\tvar vertexCount = ( ( widthSegments + 1 ) * ( heightSegments + 1 ) );\r\n\r\n\tvar positions = new THREE.BufferAttribute( new Float32Array( vertexCount * 3 ), 3 );\r\n\tvar normals = new THREE.BufferAttribute( new Float32Array( vertexCount * 3 ), 3 );\r\n\tvar uvs = new THREE.BufferAttribute( new Float32Array( vertexCount * 2 ), 2 );\r\n\r\n\tvar index = 0, vertices = [], normal = new THREE.Vector3();\r\n\r\n\tfor ( var y = 0; y <= heightSegments; y ++ ) {\r\n\r\n\t\tvar verticesRow = [];\r\n\r\n\t\tvar v = y / heightSegments;\r\n\r\n\t\tfor ( var x = 0; x <= widthSegments; x ++ ) {\r\n\r\n\t\t\tvar u = x / widthSegments;\r\n\r\n\t\t\tvar px = - radius * Math.cos( phiStart + u * phiLength ) * Math.sin( thetaStart + v * thetaLength );\r\n\t\t\tvar py = radius * Math.cos( thetaStart + v * thetaLength );\r\n\t\t\tvar pz = radius * Math.sin( phiStart + u * phiLength ) * Math.sin( thetaStart + v * thetaLength );\r\n\r\n\t\t\tnormal.set( px, py, pz ).normalize();\r\n\r\n\t\t\tpositions.setXYZ( index, px, py, pz );\r\n\t\t\tnormals.setXYZ( index, normal.x, normal.y, normal.z );\r\n\t\t\tuvs.setXY( index, u, 1 - v );\r\n\r\n\t\t\tverticesRow.push( index );\r\n\r\n\t\t\tindex ++;\r\n\r\n\t\t}\r\n\r\n\t\tvertices.push( verticesRow );\r\n\r\n\t}\r\n\r\n\tvar indices = [];\r\n\r\n\tfor ( var y = 0; y < heightSegments; y ++ ) {\r\n\r\n\t\tfor ( var x = 0; x < widthSegments; x ++ ) {\r\n\r\n\t\t\tvar v1 = vertices[ y ][ x + 1 ];\r\n\t\t\tvar v2 = vertices[ y ][ x ];\r\n\t\t\tvar v3 = vertices[ y + 1 ][ x ];\r\n\t\t\tvar v4 = vertices[ y + 1 ][ x + 1 ];\r\n\r\n\t\t\tif ( y !== 0 || thetaStart > 0 ) indices.push( v1, v2, v4 );\r\n\t\t\tif ( y !== heightSegments - 1 || thetaEnd < Math.PI ) indices.push( v2, v3, v4 );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tthis.addIndex( new THREE.BufferAttribute( new Uint16Array( indices ), 1 ) );\r\n\tthis.addAttribute( 'position', positions );\r\n\tthis.addAttribute( 'normal', normals );\r\n\tthis.addAttribute( 'uv', uvs );\r\n\r\n\tthis.boundingSphere = new THREE.Sphere( new THREE.Vector3(), radius );\r\n\r\n};\r\n\r\nTHREE.SphereBufferGeometry.prototype = Object.create( THREE.BufferGeometry.prototype );\r\nTHREE.SphereBufferGeometry.prototype.constructor = THREE.SphereBufferGeometry;\r\n\r\nTHREE.SphereBufferGeometry.prototype.clone = function () {\r\n\r\n\tvar geometry = new THREE.SphereBufferGeometry(\r\n\t\tthis.parameters.radius,\r\n\t\tthis.parameters.widthSegments,\r\n\t\tthis.parameters.heightSegments,\r\n\t\tthis.parameters.phiStart,\r\n\t\tthis.parameters.phiLength,\r\n\t\tthis.parameters.thetaStart,\r\n\t\tthis.parameters.thetaLength\r\n\t);\r\n\r\n\tgeometry.copy( this );\r\n\r\n\treturn geometry;\r\n\r\n};\r\n\r\n// File:src/extras/geometries/TextGeometry.js\r\n\r\n/**\r\n * @author zz85 / http://www.lab4games.net/zz85/blog\r\n * @author alteredq / http://alteredqualia.com/\r\n *\r\n * For creating 3D text geometry in three.js\r\n *\r\n * Text = 3D Text\r\n *\r\n * parameters = {\r\n * size: \t\t\t, \t// size of the text\r\n * height: \t\t, \t// thickness to extrude text\r\n * curveSegments: \t,\t\t// number of points on the curves\r\n *\r\n * font: \t\t\t,\t\t// font name\r\n * weight: \t\t,\t\t// font weight (normal, bold)\r\n * style: \t\t\t,\t\t// font style (normal, italics)\r\n *\r\n * bevelEnabled:\t,\t\t\t// turn on bevel\r\n * bevelThickness: , \t\t// how deep into text bevel goes\r\n * bevelSize:\t\t, \t\t// how far from text outline is bevel\r\n * }\r\n *\r\n */\r\n\r\n/*\tUsage Examples\r\n\r\n\t// TextGeometry wrapper\r\n\r\n\tvar text3d = new TextGeometry( text, options );\r\n\r\n\t// Complete manner\r\n\r\n\tvar textShapes = THREE.FontUtils.generateShapes( text, options );\r\n\tvar text3d = new ExtrudeGeometry( textShapes, options );\r\n\r\n*/\r\n\r\n\r\nTHREE.TextGeometry = function ( text, parameters ) {\r\n\r\n\tparameters = parameters || {};\r\n\r\n\tvar textShapes = THREE.FontUtils.generateShapes( text, parameters );\r\n\r\n\t// translate parameters to ExtrudeGeometry API\r\n\r\n\tparameters.amount = parameters.height !== undefined ? parameters.height : 50;\r\n\r\n\t// defaults\r\n\r\n\tif ( parameters.bevelThickness === undefined ) parameters.bevelThickness = 10;\r\n\tif ( parameters.bevelSize === undefined ) parameters.bevelSize = 8;\r\n\tif ( parameters.bevelEnabled === undefined ) parameters.bevelEnabled = false;\r\n\r\n\tTHREE.ExtrudeGeometry.call( this, textShapes, parameters );\r\n\r\n\tthis.type = 'TextGeometry';\r\n\r\n};\r\n\r\nTHREE.TextGeometry.prototype = Object.create( THREE.ExtrudeGeometry.prototype );\r\nTHREE.TextGeometry.prototype.constructor = THREE.TextGeometry;\r\n\r\n// File:src/extras/geometries/TorusGeometry.js\r\n\r\n/**\r\n * @author oosmoxiecode\r\n * @author mrdoob / http://mrdoob.com/\r\n * based on http://code.google.com/p/away3d/source/browse/trunk/fp10/Away3DLite/src/away3dlite/primitives/Torus.as?r=2888\r\n */\r\n\r\nTHREE.TorusGeometry = function ( radius, tube, radialSegments, tubularSegments, arc ) {\r\n\r\n\tTHREE.Geometry.call( this );\r\n\r\n\tthis.type = 'TorusGeometry';\r\n\r\n\tthis.parameters = {\r\n\t\tradius: radius,\r\n\t\ttube: tube,\r\n\t\tradialSegments: radialSegments,\r\n\t\ttubularSegments: tubularSegments,\r\n\t\tarc: arc\r\n\t};\r\n\r\n\tradius = radius || 100;\r\n\ttube = tube || 40;\r\n\tradialSegments = radialSegments || 8;\r\n\ttubularSegments = tubularSegments || 6;\r\n\tarc = arc || Math.PI * 2;\r\n\r\n\tvar center = new THREE.Vector3(), uvs = [], normals = [];\r\n\r\n\tfor ( var j = 0; j <= radialSegments; j ++ ) {\r\n\r\n\t\tfor ( var i = 0; i <= tubularSegments; i ++ ) {\r\n\r\n\t\t\tvar u = i / tubularSegments * arc;\r\n\t\t\tvar v = j / radialSegments * Math.PI * 2;\r\n\r\n\t\t\tcenter.x = radius * Math.cos( u );\r\n\t\t\tcenter.y = radius * Math.sin( u );\r\n\r\n\t\t\tvar vertex = new THREE.Vector3();\r\n\t\t\tvertex.x = ( radius + tube * Math.cos( v ) ) * Math.cos( u );\r\n\t\t\tvertex.y = ( radius + tube * Math.cos( v ) ) * Math.sin( u );\r\n\t\t\tvertex.z = tube * Math.sin( v );\r\n\r\n\t\t\tthis.vertices.push( vertex );\r\n\r\n\t\t\tuvs.push( new THREE.Vector2( i / tubularSegments, j / radialSegments ) );\r\n\t\t\tnormals.push( vertex.clone().sub( center ).normalize() );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tfor ( var j = 1; j <= radialSegments; j ++ ) {\r\n\r\n\t\tfor ( var i = 1; i <= tubularSegments; i ++ ) {\r\n\r\n\t\t\tvar a = ( tubularSegments + 1 ) * j + i - 1;\r\n\t\t\tvar b = ( tubularSegments + 1 ) * ( j - 1 ) + i - 1;\r\n\t\t\tvar c = ( tubularSegments + 1 ) * ( j - 1 ) + i;\r\n\t\t\tvar d = ( tubularSegments + 1 ) * j + i;\r\n\r\n\t\t\tvar face = new THREE.Face3( a, b, d, [ normals[ a ].clone(), normals[ b ].clone(), normals[ d ].clone() ] );\r\n\t\t\tthis.faces.push( face );\r\n\t\t\tthis.faceVertexUvs[ 0 ].push( [ uvs[ a ].clone(), uvs[ b ].clone(), uvs[ d ].clone() ] );\r\n\r\n\t\t\tface = new THREE.Face3( b, c, d, [ normals[ b ].clone(), normals[ c ].clone(), normals[ d ].clone() ] );\r\n\t\t\tthis.faces.push( face );\r\n\t\t\tthis.faceVertexUvs[ 0 ].push( [ uvs[ b ].clone(), uvs[ c ].clone(), uvs[ d ].clone() ] );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tthis.computeFaceNormals();\r\n\r\n};\r\n\r\nTHREE.TorusGeometry.prototype = Object.create( THREE.Geometry.prototype );\r\nTHREE.TorusGeometry.prototype.constructor = THREE.TorusGeometry;\r\n\r\nTHREE.TorusGeometry.prototype.clone = function () {\r\n\r\n\tvar geometry = new THREE.TorusGeometry(\r\n\t\tthis.parameters.radius,\r\n\t\tthis.parameters.tube,\r\n\t\tthis.parameters.radialSegments,\r\n\t\tthis.parameters.tubularSegments,\r\n\t\tthis.parameters.arc\r\n\t);\r\n\r\n\treturn geometry;\r\n\r\n};\r\n\r\n// File:src/extras/geometries/TorusKnotGeometry.js\r\n\r\n/**\r\n * @author oosmoxiecode\r\n * based on http://code.google.com/p/away3d/source/browse/trunk/fp10/Away3D/src/away3d/primitives/TorusKnot.as?spec=svn2473&r=2473\r\n */\r\n\r\nTHREE.TorusKnotGeometry = function ( radius, tube, radialSegments, tubularSegments, p, q, heightScale ) {\r\n\r\n\tTHREE.Geometry.call( this );\r\n\r\n\tthis.type = 'TorusKnotGeometry';\r\n\r\n\tthis.parameters = {\r\n\t\tradius: radius,\r\n\t\ttube: tube,\r\n\t\tradialSegments: radialSegments,\r\n\t\ttubularSegments: tubularSegments,\r\n\t\tp: p,\r\n\t\tq: q,\r\n\t\theightScale: heightScale\r\n\t};\r\n\r\n\tradius = radius || 100;\r\n\ttube = tube || 40;\r\n\tradialSegments = radialSegments || 64;\r\n\ttubularSegments = tubularSegments || 8;\r\n\tp = p || 2;\r\n\tq = q || 3;\r\n\theightScale = heightScale || 1;\r\n\r\n\tvar grid = new Array( radialSegments );\r\n\tvar tang = new THREE.Vector3();\r\n\tvar n = new THREE.Vector3();\r\n\tvar bitan = new THREE.Vector3();\r\n\r\n\tfor ( var i = 0; i < radialSegments; ++ i ) {\r\n\r\n\t\tgrid[ i ] = new Array( tubularSegments );\r\n\t\tvar u = i / radialSegments * 2 * p * Math.PI;\r\n\t\tvar p1 = getPos( u, q, p, radius, heightScale );\r\n\t\tvar p2 = getPos( u + 0.01, q, p, radius, heightScale );\r\n\t\ttang.subVectors( p2, p1 );\r\n\t\tn.addVectors( p2, p1 );\r\n\r\n\t\tbitan.crossVectors( tang, n );\r\n\t\tn.crossVectors( bitan, tang );\r\n\t\tbitan.normalize();\r\n\t\tn.normalize();\r\n\r\n\t\tfor ( var j = 0; j < tubularSegments; ++ j ) {\r\n\r\n\t\t\tvar v = j / tubularSegments * 2 * Math.PI;\r\n\t\t\tvar cx = - tube * Math.cos( v ); // TODO: Hack: Negating it so it faces outside.\r\n\t\t\tvar cy = tube * Math.sin( v );\r\n\r\n\t\t\tvar pos = new THREE.Vector3();\r\n\t\t\tpos.x = p1.x + cx * n.x + cy * bitan.x;\r\n\t\t\tpos.y = p1.y + cx * n.y + cy * bitan.y;\r\n\t\t\tpos.z = p1.z + cx * n.z + cy * bitan.z;\r\n\r\n\t\t\tgrid[ i ][ j ] = this.vertices.push( pos ) - 1;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tfor ( var i = 0; i < radialSegments; ++ i ) {\r\n\r\n\t\tfor ( var j = 0; j < tubularSegments; ++ j ) {\r\n\r\n\t\t\tvar ip = ( i + 1 ) % radialSegments;\r\n\t\t\tvar jp = ( j + 1 ) % tubularSegments;\r\n\r\n\t\t\tvar a = grid[ i ][ j ];\r\n\t\t\tvar b = grid[ ip ][ j ];\r\n\t\t\tvar c = grid[ ip ][ jp ];\r\n\t\t\tvar d = grid[ i ][ jp ];\r\n\r\n\t\t\tvar uva = new THREE.Vector2( i / radialSegments, j / tubularSegments );\r\n\t\t\tvar uvb = new THREE.Vector2( ( i + 1 ) / radialSegments, j / tubularSegments );\r\n\t\t\tvar uvc = new THREE.Vector2( ( i + 1 ) / radialSegments, ( j + 1 ) / tubularSegments );\r\n\t\t\tvar uvd = new THREE.Vector2( i / radialSegments, ( j + 1 ) / tubularSegments );\r\n\r\n\t\t\tthis.faces.push( new THREE.Face3( a, b, d ) );\r\n\t\t\tthis.faceVertexUvs[ 0 ].push( [ uva, uvb, uvd ] );\r\n\r\n\t\t\tthis.faces.push( new THREE.Face3( b, c, d ) );\r\n\t\t\tthis.faceVertexUvs[ 0 ].push( [ uvb.clone(), uvc, uvd.clone() ] );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tthis.computeFaceNormals();\r\n\tthis.computeVertexNormals();\r\n\r\n\tfunction getPos( u, in_q, in_p, radius, heightScale ) {\r\n\r\n\t\tvar cu = Math.cos( u );\r\n\t\tvar su = Math.sin( u );\r\n\t\tvar quOverP = in_q / in_p * u;\r\n\t\tvar cs = Math.cos( quOverP );\r\n\r\n\t\tvar tx = radius * ( 2 + cs ) * 0.5 * cu;\r\n\t\tvar ty = radius * ( 2 + cs ) * su * 0.5;\r\n\t\tvar tz = heightScale * radius * Math.sin( quOverP ) * 0.5;\r\n\r\n\t\treturn new THREE.Vector3( tx, ty, tz );\r\n\r\n\t}\r\n\r\n};\r\n\r\nTHREE.TorusKnotGeometry.prototype = Object.create( THREE.Geometry.prototype );\r\nTHREE.TorusKnotGeometry.prototype.constructor = THREE.TorusKnotGeometry;\r\n\r\nTHREE.TorusKnotGeometry.prototype.clone = function () {\r\n\r\n\tvar geometry = new THREE.TorusKnotGeometry(\r\n\t\tthis.parameters.radius,\r\n\t\tthis.parameters.tube,\r\n\t\tthis.parameters.radialSegments,\r\n\t\tthis.parameters.tubularSegments,\r\n\t\tthis.parameters.p,\r\n\t\tthis.parameters.q,\r\n\t\tthis.parameters.heightScale\r\n\t);\r\n\r\n\treturn geometry;\r\n\r\n};\r\n\r\n// File:src/extras/geometries/TubeGeometry.js\r\n\r\n/**\r\n * @author WestLangley / https://github.com/WestLangley\r\n * @author zz85 / https://github.com/zz85\r\n * @author miningold / https://github.com/miningold\r\n * @author jonobr1 / https://github.com/jonobr1\r\n *\r\n * Modified from the TorusKnotGeometry by @oosmoxiecode\r\n *\r\n * Creates a tube which extrudes along a 3d spline\r\n *\r\n * Uses parallel transport frames as described in\r\n * http://www.cs.indiana.edu/pub/techreports/TR425.pdf\r\n */\r\n\r\nTHREE.TubeGeometry = function ( path, segments, radius, radialSegments, closed, taper ) {\r\n\r\n\tTHREE.Geometry.call( this );\r\n\r\n\tthis.type = 'TubeGeometry';\r\n\r\n\tthis.parameters = {\r\n\t\tpath: path,\r\n\t\tsegments: segments,\r\n\t\tradius: radius,\r\n\t\tradialSegments: radialSegments,\r\n\t\tclosed: closed\r\n\t};\r\n\r\n\tsegments = segments || 64;\r\n\tradius = radius || 1;\r\n\tradialSegments = radialSegments || 8;\r\n\tclosed = closed || false;\r\n\ttaper = taper || THREE.TubeGeometry.NoTaper;\r\n\r\n\tvar grid = [];\r\n\r\n\tvar scope = this,\r\n\r\n\t\ttangent,\r\n\t\tnormal,\r\n\t\tbinormal,\r\n\r\n\t\tnumpoints = segments + 1,\r\n\r\n\t\tu, v, r,\r\n\r\n\t\tcx, cy,\r\n\t\tpos, pos2 = new THREE.Vector3(),\r\n\t\ti, j,\r\n\t\tip, jp,\r\n\t\ta, b, c, d,\r\n\t\tuva, uvb, uvc, uvd;\r\n\r\n\tvar frames = new THREE.TubeGeometry.FrenetFrames( path, segments, closed ),\r\n\t\ttangents = frames.tangents,\r\n\t\tnormals = frames.normals,\r\n\t\tbinormals = frames.binormals;\r\n\r\n\t// proxy internals\r\n\tthis.tangents = tangents;\r\n\tthis.normals = normals;\r\n\tthis.binormals = binormals;\r\n\r\n\tfunction vert( x, y, z ) {\r\n\r\n\t\treturn scope.vertices.push( new THREE.Vector3( x, y, z ) ) - 1;\r\n\r\n\t}\r\n\r\n\t// construct the grid\r\n\r\n\tfor ( i = 0; i < numpoints; i ++ ) {\r\n\r\n\t\tgrid[ i ] = [];\r\n\r\n\t\tu = i / ( numpoints - 1 );\r\n\r\n\t\tpos = path.getPointAt( u );\r\n\r\n\t\ttangent = tangents[ i ];\r\n\t\tnormal = normals[ i ];\r\n\t\tbinormal = binormals[ i ];\r\n\r\n\t\tr = radius * taper( u );\r\n\r\n\t\tfor ( j = 0; j < radialSegments; j ++ ) {\r\n\r\n\t\t\tv = j / radialSegments * 2 * Math.PI;\r\n\r\n\t\t\tcx = - r * Math.cos( v ); // TODO: Hack: Negating it so it faces outside.\r\n\t\t\tcy = r * Math.sin( v );\r\n\r\n\t\t\tpos2.copy( pos );\r\n\t\t\tpos2.x += cx * normal.x + cy * binormal.x;\r\n\t\t\tpos2.y += cx * normal.y + cy * binormal.y;\r\n\t\t\tpos2.z += cx * normal.z + cy * binormal.z;\r\n\r\n\t\t\tgrid[ i ][ j ] = vert( pos2.x, pos2.y, pos2.z );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\r\n\t// construct the mesh\r\n\r\n\tfor ( i = 0; i < segments; i ++ ) {\r\n\r\n\t\tfor ( j = 0; j < radialSegments; j ++ ) {\r\n\r\n\t\t\tip = ( closed ) ? ( i + 1 ) % segments : i + 1;\r\n\t\t\tjp = ( j + 1 ) % radialSegments;\r\n\r\n\t\t\ta = grid[ i ][ j ];\t\t// *** NOT NECESSARILY PLANAR ! ***\r\n\t\t\tb = grid[ ip ][ j ];\r\n\t\t\tc = grid[ ip ][ jp ];\r\n\t\t\td = grid[ i ][ jp ];\r\n\r\n\t\t\tuva = new THREE.Vector2( i / segments, j / radialSegments );\r\n\t\t\tuvb = new THREE.Vector2( ( i + 1 ) / segments, j / radialSegments );\r\n\t\t\tuvc = new THREE.Vector2( ( i + 1 ) / segments, ( j + 1 ) / radialSegments );\r\n\t\t\tuvd = new THREE.Vector2( i / segments, ( j + 1 ) / radialSegments );\r\n\r\n\t\t\tthis.faces.push( new THREE.Face3( a, b, d ) );\r\n\t\t\tthis.faceVertexUvs[ 0 ].push( [ uva, uvb, uvd ] );\r\n\r\n\t\t\tthis.faces.push( new THREE.Face3( b, c, d ) );\r\n\t\t\tthis.faceVertexUvs[ 0 ].push( [ uvb.clone(), uvc, uvd.clone() ] );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tthis.computeFaceNormals();\r\n\tthis.computeVertexNormals();\r\n\r\n};\r\n\r\nTHREE.TubeGeometry.prototype = Object.create( THREE.Geometry.prototype );\r\nTHREE.TubeGeometry.prototype.constructor = THREE.TubeGeometry;\r\n\r\nTHREE.TubeGeometry.NoTaper = function ( u ) {\r\n\r\n\treturn 1;\r\n\r\n};\r\n\r\nTHREE.TubeGeometry.SinusoidalTaper = function ( u ) {\r\n\r\n\treturn Math.sin( Math.PI * u );\r\n\r\n};\r\n\r\n// For computing of Frenet frames, exposing the tangents, normals and binormals the spline\r\nTHREE.TubeGeometry.FrenetFrames = function ( path, segments, closed ) {\r\n\r\n\tvar\tnormal = new THREE.Vector3(),\r\n\r\n\t\ttangents = [],\r\n\t\tnormals = [],\r\n\t\tbinormals = [],\r\n\r\n\t\tvec = new THREE.Vector3(),\r\n\t\tmat = new THREE.Matrix4(),\r\n\r\n\t\tnumpoints = segments + 1,\r\n\t\ttheta,\r\n\t\tepsilon = 0.0001,\r\n\t\tsmallest,\r\n\r\n\t\ttx, ty, tz,\r\n\t\ti, u;\r\n\r\n\r\n\t// expose internals\r\n\tthis.tangents = tangents;\r\n\tthis.normals = normals;\r\n\tthis.binormals = binormals;\r\n\r\n\t// compute the tangent vectors for each segment on the path\r\n\r\n\tfor ( i = 0; i < numpoints; i ++ ) {\r\n\r\n\t\tu = i / ( numpoints - 1 );\r\n\r\n\t\ttangents[ i ] = path.getTangentAt( u );\r\n\t\ttangents[ i ].normalize();\r\n\r\n\t}\r\n\r\n\tinitialNormal3();\r\n\r\n\t/*\r\n\tfunction initialNormal1(lastBinormal) {\r\n\t\t// fixed start binormal. Has dangers of 0 vectors\r\n\t\tnormals[ 0 ] = new THREE.Vector3();\r\n\t\tbinormals[ 0 ] = new THREE.Vector3();\r\n\t\tif (lastBinormal===undefined) lastBinormal = new THREE.Vector3( 0, 0, 1 );\r\n\t\tnormals[ 0 ].crossVectors( lastBinormal, tangents[ 0 ] ).normalize();\r\n\t\tbinormals[ 0 ].crossVectors( tangents[ 0 ], normals[ 0 ] ).normalize();\r\n\t}\r\n\r\n\tfunction initialNormal2() {\r\n\r\n\t\t// This uses the Frenet-Serret formula for deriving binormal\r\n\t\tvar t2 = path.getTangentAt( epsilon );\r\n\r\n\t\tnormals[ 0 ] = new THREE.Vector3().subVectors( t2, tangents[ 0 ] ).normalize();\r\n\t\tbinormals[ 0 ] = new THREE.Vector3().crossVectors( tangents[ 0 ], normals[ 0 ] );\r\n\r\n\t\tnormals[ 0 ].crossVectors( binormals[ 0 ], tangents[ 0 ] ).normalize(); // last binormal x tangent\r\n\t\tbinormals[ 0 ].crossVectors( tangents[ 0 ], normals[ 0 ] ).normalize();\r\n\r\n\t}\r\n\t*/\r\n\r\n\tfunction initialNormal3() {\r\n\r\n\t\t// select an initial normal vector perpendicular to the first tangent vector,\r\n\t\t// and in the direction of the smallest tangent xyz component\r\n\r\n\t\tnormals[ 0 ] = new THREE.Vector3();\r\n\t\tbinormals[ 0 ] = new THREE.Vector3();\r\n\t\tsmallest = Number.MAX_VALUE;\r\n\t\ttx = Math.abs( tangents[ 0 ].x );\r\n\t\tty = Math.abs( tangents[ 0 ].y );\r\n\t\ttz = Math.abs( tangents[ 0 ].z );\r\n\r\n\t\tif ( tx <= smallest ) {\r\n\r\n\t\t\tsmallest = tx;\r\n\t\t\tnormal.set( 1, 0, 0 );\r\n\r\n\t\t}\r\n\r\n\t\tif ( ty <= smallest ) {\r\n\r\n\t\t\tsmallest = ty;\r\n\t\t\tnormal.set( 0, 1, 0 );\r\n\r\n\t\t}\r\n\r\n\t\tif ( tz <= smallest ) {\r\n\r\n\t\t\tnormal.set( 0, 0, 1 );\r\n\r\n\t\t}\r\n\r\n\t\tvec.crossVectors( tangents[ 0 ], normal ).normalize();\r\n\r\n\t\tnormals[ 0 ].crossVectors( tangents[ 0 ], vec );\r\n\t\tbinormals[ 0 ].crossVectors( tangents[ 0 ], normals[ 0 ] );\r\n\r\n\t}\r\n\r\n\r\n\t// compute the slowly-varying normal and binormal vectors for each segment on the path\r\n\r\n\tfor ( i = 1; i < numpoints; i ++ ) {\r\n\r\n\t\tnormals[ i ] = normals[ i - 1 ].clone();\r\n\r\n\t\tbinormals[ i ] = binormals[ i - 1 ].clone();\r\n\r\n\t\tvec.crossVectors( tangents[ i - 1 ], tangents[ i ] );\r\n\r\n\t\tif ( vec.length() > epsilon ) {\r\n\r\n\t\t\tvec.normalize();\r\n\r\n\t\t\ttheta = Math.acos( THREE.Math.clamp( tangents[ i - 1 ].dot( tangents[ i ] ), - 1, 1 ) ); // clamp for floating pt errors\r\n\r\n\t\t\tnormals[ i ].applyMatrix4( mat.makeRotationAxis( vec, theta ) );\r\n\r\n\t\t}\r\n\r\n\t\tbinormals[ i ].crossVectors( tangents[ i ], normals[ i ] );\r\n\r\n\t}\r\n\r\n\r\n\t// if the curve is closed, postprocess the vectors so the first and last normal vectors are the same\r\n\r\n\tif ( closed ) {\r\n\r\n\t\ttheta = Math.acos( THREE.Math.clamp( normals[ 0 ].dot( normals[ numpoints - 1 ] ), - 1, 1 ) );\r\n\t\ttheta /= ( numpoints - 1 );\r\n\r\n\t\tif ( tangents[ 0 ].dot( vec.crossVectors( normals[ 0 ], normals[ numpoints - 1 ] ) ) > 0 ) {\r\n\r\n\t\t\ttheta = - theta;\r\n\r\n\t\t}\r\n\r\n\t\tfor ( i = 1; i < numpoints; i ++ ) {\r\n\r\n\t\t\t// twist a little...\r\n\t\t\tnormals[ i ].applyMatrix4( mat.makeRotationAxis( tangents[ i ], theta * i ) );\r\n\t\t\tbinormals[ i ].crossVectors( tangents[ i ], normals[ i ] );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n};\r\n\r\n// File:src/extras/geometries/PolyhedronGeometry.js\r\n\r\n/**\r\n * @author clockworkgeek / https://github.com/clockworkgeek\r\n * @author timothypratley / https://github.com/timothypratley\r\n * @author WestLangley / http://github.com/WestLangley\r\n*/\r\n\r\nTHREE.PolyhedronGeometry = function ( vertices, indices, radius, detail ) {\r\n\r\n\tTHREE.Geometry.call( this );\r\n\r\n\tthis.type = 'PolyhedronGeometry';\r\n\r\n\tthis.parameters = {\r\n\t\tvertices: vertices,\r\n\t\tindices: indices,\r\n\t\tradius: radius,\r\n\t\tdetail: detail\r\n\t};\r\n\r\n\tradius = radius || 1;\r\n\tdetail = detail || 0;\r\n\r\n\tvar that = this;\r\n\r\n\tfor ( var i = 0, l = vertices.length; i < l; i += 3 ) {\r\n\r\n\t\tprepare( new THREE.Vector3( vertices[ i ], vertices[ i + 1 ], vertices[ i + 2 ] ) );\r\n\r\n\t}\r\n\r\n\tvar p = this.vertices;\r\n\r\n\tvar faces = [];\r\n\r\n\tfor ( var i = 0, j = 0, l = indices.length; i < l; i += 3, j ++ ) {\r\n\r\n\t\tvar v1 = p[ indices[ i ] ];\r\n\t\tvar v2 = p[ indices[ i + 1 ] ];\r\n\t\tvar v3 = p[ indices[ i + 2 ] ];\r\n\r\n\t\tfaces[ j ] = new THREE.Face3( v1.index, v2.index, v3.index, [ v1.clone(), v2.clone(), v3.clone() ], undefined, j );\r\n\r\n\t}\r\n\r\n\tvar centroid = new THREE.Vector3();\r\n\r\n\tfor ( var i = 0, l = faces.length; i < l; i ++ ) {\r\n\r\n\t\tsubdivide( faces[ i ], detail );\r\n\r\n\t}\r\n\r\n\r\n\t// Handle case when face straddles the seam\r\n\r\n\tfor ( var i = 0, l = this.faceVertexUvs[ 0 ].length; i < l; i ++ ) {\r\n\r\n\t\tvar uvs = this.faceVertexUvs[ 0 ][ i ];\r\n\r\n\t\tvar x0 = uvs[ 0 ].x;\r\n\t\tvar x1 = uvs[ 1 ].x;\r\n\t\tvar x2 = uvs[ 2 ].x;\r\n\r\n\t\tvar max = Math.max( x0, Math.max( x1, x2 ) );\r\n\t\tvar min = Math.min( x0, Math.min( x1, x2 ) );\r\n\r\n\t\tif ( max > 0.9 && min < 0.1 ) {\r\n\r\n\t\t\t// 0.9 is somewhat arbitrary\r\n\r\n\t\t\tif ( x0 < 0.2 ) uvs[ 0 ].x += 1;\r\n\t\t\tif ( x1 < 0.2 ) uvs[ 1 ].x += 1;\r\n\t\t\tif ( x2 < 0.2 ) uvs[ 2 ].x += 1;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\r\n\t// Apply radius\r\n\r\n\tfor ( var i = 0, l = this.vertices.length; i < l; i ++ ) {\r\n\r\n\t\tthis.vertices[ i ].multiplyScalar( radius );\r\n\r\n\t}\r\n\r\n\r\n\t// Merge vertices\r\n\r\n\tthis.mergeVertices();\r\n\r\n\tthis.computeFaceNormals();\r\n\r\n\tthis.boundingSphere = new THREE.Sphere( new THREE.Vector3(), radius );\r\n\r\n\r\n\t// Project vector onto sphere's surface\r\n\r\n\tfunction prepare( vector ) {\r\n\r\n\t\tvar vertex = vector.normalize().clone();\r\n\t\tvertex.index = that.vertices.push( vertex ) - 1;\r\n\r\n\t\t// Texture coords are equivalent to map coords, calculate angle and convert to fraction of a circle.\r\n\r\n\t\tvar u = azimuth( vector ) / 2 / Math.PI + 0.5;\r\n\t\tvar v = inclination( vector ) / Math.PI + 0.5;\r\n\t\tvertex.uv = new THREE.Vector2( u, 1 - v );\r\n\r\n\t\treturn vertex;\r\n\r\n\t}\r\n\r\n\r\n\t// Approximate a curved face with recursively sub-divided triangles.\r\n\r\n\tfunction make( v1, v2, v3, materialIndex ) {\r\n\r\n\t\tvar face = new THREE.Face3( v1.index, v2.index, v3.index, [ v1.clone(), v2.clone(), v3.clone() ], undefined, materialIndex );\r\n\t\tthat.faces.push( face );\r\n\r\n\t\tcentroid.copy( v1 ).add( v2 ).add( v3 ).divideScalar( 3 );\r\n\r\n\t\tvar azi = azimuth( centroid );\r\n\r\n\t\tthat.faceVertexUvs[ 0 ].push( [\r\n\t\t\tcorrectUV( v1.uv, v1, azi ),\r\n\t\t\tcorrectUV( v2.uv, v2, azi ),\r\n\t\t\tcorrectUV( v3.uv, v3, azi )\r\n\t\t] );\r\n\r\n\t}\r\n\r\n\r\n\t// Analytically subdivide a face to the required detail level.\r\n\r\n\tfunction subdivide( face, detail ) {\r\n\r\n\t\tvar cols = Math.pow( 2, detail );\r\n\t\tvar a = prepare( that.vertices[ face.a ] );\r\n\t\tvar b = prepare( that.vertices[ face.b ] );\r\n\t\tvar c = prepare( that.vertices[ face.c ] );\r\n\t\tvar v = [];\r\n\r\n\t\tvar materialIndex = face.materialIndex;\r\n\r\n\t\t// Construct all of the vertices for this subdivision.\r\n\r\n\t\tfor ( var i = 0 ; i <= cols; i ++ ) {\r\n\r\n\t\t\tv[ i ] = [];\r\n\r\n\t\t\tvar aj = prepare( a.clone().lerp( c, i / cols ) );\r\n\t\t\tvar bj = prepare( b.clone().lerp( c, i / cols ) );\r\n\t\t\tvar rows = cols - i;\r\n\r\n\t\t\tfor ( var j = 0; j <= rows; j ++ ) {\r\n\r\n\t\t\t\tif ( j === 0 && i === cols ) {\r\n\r\n\t\t\t\t\tv[ i ][ j ] = aj;\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\tv[ i ][ j ] = prepare( aj.clone().lerp( bj, j / rows ) );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\t// Construct all of the faces.\r\n\r\n\t\tfor ( var i = 0; i < cols ; i ++ ) {\r\n\r\n\t\t\tfor ( var j = 0; j < 2 * ( cols - i ) - 1; j ++ ) {\r\n\r\n\t\t\t\tvar k = Math.floor( j / 2 );\r\n\r\n\t\t\t\tif ( j % 2 === 0 ) {\r\n\r\n\t\t\t\t\tmake(\r\n\t\t\t\t\t\tv[ i ][ k + 1 ],\r\n\t\t\t\t\t\tv[ i + 1 ][ k ],\r\n\t\t\t\t\t\tv[ i ][ k ],\r\n\t\t\t\t\t\tmaterialIndex\r\n\t\t\t\t\t);\r\n\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\tmake(\r\n\t\t\t\t\t\tv[ i ][ k + 1 ],\r\n\t\t\t\t\t\tv[ i + 1 ][ k + 1 ],\r\n\t\t\t\t\t\tv[ i + 1 ][ k ],\r\n\t\t\t\t\t\tmaterialIndex\r\n\t\t\t\t\t);\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\r\n\t// Angle around the Y axis, counter-clockwise when looking from above.\r\n\r\n\tfunction azimuth( vector ) {\r\n\r\n\t\treturn Math.atan2( vector.z, - vector.x );\r\n\r\n\t}\r\n\r\n\r\n\t// Angle above the XZ plane.\r\n\r\n\tfunction inclination( vector ) {\r\n\r\n\t\treturn Math.atan2( - vector.y, Math.sqrt( ( vector.x * vector.x ) + ( vector.z * vector.z ) ) );\r\n\r\n\t}\r\n\r\n\r\n\t// Texture fixing helper. Spheres have some odd behaviours.\r\n\r\n\tfunction correctUV( uv, vector, azimuth ) {\r\n\r\n\t\tif ( ( azimuth < 0 ) && ( uv.x === 1 ) ) uv = new THREE.Vector2( uv.x - 1, uv.y );\r\n\t\tif ( ( vector.x === 0 ) && ( vector.z === 0 ) ) uv = new THREE.Vector2( azimuth / 2 / Math.PI + 0.5, uv.y );\r\n\t\treturn uv.clone();\r\n\r\n\t}\r\n\r\n\r\n};\r\n\r\nTHREE.PolyhedronGeometry.prototype = Object.create( THREE.Geometry.prototype );\r\nTHREE.PolyhedronGeometry.prototype.constructor = THREE.PolyhedronGeometry;\r\n\r\nTHREE.PolyhedronGeometry.prototype.clone = function () {\r\n\r\n\tvar geometry = new THREE.PolyhedronGeometry(\r\n\t\tthis.parameters.vertices,\r\n\t\tthis.parameters.indices,\r\n\t\tthis.parameters.radius,\r\n\t\tthis.parameters.detail\r\n\t);\r\n\r\n\treturn geometry.copy( this );\r\n\r\n};\r\n\r\nTHREE.PolyhedronGeometry.prototype.copy = function ( source ) {\r\n\r\n\tTHREE.Geometry.prototype.copy.call( this, source );\r\n\treturn this;\r\n\r\n};\r\n\r\n// File:src/extras/geometries/DodecahedronGeometry.js\r\n\r\n/**\r\n * @author Abe Pazos / https://hamoid.com\r\n */\r\n\r\nTHREE.DodecahedronGeometry = function ( radius, detail ) {\r\n\r\n\tvar t = ( 1 + Math.sqrt( 5 ) ) / 2;\r\n\tvar r = 1 / t;\r\n\r\n\tvar vertices = [\r\n\r\n\t\t// (Ā±1, Ā±1, Ā±1)\r\n\t\t- 1, - 1, - 1, - 1, - 1, 1,\r\n\t\t- 1, 1, - 1, - 1, 1, 1,\r\n\t\t 1, - 1, - 1, 1, - 1, 1,\r\n\t\t 1, 1, - 1, 1, 1, 1,\r\n\r\n\t\t// (0, Ā±1/Ļ†, Ā±Ļ†)\r\n\t\t 0, - r, - t, 0, - r, t,\r\n\t\t 0, r, - t, 0, r, t,\r\n\r\n\t\t// (Ā±1/Ļ†, Ā±Ļ†, 0)\r\n\t\t- r, - t, 0, - r, t, 0,\r\n\t\t r, - t, 0, r, t, 0,\r\n\r\n\t\t// (Ā±Ļ†, 0, Ā±1/Ļ†)\r\n\t\t- t, 0, - r, t, 0, - r,\r\n\t\t- t, 0, r, t, 0, r\r\n\t];\r\n\r\n\tvar indices = [\r\n\t\t 3, 11, 7, 3, 7, 15, 3, 15, 13,\r\n\t\t 7, 19, 17, 7, 17, 6, 7, 6, 15,\r\n\t\t17, 4, 8, 17, 8, 10, 17, 10, 6,\r\n\t\t 8, 0, 16, 8, 16, 2, 8, 2, 10,\r\n\t\t 0, 12, 1, 0, 1, 18, 0, 18, 16,\r\n\t\t 6, 10, 2, 6, 2, 13, 6, 13, 15,\r\n\t\t 2, 16, 18, 2, 18, 3, 2, 3, 13,\r\n\t\t18, 1, 9, 18, 9, 11, 18, 11, 3,\r\n\t\t 4, 14, 12, 4, 12, 0, 4, 0, 8,\r\n\t\t11, 9, 5, 11, 5, 19, 11, 19, 7,\r\n\t\t19, 5, 14, 19, 14, 4, 19, 4, 17,\r\n\t\t 1, 12, 14, 1, 14, 5, 1, 5, 9\r\n\t];\r\n\r\n\tTHREE.PolyhedronGeometry.call( this, vertices, indices, radius, detail );\r\n\r\n\tthis.type = 'DodecahedronGeometry';\r\n\r\n\tthis.parameters = {\r\n\t\tradius: radius,\r\n\t\tdetail: detail\r\n\t};\r\n\r\n};\r\n\r\nTHREE.DodecahedronGeometry.prototype = Object.create( THREE.PolyhedronGeometry.prototype );\r\nTHREE.DodecahedronGeometry.prototype.constructor = THREE.DodecahedronGeometry;\r\n\r\nTHREE.DodecahedronGeometry.prototype.clone = function () {\r\n\r\n\tvar geometry = new THREE.DodecahedronGeometry(\r\n\t\tthis.parameters.radius,\r\n\t\tthis.parameters.detail\r\n\t);\r\n\r\n\tgeometry.copy( this );\r\n\r\n\treturn geometry;\r\n\r\n};\r\n\r\n// File:src/extras/geometries/IcosahedronGeometry.js\r\n\r\n/**\r\n * @author timothypratley / https://github.com/timothypratley\r\n */\r\n\r\nTHREE.IcosahedronGeometry = function ( radius, detail ) {\r\n\r\n\tvar t = ( 1 + Math.sqrt( 5 ) ) / 2;\r\n\r\n\tvar vertices = [\r\n\t\t- 1, t, 0, 1, t, 0, - 1, - t, 0, 1, - t, 0,\r\n\t\t 0, - 1, t, 0, 1, t, 0, - 1, - t, 0, 1, - t,\r\n\t\t t, 0, - 1, t, 0, 1, - t, 0, - 1, - t, 0, 1\r\n\t];\r\n\r\n\tvar indices = [\r\n\t\t 0, 11, 5, 0, 5, 1, 0, 1, 7, 0, 7, 10, 0, 10, 11,\r\n\t\t 1, 5, 9, 5, 11, 4, 11, 10, 2, 10, 7, 6, 7, 1, 8,\r\n\t\t 3, 9, 4, 3, 4, 2, 3, 2, 6, 3, 6, 8, 3, 8, 9,\r\n\t\t 4, 9, 5, 2, 4, 11, 6, 2, 10, 8, 6, 7, 9, 8, 1\r\n\t];\r\n\r\n\tTHREE.PolyhedronGeometry.call( this, vertices, indices, radius, detail );\r\n\r\n\tthis.type = 'IcosahedronGeometry';\r\n\r\n\tthis.parameters = {\r\n\t\tradius: radius,\r\n\t\tdetail: detail\r\n\t};\r\n\r\n};\r\n\r\nTHREE.IcosahedronGeometry.prototype = Object.create( THREE.PolyhedronGeometry.prototype );\r\nTHREE.IcosahedronGeometry.prototype.constructor = THREE.IcosahedronGeometry;\r\n\r\nTHREE.IcosahedronGeometry.prototype.clone = function () {\r\n\r\n\tvar geometry = new THREE.IcosahedronGeometry(\r\n\t\tthis.parameters.radius,\r\n\t\tthis.parameters.detail\r\n\t);\r\n\r\n\tgeometry.copy( this );\r\n\r\n\treturn geometry;\r\n\r\n};\r\n\r\n// File:src/extras/geometries/OctahedronGeometry.js\r\n\r\n/**\r\n * @author timothypratley / https://github.com/timothypratley\r\n */\r\n\r\nTHREE.OctahedronGeometry = function ( radius, detail ) {\r\n\r\n\tvar vertices = [\r\n\t\t1, 0, 0, - 1, 0, 0, 0, 1, 0, 0, - 1, 0, 0, 0, 1, 0, 0, - 1\r\n\t];\r\n\r\n\tvar indices = [\r\n\t\t0, 2, 4, 0, 4, 3, 0, 3, 5, 0, 5, 2, 1, 2, 5, 1, 5, 3, 1, 3, 4, 1, 4, 2\r\n\t];\r\n\r\n\tTHREE.PolyhedronGeometry.call( this, vertices, indices, radius, detail );\r\n\r\n\tthis.type = 'OctahedronGeometry';\r\n\r\n\tthis.parameters = {\r\n\t\tradius: radius,\r\n\t\tdetail: detail\r\n\t};\r\n\r\n};\r\n\r\nTHREE.OctahedronGeometry.prototype = Object.create( THREE.PolyhedronGeometry.prototype );\r\nTHREE.OctahedronGeometry.prototype.constructor = THREE.OctahedronGeometry;\r\n\r\nTHREE.OctahedronGeometry.prototype.clone = function () {\r\n\r\n\tvar geometry = new THREE.OctahedronGeometry(\r\n\t\tthis.parameters.radius,\r\n\t\tthis.parameters.detail\r\n\t);\r\n\r\n\tgeometry.copy( this );\r\n\r\n\treturn geometry;\r\n\r\n};\r\n\r\n// File:src/extras/geometries/TetrahedronGeometry.js\r\n\r\n/**\r\n * @author timothypratley / https://github.com/timothypratley\r\n */\r\n\r\nTHREE.TetrahedronGeometry = function ( radius, detail ) {\r\n\r\n\tvar vertices = [\r\n\t\t 1, 1, 1, - 1, - 1, 1, - 1, 1, - 1, 1, - 1, - 1\r\n\t];\r\n\r\n\tvar indices = [\r\n\t\t 2, 1, 0, 0, 3, 2, 1, 3, 0, 2, 3, 1\r\n\t];\r\n\r\n\tTHREE.PolyhedronGeometry.call( this, vertices, indices, radius, detail );\r\n\r\n\tthis.type = 'TetrahedronGeometry';\r\n\r\n\tthis.parameters = {\r\n\t\tradius: radius,\r\n\t\tdetail: detail\r\n\t};\r\n\r\n};\r\n\r\nTHREE.TetrahedronGeometry.prototype = Object.create( THREE.PolyhedronGeometry.prototype );\r\nTHREE.TetrahedronGeometry.prototype.constructor = THREE.TetrahedronGeometry;\r\n\r\nTHREE.TetrahedronGeometry.prototype.clone = function () {\r\n\r\n\tvar geometry = new THREE.TetrahedronGeometry(\r\n\t\tthis.parameters.radius,\r\n\t\tthis.parameters.detail\r\n\t);\r\n\r\n\tgeometry.copy( this );\r\n\r\n\treturn geometry;\r\n\r\n};\r\n\r\n// File:src/extras/geometries/ParametricGeometry.js\r\n\r\n/**\r\n * @author zz85 / https://github.com/zz85\r\n * Parametric Surfaces Geometry\r\n * based on the brilliant article by @prideout http://prideout.net/blog/?p=44\r\n *\r\n * new THREE.ParametricGeometry( parametricFunction, uSegments, ySegements );\r\n *\r\n */\r\n\r\nTHREE.ParametricGeometry = function ( func, slices, stacks ) {\r\n\r\n\tTHREE.Geometry.call( this );\r\n\r\n\tthis.type = 'ParametricGeometry';\r\n\r\n\tthis.parameters = {\r\n\t\tfunc: func,\r\n\t\tslices: slices,\r\n\t\tstacks: stacks\r\n\t};\r\n\r\n\tvar verts = this.vertices;\r\n\tvar faces = this.faces;\r\n\tvar uvs = this.faceVertexUvs[ 0 ];\r\n\r\n\tvar i, j, p;\r\n\tvar u, v;\r\n\r\n\tvar sliceCount = slices + 1;\r\n\r\n\tfor ( i = 0; i <= stacks; i ++ ) {\r\n\r\n\t\tv = i / stacks;\r\n\r\n\t\tfor ( j = 0; j <= slices; j ++ ) {\r\n\r\n\t\t\tu = j / slices;\r\n\r\n\t\t\tp = func( u, v );\r\n\t\t\tverts.push( p );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tvar a, b, c, d;\r\n\tvar uva, uvb, uvc, uvd;\r\n\r\n\tfor ( i = 0; i < stacks; i ++ ) {\r\n\r\n\t\tfor ( j = 0; j < slices; j ++ ) {\r\n\r\n\t\t\ta = i * sliceCount + j;\r\n\t\t\tb = i * sliceCount + j + 1;\r\n\t\t\tc = ( i + 1 ) * sliceCount + j + 1;\r\n\t\t\td = ( i + 1 ) * sliceCount + j;\r\n\r\n\t\t\tuva = new THREE.Vector2( j / slices, i / stacks );\r\n\t\t\tuvb = new THREE.Vector2( ( j + 1 ) / slices, i / stacks );\r\n\t\t\tuvc = new THREE.Vector2( ( j + 1 ) / slices, ( i + 1 ) / stacks );\r\n\t\t\tuvd = new THREE.Vector2( j / slices, ( i + 1 ) / stacks );\r\n\r\n\t\t\tfaces.push( new THREE.Face3( a, b, d ) );\r\n\t\t\tuvs.push( [ uva, uvb, uvd ] );\r\n\r\n\t\t\tfaces.push( new THREE.Face3( b, c, d ) );\r\n\t\t\tuvs.push( [ uvb.clone(), uvc, uvd.clone() ] );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\t// console.log(this);\r\n\r\n\t// magic bullet\r\n\t// var diff = this.mergeVertices();\r\n\t// console.log('removed ', diff, ' vertices by merging');\r\n\r\n\tthis.computeFaceNormals();\r\n\tthis.computeVertexNormals();\r\n\r\n};\r\n\r\nTHREE.ParametricGeometry.prototype = Object.create( THREE.Geometry.prototype );\r\nTHREE.ParametricGeometry.prototype.constructor = THREE.ParametricGeometry;\r\n\r\n// File:src/extras/geometries/WireframeGeometry.js\r\n\r\n/**\r\n * @author mrdoob / http://mrdoob.com/\r\n */\r\n\r\nTHREE.WireframeGeometry = function ( geometry ) {\r\n\r\n\tTHREE.BufferGeometry.call( this );\r\n\r\n\tvar edge = [ 0, 0 ], hash = {};\r\n\tvar sortFunction = function ( a, b ) {\r\n\r\n\t\treturn a - b;\r\n\r\n\t};\r\n\r\n\tvar keys = [ 'a', 'b', 'c' ];\r\n\r\n\tif ( geometry instanceof THREE.Geometry ) {\r\n\r\n\t\tvar vertices = geometry.vertices;\r\n\t\tvar faces = geometry.faces;\r\n\t\tvar numEdges = 0;\r\n\r\n\t\t// allocate maximal size\r\n\t\tvar edges = new Uint32Array( 6 * faces.length );\r\n\r\n\t\tfor ( var i = 0, l = faces.length; i < l; i ++ ) {\r\n\r\n\t\t\tvar face = faces[ i ];\r\n\r\n\t\t\tfor ( var j = 0; j < 3; j ++ ) {\r\n\r\n\t\t\t\tedge[ 0 ] = face[ keys[ j ] ];\r\n\t\t\t\tedge[ 1 ] = face[ keys[ ( j + 1 ) % 3 ] ];\r\n\t\t\t\tedge.sort( sortFunction );\r\n\r\n\t\t\t\tvar key = edge.toString();\r\n\r\n\t\t\t\tif ( hash[ key ] === undefined ) {\r\n\r\n\t\t\t\t\tedges[ 2 * numEdges ] = edge[ 0 ];\r\n\t\t\t\t\tedges[ 2 * numEdges + 1 ] = edge[ 1 ];\r\n\t\t\t\t\thash[ key ] = true;\r\n\t\t\t\t\tnumEdges ++;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tvar coords = new Float32Array( numEdges * 2 * 3 );\r\n\r\n\t\tfor ( var i = 0, l = numEdges; i < l; i ++ ) {\r\n\r\n\t\t\tfor ( var j = 0; j < 2; j ++ ) {\r\n\r\n\t\t\t\tvar vertex = vertices[ edges [ 2 * i + j ] ];\r\n\r\n\t\t\t\tvar index = 6 * i + 3 * j;\r\n\t\t\t\tcoords[ index + 0 ] = vertex.x;\r\n\t\t\t\tcoords[ index + 1 ] = vertex.y;\r\n\t\t\t\tcoords[ index + 2 ] = vertex.z;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tthis.addAttribute( 'position', new THREE.BufferAttribute( coords, 3 ) );\r\n\r\n\t} else if ( geometry instanceof THREE.BufferGeometry ) {\r\n\r\n\t\tif ( geometry.index !== null ) {\r\n\r\n\t\t\t// Indexed BufferGeometry\r\n\r\n\t\t\tvar indices = geometry.index.array;\r\n\t\t\tvar vertices = geometry.attributes.position;\r\n\t\t\tvar drawcalls = geometry.drawcalls;\r\n\t\t\tvar numEdges = 0;\r\n\r\n\t\t\tif ( drawcalls.length === 0 ) {\r\n\r\n\t\t\t\tgeometry.addDrawCall( 0, indices.length );\r\n\r\n\t\t\t}\r\n\r\n\t\t\t// allocate maximal size\r\n\t\t\tvar edges = new Uint32Array( 2 * indices.length );\r\n\r\n\t\t\tfor ( var o = 0, ol = drawcalls.length; o < ol; ++ o ) {\r\n\r\n\t\t\t\tvar drawcall = drawcalls[ o ];\r\n\r\n\t\t\t\tvar start = drawcall.start;\r\n\t\t\t\tvar count = drawcall.count;\r\n\r\n\t\t\t\tfor ( var i = start, il = start + count; i < il; i += 3 ) {\r\n\r\n\t\t\t\t\tfor ( var j = 0; j < 3; j ++ ) {\r\n\r\n\t\t\t\t\t\tedge[ 0 ] = indices[ i + j ];\r\n\t\t\t\t\t\tedge[ 1 ] = indices[ i + ( j + 1 ) % 3 ];\r\n\t\t\t\t\t\tedge.sort( sortFunction );\r\n\r\n\t\t\t\t\t\tvar key = edge.toString();\r\n\r\n\t\t\t\t\t\tif ( hash[ key ] === undefined ) {\r\n\r\n\t\t\t\t\t\t\tedges[ 2 * numEdges ] = edge[ 0 ];\r\n\t\t\t\t\t\t\tedges[ 2 * numEdges + 1 ] = edge[ 1 ];\r\n\t\t\t\t\t\t\thash[ key ] = true;\r\n\t\t\t\t\t\t\tnumEdges ++;\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\tvar coords = new Float32Array( numEdges * 2 * 3 );\r\n\r\n\t\t\tfor ( var i = 0, l = numEdges; i < l; i ++ ) {\r\n\r\n\t\t\t\tfor ( var j = 0; j < 2; j ++ ) {\r\n\r\n\t\t\t\t\tvar index = 6 * i + 3 * j;\r\n\t\t\t\t\tvar index2 = edges[ 2 * i + j ];\r\n\r\n\t\t\t\t\tcoords[ index + 0 ] = vertices.getX( index2 );\r\n\t\t\t\t\tcoords[ index + 1 ] = vertices.getY( index2 );\r\n\t\t\t\t\tcoords[ index + 2 ] = vertices.getZ( index2 );\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\tthis.addAttribute( 'position', new THREE.BufferAttribute( coords, 3 ) );\r\n\r\n\t\t} else {\r\n\r\n\t\t\t// non-indexed BufferGeometry\r\n\r\n\t\t\tvar vertices = geometry.attributes.position.array;\r\n\t\t\tvar numEdges = vertices.length / 3;\r\n\t\t\tvar numTris = numEdges / 3;\r\n\r\n\t\t\tvar coords = new Float32Array( numEdges * 2 * 3 );\r\n\r\n\t\t\tfor ( var i = 0, l = numTris; i < l; i ++ ) {\r\n\r\n\t\t\t\tfor ( var j = 0; j < 3; j ++ ) {\r\n\r\n\t\t\t\t\tvar index = 18 * i + 6 * j;\r\n\r\n\t\t\t\t\tvar index1 = 9 * i + 3 * j;\r\n\t\t\t\t\tcoords[ index + 0 ] = vertices[ index1 ];\r\n\t\t\t\t\tcoords[ index + 1 ] = vertices[ index1 + 1 ];\r\n\t\t\t\t\tcoords[ index + 2 ] = vertices[ index1 + 2 ];\r\n\r\n\t\t\t\t\tvar index2 = 9 * i + 3 * ( ( j + 1 ) % 3 );\r\n\t\t\t\t\tcoords[ index + 3 ] = vertices[ index2 ];\r\n\t\t\t\t\tcoords[ index + 4 ] = vertices[ index2 + 1 ];\r\n\t\t\t\t\tcoords[ index + 5 ] = vertices[ index2 + 2 ];\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\tthis.addAttribute( 'position', new THREE.BufferAttribute( coords, 3 ) );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n};\r\n\r\nTHREE.WireframeGeometry.prototype = Object.create( THREE.BufferGeometry.prototype );\r\nTHREE.WireframeGeometry.prototype.constructor = THREE.WireframeGeometry;\r\n\r\n// File:src/extras/helpers/AxisHelper.js\r\n\r\n/**\r\n * @author sroucheray / http://sroucheray.org/\r\n * @author mrdoob / http://mrdoob.com/\r\n */\r\n\r\nTHREE.AxisHelper = function ( size ) {\r\n\r\n\tsize = size || 1;\r\n\r\n\tvar vertices = new Float32Array( [\r\n\t\t0, 0, 0, size, 0, 0,\r\n\t\t0, 0, 0, 0, size, 0,\r\n\t\t0, 0, 0, 0, 0, size\r\n\t] );\r\n\r\n\tvar colors = new Float32Array( [\r\n\t\t1, 0, 0, 1, 0.6, 0,\r\n\t\t0, 1, 0, 0.6, 1, 0,\r\n\t\t0, 0, 1, 0, 0.6, 1\r\n\t] );\r\n\r\n\tvar geometry = new THREE.BufferGeometry();\r\n\tgeometry.addAttribute( 'position', new THREE.BufferAttribute( vertices, 3 ) );\r\n\tgeometry.addAttribute( 'color', new THREE.BufferAttribute( colors, 3 ) );\r\n\r\n\tvar material = new THREE.LineBasicMaterial( { vertexColors: THREE.VertexColors } );\r\n\r\n\tTHREE.LineSegments.call( this, geometry, material );\r\n\r\n};\r\n\r\nTHREE.AxisHelper.prototype = Object.create( THREE.LineSegments.prototype );\r\nTHREE.AxisHelper.prototype.constructor = THREE.AxisHelper;\r\n\r\n// File:src/extras/helpers/ArrowHelper.js\r\n\r\n/**\r\n * @author WestLangley / http://github.com/WestLangley\r\n * @author zz85 / http://github.com/zz85\r\n * @author bhouston / http://exocortex.com\r\n *\r\n * Creates an arrow for visualizing directions\r\n *\r\n * Parameters:\r\n * dir - Vector3\r\n * origin - Vector3\r\n * length - Number\r\n * color - color in hex value\r\n * headLength - Number\r\n * headWidth - Number\r\n */\r\n\r\nTHREE.ArrowHelper = ( function () {\r\n\r\n\tvar lineGeometry = new THREE.Geometry();\r\n\tlineGeometry.vertices.push( new THREE.Vector3( 0, 0, 0 ), new THREE.Vector3( 0, 1, 0 ) );\r\n\r\n\tvar coneGeometry = new THREE.CylinderGeometry( 0, 0.5, 1, 5, 1 );\r\n\tconeGeometry.translate( 0, - 0.5, 0 );\r\n\r\n\treturn function ArrowHelper( dir, origin, length, color, headLength, headWidth ) {\r\n\r\n\t\t// dir is assumed to be normalized\r\n\r\n\t\tTHREE.Object3D.call( this );\r\n\r\n\t\tif ( color === undefined ) color = 0xffff00;\r\n\t\tif ( length === undefined ) length = 1;\r\n\t\tif ( headLength === undefined ) headLength = 0.2 * length;\r\n\t\tif ( headWidth === undefined ) headWidth = 0.2 * headLength;\r\n\r\n\t\tthis.position.copy( origin );\r\n\t\t\r\n\t\tif ( headLength < length ) {\r\n\t\t\tthis.line = new THREE.Line( lineGeometry, new THREE.LineBasicMaterial( { color: color } ) );\r\n\t\t\tthis.line.matrixAutoUpdate = false;\r\n\t\t\tthis.add( this.line );\r\n\t\t}\r\n\r\n\t\tthis.cone = new THREE.Mesh( coneGeometry, new THREE.MeshBasicMaterial( { color: color } ) );\r\n\t\tthis.cone.matrixAutoUpdate = false;\r\n\t\tthis.add( this.cone );\r\n\r\n\t\tthis.setDirection( dir );\r\n\t\tthis.setLength( length, headLength, headWidth );\r\n\r\n\t}\r\n\r\n}() );\r\n\r\nTHREE.ArrowHelper.prototype = Object.create( THREE.Object3D.prototype );\r\nTHREE.ArrowHelper.prototype.constructor = THREE.ArrowHelper;\r\n\r\nTHREE.ArrowHelper.prototype.setDirection = ( function () {\r\n\r\n\tvar axis = new THREE.Vector3();\r\n\tvar radians;\r\n\r\n\treturn function setDirection( dir ) {\r\n\r\n\t\t// dir is assumed to be normalized\r\n\r\n\t\tif ( dir.y > 0.99999 ) {\r\n\r\n\t\t\tthis.quaternion.set( 0, 0, 0, 1 );\r\n\r\n\t\t} else if ( dir.y < - 0.99999 ) {\r\n\r\n\t\t\tthis.quaternion.set( 1, 0, 0, 0 );\r\n\r\n\t\t} else {\r\n\r\n\t\t\taxis.set( dir.z, 0, - dir.x ).normalize();\r\n\r\n\t\t\tradians = Math.acos( dir.y );\r\n\r\n\t\t\tthis.quaternion.setFromAxisAngle( axis, radians );\r\n\r\n\t\t}\r\n\r\n\t};\r\n\r\n}() );\r\n\r\nTHREE.ArrowHelper.prototype.setLength = function ( length, headLength, headWidth ) {\r\n\r\n\tif ( headLength === undefined ) headLength = 0.2 * length;\r\n\tif ( headWidth === undefined ) headWidth = 0.2 * headLength;\r\n\r\n\tif ( headLength < length ){\r\n\t\tthis.line.scale.set( 1, length - headLength, 1 );\r\n\t\tthis.line.updateMatrix();\r\n\t}\r\n\r\n\tthis.cone.scale.set( headWidth, headLength, headWidth );\r\n\tthis.cone.position.y = length;\r\n\tthis.cone.updateMatrix();\r\n\r\n};\r\n\r\nTHREE.ArrowHelper.prototype.setColor = function ( color ) {\r\n\r\n\tif ( this.line !== undefined ) this.line.material.color.set( color );\r\n\tthis.cone.material.color.set( color );\r\n\r\n};\r\n\r\n// File:src/extras/helpers/BoxHelper.js\r\n\r\n/**\r\n * @author mrdoob / http://mrdoob.com/\r\n */\r\n\r\nTHREE.BoxHelper = function ( object ) {\r\n\r\n\tvar indices = new Uint16Array( [ 0, 1, 1, 2, 2, 3, 3, 0, 4, 5, 5, 6, 6, 7, 7, 4, 0, 4, 1, 5, 2, 6, 3, 7 ] );\r\n\tvar positions = new Float32Array( 8 * 3 );\r\n\r\n\tvar geometry = new THREE.BufferGeometry();\r\n\tgeometry.addIndex( new THREE.BufferAttribute( indices, 1 ) );\r\n\tgeometry.addAttribute( 'position', new THREE.BufferAttribute( positions, 3 ) );\r\n\r\n\tTHREE.LineSegments.call( this, geometry, new THREE.LineBasicMaterial( { color: 0xffff00 } ) );\r\n\r\n\tif ( object !== undefined ) {\r\n\r\n\t\tthis.update( object );\r\n\r\n\t}\r\n\r\n};\r\n\r\nTHREE.BoxHelper.prototype = Object.create( THREE.LineSegments.prototype );\r\nTHREE.BoxHelper.prototype.constructor = THREE.BoxHelper;\r\n\r\nTHREE.BoxHelper.prototype.update = ( function () {\r\n\r\n\tvar box = new THREE.Box3();\r\n\r\n\treturn function ( object ) {\r\n\r\n\t\tbox.setFromObject( object );\r\n\r\n\t\tif ( box.empty() ) return;\r\n\r\n\t\tvar min = box.min;\r\n\t\tvar max = box.max;\r\n\r\n\t\t/*\r\n\t\t 5____4\r\n\t\t1/___0/|\r\n\t\t| 6__|_7\r\n\t\t2/___3/\r\n\r\n\t\t0: max.x, max.y, max.z\r\n\t\t1: min.x, max.y, max.z\r\n\t\t2: min.x, min.y, max.z\r\n\t\t3: max.x, min.y, max.z\r\n\t\t4: max.x, max.y, min.z\r\n\t\t5: min.x, max.y, min.z\r\n\t\t6: min.x, min.y, min.z\r\n\t\t7: max.x, min.y, min.z\r\n\t\t*/\r\n\r\n\t\tvar position = this.geometry.attributes.position;\r\n\t\tvar array = position.array;\r\n\r\n\t\tarray[ 0 ] = max.x; array[ 1 ] = max.y; array[ 2 ] = max.z;\r\n\t\tarray[ 3 ] = min.x; array[ 4 ] = max.y; array[ 5 ] = max.z;\r\n\t\tarray[ 6 ] = min.x; array[ 7 ] = min.y; array[ 8 ] = max.z;\r\n\t\tarray[ 9 ] = max.x; array[ 10 ] = min.y; array[ 11 ] = max.z;\r\n\t\tarray[ 12 ] = max.x; array[ 13 ] = max.y; array[ 14 ] = min.z;\r\n\t\tarray[ 15 ] = min.x; array[ 16 ] = max.y; array[ 17 ] = min.z;\r\n\t\tarray[ 18 ] = min.x; array[ 19 ] = min.y; array[ 20 ] = min.z;\r\n\t\tarray[ 21 ] = max.x; array[ 22 ] = min.y; array[ 23 ] = min.z;\r\n\r\n\t\tposition.needsUpdate = true;\r\n\r\n\t\tthis.geometry.computeBoundingSphere();\r\n\r\n\t}\r\n\r\n} )();\r\n\r\n// File:src/extras/helpers/BoundingBoxHelper.js\r\n\r\n/**\r\n * @author WestLangley / http://github.com/WestLangley\r\n */\r\n\r\n// a helper to show the world-axis-aligned bounding box for an object\r\n\r\nTHREE.BoundingBoxHelper = function ( object, hex ) {\r\n\r\n\tvar color = ( hex !== undefined ) ? hex : 0x888888;\r\n\r\n\tthis.object = object;\r\n\r\n\tthis.box = new THREE.Box3();\r\n\r\n\tTHREE.Mesh.call( this, new THREE.BoxGeometry( 1, 1, 1 ), new THREE.MeshBasicMaterial( { color: color, wireframe: true } ) );\r\n\r\n};\r\n\r\nTHREE.BoundingBoxHelper.prototype = Object.create( THREE.Mesh.prototype );\r\nTHREE.BoundingBoxHelper.prototype.constructor = THREE.BoundingBoxHelper;\r\n\r\nTHREE.BoundingBoxHelper.prototype.update = function () {\r\n\r\n\tthis.box.setFromObject( this.object );\r\n\r\n\tthis.box.size( this.scale );\r\n\r\n\tthis.box.center( this.position );\r\n\r\n};\r\n\r\n// File:src/extras/helpers/CameraHelper.js\r\n\r\n/**\r\n * @author alteredq / http://alteredqualia.com/\r\n *\r\n *\t- shows frustum, line of sight and up of the camera\r\n *\t- suitable for fast updates\r\n * \t- based on frustum visualization in lightgl.js shadowmap example\r\n *\t\thttp://evanw.github.com/lightgl.js/tests/shadowmap.html\r\n */\r\n\r\nTHREE.CameraHelper = function ( camera ) {\r\n\r\n\tvar geometry = new THREE.Geometry();\r\n\tvar material = new THREE.LineBasicMaterial( { color: 0xffffff, vertexColors: THREE.FaceColors } );\r\n\r\n\tvar pointMap = {};\r\n\r\n\t// colors\r\n\r\n\tvar hexFrustum = 0xffaa00;\r\n\tvar hexCone = 0xff0000;\r\n\tvar hexUp = 0x00aaff;\r\n\tvar hexTarget = 0xffffff;\r\n\tvar hexCross = 0x333333;\r\n\r\n\t// near\r\n\r\n\taddLine( \"n1\", \"n2\", hexFrustum );\r\n\taddLine( \"n2\", \"n4\", hexFrustum );\r\n\taddLine( \"n4\", \"n3\", hexFrustum );\r\n\taddLine( \"n3\", \"n1\", hexFrustum );\r\n\r\n\t// far\r\n\r\n\taddLine( \"f1\", \"f2\", hexFrustum );\r\n\taddLine( \"f2\", \"f4\", hexFrustum );\r\n\taddLine( \"f4\", \"f3\", hexFrustum );\r\n\taddLine( \"f3\", \"f1\", hexFrustum );\r\n\r\n\t// sides\r\n\r\n\taddLine( \"n1\", \"f1\", hexFrustum );\r\n\taddLine( \"n2\", \"f2\", hexFrustum );\r\n\taddLine( \"n3\", \"f3\", hexFrustum );\r\n\taddLine( \"n4\", \"f4\", hexFrustum );\r\n\r\n\t// cone\r\n\r\n\taddLine( \"p\", \"n1\", hexCone );\r\n\taddLine( \"p\", \"n2\", hexCone );\r\n\taddLine( \"p\", \"n3\", hexCone );\r\n\taddLine( \"p\", \"n4\", hexCone );\r\n\r\n\t// up\r\n\r\n\taddLine( \"u1\", \"u2\", hexUp );\r\n\taddLine( \"u2\", \"u3\", hexUp );\r\n\taddLine( \"u3\", \"u1\", hexUp );\r\n\r\n\t// target\r\n\r\n\taddLine( \"c\", \"t\", hexTarget );\r\n\taddLine( \"p\", \"c\", hexCross );\r\n\r\n\t// cross\r\n\r\n\taddLine( \"cn1\", \"cn2\", hexCross );\r\n\taddLine( \"cn3\", \"cn4\", hexCross );\r\n\r\n\taddLine( \"cf1\", \"cf2\", hexCross );\r\n\taddLine( \"cf3\", \"cf4\", hexCross );\r\n\r\n\tfunction addLine( a, b, hex ) {\r\n\r\n\t\taddPoint( a, hex );\r\n\t\taddPoint( b, hex );\r\n\r\n\t}\r\n\r\n\tfunction addPoint( id, hex ) {\r\n\r\n\t\tgeometry.vertices.push( new THREE.Vector3() );\r\n\t\tgeometry.colors.push( new THREE.Color( hex ) );\r\n\r\n\t\tif ( pointMap[ id ] === undefined ) {\r\n\r\n\t\t\tpointMap[ id ] = [];\r\n\r\n\t\t}\r\n\r\n\t\tpointMap[ id ].push( geometry.vertices.length - 1 );\r\n\r\n\t}\r\n\r\n\tTHREE.LineSegments.call( this, geometry, material );\r\n\r\n\tthis.camera = camera;\r\n\tthis.matrix = camera.matrixWorld;\r\n\tthis.matrixAutoUpdate = false;\r\n\r\n\tthis.pointMap = pointMap;\r\n\r\n\tthis.update();\r\n\r\n};\r\n\r\nTHREE.CameraHelper.prototype = Object.create( THREE.LineSegments.prototype );\r\nTHREE.CameraHelper.prototype.constructor = THREE.CameraHelper;\r\n\r\nTHREE.CameraHelper.prototype.update = function () {\r\n\r\n\tvar geometry, pointMap;\r\n\r\n\tvar vector = new THREE.Vector3();\r\n\tvar camera = new THREE.Camera();\r\n\r\n\tvar setPoint = function ( point, x, y, z ) {\r\n\r\n\t\tvector.set( x, y, z ).unproject( camera );\r\n\r\n\t\tvar points = pointMap[ point ];\r\n\r\n\t\tif ( points !== undefined ) {\r\n\r\n\t\t\tfor ( var i = 0, il = points.length; i < il; i ++ ) {\r\n\r\n\t\t\t\tgeometry.vertices[ points[ i ] ].copy( vector );\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t};\r\n\r\n\treturn function () {\r\n\r\n\t\tgeometry = this.geometry;\r\n\t\tpointMap = this.pointMap;\r\n\r\n\t\tvar w = 1, h = 1;\r\n\r\n\t\t// we need just camera projection matrix\r\n\t\t// world matrix must be identity\r\n\r\n\t\tcamera.projectionMatrix.copy( this.camera.projectionMatrix );\r\n\r\n\t\t// center / target\r\n\r\n\t\tsetPoint( \"c\", 0, 0, - 1 );\r\n\t\tsetPoint( \"t\", 0, 0, 1 );\r\n\r\n\t\t// near\r\n\r\n\t\tsetPoint( \"n1\", - w, - h, - 1 );\r\n\t\tsetPoint( \"n2\", w, - h, - 1 );\r\n\t\tsetPoint( \"n3\", - w, h, - 1 );\r\n\t\tsetPoint( \"n4\", w, h, - 1 );\r\n\r\n\t\t// far\r\n\r\n\t\tsetPoint( \"f1\", - w, - h, 1 );\r\n\t\tsetPoint( \"f2\", w, - h, 1 );\r\n\t\tsetPoint( \"f3\", - w, h, 1 );\r\n\t\tsetPoint( \"f4\", w, h, 1 );\r\n\r\n\t\t// up\r\n\r\n\t\tsetPoint( \"u1\", w * 0.7, h * 1.1, - 1 );\r\n\t\tsetPoint( \"u2\", - w * 0.7, h * 1.1, - 1 );\r\n\t\tsetPoint( \"u3\", 0, h * 2, - 1 );\r\n\r\n\t\t// cross\r\n\r\n\t\tsetPoint( \"cf1\", - w, 0, 1 );\r\n\t\tsetPoint( \"cf2\", w, 0, 1 );\r\n\t\tsetPoint( \"cf3\", 0, - h, 1 );\r\n\t\tsetPoint( \"cf4\", 0, h, 1 );\r\n\r\n\t\tsetPoint( \"cn1\", - w, 0, - 1 );\r\n\t\tsetPoint( \"cn2\", w, 0, - 1 );\r\n\t\tsetPoint( \"cn3\", 0, - h, - 1 );\r\n\t\tsetPoint( \"cn4\", 0, h, - 1 );\r\n\r\n\t\tgeometry.verticesNeedUpdate = true;\r\n\r\n\t};\r\n\r\n}();\r\n\r\n// File:src/extras/helpers/DirectionalLightHelper.js\r\n\r\n/**\r\n * @author alteredq / http://alteredqualia.com/\r\n * @author mrdoob / http://mrdoob.com/\r\n * @author WestLangley / http://github.com/WestLangley\r\n */\r\n\r\nTHREE.DirectionalLightHelper = function ( light, size ) {\r\n\r\n\tTHREE.Object3D.call( this );\r\n\r\n\tthis.light = light;\r\n\tthis.light.updateMatrixWorld();\r\n\r\n\tthis.matrix = light.matrixWorld;\r\n\tthis.matrixAutoUpdate = false;\r\n\r\n\tsize = size || 1;\r\n\r\n\tvar geometry = new THREE.Geometry();\r\n\tgeometry.vertices.push(\r\n\t\tnew THREE.Vector3( - size, size, 0 ),\r\n\t\tnew THREE.Vector3( size, size, 0 ),\r\n\t\tnew THREE.Vector3( size, - size, 0 ),\r\n\t\tnew THREE.Vector3( - size, - size, 0 ),\r\n\t\tnew THREE.Vector3( - size, size, 0 )\r\n\t);\r\n\r\n\tvar material = new THREE.LineBasicMaterial( { fog: false } );\r\n\tmaterial.color.copy( this.light.color ).multiplyScalar( this.light.intensity );\r\n\r\n\tthis.lightPlane = new THREE.Line( geometry, material );\r\n\tthis.add( this.lightPlane );\r\n\r\n\tgeometry = new THREE.Geometry();\r\n\tgeometry.vertices.push(\r\n\t\tnew THREE.Vector3(),\r\n\t\tnew THREE.Vector3()\r\n\t);\r\n\r\n\tmaterial = new THREE.LineBasicMaterial( { fog: false } );\r\n\tmaterial.color.copy( this.light.color ).multiplyScalar( this.light.intensity );\r\n\r\n\tthis.targetLine = new THREE.Line( geometry, material );\r\n\tthis.add( this.targetLine );\r\n\r\n\tthis.update();\r\n\r\n};\r\n\r\nTHREE.DirectionalLightHelper.prototype = Object.create( THREE.Object3D.prototype );\r\nTHREE.DirectionalLightHelper.prototype.constructor = THREE.DirectionalLightHelper;\r\n\r\nTHREE.DirectionalLightHelper.prototype.dispose = function () {\r\n\r\n\tthis.lightPlane.geometry.dispose();\r\n\tthis.lightPlane.material.dispose();\r\n\tthis.targetLine.geometry.dispose();\r\n\tthis.targetLine.material.dispose();\r\n\r\n};\r\n\r\nTHREE.DirectionalLightHelper.prototype.update = function () {\r\n\r\n\tvar v1 = new THREE.Vector3();\r\n\tvar v2 = new THREE.Vector3();\r\n\tvar v3 = new THREE.Vector3();\r\n\r\n\treturn function () {\r\n\r\n\t\tv1.setFromMatrixPosition( this.light.matrixWorld );\r\n\t\tv2.setFromMatrixPosition( this.light.target.matrixWorld );\r\n\t\tv3.subVectors( v2, v1 );\r\n\r\n\t\tthis.lightPlane.lookAt( v3 );\r\n\t\tthis.lightPlane.material.color.copy( this.light.color ).multiplyScalar( this.light.intensity );\r\n\r\n\t\tthis.targetLine.geometry.vertices[ 1 ].copy( v3 );\r\n\t\tthis.targetLine.geometry.verticesNeedUpdate = true;\r\n\t\tthis.targetLine.material.color.copy( this.lightPlane.material.color );\r\n\r\n\t};\r\n\r\n}();\r\n\r\n// File:src/extras/helpers/EdgesHelper.js\r\n\r\n/**\r\n * @author WestLangley / http://github.com/WestLangley\r\n * @param object THREE.Mesh whose geometry will be used\r\n * @param hex line color\r\n * @param thresholdAngle the minimum angle (in degrees),\r\n * between the face normals of adjacent faces,\r\n * that is required to render an edge. A value of 10 means\r\n * an edge is only rendered if the angle is at least 10 degrees.\r\n */\r\n\r\nTHREE.EdgesHelper = function ( object, hex, thresholdAngle ) {\r\n\r\n\tvar color = ( hex !== undefined ) ? hex : 0xffffff;\r\n\r\n\tTHREE.LineSegments.call( this, new THREE.EdgesGeometry( object.geometry, thresholdAngle ), new THREE.LineBasicMaterial( { color: color } ) );\r\n\r\n\tthis.matrix = object.matrixWorld;\r\n\tthis.matrixAutoUpdate = false;\r\n\r\n};\r\n\r\nTHREE.EdgesHelper.prototype = Object.create( THREE.LineSegments.prototype );\r\nTHREE.EdgesHelper.prototype.constructor = THREE.EdgesHelper;\r\n\r\n// File:src/extras/helpers/FaceNormalsHelper.js\r\n\r\n/**\r\n * @author mrdoob / http://mrdoob.com/\r\n * @author WestLangley / http://github.com/WestLangley\r\n*/\r\n\r\nTHREE.FaceNormalsHelper = function ( object, size, hex, linewidth ) {\r\n\r\n\t// FaceNormalsHelper only supports THREE.Geometry\r\n\r\n\tthis.object = object;\r\n\r\n\tthis.size = ( size !== undefined ) ? size : 1;\r\n\r\n\tvar color = ( hex !== undefined ) ? hex : 0xffff00;\r\n\r\n\tvar width = ( linewidth !== undefined ) ? linewidth : 1;\r\n\r\n\t//\r\n\r\n\tvar nNormals = 0;\r\n\r\n\tvar objGeometry = this.object.geometry;\r\n\r\n\tif ( objGeometry instanceof THREE.Geometry ) {\r\n\r\n\t\tnNormals = objGeometry.faces.length;\r\n\r\n\t} else {\r\n\r\n\t\tconsole.warn( 'THREE.FaceNormalsHelper: only THREE.Geometry is supported. Use THREE.VertexNormalsHelper, instead.' );\r\n\r\n\t}\r\n\r\n\t//\r\n\r\n\tvar geometry = new THREE.BufferGeometry();\r\n\r\n\tvar positions = new THREE.Float32Attribute( nNormals * 2 * 3, 3 );\r\n\r\n\tgeometry.addAttribute( 'position', positions );\r\n\r\n\tTHREE.LineSegments.call( this, geometry, new THREE.LineBasicMaterial( { color: color, linewidth: width } ) );\r\n\r\n\t//\r\n\r\n\tthis.matrixAutoUpdate = false;\r\n\tthis.update();\r\n\r\n};\r\n\r\nTHREE.FaceNormalsHelper.prototype = Object.create( THREE.LineSegments.prototype );\r\nTHREE.FaceNormalsHelper.prototype.constructor = THREE.FaceNormalsHelper;\r\n\r\nTHREE.FaceNormalsHelper.prototype.update = ( function () {\r\n\r\n\tvar v1 = new THREE.Vector3();\r\n\tvar v2 = new THREE.Vector3();\r\n\tvar normalMatrix = new THREE.Matrix3();\r\n\r\n\treturn function update() {\r\n\r\n\t\tthis.object.updateMatrixWorld( true );\r\n\r\n\t\tnormalMatrix.getNormalMatrix( this.object.matrixWorld );\r\n\r\n\t\tvar matrixWorld = this.object.matrixWorld;\r\n\r\n\t\tvar position = this.geometry.attributes.position;\r\n\r\n\t\t//\r\n\r\n\t\tvar objGeometry = this.object.geometry;\r\n\r\n\t\tvar vertices = objGeometry.vertices;\r\n\r\n\t\tvar faces = objGeometry.faces;\r\n\r\n\t\tvar idx = 0;\r\n\r\n\t\tfor ( var i = 0, l = faces.length; i < l; i ++ ) {\r\n\r\n\t\t\tvar face = faces[ i ];\r\n\r\n\t\t\tvar normal = face.normal;\r\n\r\n\t\t\tv1.copy( vertices[ face.a ] )\r\n\t\t\t\t.add( vertices[ face.b ] )\r\n\t\t\t\t.add( vertices[ face.c ] )\r\n\t\t\t\t.divideScalar( 3 )\r\n\t\t\t\t.applyMatrix4( matrixWorld );\r\n\r\n\t\t\tv2.copy( normal ).applyMatrix3( normalMatrix ).normalize().multiplyScalar( this.size ).add( v1 );\r\n\r\n\t\t\tposition.setXYZ( idx, v1.x, v1.y, v1.z );\r\n\r\n\t\t\tidx = idx + 1;\r\n\r\n\t\t\tposition.setXYZ( idx, v2.x, v2.y, v2.z );\r\n\r\n\t\t\tidx = idx + 1;\r\n\r\n\t\t}\r\n\r\n\t\tposition.needsUpdate = true;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n}() );\r\n\r\n// File:src/extras/helpers/GridHelper.js\r\n\r\n/**\r\n * @author mrdoob / http://mrdoob.com/\r\n */\r\n\r\nTHREE.GridHelper = function ( size, step ) {\r\n\r\n\tvar geometry = new THREE.Geometry();\r\n\tvar material = new THREE.LineBasicMaterial( { vertexColors: THREE.VertexColors } );\r\n\r\n\tthis.color1 = new THREE.Color( 0x444444 );\r\n\tthis.color2 = new THREE.Color( 0x888888 );\r\n\r\n\tfor ( var i = - size; i <= size; i += step ) {\r\n\r\n\t\tgeometry.vertices.push(\r\n\t\t\tnew THREE.Vector3( - size, 0, i ), new THREE.Vector3( size, 0, i ),\r\n\t\t\tnew THREE.Vector3( i, 0, - size ), new THREE.Vector3( i, 0, size )\r\n\t\t);\r\n\r\n\t\tvar color = i === 0 ? this.color1 : this.color2;\r\n\r\n\t\tgeometry.colors.push( color, color, color, color );\r\n\r\n\t}\r\n\r\n\tTHREE.LineSegments.call( this, geometry, material );\r\n\r\n};\r\n\r\nTHREE.GridHelper.prototype = Object.create( THREE.LineSegments.prototype );\r\nTHREE.GridHelper.prototype.constructor = THREE.GridHelper;\r\n\r\nTHREE.GridHelper.prototype.setColors = function( colorCenterLine, colorGrid ) {\r\n\r\n\tthis.color1.set( colorCenterLine );\r\n\tthis.color2.set( colorGrid );\r\n\r\n\tthis.geometry.colorsNeedUpdate = true;\r\n\r\n};\r\n\r\n// File:src/extras/helpers/HemisphereLightHelper.js\r\n\r\n/**\r\n * @author alteredq / http://alteredqualia.com/\r\n * @author mrdoob / http://mrdoob.com/\r\n */\r\n\r\nTHREE.HemisphereLightHelper = function ( light, sphereSize ) {\r\n\r\n\tTHREE.Object3D.call( this );\r\n\r\n\tthis.light = light;\r\n\tthis.light.updateMatrixWorld();\r\n\r\n\tthis.matrix = light.matrixWorld;\r\n\tthis.matrixAutoUpdate = false;\r\n\r\n\tthis.colors = [ new THREE.Color(), new THREE.Color() ];\r\n\r\n\tvar geometry = new THREE.SphereGeometry( sphereSize, 4, 2 );\r\n\tgeometry.rotateX( - Math.PI / 2 );\r\n\r\n\tfor ( var i = 0, il = 8; i < il; i ++ ) {\r\n\r\n\t\tgeometry.faces[ i ].color = this.colors[ i < 4 ? 0 : 1 ];\r\n\r\n\t}\r\n\r\n\tvar material = new THREE.MeshBasicMaterial( { vertexColors: THREE.FaceColors, wireframe: true } );\r\n\r\n\tthis.lightSphere = new THREE.Mesh( geometry, material );\r\n\tthis.add( this.lightSphere );\r\n\r\n\tthis.update();\r\n\r\n};\r\n\r\nTHREE.HemisphereLightHelper.prototype = Object.create( THREE.Object3D.prototype );\r\nTHREE.HemisphereLightHelper.prototype.constructor = THREE.HemisphereLightHelper;\r\n\r\nTHREE.HemisphereLightHelper.prototype.dispose = function () {\r\n\r\n\tthis.lightSphere.geometry.dispose();\r\n\tthis.lightSphere.material.dispose();\r\n\r\n};\r\n\r\nTHREE.HemisphereLightHelper.prototype.update = function () {\r\n\r\n\tvar vector = new THREE.Vector3();\r\n\r\n\treturn function () {\r\n\r\n\t\tthis.colors[ 0 ].copy( this.light.color ).multiplyScalar( this.light.intensity );\r\n\t\tthis.colors[ 1 ].copy( this.light.groundColor ).multiplyScalar( this.light.intensity );\r\n\r\n\t\tthis.lightSphere.lookAt( vector.setFromMatrixPosition( this.light.matrixWorld ).negate() );\r\n\t\tthis.lightSphere.geometry.colorsNeedUpdate = true;\r\n\r\n\t}\r\n\r\n}();\r\n\r\n// File:src/extras/helpers/PointLightHelper.js\r\n\r\n/**\r\n * @author alteredq / http://alteredqualia.com/\r\n * @author mrdoob / http://mrdoob.com/\r\n */\r\n\r\nTHREE.PointLightHelper = function ( light, sphereSize ) {\r\n\r\n\tthis.light = light;\r\n\tthis.light.updateMatrixWorld();\r\n\r\n\tvar geometry = new THREE.SphereGeometry( sphereSize, 4, 2 );\r\n\tvar material = new THREE.MeshBasicMaterial( { wireframe: true, fog: false } );\r\n\tmaterial.color.copy( this.light.color ).multiplyScalar( this.light.intensity );\r\n\r\n\tTHREE.Mesh.call( this, geometry, material );\r\n\r\n\tthis.matrix = this.light.matrixWorld;\r\n\tthis.matrixAutoUpdate = false;\r\n\r\n\t/*\r\n\tvar distanceGeometry = new THREE.IcosahedronGeometry( 1, 2 );\r\n\tvar distanceMaterial = new THREE.MeshBasicMaterial( { color: hexColor, fog: false, wireframe: true, opacity: 0.1, transparent: true } );\r\n\r\n\tthis.lightSphere = new THREE.Mesh( bulbGeometry, bulbMaterial );\r\n\tthis.lightDistance = new THREE.Mesh( distanceGeometry, distanceMaterial );\r\n\r\n\tvar d = light.distance;\r\n\r\n\tif ( d === 0.0 ) {\r\n\r\n\t\tthis.lightDistance.visible = false;\r\n\r\n\t} else {\r\n\r\n\t\tthis.lightDistance.scale.set( d, d, d );\r\n\r\n\t}\r\n\r\n\tthis.add( this.lightDistance );\r\n\t*/\r\n\r\n};\r\n\r\nTHREE.PointLightHelper.prototype = Object.create( THREE.Mesh.prototype );\r\nTHREE.PointLightHelper.prototype.constructor = THREE.PointLightHelper;\r\n\r\nTHREE.PointLightHelper.prototype.dispose = function () {\r\n\r\n\tthis.geometry.dispose();\r\n\tthis.material.dispose();\r\n\r\n};\r\n\r\nTHREE.PointLightHelper.prototype.update = function () {\r\n\r\n\tthis.material.color.copy( this.light.color ).multiplyScalar( this.light.intensity );\r\n\r\n\t/*\r\n\tvar d = this.light.distance;\r\n\r\n\tif ( d === 0.0 ) {\r\n\r\n\t\tthis.lightDistance.visible = false;\r\n\r\n\t} else {\r\n\r\n\t\tthis.lightDistance.visible = true;\r\n\t\tthis.lightDistance.scale.set( d, d, d );\r\n\r\n\t}\r\n\t*/\r\n\r\n};\r\n\r\n// File:src/extras/helpers/SkeletonHelper.js\r\n\r\n/**\r\n * @author Sean Griffin / http://twitter.com/sgrif\r\n * @author Michael Guerrero / http://realitymeltdown.com\r\n * @author mrdoob / http://mrdoob.com/\r\n * @author ikerr / http://verold.com\r\n */\r\n\r\nTHREE.SkeletonHelper = function ( object ) {\r\n\r\n\tthis.bones = this.getBoneList( object );\r\n\r\n\tvar geometry = new THREE.Geometry();\r\n\r\n\tfor ( var i = 0; i < this.bones.length; i ++ ) {\r\n\r\n\t\tvar bone = this.bones[ i ];\r\n\r\n\t\tif ( bone.parent instanceof THREE.Bone ) {\r\n\r\n\t\t\tgeometry.vertices.push( new THREE.Vector3() );\r\n\t\t\tgeometry.vertices.push( new THREE.Vector3() );\r\n\t\t\tgeometry.colors.push( new THREE.Color( 0, 0, 1 ) );\r\n\t\t\tgeometry.colors.push( new THREE.Color( 0, 1, 0 ) );\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tgeometry.dynamic = true;\r\n\r\n\tvar material = new THREE.LineBasicMaterial( { vertexColors: THREE.VertexColors, depthTest: false, depthWrite: false, transparent: true } );\r\n\r\n\tTHREE.LineSegments.call( this, geometry, material );\r\n\r\n\tthis.root = object;\r\n\r\n\tthis.matrix = object.matrixWorld;\r\n\tthis.matrixAutoUpdate = false;\r\n\r\n\tthis.update();\r\n\r\n};\r\n\r\n\r\nTHREE.SkeletonHelper.prototype = Object.create( THREE.LineSegments.prototype );\r\nTHREE.SkeletonHelper.prototype.constructor = THREE.SkeletonHelper;\r\n\r\nTHREE.SkeletonHelper.prototype.getBoneList = function( object ) {\r\n\r\n\tvar boneList = [];\r\n\r\n\tif ( object instanceof THREE.Bone ) {\r\n\r\n\t\tboneList.push( object );\r\n\r\n\t}\r\n\r\n\tfor ( var i = 0; i < object.children.length; i ++ ) {\r\n\r\n\t\tboneList.push.apply( boneList, this.getBoneList( object.children[ i ] ) );\r\n\r\n\t}\r\n\r\n\treturn boneList;\r\n\r\n};\r\n\r\nTHREE.SkeletonHelper.prototype.update = function () {\r\n\r\n\tvar geometry = this.geometry;\r\n\r\n\tvar matrixWorldInv = new THREE.Matrix4().getInverse( this.root.matrixWorld );\r\n\r\n\tvar boneMatrix = new THREE.Matrix4();\r\n\r\n\tvar j = 0;\r\n\r\n\tfor ( var i = 0; i < this.bones.length; i ++ ) {\r\n\r\n\t\tvar bone = this.bones[ i ];\r\n\r\n\t\tif ( bone.parent instanceof THREE.Bone ) {\r\n\r\n\t\t\tboneMatrix.multiplyMatrices( matrixWorldInv, bone.matrixWorld );\r\n\t\t\tgeometry.vertices[ j ].setFromMatrixPosition( boneMatrix );\r\n\r\n\t\t\tboneMatrix.multiplyMatrices( matrixWorldInv, bone.parent.matrixWorld );\r\n\t\t\tgeometry.vertices[ j + 1 ].setFromMatrixPosition( boneMatrix );\r\n\r\n\t\t\tj += 2;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tgeometry.verticesNeedUpdate = true;\r\n\r\n\tgeometry.computeBoundingSphere();\r\n\r\n};\r\n\r\n// File:src/extras/helpers/SpotLightHelper.js\r\n\r\n/**\r\n * @author alteredq / http://alteredqualia.com/\r\n * @author mrdoob / http://mrdoob.com/\r\n * @author WestLangley / http://github.com/WestLangley\r\n*/\r\n\r\nTHREE.SpotLightHelper = function ( light ) {\r\n\r\n\tTHREE.Object3D.call( this );\r\n\r\n\tthis.light = light;\r\n\tthis.light.updateMatrixWorld();\r\n\r\n\tthis.matrix = light.matrixWorld;\r\n\tthis.matrixAutoUpdate = false;\r\n\r\n\tvar geometry = new THREE.CylinderGeometry( 0, 1, 1, 8, 1, true );\r\n\r\n\tgeometry.translate( 0, - 0.5, 0 );\r\n\tgeometry.rotateX( - Math.PI / 2 );\r\n\r\n\tvar material = new THREE.MeshBasicMaterial( { wireframe: true, fog: false } );\r\n\r\n\tthis.cone = new THREE.Mesh( geometry, material );\r\n\tthis.add( this.cone );\r\n\r\n\tthis.update();\r\n\r\n};\r\n\r\nTHREE.SpotLightHelper.prototype = Object.create( THREE.Object3D.prototype );\r\nTHREE.SpotLightHelper.prototype.constructor = THREE.SpotLightHelper;\r\n\r\nTHREE.SpotLightHelper.prototype.dispose = function () {\r\n\r\n\tthis.cone.geometry.dispose();\r\n\tthis.cone.material.dispose();\r\n\r\n};\r\n\r\nTHREE.SpotLightHelper.prototype.update = function () {\r\n\r\n\tvar vector = new THREE.Vector3();\r\n\tvar vector2 = new THREE.Vector3();\r\n\r\n\treturn function () {\r\n\r\n\t\tvar coneLength = this.light.distance ? this.light.distance : 10000;\r\n\t\tvar coneWidth = coneLength * Math.tan( this.light.angle );\r\n\r\n\t\tthis.cone.scale.set( coneWidth, coneWidth, coneLength );\r\n\r\n\t\tvector.setFromMatrixPosition( this.light.matrixWorld );\r\n\t\tvector2.setFromMatrixPosition( this.light.target.matrixWorld );\r\n\r\n\t\tthis.cone.lookAt( vector2.sub( vector ) );\r\n\r\n\t\tthis.cone.material.color.copy( this.light.color ).multiplyScalar( this.light.intensity );\r\n\r\n\t};\r\n\r\n}();\r\n\r\n// File:src/extras/helpers/VertexNormalsHelper.js\r\n\r\n/**\r\n * @author mrdoob / http://mrdoob.com/\r\n * @author WestLangley / http://github.com/WestLangley\r\n*/\r\n\r\nTHREE.VertexNormalsHelper = function ( object, size, hex, linewidth ) {\r\n\r\n\tthis.object = object;\r\n\r\n\tthis.size = ( size !== undefined ) ? size : 1;\r\n\r\n\tvar color = ( hex !== undefined ) ? hex : 0xff0000;\r\n\r\n\tvar width = ( linewidth !== undefined ) ? linewidth : 1;\r\n\r\n\t//\r\n\r\n\tvar nNormals = 0;\r\n\r\n\tvar objGeometry = this.object.geometry;\r\n\r\n\tif ( objGeometry instanceof THREE.Geometry ) {\r\n\r\n\t\tnNormals = objGeometry.faces.length * 3;\r\n\r\n\t} else if ( objGeometry instanceof THREE.BufferGeometry ) {\r\n\r\n\t\tnNormals = objGeometry.attributes.normal.count\r\n\r\n\t}\r\n\r\n\t//\r\n\r\n\tvar geometry = new THREE.BufferGeometry();\r\n\r\n\tvar positions = new THREE.Float32Attribute( nNormals * 2 * 3, 3 );\r\n\r\n\tgeometry.addAttribute( 'position', positions );\r\n\r\n\tTHREE.LineSegments.call( this, geometry, new THREE.LineBasicMaterial( { color: color, linewidth: width } ) );\r\n\r\n\t//\r\n\r\n\tthis.matrixAutoUpdate = false;\r\n\r\n\tthis.update();\r\n\r\n};\r\n\r\nTHREE.VertexNormalsHelper.prototype = Object.create( THREE.LineSegments.prototype );\r\nTHREE.VertexNormalsHelper.prototype.constructor = THREE.VertexNormalsHelper;\r\n\r\nTHREE.VertexNormalsHelper.prototype.update = ( function () {\r\n\r\n\tvar v1 = new THREE.Vector3();\r\n\tvar v2 = new THREE.Vector3();\r\n\tvar normalMatrix = new THREE.Matrix3();\r\n\r\n\treturn function update() {\r\n\r\n\t\tvar keys = [ 'a', 'b', 'c' ];\r\n\r\n\t\tthis.object.updateMatrixWorld( true );\r\n\r\n\t\tnormalMatrix.getNormalMatrix( this.object.matrixWorld );\r\n\r\n\t\tvar matrixWorld = this.object.matrixWorld;\r\n\r\n\t\tvar position = this.geometry.attributes.position;\r\n\r\n\t\t//\r\n\r\n\t\tvar objGeometry = this.object.geometry;\r\n\r\n\t\tif ( objGeometry instanceof THREE.Geometry ) {\r\n\r\n\t\t\tvar vertices = objGeometry.vertices;\r\n\r\n\t\t\tvar faces = objGeometry.faces;\r\n\r\n\t\t\tvar idx = 0;\r\n\r\n\t\t\tfor ( var i = 0, l = faces.length; i < l; i ++ ) {\r\n\r\n\t\t\t\tvar face = faces[ i ];\r\n\r\n\t\t\t\tfor ( var j = 0, jl = face.vertexNormals.length; j < jl; j ++ ) {\r\n\r\n\t\t\t\t\tvar vertex = vertices[ face[ keys[ j ] ] ];\r\n\r\n\t\t\t\t\tvar normal = face.vertexNormals[ j ];\r\n\r\n\t\t\t\t\tv1.copy( vertex ).applyMatrix4( matrixWorld );\r\n\r\n\t\t\t\t\tv2.copy( normal ).applyMatrix3( normalMatrix ).normalize().multiplyScalar( this.size ).add( v1 );\r\n\r\n\t\t\t\t\tposition.setXYZ( idx, v1.x, v1.y, v1.z );\r\n\r\n\t\t\t\t\tidx = idx + 1;\r\n\r\n\t\t\t\t\tposition.setXYZ( idx, v2.x, v2.y, v2.z );\r\n\r\n\t\t\t\t\tidx = idx + 1;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t} else if ( objGeometry instanceof THREE.BufferGeometry ) {\r\n\r\n\t\t\tvar objPos = objGeometry.attributes.position;\r\n\r\n\t\t\tvar objNorm = objGeometry.attributes.normal;\r\n\r\n\t\t\tvar idx = 0;\r\n\r\n\t\t\t// for simplicity, ignore index and drawcalls, and render every normal\r\n\r\n\t\t\tfor ( var j = 0, jl = objPos.count; j < jl; j ++ ) {\r\n\r\n\t\t\t\tv1.set( objPos.getX( j ), objPos.getY( j ), objPos.getZ( j ) ).applyMatrix4( matrixWorld );\r\n\r\n\t\t\t\tv2.set( objNorm.getX( j ), objNorm.getY( j ), objNorm.getZ( j ) );\r\n\r\n\t\t\t\tv2.applyMatrix3( normalMatrix ).normalize().multiplyScalar( this.size ).add( v1 );\r\n\r\n\t\t\t\tposition.setXYZ( idx, v1.x, v1.y, v1.z );\r\n\r\n\t\t\t\tidx = idx + 1;\r\n\r\n\t\t\t\tposition.setXYZ( idx, v2.x, v2.y, v2.z );\r\n\r\n\t\t\t\tidx = idx + 1;\r\n\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tposition.needsUpdate = true;\r\n\r\n\t\treturn this;\r\n\r\n\t}\r\n\r\n}() );\r\n\r\n// File:src/extras/helpers/WireframeHelper.js\r\n\r\n/**\r\n * @author mrdoob / http://mrdoob.com/\r\n */\r\n\r\nTHREE.WireframeHelper = function ( object, hex ) {\r\n\r\n\tvar color = ( hex !== undefined ) ? hex : 0xffffff;\r\n\r\n\tTHREE.LineSegments.call( this, new THREE.WireframeGeometry( object.geometry ), new THREE.LineBasicMaterial( { color: color } ) );\r\n\r\n\tthis.matrix = object.matrixWorld;\r\n\tthis.matrixAutoUpdate = false;\r\n\r\n};\r\n\r\nTHREE.WireframeHelper.prototype = Object.create( THREE.LineSegments.prototype );\r\nTHREE.WireframeHelper.prototype.constructor = THREE.WireframeHelper;\r\n\r\n// File:src/extras/objects/ImmediateRenderObject.js\r\n\r\n/**\r\n * @author alteredq / http://alteredqualia.com/\r\n */\r\n\r\nTHREE.ImmediateRenderObject = function () {\r\n\r\n\tTHREE.Object3D.call( this );\r\n\r\n\tthis.render = function ( renderCallback ) {};\r\n\r\n};\r\n\r\nTHREE.ImmediateRenderObject.prototype = Object.create( THREE.Object3D.prototype );\r\nTHREE.ImmediateRenderObject.prototype.constructor = THREE.ImmediateRenderObject;\r\n\r\n// File:src/extras/objects/MorphBlendMesh.js\r\n\r\n/**\r\n * @author alteredq / http://alteredqualia.com/\r\n */\r\n\r\nTHREE.MorphBlendMesh = function( geometry, material ) {\r\n\r\n\tTHREE.Mesh.call( this, geometry, material );\r\n\r\n\tthis.animationsMap = {};\r\n\tthis.animationsList = [];\r\n\r\n\t// prepare default animation\r\n\t// (all frames played together in 1 second)\r\n\r\n\tvar numFrames = this.geometry.morphTargets.length;\r\n\r\n\tvar name = \"__default\";\r\n\r\n\tvar startFrame = 0;\r\n\tvar endFrame = numFrames - 1;\r\n\r\n\tvar fps = numFrames / 1;\r\n\r\n\tthis.createAnimation( name, startFrame, endFrame, fps );\r\n\tthis.setAnimationWeight( name, 1 );\r\n\r\n};\r\n\r\nTHREE.MorphBlendMesh.prototype = Object.create( THREE.Mesh.prototype );\r\nTHREE.MorphBlendMesh.prototype.constructor = THREE.MorphBlendMesh;\r\n\r\nTHREE.MorphBlendMesh.prototype.createAnimation = function ( name, start, end, fps ) {\r\n\r\n\tvar animation = {\r\n\r\n\t\tstart: start,\r\n\t\tend: end,\r\n\r\n\t\tlength: end - start + 1,\r\n\r\n\t\tfps: fps,\r\n\t\tduration: ( end - start ) / fps,\r\n\r\n\t\tlastFrame: 0,\r\n\t\tcurrentFrame: 0,\r\n\r\n\t\tactive: false,\r\n\r\n\t\ttime: 0,\r\n\t\tdirection: 1,\r\n\t\tweight: 1,\r\n\r\n\t\tdirectionBackwards: false,\r\n\t\tmirroredLoop: false\r\n\r\n\t};\r\n\r\n\tthis.animationsMap[ name ] = animation;\r\n\tthis.animationsList.push( animation );\r\n\r\n};\r\n\r\nTHREE.MorphBlendMesh.prototype.autoCreateAnimations = function ( fps ) {\r\n\r\n\tvar pattern = /([a-z]+)_?(\\d+)/;\r\n\r\n\tvar firstAnimation, frameRanges = {};\r\n\r\n\tvar geometry = this.geometry;\r\n\r\n\tfor ( var i = 0, il = geometry.morphTargets.length; i < il; i ++ ) {\r\n\r\n\t\tvar morph = geometry.morphTargets[ i ];\r\n\t\tvar chunks = morph.name.match( pattern );\r\n\r\n\t\tif ( chunks && chunks.length > 1 ) {\r\n\r\n\t\t\tvar name = chunks[ 1 ];\r\n\r\n\t\t\tif ( ! frameRanges[ name ] ) frameRanges[ name ] = { start: Infinity, end: - Infinity };\r\n\r\n\t\t\tvar range = frameRanges[ name ];\r\n\r\n\t\t\tif ( i < range.start ) range.start = i;\r\n\t\t\tif ( i > range.end ) range.end = i;\r\n\r\n\t\t\tif ( ! firstAnimation ) firstAnimation = name;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tfor ( var name in frameRanges ) {\r\n\r\n\t\tvar range = frameRanges[ name ];\r\n\t\tthis.createAnimation( name, range.start, range.end, fps );\r\n\r\n\t}\r\n\r\n\tthis.firstAnimation = firstAnimation;\r\n\r\n};\r\n\r\nTHREE.MorphBlendMesh.prototype.setAnimationDirectionForward = function ( name ) {\r\n\r\n\tvar animation = this.animationsMap[ name ];\r\n\r\n\tif ( animation ) {\r\n\r\n\t\tanimation.direction = 1;\r\n\t\tanimation.directionBackwards = false;\r\n\r\n\t}\r\n\r\n};\r\n\r\nTHREE.MorphBlendMesh.prototype.setAnimationDirectionBackward = function ( name ) {\r\n\r\n\tvar animation = this.animationsMap[ name ];\r\n\r\n\tif ( animation ) {\r\n\r\n\t\tanimation.direction = - 1;\r\n\t\tanimation.directionBackwards = true;\r\n\r\n\t}\r\n\r\n};\r\n\r\nTHREE.MorphBlendMesh.prototype.setAnimationFPS = function ( name, fps ) {\r\n\r\n\tvar animation = this.animationsMap[ name ];\r\n\r\n\tif ( animation ) {\r\n\r\n\t\tanimation.fps = fps;\r\n\t\tanimation.duration = ( animation.end - animation.start ) / animation.fps;\r\n\r\n\t}\r\n\r\n};\r\n\r\nTHREE.MorphBlendMesh.prototype.setAnimationDuration = function ( name, duration ) {\r\n\r\n\tvar animation = this.animationsMap[ name ];\r\n\r\n\tif ( animation ) {\r\n\r\n\t\tanimation.duration = duration;\r\n\t\tanimation.fps = ( animation.end - animation.start ) / animation.duration;\r\n\r\n\t}\r\n\r\n};\r\n\r\nTHREE.MorphBlendMesh.prototype.setAnimationWeight = function ( name, weight ) {\r\n\r\n\tvar animation = this.animationsMap[ name ];\r\n\r\n\tif ( animation ) {\r\n\r\n\t\tanimation.weight = weight;\r\n\r\n\t}\r\n\r\n};\r\n\r\nTHREE.MorphBlendMesh.prototype.setAnimationTime = function ( name, time ) {\r\n\r\n\tvar animation = this.animationsMap[ name ];\r\n\r\n\tif ( animation ) {\r\n\r\n\t\tanimation.time = time;\r\n\r\n\t}\r\n\r\n};\r\n\r\nTHREE.MorphBlendMesh.prototype.getAnimationTime = function ( name ) {\r\n\r\n\tvar time = 0;\r\n\r\n\tvar animation = this.animationsMap[ name ];\r\n\r\n\tif ( animation ) {\r\n\r\n\t\ttime = animation.time;\r\n\r\n\t}\r\n\r\n\treturn time;\r\n\r\n};\r\n\r\nTHREE.MorphBlendMesh.prototype.getAnimationDuration = function ( name ) {\r\n\r\n\tvar duration = - 1;\r\n\r\n\tvar animation = this.animationsMap[ name ];\r\n\r\n\tif ( animation ) {\r\n\r\n\t\tduration = animation.duration;\r\n\r\n\t}\r\n\r\n\treturn duration;\r\n\r\n};\r\n\r\nTHREE.MorphBlendMesh.prototype.playAnimation = function ( name ) {\r\n\r\n\tvar animation = this.animationsMap[ name ];\r\n\r\n\tif ( animation ) {\r\n\r\n\t\tanimation.time = 0;\r\n\t\tanimation.active = true;\r\n\r\n\t} else {\r\n\r\n\t\tconsole.warn( \"THREE.MorphBlendMesh: animation[\" + name + \"] undefined in .playAnimation()\" );\r\n\r\n\t}\r\n\r\n};\r\n\r\nTHREE.MorphBlendMesh.prototype.stopAnimation = function ( name ) {\r\n\r\n\tvar animation = this.animationsMap[ name ];\r\n\r\n\tif ( animation ) {\r\n\r\n\t\tanimation.active = false;\r\n\r\n\t}\r\n\r\n};\r\n\r\nTHREE.MorphBlendMesh.prototype.update = function ( delta ) {\r\n\r\n\tfor ( var i = 0, il = this.animationsList.length; i < il; i ++ ) {\r\n\r\n\t\tvar animation = this.animationsList[ i ];\r\n\r\n\t\tif ( ! animation.active ) continue;\r\n\r\n\t\tvar frameTime = animation.duration / animation.length;\r\n\r\n\t\tanimation.time += animation.direction * delta;\r\n\r\n\t\tif ( animation.mirroredLoop ) {\r\n\r\n\t\t\tif ( animation.time > animation.duration || animation.time < 0 ) {\r\n\r\n\t\t\t\tanimation.direction *= - 1;\r\n\r\n\t\t\t\tif ( animation.time > animation.duration ) {\r\n\r\n\t\t\t\t\tanimation.time = animation.duration;\r\n\t\t\t\t\tanimation.directionBackwards = true;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif ( animation.time < 0 ) {\r\n\r\n\t\t\t\t\tanimation.time = 0;\r\n\t\t\t\t\tanimation.directionBackwards = false;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t} else {\r\n\r\n\t\t\tanimation.time = animation.time % animation.duration;\r\n\r\n\t\t\tif ( animation.time < 0 ) animation.time += animation.duration;\r\n\r\n\t\t}\r\n\r\n\t\tvar keyframe = animation.start + THREE.Math.clamp( Math.floor( animation.time / frameTime ), 0, animation.length - 1 );\r\n\t\tvar weight = animation.weight;\r\n\r\n\t\tif ( keyframe !== animation.currentFrame ) {\r\n\r\n\t\t\tthis.morphTargetInfluences[ animation.lastFrame ] = 0;\r\n\t\t\tthis.morphTargetInfluences[ animation.currentFrame ] = 1 * weight;\r\n\r\n\t\t\tthis.morphTargetInfluences[ keyframe ] = 0;\r\n\r\n\t\t\tanimation.lastFrame = animation.currentFrame;\r\n\t\t\tanimation.currentFrame = keyframe;\r\n\r\n\t\t}\r\n\r\n\t\tvar mix = ( animation.time % frameTime ) / frameTime;\r\n\r\n\t\tif ( animation.directionBackwards ) mix = 1 - mix;\r\n\r\n\t\tif ( animation.currentFrame !== animation.lastFrame ) {\r\n\r\n\t\t\tthis.morphTargetInfluences[ animation.currentFrame ] = mix * weight;\r\n\t\t\tthis.morphTargetInfluences[ animation.lastFrame ] = ( 1 - mix ) * weight;\r\n\r\n\t\t} else {\r\n\r\n\t\t\tthis.morphTargetInfluences[ animation.currentFrame ] = weight;\r\n\r\n\t\t}\r\n\r\n\t}\r\n\r\n};\r\n\r\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/three/three.js\n ** module id = 8\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./~/three/three.js?"); /***/ }, /* 9 */ @@ -434,7 +434,7 @@ /* 65 */ /***/ function(module, exports, __webpack_require__) { - eval("var map = {\n\t\"./box\": 66,\n\t\"./box.js\": 66,\n\t\"./cylinder\": 67,\n\t\"./cylinder.js\": 67,\n\t\"./empty\": 59,\n\t\"./empty.js\": 59,\n\t\"./floor\": 68,\n\t\"./floor.js\": 68,\n\t\"./image\": 69,\n\t\"./image.js\": 69,\n\t\"./panorama\": 70,\n\t\"./panorama.js\": 70,\n\t\"./sky\": 71,\n\t\"./sky.js\": 71,\n\t\"./sound\": 73,\n\t\"./sound.js\": 73,\n\t\"./sphere\": 75,\n\t\"./sphere.js\": 75,\n\t\"./text\": 76,\n\t\"./text.js\": 76,\n\t\"./torus\": 77,\n\t\"./torus.js\": 77,\n\t\"./video\": 78,\n\t\"./video.js\": 78\n};\nfunction webpackContext(req) {\n\treturn __webpack_require__(webpackContextResolve(req));\n};\nfunction webpackContextResolve(req) {\n\treturn map[req] || (function() { throw new Error(\"Cannot find module '\" + req + \"'.\") }());\n};\nwebpackContext.keys = function webpackContextKeys() {\n\treturn Object.keys(map);\n};\nwebpackContext.resolve = webpackContextResolve;\nmodule.exports = webpackContext;\nwebpackContext.id = 65;\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/objects ^\\.\\/.*$\n ** module id = 65\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/objects_^\\.\\/.*$?"); + eval("var map = {\n\t\"./box\": 66,\n\t\"./box.js\": 66,\n\t\"./cylinder\": 67,\n\t\"./cylinder.js\": 67,\n\t\"./empty\": 59,\n\t\"./empty.js\": 59,\n\t\"./floor\": 68,\n\t\"./floor.js\": 68,\n\t\"./grid\": 69,\n\t\"./grid.js\": 69,\n\t\"./image\": 70,\n\t\"./image.js\": 70,\n\t\"./panorama\": 71,\n\t\"./panorama.js\": 71,\n\t\"./sky\": 72,\n\t\"./sky.js\": 72,\n\t\"./sound\": 74,\n\t\"./sound.js\": 74,\n\t\"./sphere\": 76,\n\t\"./sphere.js\": 76,\n\t\"./text\": 77,\n\t\"./text.js\": 77,\n\t\"./torus\": 78,\n\t\"./torus.js\": 78,\n\t\"./video\": 79,\n\t\"./video.js\": 79\n};\nfunction webpackContext(req) {\n\treturn __webpack_require__(webpackContextResolve(req));\n};\nfunction webpackContextResolve(req) {\n\treturn map[req] || (function() { throw new Error(\"Cannot find module '\" + req + \"'.\") }());\n};\nwebpackContext.keys = function webpackContextKeys() {\n\treturn Object.keys(map);\n};\nwebpackContext.resolve = webpackContextResolve;\nmodule.exports = webpackContext;\nwebpackContext.id = 65;\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/objects ^\\.\\/.*$\n ** module id = 65\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/objects_^\\.\\/.*$?"); /***/ }, /* 66 */ @@ -458,85 +458,91 @@ /* 69 */ /***/ function(module, exports, __webpack_require__) { - eval("module.exports = (function () {\n\t'use strict';\n\n\tvar materials = __webpack_require__(7),\n\t\tTHREE = __webpack_require__(8);\n\n\treturn function image(parent, options) {\n\t\tvar geometry,\n\t\t\tmaterial,\n\t\t\tmesh,\n\t\t\tsrc,\n\t\t\ttex;\n\n\t\tif (typeof options === 'string') {\n\t\t\tsrc = options;\n\t\t} else if (options) {\n\t\t\tsrc = options.src;\n\t\t}\n\n\t\tif (src) {\n\t\t\ttex = materials.imageTexture(src, THREE.UVMapping, function (t, image) {\n\t\t\t\t//todo: don't do any of this if object has been deleted\n\t\t\t\tgeometry.applyMatrix(new THREE.Matrix4().makeScale(1, image.naturalHeight / image.naturalWidth, 1));\n\t\t\t\tmaterial.map = tex;\n\t\t\t\tmaterial.visible = true;\n\t\t\t\tmesh.visible = true;\n\t\t\t\tparent.add(mesh);\n\t\t\t});\n\t\t}\n\n\t\tgeometry = new THREE.PlaneBufferGeometry(1, 1, 8);\n\n\t\tmaterial = new THREE.MeshBasicMaterial({\n\t\t\tside: THREE.DoubleSide,\n\t\t\ttransparent: true,\n\t\t\tmap: tex\n\t\t});\n\n\t\tmesh = new THREE.Mesh( geometry, material );\n\n\t\tmesh.visible = false;\n\n\t\tparent.add(mesh);\n\n\t\treturn mesh;\n\t};\n}());\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/objects/image.js\n ** module id = 69\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/objects/image.js?"); + eval("module.exports = (function () {\n\t'use strict';\n\n\tvar THREE = __webpack_require__(8);\n\n\treturn function box(parent, options) {\n\t\tvar obj,\n\t\t\tsize = options && options.size || 10,\n\t\t\tstep = options && options.step || 1;\n\n\t\tobj = new THREE.GridHelper(size, step);\n\t\tobj.name = 'grid';\n\t\tif (options) {\n\t\t\tobj.setColors(options.colorCenterLine || obj.color1, options.colorGrid || obj.color2);\n\t\t}\n\t\tobj.geometry.computeBoundingBox();\n\n\t\tparent.add(obj);\n\n\t\treturn obj;\n\t};\n}());\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/objects/grid.js\n ** module id = 69\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/objects/grid.js?"); /***/ }, /* 70 */ /***/ function(module, exports, __webpack_require__) { - eval("module.exports = (function () {\n\t'use strict';\n\n\tvar materials = __webpack_require__(7),\n\t\tTHREE = __webpack_require__(8),\n\t\tgeometry = new THREE.SphereGeometry(1000, 60, 60);\n\n\tgeometry.applyMatrix(new THREE.Matrix4().makeScale(-1, 1, 1));\n\tgeometry.applyMatrix(new THREE.Matrix4().makeRotationY(- Math.PI / 2));\n\n\treturn function panorama(parent, options) {\n\t\tvar material,\n\t\t\tmesh,\n\t\t\tsrc,\n\t\t\ttex;\n\n\t\tif (typeof options === 'string') {\n\t\t\tsrc = options;\n\t\t} else if (options) {\n\t\t\tsrc = options.src;\n\t\t}\n\n\t\tif (src) {\n\t\t\ttex = materials.imageTexture(src, THREE.UVMapping);\n\t\t}\n\n\t\tmaterial = new THREE.MeshBasicMaterial({\n\t\t\ttransparent: true,\n\t\t\tmap: tex\n\t\t});\n\n\t\tmesh = new THREE.Mesh(geometry, material);\n\n\t\tif (options && options.stereo) {\n\t\t\tif (options.stereo === 'vertical') {\n\t\t\t\ttex.repeat.y = 0.5;\n\t\t\t} else {\n\t\t\t\ttex.repeat.x = 0.5;\n\t\t\t}\n\t\t\tmesh.userData.stereo = options.stereo;\n\t\t}\n\n\t\tmesh.name = 'panorama';\n\n\t\tparent.add(mesh);\n\n\t\tthis.raycastable = false;\n\n\t\treturn mesh;\n\t};\n}());\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/objects/panorama.js\n ** module id = 70\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/objects/panorama.js?"); + eval("module.exports = (function () {\n\t'use strict';\n\n\tvar materials = __webpack_require__(7),\n\t\tTHREE = __webpack_require__(8);\n\n\treturn function image(parent, options) {\n\t\tvar geometry,\n\t\t\tmaterial,\n\t\t\tmesh,\n\t\t\tsrc,\n\t\t\ttex;\n\n\t\tif (typeof options === 'string') {\n\t\t\tsrc = options;\n\t\t} else if (options) {\n\t\t\tsrc = options.src;\n\t\t}\n\n\t\tif (src) {\n\t\t\ttex = materials.imageTexture(src, THREE.UVMapping, function (t, image) {\n\t\t\t\t//todo: don't do any of this if object has been deleted\n\t\t\t\tgeometry.applyMatrix(new THREE.Matrix4().makeScale(1, image.naturalHeight / image.naturalWidth, 1));\n\t\t\t\tmaterial.map = tex;\n\t\t\t\tmaterial.visible = true;\n\t\t\t\tmesh.visible = true;\n\t\t\t\tparent.add(mesh);\n\t\t\t});\n\t\t}\n\n\t\tgeometry = new THREE.PlaneBufferGeometry(1, 1, 8);\n\n\t\tmaterial = new THREE.MeshBasicMaterial({\n\t\t\tside: THREE.DoubleSide,\n\t\t\ttransparent: true,\n\t\t\tmap: tex\n\t\t});\n\n\t\tmesh = new THREE.Mesh( geometry, material );\n\n\t\tmesh.visible = false;\n\n\t\tparent.add(mesh);\n\n\t\treturn mesh;\n\t};\n}());\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/objects/image.js\n ** module id = 70\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/objects/image.js?"); /***/ }, /* 71 */ /***/ function(module, exports, __webpack_require__) { - eval("module.exports = (function () {\n\t'use strict';\n\n\tvar materials = __webpack_require__(7),\n\t\tTHREE = __webpack_require__(8),\n\t\tTAU = Math.PI * 2,\n\t\tHALF_PI = Math.PI / 2,\n\n\t\tdistance = 400000,\n\t\tscratchVector = new THREE.Vector3(),\n\n\t\tparams = [\n\t\t\t'luminance',\n\t\t\t'turbidity',\n\t\t\t'reileigh',\n\t\t\t'mieCoefficient',\n\t\t\t'mieDirectionalG'\n\t\t];\n\n\t__webpack_require__(72);\n\n\treturn function sky(parent, options) {\n\t\tvar obj = new THREE.Sky(),\n\t\t\tself = this,\n\t\t\tscene = parent,\n\t\t\tlight,\n\t\t\tsunPosition,\n\t\t\tazimuth = Math.PI / 6,\n\t\t\taltitude = Math.PI / 6;\n\n\t\tfunction mod(x, y) {\n\t\t\treturn x - y * Math.floor(x / y);\n\t\t}\n\n\t\tfunction update() {\n\t\t\tvar sinTheta,\n\t\t\t\tcosTheta,\n\t\t\t\tphi,\n\t\t\t\tsinPhi,\n\t\t\t\tcosPhi;\n\n\t\t\tsinTheta = Math.sin(altitude);\n\t\t\tcosTheta = Math.cos(altitude);\n\t\t\tphi = -HALF_PI - azimuth;\n\t\t\tsinPhi = Math.sin(phi);\n\t\t\tcosPhi = Math.cos(phi);\n\n\t\t\tsunPosition.set(\n\t\t\t\tdistance * cosPhi * cosTheta,\n\t\t\t\tdistance * sinTheta,\n\t\t\t\tdistance * sinPhi * cosTheta\n\t\t\t);\n\n\t\t\tif (light) {\n\t\t\t\tlight.intensity = 1.5 * Math.max(0.0, 1.0 - Math.exp(-((Math.PI / 1.95 - Math.abs(HALF_PI - altitude)) / 1.5)));\n\t\t\t\tlight.position.copy(sunPosition).normalize().multiplyScalar(100);\n\t\t\t}\n\t\t}\n\n\t\tobj.mesh.name = 'sky';\n\n\t\tparent.add(obj.mesh);\n\n\t\twhile (!(scene instanceof THREE.Scene) && scene.parent) {\n\t\t\tscene = scene.parent;\n\t\t}\n\t\tlight = scene.getObjectByName('directional-light');\n\n\t\tthis.setOptions = function (options) {\n\t\t\tvar needUpdate = false,\n\t\t\t\taltitude,\n\t\t\t\tazimuth;\n\n\t\t\tif (options) {\n\t\t\t\tparams.forEach(function (param) {\n\t\t\t\t\tvar val = options[param];\n\t\t\t\t\tif (val !== undefined) {\n\t\t\t\t\t\tval = parseFloat(val);\n\t\t\t\t\t\tif (!isNaN(val)) {\n\t\t\t\t\t\t\tobj.uniforms[param].value = val;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t});\n\n\t\t\t\tif (options.sunPosition instanceof THREE.Vector3) {\n\t\t\t\t\tobj.uniforms.sunPosition.value.copy(options.sunPosition);\n\t\t\t\t} else if (Array.isArray(options.sunPosition)) {\n\t\t\t\t\tobj.uniforms.sunPosition.value.set(obj.uniforms.sunPosition.value, options.sunPosition);\n\t\t\t\t} else {\n\t\t\t\t\tself.altitude = options.altitude;\n\t\t\t\t\tself.azimuth = options.azimuth;\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\n\t\tObject.defineProperty(this, 'azimuth', {\n\t\t\tset: function (val) {\n\t\t\t\tval = mod(parseFloat(val), TAU);\n\t\t\t\tif (!isNaN(val) && val !== azimuth) {\n\t\t\t\t\tazimuth = val;\n\t\t\t\t\tupdate();\n\t\t\t\t}\n\t\t\t},\n\t\t\tget: function () {\n\t\t\t\treturn azimuth;\n\t\t\t}\n\t\t});\n\n\t\tObject.defineProperty(this, 'altitude', {\n\t\t\tset: function (val) {\n\t\t\t\tval = mod(parseFloat(val), TAU);\n\t\t\t\tif (!isNaN(val) && val !== altitude) {\n\t\t\t\t\taltitude = val;\n\t\t\t\t\tupdate();\n\t\t\t\t}\n\t\t\t},\n\t\t\tget: function() {\n\t\t\t\treturn altitude;\n\t\t\t}\n\t\t});\n\n\t\tthis.setAltitude = function (val) {\n\t\t\tself.altitude = val;\n\t\t\treturn this;\n\t\t};\n\n\t\tthis.setAzimuth = function (val) {\n\t\t\tself.azimuth = val;\n\t\t\treturn this;\n\t\t};\n\n\t\tsunPosition = obj.uniforms.sunPosition.value;\n\t\tupdate();\n\n\t\tthis.setOptions(options);\n\n\t\tthis.raycastable = false;\n\n\t\treturn obj.mesh;\n\t};\n}());\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/objects/sky.js\n ** module id = 71\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/objects/sky.js?"); + eval("module.exports = (function () {\n\t'use strict';\n\n\tvar materials = __webpack_require__(7),\n\t\tTHREE = __webpack_require__(8),\n\t\tgeometry = new THREE.SphereGeometry(1000, 60, 60);\n\n\tgeometry.applyMatrix(new THREE.Matrix4().makeScale(-1, 1, 1));\n\tgeometry.applyMatrix(new THREE.Matrix4().makeRotationY(- Math.PI / 2));\n\n\treturn function panorama(parent, options) {\n\t\tvar material,\n\t\t\tmesh,\n\t\t\tsrc,\n\t\t\ttex;\n\n\t\tif (typeof options === 'string') {\n\t\t\tsrc = options;\n\t\t} else if (options) {\n\t\t\tsrc = options.src;\n\t\t}\n\n\t\tif (src) {\n\t\t\ttex = materials.imageTexture(src, THREE.UVMapping);\n\t\t}\n\n\t\tmaterial = new THREE.MeshBasicMaterial({\n\t\t\ttransparent: true,\n\t\t\tmap: tex\n\t\t});\n\n\t\tmesh = new THREE.Mesh(geometry, material);\n\n\t\tif (options && options.stereo) {\n\t\t\tif (options.stereo === 'vertical') {\n\t\t\t\ttex.repeat.y = 0.5;\n\t\t\t} else {\n\t\t\t\ttex.repeat.x = 0.5;\n\t\t\t}\n\t\t\tmesh.userData.stereo = options.stereo;\n\t\t}\n\n\t\tmesh.name = 'panorama';\n\n\t\tparent.add(mesh);\n\n\t\tthis.raycastable = false;\n\n\t\treturn mesh;\n\t};\n}());\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/objects/panorama.js\n ** module id = 71\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/objects/panorama.js?"); /***/ }, /* 72 */ /***/ function(module, exports, __webpack_require__) { - eval("/*** IMPORTS FROM imports-loader ***/\nvar THREE = __webpack_require__(8);\n\n/**\n * @author zz85 / https://github.com/zz85\n * \n * Based on \"A Practical Analytic Model for Daylight\" \n * aka The Preetham Model, the de facto standard analytic skydome model\n * http://www.cs.utah.edu/~shirley/papers/sunsky/sunsky.pdf\n * \n * First implemented by Simon Wallner\n * http://www.simonwallner.at/projects/atmospheric-scattering\n * \n * Improved by Martin Upitis\n * http://blenderartists.org/forum/showthread.php?245954-preethams-sky-impementation-HDR\n * \n * Three.js integration by zz85 http://twitter.com/blurspline\n*/\n\nTHREE.ShaderLib['sky'] = {\n\n\tuniforms: {\n\n\t\tluminance:\t { type: \"f\", value:1 },\n\t\tturbidity:\t { type: \"f\", value:2 },\n\t\treileigh:\t { type: \"f\", value:1 },\n\t\tmieCoefficient:\t { type: \"f\", value:0.005 },\n\t\tmieDirectionalG: { type: \"f\", value:0.8 },\n\t\tsunPosition: \t { type: \"v3\", value: new THREE.Vector3() }\n\n\t},\n\n\tvertexShader: [\n\n\t\t\"varying vec3 vWorldPosition;\",\n\t\t\"varying vec2 vUv;\",\n\n\t\t\"void main() {\",\n\n\t\t\t\"vec4 worldPosition = modelMatrix * vec4( position, 1.0 );\",\n\t\t\t\"vWorldPosition = worldPosition.xyz;\",\n\t\t\t\"vUv = uv;\",\n\n\t\t\t\"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\",\n\n\t\t\"}\",\n\n\t].join(\"\\n\"),\n\n\tfragmentShader: [\n\n\n\t\t\"uniform sampler2D skySampler;\",\n\t\t\"uniform vec3 sunPosition;\",\n\t\t\"varying vec3 vWorldPosition;\",\n\t\t\"varying vec2 vUv;\",\n\n\n\t\t\"vec3 cameraPos = vec3(0., 0., 0.);\",\n\t\t\"// uniform sampler2D sDiffuse;\",\n\t\t\"// const float turbidity = 10.0; //\",\n\t\t\"// const float reileigh = 2.; //\",\n\t\t\"// const float luminance = 1.0; //\",\n\t\t\"// const float mieCoefficient = 0.005;\",\n\t\t\"// const float mieDirectionalG = 0.8;\",\n\n\t\t\"uniform float luminance;\",\n\t\t\"uniform float turbidity;\",\n\t\t\"uniform float reileigh;\",\n\t\t\"uniform float mieCoefficient;\",\n\t\t\"uniform float mieDirectionalG;\",\n\n\n\t\t\"vec3 sunDirection = normalize(sunPosition);\",\n\t\t\"float reileighCoefficient = reileigh;\",\n\n\t\t\"// constants for atmospheric scattering\",\n\t\t\"const float e = 2.71828182845904523536028747135266249775724709369995957;\",\n\t\t\"const float pi = 3.141592653589793238462643383279502884197169;\",\n\n\t\t\"const float n = 1.0003; // refractive index of air\",\n\t\t\"const float N = 2.545E25; // number of molecules per unit volume for air at\",\n\t\t\t\t\t\t\t\t\"// 288.15K and 1013mb (sea level -45 celsius)\",\n\t\t\"const float pn = 0.035;\t// depolatization factor for standard air\",\n\n\t\t\"// wavelength of used primaries, according to preetham\",\n\t\t\"const vec3 lambda = vec3(680E-9, 550E-9, 450E-9);\",\n\n\t\t\"// mie stuff\",\n\t\t\"// K coefficient for the primaries\",\n\t\t\"const vec3 K = vec3(0.686, 0.678, 0.666);\",\n\t\t\"const float v = 4.0;\",\n\n\t\t\"// optical length at zenith for molecules\",\n\t\t\"const float rayleighZenithLength = 8.4E3;\",\n\t\t\"const float mieZenithLength = 1.25E3;\",\n\t\t\"const vec3 up = vec3(0.0, 1.0, 0.0);\",\n\n\t\t\"const float EE = 1000.0;\",\n\t\t\"const float sunAngularDiameterCos = 0.999956676946448443553574619906976478926848692873900859324;\",\n\t\t\"// 66 arc seconds -> degrees, and the cosine of that\",\n\n\t\t\"// earth shadow hack\",\n\t\t\"const float cutoffAngle = pi/1.95;\",\n\t\t\"const float steepness = 1.5;\",\n\n\n\t\t\"vec3 totalRayleigh(vec3 lambda)\",\n\t\t\"{\",\n\t\t\t\"return (8.0 * pow(pi, 3.0) * pow(pow(n, 2.0) - 1.0, 2.0) * (6.0 + 3.0 * pn)) / (3.0 * N * pow(lambda, vec3(4.0)) * (6.0 - 7.0 * pn));\",\n\t\t\"}\",\n\n\t\t// see http://blenderartists.org/forum/showthread.php?321110-Shaders-and-Skybox-madness\n\t\t\"// A simplied version of the total Reayleigh scattering to works on browsers that use ANGLE\",\n\t\t\"vec3 simplifiedRayleigh()\",\n\t\t\"{\",\n\t\t\t\"return 0.0005 / vec3(94, 40, 18);\",\n\t\t\t// return 0.00054532832366 / (3.0 * 2.545E25 * pow(vec3(680E-9, 550E-9, 450E-9), vec3(4.0)) * 6.245);\n\t\t\"}\",\n\n\t\t\"float rayleighPhase(float cosTheta)\",\n\t\t\"{\t \",\n\t\t\t\"return (3.0 / (16.0*pi)) * (1.0 + pow(cosTheta, 2.0));\",\n\t\t\"//\treturn (1.0 / (3.0*pi)) * (1.0 + pow(cosTheta, 2.0));\",\n\t\t\"//\treturn (3.0 / 4.0) * (1.0 + pow(cosTheta, 2.0));\",\n\t\t\"}\",\n\n\t\t\"vec3 totalMie(vec3 lambda, vec3 K, float T)\",\n\t\t\"{\",\n\t\t\t\"float c = (0.2 * T ) * 10E-18;\",\n\t\t\t\"return 0.434 * c * pi * pow((2.0 * pi) / lambda, vec3(v - 2.0)) * K;\",\n\t\t\"}\",\n\n\t\t\"float hgPhase(float cosTheta, float g)\",\n\t\t\"{\",\n\t\t\t\"return (1.0 / (4.0*pi)) * ((1.0 - pow(g, 2.0)) / pow(1.0 - 2.0*g*cosTheta + pow(g, 2.0), 1.5));\",\n\t\t\"}\",\n\n\t\t\"float sunIntensity(float zenithAngleCos)\",\n\t\t\"{\",\n\t\t\t\"return EE * max(0.0, 1.0 - exp(-((cutoffAngle - acos(zenithAngleCos))/steepness)));\",\n\t\t\"}\",\n\n\t\t\"// float logLuminance(vec3 c)\",\n\t\t\"// {\",\n\t\t\"// \treturn log(c.r * 0.2126 + c.g * 0.7152 + c.b * 0.0722);\",\n\t\t\"// }\",\n\n\t\t\"// Filmic ToneMapping http://filmicgames.com/archives/75\",\n\t\t\"float A = 0.15;\",\n\t\t\"float B = 0.50;\",\n\t\t\"float C = 0.10;\",\n\t\t\"float D = 0.20;\",\n\t\t\"float E = 0.02;\",\n\t\t\"float F = 0.30;\",\n\t\t\"float W = 1000.0;\",\n\n\t\t\"vec3 Uncharted2Tonemap(vec3 x)\",\n\t\t\"{\",\n\t\t \"return ((x*(A*x+C*B)+D*E)/(x*(A*x+B)+D*F))-E/F;\",\n\t\t\"}\",\n\n\n\t\t\"void main() \",\n\t\t\"{\",\n\t\t\t\"float sunfade = 1.0-clamp(1.0-exp((sunPosition.y/450000.0)),0.0,1.0);\",\n\n\t\t\t\"// luminance = 1.0 ;// vWorldPosition.y / 450000. + 0.5; //sunPosition.y / 450000. * 1. + 0.5;\",\n\n\t\t\t \"// gl_FragColor = vec4(sunfade, sunfade, sunfade, 1.0);\",\n\t\t\t\n\t\t\t\"reileighCoefficient = reileighCoefficient - (1.0* (1.0-sunfade));\",\n\t\t\t\n\t\t\t\"float sunE = sunIntensity(dot(sunDirection, up));\",\n\n\t\t\t\"// extinction (absorbtion + out scattering) \",\n\t\t\t\"// rayleigh coefficients\",\n\n\t\t\t// \"vec3 betaR = totalRayleigh(lambda) * reileighCoefficient;\",\n\t\t\t\"vec3 betaR = simplifiedRayleigh() * reileighCoefficient;\",\n\n\t\t\t\"// mie coefficients\",\n\t\t\t\"vec3 betaM = totalMie(lambda, K, turbidity) * mieCoefficient;\",\n\n\t\t\t\"// optical length\",\n\t\t\t\"// cutoff angle at 90 to avoid singularity in next formula.\",\n\t\t\t\"float zenithAngle = acos(max(0.0, dot(up, normalize(vWorldPosition - cameraPos))));\",\n\t\t\t\"float sR = rayleighZenithLength / (cos(zenithAngle) + 0.15 * pow(93.885 - ((zenithAngle * 180.0) / pi), -1.253));\",\n\t\t\t\"float sM = mieZenithLength / (cos(zenithAngle) + 0.15 * pow(93.885 - ((zenithAngle * 180.0) / pi), -1.253));\",\n\n\n\n\t\t\t\"// combined extinction factor\t\",\n\t\t\t\"vec3 Fex = exp(-(betaR * sR + betaM * sM));\",\n\n\t\t\t\"// in scattering\",\n\t\t\t\"float cosTheta = dot(normalize(vWorldPosition - cameraPos), sunDirection);\",\n\n\t\t\t\"float rPhase = rayleighPhase(cosTheta*0.5+0.5);\",\n\t\t\t\"vec3 betaRTheta = betaR * rPhase;\",\n\n\t\t\t\"float mPhase = hgPhase(cosTheta, mieDirectionalG);\",\n\t\t\t\"vec3 betaMTheta = betaM * mPhase;\",\n\n\n\t\t\t\"vec3 Lin = pow(sunE * ((betaRTheta + betaMTheta) / (betaR + betaM)) * (1.0 - Fex),vec3(1.5));\",\n\t\t\t\"Lin *= mix(vec3(1.0),pow(sunE * ((betaRTheta + betaMTheta) / (betaR + betaM)) * Fex,vec3(1.0/2.0)),clamp(pow(1.0-dot(up, sunDirection),5.0),0.0,1.0));\",\n\n\t\t\t\"//nightsky\",\n\t\t\t\"vec3 direction = normalize(vWorldPosition - cameraPos);\",\n\t\t\t\"float theta = acos(direction.y); // elevation --> y-axis, [-pi/2, pi/2]\",\n\t\t\t\"float phi = atan(direction.z, direction.x); // azimuth --> x-axis [-pi/2, pi/2]\",\n\t\t\t\"vec2 uv = vec2(phi, theta) / vec2(2.0*pi, pi) + vec2(0.5, 0.0);\",\n\t\t\t\"// vec3 L0 = texture2D(skySampler, uv).rgb+0.1 * Fex;\",\n\t\t\t\"vec3 L0 = vec3(0.1) * Fex;\",\n\t\t\t\n\t\t\t\"// composition + solar disc\",\n\t\t\t\"//if (cosTheta > sunAngularDiameterCos)\",\n\t\t\t\"float sundisk = smoothstep(sunAngularDiameterCos,sunAngularDiameterCos+0.00002,cosTheta);\",\n\t\t\t\"// if (normalize(vWorldPosition - cameraPos).y>0.0)\",\n\t\t\t\"L0 += (sunE * 19000.0 * Fex)*sundisk;\",\n\n\n\t\t\t\"vec3 whiteScale = 1.0/Uncharted2Tonemap(vec3(W));\",\n\t\t\t\n\t\t\t\"vec3 texColor = (Lin+L0); \",\n\t\t\t\"texColor *= 0.04 ;\",\n\t\t\t\"texColor += vec3(0.0,0.001,0.0025)*0.3;\",\n\t\t\t\n\t\t\t\"float g_fMaxLuminance = 1.0;\",\n\t\t\t\"float fLumScaled = 0.1 / luminance; \",\n\t\t\t\"float fLumCompressed = (fLumScaled * (1.0 + (fLumScaled / (g_fMaxLuminance * g_fMaxLuminance)))) / (1.0 + fLumScaled); \",\n\n\t\t\t\"float ExposureBias = fLumCompressed;\",\n\t\t \n\t\t\t\"vec3 curr = Uncharted2Tonemap((log2(2.0/pow(luminance,4.0)))*texColor);\",\n\t\t\t\"vec3 color = curr*whiteScale;\",\n\n\t\t\t\"vec3 retColor = pow(color,vec3(1.0/(1.2+(1.2*sunfade))));\",\n\n\t\t\t\n\t\t\t\"gl_FragColor.rgb = retColor;\",\n\t\t\t\t\n\t\t\t\"gl_FragColor.a = 1.0;\",\n\t\t\"}\",\n\n\t].join(\"\\n\")\n\n};\n\nTHREE.Sky = function () {\n\n\tvar skyShader = THREE.ShaderLib[ \"sky\" ];\n\tvar skyUniforms = THREE.UniformsUtils.clone( skyShader.uniforms );\n\n\tvar skyMat = new THREE.ShaderMaterial( { \n\t\tfragmentShader: skyShader.fragmentShader, \n\t\tvertexShader: skyShader.vertexShader, \n\t\tuniforms: skyUniforms,\n\t\tside: THREE.BackSide\n\t} );\n\n\tvar skyGeo = new THREE.SphereGeometry( 450000, 32, 15 );\n\tvar skyMesh = new THREE.Mesh( skyGeo, skyMat );\n\n\n\t// Expose variables\n\tthis.mesh = skyMesh;\n\tthis.uniforms = skyUniforms;\n\n\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/imports-loader?THREE=three!./bower_components/SkyShader/index.js\n ** module id = 72\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./bower_components/SkyShader/index.js?./~/imports-loader?THREE=three"); + eval("module.exports = (function () {\n\t'use strict';\n\n\tvar materials = __webpack_require__(7),\n\t\tTHREE = __webpack_require__(8),\n\t\tTAU = Math.PI * 2,\n\t\tHALF_PI = Math.PI / 2,\n\n\t\tdistance = 400000,\n\t\tscratchVector = new THREE.Vector3(),\n\n\t\tparams = [\n\t\t\t'luminance',\n\t\t\t'turbidity',\n\t\t\t'reileigh',\n\t\t\t'mieCoefficient',\n\t\t\t'mieDirectionalG'\n\t\t];\n\n\t__webpack_require__(73);\n\n\treturn function sky(parent, options) {\n\t\tvar obj = new THREE.Sky(),\n\t\t\tself = this,\n\t\t\tscene = parent,\n\t\t\tlight,\n\t\t\tsunPosition,\n\t\t\tazimuth = Math.PI / 6,\n\t\t\taltitude = Math.PI / 6;\n\n\t\tfunction mod(x, y) {\n\t\t\treturn x - y * Math.floor(x / y);\n\t\t}\n\n\t\tfunction update() {\n\t\t\tvar sinTheta,\n\t\t\t\tcosTheta,\n\t\t\t\tphi,\n\t\t\t\tsinPhi,\n\t\t\t\tcosPhi;\n\n\t\t\tsinTheta = Math.sin(altitude);\n\t\t\tcosTheta = Math.cos(altitude);\n\t\t\tphi = -HALF_PI - azimuth;\n\t\t\tsinPhi = Math.sin(phi);\n\t\t\tcosPhi = Math.cos(phi);\n\n\t\t\tsunPosition.set(\n\t\t\t\tdistance * cosPhi * cosTheta,\n\t\t\t\tdistance * sinTheta,\n\t\t\t\tdistance * sinPhi * cosTheta\n\t\t\t);\n\n\t\t\tif (light) {\n\t\t\t\tlight.intensity = 1.5 * Math.max(0.0, 1.0 - Math.exp(-((Math.PI / 1.95 - Math.abs(HALF_PI - altitude)) / 1.5)));\n\t\t\t\tlight.position.copy(sunPosition).normalize().multiplyScalar(100);\n\t\t\t}\n\t\t}\n\n\t\tobj.mesh.name = 'sky';\n\n\t\tparent.add(obj.mesh);\n\n\t\twhile (!(scene instanceof THREE.Scene) && scene.parent) {\n\t\t\tscene = scene.parent;\n\t\t}\n\t\tlight = scene.getObjectByName('directional-light');\n\n\t\tthis.setOptions = function (options) {\n\t\t\tvar needUpdate = false,\n\t\t\t\taltitude,\n\t\t\t\tazimuth;\n\n\t\t\tif (options) {\n\t\t\t\tparams.forEach(function (param) {\n\t\t\t\t\tvar val = options[param];\n\t\t\t\t\tif (val !== undefined) {\n\t\t\t\t\t\tval = parseFloat(val);\n\t\t\t\t\t\tif (!isNaN(val)) {\n\t\t\t\t\t\t\tobj.uniforms[param].value = val;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t});\n\n\t\t\t\tif (options.sunPosition instanceof THREE.Vector3) {\n\t\t\t\t\tobj.uniforms.sunPosition.value.copy(options.sunPosition);\n\t\t\t\t} else if (Array.isArray(options.sunPosition)) {\n\t\t\t\t\tobj.uniforms.sunPosition.value.set(obj.uniforms.sunPosition.value, options.sunPosition);\n\t\t\t\t} else {\n\t\t\t\t\tself.altitude = options.altitude;\n\t\t\t\t\tself.azimuth = options.azimuth;\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\n\t\tObject.defineProperty(this, 'azimuth', {\n\t\t\tset: function (val) {\n\t\t\t\tval = mod(parseFloat(val), TAU);\n\t\t\t\tif (!isNaN(val) && val !== azimuth) {\n\t\t\t\t\tazimuth = val;\n\t\t\t\t\tupdate();\n\t\t\t\t}\n\t\t\t},\n\t\t\tget: function () {\n\t\t\t\treturn azimuth;\n\t\t\t}\n\t\t});\n\n\t\tObject.defineProperty(this, 'altitude', {\n\t\t\tset: function (val) {\n\t\t\t\tval = mod(parseFloat(val), TAU);\n\t\t\t\tif (!isNaN(val) && val !== altitude) {\n\t\t\t\t\taltitude = val;\n\t\t\t\t\tupdate();\n\t\t\t\t}\n\t\t\t},\n\t\t\tget: function() {\n\t\t\t\treturn altitude;\n\t\t\t}\n\t\t});\n\n\t\tthis.setAltitude = function (val) {\n\t\t\tself.altitude = val;\n\t\t\treturn this;\n\t\t};\n\n\t\tthis.setAzimuth = function (val) {\n\t\t\tself.azimuth = val;\n\t\t\treturn this;\n\t\t};\n\n\t\tsunPosition = obj.uniforms.sunPosition.value;\n\t\tupdate();\n\n\t\tthis.setOptions(options);\n\n\t\tthis.raycastable = false;\n\n\t\treturn obj.mesh;\n\t};\n}());\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/objects/sky.js\n ** module id = 72\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/objects/sky.js?"); /***/ }, /* 73 */ /***/ function(module, exports, __webpack_require__) { - eval("module.exports = (function () {\n\t'use strict';\n\n\tvar materials = __webpack_require__(7),\n\t\tTHREE = __webpack_require__(8);\n\n\t__webpack_require__(74);\n\n\treturn function sound(parent, options) {\n\t\tvar obj,\n\t\t\tsrc,\n\t\t\tlistener,\n\t\t\tscene = parent;\n\n\t\tif (typeof options === 'string' || Array.isArray(options)) {\n\t\t\tsrc = options;\n\t\t} else if (options) {\n\t\t\tsrc = options.src;\n\t\t}\n\n\t\twhile (!(scene instanceof THREE.Scene) && scene.parent) {\n\t\t\tscene = scene.parent;\n\t\t}\n\n\t\tlistener = scene.getObjectByName('audio-listener');\n\t\tobj = new THREE.Audio(listener);\n\t\t// obj.setLoop(true);\n\t\tobj.load(src);\n\n\t\tthis.start = obj.start.bind(obj);\n\t\tthis.volume = obj.volume.bind(obj);\n\n\t\tparent.add(obj);\n\n\t\treturn obj;\n\t};\n}());\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/objects/sound.js\n ** module id = 73\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/objects/sound.js?"); + eval("/*** IMPORTS FROM imports-loader ***/\nvar THREE = __webpack_require__(8);\n\n/**\n * @author zz85 / https://github.com/zz85\n * \n * Based on \"A Practical Analytic Model for Daylight\" \n * aka The Preetham Model, the de facto standard analytic skydome model\n * http://www.cs.utah.edu/~shirley/papers/sunsky/sunsky.pdf\n * \n * First implemented by Simon Wallner\n * http://www.simonwallner.at/projects/atmospheric-scattering\n * \n * Improved by Martin Upitis\n * http://blenderartists.org/forum/showthread.php?245954-preethams-sky-impementation-HDR\n * \n * Three.js integration by zz85 http://twitter.com/blurspline\n*/\n\nTHREE.ShaderLib['sky'] = {\n\n\tuniforms: {\n\n\t\tluminance:\t { type: \"f\", value:1 },\n\t\tturbidity:\t { type: \"f\", value:2 },\n\t\treileigh:\t { type: \"f\", value:1 },\n\t\tmieCoefficient:\t { type: \"f\", value:0.005 },\n\t\tmieDirectionalG: { type: \"f\", value:0.8 },\n\t\tsunPosition: \t { type: \"v3\", value: new THREE.Vector3() }\n\n\t},\n\n\tvertexShader: [\n\n\t\t\"varying vec3 vWorldPosition;\",\n\t\t\"varying vec2 vUv;\",\n\n\t\t\"void main() {\",\n\n\t\t\t\"vec4 worldPosition = modelMatrix * vec4( position, 1.0 );\",\n\t\t\t\"vWorldPosition = worldPosition.xyz;\",\n\t\t\t\"vUv = uv;\",\n\n\t\t\t\"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\",\n\n\t\t\"}\",\n\n\t].join(\"\\n\"),\n\n\tfragmentShader: [\n\n\n\t\t\"uniform sampler2D skySampler;\",\n\t\t\"uniform vec3 sunPosition;\",\n\t\t\"varying vec3 vWorldPosition;\",\n\t\t\"varying vec2 vUv;\",\n\n\n\t\t\"vec3 cameraPos = vec3(0., 0., 0.);\",\n\t\t\"// uniform sampler2D sDiffuse;\",\n\t\t\"// const float turbidity = 10.0; //\",\n\t\t\"// const float reileigh = 2.; //\",\n\t\t\"// const float luminance = 1.0; //\",\n\t\t\"// const float mieCoefficient = 0.005;\",\n\t\t\"// const float mieDirectionalG = 0.8;\",\n\n\t\t\"uniform float luminance;\",\n\t\t\"uniform float turbidity;\",\n\t\t\"uniform float reileigh;\",\n\t\t\"uniform float mieCoefficient;\",\n\t\t\"uniform float mieDirectionalG;\",\n\n\n\t\t\"vec3 sunDirection = normalize(sunPosition);\",\n\t\t\"float reileighCoefficient = reileigh;\",\n\n\t\t\"// constants for atmospheric scattering\",\n\t\t\"const float e = 2.71828182845904523536028747135266249775724709369995957;\",\n\t\t\"const float pi = 3.141592653589793238462643383279502884197169;\",\n\n\t\t\"const float n = 1.0003; // refractive index of air\",\n\t\t\"const float N = 2.545E25; // number of molecules per unit volume for air at\",\n\t\t\t\t\t\t\t\t\"// 288.15K and 1013mb (sea level -45 celsius)\",\n\t\t\"const float pn = 0.035;\t// depolatization factor for standard air\",\n\n\t\t\"// wavelength of used primaries, according to preetham\",\n\t\t\"const vec3 lambda = vec3(680E-9, 550E-9, 450E-9);\",\n\n\t\t\"// mie stuff\",\n\t\t\"// K coefficient for the primaries\",\n\t\t\"const vec3 K = vec3(0.686, 0.678, 0.666);\",\n\t\t\"const float v = 4.0;\",\n\n\t\t\"// optical length at zenith for molecules\",\n\t\t\"const float rayleighZenithLength = 8.4E3;\",\n\t\t\"const float mieZenithLength = 1.25E3;\",\n\t\t\"const vec3 up = vec3(0.0, 1.0, 0.0);\",\n\n\t\t\"const float EE = 1000.0;\",\n\t\t\"const float sunAngularDiameterCos = 0.999956676946448443553574619906976478926848692873900859324;\",\n\t\t\"// 66 arc seconds -> degrees, and the cosine of that\",\n\n\t\t\"// earth shadow hack\",\n\t\t\"const float cutoffAngle = pi/1.95;\",\n\t\t\"const float steepness = 1.5;\",\n\n\n\t\t\"vec3 totalRayleigh(vec3 lambda)\",\n\t\t\"{\",\n\t\t\t\"return (8.0 * pow(pi, 3.0) * pow(pow(n, 2.0) - 1.0, 2.0) * (6.0 + 3.0 * pn)) / (3.0 * N * pow(lambda, vec3(4.0)) * (6.0 - 7.0 * pn));\",\n\t\t\"}\",\n\n\t\t// see http://blenderartists.org/forum/showthread.php?321110-Shaders-and-Skybox-madness\n\t\t\"// A simplied version of the total Reayleigh scattering to works on browsers that use ANGLE\",\n\t\t\"vec3 simplifiedRayleigh()\",\n\t\t\"{\",\n\t\t\t\"return 0.0005 / vec3(94, 40, 18);\",\n\t\t\t// return 0.00054532832366 / (3.0 * 2.545E25 * pow(vec3(680E-9, 550E-9, 450E-9), vec3(4.0)) * 6.245);\n\t\t\"}\",\n\n\t\t\"float rayleighPhase(float cosTheta)\",\n\t\t\"{\t \",\n\t\t\t\"return (3.0 / (16.0*pi)) * (1.0 + pow(cosTheta, 2.0));\",\n\t\t\"//\treturn (1.0 / (3.0*pi)) * (1.0 + pow(cosTheta, 2.0));\",\n\t\t\"//\treturn (3.0 / 4.0) * (1.0 + pow(cosTheta, 2.0));\",\n\t\t\"}\",\n\n\t\t\"vec3 totalMie(vec3 lambda, vec3 K, float T)\",\n\t\t\"{\",\n\t\t\t\"float c = (0.2 * T ) * 10E-18;\",\n\t\t\t\"return 0.434 * c * pi * pow((2.0 * pi) / lambda, vec3(v - 2.0)) * K;\",\n\t\t\"}\",\n\n\t\t\"float hgPhase(float cosTheta, float g)\",\n\t\t\"{\",\n\t\t\t\"return (1.0 / (4.0*pi)) * ((1.0 - pow(g, 2.0)) / pow(1.0 - 2.0*g*cosTheta + pow(g, 2.0), 1.5));\",\n\t\t\"}\",\n\n\t\t\"float sunIntensity(float zenithAngleCos)\",\n\t\t\"{\",\n\t\t\t\"return EE * max(0.0, 1.0 - exp(-((cutoffAngle - acos(zenithAngleCos))/steepness)));\",\n\t\t\"}\",\n\n\t\t\"// float logLuminance(vec3 c)\",\n\t\t\"// {\",\n\t\t\"// \treturn log(c.r * 0.2126 + c.g * 0.7152 + c.b * 0.0722);\",\n\t\t\"// }\",\n\n\t\t\"// Filmic ToneMapping http://filmicgames.com/archives/75\",\n\t\t\"float A = 0.15;\",\n\t\t\"float B = 0.50;\",\n\t\t\"float C = 0.10;\",\n\t\t\"float D = 0.20;\",\n\t\t\"float E = 0.02;\",\n\t\t\"float F = 0.30;\",\n\t\t\"float W = 1000.0;\",\n\n\t\t\"vec3 Uncharted2Tonemap(vec3 x)\",\n\t\t\"{\",\n\t\t \"return ((x*(A*x+C*B)+D*E)/(x*(A*x+B)+D*F))-E/F;\",\n\t\t\"}\",\n\n\n\t\t\"void main() \",\n\t\t\"{\",\n\t\t\t\"float sunfade = 1.0-clamp(1.0-exp((sunPosition.y/450000.0)),0.0,1.0);\",\n\n\t\t\t\"// luminance = 1.0 ;// vWorldPosition.y / 450000. + 0.5; //sunPosition.y / 450000. * 1. + 0.5;\",\n\n\t\t\t \"// gl_FragColor = vec4(sunfade, sunfade, sunfade, 1.0);\",\n\t\t\t\n\t\t\t\"reileighCoefficient = reileighCoefficient - (1.0* (1.0-sunfade));\",\n\t\t\t\n\t\t\t\"float sunE = sunIntensity(dot(sunDirection, up));\",\n\n\t\t\t\"// extinction (absorbtion + out scattering) \",\n\t\t\t\"// rayleigh coefficients\",\n\n\t\t\t// \"vec3 betaR = totalRayleigh(lambda) * reileighCoefficient;\",\n\t\t\t\"vec3 betaR = simplifiedRayleigh() * reileighCoefficient;\",\n\n\t\t\t\"// mie coefficients\",\n\t\t\t\"vec3 betaM = totalMie(lambda, K, turbidity) * mieCoefficient;\",\n\n\t\t\t\"// optical length\",\n\t\t\t\"// cutoff angle at 90 to avoid singularity in next formula.\",\n\t\t\t\"float zenithAngle = acos(max(0.0, dot(up, normalize(vWorldPosition - cameraPos))));\",\n\t\t\t\"float sR = rayleighZenithLength / (cos(zenithAngle) + 0.15 * pow(93.885 - ((zenithAngle * 180.0) / pi), -1.253));\",\n\t\t\t\"float sM = mieZenithLength / (cos(zenithAngle) + 0.15 * pow(93.885 - ((zenithAngle * 180.0) / pi), -1.253));\",\n\n\n\n\t\t\t\"// combined extinction factor\t\",\n\t\t\t\"vec3 Fex = exp(-(betaR * sR + betaM * sM));\",\n\n\t\t\t\"// in scattering\",\n\t\t\t\"float cosTheta = dot(normalize(vWorldPosition - cameraPos), sunDirection);\",\n\n\t\t\t\"float rPhase = rayleighPhase(cosTheta*0.5+0.5);\",\n\t\t\t\"vec3 betaRTheta = betaR * rPhase;\",\n\n\t\t\t\"float mPhase = hgPhase(cosTheta, mieDirectionalG);\",\n\t\t\t\"vec3 betaMTheta = betaM * mPhase;\",\n\n\n\t\t\t\"vec3 Lin = pow(sunE * ((betaRTheta + betaMTheta) / (betaR + betaM)) * (1.0 - Fex),vec3(1.5));\",\n\t\t\t\"Lin *= mix(vec3(1.0),pow(sunE * ((betaRTheta + betaMTheta) / (betaR + betaM)) * Fex,vec3(1.0/2.0)),clamp(pow(1.0-dot(up, sunDirection),5.0),0.0,1.0));\",\n\n\t\t\t\"//nightsky\",\n\t\t\t\"vec3 direction = normalize(vWorldPosition - cameraPos);\",\n\t\t\t\"float theta = acos(direction.y); // elevation --> y-axis, [-pi/2, pi/2]\",\n\t\t\t\"float phi = atan(direction.z, direction.x); // azimuth --> x-axis [-pi/2, pi/2]\",\n\t\t\t\"vec2 uv = vec2(phi, theta) / vec2(2.0*pi, pi) + vec2(0.5, 0.0);\",\n\t\t\t\"// vec3 L0 = texture2D(skySampler, uv).rgb+0.1 * Fex;\",\n\t\t\t\"vec3 L0 = vec3(0.1) * Fex;\",\n\t\t\t\n\t\t\t\"// composition + solar disc\",\n\t\t\t\"//if (cosTheta > sunAngularDiameterCos)\",\n\t\t\t\"float sundisk = smoothstep(sunAngularDiameterCos,sunAngularDiameterCos+0.00002,cosTheta);\",\n\t\t\t\"// if (normalize(vWorldPosition - cameraPos).y>0.0)\",\n\t\t\t\"L0 += (sunE * 19000.0 * Fex)*sundisk;\",\n\n\n\t\t\t\"vec3 whiteScale = 1.0/Uncharted2Tonemap(vec3(W));\",\n\t\t\t\n\t\t\t\"vec3 texColor = (Lin+L0); \",\n\t\t\t\"texColor *= 0.04 ;\",\n\t\t\t\"texColor += vec3(0.0,0.001,0.0025)*0.3;\",\n\t\t\t\n\t\t\t\"float g_fMaxLuminance = 1.0;\",\n\t\t\t\"float fLumScaled = 0.1 / luminance; \",\n\t\t\t\"float fLumCompressed = (fLumScaled * (1.0 + (fLumScaled / (g_fMaxLuminance * g_fMaxLuminance)))) / (1.0 + fLumScaled); \",\n\n\t\t\t\"float ExposureBias = fLumCompressed;\",\n\t\t \n\t\t\t\"vec3 curr = Uncharted2Tonemap((log2(2.0/pow(luminance,4.0)))*texColor);\",\n\t\t\t\"vec3 color = curr*whiteScale;\",\n\n\t\t\t\"vec3 retColor = pow(color,vec3(1.0/(1.2+(1.2*sunfade))));\",\n\n\t\t\t\n\t\t\t\"gl_FragColor.rgb = retColor;\",\n\t\t\t\t\n\t\t\t\"gl_FragColor.a = 1.0;\",\n\t\t\"}\",\n\n\t].join(\"\\n\")\n\n};\n\nTHREE.Sky = function () {\n\n\tvar skyShader = THREE.ShaderLib[ \"sky\" ];\n\tvar skyUniforms = THREE.UniformsUtils.clone( skyShader.uniforms );\n\n\tvar skyMat = new THREE.ShaderMaterial( { \n\t\tfragmentShader: skyShader.fragmentShader, \n\t\tvertexShader: skyShader.vertexShader, \n\t\tuniforms: skyUniforms,\n\t\tside: THREE.BackSide\n\t} );\n\n\tvar skyGeo = new THREE.SphereGeometry( 450000, 32, 15 );\n\tvar skyMesh = new THREE.Mesh( skyGeo, skyMat );\n\n\n\t// Expose variables\n\tthis.mesh = skyMesh;\n\tthis.uniforms = skyUniforms;\n\n\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/imports-loader?THREE=three!./bower_components/SkyShader/index.js\n ** module id = 73\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./bower_components/SkyShader/index.js?./~/imports-loader?THREE=three"); /***/ }, /* 74 */ /***/ function(module, exports, __webpack_require__) { - eval("/*** IMPORTS FROM imports-loader ***/\nvar THREE = __webpack_require__(8);\n\n/**\n * @author mrdoob / http://mrdoob.com/\n */\n\nTHREE.Audio = function ( listener ) {\n\n\tTHREE.Object3D.call( this );\n\n\tthis.type = 'Audio';\n\tthis.started = false;\n\n\tif (listener.context) {\n\n\t\tthis.context = listener.context;\n\t\t// this.source = this.context.createBufferSource();\n\n\t\tthis.gain = this.context.createGain();\n\t\tthis.gain.connect( listener.input );\n\n\t\tthis.panner = this.context.createPanner();\n\t\tthis.panner.connect( this.gain );\n\n\t} else {\n\n\t\tthis.source = new Audio();\n\n\t}\n};\n\nTHREE.Audio.prototype = Object.create( THREE.Object3D.prototype );\n\nTHREE.Audio.prototype.load = function ( sources ) {\n\t//todo: support multiple sources for different audio formats\n\n\tvar scope = this;\n\tvar file;\n\tvar i;\n\tvar match;\n\tvar element = this.source instanceof window.HTMLAudioElement ? this.source : new Audio();\n\n\tif (typeof sources === 'string') {\n\t\tsources = [sources];\n\t}\n\n\tfor (i = 0; i < sources.length; i++) {\n\t\tfile = sources[i];\n\t\tmatch = /\\.([a-z0-9]+)$/i.exec(file);\n\t\tif (match && element.canPlayType('audio/' + match[1])) {\n\t\t\tbreak;\n\t\t}\n\t}\n\n\tif (this.context) {\n\t\tvar request = new XMLHttpRequest();\n\t\trequest.open( 'GET', file, true );\n\t\trequest.responseType = 'arraybuffer';\n\t\trequest.onload = function ( e ) {\n\t\t\tconsole.log('audio buffer loaded. decoding...', e );\n\t\t\tscope.context.decodeAudioData( this.response, function ( buffer ) {\n\n\t\t\t\tscope.buffer = buffer;\n\t\t\t\tif (scope.started) {\n\t\t\t\t\tscope.start();\n\t\t\t\t}\n\n\t\t\t}, function onFailure(e) {\n\t\t\t\tconsole.log('Decoding the audio buffer failed', e);\n\t\t\t} );\n\n\t\t};\n\n\t\trequest.onerror = function ( e ) {\n\t\t\tconsole.log('error', e);\n\t\t};\n\n\t\trequest.send();\n\n\t} else {\n\n\t\tthis.source.src = file;\n\t\tthis.source.play();\n\n\t}\n\n\treturn this;\n};\n\nTHREE.Audio.prototype.stop = function ( value ) {\n\n\tif (this.context) {\n\t\tthis.source.stop();\n\t\tthis.source.disconnect( this.panner );\n\t\tthis.source = null;\n\t} else {\n\t\tthis.source.pause();\n\t\tthis.source.currentTime = 0;\n\t}\n\tthis.started = false;\n};\n\nTHREE.Audio.prototype.start = function ( value ) {\n\n\tthis.started = true;\n\tif (this.context) {\n\t\tif (this.source) {\n\t\t\tthis.source.disconnect( this.panner );\n\t\t}\n\n\t\tif (this.buffer) {\n\t\t\tthis.source = this.context.createBufferSource();\n\t\t\tthis.source.buffer = this.buffer;\n\t\t\tthis.source.connect( this.panner );\n\t\t\tthis.source.start( 0 );\n\t\t}\n\t} else {\n\t\tthis.source.currentTime = 0;\n\t\tthis.source.play();\n\t}\n\n};\n\nTHREE.Audio.prototype.setLoop = function ( value ) {\n\n\tthis.source.loop = value;\n\n};\n\nTHREE.Audio.prototype.setRefDistance = function ( value ) {\n\n\tif ( this.panner ) {\n\n\t\tthis.panner.refDistance = value;\n\n\t}\n\n};\n\nTHREE.Audio.prototype.setRolloffFactor = function ( value ) {\n\n\tif ( this.panner ) {\n\n\t\tthis.panner.rolloffFactor = value;\n\n\t}\n\n};\n\nTHREE.Audio.prototype.volume = function ( volume, time ) {\n\n\tif ( this.gain ) {\n\n\t\tif ( volume !== undefined ) {\n\t\t\tthis.gain.gain.linearRampToValueAtTime( volume, this.context.currentTime + (time || 0));\n\t\t}\n\n\t\treturn this.gain.gain.value;\n\t}\n\n\tif ( volume !== undefined ) {\n\t\tthis.source.volume = volume;\n\t}\n\n\treturn this.source.volume;\n};\n\nTHREE.Audio.prototype.updateMatrixWorld = ( function () {\n\n\tvar position = new THREE.Vector3();\n\n\treturn function ( force ) {\n\n\t\tTHREE.Object3D.prototype.updateMatrixWorld.call( this, force );\n\n\t\tposition.setFromMatrixPosition( this.matrixWorld );\n\n\t\tif (this.panner) {\n\n\t\t\tthis.panner.setPosition( position.x, position.y, position.z );\n\n\t\t}\n\n\t};\n\n} )();\n\n// File:src/extras/audio/AudioListener.js\n\n/**\n * @author mrdoob / http://mrdoob.com/\n */\n\nTHREE.AudioListener = function () {\n\tvar AudioContext = window.AudioContext || window.webkitAudioContext;\n\n\tTHREE.Object3D.call( this );\n\n\tthis.type = 'AudioListener';\n\n\tif (AudioContext) {\n\t\tthis.context = new AudioContext();\n\t\tthis.input = this.context.createGain();\n\n\t\tthis.input.connect( this.context.destination );\n\t}\n};\n\nTHREE.AudioListener.prototype = Object.create( THREE.Object3D.prototype );\n\nTHREE.AudioListener.prototype.volume = function (val) {\n\tif (this.input) {\n\t\tval = val !== undefined && parseFloat(val);\n\t\tif (!isNaN(val)) {\n\t\t\tthis.input.gain.value = val;\n\t\t}\n\n\t\treturn this.input.gain.value;\n\t}\n};\n\nTHREE.AudioListener.prototype.updateMatrixWorld = ( function () {\n\n\tvar position = new THREE.Vector3();\n\tvar quaternion = new THREE.Quaternion();\n\tvar scale = new THREE.Vector3();\n\n\tvar orientation = new THREE.Vector3();\n\n\treturn function ( force ) {\n\n\t\tTHREE.Object3D.prototype.updateMatrixWorld.call( this, force );\n\n\t\tvar listener;\n\n\t\tif (this.context) {\n\t\t\tlistener = this.context.listener;\n\n\t\t\tthis.matrixWorld.decompose( position, quaternion, scale );\n\n\t\t\torientation.set( 0, 0, -1 ).applyQuaternion( quaternion );\n\n\t\t\tlistener.setPosition( position.x, position.y, position.z );\n\t\t\tlistener.setOrientation( orientation.x, orientation.y, orientation.z, this.up.x, this.up.y, this.up.z );\n\n\t\t}\n\t};\n\n} ());\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/imports-loader?THREE=three!./src/lib/ThreeAudio.js\n ** module id = 74\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/lib/ThreeAudio.js?./~/imports-loader?THREE=three"); + eval("module.exports = (function () {\n\t'use strict';\n\n\tvar materials = __webpack_require__(7),\n\t\tTHREE = __webpack_require__(8);\n\n\t__webpack_require__(75);\n\n\treturn function sound(parent, options) {\n\t\tvar obj,\n\t\t\tsrc,\n\t\t\tlistener,\n\t\t\tscene = parent;\n\n\t\tif (typeof options === 'string' || Array.isArray(options)) {\n\t\t\tsrc = options;\n\t\t} else if (options) {\n\t\t\tsrc = options.src;\n\t\t}\n\n\t\twhile (!(scene instanceof THREE.Scene) && scene.parent) {\n\t\t\tscene = scene.parent;\n\t\t}\n\n\t\tlistener = scene.getObjectByName('audio-listener');\n\t\tobj = new THREE.Audio(listener);\n\t\t// obj.setLoop(true);\n\t\tobj.load(src);\n\n\t\tthis.start = obj.start.bind(obj);\n\t\tthis.volume = obj.volume.bind(obj);\n\n\t\tparent.add(obj);\n\n\t\treturn obj;\n\t};\n}());\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/objects/sound.js\n ** module id = 74\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/objects/sound.js?"); /***/ }, /* 75 */ /***/ function(module, exports, __webpack_require__) { - eval("module.exports = (function () {\n\t'use strict';\n\n\tvar materials = __webpack_require__(7),\n\t\tTHREE = __webpack_require__(8);\n\n\treturn function box(parent, options) {\n\t\tvar geometry,\n\t\t\tmesh;\n\n\t\tgeometry = new THREE.SphereGeometry(\n\t\t\toptions.radius === undefined ? 0.5 : options.radius,\n\t\t\toptions.widthSegments === undefined ? 16 : options.widthSegments,\n\t\t\toptions.heightSegments === undefined ? 12 : options.heightSegments,\n\t\t\toptions.phiStart,\n\t\t\toptions.phiLength,\n\t\t\toptions.thetaStart,\n\t\t\toptions.thetaLength\n\t\t);\n\t\tmesh = new THREE.Mesh(geometry, materials.standard());\n\t\tmesh.name = 'sphere';\n\n\t\tparent.add(mesh);\n\n\t\treturn mesh;\n\t};\n}());\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/objects/sphere.js\n ** module id = 75\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/objects/sphere.js?"); + eval("/*** IMPORTS FROM imports-loader ***/\nvar THREE = __webpack_require__(8);\n\n/**\n * @author mrdoob / http://mrdoob.com/\n */\n\nTHREE.Audio = function ( listener ) {\n\n\tTHREE.Object3D.call( this );\n\n\tthis.type = 'Audio';\n\tthis.started = false;\n\n\tif (listener.context) {\n\n\t\tthis.context = listener.context;\n\t\t// this.source = this.context.createBufferSource();\n\n\t\tthis.gain = this.context.createGain();\n\t\tthis.gain.connect( listener.input );\n\n\t\tthis.panner = this.context.createPanner();\n\t\tthis.panner.connect( this.gain );\n\n\t} else {\n\n\t\tthis.source = new Audio();\n\n\t}\n};\n\nTHREE.Audio.prototype = Object.create( THREE.Object3D.prototype );\n\nTHREE.Audio.prototype.load = function ( sources ) {\n\t//todo: support multiple sources for different audio formats\n\n\tvar scope = this;\n\tvar file;\n\tvar i;\n\tvar match;\n\tvar element = this.source instanceof window.HTMLAudioElement ? this.source : new Audio();\n\n\tif (typeof sources === 'string') {\n\t\tsources = [sources];\n\t}\n\n\tfor (i = 0; i < sources.length; i++) {\n\t\tfile = sources[i];\n\t\tmatch = /\\.([a-z0-9]+)$/i.exec(file);\n\t\tif (match && element.canPlayType('audio/' + match[1])) {\n\t\t\tbreak;\n\t\t}\n\t}\n\n\tif (this.context) {\n\t\tvar request = new XMLHttpRequest();\n\t\trequest.open( 'GET', file, true );\n\t\trequest.responseType = 'arraybuffer';\n\t\trequest.onload = function ( e ) {\n\t\t\tconsole.log('audio buffer loaded. decoding...', e );\n\t\t\tscope.context.decodeAudioData( this.response, function ( buffer ) {\n\n\t\t\t\tscope.buffer = buffer;\n\t\t\t\tif (scope.started) {\n\t\t\t\t\tscope.start();\n\t\t\t\t}\n\n\t\t\t}, function onFailure(e) {\n\t\t\t\tconsole.log('Decoding the audio buffer failed', e);\n\t\t\t} );\n\n\t\t};\n\n\t\trequest.onerror = function ( e ) {\n\t\t\tconsole.log('error', e);\n\t\t};\n\n\t\trequest.send();\n\n\t} else {\n\n\t\tthis.source.src = file;\n\t\tthis.source.play();\n\n\t}\n\n\treturn this;\n};\n\nTHREE.Audio.prototype.stop = function ( value ) {\n\n\tif (this.context) {\n\t\tthis.source.stop();\n\t\tthis.source.disconnect( this.panner );\n\t\tthis.source = null;\n\t} else {\n\t\tthis.source.pause();\n\t\tthis.source.currentTime = 0;\n\t}\n\tthis.started = false;\n};\n\nTHREE.Audio.prototype.start = function ( value ) {\n\n\tthis.started = true;\n\tif (this.context) {\n\t\tif (this.source) {\n\t\t\tthis.source.disconnect( this.panner );\n\t\t}\n\n\t\tif (this.buffer) {\n\t\t\tthis.source = this.context.createBufferSource();\n\t\t\tthis.source.buffer = this.buffer;\n\t\t\tthis.source.connect( this.panner );\n\t\t\tthis.source.start( 0 );\n\t\t}\n\t} else {\n\t\tthis.source.currentTime = 0;\n\t\tthis.source.play();\n\t}\n\n};\n\nTHREE.Audio.prototype.setLoop = function ( value ) {\n\n\tthis.source.loop = value;\n\n};\n\nTHREE.Audio.prototype.setRefDistance = function ( value ) {\n\n\tif ( this.panner ) {\n\n\t\tthis.panner.refDistance = value;\n\n\t}\n\n};\n\nTHREE.Audio.prototype.setRolloffFactor = function ( value ) {\n\n\tif ( this.panner ) {\n\n\t\tthis.panner.rolloffFactor = value;\n\n\t}\n\n};\n\nTHREE.Audio.prototype.volume = function ( volume, time ) {\n\n\tif ( this.gain ) {\n\n\t\tif ( volume !== undefined ) {\n\t\t\tthis.gain.gain.linearRampToValueAtTime( volume, this.context.currentTime + (time || 0));\n\t\t}\n\n\t\treturn this.gain.gain.value;\n\t}\n\n\tif ( volume !== undefined ) {\n\t\tthis.source.volume = volume;\n\t}\n\n\treturn this.source.volume;\n};\n\nTHREE.Audio.prototype.updateMatrixWorld = ( function () {\n\n\tvar position = new THREE.Vector3();\n\n\treturn function ( force ) {\n\n\t\tTHREE.Object3D.prototype.updateMatrixWorld.call( this, force );\n\n\t\tposition.setFromMatrixPosition( this.matrixWorld );\n\n\t\tif (this.panner) {\n\n\t\t\tthis.panner.setPosition( position.x, position.y, position.z );\n\n\t\t}\n\n\t};\n\n} )();\n\n// File:src/extras/audio/AudioListener.js\n\n/**\n * @author mrdoob / http://mrdoob.com/\n */\n\nTHREE.AudioListener = function () {\n\tvar AudioContext = window.AudioContext || window.webkitAudioContext;\n\n\tTHREE.Object3D.call( this );\n\n\tthis.type = 'AudioListener';\n\n\tif (AudioContext) {\n\t\tthis.context = new AudioContext();\n\t\tthis.input = this.context.createGain();\n\n\t\tthis.input.connect( this.context.destination );\n\t}\n};\n\nTHREE.AudioListener.prototype = Object.create( THREE.Object3D.prototype );\n\nTHREE.AudioListener.prototype.volume = function (val) {\n\tif (this.input) {\n\t\tval = val !== undefined && parseFloat(val);\n\t\tif (!isNaN(val)) {\n\t\t\tthis.input.gain.value = val;\n\t\t}\n\n\t\treturn this.input.gain.value;\n\t}\n};\n\nTHREE.AudioListener.prototype.updateMatrixWorld = ( function () {\n\n\tvar position = new THREE.Vector3();\n\tvar quaternion = new THREE.Quaternion();\n\tvar scale = new THREE.Vector3();\n\n\tvar orientation = new THREE.Vector3();\n\n\treturn function ( force ) {\n\n\t\tTHREE.Object3D.prototype.updateMatrixWorld.call( this, force );\n\n\t\tvar listener;\n\n\t\tif (this.context) {\n\t\t\tlistener = this.context.listener;\n\n\t\t\tthis.matrixWorld.decompose( position, quaternion, scale );\n\n\t\t\torientation.set( 0, 0, -1 ).applyQuaternion( quaternion );\n\n\t\t\tlistener.setPosition( position.x, position.y, position.z );\n\t\t\tlistener.setOrientation( orientation.x, orientation.y, orientation.z, this.up.x, this.up.y, this.up.z );\n\n\t\t}\n\t};\n\n} ());\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/imports-loader?THREE=three!./src/lib/ThreeAudio.js\n ** module id = 75\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/lib/ThreeAudio.js?./~/imports-loader?THREE=three"); /***/ }, /* 76 */ /***/ function(module, exports, __webpack_require__) { - eval("module.exports = (function () {\n\t'use strict';\n\n\tvar THREE = __webpack_require__(8),\n\t\tfontSizeRegex = /(\\d+)px/i,\n\t\tnewLineRegex = /[\\n\\r]/,\n\t\tspaceRegex = /[\\t ]/,\n\t\tlog2 = Math.log(2),\n\t\tgeometry = new THREE.PlaneBufferGeometry(1, 1);\n\n\treturn function text(parent, options) {\n\t\tvar self = this,\n\t\t\tmaterial,\n\t\t\tcanvas,\n\t\t\tctx,\n\t\t\tmesh,\n\t\t\tcontainer,\n\t\t\tsrc,\n\t\t\ttextWidth = 0,\n\t\t\ttextHeight = 0,\n\t\t\tprops = {\n\t\t\t\ttext: '',\n\t\t\t\tfont: '80px sans-serif',\n\t\t\t\ttextAlign: 'center',\n\t\t\t\ttextBaseline: '',\n\t\t\t\tdirection: '',\n\t\t\t\tfillStyle: 'white',\n\t\t\t\tresolution: 256, //pixels per meter\n\t\t\t\twrap: 5 //in meters\n\t\t\t},\n\t\t\ttex;\n\n\t\tfunction nextPowerOfTwo(n) {\n\t\t\treturn Math.pow(2, Math.ceil(Math.log(n) / log2));\n\t\t}\n\n\t\tfunction Line(word) {\n\t\t\tthis.spaceWidth = ctx.measureText(' ').width;\n\t\t\tthis.totalWidth = 0;\n\t\t\tthis.wordsWidth = 0;\n\t\t\tthis.words = [];\n\t\t\tthis.wrap = false;\n\t\t\tif (word) {\n\t\t\t\tthis.add(word);\n\t\t\t}\n\t\t}\n\n\t\tLine.prototype.text = function () {\n\t\t\treturn this.words.join(' ');\n\t\t};\n\n\t\tLine.prototype.add = function(word) {\n\t\t\tvar wordWidth;\n\t\t\tif (this.words.length) {\n\t\t\t\tthis.totalWidth += this.spaceWidth;\n\t\t\t}\n\t\t\tthis.words.push(word);\n\t\t\twordWidth = Line.measure(word);\n\t\t\tthis.totalWidth += wordWidth;\n\t\t\tthis.wordsWidth += wordWidth;\n\t\t};\n\n\t\tLine.prototype.measure = function(word) {\n\t\t\tvar width = this.totalWidth;\n\t\t\tif (word) {\n\t\t\t\twidth += Line.measure(word);\n\t\t\t\tif (this.words.length) {\n\t\t\t\t\twidth += this.spaceWidth;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn width;\n\t\t};\n\n\t\tLine.measure = function(word) {\n\t\t\treturn ctx.measureText(word).width;\n\t\t};\n\n\t\tfunction update() {\n\t\t\t//text stuffs\n\t\t\tvar text,\n\t\t\t\tword = '',\n\t\t\t\tletter,\n\t\t\t\tisSpace,\n\t\t\t\tline,\n\t\t\t\tlines = [],\n\t\t\t\tparse,\n\n\t\t\t\t//layout\n\t\t\t\tdirection = getComputedStyle(document.body).direction,\n\t\t\t\tinherit,\n\t\t\t\tresolution = parseFloat(props.resolution) || 256,\n\t\t\t\twrap,\n\t\t\t\twrapped = false,\n\t\t\t\tfontSize,\n\t\t\t\tpadding,\n\n\t\t\t\t//measurements\n\t\t\t\tlineHeight,\n\t\t\t\ti, start, y, measure,\n\t\t\t\twidth,\n\t\t\t\theight = 0;\n\n\t\t\twrap = parseFloat(props.wrap);\n\t\t\tif (isNaN(wrap) || wrap < 0) {\n\t\t\t\twrap = 5;\n\t\t\t}\n\t\t\twidth = resolution * wrap;\n\n\t\t\tctx.font = props.font;\n\t\t\tparse = fontSizeRegex.exec(ctx.font);\n\t\t\tfontSize = parseFloat(parse && parse[1]) || 50;\n\n\t\t\tlineHeight = fontSize * 1.5;\n\n\t\t\tline = new Line();\n\n\t\t\ttext = props.text === 0 ? '0' : String(props.text || '');\n\t\t\tif (wrap) {\n\t\t\t\ttext = text.trim() + ' ';\n\t\t\t\tfor (i = 0; i < text.length; i++) {\n\t\t\t\t\tletter = text.charAt(i);\n\t\t\t\t\tif (newLineRegex.test(letter)) {\n\t\t\t\t\t\tline.add(word);\n\t\t\t\t\t\tlines.push(line);\n\t\t\t\t\t\tword = '';\n\t\t\t\t\t\tline = new Line();\n\t\t\t\t\t} else if (spaceRegex.test(letter)) {\n\t\t\t\t\t\tmeasure = line.measure(word);\n\t\t\t\t\t\tif (measure < width) {\n\t\t\t\t\t\t\tif (line) {\n\t\t\t\t\t\t\t\tline.add(word);\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tline = new Line(word);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else if (!line && Line.measure(word) >= width) {\n\t\t\t\t\t\t\t//one very long word\n\t\t\t\t\t\t\tlines.push(new Line(word));\n\t\t\t\t\t\t\tword = '';\n\t\t\t\t\t\t\tline = new Line();\n\t\t\t\t\t\t\twrapped = true;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tline.wrap = true;\n\t\t\t\t\t\t\tlines.push(line);\n\t\t\t\t\t\t\tline = new Line(word);\n\t\t\t\t\t\t\twrapped = true;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tword = '';\n\t\t\t\t\t} else {\n\t\t\t\t\t\tword += letter;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (line) {\n\t\t\t\t\tlines.push(line);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tlines.push(new Line(text));\n\t\t\t}\n\n\t\t\tif (!width || !wrapped) {\n\t\t\t\twidth = lines.reduce(function (previous, line) {\n\t\t\t\t\treturn Math.max(previous, line.totalWidth);\n\t\t\t\t}, 0);\n\t\t\t}\n\t\t\twidth = Math.min(width, 2048);\n\n\t\t\theight = lines.length * lineHeight;\n\n\t\t\tif (options && options.mipmap === false) {\n\t\t\t\tcanvas.width = width;\n\t\t\t\tcanvas.height = height;\n\t\t\t} else {\n\t\t\t\tcanvas.width = nextPowerOfTwo(width);\n\t\t\t\tcanvas.height = nextPowerOfTwo(height);\n\t\t\t}\n\n\t\t\tmesh.scale.set(canvas.width / resolution, canvas.height / resolution, 1);\n\n\t\t\t//debug\n\t\t\t// ctx.fillStyle = 'rgba(100, 100, 100, 0.5)';\n\t\t\t// ctx.fillRect(0, 0, canvas.width, canvas.height);\n\t\t\t// document.body.appendChild(canvas);\n\t\t\t// canvas.style.cssText = 'position: absolute; width: auto !important; height: auto !important; max-width: 80%';\n\n\t\t\t/*\n\t\t\tset all these properties again because they get reset\n\t\t\twhen you resize the canvas\n\t\t\t*/\n\t\t\tctx.font = props.font;\n\t\t\tctx.textAlign = props.textAlign;\n\t\t\tctx.textBaseline = props.textBaseline;\n\t\t\tctx.direction = props.direction;\n\t\t\tctx.fillStyle = props.fillStyle;\n\t\t\t//todo: add maxWidth?\n\n\t\t\tpadding = (canvas.width - width) / 2;\n\t\t\ty = (canvas.height - height) / 2 + lineHeight / 2;\n\n\t\t\tinherit = (ctx.direction === '' || ctx.direction === 'inherit');\n\t\t\tif (ctx.textAlign === 'center') {\n\t\t\t\tstart = canvas.width / 2;\n\t\t\t} else if (ctx.textAlign === 'right' ||\n\t\t\t\tctx.textAlign === 'end' && (ctx.direction === 'ltr' || inherit && direction === 'ltr') ||\n\t\t\t\tctx.textAlign === 'start' && (ctx.direction === 'rtl' || inherit && direction === 'rtl')) {\n\n\t\t\t\tstart = canvas.width - padding;\n\t\t\t} else {\n\t\t\t\tstart = padding;\n\t\t\t}\n\n\t\t\tlines.forEach(function (line) {\n\t\t\t\tvar x,\n\t\t\t\t\tspace;\n\t\t\t\tif (props.textAlign === 'justify' && line.wrap && line.words.length > 1) {\n\t\t\t\t\tx = start;\n\t\t\t\t\tspace = (width - line.wordsWidth) / (line.words.length - 1);\n\t\t\t\t\tline.words.forEach(function (word) {\n\t\t\t\t\t\tctx.fillText(word, x, y);\n\t\t\t\t\t\tx += space + Line.measure(word);\n\t\t\t\t\t});\n\t\t\t\t} else {\n\t\t\t\t\tctx.fillText(line.text(), start, y);\n\t\t\t\t}\n\t\t\t\ty += lineHeight;\n\t\t\t});\n\n\t\t\ttextWidth = width / resolution;\n\t\t\ttextHeight = lines.length * lineHeight / resolution;\n\n\t\t\ttex.needsUpdate = true;\n\n\t\t\tmesh.name = text.trim();\n\t\t}\n\n\t\tcanvas = document.createElement('canvas');\n\t\tctx = canvas.getContext('2d');\n\t\ttex = new THREE.Texture(canvas);\n\n\t\tif (canvas.width === nextPowerOfTwo(canvas.width) &&\n\t\t\tcanvas.height === nextPowerOfTwo(canvas.height)) {\n\n\t\t\ttex.minFilter = THREE.LinearMipMapLinearFilter;\n\t\t\ttex.generateMipmaps = true;\n\t\t}\n\n\t\tmaterial = new THREE.MeshBasicMaterial({\n\t\t\tside: THREE.DoubleSide,\n\t\t\ttransparent: true,\n\t\t\tmap: tex\n\t\t});\n\n\t\tmesh = new THREE.Mesh(geometry, material);\n\n\t\tcontainer = new THREE.Object3D();\n\t\tcontainer.name = 'text';\n\t\tcontainer.add(mesh);\n\t\tparent.add(container);\n\n\t\tif (typeof options === 'string') {\n\t\t\tprops.text = options;\n\t\t} else if (options) {\n\t\t\tObject.keys(props).forEach(function (key) {\n\t\t\t\tprops[key] = options[key] || props[key];\n\t\t\t});\n\t\t}\n\t\tupdate();\n\n\t\tObject.keys(props).forEach(function (key) {\n\t\t\tObject.defineProperty(self, key, {\n\t\t\t\tget: function () {\n\t\t\t\t\treturn props[key];\n\t\t\t\t},\n\t\t\t\tset: function (val) {\n\t\t\t\t\tprops[key] = val;\n\t\t\t\t\tupdate();\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\n\t\tObject.defineProperty(self, 'width', {\n\t\t\tget: function () {\n\t\t\t\treturn textWidth;\n\t\t\t}\n\t\t});\n\n\t\tObject.defineProperty(self, 'height', {\n\t\t\tget: function () {\n\t\t\t\treturn textHeight;\n\t\t\t}\n\t\t});\n\n\t\tthis.material = material;\n\n\t\treturn container;\n\t};\n}());\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/objects/text.js\n ** module id = 76\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/objects/text.js?"); + eval("module.exports = (function () {\n\t'use strict';\n\n\tvar materials = __webpack_require__(7),\n\t\tTHREE = __webpack_require__(8);\n\n\treturn function box(parent, options) {\n\t\tvar geometry,\n\t\t\tmesh;\n\n\t\tgeometry = new THREE.SphereGeometry(\n\t\t\toptions.radius === undefined ? 0.5 : options.radius,\n\t\t\toptions.widthSegments === undefined ? 16 : options.widthSegments,\n\t\t\toptions.heightSegments === undefined ? 12 : options.heightSegments,\n\t\t\toptions.phiStart,\n\t\t\toptions.phiLength,\n\t\t\toptions.thetaStart,\n\t\t\toptions.thetaLength\n\t\t);\n\t\tmesh = new THREE.Mesh(geometry, materials.standard());\n\t\tmesh.name = 'sphere';\n\n\t\tparent.add(mesh);\n\n\t\treturn mesh;\n\t};\n}());\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/objects/sphere.js\n ** module id = 76\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/objects/sphere.js?"); /***/ }, /* 77 */ /***/ function(module, exports, __webpack_require__) { - eval("module.exports = (function () {\n\t'use strict';\n\n\tvar materials = __webpack_require__(7),\n\t\tTHREE = __webpack_require__(8);\n\n\treturn function torus(parent, options) {\n\t\tvar geometry,\n\t\t\tmesh;\n\n\t\tgeometry = new THREE.TorusGeometry(\n\t\t\toptions.radius === undefined ? 0.5 : options.radius,\n\t\t\toptions.tube === undefined ? 0.125 : options.tube,\n\t\t\toptions.radialSegments === undefined ? 12 : options.radialSegments,\n\t\t\toptions.tubularSegments === undefined ? 16 : options.tubularSegments,\n\t\t\toptions.arc\n\t\t);\n\t\tmesh = new THREE.Mesh(geometry, materials.standard());\n\t\tmesh.name = 'torus';\n\n\t\tparent.add(mesh);\n\n\t\treturn mesh;\n\t};\n}());\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/objects/torus.js\n ** module id = 77\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/objects/torus.js?"); + eval("module.exports = (function () {\n\t'use strict';\n\n\tvar THREE = __webpack_require__(8),\n\t\tfontSizeRegex = /(\\d+)px/i,\n\t\tnewLineRegex = /[\\n\\r]/,\n\t\tspaceRegex = /[\\t ]/,\n\t\tlog2 = Math.log(2),\n\t\tgeometry = new THREE.PlaneBufferGeometry(1, 1);\n\n\treturn function text(parent, options) {\n\t\tvar self = this,\n\t\t\tmaterial,\n\t\t\tcanvas,\n\t\t\tctx,\n\t\t\tmesh,\n\t\t\tcontainer,\n\t\t\tsrc,\n\t\t\ttextWidth = 0,\n\t\t\ttextHeight = 0,\n\t\t\tprops = {\n\t\t\t\ttext: '',\n\t\t\t\tfont: '80px sans-serif',\n\t\t\t\ttextAlign: 'center',\n\t\t\t\ttextBaseline: '',\n\t\t\t\tdirection: '',\n\t\t\t\tfillStyle: 'white',\n\t\t\t\tresolution: 256, //pixels per meter\n\t\t\t\twrap: 5 //in meters\n\t\t\t},\n\t\t\ttex;\n\n\t\tfunction nextPowerOfTwo(n) {\n\t\t\treturn Math.pow(2, Math.ceil(Math.log(n) / log2));\n\t\t}\n\n\t\tfunction Line(word) {\n\t\t\tthis.spaceWidth = ctx.measureText(' ').width;\n\t\t\tthis.totalWidth = 0;\n\t\t\tthis.wordsWidth = 0;\n\t\t\tthis.words = [];\n\t\t\tthis.wrap = false;\n\t\t\tif (word) {\n\t\t\t\tthis.add(word);\n\t\t\t}\n\t\t}\n\n\t\tLine.prototype.text = function () {\n\t\t\treturn this.words.join(' ');\n\t\t};\n\n\t\tLine.prototype.add = function(word) {\n\t\t\tvar wordWidth;\n\t\t\tif (this.words.length) {\n\t\t\t\tthis.totalWidth += this.spaceWidth;\n\t\t\t}\n\t\t\tthis.words.push(word);\n\t\t\twordWidth = Line.measure(word);\n\t\t\tthis.totalWidth += wordWidth;\n\t\t\tthis.wordsWidth += wordWidth;\n\t\t};\n\n\t\tLine.prototype.measure = function(word) {\n\t\t\tvar width = this.totalWidth;\n\t\t\tif (word) {\n\t\t\t\twidth += Line.measure(word);\n\t\t\t\tif (this.words.length) {\n\t\t\t\t\twidth += this.spaceWidth;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn width;\n\t\t};\n\n\t\tLine.measure = function(word) {\n\t\t\treturn ctx.measureText(word).width;\n\t\t};\n\n\t\tfunction update() {\n\t\t\t//text stuffs\n\t\t\tvar text,\n\t\t\t\tword = '',\n\t\t\t\tletter,\n\t\t\t\tisSpace,\n\t\t\t\tline,\n\t\t\t\tlines = [],\n\t\t\t\tparse,\n\n\t\t\t\t//layout\n\t\t\t\tdirection = getComputedStyle(document.body).direction,\n\t\t\t\tinherit,\n\t\t\t\tresolution = parseFloat(props.resolution) || 256,\n\t\t\t\twrap,\n\t\t\t\twrapped = false,\n\t\t\t\tfontSize,\n\t\t\t\tpadding,\n\n\t\t\t\t//measurements\n\t\t\t\tlineHeight,\n\t\t\t\ti, start, y, measure,\n\t\t\t\twidth,\n\t\t\t\theight = 0;\n\n\t\t\twrap = parseFloat(props.wrap);\n\t\t\tif (isNaN(wrap) || wrap < 0) {\n\t\t\t\twrap = 5;\n\t\t\t}\n\t\t\twidth = resolution * wrap;\n\n\t\t\tctx.font = props.font;\n\t\t\tparse = fontSizeRegex.exec(ctx.font);\n\t\t\tfontSize = parseFloat(parse && parse[1]) || 50;\n\n\t\t\tlineHeight = fontSize * 1.5;\n\n\t\t\tline = new Line();\n\n\t\t\ttext = props.text === 0 ? '0' : String(props.text || '');\n\t\t\tif (wrap) {\n\t\t\t\ttext = text.trim() + ' ';\n\t\t\t\tfor (i = 0; i < text.length; i++) {\n\t\t\t\t\tletter = text.charAt(i);\n\t\t\t\t\tif (newLineRegex.test(letter)) {\n\t\t\t\t\t\tline.add(word);\n\t\t\t\t\t\tlines.push(line);\n\t\t\t\t\t\tword = '';\n\t\t\t\t\t\tline = new Line();\n\t\t\t\t\t} else if (spaceRegex.test(letter)) {\n\t\t\t\t\t\tmeasure = line.measure(word);\n\t\t\t\t\t\tif (measure < width) {\n\t\t\t\t\t\t\tif (line) {\n\t\t\t\t\t\t\t\tline.add(word);\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tline = new Line(word);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else if (!line && Line.measure(word) >= width) {\n\t\t\t\t\t\t\t//one very long word\n\t\t\t\t\t\t\tlines.push(new Line(word));\n\t\t\t\t\t\t\tword = '';\n\t\t\t\t\t\t\tline = new Line();\n\t\t\t\t\t\t\twrapped = true;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tline.wrap = true;\n\t\t\t\t\t\t\tlines.push(line);\n\t\t\t\t\t\t\tline = new Line(word);\n\t\t\t\t\t\t\twrapped = true;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tword = '';\n\t\t\t\t\t} else {\n\t\t\t\t\t\tword += letter;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (line) {\n\t\t\t\t\tlines.push(line);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tlines.push(new Line(text));\n\t\t\t}\n\n\t\t\tif (!width || !wrapped) {\n\t\t\t\twidth = lines.reduce(function (previous, line) {\n\t\t\t\t\treturn Math.max(previous, line.totalWidth);\n\t\t\t\t}, 0);\n\t\t\t}\n\t\t\twidth = Math.min(width, 2048);\n\n\t\t\theight = lines.length * lineHeight;\n\n\t\t\tif (options && options.mipmap === false) {\n\t\t\t\tcanvas.width = width;\n\t\t\t\tcanvas.height = height;\n\t\t\t} else {\n\t\t\t\tcanvas.width = nextPowerOfTwo(width);\n\t\t\t\tcanvas.height = nextPowerOfTwo(height);\n\t\t\t}\n\n\t\t\tmesh.scale.set(canvas.width / resolution, canvas.height / resolution, 1);\n\n\t\t\t//debug\n\t\t\t// ctx.fillStyle = 'rgba(100, 100, 100, 0.5)';\n\t\t\t// ctx.fillRect(0, 0, canvas.width, canvas.height);\n\t\t\t// document.body.appendChild(canvas);\n\t\t\t// canvas.style.cssText = 'position: absolute; width: auto !important; height: auto !important; max-width: 80%';\n\n\t\t\t/*\n\t\t\tset all these properties again because they get reset\n\t\t\twhen you resize the canvas\n\t\t\t*/\n\t\t\tctx.font = props.font;\n\t\t\tctx.textAlign = props.textAlign;\n\t\t\tctx.textBaseline = props.textBaseline;\n\t\t\tctx.direction = props.direction;\n\t\t\tctx.fillStyle = props.fillStyle;\n\t\t\t//todo: add maxWidth?\n\n\t\t\tpadding = (canvas.width - width) / 2;\n\t\t\ty = (canvas.height - height) / 2 + lineHeight / 2;\n\n\t\t\tinherit = (ctx.direction === '' || ctx.direction === 'inherit');\n\t\t\tif (ctx.textAlign === 'center') {\n\t\t\t\tstart = canvas.width / 2;\n\t\t\t} else if (ctx.textAlign === 'right' ||\n\t\t\t\tctx.textAlign === 'end' && (ctx.direction === 'ltr' || inherit && direction === 'ltr') ||\n\t\t\t\tctx.textAlign === 'start' && (ctx.direction === 'rtl' || inherit && direction === 'rtl')) {\n\n\t\t\t\tstart = canvas.width - padding;\n\t\t\t} else {\n\t\t\t\tstart = padding;\n\t\t\t}\n\n\t\t\tlines.forEach(function (line) {\n\t\t\t\tvar x,\n\t\t\t\t\tspace;\n\t\t\t\tif (props.textAlign === 'justify' && line.wrap && line.words.length > 1) {\n\t\t\t\t\tx = start;\n\t\t\t\t\tspace = (width - line.wordsWidth) / (line.words.length - 1);\n\t\t\t\t\tline.words.forEach(function (word) {\n\t\t\t\t\t\tctx.fillText(word, x, y);\n\t\t\t\t\t\tx += space + Line.measure(word);\n\t\t\t\t\t});\n\t\t\t\t} else {\n\t\t\t\t\tctx.fillText(line.text(), start, y);\n\t\t\t\t}\n\t\t\t\ty += lineHeight;\n\t\t\t});\n\n\t\t\ttextWidth = width / resolution;\n\t\t\ttextHeight = lines.length * lineHeight / resolution;\n\n\t\t\ttex.needsUpdate = true;\n\n\t\t\tmesh.name = text.trim();\n\t\t}\n\n\t\tcanvas = document.createElement('canvas');\n\t\tctx = canvas.getContext('2d');\n\t\ttex = new THREE.Texture(canvas);\n\n\t\tif (canvas.width === nextPowerOfTwo(canvas.width) &&\n\t\t\tcanvas.height === nextPowerOfTwo(canvas.height)) {\n\n\t\t\ttex.minFilter = THREE.LinearMipMapLinearFilter;\n\t\t\ttex.generateMipmaps = true;\n\t\t}\n\n\t\tmaterial = new THREE.MeshBasicMaterial({\n\t\t\tside: THREE.DoubleSide,\n\t\t\ttransparent: true,\n\t\t\tmap: tex\n\t\t});\n\n\t\tmesh = new THREE.Mesh(geometry, material);\n\n\t\tcontainer = new THREE.Object3D();\n\t\tcontainer.name = 'text';\n\t\tcontainer.add(mesh);\n\t\tparent.add(container);\n\n\t\tif (typeof options === 'string') {\n\t\t\tprops.text = options;\n\t\t} else if (options) {\n\t\t\tObject.keys(props).forEach(function (key) {\n\t\t\t\tprops[key] = options[key] || props[key];\n\t\t\t});\n\t\t}\n\t\tupdate();\n\n\t\tObject.keys(props).forEach(function (key) {\n\t\t\tObject.defineProperty(self, key, {\n\t\t\t\tget: function () {\n\t\t\t\t\treturn props[key];\n\t\t\t\t},\n\t\t\t\tset: function (val) {\n\t\t\t\t\tprops[key] = val;\n\t\t\t\t\tupdate();\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\n\t\tObject.defineProperty(self, 'width', {\n\t\t\tget: function () {\n\t\t\t\treturn textWidth;\n\t\t\t}\n\t\t});\n\n\t\tObject.defineProperty(self, 'height', {\n\t\t\tget: function () {\n\t\t\t\treturn textHeight;\n\t\t\t}\n\t\t});\n\n\t\tthis.material = material;\n\n\t\treturn container;\n\t};\n}());\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/objects/text.js\n ** module id = 77\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/objects/text.js?"); /***/ }, /* 78 */ /***/ function(module, exports, __webpack_require__) { - eval("module.exports = (function () {\n\t'use strict';\n\n\tvar THREE = __webpack_require__(8),\n\t\turlRegex = __webpack_require__(28),\n\t\textRegex = /\\.(webm|ogg|ogv|m4v|mp4|mov)/i,\n\t\tvideo;\n\n\tvideo = function (parent, options) {\n\t\tvar geometry,\n\t\t\tmaterial,\n\t\t\tmesh,\n\t\t\tvid,\n\t\t\ttex,\n\t\t\taspectRatio = 1,\n\t\t\tplaying = false,\n\t\t\tself = this;\n\n\t\tfunction isPowerOfTwo(num) {\n\t\t\treturn num > 0 && (num & (num-1)) === 0; // jshint ignore:line\n\t\t}\n\n\t\tfunction loadedMetadata() {\n\t\t\t//todo: don't do any of this if object has been deleted\n\n\t\t\tvar newAspectRatio = vid.videoWidth / vid.videoHeight;\n\t\t\tif (!options || !options.sphere) {\n\t\t\t\tgeometry.applyMatrix(new THREE.Matrix4().makeScale(1, aspectRatio / newAspectRatio, 1));\n\t\t\t}\n\t\t\taspectRatio = newAspectRatio;\n\n\t\t\tif (vid.videoWidth === vid.videoHeight &&\n\t\t\t\t\tisPowerOfTwo(vid.videoWidth) && isPowerOfTwo(vid.videoHeight)) {\n\n\t\t\t\ttex.minFilter = THREE.LinearMipMapLinearFilter;\n\t\t\t\ttex.generateMipmaps = true;\n\t\t\t} else {\n\t\t\t\ttex.minFilter = THREE.LinearFilter;\n\t\t\t\ttex.generateMipmaps = false;\n\t\t\t}\n\n\t\t\tmaterial.map = tex;\n\t\t\tmaterial.visible = true;\n\n\t\t\tif (playing) {\n\t\t\t\tvid.play();\n\t\t\t}\n\t\t}\n\n\t\tfunction setSource(sources) {\n\t\t\tsources.forEach(function (src) {\n\t\t\t\tvar parse,\n\t\t\t\t\text,\n\t\t\t\t\tsource;\n\n\t\t\t\tif (!src) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tparse = urlRegex.exec(src);\n\t\t\t\tif (parse &&\n\t\t\t\t\t\t(parse[1] && parse[1] !== window.location.hostĪ© ||\n\t\t\t\t\t\t\tparse[2] && parse[2] !== window.location.port)) {\n\n\t\t\t\t\tif (vid.crossOrigin !== undefined) {\n\t\t\t\t\t\tvid.crossOrigin = 'anonymous';\n\t\t\t\t\t} else {\n\t\t\t\t\t\tconsole.warn('Browser does not support cross-origin video');\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tsource = document.createElement('source');\n\t\t\t\tsource.src = src;\n\n\t\t\t\text = extRegex.exec(src);\n\t\t\t\tif (!ext || vid.canPlayType('video/' + ext[1])) {\n\t\t\t\t\tvid.appendChild(source);\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\n\t\t/*\n\t\tPause the video when this browser tab is in the background or minimized.\n\t\tResume when it comes back in focus, but only if the user didn't pause manually.\n\t\t*/\n\t\tfunction visibilityChange() {\n\t\t\tif (document.hidden || document.mozHidden || document.msHidden || document.webkitHidden) {\n\t\t\t\tvid.pause();\n\t\t\t} else if (playing) {\n\t\t\t\tvid.play();\n\t\t\t}\n\t\t}\n\n\t\tvid = document.createElement('video');\n\t\tvid.loop = true;\n\t\tvid.addEventListener('loadedmetadata', loadedMetadata, false);\n\n\t\tif (Array.isArray(options)) {\n\t\t\tsetSource(options);\n\t\t} if (typeof options === 'string') {\n\t\t\tsetSource([options]);\n\t\t} else if (typeof options.src === 'string') {\n\t\t\tsetSource([options.src]);\n\t\t} else if (Array.isArray(options.src)) {\n\t\t\tsetSource(options.src);\n\t\t}\n\n\t\tvid.load();\n\n\t\ttex = new THREE.VideoTexture(vid, THREE.UVMapping);\n\t\ttex.format = THREE.RGBFormat;\n\n\t\tif (options && options.sphere) {\n\t\t\tgeometry = new THREE.SphereGeometry(\n\t\t\t\t994, //radius\n\t\t\t\t60, //widthSegments\n\t\t\t\t60, //heightSegments\n\t\t\t\t(parseFloat(options.phiStart) || 0) * Math.PI * 2,\n\t\t\t\t(parseFloat(options.phiLength) || 1) * Math.PI * 2,\n\t\t\t\t(parseFloat(options.thetaStart) || 0) * Math.PI,\n\t\t\t\t(parseFloat(options.thetaLength) || 1) * Math.PI\n\t\t\t);\n\t\t\tgeometry.applyMatrix(new THREE.Matrix4().makeScale(-1, 1, 1));\n\t\t\tgeometry.applyMatrix(new THREE.Matrix4().makeRotationY(- Math.PI / 2));\n\t\t} else {\n\t\t\tgeometry = new THREE.PlaneBufferGeometry(1, 1, 8);\n\t\t}\n\n\t\tmaterial = new THREE.MeshBasicMaterial({\n\t\t\tside: THREE.DoubleSide,\n\t\t\tmap: tex,\n\t\t\tvisible: false\n\t\t});\n\n\t\tmesh = new THREE.Mesh(geometry, material);\n\n\t\tif (options && options.stereo) {\n\t\t\tif (options.stereo === 'vertical') {\n\t\t\t\ttex.repeat.y = 0.5;\n\t\t\t} else {\n\t\t\t\ttex.repeat.x = 0.5;\n\t\t\t}\n\t\t\tmesh.userData.stereo = options.stereo;\n\t\t}\n\n\t\tif (vid.readyState) {\n\t\t\tloadedMetadata();\n\t\t}\n\n\t\tthis.play = function play() {\n\t\t\tplaying = true;\n\t\t\tvid.play();\n\t\t\treturn this;\n\t\t};\n\n\t\tthis.pause = function pause() {\n\t\t\tplaying = false;\n\t\t\tvid.pause();\n\t\t\treturn this;\n\t\t};\n\n\t\tthis.canPlayType = video.canPlayType;\n\n\t\tObject.defineProperty(this, 'width', {\n\t\t\tget: function () {\n\t\t\t\treturn vid.videoWidth;\n\t\t\t}\n\t\t});\n\n\t\tObject.defineProperty(this, 'height', {\n\t\t\tget: function () {\n\t\t\t\treturn vid.videoHeight;\n\t\t\t}\n\t\t});\n\n\t\tObject.defineProperty(this, 'paused', {\n\t\t\tget: function () {\n\t\t\t\treturn !playing;\n\t\t\t}\n\t\t});\n\n\t\tObject.defineProperty(this, 'volume', {\n\t\t\tget: function () {\n\t\t\t\treturn vid.volume;\n\t\t\t},\n\t\t\tset: function (vol) {\n\t\t\t\tvid.volume = vol;\n\t\t\t}\n\t\t});\n\n\t\tObject.defineProperty(this, 'muted', {\n\t\t\tget: function () {\n\t\t\t\treturn vid.muted;\n\t\t\t},\n\t\t\tset: function (muted) {\n\t\t\t\tvid.muted = muted;\n\t\t\t}\n\t\t});\n\n\t\tObject.defineProperty(this, 'duration', {\n\t\t\tget: function () {\n\t\t\t\treturn vid.duration || 0;\n\t\t\t}\n\t\t});\n\n\t\tObject.defineProperty(this, 'currentTime', {\n\t\t\tget: function () {\n\t\t\t\treturn vid.currentTime;\n\t\t\t},\n\t\t\tset: function (currentTime) {\n\t\t\t\tif (vid.readyState && currentTime < vid.duration && currentTime >= 0) {\n\t\t\t\t\tvid.currentTime = currentTime;\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\n\t\t[\n\t\t\t'loadedmetadata',\n\t\t\t'play',\n\t\t\t'pause',\n\t\t\t'playing',\n\t\t\t'progress'\n\t\t].forEach(function registerMediaEvent(event) {\n\t\t\tvid.addEventListener(event, self.emit.bind(self, event));\n\t\t});\n\n\t\t//sometimes video fails to play because it's too big. remove it and try again\n\t\tvid.addEventListener('error', function (evt) {\n\t\t\tif (vid.error.code === window.MediaError.MEDIA_ERR_DECODE && vid.childNodes.length > 1) {\n\t\t\t\tmaterial.visible = false;\n\t\t\t\tvid.removeChild(vid.firstChild);\n\t\t\t\tvid.load();\n\t\t\t}\n\n\t\t\tself.emit(event, evt);\n\t\t}, true);\n\n\t\tthis.element = vid;\n\n\t\twindow.addEventListener('touchstart', function touchStart() {\n\t\t\tif (playing) {\n\t\t\t\tvid.play();\n\t\t\t} else {\n\t\t\t\tvid.load();\n\t\t\t}\n\t\t\twindow.removeEventListener('touchstart', touchStart, true);\n\t\t}, true);\n\n\t\t//pause when window is hidden\n\t\tdocument.addEventListener('visibilitychange', visibilityChange);\n\t\tdocument.addEventListener('mozvisibilitychange', visibilityChange);\n\t\tdocument.addEventListener('msvisibilitychange', visibilityChange);\n\t\tdocument.addEventListener('webkitvisibilitychange', visibilityChange);\n\n\t\tmesh.name = 'video';\n\t\tthis.raycastable = !(options && options.sphere);\n\t\tparent.add(mesh);\n\n\t\treturn mesh;\n\t};\n\n\tvideo.canPlayType = function canPlayType(type) {\n\t\tvar element = document.createElement('video');\n\t\treturn element.canPlayType(type);\n\t};\n\n\treturn video;\n}());\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/objects/video.js\n ** module id = 78\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/objects/video.js?"); + eval("module.exports = (function () {\n\t'use strict';\n\n\tvar materials = __webpack_require__(7),\n\t\tTHREE = __webpack_require__(8);\n\n\treturn function torus(parent, options) {\n\t\tvar geometry,\n\t\t\tmesh;\n\n\t\tgeometry = new THREE.TorusGeometry(\n\t\t\toptions.radius === undefined ? 0.5 : options.radius,\n\t\t\toptions.tube === undefined ? 0.125 : options.tube,\n\t\t\toptions.radialSegments === undefined ? 12 : options.radialSegments,\n\t\t\toptions.tubularSegments === undefined ? 16 : options.tubularSegments,\n\t\t\toptions.arc\n\t\t);\n\t\tmesh = new THREE.Mesh(geometry, materials.standard());\n\t\tmesh.name = 'torus';\n\n\t\tparent.add(mesh);\n\n\t\treturn mesh;\n\t};\n}());\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/objects/torus.js\n ** module id = 78\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/objects/torus.js?"); /***/ }, /* 79 */ -/***/ function(module, exports) { +/***/ function(module, exports, __webpack_require__) { - eval("module.exports = \"\\n \\n\"\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/raw-loader!./bower_components/open-iconic/svg/fullscreen-enter.svg\n ** module id = 79\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./bower_components/open-iconic/svg/fullscreen-enter.svg?./~/raw-loader"); + eval("module.exports = (function () {\n\t'use strict';\n\n\tvar THREE = __webpack_require__(8),\n\t\turlRegex = __webpack_require__(28),\n\t\textRegex = /\\.(webm|ogg|ogv|m4v|mp4|mov)/i,\n\t\tvideo;\n\n\tvideo = function (parent, options) {\n\t\tvar geometry,\n\t\t\tmaterial,\n\t\t\tmesh,\n\t\t\tvid,\n\t\t\ttex,\n\t\t\taspectRatio = 1,\n\t\t\tplaying = false,\n\t\t\tself = this;\n\n\t\tfunction isPowerOfTwo(num) {\n\t\t\treturn num > 0 && (num & (num-1)) === 0; // jshint ignore:line\n\t\t}\n\n\t\tfunction loadedMetadata() {\n\t\t\t//todo: don't do any of this if object has been deleted\n\n\t\t\tvar newAspectRatio = vid.videoWidth / vid.videoHeight;\n\t\t\tif (!options || !options.sphere) {\n\t\t\t\tgeometry.applyMatrix(new THREE.Matrix4().makeScale(1, aspectRatio / newAspectRatio, 1));\n\t\t\t}\n\t\t\taspectRatio = newAspectRatio;\n\n\t\t\tif (vid.videoWidth === vid.videoHeight &&\n\t\t\t\t\tisPowerOfTwo(vid.videoWidth) && isPowerOfTwo(vid.videoHeight)) {\n\n\t\t\t\ttex.minFilter = THREE.LinearMipMapLinearFilter;\n\t\t\t\ttex.generateMipmaps = true;\n\t\t\t} else {\n\t\t\t\ttex.minFilter = THREE.LinearFilter;\n\t\t\t\ttex.generateMipmaps = false;\n\t\t\t}\n\n\t\t\tmaterial.map = tex;\n\t\t\tmaterial.visible = true;\n\n\t\t\tif (playing) {\n\t\t\t\tvid.play();\n\t\t\t}\n\t\t}\n\n\t\tfunction setSource(sources) {\n\t\t\tsources.forEach(function (src) {\n\t\t\t\tvar parse,\n\t\t\t\t\text,\n\t\t\t\t\tsource;\n\n\t\t\t\tif (!src) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tparse = urlRegex.exec(src);\n\t\t\t\tif (parse &&\n\t\t\t\t\t\t(parse[1] && parse[1] !== window.location.hostĪ© ||\n\t\t\t\t\t\t\tparse[2] && parse[2] !== window.location.port)) {\n\n\t\t\t\t\tif (vid.crossOrigin !== undefined) {\n\t\t\t\t\t\tvid.crossOrigin = 'anonymous';\n\t\t\t\t\t} else {\n\t\t\t\t\t\tconsole.warn('Browser does not support cross-origin video');\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tsource = document.createElement('source');\n\t\t\t\tsource.src = src;\n\n\t\t\t\text = extRegex.exec(src);\n\t\t\t\tif (!ext || vid.canPlayType('video/' + ext[1])) {\n\t\t\t\t\tvid.appendChild(source);\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\n\t\t/*\n\t\tPause the video when this browser tab is in the background or minimized.\n\t\tResume when it comes back in focus, but only if the user didn't pause manually.\n\t\t*/\n\t\tfunction visibilityChange() {\n\t\t\tif (document.hidden || document.mozHidden || document.msHidden || document.webkitHidden) {\n\t\t\t\tvid.pause();\n\t\t\t} else if (playing) {\n\t\t\t\tvid.play();\n\t\t\t}\n\t\t}\n\n\t\tvid = document.createElement('video');\n\t\tvid.loop = true;\n\t\tvid.addEventListener('loadedmetadata', loadedMetadata, false);\n\n\t\tif (Array.isArray(options)) {\n\t\t\tsetSource(options);\n\t\t} if (typeof options === 'string') {\n\t\t\tsetSource([options]);\n\t\t} else if (typeof options.src === 'string') {\n\t\t\tsetSource([options.src]);\n\t\t} else if (Array.isArray(options.src)) {\n\t\t\tsetSource(options.src);\n\t\t}\n\n\t\tvid.load();\n\n\t\ttex = new THREE.VideoTexture(vid, THREE.UVMapping);\n\t\ttex.format = THREE.RGBFormat;\n\n\t\tif (options && options.sphere) {\n\t\t\tgeometry = new THREE.SphereGeometry(\n\t\t\t\t994, //radius\n\t\t\t\t60, //widthSegments\n\t\t\t\t60, //heightSegments\n\t\t\t\t(parseFloat(options.phiStart) || 0) * Math.PI * 2,\n\t\t\t\t(parseFloat(options.phiLength) || 1) * Math.PI * 2,\n\t\t\t\t(parseFloat(options.thetaStart) || 0) * Math.PI,\n\t\t\t\t(parseFloat(options.thetaLength) || 1) * Math.PI\n\t\t\t);\n\t\t\tgeometry.applyMatrix(new THREE.Matrix4().makeScale(-1, 1, 1));\n\t\t\tgeometry.applyMatrix(new THREE.Matrix4().makeRotationY(- Math.PI / 2));\n\t\t} else {\n\t\t\tgeometry = new THREE.PlaneBufferGeometry(1, 1, 8);\n\t\t}\n\n\t\tmaterial = new THREE.MeshBasicMaterial({\n\t\t\tside: THREE.DoubleSide,\n\t\t\tmap: tex,\n\t\t\tvisible: false\n\t\t});\n\n\t\tmesh = new THREE.Mesh(geometry, material);\n\n\t\tif (options && options.stereo) {\n\t\t\tif (options.stereo === 'vertical') {\n\t\t\t\ttex.repeat.y = 0.5;\n\t\t\t} else {\n\t\t\t\ttex.repeat.x = 0.5;\n\t\t\t}\n\t\t\tmesh.userData.stereo = options.stereo;\n\t\t}\n\n\t\tif (vid.readyState) {\n\t\t\tloadedMetadata();\n\t\t}\n\n\t\tthis.play = function play() {\n\t\t\tplaying = true;\n\t\t\tvid.play();\n\t\t\treturn this;\n\t\t};\n\n\t\tthis.pause = function pause() {\n\t\t\tplaying = false;\n\t\t\tvid.pause();\n\t\t\treturn this;\n\t\t};\n\n\t\tthis.canPlayType = video.canPlayType;\n\n\t\tObject.defineProperty(this, 'width', {\n\t\t\tget: function () {\n\t\t\t\treturn vid.videoWidth;\n\t\t\t}\n\t\t});\n\n\t\tObject.defineProperty(this, 'height', {\n\t\t\tget: function () {\n\t\t\t\treturn vid.videoHeight;\n\t\t\t}\n\t\t});\n\n\t\tObject.defineProperty(this, 'paused', {\n\t\t\tget: function () {\n\t\t\t\treturn !playing;\n\t\t\t}\n\t\t});\n\n\t\tObject.defineProperty(this, 'volume', {\n\t\t\tget: function () {\n\t\t\t\treturn vid.volume;\n\t\t\t},\n\t\t\tset: function (vol) {\n\t\t\t\tvid.volume = vol;\n\t\t\t}\n\t\t});\n\n\t\tObject.defineProperty(this, 'muted', {\n\t\t\tget: function () {\n\t\t\t\treturn vid.muted;\n\t\t\t},\n\t\t\tset: function (muted) {\n\t\t\t\tvid.muted = muted;\n\t\t\t}\n\t\t});\n\n\t\tObject.defineProperty(this, 'duration', {\n\t\t\tget: function () {\n\t\t\t\treturn vid.duration || 0;\n\t\t\t}\n\t\t});\n\n\t\tObject.defineProperty(this, 'currentTime', {\n\t\t\tget: function () {\n\t\t\t\treturn vid.currentTime;\n\t\t\t},\n\t\t\tset: function (currentTime) {\n\t\t\t\tif (vid.readyState && currentTime < vid.duration && currentTime >= 0) {\n\t\t\t\t\tvid.currentTime = currentTime;\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\n\t\t[\n\t\t\t'loadedmetadata',\n\t\t\t'play',\n\t\t\t'pause',\n\t\t\t'playing',\n\t\t\t'progress'\n\t\t].forEach(function registerMediaEvent(event) {\n\t\t\tvid.addEventListener(event, self.emit.bind(self, event));\n\t\t});\n\n\t\t//sometimes video fails to play because it's too big. remove it and try again\n\t\tvid.addEventListener('error', function (evt) {\n\t\t\tif (vid.error.code === window.MediaError.MEDIA_ERR_DECODE && vid.childNodes.length > 1) {\n\t\t\t\tmaterial.visible = false;\n\t\t\t\tvid.removeChild(vid.firstChild);\n\t\t\t\tvid.load();\n\t\t\t}\n\n\t\t\tself.emit(event, evt);\n\t\t}, true);\n\n\t\tthis.element = vid;\n\n\t\twindow.addEventListener('touchstart', function touchStart() {\n\t\t\tif (playing) {\n\t\t\t\tvid.play();\n\t\t\t} else {\n\t\t\t\tvid.load();\n\t\t\t}\n\t\t\twindow.removeEventListener('touchstart', touchStart, true);\n\t\t}, true);\n\n\t\t//pause when window is hidden\n\t\tdocument.addEventListener('visibilitychange', visibilityChange);\n\t\tdocument.addEventListener('mozvisibilitychange', visibilityChange);\n\t\tdocument.addEventListener('msvisibilitychange', visibilityChange);\n\t\tdocument.addEventListener('webkitvisibilitychange', visibilityChange);\n\n\t\tmesh.name = 'video';\n\t\tthis.raycastable = !(options && options.sphere);\n\t\tparent.add(mesh);\n\n\t\treturn mesh;\n\t};\n\n\tvideo.canPlayType = function canPlayType(type) {\n\t\tvar element = document.createElement('video');\n\t\treturn element.canPlayType(type);\n\t};\n\n\treturn video;\n}());\n\n/*****************\n ** WEBPACK FOOTER\n ** ./src/objects/video.js\n ** module id = 79\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./src/objects/video.js?"); /***/ }, /* 80 */ /***/ function(module, exports) { - eval("module.exports = \"\\n \\n\"\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/raw-loader!./bower_components/open-iconic/svg/fullscreen-exit.svg\n ** module id = 80\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./bower_components/open-iconic/svg/fullscreen-exit.svg?./~/raw-loader"); + eval("module.exports = \"\\n \\n\"\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/raw-loader!./bower_components/open-iconic/svg/fullscreen-enter.svg\n ** module id = 80\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./bower_components/open-iconic/svg/fullscreen-enter.svg?./~/raw-loader"); /***/ }, /* 81 */ /***/ function(module, exports) { - eval("module.exports = \"\\n \\n\"\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/raw-loader!./bower_components/open-iconic/svg/eye.svg\n ** module id = 81\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./bower_components/open-iconic/svg/eye.svg?./~/raw-loader"); + eval("module.exports = \"\\n \\n\"\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/raw-loader!./bower_components/open-iconic/svg/fullscreen-exit.svg\n ** module id = 81\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./bower_components/open-iconic/svg/fullscreen-exit.svg?./~/raw-loader"); /***/ }, /* 82 */ /***/ function(module, exports) { - eval("module.exports = \"\\n \\n\"\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/raw-loader!./bower_components/open-iconic/svg/compass.svg\n ** module id = 82\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./bower_components/open-iconic/svg/compass.svg?./~/raw-loader"); + eval("module.exports = \"\\n \\n\"\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/raw-loader!./bower_components/open-iconic/svg/eye.svg\n ** module id = 82\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./bower_components/open-iconic/svg/eye.svg?./~/raw-loader"); + +/***/ }, +/* 83 */ +/***/ function(module, exports) { + + eval("module.exports = \"\\n \\n\"\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/raw-loader!./bower_components/open-iconic/svg/compass.svg\n ** module id = 83\n ** module chunks = 0\n **/\n//# sourceURL=webpack:///./bower_components/open-iconic/svg/compass.svg?./~/raw-loader"); /***/ } /******/ ]); \ No newline at end of file diff --git a/build/vr.js b/build/vr.js index 0546a0b..af17098 100644 --- a/build/vr.js +++ b/build/vr.js @@ -4,19 +4,20 @@ * @link https://github.com/povdocs/webvr-starter-kit * @license MIT */ -!function(e){function t(i){if(r[i])return r[i].exports;var n=r[i]={exports:{},id:i,loaded:!1};return e[i].call(n.exports,n,n.exports,t),n.loaded=!0,n.exports}var r={};return t.m=e,t.c=r,t.p="",t(0)}(function(e){for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t))switch(typeof e[t]){case"function":break;case"object":e[t]=function(t){var r=t.slice(1),i=e[t[0]];return function(e,t,n){i.apply(this,[e,t,n].concat(r))}}(e[t]);break;default:e[t]=e[e[t]]}return e}([function(e,t,r){!function(){"use strict";function e(){r(2),n=r(6)}function t(){function e(e,t){var r,i=document.createElement("span");return i.innerHTML=e,i.id=t,r=i.firstChild,r.setAttribute("width",18),r.setAttribute("height",18),a.appendChild(i),i}function t(){n.orientationEnabled()?n.disableOrientation():n.enableOrientation()}function i(){n.controlMode()&&(c.classList.remove("unsupported"),l.classList.remove("unsupported"))}var a,s,h,c,l,u,f=new o,p=document.body,d=document.fullscreenEnabled||document.webkitFullscreenEnabled||document.mozFullScreenEnabled||document.msFullscreenEnabled,m=p.webkitRequestFullscreen||p.mozRequestFullScreen||p.msRequestFullscreen;u=document.createElement("meta"),u.setAttribute("name","viewport"),u.setAttribute("content","width=device-width, initial-scale=1, user-scalable=no"),document.head.appendChild(u),a=document.createElement("div"),a.id="buttons",document.body.appendChild(a),m&&d&&(s=e(r(79),"fs-enable"),s.setAttribute("title","Enable Full Screen"),s.addEventListener("click",m.bind(p),!1),h=e(r(80),"fs-disable"),h.setAttribute("title","Exit Full Screen"),h.addEventListener("click",n.exitFullscreen,!1)),n.on("fullscreenchange",function(){n.isFullscreen()?(h.style.display="inline-block",s.style.display="none"):(h.style.display="",s.style.display=""),n.vrMode()?f.enable():f.disable()}),c=e(r(81),"vr"),c.setAttribute("title","Toggle Virtual Reality"),c.className="unsupported",c.addEventListener("click",n.requestVR,!1),l=e(r(82),"orientation"),l.setAttribute("title","Toggle Orientation"),l.className="unsupported",l.addEventListener("click",t,!1),n.on("devicechange",i),i(),window.addEventListener("keydown",function(e){e.keyCode==="Z".charCodeAt(0)?n.zeroSensor():e.keyCode==="O".charCodeAt(0)?n.enableOrientation():13===e.keyCode&&n.requestVR()},!1),n.resize()}function i(){e(),n.init(),document.body?t():window.addEventListener("load",t,!1),window.addEventListener("resize",n.resize,!1),window.VR=n,window.THREE=n.THREE}var n,o=r(1).NoSleep;i(),n.start()}()},function(e,t){!function(e){function t(e,t,r){var i=document.createElement("source");i.src=r,i.type="video/"+t,e.appendChild(i)}var r={Android:/Android/gi.test(navigator.userAgent),iOS:/AppleWebKit/.test(navigator.userAgent)&&/Mobile\/\w+/.test(navigator.userAgent)},i={WebM:"data:video/webm;base64,GkXfo0AgQoaBAUL3gQFC8oEEQvOBCEKCQAR3ZWJtQoeBAkKFgQIYU4BnQI0VSalmQCgq17FAAw9CQE2AQAZ3aGFtbXlXQUAGd2hhbW15RIlACECPQAAAAAAAFlSua0AxrkAu14EBY8WBAZyBACK1nEADdW5khkAFVl9WUDglhohAA1ZQOIOBAeBABrCBCLqBCB9DtnVAIueBAKNAHIEAAIAwAQCdASoIAAgAAUAmJaQAA3AA/vz0AAA=",MP4:"data:video/mp4;base64,AAAAHGZ0eXBpc29tAAACAGlzb21pc28ybXA0MQAAAAhmcmVlAAAAG21kYXQAAAGzABAHAAABthADAowdbb9/AAAC6W1vb3YAAABsbXZoZAAAAAB8JbCAfCWwgAAAA+gAAAAAAAEAAAEAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAIVdHJhawAAAFx0a2hkAAAAD3wlsIB8JbCAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAQAAAAAAIAAAACAAAAAABsW1kaWEAAAAgbWRoZAAAAAB8JbCAfCWwgAAAA+gAAAAAVcQAAAAAAC1oZGxyAAAAAAAAAAB2aWRlAAAAAAAAAAAAAAAAVmlkZW9IYW5kbGVyAAAAAVxtaW5mAAAAFHZtaGQAAAABAAAAAAAAAAAAAAAkZGluZgAAABxkcmVmAAAAAAAAAAEAAAAMdXJsIAAAAAEAAAEcc3RibAAAALhzdHNkAAAAAAAAAAEAAACobXA0dgAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAIAAgASAAAAEgAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABj//wAAAFJlc2RzAAAAAANEAAEABDwgEQAAAAADDUAAAAAABS0AAAGwAQAAAbWJEwAAAQAAAAEgAMSNiB9FAEQBFGMAAAGyTGF2YzUyLjg3LjQGAQIAAAAYc3R0cwAAAAAAAAABAAAAAQAAAAAAAAAcc3RzYwAAAAAAAAABAAAAAQAAAAEAAAABAAAAFHN0c3oAAAAAAAAAEwAAAAEAAAAUc3RjbwAAAAAAAAABAAAALAAAAGB1ZHRhAAAAWG1ldGEAAAAAAAAAIWhkbHIAAAAAAAAAAG1kaXJhcHBsAAAAAAAAAAAAAAAAK2lsc3QAAAAjqXRvbwAAABtkYXRhAAAAAQAAAABMYXZmNTIuNzguMw=="},n=function(){return r.iOS?this.noSleepTimer=null:r.Android&&(this.noSleepVideo=document.createElement("video"),this.noSleepVideo.setAttribute("loop",""),t(this.noSleepVideo,"webm",i.WebM),t(this.noSleepVideo,"mp4",i.MP4)),this};n.prototype.enable=function(e){r.iOS?(this.disable(),this.noSleepTimer=window.setInterval(function(){window.location=window.location,window.setTimeout(window.stop,0)},e||15e3)):r.Android&&this.noSleepVideo.play()},n.prototype.disable=function(){r.iOS?this.noSleepTimer&&(window.clearInterval(this.noSleepTimer),this.noSleepTimer=null):r.Android&&this.noSleepVideo.pause()},e.NoSleep=n}(this)},function(e,t,r){var i=r(3);"string"==typeof i&&(i=[[e.id,i,""]]);r(5)(i,{});i.locals&&(e.exports=i.locals)},function(e,t,r){t=e.exports=r(4)(),t.push([e.id,"body{font-family:Helvetica Neue,Helvetica,Arial,sans-serif;color:#eee;overflow:hidden;background:#282828;height:100%;width:100%;margin:0;padding:0}canvas{width:100%!important;height:100%!important;top:0;left:0}#buttons{position:absolute;bottom:0;left:0;padding:9pt;margin:8px;border-radius:8px;background-color:hsla(0,0%,50%,.6)}#buttons>*{margin:0 10px;display:inline-block;width:18px;height:18px;cursor:pointer}#buttons>:first-child{margin-left:0}#buttons>.unsupported,#fs-disable{display:none}",""])},function(e,t){e.exports=function(){var e=[];return e.toString=function(){for(var e=[],t=0;t=0&&j.splice(t,1),t=H.indexOf(G.findObject(e)),t>=0&&H.splice(t,1),e.children.forEach(n)}function o(){var e,t,r,i,o,a,s=[];for(E.ray.origin.setFromMatrixPosition(y.matrixWorld),E.ray.direction.set(0,0,.5).unproject(y).sub(E.ray.origin).normalize(),i=E.intersectObjects(j,!0),e=0;en&&(a=Date.now(),s=a-i,s>1e3&&(navigator.vibrate&&navigator.vibrate(100),i=Date.now(),R.emit("shake")))),e=c.x,t=c.y,r=c.z,N=!0},!1)}function p(){function e(){document.body.insertBefore(w.domElement,document.body.firstChild||null),u()}if(!w){w=new g.WebGLRenderer({antialias:!0}),w.domElement.addEventListener("webglcontextlost",function(e){console.log("lost context",e)}),x=new g.Scene,C=new G(x,r(59),null,{name:"body"}).moveTo(0,1.5,4),b=C.object,L=new G(b,function(e){return y=new g.PerspectiveCamera(60,window.innerWidth/window.innerHeight,F,B),e.add(y),y}).moveTo(0,1e-4,1e-4),A=new g.AudioListener,A.name="audio-listener",y.add(A),M=new g.VRControls(y),M.freeze=!P,_=new g.VRStereoEffect(w),_.near=F,_.far=B,_.addEventListener("fullscreenchange",function(e){var r;t()?k&&(S.enabled=!1,M.freeze=!1,M.reset(),r=window.screen,r.lockOrientation?r.lockOrientation("landscape-primary"):r.mozLockOrientation?r.mozLockOrientation("landscape-primary"):r.orientation&&r.orientation.lock&&r.orientation.lock("landscape-primary")):R.exitVR(),y.position.set(0,1e-4,1e-4),y.rotation.set(0,0,0),R.emit("fullscreenchange",e)}),M.addEventListener("devicechange",function(){N=!0,void 0===P&&(P="deviceorientation"===M.mode()),M.freeze=!P&&!k,R.emit("devicechange",M.mode(),_.hmd())}),S=new g.OrbitControls(y),S.target0.set(0,1e-4,0),S.target.copy(S.target0),S.update();var n=new g.DirectionalLight(16777215,.8);n.name="directional-light",n.position.set(20,100,100),n.castShadow=!0,n.shadowCameraVisible=!0,n.shadowMapWidth=2048,n.shadowMapHeight=2048,n.shadowCameraLeft=-10,n.shadowCameraRight=10,n.shadowCameraTop=10,n.shadowCameraBottom=-10,n.shadowCameraFar=150,n.shadowCameraNear=100,n.shadowDarkness=1,x.add(n),x.add(new g.AmbientLight(4473924)),R&&(R.camera=L,R.body=C,R.scene=x,R.canvas=w.domElement,R.renderer=w,R.zeroSensor=M.zeroSensor),E=new g.Raycaster,document.body?e():window.addEventListener("load",e,!1),R.canvas.addEventListener("mozfullscreenerror",i,!1),R.canvas.addEventListener("webkitfullscreenerror",i,!1),R.canvas.addEventListener("fullscreenerror",i,!1)}}function d(){g=r(8),r(60),r(61),r(62),g.ImageUtils.crossOrigin="",v=r(44),r(63),r(64)}function m(){p(),f(),u(),document.addEventListener("visibilitychange",l),document.addEventListener("mozvisibilitychange",l),document.addEventListener("msvisibilitychange",l),document.addEventListener("webkitvisibilitychange",l)}var g,v,y,x,b,w,A,M,_,S,E,T,C,L,P,R,F=.1,B=1e6,D=r(7),U=function(){},V=U,O=(document.exitFullscreen||document.mozCancelFullScreen||document.webkitExitFullscreen||document.msExitFullscreen||U).bind(document),z=!1,k=!1,N=!1,G=r(43),I=["box","cylinder","torus","sphere","empty","sound","floor","sky","panorama","image","video","text"],H=[],j=[],W=0,X=[];d(),e.exports=R={init:m,render:a,start:c,stop:h,resize:u,THREE:g,materials:D,animate:function(e){var t;"function"==typeof e&&(t=X.indexOf(e),0>t&&X.push(e))},end:function(e){var t;return e?void("function"==typeof e&&(t=X.indexOf(e),t>=0&&X.splice(t,1))):void(X.length=0)},requestVR:function(){!k&&_&&(k=!0,_.requestFullScreen())},exitVR:function(){return k=!1,t()?void O():(S.enabled=!0,M.freeze=!P,void y.rotation.set(0,0,0))},vrMode:function(){return k&&t()},orientationEnabled:function(){return!!P},enableOrientation:function(){P=!0,k||(M.freeze=!1)},disableOrientation:function(){P=!1,y.rotation.set(0,0,0),M.freeze=!k},isFullscreen:t,requestFullscreen:V,exitFullscreen:function(){t()&&O()},controlMode:function(){return M&&M.mode()},zeroSensor:U,vibrate:navigator.vibrate?navigator.vibrate.bind(navigator):U,times:function(e,t){var r;for(r=0;e>r;r++)t(r)},camera:L,body:C,scene:x,renderer:w||null,canvas:w&&w.domElement||null},I.forEach(function(e){var t,i=r(65)("./"+e);R[e]=function(e){var t=new G(x,i,b,e);return H.push(t),t.raycastable&&j.push(t.object),t},G.prototype[e]=function(e){var t=new G(this.object,i,b,e);return H.push(t),t.raycastable&&j.push(t.object),t};for(t in i)i.hasOwnProperty(t)&&"function"==typeof i[t]&&(R[e][t]=i[t],G.prototype[e][t]=i[t])}),v(R),Object.defineProperty(R,"target",{get:function(){return T}})}()},function(e,t,r){e.exports=function(){"use strict";function e(e,t,r){function i(){var e,t,i;s&&(o.naturalWidth>2048||o.naturalHeight>2048)&&(e=2048/Math.max(o.naturalWidth,o.naturalHeight),t=document.createElement("canvas"),t.width=Math.floor(o.naturalWidth*e),t.height=Math.floor(o.naturalHeight*e),i=t.getContext("2d"),i.drawImage(o,0,0,o.naturalWidth,o.naturalHeight,0,0,t.width,t.height),o=t),l.image=o,l.needsUpdate=!0,"function"==typeof r&&setTimeout(r.bind(null,l,o),1)}var o,a,l,f;return a=c.exec(e),f=!!a,a||(a=h.exec(e)),u[e]?o=u[e]:(o=document.createElement("img"),a&&(a[1]&&a[1]!==window.location.hostname||a[2]&&a[2]!==window.location.port)&&(o.crossOrigin="anonymous"),o.src=e,u[e]=o),l=new n.Texture(void 0,t),o.naturalWidth||f?setTimeout(i,1):o.addEventListener("load",i),l}function t(t){function r(r){if("string"==typeof r){if(h.test(r)||c.test(r))return e(r);r=d[r]}return"function"==typeof r?r(t):r}var i,s=f[t.type]||n.MeshLambertMaterial;return"string"==typeof t&&(t={map:t}),i=a({},t),o({ambient:t.ambient||t.color,emissive:t.emissive||t.color,map:r(t.map),specularMap:r(t.specularMap),normalMap:r(t.normalMap),alphaMap:r(t.alphaMap),envMap:r(t.envMap),lightMap:r(t.lightMap)},function(e,t){void 0!==e&&(i[t]=e)}),delete i.type,new s(i)}var i,n=r(8),o=r(9),a=r(17),s=navigator.userAgent.match(/(iPad|iPhone|iPod)/g),h=r(28),c=/^data:image\/(?:png|jpe?g|gif);/,l="http://pov-tc.pbs.org/pov/flv/2015/webvr-starter-kit/",u={},f={lambert:n.MeshLambertMaterial,basic:n.MeshBasicMaterial,phong:n.MeshPhongMaterial,normal:n.MeshNormalMaterial,depth:n.MeshDepthMaterial},p={asphalt:{repeat:12},"brick-tiles":{repeat:2},bricks:{type:"phong",repeat:4,normalMap:"bricks-normal.jpg",specularMap:"bricks-specular.jpg"},checkerboard:{repeat:10,map:"checkerboard.png"},grass:{repeat:12},"metal-floor":{type:"phong",shininess:100,repeat:2},metal:{type:"phong",shininess:100,shading:n.SmoothShading,repeat:2},stone:{repeat:8},tiles:{repeat:4},"weathered-wood":{repeat:8},wood:{repeat:4}},d={};return l=function(){var e,t;return document.currentScript?e=document.currentScript.getAttribute("src"):(t=document.getElementsByTagName("script"),e=t[t.length-1].getAttribute("src")),h.test(e)?"http://pov-tc.pbs.org/pov/flv/2015/webvr-starter-kit/":e.replace(/[a-z\-\.]+\.js$/i,"")}(),i={standard:function(){return new n.MeshLambertMaterial},textures:d,imageTexture:e,material:t,library:["standard"]},o(p,function(o,s){function h(t,i){function o(e){return/^[a-z0-9\/\-]+\.(png|jpg)$/i.test(e)?l+e:e}return i=i||{},function(s){var h=e(o(r(29)("./"+t)));return s=a({},i,s),s.repeat&&(s.repeat>0?h.repeat.set(s.repeat,s.repeat):s.repeat instanceof n.Vector2&&h.repeat.copy(s.repeat),h.wrapS=h.wrapT=n.RepeatWrapping),h}}var c,u=h(o.map||s+".jpg",o);c=a({},o,{map:u}),d[s]=u,o.normalMap&&(c.normalMap=d[s+"-normal"]=h(o.normalMap,o)),o.specularMap&&(c.specularMap=d[s+"-specular"]=h(o.specularMap,o)),i.library.push(s),i[s]=function(e){var r=a({},c,e);return t(r)}}),i}()},function(e,t,r){var i=i||{},n={REVISION:"71"};e.exports=n,void 0===Math.sign&&(Math.sign=function(e){return 0>e?-1:e>0?1:+e}),n.log=function(){console.log.apply(console,arguments)},n.warn=function(){console.warn.apply(console,arguments)},n.error=function(){console.error.apply(console,arguments)},n.MOUSE={LEFT:0,MIDDLE:1,RIGHT:2},n.CullFaceNone=0,n.CullFaceBack=1,n.CullFaceFront=2,n.CullFaceFrontBack=3,n.FrontFaceDirectionCW=0,n.FrontFaceDirectionCCW=1,n.BasicShadowMap=0,n.PCFShadowMap=1,n.PCFSoftShadowMap=2,n.FrontSide=0,n.BackSide=1,n.DoubleSide=2,n.NoShading=0,n.FlatShading=1,n.SmoothShading=2,n.NoColors=0,n.FaceColors=1,n.VertexColors=2,n.NoBlending=0,n.NormalBlending=1,n.AdditiveBlending=2,n.SubtractiveBlending=3,n.MultiplyBlending=4,n.CustomBlending=5,n.AddEquation=100,n.SubtractEquation=101,n.ReverseSubtractEquation=102,n.MinEquation=103,n.MaxEquation=104,n.ZeroFactor=200,n.OneFactor=201,n.SrcColorFactor=202,n.OneMinusSrcColorFactor=203,n.SrcAlphaFactor=204,n.OneMinusSrcAlphaFactor=205,n.DstAlphaFactor=206,n.OneMinusDstAlphaFactor=207,n.DstColorFactor=208,n.OneMinusDstColorFactor=209,n.SrcAlphaSaturateFactor=210,n.MultiplyOperation=0,n.MixOperation=1,n.AddOperation=2,n.UVMapping=300,n.CubeReflectionMapping=301,n.CubeRefractionMapping=302,n.EquirectangularReflectionMapping=303,n.EquirectangularRefractionMapping=304,n.SphericalReflectionMapping=305,n.RepeatWrapping=1e3,n.ClampToEdgeWrapping=1001,n.MirroredRepeatWrapping=1002,n.NearestFilter=1003,n.NearestMipMapNearestFilter=1004,n.NearestMipMapLinearFilter=1005,n.LinearFilter=1006,n.LinearMipMapNearestFilter=1007,n.LinearMipMapLinearFilter=1008,n.UnsignedByteType=1009,n.ByteType=1010,n.ShortType=1011,n.UnsignedShortType=1012,n.IntType=1013,n.UnsignedIntType=1014,n.FloatType=1015,n.HalfFloatType=1025,n.UnsignedShort4444Type=1016,n.UnsignedShort5551Type=1017,n.UnsignedShort565Type=1018,n.AlphaFormat=1019,n.RGBFormat=1020,n.RGBAFormat=1021,n.LuminanceFormat=1022,n.LuminanceAlphaFormat=1023,n.RGBEFormat=n.RGBAFormat,n.RGB_S3TC_DXT1_Format=2001,n.RGBA_S3TC_DXT1_Format=2002,n.RGBA_S3TC_DXT3_Format=2003,n.RGBA_S3TC_DXT5_Format=2004,n.RGB_PVRTC_4BPPV1_Format=2100,n.RGB_PVRTC_2BPPV1_Format=2101,n.RGBA_PVRTC_4BPPV1_Format=2102,n.RGBA_PVRTC_2BPPV1_Format=2103,n.Projector=function(){n.error("THREE.Projector has been moved to /examples/js/renderers/Projector.js."),this.projectVector=function(e,t){n.warn("THREE.Projector: .projectVector() is now vector.project()."),e.project(t)},this.unprojectVector=function(e,t){n.warn("THREE.Projector: .unprojectVector() is now vector.unproject()."),e.unproject(t)},this.pickingRay=function(e,t){n.error("THREE.Projector: .pickingRay() is now raycaster.setFromCamera().")}},n.CanvasRenderer=function(){n.error("THREE.CanvasRenderer has been moved to /examples/js/renderers/CanvasRenderer.js"),this.domElement=document.createElement("canvas"),this.clear=function(){},this.render=function(){},this.setClearColor=function(){},this.setSize=function(){}},n.Color=function(e){return 3===arguments.length?this.setRGB(arguments[0],arguments[1],arguments[2]):this.set(e)},n.Color.prototype={constructor:n.Color,r:1,g:1,b:1,set:function(e){return e instanceof n.Color?this.copy(e):"number"==typeof e?this.setHex(e):"string"==typeof e&&this.setStyle(e),this},setHex:function(e){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(255&e)/255,this},setRGB:function(e,t,r){return this.r=e,this.g=t,this.b=r,this},setHSL:function(e,t,r){if(0===t)this.r=this.g=this.b=r;else{var i=function(e,t,r){return 0>r&&(r+=1),r>1&&(r-=1),1/6>r?e+6*(t-e)*r:.5>r?t:2/3>r?e+6*(t-e)*(2/3-r):e},n=.5>=r?r*(1+t):r+t-r*t,o=2*r-n;this.r=i(o,n,e+1/3),this.g=i(o,n,e),this.b=i(o,n,e-1/3)}return this},setStyle:function(e){if(/^rgb\((\d+), ?(\d+), ?(\d+)\)$/i.test(e)){var t=/^rgb\((\d+), ?(\d+), ?(\d+)\)$/i.exec(e);return this.r=Math.min(255,parseInt(t[1],10))/255,this.g=Math.min(255,parseInt(t[2],10))/255,this.b=Math.min(255,parseInt(t[3],10))/255,this}if(/^rgb\((\d+)\%, ?(\d+)\%, ?(\d+)\%\)$/i.test(e)){var t=/^rgb\((\d+)\%, ?(\d+)\%, ?(\d+)\%\)$/i.exec(e);return this.r=Math.min(100,parseInt(t[1],10))/100,this.g=Math.min(100,parseInt(t[2],10))/100,this.b=Math.min(100,parseInt(t[3],10))/100,this}if(/^\#([0-9a-f]{6})$/i.test(e)){var t=/^\#([0-9a-f]{6})$/i.exec(e);return this.setHex(parseInt(t[1],16)),this}if(/^\#([0-9a-f])([0-9a-f])([0-9a-f])$/i.test(e)){var t=/^\#([0-9a-f])([0-9a-f])([0-9a-f])$/i.exec(e);return this.setHex(parseInt(t[1]+t[1]+t[2]+t[2]+t[3]+t[3],16)),this}return/^(\w+)$/i.test(e)?(this.setHex(n.ColorKeywords[e]),this):void 0},copy:function(e){return this.r=e.r,this.g=e.g,this.b=e.b,this},copyGammaToLinear:function(e,t){return void 0===t&&(t=2),this.r=Math.pow(e.r,t),this.g=Math.pow(e.g,t),this.b=Math.pow(e.b,t),this},copyLinearToGamma:function(e,t){void 0===t&&(t=2);var r=t>0?1/t:1;return this.r=Math.pow(e.r,r),this.g=Math.pow(e.g,r),this.b=Math.pow(e.b,r),this},convertGammaToLinear:function(){var e=this.r,t=this.g,r=this.b;return this.r=e*e,this.g=t*t,this.b=r*r,this},convertLinearToGamma:function(){return this.r=Math.sqrt(this.r),this.g=Math.sqrt(this.g),this.b=Math.sqrt(this.b),this},getHex:function(){return 255*this.r<<16^255*this.g<<8^255*this.b<<0},getHexString:function(){return("000000"+this.getHex().toString(16)).slice(-6)},getHSL:function(e){var t,r,i=e||{h:0,s:0,l:0},n=this.r,o=this.g,a=this.b,s=Math.max(n,o,a),h=Math.min(n,o,a),c=(h+s)/2;if(h===s)t=0,r=0;else{var l=s-h;switch(r=.5>=c?l/(s+h):l/(2-s-h),s){case n:t=(o-a)/l+(a>o?6:0);break;case o:t=(a-n)/l+2;break;case a:t=(n-o)/l+4}t/=6}return i.h=t,i.s=r,i.l=c,i},getStyle:function(){return"rgb("+(255*this.r|0)+","+(255*this.g|0)+","+(255*this.b|0)+")"},offsetHSL:function(e,t,r){var i=this.getHSL();return i.h+=e,i.s+=t,i.l+=r,this.setHSL(i.h,i.s,i.l),this},add:function(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this},addColors:function(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this},addScalar:function(e){return this.r+=e,this.g+=e,this.b+=e,this},multiply:function(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this},multiplyScalar:function(e){return this.r*=e,this.g*=e,this.b*=e,this},lerp:function(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this},equals:function(e){return e.r===this.r&&e.g===this.g&&e.b===this.b},fromArray:function(e){return this.r=e[0],this.g=e[1],this.b=e[2],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e},clone:function(){return(new n.Color).setRGB(this.r,this.g,this.b)}},n.ColorKeywords={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},n.Quaternion=function(e,t,r,i){this._x=e||0,this._y=t||0,this._z=r||0,this._w=void 0!==i?i:1},n.Quaternion.prototype={constructor:n.Quaternion,_x:0,_y:0,_z:0,_w:0,get x(){return this._x},set x(e){this._x=e,this.onChangeCallback()},get y(){return this._y},set y(e){this._y=e,this.onChangeCallback()},get z(){return this._z},set z(e){this._z=e,this.onChangeCallback()},get w(){return this._w},set w(e){this._w=e,this.onChangeCallback()},set:function(e,t,r,i){return this._x=e,this._y=t,this._z=r,this._w=i,this.onChangeCallback(),this},copy:function(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this.onChangeCallback(),this},setFromEuler:function(e,t){if(e instanceof n.Euler==!1)throw new Error("THREE.Quaternion: .setFromEuler() now expects a Euler rotation rather than a Vector3 and order.");var r=Math.cos(e._x/2),i=Math.cos(e._y/2),o=Math.cos(e._z/2),a=Math.sin(e._x/2),s=Math.sin(e._y/2),h=Math.sin(e._z/2);return"XYZ"===e.order?(this._x=a*i*o+r*s*h,this._y=r*s*o-a*i*h,this._z=r*i*h+a*s*o,this._w=r*i*o-a*s*h):"YXZ"===e.order?(this._x=a*i*o+r*s*h,this._y=r*s*o-a*i*h,this._z=r*i*h-a*s*o,this._w=r*i*o+a*s*h):"ZXY"===e.order?(this._x=a*i*o-r*s*h,this._y=r*s*o+a*i*h,this._z=r*i*h+a*s*o,this._w=r*i*o-a*s*h):"ZYX"===e.order?(this._x=a*i*o-r*s*h,this._y=r*s*o+a*i*h,this._z=r*i*h-a*s*o,this._w=r*i*o+a*s*h):"YZX"===e.order?(this._x=a*i*o+r*s*h,this._y=r*s*o+a*i*h,this._z=r*i*h-a*s*o,this._w=r*i*o-a*s*h):"XZY"===e.order&&(this._x=a*i*o-r*s*h,this._y=r*s*o-a*i*h,this._z=r*i*h+a*s*o,this._w=r*i*o+a*s*h),t!==!1&&this.onChangeCallback(),this},setFromAxisAngle:function(e,t){var r=t/2,i=Math.sin(r);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(r),this.onChangeCallback(),this},setFromRotationMatrix:function(e){var t,r=e.elements,i=r[0],n=r[4],o=r[8],a=r[1],s=r[5],h=r[9],c=r[2],l=r[6],u=r[10],f=i+s+u;return f>0?(t=.5/Math.sqrt(f+1),this._w=.25/t,this._x=(l-h)*t,this._y=(o-c)*t,this._z=(a-n)*t):i>s&&i>u?(t=2*Math.sqrt(1+i-s-u),this._w=(l-h)/t,this._x=.25*t,this._y=(n+a)/t,this._z=(o+c)/t):s>u?(t=2*Math.sqrt(1+s-i-u),this._w=(o-c)/t,this._x=(n+a)/t,this._y=.25*t,this._z=(h+l)/t):(t=2*Math.sqrt(1+u-i-s),this._w=(a-n)/t,this._x=(o+c)/t,this._y=(h+l)/t,this._z=.25*t),this.onChangeCallback(),this},setFromUnitVectors:function(){var e,t,r=1e-6;return function(i,o){return void 0===e&&(e=new n.Vector3),t=i.dot(o)+1,r>t?(t=0,Math.abs(i.x)>Math.abs(i.z)?e.set(-i.y,i.x,0):e.set(0,-i.z,i.y)):e.crossVectors(i,o),this._x=e.x,this._y=e.y,this._z=e.z,this._w=t,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(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._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 e=this.length();return 0===e?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this.onChangeCallback(),this},multiply:function(e,t){return void 0!==t?(n.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(e,t)):this.multiplyQuaternions(this,e)},multiplyQuaternions:function(e,t){var r=e._x,i=e._y,n=e._z,o=e._w,a=t._x,s=t._y,h=t._z,c=t._w;return this._x=r*c+o*a+i*h-n*s,this._y=i*c+o*s+n*a-r*h,this._z=n*c+o*h+r*s-i*a,this._w=o*c-r*a-i*s-n*h,this.onChangeCallback(),this},multiplyVector3:function(e){return n.warn("THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead."),e.applyQuaternion(this)},slerp:function(e,t){if(0===t)return this;if(1===t)return this.copy(e);var r=this._x,i=this._y,n=this._z,o=this._w,a=o*e._w+r*e._x+i*e._y+n*e._z;if(0>a?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,a=-a):this.copy(e),a>=1)return this._w=o,this._x=r,this._y=i,this._z=n,this;var s=Math.acos(a),h=Math.sqrt(1-a*a);if(Math.abs(h)<.001)return this._w=.5*(o+this._w),this._x=.5*(r+this._x),this._y=.5*(i+this._y),this._z=.5*(n+this._z),this;var c=Math.sin((1-t)*s)/h,l=Math.sin(t*s)/h;return this._w=o*c+this._w*l,this._x=r*c+this._x*l,this._y=i*c+this._y*l,this._z=n*c+this._z*l,this.onChangeCallback(),this},equals:function(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w},fromArray:function(e,t){return void 0===t&&(t=0),this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this.onChangeCallback(),this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e},onChange:function(e){return this.onChangeCallback=e,this},onChangeCallback:function(){},clone:function(){return new n.Quaternion(this._x,this._y,this._z,this._w)}},n.Quaternion.slerp=function(e,t,r,i){return r.copy(e).slerp(t,i)},n.Vector2=function(e,t){this.x=e||0,this.y=t||0},n.Vector2.prototype={constructor:n.Vector2,set:function(e,t){return this.x=e,this.y=t,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setComponent:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}},getComponent:function(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}},copy:function(e){return this.x=e.x,this.y=e.y, -this},add:function(e,t){return void 0!==t?(n.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this)},addScalar:function(e){return this.x+=e,this.y+=e,this},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this},sub:function(e,t){return void 0!==t?(n.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this)},subScalar:function(e){return this.x-=e,this.y-=e,this},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this},multiply:function(e){return this.x*=e.x,this.y*=e.y,this},multiplyScalar:function(e){return this.x*=e,this.y*=e,this},divide:function(e){return this.x/=e.x,this.y/=e.y,this},divideScalar:function(e){if(0!==e){var t=1/e;this.x*=t,this.y*=t}else this.x=0,this.y=0;return this},min:function(e){return this.x>e.x&&(this.x=e.x),this.y>e.y&&(this.y=e.y),this},max:function(e){return this.xt.x&&(this.x=t.x),this.yt.y&&(this.y=t.y),this},clampScalar:function(){var e,t;return function(r,i){return void 0===e&&(e=new n.Vector2,t=new n.Vector2),e.set(r,r),t.set(i,i),this.clamp(e,t)}}(),floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this},negate:function(){return this.x=-this.x,this.y=-this.y,this},dot:function(e){return this.x*e.x+this.y*e.y},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},normalize:function(){return this.divideScalar(this.length())},distanceTo:function(e){return Math.sqrt(this.distanceToSquared(e))},distanceToSquared:function(e){var t=this.x-e.x,r=this.y-e.y;return t*t+r*r},setLength:function(e){var t=this.length();return 0!==t&&e!==t&&this.multiplyScalar(e/t),this},lerp:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this},lerpVectors:function(e,t,r){return this.subVectors(t,e).multiplyScalar(r).add(e),this},equals:function(e){return e.x===this.x&&e.y===this.y},fromArray:function(e,t){return void 0===t&&(t=0),this.x=e[t],this.y=e[t+1],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.x,e[t+1]=this.y,e},fromAttribute:function(e,t,r){return void 0===r&&(r=0),t=t*e.itemSize+r,this.x=e.array[t],this.y=e.array[t+1],this},clone:function(){return new n.Vector2(this.x,this.y)}},n.Vector3=function(e,t,r){this.x=e||0,this.y=t||0,this.z=r||0},n.Vector3.prototype={constructor:n.Vector3,set:function(e,t,r){return this.x=e,this.y=t,this.z=r,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setZ:function(e){return this.z=e,this},setComponent:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}},getComponent:function(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}},copy:function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this},add:function(e,t){return void 0!==t?(n.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this.z+=e.z,this)},addScalar:function(e){return this.x+=e,this.y+=e,this.z+=e,this},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this},sub:function(e,t){return void 0!==t?(n.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this.z-=e.z,this)},subScalar:function(e){return this.x-=e,this.y-=e,this.z-=e,this},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this},multiply:function(e,t){return void 0!==t?(n.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(e,t)):(this.x*=e.x,this.y*=e.y,this.z*=e.z,this)},multiplyScalar:function(e){return this.x*=e,this.y*=e,this.z*=e,this},multiplyVectors:function(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this},applyEuler:function(){var e;return function(t){return t instanceof n.Euler==!1&&n.error("THREE.Vector3: .applyEuler() now expects a Euler rotation rather than a Vector3 and order."),void 0===e&&(e=new n.Quaternion),this.applyQuaternion(e.setFromEuler(t)),this}}(),applyAxisAngle:function(){var e;return function(t,r){return void 0===e&&(e=new n.Quaternion),this.applyQuaternion(e.setFromAxisAngle(t,r)),this}}(),applyMatrix3:function(e){var t=this.x,r=this.y,i=this.z,n=e.elements;return this.x=n[0]*t+n[3]*r+n[6]*i,this.y=n[1]*t+n[4]*r+n[7]*i,this.z=n[2]*t+n[5]*r+n[8]*i,this},applyMatrix4:function(e){var t=this.x,r=this.y,i=this.z,n=e.elements;return this.x=n[0]*t+n[4]*r+n[8]*i+n[12],this.y=n[1]*t+n[5]*r+n[9]*i+n[13],this.z=n[2]*t+n[6]*r+n[10]*i+n[14],this},applyProjection:function(e){var t=this.x,r=this.y,i=this.z,n=e.elements,o=1/(n[3]*t+n[7]*r+n[11]*i+n[15]);return this.x=(n[0]*t+n[4]*r+n[8]*i+n[12])*o,this.y=(n[1]*t+n[5]*r+n[9]*i+n[13])*o,this.z=(n[2]*t+n[6]*r+n[10]*i+n[14])*o,this},applyQuaternion:function(e){var t=this.x,r=this.y,i=this.z,n=e.x,o=e.y,a=e.z,s=e.w,h=s*t+o*i-a*r,c=s*r+a*t-n*i,l=s*i+n*r-o*t,u=-n*t-o*r-a*i;return this.x=h*s+u*-n+c*-a-l*-o,this.y=c*s+u*-o+l*-n-h*-a,this.z=l*s+u*-a+h*-o-c*-n,this},project:function(){var e;return function(t){return void 0===e&&(e=new n.Matrix4),e.multiplyMatrices(t.projectionMatrix,e.getInverse(t.matrixWorld)),this.applyProjection(e)}}(),unproject:function(){var e;return function(t){return void 0===e&&(e=new n.Matrix4),e.multiplyMatrices(t.matrixWorld,e.getInverse(t.projectionMatrix)),this.applyProjection(e)}}(),transformDirection:function(e){var t=this.x,r=this.y,i=this.z,n=e.elements;return this.x=n[0]*t+n[4]*r+n[8]*i,this.y=n[1]*t+n[5]*r+n[9]*i,this.z=n[2]*t+n[6]*r+n[10]*i,this.normalize(),this},divide:function(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this},divideScalar:function(e){if(0!==e){var t=1/e;this.x*=t,this.y*=t,this.z*=t}else this.x=0,this.y=0,this.z=0;return this},min:function(e){return this.x>e.x&&(this.x=e.x),this.y>e.y&&(this.y=e.y),this.z>e.z&&(this.z=e.z),this},max:function(e){return this.xt.x&&(this.x=t.x),this.yt.y&&(this.y=t.y),this.zt.z&&(this.z=t.z),this},clampScalar:function(){var e,t;return function(r,i){return void 0===e&&(e=new n.Vector3,t=new n.Vector3),e.set(r,r,r),t.set(i,i,i),this.clamp(e,t)}}(),floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},dot:function(e){return this.x*e.x+this.y*e.y+this.z*e.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)},normalize:function(){return this.divideScalar(this.length())},setLength:function(e){var t=this.length();return 0!==t&&e!==t&&this.multiplyScalar(e/t),this},lerp:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this},lerpVectors:function(e,t,r){return this.subVectors(t,e).multiplyScalar(r).add(e),this},cross:function(e,t){if(void 0!==t)return n.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(e,t);var r=this.x,i=this.y,o=this.z;return this.x=i*e.z-o*e.y,this.y=o*e.x-r*e.z,this.z=r*e.y-i*e.x,this},crossVectors:function(e,t){var r=e.x,i=e.y,n=e.z,o=t.x,a=t.y,s=t.z;return this.x=i*s-n*a,this.y=n*o-r*s,this.z=r*a-i*o,this},projectOnVector:function(){var e,t;return function(r){return void 0===e&&(e=new n.Vector3),e.copy(r).normalize(),t=this.dot(e),this.copy(e).multiplyScalar(t)}}(),projectOnPlane:function(){var e;return function(t){return void 0===e&&(e=new n.Vector3),e.copy(this).projectOnVector(t),this.sub(e)}}(),reflect:function(){var e;return function(t){return void 0===e&&(e=new n.Vector3),this.sub(e.copy(t).multiplyScalar(2*this.dot(t)))}}(),angleTo:function(e){var t=this.dot(e)/(this.length()*e.length());return Math.acos(n.Math.clamp(t,-1,1))},distanceTo:function(e){return Math.sqrt(this.distanceToSquared(e))},distanceToSquared:function(e){var t=this.x-e.x,r=this.y-e.y,i=this.z-e.z;return t*t+r*r+i*i},setEulerFromRotationMatrix:function(e,t){n.error("THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.")},setEulerFromQuaternion:function(e,t){n.error("THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.")},getPositionFromMatrix:function(e){return n.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition()."),this.setFromMatrixPosition(e)},getScaleFromMatrix:function(e){return n.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale()."),this.setFromMatrixScale(e)},getColumnFromMatrix:function(e,t){return n.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn()."),this.setFromMatrixColumn(e,t)},setFromMatrixPosition:function(e){return this.x=e.elements[12],this.y=e.elements[13],this.z=e.elements[14],this},setFromMatrixScale:function(e){var t=this.set(e.elements[0],e.elements[1],e.elements[2]).length(),r=this.set(e.elements[4],e.elements[5],e.elements[6]).length(),i=this.set(e.elements[8],e.elements[9],e.elements[10]).length();return this.x=t,this.y=r,this.z=i,this},setFromMatrixColumn:function(e,t){var r=4*e,i=t.elements;return this.x=i[r],this.y=i[r+1],this.z=i[r+2],this},equals:function(e){return e.x===this.x&&e.y===this.y&&e.z===this.z},fromArray:function(e,t){return void 0===t&&(t=0),this.x=e[t],this.y=e[t+1],this.z=e[t+2],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e},fromAttribute:function(e,t,r){return void 0===r&&(r=0),t=t*e.itemSize+r,this.x=e.array[t],this.y=e.array[t+1],this.z=e.array[t+2],this},clone:function(){return new n.Vector3(this.x,this.y,this.z)}},n.Vector4=function(e,t,r,i){this.x=e||0,this.y=t||0,this.z=r||0,this.w=void 0!==i?i:1},n.Vector4.prototype={constructor:n.Vector4,set:function(e,t,r,i){return this.x=e,this.y=t,this.z=r,this.w=i,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setZ:function(e){return this.z=e,this},setW:function(e){return this.w=e,this},setComponent:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}},getComponent:function(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}},copy:function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=void 0!==e.w?e.w:1,this},add:function(e,t){return void 0!==t?(n.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this)},addScalar:function(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this},sub:function(e,t){return void 0!==t?(n.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this)},subScalar:function(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this},multiplyScalar:function(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this},applyMatrix4:function(e){var t=this.x,r=this.y,i=this.z,n=this.w,o=e.elements;return this.x=o[0]*t+o[4]*r+o[8]*i+o[12]*n,this.y=o[1]*t+o[5]*r+o[9]*i+o[13]*n,this.z=o[2]*t+o[6]*r+o[10]*i+o[14]*n,this.w=o[3]*t+o[7]*r+o[11]*i+o[15]*n,this},divideScalar:function(e){if(0!==e){var t=1/e;this.x*=t,this.y*=t,this.z*=t,this.w*=t}else this.x=0,this.y=0,this.z=0,this.w=1;return this},setAxisAngleFromQuaternion:function(e){this.w=2*Math.acos(e.w);var t=Math.sqrt(1-e.w*e.w);return 1e-4>t?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this},setAxisAngleFromRotationMatrix:function(e){var t,r,i,n,o=.01,a=.1,s=e.elements,h=s[0],c=s[4],l=s[8],u=s[1],f=s[5],p=s[9],d=s[2],m=s[6],g=s[10];if(Math.abs(c-u)y&&v>x?o>v?(r=0,i=.707106781,n=.707106781):(r=Math.sqrt(v),i=b/r,n=w/r):y>x?o>y?(r=.707106781,i=0,n=.707106781):(i=Math.sqrt(y),r=b/i,n=A/i):o>x?(r=.707106781,i=.707106781,n=0):(n=Math.sqrt(x),r=w/n,i=A/n),this.set(r,i,n,t),this}var M=Math.sqrt((m-p)*(m-p)+(l-d)*(l-d)+(u-c)*(u-c));return Math.abs(M)<.001&&(M=1),this.x=(m-p)/M,this.y=(l-d)/M,this.z=(u-c)/M,this.w=Math.acos((h+f+g-1)/2),this},min:function(e){return this.x>e.x&&(this.x=e.x),this.y>e.y&&(this.y=e.y),this.z>e.z&&(this.z=e.z),this.w>e.w&&(this.w=e.w),this},max:function(e){return this.xt.x&&(this.x=t.x),this.yt.y&&(this.y=t.y),this.zt.z&&(this.z=t.z),this.wt.w&&(this.w=t.w),this},clampScalar:function(){var e,t;return function(r,i){return void 0===e&&(e=new n.Vector4,t=new n.Vector4),e.set(r,r,r,r),t.set(i,i,i,i),this.clamp(e,t)}}(),floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this.w=this.w<0?Math.ceil(this.w):Math.floor(this.w),this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this},dot:function(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.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)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)},normalize:function(){return this.divideScalar(this.length())},setLength:function(e){var t=this.length();return 0!==t&&e!==t&&this.multiplyScalar(e/t),this},lerp:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this},lerpVectors:function(e,t,r){return this.subVectors(t,e).multiplyScalar(r).add(e),this},equals:function(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w},fromArray:function(e,t){return void 0===t&&(t=0),this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e},fromAttribute:function(e,t,r){return void 0===r&&(r=0),t=t*e.itemSize+r,this.x=e.array[t],this.y=e.array[t+1],this.z=e.array[t+2],this.w=e.array[t+3],this},clone:function(){return new n.Vector4(this.x,this.y,this.z,this.w)}},n.Euler=function(e,t,r,i){this._x=e||0,this._y=t||0,this._z=r||0,this._order=i||n.Euler.DefaultOrder},n.Euler.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"],n.Euler.DefaultOrder="XYZ",n.Euler.prototype={constructor:n.Euler,_x:0,_y:0,_z:0,_order:n.Euler.DefaultOrder,get x(){return this._x},set x(e){this._x=e,this.onChangeCallback()},get y(){return this._y},set y(e){this._y=e,this.onChangeCallback()},get z(){return this._z},set z(e){this._z=e,this.onChangeCallback()},get order(){return this._order},set order(e){this._order=e,this.onChangeCallback()},set:function(e,t,r,i){return this._x=e,this._y=t,this._z=r,this._order=i||this._order,this.onChangeCallback(),this},copy:function(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this.onChangeCallback(),this},setFromRotationMatrix:function(e,t,r){var i=n.Math.clamp,o=e.elements,a=o[0],s=o[4],h=o[8],c=o[1],l=o[5],u=o[9],f=o[2],p=o[6],d=o[10];return t=t||this._order,"XYZ"===t?(this._y=Math.asin(i(h,-1,1)),Math.abs(h)<.99999?(this._x=Math.atan2(-u,d),this._z=Math.atan2(-s,a)):(this._x=Math.atan2(p,l),this._z=0)):"YXZ"===t?(this._x=Math.asin(-i(u,-1,1)),Math.abs(u)<.99999?(this._y=Math.atan2(h,d),this._z=Math.atan2(c,l)):(this._y=Math.atan2(-f,a),this._z=0)):"ZXY"===t?(this._x=Math.asin(i(p,-1,1)),Math.abs(p)<.99999?(this._y=Math.atan2(-f,d),this._z=Math.atan2(-s,l)):(this._y=0,this._z=Math.atan2(c,a))):"ZYX"===t?(this._y=Math.asin(-i(f,-1,1)),Math.abs(f)<.99999?(this._x=Math.atan2(p,d),this._z=Math.atan2(c,a)):(this._x=0,this._z=Math.atan2(-s,l))):"YZX"===t?(this._z=Math.asin(i(c,-1,1)),Math.abs(c)<.99999?(this._x=Math.atan2(-u,l),this._y=Math.atan2(-f,a)):(this._x=0,this._y=Math.atan2(h,d))):"XZY"===t?(this._z=Math.asin(-i(s,-1,1)),Math.abs(s)<.99999?(this._x=Math.atan2(p,l),this._y=Math.atan2(h,a)):(this._x=Math.atan2(-u,d),this._y=0)):n.warn("THREE.Euler: .setFromRotationMatrix() given unsupported order: "+t),this._order=t,r!==!1&&this.onChangeCallback(),this},setFromQuaternion:function(){var e;return function(t,r,i){return void 0===e&&(e=new n.Matrix4),e.makeRotationFromQuaternion(t),this.setFromRotationMatrix(e,r,i),this}}(),setFromVector3:function(e,t){return this.set(e.x,e.y,e.z,t||this._order)},reorder:function(){var e=new n.Quaternion;return function(t){e.setFromEuler(this),this.setFromQuaternion(e,t)}}(),equals:function(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order},fromArray:function(e){return this._x=e[0],this._y=e[1],this._z=e[2],void 0!==e[3]&&(this._order=e[3]),this.onChangeCallback(),this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e},toVector3:function(e){return e?e.set(this._x,this._y,this._z):new n.Vector3(this._x,this._y,this._z)},onChange:function(e){return this.onChangeCallback=e,this},onChangeCallback:function(){},clone:function(){return new n.Euler(this._x,this._y,this._z,this._order)}},n.Line3=function(e,t){this.start=void 0!==e?e:new n.Vector3,this.end=void 0!==t?t:new n.Vector3},n.Line3.prototype={constructor:n.Line3,set:function(e,t){return this.start.copy(e),this.end.copy(t),this},copy:function(e){return this.start.copy(e.start),this.end.copy(e.end),this},center:function(e){var t=e||new n.Vector3;return t.addVectors(this.start,this.end).multiplyScalar(.5)},delta:function(e){var t=e||new n.Vector3;return t.subVectors(this.end,this.start)},distanceSq:function(){return this.start.distanceToSquared(this.end)},distance:function(){return this.start.distanceTo(this.end)},at:function(e,t){var r=t||new n.Vector3;return this.delta(r).multiplyScalar(e).add(this.start)},closestPointToPointParameter:function(){var e=new n.Vector3,t=new n.Vector3;return function(r,i){e.subVectors(r,this.start),t.subVectors(this.end,this.start);var o=t.dot(t),a=t.dot(e),s=a/o;return i&&(s=n.Math.clamp(s,0,1)),s}}(),closestPointToPoint:function(e,t,r){var i=this.closestPointToPointParameter(e,t),o=r||new n.Vector3;return this.delta(o).multiplyScalar(i).add(this.start)},applyMatrix4:function(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this},equals:function(e){return e.start.equals(this.start)&&e.end.equals(this.end)},clone:function(){return(new n.Line3).copy(this)}},n.Box2=function(e,t){this.min=void 0!==e?e:new n.Vector2(1/0,1/0),this.max=void 0!==t?t:new n.Vector2(-(1/0),-(1/0))},n.Box2.prototype={constructor:n.Box2,set:function(e,t){return this.min.copy(e),this.max.copy(t),this},setFromPoints:function(e){this.makeEmpty();for(var t=0,r=e.length;r>t;t++)this.expandByPoint(e[t]);return this},setFromCenterAndSize:function(){var e=new n.Vector2;return function(t,r){var i=e.copy(r).multiplyScalar(.5);return this.min.copy(t).sub(i),this.max.copy(t).add(i),this}}(),copy:function(e){return this.min.copy(e.min),this.max.copy(e.max),this},makeEmpty:function(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-(1/0),this},empty:function(){return this.max.xthis.max.x||e.ythis.max.y?!1:!0},containsBox:function(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y?!0:!1},getParameter:function(e,t){var r=t||new n.Vector2;return r.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))},isIntersectionBox:function(e){return e.max.xthis.max.x||e.max.ythis.max.y?!1:!0},clampPoint:function(e,t){var r=t||new n.Vector2;return r.copy(e).clamp(this.min,this.max)},distanceToPoint:function(){var e=new n.Vector2;return function(t){var r=e.copy(t).clamp(this.min,this.max);return r.sub(t).length()}}(),intersect:function(e){return this.min.max(e.min),this.max.min(e.max),this},union:function(e){return this.min.min(e.min),this.max.max(e.max),this},translate:function(e){return this.min.add(e),this.max.add(e),this},equals:function(e){return e.min.equals(this.min)&&e.max.equals(this.max)},clone:function(){return(new n.Box2).copy(this)}},n.Box3=function(e,t){this.min=void 0!==e?e:new n.Vector3(1/0,1/0,1/0),this.max=void 0!==t?t:new n.Vector3(-(1/0),-(1/0),-(1/0))},n.Box3.prototype={constructor:n.Box3,set:function(e,t){return this.min.copy(e),this.max.copy(t),this},setFromPoints:function(e){this.makeEmpty();for(var t=0,r=e.length;r>t;t++)this.expandByPoint(e[t]);return this},setFromCenterAndSize:function(){var e=new n.Vector3;return function(t,r){var i=e.copy(r).multiplyScalar(.5);return this.min.copy(t).sub(i),this.max.copy(t).add(i),this}}(),setFromObject:function(){var e=new n.Vector3;return function(t){var r=this;return t.updateMatrixWorld(!0),this.makeEmpty(),t.traverse(function(t){var i=t.geometry;if(void 0!==i)if(i instanceof n.Geometry)for(var o=i.vertices,a=0,s=o.length;s>a;a++)e.copy(o[a]),e.applyMatrix4(t.matrixWorld),r.expandByPoint(e);else if(i instanceof n.BufferGeometry&&void 0!==i.attributes.position)for(var h=i.attributes.position.array,a=0,s=h.length;s>a;a+=3)e.set(h[a],h[a+1],h[a+2]),e.applyMatrix4(t.matrixWorld),r.expandByPoint(e)}),this}}(),copy:function(e){return this.min.copy(e.min),this.max.copy(e.max),this},makeEmpty:function(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-(1/0),this},empty:function(){return this.max.xthis.max.x||e.ythis.max.y||e.zthis.max.z?!1:!0},containsBox:function(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z?!0:!1},getParameter:function(e,t){var r=t||new n.Vector3;return r.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))},isIntersectionBox:function(e){return e.max.xthis.max.x||e.max.ythis.max.y||e.max.zthis.max.z?!1:!0},clampPoint:function(e,t){var r=t||new n.Vector3;return r.copy(e).clamp(this.min,this.max)},distanceToPoint:function(){var e=new n.Vector3;return function(t){var r=e.copy(t).clamp(this.min,this.max);return r.sub(t).length()}}(),getBoundingSphere:function(){var e=new n.Vector3;return function(t){var r=t||new n.Sphere;return r.center=this.center(),r.radius=.5*this.size(e).length(),r}}(),intersect:function(e){return this.min.max(e.min),this.max.min(e.max),this},union:function(e){return this.min.min(e.min),this.max.max(e.max),this},applyMatrix4:function(){var e=[new n.Vector3,new n.Vector3,new n.Vector3,new n.Vector3,new n.Vector3,new n.Vector3,new n.Vector3,new n.Vector3];return function(t){return e[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),e[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),e[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),e[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),e[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),e[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),e[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),e[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.makeEmpty(),this.setFromPoints(e),this}}(),translate:function(e){return this.min.add(e),this.max.add(e),this},equals:function(e){return e.min.equals(this.min)&&e.max.equals(this.max)},clone:function(){return(new n.Box3).copy(this)}},n.Matrix3=function(){this.elements=new Float32Array([1,0,0,0,1,0,0,0,1]),arguments.length>0&&n.error("THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.")},n.Matrix3.prototype={constructor:n.Matrix3,set:function(e,t,r,i,n,o,a,s,h){var c=this.elements;return c[0]=e,c[3]=t,c[6]=r,c[1]=i,c[4]=n,c[7]=o,c[2]=a,c[5]=s,c[8]=h,this},identity:function(){return this.set(1,0,0,0,1,0,0,0,1),this},copy:function(e){var t=e.elements;return this.set(t[0],t[3],t[6],t[1],t[4],t[7],t[2],t[5],t[8]),this},multiplyVector3:function(e){return n.warn("THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead."),e.applyMatrix3(this)},multiplyVector3Array:function(e){return n.warn("THREE.Matrix3: .multiplyVector3Array() has been renamed. Use matrix.applyToVector3Array( array ) instead."),this.applyToVector3Array(e)},applyToVector3Array:function(){var e=new n.Vector3;return function(t,r,i){void 0===r&&(r=0),void 0===i&&(i=t.length);for(var n=0,o=r;i>n;n+=3,o+=3)e.x=t[o],e.y=t[o+1],e.z=t[o+2],e.applyMatrix3(this),t[o]=e.x,t[o+1]=e.y,t[o+2]=e.z;return t}}(),multiplyScalar:function(e){var t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this},determinant:function(){var e=this.elements,t=e[0],r=e[1],i=e[2],n=e[3],o=e[4],a=e[5],s=e[6],h=e[7],c=e[8];return t*o*c-t*a*h-r*n*c+r*a*s+i*n*h-i*o*s},getInverse:function(e,t){var r=e.elements,i=this.elements;i[0]=r[10]*r[5]-r[6]*r[9],i[1]=-r[10]*r[1]+r[2]*r[9],i[2]=r[6]*r[1]-r[2]*r[5],i[3]=-r[10]*r[4]+r[6]*r[8],i[4]=r[10]*r[0]-r[2]*r[8],i[5]=-r[6]*r[0]+r[2]*r[4],i[6]=r[9]*r[4]-r[5]*r[8],i[7]=-r[9]*r[0]+r[1]*r[8],i[8]=r[5]*r[0]-r[1]*r[4];var o=r[0]*i[0]+r[1]*i[3]+r[2]*i[6];if(0===o){var a="Matrix3.getInverse(): can't invert matrix, determinant is 0";if(t)throw new Error(a);return n.warn(a),this.identity(),this}return this.multiplyScalar(1/o),this},transpose:function(){var e,t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this},flattenToArrayOffset:function(e,t){var r=this.elements;return e[t]=r[0],e[t+1]=r[1],e[t+2]=r[2],e[t+3]=r[3],e[t+4]=r[4],e[t+5]=r[5],e[t+6]=r[6],e[t+7]=r[7],e[t+8]=r[8],e},getNormalMatrix:function(e){return this.getInverse(e).transpose(),this},transposeIntoArray:function(e){var t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this},fromArray:function(e){return this.elements.set(e),this},toArray:function(){var e=this.elements;return[e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8]]},clone:function(){return(new n.Matrix3).fromArray(this.elements)}},n.Matrix4=function(){this.elements=new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),arguments.length>0&&n.error("THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.")},n.Matrix4.prototype={constructor:n.Matrix4,set:function(e,t,r,i,n,o,a,s,h,c,l,u,f,p,d,m){var g=this.elements;return g[0]=e,g[4]=t,g[8]=r,g[12]=i,g[1]=n,g[5]=o,g[9]=a,g[13]=s,g[2]=h,g[6]=c,g[10]=l,g[14]=u,g[3]=f,g[7]=p,g[11]=d,g[15]=m,this},identity:function(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this},copy:function(e){return this.elements.set(e.elements),this},extractPosition:function(e){return n.warn("THREE.Matrix4: .extractPosition() has been renamed to .copyPosition()."),this.copyPosition(e)},copyPosition:function(e){var t=this.elements,r=e.elements;return t[12]=r[12],t[13]=r[13],t[14]=r[14],this},extractBasis:function(e,t,r){var i=this.elements;return e.set(i[0],i[1],i[2]),t.set(i[4],i[5],i[6]),r.set(i[8],i[9],i[10]),this},makeBasis:function(e,t,r){return this.set(e.x,t.x,r.x,0,e.y,t.y,r.y,0,e.z,t.z,r.z,0,0,0,0,1),this},extractRotation:function(){var e=new n.Vector3;return function(t){var r=this.elements,i=t.elements,n=1/e.set(i[0],i[1],i[2]).length(),o=1/e.set(i[4],i[5],i[6]).length(),a=1/e.set(i[8],i[9],i[10]).length();return r[0]=i[0]*n,r[1]=i[1]*n,r[2]=i[2]*n,r[4]=i[4]*o,r[5]=i[5]*o,r[6]=i[6]*o,r[8]=i[8]*a,r[9]=i[9]*a,r[10]=i[10]*a,this}}(),makeRotationFromEuler:function(e){e instanceof n.Euler==!1&&n.error("THREE.Matrix: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");var t=this.elements,r=e.x,i=e.y,o=e.z,a=Math.cos(r),s=Math.sin(r),h=Math.cos(i),c=Math.sin(i),l=Math.cos(o),u=Math.sin(o);if("XYZ"===e.order){var f=a*l,p=a*u,d=s*l,m=s*u;t[0]=h*l,t[4]=-h*u,t[8]=c,t[1]=p+d*c,t[5]=f-m*c,t[9]=-s*h,t[2]=m-f*c,t[6]=d+p*c,t[10]=a*h}else if("YXZ"===e.order){var g=h*l,v=h*u,y=c*l,x=c*u;t[0]=g+x*s,t[4]=y*s-v,t[8]=a*c,t[1]=a*u,t[5]=a*l,t[9]=-s,t[2]=v*s-y,t[6]=x+g*s,t[10]=a*h}else if("ZXY"===e.order){var g=h*l,v=h*u,y=c*l,x=c*u;t[0]=g-x*s,t[4]=-a*u,t[8]=y+v*s,t[1]=v+y*s,t[5]=a*l,t[9]=x-g*s,t[2]=-a*c,t[6]=s,t[10]=a*h}else if("ZYX"===e.order){var f=a*l,p=a*u,d=s*l,m=s*u;t[0]=h*l,t[4]=d*c-p,t[8]=f*c+m,t[1]=h*u,t[5]=m*c+f,t[9]=p*c-d,t[2]=-c,t[6]=s*h,t[10]=a*h}else if("YZX"===e.order){var b=a*h,w=a*c,A=s*h,M=s*c;t[0]=h*l,t[4]=M-b*u,t[8]=A*u+w,t[1]=u,t[5]=a*l,t[9]=-s*l,t[2]=-c*l,t[6]=w*u+A,t[10]=b-M*u}else if("XZY"===e.order){var b=a*h,w=a*c,A=s*h,M=s*c; -t[0]=h*l,t[4]=-u,t[8]=c*l,t[1]=b*u+M,t[5]=a*l,t[9]=w*u-A,t[2]=A*u-w,t[6]=s*l,t[10]=M*u+b}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this},setRotationFromQuaternion:function(e){return n.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion()."),this.makeRotationFromQuaternion(e)},makeRotationFromQuaternion:function(e){var t=this.elements,r=e.x,i=e.y,n=e.z,o=e.w,a=r+r,s=i+i,h=n+n,c=r*a,l=r*s,u=r*h,f=i*s,p=i*h,d=n*h,m=o*a,g=o*s,v=o*h;return t[0]=1-(f+d),t[4]=l-v,t[8]=u+g,t[1]=l+v,t[5]=1-(c+d),t[9]=p-m,t[2]=u-g,t[6]=p+m,t[10]=1-(c+f),t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this},lookAt:function(){var e=new n.Vector3,t=new n.Vector3,r=new n.Vector3;return function(i,n,o){var a=this.elements;return r.subVectors(i,n).normalize(),0===r.length()&&(r.z=1),e.crossVectors(o,r).normalize(),0===e.length()&&(r.x+=1e-4,e.crossVectors(o,r).normalize()),t.crossVectors(r,e),a[0]=e.x,a[4]=t.x,a[8]=r.x,a[1]=e.y,a[5]=t.y,a[9]=r.y,a[2]=e.z,a[6]=t.z,a[10]=r.z,this}}(),multiply:function(e,t){return void 0!==t?(n.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(e,t)):this.multiplyMatrices(this,e)},multiplyMatrices:function(e,t){var r=e.elements,i=t.elements,n=this.elements,o=r[0],a=r[4],s=r[8],h=r[12],c=r[1],l=r[5],u=r[9],f=r[13],p=r[2],d=r[6],m=r[10],g=r[14],v=r[3],y=r[7],x=r[11],b=r[15],w=i[0],A=i[4],M=i[8],_=i[12],S=i[1],E=i[5],T=i[9],C=i[13],L=i[2],P=i[6],R=i[10],F=i[14],B=i[3],D=i[7],U=i[11],V=i[15];return n[0]=o*w+a*S+s*L+h*B,n[4]=o*A+a*E+s*P+h*D,n[8]=o*M+a*T+s*R+h*U,n[12]=o*_+a*C+s*F+h*V,n[1]=c*w+l*S+u*L+f*B,n[5]=c*A+l*E+u*P+f*D,n[9]=c*M+l*T+u*R+f*U,n[13]=c*_+l*C+u*F+f*V,n[2]=p*w+d*S+m*L+g*B,n[6]=p*A+d*E+m*P+g*D,n[10]=p*M+d*T+m*R+g*U,n[14]=p*_+d*C+m*F+g*V,n[3]=v*w+y*S+x*L+b*B,n[7]=v*A+y*E+x*P+b*D,n[11]=v*M+y*T+x*R+b*U,n[15]=v*_+y*C+x*F+b*V,this},multiplyToArray:function(e,t,r){var i=this.elements;return this.multiplyMatrices(e,t),r[0]=i[0],r[1]=i[1],r[2]=i[2],r[3]=i[3],r[4]=i[4],r[5]=i[5],r[6]=i[6],r[7]=i[7],r[8]=i[8],r[9]=i[9],r[10]=i[10],r[11]=i[11],r[12]=i[12],r[13]=i[13],r[14]=i[14],r[15]=i[15],this},multiplyScalar:function(e){var t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this},multiplyVector3:function(e){return n.warn("THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) or vector.applyProjection( matrix ) instead."),e.applyProjection(this)},multiplyVector4:function(e){return n.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead."),e.applyMatrix4(this)},multiplyVector3Array:function(e){return n.warn("THREE.Matrix4: .multiplyVector3Array() has been renamed. Use matrix.applyToVector3Array( array ) instead."),this.applyToVector3Array(e)},applyToVector3Array:function(){var e=new n.Vector3;return function(t,r,i){void 0===r&&(r=0),void 0===i&&(i=t.length);for(var n=0,o=r;i>n;n+=3,o+=3)e.x=t[o],e.y=t[o+1],e.z=t[o+2],e.applyMatrix4(this),t[o]=e.x,t[o+1]=e.y,t[o+2]=e.z;return t}}(),rotateAxis:function(e){n.warn("THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead."),e.transformDirection(this)},crossVector:function(e){return n.warn("THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead."),e.applyMatrix4(this)},determinant:function(){var e=this.elements,t=e[0],r=e[4],i=e[8],n=e[12],o=e[1],a=e[5],s=e[9],h=e[13],c=e[2],l=e[6],u=e[10],f=e[14],p=e[3],d=e[7],m=e[11],g=e[15];return p*(+n*s*l-i*h*l-n*a*u+r*h*u+i*a*f-r*s*f)+d*(+t*s*f-t*h*u+n*o*u-i*o*f+i*h*c-n*s*c)+m*(+t*h*l-t*a*f-n*o*l+r*o*f+n*a*c-r*h*c)+g*(-i*a*c-t*s*l+t*a*u+i*o*l-r*o*u+r*s*c)},transpose:function(){var e,t=this.elements;return e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this},flattenToArrayOffset:function(e,t){var r=this.elements;return e[t]=r[0],e[t+1]=r[1],e[t+2]=r[2],e[t+3]=r[3],e[t+4]=r[4],e[t+5]=r[5],e[t+6]=r[6],e[t+7]=r[7],e[t+8]=r[8],e[t+9]=r[9],e[t+10]=r[10],e[t+11]=r[11],e[t+12]=r[12],e[t+13]=r[13],e[t+14]=r[14],e[t+15]=r[15],e},getPosition:function(){var e=new n.Vector3;return function(){n.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead.");var t=this.elements;return e.set(t[12],t[13],t[14])}}(),setPosition:function(e){var t=this.elements;return t[12]=e.x,t[13]=e.y,t[14]=e.z,this},getInverse:function(e,t){var r=this.elements,i=e.elements,o=i[0],a=i[4],s=i[8],h=i[12],c=i[1],l=i[5],u=i[9],f=i[13],p=i[2],d=i[6],m=i[10],g=i[14],v=i[3],y=i[7],x=i[11],b=i[15];r[0]=u*g*y-f*m*y+f*d*x-l*g*x-u*d*b+l*m*b,r[4]=h*m*y-s*g*y-h*d*x+a*g*x+s*d*b-a*m*b,r[8]=s*f*y-h*u*y+h*l*x-a*f*x-s*l*b+a*u*b,r[12]=h*u*d-s*f*d-h*l*m+a*f*m+s*l*g-a*u*g,r[1]=f*m*v-u*g*v-f*p*x+c*g*x+u*p*b-c*m*b,r[5]=s*g*v-h*m*v+h*p*x-o*g*x-s*p*b+o*m*b,r[9]=h*u*v-s*f*v-h*c*x+o*f*x+s*c*b-o*u*b,r[13]=s*f*p-h*u*p+h*c*m-o*f*m-s*c*g+o*u*g,r[2]=l*g*v-f*d*v+f*p*y-c*g*y-l*p*b+c*d*b,r[6]=h*d*v-a*g*v-h*p*y+o*g*y+a*p*b-o*d*b,r[10]=a*f*v-h*l*v+h*c*y-o*f*y-a*c*b+o*l*b,r[14]=h*l*p-a*f*p-h*c*d+o*f*d+a*c*g-o*l*g,r[3]=u*d*v-l*m*v-u*p*y+c*m*y+l*p*x-c*d*x,r[7]=a*m*v-s*d*v+s*p*y-o*m*y-a*p*x+o*d*x,r[11]=s*l*v-a*u*v-s*c*y+o*u*y+a*c*x-o*l*x,r[15]=a*u*p-s*l*p+s*c*d-o*u*d-a*c*m+o*l*m;var w=o*r[0]+c*r[4]+p*r[8]+v*r[12];if(0==w){var A="THREE.Matrix4.getInverse(): can't invert matrix, determinant is 0";if(t)throw new Error(A);return n.warn(A),this.identity(),this}return this.multiplyScalar(1/w),this},translate:function(e){n.error("THREE.Matrix4: .translate() has been removed.")},rotateX:function(e){n.error("THREE.Matrix4: .rotateX() has been removed.")},rotateY:function(e){n.error("THREE.Matrix4: .rotateY() has been removed.")},rotateZ:function(e){n.error("THREE.Matrix4: .rotateZ() has been removed.")},rotateByAxis:function(e,t){n.error("THREE.Matrix4: .rotateByAxis() has been removed.")},scale:function(e){var t=this.elements,r=e.x,i=e.y,n=e.z;return t[0]*=r,t[4]*=i,t[8]*=n,t[1]*=r,t[5]*=i,t[9]*=n,t[2]*=r,t[6]*=i,t[10]*=n,t[3]*=r,t[7]*=i,t[11]*=n,this},getMaxScaleOnAxis:function(){var e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],r=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],i=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,Math.max(r,i)))},makeTranslation:function(e,t,r){return this.set(1,0,0,e,0,1,0,t,0,0,1,r,0,0,0,1),this},makeRotationX:function(e){var t=Math.cos(e),r=Math.sin(e);return this.set(1,0,0,0,0,t,-r,0,0,r,t,0,0,0,0,1),this},makeRotationY:function(e){var t=Math.cos(e),r=Math.sin(e);return this.set(t,0,r,0,0,1,0,0,-r,0,t,0,0,0,0,1),this},makeRotationZ:function(e){var t=Math.cos(e),r=Math.sin(e);return this.set(t,-r,0,0,r,t,0,0,0,0,1,0,0,0,0,1),this},makeRotationAxis:function(e,t){var r=Math.cos(t),i=Math.sin(t),n=1-r,o=e.x,a=e.y,s=e.z,h=n*o,c=n*a;return this.set(h*o+r,h*a-i*s,h*s+i*a,0,h*a+i*s,c*a+r,c*s-i*o,0,h*s-i*a,c*s+i*o,n*s*s+r,0,0,0,0,1),this},makeScale:function(e,t,r){return this.set(e,0,0,0,0,t,0,0,0,0,r,0,0,0,0,1),this},compose:function(e,t,r){return this.makeRotationFromQuaternion(t),this.scale(r),this.setPosition(e),this},decompose:function(){var e=new n.Vector3,t=new n.Matrix4;return function(r,i,n){var o=this.elements,a=e.set(o[0],o[1],o[2]).length(),s=e.set(o[4],o[5],o[6]).length(),h=e.set(o[8],o[9],o[10]).length(),c=this.determinant();0>c&&(a=-a),r.x=o[12],r.y=o[13],r.z=o[14],t.elements.set(this.elements);var l=1/a,u=1/s,f=1/h;return t.elements[0]*=l,t.elements[1]*=l,t.elements[2]*=l,t.elements[4]*=u,t.elements[5]*=u,t.elements[6]*=u,t.elements[8]*=f,t.elements[9]*=f,t.elements[10]*=f,i.setFromRotationMatrix(t),n.x=a,n.y=s,n.z=h,this}}(),makeFrustum:function(e,t,r,i,n,o){var a=this.elements,s=2*n/(t-e),h=2*n/(i-r),c=(t+e)/(t-e),l=(i+r)/(i-r),u=-(o+n)/(o-n),f=-2*o*n/(o-n);return a[0]=s,a[4]=0,a[8]=c,a[12]=0,a[1]=0,a[5]=h,a[9]=l,a[13]=0,a[2]=0,a[6]=0,a[10]=u,a[14]=f,a[3]=0,a[7]=0,a[11]=-1,a[15]=0,this},makePerspective:function(e,t,r,i){var o=r*Math.tan(n.Math.degToRad(.5*e)),a=-o,s=a*t,h=o*t;return this.makeFrustum(s,h,a,o,r,i)},makeOrthographic:function(e,t,r,i,n,o){var a=this.elements,s=t-e,h=r-i,c=o-n,l=(t+e)/s,u=(r+i)/h,f=(o+n)/c;return a[0]=2/s,a[4]=0,a[8]=0,a[12]=-l,a[1]=0,a[5]=2/h,a[9]=0,a[13]=-u,a[2]=0,a[6]=0,a[10]=-2/c,a[14]=-f,a[3]=0,a[7]=0,a[11]=0,a[15]=1,this},fromArray:function(e){return this.elements.set(e),this},toArray:function(){var e=this.elements;return[e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15]]},clone:function(){return(new n.Matrix4).fromArray(this.elements)}},n.Ray=function(e,t){this.origin=void 0!==e?e:new n.Vector3,this.direction=void 0!==t?t:new n.Vector3},n.Ray.prototype={constructor:n.Ray,set:function(e,t){return this.origin.copy(e),this.direction.copy(t),this},copy:function(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this},at:function(e,t){var r=t||new n.Vector3;return r.copy(this.direction).multiplyScalar(e).add(this.origin)},recast:function(){var e=new n.Vector3;return function(t){return this.origin.copy(this.at(t,e)),this}}(),closestPointToPoint:function(e,t){var r=t||new n.Vector3;r.subVectors(e,this.origin);var i=r.dot(this.direction);return 0>i?r.copy(this.origin):r.copy(this.direction).multiplyScalar(i).add(this.origin)},distanceToPoint:function(){var e=new n.Vector3;return function(t){var r=e.subVectors(t,this.origin).dot(this.direction);return 0>r?this.origin.distanceTo(t):(e.copy(this.direction).multiplyScalar(r).add(this.origin),e.distanceTo(t))}}(),distanceSqToSegment:function(){var e=new n.Vector3,t=new n.Vector3,r=new n.Vector3;return function(i,n,o,a){e.copy(i).add(n).multiplyScalar(.5),t.copy(n).sub(i).normalize(),r.copy(this.origin).sub(e);var s,h,c,l,u=.5*i.distanceTo(n),f=-this.direction.dot(t),p=r.dot(this.direction),d=-r.dot(t),m=r.lengthSq(),g=Math.abs(1-f*f);if(g>0)if(s=f*d-p,h=f*p-d,l=u*g,s>=0)if(h>=-l)if(l>=h){var v=1/g;s*=v,h*=v,c=s*(s+f*h+2*p)+h*(f*s+h+2*d)+m}else h=u,s=Math.max(0,-(f*h+p)),c=-s*s+h*(h+2*d)+m;else h=-u,s=Math.max(0,-(f*h+p)),c=-s*s+h*(h+2*d)+m;else-l>=h?(s=Math.max(0,-(-f*u+p)),h=s>0?-u:Math.min(Math.max(-u,-d),u),c=-s*s+h*(h+2*d)+m):l>=h?(s=0,h=Math.min(Math.max(-u,-d),u),c=h*(h+2*d)+m):(s=Math.max(0,-(f*u+p)),h=s>0?u:Math.min(Math.max(-u,-d),u),c=-s*s+h*(h+2*d)+m);else h=f>0?-u:u,s=Math.max(0,-(f*h+p)),c=-s*s+h*(h+2*d)+m;return o&&o.copy(this.direction).multiplyScalar(s).add(this.origin),a&&a.copy(t).multiplyScalar(h).add(e),c}}(),isIntersectionSphere:function(e){return this.distanceToPoint(e.center)<=e.radius},intersectSphere:function(){var e=new n.Vector3;return function(t,r){e.subVectors(t.center,this.origin);var i=e.dot(this.direction),n=e.dot(e)-i*i,o=t.radius*t.radius;if(n>o)return null;var a=Math.sqrt(o-n),s=i-a,h=i+a;return 0>s&&0>h?null:0>s?this.at(h,r):this.at(s,r)}}(),isIntersectionPlane:function(e){var t=e.distanceToPoint(this.origin);if(0===t)return!0;var r=e.normal.dot(this.direction);return 0>r*t?!0:!1},distanceToPlane:function(e){var t=e.normal.dot(this.direction);if(0==t)return 0==e.distanceToPoint(this.origin)?0:null;var r=-(this.origin.dot(e.normal)+e.constant)/t;return r>=0?r:null},intersectPlane:function(e,t){var r=this.distanceToPlane(e);return null===r?null:this.at(r,t)},isIntersectionBox:function(){var e=new n.Vector3;return function(t){return null!==this.intersectBox(t,e)}}(),intersectBox:function(e,t){var r,i,n,o,a,s,h=1/this.direction.x,c=1/this.direction.y,l=1/this.direction.z,u=this.origin;return h>=0?(r=(e.min.x-u.x)*h,i=(e.max.x-u.x)*h):(r=(e.max.x-u.x)*h,i=(e.min.x-u.x)*h),c>=0?(n=(e.min.y-u.y)*c,o=(e.max.y-u.y)*c):(n=(e.max.y-u.y)*c,o=(e.min.y-u.y)*c),r>o||n>i?null:((n>r||r!==r)&&(r=n),(i>o||i!==i)&&(i=o),l>=0?(a=(e.min.z-u.z)*l,s=(e.max.z-u.z)*l):(a=(e.max.z-u.z)*l,s=(e.min.z-u.z)*l),r>s||a>i?null:((a>r||r!==r)&&(r=a),(i>s||i!==i)&&(i=s),0>i?null:this.at(r>=0?r:i,t)))},intersectTriangle:function(){var e=new n.Vector3,t=new n.Vector3,r=new n.Vector3,i=new n.Vector3;return function(n,o,a,s,h){t.subVectors(o,n),r.subVectors(a,n),i.crossVectors(t,r);var c,l=this.direction.dot(i);if(l>0){if(s)return null;c=1}else{if(!(0>l))return null;c=-1,l=-l}e.subVectors(this.origin,n);var u=c*this.direction.dot(r.crossVectors(e,r));if(0>u)return null;var f=c*this.direction.dot(t.cross(e));if(0>f)return null;if(u+f>l)return null;var p=-c*e.dot(i);return 0>p?null:this.at(p/l,h)}}(),applyMatrix4:function(e){return this.direction.add(this.origin).applyMatrix4(e),this.origin.applyMatrix4(e),this.direction.sub(this.origin),this.direction.normalize(),this},equals:function(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)},clone:function(){return(new n.Ray).copy(this)}},n.Sphere=function(e,t){this.center=void 0!==e?e:new n.Vector3,this.radius=void 0!==t?t:0},n.Sphere.prototype={constructor:n.Sphere,set:function(e,t){return this.center.copy(e),this.radius=t,this},setFromPoints:function(){var e=new n.Box3;return function(t,r){var i=this.center;void 0!==r?i.copy(r):e.setFromPoints(t).center(i);for(var n=0,o=0,a=t.length;a>o;o++)n=Math.max(n,i.distanceToSquared(t[o]));return this.radius=Math.sqrt(n),this}}(),copy:function(e){return this.center.copy(e.center),this.radius=e.radius,this},empty:function(){return this.radius<=0},containsPoint:function(e){return e.distanceToSquared(this.center)<=this.radius*this.radius},distanceToPoint:function(e){return e.distanceTo(this.center)-this.radius},intersectsSphere:function(e){var t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t},clampPoint:function(e,t){var r=this.center.distanceToSquared(e),i=t||new n.Vector3;return i.copy(e),r>this.radius*this.radius&&(i.sub(this.center).normalize(),i.multiplyScalar(this.radius).add(this.center)),i},getBoundingBox:function(e){var t=e||new n.Box3;return t.set(this.center,this.center),t.expandByScalar(this.radius),t},applyMatrix4:function(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this},translate:function(e){return this.center.add(e),this},equals:function(e){return e.center.equals(this.center)&&e.radius===this.radius},clone:function(){return(new n.Sphere).copy(this)}},n.Frustum=function(e,t,r,i,o,a){this.planes=[void 0!==e?e:new n.Plane,void 0!==t?t:new n.Plane,void 0!==r?r:new n.Plane,void 0!==i?i:new n.Plane,void 0!==o?o:new n.Plane,void 0!==a?a:new n.Plane]},n.Frustum.prototype={constructor:n.Frustum,set:function(e,t,r,i,n,o){var a=this.planes;return a[0].copy(e),a[1].copy(t),a[2].copy(r),a[3].copy(i),a[4].copy(n),a[5].copy(o),this},copy:function(e){for(var t=this.planes,r=0;6>r;r++)t[r].copy(e.planes[r]);return this},setFromMatrix:function(e){var t=this.planes,r=e.elements,i=r[0],n=r[1],o=r[2],a=r[3],s=r[4],h=r[5],c=r[6],l=r[7],u=r[8],f=r[9],p=r[10],d=r[11],m=r[12],g=r[13],v=r[14],y=r[15];return t[0].setComponents(a-i,l-s,d-u,y-m).normalize(),t[1].setComponents(a+i,l+s,d+u,y+m).normalize(),t[2].setComponents(a+n,l+h,d+f,y+g).normalize(),t[3].setComponents(a-n,l-h,d-f,y-g).normalize(),t[4].setComponents(a-o,l-c,d-p,y-v).normalize(),t[5].setComponents(a+o,l+c,d+p,y+v).normalize(),this},intersectsObject:function(){var e=new n.Sphere;return function(t){var r=t.geometry;return null===r.boundingSphere&&r.computeBoundingSphere(),e.copy(r.boundingSphere),e.applyMatrix4(t.matrixWorld),this.intersectsSphere(e)}}(),intersectsSphere:function(e){for(var t=this.planes,r=e.center,i=-e.radius,n=0;6>n;n++){var o=t[n].distanceToPoint(r);if(i>o)return!1}return!0},intersectsBox:function(){var e=new n.Vector3,t=new n.Vector3;return function(r){for(var i=this.planes,n=0;6>n;n++){var o=i[n];e.x=o.normal.x>0?r.min.x:r.max.x,t.x=o.normal.x>0?r.max.x:r.min.x,e.y=o.normal.y>0?r.min.y:r.max.y,t.y=o.normal.y>0?r.max.y:r.min.y,e.z=o.normal.z>0?r.min.z:r.max.z,t.z=o.normal.z>0?r.max.z:r.min.z;var a=o.distanceToPoint(e),s=o.distanceToPoint(t);if(0>a&&0>s)return!1}return!0}}(),containsPoint:function(e){for(var t=this.planes,r=0;6>r;r++)if(t[r].distanceToPoint(e)<0)return!1;return!0},clone:function(){return(new n.Frustum).copy(this)}},n.Plane=function(e,t){this.normal=void 0!==e?e:new n.Vector3(1,0,0),this.constant=void 0!==t?t:0},n.Plane.prototype={constructor:n.Plane,set:function(e,t){return this.normal.copy(e),this.constant=t,this},setComponents:function(e,t,r,i){return this.normal.set(e,t,r),this.constant=i,this},setFromNormalAndCoplanarPoint:function(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this},setFromCoplanarPoints:function(){var e=new n.Vector3,t=new n.Vector3;return function(r,i,n){var o=e.subVectors(n,i).cross(t.subVectors(r,i)).normalize();return this.setFromNormalAndCoplanarPoint(o,r),this}}(),copy:function(e){return this.normal.copy(e.normal),this.constant=e.constant,this},normalize:function(){var e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this},negate:function(){return this.constant*=-1,this.normal.negate(),this},distanceToPoint:function(e){return this.normal.dot(e)+this.constant},distanceToSphere:function(e){return this.distanceToPoint(e.center)-e.radius},projectPoint:function(e,t){return this.orthoPoint(e,t).sub(e).negate()},orthoPoint:function(e,t){var r=this.distanceToPoint(e),i=t||new n.Vector3;return i.copy(this.normal).multiplyScalar(r)},isIntersectionLine:function(e){var t=this.distanceToPoint(e.start),r=this.distanceToPoint(e.end);return 0>t&&r>0||0>r&&t>0},intersectLine:function(){var e=new n.Vector3;return function(t,r){var i=r||new n.Vector3,o=t.delta(e),a=this.normal.dot(o);if(0==a)return 0==this.distanceToPoint(t.start)?i.copy(t.start):void 0;var s=-(t.start.dot(this.normal)+this.constant)/a;return 0>s||s>1?void 0:i.copy(o).multiplyScalar(s).add(t.start)}}(),coplanarPoint:function(e){var t=e||new n.Vector3;return t.copy(this.normal).multiplyScalar(-this.constant)},applyMatrix4:function(){var e=new n.Vector3,t=new n.Vector3,r=new n.Matrix3;return function(i,n){var o=n||r.getNormalMatrix(i),a=e.copy(this.normal).applyMatrix3(o),s=this.coplanarPoint(t);return s.applyMatrix4(i),this.setFromNormalAndCoplanarPoint(a,s),this}}(),translate:function(e){return this.constant=this.constant-e.dot(this.normal),this},equals:function(e){return e.normal.equals(this.normal)&&e.constant==this.constant},clone:function(){return(new n.Plane).copy(this)}},n.Math={generateUUID:function(){var e,t="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),r=new Array(36),i=0;return function(){for(var n=0;36>n;n++)8==n||13==n||18==n||23==n?r[n]="-":14==n?r[n]="4":(2>=i&&(i=33554432+16777216*Math.random()|0),e=15&i,i>>=4,r[n]=t[19==n?3&e|8:e]);return r.join("")}}(),clamp:function(e,t,r){return t>e?t:e>r?r:e},clampBottom:function(e,t){return t>e?t:e},mapLinear:function(e,t,r,i,n){return i+(e-t)*(n-i)/(r-t)},smoothstep:function(e,t,r){return t>=e?0:e>=r?1:(e=(e-t)/(r-t),e*e*(3-2*e))},smootherstep:function(e,t,r){return t>=e?0:e>=r?1:(e=(e-t)/(r-t),e*e*e*(e*(6*e-15)+10))},random16:function(){return(65280*Math.random()+255*Math.random())/65535},randInt:function(e,t){return Math.floor(this.randFloat(e,t))},randFloat:function(e,t){return e+Math.random()*(t-e)},randFloatSpread:function(e){return e*(.5-Math.random())},degToRad:function(){var e=Math.PI/180;return function(t){return t*e}}(),radToDeg:function(){var e=180/Math.PI;return function(t){return t*e}}(),isPowerOfTwo:function(e){return 0===(e&e-1)&&0!==e},nextPowerOfTwo:function(e){return e--,e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,e++,e}},n.Spline=function(e){function t(e,t,r,i,n,o,a){var s=.5*(r-e),h=.5*(i-t);return(2*(t-r)+s+h)*a+(-3*(t-r)-2*s-h)*o+s*n+t}this.points=e;var r,i,o,a,s,h,c,l,u,f=[],p={x:0,y:0,z:0};this.initFromArray=function(e){this.points=[];for(var t=0;tthis.points.length-2?this.points.length-1:i+1,f[3]=i>this.points.length-3?this.points.length-1:i+2,h=this.points[f[0]],c=this.points[f[1]],l=this.points[f[2]],u=this.points[f[3]],a=o*o,s=o*a,p.x=t(h.x,c.x,l.x,u.x,o,a,s),p.y=t(h.y,c.y,l.y,u.y,o,a,s),p.z=t(h.z,c.z,l.z,u.z,o,a,s),p},this.getControlPointsArray=function(){var e,t,r=this.points.length,i=[];for(e=0;r>e;e++)t=this.points[e],i[e]=[t.x,t.y,t.z];return i},this.getLength=function(e){var t,r,i,o,a=0,s=0,h=0,c=new n.Vector3,l=new n.Vector3,u=[],f=0;for(u[0]=0,e||(e=100),i=this.points.length*e,c.copy(this.points[0]),t=1;i>t;t++)r=t/i,o=this.getPoint(r),l.copy(o),f+=l.distanceTo(c),c.copy(o),a=(this.points.length-1)*r,s=Math.floor(a),s!=h&&(u[s]=f,h=s);return u[u.length]=f,{chunks:u,total:f}},this.reparametrizeByArcLength=function(e){var t,r,i,o,a,s,h,c,l=[],u=new n.Vector3,f=this.getLength();for(l.push(u.copy(this.points[0]).clone()),t=1;tr;r++)i=o+r*(1/h)*(a-o),c=this.getPoint(i),l.push(u.copy(c).clone());l.push(u.copy(this.points[t]).clone())}this.points=l}},n.Triangle=function(e,t,r){this.a=void 0!==e?e:new n.Vector3,this.b=void 0!==t?t:new n.Vector3,this.c=void 0!==r?r:new n.Vector3},n.Triangle.normal=function(){var e=new n.Vector3;return function(t,r,i,o){var a=o||new n.Vector3;a.subVectors(i,r),e.subVectors(t,r),a.cross(e);var s=a.lengthSq();return s>0?a.multiplyScalar(1/Math.sqrt(s)):a.set(0,0,0)}}(),n.Triangle.barycoordFromPoint=function(){var e=new n.Vector3,t=new n.Vector3,r=new n.Vector3;return function(i,o,a,s,h){e.subVectors(s,o),t.subVectors(a,o),r.subVectors(i,o);var c=e.dot(e),l=e.dot(t),u=e.dot(r),f=t.dot(t),p=t.dot(r),d=c*f-l*l,m=h||new n.Vector3;if(0==d)return m.set(-2,-1,-1);var g=1/d,v=(f*u-l*p)*g,y=(c*p-l*u)*g;return m.set(1-v-y,y,v)}}(),n.Triangle.containsPoint=function(){var e=new n.Vector3;return function(t,r,i,o){var a=n.Triangle.barycoordFromPoint(t,r,i,o,e);return a.x>=0&&a.y>=0&&a.x+a.y<=1}}(),n.Triangle.prototype={constructor:n.Triangle,set:function(e,t,r){return this.a.copy(e),this.b.copy(t),this.c.copy(r),this},setFromPointsAndIndices:function(e,t,r,i){return this.a.copy(e[t]),this.b.copy(e[r]),this.c.copy(e[i]),this},copy:function(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this},area:function(){var e=new n.Vector3,t=new n.Vector3;return function(){return e.subVectors(this.c,this.b),t.subVectors(this.a,this.b),.5*e.cross(t).length()}}(),midpoint:function(e){var t=e||new n.Vector3;return t.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)},normal:function(e){return n.Triangle.normal(this.a,this.b,this.c,e)},plane:function(e){var t=e||new n.Plane;return t.setFromCoplanarPoints(this.a,this.b,this.c)},barycoordFromPoint:function(e,t){return n.Triangle.barycoordFromPoint(e,this.a,this.b,this.c,t)},containsPoint:function(e){return n.Triangle.containsPoint(e,this.a,this.b,this.c)},equals:function(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)},clone:function(){return(new n.Triangle).copy(this)}},n.Clock=function(e){this.autoStart=void 0!==e?e:!0,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1},n.Clock.prototype={constructor:n.Clock,start:function(){this.startTime=void 0!==i.performance&&void 0!==i.performance.now?i.performance.now():Date.now(),this.oldTime=this.startTime,this.running=!0},stop:function(){this.getElapsedTime(),this.running=!1},getElapsedTime:function(){return this.getDelta(),this.elapsedTime},getDelta:function(){var e=0;if(this.autoStart&&!this.running&&this.start(),this.running){var t=void 0!==i.performance&&void 0!==i.performance.now?i.performance.now():Date.now();e=.001*(t-this.oldTime),this.oldTime=t,this.elapsedTime+=e}return e}},n.EventDispatcher=function(){},n.EventDispatcher.prototype={constructor:n.EventDispatcher,apply:function(e){e.addEventListener=n.EventDispatcher.prototype.addEventListener,e.hasEventListener=n.EventDispatcher.prototype.hasEventListener,e.removeEventListener=n.EventDispatcher.prototype.removeEventListener,e.dispatchEvent=n.EventDispatcher.prototype.dispatchEvent},addEventListener:function(e,t){void 0===this._listeners&&(this._listeners={});var r=this._listeners;void 0===r[e]&&(r[e]=[]),-1===r[e].indexOf(t)&&r[e].push(t)},hasEventListener:function(e,t){if(void 0===this._listeners)return!1;var r=this._listeners;return void 0!==r[e]&&-1!==r[e].indexOf(t)?!0:!1},removeEventListener:function(e,t){if(void 0!==this._listeners){var r=this._listeners,i=r[e];if(void 0!==i){var n=i.indexOf(t);-1!==n&&i.splice(n,1)}}},dispatchEvent:function(e){if(void 0!==this._listeners){var t=this._listeners,r=t[e.type];if(void 0!==r){e.target=this;for(var i=[],n=r.length,o=0;n>o;o++)i[o]=r[o];for(var o=0;n>o;o++)i[o].call(this,e)}}}},function(e){e.Raycaster=function(t,r,i,n){this.ray=new e.Ray(t,r),this.near=i||0,this.far=n||1/0,this.params={Sprite:{},Mesh:{},PointCloud:{threshold:1},LOD:{},Line:{}}};var t=function(e,t){return e.distance-t.distance},r=function(e,t,i,n){if(e.raycast(t,i),n===!0)for(var o=e.children,a=0,s=o.length;s>a;a++)r(o[a],t,i,!0)};e.Raycaster.prototype={constructor:e.Raycaster,precision:1e-4,linePrecision:1,set:function(e,t){this.ray.set(e,t)},setFromCamera:function(t,r){r instanceof e.PerspectiveCamera?(this.ray.origin.copy(r.position),this.ray.direction.set(t.x,t.y,.5).unproject(r).sub(r.position).normalize()):r instanceof e.OrthographicCamera?(this.ray.origin.set(t.x,t.y,-1).unproject(r),this.ray.direction.set(0,0,-1).transformDirection(r.matrixWorld)):e.error("THREE.Raycaster: Unsupported camera type.")},intersectObject:function(e,i){var n=[];return r(e,this,n,i),n.sort(t),n},intersectObjects:function(i,n){var o=[];if(i instanceof Array==!1)return e.warn("THREE.Raycaster.intersectObjects: objects is not an Array."),o;for(var a=0,s=i.length;s>a;a++)r(i[a],this,o,n);return o.sort(t),o}}}(n),n.Object3D=function(){Object.defineProperty(this,"id",{value:n.Object3DIdCount++}),this.uuid=n.Math.generateUUID(),this.name="",this.type="Object3D",this.parent=void 0,this.children=[],this.up=n.Object3D.DefaultUp.clone();var e=new n.Vector3,t=new n.Euler,r=new n.Quaternion,i=new n.Vector3(1,1,1),o=function(){r.setFromEuler(t,!1)},a=function(){t.setFromQuaternion(r,void 0,!1)};t.onChange(o),r.onChange(a),Object.defineProperties(this,{position:{enumerable:!0,value:e},rotation:{enumerable:!0,value:t},quaternion:{enumerable:!0,value:r},scale:{enumerable:!0,value:i}}),this.rotationAutoUpdate=!0,this.matrix=new n.Matrix4,this.matrixWorld=new n.Matrix4,this.matrixAutoUpdate=!0,this.matrixWorldNeedsUpdate=!1,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.userData={}},n.Object3D.DefaultUp=new n.Vector3(0,1,0),n.Object3D.prototype={constructor:n.Object3D,get eulerOrder(){return n.warn("THREE.Object3D: .eulerOrder has been moved to .rotation.order."),this.rotation.order},set eulerOrder(e){n.warn("THREE.Object3D: .eulerOrder has been moved to .rotation.order."),this.rotation.order=e},get useQuaternion(){n.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")},set useQuaternion(e){n.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")},applyMatrix:function(e){this.matrix.multiplyMatrices(e,this.matrix),this.matrix.decompose(this.position,this.quaternion,this.scale)},setRotationFromAxisAngle:function(e,t){this.quaternion.setFromAxisAngle(e,t)},setRotationFromEuler:function(e){this.quaternion.setFromEuler(e,!0)},setRotationFromMatrix:function(e){this.quaternion.setFromRotationMatrix(e)},setRotationFromQuaternion:function(e){this.quaternion.copy(e)},rotateOnAxis:function(){var e=new n.Quaternion;return function(t,r){return e.setFromAxisAngle(t,r),this.quaternion.multiply(e),this}}(),rotateX:function(){var e=new n.Vector3(1,0,0);return function(t){return this.rotateOnAxis(e,t)}}(),rotateY:function(){var e=new n.Vector3(0,1,0);return function(t){return this.rotateOnAxis(e,t)}}(),rotateZ:function(){var e=new n.Vector3(0,0,1);return function(t){return this.rotateOnAxis(e,t)}}(),translateOnAxis:function(){var e=new n.Vector3;return function(t,r){return e.copy(t).applyQuaternion(this.quaternion),this.position.add(e.multiplyScalar(r)),this}}(),translate:function(e,t){return n.warn("THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead."),this.translateOnAxis(t,e)},translateX:function(){var e=new n.Vector3(1,0,0);return function(t){return this.translateOnAxis(e,t)}}(),translateY:function(){var e=new n.Vector3(0,1,0);return function(t){return this.translateOnAxis(e,t)}}(),translateZ:function(){var e=new n.Vector3(0,0,1);return function(t){return this.translateOnAxis(e,t)}}(),localToWorld:function(e){return e.applyMatrix4(this.matrixWorld)},worldToLocal:function(){var e=new n.Matrix4;return function(t){return t.applyMatrix4(e.getInverse(this.matrixWorld))}}(),lookAt:function(){var e=new n.Matrix4;return function(t){e.lookAt(t,this.position,this.up),this.quaternion.setFromRotationMatrix(e)}}(),add:function(e){if(arguments.length>1){for(var t=0;t1)for(var t=0;tr;r++){var n=this.children[r],o=n.getObjectByProperty(e,t);if(void 0!==o)return o}return void 0},getWorldPosition:function(e){var t=e||new n.Vector3;return this.updateMatrixWorld(!0),t.setFromMatrixPosition(this.matrixWorld)},getWorldQuaternion:function(){var e=new n.Vector3,t=new n.Vector3;return function(r){var i=r||new n.Quaternion;return this.updateMatrixWorld(!0),this.matrixWorld.decompose(e,i,t),i}}(),getWorldRotation:function(){var e=new n.Quaternion;return function(t){var r=t||new n.Euler;return this.getWorldQuaternion(e),r.setFromQuaternion(e,this.rotation.order,!1)}}(),getWorldScale:function(){var e=new n.Vector3,t=new n.Quaternion;return function(r){var i=r||new n.Vector3;return this.updateMatrixWorld(!0),this.matrixWorld.decompose(e,t,i),i}}(),getWorldDirection:function(){var e=new n.Quaternion;return function(t){var r=t||new n.Vector3;return this.getWorldQuaternion(e),r.set(0,0,1).applyQuaternion(e)}}(),raycast:function(){},traverse:function(e){e(this);for(var t=0,r=this.children.length;r>t;t++)this.children[t].traverse(e)},traverseVisible:function(e){if(this.visible!==!1){e(this);for(var t=0,r=this.children.length;r>t;t++)this.children[t].traverseVisible(e)}},traverseAncestors:function(e){this.parent&&(e(this.parent),this.parent.traverseAncestors(e))},updateMatrix:function(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0},updateMatrixWorld:function(e){this.matrixAutoUpdate===!0&&this.updateMatrix(),(this.matrixWorldNeedsUpdate===!0||e===!0)&&(void 0===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,e=!0);for(var t=0,r=this.children.length;r>t;t++)this.children[t].updateMatrixWorld(e)},toJSON:function(){var e={metadata:{version:4.3,type:"Object",generator:"ObjectExporter"}},t={},r=function(r){if(void 0===e.geometries&&(e.geometries=[]),void 0===t[r.uuid]){ -var i=r.toJSON();delete i.metadata,t[r.uuid]=i,e.geometries.push(i)}return r.uuid},i={},o=function(t){if(void 0===e.materials&&(e.materials=[]),void 0===i[t.uuid]){var r=t.toJSON();delete r.metadata,i[t.uuid]=r,e.materials.push(r)}return t.uuid},a=function(e){var t={};if(t.uuid=e.uuid,t.type=e.type,""!==e.name&&(t.name=e.name),"{}"!==JSON.stringify(e.userData)&&(t.userData=e.userData),e.visible!==!0&&(t.visible=e.visible),e instanceof n.PerspectiveCamera?(t.fov=e.fov,t.aspect=e.aspect,t.near=e.near,t.far=e.far):e instanceof n.OrthographicCamera?(t.left=e.left,t.right=e.right,t.top=e.top,t.bottom=e.bottom,t.near=e.near,t.far=e.far):e instanceof n.AmbientLight?t.color=e.color.getHex():e instanceof n.DirectionalLight?(t.color=e.color.getHex(),t.intensity=e.intensity):e instanceof n.PointLight?(t.color=e.color.getHex(),t.intensity=e.intensity,t.distance=e.distance,t.decay=e.decay):e instanceof n.SpotLight?(t.color=e.color.getHex(),t.intensity=e.intensity,t.distance=e.distance,t.angle=e.angle,t.exponent=e.exponent,t.decay=e.decay):e instanceof n.HemisphereLight?(t.color=e.color.getHex(),t.groundColor=e.groundColor.getHex()):e instanceof n.Mesh||e instanceof n.Line||e instanceof n.PointCloud?(t.geometry=r(e.geometry),t.material=o(e.material),e instanceof n.Line&&(t.mode=e.mode)):e instanceof n.Sprite&&(t.material=o(e.material)),t.matrix=e.matrix.toArray(),e.children.length>0){t.children=[];for(var i=0;it;t++)e.vertexNormals[t]=this.vertexNormals[t].clone();for(var t=0,r=this.vertexColors.length;r>t;t++)e.vertexColors[t]=this.vertexColors[t].clone();for(var t=0,r=this.vertexTangents.length;r>t;t++)e.vertexTangents[t]=this.vertexTangents[t].clone();return e}},n.Face4=function(e,t,r,i,o,a,s){return n.warn("THREE.Face4 has been removed. A THREE.Face3 will be created instead."),new n.Face3(e,t,r,o,a,s)},n.BufferAttribute=function(e,t){this.array=e,this.itemSize=t,this.needsUpdate=!1},n.BufferAttribute.prototype={constructor:n.BufferAttribute,get length(){return this.array.length},copyAt:function(e,t,r){e*=this.itemSize,r*=t.itemSize;for(var i=0,n=this.itemSize;n>i;i++)this.array[e+i]=t.array[r+i];return this},set:function(e,t){return void 0===t&&(t=0),this.array.set(e,t),this},setX:function(e,t){return this.array[e*this.itemSize]=t,this},setY:function(e,t){return this.array[e*this.itemSize+1]=t,this},setZ:function(e,t){return this.array[e*this.itemSize+2]=t,this},setXY:function(e,t,r){return e*=this.itemSize,this.array[e]=t,this.array[e+1]=r,this},setXYZ:function(e,t,r,i){return e*=this.itemSize,this.array[e]=t,this.array[e+1]=r,this.array[e+2]=i,this},setXYZW:function(e,t,r,i,n){return e*=this.itemSize,this.array[e]=t,this.array[e+1]=r,this.array[e+2]=i,this.array[e+3]=n,this},clone:function(){return new n.BufferAttribute(new this.array.constructor(this.array),this.itemSize)}},n.Int8Attribute=function(e,t){return n.warn("THREE.Int8Attribute has been removed. Use THREE.BufferAttribute( array, itemSize ) instead."),new n.BufferAttribute(e,t)},n.Uint8Attribute=function(e,t){return n.warn("THREE.Uint8Attribute has been removed. Use THREE.BufferAttribute( array, itemSize ) instead."),new n.BufferAttribute(e,t)},n.Uint8ClampedAttribute=function(e,t){return n.warn("THREE.Uint8ClampedAttribute has been removed. Use THREE.BufferAttribute( array, itemSize ) instead."),new n.BufferAttribute(e,t)},n.Int16Attribute=function(e,t){return n.warn("THREE.Int16Attribute has been removed. Use THREE.BufferAttribute( array, itemSize ) instead."),new n.BufferAttribute(e,t)},n.Uint16Attribute=function(e,t){return n.warn("THREE.Uint16Attribute has been removed. Use THREE.BufferAttribute( array, itemSize ) instead."),new n.BufferAttribute(e,t)},n.Int32Attribute=function(e,t){return n.warn("THREE.Int32Attribute has been removed. Use THREE.BufferAttribute( array, itemSize ) instead."),new n.BufferAttribute(e,t)},n.Uint32Attribute=function(e,t){return n.warn("THREE.Uint32Attribute has been removed. Use THREE.BufferAttribute( array, itemSize ) instead."),new n.BufferAttribute(e,t)},n.Float32Attribute=function(e,t){return n.warn("THREE.Float32Attribute has been removed. Use THREE.BufferAttribute( array, itemSize ) instead."),new n.BufferAttribute(e,t)},n.Float64Attribute=function(e,t){return n.warn("THREE.Float64Attribute has been removed. Use THREE.BufferAttribute( array, itemSize ) instead."),new n.BufferAttribute(e,t)},n.DynamicBufferAttribute=function(e,t){n.BufferAttribute.call(this,e,t),this.updateRange={offset:0,count:-1}},n.DynamicBufferAttribute.prototype=Object.create(n.BufferAttribute.prototype),n.DynamicBufferAttribute.prototype.constructor=n.DynamicBufferAttribute,n.DynamicBufferAttribute.prototype.clone=function(){return new n.DynamicBufferAttribute(new this.array.constructor(this.array),this.itemSize)},n.BufferGeometry=function(){Object.defineProperty(this,"id",{value:n.GeometryIdCount++}),this.uuid=n.Math.generateUUID(),this.name="",this.type="BufferGeometry",this.attributes={},this.attributesKeys=[],this.drawcalls=[],this.offsets=this.drawcalls,this.boundingBox=null,this.boundingSphere=null},n.BufferGeometry.prototype={constructor:n.BufferGeometry,addAttribute:function(e,t){return t instanceof n.BufferAttribute==!1?(n.warn("THREE.BufferGeometry: .addAttribute() now expects ( name, attribute )."),void(this.attributes[e]={array:arguments[1],itemSize:arguments[2]})):(this.attributes[e]=t,void(this.attributesKeys=Object.keys(this.attributes)))},getAttribute:function(e){return this.attributes[e]},addDrawCall:function(e,t,r){this.drawcalls.push({start:e,count:t,index:void 0!==r?r:0})},applyMatrix:function(e){var t=this.attributes.position;void 0!==t&&(e.applyToVector3Array(t.array),t.needsUpdate=!0);var r=this.attributes.normal;if(void 0!==r){var i=(new n.Matrix3).getNormalMatrix(e);i.applyToVector3Array(r.array),r.needsUpdate=!0}null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere()},center:function(){this.computeBoundingBox();var e=this.boundingBox.center().negate();return this.applyMatrix((new n.Matrix4).setPosition(e)),e},fromGeometry:function(e,t){t=t||{vertexColors:n.NoColors};var r=e.vertices,i=e.faces,o=e.faceVertexUvs,a=t.vertexColors,s=o[0].length>0,h=3==i[0].vertexNormals.length,c=new Float32Array(3*i.length*3);this.addAttribute("position",new n.BufferAttribute(c,3));var l=new Float32Array(3*i.length*3);if(this.addAttribute("normal",new n.BufferAttribute(l,3)),a!==n.NoColors){var u=new Float32Array(3*i.length*3);this.addAttribute("color",new n.BufferAttribute(u,3))}if(s===!0){var f=new Float32Array(3*i.length*2);this.addAttribute("uv",new n.BufferAttribute(f,2))}for(var p=0,d=0,m=0;pi;i+=3)e.set(t[i],t[i+1],t[i+2]),r.expandByPoint(e)}(void 0===t||0===t.length)&&(this.boundingBox.min.set(0,0,0),this.boundingBox.max.set(0,0,0)),(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&n.error('THREE.BufferGeometry.computeBoundingBox: Computed min/max have NaN values. The "position" attribute is likely to have NaN values.')}}(),computeBoundingSphere:function(){var e=new n.Box3,t=new n.Vector3;return function(){null===this.boundingSphere&&(this.boundingSphere=new n.Sphere);var r=this.attributes.position.array;if(r){e.makeEmpty();for(var i=this.boundingSphere.center,o=0,a=r.length;a>o;o+=3)t.set(r[o],r[o+1],r[o+2]),e.expandByPoint(t);e.center(i);for(var s=0,o=0,a=r.length;a>o;o+=3)t.set(r[o],r[o+1],r[o+2]),s=Math.max(s,i.distanceToSquared(t));this.boundingSphere.radius=Math.sqrt(s),isNaN(this.boundingSphere.radius)&&n.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.')}}}(),computeFaceNormals:function(){},computeVertexNormals:function(){var e=this.attributes;if(e.position){var t=e.position.array;if(void 0===e.normal)this.addAttribute("normal",new n.BufferAttribute(new Float32Array(t.length),3));else for(var r=e.normal.array,i=0,o=r.length;o>i;i++)r[i]=0;var a,s,h,r=e.normal.array,c=new n.Vector3,l=new n.Vector3,u=new n.Vector3,f=new n.Vector3,p=new n.Vector3;if(e.index)for(var d=e.index.array,m=this.offsets.length>0?this.offsets:[{start:0,count:d.length,index:0}],g=0,v=m.length;v>g;++g)for(var y=m[g].start,x=m[g].count,b=m[g].index,i=y,o=y+x;o>i;i+=3)a=3*(b+d[i]),s=3*(b+d[i+1]),h=3*(b+d[i+2]),c.fromArray(t,a),l.fromArray(t,s),u.fromArray(t,h),f.subVectors(u,l),p.subVectors(c,l),f.cross(p),r[a]+=f.x,r[a+1]+=f.y,r[a+2]+=f.z,r[s]+=f.x,r[s+1]+=f.y,r[s+2]+=f.z,r[h]+=f.x,r[h+1]+=f.y,r[h+2]+=f.z;else for(var i=0,o=t.length;o>i;i+=9)c.fromArray(t,i),l.fromArray(t,i+3),u.fromArray(t,i+6),f.subVectors(u,l),p.subVectors(c,l),f.cross(p),r[i]=f.x,r[i+1]=f.y,r[i+2]=f.z,r[i+3]=f.x,r[i+4]=f.y,r[i+5]=f.z,r[i+6]=f.x,r[i+7]=f.y,r[i+8]=f.z;this.normalizeNormals(),e.normal.needsUpdate=!0}},computeTangents:function(){function e(e,t,r){P.fromArray(i,3*e),R.fromArray(i,3*t),F.fromArray(i,3*r),B.fromArray(a,2*e),D.fromArray(a,2*t),U.fromArray(a,2*r),f=R.x-P.x,p=F.x-P.x,d=R.y-P.y,m=F.y-P.y,g=R.z-P.z,v=F.z-P.z,y=D.x-B.x,x=U.x-B.x,b=D.y-B.y,w=U.y-B.y,A=1/(y*w-x*b),V.set((w*f-b*p)*A,(w*d-b*m)*A,(w*g-b*v)*A),O.set((y*p-x*f)*A,(y*m-x*d)*A,(y*v-x*g)*A),c[e].add(V),c[t].add(V),c[r].add(V),l[e].add(O),l[t].add(O),l[r].add(O)}function t(e){q.fromArray(o,3*e),Y.copy(q),H=c[e],W.copy(H),W.sub(q.multiplyScalar(q.dot(H))).normalize(),X.crossVectors(Y,H),j=X.dot(l[e]),I=0>j?-1:1,h[4*e]=W.x,h[4*e+1]=W.y,h[4*e+2]=W.z,h[4*e+3]=I}if(void 0===this.attributes.index||void 0===this.attributes.position||void 0===this.attributes.normal||void 0===this.attributes.uv)return void n.warn("THREE.BufferGeometry: Missing required attributes (index, position, normal or uv) in BufferGeometry.computeTangents()");var r=this.attributes.index.array,i=this.attributes.position.array,o=this.attributes.normal.array,a=this.attributes.uv.array,s=i.length/3;void 0===this.attributes.tangent&&this.addAttribute("tangent",new n.BufferAttribute(new Float32Array(4*s),4));for(var h=this.attributes.tangent.array,c=[],l=[],u=0;s>u;u++)c[u]=new n.Vector3,l[u]=new n.Vector3;var f,p,d,m,g,v,y,x,b,w,A,M,_,S,E,T,C,L,P=new n.Vector3,R=new n.Vector3,F=new n.Vector3,B=new n.Vector2,D=new n.Vector2,U=new n.Vector2,V=new n.Vector3,O=new n.Vector3;0===this.drawcalls.length&&this.addDrawCall(0,r.length,0);var z=this.drawcalls;for(S=0,E=z.length;E>S;++S){var k=z[S].start,N=z[S].count,G=z[S].index;for(M=k,_=k+N;_>M;M+=3)T=G+r[M],C=G+r[M+1],L=G+r[M+2],e(T,C,L)}var I,H,j,W=new n.Vector3,X=new n.Vector3,q=new n.Vector3,Y=new n.Vector3;for(S=0,E=z.length;E>S;++S){var k=z[S].start,N=z[S].count,G=z[S].index;for(M=k,_=k+N;_>M;M+=3)T=G+r[M],C=G+r[M+1],L=G+r[M+2],t(T),t(C),t(L)}},computeOffsets:function(e){void 0===e&&(e=65535);for(var t=this.attributes.index.array,r=this.attributes.position.array,i=t.length/3,n=new Uint16Array(t.length),o=0,a=0,s=[{start:0,count:0,index:0}],h=s[0],c=0,l=0,u=new Int32Array(6),f=new Int32Array(r.length),p=new Int32Array(r.length),d=0;dm;m++){l=0;for(var g=0;3>g;g++){var v=t[3*m+g];-1==f[v]?(u[2*g]=v,u[2*g+1]=-1,l++):f[v]h.index+e){var x={start:o,count:0,index:a};s.push(x),h=x;for(var b=0;6>b;b+=2){var w=u[b+1];w>-1&&wb;b+=2){var v=u[b],w=u[b+1];-1===w&&(w=a++),f[v]=w,p[w]=v,n[o++]=w-h.index,h.count++}}return this.reorderBuffers(n,p,a),this.offsets=s,this.drawcalls=s,s},merge:function(e,t){if(e instanceof n.BufferGeometry==!1)return void n.error("THREE.BufferGeometry.merge(): geometry not an instance of THREE.BufferGeometry.",e);void 0===t&&(t=0);var r=this.attributes;for(var i in r)if(void 0!==e.attributes[i])for(var o=r[i],a=o.array,s=e.attributes[i],h=s.array,c=s.itemSize,l=0,u=c*t;lo;o+=3)e=n[o],t=n[o+1],r=n[o+2],i=1/Math.sqrt(e*e+t*t+r*r),n[o]*=i,n[o+1]*=i,n[o+2]*=i},reorderBuffers:function(e,t,r){var i={};for(var n in this.attributes)if("index"!=n){var o=this.attributes[n].array;i[n]=new o.constructor(this.attributes[n].itemSize*r)}for(var a=0;r>a;a++){var s=t[a];for(var n in this.attributes)if("index"!=n)for(var h=this.attributes[n].array,c=this.attributes[n].itemSize,l=i[n],u=0;c>u;u++)l[a*c+u]=h[s*c+u]}this.attributes.index.array=e;for(var n in this.attributes)"index"!=n&&(this.attributes[n].array=i[n],this.attributes[n].numItems=this.attributes[n].itemSize*r)},toJSON:function(){var e={metadata:{version:4,type:"BufferGeometry",generator:"BufferGeometryExporter"},uuid:this.uuid,type:this.type,data:{attributes:{}}},t=this.attributes,r=this.offsets,i=this.boundingSphere;for(var n in t){var o=t[n],a=Array.prototype.slice.call(o.array);e.data.attributes[n]={itemSize:o.itemSize,type:o.array.constructor.name,array:a}}return r.length>0&&(e.data.offsets=JSON.parse(JSON.stringify(r))),null!==i&&(e.data.boundingSphere={center:i.center.toArray(),radius:i.radius}),e},clone:function(){var e=new n.BufferGeometry;for(var t in this.attributes){var r=this.attributes[t];e.addAttribute(t,r.clone())}for(var i=0,o=this.offsets.length;o>i;i++){var a=this.offsets[i];e.offsets.push({start:a.start,index:a.index,count:a.count})}return e},dispose:function(){this.dispatchEvent({type:"dispose"})}},n.EventDispatcher.prototype.apply(n.BufferGeometry.prototype),n.Geometry=function(){Object.defineProperty(this,"id",{value:n.GeometryIdCount++}),this.uuid=n.Math.generateUUID(),this.name="",this.type="Geometry",this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]],this.morphTargets=[],this.morphColors=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingBox=null,this.boundingSphere=null,this.hasTangents=!1,this.dynamic=!0,this.verticesNeedUpdate=!1,this.elementsNeedUpdate=!1,this.uvsNeedUpdate=!1,this.normalsNeedUpdate=!1,this.tangentsNeedUpdate=!1,this.colorsNeedUpdate=!1,this.lineDistancesNeedUpdate=!1,this.groupsNeedUpdate=!1},n.Geometry.prototype={constructor:n.Geometry,applyMatrix:function(e){for(var t=(new n.Matrix3).getNormalMatrix(e),r=0,i=this.vertices.length;i>r;r++){var o=this.vertices[r];o.applyMatrix4(e)}for(var r=0,i=this.faces.length;i>r;r++){var a=this.faces[r];a.normal.applyMatrix3(t).normalize();for(var s=0,h=a.vertexNormals.length;h>s;s++)a.vertexNormals[s].applyMatrix3(t).normalize()}null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this.verticesNeedUpdate=!0,this.normalsNeedUpdate=!0},fromBufferGeometry:function(e){for(var t=this,r=e.attributes,i=r.position.array,o=void 0!==r.index?r.index.array:void 0,a=void 0!==r.normal?r.normal.array:void 0,s=void 0!==r.color?r.color.array:void 0,h=void 0!==r.uv?r.uv.array:void 0,c=[],l=[],u=0,f=0;u0)for(var u=0;uf;f+=3)p(y+o[f],y+o[f+1],y+o[f+2]);else for(var u=0;ur;r++){var o=this.faces[r],a=this.vertices[o.a],s=this.vertices[o.b],h=this.vertices[o.c];e.subVectors(h,s),t.subVectors(a,s),e.cross(t),e.normalize(),o.normal.copy(e)}},computeVertexNormals:function(e){var t,r,i,o,a,s;for(s=new Array(this.vertices.length),t=0,r=this.vertices.length;r>t;t++)s[t]=new n.Vector3;if(e){var h,c,l,u=new n.Vector3,f=new n.Vector3;for(i=0,o=this.faces.length;o>i;i++)a=this.faces[i],h=this.vertices[a.a],c=this.vertices[a.b],l=this.vertices[a.c],u.subVectors(l,c),f.subVectors(h,c),u.cross(f),s[a.a].add(u),s[a.b].add(u),s[a.c].add(u)}else for(i=0,o=this.faces.length;o>i;i++)a=this.faces[i],s[a.a].add(a.normal),s[a.b].add(a.normal),s[a.c].add(a.normal);for(t=0,r=this.vertices.length;r>t;t++)s[t].normalize();for(i=0,o=this.faces.length;o>i;i++)a=this.faces[i],a.vertexNormals[0]=s[a.a].clone(),a.vertexNormals[1]=s[a.b].clone(),a.vertexNormals[2]=s[a.c].clone()},computeMorphNormals:function(){var e,t,r,i,o;for(r=0,i=this.faces.length;i>r;r++)for(o=this.faces[r],o.__originalFaceNormal?o.__originalFaceNormal.copy(o.normal):o.__originalFaceNormal=o.normal.clone(),o.__originalVertexNormals||(o.__originalVertexNormals=[]),e=0,t=o.vertexNormals.length;t>e;e++)o.__originalVertexNormals[e]?o.__originalVertexNormals[e].copy(o.vertexNormals[e]):o.__originalVertexNormals[e]=o.vertexNormals[e].clone();var a=new n.Geometry;for(a.faces=this.faces,e=0,t=this.morphTargets.length;t>e;e++){if(!this.morphNormals[e]){this.morphNormals[e]={},this.morphNormals[e].faceNormals=[],this.morphNormals[e].vertexNormals=[];var s,h,c=this.morphNormals[e].faceNormals,l=this.morphNormals[e].vertexNormals;for(r=0,i=this.faces.length;i>r;r++)s=new n.Vector3,h={a:new n.Vector3,b:new n.Vector3,c:new n.Vector3},c.push(s),l.push(h)}var u=this.morphNormals[e];a.vertices=this.morphTargets[e].vertices,a.computeFaceNormals(),a.computeVertexNormals();var s,h;for(r=0,i=this.faces.length;i>r;r++)o=this.faces[r],s=u.faceNormals[r],h=u.vertexNormals[r],s.copy(o.normal),h.a.copy(o.vertexNormals[0]),h.b.copy(o.vertexNormals[1]),h.c.copy(o.vertexNormals[2])}for(r=0,i=this.faces.length;i>r;r++)o=this.faces[r],o.normal=o.__originalFaceNormal,o.vertexNormals=o.__originalVertexNormals},computeTangents:function(){function e(e,t,r,i,n,o,a){l=e.vertices[t],u=e.vertices[r],f=e.vertices[i],p=c[n],d=c[o],m=c[a],g=u.x-l.x,v=f.x-l.x,y=u.y-l.y,x=f.y-l.y,b=u.z-l.z,w=f.z-l.z,A=d.x-p.x,M=m.x-p.x,_=d.y-p.y,S=m.y-p.y,E=1/(A*S-M*_),F.set((S*g-_*v)*E,(S*y-_*x)*E,(S*b-_*w)*E),B.set((A*v-M*g)*E,(A*x-M*y)*E,(A*w-M*b)*E),P[t].add(F),P[r].add(F),P[i].add(F),R[t].add(B),R[r].add(B),R[i].add(B)}var t,r,i,o,a,s,h,c,l,u,f,p,d,m,g,v,y,x,b,w,A,M,_,S,E,T,C,L,P=[],R=[],F=new n.Vector3,B=new n.Vector3,D=new n.Vector3,U=new n.Vector3,V=new n.Vector3;for(i=0,o=this.vertices.length;o>i;i++)P[i]=new n.Vector3,R[i]=new n.Vector3;for(t=0,r=this.faces.length;r>t;t++)h=this.faces[t],c=this.faceVertexUvs[0][t],e(this,h.a,h.b,h.c,0,1,2);var O=["a","b","c","d"];for(t=0,r=this.faces.length;r>t;t++)for(h=this.faces[t],a=0;aC?-1:1,h.vertexTangents[a]=new n.Vector4(D.x,D.y,D.z,L);this.hasTangents=!0},computeLineDistances:function(){for(var e=0,t=this.vertices,r=0,i=t.length;i>r;r++)r>0&&(e+=t[r].distanceTo(t[r-1])),this.lineDistances[r]=e},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new n.Box3),this.boundingBox.setFromPoints(this.vertices)},computeBoundingSphere:function(){null===this.boundingSphere&&(this.boundingSphere=new n.Sphere),this.boundingSphere.setFromPoints(this.vertices)},merge:function(e,t,r){if(e instanceof n.Geometry==!1)return void n.error("THREE.Geometry.merge(): geometry not an instance of THREE.Geometry.",e);var i,o=this.vertices.length,a=this.vertices,s=e.vertices,h=this.faces,c=e.faces,l=this.faceVertexUvs[0],u=e.faceVertexUvs[0];void 0===r&&(r=0),void 0!==t&&(i=(new n.Matrix3).getNormalMatrix(t));for(var f=0,p=s.length;p>f;f++){var d=s[f],m=d.clone();void 0!==t&&m.applyMatrix4(t),a.push(m)}for(f=0,p=c.length;p>f;f++){var g,v,y,x=c[f],b=x.vertexNormals,w=x.vertexColors;g=new n.Face3(x.a+o,x.b+o,x.c+o),g.normal.copy(x.normal),void 0!==i&&g.normal.applyMatrix3(i).normalize();for(var A=0,M=b.length;M>A;A++)v=b[A].clone(),void 0!==i&&v.applyMatrix3(i).normalize(),g.vertexNormals.push(v);g.color.copy(x.color);for(var A=0,M=w.length;M>A;A++)y=w[A],g.vertexColors.push(y.clone());g.materialIndex=x.materialIndex+r,h.push(g)}for(f=0,p=u.length;p>f;f++){var _=u[f],S=[];if(void 0!==_){for(var A=0,M=_.length;M>A;A++)S.push(_[A].clone());l.push(S)}}},mergeMesh:function(e){return e instanceof n.Mesh==!1?void n.error("THREE.Geometry.mergeMesh(): mesh not an instance of THREE.Mesh.",e):(e.matrixAutoUpdate&&e.updateMatrix(),void this.merge(e.geometry,e.matrix))},mergeVertices:function(){var e,t,r,i,n,o,a,s,h={},c=[],l=[],u=4,f=Math.pow(10,u);for(r=0,i=this.vertices.length;i>r;r++)e=this.vertices[r],t=Math.round(e.x*f)+"_"+Math.round(e.y*f)+"_"+Math.round(e.z*f),void 0===h[t]?(h[t]=r,c.push(this.vertices[r]),l[r]=c.length-1):l[r]=l[h[t]];var p=[];for(r=0,i=this.faces.length;i>r;r++){n=this.faces[r],n.a=l[n.a],n.b=l[n.b],n.c=l[n.c],o=[n.a,n.b,n.c];for(var d=-1,m=0;3>m;m++)if(o[m]==o[(m+1)%3]){d=m,p.push(r);break}}for(r=p.length-1;r>=0;r--){var g=p[r];for(this.faces.splice(g,1),a=0,s=this.faceVertexUvs.length;s>a;a++)this.faceVertexUvs[a].splice(g,1)}var v=this.vertices.length-c.length;return this.vertices=c,v},toJSON:function(){function e(e,t,r){return r?e|1<0,A=v.vertexNormals.length>0,M=1!==v.color.r||1!==v.color.g||1!==v.color.b,_=v.vertexColors.length>0,S=0;if(S=e(S,0,0),S=e(S,1,y),S=e(S,2,x),S=e(S,3,b),S=e(S,4,w),S=e(S,5,A),S=e(S,6,M),S=e(S,7,_),l.push(S),l.push(v.a,v.b,v.c),b){var E=this.faceVertexUvs[0][h];l.push(i(E[0]),i(E[1]),i(E[2]))}if(w&&l.push(t(v.normal)),A){var T=v.vertexNormals;l.push(t(T[0]),t(T[1]),t(T[2]))}if(M&&l.push(r(v.color)),_){var C=v.vertexColors;l.push(r(C[0]),r(C[1]),r(C[2]))}}return n.data={},n.data.vertices=s,n.data.normals=u,p.length>0&&(n.data.colors=p),m.length>0&&(n.data.uvs=[m]),n.data.faces=l,n},clone:function(){for(var e=new n.Geometry,t=this.vertices,r=0,i=t.length;i>r;r++)e.vertices.push(t[r].clone());for(var o=this.faces,r=0,i=o.length;i>r;r++)e.faces.push(o[r].clone());for(var r=0,i=this.faceVertexUvs.length;i>r;r++){var a=this.faceVertexUvs[r];void 0===e.faceVertexUvs[r]&&(e.faceVertexUvs[r]=[]);for(var s=0,h=a.length;h>s;s++){for(var c=a[s],l=[],u=0,f=c.length;f>u;u++){var p=c[u];l.push(p.clone())}e.faceVertexUvs[r].push(l)}}return e},dispose:function(){this.dispatchEvent({type:"dispose"})}},n.EventDispatcher.prototype.apply(n.Geometry.prototype),n.GeometryIdCount=0,n.Camera=function(){n.Object3D.call(this),this.type="Camera",this.matrixWorldInverse=new n.Matrix4,this.projectionMatrix=new n.Matrix4},n.Camera.prototype=Object.create(n.Object3D.prototype),n.Camera.prototype.constructor=n.Camera,n.Camera.prototype.getWorldDirection=function(){var e=new n.Quaternion;return function(t){var r=t||new n.Vector3;return this.getWorldQuaternion(e),r.set(0,0,-1).applyQuaternion(e)}}(),n.Camera.prototype.lookAt=function(){var e=new n.Matrix4;return function(t){e.lookAt(this.position,t,this.up),this.quaternion.setFromRotationMatrix(e)}}(),n.Camera.prototype.clone=function(e){return void 0===e&&(e=new n.Camera),n.Object3D.prototype.clone.call(this,e),e.matrixWorldInverse.copy(this.matrixWorldInverse),e.projectionMatrix.copy(this.projectionMatrix),e},n.CubeCamera=function(e,t,r){n.Object3D.call(this),this.type="CubeCamera";var i=90,o=1,a=new n.PerspectiveCamera(i,o,e,t);a.up.set(0,-1,0),a.lookAt(new n.Vector3(1,0,0)),this.add(a);var s=new n.PerspectiveCamera(i,o,e,t);s.up.set(0,-1,0),s.lookAt(new n.Vector3(-1,0,0)),this.add(s);var h=new n.PerspectiveCamera(i,o,e,t);h.up.set(0,0,1),h.lookAt(new n.Vector3(0,1,0)),this.add(h);var c=new n.PerspectiveCamera(i,o,e,t);c.up.set(0,0,-1),c.lookAt(new n.Vector3(0,-1,0)),this.add(c);var l=new n.PerspectiveCamera(i,o,e,t);l.up.set(0,-1,0),l.lookAt(new n.Vector3(0,0,1)),this.add(l);var u=new n.PerspectiveCamera(i,o,e,t);u.up.set(0,-1,0),u.lookAt(new n.Vector3(0,0,-1)),this.add(u),this.renderTarget=new n.WebGLRenderTargetCube(r,r,{format:n.RGBFormat,magFilter:n.LinearFilter,minFilter:n.LinearFilter}),this.updateCubeMap=function(e,t){var r=this.renderTarget,i=r.generateMipmaps;r.generateMipmaps=!1,r.activeCubeFace=0,e.render(t,a,r),r.activeCubeFace=1,e.render(t,s,r),r.activeCubeFace=2,e.render(t,h,r),r.activeCubeFace=3,e.render(t,c,r),r.activeCubeFace=4,e.render(t,l,r),r.generateMipmaps=i,r.activeCubeFace=5,e.render(t,u,r)}},n.CubeCamera.prototype=Object.create(n.Object3D.prototype),n.CubeCamera.prototype.constructor=n.CubeCamera,n.OrthographicCamera=function(e,t,r,i,o,a){n.Camera.call(this),this.type="OrthographicCamera",this.zoom=1,this.left=e,this.right=t,this.top=r,this.bottom=i,this.near=void 0!==o?o:.1,this.far=void 0!==a?a:2e3,this.updateProjectionMatrix()},n.OrthographicCamera.prototype=Object.create(n.Camera.prototype),n.OrthographicCamera.prototype.constructor=n.OrthographicCamera,n.OrthographicCamera.prototype.updateProjectionMatrix=function(){var e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),r=(this.right+this.left)/2,i=(this.top+this.bottom)/2;this.projectionMatrix.makeOrthographic(r-e,r+e,i+t,i-t,this.near,this.far)},n.OrthographicCamera.prototype.clone=function(){var e=new n.OrthographicCamera;return n.Camera.prototype.clone.call(this,e),e.zoom=this.zoom,e.left=this.left,e.right=this.right,e.top=this.top,e.bottom=this.bottom,e.near=this.near,e.far=this.far,e.projectionMatrix.copy(this.projectionMatrix),e},n.PerspectiveCamera=function(e,t,r,i){n.Camera.call(this),this.type="PerspectiveCamera",this.zoom=1,this.fov=void 0!==e?e:50,this.aspect=void 0!==t?t:1,this.near=void 0!==r?r:.1,this.far=void 0!==i?i:2e3,this.updateProjectionMatrix()},n.PerspectiveCamera.prototype=Object.create(n.Camera.prototype),n.PerspectiveCamera.prototype.constructor=n.PerspectiveCamera,n.PerspectiveCamera.prototype.setLens=function(e,t){void 0===t&&(t=24),this.fov=2*n.Math.radToDeg(Math.atan(t/(2*e))),this.updateProjectionMatrix()},n.PerspectiveCamera.prototype.setViewOffset=function(e,t,r,i,n,o){this.fullWidth=e,this.fullHeight=t,this.x=r,this.y=i,this.width=n,this.height=o,this.updateProjectionMatrix()},n.PerspectiveCamera.prototype.updateProjectionMatrix=function(){var e=n.Math.radToDeg(2*Math.atan(Math.tan(.5*n.Math.degToRad(this.fov))/this.zoom));if(this.fullWidth){var t=this.fullWidth/this.fullHeight,r=Math.tan(n.Math.degToRad(.5*e))*this.near,i=-r,o=t*i,a=t*r,s=Math.abs(a-o),h=Math.abs(r-i);this.projectionMatrix.makeFrustum(o+this.x*s/this.fullWidth,o+(this.x+this.width)*s/this.fullWidth,r-(this.y+this.height)*h/this.fullHeight,r-this.y*h/this.fullHeight,this.near,this.far)}else this.projectionMatrix.makePerspective(e,this.aspect,this.near,this.far)},n.PerspectiveCamera.prototype.clone=function(){var e=new n.PerspectiveCamera;return n.Camera.prototype.clone.call(this,e),e.zoom=this.zoom,e.fov=this.fov,e.aspect=this.aspect,e.near=this.near,e.far=this.far,e.projectionMatrix.copy(this.projectionMatrix),e},n.Light=function(e){n.Object3D.call(this),this.type="Light",this.color=new n.Color(e)},n.Light.prototype=Object.create(n.Object3D.prototype),n.Light.prototype.constructor=n.Light,n.Light.prototype.clone=function(e){return void 0===e&&(e=new n.Light),n.Object3D.prototype.clone.call(this,e),e.color.copy(this.color),e},n.AmbientLight=function(e){n.Light.call(this,e),this.type="AmbientLight"},n.AmbientLight.prototype=Object.create(n.Light.prototype),n.AmbientLight.prototype.constructor=n.AmbientLight,n.AmbientLight.prototype.clone=function(){var e=new n.AmbientLight;return n.Light.prototype.clone.call(this,e),e},n.AreaLight=function(e,t){n.Light.call(this,e),this.type="AreaLight",this.normal=new n.Vector3(0,-1,0),this.right=new n.Vector3(1,0,0),this.intensity=void 0!==t?t:1,this.width=1,this.height=1,this.constantAttenuation=1.5,this.linearAttenuation=.5,this.quadraticAttenuation=.1},n.AreaLight.prototype=Object.create(n.Light.prototype),n.AreaLight.prototype.constructor=n.AreaLight,n.DirectionalLight=function(e,t){n.Light.call(this,e),this.type="DirectionalLight",this.position.set(0,1,0),this.target=new n.Object3D,this.intensity=void 0!==t?t:1,this.castShadow=!1,this.onlyShadow=!1,this.shadowCameraNear=50,this.shadowCameraFar=5e3,this.shadowCameraLeft=-500,this.shadowCameraRight=500,this.shadowCameraTop=500,this.shadowCameraBottom=-500, -this.shadowCameraVisible=!1,this.shadowBias=0,this.shadowDarkness=.5,this.shadowMapWidth=512,this.shadowMapHeight=512,this.shadowCascade=!1,this.shadowCascadeOffset=new n.Vector3(0,0,-1e3),this.shadowCascadeCount=2,this.shadowCascadeBias=[0,0,0],this.shadowCascadeWidth=[512,512,512],this.shadowCascadeHeight=[512,512,512],this.shadowCascadeNearZ=[-1,.99,.998],this.shadowCascadeFarZ=[.99,.998,1],this.shadowCascadeArray=[],this.shadowMap=null,this.shadowMapSize=null,this.shadowCamera=null,this.shadowMatrix=null},n.DirectionalLight.prototype=Object.create(n.Light.prototype),n.DirectionalLight.prototype.constructor=n.DirectionalLight,n.DirectionalLight.prototype.clone=function(){var e=new n.DirectionalLight;return n.Light.prototype.clone.call(this,e),e.target=this.target.clone(),e.intensity=this.intensity,e.castShadow=this.castShadow,e.onlyShadow=this.onlyShadow,e.shadowCameraNear=this.shadowCameraNear,e.shadowCameraFar=this.shadowCameraFar,e.shadowCameraLeft=this.shadowCameraLeft,e.shadowCameraRight=this.shadowCameraRight,e.shadowCameraTop=this.shadowCameraTop,e.shadowCameraBottom=this.shadowCameraBottom,e.shadowCameraVisible=this.shadowCameraVisible,e.shadowBias=this.shadowBias,e.shadowDarkness=this.shadowDarkness,e.shadowMapWidth=this.shadowMapWidth,e.shadowMapHeight=this.shadowMapHeight,e.shadowCascade=this.shadowCascade,e.shadowCascadeOffset.copy(this.shadowCascadeOffset),e.shadowCascadeCount=this.shadowCascadeCount,e.shadowCascadeBias=this.shadowCascadeBias.slice(0),e.shadowCascadeWidth=this.shadowCascadeWidth.slice(0),e.shadowCascadeHeight=this.shadowCascadeHeight.slice(0),e.shadowCascadeNearZ=this.shadowCascadeNearZ.slice(0),e.shadowCascadeFarZ=this.shadowCascadeFarZ.slice(0),e},n.HemisphereLight=function(e,t,r){n.Light.call(this,e),this.type="HemisphereLight",this.position.set(0,100,0),this.groundColor=new n.Color(t),this.intensity=void 0!==r?r:1},n.HemisphereLight.prototype=Object.create(n.Light.prototype),n.HemisphereLight.prototype.constructor=n.HemisphereLight,n.HemisphereLight.prototype.clone=function(){var e=new n.HemisphereLight;return n.Light.prototype.clone.call(this,e),e.groundColor.copy(this.groundColor),e.intensity=this.intensity,e},n.PointLight=function(e,t,r,i){n.Light.call(this,e),this.type="PointLight",this.intensity=void 0!==t?t:1,this.distance=void 0!==r?r:0,this.decay=void 0!==i?i:1},n.PointLight.prototype=Object.create(n.Light.prototype),n.PointLight.prototype.constructor=n.PointLight,n.PointLight.prototype.clone=function(){var e=new n.PointLight;return n.Light.prototype.clone.call(this,e),e.intensity=this.intensity,e.distance=this.distance,e.decay=this.decay,e},n.SpotLight=function(e,t,r,i,o,a){n.Light.call(this,e),this.type="SpotLight",this.position.set(0,1,0),this.target=new n.Object3D,this.intensity=void 0!==t?t:1,this.distance=void 0!==r?r:0,this.angle=void 0!==i?i:Math.PI/3,this.exponent=void 0!==o?o:10,this.decay=void 0!==a?a:1,this.castShadow=!1,this.onlyShadow=!1,this.shadowCameraNear=50,this.shadowCameraFar=5e3,this.shadowCameraFov=50,this.shadowCameraVisible=!1,this.shadowBias=0,this.shadowDarkness=.5,this.shadowMapWidth=512,this.shadowMapHeight=512,this.shadowMap=null,this.shadowMapSize=null,this.shadowCamera=null,this.shadowMatrix=null},n.SpotLight.prototype=Object.create(n.Light.prototype),n.SpotLight.prototype.constructor=n.SpotLight,n.SpotLight.prototype.clone=function(){var e=new n.SpotLight;return n.Light.prototype.clone.call(this,e),e.target=this.target.clone(),e.intensity=this.intensity,e.distance=this.distance,e.angle=this.angle,e.exponent=this.exponent,e.decay=this.decay,e.castShadow=this.castShadow,e.onlyShadow=this.onlyShadow,e.shadowCameraNear=this.shadowCameraNear,e.shadowCameraFar=this.shadowCameraFar,e.shadowCameraFov=this.shadowCameraFov,e.shadowCameraVisible=this.shadowCameraVisible,e.shadowBias=this.shadowBias,e.shadowDarkness=this.shadowDarkness,e.shadowMapWidth=this.shadowMapWidth,e.shadowMapHeight=this.shadowMapHeight,e},n.Cache={files:{},add:function(e,t){this.files[e]=t},get:function(e){return this.files[e]},remove:function(e){delete this.files[e]},clear:function(){this.files={}}},n.Loader=function(e){this.showStatus=e,this.statusDomElement=e?n.Loader.prototype.addStatusElement():null,this.imageLoader=new n.ImageLoader,this.onLoadStart=function(){},this.onLoadProgress=function(){},this.onLoadComplete=function(){}},n.Loader.prototype={constructor:n.Loader,crossOrigin:void 0,addStatusElement:function(){var e=document.createElement("div");return e.style.position="absolute",e.style.right="0px",e.style.top="0px",e.style.fontSize="0.8em",e.style.textAlign="left",e.style.background="rgba(0,0,0,0.25)",e.style.color="#fff",e.style.width="120px",e.style.padding="0.5em 0.5em 0.5em 0.5em",e.style.zIndex=1e3,e.innerHTML="Loading ...",e},updateProgress:function(e){var t="Loaded ";t+=e.total?(100*e.loaded/e.total).toFixed(0)+"%":(e.loaded/1024).toFixed(2)+" KB",this.statusDomElement.innerHTML=t},extractUrlBase:function(e){var t=e.split("/");return 1===t.length?"./":(t.pop(),t.join("/")+"/")},initMaterials:function(e,t){for(var r=[],i=0;it;t++){var i=e[t];if(i instanceof n.ShaderMaterial)return!0}return!1},createMaterial:function(e,t){function r(e){var t=Math.log(e)/Math.LN2;return Math.pow(2,Math.round(t))}function i(e,i,o,s,h,c,l){var u,f=t+o,p=n.Loader.Handlers.get(f);if(null!==p?u=p.load(f):(u=new n.Texture,p=a.imageLoader,p.crossOrigin=a.crossOrigin,p.load(f,function(e){if(n.Math.isPowerOfTwo(e.width)===!1||n.Math.isPowerOfTwo(e.height)===!1){var t=r(e.width),i=r(e.height),o=document.createElement("canvas");o.width=t,o.height=i;var a=o.getContext("2d");a.drawImage(e,0,0,t,i),u.image=o}else u.image=e;u.needsUpdate=!0})),u.sourceFile=o,s&&(u.repeat.set(s[0],s[1]),1!==s[0]&&(u.wrapS=n.RepeatWrapping),1!==s[1]&&(u.wrapT=n.RepeatWrapping)),h&&u.offset.set(h[0],h[1]),c){var d={repeat:n.RepeatWrapping,mirror:n.MirroredRepeatWrapping};void 0!==d[c[0]]&&(u.wrapS=d[c[0]]),void 0!==d[c[1]]&&(u.wrapT=d[c[1]])}l&&(u.anisotropy=l),e[i]=u}function o(e){return(255*e[0]<<16)+(255*e[1]<<8)+255*e[2]}var a=this,s="MeshLambertMaterial",h={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,bumpMap:null,wireframe:!1};if(e.shading){var c=e.shading.toLowerCase();"phong"===c?s="MeshPhongMaterial":"basic"===c&&(s="MeshBasicMaterial")}void 0!==e.blending&&void 0!==n[e.blending]&&(h.blending=n[e.blending]),void 0!==e.transparent&&(h.transparent=e.transparent),void 0!==e.opacity&&e.opacity<1&&(h.transparent=!0),void 0!==e.depthTest&&(h.depthTest=e.depthTest),void 0!==e.depthWrite&&(h.depthWrite=e.depthWrite),void 0!==e.visible&&(h.visible=e.visible),void 0!==e.flipSided&&(h.side=n.BackSide),void 0!==e.doubleSided&&(h.side=n.DoubleSide),void 0!==e.wireframe&&(h.wireframe=e.wireframe),void 0!==e.vertexColors&&("face"===e.vertexColors?h.vertexColors=n.FaceColors:e.vertexColors&&(h.vertexColors=n.VertexColors)),e.colorDiffuse?h.color=o(e.colorDiffuse):e.DbgColor&&(h.color=e.DbgColor),e.colorSpecular&&(h.specular=o(e.colorSpecular)),e.colorEmissive&&(h.emissive=o(e.colorEmissive)),void 0!==e.transparency&&(console.warn("THREE.Loader: transparency has been renamed to opacity"),e.opacity=e.transparency),void 0!==e.opacity&&(h.opacity=e.opacity),e.specularCoef&&(h.shininess=e.specularCoef),e.mapDiffuse&&t&&i(h,"map",e.mapDiffuse,e.mapDiffuseRepeat,e.mapDiffuseOffset,e.mapDiffuseWrap,e.mapDiffuseAnisotropy),e.mapLight&&t&&i(h,"lightMap",e.mapLight,e.mapLightRepeat,e.mapLightOffset,e.mapLightWrap,e.mapLightAnisotropy),e.mapBump&&t&&i(h,"bumpMap",e.mapBump,e.mapBumpRepeat,e.mapBumpOffset,e.mapBumpWrap,e.mapBumpAnisotropy),e.mapNormal&&t&&i(h,"normalMap",e.mapNormal,e.mapNormalRepeat,e.mapNormalOffset,e.mapNormalWrap,e.mapNormalAnisotropy),e.mapSpecular&&t&&i(h,"specularMap",e.mapSpecular,e.mapSpecularRepeat,e.mapSpecularOffset,e.mapSpecularWrap,e.mapSpecularAnisotropy),e.mapAlpha&&t&&i(h,"alphaMap",e.mapAlpha,e.mapAlphaRepeat,e.mapAlphaOffset,e.mapAlphaWrap,e.mapAlphaAnisotropy),e.mapBumpScale&&(h.bumpScale=e.mapBumpScale),e.mapNormalFactor&&(h.normalScale=new n.Vector2(e.mapNormalFactor,e.mapNormalFactor));var l=new n[s](h);return void 0!==e.DbgName&&(l.name=e.DbgName),l}},n.Loader.Handlers={handlers:[],add:function(e,t){this.handlers.push(e,t)},get:function(e){for(var t=0,r=this.handlers.length;r>t;t+=2){var i=this.handlers[t],n=this.handlers[t+1];if(i.test(e))return n}return null}},n.XHRLoader=function(e){this.manager=void 0!==e?e:n.DefaultLoadingManager},n.XHRLoader.prototype={constructor:n.XHRLoader,load:function(e,t,r,i){var o=this,a=n.Cache.get(e);if(void 0!==a)return void(t&&t(a));var s=new XMLHttpRequest;s.open("GET",e,!0),s.addEventListener("load",function(r){n.Cache.add(e,this.response),t&&t(this.response),o.manager.itemEnd(e)},!1),void 0!==r&&s.addEventListener("progress",function(e){r(e)},!1),void 0!==i&&s.addEventListener("error",function(e){i(e)},!1),void 0!==this.crossOrigin&&(s.crossOrigin=this.crossOrigin),void 0!==this.responseType&&(s.responseType=this.responseType),s.send(null),o.manager.itemStart(e)},setResponseType:function(e){this.responseType=e},setCrossOrigin:function(e){this.crossOrigin=e}},n.ImageLoader=function(e){this.manager=void 0!==e?e:n.DefaultLoadingManager},n.ImageLoader.prototype={constructor:n.ImageLoader,load:function(e,t,r,i){var o=this,a=n.Cache.get(e);if(void 0!==a)return void t(a);var s=document.createElement("img");return s.addEventListener("load",function(r){n.Cache.add(e,this),t&&t(this),o.manager.itemEnd(e)},!1),void 0!==r&&s.addEventListener("progress",function(e){r(e)},!1),void 0!==i&&s.addEventListener("error",function(e){i(e)},!1),void 0!==this.crossOrigin&&(s.crossOrigin=this.crossOrigin),s.src=e,o.manager.itemStart(e),s},setCrossOrigin:function(e){this.crossOrigin=e}},n.JSONLoader=function(e){n.Loader.call(this,e),this.withCredentials=!1},n.JSONLoader.prototype=Object.create(n.Loader.prototype),n.JSONLoader.prototype.constructor=n.JSONLoader,n.JSONLoader.prototype.load=function(e,t,r){r=r&&"string"==typeof r?r:this.extractUrlBase(e),this.onLoadStart(),this.loadAjaxJSON(this,e,t,r)},n.JSONLoader.prototype.loadAjaxJSON=function(e,t,r,i,o){var a=new XMLHttpRequest,s=0;a.onreadystatechange=function(){if(a.readyState===a.DONE)if(200===a.status||0===a.status){if(a.responseText){var h=JSON.parse(a.responseText),c=h.metadata;if(void 0!==c){if("object"===c.type)return void n.error("THREE.JSONLoader: "+t+" should be loaded with THREE.ObjectLoader instead.");if("scene"===c.type)return void n.error("THREE.JSONLoader: "+t+" seems to be a Scene. Use THREE.SceneLoader instead.")}var l=e.parse(h,i);r(l.geometry,l.materials)}else n.error("THREE.JSONLoader: "+t+" seems to be unreachable or the file is empty.");e.onLoadComplete()}else n.error("THREE.JSONLoader: Couldn't load "+t+" ("+a.status+")");else a.readyState===a.LOADING?o&&(0===s&&(s=a.getResponseHeader("Content-Length")),o({total:s,loaded:a.responseText.length})):a.readyState===a.HEADERS_RECEIVED&&void 0!==o&&(s=a.getResponseHeader("Content-Length"))},a.open("GET",t,!0),a.withCredentials=this.withCredentials,a.send(null)},n.JSONLoader.prototype.parse=function(e,t){function r(t){function r(e,t){return e&1<i;i++)a.faceVertexUvs[i]=[]}for(h=0,c=B.length;c>h;)A=new n.Vector3,A.x=B[h++]*t,A.y=B[h++]*t,A.z=B[h++]*t,a.vertices.push(A);for(h=0,c=F.length;c>h;)if(d=F[h++],m=r(d,0),g=r(d,1),v=r(d,3),y=r(d,4),x=r(d,5),b=r(d,6),w=r(d,7),m){if(_=new n.Face3,_.a=F[h],_.b=F[h+1],_.c=F[h+3],S=new n.Face3,S.a=F[h+1],S.b=F[h+2],S.c=F[h+3],h+=4,g&&(p=F[h++],_.materialIndex=p,S.materialIndex=p),s=a.faces.length,v)for(i=0;V>i;i++)for(C=e.uvs[i],a.faceVertexUvs[i][s]=[],a.faceVertexUvs[i][s+1]=[],o=0;4>o;o++)f=F[h++],P=C[2*f],R=C[2*f+1],L=new n.Vector2(P,R),2!==o&&a.faceVertexUvs[i][s].push(L),0!==o&&a.faceVertexUvs[i][s+1].push(L);if(y&&(u=3*F[h++],_.normal.set(D[u++],D[u++],D[u]),S.normal.copy(_.normal)),x)for(i=0;4>i;i++)u=3*F[h++],T=new n.Vector3(D[u++],D[u++],D[u]),2!==i&&_.vertexNormals.push(T),0!==i&&S.vertexNormals.push(T);if(b&&(l=F[h++],E=U[l],_.color.setHex(E),S.color.setHex(E)),w)for(i=0;4>i;i++)l=F[h++],E=U[l],2!==i&&_.vertexColors.push(new n.Color(E)),0!==i&&S.vertexColors.push(new n.Color(E));a.faces.push(_),a.faces.push(S)}else{if(M=new n.Face3,M.a=F[h++],M.b=F[h++],M.c=F[h++],g&&(p=F[h++],M.materialIndex=p),s=a.faces.length,v)for(i=0;V>i;i++)for(C=e.uvs[i],a.faceVertexUvs[i][s]=[],o=0;3>o;o++)f=F[h++],P=C[2*f],R=C[2*f+1],L=new n.Vector2(P,R),a.faceVertexUvs[i][s].push(L);if(y&&(u=3*F[h++],M.normal.set(D[u++],D[u++],D[u])),x)for(i=0;3>i;i++)u=3*F[h++],T=new n.Vector3(D[u++],D[u++],D[u]),M.vertexNormals.push(T);if(b&&(l=F[h++],M.color.setHex(U[l])),w)for(i=0;3>i;i++)l=F[h++],M.vertexColors.push(new n.Color(U[l]));a.faces.push(M)}}function i(){var t=void 0!==e.influencesPerVertex?e.influencesPerVertex:2;if(e.skinWeights)for(var r=0,i=e.skinWeights.length;i>r;r+=t){var o=e.skinWeights[r],s=t>1?e.skinWeights[r+1]:0,h=t>2?e.skinWeights[r+2]:0,c=t>3?e.skinWeights[r+3]:0;a.skinWeights.push(new n.Vector4(o,s,h,c))}if(e.skinIndices)for(var r=0,i=e.skinIndices.length;i>r;r+=t){var l=e.skinIndices[r],u=t>1?e.skinIndices[r+1]:0,f=t>2?e.skinIndices[r+2]:0,p=t>3?e.skinIndices[r+3]:0;a.skinIndices.push(new n.Vector4(l,u,f,p))}a.bones=e.bones,a.bones&&a.bones.length>0&&(a.skinWeights.length!==a.skinIndices.length||a.skinIndices.length!==a.vertices.length)&&n.warn("THREE.JSONLoader: When skinning, number of vertices ("+a.vertices.length+"), skinIndices ("+a.skinIndices.length+"), and skinWeights ("+a.skinWeights.length+") should match."),a.animation=e.animation,a.animations=e.animations}function o(t){if(void 0!==e.morphTargets){var r,i,o,s,h,c;for(r=0,i=e.morphTargets.length;i>r;r++)for(a.morphTargets[r]={},a.morphTargets[r].name=e.morphTargets[r].name,a.morphTargets[r].vertices=[],h=a.morphTargets[r].vertices,c=e.morphTargets[r].vertices,o=0,s=c.length;s>o;o+=3){var l=new n.Vector3;l.x=c[o]*t,l.y=c[o+1]*t,l.z=c[o+2]*t,h.push(l)}}if(void 0!==e.morphColors){var r,i,u,f,p,d,m;for(r=0,i=e.morphColors.length;i>r;r++)for(a.morphColors[r]={},a.morphColors[r].name=e.morphColors[r].name,a.morphColors[r].colors=[],p=a.morphColors[r].colors,d=e.morphColors[r].colors,u=0,f=d.length;f>u;u+=3)m=new n.Color(16755200),m.setRGB(d[u],d[u+1],d[u+2]),p.push(m)}}var a=new n.Geometry,s=void 0!==e.scale?1/e.scale:1;if(r(s),i(),o(s),a.computeFaceNormals(),a.computeBoundingSphere(),void 0===e.materials||0===e.materials.length)return{geometry:a};var h=this.initMaterials(e.materials,t);return this.needsTangents(h)&&a.computeTangents(),{geometry:a,materials:h}},n.LoadingManager=function(e,t,r){var i=this,n=0,o=0;this.onLoad=e,this.onProgress=t,this.onError=r,this.itemStart=function(e){o++},this.itemEnd=function(e){n++,void 0!==i.onProgress&&i.onProgress(e,n,o),n===o&&void 0!==i.onLoad&&i.onLoad()}},n.DefaultLoadingManager=new n.LoadingManager,n.BufferGeometryLoader=function(e){this.manager=void 0!==e?e:n.DefaultLoadingManager},n.BufferGeometryLoader.prototype={constructor:n.BufferGeometryLoader,load:function(e,t,r,i){var o=this,a=new n.XHRLoader(o.manager);a.setCrossOrigin(this.crossOrigin),a.load(e,function(e){t(o.parse(JSON.parse(e)))},r,i)},setCrossOrigin:function(e){this.crossOrigin=e},parse:function(e){var t=new n.BufferGeometry,r=e.data.attributes;for(var o in r){var a=r[o],s=new i[a.type](a.array);t.addAttribute(o,new n.BufferAttribute(s,a.itemSize))}var h=e.data.offsets;void 0!==h&&(t.offsets=JSON.parse(JSON.stringify(h)));var c=e.data.boundingSphere;if(void 0!==c){var l=new n.Vector3;void 0!==c.center&&l.fromArray(c.center),t.boundingSphere=new n.Sphere(l,c.radius)}return t}},n.MaterialLoader=function(e){this.manager=void 0!==e?e:n.DefaultLoadingManager},n.MaterialLoader.prototype={constructor:n.MaterialLoader,load:function(e,t,r,i){var o=this,a=new n.XHRLoader(o.manager);a.setCrossOrigin(this.crossOrigin),a.load(e,function(e){t(o.parse(JSON.parse(e)))},r,i)},setCrossOrigin:function(e){this.crossOrigin=e},parse:function(e){var t=new n[e.type];if(void 0!==e.color&&t.color.setHex(e.color),void 0!==e.emissive&&t.emissive.setHex(e.emissive),void 0!==e.specular&&t.specular.setHex(e.specular),void 0!==e.shininess&&(t.shininess=e.shininess),void 0!==e.uniforms&&(t.uniforms=e.uniforms),void 0!==e.vertexShader&&(t.vertexShader=e.vertexShader),void 0!==e.fragmentShader&&(t.fragmentShader=e.fragmentShader),void 0!==e.vertexColors&&(t.vertexColors=e.vertexColors),void 0!==e.shading&&(t.shading=e.shading),void 0!==e.blending&&(t.blending=e.blending),void 0!==e.side&&(t.side=e.side),void 0!==e.opacity&&(t.opacity=e.opacity),void 0!==e.transparent&&(t.transparent=e.transparent),void 0!==e.wireframe&&(t.wireframe=e.wireframe),void 0!==e.size&&(t.size=e.size),void 0!==e.sizeAttenuation&&(t.sizeAttenuation=e.sizeAttenuation),void 0!==e.materials)for(var r=0,i=e.materials.length;i>r;r++)t.materials.push(this.parse(e.materials[r]));return t}},n.ObjectLoader=function(e){this.manager=void 0!==e?e:n.DefaultLoadingManager,this.texturePath=""},n.ObjectLoader.prototype={constructor:n.ObjectLoader,load:function(e,t,r,i){""===this.texturePath&&(this.texturePath=e.substring(0,e.lastIndexOf("/")+1));var o=this,a=new n.XHRLoader(o.manager);a.setCrossOrigin(this.crossOrigin),a.load(e,function(e){o.parse(JSON.parse(e),t)},r,i)},setTexturePath:function(e){this.texturePath=e},setCrossOrigin:function(e){this.crossOrigin=e},parse:function(e,t){var r=this.parseGeometries(e.geometries),i=this.parseImages(e.images,function(){void 0!==t&&t(a)}),n=this.parseTextures(e.textures,i),o=this.parseMaterials(e.materials,n),a=this.parseObject(e.object,r,o);return(void 0===e.images||0===e.images.length)&&void 0!==t&&t(a),a},parseGeometries:function(e){var t={};if(void 0!==e)for(var r=new n.JSONLoader,i=new n.BufferGeometryLoader,o=0,a=e.length;a>o;o++){var s,h=e[o];switch(h.type){case"PlaneGeometry":case"PlaneBufferGeometry":s=new n[h.type](h.width,h.height,h.widthSegments,h.heightSegments);break;case"BoxGeometry":case"CubeGeometry":s=new n.BoxGeometry(h.width,h.height,h.depth,h.widthSegments,h.heightSegments,h.depthSegments);break;case"CircleGeometry":s=new n.CircleGeometry(h.radius,h.segments);break;case"CylinderGeometry":s=new n.CylinderGeometry(h.radiusTop,h.radiusBottom,h.height,h.radialSegments,h.heightSegments,h.openEnded);break;case"SphereGeometry":s=new n.SphereGeometry(h.radius,h.widthSegments,h.heightSegments,h.phiStart,h.phiLength,h.thetaStart,h.thetaLength);break;case"IcosahedronGeometry":s=new n.IcosahedronGeometry(h.radius,h.detail);break;case"TorusGeometry":s=new n.TorusGeometry(h.radius,h.tube,h.radialSegments,h.tubularSegments,h.arc);break;case"TorusKnotGeometry":s=new n.TorusKnotGeometry(h.radius,h.tube,h.radialSegments,h.tubularSegments,h.p,h.q,h.heightScale);break;case"BufferGeometry":s=i.parse(h);break;case"Geometry":s=r.parse(h.data).geometry}s.uuid=h.uuid,void 0!==h.name&&(s.name=h.name),t[h.uuid]=s}return t},parseMaterials:function(e,t){var r={};if(void 0!==e)for(var i=function(e){return void 0===t[e]&&n.warn("THREE.ObjectLoader: Undefined texture",e),t[e]},o=new n.MaterialLoader,a=0,s=e.length;s>a;a++){var h=e[a],c=o.parse(h);c.uuid=h.uuid,void 0!==h.name&&(c.name=h.name),void 0!==h.map&&(c.map=i(h.map)),void 0!==h.bumpMap&&(c.bumpMap=i(h.bumpMap),h.bumpScale&&(c.bumpScale=new n.Vector2(h.bumpScale,h.bumpScale))),void 0!==h.alphaMap&&(c.alphaMap=i(h.alphaMap)),void 0!==h.envMap&&(c.envMap=i(h.envMap)),void 0!==h.normalMap&&(c.normalMap=i(h.normalMap),h.normalScale&&(c.normalScale=new n.Vector2(h.normalScale,h.normalScale))),void 0!==h.lightMap&&(c.lightMap=i(h.lightMap)),void 0!==h.specularMap&&(c.specularMap=i(h.specularMap)),r[h.uuid]=c}return r},parseImages:function(e,t){var r=this,i={};if(void 0!==e&&e.length>0){var o=new n.LoadingManager(t),a=new n.ImageLoader(o);a.setCrossOrigin(this.crossOrigin);for(var s=function(e){return r.manager.itemStart(e),a.load(e,function(){r.manager.itemEnd(e)})},h=0,c=e.length;c>h;h++){var l=e[h],u=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(l.url)?l.url:r.texturePath+l.url;i[l.uuid]=s(u)}}return i},parseTextures:function(e,t){var r={};if(void 0!==e)for(var i=0,o=e.length;o>i;i++){var a=e[i];void 0===a.image&&n.warn('THREE.ObjectLoader: No "image" speficied for',a.uuid),void 0===t[a.image]&&n.warn("THREE.ObjectLoader: Undefined image",a.image);var s=new n.Texture(t[a.image]);s.needsUpdate=!0,s.uuid=a.uuid,void 0!==a.name&&(s.name=a.name),void 0!==a.repeat&&(s.repeat=new n.Vector2(a.repeat[0],a.repeat[1])),void 0!==a.minFilter&&(s.minFilter=n[a.minFilter]),void 0!==a.magFilter&&(s.magFilter=n[a.magFilter]),void 0!==a.anisotropy&&(s.anisotropy=a.anisotropy),a.wrap instanceof Array&&(s.wrapS=n[a.wrap[0]],s.wrapT=n[a.wrap[1]]),r[a.uuid]=s}return r},parseObject:function(){var e=new n.Matrix4;return function(t,r,i){var o,a=function(e){return void 0===r[e]&&n.warn("THREE.ObjectLoader: Undefined geometry",e),r[e]},s=function(e){return void 0===i[e]&&n.warn("THREE.ObjectLoader: Undefined material",e),i[e]};switch(t.type){case"Scene":o=new n.Scene;break;case"PerspectiveCamera":o=new n.PerspectiveCamera(t.fov,t.aspect,t.near,t.far);break;case"OrthographicCamera":o=new n.OrthographicCamera(t.left,t.right,t.top,t.bottom,t.near,t.far);break;case"AmbientLight":o=new n.AmbientLight(t.color);break;case"DirectionalLight":o=new n.DirectionalLight(t.color,t.intensity);break;case"PointLight":o=new n.PointLight(t.color,t.intensity,t.distance,t.decay);break;case"SpotLight":o=new n.SpotLight(t.color,t.intensity,t.distance,t.angle,t.exponent,t.decay);break;case"HemisphereLight":o=new n.HemisphereLight(t.color,t.groundColor,t.intensity);break;case"Mesh":o=new n.Mesh(a(t.geometry),s(t.material));break;case"Line":o=new n.Line(a(t.geometry),s(t.material),t.mode);break;case"PointCloud":o=new n.PointCloud(a(t.geometry),s(t.material));break;case"Sprite":o=new n.Sprite(s(t.material));break;case"Group":o=new n.Group;break;default:o=new n.Object3D}if(o.uuid=t.uuid,void 0!==t.name&&(o.name=t.name),void 0!==t.matrix?(e.fromArray(t.matrix),e.decompose(o.position,o.quaternion,o.scale)):(void 0!==t.position&&o.position.fromArray(t.position),void 0!==t.rotation&&o.rotation.fromArray(t.rotation),void 0!==t.scale&&o.scale.fromArray(t.scale)),void 0!==t.visible&&(o.visible=t.visible),void 0!==t.userData&&(o.userData=t.userData),void 0!==t.children)for(var h in t.children)o.add(this.parseObject(t.children[h],r,i));return o}}()},n.TextureLoader=function(e){this.manager=void 0!==e?e:n.DefaultLoadingManager},n.TextureLoader.prototype={constructor:n.TextureLoader,load:function(e,t,r,i){var o=this,a=new n.ImageLoader(o.manager);a.setCrossOrigin(this.crossOrigin),a.load(e,function(e){var r=new n.Texture(e);r.needsUpdate=!0,void 0!==t&&t(r)},r,i)},setCrossOrigin:function(e){this.crossOrigin=e}},n.DataTextureLoader=n.BinaryTextureLoader=function(){this._parser=null},n.BinaryTextureLoader.prototype={constructor:n.BinaryTextureLoader,load:function(e,t,r,i){var o=this,a=new n.DataTexture,s=new n.XHRLoader;return s.setResponseType("arraybuffer"),s.load(e,function(e){var r=o._parser(e);r&&(void 0!==r.image?a.image=r.image:void 0!==r.data&&(a.image.width=r.width,a.image.height=r.height,a.image.data=r.data),a.wrapS=void 0!==r.wrapS?r.wrapS:n.ClampToEdgeWrapping,a.wrapT=void 0!==r.wrapT?r.wrapT:n.ClampToEdgeWrapping,a.magFilter=void 0!==r.magFilter?r.magFilter:n.LinearFilter,a.minFilter=void 0!==r.minFilter?r.minFilter:n.LinearMipMapLinearFilter,a.anisotropy=void 0!==r.anisotropy?r.anisotropy:1,void 0!==r.format&&(a.format=r.format),void 0!==r.type&&(a.type=r.type),void 0!==r.mipmaps&&(a.mipmaps=r.mipmaps),1===r.mipmapCount&&(a.minFilter=n.LinearFilter),a.needsUpdate=!0,t&&t(a,r))},r,i),a}},n.CompressedTextureLoader=function(){this._parser=null},n.CompressedTextureLoader.prototype={constructor:n.CompressedTextureLoader,load:function(e,t,r){var i=this,o=[],a=new n.CompressedTexture;a.image=o;var s=new n.XHRLoader;if(s.setResponseType("arraybuffer"),e instanceof Array)for(var h=0,c=function(r){s.load(e[r],function(e){var s=i._parser(e,!0);o[r]={width:s.width,height:s.height,format:s.format,mipmaps:s.mipmaps},h+=1,6===h&&(1==s.mipmapCount&&(a.minFilter=n.LinearFilter),a.format=s.format,a.needsUpdate=!0,t&&t(a))})},l=0,u=e.length;u>l;++l)c(l);else s.load(e,function(e){var r=i._parser(e,!0);if(r.isCubemap)for(var s=r.mipmaps.length/r.mipmapCount,h=0;s>h;h++){o[h]={mipmaps:[]};for(var c=0;ct;t++)e.materials.push(this.materials[t].toJSON());return e},clone:function(){for(var e=new n.MeshFaceMaterial,t=0;ta){var s=t.closestPointToPoint(e);s.applyMatrix4(o.matrixWorld);var c=r.ray.origin.distanceTo(s);i.push({distance:c,distanceToRay:a,point:s.clone(),index:n,face:null,object:o})}};if(a instanceof n.BufferGeometry){var u=a.attributes,f=u.position.array;if(void 0!==u.index){var p=u.index.array,d=a.offsets;if(0===d.length){var m={start:0,count:p.length,index:0};d=[m]}for(var g=0,v=d.length;v>g;++g)for(var y=d[g].start,x=d[g].count,b=d[g].index,w=y,A=y+x;A>w;w++){var M=b+p[w];c.fromArray(f,3*M),l(c,M)}}else for(var _=f.length/3,w=0;_>w;w++)c.set(f[3*w],f[3*w+1],f[3*w+2]),l(c,w)}else for(var S=this.geometry.vertices,w=0;wA;A+=p){var M=w+m[A],_=w+m[A+1];c.fromArray(g,3*M),l.fromArray(g,3*_);var S=t.distanceSqToSegment(c,l,f,u);if(!(S>s)){var E=t.origin.distanceTo(f);Ei.far||o.push({distance:E,point:u.clone().applyMatrix4(this.matrixWorld),index:A,offsetIndex:y,face:null,faceIndex:null,object:this})}}}else for(var g=d.position.array,A=0;As)){var E=t.origin.distanceTo(f);Ei.far||o.push({distance:E,point:u.clone().applyMatrix4(this.matrixWorld),index:A,face:null,faceIndex:null,object:this})}}}else if(h instanceof n.Geometry)for(var T=h.vertices,C=T.length,A=0;C-1>A;A+=p){var S=t.distanceSqToSegment(T[A],T[A+1],f,u);if(!(S>s)){var E=t.origin.distanceTo(f);Ei.far||o.push({distance:E,point:u.clone().applyMatrix4(this.matrixWorld),index:A,face:null,faceIndex:null,object:this})}}}}}(),n.Line.prototype.clone=function(e){return void 0===e&&(e=new n.Line(this.geometry,this.material,this.mode)),n.Object3D.prototype.clone.call(this,e),e},n.Mesh=function(e,t){n.Object3D.call(this),this.type="Mesh",this.geometry=void 0!==e?e:new n.Geometry,this.material=void 0!==t?t:new n.MeshBasicMaterial({color:16777215*Math.random()}),this.updateMorphTargets()},n.Mesh.prototype=Object.create(n.Object3D.prototype),n.Mesh.prototype.constructor=n.Mesh,n.Mesh.prototype.updateMorphTargets=function(){if(void 0!==this.geometry.morphTargets&&this.geometry.morphTargets.length>0){this.morphTargetBase=-1,this.morphTargetForcedOrder=[],this.morphTargetInfluences=[],this.morphTargetDictionary={};for(var e=0,t=this.geometry.morphTargets.length;t>e;e++)this.morphTargetInfluences.push(0),this.morphTargetDictionary[this.geometry.morphTargets[e].name]=e}},n.Mesh.prototype.getMorphTargetIndexByName=function(e){return void 0!==this.morphTargetDictionary[e]?this.morphTargetDictionary[e]:(n.warn("THREE.Mesh.getMorphTargetIndexByName: morph target "+e+" does not exist. Returning 0."),0)},n.Mesh.prototype.raycast=function(){var e=new n.Matrix4,t=new n.Ray,r=new n.Sphere,i=new n.Vector3,o=new n.Vector3,a=new n.Vector3;return function(s,h){var c=this.geometry;if(null===c.boundingSphere&&c.computeBoundingSphere(),r.copy(c.boundingSphere),r.applyMatrix4(this.matrixWorld),s.ray.isIntersectionSphere(r)!==!1&&(e.getInverse(this.matrixWorld),t.copy(s.ray).applyMatrix4(e),null===c.boundingBox||t.isIntersectionBox(c.boundingBox)!==!1))if(c instanceof n.BufferGeometry){var l=this.material;if(void 0===l)return;var u,f,p,d=c.attributes,m=s.precision;if(void 0!==d.index){var g=d.index.array,v=d.position.array,y=c.offsets;0===y.length&&(y=[{start:0,count:g.length,index:0}]);for(var x=0,b=y.length;b>x;++x)for(var w=y[x].start,A=y[x].count,M=y[x].index,_=w,S=w+A;S>_;_+=3){if(u=M+g[_],f=M+g[_+1],p=M+g[_+2],i.fromArray(v,3*u),o.fromArray(v,3*f),a.fromArray(v,3*p),l.side===n.BackSide)var E=t.intersectTriangle(a,o,i,!0);else var E=t.intersectTriangle(i,o,a,l.side!==n.DoubleSide);if(null!==E){E.applyMatrix4(this.matrixWorld);var T=s.ray.origin.distanceTo(E);m>T||Ts.far||h.push({distance:T,point:E,face:new n.Face3(u,f,p,n.Triangle.normal(i,o,a)),faceIndex:null,object:this})}}}else for(var v=d.position.array,_=0,C=0,S=v.length;S>_;_+=3,C+=9){if(u=_,f=_+1,p=_+2,i.fromArray(v,C),o.fromArray(v,C+3),a.fromArray(v,C+6),l.side===n.BackSide)var E=t.intersectTriangle(a,o,i,!0);else var E=t.intersectTriangle(i,o,a,l.side!==n.DoubleSide);if(null!==E){E.applyMatrix4(this.matrixWorld);var T=s.ray.origin.distanceTo(E);m>T||Ts.far||h.push({distance:T,point:E,face:new n.Face3(u,f,p,n.Triangle.normal(i,o,a)),faceIndex:null,object:this})}}}else if(c instanceof n.Geometry)for(var u,f,p,L=this.material instanceof n.MeshFaceMaterial,P=L===!0?this.material.materials:null,m=s.precision,R=c.vertices,F=0,B=c.faces.length;B>F;F++){var D=c.faces[F],l=L===!0?P[D.materialIndex]:this.material;if(void 0!==l){if(u=R[D.a],f=R[D.b],p=R[D.c],l.morphTargets===!0){var U=c.morphTargets,V=this.morphTargetInfluences;i.set(0,0,0),o.set(0,0,0),a.set(0,0,0);for(var O=0,z=U.length;z>O;O++){var k=V[O];if(0!==k){var N=U[O].vertices;i.x+=(N[D.a].x-u.x)*k,i.y+=(N[D.a].y-u.y)*k,i.z+=(N[D.a].z-u.z)*k,o.x+=(N[D.b].x-f.x)*k,o.y+=(N[D.b].y-f.y)*k,o.z+=(N[D.b].z-f.z)*k,a.x+=(N[D.c].x-p.x)*k,a.y+=(N[D.c].y-p.y)*k,a.z+=(N[D.c].z-p.z)*k}}i.add(u),o.add(f),a.add(p),u=i,f=o,p=a}if(l.side===n.BackSide)var E=t.intersectTriangle(p,f,u,!0);else var E=t.intersectTriangle(u,f,p,l.side!==n.DoubleSide);if(null!==E){E.applyMatrix4(this.matrixWorld);var T=s.ray.origin.distanceTo(E);m>T||Ts.far||h.push({distance:T,point:E,face:D,faceIndex:F,object:this})}}}}}(),n.Mesh.prototype.clone=function(e,t){return void 0===e&&(e=new n.Mesh(this.geometry,this.material)),n.Object3D.prototype.clone.call(this,e,t),e},n.Bone=function(e){n.Object3D.call(this),this.type="Bone",this.skin=e},n.Bone.prototype=Object.create(n.Object3D.prototype),n.Bone.prototype.constructor=n.Bone,n.Skeleton=function(e,t,r){if(this.useVertexTexture=void 0!==r?r:!0,this.identityMatrix=new n.Matrix4,e=e||[],this.bones=e.slice(0),this.useVertexTexture){var i;i=this.bones.length>256?64:this.bones.length>64?32:this.bones.length>16?16:8,this.boneTextureWidth=i,this.boneTextureHeight=i,this.boneMatrices=new Float32Array(this.boneTextureWidth*this.boneTextureHeight*4),this.boneTexture=new n.DataTexture(this.boneMatrices,this.boneTextureWidth,this.boneTextureHeight,n.RGBAFormat,n.FloatType),this.boneTexture.minFilter=n.NearestFilter,this.boneTexture.magFilter=n.NearestFilter,this.boneTexture.generateMipmaps=!1,this.boneTexture.flipY=!1}else this.boneMatrices=new Float32Array(16*this.bones.length);if(void 0===t)this.calculateInverses();else if(this.bones.length===t.length)this.boneInverses=t.slice(0);else{n.warn("THREE.Skeleton bonInverses is the wrong length."),this.boneInverses=[];for(var o=0,a=this.bones.length;a>o;o++)this.boneInverses.push(new n.Matrix4)}},n.Skeleton.prototype.calculateInverses=function(){this.boneInverses=[];for(var e=0,t=this.bones.length;t>e;e++){var r=new n.Matrix4;this.bones[e]&&r.getInverse(this.bones[e].matrixWorld),this.boneInverses.push(r)}},n.Skeleton.prototype.pose=function(){for(var e,t=0,r=this.bones.length;r>t;t++)e=this.bones[t],e&&e.matrixWorld.getInverse(this.boneInverses[t]);for(var t=0,r=this.bones.length;r>t;t++)e=this.bones[t],e&&(e.parent?(e.matrix.getInverse(e.parent.matrixWorld),e.matrix.multiply(e.matrixWorld)):e.matrix.copy(e.matrixWorld),e.matrix.decompose(e.position,e.quaternion,e.scale))},n.Skeleton.prototype.update=function(){var e=new n.Matrix4;return function(){for(var t=0,r=this.bones.length;r>t;t++){var i=this.bones[t]?this.bones[t].matrixWorld:this.identityMatrix;e.multiplyMatrices(i,this.boneInverses[t]),e.flattenToArrayOffset(this.boneMatrices,16*t)}this.useVertexTexture&&(this.boneTexture.needsUpdate=!0)}}(),n.SkinnedMesh=function(e,t,r){n.Mesh.call(this,e,t),this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new n.Matrix4,this.bindMatrixInverse=new n.Matrix4;var i=[];if(this.geometry&&void 0!==this.geometry.bones){for(var o,a,s,h,c,l=0,u=this.geometry.bones.length;u>l;++l)a=this.geometry.bones[l],s=a.pos,h=a.rotq,c=a.scl,o=new n.Bone(this),i.push(o),o.name=a.name,o.position.set(s[0],s[1],s[2]),o.quaternion.set(h[0],h[1],h[2],h[3]),void 0!==c?o.scale.set(c[0],c[1],c[2]):o.scale.set(1,1,1);for(var l=0,u=this.geometry.bones.length;u>l;++l)a=this.geometry.bones[l],-1!==a.parent?i[a.parent].add(i[l]):this.add(i[l])}this.normalizeSkinWeights(),this.updateMatrixWorld(!0),this.bind(new n.Skeleton(i,void 0,r))},n.SkinnedMesh.prototype=Object.create(n.Mesh.prototype),n.SkinnedMesh.prototype.constructor=n.SkinnedMesh,n.SkinnedMesh.prototype.bind=function(e,t){this.skeleton=e,void 0===t&&(this.updateMatrixWorld(!0),t=this.matrixWorld),this.bindMatrix.copy(t),this.bindMatrixInverse.getInverse(t)},n.SkinnedMesh.prototype.pose=function(){this.skeleton.pose()},n.SkinnedMesh.prototype.normalizeSkinWeights=function(){if(this.geometry instanceof n.Geometry)for(var e=0;en;n++){var a=e.morphTargets[n],s=a.name.match(i);if(s&&s.length>1){var h=s[1];r[h]||(r[h]={start:1/0,end:-(1/0)});var c=r[h];nc.end&&(c.end=n),t||(t=h)}}e.firstAnimation=t},n.MorphAnimMesh.prototype.setAnimationLabel=function(e,t,r){this.geometry.animations||(this.geometry.animations={}),this.geometry.animations[e]={start:t,end:r}},n.MorphAnimMesh.prototype.playAnimation=function(e,t){var r=this.geometry.animations[e];r?(this.setFrameRange(r.start,r.end),this.duration=1e3*((r.end-r.start)/t),this.time=0):n.warn("THREE.MorphAnimMesh: animation["+e+"] undefined in .playAnimation()")},n.MorphAnimMesh.prototype.updateAnimation=function(e){var t=this.duration/this.length;this.time+=this.direction*e,this.mirroredLoop?(this.time>this.duration||this.time<0)&&(this.direction*=-1,this.time>this.duration&&(this.time=this.duration,this.directionBackwards=!0),this.time<0&&(this.time=0,this.directionBackwards=!1)):(this.time=this.time%this.duration,this.time<0&&(this.time+=this.duration));var r=this.startKeyframe+n.Math.clamp(Math.floor(this.time/t),0,this.length-1);r!==this.currentKeyframe&&(this.morphTargetInfluences[this.lastKeyframe]=0,this.morphTargetInfluences[this.currentKeyframe]=1,this.morphTargetInfluences[r]=0,this.lastKeyframe=this.currentKeyframe,this.currentKeyframe=r);var i=this.time%t/t;this.directionBackwards&&(i=1-i),this.morphTargetInfluences[this.currentKeyframe]=i,this.morphTargetInfluences[this.lastKeyframe]=1-i},n.MorphAnimMesh.prototype.interpolateTargets=function(e,t,r){for(var i=this.morphTargetInfluences,n=0,o=i.length;o>n;n++)i[n]=0;e>-1&&(i[e]=1-r),t>-1&&(i[t]=r)},n.MorphAnimMesh.prototype.clone=function(e){return void 0===e&&(e=new n.MorphAnimMesh(this.geometry,this.material)),e.duration=this.duration,e.mirroredLoop=this.mirroredLoop,e.time=this.time,e.lastKeyframe=this.lastKeyframe,e.currentKeyframe=this.currentKeyframe,e.direction=this.direction,e.directionBackwards=this.directionBackwards,n.Mesh.prototype.clone.call(this,e),e},n.LOD=function(){n.Object3D.call(this),this.objects=[]},n.LOD.prototype=Object.create(n.Object3D.prototype),n.LOD.prototype.constructor=n.LOD,n.LOD.prototype.addLevel=function(e,t){void 0===t&&(t=0),t=Math.abs(t);for(var r=0;rt&&!(e1){e.setFromMatrixPosition(r.matrixWorld),t.setFromMatrixPosition(this.matrixWorld);var i=e.distanceTo(t);this.objects[0].object.visible=!0;for(var n=1,o=this.objects.length;o>n&&i>=this.objects[n].distance;n++)this.objects[n-1].object.visible=!1,this.objects[n].object.visible=!0;for(;o>n;n++)this.objects[n].object.visible=!1}}}(),n.LOD.prototype.clone=function(e){void 0===e&&(e=new n.LOD),n.Object3D.prototype.clone.call(this,e);for(var t=0,r=this.objects.length;r>t;t++){var i=this.objects[t].object.clone();i.visible=0===t,e.addLevel(i,this.objects[t].distance)}return e},n.Sprite=function(){var e=new Uint16Array([0,1,2,0,2,3]),t=new Float32Array([-.5,-.5,0,.5,-.5,0,.5,.5,0,-.5,.5,0]),r=new Float32Array([0,0,1,0,1,1,0,1]),i=new n.BufferGeometry;return i.addAttribute("index",new n.BufferAttribute(e,1)),i.addAttribute("position",new n.BufferAttribute(t,3)),i.addAttribute("uv",new n.BufferAttribute(r,2)),function(e){n.Object3D.call(this),this.type="Sprite",this.geometry=i,this.material=void 0!==e?e:new n.SpriteMaterial}}(),n.Sprite.prototype=Object.create(n.Object3D.prototype),n.Sprite.prototype.constructor=n.Sprite,n.Sprite.prototype.raycast=function(){var e=new n.Vector3;return function(t,r){e.setFromMatrixPosition(this.matrixWorld);var i=t.ray.distanceToPoint(e);i>this.scale.x||r.push({distance:i,point:this.position,face:null,object:this})}}(),n.Sprite.prototype.clone=function(e){return void 0===e&&(e=new n.Sprite(this.material)),n.Object3D.prototype.clone.call(this,e),e},n.Particle=n.Sprite,n.LensFlare=function(e,t,r,i,o){n.Object3D.call(this),this.lensFlares=[],this.positionScreen=new n.Vector3,this.customUpdateCallback=void 0,void 0!==e&&this.add(e,t,r,i,o)},n.LensFlare.prototype=Object.create(n.Object3D.prototype),n.LensFlare.prototype.constructor=n.LensFlare,n.LensFlare.prototype.add=function(e,t,r,i,o,a){void 0===t&&(t=-1),void 0===r&&(r=0),void 0===a&&(a=1),void 0===o&&(o=new n.Color(16777215)),void 0===i&&(i=n.NormalBlending),r=Math.min(r,Math.max(0,r)),this.lensFlares.push({texture:e,size:t,distance:r,x:0,y:0,z:0,scale:1,rotation:1,opacity:a,color:o,blending:i})},n.LensFlare.prototype.updateLensFlares=function(){var e,t,r=this.lensFlares.length,i=2*-this.positionScreen.x,n=2*-this.positionScreen.y;for(e=0;r>e;e++)t=this.lensFlares[e],t.x=this.positionScreen.x+i*t.distance,t.y=this.positionScreen.y+n*t.distance,t.wantedRotation=t.x*Math.PI*.25,t.rotation+=.25*(t.wantedRotation-t.rotation)},n.Scene=function(){n.Object3D.call(this),this.type="Scene",this.fog=null,this.overrideMaterial=null,this.autoUpdate=!0},n.Scene.prototype=Object.create(n.Object3D.prototype),n.Scene.prototype.constructor=n.Scene,n.Scene.prototype.clone=function(e){return void 0===e&&(e=new n.Scene),n.Object3D.prototype.clone.call(this,e),null!==this.fog&&(e.fog=this.fog.clone()),null!==this.overrideMaterial&&(e.overrideMaterial=this.overrideMaterial.clone()),e.autoUpdate=this.autoUpdate,e.matrixAutoUpdate=this.matrixAutoUpdate,e},n.Fog=function(e,t,r){this.name="",this.color=new n.Color(e),this.near=void 0!==t?t:1,this.far=void 0!==r?r:1e3},n.Fog.prototype.clone=function(){return new n.Fog(this.color.getHex(),this.near,this.far)},n.FogExp2=function(e,t){this.name="",this.color=new n.Color(e),this.density=void 0!==t?t:25e-5},n.FogExp2.prototype.clone=function(){return new n.FogExp2(this.color.getHex(),this.density)},n.ShaderChunk={},n.ShaderChunk.common="#define PI 3.14159\n#define PI2 6.28318\n#define RECIPROCAL_PI2 0.15915494\n#define LOG2 1.442695\n#define EPSILON 1e-6\n\nfloat square( in float a ) { return a*a; }\nvec2 square( in vec2 a ) { return vec2( a.x*a.x, a.y*a.y ); }\nvec3 square( in vec3 a ) { return vec3( a.x*a.x, a.y*a.y, a.z*a.z ); }\nvec4 square( in vec4 a ) { return vec4( a.x*a.x, a.y*a.y, a.z*a.z, a.w*a.w ); }\nfloat saturate( in float a ) { return clamp( a, 0.0, 1.0 ); }\nvec2 saturate( in vec2 a ) { return clamp( a, 0.0, 1.0 ); }\nvec3 saturate( in vec3 a ) { return clamp( a, 0.0, 1.0 ); }\nvec4 saturate( in vec4 a ) { return clamp( a, 0.0, 1.0 ); }\nfloat average( in float a ) { return a; }\nfloat average( in vec2 a ) { return ( a.x + a.y) * 0.5; }\nfloat average( in vec3 a ) { return ( a.x + a.y + a.z) / 3.0; }\nfloat average( in vec4 a ) { return ( a.x + a.y + a.z + a.w) * 0.25; }\nfloat whiteCompliment( in float a ) { return saturate( 1.0 - a ); }\nvec2 whiteCompliment( in vec2 a ) { return saturate( vec2(1.0) - a ); }\nvec3 whiteCompliment( in vec3 a ) { return saturate( vec3(1.0) - a ); }\nvec4 whiteCompliment( in vec4 a ) { return saturate( vec4(1.0) - a ); }\nvec3 transformDirection( in vec3 normal, in mat4 matrix ) {\n return normalize( ( matrix * vec4( normal, 0.0 ) ).xyz );\n}\n// http://en.wikibooks.org/wiki/GLSL_Programming/Applying_Matrix_Transformations\nvec3 inverseTransformDirection( in vec3 normal, in mat4 matrix ) {\n return normalize( ( vec4( normal, 0.0 ) * matrix ).xyz );\n}\nvec3 projectOnPlane(in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal) {\n float distance = dot( planeNormal, point-pointOnPlane );\n return point - distance * planeNormal;\n}\nfloat sideOfPlane( in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n return sign( dot( point - pointOnPlane, planeNormal ) );\n}\nvec3 linePlaneIntersect( in vec3 pointOnLine, in vec3 lineDirection, in vec3 pointOnPlane, in vec3 planeNormal ) {\n return pointOnLine + lineDirection * ( dot( planeNormal, pointOnPlane - pointOnLine ) / dot( planeNormal, lineDirection ) );\n}\nfloat calcLightAttenuation( float lightDistance, float cutoffDistance, float decayExponent ) {\n if ( decayExponent > 0.0 ) {\n return pow( saturate( 1.0 - lightDistance / cutoffDistance ), decayExponent );\n }\n return 1.0;\n}\n\nvec3 inputToLinear( in vec3 a ) {\n#ifdef GAMMA_INPUT\n return pow( a, vec3( float( GAMMA_FACTOR ) ) );\n#else\n return a;\n#endif\n}\nvec3 linearToOutput( in vec3 a ) {\n#ifdef GAMMA_OUTPUT\n return pow( a, vec3( 1.0 / float( GAMMA_FACTOR ) ) );\n#else\n return a;\n#endif\n}\n",n.ShaderChunk.alphatest_fragment="#ifdef ALPHATEST\n\n if ( diffuseColor.a < ALPHATEST ) discard;\n\n#endif\n",n.ShaderChunk.lights_lambert_vertex="vLightFront = vec3( 0.0 );\n\n#ifdef DOUBLE_SIDED\n\n vLightBack = vec3( 0.0 );\n\n#endif\n\ntransformedNormal = normalize( transformedNormal );\n\n#if MAX_DIR_LIGHTS > 0\n\nfor( int i = 0; i < MAX_DIR_LIGHTS; i ++ ) {\n\n vec3 dirVector = transformDirection( directionalLightDirection[ i ], viewMatrix );\n\n float dotProduct = dot( transformedNormal, dirVector );\n vec3 directionalLightWeighting = vec3( max( dotProduct, 0.0 ) );\n\n #ifdef DOUBLE_SIDED\n\n vec3 directionalLightWeightingBack = vec3( max( -dotProduct, 0.0 ) );\n\n #ifdef WRAP_AROUND\n\n vec3 directionalLightWeightingHalfBack = vec3( max( -0.5 * dotProduct + 0.5, 0.0 ) );\n\n #endif\n\n #endif\n\n #ifdef WRAP_AROUND\n\n vec3 directionalLightWeightingHalf = vec3( max( 0.5 * dotProduct + 0.5, 0.0 ) );\n directionalLightWeighting = mix( directionalLightWeighting, directionalLightWeightingHalf, wrapRGB );\n\n #ifdef DOUBLE_SIDED\n\n directionalLightWeightingBack = mix( directionalLightWeightingBack, directionalLightWeightingHalfBack, wrapRGB );\n\n #endif\n\n #endif\n\n vLightFront += directionalLightColor[ i ] * directionalLightWeighting;\n\n #ifdef DOUBLE_SIDED\n\n vLightBack += directionalLightColor[ i ] * directionalLightWeightingBack;\n\n #endif\n\n}\n\n#endif\n\n#if MAX_POINT_LIGHTS > 0\n\n for( int i = 0; i < MAX_POINT_LIGHTS; i ++ ) {\n\n vec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );\n vec3 lVector = lPosition.xyz - mvPosition.xyz;\n\n float attenuation = calcLightAttenuation( length( lVector ), pointLightDistance[ i ], pointLightDecay[ i ] );\n\n lVector = normalize( lVector );\n float dotProduct = dot( transformedNormal, lVector );\n\n vec3 pointLightWeighting = vec3( max( dotProduct, 0.0 ) );\n\n #ifdef DOUBLE_SIDED\n\n vec3 pointLightWeightingBack = vec3( max( -dotProduct, 0.0 ) );\n\n #ifdef WRAP_AROUND\n\n vec3 pointLightWeightingHalfBack = vec3( max( -0.5 * dotProduct + 0.5, 0.0 ) );\n\n #endif\n\n #endif\n\n #ifdef WRAP_AROUND\n\n vec3 pointLightWeightingHalf = vec3( max( 0.5 * dotProduct + 0.5, 0.0 ) );\n pointLightWeighting = mix( pointLightWeighting, pointLightWeightingHalf, wrapRGB );\n\n #ifdef DOUBLE_SIDED\n\n pointLightWeightingBack = mix( pointLightWeightingBack, pointLightWeightingHalfBack, wrapRGB );\n\n #endif\n\n #endif\n\n vLightFront += pointLightColor[ i ] * pointLightWeighting * attenuation;\n\n #ifdef DOUBLE_SIDED\n\n vLightBack += pointLightColor[ i ] * pointLightWeightingBack * attenuation;\n\n #endif\n\n }\n\n#endif\n\n#if MAX_SPOT_LIGHTS > 0\n\n for( int i = 0; i < MAX_SPOT_LIGHTS; i ++ ) {\n\n vec4 lPosition = viewMatrix * vec4( spotLightPosition[ i ], 1.0 );\n vec3 lVector = lPosition.xyz - mvPosition.xyz;\n\n float spotEffect = dot( spotLightDirection[ i ], normalize( spotLightPosition[ i ] - worldPosition.xyz ) );\n\n if ( spotEffect > spotLightAngleCos[ i ] ) {\n\n spotEffect = max( pow( max( spotEffect, 0.0 ), spotLightExponent[ i ] ), 0.0 );\n\n float attenuation = calcLightAttenuation( length( lVector ), spotLightDistance[ i ], spotLightDecay[ i ] );\n\n lVector = normalize( lVector );\n\n float dotProduct = dot( transformedNormal, lVector );\n vec3 spotLightWeighting = vec3( max( dotProduct, 0.0 ) );\n\n #ifdef DOUBLE_SIDED\n\n vec3 spotLightWeightingBack = vec3( max( -dotProduct, 0.0 ) );\n\n #ifdef WRAP_AROUND\n\n vec3 spotLightWeightingHalfBack = vec3( max( -0.5 * dotProduct + 0.5, 0.0 ) );\n\n #endif\n\n #endif\n\n #ifdef WRAP_AROUND\n\n vec3 spotLightWeightingHalf = vec3( max( 0.5 * dotProduct + 0.5, 0.0 ) );\n spotLightWeighting = mix( spotLightWeighting, spotLightWeightingHalf, wrapRGB );\n\n #ifdef DOUBLE_SIDED\n\n spotLightWeightingBack = mix( spotLightWeightingBack, spotLightWeightingHalfBack, wrapRGB );\n\n #endif\n\n #endif\n\n vLightFront += spotLightColor[ i ] * spotLightWeighting * attenuation * spotEffect;\n\n #ifdef DOUBLE_SIDED\n\n vLightBack += spotLightColor[ i ] * spotLightWeightingBack * attenuation * spotEffect;\n\n #endif\n\n }\n\n }\n\n#endif\n\n#if MAX_HEMI_LIGHTS > 0\n\n for( int i = 0; i < MAX_HEMI_LIGHTS; i ++ ) {\n\n vec3 lVector = transformDirection( hemisphereLightDirection[ i ], viewMatrix );\n\n float dotProduct = dot( transformedNormal, lVector );\n\n float hemiDiffuseWeight = 0.5 * dotProduct + 0.5;\n float hemiDiffuseWeightBack = -0.5 * dotProduct + 0.5;\n\n vLightFront += mix( hemisphereLightGroundColor[ i ], hemisphereLightSkyColor[ i ], hemiDiffuseWeight );\n\n #ifdef DOUBLE_SIDED\n\n vLightBack += mix( hemisphereLightGroundColor[ i ], hemisphereLightSkyColor[ i ], hemiDiffuseWeightBack );\n\n #endif\n\n }\n\n#endif\n\nvLightFront += ambientLightColor;\n\n#ifdef DOUBLE_SIDED\n\n vLightBack += ambientLightColor;\n\n#endif\n", -n.ShaderChunk.map_particle_pars_fragment="#ifdef USE_MAP\n\n uniform vec4 offsetRepeat;\n uniform sampler2D map;\n\n#endif\n",n.ShaderChunk.default_vertex="#ifdef USE_SKINNING\n\n vec4 mvPosition = modelViewMatrix * skinned;\n\n#elif defined( USE_MORPHTARGETS )\n\n vec4 mvPosition = modelViewMatrix * vec4( morphed, 1.0 );\n\n#else\n\n vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n\n#endif\n\ngl_Position = projectionMatrix * mvPosition;\n",n.ShaderChunk.map_pars_fragment="#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP )\n\n varying vec2 vUv;\n\n#endif\n\n#ifdef USE_MAP\n\n uniform sampler2D map;\n\n#endif",n.ShaderChunk.skinnormal_vertex="#ifdef USE_SKINNING\n\n mat4 skinMatrix = mat4( 0.0 );\n skinMatrix += skinWeight.x * boneMatX;\n skinMatrix += skinWeight.y * boneMatY;\n skinMatrix += skinWeight.z * boneMatZ;\n skinMatrix += skinWeight.w * boneMatW;\n skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n\n #ifdef USE_MORPHNORMALS\n\n vec4 skinnedNormal = skinMatrix * vec4( morphedNormal, 0.0 );\n\n #else\n\n vec4 skinnedNormal = skinMatrix * vec4( normal, 0.0 );\n\n #endif\n\n#endif\n",n.ShaderChunk.logdepthbuf_pars_vertex="#ifdef USE_LOGDEPTHBUF\n\n #ifdef USE_LOGDEPTHBUF_EXT\n\n varying float vFragDepth;\n\n #endif\n\n uniform float logDepthBufFC;\n\n#endif",n.ShaderChunk.lightmap_pars_vertex="#ifdef USE_LIGHTMAP\n\n varying vec2 vUv2;\n\n#endif",n.ShaderChunk.lights_phong_fragment="#ifndef FLAT_SHADED\n\n vec3 normal = normalize( vNormal );\n\n #ifdef DOUBLE_SIDED\n\n normal = normal * ( -1.0 + 2.0 * float( gl_FrontFacing ) );\n\n #endif\n\n#else\n\n vec3 fdx = dFdx( vViewPosition );\n vec3 fdy = dFdy( vViewPosition );\n vec3 normal = normalize( cross( fdx, fdy ) );\n\n#endif\n\nvec3 viewPosition = normalize( vViewPosition );\n\n#ifdef USE_NORMALMAP\n\n normal = perturbNormal2Arb( -vViewPosition, normal );\n\n#elif defined( USE_BUMPMAP )\n\n normal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd() );\n\n#endif\n\nvec3 totalDiffuseLight = vec3( 0.0 );\nvec3 totalSpecularLight = vec3( 0.0 );\n\n#if MAX_POINT_LIGHTS > 0\n\n for ( int i = 0; i < MAX_POINT_LIGHTS; i ++ ) {\n\n vec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );\n vec3 lVector = lPosition.xyz + vViewPosition.xyz;\n\n float attenuation = calcLightAttenuation( length( lVector ), pointLightDistance[ i ], pointLightDecay[ i ] );\n\n lVector = normalize( lVector );\n\n // diffuse\n\n float dotProduct = dot( normal, lVector );\n\n #ifdef WRAP_AROUND\n\n float pointDiffuseWeightFull = max( dotProduct, 0.0 );\n float pointDiffuseWeightHalf = max( 0.5 * dotProduct + 0.5, 0.0 );\n\n vec3 pointDiffuseWeight = mix( vec3( pointDiffuseWeightFull ), vec3( pointDiffuseWeightHalf ), wrapRGB );\n\n #else\n\n float pointDiffuseWeight = max( dotProduct, 0.0 );\n\n #endif\n\n totalDiffuseLight += pointLightColor[ i ] * pointDiffuseWeight * attenuation;\n\n // specular\n\n vec3 pointHalfVector = normalize( lVector + viewPosition );\n float pointDotNormalHalf = max( dot( normal, pointHalfVector ), 0.0 );\n float pointSpecularWeight = specularStrength * max( pow( pointDotNormalHalf, shininess ), 0.0 );\n\n float specularNormalization = ( shininess + 2.0 ) / 8.0;\n\n vec3 schlick = specular + vec3( 1.0 - specular ) * pow( max( 1.0 - dot( lVector, pointHalfVector ), 0.0 ), 5.0 );\n totalSpecularLight += schlick * pointLightColor[ i ] * pointSpecularWeight * pointDiffuseWeight * attenuation * specularNormalization;\n\n }\n\n#endif\n\n#if MAX_SPOT_LIGHTS > 0\n\n for ( int i = 0; i < MAX_SPOT_LIGHTS; i ++ ) {\n\n vec4 lPosition = viewMatrix * vec4( spotLightPosition[ i ], 1.0 );\n vec3 lVector = lPosition.xyz + vViewPosition.xyz;\n\n float attenuation = calcLightAttenuation( length( lVector ), spotLightDistance[ i ], spotLightDecay[ i ] );\n\n lVector = normalize( lVector );\n\n float spotEffect = dot( spotLightDirection[ i ], normalize( spotLightPosition[ i ] - vWorldPosition ) );\n\n if ( spotEffect > spotLightAngleCos[ i ] ) {\n\n spotEffect = max( pow( max( spotEffect, 0.0 ), spotLightExponent[ i ] ), 0.0 );\n\n // diffuse\n\n float dotProduct = dot( normal, lVector );\n\n #ifdef WRAP_AROUND\n\n float spotDiffuseWeightFull = max( dotProduct, 0.0 );\n float spotDiffuseWeightHalf = max( 0.5 * dotProduct + 0.5, 0.0 );\n\n vec3 spotDiffuseWeight = mix( vec3( spotDiffuseWeightFull ), vec3( spotDiffuseWeightHalf ), wrapRGB );\n\n #else\n\n float spotDiffuseWeight = max( dotProduct, 0.0 );\n\n #endif\n\n totalDiffuseLight += spotLightColor[ i ] * spotDiffuseWeight * attenuation * spotEffect;\n\n // specular\n\n vec3 spotHalfVector = normalize( lVector + viewPosition );\n float spotDotNormalHalf = max( dot( normal, spotHalfVector ), 0.0 );\n float spotSpecularWeight = specularStrength * max( pow( spotDotNormalHalf, shininess ), 0.0 );\n\n float specularNormalization = ( shininess + 2.0 ) / 8.0;\n\n vec3 schlick = specular + vec3( 1.0 - specular ) * pow( max( 1.0 - dot( lVector, spotHalfVector ), 0.0 ), 5.0 );\n totalSpecularLight += schlick * spotLightColor[ i ] * spotSpecularWeight * spotDiffuseWeight * attenuation * specularNormalization * spotEffect;\n\n }\n\n }\n\n#endif\n\n#if MAX_DIR_LIGHTS > 0\n\n for( int i = 0; i < MAX_DIR_LIGHTS; i ++ ) {\n\n vec3 dirVector = transformDirection( directionalLightDirection[ i ], viewMatrix );\n\n // diffuse\n\n float dotProduct = dot( normal, dirVector );\n\n #ifdef WRAP_AROUND\n\n float dirDiffuseWeightFull = max( dotProduct, 0.0 );\n float dirDiffuseWeightHalf = max( 0.5 * dotProduct + 0.5, 0.0 );\n\n vec3 dirDiffuseWeight = mix( vec3( dirDiffuseWeightFull ), vec3( dirDiffuseWeightHalf ), wrapRGB );\n\n #else\n\n float dirDiffuseWeight = max( dotProduct, 0.0 );\n\n #endif\n\n totalDiffuseLight += directionalLightColor[ i ] * dirDiffuseWeight;\n\n // specular\n\n vec3 dirHalfVector = normalize( dirVector + viewPosition );\n float dirDotNormalHalf = max( dot( normal, dirHalfVector ), 0.0 );\n float dirSpecularWeight = specularStrength * max( pow( dirDotNormalHalf, shininess ), 0.0 );\n\n /*\n // fresnel term from skin shader\n const float F0 = 0.128;\n\n float base = 1.0 - dot( viewPosition, dirHalfVector );\n float exponential = pow( base, 5.0 );\n\n float fresnel = exponential + F0 * ( 1.0 - exponential );\n */\n\n /*\n // fresnel term from fresnel shader\n const float mFresnelBias = 0.08;\n const float mFresnelScale = 0.3;\n const float mFresnelPower = 5.0;\n\n float fresnel = mFresnelBias + mFresnelScale * pow( 1.0 + dot( normalize( -viewPosition ), normal ), mFresnelPower );\n */\n\n float specularNormalization = ( shininess + 2.0 ) / 8.0;\n\n // dirSpecular += specular * directionalLightColor[ i ] * dirSpecularWeight * dirDiffuseWeight * specularNormalization * fresnel;\n\n vec3 schlick = specular + vec3( 1.0 - specular ) * pow( max( 1.0 - dot( dirVector, dirHalfVector ), 0.0 ), 5.0 );\n totalSpecularLight += schlick * directionalLightColor[ i ] * dirSpecularWeight * dirDiffuseWeight * specularNormalization;\n\n\n }\n\n#endif\n\n#if MAX_HEMI_LIGHTS > 0\n\n for( int i = 0; i < MAX_HEMI_LIGHTS; i ++ ) {\n\n vec3 lVector = transformDirection( hemisphereLightDirection[ i ], viewMatrix );\n\n // diffuse\n\n float dotProduct = dot( normal, lVector );\n float hemiDiffuseWeight = 0.5 * dotProduct + 0.5;\n\n vec3 hemiColor = mix( hemisphereLightGroundColor[ i ], hemisphereLightSkyColor[ i ], hemiDiffuseWeight );\n\n totalDiffuseLight += hemiColor;\n\n // specular (sky light)\n\n vec3 hemiHalfVectorSky = normalize( lVector + viewPosition );\n float hemiDotNormalHalfSky = 0.5 * dot( normal, hemiHalfVectorSky ) + 0.5;\n float hemiSpecularWeightSky = specularStrength * max( pow( max( hemiDotNormalHalfSky, 0.0 ), shininess ), 0.0 );\n\n // specular (ground light)\n\n vec3 lVectorGround = -lVector;\n\n vec3 hemiHalfVectorGround = normalize( lVectorGround + viewPosition );\n float hemiDotNormalHalfGround = 0.5 * dot( normal, hemiHalfVectorGround ) + 0.5;\n float hemiSpecularWeightGround = specularStrength * max( pow( max( hemiDotNormalHalfGround, 0.0 ), shininess ), 0.0 );\n\n float dotProductGround = dot( normal, lVectorGround );\n\n float specularNormalization = ( shininess + 2.0 ) / 8.0;\n\n vec3 schlickSky = specular + vec3( 1.0 - specular ) * pow( max( 1.0 - dot( lVector, hemiHalfVectorSky ), 0.0 ), 5.0 );\n vec3 schlickGround = specular + vec3( 1.0 - specular ) * pow( max( 1.0 - dot( lVectorGround, hemiHalfVectorGround ), 0.0 ), 5.0 );\n totalSpecularLight += hemiColor * specularNormalization * ( schlickSky * hemiSpecularWeightSky * max( dotProduct, 0.0 ) + schlickGround * hemiSpecularWeightGround * max( dotProductGround, 0.0 ) );\n\n }\n\n#endif\n\n#ifdef METAL\n\n outgoingLight += diffuseColor.rgb * ( totalDiffuseLight + ambientLightColor ) * specular + totalSpecularLight + emissive;\n\n#else\n\n outgoingLight += diffuseColor.rgb * ( totalDiffuseLight + ambientLightColor ) + totalSpecularLight + emissive;\n\n#endif\n",n.ShaderChunk.fog_pars_fragment="#ifdef USE_FOG\n\n uniform vec3 fogColor;\n\n #ifdef FOG_EXP2\n\n uniform float fogDensity;\n\n #else\n\n uniform float fogNear;\n uniform float fogFar;\n #endif\n\n#endif",n.ShaderChunk.morphnormal_vertex="#ifdef USE_MORPHNORMALS\n\n vec3 morphedNormal = vec3( 0.0 );\n\n morphedNormal += ( morphNormal0 - normal ) * morphTargetInfluences[ 0 ];\n morphedNormal += ( morphNormal1 - normal ) * morphTargetInfluences[ 1 ];\n morphedNormal += ( morphNormal2 - normal ) * morphTargetInfluences[ 2 ];\n morphedNormal += ( morphNormal3 - normal ) * morphTargetInfluences[ 3 ];\n\n morphedNormal += normal;\n\n#endif",n.ShaderChunk.envmap_pars_fragment="#ifdef USE_ENVMAP\n\n uniform float reflectivity;\n #ifdef ENVMAP_TYPE_CUBE\n uniform samplerCube envMap;\n #else\n uniform sampler2D envMap;\n #endif\n uniform float flipEnvMap;\n\n #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\n uniform float refractionRatio;\n\n #else\n\n varying vec3 vReflect;\n\n #endif\n\n#endif\n",n.ShaderChunk.logdepthbuf_fragment="#if defined(USE_LOGDEPTHBUF) && defined(USE_LOGDEPTHBUF_EXT)\n\n gl_FragDepthEXT = log2(vFragDepth) * logDepthBufFC * 0.5;\n\n#endif",n.ShaderChunk.normalmap_pars_fragment="#ifdef USE_NORMALMAP\n\n uniform sampler2D normalMap;\n uniform vec2 normalScale;\n\n // Per-Pixel Tangent Space Normal Mapping\n // http://hacksoflife.blogspot.ch/2009/11/per-pixel-tangent-space-normal-mapping.html\n\n vec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm ) {\n\n vec3 q0 = dFdx( eye_pos.xyz );\n vec3 q1 = dFdy( eye_pos.xyz );\n vec2 st0 = dFdx( vUv.st );\n vec2 st1 = dFdy( vUv.st );\n\n vec3 S = normalize( q0 * st1.t - q1 * st0.t );\n vec3 T = normalize( -q0 * st1.s + q1 * st0.s );\n vec3 N = normalize( surf_norm );\n\n vec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n mapN.xy = normalScale * mapN.xy;\n mat3 tsn = mat3( S, T, N );\n return normalize( tsn * mapN );\n\n }\n\n#endif\n",n.ShaderChunk.lights_phong_pars_vertex="#if MAX_SPOT_LIGHTS > 0 || defined( USE_BUMPMAP ) || defined( USE_ENVMAP )\n\n varying vec3 vWorldPosition;\n\n#endif\n",n.ShaderChunk.lightmap_pars_fragment="#ifdef USE_LIGHTMAP\n\n varying vec2 vUv2;\n uniform sampler2D lightMap;\n\n#endif",n.ShaderChunk.shadowmap_vertex="#ifdef USE_SHADOWMAP\n\n for( int i = 0; i < MAX_SHADOWS; i ++ ) {\n\n vShadowCoord[ i ] = shadowMatrix[ i ] * worldPosition;\n\n }\n\n#endif",n.ShaderChunk.lights_phong_vertex="#if MAX_SPOT_LIGHTS > 0 || defined( USE_BUMPMAP ) || defined( USE_ENVMAP )\n\n vWorldPosition = worldPosition.xyz;\n\n#endif",n.ShaderChunk.map_fragment="#ifdef USE_MAP\n\n vec4 texelColor = texture2D( map, vUv );\n\n texelColor.xyz = inputToLinear( texelColor.xyz );\n\n diffuseColor *= texelColor;\n\n#endif",n.ShaderChunk.lightmap_vertex="#ifdef USE_LIGHTMAP\n\n vUv2 = uv2;\n\n#endif",n.ShaderChunk.map_particle_fragment="#ifdef USE_MAP\n\n diffuseColor *= texture2D( map, vec2( gl_PointCoord.x, 1.0 - gl_PointCoord.y ) * offsetRepeat.zw + offsetRepeat.xy );\n\n#endif\n",n.ShaderChunk.color_pars_fragment="#ifdef USE_COLOR\n\n varying vec3 vColor;\n\n#endif\n",n.ShaderChunk.color_vertex="#ifdef USE_COLOR\n\n vColor.xyz = inputToLinear( color.xyz );\n\n#endif",n.ShaderChunk.skinning_vertex="#ifdef USE_SKINNING\n\n #ifdef USE_MORPHTARGETS\n\n vec4 skinVertex = bindMatrix * vec4( morphed, 1.0 );\n\n #else\n\n vec4 skinVertex = bindMatrix * vec4( position, 1.0 );\n\n #endif\n\n vec4 skinned = vec4( 0.0 );\n skinned += boneMatX * skinVertex * skinWeight.x;\n skinned += boneMatY * skinVertex * skinWeight.y;\n skinned += boneMatZ * skinVertex * skinWeight.z;\n skinned += boneMatW * skinVertex * skinWeight.w;\n skinned = bindMatrixInverse * skinned;\n\n#endif\n",n.ShaderChunk.envmap_pars_vertex="#if defined( USE_ENVMAP ) && ! defined( USE_BUMPMAP ) && ! defined( USE_NORMALMAP ) && ! defined( PHONG )\n\n varying vec3 vReflect;\n\n uniform float refractionRatio;\n\n#endif\n",n.ShaderChunk.linear_to_gamma_fragment="\n outgoingLight = linearToOutput( outgoingLight );\n",n.ShaderChunk.color_pars_vertex="#ifdef USE_COLOR\n\n varying vec3 vColor;\n\n#endif",n.ShaderChunk.lights_lambert_pars_vertex="uniform vec3 ambientLightColor;\n\n#if MAX_DIR_LIGHTS > 0\n\n uniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];\n uniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n\n#endif\n\n#if MAX_HEMI_LIGHTS > 0\n\n uniform vec3 hemisphereLightSkyColor[ MAX_HEMI_LIGHTS ];\n uniform vec3 hemisphereLightGroundColor[ MAX_HEMI_LIGHTS ];\n uniform vec3 hemisphereLightDirection[ MAX_HEMI_LIGHTS ];\n\n#endif\n\n#if MAX_POINT_LIGHTS > 0\n\n uniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];\n uniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\n uniform float pointLightDistance[ MAX_POINT_LIGHTS ];\n uniform float pointLightDecay[ MAX_POINT_LIGHTS ];\n\n#endif\n\n#if MAX_SPOT_LIGHTS > 0\n\n uniform vec3 spotLightColor[ MAX_SPOT_LIGHTS ];\n uniform vec3 spotLightPosition[ MAX_SPOT_LIGHTS ];\n uniform vec3 spotLightDirection[ MAX_SPOT_LIGHTS ];\n uniform float spotLightDistance[ MAX_SPOT_LIGHTS ];\n uniform float spotLightAngleCos[ MAX_SPOT_LIGHTS ];\n uniform float spotLightExponent[ MAX_SPOT_LIGHTS ];\n uniform float spotLightDecay[ MAX_SPOT_LIGHTS ];\n\n#endif\n\n#ifdef WRAP_AROUND\n\n uniform vec3 wrapRGB;\n\n#endif\n",n.ShaderChunk.map_pars_vertex="#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP )\n\n varying vec2 vUv;\n uniform vec4 offsetRepeat;\n\n#endif\n",n.ShaderChunk.envmap_fragment="#ifdef USE_ENVMAP\n\n #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\n vec3 cameraToVertex = normalize( vWorldPosition - cameraPosition );\n\n // Transforming Normal Vectors with the Inverse Transformation\n vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\n #ifdef ENVMAP_MODE_REFLECTION\n\n vec3 reflectVec = reflect( cameraToVertex, worldNormal );\n\n #else\n\n vec3 reflectVec = refract( cameraToVertex, worldNormal, refractionRatio );\n\n #endif\n\n #else\n\n vec3 reflectVec = vReflect;\n\n #endif\n\n #ifdef DOUBLE_SIDED\n float flipNormal = ( -1.0 + 2.0 * float( gl_FrontFacing ) );\n #else\n float flipNormal = 1.0;\n #endif\n\n #ifdef ENVMAP_TYPE_CUBE\n vec4 envColor = textureCube( envMap, flipNormal * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\n #elif defined( ENVMAP_TYPE_EQUIREC )\n vec2 sampleUV;\n sampleUV.y = saturate( flipNormal * reflectVec.y * 0.5 + 0.5 );\n sampleUV.x = atan( flipNormal * reflectVec.z, flipNormal * reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n vec4 envColor = texture2D( envMap, sampleUV );\n\n #elif defined( ENVMAP_TYPE_SPHERE )\n vec3 reflectView = flipNormal * normalize((viewMatrix * vec4( reflectVec, 0.0 )).xyz + vec3(0.0,0.0,1.0));\n vec4 envColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5 );\n #endif\n\n envColor.xyz = inputToLinear( envColor.xyz );\n\n #ifdef ENVMAP_BLENDING_MULTIPLY\n\n outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\n #elif defined( ENVMAP_BLENDING_MIX )\n\n outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\n #elif defined( ENVMAP_BLENDING_ADD )\n\n outgoingLight += envColor.xyz * specularStrength * reflectivity;\n\n #endif\n\n#endif\n",n.ShaderChunk.specularmap_pars_fragment="#ifdef USE_SPECULARMAP\n\n uniform sampler2D specularMap;\n\n#endif",n.ShaderChunk.logdepthbuf_vertex="#ifdef USE_LOGDEPTHBUF\n\n gl_Position.z = log2(max( EPSILON, gl_Position.w + 1.0 )) * logDepthBufFC;\n\n #ifdef USE_LOGDEPTHBUF_EXT\n\n vFragDepth = 1.0 + gl_Position.w;\n\n#else\n\n gl_Position.z = (gl_Position.z - 1.0) * gl_Position.w;\n\n #endif\n\n#endif",n.ShaderChunk.morphtarget_pars_vertex="#ifdef USE_MORPHTARGETS\n\n #ifndef USE_MORPHNORMALS\n\n uniform float morphTargetInfluences[ 8 ];\n\n #else\n\n uniform float morphTargetInfluences[ 4 ];\n\n #endif\n\n#endif",n.ShaderChunk.specularmap_fragment="float specularStrength;\n\n#ifdef USE_SPECULARMAP\n\n vec4 texelSpecular = texture2D( specularMap, vUv );\n specularStrength = texelSpecular.r;\n\n#else\n\n specularStrength = 1.0;\n\n#endif",n.ShaderChunk.fog_fragment="#ifdef USE_FOG\n\n #ifdef USE_LOGDEPTHBUF_EXT\n\n float depth = gl_FragDepthEXT / gl_FragCoord.w;\n\n #else\n\n float depth = gl_FragCoord.z / gl_FragCoord.w;\n\n #endif\n\n #ifdef FOG_EXP2\n\n float fogFactor = exp2( - square( fogDensity ) * square( depth ) * LOG2 );\n fogFactor = whiteCompliment( fogFactor );\n\n #else\n\n float fogFactor = smoothstep( fogNear, fogFar, depth );\n\n #endif\n \n outgoingLight = mix( outgoingLight, fogColor, fogFactor );\n\n#endif",n.ShaderChunk.bumpmap_pars_fragment="#ifdef USE_BUMPMAP\n\n uniform sampler2D bumpMap;\n uniform float bumpScale;\n\n // Derivative maps - bump mapping unparametrized surfaces by Morten Mikkelsen\n // http://mmikkelsen3d.blogspot.sk/2011/07/derivative-maps.html\n\n // Evaluate the derivative of the height w.r.t. screen-space using forward differencing (listing 2)\n\n vec2 dHdxy_fwd() {\n\n vec2 dSTdx = dFdx( vUv );\n vec2 dSTdy = dFdy( vUv );\n\n float Hll = bumpScale * texture2D( bumpMap, vUv ).x;\n float dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\n float dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;\n\n return vec2( dBx, dBy );\n\n }\n\n vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy ) {\n\n vec3 vSigmaX = dFdx( surf_pos );\n vec3 vSigmaY = dFdy( surf_pos );\n vec3 vN = surf_norm; // normalized\n\n vec3 R1 = cross( vSigmaY, vN );\n vec3 R2 = cross( vN, vSigmaX );\n\n float fDet = dot( vSigmaX, R1 );\n\n vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n return normalize( abs( fDet ) * surf_norm - vGrad );\n\n }\n\n#endif\n",n.ShaderChunk.defaultnormal_vertex="#ifdef USE_SKINNING\n\n vec3 objectNormal = skinnedNormal.xyz;\n\n#elif defined( USE_MORPHNORMALS )\n\n vec3 objectNormal = morphedNormal;\n\n#else\n\n vec3 objectNormal = normal;\n\n#endif\n\n#ifdef FLIP_SIDED\n\n objectNormal = -objectNormal;\n\n#endif\n\nvec3 transformedNormal = normalMatrix * objectNormal;\n",n.ShaderChunk.lights_phong_pars_fragment="uniform vec3 ambientLightColor;\n\n#if MAX_DIR_LIGHTS > 0\n\n uniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];\n uniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n\n#endif\n\n#if MAX_HEMI_LIGHTS > 0\n\n uniform vec3 hemisphereLightSkyColor[ MAX_HEMI_LIGHTS ];\n uniform vec3 hemisphereLightGroundColor[ MAX_HEMI_LIGHTS ];\n uniform vec3 hemisphereLightDirection[ MAX_HEMI_LIGHTS ];\n\n#endif\n\n#if MAX_POINT_LIGHTS > 0\n\n uniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];\n\n uniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\n uniform float pointLightDistance[ MAX_POINT_LIGHTS ];\n uniform float pointLightDecay[ MAX_POINT_LIGHTS ];\n\n#endif\n\n#if MAX_SPOT_LIGHTS > 0\n\n uniform vec3 spotLightColor[ MAX_SPOT_LIGHTS ];\n uniform vec3 spotLightPosition[ MAX_SPOT_LIGHTS ];\n uniform vec3 spotLightDirection[ MAX_SPOT_LIGHTS ];\n uniform float spotLightAngleCos[ MAX_SPOT_LIGHTS ];\n uniform float spotLightExponent[ MAX_SPOT_LIGHTS ];\n uniform float spotLightDistance[ MAX_SPOT_LIGHTS ];\n uniform float spotLightDecay[ MAX_SPOT_LIGHTS ];\n\n#endif\n\n#if MAX_SPOT_LIGHTS > 0 || defined( USE_BUMPMAP ) || defined( USE_ENVMAP )\n\n varying vec3 vWorldPosition;\n\n#endif\n\n#ifdef WRAP_AROUND\n\n uniform vec3 wrapRGB;\n\n#endif\n\nvarying vec3 vViewPosition;\n\n#ifndef FLAT_SHADED\n\n varying vec3 vNormal;\n\n#endif\n",n.ShaderChunk.skinbase_vertex="#ifdef USE_SKINNING\n\n mat4 boneMatX = getBoneMatrix( skinIndex.x );\n mat4 boneMatY = getBoneMatrix( skinIndex.y );\n mat4 boneMatZ = getBoneMatrix( skinIndex.z );\n mat4 boneMatW = getBoneMatrix( skinIndex.w );\n\n#endif",n.ShaderChunk.map_vertex="#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP )\n\n vUv = uv * offsetRepeat.zw + offsetRepeat.xy;\n\n#endif",n.ShaderChunk.lightmap_fragment="#ifdef USE_LIGHTMAP\n\n outgoingLight *= diffuseColor.xyz * texture2D( lightMap, vUv2 ).xyz;\n\n#endif",n.ShaderChunk.shadowmap_pars_vertex="#ifdef USE_SHADOWMAP\n\n varying vec4 vShadowCoord[ MAX_SHADOWS ];\n uniform mat4 shadowMatrix[ MAX_SHADOWS ];\n\n#endif",n.ShaderChunk.color_fragment="#ifdef USE_COLOR\n\n diffuseColor.rgb *= vColor;\n\n#endif",n.ShaderChunk.morphtarget_vertex="#ifdef USE_MORPHTARGETS\n\n vec3 morphed = vec3( 0.0 );\n morphed += ( morphTarget0 - position ) * morphTargetInfluences[ 0 ];\n morphed += ( morphTarget1 - position ) * morphTargetInfluences[ 1 ];\n morphed += ( morphTarget2 - position ) * morphTargetInfluences[ 2 ];\n morphed += ( morphTarget3 - position ) * morphTargetInfluences[ 3 ];\n\n #ifndef USE_MORPHNORMALS\n\n morphed += ( morphTarget4 - position ) * morphTargetInfluences[ 4 ];\n morphed += ( morphTarget5 - position ) * morphTargetInfluences[ 5 ];\n morphed += ( morphTarget6 - position ) * morphTargetInfluences[ 6 ];\n morphed += ( morphTarget7 - position ) * morphTargetInfluences[ 7 ];\n\n #endif\n\n morphed += position;\n\n#endif",n.ShaderChunk.envmap_vertex="#if defined( USE_ENVMAP ) && ! defined( USE_BUMPMAP ) && ! defined( USE_NORMALMAP ) && ! defined( PHONG )\n\n vec3 worldNormal = transformDirection( objectNormal, modelMatrix );\n\n vec3 cameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\n #ifdef ENVMAP_MODE_REFLECTION\n\n vReflect = reflect( cameraToVertex, worldNormal );\n\n #else\n\n vReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\n #endif\n\n#endif\n",n.ShaderChunk.shadowmap_fragment="#ifdef USE_SHADOWMAP\n\n #ifdef SHADOWMAP_DEBUG\n\n vec3 frustumColors[3];\n frustumColors[0] = vec3( 1.0, 0.5, 0.0 );\n frustumColors[1] = vec3( 0.0, 1.0, 0.8 );\n frustumColors[2] = vec3( 0.0, 0.5, 1.0 );\n\n #endif\n\n #ifdef SHADOWMAP_CASCADE\n\n int inFrustumCount = 0;\n\n #endif\n\n float fDepth;\n vec3 shadowColor = vec3( 1.0 );\n\n for( int i = 0; i < MAX_SHADOWS; i ++ ) {\n\n vec3 shadowCoord = vShadowCoord[ i ].xyz / vShadowCoord[ i ].w;\n\n // if ( something && something ) breaks ATI OpenGL shader compiler\n // if ( all( something, something ) ) using this instead\n\n bvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\n bool inFrustum = all( inFrustumVec );\n\n // don't shadow pixels outside of light frustum\n // use just first frustum (for cascades)\n // don't shadow pixels behind far plane of light frustum\n\n #ifdef SHADOWMAP_CASCADE\n\n inFrustumCount += int( inFrustum );\n bvec3 frustumTestVec = bvec3( inFrustum, inFrustumCount == 1, shadowCoord.z <= 1.0 );\n\n #else\n\n bvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\n\n #endif\n\n bool frustumTest = all( frustumTestVec );\n\n if ( frustumTest ) {\n\n shadowCoord.z += shadowBias[ i ];\n\n #if defined( SHADOWMAP_TYPE_PCF )\n\n // Percentage-close filtering\n // (9 pixel kernel)\n // http://fabiensanglard.net/shadowmappingPCF/\n\n float shadow = 0.0;\n\n /*\n // nested loops breaks shader compiler / validator on some ATI cards when using OpenGL\n // must enroll loop manually\n\n for ( float y = -1.25; y <= 1.25; y += 1.25 )\n for ( float x = -1.25; x <= 1.25; x += 1.25 ) {\n\n vec4 rgbaDepth = texture2D( shadowMap[ i ], vec2( x * xPixelOffset, y * yPixelOffset ) + shadowCoord.xy );\n\n // doesn't seem to produce any noticeable visual difference compared to simple texture2D lookup\n //vec4 rgbaDepth = texture2DProj( shadowMap[ i ], vec4( vShadowCoord[ i ].w * ( vec2( x * xPixelOffset, y * yPixelOffset ) + shadowCoord.xy ), 0.05, vShadowCoord[ i ].w ) );\n\n float fDepth = unpackDepth( rgbaDepth );\n\n if ( fDepth < shadowCoord.z )\n shadow += 1.0;\n\n }\n\n shadow /= 9.0;\n\n */\n\n const float shadowDelta = 1.0 / 9.0;\n\n float xPixelOffset = 1.0 / shadowMapSize[ i ].x;\n float yPixelOffset = 1.0 / shadowMapSize[ i ].y;\n\n float dx0 = -1.25 * xPixelOffset;\n float dy0 = -1.25 * yPixelOffset;\n float dx1 = 1.25 * xPixelOffset;\n float dy1 = 1.25 * yPixelOffset;\n\n fDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, dy0 ) ) );\n if ( fDepth < shadowCoord.z ) shadow += shadowDelta;\n\n fDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( 0.0, dy0 ) ) );\n if ( fDepth < shadowCoord.z ) shadow += shadowDelta;\n\n fDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, dy0 ) ) );\n if ( fDepth < shadowCoord.z ) shadow += shadowDelta;\n\n fDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, 0.0 ) ) );\n if ( fDepth < shadowCoord.z ) shadow += shadowDelta;\n\n fDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy ) );\n if ( fDepth < shadowCoord.z ) shadow += shadowDelta;\n\n fDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, 0.0 ) ) );\n if ( fDepth < shadowCoord.z ) shadow += shadowDelta;\n\n fDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, dy1 ) ) );\n if ( fDepth < shadowCoord.z ) shadow += shadowDelta;\n\n fDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( 0.0, dy1 ) ) );\n if ( fDepth < shadowCoord.z ) shadow += shadowDelta;\n\n fDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, dy1 ) ) );\n if ( fDepth < shadowCoord.z ) shadow += shadowDelta;\n\n shadowColor = shadowColor * vec3( ( 1.0 - shadowDarkness[ i ] * shadow ) );\n\n #elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\n // Percentage-close filtering\n // (9 pixel kernel)\n // http://fabiensanglard.net/shadowmappingPCF/\n\n float shadow = 0.0;\n\n float xPixelOffset = 1.0 / shadowMapSize[ i ].x;\n float yPixelOffset = 1.0 / shadowMapSize[ i ].y;\n\n float dx0 = -1.0 * xPixelOffset;\n float dy0 = -1.0 * yPixelOffset;\n float dx1 = 1.0 * xPixelOffset;\n float dy1 = 1.0 * yPixelOffset;\n\n mat3 shadowKernel;\n mat3 depthKernel;\n\n depthKernel[0][0] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, dy0 ) ) );\n depthKernel[0][1] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, 0.0 ) ) );\n depthKernel[0][2] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, dy1 ) ) );\n depthKernel[1][0] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( 0.0, dy0 ) ) );\n depthKernel[1][1] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy ) );\n depthKernel[1][2] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( 0.0, dy1 ) ) );\n depthKernel[2][0] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, dy0 ) ) );\n depthKernel[2][1] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, 0.0 ) ) );\n depthKernel[2][2] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, dy1 ) ) );\n\n vec3 shadowZ = vec3( shadowCoord.z );\n shadowKernel[0] = vec3(lessThan(depthKernel[0], shadowZ ));\n shadowKernel[0] *= vec3(0.25);\n\n shadowKernel[1] = vec3(lessThan(depthKernel[1], shadowZ ));\n shadowKernel[1] *= vec3(0.25);\n\n shadowKernel[2] = vec3(lessThan(depthKernel[2], shadowZ ));\n shadowKernel[2] *= vec3(0.25);\n\n vec2 fractionalCoord = 1.0 - fract( shadowCoord.xy * shadowMapSize[i].xy );\n\n shadowKernel[0] = mix( shadowKernel[1], shadowKernel[0], fractionalCoord.x );\n shadowKernel[1] = mix( shadowKernel[2], shadowKernel[1], fractionalCoord.x );\n\n vec4 shadowValues;\n shadowValues.x = mix( shadowKernel[0][1], shadowKernel[0][0], fractionalCoord.y );\n shadowValues.y = mix( shadowKernel[0][2], shadowKernel[0][1], fractionalCoord.y );\n shadowValues.z = mix( shadowKernel[1][1], shadowKernel[1][0], fractionalCoord.y );\n shadowValues.w = mix( shadowKernel[1][2], shadowKernel[1][1], fractionalCoord.y );\n\n shadow = dot( shadowValues, vec4( 1.0 ) );\n\n shadowColor = shadowColor * vec3( ( 1.0 - shadowDarkness[ i ] * shadow ) );\n\n #else\n\n vec4 rgbaDepth = texture2D( shadowMap[ i ], shadowCoord.xy );\n float fDepth = unpackDepth( rgbaDepth );\n\n if ( fDepth < shadowCoord.z )\n\n // spot with multiple shadows is darker\n\n shadowColor = shadowColor * vec3( 1.0 - shadowDarkness[ i ] );\n\n // spot with multiple shadows has the same color as single shadow spot\n\n // shadowColor = min( shadowColor, vec3( shadowDarkness[ i ] ) );\n\n #endif\n\n }\n\n\n #ifdef SHADOWMAP_DEBUG\n\n #ifdef SHADOWMAP_CASCADE\n\n if ( inFrustum && inFrustumCount == 1 ) outgoingLight *= frustumColors[ i ];\n\n #else\n\n if ( inFrustum ) outgoingLight *= frustumColors[ i ];\n\n #endif\n\n #endif\n\n }\n\n // NOTE: I am unsure if this is correct in linear space. -bhouston, Dec 29, 2014\n shadowColor = inputToLinear( shadowColor );\n\n outgoingLight = outgoingLight * shadowColor;\n\n#endif\n",n.ShaderChunk.worldpos_vertex="#if defined( USE_ENVMAP ) || defined( PHONG ) || defined( LAMBERT ) || defined ( USE_SHADOWMAP )\n\n #ifdef USE_SKINNING\n\n vec4 worldPosition = modelMatrix * skinned;\n\n #elif defined( USE_MORPHTARGETS )\n\n vec4 worldPosition = modelMatrix * vec4( morphed, 1.0 );\n\n #else\n\n vec4 worldPosition = modelMatrix * vec4( position, 1.0 );\n\n #endif\n\n#endif\n",n.ShaderChunk.shadowmap_pars_fragment="#ifdef USE_SHADOWMAP\n\n uniform sampler2D shadowMap[ MAX_SHADOWS ];\n uniform vec2 shadowMapSize[ MAX_SHADOWS ];\n\n uniform float shadowDarkness[ MAX_SHADOWS ];\n uniform float shadowBias[ MAX_SHADOWS ];\n\n varying vec4 vShadowCoord[ MAX_SHADOWS ];\n\n float unpackDepth( const in vec4 rgba_depth ) {\n\n const vec4 bit_shift = vec4( 1.0 / ( 256.0 * 256.0 * 256.0 ), 1.0 / ( 256.0 * 256.0 ), 1.0 / 256.0, 1.0 );\n float depth = dot( rgba_depth, bit_shift );\n return depth;\n\n }\n\n#endif",n.ShaderChunk.skinning_pars_vertex="#ifdef USE_SKINNING\n\n uniform mat4 bindMatrix;\n uniform mat4 bindMatrixInverse;\n\n #ifdef BONE_TEXTURE\n\n uniform sampler2D boneTexture;\n uniform int boneTextureWidth;\n uniform int boneTextureHeight;\n\n mat4 getBoneMatrix( const in float i ) {\n\n float j = i * 4.0;\n float x = mod( j, float( boneTextureWidth ) );\n float y = floor( j / float( boneTextureWidth ) );\n\n float dx = 1.0 / float( boneTextureWidth );\n float dy = 1.0 / float( boneTextureHeight );\n\n y = dy * ( y + 0.5 );\n\n vec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n vec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n vec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n vec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n\n mat4 bone = mat4( v1, v2, v3, v4 );\n\n return bone;\n\n }\n\n #else\n\n uniform mat4 boneGlobalMatrices[ MAX_BONES ];\n\n mat4 getBoneMatrix( const in float i ) {\n\n mat4 bone = boneGlobalMatrices[ int(i) ];\n return bone;\n\n }\n\n #endif\n\n#endif\n", -n.ShaderChunk.logdepthbuf_pars_fragment="#ifdef USE_LOGDEPTHBUF\n\n uniform float logDepthBufFC;\n\n #ifdef USE_LOGDEPTHBUF_EXT\n\n #extension GL_EXT_frag_depth : enable\n varying float vFragDepth;\n\n #endif\n\n#endif",n.ShaderChunk.alphamap_fragment="#ifdef USE_ALPHAMAP\n\n diffuseColor.a *= texture2D( alphaMap, vUv ).g;\n\n#endif\n",n.ShaderChunk.alphamap_pars_fragment="#ifdef USE_ALPHAMAP\n\n uniform sampler2D alphaMap;\n\n#endif\n",n.UniformsUtils={merge:function(e){for(var t={},r=0;r dashSize ) {"," discard;"," }"," vec3 outgoingLight = vec3( 0.0 );"," vec4 diffuseColor = vec4( diffuse, opacity );",n.ShaderChunk.logdepthbuf_fragment,n.ShaderChunk.color_fragment," outgoingLight = diffuseColor.rgb;",n.ShaderChunk.fog_fragment," gl_FragColor = vec4( outgoingLight, diffuseColor.a );","}"].join("\n")},depth:{uniforms:{mNear:{type:"f",value:1},mFar:{type:"f",value:2e3},opacity:{type:"f",value:1}},vertexShader:[n.ShaderChunk.common,n.ShaderChunk.morphtarget_pars_vertex,n.ShaderChunk.logdepthbuf_pars_vertex,"void main() {",n.ShaderChunk.morphtarget_vertex,n.ShaderChunk.default_vertex,n.ShaderChunk.logdepthbuf_vertex,"}"].join("\n"),fragmentShader:["uniform float mNear;","uniform float mFar;","uniform float opacity;",n.ShaderChunk.common,n.ShaderChunk.logdepthbuf_pars_fragment,"void main() {",n.ShaderChunk.logdepthbuf_fragment," #ifdef USE_LOGDEPTHBUF_EXT"," float depth = gl_FragDepthEXT / gl_FragCoord.w;"," #else"," float depth = gl_FragCoord.z / gl_FragCoord.w;"," #endif"," float color = 1.0 - smoothstep( mNear, mFar, depth );"," gl_FragColor = vec4( vec3( color ), opacity );","}"].join("\n")},normal:{uniforms:{opacity:{type:"f",value:1}},vertexShader:["varying vec3 vNormal;",n.ShaderChunk.common,n.ShaderChunk.morphtarget_pars_vertex,n.ShaderChunk.logdepthbuf_pars_vertex,"void main() {"," vNormal = normalize( normalMatrix * normal );",n.ShaderChunk.morphtarget_vertex,n.ShaderChunk.default_vertex,n.ShaderChunk.logdepthbuf_vertex,"}"].join("\n"),fragmentShader:["uniform float opacity;","varying vec3 vNormal;",n.ShaderChunk.common,n.ShaderChunk.logdepthbuf_pars_fragment,"void main() {"," gl_FragColor = vec4( 0.5 * normalize( vNormal ) + 0.5, opacity );",n.ShaderChunk.logdepthbuf_fragment,"}"].join("\n")},cube:{uniforms:{tCube:{type:"t",value:null},tFlip:{type:"f",value:-1}},vertexShader:["varying vec3 vWorldPosition;",n.ShaderChunk.common,n.ShaderChunk.logdepthbuf_pars_vertex,"void main() {"," vWorldPosition = transformDirection( position, modelMatrix );"," gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",n.ShaderChunk.logdepthbuf_vertex,"}"].join("\n"),fragmentShader:["uniform samplerCube tCube;","uniform float tFlip;","varying vec3 vWorldPosition;",n.ShaderChunk.common,n.ShaderChunk.logdepthbuf_pars_fragment,"void main() {"," gl_FragColor = textureCube( tCube, vec3( tFlip * vWorldPosition.x, vWorldPosition.yz ) );",n.ShaderChunk.logdepthbuf_fragment,"}"].join("\n")},equirect:{uniforms:{tEquirect:{type:"t",value:null},tFlip:{type:"f",value:-1}},vertexShader:["varying vec3 vWorldPosition;",n.ShaderChunk.common,n.ShaderChunk.logdepthbuf_pars_vertex,"void main() {"," vWorldPosition = transformDirection( position, modelMatrix );"," gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",n.ShaderChunk.logdepthbuf_vertex,"}"].join("\n"),fragmentShader:["uniform sampler2D tEquirect;","uniform float tFlip;","varying vec3 vWorldPosition;",n.ShaderChunk.common,n.ShaderChunk.logdepthbuf_pars_fragment,"void main() {","vec3 direction = normalize( vWorldPosition );","vec2 sampleUV;","sampleUV.y = saturate( tFlip * direction.y * -0.5 + 0.5 );","sampleUV.x = atan( direction.z, direction.x ) * RECIPROCAL_PI2 + 0.5;","gl_FragColor = texture2D( tEquirect, sampleUV );",n.ShaderChunk.logdepthbuf_fragment,"}"].join("\n")},depthRGBA:{uniforms:{},vertexShader:[n.ShaderChunk.common,n.ShaderChunk.morphtarget_pars_vertex,n.ShaderChunk.skinning_pars_vertex,n.ShaderChunk.logdepthbuf_pars_vertex,"void main() {",n.ShaderChunk.skinbase_vertex,n.ShaderChunk.morphtarget_vertex,n.ShaderChunk.skinning_vertex,n.ShaderChunk.default_vertex,n.ShaderChunk.logdepthbuf_vertex,"}"].join("\n"),fragmentShader:[n.ShaderChunk.common,n.ShaderChunk.logdepthbuf_pars_fragment,"vec4 pack_depth( const in float depth ) {"," const vec4 bit_shift = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );"," const vec4 bit_mask = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );"," vec4 res = mod( depth * bit_shift * vec4( 255 ), vec4( 256 ) ) / vec4( 255 );"," res -= res.xxyz * bit_mask;"," return res;","}","void main() {",n.ShaderChunk.logdepthbuf_fragment," #ifdef USE_LOGDEPTHBUF_EXT"," gl_FragData[ 0 ] = pack_depth( gl_FragDepthEXT );"," #else"," gl_FragData[ 0 ] = pack_depth( gl_FragCoord.z );"," #endif","}"].join("\n")}},n.WebGLRenderer=function(e){function t(e){e.__webglVertexBuffer=Re.createBuffer(),e.__webglColorBuffer=Re.createBuffer(),Fe.info.memory.geometries++}function r(e){e.__webglVertexBuffer=Re.createBuffer(),e.__webglColorBuffer=Re.createBuffer(),e.__webglLineDistanceBuffer=Re.createBuffer(),Fe.info.memory.geometries++}function i(e){e.__webglVertexBuffer=Re.createBuffer(),e.__webglNormalBuffer=Re.createBuffer(),e.__webglTangentBuffer=Re.createBuffer(),e.__webglColorBuffer=Re.createBuffer(),e.__webglUVBuffer=Re.createBuffer(),e.__webglUV2Buffer=Re.createBuffer(),e.__webglSkinIndicesBuffer=Re.createBuffer(),e.__webglSkinWeightsBuffer=Re.createBuffer(),e.__webglFaceBuffer=Re.createBuffer(),e.__webglLineBuffer=Re.createBuffer();var t=e.numMorphTargets;if(t){e.__webglMorphTargetsBuffers=[];for(var r=0,i=t;i>r;r++)e.__webglMorphTargetsBuffers.push(Re.createBuffer())}var n=e.numMorphNormals;if(n){e.__webglMorphNormalsBuffers=[];for(var r=0,i=n;i>r;r++)e.__webglMorphNormalsBuffers.push(Re.createBuffer())}Fe.info.memory.geometries++}function o(e){var t=e.geometry,r=e.material,i=t.vertices.length;if(r.attributes){void 0===t.__webglCustomAttributesList&&(t.__webglCustomAttributesList=[]);for(var n in r.attributes){var o=r.attributes[n];if(!o.__webglInitialized||o.createUniqueBuffers){o.__webglInitialized=!0;var a=1;"v2"===o.type?a=2:"v3"===o.type?a=3:"v4"===o.type?a=4:"c"===o.type&&(a=3),o.size=a,o.array=new Float32Array(i*a),o.buffer=Re.createBuffer(),o.buffer.belongsToAttribute=n,o.needsUpdate=!0}t.__webglCustomAttributesList.push(o)}}}function a(e,t){var r=e.vertices.length;e.__vertexArray=new Float32Array(3*r),e.__colorArray=new Float32Array(3*r),e.__webglParticleCount=r,o(t)}function s(e,t){var r=e.vertices.length;e.__vertexArray=new Float32Array(3*r),e.__colorArray=new Float32Array(3*r),e.__lineDistanceArray=new Float32Array(1*r),e.__webglLineCount=r,o(t)}function h(e,t){var r=t.geometry,i=e.faces3,n=3*i.length,o=1*i.length,a=3*i.length,s=c(t,e);e.__vertexArray=new Float32Array(3*n),e.__normalArray=new Float32Array(3*n),e.__colorArray=new Float32Array(3*n),e.__uvArray=new Float32Array(2*n),r.faceVertexUvs.length>1&&(e.__uv2Array=new Float32Array(2*n)),r.hasTangents&&(e.__tangentArray=new Float32Array(4*n)),t.geometry.skinWeights.length&&t.geometry.skinIndices.length&&(e.__skinIndexArray=new Float32Array(4*n),e.__skinWeightArray=new Float32Array(4*n));var h=null!==tt.get("OES_element_index_uint")&&o>21845?Uint32Array:Uint16Array;e.__typeArray=h,e.__faceArray=new h(3*o),e.__lineArray=new h(2*a);var l=e.numMorphTargets;if(l){e.__morphTargetsArrays=[];for(var u=0,f=l;f>u;u++)e.__morphTargetsArrays.push(new Float32Array(3*n))}var p=e.numMorphNormals;if(p){e.__morphNormalsArrays=[];for(var u=0,f=p;f>u;u++)e.__morphNormalsArrays.push(new Float32Array(3*n))}if(e.__webglFaceCount=3*o,e.__webglLineCount=2*a,s.attributes){void 0===e.__webglCustomAttributesList&&(e.__webglCustomAttributesList=[]);for(var d in s.attributes){var m=s.attributes[d],g={};for(var v in m)g[v]=m[v];if(!g.__webglInitialized||g.createUniqueBuffers){g.__webglInitialized=!0;var y=1;"v2"===g.type?y=2:"v3"===g.type?y=3:"v4"===g.type?y=4:"c"===g.type&&(y=3),g.size=y,g.array=new Float32Array(n*y),g.buffer=Re.createBuffer(),g.buffer.belongsToAttribute=d,m.needsUpdate=!0,g.__original=m}e.__webglCustomAttributesList.push(g)}}e.__inittedArrays=!0}function c(e,t){return e.material instanceof n.MeshFaceMaterial?e.material.materials[t.materialIndex]:e.material}function l(e){return e instanceof n.MeshPhongMaterial==!1&&e.shading===n.FlatShading}function u(e,t,r){var i,n,o,a,s,h,c,l,u,f,p,d=e.vertices,m=d.length,g=e.colors,v=g.length,y=e.__vertexArray,x=e.__colorArray,b=e.verticesNeedUpdate,w=e.colorsNeedUpdate,A=e.__webglCustomAttributesList;if(b){for(i=0;m>i;i++)o=d[i],a=3*i,y[a]=o.x,y[a+1]=o.y,y[a+2]=o.z;Re.bindBuffer(Re.ARRAY_BUFFER,e.__webglVertexBuffer),Re.bufferData(Re.ARRAY_BUFFER,y,t)}if(w){for(n=0;v>n;n++)s=g[n],a=3*n,x[a]=s.r,x[a+1]=s.g,x[a+2]=s.b;Re.bindBuffer(Re.ARRAY_BUFFER,e.__webglColorBuffer),Re.bufferData(Re.ARRAY_BUFFER,x,t)}if(A)for(h=0,c=A.length;c>h;h++){if(p=A[h],p.needsUpdate&&(void 0===p.boundTo||"vertices"===p.boundTo))if(u=p.value.length,a=0,1===p.size)for(l=0;u>l;l++)p.array[l]=p.value[l];else if(2===p.size)for(l=0;u>l;l++)f=p.value[l],p.array[a]=f.x,p.array[a+1]=f.y,a+=2;else if(3===p.size)if("c"===p.type)for(l=0;u>l;l++)f=p.value[l],p.array[a]=f.r,p.array[a+1]=f.g,p.array[a+2]=f.b,a+=3;else for(l=0;u>l;l++)f=p.value[l],p.array[a]=f.x,p.array[a+1]=f.y,p.array[a+2]=f.z,a+=3;else if(4===p.size)for(l=0;u>l;l++)f=p.value[l],p.array[a]=f.x,p.array[a+1]=f.y,p.array[a+2]=f.z,p.array[a+3]=f.w,a+=4;Re.bindBuffer(Re.ARRAY_BUFFER,p.buffer),Re.bufferData(Re.ARRAY_BUFFER,p.array,t),p.needsUpdate=!1}}function f(e,t){var r,i,n,o,a,s,h,c,l,u,f,p,d=e.vertices,m=e.colors,g=e.lineDistances,v=d.length,y=m.length,x=g.length,b=e.__vertexArray,w=e.__colorArray,A=e.__lineDistanceArray,M=e.verticesNeedUpdate,_=e.colorsNeedUpdate,S=e.lineDistancesNeedUpdate,E=e.__webglCustomAttributesList;if(M){for(r=0;v>r;r++)o=d[r],a=3*r,b[a]=o.x,b[a+1]=o.y,b[a+2]=o.z;Re.bindBuffer(Re.ARRAY_BUFFER,e.__webglVertexBuffer),Re.bufferData(Re.ARRAY_BUFFER,b,t)}if(_){for(i=0;y>i;i++)s=m[i],a=3*i,w[a]=s.r,w[a+1]=s.g,w[a+2]=s.b;Re.bindBuffer(Re.ARRAY_BUFFER,e.__webglColorBuffer),Re.bufferData(Re.ARRAY_BUFFER,w,t)}if(S){for(n=0;x>n;n++)A[n]=g[n];Re.bindBuffer(Re.ARRAY_BUFFER,e.__webglLineDistanceBuffer),Re.bufferData(Re.ARRAY_BUFFER,A,t)}if(E)for(h=0,c=E.length;c>h;h++)if(p=E[h],p.needsUpdate&&(void 0===p.boundTo||"vertices"===p.boundTo)){if(a=0,u=p.value.length,1===p.size)for(l=0;u>l;l++)p.array[l]=p.value[l];else if(2===p.size)for(l=0;u>l;l++)f=p.value[l],p.array[a]=f.x,p.array[a+1]=f.y,a+=2;else if(3===p.size)if("c"===p.type)for(l=0;u>l;l++)f=p.value[l],p.array[a]=f.r,p.array[a+1]=f.g,p.array[a+2]=f.b,a+=3;else for(l=0;u>l;l++)f=p.value[l],p.array[a]=f.x,p.array[a+1]=f.y,p.array[a+2]=f.z,a+=3;else if(4===p.size)for(l=0;u>l;l++)f=p.value[l],p.array[a]=f.x,p.array[a+1]=f.y,p.array[a+2]=f.z,p.array[a+3]=f.w,a+=4;Re.bindBuffer(Re.ARRAY_BUFFER,p.buffer),Re.bufferData(Re.ARRAY_BUFFER,p.array,t),p.needsUpdate=!1}}function p(e,t,r,i,o){if(e.__inittedArrays){var a,s,h,c,u,f,p,d,m,g,v,y,x,b,w,A,M,_,S,E,T,C,L,P,R,F,B,D,U,V,O,z,k,N,G,I,H,j,W,X,q,Y,K=l(o),Q=0,Z=0,J=0,$=0,ee=0,te=0,re=0,ie=0,ne=0,oe=0,ae=0,se=0,he=e.__vertexArray,ce=e.__uvArray,le=e.__uv2Array,ue=e.__normalArray,fe=e.__tangentArray,pe=e.__colorArray,de=e.__skinIndexArray,me=e.__skinWeightArray,ge=e.__morphTargetsArrays,ve=e.__morphNormalsArrays,ye=e.__webglCustomAttributesList,xe=e.__faceArray,be=e.__lineArray,we=t.geometry,Ae=we.verticesNeedUpdate,Me=we.elementsNeedUpdate,_e=we.uvsNeedUpdate,Se=we.normalsNeedUpdate,Ee=we.tangentsNeedUpdate,Te=we.colorsNeedUpdate,Ce=we.morphTargetsNeedUpdate,Le=we.vertices,Pe=e.faces3,Fe=we.faces,Be=we.faceVertexUvs[0],De=we.faceVertexUvs[1],Ue=we.skinIndices,Ve=we.skinWeights,Oe=we.morphTargets,ze=we.morphNormals;if(Ae){for(a=0,s=Pe.length;s>a;a++)c=Fe[Pe[a]],y=Le[c.a],x=Le[c.b],b=Le[c.c],he[Z]=y.x,he[Z+1]=y.y,he[Z+2]=y.z,he[Z+3]=x.x,he[Z+4]=x.y,he[Z+5]=x.z,he[Z+6]=b.x,he[Z+7]=b.y,he[Z+8]=b.z,Z+=9;Re.bindBuffer(Re.ARRAY_BUFFER,e.__webglVertexBuffer),Re.bufferData(Re.ARRAY_BUFFER,he,r)}if(Ce)for(G=0,I=Oe.length;I>G;G++){for(ae=0,a=0,s=Pe.length;s>a;a++)W=Pe[a],c=Fe[W],y=Oe[G].vertices[c.a],x=Oe[G].vertices[c.b],b=Oe[G].vertices[c.c],H=ge[G],H[ae]=y.x,H[ae+1]=y.y,H[ae+2]=y.z,H[ae+3]=x.x,H[ae+4]=x.y,H[ae+5]=x.z,H[ae+6]=b.x,H[ae+7]=b.y,H[ae+8]=b.z,o.morphNormals&&(K?(_=ze[G].faceNormals[W],S=_,E=_):(X=ze[G].vertexNormals[W],_=X.a,S=X.b,E=X.c),j=ve[G],j[ae]=_.x,j[ae+1]=_.y,j[ae+2]=_.z,j[ae+3]=S.x,j[ae+4]=S.y,j[ae+5]=S.z,j[ae+6]=E.x,j[ae+7]=E.y,j[ae+8]=E.z),ae+=9;Re.bindBuffer(Re.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[G]),Re.bufferData(Re.ARRAY_BUFFER,ge[G],r),o.morphNormals&&(Re.bindBuffer(Re.ARRAY_BUFFER,e.__webglMorphNormalsBuffers[G]),Re.bufferData(Re.ARRAY_BUFFER,ve[G],r))}if(Ve.length){for(a=0,s=Pe.length;s>a;a++)c=Fe[Pe[a]],P=Ve[c.a],R=Ve[c.b],F=Ve[c.c],me[oe]=P.x,me[oe+1]=P.y,me[oe+2]=P.z,me[oe+3]=P.w,me[oe+4]=R.x,me[oe+5]=R.y,me[oe+6]=R.z,me[oe+7]=R.w,me[oe+8]=F.x,me[oe+9]=F.y,me[oe+10]=F.z,me[oe+11]=F.w,B=Ue[c.a],D=Ue[c.b],U=Ue[c.c],de[oe]=B.x,de[oe+1]=B.y,de[oe+2]=B.z,de[oe+3]=B.w,de[oe+4]=D.x,de[oe+5]=D.y,de[oe+6]=D.z,de[oe+7]=D.w,de[oe+8]=U.x,de[oe+9]=U.y,de[oe+10]=U.z,de[oe+11]=U.w,oe+=12;oe>0&&(Re.bindBuffer(Re.ARRAY_BUFFER,e.__webglSkinIndicesBuffer),Re.bufferData(Re.ARRAY_BUFFER,de,r),Re.bindBuffer(Re.ARRAY_BUFFER,e.__webglSkinWeightsBuffer),Re.bufferData(Re.ARRAY_BUFFER,me,r))}if(Te){for(a=0,s=Pe.length;s>a;a++)c=Fe[Pe[a]],p=c.vertexColors,d=c.color,3===p.length&&o.vertexColors===n.VertexColors?(T=p[0],C=p[1],L=p[2]):(T=d,C=d,L=d),pe[ne]=T.r,pe[ne+1]=T.g,pe[ne+2]=T.b,pe[ne+3]=C.r,pe[ne+4]=C.g,pe[ne+5]=C.b,pe[ne+6]=L.r,pe[ne+7]=L.g,pe[ne+8]=L.b,ne+=9;ne>0&&(Re.bindBuffer(Re.ARRAY_BUFFER,e.__webglColorBuffer),Re.bufferData(Re.ARRAY_BUFFER,pe,r))}if(Ee&&we.hasTangents){for(a=0,s=Pe.length;s>a;a++)c=Fe[Pe[a]],m=c.vertexTangents,w=m[0],A=m[1],M=m[2],fe[re]=w.x,fe[re+1]=w.y,fe[re+2]=w.z,fe[re+3]=w.w,fe[re+4]=A.x,fe[re+5]=A.y,fe[re+6]=A.z,fe[re+7]=A.w,fe[re+8]=M.x,fe[re+9]=M.y,fe[re+10]=M.z,fe[re+11]=M.w,re+=12;Re.bindBuffer(Re.ARRAY_BUFFER,e.__webglTangentBuffer),Re.bufferData(Re.ARRAY_BUFFER,fe,r)}if(Se){for(a=0,s=Pe.length;s>a;a++)if(c=Fe[Pe[a]],u=c.vertexNormals,f=c.normal,3===u.length&&K===!1)for(V=0;3>V;V++)z=u[V],ue[te]=z.x,ue[te+1]=z.y,ue[te+2]=z.z,te+=3;else for(V=0;3>V;V++)ue[te]=f.x,ue[te+1]=f.y,ue[te+2]=f.z,te+=3;Re.bindBuffer(Re.ARRAY_BUFFER,e.__webglNormalBuffer),Re.bufferData(Re.ARRAY_BUFFER,ue,r)}if(_e&&Be){for(a=0,s=Pe.length;s>a;a++)if(h=Pe[a],g=Be[h],void 0!==g)for(V=0;3>V;V++)k=g[V],ce[J]=k.x,ce[J+1]=k.y,J+=2;J>0&&(Re.bindBuffer(Re.ARRAY_BUFFER,e.__webglUVBuffer),Re.bufferData(Re.ARRAY_BUFFER,ce,r))}if(_e&&De){for(a=0,s=Pe.length;s>a;a++)if(h=Pe[a],v=De[h],void 0!==v)for(V=0;3>V;V++)N=v[V],le[$]=N.x,le[$+1]=N.y,$+=2;$>0&&(Re.bindBuffer(Re.ARRAY_BUFFER,e.__webglUV2Buffer),Re.bufferData(Re.ARRAY_BUFFER,le,r))}if(Me){for(a=0,s=Pe.length;s>a;a++)xe[ee]=Q,xe[ee+1]=Q+1,xe[ee+2]=Q+2,ee+=3,be[ie]=Q,be[ie+1]=Q+1,be[ie+2]=Q,be[ie+3]=Q+2,be[ie+4]=Q+1,be[ie+5]=Q+2,ie+=6,Q+=3;Re.bindBuffer(Re.ELEMENT_ARRAY_BUFFER,e.__webglFaceBuffer),Re.bufferData(Re.ELEMENT_ARRAY_BUFFER,xe,r),Re.bindBuffer(Re.ELEMENT_ARRAY_BUFFER,e.__webglLineBuffer),Re.bufferData(Re.ELEMENT_ARRAY_BUFFER,be,r)}if(ye)for(V=0,O=ye.length;O>V;V++)if(Y=ye[V],Y.__original.needsUpdate){if(se=0,1===Y.size){if(void 0===Y.boundTo||"vertices"===Y.boundTo)for(a=0,s=Pe.length;s>a;a++)c=Fe[Pe[a]],Y.array[se]=Y.value[c.a],Y.array[se+1]=Y.value[c.b],Y.array[se+2]=Y.value[c.c],se+=3;else if("faces"===Y.boundTo)for(a=0,s=Pe.length;s>a;a++)q=Y.value[Pe[a]],Y.array[se]=q,Y.array[se+1]=q,Y.array[se+2]=q,se+=3}else if(2===Y.size){if(void 0===Y.boundTo||"vertices"===Y.boundTo)for(a=0,s=Pe.length;s>a;a++)c=Fe[Pe[a]],y=Y.value[c.a],x=Y.value[c.b],b=Y.value[c.c],Y.array[se]=y.x,Y.array[se+1]=y.y,Y.array[se+2]=x.x,Y.array[se+3]=x.y,Y.array[se+4]=b.x,Y.array[se+5]=b.y,se+=6;else if("faces"===Y.boundTo)for(a=0,s=Pe.length;s>a;a++)q=Y.value[Pe[a]],y=q,x=q,b=q,Y.array[se]=y.x,Y.array[se+1]=y.y,Y.array[se+2]=x.x,Y.array[se+3]=x.y,Y.array[se+4]=b.x,Y.array[se+5]=b.y,se+=6}else if(3===Y.size){var ke;if(ke="c"===Y.type?["r","g","b"]:["x","y","z"],void 0===Y.boundTo||"vertices"===Y.boundTo)for(a=0,s=Pe.length;s>a;a++)c=Fe[Pe[a]],y=Y.value[c.a],x=Y.value[c.b],b=Y.value[c.c],Y.array[se]=y[ke[0]],Y.array[se+1]=y[ke[1]],Y.array[se+2]=y[ke[2]],Y.array[se+3]=x[ke[0]],Y.array[se+4]=x[ke[1]],Y.array[se+5]=x[ke[2]],Y.array[se+6]=b[ke[0]],Y.array[se+7]=b[ke[1]],Y.array[se+8]=b[ke[2]],se+=9;else if("faces"===Y.boundTo)for(a=0,s=Pe.length;s>a;a++)q=Y.value[Pe[a]],y=q,x=q,b=q,Y.array[se]=y[ke[0]],Y.array[se+1]=y[ke[1]],Y.array[se+2]=y[ke[2]],Y.array[se+3]=x[ke[0]],Y.array[se+4]=x[ke[1]],Y.array[se+5]=x[ke[2]],Y.array[se+6]=b[ke[0]],Y.array[se+7]=b[ke[1]],Y.array[se+8]=b[ke[2]],se+=9;else if("faceVertices"===Y.boundTo)for(a=0,s=Pe.length;s>a;a++)q=Y.value[Pe[a]],y=q[0],x=q[1],b=q[2],Y.array[se]=y[ke[0]],Y.array[se+1]=y[ke[1]],Y.array[se+2]=y[ke[2]],Y.array[se+3]=x[ke[0]],Y.array[se+4]=x[ke[1]],Y.array[se+5]=x[ke[2]],Y.array[se+6]=b[ke[0]],Y.array[se+7]=b[ke[1]],Y.array[se+8]=b[ke[2]],se+=9}else if(4===Y.size)if(void 0===Y.boundTo||"vertices"===Y.boundTo)for(a=0,s=Pe.length;s>a;a++)c=Fe[Pe[a]],y=Y.value[c.a],x=Y.value[c.b],b=Y.value[c.c],Y.array[se]=y.x,Y.array[se+1]=y.y,Y.array[se+2]=y.z,Y.array[se+3]=y.w,Y.array[se+4]=x.x,Y.array[se+5]=x.y,Y.array[se+6]=x.z,Y.array[se+7]=x.w,Y.array[se+8]=b.x,Y.array[se+9]=b.y,Y.array[se+10]=b.z,Y.array[se+11]=b.w,se+=12;else if("faces"===Y.boundTo)for(a=0,s=Pe.length;s>a;a++)q=Y.value[Pe[a]],y=q,x=q,b=q,Y.array[se]=y.x,Y.array[se+1]=y.y,Y.array[se+2]=y.z,Y.array[se+3]=y.w,Y.array[se+4]=x.x,Y.array[se+5]=x.y,Y.array[se+6]=x.z,Y.array[se+7]=x.w,Y.array[se+8]=b.x,Y.array[se+9]=b.y,Y.array[se+10]=b.z,Y.array[se+11]=b.w,se+=12;else if("faceVertices"===Y.boundTo)for(a=0,s=Pe.length;s>a;a++)q=Y.value[Pe[a]],y=q[0],x=q[1],b=q[2],Y.array[se]=y.x,Y.array[se+1]=y.y,Y.array[se+2]=y.z,Y.array[se+3]=y.w,Y.array[se+4]=x.x,Y.array[se+5]=x.y,Y.array[se+6]=x.z,Y.array[se+7]=x.w,Y.array[se+8]=b.x,Y.array[se+9]=b.y,Y.array[se+10]=b.z,Y.array[se+11]=b.w,se+=12;Re.bindBuffer(Re.ARRAY_BUFFER,Y.buffer),Re.bufferData(Re.ARRAY_BUFFER,Y.array,r)}i&&(delete e.__inittedArrays,delete e.__colorArray,delete e.__normalArray,delete e.__tangentArray,delete e.__uvArray,delete e.__uv2Array,delete e.__faceArray,delete e.__vertexArray,delete e.__lineArray,delete e.__skinIndexArray,delete e.__skinWeightArray)}}function d(e,t,r,i){for(var n=r.attributes,o=t.attributes,a=t.attributesKeys,s=0,h=a.length;h>s;s++){var c=a[s],l=o[c];if(l>=0){var u=n[c];if(void 0!==u){var f=u.itemSize;Re.bindBuffer(Re.ARRAY_BUFFER,u.buffer),et.enableAttribute(l),Re.vertexAttribPointer(l,f,Re.FLOAT,!1,0,i*f*4)}else void 0!==e.defaultAttributeValues&&(2===e.defaultAttributeValues[c].length?Re.vertexAttrib2fv(l,e.defaultAttributeValues[c]):3===e.defaultAttributeValues[c].length&&Re.vertexAttrib3fv(l,e.defaultAttributeValues[c]))}}et.disableUnusedAttributes()}function m(e,t,r){var i=e.program.attributes;if(-1!==r.morphTargetBase&&i.position>=0?(Re.bindBuffer(Re.ARRAY_BUFFER,t.__webglMorphTargetsBuffers[r.morphTargetBase]),et.enableAttribute(i.position),Re.vertexAttribPointer(i.position,3,Re.FLOAT,!1,0,0)):i.position>=0&&(Re.bindBuffer(Re.ARRAY_BUFFER,t.__webglVertexBuffer),et.enableAttribute(i.position),Re.vertexAttribPointer(i.position,3,Re.FLOAT,!1,0,0)),r.morphTargetForcedOrder.length)for(var n,o=0,a=r.morphTargetForcedOrder,s=r.morphTargetInfluences;o=0&&(Re.bindBuffer(Re.ARRAY_BUFFER,t.__webglMorphTargetsBuffers[a[o]]),et.enableAttribute(n),Re.vertexAttribPointer(n,3,Re.FLOAT,!1,0,0)),n=i["morphNormal"+o],n>=0&&e.morphNormals&&(Re.bindBuffer(Re.ARRAY_BUFFER,t.__webglMorphNormalsBuffers[a[o]]),et.enableAttribute(n),Re.vertexAttribPointer(n,3,Re.FLOAT,!1,0,0)),r.__webglMorphTargetInfluences[o]=s[a[o]],o++;else{var h=[],s=r.morphTargetInfluences,c=r.geometry.morphTargets;s.length>c.length&&(console.warn("THREE.WebGLRenderer: Influences array is bigger than morphTargets array."),s.length=c.length);for(var l=0,u=s.length;u>l;l++){var f=s[l];h.push([f,l])}h.length>e.numSupportedMorphTargets?(h.sort(y),h.length=e.numSupportedMorphTargets):h.length>e.numSupportedMorphNormals?h.sort(y):0===h.length&&h.push([0,0]);for(var n,o=0,p=e.numSupportedMorphTargets;p>o;o++)if(h[o]){var d=h[o][1];n=i["morphTarget"+o],n>=0&&(Re.bindBuffer(Re.ARRAY_BUFFER,t.__webglMorphTargetsBuffers[d]), -et.enableAttribute(n),Re.vertexAttribPointer(n,3,Re.FLOAT,!1,0,0)),n=i["morphNormal"+o],n>=0&&e.morphNormals&&(Re.bindBuffer(Re.ARRAY_BUFFER,t.__webglMorphNormalsBuffers[d]),et.enableAttribute(n),Re.vertexAttribPointer(n,3,Re.FLOAT,!1,0,0)),r.__webglMorphTargetInfluences[o]=s[d]}else r.__webglMorphTargetInfluences[o]=0}null!==e.program.uniforms.morphTargetInfluences&&Re.uniform1fv(e.program.uniforms.morphTargetInfluences,r.__webglMorphTargetInfluences)}function g(e,t){return e.object.renderOrder!==t.object.renderOrder?e.object.renderOrder-t.object.renderOrder:e.material.id!==t.material.id?e.material.id-t.material.id:e.z!==t.z?e.z-t.z:e.id-t.id}function v(e,t){return e.object.renderOrder!==t.object.renderOrder?e.object.renderOrder-t.object.renderOrder:e.z!==t.z?t.z-e.z:e.id-t.id}function y(e,t){return t[0]-e[0]}function x(e){if(e.visible!==!1){if(e instanceof n.Scene||e instanceof n.Group);else if(_(e),e instanceof n.Light)_e.push(e);else if(e instanceof n.Sprite)Le.push(e);else if(e instanceof n.LensFlare)Pe.push(e);else{var t=Se[e.id];if(t&&(e.frustumCulled===!1||Xe.intersectsObject(e)===!0))for(var r=0,i=t.length;i>r;r++){var o=t[r];M(o),o.render=!0,Fe.sortObjects===!0&&(Ye.setFromMatrixPosition(e.matrixWorld),Ye.applyProjection(qe),o.z=Ye.z)}}for(var r=0,i=e.children.length;i>r;r++)x(e.children[r])}}function b(e,t,r,i,o){for(var a,s=0,h=e.length;h>s;s++){var c=e[s],l=c.object,u=c.buffer;if(Q(l,t),o)a=o;else{if(a=c.material,!a)continue;U(a)}Fe.setMaterialFaces(a),u instanceof n.BufferGeometry?Fe.renderBufferDirect(t,r,i,a,u,l):Fe.renderBuffer(t,r,i,a,u,l)}}function w(e,t,r,i,n,o){for(var a,s=0,h=e.length;h>s;s++){var c=e[s],l=c.object;if(l.visible){if(o)a=o;else{if(a=c[t],!a)continue;U(a)}Fe.renderImmediateObject(r,i,n,a,l)}}}function A(e){var t=e.object,r=t.material;r.transparent?(e.transparent=r,e.opaque=null):(e.opaque=r,e.transparent=null)}function M(e){var t=e.object,r=e.buffer,i=t.geometry,o=t.material;if(o instanceof n.MeshFaceMaterial){var a=i instanceof n.BufferGeometry?0:r.materialIndex;o=o.materials[a],e.material=o,o.transparent?Ce.push(e):Te.push(e)}else o&&(e.material=o,o.transparent?Ce.push(e):Te.push(e))}function _(e){void 0===e.__webglInit&&(e.__webglInit=!0,e._modelViewMatrix=new n.Matrix4,e._normalMatrix=new n.Matrix3,e.addEventListener("removed",wt));var i=e.geometry;if(void 0===i||void 0===i.__webglInit&&(i.__webglInit=!0,i.addEventListener("dispose",At),i instanceof n.BufferGeometry?Fe.info.memory.geometries++:e instanceof n.Mesh?E(e,i):e instanceof n.Line?void 0===i.__webglVertexBuffer&&(r(i),s(i,e),i.verticesNeedUpdate=!0,i.colorsNeedUpdate=!0,i.lineDistancesNeedUpdate=!0):e instanceof n.PointCloud&&void 0===i.__webglVertexBuffer&&(t(i),a(i,e),i.verticesNeedUpdate=!0,i.colorsNeedUpdate=!0)),void 0===e.__webglActive)if(e.__webglActive=!0,e instanceof n.Mesh){if(i instanceof n.BufferGeometry)T(Se,i,e);else if(i instanceof n.Geometry)for(var o=Rt[i.id],h=0,c=o.length;c>h;h++)T(Se,o[h],e)}else e instanceof n.Line||e instanceof n.PointCloud?T(Se,i,e):(e instanceof n.ImmediateRenderObject||e.immediateRenderCallback)&&C(Ee,e)}function S(e,t){for(var r,i,n=tt.get("OES_element_index_uint")?4294967296:65535,o={},a=e.morphTargets.length,s=e.morphNormals.length,h={},c=[],l=0,u=e.faces.length;u>l;l++){var f=e.faces[l],p=t?f.materialIndex:0;p in o||(o[p]={hash:p,counter:0}),r=o[p].hash+"_"+o[p].counter,r in h||(i={id:Ft++,faces3:[],materialIndex:p,vertices:0,numMorphTargets:a,numMorphNormals:s},h[r]=i,c.push(i)),h[r].vertices+3>n&&(o[p].counter+=1,r=o[p].hash+"_"+o[p].counter,r in h||(i={id:Ft++,faces3:[],materialIndex:p,vertices:0,numMorphTargets:a,numMorphNormals:s},h[r]=i,c.push(i))),h[r].faces3.push(l),h[r].vertices+=3}return c}function E(e,t){var r=e.material,o=!1;(void 0===Rt[t.id]||t.groupsNeedUpdate===!0)&&(delete Se[e.id],Rt[t.id]=S(t,r instanceof n.MeshFaceMaterial),t.groupsNeedUpdate=!1);for(var a=Rt[t.id],s=0,c=a.length;c>s;s++){var l=a[s];void 0===l.__webglVertexBuffer?(i(l),h(l,e),t.verticesNeedUpdate=!0,t.morphTargetsNeedUpdate=!0,t.elementsNeedUpdate=!0,t.uvsNeedUpdate=!0,t.normalsNeedUpdate=!0,t.tangentsNeedUpdate=!0,t.colorsNeedUpdate=!0,o=!0):o=!1,(o||void 0===e.__webglActive)&&T(Se,l,e)}e.__webglActive=!0}function T(e,t,r){var i=r.id;e[i]=e[i]||[],e[i].push({id:i,buffer:t,object:r,material:null,z:0})}function C(e,t){e.push({id:null,object:t,opaque:null,transparent:null,z:0})}function L(e){var t=e.geometry;if(t instanceof n.BufferGeometry)for(var r=t.attributes,i=t.attributesKeys,o=0,a=i.length;a>o;o++){var s=i[o],h=r[s],l="index"===s?Re.ELEMENT_ARRAY_BUFFER:Re.ARRAY_BUFFER;void 0===h.buffer?(h.buffer=Re.createBuffer(),Re.bindBuffer(l,h.buffer),Re.bufferData(l,h.array,h instanceof n.DynamicBufferAttribute?Re.DYNAMIC_DRAW:Re.STATIC_DRAW),h.needsUpdate=!1):h.needsUpdate===!0&&(Re.bindBuffer(l,h.buffer),void 0===h.updateRange||-1===h.updateRange.count?Re.bufferSubData(l,0,h.array):0===h.updateRange.count?console.error("THREE.WebGLRenderer.updateObject: using updateRange for THREE.DynamicBufferAttribute and marked as needsUpdate but count is 0, ensure you are using set methods or updating manually."):(Re.bufferSubData(l,h.updateRange.offset*h.array.BYTES_PER_ELEMENT,h.array.subarray(h.updateRange.offset,h.updateRange.offset+h.updateRange.count)),h.updateRange.count=0),h.needsUpdate=!1)}else if(e instanceof n.Mesh){t.groupsNeedUpdate===!0&&E(e,t);for(var d=Rt[t.id],o=0,m=d.length;m>o;o++){var g=d[o],v=c(e,g),y=v.attributes&&P(v);(t.verticesNeedUpdate||t.morphTargetsNeedUpdate||t.elementsNeedUpdate||t.uvsNeedUpdate||t.normalsNeedUpdate||t.colorsNeedUpdate||t.tangentsNeedUpdate||y)&&p(g,e,Re.DYNAMIC_DRAW,!t.dynamic,v)}t.verticesNeedUpdate=!1,t.morphTargetsNeedUpdate=!1,t.elementsNeedUpdate=!1,t.uvsNeedUpdate=!1,t.normalsNeedUpdate=!1,t.colorsNeedUpdate=!1,t.tangentsNeedUpdate=!1,v.attributes&&R(v)}else if(e instanceof n.Line){var v=c(e,t),y=v.attributes&&P(v);(t.verticesNeedUpdate||t.colorsNeedUpdate||t.lineDistancesNeedUpdate||y)&&f(t,Re.DYNAMIC_DRAW),t.verticesNeedUpdate=!1,t.colorsNeedUpdate=!1,t.lineDistancesNeedUpdate=!1,v.attributes&&R(v)}else if(e instanceof n.PointCloud){var v=c(e,t),y=v.attributes&&P(v);(t.verticesNeedUpdate||t.colorsNeedUpdate||y)&&u(t,Re.DYNAMIC_DRAW,e),t.verticesNeedUpdate=!1,t.colorsNeedUpdate=!1,v.attributes&&R(v)}}function P(e){for(var t in e.attributes)if(e.attributes[t].needsUpdate)return!0;return!1}function R(e){for(var t in e.attributes)e.attributes[t].needsUpdate=!1}function F(e){e instanceof n.Mesh||e instanceof n.PointCloud||e instanceof n.Line?delete Se[e.id]:(e instanceof n.ImmediateRenderObject||e.immediateRenderCallback)&&B(Ee,e),delete e.__webglInit,delete e._modelViewMatrix,delete e._normalMatrix,delete e.__webglActive}function B(e,t){for(var r=e.length-1;r>=0;r--)e[r].object===t&&e.splice(r,1)}function D(e,t,r,i){e.addEventListener("dispose",St);var o=Bt[e.type];if(o){var a=n.ShaderLib[o];e.__webglShader={uniforms:n.UniformsUtils.clone(a.uniforms),vertexShader:a.vertexShader,fragmentShader:a.fragmentShader}}else e.__webglShader={uniforms:e.uniforms,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader};var s=ce(t),h=le(t),c=he(i),l={precision:de,supportsVertexTextures:ct,map:!!e.map,envMap:!!e.envMap,envMapMode:e.envMap&&e.envMap.mapping,lightMap:!!e.lightMap,bumpMap:!!e.bumpMap,normalMap:!!e.normalMap,specularMap:!!e.specularMap,alphaMap:!!e.alphaMap,combine:e.combine,vertexColors:e.vertexColors,fog:r,useFog:e.fog,fogExp:r instanceof n.FogExp2,flatShading:e.shading===n.FlatShading,sizeAttenuation:e.sizeAttenuation,logarithmicDepthBuffer:we,skinning:e.skinning,maxBones:c,useVertexTexture:lt&&i&&i.skeleton&&i.skeleton.useVertexTexture,morphTargets:e.morphTargets,morphNormals:e.morphNormals,maxMorphTargets:Fe.maxMorphTargets,maxMorphNormals:Fe.maxMorphNormals,maxDirLights:s.directional,maxPointLights:s.point,maxSpotLights:s.spot,maxHemiLights:s.hemi,maxShadows:h,shadowMapEnabled:Fe.shadowMapEnabled&&i.receiveShadow&&h>0,shadowMapType:Fe.shadowMapType,shadowMapDebug:Fe.shadowMapDebug,shadowMapCascade:Fe.shadowMapCascade,alphaTest:e.alphaTest,metal:e.metal,wrapAround:e.wrapAround,doubleSided:e.side===n.DoubleSide,flipSided:e.side===n.BackSide},u=[];if(o?u.push(o):(u.push(e.fragmentShader),u.push(e.vertexShader)),void 0!==e.defines)for(var f in e.defines)u.push(f),u.push(e.defines[f]);for(var f in l)u.push(f),u.push(l[f]);for(var p,d=u.join(),m=0,g=Be.length;g>m;m++){var v=Be[m];if(v.code===d){p=v,p.usedTimes++;break}}void 0===p&&(p=new n.WebGLProgram(Fe,d,e,l),Be.push(p),Fe.info.memory.programs=Be.length),e.program=p;var y=p.attributes;if(e.morphTargets){e.numSupportedMorphTargets=0;for(var x,b="morphTarget",w=0;w=0&&e.numSupportedMorphTargets++}if(e.morphNormals){e.numSupportedMorphNormals=0;var x,b="morphNormal";for(w=0;w=0&&e.numSupportedMorphNormals++}e.uniformsList=[];for(var A in e.__webglShader.uniforms){var M=e.program.uniforms[A];M&&e.uniformsList.push([e.__webglShader.uniforms[A],M])}}function U(e){e.transparent===!0?et.setBlending(e.blending,e.blendEquation,e.blendSrc,e.blendDst,e.blendEquationAlpha,e.blendSrcAlpha,e.blendDstAlpha):et.setBlending(n.NoBlending),et.setDepthTest(e.depthTest),et.setDepthWrite(e.depthWrite),et.setColorWrite(e.colorWrite),et.setPolygonOffset(e.polygonOffset,e.polygonOffsetFactor,e.polygonOffsetUnits)}function V(e,t,r,i,o){ke=0,i.needsUpdate&&(i.program&&Pt(i),D(i,t,r,o),i.needsUpdate=!1),i.morphTargets&&(o.__webglMorphTargetInfluences||(o.__webglMorphTargetInfluences=new Float32Array(Fe.maxMorphTargets)));var a=!1,s=!1,h=!1,c=i.program,l=c.uniforms,u=i.__webglShader.uniforms;if(c.id!==De&&(Re.useProgram(c.program),De=c.id,a=!0,s=!0,h=!0),i.id!==Ve&&(-1===Ve&&(h=!0),Ve=i.id,s=!0),(a||e!==ze)&&(Re.uniformMatrix4fv(l.projectionMatrix,!1,e.projectionMatrix.elements),we&&Re.uniform1f(l.logDepthBufFC,2/(Math.log(e.far+1)/Math.LN2)),e!==ze&&(ze=e),(i instanceof n.ShaderMaterial||i instanceof n.MeshPhongMaterial||i.envMap)&&null!==l.cameraPosition&&(Ye.setFromMatrixPosition(e.matrixWorld),Re.uniform3f(l.cameraPosition,Ye.x,Ye.y,Ye.z)),(i instanceof n.MeshPhongMaterial||i instanceof n.MeshLambertMaterial||i instanceof n.MeshBasicMaterial||i instanceof n.ShaderMaterial||i.skinning)&&null!==l.viewMatrix&&Re.uniformMatrix4fv(l.viewMatrix,!1,e.matrixWorldInverse.elements)),i.skinning)if(o.bindMatrix&&null!==l.bindMatrix&&Re.uniformMatrix4fv(l.bindMatrix,!1,o.bindMatrix.elements),o.bindMatrixInverse&&null!==l.bindMatrixInverse&&Re.uniformMatrix4fv(l.bindMatrixInverse,!1,o.bindMatrixInverse.elements),lt&&o.skeleton&&o.skeleton.useVertexTexture){if(null!==l.boneTexture){var f=Y();Re.uniform1i(l.boneTexture,f),Fe.setTexture(o.skeleton.boneTexture,f)}null!==l.boneTextureWidth&&Re.uniform1i(l.boneTextureWidth,o.skeleton.boneTextureWidth),null!==l.boneTextureHeight&&Re.uniform1i(l.boneTextureHeight,o.skeleton.boneTextureHeight)}else o.skeleton&&o.skeleton.boneMatrices&&null!==l.boneGlobalMatrices&&Re.uniformMatrix4fv(l.boneGlobalMatrices,!1,o.skeleton.boneMatrices);return s&&(r&&i.fog&&G(u,r),(i instanceof n.MeshPhongMaterial||i instanceof n.MeshLambertMaterial||i.lights)&&(Qe&&(h=!0,J(t),Qe=!1),h?(j(u,Ze),W(u,!0)):W(u,!1)),(i instanceof n.MeshBasicMaterial||i instanceof n.MeshLambertMaterial||i instanceof n.MeshPhongMaterial)&&O(u,i),i instanceof n.LineBasicMaterial?z(u,i):i instanceof n.LineDashedMaterial?(z(u,i),k(u,i)):i instanceof n.PointCloudMaterial?N(u,i):i instanceof n.MeshPhongMaterial?I(u,i):i instanceof n.MeshLambertMaterial?H(u,i):i instanceof n.MeshDepthMaterial?(u.mNear.value=e.near,u.mFar.value=e.far,u.opacity.value=i.opacity):i instanceof n.MeshNormalMaterial&&(u.opacity.value=i.opacity),o.receiveShadow&&!i._shadowPass&&X(u,t),K(i.uniformsList)),q(l,o),null!==l.modelMatrix&&Re.uniformMatrix4fv(l.modelMatrix,!1,o.matrixWorld.elements),c}function O(e,t){e.opacity.value=t.opacity,e.diffuse.value=t.color,e.map.value=t.map,e.lightMap.value=t.lightMap,e.specularMap.value=t.specularMap,e.alphaMap.value=t.alphaMap,t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale),t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale));var r;if(t.map?r=t.map:t.specularMap?r=t.specularMap:t.normalMap?r=t.normalMap:t.bumpMap?r=t.bumpMap:t.alphaMap&&(r=t.alphaMap),void 0!==r){var i=r.offset,o=r.repeat;e.offsetRepeat.value.set(i.x,i.y,o.x,o.y)}e.envMap.value=t.envMap,e.flipEnvMap.value=t.envMap instanceof n.WebGLRenderTargetCube?1:-1,e.reflectivity.value=t.reflectivity,e.refractionRatio.value=t.refractionRatio}function z(e,t){e.diffuse.value=t.color,e.opacity.value=t.opacity}function k(e,t){e.dashSize.value=t.dashSize,e.totalSize.value=t.dashSize+t.gapSize,e.scale.value=t.scale}function N(e,t){if(e.psColor.value=t.color,e.opacity.value=t.opacity,e.size.value=t.size,e.scale.value=ue.height/2,e.map.value=t.map,null!==t.map){var r=t.map.offset,i=t.map.repeat;e.offsetRepeat.value.set(r.x,r.y,i.x,i.y)}}function G(e,t){e.fogColor.value=t.color,t instanceof n.Fog?(e.fogNear.value=t.near,e.fogFar.value=t.far):t instanceof n.FogExp2&&(e.fogDensity.value=t.density)}function I(e,t){e.shininess.value=t.shininess,e.emissive.value=t.emissive,e.specular.value=t.specular,t.wrapAround&&e.wrapRGB.value.copy(t.wrapRGB)}function H(e,t){e.emissive.value=t.emissive,t.wrapAround&&e.wrapRGB.value.copy(t.wrapRGB)}function j(e,t){e.ambientLightColor.value=t.ambient,e.directionalLightColor.value=t.directional.colors,e.directionalLightDirection.value=t.directional.positions,e.pointLightColor.value=t.point.colors,e.pointLightPosition.value=t.point.positions,e.pointLightDistance.value=t.point.distances,e.pointLightDecay.value=t.point.decays,e.spotLightColor.value=t.spot.colors,e.spotLightPosition.value=t.spot.positions,e.spotLightDistance.value=t.spot.distances,e.spotLightDirection.value=t.spot.directions,e.spotLightAngleCos.value=t.spot.anglesCos,e.spotLightExponent.value=t.spot.exponents,e.spotLightDecay.value=t.spot.decays,e.hemisphereLightSkyColor.value=t.hemi.skyColors,e.hemisphereLightGroundColor.value=t.hemi.groundColors,e.hemisphereLightDirection.value=t.hemi.positions}function W(e,t){e.ambientLightColor.needsUpdate=t,e.directionalLightColor.needsUpdate=t,e.directionalLightDirection.needsUpdate=t,e.pointLightColor.needsUpdate=t,e.pointLightPosition.needsUpdate=t,e.pointLightDistance.needsUpdate=t,e.pointLightDecay.needsUpdate=t,e.spotLightColor.needsUpdate=t,e.spotLightPosition.needsUpdate=t,e.spotLightDistance.needsUpdate=t,e.spotLightDirection.needsUpdate=t,e.spotLightAngleCos.needsUpdate=t,e.spotLightExponent.needsUpdate=t,e.spotLightDecay.needsUpdate=t,e.hemisphereLightSkyColor.needsUpdate=t,e.hemisphereLightGroundColor.needsUpdate=t,e.hemisphereLightDirection.needsUpdate=t}function X(e,t){if(e.shadowMatrix)for(var r=0,i=0,o=t.length;o>i;i++){var a=t[i];a.castShadow&&(a instanceof n.SpotLight||a instanceof n.DirectionalLight&&!a.shadowCascade)&&(e.shadowMap.value[r]=a.shadowMap,e.shadowMapSize.value[r]=a.shadowMapSize,e.shadowMatrix.value[r]=a.shadowMatrix,e.shadowDarkness.value[r]=a.shadowDarkness,e.shadowBias.value[r]=a.shadowBias,r++)}}function q(e,t){Re.uniformMatrix4fv(e.modelViewMatrix,!1,t._modelViewMatrix.elements),e.normalMatrix&&Re.uniformMatrix3fv(e.normalMatrix,!1,t._normalMatrix.elements)}function Y(){var e=ke;return e>=ot&&n.warn("WebGLRenderer: trying to use "+e+" texture units while this GPU supports only "+ot),ke+=1,e}function K(e){for(var t,r,i,o=0,a=e.length;a>o;o++){var s=e[o][0];if(s.needsUpdate!==!1){var h=s.type,c=s.value,l=e[o][1];switch(h){case"1i":Re.uniform1i(l,c);break;case"1f":Re.uniform1f(l,c);break;case"2f":Re.uniform2f(l,c[0],c[1]);break;case"3f":Re.uniform3f(l,c[0],c[1],c[2]);break;case"4f":Re.uniform4f(l,c[0],c[1],c[2],c[3]);break;case"1iv":Re.uniform1iv(l,c);break;case"3iv":Re.uniform3iv(l,c);break;case"1fv":Re.uniform1fv(l,c);break;case"2fv":Re.uniform2fv(l,c);break;case"3fv":Re.uniform3fv(l,c);break;case"4fv":Re.uniform4fv(l,c);break;case"Matrix3fv":Re.uniformMatrix3fv(l,!1,c);break;case"Matrix4fv":Re.uniformMatrix4fv(l,!1,c);break;case"i":Re.uniform1i(l,c);break;case"f":Re.uniform1f(l,c);break;case"v2":Re.uniform2f(l,c.x,c.y);break;case"v3":Re.uniform3f(l,c.x,c.y,c.z);break;case"v4":Re.uniform4f(l,c.x,c.y,c.z,c.w);break;case"c":Re.uniform3f(l,c.r,c.g,c.b);break;case"iv1":Re.uniform1iv(l,c);break;case"iv":Re.uniform3iv(l,c);break;case"fv1":Re.uniform1fv(l,c);break;case"fv":Re.uniform3fv(l,c);break;case"v2v":void 0===s._array&&(s._array=new Float32Array(2*c.length));for(var u=0,f=c.length;f>u;u++)i=2*u,s._array[i]=c[u].x,s._array[i+1]=c[u].y;Re.uniform2fv(l,s._array);break;case"v3v":void 0===s._array&&(s._array=new Float32Array(3*c.length));for(var u=0,f=c.length;f>u;u++)i=3*u,s._array[i]=c[u].x,s._array[i+1]=c[u].y,s._array[i+2]=c[u].z;Re.uniform3fv(l,s._array);break;case"v4v":void 0===s._array&&(s._array=new Float32Array(4*c.length));for(var u=0,f=c.length;f>u;u++)i=4*u,s._array[i]=c[u].x,s._array[i+1]=c[u].y,s._array[i+2]=c[u].z,s._array[i+3]=c[u].w;Re.uniform4fv(l,s._array);break;case"m3":Re.uniformMatrix3fv(l,!1,c.elements);break;case"m3v":void 0===s._array&&(s._array=new Float32Array(9*c.length));for(var u=0,f=c.length;f>u;u++)c[u].flattenToArrayOffset(s._array,9*u);Re.uniformMatrix3fv(l,!1,s._array);break;case"m4":Re.uniformMatrix4fv(l,!1,c.elements);break;case"m4v":void 0===s._array&&(s._array=new Float32Array(16*c.length));for(var u=0,f=c.length;f>u;u++)c[u].flattenToArrayOffset(s._array,16*u);Re.uniformMatrix4fv(l,!1,s._array);break;case"t":if(t=c,r=Y(),Re.uniform1i(l,r),!t)continue;t instanceof n.CubeTexture||t.image instanceof Array&&6===t.image.length?te(t,r):t instanceof n.WebGLRenderTargetCube?re(t,r):Fe.setTexture(t,r);break;case"tv":void 0===s._array&&(s._array=[]);for(var u=0,f=s.value.length;f>u;u++)s._array[u]=Y();Re.uniform1iv(l,s._array);for(var u=0,f=s.value.length;f>u;u++)t=s.value[u],r=s._array[u],t&&Fe.setTexture(t,r);break;default:n.warn("THREE.WebGLRenderer: Unknown uniform type: "+h)}}}}function Q(e,t){e._modelViewMatrix.multiplyMatrices(t.matrixWorldInverse,e.matrixWorld),e._normalMatrix.getNormalMatrix(e._modelViewMatrix)}function Z(e,t,r,i){e[t]=r.r*i,e[t+1]=r.g*i,e[t+2]=r.b*i}function J(e){var t,r,i,o,a,s,h,c,l=0,u=0,f=0,p=Ze,d=p.directional.colors,m=p.directional.positions,g=p.point.colors,v=p.point.positions,y=p.point.distances,x=p.point.decays,b=p.spot.colors,w=p.spot.positions,A=p.spot.distances,M=p.spot.directions,_=p.spot.anglesCos,S=p.spot.exponents,E=p.spot.decays,T=p.hemi.skyColors,C=p.hemi.groundColors,L=p.hemi.positions,P=0,R=0,F=0,B=0,D=0,U=0,V=0,O=0,z=0,k=0,N=0,G=0;for(t=0,r=e.length;r>t;t++)if(i=e[t],!i.onlyShadow)if(o=i.color,h=i.intensity,c=i.distance,i instanceof n.AmbientLight){if(!i.visible)continue;l+=o.r,u+=o.g,f+=o.b}else if(i instanceof n.DirectionalLight){if(D+=1,!i.visible)continue;Ke.setFromMatrixPosition(i.matrixWorld),Ye.setFromMatrixPosition(i.target.matrixWorld),Ke.sub(Ye),Ke.normalize(),z=3*P,m[z]=Ke.x,m[z+1]=Ke.y,m[z+2]=Ke.z,Z(d,z,o,h),P+=1}else if(i instanceof n.PointLight){if(U+=1,!i.visible)continue;k=3*R,Z(g,k,o,h),Ye.setFromMatrixPosition(i.matrixWorld),v[k]=Ye.x,v[k+1]=Ye.y,v[k+2]=Ye.z,y[R]=c,x[R]=0===i.distance?0:i.decay,R+=1}else if(i instanceof n.SpotLight){if(V+=1,!i.visible)continue;N=3*F,Z(b,N,o,h),Ke.setFromMatrixPosition(i.matrixWorld),w[N]=Ke.x,w[N+1]=Ke.y,w[N+2]=Ke.z,A[F]=c,Ye.setFromMatrixPosition(i.target.matrixWorld),Ke.sub(Ye),Ke.normalize(),M[N]=Ke.x,M[N+1]=Ke.y,M[N+2]=Ke.z,_[F]=Math.cos(i.angle),S[F]=i.exponent,E[F]=0===i.distance?0:i.decay,F+=1}else if(i instanceof n.HemisphereLight){if(O+=1,!i.visible)continue;Ke.setFromMatrixPosition(i.matrixWorld),Ke.normalize(),G=3*B,L[G]=Ke.x,L[G+1]=Ke.y,L[G+2]=Ke.z,a=i.color,s=i.groundColor,Z(T,G,a,h),Z(C,G,s,h),B+=1}for(t=3*P,r=Math.max(d.length,3*D);r>t;t++)d[t]=0;for(t=3*R,r=Math.max(g.length,3*U);r>t;t++)g[t]=0;for(t=3*F,r=Math.max(b.length,3*V);r>t;t++)b[t]=0;for(t=3*B,r=Math.max(T.length,3*O);r>t;t++)T[t]=0;for(t=3*B,r=Math.max(C.length,3*O);r>t;t++)C[t]=0;p.directional.length=P,p.point.length=R,p.spot.length=F,p.hemi.length=B,p.ambient[0]=l,p.ambient[1]=u,p.ambient[2]=f}function $(e,t,r){var i;r?(Re.texParameteri(e,Re.TEXTURE_WRAP_S,se(t.wrapS)),Re.texParameteri(e,Re.TEXTURE_WRAP_T,se(t.wrapT)),Re.texParameteri(e,Re.TEXTURE_MAG_FILTER,se(t.magFilter)),Re.texParameteri(e,Re.TEXTURE_MIN_FILTER,se(t.minFilter))):(Re.texParameteri(e,Re.TEXTURE_WRAP_S,Re.CLAMP_TO_EDGE),Re.texParameteri(e,Re.TEXTURE_WRAP_T,Re.CLAMP_TO_EDGE),(t.wrapS!==n.ClampToEdgeWrapping||t.wrapT!==n.ClampToEdgeWrapping)&&n.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping. ( "+t.sourceFile+" )"),Re.texParameteri(e,Re.TEXTURE_MAG_FILTER,ae(t.magFilter)),Re.texParameteri(e,Re.TEXTURE_MIN_FILTER,ae(t.minFilter)),t.minFilter!==n.NearestFilter&&t.minFilter!==n.LinearFilter&&n.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter. ( "+t.sourceFile+" )")),i=tt.get("EXT_texture_filter_anisotropic"),i&&t.type!==n.FloatType&&t.type!==n.HalfFloatType&&(t.anisotropy>1||t.__currentAnisotropy)&&(Re.texParameterf(e,i.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(t.anisotropy,Fe.getMaxAnisotropy())),t.__currentAnisotropy=t.anisotropy)}function ee(e,t){if(e.width>t||e.height>t){var r=t/Math.max(e.width,e.height),i=document.createElement("canvas");i.width=Math.floor(e.width*r),i.height=Math.floor(e.height*r);var o=i.getContext("2d");return o.drawImage(e,0,0,e.width,e.height,0,0,i.width,i.height),n.warn("THREE.WebGLRenderer: image is too big ("+e.width+"x"+e.height+"). Resized to "+i.width+"x"+i.height,e),i}return e}function te(e,t){if(6===e.image.length)if(e.needsUpdate){e.image.__webglTextureCube||(e.addEventListener("dispose",Mt),e.image.__webglTextureCube=Re.createTexture(),Fe.info.memory.textures++),Re.activeTexture(Re.TEXTURE0+t),Re.bindTexture(Re.TEXTURE_CUBE_MAP,e.image.__webglTextureCube),Re.pixelStorei(Re.UNPACK_FLIP_Y_WEBGL,e.flipY);for(var r=e instanceof n.CompressedTexture,i=e.image[0]instanceof n.DataTexture,o=[],a=0;6>a;a++)!Fe.autoScaleCubemaps||r||i?o[a]=i?e.image[a].image:e.image[a]:o[a]=ee(e.image[a],ht);var s=o[0],h=n.Math.isPowerOfTwo(s.width)&&n.Math.isPowerOfTwo(s.height),c=se(e.format),l=se(e.type);$(Re.TEXTURE_CUBE_MAP,e,h);for(var a=0;6>a;a++)if(r)for(var u,f=o[a].mipmaps,p=0,d=f.length;d>p;p++)u=f[p],e.format!==n.RGBAFormat&&e.format!==n.RGBFormat?mt().indexOf(c)>-1?Re.compressedTexImage2D(Re.TEXTURE_CUBE_MAP_POSITIVE_X+a,p,c,u.width,u.height,0,u.data):n.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setCubeTexture()"):Re.texImage2D(Re.TEXTURE_CUBE_MAP_POSITIVE_X+a,p,c,u.width,u.height,0,c,l,u.data);else i?Re.texImage2D(Re.TEXTURE_CUBE_MAP_POSITIVE_X+a,0,c,o[a].width,o[a].height,0,c,l,o[a].data):Re.texImage2D(Re.TEXTURE_CUBE_MAP_POSITIVE_X+a,0,c,c,l,o[a]);e.generateMipmaps&&h&&Re.generateMipmap(Re.TEXTURE_CUBE_MAP),e.needsUpdate=!1,e.onUpdate&&e.onUpdate()}else Re.activeTexture(Re.TEXTURE0+t),Re.bindTexture(Re.TEXTURE_CUBE_MAP,e.image.__webglTextureCube)}function re(e,t){Re.activeTexture(Re.TEXTURE0+t),Re.bindTexture(Re.TEXTURE_CUBE_MAP,e.__webglTexture)}function ie(e,t,r){Re.bindFramebuffer(Re.FRAMEBUFFER,e),Re.framebufferTexture2D(Re.FRAMEBUFFER,Re.COLOR_ATTACHMENT0,r,t.__webglTexture,0)}function ne(e,t){Re.bindRenderbuffer(Re.RENDERBUFFER,e),t.depthBuffer&&!t.stencilBuffer?(Re.renderbufferStorage(Re.RENDERBUFFER,Re.DEPTH_COMPONENT16,t.width,t.height),Re.framebufferRenderbuffer(Re.FRAMEBUFFER,Re.DEPTH_ATTACHMENT,Re.RENDERBUFFER,e)):t.depthBuffer&&t.stencilBuffer?(Re.renderbufferStorage(Re.RENDERBUFFER,Re.DEPTH_STENCIL,t.width,t.height),Re.framebufferRenderbuffer(Re.FRAMEBUFFER,Re.DEPTH_STENCIL_ATTACHMENT,Re.RENDERBUFFER,e)):Re.renderbufferStorage(Re.RENDERBUFFER,Re.RGBA4,t.width,t.height)}function oe(e){e instanceof n.WebGLRenderTargetCube?(Re.bindTexture(Re.TEXTURE_CUBE_MAP,e.__webglTexture),Re.generateMipmap(Re.TEXTURE_CUBE_MAP),Re.bindTexture(Re.TEXTURE_CUBE_MAP,null)):(Re.bindTexture(Re.TEXTURE_2D,e.__webglTexture),Re.generateMipmap(Re.TEXTURE_2D),Re.bindTexture(Re.TEXTURE_2D,null))}function ae(e){return e===n.NearestFilter||e===n.NearestMipMapNearestFilter||e===n.NearestMipMapLinearFilter?Re.NEAREST:Re.LINEAR}function se(e){var t;if(e===n.RepeatWrapping)return Re.REPEAT;if(e===n.ClampToEdgeWrapping)return Re.CLAMP_TO_EDGE;if(e===n.MirroredRepeatWrapping)return Re.MIRRORED_REPEAT;if(e===n.NearestFilter)return Re.NEAREST;if(e===n.NearestMipMapNearestFilter)return Re.NEAREST_MIPMAP_NEAREST;if(e===n.NearestMipMapLinearFilter)return Re.NEAREST_MIPMAP_LINEAR;if(e===n.LinearFilter)return Re.LINEAR;if(e===n.LinearMipMapNearestFilter)return Re.LINEAR_MIPMAP_NEAREST;if(e===n.LinearMipMapLinearFilter)return Re.LINEAR_MIPMAP_LINEAR;if(e===n.UnsignedByteType)return Re.UNSIGNED_BYTE;if(e===n.UnsignedShort4444Type)return Re.UNSIGNED_SHORT_4_4_4_4;if(e===n.UnsignedShort5551Type)return Re.UNSIGNED_SHORT_5_5_5_1;if(e===n.UnsignedShort565Type)return Re.UNSIGNED_SHORT_5_6_5;if(e===n.ByteType)return Re.BYTE;if(e===n.ShortType)return Re.SHORT;if(e===n.UnsignedShortType)return Re.UNSIGNED_SHORT;if(e===n.IntType)return Re.INT;if(e===n.UnsignedIntType)return Re.UNSIGNED_INT;if(e===n.FloatType)return Re.FLOAT;if(t=tt.get("OES_texture_half_float"),null!==t&&e===n.HalfFloatType)return t.HALF_FLOAT_OES;if(e===n.AlphaFormat)return Re.ALPHA;if(e===n.RGBFormat)return Re.RGB;if(e===n.RGBAFormat)return Re.RGBA;if(e===n.LuminanceFormat)return Re.LUMINANCE;if(e===n.LuminanceAlphaFormat)return Re.LUMINANCE_ALPHA;if(e===n.AddEquation)return Re.FUNC_ADD;if(e===n.SubtractEquation)return Re.FUNC_SUBTRACT;if(e===n.ReverseSubtractEquation)return Re.FUNC_REVERSE_SUBTRACT;if(e===n.ZeroFactor)return Re.ZERO;if(e===n.OneFactor)return Re.ONE;if(e===n.SrcColorFactor)return Re.SRC_COLOR;if(e===n.OneMinusSrcColorFactor)return Re.ONE_MINUS_SRC_COLOR;if(e===n.SrcAlphaFactor)return Re.SRC_ALPHA;if(e===n.OneMinusSrcAlphaFactor)return Re.ONE_MINUS_SRC_ALPHA;if(e===n.DstAlphaFactor)return Re.DST_ALPHA;if(e===n.OneMinusDstAlphaFactor)return Re.ONE_MINUS_DST_ALPHA;if(e===n.DstColorFactor)return Re.DST_COLOR;if(e===n.OneMinusDstColorFactor)return Re.ONE_MINUS_DST_COLOR;if(e===n.SrcAlphaSaturateFactor)return Re.SRC_ALPHA_SATURATE;if(t=tt.get("WEBGL_compressed_texture_s3tc"),null!==t){if(e===n.RGB_S3TC_DXT1_Format)return t.COMPRESSED_RGB_S3TC_DXT1_EXT;if(e===n.RGBA_S3TC_DXT1_Format)return t.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(e===n.RGBA_S3TC_DXT3_Format)return t.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(e===n.RGBA_S3TC_DXT5_Format)return t.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(t=tt.get("WEBGL_compressed_texture_pvrtc"),null!==t){if(e===n.RGB_PVRTC_4BPPV1_Format)return t.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(e===n.RGB_PVRTC_2BPPV1_Format)return t.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(e===n.RGBA_PVRTC_4BPPV1_Format)return t.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(e===n.RGBA_PVRTC_2BPPV1_Format)return t.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(t=tt.get("EXT_blend_minmax"),null!==t){if(e===n.MinEquation)return t.MIN_EXT;if(e===n.MaxEquation)return t.MAX_EXT}return 0}function he(e){if(lt&&e&&e.skeleton&&e.skeleton.useVertexTexture)return 1024;var t=Re.getParameter(Re.MAX_VERTEX_UNIFORM_VECTORS),r=Math.floor((t-20)/4),i=r;return void 0!==e&&e instanceof n.SkinnedMesh&&(i=Math.min(e.skeleton.bones.length,i),ia;a++){var h=e[a];h.onlyShadow||h.visible===!1||(h instanceof n.DirectionalLight&&t++,h instanceof n.PointLight&&r++,h instanceof n.SpotLight&&i++,h instanceof n.HemisphereLight&&o++)}return{directional:t,point:r,spot:i,hemi:o}}function le(e){for(var t=0,r=0,i=e.length;i>r;r++){var o=e[r];o.castShadow&&(o instanceof n.SpotLight&&t++,o instanceof n.DirectionalLight&&!o.shadowCascade&&t++)}return t}console.log("THREE.WebGLRenderer",n.REVISION),e=e||{};var ue=void 0!==e.canvas?e.canvas:document.createElement("canvas"),fe=void 0!==e.context?e.context:null,pe=1,de=void 0!==e.precision?e.precision:"highp",me=void 0!==e.alpha?e.alpha:!1,ge=void 0!==e.depth?e.depth:!0,ve=void 0!==e.stencil?e.stencil:!0,ye=void 0!==e.antialias?e.antialias:!1,xe=void 0!==e.premultipliedAlpha?e.premultipliedAlpha:!0,be=void 0!==e.preserveDrawingBuffer?e.preserveDrawingBuffer:!1,we=void 0!==e.logarithmicDepthBuffer?e.logarithmicDepthBuffer:!1,Ae=new n.Color(0),Me=0,_e=[],Se={},Ee=[],Te=[],Ce=[],Le=[],Pe=[];this.domElement=ue,this.context=null,this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.gammaFactor=2,this.gammaInput=!1,this.gammaOutput=!1,this.shadowMapEnabled=!1,this.shadowMapType=n.PCFShadowMap,this.shadowMapCullFace=n.CullFaceFront,this.shadowMapDebug=!1,this.shadowMapCascade=!1,this.maxMorphTargets=8,this.maxMorphNormals=4,this.autoScaleCubemaps=!0,this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0,points:0}};var Re,Fe=this,Be=[],De=null,Ue=null,Ve=-1,Oe="",ze=null,ke=0,Ne=0,Ge=0,Ie=ue.width,He=ue.height,je=0,We=0,Xe=new n.Frustum,qe=new n.Matrix4,Ye=new n.Vector3,Ke=new n.Vector3,Qe=!0,Ze={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[],decays:[]},spot:{length:0,colors:[],positions:[],distances:[],directions:[],anglesCos:[],exponents:[],decays:[]},hemi:{length:0,skyColors:[],groundColors:[],positions:[]}};try{var Je={alpha:me,depth:ge,stencil:ve,antialias:ye,premultipliedAlpha:xe,preserveDrawingBuffer:be};if(Re=fe||ue.getContext("webgl",Je)||ue.getContext("experimental-webgl",Je),null===Re)throw null!==ue.getContext("webgl")?"Error creating WebGL context with your selected attributes.":"Error creating WebGL context.";ue.addEventListener("webglcontextlost",function(e){e.preventDefault(),nt(),it(),Se={}},!1)}catch($e){n.error("THREE.WebGLRenderer: "+$e)}var et=new n.WebGLState(Re,se);void 0===Re.getShaderPrecisionFormat&&(Re.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}});var tt=new n.WebGLExtensions(Re);tt.get("OES_texture_float"),tt.get("OES_texture_float_linear"),tt.get("OES_texture_half_float"),tt.get("OES_texture_half_float_linear"),tt.get("OES_standard_derivatives"),we&&tt.get("EXT_frag_depth");var rt=function(e,t,r,i){xe===!0&&(e*=i,t*=i,r*=i),Re.clearColor(e,t,r,i)},it=function(){Re.clearColor(0,0,0,1),Re.clearDepth(1),Re.clearStencil(0),Re.enable(Re.DEPTH_TEST),Re.depthFunc(Re.LEQUAL),Re.frontFace(Re.CCW),Re.cullFace(Re.BACK),Re.enable(Re.CULL_FACE),Re.enable(Re.BLEND),Re.blendEquation(Re.FUNC_ADD),Re.blendFunc(Re.SRC_ALPHA,Re.ONE_MINUS_SRC_ALPHA),Re.viewport(Ne,Ge,Ie,He),rt(Ae.r,Ae.g,Ae.b,Me)},nt=function(){De=null,ze=null,Oe="",Ve=-1,Qe=!0,et.reset()};it(),this.context=Re,this.state=et;var ot=Re.getParameter(Re.MAX_TEXTURE_IMAGE_UNITS),at=Re.getParameter(Re.MAX_VERTEX_TEXTURE_IMAGE_UNITS),st=Re.getParameter(Re.MAX_TEXTURE_SIZE),ht=Re.getParameter(Re.MAX_CUBE_MAP_TEXTURE_SIZE),ct=at>0,lt=ct&&tt.get("OES_texture_float"),ut=Re.getShaderPrecisionFormat(Re.VERTEX_SHADER,Re.HIGH_FLOAT),ft=Re.getShaderPrecisionFormat(Re.VERTEX_SHADER,Re.MEDIUM_FLOAT),pt=Re.getShaderPrecisionFormat(Re.FRAGMENT_SHADER,Re.HIGH_FLOAT),dt=Re.getShaderPrecisionFormat(Re.FRAGMENT_SHADER,Re.MEDIUM_FLOAT),mt=function(){var e;return function(){if(void 0!==e)return e;if(e=[],tt.get("WEBGL_compressed_texture_pvrtc")||tt.get("WEBGL_compressed_texture_s3tc"))for(var t=Re.getParameter(Re.COMPRESSED_TEXTURE_FORMATS),r=0;r0&&pt.precision>0,vt=ft.precision>0&&dt.precision>0;"highp"!==de||gt||(vt?(de="mediump",n.warn("THREE.WebGLRenderer: highp not supported, using mediump.")):(de="lowp",n.warn("THREE.WebGLRenderer: highp and mediump not supported, using lowp."))),"mediump"!==de||vt||(de="lowp",n.warn("THREE.WebGLRenderer: mediump not supported, using lowp.")); -var yt=new n.ShadowMapPlugin(this,_e,Se,Ee),xt=new n.SpritePlugin(this,Le),bt=new n.LensFlarePlugin(this,Pe);this.getContext=function(){return Re},this.forceContextLoss=function(){tt.get("WEBGL_lose_context").loseContext()},this.supportsVertexTextures=function(){return ct},this.supportsFloatTextures=function(){return tt.get("OES_texture_float")},this.supportsHalfFloatTextures=function(){return tt.get("OES_texture_half_float")},this.supportsStandardDerivatives=function(){return tt.get("OES_standard_derivatives")},this.supportsCompressedTextureS3TC=function(){return tt.get("WEBGL_compressed_texture_s3tc")},this.supportsCompressedTexturePVRTC=function(){return tt.get("WEBGL_compressed_texture_pvrtc")},this.supportsBlendMinMax=function(){return tt.get("EXT_blend_minmax")},this.getMaxAnisotropy=function(){var e;return function(){if(void 0!==e)return e;var t=tt.get("EXT_texture_filter_anisotropic");return e=null!==t?Re.getParameter(t.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0}}(),this.getPrecision=function(){return de},this.getPixelRatio=function(){return pe},this.setPixelRatio=function(e){pe=e},this.setSize=function(e,t,r){ue.width=e*pe,ue.height=t*pe,r!==!1&&(ue.style.width=e+"px",ue.style.height=t+"px"),this.setViewport(0,0,e,t)},this.setViewport=function(e,t,r,i){Ne=e*pe,Ge=t*pe,Ie=r*pe,He=i*pe,Re.viewport(Ne,Ge,Ie,He)},this.setScissor=function(e,t,r,i){Re.scissor(e*pe,t*pe,r*pe,i*pe)},this.enableScissorTest=function(e){e?Re.enable(Re.SCISSOR_TEST):Re.disable(Re.SCISSOR_TEST)},this.getClearColor=function(){return Ae},this.setClearColor=function(e,t){Ae.set(e),Me=void 0!==t?t:1,rt(Ae.r,Ae.g,Ae.b,Me)},this.getClearAlpha=function(){return Me},this.setClearAlpha=function(e){Me=e,rt(Ae.r,Ae.g,Ae.b,Me)},this.clear=function(e,t,r){var i=0;(void 0===e||e)&&(i|=Re.COLOR_BUFFER_BIT),(void 0===t||t)&&(i|=Re.DEPTH_BUFFER_BIT),(void 0===r||r)&&(i|=Re.STENCIL_BUFFER_BIT),Re.clear(i)},this.clearColor=function(){Re.clear(Re.COLOR_BUFFER_BIT)},this.clearDepth=function(){Re.clear(Re.DEPTH_BUFFER_BIT)},this.clearStencil=function(){Re.clear(Re.STENCIL_BUFFER_BIT)},this.clearTarget=function(e,t,r,i){this.setRenderTarget(e),this.clear(t,r,i)},this.resetGLState=nt;var wt=function(e){var t=e.target;t.traverse(function(e){e.removeEventListener("remove",wt),F(e)})},At=function(e){var t=e.target;t.removeEventListener("dispose",At),Tt(t)},Mt=function(e){var t=e.target;t.removeEventListener("dispose",Mt),Ct(t),Fe.info.memory.textures--},_t=function(e){var t=e.target;t.removeEventListener("dispose",_t),Lt(t),Fe.info.memory.textures--},St=function(e){var t=e.target;t.removeEventListener("dispose",St),Pt(t)},Et=function(e){for(var t=["__webglVertexBuffer","__webglNormalBuffer","__webglTangentBuffer","__webglColorBuffer","__webglUVBuffer","__webglUV2Buffer","__webglSkinIndicesBuffer","__webglSkinWeightsBuffer","__webglFaceBuffer","__webglLineBuffer","__webglLineDistanceBuffer"],r=0,i=t.length;i>r;r++){var n=t[r];void 0!==e[n]&&(Re.deleteBuffer(e[n]),delete e[n])}if(void 0!==e.__webglCustomAttributesList){for(var n in e.__webglCustomAttributesList)Re.deleteBuffer(e.__webglCustomAttributesList[n].buffer);delete e.__webglCustomAttributesList}Fe.info.memory.geometries--},Tt=function(e){if(delete e.__webglInit,e instanceof n.BufferGeometry){for(var t in e.attributes){var r=e.attributes[t];void 0!==r.buffer&&(Re.deleteBuffer(r.buffer),delete r.buffer)}Fe.info.memory.geometries--}else{var i=Rt[e.id];if(void 0!==i){for(var o=0,a=i.length;a>o;o++){var s=i[o];if(void 0!==s.numMorphTargets){for(var h=0,c=s.numMorphTargets;c>h;h++)Re.deleteBuffer(s.__webglMorphTargetsBuffers[h]);delete s.__webglMorphTargetsBuffers}if(void 0!==s.numMorphNormals){for(var h=0,c=s.numMorphNormals;c>h;h++)Re.deleteBuffer(s.__webglMorphNormalsBuffers[h]);delete s.__webglMorphNormalsBuffers}Et(s)}delete Rt[e.id]}else Et(e)}Oe=""},Ct=function(e){if(e.image&&e.image.__webglTextureCube)Re.deleteTexture(e.image.__webglTextureCube),delete e.image.__webglTextureCube;else{if(void 0===e.__webglInit)return;Re.deleteTexture(e.__webglTexture),delete e.__webglTexture,delete e.__webglInit}},Lt=function(e){if(e&&void 0!==e.__webglTexture){if(Re.deleteTexture(e.__webglTexture),delete e.__webglTexture,e instanceof n.WebGLRenderTargetCube)for(var t=0;6>t;t++)Re.deleteFramebuffer(e.__webglFramebuffer[t]),Re.deleteRenderbuffer(e.__webglRenderbuffer[t]);else Re.deleteFramebuffer(e.__webglFramebuffer),Re.deleteRenderbuffer(e.__webglRenderbuffer);delete e.__webglFramebuffer,delete e.__webglRenderbuffer}},Pt=function(e){var t=e.program.program;if(void 0!==t){e.program=void 0;var r,i,n,o=!1;for(r=0,i=Be.length;i>r;r++)if(n=Be[r],n.program===t){n.usedTimes--,0===n.usedTimes&&(o=!0);break}if(o===!0){var a=[];for(r=0,i=Be.length;i>r;r++)n=Be[r],n.program!==t&&a.push(n);Be=a,Re.deleteProgram(t),Fe.info.memory.programs--}}};this.renderBufferImmediate=function(e,t,r){if(et.initAttributes(),e.hasPositions&&!e.__webglVertexBuffer&&(e.__webglVertexBuffer=Re.createBuffer()),e.hasNormals&&!e.__webglNormalBuffer&&(e.__webglNormalBuffer=Re.createBuffer()),e.hasUvs&&!e.__webglUvBuffer&&(e.__webglUvBuffer=Re.createBuffer()),e.hasColors&&!e.__webglColorBuffer&&(e.__webglColorBuffer=Re.createBuffer()),e.hasPositions&&(Re.bindBuffer(Re.ARRAY_BUFFER,e.__webglVertexBuffer),Re.bufferData(Re.ARRAY_BUFFER,e.positionArray,Re.DYNAMIC_DRAW),et.enableAttribute(t.attributes.position),Re.vertexAttribPointer(t.attributes.position,3,Re.FLOAT,!1,0,0)),e.hasNormals){if(Re.bindBuffer(Re.ARRAY_BUFFER,e.__webglNormalBuffer),r instanceof n.MeshPhongMaterial==!1&&r.shading===n.FlatShading){var i,o,a,s,h,c,l,u,f,p,d,m,g,v,y=3*e.count;for(v=0;y>v;v+=9)g=e.normalArray,s=g[v],l=g[v+1],p=g[v+2],h=g[v+3],u=g[v+4],d=g[v+5],c=g[v+6],f=g[v+7],m=g[v+8],i=(s+h+c)/3,o=(l+u+f)/3,a=(p+d+m)/3,g[v]=i,g[v+1]=o,g[v+2]=a,g[v+3]=i,g[v+4]=o,g[v+5]=a,g[v+6]=i,g[v+7]=o,g[v+8]=a}Re.bufferData(Re.ARRAY_BUFFER,e.normalArray,Re.DYNAMIC_DRAW),et.enableAttribute(t.attributes.normal),Re.vertexAttribPointer(t.attributes.normal,3,Re.FLOAT,!1,0,0)}e.hasUvs&&r.map&&(Re.bindBuffer(Re.ARRAY_BUFFER,e.__webglUvBuffer),Re.bufferData(Re.ARRAY_BUFFER,e.uvArray,Re.DYNAMIC_DRAW),et.enableAttribute(t.attributes.uv),Re.vertexAttribPointer(t.attributes.uv,2,Re.FLOAT,!1,0,0)),e.hasColors&&r.vertexColors!==n.NoColors&&(Re.bindBuffer(Re.ARRAY_BUFFER,e.__webglColorBuffer),Re.bufferData(Re.ARRAY_BUFFER,e.colorArray,Re.DYNAMIC_DRAW),et.enableAttribute(t.attributes.color),Re.vertexAttribPointer(t.attributes.color,3,Re.FLOAT,!1,0,0)),et.disableUnusedAttributes(),Re.drawArrays(Re.TRIANGLES,0,e.count),e.count=0},this.renderBufferDirect=function(e,t,r,i,o,a){if(i.visible!==!1){L(a);var s=V(e,t,r,i,a),h=!1,c=i.wireframe?1:0,l="direct_"+o.id+"_"+s.id+"_"+c;if(l!==Oe&&(Oe=l,h=!0),h&&et.initAttributes(),a instanceof n.Mesh){var u=i.wireframe===!0?Re.LINES:Re.TRIANGLES,f=o.attributes.index;if(f){var p,m;f.array instanceof Uint32Array&&tt.get("OES_element_index_uint")?(p=Re.UNSIGNED_INT,m=4):(p=Re.UNSIGNED_SHORT,m=2);var g=o.offsets;if(0===g.length)h&&(d(i,s,o,0),Re.bindBuffer(Re.ELEMENT_ARRAY_BUFFER,f.buffer)),Re.drawElements(u,f.array.length,p,0),Fe.info.render.calls++,Fe.info.render.vertices+=f.array.length,Fe.info.render.faces+=f.array.length/3;else{h=!0;for(var v=0,y=g.length;y>v;v++){var x=g[v].index;h&&(d(i,s,o,x),Re.bindBuffer(Re.ELEMENT_ARRAY_BUFFER,f.buffer)),Re.drawElements(u,g[v].count,p,g[v].start*m),Fe.info.render.calls++,Fe.info.render.vertices+=g[v].count,Fe.info.render.faces+=g[v].count/3}}}else{h&&d(i,s,o,0);var b=o.attributes.position;Re.drawArrays(u,0,b.array.length/b.itemSize),Fe.info.render.calls++,Fe.info.render.vertices+=b.array.length/b.itemSize,Fe.info.render.faces+=b.array.length/(3*b.itemSize)}}else if(a instanceof n.PointCloud){var u=Re.POINTS,f=o.attributes.index;if(f){var p,m;f.array instanceof Uint32Array&&tt.get("OES_element_index_uint")?(p=Re.UNSIGNED_INT,m=4):(p=Re.UNSIGNED_SHORT,m=2);var g=o.offsets;if(0===g.length)h&&(d(i,s,o,0),Re.bindBuffer(Re.ELEMENT_ARRAY_BUFFER,f.buffer)),Re.drawElements(u,f.array.length,p,0),Fe.info.render.calls++,Fe.info.render.points+=f.array.length;else{g.length>1&&(h=!0);for(var v=0,y=g.length;y>v;v++){var x=g[v].index;h&&(d(i,s,o,x),Re.bindBuffer(Re.ELEMENT_ARRAY_BUFFER,f.buffer)),Re.drawElements(u,g[v].count,p,g[v].start*m),Fe.info.render.calls++,Fe.info.render.points+=g[v].count}}}else{h&&d(i,s,o,0);var b=o.attributes.position,g=o.offsets;if(0===g.length)Re.drawArrays(u,0,b.array.length/3),Fe.info.render.calls++,Fe.info.render.points+=b.array.length/3;else for(var v=0,y=g.length;y>v;v++)Re.drawArrays(u,g[v].index,g[v].count),Fe.info.render.calls++,Fe.info.render.points+=g[v].count}}else if(a instanceof n.Line){var u=a.mode===n.LineStrip?Re.LINE_STRIP:Re.LINES;et.setLineWidth(i.linewidth*pe);var f=o.attributes.index;if(f){var p,m;f.array instanceof Uint32Array?(p=Re.UNSIGNED_INT,m=4):(p=Re.UNSIGNED_SHORT,m=2);var g=o.offsets;if(0===g.length)h&&(d(i,s,o,0),Re.bindBuffer(Re.ELEMENT_ARRAY_BUFFER,f.buffer)),Re.drawElements(u,f.array.length,p,0),Fe.info.render.calls++,Fe.info.render.vertices+=f.array.length;else{g.length>1&&(h=!0);for(var v=0,y=g.length;y>v;v++){var x=g[v].index;h&&(d(i,s,o,x),Re.bindBuffer(Re.ELEMENT_ARRAY_BUFFER,f.buffer)),Re.drawElements(u,g[v].count,p,g[v].start*m),Fe.info.render.calls++,Fe.info.render.vertices+=g[v].count}}}else{h&&d(i,s,o,0);var b=o.attributes.position,g=o.offsets;if(0===g.length)Re.drawArrays(u,0,b.array.length/3),Fe.info.render.calls++,Fe.info.render.vertices+=b.array.length/3;else for(var v=0,y=g.length;y>v;v++)Re.drawArrays(u,g[v].index,g[v].count),Fe.info.render.calls++,Fe.info.render.vertices+=g[v].count}}}},this.renderBuffer=function(e,t,r,i,o,a){if(i.visible!==!1){L(a);var s=V(e,t,r,i,a),h=s.attributes,c=!1,l=i.wireframe?1:0,u=o.id+"_"+s.id+"_"+l;if(u!==Oe&&(Oe=u,c=!0),c&&et.initAttributes(),!i.morphTargets&&h.position>=0?c&&(Re.bindBuffer(Re.ARRAY_BUFFER,o.__webglVertexBuffer),et.enableAttribute(h.position),Re.vertexAttribPointer(h.position,3,Re.FLOAT,!1,0,0)):a.morphTargetBase&&m(i,o,a),c){if(o.__webglCustomAttributesList)for(var f=0,p=o.__webglCustomAttributesList.length;p>f;f++){var d=o.__webglCustomAttributesList[f];h[d.buffer.belongsToAttribute]>=0&&(Re.bindBuffer(Re.ARRAY_BUFFER,d.buffer),et.enableAttribute(h[d.buffer.belongsToAttribute]),Re.vertexAttribPointer(h[d.buffer.belongsToAttribute],d.size,Re.FLOAT,!1,0,0))}h.color>=0&&(a.geometry.colors.length>0||a.geometry.faces.length>0?(Re.bindBuffer(Re.ARRAY_BUFFER,o.__webglColorBuffer),et.enableAttribute(h.color),Re.vertexAttribPointer(h.color,3,Re.FLOAT,!1,0,0)):void 0!==i.defaultAttributeValues&&Re.vertexAttrib3fv(h.color,i.defaultAttributeValues.color)),h.normal>=0&&(Re.bindBuffer(Re.ARRAY_BUFFER,o.__webglNormalBuffer),et.enableAttribute(h.normal),Re.vertexAttribPointer(h.normal,3,Re.FLOAT,!1,0,0)),h.tangent>=0&&(Re.bindBuffer(Re.ARRAY_BUFFER,o.__webglTangentBuffer),et.enableAttribute(h.tangent),Re.vertexAttribPointer(h.tangent,4,Re.FLOAT,!1,0,0)),h.uv>=0&&(a.geometry.faceVertexUvs[0]?(Re.bindBuffer(Re.ARRAY_BUFFER,o.__webglUVBuffer),et.enableAttribute(h.uv),Re.vertexAttribPointer(h.uv,2,Re.FLOAT,!1,0,0)):void 0!==i.defaultAttributeValues&&Re.vertexAttrib2fv(h.uv,i.defaultAttributeValues.uv)),h.uv2>=0&&(a.geometry.faceVertexUvs[1]?(Re.bindBuffer(Re.ARRAY_BUFFER,o.__webglUV2Buffer),et.enableAttribute(h.uv2),Re.vertexAttribPointer(h.uv2,2,Re.FLOAT,!1,0,0)):void 0!==i.defaultAttributeValues&&Re.vertexAttrib2fv(h.uv2,i.defaultAttributeValues.uv2)),i.skinning&&h.skinIndex>=0&&h.skinWeight>=0&&(Re.bindBuffer(Re.ARRAY_BUFFER,o.__webglSkinIndicesBuffer),et.enableAttribute(h.skinIndex),Re.vertexAttribPointer(h.skinIndex,4,Re.FLOAT,!1,0,0),Re.bindBuffer(Re.ARRAY_BUFFER,o.__webglSkinWeightsBuffer),et.enableAttribute(h.skinWeight),Re.vertexAttribPointer(h.skinWeight,4,Re.FLOAT,!1,0,0)),h.lineDistance>=0&&(Re.bindBuffer(Re.ARRAY_BUFFER,o.__webglLineDistanceBuffer),et.enableAttribute(h.lineDistance),Re.vertexAttribPointer(h.lineDistance,1,Re.FLOAT,!1,0,0))}if(et.disableUnusedAttributes(),a instanceof n.Mesh){var g=o.__typeArray===Uint32Array?Re.UNSIGNED_INT:Re.UNSIGNED_SHORT;i.wireframe?(et.setLineWidth(i.wireframeLinewidth*pe),c&&Re.bindBuffer(Re.ELEMENT_ARRAY_BUFFER,o.__webglLineBuffer),Re.drawElements(Re.LINES,o.__webglLineCount,g,0)):(c&&Re.bindBuffer(Re.ELEMENT_ARRAY_BUFFER,o.__webglFaceBuffer),Re.drawElements(Re.TRIANGLES,o.__webglFaceCount,g,0)),Fe.info.render.calls++,Fe.info.render.vertices+=o.__webglFaceCount,Fe.info.render.faces+=o.__webglFaceCount/3}else if(a instanceof n.Line){var v=a.mode===n.LineStrip?Re.LINE_STRIP:Re.LINES;et.setLineWidth(i.linewidth*pe),Re.drawArrays(v,0,o.__webglLineCount),Fe.info.render.calls++}else a instanceof n.PointCloud&&(Re.drawArrays(Re.POINTS,0,o.__webglParticleCount),Fe.info.render.calls++,Fe.info.render.points+=o.__webglParticleCount)}},this.render=function(e,t,r,i){if(t instanceof n.Camera==!1)return void n.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");var o=e.fog;Oe="",Ve=-1,ze=null,Qe=!0,e.autoUpdate===!0&&e.updateMatrixWorld(),void 0===t.parent&&t.updateMatrixWorld(),e.traverse(function(e){e instanceof n.SkinnedMesh&&e.skeleton.update()}),t.matrixWorldInverse.getInverse(t.matrixWorld),qe.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),Xe.setFromMatrix(qe),_e.length=0,Te.length=0,Ce.length=0,Le.length=0,Pe.length=0,x(e),Fe.sortObjects===!0&&(Te.sort(g),Ce.sort(v)),yt.render(e,t),Fe.info.render.calls=0,Fe.info.render.vertices=0,Fe.info.render.faces=0,Fe.info.render.points=0,this.setRenderTarget(r),(this.autoClear||i)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);for(var a=0,s=Ee.length;s>a;a++){var h=Ee[a],c=h.object;c.visible&&(Q(c,t),A(h))}if(e.overrideMaterial){var l=e.overrideMaterial;U(l),b(Te,t,_e,o,l),b(Ce,t,_e,o,l),w(Ee,"",t,_e,o,l)}else et.setBlending(n.NoBlending),b(Te,t,_e,o,null),w(Ee,"opaque",t,_e,o,null),b(Ce,t,_e,o,null),w(Ee,"transparent",t,_e,o,null);xt.render(e,t),bt.render(e,t,je,We),r&&r.generateMipmaps&&r.minFilter!==n.NearestFilter&&r.minFilter!==n.LinearFilter&&oe(r),et.setDepthTest(!0),et.setDepthWrite(!0),et.setColorWrite(!0)},this.renderImmediateObject=function(e,t,r,i,n){var o=V(e,t,r,i,n);Oe="",Fe.setMaterialFaces(i),n.immediateRenderCallback?n.immediateRenderCallback(o,Re,Xe):n.render(function(e){Fe.renderBufferImmediate(e,o,i)})};var Rt={},Ft=0,Bt={MeshDepthMaterial:"depth",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointCloudMaterial:"particle_basic"};this.setFaceCulling=function(e,t){e===n.CullFaceNone?Re.disable(Re.CULL_FACE):(t===n.FrontFaceDirectionCW?Re.frontFace(Re.CW):Re.frontFace(Re.CCW),e===n.CullFaceBack?Re.cullFace(Re.BACK):e===n.CullFaceFront?Re.cullFace(Re.FRONT):Re.cullFace(Re.FRONT_AND_BACK),Re.enable(Re.CULL_FACE))},this.setMaterialFaces=function(e){et.setDoubleSided(e.side===n.DoubleSide),et.setFlipSided(e.side===n.BackSide)},this.uploadTexture=function(e){void 0===e.__webglInit&&(e.__webglInit=!0,e.addEventListener("dispose",Mt),e.__webglTexture=Re.createTexture(),Fe.info.memory.textures++),Re.bindTexture(Re.TEXTURE_2D,e.__webglTexture),Re.pixelStorei(Re.UNPACK_FLIP_Y_WEBGL,e.flipY),Re.pixelStorei(Re.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e.premultiplyAlpha),Re.pixelStorei(Re.UNPACK_ALIGNMENT,e.unpackAlignment),e.image=ee(e.image,st);var t=e.image,r=n.Math.isPowerOfTwo(t.width)&&n.Math.isPowerOfTwo(t.height),i=se(e.format),o=se(e.type);$(Re.TEXTURE_2D,e,r);var a,s=e.mipmaps;if(e instanceof n.DataTexture)if(s.length>0&&r){for(var h=0,c=s.length;c>h;h++)a=s[h],Re.texImage2D(Re.TEXTURE_2D,h,i,a.width,a.height,0,i,o,a.data);e.generateMipmaps=!1}else Re.texImage2D(Re.TEXTURE_2D,0,i,t.width,t.height,0,i,o,t.data);else if(e instanceof n.CompressedTexture)for(var h=0,c=s.length;c>h;h++)a=s[h],e.format!==n.RGBAFormat&&e.format!==n.RGBFormat?mt().indexOf(i)>-1?Re.compressedTexImage2D(Re.TEXTURE_2D,h,i,a.width,a.height,0,a.data):n.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):Re.texImage2D(Re.TEXTURE_2D,h,i,a.width,a.height,0,i,o,a.data);else if(s.length>0&&r){for(var h=0,c=s.length;c>h;h++)a=s[h],Re.texImage2D(Re.TEXTURE_2D,h,i,i,o,a);e.generateMipmaps=!1}else Re.texImage2D(Re.TEXTURE_2D,0,i,i,o,e.image);e.generateMipmaps&&r&&Re.generateMipmap(Re.TEXTURE_2D),e.needsUpdate=!1,e.onUpdate&&e.onUpdate()},this.setTexture=function(e,t){Re.activeTexture(Re.TEXTURE0+t),e.needsUpdate?Fe.uploadTexture(e):Re.bindTexture(Re.TEXTURE_2D,e.__webglTexture)},this.setRenderTarget=function(e){var t=e instanceof n.WebGLRenderTargetCube;if(e&&void 0===e.__webglFramebuffer){void 0===e.depthBuffer&&(e.depthBuffer=!0),void 0===e.stencilBuffer&&(e.stencilBuffer=!0),e.addEventListener("dispose",_t),e.__webglTexture=Re.createTexture(),Fe.info.memory.textures++;var r=n.Math.isPowerOfTwo(e.width)&&n.Math.isPowerOfTwo(e.height),i=se(e.format),o=se(e.type);if(t){e.__webglFramebuffer=[],e.__webglRenderbuffer=[],Re.bindTexture(Re.TEXTURE_CUBE_MAP,e.__webglTexture),$(Re.TEXTURE_CUBE_MAP,e,r);for(var a=0;6>a;a++)e.__webglFramebuffer[a]=Re.createFramebuffer(),e.__webglRenderbuffer[a]=Re.createRenderbuffer(),Re.texImage2D(Re.TEXTURE_CUBE_MAP_POSITIVE_X+a,0,i,e.width,e.height,0,i,o,null),ie(e.__webglFramebuffer[a],e,Re.TEXTURE_CUBE_MAP_POSITIVE_X+a),ne(e.__webglRenderbuffer[a],e);r&&Re.generateMipmap(Re.TEXTURE_CUBE_MAP)}else e.__webglFramebuffer=Re.createFramebuffer(),e.shareDepthFrom?e.__webglRenderbuffer=e.shareDepthFrom.__webglRenderbuffer:e.__webglRenderbuffer=Re.createRenderbuffer(),Re.bindTexture(Re.TEXTURE_2D,e.__webglTexture),$(Re.TEXTURE_2D,e,r),Re.texImage2D(Re.TEXTURE_2D,0,i,e.width,e.height,0,i,o,null),ie(e.__webglFramebuffer,e,Re.TEXTURE_2D),e.shareDepthFrom?e.depthBuffer&&!e.stencilBuffer?Re.framebufferRenderbuffer(Re.FRAMEBUFFER,Re.DEPTH_ATTACHMENT,Re.RENDERBUFFER,e.__webglRenderbuffer):e.depthBuffer&&e.stencilBuffer&&Re.framebufferRenderbuffer(Re.FRAMEBUFFER,Re.DEPTH_STENCIL_ATTACHMENT,Re.RENDERBUFFER,e.__webglRenderbuffer):ne(e.__webglRenderbuffer,e),r&&Re.generateMipmap(Re.TEXTURE_2D);t?Re.bindTexture(Re.TEXTURE_CUBE_MAP,null):Re.bindTexture(Re.TEXTURE_2D,null),Re.bindRenderbuffer(Re.RENDERBUFFER,null),Re.bindFramebuffer(Re.FRAMEBUFFER,null)}var s,h,c,l,u;e?(s=t?e.__webglFramebuffer[e.activeCubeFace]:e.__webglFramebuffer,h=e.width,c=e.height,l=0,u=0):(s=null,h=Ie,c=He,l=Ne,u=Ge),s!==Ue&&(Re.bindFramebuffer(Re.FRAMEBUFFER,s),Re.viewport(l,u,h,c),Ue=s),je=h,We=c},this.readRenderTargetPixels=function(e,t,r,i,o,a){if(!(e instanceof n.WebGLRenderTarget))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");if(e.__webglFramebuffer){if(e.format!==n.RGBAFormat)return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA format. readPixels can read only RGBA format.");var s=!1;e.__webglFramebuffer!==Ue&&(Re.bindFramebuffer(Re.FRAMEBUFFER,e.__webglFramebuffer),s=!0),Re.checkFramebufferStatus(Re.FRAMEBUFFER)===Re.FRAMEBUFFER_COMPLETE?Re.readPixels(t,r,i,o,Re.RGBA,Re.UNSIGNED_BYTE,a):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete."),s&&Re.bindFramebuffer(Re.FRAMEBUFFER,Ue)}},this.initMaterial=function(){n.warn("THREE.WebGLRenderer: .initMaterial() has been removed.")},this.addPrePlugin=function(){n.warn("THREE.WebGLRenderer: .addPrePlugin() has been removed.")},this.addPostPlugin=function(){n.warn("THREE.WebGLRenderer: .addPostPlugin() has been removed.")},this.updateShadowMap=function(){n.warn("THREE.WebGLRenderer: .updateShadowMap() has been removed.")}},n.WebGLRenderTarget=function(e,t,r){this.width=e,this.height=t,r=r||{},this.wrapS=void 0!==r.wrapS?r.wrapS:n.ClampToEdgeWrapping,this.wrapT=void 0!==r.wrapT?r.wrapT:n.ClampToEdgeWrapping,this.magFilter=void 0!==r.magFilter?r.magFilter:n.LinearFilter,this.minFilter=void 0!==r.minFilter?r.minFilter:n.LinearMipMapLinearFilter,this.anisotropy=void 0!==r.anisotropy?r.anisotropy:1,this.offset=new n.Vector2(0,0),this.repeat=new n.Vector2(1,1),this.format=void 0!==r.format?r.format:n.RGBAFormat,this.type=void 0!==r.type?r.type:n.UnsignedByteType,this.depthBuffer=void 0!==r.depthBuffer?r.depthBuffer:!0,this.stencilBuffer=void 0!==r.stencilBuffer?r.stencilBuffer:!0,this.generateMipmaps=!0,this.shareDepthFrom=void 0!==r.shareDepthFrom?r.shareDepthFrom:null},n.WebGLRenderTarget.prototype={constructor:n.WebGLRenderTarget,setSize:function(e,t){this.width=e,this.height=t},clone:function(){var e=new n.WebGLRenderTarget(this.width,this.height);return e.wrapS=this.wrapS,e.wrapT=this.wrapT,e.magFilter=this.magFilter,e.minFilter=this.minFilter,e.anisotropy=this.anisotropy,e.offset.copy(this.offset),e.repeat.copy(this.repeat),e.format=this.format,e.type=this.type,e.depthBuffer=this.depthBuffer,e.stencilBuffer=this.stencilBuffer,e.generateMipmaps=this.generateMipmaps,e.shareDepthFrom=this.shareDepthFrom,e},dispose:function(){this.dispatchEvent({type:"dispose"})}},n.EventDispatcher.prototype.apply(n.WebGLRenderTarget.prototype),n.WebGLRenderTargetCube=function(e,t,r){n.WebGLRenderTarget.call(this,e,t,r),this.activeCubeFace=0},n.WebGLRenderTargetCube.prototype=Object.create(n.WebGLRenderTarget.prototype),n.WebGLRenderTargetCube.prototype.constructor=n.WebGLRenderTargetCube,n.WebGLExtensions=function(e){var t={};this.get=function(r){if(void 0!==t[r])return t[r];var i;switch(r){case"EXT_texture_filter_anisotropic":i=e.getExtension("EXT_texture_filter_anisotropic")||e.getExtension("MOZ_EXT_texture_filter_anisotropic")||e.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":i=e.getExtension("WEBGL_compressed_texture_s3tc")||e.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":i=e.getExtension("WEBGL_compressed_texture_pvrtc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:i=e.getExtension(r)}return null===i&&n.warn("THREE.WebGLRenderer: "+r+" extension not supported."),t[r]=i,i}},n.WebGLProgram=function(){var e=0,t=function(e){var t,r,i=[];for(var n in e)t=e[n],t!==!1&&(r="#define "+n+" "+t,i.push(r));return i.join("\n")},r=function(e,t,r){for(var i={},n=0,o=r.length;o>n;n++){var a=r[n];i[a]=e.getUniformLocation(t,a)}return i},i=function(e,t,r){for(var i={},n=0,o=r.length;o>n;n++){var a=r[n];i[a]=e.getAttribLocation(t,a)}return i};return function(o,a,s,h){var c=o,l=c.context,u=s.defines,f=s.__webglShader.uniforms,p=s.attributes,d=s.__webglShader.vertexShader,m=s.__webglShader.fragmentShader,g=s.index0AttributeName;void 0===g&&h.morphTargets===!0&&(g="position");var v="SHADOWMAP_TYPE_BASIC";h.shadowMapType===n.PCFShadowMap?v="SHADOWMAP_TYPE_PCF":h.shadowMapType===n.PCFSoftShadowMap&&(v="SHADOWMAP_TYPE_PCF_SOFT");var y="ENVMAP_TYPE_CUBE",x="ENVMAP_MODE_REFLECTION",b="ENVMAP_BLENDING_MULTIPLY";if(h.envMap){switch(s.envMap.mapping){case n.CubeReflectionMapping:case n.CubeRefractionMapping:y="ENVMAP_TYPE_CUBE";break;case n.EquirectangularReflectionMapping:case n.EquirectangularRefractionMapping:y="ENVMAP_TYPE_EQUIREC";break;case n.SphericalReflectionMapping:y="ENVMAP_TYPE_SPHERE"}switch(s.envMap.mapping){case n.CubeRefractionMapping:case n.EquirectangularRefractionMapping:x="ENVMAP_MODE_REFRACTION"}switch(s.combine){case n.MultiplyOperation:b="ENVMAP_BLENDING_MULTIPLY";break;case n.MixOperation:b="ENVMAP_BLENDING_MIX";break;case n.AddOperation:b="ENVMAP_BLENDING_ADD"}}var w,A,M=o.gammaFactor>0?o.gammaFactor:1,_=t(u),S=l.createProgram();s instanceof n.RawShaderMaterial?(w="",A=""):(w=["precision "+h.precision+" float;","precision "+h.precision+" int;",_,h.supportsVertexTextures?"#define VERTEX_TEXTURES":"",c.gammaInput?"#define GAMMA_INPUT":"",c.gammaOutput?"#define GAMMA_OUTPUT":"","#define GAMMA_FACTOR "+M,"#define MAX_DIR_LIGHTS "+h.maxDirLights,"#define MAX_POINT_LIGHTS "+h.maxPointLights,"#define MAX_SPOT_LIGHTS "+h.maxSpotLights,"#define MAX_HEMI_LIGHTS "+h.maxHemiLights,"#define MAX_SHADOWS "+h.maxShadows,"#define MAX_BONES "+h.maxBones,h.map?"#define USE_MAP":"",h.envMap?"#define USE_ENVMAP":"",h.envMap?"#define "+x:"",h.lightMap?"#define USE_LIGHTMAP":"",h.bumpMap?"#define USE_BUMPMAP":"",h.normalMap?"#define USE_NORMALMAP":"",h.specularMap?"#define USE_SPECULARMAP":"",h.alphaMap?"#define USE_ALPHAMAP":"",h.vertexColors?"#define USE_COLOR":"",h.flatShading?"#define FLAT_SHADED":"",h.skinning?"#define USE_SKINNING":"",h.useVertexTexture?"#define BONE_TEXTURE":"",h.morphTargets?"#define USE_MORPHTARGETS":"",h.morphNormals?"#define USE_MORPHNORMALS":"",h.wrapAround?"#define WRAP_AROUND":"",h.doubleSided?"#define DOUBLE_SIDED":"",h.flipSided?"#define FLIP_SIDED":"",h.shadowMapEnabled?"#define USE_SHADOWMAP":"",h.shadowMapEnabled?"#define "+v:"",h.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",h.shadowMapCascade?"#define SHADOWMAP_CASCADE":"",h.sizeAttenuation?"#define USE_SIZEATTENUATION":"",h.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","attribute vec2 uv2;","#ifdef USE_COLOR"," attribute vec3 color;","#endif","#ifdef USE_MORPHTARGETS"," attribute vec3 morphTarget0;"," attribute vec3 morphTarget1;"," attribute vec3 morphTarget2;"," attribute vec3 morphTarget3;"," #ifdef USE_MORPHNORMALS"," attribute vec3 morphNormal0;"," attribute vec3 morphNormal1;"," attribute vec3 morphNormal2;"," attribute vec3 morphNormal3;"," #else"," attribute vec3 morphTarget4;"," attribute vec3 morphTarget5;"," attribute vec3 morphTarget6;"," attribute vec3 morphTarget7;"," #endif","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif",""].join("\n"),A=["precision "+h.precision+" float;","precision "+h.precision+" int;",h.bumpMap||h.normalMap||h.flatShading?"#extension GL_OES_standard_derivatives : enable":"",_,"#define MAX_DIR_LIGHTS "+h.maxDirLights,"#define MAX_POINT_LIGHTS "+h.maxPointLights,"#define MAX_SPOT_LIGHTS "+h.maxSpotLights,"#define MAX_HEMI_LIGHTS "+h.maxHemiLights,"#define MAX_SHADOWS "+h.maxShadows,h.alphaTest?"#define ALPHATEST "+h.alphaTest:"",c.gammaInput?"#define GAMMA_INPUT":"",c.gammaOutput?"#define GAMMA_OUTPUT":"","#define GAMMA_FACTOR "+M,h.useFog&&h.fog?"#define USE_FOG":"",h.useFog&&h.fogExp?"#define FOG_EXP2":"",h.map?"#define USE_MAP":"",h.envMap?"#define USE_ENVMAP":"",h.envMap?"#define "+y:"",h.envMap?"#define "+x:"",h.envMap?"#define "+b:"",h.lightMap?"#define USE_LIGHTMAP":"",h.bumpMap?"#define USE_BUMPMAP":"",h.normalMap?"#define USE_NORMALMAP":"",h.specularMap?"#define USE_SPECULARMAP":"",h.alphaMap?"#define USE_ALPHAMAP":"",h.vertexColors?"#define USE_COLOR":"",h.flatShading?"#define FLAT_SHADED":"",h.metal?"#define METAL":"",h.wrapAround?"#define WRAP_AROUND":"",h.doubleSided?"#define DOUBLE_SIDED":"",h.flipSided?"#define FLIP_SIDED":"",h.shadowMapEnabled?"#define USE_SHADOWMAP":"",h.shadowMapEnabled?"#define "+v:"",h.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",h.shadowMapCascade?"#define SHADOWMAP_CASCADE":"",h.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;",""].join("\n"));var E=new n.WebGLShader(l,l.VERTEX_SHADER,w+d),T=new n.WebGLShader(l,l.FRAGMENT_SHADER,A+m);l.attachShader(S,E),l.attachShader(S,T),void 0!==g&&l.bindAttribLocation(S,0,g),l.linkProgram(S);var C=l.getProgramInfoLog(S);l.getProgramParameter(S,l.LINK_STATUS)===!1&&n.error("THREE.WebGLProgram: shader error: "+l.getError(),"gl.VALIDATE_STATUS",l.getProgramParameter(S,l.VALIDATE_STATUS),"gl.getPRogramInfoLog",C),""!==C&&n.warn("THREE.WebGLProgram: gl.getProgramInfoLog()"+C),l.deleteShader(E),l.deleteShader(T);var L=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","modelMatrix","cameraPosition","morphTargetInfluences","bindMatrix","bindMatrixInverse"];h.useVertexTexture?(L.push("boneTexture"),L.push("boneTextureWidth"),L.push("boneTextureHeight")):L.push("boneGlobalMatrices"),h.logarithmicDepthBuffer&&L.push("logDepthBufFC");for(var P in f)L.push(P);this.uniforms=r(l,S,L),L=["position","normal","uv","uv2","tangent","color","skinIndex","skinWeight","lineDistance"];for(var R=0;Re;e++)r[e]=0},this.enableAttribute=function(t){r[t]=1,0===i[t]&&(e.enableVertexAttribArray(t),i[t]=1)},this.disableUnusedAttributes=function(){for(var t=0,n=i.length;n>t;t++)i[t]!==r[t]&&(e.disableVertexAttribArray(t),i[t]=0)},this.setBlending=function(r,i,f,p,d,m,g){r!==o&&(r===n.NoBlending?e.disable(e.BLEND):r===n.AdditiveBlending?(e.enable(e.BLEND),e.blendEquation(e.FUNC_ADD),e.blendFunc(e.SRC_ALPHA,e.ONE)):r===n.SubtractiveBlending?(e.enable(e.BLEND),e.blendEquation(e.FUNC_ADD),e.blendFunc(e.ZERO,e.ONE_MINUS_SRC_COLOR)):r===n.MultiplyBlending?(e.enable(e.BLEND),e.blendEquation(e.FUNC_ADD),e.blendFunc(e.ZERO,e.SRC_COLOR)):r===n.CustomBlending?e.enable(e.BLEND):(e.enable(e.BLEND),e.blendEquationSeparate(e.FUNC_ADD,e.FUNC_ADD),e.blendFuncSeparate(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA)),o=r),r===n.CustomBlending?(d=d||i,m=m||f,g=g||p,(i!==a||d!==c)&&(e.blendEquationSeparate(t(i),t(d)),a=i,c=d),(f!==s||p!==h||m!==l||g!==u)&&(e.blendFuncSeparate(t(f),t(p),t(m),t(g)),s=f,h=p,l=m,u=g)):(a=null,s=null,h=null,c=null,l=null,u=null)},this.setDepthTest=function(t){f!==t&&(t?e.enable(e.DEPTH_TEST):e.disable(e.DEPTH_TEST),f=t)},this.setDepthWrite=function(t){p!==t&&(e.depthMask(t),p=t)},this.setColorWrite=function(t){d!==t&&(e.colorMask(t,t,t,t),d=t)},this.setDoubleSided=function(t){m!==t&&(t?e.disable(e.CULL_FACE):e.enable(e.CULL_FACE),m=t)},this.setFlipSided=function(t){g!==t&&(t?e.frontFace(e.CW):e.frontFace(e.CCW),g=t)},this.setLineWidth=function(t){t!==v&&(e.lineWidth(t),v=t)},this.setPolygonOffset=function(t,r,i){y!==t&&(t?e.enable(e.POLYGON_OFFSET_FILL):e.disable(e.POLYGON_OFFSET_FILL),y=t),!t||x===r&&b===i||(e.polygonOffset(r,i),x=r,b=i)},this.reset=function(){for(var e=0;e0;var n;n=c?{vertexShader:["uniform lowp int renderType;","uniform vec3 screenPosition;","uniform vec2 scale;","uniform float rotation;","uniform sampler2D occlusionMap;","attribute vec2 position;","attribute vec2 uv;","varying vec2 vUV;","varying float vVisibility;","void main() {","vUV = uv;","vec2 pos = position;","if( renderType == 2 ) {","vec4 visibility = texture2D( occlusionMap, vec2( 0.1, 0.1 ) );","visibility += texture2D( occlusionMap, vec2( 0.5, 0.1 ) );","visibility += texture2D( occlusionMap, vec2( 0.9, 0.1 ) );","visibility += texture2D( occlusionMap, vec2( 0.9, 0.5 ) );","visibility += texture2D( occlusionMap, vec2( 0.9, 0.9 ) );","visibility += texture2D( occlusionMap, vec2( 0.5, 0.9 ) );","visibility += texture2D( occlusionMap, vec2( 0.1, 0.9 ) );","visibility += texture2D( occlusionMap, vec2( 0.1, 0.5 ) );","visibility += texture2D( occlusionMap, vec2( 0.5, 0.5 ) );","vVisibility = visibility.r / 9.0;","vVisibility *= 1.0 - visibility.g / 9.0;","vVisibility *= visibility.b / 9.0;","vVisibility *= 1.0 - visibility.a / 9.0;","pos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;","pos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;","}","gl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );","}"].join("\n"),fragmentShader:["uniform lowp int renderType;","uniform sampler2D map;","uniform float opacity;","uniform vec3 color;","varying vec2 vUV;","varying float vVisibility;","void main() {","if( renderType == 0 ) {","gl_FragColor = vec4( 1.0, 0.0, 1.0, 0.0 );","} else if( renderType == 1 ) {","gl_FragColor = texture2D( map, vUV );","} else {","vec4 texture = texture2D( map, vUV );","texture.a *= opacity * vVisibility;","gl_FragColor = texture;","gl_FragColor.rgb *= color;","}","}"].join("\n")}:{vertexShader:["uniform lowp int renderType;","uniform vec3 screenPosition;","uniform vec2 scale;","uniform float rotation;","attribute vec2 position;","attribute vec2 uv;","varying vec2 vUV;","void main() {","vUV = uv;","vec2 pos = position;","if( renderType == 2 ) {","pos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;","pos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;","}","gl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );","}"].join("\n"),fragmentShader:["precision mediump float;","uniform lowp int renderType;","uniform sampler2D map;","uniform sampler2D occlusionMap;","uniform float opacity;","uniform vec3 color;","varying vec2 vUV;","void main() {","if( renderType == 0 ) {","gl_FragColor = vec4( texture2D( map, vUV ).rgb, 0.0 );","} else if( renderType == 1 ) {","gl_FragColor = texture2D( map, vUV );","} else {","float visibility = texture2D( occlusionMap, vec2( 0.5, 0.1 ) ).a;","visibility += texture2D( occlusionMap, vec2( 0.9, 0.5 ) ).a;","visibility += texture2D( occlusionMap, vec2( 0.5, 0.9 ) ).a;","visibility += texture2D( occlusionMap, vec2( 0.1, 0.5 ) ).a;","visibility = ( 1.0 - visibility / 4.0 );","vec4 texture = texture2D( map, vUV );","texture.a *= opacity * visibility;","gl_FragColor = texture;","gl_FragColor.rgb *= color;","}","}"].join("\n")},a=r(n),s={vertex:f.getAttribLocation(a,"position"),uv:f.getAttribLocation(a,"uv")},h={renderType:f.getUniformLocation(a,"renderType"),map:f.getUniformLocation(a,"map"),occlusionMap:f.getUniformLocation(a,"occlusionMap"),opacity:f.getUniformLocation(a,"opacity"),color:f.getUniformLocation(a,"color"),scale:f.getUniformLocation(a,"scale"),rotation:f.getUniformLocation(a,"rotation"),screenPosition:f.getUniformLocation(a,"screenPosition")}};this.render=function(r,d,m,g){if(0!==t.length){var v=new n.Vector3,y=g/m,x=.5*m,b=.5*g,w=16/g,A=new n.Vector2(w*y,w),M=new n.Vector3(1,1,0),_=new n.Vector2(1,1);void 0===a&&p(),f.useProgram(a),f.enableVertexAttribArray(s.vertex),f.enableVertexAttribArray(s.uv),f.uniform1i(h.occlusionMap,0),f.uniform1i(h.map,1),f.bindBuffer(f.ARRAY_BUFFER,i),f.vertexAttribPointer(s.vertex,2,f.FLOAT,!1,16,0),f.vertexAttribPointer(s.uv,2,f.FLOAT,!1,16,8),f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,o),f.disable(f.CULL_FACE),f.depthMask(!1);for(var S=0,E=t.length;E>S;S++){w=16/g,A.set(w*y,w);var T=t[S];if(v.set(T.matrixWorld.elements[12],T.matrixWorld.elements[13],T.matrixWorld.elements[14]),v.applyMatrix4(d.matrixWorldInverse),v.applyProjection(d.projectionMatrix),M.copy(v),_.x=M.x*x+x,_.y=M.y*b+b,c||_.x>0&&_.x0&&_.yC;C++){var P=T.lensFlares[C];P.opacity>.001&&P.scale>.001&&(M.x=P.x,M.y=P.y,M.z=P.z,w=P.size*P.scale/g,A.x=w*y,A.y=w,f.uniform3f(h.screenPosition,M.x,M.y,M.z),f.uniform2f(h.scale,A.x,A.y),f.uniform1f(h.rotation,P.rotation),f.uniform1f(h.opacity,P.opacity),f.uniform3f(h.color,P.color.r,P.color.g,P.color.b),e.state.setBlending(P.blending,P.blendEquation,P.blendSrc,P.blendDst),e.setTexture(P.texture,1),f.drawElements(f.TRIANGLES,6,f.UNSIGNED_SHORT,0))}}}f.enable(f.CULL_FACE),f.enable(f.DEPTH_TEST),f.depthMask(!0),e.resetGLState()}}},n.ShadowMapPlugin=function(e,t,r,i){function o(e,t,i){if(t.visible){var n=r[t.id];if(n&&t.castShadow&&(t.frustumCulled===!1||m.intersectsObject(t)===!0))for(var a=0,s=n.length;s>a;a++){var h=n[a];t._modelViewMatrix.multiplyMatrices(i.matrixWorldInverse,t.matrixWorld),b.push(h)}for(var a=0,s=t.children.length;s>a;a++)o(e,t.children[a],i)}}function a(e,t){var r=new n.DirectionalLight;r.isVirtual=!0,r.onlyShadow=!0,r.castShadow=!0,r.shadowCameraNear=e.shadowCameraNear,r.shadowCameraFar=e.shadowCameraFar,r.shadowCameraLeft=e.shadowCameraLeft,r.shadowCameraRight=e.shadowCameraRight,r.shadowCameraBottom=e.shadowCameraBottom,r.shadowCameraTop=e.shadowCameraTop,r.shadowCameraVisible=e.shadowCameraVisible,r.shadowDarkness=e.shadowDarkness,r.shadowBias=e.shadowCascadeBias[t],r.shadowMapWidth=e.shadowCascadeWidth[t],r.shadowMapHeight=e.shadowCascadeHeight[t],r.pointsWorld=[],r.pointsFrustum=[];for(var i=r.pointsWorld,o=r.pointsFrustum,a=0;8>a;a++)i[a]=new n.Vector3,o[a]=new n.Vector3;var s=e.shadowCascadeNearZ[t],h=e.shadowCascadeFarZ[t];return o[0].set(-1,-1,s),o[1].set(1,-1,s),o[2].set(-1,1,s),o[3].set(1,1,s),o[4].set(-1,-1,h),o[5].set(1,-1,h),o[6].set(-1,1,h),o[7].set(1,1,h),r}function s(e,t){var r=e.shadowCascadeArray[t];r.position.copy(e.position),r.target.position.copy(e.target.position),r.lookAt(r.target),r.shadowCameraVisible=e.shadowCameraVisible,r.shadowDarkness=e.shadowDarkness,r.shadowBias=e.shadowCascadeBias[t];var i=e.shadowCascadeNearZ[t],n=e.shadowCascadeFarZ[t],o=r.pointsFrustum;o[0].z=i,o[1].z=i,o[2].z=i,o[3].z=i,o[4].z=n,o[5].z=n,o[6].z=n,o[7].z=n}function h(e,t){var r=t.shadowCamera,i=t.pointsFrustum,n=t.pointsWorld;v.set(1/0,1/0,1/0),y.set(-(1/0),-(1/0),-(1/0));for(var o=0;8>o;o++){var a=n[o];a.copy(i[o]),a.unproject(e),a.applyMatrix4(r.matrixWorldInverse),a.xy.x&&(y.x=a.x),a.yy.y&&(y.y=a.y),a.zy.z&&(y.z=a.z)}r.left=v.x,r.right=y.x,r.top=y.y,r.bottom=v.y,r.updateProjectionMatrix()}function c(e){return e.material instanceof n.MeshFaceMaterial?e.material.materials[0]:e.material}var l,u,f,p,d=e.context,m=new n.Frustum,g=new n.Matrix4,v=new n.Vector3,y=new n.Vector3,x=new n.Vector3,b=[],w=n.ShaderLib.depthRGBA,A=n.UniformsUtils.clone(w.uniforms);l=new n.ShaderMaterial({uniforms:A,vertexShader:w.vertexShader,fragmentShader:w.fragmentShader}),u=new n.ShaderMaterial({uniforms:A,vertexShader:w.vertexShader,fragmentShader:w.fragmentShader,morphTargets:!0}),f=new n.ShaderMaterial({uniforms:A,vertexShader:w.vertexShader,fragmentShader:w.fragmentShader,skinning:!0}),p=new n.ShaderMaterial({uniforms:A,vertexShader:w.vertexShader,fragmentShader:w.fragmentShader,morphTargets:!0,skinning:!0}),l._shadowPass=!0,u._shadowPass=!0,f._shadowPass=!0,p._shadowPass=!0,this.render=function(r,v){if(e.shadowMapEnabled!==!1){var y,w,A,M,_,S,E,T,C,L,P,R,F,B=[],D=0,U=null;for(d.clearColor(1,1,1,1),d.disable(d.BLEND),d.enable(d.CULL_FACE),d.frontFace(d.CCW),e.shadowMapCullFace===n.CullFaceFront?d.cullFace(d.FRONT):d.cullFace(d.BACK),e.state.setDepthTest(!0),y=0,w=t.length;w>y;y++)if(F=t[y],F.castShadow)if(F instanceof n.DirectionalLight&&F.shadowCascade)for(_=0;_y;y++){if(F=B[y],!F.shadowMap){var z=n.LinearFilter;e.shadowMapType===n.PCFSoftShadowMap&&(z=n.NearestFilter);var k={minFilter:z,magFilter:z,format:n.RGBAFormat};F.shadowMap=new n.WebGLRenderTarget(F.shadowMapWidth,F.shadowMapHeight,k),F.shadowMapSize=new n.Vector2(F.shadowMapWidth,F.shadowMapHeight),F.shadowMatrix=new n.Matrix4}if(!F.shadowCamera){if(F instanceof n.SpotLight)F.shadowCamera=new n.PerspectiveCamera(F.shadowCameraFov,F.shadowMapWidth/F.shadowMapHeight,F.shadowCameraNear,F.shadowCameraFar);else{if(!(F instanceof n.DirectionalLight)){n.error("THREE.ShadowMapPlugin: Unsupported light type for shadow",F);continue}F.shadowCamera=new n.OrthographicCamera(F.shadowCameraLeft,F.shadowCameraRight,F.shadowCameraTop,F.shadowCameraBottom,F.shadowCameraNear,F.shadowCameraFar)}r.add(F.shadowCamera),r.autoUpdate===!0&&r.updateMatrixWorld()}F.shadowCameraVisible&&!F.cameraHelper&&(F.cameraHelper=new n.CameraHelper(F.shadowCamera),r.add(F.cameraHelper)),F.isVirtual&&V.originalCamera==v&&h(v,F),S=F.shadowMap,E=F.shadowMatrix,T=F.shadowCamera,T.position.setFromMatrixPosition(F.matrixWorld),x.setFromMatrixPosition(F.target.matrixWorld),T.lookAt(x),T.updateMatrixWorld(),T.matrixWorldInverse.getInverse(T.matrixWorld),F.cameraHelper&&(F.cameraHelper.visible=F.shadowCameraVisible),F.shadowCameraVisible&&F.cameraHelper.update(),E.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),E.multiply(T.projectionMatrix),E.multiply(T.matrixWorldInverse),g.multiplyMatrices(T.projectionMatrix,T.matrixWorldInverse),m.setFromMatrix(g),e.setRenderTarget(S),e.clear(),b.length=0,o(r,r,T);var N,G,I;for(A=0,M=b.length;M>A;A++)P=b[A],R=P.object,C=P.buffer,N=c(R),G=void 0!==R.geometry.morphTargets&&R.geometry.morphTargets.length>0&&N.morphTargets,I=R instanceof n.SkinnedMesh&&N.skinning,L=R.customDepthMaterial?R.customDepthMaterial:I?G?p:f:G?u:l,e.setMaterialFaces(N),C instanceof n.BufferGeometry?e.renderBufferDirect(T,t,U,L,C,R):e.renderBuffer(T,t,U,L,C,R);for(A=0,M=i.length;M>A;A++)P=i[A],R=P.object,R.visible&&R.castShadow&&(R._modelViewMatrix.multiplyMatrices(T.matrixWorldInverse,R.matrixWorld),e.renderImmediateObject(T,t,U,l,R))}var H=e.getClearColor(),j=e.getClearAlpha();d.clearColor(H.r,H.g,H.b,j),d.enable(d.BLEND),e.shadowMapCullFace===n.CullFaceFront&&d.cullFace(d.BACK),e.resetGLState()}}},n.SpritePlugin=function(e,t){function r(){var t=u.createProgram(),r=u.createShader(u.VERTEX_SHADER),i=u.createShader(u.FRAGMENT_SHADER);return u.shaderSource(r,["precision "+e.getPrecision()+" float;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform float rotation;","uniform vec2 scale;","uniform vec2 uvOffset;","uniform vec2 uvScale;","attribute vec2 position;","attribute vec2 uv;","varying vec2 vUV;","void main() {","vUV = uvOffset + uv * uvScale;","vec2 alignedPosition = position * scale;","vec2 rotatedPosition;","rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;","rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;","vec4 finalPosition;","finalPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );","finalPosition.xy += rotatedPosition;","finalPosition = projectionMatrix * finalPosition;","gl_Position = finalPosition;","}"].join("\n")),u.shaderSource(i,["precision "+e.getPrecision()+" float;","uniform vec3 color;","uniform sampler2D map;","uniform float opacity;","uniform int fogType;","uniform vec3 fogColor;","uniform float fogDensity;","uniform float fogNear;","uniform float fogFar;","uniform float alphaTest;","varying vec2 vUV;","void main() {","vec4 texture = texture2D( map, vUV );","if ( texture.a < alphaTest ) discard;","gl_FragColor = vec4( color * texture.xyz, texture.a * opacity );","if ( fogType > 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;","float 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")),u.compileShader(r),u.compileShader(i),u.attachShader(t,r),u.attachShader(t,i),u.linkProgram(t),t}function i(e,t){return e.z!==t.z?t.z-e.z:t.id-e.id}var o,a,s,h,c,l,u=e.context,f=new n.Vector3,p=new n.Quaternion,d=new n.Vector3,m=function(){var e=new Float32Array([-.5,-.5,0,0,.5,-.5,1,0,.5,.5,1,1,-.5,.5,0,1]),t=new Uint16Array([0,1,2,0,2,3]);o=u.createBuffer(),a=u.createBuffer(),u.bindBuffer(u.ARRAY_BUFFER,o),u.bufferData(u.ARRAY_BUFFER,e,u.STATIC_DRAW),u.bindBuffer(u.ELEMENT_ARRAY_BUFFER,a),u.bufferData(u.ELEMENT_ARRAY_BUFFER,t,u.STATIC_DRAW),s=r(),h={position:u.getAttribLocation(s,"position"),uv:u.getAttribLocation(s,"uv")},c={uvOffset:u.getUniformLocation(s,"uvOffset"),uvScale:u.getUniformLocation(s,"uvScale"),rotation:u.getUniformLocation(s,"rotation"),scale:u.getUniformLocation(s,"scale"),color:u.getUniformLocation(s,"color"),map:u.getUniformLocation(s,"map"),opacity:u.getUniformLocation(s,"opacity"),modelViewMatrix:u.getUniformLocation(s,"modelViewMatrix"),projectionMatrix:u.getUniformLocation(s,"projectionMatrix"),fogType:u.getUniformLocation(s,"fogType"),fogDensity:u.getUniformLocation(s,"fogDensity"),fogNear:u.getUniformLocation(s,"fogNear"),fogFar:u.getUniformLocation(s,"fogFar"),fogColor:u.getUniformLocation(s,"fogColor"),alphaTest:u.getUniformLocation(s,"alphaTest")};var i=document.createElement("canvas");i.width=8,i.height=8;var f=i.getContext("2d");f.fillStyle="white",f.fillRect(0,0,8,8),l=new n.Texture(i),l.needsUpdate=!0};this.render=function(r,g){if(0!==t.length){void 0===s&&m(),u.useProgram(s),u.enableVertexAttribArray(h.position),u.enableVertexAttribArray(h.uv),u.disable(u.CULL_FACE),u.enable(u.BLEND),u.bindBuffer(u.ARRAY_BUFFER,o),u.vertexAttribPointer(h.position,2,u.FLOAT,!1,16,0),u.vertexAttribPointer(h.uv,2,u.FLOAT,!1,16,8),u.bindBuffer(u.ELEMENT_ARRAY_BUFFER,a),u.uniformMatrix4fv(c.projectionMatrix,!1,g.projectionMatrix.elements),u.activeTexture(u.TEXTURE0),u.uniform1i(c.map,0);var v=0,y=0,x=r.fog;x?(u.uniform3f(c.fogColor,x.color.r,x.color.g,x.color.b),x instanceof n.Fog?(u.uniform1f(c.fogNear,x.near),u.uniform1f(c.fogFar,x.far),u.uniform1i(c.fogType,1),v=1,y=1):x instanceof n.FogExp2&&(u.uniform1f(c.fogDensity,x.density),u.uniform1i(c.fogType,2),v=2,y=2)):(u.uniform1i(c.fogType,0),v=0,y=0);for(var b=0,w=t.length;w>b;b++){var A=t[b];A._modelViewMatrix.multiplyMatrices(g.matrixWorldInverse,A.matrixWorld),A.z=-A._modelViewMatrix.elements[14]}t.sort(i);for(var M=[],b=0,w=t.length;w>b;b++){var A=t[b],_=A.material;u.uniform1f(c.alphaTest,_.alphaTest),u.uniformMatrix4fv(c.modelViewMatrix,!1,A._modelViewMatrix.elements),A.matrixWorld.decompose(f,p,d),M[0]=d.x,M[1]=d.y;var S=0;r.fog&&_.fog&&(S=y),v!==S&&(u.uniform1i(c.fogType,S),v=S),null!==_.map?(u.uniform2f(c.uvOffset,_.map.offset.x,_.map.offset.y),u.uniform2f(c.uvScale,_.map.repeat.x,_.map.repeat.y)):(u.uniform2f(c.uvOffset,0,0),u.uniform2f(c.uvScale,1,1)),u.uniform1f(c.opacity,_.opacity),u.uniform3f(c.color,_.color.r,_.color.g,_.color.b),u.uniform1f(c.rotation,_.rotation),u.uniform2fv(c.scale,M),e.state.setBlending(_.blending,_.blendEquation,_.blendSrc,_.blendDst),e.state.setDepthTest(_.depthTest),e.state.setDepthWrite(_.depthWrite),_.map&&_.map.image&&_.map.image.width?e.setTexture(_.map,0):e.setTexture(l,0),u.drawElements(u.TRIANGLES,6,u.UNSIGNED_SHORT,0)}u.enable(u.CULL_FACE),e.resetGLState()}}},n.GeometryUtils={merge:function(e,t,r){n.warn("THREE.GeometryUtils: .merge() has been moved to Geometry. Use geometry.merge( geometry2, matrix, materialIndexOffset ) instead.");var i;t instanceof n.Mesh&&(t.matrixAutoUpdate&&t.updateMatrix(),i=t.matrix,t=t.geometry),e.merge(t,i,r)},center:function(e){return n.warn("THREE.GeometryUtils: .center() has been moved to Geometry. Use geometry.center() instead."),e.center()}},n.ImageUtils={crossOrigin:void 0,loadTexture:function(e,t,r,i){var o=new n.ImageLoader;o.crossOrigin=this.crossOrigin;var a=new n.Texture(void 0,t);return o.load(e,function(e){a.image=e,a.needsUpdate=!0,r&&r(a)},void 0,function(e){i&&i(e)}),a.sourceFile=e,a},loadTextureCube:function(e,t,r,i){var o=[],a=new n.ImageLoader;a.crossOrigin=this.crossOrigin;var s=new n.CubeTexture(o,t);s.flipY=!1;for(var h=0,c=function(t){a.load(e[t],function(e){s.images[t]=e,h+=1,6===h&&(s.needsUpdate=!0,r&&r(s))},void 0,i)},l=0,u=e.length;u>l;++l)c(l);return s},loadCompressedTexture:function(){n.error("THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.")},loadCompressedTextureCube:function(){n.error("THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead.")},getNormalMap:function(e,t){var r=function(e,t){return[e[1]*t[2]-e[2]*t[1],e[2]*t[0]-e[0]*t[2],e[0]*t[1]-e[1]*t[0]]},i=function(e,t){return[e[0]-t[0],e[1]-t[1],e[2]-t[2]]},n=function(e){var t=Math.sqrt(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]);return[e[0]/t,e[1]/t,e[2]/t]};t=1|t;var o=e.width,a=e.height,s=document.createElement("canvas");s.width=o,s.height=a;var h=s.getContext("2d");h.drawImage(e,0,0);for(var c=h.getImageData(0,0,o,a).data,l=h.createImageData(o,a),u=l.data,f=0;o>f;f++)for(var p=0;a>p;p++){var d=0>p-1?0:p-1,m=p+1>a-1?a-1:p+1,g=0>f-1?0:f-1,v=f+1>o-1?o-1:f+1,y=[],x=[0,0,c[4*(p*o+f)]/255*t];y.push([-1,0,c[4*(p*o+g)]/255*t]),y.push([-1,-1,c[4*(d*o+g)]/255*t]),y.push([0,-1,c[4*(d*o+f)]/255*t]),y.push([1,-1,c[4*(d*o+v)]/255*t]),y.push([1,0,c[4*(p*o+v)]/255*t]),y.push([1,1,c[4*(m*o+v)]/255*t]),y.push([0,1,c[4*(m*o+f)]/255*t]),y.push([-1,1,c[4*(m*o+g)]/255*t]);for(var b=[],w=y.length,A=0;w>A;A++){var M=y[A],_=y[(A+1)%w];M=i(M,x),_=i(_,x),b.push(n(r(M,_)))}for(var S=[0,0,0],A=0;Ac;c++)o[3*c]=a,o[3*c+1]=s,o[3*c+2]=h;var l=new n.DataTexture(o,e,t,n.RGBFormat);return l.needsUpdate=!0,l}},n.SceneUtils={createMultiMaterialObject:function(e,t){for(var r=new n.Object3D,i=0,o=t.length;o>i;i++)r.add(new n.Mesh(e,t[i]));return r},detach:function(e,t,r){e.applyMatrix(t.matrixWorld),t.remove(e),r.add(e)},attach:function(e,t,r){var i=new n.Matrix4;i.getInverse(r.matrixWorld),e.applyMatrix(i),t.remove(e),r.add(e)}},n.FontUtils={faces:{},face:"helvetiker",weight:"normal",style:"normal",size:150,divisions:10,getFace:function(){try{return this.faces[this.face][this.weight][this.style]}catch(e){throw"The font "+this.face+" with "+this.weight+" weight and "+this.style+" style is missing."}},loadFace:function(e){var t=e.familyName.toLowerCase(),r=this;return r.faces[t]=r.faces[t]||{},r.faces[t][e.cssFontWeight]=r.faces[t][e.cssFontWeight]||{},r.faces[t][e.cssFontWeight][e.cssFontStyle]=e,r.faces[t][e.cssFontWeight][e.cssFontStyle]=e,e},drawText:function(e){var t,r=this.getFace(),i=this.size/r.resolution,o=0,a=String(e).split(""),s=a.length,h=[];for(t=0;s>t;t++){var c=new n.Path,l=this.extractGlyphPoints(a[t],r,i,o,c);o+=l.offset,h.push(l.path)}var u=o/2;return{paths:h,offset:u}},extractGlyphPoints:function(e,t,r,i,o){var a,s,h,c,l,u,f,p,d,m,g,v,y,x,b,w,A,M,_,S=[],E=t.glyphs[e]||t.glyphs["?"];if(E){if(E.o)for(c=E._cachedOutline||(E._cachedOutline=E.o.split(" ")),u=c.length,f=r,p=r,a=0;u>a;)switch(l=c[a++]){case"m":d=c[a++]*f+i,m=c[a++]*p,o.moveTo(d,m);break;case"l":d=c[a++]*f+i,m=c[a++]*p,o.lineTo(d,m);break;case"q":if(g=c[a++]*f+i,v=c[a++]*p,b=c[a++]*f+i,w=c[a++]*p,o.quadraticCurveTo(b,w,g,v),_=S[S.length-1])for(y=_.x,x=_.y,s=1,h=this.divisions;h>=s;s++){var T=s/h;n.Shape.Utils.b2(T,y,b,g),n.Shape.Utils.b2(T,x,w,v)}break;case"b":if(g=c[a++]*f+i,v=c[a++]*p,b=c[a++]*f+i,w=c[a++]*p,A=c[a++]*f+i,M=c[a++]*p,o.bezierCurveTo(b,w,A,M,g,v),_=S[S.length-1])for(y=_.x,x=_.y,s=1,h=this.divisions;h>=s;s++){var T=s/h;n.Shape.Utils.b3(T,y,b,A,g),n.Shape.Utils.b3(T,x,w,M,v)}}return{offset:E.ha*r,path:o}}}},n.FontUtils.generateShapes=function(e,t){t=t||{};var r=void 0!==t.size?t.size:100,i=void 0!==t.curveSegments?t.curveSegments:4,o=void 0!==t.font?t.font:"helvetiker",a=void 0!==t.weight?t.weight:"normal",s=void 0!==t.style?t.style:"normal";n.FontUtils.size=r,n.FontUtils.divisions=i,n.FontUtils.face=o,n.FontUtils.weight=a,n.FontUtils.style=s;for(var h=n.FontUtils.drawText(e),c=h.paths,l=[],u=0,f=c.length;f>u;u++)Array.prototype.push.apply(l,c[u].toShapes());return l},function(e){var t=1e-10,r=function(e,t){var r=e.length;if(3>r)return null;var a,s,h,c=[],l=[],u=[];if(i(e)>0)for(s=0;r>s;s++)l[s]=s;else for(s=0;r>s;s++)l[s]=r-1-s;var f=r,p=2*f;for(s=f-1;f>2;){if(p--<=0)return n.warn("THREE.FontUtils: Warning, unable to triangulate polygon! in Triangulate.process()"),t?u:c;if(a=s,a>=f&&(a=0),s=a+1,s>=f&&(s=0),h=s+1,h>=f&&(h=0),o(e,a,s,h,f,l)){var d,m,g,v,y;for(d=l[a],m=l[s],g=l[h],c.push([e[d],e[m],e[g]]),u.push([l[a],l[s],l[h]]),v=s,y=s+1;f>y;v++,y++)l[v]=l[y];f--,p=2*f}}return t?u:c},i=function(e){for(var t=e.length,r=0,i=t-1,n=0;t>n;i=n++)r+=e[i].x*e[n].y-e[n].x*e[i].y;return.5*r},o=function(e,r,i,n,o,a){var s,h,c,l,u,f,p,d,m;if(h=e[a[r]].x,c=e[a[r]].y,l=e[a[i]].x,u=e[a[i]].y,f=e[a[n]].x,p=e[a[n]].y,t>(l-h)*(p-c)-(u-c)*(f-h))return!1;var g,v,y,x,b,w,A,M,_,S,E,T,C,L,P;for(g=f-l,v=p-u,y=h-f,x=c-p,b=l-h,w=u-c,s=0;o>s;s++)if(d=e[a[s]].x,m=e[a[s]].y,!(d===h&&m===c||d===l&&m===u||d===f&&m===p)&&(A=d-h,M=m-c,_=d-l,S=m-u,E=d-f,T=m-p,P=g*S-v*_,C=b*M-w*A,L=y*T-x*E,P>=-t&&L>=-t&&C>=-t))return!1;return!0};return e.Triangulate=r,e.Triangulate.area=i,e}(n.FontUtils),i._typeface_js={faces:n.FontUtils.faces,loadFace:n.FontUtils.loadFace},n.typeface_js=i._typeface_js,n.Audio=function(e){n.Object3D.call(this),this.type="Audio",this.context=e.context,this.source=this.context.createBufferSource(),this.source.onended=this.onEnded.bind(this),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.panner=this.context.createPanner(),this.panner.connect(this.gain),this.autoplay=!1,this.startTime=0,this.isPlaying=!1},n.Audio.prototype=Object.create(n.Object3D.prototype),n.Audio.prototype.constructor=n.Audio,n.Audio.prototype.load=function(e){var t=this,r=new XMLHttpRequest;return r.open("GET",e,!0),r.responseType="arraybuffer",r.onload=function(e){t.context.decodeAudioData(this.response,function(e){t.source.buffer=e,t.autoplay&&t.play()})},r.send(),this},n.Audio.prototype.play=function(){if(this.isPlaying===!0)return void n.warn("THREE.Audio: Audio is already playing.");var e=this.context.createBufferSource();e.buffer=this.source.buffer,e.loop=this.source.loop,e.onended=this.source.onended,e.connect(this.panner),e.start(0,this.startTime),this.isPlaying=!0,this.source=e},n.Audio.prototype.pause=function(){this.source.stop(),this.startTime=this.context.currentTime},n.Audio.prototype.stop=function(){this.source.stop(),this.startTime=0},n.Audio.prototype.onEnded=function(){this.isPlaying=!1},n.Audio.prototype.setLoop=function(e){this.source.loop=e},n.Audio.prototype.setRefDistance=function(e){this.panner.refDistance=e},n.Audio.prototype.setRolloffFactor=function(e){this.panner.rolloffFactor=e},n.Audio.prototype.setVolume=function(e){this.gain.gain.value=e},n.Audio.prototype.updateMatrixWorld=function(){var e=new n.Vector3;return function(t){n.Object3D.prototype.updateMatrixWorld.call(this,t),e.setFromMatrixPosition(this.matrixWorld),this.panner.setPosition(e.x,e.y,e.z)}}(),n.AudioListener=function(){n.Object3D.call(this),this.type="AudioListener",this.context=new(window.AudioContext||window.webkitAudioContext)},n.AudioListener.prototype=Object.create(n.Object3D.prototype),n.AudioListener.prototype.constructor=n.AudioListener,n.AudioListener.prototype.updateMatrixWorld=function(){var e=new n.Vector3,t=new n.Quaternion,r=new n.Vector3,i=new n.Vector3,o=new n.Vector3,a=new n.Vector3;return function(s){n.Object3D.prototype.updateMatrixWorld.call(this,s);var h=this.context.listener,c=this.up;this.matrixWorld.decompose(e,t,r),i.set(0,0,-1).applyQuaternion(t),o.subVectors(e,a),h.setPosition(e.x,e.y,e.z),h.setOrientation(i.x,i.y,i.z,c.x,c.y,c.z),h.setVelocity(o.x,o.y,o.z),a.copy(e)}}(),n.Curve=function(){},n.Curve.prototype.getPoint=function(e){return n.warn("THREE.Curve: Warning, getPoint() not implemented!"),null},n.Curve.prototype.getPointAt=function(e){var t=this.getUtoTmapping(e);return this.getPoint(t)},n.Curve.prototype.getPoints=function(e){e||(e=5);var t,r=[];for(t=0;e>=t;t++)r.push(this.getPoint(t/e));return r},n.Curve.prototype.getSpacedPoints=function(e){e||(e=5);var t,r=[];for(t=0;e>=t;t++)r.push(this.getPointAt(t/e));return r},n.Curve.prototype.getLength=function(){var e=this.getLengths();return e[e.length-1]},n.Curve.prototype.getLengths=function(e){if(e||(e=this.__arcLengthDivisions?this.__arcLengthDivisions:200),this.cacheArcLengths&&this.cacheArcLengths.length==e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;var t,r,i=[],n=this.getPoint(0),o=0;for(i.push(0),r=1;e>=r;r++)t=this.getPoint(r/e),o+=t.distanceTo(n),i.push(o),n=t;return this.cacheArcLengths=i,i},n.Curve.prototype.updateArcLengths=function(){this.needsUpdate=!0,this.getLengths()},n.Curve.prototype.getUtoTmapping=function(e,t){var r,i=this.getLengths(),n=0,o=i.length;r=t?t:e*i[o-1];for(var a,s=0,h=o-1;h>=s;)if(n=Math.floor(s+(h-s)/2),a=i[n]-r,0>a)s=n+1;else{if(!(a>0)){h=n;break}h=n-1}if(n=h,i[n]==r){var c=n/(o-1);return c}var l=i[n],u=i[n+1],f=u-l,p=(r-l)/f,c=(n+p)/(o-1);return c},n.Curve.prototype.getTangent=function(e){var t=1e-4,r=e-t,i=e+t;0>r&&(r=0),i>1&&(i=1);var n=this.getPoint(r),o=this.getPoint(i),a=o.clone().sub(n);return a.normalize()},n.Curve.prototype.getTangentAt=function(e){var t=this.getUtoTmapping(e);return this.getTangent(t)},n.Curve.Utils={tangentQuadraticBezier:function(e,t,r,i){return 2*(1-e)*(r-t)+2*e*(i-r)},tangentCubicBezier:function(e,t,r,i,n){return-3*t*(1-e)*(1-e)+3*r*(1-e)*(1-e)-6*e*r*(1-e)+6*e*i*(1-e)-3*e*e*i+3*e*e*n},tangentSpline:function(e,t,r,i,n){var o=6*e*e-6*e,a=3*e*e-4*e+1,s=-6*e*e+6*e,h=3*e*e-2*e;return o+a+s+h},interpolate:function(e,t,r,i,n){var o=.5*(r-e),a=.5*(i-t),s=n*n,h=n*s;return(2*t-2*r+o+a)*h+(-3*t+3*r-2*o-a)*s+o*n+t}},n.Curve.create=function(e,t){return e.prototype=Object.create(n.Curve.prototype),e.prototype.constructor=e,e.prototype.getPoint=t,e},n.CurvePath=function(){this.curves=[],this.bends=[],this.autoClose=!1},n.CurvePath.prototype=Object.create(n.Curve.prototype),n.CurvePath.prototype.constructor=n.CurvePath,n.CurvePath.prototype.add=function(e){this.curves.push(e)},n.CurvePath.prototype.checkConnection=function(){},n.CurvePath.prototype.closePath=function(){var e=this.curves[0].getPoint(0),t=this.curves[this.curves.length-1].getPoint(1);e.equals(t)||this.curves.push(new n.LineCurve(t,e))},n.CurvePath.prototype.getPoint=function(e){for(var t,r,i=e*this.getLength(),n=this.getCurveLengths(),o=0;o=i){t=n[o]-i,r=this.curves[o];var a=1-t/r.getLength();return r.getPointAt(a)}o++}return null},n.CurvePath.prototype.getLength=function(){var e=this.getCurveLengths();return e[e.length-1]},n.CurvePath.prototype.getCurveLengths=function(){if(this.cacheLengths&&this.cacheLengths.length==this.curves.length)return this.cacheLengths;var e,t=[],r=0,i=this.curves.length;for(e=0;i>e;e++)r+=this.curves[e].getLength(),t.push(r);return this.cacheLengths=t,t},n.CurvePath.prototype.getBoundingBox=function(){var e,t,r,i,o,a,s=this.getPoints();e=t=Number.NEGATIVE_INFINITY,i=o=Number.POSITIVE_INFINITY;var h,c,l,u,f=s[0]instanceof n.Vector3;for(u=f?new n.Vector3:new n.Vector2,c=0,l=s.length;l>c;c++)h=s[c],h.x>e?e=h.x:h.xt?t=h.y:h.yr?r=h.z:h.zr;r++)n=this.getWrapPoints(n,t[r]);return n},n.CurvePath.prototype.getTransformedSpacedPoints=function(e,t){var r,i,n=this.getSpacedPoints(e);for(t||(t=this.bends),r=0,i=t.length;i>r;r++)n=this.getWrapPoints(n,t[r]);return n},n.CurvePath.prototype.getWrapPoints=function(e,t){var r,i,n,o,a,s,h=this.getBoundingBox();for(r=0,i=e.length;i>r;r++){n=e[r],o=n.x,a=n.y,s=o/h.maxX,s=t.getUtoTmapping(s,o);var c=t.getPoint(s),l=t.getTangent(s);l.set(-l.y,l.x).multiplyScalar(a),n.x=c.x+l.x,n.y=c.y+l.y}return e},n.Gyroscope=function(){n.Object3D.call(this)},n.Gyroscope.prototype=Object.create(n.Object3D.prototype),n.Gyroscope.prototype.constructor=n.Gyroscope,n.Gyroscope.prototype.updateMatrixWorld=function(){var e=new n.Vector3,t=new n.Quaternion,r=new n.Vector3,i=new n.Vector3,o=new n.Quaternion,a=new n.Vector3;return function(n){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||n)&&(this.parent?(this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorld.decompose(i,o,a),this.matrix.decompose(e,t,r),this.matrixWorld.compose(i,t,a)):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,n=!0);for(var s=0,h=this.children.length;h>s;s++)this.children[s].updateMatrixWorld(n)}}(),n.Path=function(e){n.CurvePath.call(this),this.actions=[],e&&this.fromPoints(e)},n.Path.prototype=Object.create(n.CurvePath.prototype),n.Path.prototype.constructor=n.Path,n.PathActions={MOVE_TO:"moveTo",LINE_TO:"lineTo",QUADRATIC_CURVE_TO:"quadraticCurveTo",BEZIER_CURVE_TO:"bezierCurveTo",CSPLINE_THRU:"splineThru",ARC:"arc",ELLIPSE:"ellipse"},n.Path.prototype.fromPoints=function(e){this.moveTo(e[0].x,e[0].y);for(var t=1,r=e.length;r>t;t++)this.lineTo(e[t].x,e[t].y); -},n.Path.prototype.moveTo=function(e,t){var r=Array.prototype.slice.call(arguments);this.actions.push({action:n.PathActions.MOVE_TO,args:r})},n.Path.prototype.lineTo=function(e,t){var r=Array.prototype.slice.call(arguments),i=this.actions[this.actions.length-1].args,o=i[i.length-2],a=i[i.length-1],s=new n.LineCurve(new n.Vector2(o,a),new n.Vector2(e,t));this.curves.push(s),this.actions.push({action:n.PathActions.LINE_TO,args:r})},n.Path.prototype.quadraticCurveTo=function(e,t,r,i){var o=Array.prototype.slice.call(arguments),a=this.actions[this.actions.length-1].args,s=a[a.length-2],h=a[a.length-1],c=new n.QuadraticBezierCurve(new n.Vector2(s,h),new n.Vector2(e,t),new n.Vector2(r,i));this.curves.push(c),this.actions.push({action:n.PathActions.QUADRATIC_CURVE_TO,args:o})},n.Path.prototype.bezierCurveTo=function(e,t,r,i,o,a){var s=Array.prototype.slice.call(arguments),h=this.actions[this.actions.length-1].args,c=h[h.length-2],l=h[h.length-1],u=new n.CubicBezierCurve(new n.Vector2(c,l),new n.Vector2(e,t),new n.Vector2(r,i),new n.Vector2(o,a));this.curves.push(u),this.actions.push({action:n.PathActions.BEZIER_CURVE_TO,args:s})},n.Path.prototype.splineThru=function(e){var t=Array.prototype.slice.call(arguments),r=this.actions[this.actions.length-1].args,i=r[r.length-2],o=r[r.length-1],a=[new n.Vector2(i,o)];Array.prototype.push.apply(a,e);var s=new n.SplineCurve(a);this.curves.push(s),this.actions.push({action:n.PathActions.CSPLINE_THRU,args:t})},n.Path.prototype.arc=function(e,t,r,i,n,o){var a=this.actions[this.actions.length-1].args,s=a[a.length-2],h=a[a.length-1];this.absarc(e+s,t+h,r,i,n,o)},n.Path.prototype.absarc=function(e,t,r,i,n,o){this.absellipse(e,t,r,r,i,n,o)},n.Path.prototype.ellipse=function(e,t,r,i,n,o,a){var s=this.actions[this.actions.length-1].args,h=s[s.length-2],c=s[s.length-1];this.absellipse(e+h,t+c,r,i,n,o,a)},n.Path.prototype.absellipse=function(e,t,r,i,o,a,s){var h=Array.prototype.slice.call(arguments),c=new n.EllipseCurve(e,t,r,i,o,a,s);this.curves.push(c);var l=c.getPoint(1);h.push(l.x),h.push(l.y),this.actions.push({action:n.PathActions.ELLIPSE,args:h})},n.Path.prototype.getSpacedPoints=function(e,t){e||(e=40);for(var r=[],i=0;e>i;i++)r.push(this.getPoint(i/e));return r},n.Path.prototype.getPoints=function(e,t){if(this.useSpacedPoints)return console.log("tata"),this.getSpacedPoints(e,t);e=e||12;var r,i,o,a,s,h,c,l,u,f,p,d,m,g,v,y,x,b,w=[];for(r=0,i=this.actions.length;i>r;r++)switch(o=this.actions[r],a=o.action,s=o.args,a){case n.PathActions.MOVE_TO:w.push(new n.Vector2(s[0],s[1]));break;case n.PathActions.LINE_TO:w.push(new n.Vector2(s[0],s[1]));break;case n.PathActions.QUADRATIC_CURVE_TO:for(h=s[2],c=s[3],f=s[0],p=s[1],w.length>0?(g=w[w.length-1],d=g.x,m=g.y):(g=this.actions[r-1].args,d=g[g.length-2],m=g[g.length-1]),v=1;e>=v;v++)y=v/e,x=n.Shape.Utils.b2(y,d,f,h),b=n.Shape.Utils.b2(y,m,p,c),w.push(new n.Vector2(x,b));break;case n.PathActions.BEZIER_CURVE_TO:for(h=s[4],c=s[5],f=s[0],p=s[1],l=s[2],u=s[3],w.length>0?(g=w[w.length-1],d=g.x,m=g.y):(g=this.actions[r-1].args,d=g[g.length-2],m=g[g.length-1]),v=1;e>=v;v++)y=v/e,x=n.Shape.Utils.b3(y,d,f,l,h),b=n.Shape.Utils.b3(y,m,p,u,c),w.push(new n.Vector2(x,b));break;case n.PathActions.CSPLINE_THRU:g=this.actions[r-1].args;var A=new n.Vector2(g[g.length-2],g[g.length-1]),M=[A],_=e*s[0].length;M=M.concat(s[0]);var S=new n.SplineCurve(M);for(v=1;_>=v;v++)w.push(S.getPointAt(v/_));break;case n.PathActions.ARC:var E,T=s[0],C=s[1],L=s[2],P=s[3],R=s[4],F=!!s[5],B=R-P,D=2*e;for(v=1;D>=v;v++)y=v/D,F||(y=1-y),E=P+y*B,x=T+L*Math.cos(E),b=C+L*Math.sin(E),w.push(new n.Vector2(x,b));break;case n.PathActions.ELLIPSE:var E,T=s[0],C=s[1],U=s[2],V=s[3],P=s[4],R=s[5],F=!!s[6],B=R-P,D=2*e;for(v=1;D>=v;v++)y=v/D,F||(y=1-y),E=P+y*B,x=T+U*Math.cos(E),b=C+V*Math.sin(E),w.push(new n.Vector2(x,b))}var O=w[w.length-1],z=1e-10;return Math.abs(O.x-w[0].x)t;t++)i=e[t],a=i.args,o=i.action,o==n.PathActions.MOVE_TO&&0!=h.actions.length&&(s.push(h),h=new n.Path),h[o].apply(h,a);return 0!=h.actions.length&&s.push(h),s}function i(e){for(var t=[],r=0,i=e.length;i>r;r++){var o=e[r],a=new n.Shape;a.actions=o.actions,a.curves=o.curves,t.push(a)}return t}function o(e,t){for(var r=1e-10,i=t.length,n=!1,o=i-1,a=0;i>a;o=a++){var s=t[o],h=t[a],c=h.x-s.x,l=h.y-s.y;if(Math.abs(l)>r){if(0>l&&(s=t[a],c=-c,h=t[o],l=-l),e.yh.y)continue;if(e.y==s.y){if(e.x==s.x)return!0}else{var u=l*(e.x-s.x)-c*(e.y-s.y);if(0==u)return!0;if(0>u)continue;n=!n}}else{if(e.y!=s.y)continue;if(h.x<=e.x&&e.x<=s.x||s.x<=e.x&&e.x<=h.x)return!0}}return n}var a=r(this.actions);if(0==a.length)return[];if(t===!0)return i(a);var s,h,c,l=[];if(1==a.length)return h=a[0],c=new n.Shape,c.actions=h.actions,c.curves=h.curves,l.push(c),l;var u=!n.Shape.Utils.isClockWise(a[0].getPoints());u=e?!u:u;var f,p=[],d=[],m=[],g=0;d[g]=void 0,m[g]=[];var v,y;for(v=0,y=a.length;y>v;v++)h=a[v],f=h.getPoints(),s=n.Shape.Utils.isClockWise(f),s=e?!s:s,s?(!u&&d[g]&&g++,d[g]={s:new n.Shape,p:f},d[g].s.actions=h.actions,d[g].s.curves=h.curves,u&&g++,m[g]=[]):m[g].push({h:h,p:f[0]});if(!d[0])return i(a);if(d.length>1){for(var x=!1,b=[],w=0,A=d.length;A>w;w++)p[w]=[];for(var w=0,A=d.length;A>w;w++)for(var M=m[w],_=0;_0&&(x||(m=p))}var C,L,P;for(v=0,y=d.length;y>v;v++)for(c=d[v].s,l.push(c),C=m[v],L=0,P=C.length;P>L;L++)c.holes.push(C[L].h);return l},n.Shape=function(){n.Path.apply(this,arguments),this.holes=[]},n.Shape.prototype=Object.create(n.Path.prototype),n.Shape.prototype.constructor=n.Shape,n.Shape.prototype.extrude=function(e){var t=new n.ExtrudeGeometry(this,e);return t},n.Shape.prototype.makeGeometry=function(e){var t=new n.ShapeGeometry(this,e);return t},n.Shape.prototype.getPointsHoles=function(e){var t,r=this.holes.length,i=[];for(t=0;r>t;t++)i[t]=this.holes[t].getTransformedPoints(e,this.bends);return i},n.Shape.prototype.getSpacedPointsHoles=function(e){var t,r=this.holes.length,i=[];for(t=0;r>t;t++)i[t]=this.holes[t].getTransformedSpacedPoints(e,this.bends);return i},n.Shape.prototype.extractAllPoints=function(e){return{shape:this.getTransformedPoints(e),holes:this.getPointsHoles(e)}},n.Shape.prototype.extractPoints=function(e){return this.useSpacedPoints?this.extractAllSpacedPoints(e):this.extractAllPoints(e)},n.Shape.prototype.extractAllSpacedPoints=function(e){return{shape:this.getTransformedSpacedPoints(e),holes:this.getSpacedPointsHoles(e)}},n.Shape.Utils={triangulateShape:function(e,t){function r(e,t,r){return e.x!=t.x?e.xa){var m;if(p>0){if(0>d||d>p)return[];if(m=l*u-c*f,0>m||m>p)return[]}else{if(d>0||p>d)return[];if(m=l*u-c*f,m>0||p>m)return[]}if(0==m)return!o||0!=d&&d!=p?[e]:[];if(m==p)return!o||0!=d&&d!=p?[t]:[];if(0==d)return[i];if(d==p)return[n];var g=m/p;return[{x:e.x+g*s,y:e.y+g*h}]}if(0!=d||l*u!=c*f)return[];var v=0==s&&0==h,y=0==c&&0==l;if(v&&y)return e.x!=i.x||e.y!=i.y?[]:[e];if(v)return r(i,n,e)?[e]:[];if(y)return r(e,t,i)?[i]:[];var x,b,w,A,M,_,S,E;return 0!=s?(e.x=w?S>A?[]:A==S?o?[]:[M]:E>=A?[M,b]:[M,_]:w>E?[]:w==E?o?[]:[x]:E>=A?[x,b]:[x,_]}function o(e,t,r,i){var n=1e-10,o=t.x-e.x,a=t.y-e.y,s=r.x-e.x,h=r.y-e.y,c=i.x-e.x,l=i.y-e.y,u=o*h-a*s,f=o*l-a*c;if(Math.abs(u)>n){var p=c*h-l*s;return u>0?f>=0&&p>=0:f>=0||p>=0}return f>0}function a(e,t){function r(e,t){var r=y.length-1,i=e-1;0>i&&(i=r);var n=e+1;n>r&&(n=0);var a=o(y[e],y[i],y[n],s[t]);if(!a)return!1;var h=s.length-1,c=t-1;0>c&&(c=h);var l=t+1;return l>h&&(l=0),a=o(s[t],s[c],s[l],y[e]),a?!0:!1}function n(e,t){var r,n,o;for(r=0;r0)return!0;return!1}function a(e,r){var n,o,a,s,h;for(n=0;n0)return!0;return!1}for(var s,h,c,l,u,f,p,d,m,g,v,y=e.concat(),x=[],b=[],w=0,A=t.length;A>w;w++)x.push(w);for(var M=0,_=2*x.length;x.length>0;){if(_--,0>_){console.log("Infinite Loop! Holes left:"+x.length+", Probably Hole outside Shape!");break}for(c=M;c=0)break;b[p]=!0}if(h>=0)break}}return y}for(var s,h,c,l,u,f,p={},d=e.concat(),m=0,g=t.length;g>m;m++)Array.prototype.push.apply(d,t[m]);for(s=0,h=d.length;h>s;s++)u=d[s].x+":"+d[s].y,void 0!==p[u]&&n.warn("THREE.Shape: Duplicate point",u),p[u]=s;var v=a(e,t),y=n.FontUtils.Triangulate(v,!1);for(s=0,h=y.length;h>s;s++)for(l=y[s],c=0;3>c;c++)u=l[c].x+":"+l[c].y,f=p[u],void 0!==f&&(l[c]=f);return y.concat()},isClockWise:function(e){return n.FontUtils.Triangulate.area(e)<0},b2p0:function(e,t){var r=1-e;return r*r*t},b2p1:function(e,t){return 2*(1-e)*e*t},b2p2:function(e,t){return e*e*t},b2:function(e,t,r,i){return this.b2p0(e,t)+this.b2p1(e,r)+this.b2p2(e,i)},b3p0:function(e,t){var r=1-e;return r*r*r*t},b3p1:function(e,t){var r=1-e;return 3*r*r*e*t},b3p2:function(e,t){var r=1-e;return 3*r*e*e*t},b3p3:function(e,t){return e*e*e*t},b3:function(e,t,r,i,n){return this.b3p0(e,t)+this.b3p1(e,r)+this.b3p2(e,i)+this.b3p3(e,n)}},n.LineCurve=function(e,t){this.v1=e,this.v2=t},n.LineCurve.prototype=Object.create(n.Curve.prototype),n.LineCurve.prototype.constructor=n.LineCurve,n.LineCurve.prototype.getPoint=function(e){var t=this.v2.clone().sub(this.v1);return t.multiplyScalar(e).add(this.v1),t},n.LineCurve.prototype.getPointAt=function(e){return this.getPoint(e)},n.LineCurve.prototype.getTangent=function(e){var t=this.v2.clone().sub(this.v1);return t.normalize()},n.QuadraticBezierCurve=function(e,t,r){this.v0=e,this.v1=t,this.v2=r},n.QuadraticBezierCurve.prototype=Object.create(n.Curve.prototype),n.QuadraticBezierCurve.prototype.constructor=n.QuadraticBezierCurve,n.QuadraticBezierCurve.prototype.getPoint=function(e){var t=new n.Vector2;return t.x=n.Shape.Utils.b2(e,this.v0.x,this.v1.x,this.v2.x),t.y=n.Shape.Utils.b2(e,this.v0.y,this.v1.y,this.v2.y),t},n.QuadraticBezierCurve.prototype.getTangent=function(e){var t=new n.Vector2;return t.x=n.Curve.Utils.tangentQuadraticBezier(e,this.v0.x,this.v1.x,this.v2.x),t.y=n.Curve.Utils.tangentQuadraticBezier(e,this.v0.y,this.v1.y,this.v2.y),t.normalize()},n.CubicBezierCurve=function(e,t,r,i){this.v0=e,this.v1=t,this.v2=r,this.v3=i},n.CubicBezierCurve.prototype=Object.create(n.Curve.prototype),n.CubicBezierCurve.prototype.constructor=n.CubicBezierCurve,n.CubicBezierCurve.prototype.getPoint=function(e){var t,r;return t=n.Shape.Utils.b3(e,this.v0.x,this.v1.x,this.v2.x,this.v3.x),r=n.Shape.Utils.b3(e,this.v0.y,this.v1.y,this.v2.y,this.v3.y),new n.Vector2(t,r)},n.CubicBezierCurve.prototype.getTangent=function(e){var t,r;t=n.Curve.Utils.tangentCubicBezier(e,this.v0.x,this.v1.x,this.v2.x,this.v3.x),r=n.Curve.Utils.tangentCubicBezier(e,this.v0.y,this.v1.y,this.v2.y,this.v3.y);var i=new n.Vector2(t,r);return i.normalize(),i},n.SplineCurve=function(e){this.points=void 0==e?[]:e},n.SplineCurve.prototype=Object.create(n.Curve.prototype),n.SplineCurve.prototype.constructor=n.SplineCurve,n.SplineCurve.prototype.getPoint=function(e){var t=this.points,r=(t.length-1)*e,i=Math.floor(r),o=r-i,a=t[0==i?i:i-1],s=t[i],h=t[i>t.length-2?t.length-1:i+1],c=t[i>t.length-3?t.length-1:i+2],l=new n.Vector2;return l.x=n.Curve.Utils.interpolate(a.x,s.x,h.x,c.x,o),l.y=n.Curve.Utils.interpolate(a.y,s.y,h.y,c.y,o),l},n.EllipseCurve=function(e,t,r,i,n,o,a){this.aX=e,this.aY=t,this.xRadius=r,this.yRadius=i,this.aStartAngle=n,this.aEndAngle=o,this.aClockwise=a},n.EllipseCurve.prototype=Object.create(n.Curve.prototype),n.EllipseCurve.prototype.constructor=n.EllipseCurve,n.EllipseCurve.prototype.getPoint=function(e){var t=this.aEndAngle-this.aStartAngle;0>t&&(t+=2*Math.PI),t>2*Math.PI&&(t-=2*Math.PI);var r;r=this.aClockwise===!0?this.aEndAngle+(1-e)*(2*Math.PI-t):this.aStartAngle+e*t;var i=new n.Vector2;return i.x=this.aX+this.xRadius*Math.cos(r),i.y=this.aY+this.yRadius*Math.sin(r),i},n.ArcCurve=function(e,t,r,i,o,a){n.EllipseCurve.call(this,e,t,r,r,i,o,a)},n.ArcCurve.prototype=Object.create(n.EllipseCurve.prototype),n.ArcCurve.prototype.constructor=n.ArcCurve,n.LineCurve3=n.Curve.create(function(e,t){this.v1=e,this.v2=t},function(e){var t=new n.Vector3;return t.subVectors(this.v2,this.v1),t.multiplyScalar(e),t.add(this.v1),t}),n.QuadraticBezierCurve3=n.Curve.create(function(e,t,r){this.v0=e,this.v1=t,this.v2=r},function(e){var t=new n.Vector3;return t.x=n.Shape.Utils.b2(e,this.v0.x,this.v1.x,this.v2.x),t.y=n.Shape.Utils.b2(e,this.v0.y,this.v1.y,this.v2.y),t.z=n.Shape.Utils.b2(e,this.v0.z,this.v1.z,this.v2.z),t}),n.CubicBezierCurve3=n.Curve.create(function(e,t,r,i){this.v0=e,this.v1=t,this.v2=r,this.v3=i},function(e){var t=new n.Vector3;return t.x=n.Shape.Utils.b3(e,this.v0.x,this.v1.x,this.v2.x,this.v3.x),t.y=n.Shape.Utils.b3(e,this.v0.y,this.v1.y,this.v2.y,this.v3.y),t.z=n.Shape.Utils.b3(e,this.v0.z,this.v1.z,this.v2.z,this.v3.z),t}),n.SplineCurve3=n.Curve.create(function(e){this.points=void 0==e?[]:e},function(e){var t=this.points,r=(t.length-1)*e,i=Math.floor(r),o=r-i,a=t[0==i?i:i-1],s=t[i],h=t[i>t.length-2?t.length-1:i+1],c=t[i>t.length-3?t.length-1:i+2],l=new n.Vector3;return l.x=n.Curve.Utils.interpolate(a.x,s.x,h.x,c.x,o),l.y=n.Curve.Utils.interpolate(a.y,s.y,h.y,c.y,o),l.z=n.Curve.Utils.interpolate(a.z,s.z,h.z,c.z,o),l}),n.ClosedSplineCurve3=n.Curve.create(function(e){this.points=void 0==e?[]:e},function(e){var t=this.points,r=(t.length-0)*e,i=Math.floor(r),o=r-i;i+=i>0?0:(Math.floor(Math.abs(i)/t.length)+1)*t.length;var a=t[(i-1)%t.length],s=t[i%t.length],h=t[(i+1)%t.length],c=t[(i+2)%t.length],l=new n.Vector3;return l.x=n.Curve.Utils.interpolate(a.x,s.x,h.x,c.x,o),l.y=n.Curve.Utils.interpolate(a.y,s.y,h.y,c.y,o),l.z=n.Curve.Utils.interpolate(a.z,s.z,h.z,c.z,o),l}),n.AnimationHandler={LINEAR:0,CATMULLROM:1,CATMULLROM_FORWARD:2,add:function(){n.warn("THREE.AnimationHandler.add() has been deprecated.")},get:function(){n.warn("THREE.AnimationHandler.get() has been deprecated.")},remove:function(){n.warn("THREE.AnimationHandler.remove() has been deprecated.")},animations:[],init:function(e){if(e.initialized===!0)return e;for(var t=0;te;e++){var r=this.hierarchy[e];void 0===r.animationCache&&(r.animationCache={animations:{},blending:{positionWeight:0,quaternionWeight:0,scaleWeight:0}});var i=this.data.name,n=r.animationCache.animations,o=n[i];void 0===o&&(o={prevKey:{pos:0,rot:0,scl:0},nextKey:{pos:0,rot:0,scl:0},originalMatrix:r.matrix},n[i]=o);for(var a=0;3>a;a++){for(var s=this.keyTypes[a],h=this.data.hierarchy[e].keys[0],c=this.getNextKeyWith(s,e,1);c.timeh.index;)h=c,c=this.getNextKeyWith(s,e,c.index+1);o.prevKey[s]=h,o.nextKey[s]=c}}},resetBlendWeights:function(){for(var e=0,t=this.hierarchy.length;t>e;e++){var r=this.hierarchy[e],i=r.animationCache;if(void 0!==i){var n=i.blending;n.positionWeight=0,n.quaternionWeight=0,n.scaleWeight=0}}},update:function(){var e=[],t=new n.Vector3,r=new n.Vector3,i=new n.Quaternion,o=function(e,t){var r,i,n,o,s,h,c,l,u,f=[],p=[];return r=(e.length-1)*t,i=Math.floor(r),n=r-i,f[0]=0===i?i:i-1,f[1]=i,f[2]=i>e.length-2?i:i+1,f[3]=i>e.length-3?i:i+2,h=e[f[0]],c=e[f[1]],l=e[f[2]],u=e[f[3]],o=n*n,s=n*o,p[0]=a(h[0],c[0],l[0],u[0],n,o,s),p[1]=a(h[1],c[1],l[1],u[1],n,o,s),p[2]=a(h[2],c[2],l[2],u[2],n,o,s),p},a=function(e,t,r,i,n,o,a){var s=.5*(r-e),h=.5*(i-t);return(2*(t-r)+s+h)*a+(-3*(t-r)-2*s-h)*o+s*n+t};return function(a){if(this.isPlaying!==!1&&(this.currentTime+=a*this.timeScale,0!==this.weight)){var s=this.data.length;(this.currentTime>s||this.currentTime<0)&&(this.loop?(this.currentTime%=s,this.currentTime<0&&(this.currentTime+=s),this.reset()):this.stop());for(var h=0,c=this.hierarchy.length;c>h;h++)for(var l=this.hierarchy[h],u=l.animationCache.animations[this.data.name],f=l.animationCache.blending,p=0;3>p;p++){var d=this.keyTypes[p],m=u.prevKey[d],g=u.nextKey[d];if(this.timeScale>0&&g.time<=this.currentTime||this.timeScale<0&&m.time>=this.currentTime){for(m=this.data.hierarchy[h].keys[0],g=this.getNextKeyWith(d,h,1);g.timem.index;)m=g,g=this.getNextKeyWith(d,h,g.index+1);u.prevKey[d]=m,u.nextKey[d]=g}var v=(this.currentTime-m.time)/(g.time-m.time),y=m[d],x=g[d];if(0>v&&(v=0),v>1&&(v=1),"pos"===d){if(this.interpolationType===n.AnimationHandler.LINEAR){r.x=y[0]+(x[0]-y[0])*v,r.y=y[1]+(x[1]-y[1])*v,r.z=y[2]+(x[2]-y[2])*v;var b=this.weight/(this.weight+f.positionWeight);l.position.lerp(r,b),f.positionWeight+=this.weight}else if(this.interpolationType===n.AnimationHandler.CATMULLROM||this.interpolationType===n.AnimationHandler.CATMULLROM_FORWARD){e[0]=this.getPrevKeyWith("pos",h,m.index-1).pos,e[1]=y,e[2]=x,e[3]=this.getNextKeyWith("pos",h,g.index+1).pos,v=.33*v+.33;var w=o(e,v),b=this.weight/(this.weight+f.positionWeight);f.positionWeight+=this.weight;var A=l.position;if(A.x=A.x+(w[0]-A.x)*b,A.y=A.y+(w[1]-A.y)*b,A.z=A.z+(w[2]-A.z)*b,this.interpolationType===n.AnimationHandler.CATMULLROM_FORWARD){var M=o(e,1.01*v);t.set(M[0],M[1],M[2]),t.sub(A),t.y=0,t.normalize();var _=Math.atan2(t.x,t.z);l.rotation.set(0,_,0)}}}else if("rot"===d)if(n.Quaternion.slerp(y,x,i,v),0===f.quaternionWeight)l.quaternion.copy(i),f.quaternionWeight=this.weight;else{var b=this.weight/(this.weight+f.quaternionWeight);n.Quaternion.slerp(l.quaternion,i,l.quaternion,b),f.quaternionWeight+=this.weight}else if("scl"===d){r.x=y[0]+(x[0]-y[0])*v,r.y=y[1]+(x[1]-y[1])*v,r.z=y[2]+(x[2]-y[2])*v;var b=this.weight/(this.weight+f.scaleWeight);l.scale.lerp(r,b),f.scaleWeight+=this.weight}}return!0}}}(),getNextKeyWith:function(e,t,r){var i=this.data.hierarchy[t].keys;for(this.interpolationType===n.AnimationHandler.CATMULLROM||this.interpolationType===n.AnimationHandler.CATMULLROM_FORWARD?r=r0?r:0:r>=0?r:r+i.length;r>=0;r--)if(void 0!==i[r][e])return i[r];return this.data.hierarchy[t].keys[i.length-1]}},n.KeyFrameAnimation=function(e){this.root=e.node,this.data=n.AnimationHandler.init(e),this.hierarchy=n.AnimationHandler.parse(this.root),this.currentTime=0,this.timeScale=.001,this.isPlaying=!1,this.isPaused=!0,this.loop=!0;for(var t=0,r=this.hierarchy.length;r>t;t++){var i=this.data.hierarchy[t].keys,o=this.data.hierarchy[t].sids,a=this.hierarchy[t];if(i.length&&o){for(var s=0;st;t++){r=this.hierarchy[t],i=this.data.hierarchy[t],void 0===i.animationCache&&(i.animationCache={},i.animationCache.prevKey=null,i.animationCache.nextKey=null,i.animationCache.originalMatrix=r.matrix);var a=this.data.hierarchy[t].keys;a.length&&(i.animationCache.prevKey=a[0],i.animationCache.nextKey=a[1],this.startTime=Math.min(a[0].time,this.startTime),this.endTime=Math.max(a[a.length-1].time,this.endTime))}this.update(0)}this.isPaused=!1,n.AnimationHandler.play(this)},stop:function(){this.isPlaying=!1,this.isPaused=!1,n.AnimationHandler.stop(this);for(var e=0;et&&(this.currentTime%=t),this.currentTime=Math.min(this.currentTime,t);for(var r=0,i=this.hierarchy.length;i>r;r++){var n=this.hierarchy[r],o=this.data.hierarchy[r],a=o.keys,s=o.animationCache;if(a.length){var h=s.prevKey,c=s.nextKey;if(c.time<=this.currentTime){for(;c.timeh.index;)h=c,c=a[h.index+1];s.prevKey=h,s.nextKey=c}c.time>=this.currentTime?h.interpolate(c,this.currentTime):h.interpolate(c,c.time),this.data.hierarchy[r].node.updateMatrix(),n.matrixWorldNeedsUpdate=!0}}}},getNextKeyWith:function(e,t,r){var i=this.data.hierarchy[t].keys;for(r%=i.length;r=0?r:r+i.length;r>=0;r--)if(i[r].hasTarget(e))return i[r];return i[i.length-1]}},n.MorphAnimation=function(e){this.mesh=e,this.frames=e.morphTargetInfluences.length,this.currentTime=0,this.duration=1e3,this.loop=!0,this.lastFrame=0,this.currentFrame=0,this.isPlaying=!1},n.MorphAnimation.prototype={constructor:n.MorphAnimation,play:function(){this.isPlaying=!0},pause:function(){this.isPlaying=!1},update:function(e){if(this.isPlaying!==!1){this.currentTime+=e,this.loop===!0&&this.currentTime>this.duration&&(this.currentTime%=this.duration),this.currentTime=Math.min(this.currentTime,this.duration);var t=this.duration/this.frames,r=Math.floor(this.currentTime/t),i=this.mesh.morphTargetInfluences;r!=this.currentFrame&&(i[this.lastFrame]=0,i[this.currentFrame]=1,i[r]=0,this.lastFrame=this.currentFrame,this.currentFrame=r),i[r]=this.currentTime%t/t,i[this.lastFrame]=1-i[r]}}},n.BoxGeometry=function(e,t,r,i,o,a){function s(e,t,r,i,o,a,s,c){var l,u,f,p=h.widthSegments,d=h.heightSegments,m=o/2,g=a/2,v=h.vertices.length;"x"===e&&"y"===t||"y"===e&&"x"===t?l="z":"x"===e&&"z"===t||"z"===e&&"x"===t?(l="y",d=h.depthSegments):("z"===e&&"y"===t||"y"===e&&"z"===t)&&(l="x",p=h.depthSegments);var y=p+1,x=d+1,b=o/p,w=a/d,A=new n.Vector3;for(A[l]=s>0?1:-1,f=0;x>f;f++)for(u=0;y>u;u++){var M=new n.Vector3;M[e]=(u*b-m)*r,M[t]=(f*w-g)*i,M[l]=s,h.vertices.push(M)}for(f=0;d>f;f++)for(u=0;p>u;u++){var _=u+y*f,S=u+y*(f+1),E=u+1+y*(f+1),T=u+1+y*f,C=new n.Vector2(u/p,1-f/d),L=new n.Vector2(u/p,1-(f+1)/d),P=new n.Vector2((u+1)/p,1-(f+1)/d),R=new n.Vector2((u+1)/p,1-f/d),F=new n.Face3(_+v,S+v,T+v);F.normal.copy(A),F.vertexNormals.push(A.clone(),A.clone(),A.clone()),F.materialIndex=c,h.faces.push(F),h.faceVertexUvs[0].push([C,L,R]),F=new n.Face3(S+v,E+v,T+v),F.normal.copy(A),F.vertexNormals.push(A.clone(),A.clone(),A.clone()),F.materialIndex=c,h.faces.push(F),h.faceVertexUvs[0].push([L.clone(),P,R.clone()])}}n.Geometry.call(this),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:r,widthSegments:i,heightSegments:o,depthSegments:a},this.widthSegments=i||1,this.heightSegments=o||1,this.depthSegments=a||1;var h=this,c=e/2,l=t/2,u=r/2;s("z","y",-1,-1,r,t,c,0),s("z","y",1,-1,r,t,-c,1),s("x","z",1,1,e,r,l,2),s("x","z",1,-1,e,r,-l,3),s("x","y",1,-1,e,t,u,4),s("x","y",-1,-1,e,t,-u,5),this.mergeVertices()},n.BoxGeometry.prototype=Object.create(n.Geometry.prototype),n.BoxGeometry.prototype.constructor=n.BoxGeometry,n.CircleGeometry=function(e,t,r,i){n.Geometry.call(this),this.type="CircleGeometry",this.parameters={radius:e,segments:t,thetaStart:r,thetaLength:i},e=e||50,t=void 0!==t?Math.max(3,t):8,r=void 0!==r?r:0,i=void 0!==i?i:2*Math.PI;var o,a=[],s=new n.Vector3,h=new n.Vector2(.5,.5);for(this.vertices.push(s),a.push(h),o=0;t>=o;o++){var c=new n.Vector3,l=r+o/t*i;c.x=e*Math.cos(l),c.y=e*Math.sin(l),this.vertices.push(c),a.push(new n.Vector2((c.x/e+1)/2,(c.y/e+1)/2))}var u=new n.Vector3(0,0,1);for(o=1;t>=o;o++)this.faces.push(new n.Face3(o,o+1,0,[u.clone(),u.clone(),u.clone()])),this.faceVertexUvs[0].push([a[o].clone(),a[o+1].clone(),h.clone()]);this.computeFaceNormals(),this.boundingSphere=new n.Sphere(new n.Vector3,e)},n.CircleGeometry.prototype=Object.create(n.Geometry.prototype),n.CircleGeometry.prototype.constructor=n.CircleGeometry,n.CubeGeometry=function(e,t,r,i,o,a){return n.warn("THREE.CubeGeometry has been renamed to THREE.BoxGeometry."),new n.BoxGeometry(e,t,r,i,o,a)},n.CylinderGeometry=function(e,t,r,i,o,a,s,h){n.Geometry.call(this),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:r,radialSegments:i,heightSegments:o,openEnded:a,thetaStart:s,thetaLength:h},e=void 0!==e?e:20,t=void 0!==t?t:20,r=void 0!==r?r:100,i=i||8,o=o||1,a=void 0!==a?a:!1,s=void 0!==s?s:0,h=void 0!==h?h:2*Math.PI;var c,l,u=r/2,f=[],p=[];for(l=0;o>=l;l++){var d=[],m=[],g=l/o,v=g*(t-e)+e;for(c=0;i>=c;c++){var y=c/i,x=new n.Vector3;x.x=v*Math.sin(y*h+s),x.y=-g*r+u,x.z=v*Math.cos(y*h+s),this.vertices.push(x),d.push(this.vertices.length-1),m.push(new n.Vector2(y,1-g))}f.push(d),p.push(m)}var b,w,A=(t-e)/r;for(c=0;i>c;c++)for(0!==e?(b=this.vertices[f[0][c]].clone(),w=this.vertices[f[0][c+1]].clone()):(b=this.vertices[f[1][c]].clone(),w=this.vertices[f[1][c+1]].clone()),b.setY(Math.sqrt(b.x*b.x+b.z*b.z)*A).normalize(),w.setY(Math.sqrt(w.x*w.x+w.z*w.z)*A).normalize(),l=0;o>l;l++){var M=f[l][c],_=f[l+1][c],S=f[l+1][c+1],E=f[l][c+1],T=b.clone(),C=b.clone(),L=w.clone(),P=w.clone(),R=p[l][c].clone(),F=p[l+1][c].clone(),B=p[l+1][c+1].clone(),D=p[l][c+1].clone();this.faces.push(new n.Face3(M,_,E,[T,C,P])),this.faceVertexUvs[0].push([R,F,D]),this.faces.push(new n.Face3(_,S,E,[C.clone(),L,P.clone()])),this.faceVertexUvs[0].push([F.clone(),B,D.clone()])}if(a===!1&&e>0)for(this.vertices.push(new n.Vector3(0,u,0)),c=0;i>c;c++){var M=f[0][c],_=f[0][c+1],S=this.vertices.length-1,T=new n.Vector3(0,1,0),C=new n.Vector3(0,1,0),L=new n.Vector3(0,1,0),R=p[0][c].clone(),F=p[0][c+1].clone(),B=new n.Vector2(F.x,0);this.faces.push(new n.Face3(M,_,S,[T,C,L])),this.faceVertexUvs[0].push([R,F,B])}if(a===!1&&t>0)for(this.vertices.push(new n.Vector3(0,-u,0)),c=0;i>c;c++){var M=f[o][c+1],_=f[o][c],S=this.vertices.length-1,T=new n.Vector3(0,-1,0),C=new n.Vector3(0,-1,0),L=new n.Vector3(0,-1,0),R=p[o][c+1].clone(),F=p[o][c].clone(),B=new n.Vector2(F.x,1);this.faces.push(new n.Face3(M,_,S,[T,C,L])),this.faceVertexUvs[0].push([R,F,B])}this.computeFaceNormals()},n.CylinderGeometry.prototype=Object.create(n.Geometry.prototype),n.CylinderGeometry.prototype.constructor=n.CylinderGeometry,n.ExtrudeGeometry=function(e,t){return"undefined"==typeof e?void(e=[]):(n.Geometry.call(this),this.type="ExtrudeGeometry",e=e instanceof Array?e:[e],this.addShapeList(e,t),void this.computeFaceNormals())},n.ExtrudeGeometry.prototype=Object.create(n.Geometry.prototype),n.ExtrudeGeometry.prototype.constructor=n.ExtrudeGeometry,n.ExtrudeGeometry.prototype.addShapeList=function(e,t){for(var r=e.length,i=0;r>i;i++){var n=e[i];this.addShape(n,t)}},n.ExtrudeGeometry.prototype.addShape=function(e,t){function r(e,t,r){return t||n.error("THREE.ExtrudeGeometry: vec does not exist"),t.clone().multiplyScalar(r).add(e)}function i(e,t,r){var i,o,a=1e-10,s=1,h=e.x-t.x,c=e.y-t.y,l=r.x-e.x,u=r.y-e.y,f=h*h+c*c,p=h*u-c*l;if(Math.abs(p)>a){var d=Math.sqrt(f),m=Math.sqrt(l*l+u*u),g=t.x-c/d,v=t.y+h/d,y=r.x-u/m,x=r.y+l/m,b=((y-g)*u-(x-v)*l)/(h*u-c*l);i=g+h*b-e.x,o=v+c*b-e.y;var w=i*i+o*o;if(2>=w)return new n.Vector2(i,o);s=Math.sqrt(w/2)}else{var A=!1;h>a?l>a&&(A=!0):-a>h?-a>l&&(A=!0):Math.sign(c)==Math.sign(u)&&(A=!0),A?(i=-c,o=h,s=Math.sqrt(f)):(i=h,o=c,s=Math.sqrt(f/2))}return new n.Vector2(i/s,o/s)}function o(){if(b){var e=0,t=W*e;for(Y=0;X>Y;Y++)j=O[Y],c(j[2]+t,j[1]+t,j[0]+t);for(e=A+2*x,t=W*e,Y=0;X>Y;Y++)j=O[Y],c(j[0]+t,j[1]+t,j[2]+t)}else{for(Y=0;X>Y;Y++)j=O[Y],c(j[2],j[1],j[0]);for(Y=0;X>Y;Y++)j=O[Y],c(j[0]+W*A,j[1]+W*A,j[2]+W*A)}}function a(){var e=0;for(s(z,e),e+=z.length,L=0,P=U.length;P>L;L++)C=U[L],s(C,e),e+=C.length}function s(e,t){var r,i;for(Y=e.length;--Y>=0;){r=Y,i=Y-1,0>i&&(i=e.length-1);var n=0,o=A+2*x;for(n=0;o>n;n++){var a=W*n,s=W*(n+1),h=t+r+a,c=t+i+a,u=t+i+s,f=t+r+s;l(h,c,u,f,e,n,o,r,i)}}}function h(e,t,r){R.vertices.push(new n.Vector3(e,t,r))}function c(e,t,r){e+=F,t+=F,r+=F,R.faces.push(new n.Face3(e,t,r,null,null,S));var i=T.generateTopUV(R,e,t,r);R.faceVertexUvs[0].push(i)}function l(e,t,r,i,o,a,s,h,c){e+=F,t+=F,r+=F,i+=F,R.faces.push(new n.Face3(e,t,i,null,null,E)),R.faces.push(new n.Face3(t,r,i,null,null,E));var l=T.generateSideWallUV(R,e,t,r,i);R.faceVertexUvs[0].push([l[0],l[1],l[3]]),R.faceVertexUvs[0].push([l[1],l[2],l[3]])}var u,f,p,d,m,g=void 0!==t.amount?t.amount:100,v=void 0!==t.bevelThickness?t.bevelThickness:6,y=void 0!==t.bevelSize?t.bevelSize:v-2,x=void 0!==t.bevelSegments?t.bevelSegments:3,b=void 0!==t.bevelEnabled?t.bevelEnabled:!0,w=void 0!==t.curveSegments?t.curveSegments:12,A=void 0!==t.steps?t.steps:1,M=t.extrudePath,_=!1,S=t.material,E=t.extrudeMaterial,T=void 0!==t.UVGenerator?t.UVGenerator:n.ExtrudeGeometry.WorldUVGenerator;M&&(u=M.getSpacedPoints(A),_=!0,b=!1,f=void 0!==t.frames?t.frames:new n.TubeGeometry.FrenetFrames(M,A,!1),p=new n.Vector3,d=new n.Vector3,m=new n.Vector3),b||(x=0,v=0,y=0);var C,L,P,R=this,F=this.vertices.length,B=e.extractPoints(w),D=B.shape,U=B.holes,V=!n.Shape.Utils.isClockWise(D);if(V){for(D=D.reverse(),L=0,P=U.length;P>L;L++)C=U[L],n.Shape.Utils.isClockWise(C)&&(U[L]=C.reverse()); -V=!1}var O=n.Shape.Utils.triangulateShape(D,U),z=D;for(L=0,P=U.length;P>L;L++)C=U[L],D=D.concat(C);for(var k,N,G,I,H,j,W=D.length,X=O.length,q=[],Y=0,K=z.length,Q=K-1,Z=Y+1;K>Y;Y++,Q++,Z++)Q===K&&(Q=0),Z===K&&(Z=0),q[Y]=i(z[Y],z[Q],z[Z]);var J,$=[],ee=q.concat();for(L=0,P=U.length;P>L;L++){for(C=U[L],J=[],Y=0,K=C.length,Q=K-1,Z=Y+1;K>Y;Y++,Q++,Z++)Q===K&&(Q=0),Z===K&&(Z=0),J[Y]=i(C[Y],C[Q],C[Z]);$.push(J),ee=ee.concat(J)}for(k=0;x>k;k++){for(G=k/x,I=v*(1-G),N=y*Math.sin(G*Math.PI/2),Y=0,K=z.length;K>Y;Y++)H=r(z[Y],q[Y],N),h(H.x,H.y,-I);for(L=0,P=U.length;P>L;L++)for(C=U[L],J=$[L],Y=0,K=C.length;K>Y;Y++)H=r(C[Y],J[Y],N),h(H.x,H.y,-I)}for(N=y,Y=0;W>Y;Y++)H=b?r(D[Y],ee[Y],N):D[Y],_?(d.copy(f.normals[0]).multiplyScalar(H.x),p.copy(f.binormals[0]).multiplyScalar(H.y),m.copy(u[0]).add(d).add(p),h(m.x,m.y,m.z)):h(H.x,H.y,0);var te;for(te=1;A>=te;te++)for(Y=0;W>Y;Y++)H=b?r(D[Y],ee[Y],N):D[Y],_?(d.copy(f.normals[te]).multiplyScalar(H.x),p.copy(f.binormals[te]).multiplyScalar(H.y),m.copy(u[te]).add(d).add(p),h(m.x,m.y,m.z)):h(H.x,H.y,g/A*te);for(k=x-1;k>=0;k--){for(G=k/x,I=v*(1-G),N=y*Math.sin(G*Math.PI/2),Y=0,K=z.length;K>Y;Y++)H=r(z[Y],q[Y],N),h(H.x,H.y,g+I);for(L=0,P=U.length;P>L;L++)for(C=U[L],J=$[L],Y=0,K=C.length;K>Y;Y++)H=r(C[Y],J[Y],N),_?h(H.x,H.y+u[A-1].y,u[A-1].x+I):h(H.x,H.y,g+I)}o(),a()},n.ExtrudeGeometry.WorldUVGenerator={generateTopUV:function(e,t,r,i){var o=e.vertices,a=o[t],s=o[r],h=o[i];return[new n.Vector2(a.x,a.y),new n.Vector2(s.x,s.y),new n.Vector2(h.x,h.y)]},generateSideWallUV:function(e,t,r,i,o){var a=e.vertices,s=a[t],h=a[r],c=a[i],l=a[o];return Math.abs(s.y-h.y)<.01?[new n.Vector2(s.x,1-s.z),new n.Vector2(h.x,1-h.z),new n.Vector2(c.x,1-c.z),new n.Vector2(l.x,1-l.z)]:[new n.Vector2(s.y,1-s.z),new n.Vector2(h.y,1-h.z),new n.Vector2(c.y,1-c.z),new n.Vector2(l.y,1-l.z)]}},n.ShapeGeometry=function(e,t){n.Geometry.call(this),this.type="ShapeGeometry",e instanceof Array==!1&&(e=[e]),this.addShapeList(e,t),this.computeFaceNormals()},n.ShapeGeometry.prototype=Object.create(n.Geometry.prototype),n.ShapeGeometry.prototype.constructor=n.ShapeGeometry,n.ShapeGeometry.prototype.addShapeList=function(e,t){for(var r=0,i=e.length;i>r;r++)this.addShape(e[r],t);return this},n.ShapeGeometry.prototype.addShape=function(e,t){void 0===t&&(t={});var r,i,o,a=void 0!==t.curveSegments?t.curveSegments:12,s=t.material,h=void 0===t.UVGenerator?n.ExtrudeGeometry.WorldUVGenerator:t.UVGenerator,c=this.vertices.length,l=e.extractPoints(a),u=l.shape,f=l.holes,p=!n.Shape.Utils.isClockWise(u);if(p){for(u=u.reverse(),r=0,i=f.length;i>r;r++)o=f[r],n.Shape.Utils.isClockWise(o)&&(f[r]=o.reverse());p=!1}var d=n.Shape.Utils.triangulateShape(u,f);for(r=0,i=f.length;i>r;r++)o=f[r],u=u.concat(o);var m,g,v=u.length,y=d.length;for(r=0;v>r;r++)m=u[r],this.vertices.push(new n.Vector3(m.x,m.y,0));for(r=0;y>r;r++){g=d[r];var x=g[0]+c,b=g[1]+c,w=g[2]+c;this.faces.push(new n.Face3(x,b,w,null,null,s)),this.faceVertexUvs[0].push(h.generateTopUV(this,x,b,w))}},n.LatheGeometry=function(e,t,r,i){n.Geometry.call(this),this.type="LatheGeometry",this.parameters={points:e,segments:t,phiStart:r,phiLength:i},t=t||12,r=r||0,i=i||2*Math.PI;for(var o=1/(e.length-1),a=1/t,s=0,h=t;h>=s;s++)for(var c=r+s*a*i,l=Math.cos(c),u=Math.sin(c),f=0,p=e.length;p>f;f++){var d=e[f],m=new n.Vector3;m.x=l*d.x-u*d.y,m.y=u*d.x+l*d.y,m.z=d.z,this.vertices.push(m)}for(var g=e.length,s=0,h=t;h>s;s++)for(var f=0,p=e.length-1;p>f;f++){var v=f+g*s,y=v,x=v+g,l=v+1+g,b=v+1,w=s*a,A=f*o,M=w+a,_=A+o;this.faces.push(new n.Face3(y,x,b)),this.faceVertexUvs[0].push([new n.Vector2(w,A),new n.Vector2(M,A),new n.Vector2(w,_)]),this.faces.push(new n.Face3(x,l,b)),this.faceVertexUvs[0].push([new n.Vector2(M,A),new n.Vector2(M,_),new n.Vector2(w,_)])}this.mergeVertices(),this.computeFaceNormals(),this.computeVertexNormals()},n.LatheGeometry.prototype=Object.create(n.Geometry.prototype),n.LatheGeometry.prototype.constructor=n.LatheGeometry,n.PlaneGeometry=function(e,t,r,i){console.info("THREE.PlaneGeometry: Consider using THREE.PlaneBufferGeometry for lower memory footprint."),n.Geometry.call(this),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:r,heightSegments:i},this.fromBufferGeometry(new n.PlaneBufferGeometry(e,t,r,i))},n.PlaneGeometry.prototype=Object.create(n.Geometry.prototype),n.PlaneGeometry.prototype.constructor=n.PlaneGeometry,n.PlaneBufferGeometry=function(e,t,r,i){n.BufferGeometry.call(this),this.type="PlaneBufferGeometry",this.parameters={width:e,height:t,widthSegments:r,heightSegments:i};for(var o=e/2,a=t/2,s=r||1,h=i||1,c=s+1,l=h+1,u=e/s,f=t/h,p=new Float32Array(c*l*3),d=new Float32Array(c*l*3),m=new Float32Array(c*l*2),g=0,v=0,y=0;l>y;y++)for(var x=y*f-a,b=0;c>b;b++){var w=b*u-o;p[g]=w,p[g+1]=-x,d[g+2]=1,m[v]=b/s,m[v+1]=1-y/h,g+=3,v+=2}g=0;for(var A=new(p.length/3>65535?Uint32Array:Uint16Array)(s*h*6),y=0;h>y;y++)for(var b=0;s>b;b++){var M=b+c*y,_=b+c*(y+1),S=b+1+c*(y+1),E=b+1+c*y;A[g]=M,A[g+1]=_,A[g+2]=E,A[g+3]=_,A[g+4]=S,A[g+5]=E,g+=6}this.addAttribute("index",new n.BufferAttribute(A,1)),this.addAttribute("position",new n.BufferAttribute(p,3)),this.addAttribute("normal",new n.BufferAttribute(d,3)),this.addAttribute("uv",new n.BufferAttribute(m,2))},n.PlaneBufferGeometry.prototype=Object.create(n.BufferGeometry.prototype),n.PlaneBufferGeometry.prototype.constructor=n.PlaneBufferGeometry,n.RingGeometry=function(e,t,r,i,o,a){n.Geometry.call(this),this.type="RingGeometry",this.parameters={innerRadius:e,outerRadius:t,thetaSegments:r,phiSegments:i,thetaStart:o,thetaLength:a},e=e||0,t=t||50,o=void 0!==o?o:0,a=void 0!==a?a:2*Math.PI,r=void 0!==r?Math.max(3,r):8,i=void 0!==i?Math.max(1,i):8;var s,h,c=[],l=e,u=(t-e)/i;for(s=0;i+1>s;s++){for(h=0;r+1>h;h++){var f=new n.Vector3,p=o+h/r*a;f.x=l*Math.cos(p),f.y=l*Math.sin(p),this.vertices.push(f),c.push(new n.Vector2((f.x/t+1)/2,(f.y/t+1)/2))}l+=u}var d=new n.Vector3(0,0,1);for(s=0;i>s;s++){var m=s*(r+1);for(h=0;r>h;h++){var p=h+m,g=p,v=p+r+1,y=p+r+2;this.faces.push(new n.Face3(g,v,y,[d.clone(),d.clone(),d.clone()])),this.faceVertexUvs[0].push([c[g].clone(),c[v].clone(),c[y].clone()]),g=p,v=p+r+2,y=p+1,this.faces.push(new n.Face3(g,v,y,[d.clone(),d.clone(),d.clone()])),this.faceVertexUvs[0].push([c[g].clone(),c[v].clone(),c[y].clone()])}}this.computeFaceNormals(),this.boundingSphere=new n.Sphere(new n.Vector3,l)},n.RingGeometry.prototype=Object.create(n.Geometry.prototype),n.RingGeometry.prototype.constructor=n.RingGeometry,n.SphereGeometry=function(e,t,r,i,o,a,s){n.Geometry.call(this),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:r,phiStart:i,phiLength:o,thetaStart:a,thetaLength:s},e=e||50,t=Math.max(3,Math.floor(t)||8),r=Math.max(2,Math.floor(r)||6),i=void 0!==i?i:0,o=void 0!==o?o:2*Math.PI,a=void 0!==a?a:0,s=void 0!==s?s:Math.PI;var h,c,l=[],u=[];for(c=0;r>=c;c++){var f=[],p=[];for(h=0;t>=h;h++){var d=h/t,m=c/r,g=new n.Vector3;g.x=-e*Math.cos(i+d*o)*Math.sin(a+m*s),g.y=e*Math.cos(a+m*s),g.z=e*Math.sin(i+d*o)*Math.sin(a+m*s),this.vertices.push(g),f.push(this.vertices.length-1),p.push(new n.Vector2(d,1-m))}l.push(f),u.push(p)}for(c=0;r>c;c++)for(h=0;t>h;h++){var v=l[c][h+1],y=l[c][h],x=l[c+1][h],b=l[c+1][h+1],w=this.vertices[v].clone().normalize(),A=this.vertices[y].clone().normalize(),M=this.vertices[x].clone().normalize(),_=this.vertices[b].clone().normalize(),S=u[c][h+1].clone(),E=u[c][h].clone(),T=u[c+1][h].clone(),C=u[c+1][h+1].clone();Math.abs(this.vertices[v].y)===e?(S.x=(S.x+E.x)/2,this.faces.push(new n.Face3(v,x,b,[w,M,_])),this.faceVertexUvs[0].push([S,T,C])):Math.abs(this.vertices[x].y)===e?(T.x=(T.x+C.x)/2,this.faces.push(new n.Face3(v,y,x,[w,A,M])),this.faceVertexUvs[0].push([S,E,T])):(this.faces.push(new n.Face3(v,y,b,[w,A,_])),this.faceVertexUvs[0].push([S,E,C]),this.faces.push(new n.Face3(y,x,b,[A.clone(),M,_.clone()])),this.faceVertexUvs[0].push([E.clone(),T,C.clone()]))}this.computeFaceNormals(),this.boundingSphere=new n.Sphere(new n.Vector3,e)},n.SphereGeometry.prototype=Object.create(n.Geometry.prototype),n.SphereGeometry.prototype.constructor=n.SphereGeometry,n.TextGeometry=function(e,t){t=t||{};var r=n.FontUtils.generateShapes(e,t);t.amount=void 0!==t.height?t.height:50,void 0===t.bevelThickness&&(t.bevelThickness=10),void 0===t.bevelSize&&(t.bevelSize=8),void 0===t.bevelEnabled&&(t.bevelEnabled=!1),n.ExtrudeGeometry.call(this,r,t),this.type="TextGeometry"},n.TextGeometry.prototype=Object.create(n.ExtrudeGeometry.prototype),n.TextGeometry.prototype.constructor=n.TextGeometry,n.TorusGeometry=function(e,t,r,i,o){n.Geometry.call(this),this.type="TorusGeometry",this.parameters={radius:e,tube:t,radialSegments:r,tubularSegments:i,arc:o},e=e||100,t=t||40,r=r||8,i=i||6,o=o||2*Math.PI;for(var a=new n.Vector3,s=[],h=[],c=0;r>=c;c++)for(var l=0;i>=l;l++){var u=l/i*o,f=c/r*Math.PI*2;a.x=e*Math.cos(u),a.y=e*Math.sin(u);var p=new n.Vector3;p.x=(e+t*Math.cos(f))*Math.cos(u),p.y=(e+t*Math.cos(f))*Math.sin(u),p.z=t*Math.sin(f),this.vertices.push(p),s.push(new n.Vector2(l/i,c/r)),h.push(p.clone().sub(a).normalize())}for(var c=1;r>=c;c++)for(var l=1;i>=l;l++){var d=(i+1)*c+l-1,m=(i+1)*(c-1)+l-1,g=(i+1)*(c-1)+l,v=(i+1)*c+l,y=new n.Face3(d,m,v,[h[d].clone(),h[m].clone(),h[v].clone()]);this.faces.push(y),this.faceVertexUvs[0].push([s[d].clone(),s[m].clone(),s[v].clone()]),y=new n.Face3(m,g,v,[h[m].clone(),h[g].clone(),h[v].clone()]),this.faces.push(y),this.faceVertexUvs[0].push([s[m].clone(),s[g].clone(),s[v].clone()])}this.computeFaceNormals()},n.TorusGeometry.prototype=Object.create(n.Geometry.prototype),n.TorusGeometry.prototype.constructor=n.TorusGeometry,n.TorusKnotGeometry=function(e,t,r,i,o,a,s){function h(e,t,r,i,o){var a=Math.cos(e),s=Math.sin(e),h=t/r*e,c=Math.cos(h),l=i*(2+c)*.5*a,u=i*(2+c)*s*.5,f=o*i*Math.sin(h)*.5;return new n.Vector3(l,u,f)}n.Geometry.call(this),this.type="TorusKnotGeometry",this.parameters={radius:e,tube:t,radialSegments:r,tubularSegments:i,p:o,q:a,heightScale:s},e=e||100,t=t||40,r=r||64,i=i||8,o=o||2,a=a||3,s=s||1;for(var c=new Array(r),l=new n.Vector3,u=new n.Vector3,f=new n.Vector3,p=0;r>p;++p){c[p]=new Array(i);var d=p/r*2*o*Math.PI,m=h(d,a,o,e,s),g=h(d+.01,a,o,e,s);l.subVectors(g,m),u.addVectors(g,m),f.crossVectors(l,u),u.crossVectors(f,l),f.normalize(),u.normalize();for(var v=0;i>v;++v){var y=v/i*2*Math.PI,x=-t*Math.cos(y),b=t*Math.sin(y),w=new n.Vector3;w.x=m.x+x*u.x+b*f.x,w.y=m.y+x*u.y+b*f.y,w.z=m.z+x*u.z+b*f.z,c[p][v]=this.vertices.push(w)-1}}for(var p=0;r>p;++p)for(var v=0;i>v;++v){var A=(p+1)%r,M=(v+1)%i,_=c[p][v],S=c[A][v],E=c[A][M],T=c[p][M],C=new n.Vector2(p/r,v/i),L=new n.Vector2((p+1)/r,v/i),P=new n.Vector2((p+1)/r,(v+1)/i),R=new n.Vector2(p/r,(v+1)/i);this.faces.push(new n.Face3(_,S,T)),this.faceVertexUvs[0].push([C,L,R]),this.faces.push(new n.Face3(S,E,T)),this.faceVertexUvs[0].push([L.clone(),P,R.clone()])}this.computeFaceNormals(),this.computeVertexNormals()},n.TorusKnotGeometry.prototype=Object.create(n.Geometry.prototype),n.TorusKnotGeometry.prototype.constructor=n.TorusKnotGeometry,n.TubeGeometry=function(e,t,r,i,o,a){function s(e,t,r){return P.vertices.push(new n.Vector3(e,t,r))-1}n.Geometry.call(this),this.type="TubeGeometry",this.parameters={path:e,segments:t,radius:r,radialSegments:i,closed:o},t=t||64,r=r||1,i=i||8,o=o||!1,a=a||n.TubeGeometry.NoTaper;var h,c,l,u,f,p,d,m,g,v,y,x,b,w,A,M,_,S,E,T,C,L=[],P=this,R=t+1,F=new n.Vector3,B=new n.TubeGeometry.FrenetFrames(e,t,o),D=B.tangents,U=B.normals,V=B.binormals;for(this.tangents=D,this.normals=U,this.binormals=V,v=0;R>v;v++)for(L[v]=[],u=v/(R-1),g=e.getPointAt(u),h=D[v],c=U[v],l=V[v],p=r*a(u),y=0;i>y;y++)f=y/i*2*Math.PI,d=-p*Math.cos(f),m=p*Math.sin(f),F.copy(g),F.x+=d*c.x+m*l.x,F.y+=d*c.y+m*l.y,F.z+=d*c.z+m*l.z,L[v][y]=s(F.x,F.y,F.z);for(v=0;t>v;v++)for(y=0;i>y;y++)x=o?(v+1)%t:v+1,b=(y+1)%i,w=L[v][y],A=L[x][y],M=L[x][b],_=L[v][b],S=new n.Vector2(v/t,y/i),E=new n.Vector2((v+1)/t,y/i),T=new n.Vector2((v+1)/t,(y+1)/i),C=new n.Vector2(v/t,(y+1)/i),this.faces.push(new n.Face3(w,A,_)),this.faceVertexUvs[0].push([S,E,C]),this.faces.push(new n.Face3(A,M,_)),this.faceVertexUvs[0].push([E.clone(),T,C.clone()]);this.computeFaceNormals(),this.computeVertexNormals()},n.TubeGeometry.prototype=Object.create(n.Geometry.prototype),n.TubeGeometry.prototype.constructor=n.TubeGeometry,n.TubeGeometry.NoTaper=function(e){return 1},n.TubeGeometry.SinusoidalTaper=function(e){return Math.sin(Math.PI*e)},n.TubeGeometry.FrenetFrames=function(e,t,r){function i(){d[0]=new n.Vector3,m[0]=new n.Vector3,a=Number.MAX_VALUE,s=Math.abs(p[0].x),h=Math.abs(p[0].y),c=Math.abs(p[0].z),a>=s&&(a=s,f.set(1,0,0)),a>=h&&(a=h,f.set(0,1,0)),a>=c&&f.set(0,0,1),g.crossVectors(p[0],f).normalize(),d[0].crossVectors(p[0],g),m[0].crossVectors(p[0],d[0])}var o,a,s,h,c,l,u,f=new n.Vector3,p=[],d=[],m=[],g=new n.Vector3,v=new n.Matrix4,y=t+1,x=1e-4;for(this.tangents=p,this.normals=d,this.binormals=m,l=0;y>l;l++)u=l/(y-1),p[l]=e.getTangentAt(u),p[l].normalize();for(i(),l=1;y>l;l++)d[l]=d[l-1].clone(),m[l]=m[l-1].clone(),g.crossVectors(p[l-1],p[l]),g.length()>x&&(g.normalize(),o=Math.acos(n.Math.clamp(p[l-1].dot(p[l]),-1,1)),d[l].applyMatrix4(v.makeRotationAxis(g,o))),m[l].crossVectors(p[l],d[l]);if(r)for(o=Math.acos(n.Math.clamp(d[0].dot(d[y-1]),-1,1)),o/=y-1,p[0].dot(g.crossVectors(d[0],d[y-1]))>0&&(o=-o),l=1;y>l;l++)d[l].applyMatrix4(v.makeRotationAxis(p[l],o*l)),m[l].crossVectors(p[l],d[l])},n.PolyhedronGeometry=function(e,t,r,i){function o(e){var t=e.normalize().clone();t.index=u.vertices.push(t)-1;var r=h(e)/2/Math.PI+.5,i=c(e)/Math.PI+.5;return t.uv=new n.Vector2(r,1-i),t}function a(e,t,r){var i=new n.Face3(e.index,t.index,r.index,[e.clone(),t.clone(),r.clone()]);u.faces.push(i),b.copy(e).add(t).add(r).divideScalar(3);var o=h(b);u.faceVertexUvs[0].push([l(e.uv,e,o),l(t.uv,t,o),l(r.uv,r,o)])}function s(e,t){for(var r=Math.pow(2,t),i=o(u.vertices[e.a]),n=o(u.vertices[e.b]),s=o(u.vertices[e.c]),h=[],c=0;r>=c;c++){h[c]=[];for(var l=o(i.clone().lerp(s,c/r)),f=o(n.clone().lerp(s,c/r)),p=r-c,d=0;p>=d;d++)0==d&&c==r?h[c][d]=l:h[c][d]=o(l.clone().lerp(f,d/p))}for(var c=0;r>c;c++)for(var d=0;2*(r-c)-1>d;d++){var m=Math.floor(d/2);d%2==0?a(h[c][m+1],h[c+1][m],h[c][m]):a(h[c][m+1],h[c+1][m+1],h[c+1][m])}}function h(e){return Math.atan2(e.z,-e.x)}function c(e){return Math.atan2(-e.y,Math.sqrt(e.x*e.x+e.z*e.z))}function l(e,t,r){return 0>r&&1===e.x&&(e=new n.Vector2(e.x-1,e.y)),0===t.x&&0===t.z&&(e=new n.Vector2(r/2/Math.PI+.5,e.y)),e.clone()}n.Geometry.call(this),this.type="PolyhedronGeometry",this.parameters={vertices:e,indices:t,radius:r,detail:i},r=r||1,i=i||0;for(var u=this,f=0,p=e.length;p>f;f+=3)o(new n.Vector3(e[f],e[f+1],e[f+2]));for(var d=this.vertices,m=[],f=0,g=0,p=t.length;p>f;f+=3,g++){var v=d[t[f]],y=d[t[f+1]],x=d[t[f+2]];m[g]=new n.Face3(v.index,y.index,x.index,[v.clone(),y.clone(),x.clone()])}for(var b=new n.Vector3,f=0,p=m.length;p>f;f++)s(m[f],i);for(var f=0,p=this.faceVertexUvs[0].length;p>f;f++){var w=this.faceVertexUvs[0][f],A=w[0].x,M=w[1].x,_=w[2].x,S=Math.max(A,Math.max(M,_)),E=Math.min(A,Math.min(M,_));S>.9&&.1>E&&(.2>A&&(w[0].x+=1),.2>M&&(w[1].x+=1),.2>_&&(w[2].x+=1))}for(var f=0,p=this.vertices.length;p>f;f++)this.vertices[f].multiplyScalar(r);this.mergeVertices(),this.computeFaceNormals(),this.boundingSphere=new n.Sphere(new n.Vector3,r)},n.PolyhedronGeometry.prototype=Object.create(n.Geometry.prototype),n.PolyhedronGeometry.prototype.constructor=n.PolyhedronGeometry,n.DodecahedronGeometry=function(e,t){this.parameters={radius:e,detail:t};var r=(1+Math.sqrt(5))/2,i=1/r,o=[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-i,-r,0,-i,r,0,i,-r,0,i,r,-i,-r,0,-i,r,0,i,-r,0,i,r,0,-r,0,-i,r,0,-i,-r,0,i,r,0,i],a=[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9];n.PolyhedronGeometry.call(this,o,a,e,t)},n.DodecahedronGeometry.prototype=Object.create(n.Geometry.prototype),n.DodecahedronGeometry.prototype.constructor=n.DodecahedronGeometry,n.IcosahedronGeometry=function(e,t){var r=(1+Math.sqrt(5))/2,i=[-1,r,0,1,r,0,-1,-r,0,1,-r,0,0,-1,r,0,1,r,0,-1,-r,0,1,-r,r,0,-1,r,0,1,-r,0,-1,-r,0,1],o=[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1];n.PolyhedronGeometry.call(this,i,o,e,t),this.type="IcosahedronGeometry",this.parameters={radius:e,detail:t}},n.IcosahedronGeometry.prototype=Object.create(n.Geometry.prototype),n.IcosahedronGeometry.prototype.constructor=n.IcosahedronGeometry,n.OctahedronGeometry=function(e,t){this.parameters={radius:e,detail:t};var r=[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],i=[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2];n.PolyhedronGeometry.call(this,r,i,e,t),this.type="OctahedronGeometry",this.parameters={radius:e,detail:t}},n.OctahedronGeometry.prototype=Object.create(n.Geometry.prototype),n.OctahedronGeometry.prototype.constructor=n.OctahedronGeometry,n.TetrahedronGeometry=function(e,t){var r=[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],i=[2,1,0,0,3,2,1,3,0,2,3,1];n.PolyhedronGeometry.call(this,r,i,e,t),this.type="TetrahedronGeometry",this.parameters={radius:e,detail:t}},n.TetrahedronGeometry.prototype=Object.create(n.Geometry.prototype),n.TetrahedronGeometry.prototype.constructor=n.TetrahedronGeometry,n.ParametricGeometry=function(e,t,r){n.Geometry.call(this),this.type="ParametricGeometry",this.parameters={func:e,slices:t,stacks:r};var i,o,a,s,h,c=this.vertices,l=this.faces,u=this.faceVertexUvs[0],f=t+1;for(i=0;r>=i;i++)for(h=i/r,o=0;t>=o;o++)s=o/t,a=e(s,h),c.push(a);var p,d,m,g,v,y,x,b;for(i=0;r>i;i++)for(o=0;t>o;o++)p=i*f+o,d=i*f+o+1,m=(i+1)*f+o+1,g=(i+1)*f+o,v=new n.Vector2(o/t,i/r),y=new n.Vector2((o+1)/t,i/r),x=new n.Vector2((o+1)/t,(i+1)/r),b=new n.Vector2(o/t,(i+1)/r),l.push(new n.Face3(p,d,g)),u.push([v,y,b]),l.push(new n.Face3(d,m,g)),u.push([y.clone(),x,b.clone()]);this.computeFaceNormals(),this.computeVertexNormals()},n.ParametricGeometry.prototype=Object.create(n.Geometry.prototype),n.ParametricGeometry.prototype.constructor=n.ParametricGeometry,n.AxisHelper=function(e){e=e||1;var t=new Float32Array([0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e]),r=new Float32Array([1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1]),i=new n.BufferGeometry;i.addAttribute("position",new n.BufferAttribute(t,3)),i.addAttribute("color",new n.BufferAttribute(r,3));var o=new n.LineBasicMaterial({vertexColors:n.VertexColors});n.Line.call(this,i,o,n.LinePieces)},n.AxisHelper.prototype=Object.create(n.Line.prototype),n.AxisHelper.prototype.constructor=n.AxisHelper,n.ArrowHelper=function(){var e=new n.Geometry;e.vertices.push(new n.Vector3(0,0,0),new n.Vector3(0,1,0));var t=new n.CylinderGeometry(0,.5,1,5,1);return t.applyMatrix((new n.Matrix4).makeTranslation(0,-.5,0)),function(r,i,o,a,s,h){n.Object3D.call(this),void 0===a&&(a=16776960),void 0===o&&(o=1),void 0===s&&(s=.2*o),void 0===h&&(h=.2*s),this.position.copy(i),this.line=new n.Line(e,new n.LineBasicMaterial({color:a})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new n.Mesh(t,new n.MeshBasicMaterial({color:a})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(r),this.setLength(o,s,h)}}(),n.ArrowHelper.prototype=Object.create(n.Object3D.prototype),n.ArrowHelper.prototype.constructor=n.ArrowHelper,n.ArrowHelper.prototype.setDirection=function(){var e,t=new n.Vector3;return function(r){r.y>.99999?this.quaternion.set(0,0,0,1):r.y<-.99999?this.quaternion.set(1,0,0,0):(t.set(r.z,0,-r.x).normalize(),e=Math.acos(r.y),this.quaternion.setFromAxisAngle(t,e))}}(),n.ArrowHelper.prototype.setLength=function(e,t,r){void 0===t&&(t=.2*e),void 0===r&&(r=.2*t),this.line.scale.set(1,e-t,1),this.line.updateMatrix(),this.cone.scale.set(r,t,r),this.cone.position.y=e,this.cone.updateMatrix()},n.ArrowHelper.prototype.setColor=function(e){this.line.material.color.set(e),this.cone.material.color.set(e)},n.BoxHelper=function(e){var t=new n.BufferGeometry;t.addAttribute("position",new n.BufferAttribute(new Float32Array(72),3)),n.Line.call(this,t,new n.LineBasicMaterial({color:16776960}),n.LinePieces),void 0!==e&&this.update(e)},n.BoxHelper.prototype=Object.create(n.Line.prototype),n.BoxHelper.prototype.constructor=n.BoxHelper,n.BoxHelper.prototype.update=function(e){var t=e.geometry;null===t.boundingBox&&t.computeBoundingBox();var r=t.boundingBox.min,i=t.boundingBox.max,n=this.geometry.attributes.position.array;n[0]=i.x,n[1]=i.y,n[2]=i.z,n[3]=r.x,n[4]=i.y,n[5]=i.z,n[6]=r.x,n[7]=i.y,n[8]=i.z,n[9]=r.x,n[10]=r.y,n[11]=i.z,n[12]=r.x,n[13]=r.y,n[14]=i.z,n[15]=i.x,n[16]=r.y,n[17]=i.z,n[18]=i.x,n[19]=r.y,n[20]=i.z,n[21]=i.x,n[22]=i.y,n[23]=i.z,n[24]=i.x,n[25]=i.y,n[26]=r.z,n[27]=r.x,n[28]=i.y,n[29]=r.z,n[30]=r.x,n[31]=i.y,n[32]=r.z,n[33]=r.x,n[34]=r.y,n[35]=r.z,n[36]=r.x,n[37]=r.y,n[38]=r.z,n[39]=i.x,n[40]=r.y,n[41]=r.z,n[42]=i.x,n[43]=r.y,n[44]=r.z,n[45]=i.x,n[46]=i.y,n[47]=r.z,n[48]=i.x,n[49]=i.y,n[50]=i.z,n[51]=i.x,n[52]=i.y,n[53]=r.z,n[54]=r.x,n[55]=i.y,n[56]=i.z,n[57]=r.x,n[58]=i.y,n[59]=r.z,n[60]=r.x,n[61]=r.y,n[62]=i.z,n[63]=r.x,n[64]=r.y,n[65]=r.z,n[66]=i.x,n[67]=r.y,n[68]=i.z,n[69]=i.x,n[70]=r.y,n[71]=r.z,this.geometry.attributes.position.needsUpdate=!0,this.geometry.computeBoundingSphere(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1},n.BoundingBoxHelper=function(e,t){var r=void 0!==t?t:8947848;this.object=e,this.box=new n.Box3,n.Mesh.call(this,new n.BoxGeometry(1,1,1),new n.MeshBasicMaterial({color:r,wireframe:!0}))},n.BoundingBoxHelper.prototype=Object.create(n.Mesh.prototype),n.BoundingBoxHelper.prototype.constructor=n.BoundingBoxHelper,n.BoundingBoxHelper.prototype.update=function(){this.box.setFromObject(this.object),this.box.size(this.scale),this.box.center(this.position)},n.CameraHelper=function(e){function t(e,t,i){r(e,i),r(t,i)}function r(e,t){i.vertices.push(new n.Vector3),i.colors.push(new n.Color(t)),void 0===a[e]&&(a[e]=[]),a[e].push(i.vertices.length-1)}var i=new n.Geometry,o=new n.LineBasicMaterial({color:16777215,vertexColors:n.FaceColors}),a={},s=16755200,h=16711680,c=43775,l=16777215,u=3355443;t("n1","n2",s),t("n2","n4",s),t("n4","n3",s),t("n3","n1",s),t("f1","f2",s),t("f2","f4",s),t("f4","f3",s),t("f3","f1",s),t("n1","f1",s),t("n2","f2",s),t("n3","f3",s),t("n4","f4",s),t("p","n1",h),t("p","n2",h),t("p","n3",h),t("p","n4",h),t("u1","u2",c),t("u2","u3",c),t("u3","u1",c),t("c","t",l),t("p","c",u),t("cn1","cn2",u),t("cn3","cn4",u),t("cf1","cf2",u),t("cf3","cf4",u),n.Line.call(this,i,o,n.LinePieces),this.camera=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=a,this.update()},n.CameraHelper.prototype=Object.create(n.Line.prototype),n.CameraHelper.prototype.constructor=n.CameraHelper,n.CameraHelper.prototype.update=function(){var e,t,r=new n.Vector3,i=new n.Camera,o=function(n,o,a,s){r.set(o,a,s).unproject(i);var h=t[n];if(void 0!==h)for(var c=0,l=h.length;l>c;c++)e.vertices[h[c]].copy(r)};return function(){e=this.geometry,t=this.pointMap;var r=1,n=1;i.projectionMatrix.copy(this.camera.projectionMatrix),o("c",0,0,-1),o("t",0,0,1),o("n1",-r,-n,-1),o("n2",r,-n,-1),o("n3",-r,n,-1),o("n4",r,n,-1),o("f1",-r,-n,1),o("f2",r,-n,1),o("f3",-r,n,1),o("f4",r,n,1),o("u1",.7*r,1.1*n,-1),o("u2",.7*-r,1.1*n,-1),o("u3",0,2*n,-1),o("cf1",-r,0,1),o("cf2",r,0,1),o("cf3",0,-n,1),o("cf4",0,n,1),o("cn1",-r,0,-1),o("cn2",r,0,-1),o("cn3",0,-n,-1),o("cn4",0,n,-1),e.verticesNeedUpdate=!0}}(),n.DirectionalLightHelper=function(e,t){n.Object3D.call(this),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,t=t||1;var r=new n.Geometry;r.vertices.push(new n.Vector3(-t,t,0),new n.Vector3(t,t,0),new n.Vector3(t,-t,0),new n.Vector3(-t,-t,0),new n.Vector3(-t,t,0));var i=new n.LineBasicMaterial({fog:!1});i.color.copy(this.light.color).multiplyScalar(this.light.intensity),this.lightPlane=new n.Line(r,i),this.add(this.lightPlane),r=new n.Geometry,r.vertices.push(new n.Vector3,new n.Vector3),i=new n.LineBasicMaterial({fog:!1}),i.color.copy(this.light.color).multiplyScalar(this.light.intensity),this.targetLine=new n.Line(r,i),this.add(this.targetLine),this.update()},n.DirectionalLightHelper.prototype=Object.create(n.Object3D.prototype),n.DirectionalLightHelper.prototype.constructor=n.DirectionalLightHelper,n.DirectionalLightHelper.prototype.dispose=function(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()},n.DirectionalLightHelper.prototype.update=function(){var e=new n.Vector3,t=new n.Vector3,r=new n.Vector3;return function(){e.setFromMatrixPosition(this.light.matrixWorld),t.setFromMatrixPosition(this.light.target.matrixWorld),r.subVectors(t,e),this.lightPlane.lookAt(r),this.lightPlane.material.color.copy(this.light.color).multiplyScalar(this.light.intensity),this.targetLine.geometry.vertices[1].copy(r),this.targetLine.geometry.verticesNeedUpdate=!0,this.targetLine.material.color.copy(this.lightPlane.material.color)}}(),n.EdgesHelper=function(e,t,r){var i=void 0!==t?t:16777215;r=void 0!==r?r:1;var o,a=Math.cos(n.Math.degToRad(r)),s=[0,0],h={},c=function(e,t){return e-t},l=["a","b","c"],u=new n.BufferGeometry;e.geometry instanceof n.BufferGeometry?(o=new n.Geometry,o.fromBufferGeometry(e.geometry)):o=e.geometry.clone(),o.mergeVertices(),o.computeFaceNormals();for(var f=o.vertices,p=o.faces,d=0,m=0,g=p.length;g>m;m++)for(var v=p[m],y=0;3>y;y++){s[0]=v[l[y]],s[1]=v[l[(y+1)%3]],s.sort(c);var x=s.toString();void 0===h[x]?(h[x]={vert1:s[0],vert2:s[1],face1:m,face2:void 0},d++):h[x].face2=m}var b=new Float32Array(2*d*3),w=0;for(var x in h){var A=h[x];if(void 0===A.face2||p[A.face1].normal.dot(p[A.face2].normal)<=a){var M=f[A.vert1];b[w++]=M.x,b[w++]=M.y,b[w++]=M.z,M=f[A.vert2],b[w++]=M.x,b[w++]=M.y,b[w++]=M.z}}u.addAttribute("position",new n.BufferAttribute(b,3)),n.Line.call(this,u,new n.LineBasicMaterial({color:i}),n.LinePieces),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1},n.EdgesHelper.prototype=Object.create(n.Line.prototype),n.EdgesHelper.prototype.constructor=n.EdgesHelper,n.FaceNormalsHelper=function(e,t,r,i){this.object=e,this.size=void 0!==t?t:1;for(var o=void 0!==r?r:16776960,a=void 0!==i?i:1,s=new n.Geometry,h=this.object.geometry.faces,c=0,l=h.length;l>c;c++)s.vertices.push(new n.Vector3,new n.Vector3);n.Line.call(this,s,new n.LineBasicMaterial({color:o,linewidth:a}),n.LinePieces),this.matrixAutoUpdate=!1,this.normalMatrix=new n.Matrix3,this.update()},n.FaceNormalsHelper.prototype=Object.create(n.Line.prototype),n.FaceNormalsHelper.prototype.constructor=n.FaceNormalsHelper,n.FaceNormalsHelper.prototype.update=function(){var e=this.geometry.vertices,t=this.object,r=t.geometry.vertices,i=t.geometry.faces,n=t.matrixWorld;t.updateMatrixWorld(!0),this.normalMatrix.getNormalMatrix(n);for(var o=0,a=0,s=i.length;s>o;o++,a+=2){var h=i[o];e[a].copy(r[h.a]).add(r[h.b]).add(r[h.c]).divideScalar(3).applyMatrix4(n),e[a+1].copy(h.normal).applyMatrix3(this.normalMatrix).normalize().multiplyScalar(this.size).add(e[a])}return this.geometry.verticesNeedUpdate=!0,this},n.GridHelper=function(e,t){var r=new n.Geometry,i=new n.LineBasicMaterial({vertexColors:n.VertexColors});this.color1=new n.Color(4473924),this.color2=new n.Color(8947848);for(var o=-e;e>=o;o+=t){r.vertices.push(new n.Vector3(-e,0,o),new n.Vector3(e,0,o),new n.Vector3(o,0,-e),new n.Vector3(o,0,e));var a=0===o?this.color1:this.color2;r.colors.push(a,a,a,a)}n.Line.call(this,r,i,n.LinePieces)},n.GridHelper.prototype=Object.create(n.Line.prototype),n.GridHelper.prototype.constructor=n.GridHelper,n.GridHelper.prototype.setColors=function(e,t){this.color1.set(e),this.color2.set(t),this.geometry.colorsNeedUpdate=!0},n.HemisphereLightHelper=function(e,t){n.Object3D.call(this),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.colors=[new n.Color,new n.Color];var r=new n.SphereGeometry(t,4,2);r.applyMatrix((new n.Matrix4).makeRotationX(-Math.PI/2));for(var i=0,o=8;o>i;i++)r.faces[i].color=this.colors[4>i?0:1];var a=new n.MeshBasicMaterial({vertexColors:n.FaceColors,wireframe:!0});this.lightSphere=new n.Mesh(r,a),this.add(this.lightSphere),this.update()},n.HemisphereLightHelper.prototype=Object.create(n.Object3D.prototype),n.HemisphereLightHelper.prototype.constructor=n.HemisphereLightHelper,n.HemisphereLightHelper.prototype.dispose=function(){this.lightSphere.geometry.dispose(),this.lightSphere.material.dispose()},n.HemisphereLightHelper.prototype.update=function(){var e=new n.Vector3;return function(){this.colors[0].copy(this.light.color).multiplyScalar(this.light.intensity),this.colors[1].copy(this.light.groundColor).multiplyScalar(this.light.intensity),this.lightSphere.lookAt(e.setFromMatrixPosition(this.light.matrixWorld).negate()),this.lightSphere.geometry.colorsNeedUpdate=!0}}(),n.PointLightHelper=function(e,t){this.light=e,this.light.updateMatrixWorld();var r=new n.SphereGeometry(t,4,2),i=new n.MeshBasicMaterial({wireframe:!0,fog:!1});i.color.copy(this.light.color).multiplyScalar(this.light.intensity),n.Mesh.call(this,r,i),this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1},n.PointLightHelper.prototype=Object.create(n.Mesh.prototype),n.PointLightHelper.prototype.constructor=n.PointLightHelper,n.PointLightHelper.prototype.dispose=function(){this.geometry.dispose(),this.material.dispose()},n.PointLightHelper.prototype.update=function(){this.material.color.copy(this.light.color).multiplyScalar(this.light.intensity)},n.SkeletonHelper=function(e){this.bones=this.getBoneList(e);for(var t=new n.Geometry,r=0;rc;c++)for(var u=h[c],f=0,p=u.vertexNormals.length;p>f;f++)s.vertices.push(new n.Vector3,new n.Vector3); -n.Line.call(this,s,new n.LineBasicMaterial({color:o,linewidth:a}),n.LinePieces),this.matrixAutoUpdate=!1,this.normalMatrix=new n.Matrix3,this.update()},n.VertexNormalsHelper.prototype=Object.create(n.Line.prototype),n.VertexNormalsHelper.prototype.constructor=n.VertexNormalsHelper,n.VertexNormalsHelper.prototype.update=function(e){var t=new n.Vector3;return function(e){var r=["a","b","c","d"];this.object.updateMatrixWorld(!0),this.normalMatrix.getNormalMatrix(this.object.matrixWorld);for(var i=this.geometry.vertices,n=this.object.geometry.vertices,o=this.object.geometry.faces,a=this.object.matrixWorld,s=0,h=0,c=o.length;c>h;h++)for(var l=o[h],u=0,f=l.vertexNormals.length;f>u;u++){var p=l[r[u]],d=n[p],m=l.vertexNormals[u];i[s].copy(d).applyMatrix4(a),t.copy(m).applyMatrix3(this.normalMatrix).normalize().multiplyScalar(this.size),t.add(i[s]),s+=1,i[s].copy(t),s+=1}return this.geometry.verticesNeedUpdate=!0,this}}(),n.VertexTangentsHelper=function(e,t,r,i){this.object=e,this.size=void 0!==t?t:1;for(var o=void 0!==r?r:255,a=void 0!==i?i:1,s=new n.Geometry,h=e.geometry.faces,c=0,l=h.length;l>c;c++)for(var u=h[c],f=0,p=u.vertexTangents.length;p>f;f++)s.vertices.push(new n.Vector3),s.vertices.push(new n.Vector3);n.Line.call(this,s,new n.LineBasicMaterial({color:o,linewidth:a}),n.LinePieces),this.matrixAutoUpdate=!1,this.update()},n.VertexTangentsHelper.prototype=Object.create(n.Line.prototype),n.VertexTangentsHelper.prototype.constructor=n.VertexTangentsHelper,n.VertexTangentsHelper.prototype.update=function(e){var t=new n.Vector3;return function(e){var r=["a","b","c","d"];this.object.updateMatrixWorld(!0);for(var i=this.geometry.vertices,n=this.object.geometry.vertices,o=this.object.geometry.faces,a=this.object.matrixWorld,s=0,h=0,c=o.length;c>h;h++)for(var l=o[h],u=0,f=l.vertexTangents.length;f>u;u++){var p=l[r[u]],d=n[p],m=l.vertexTangents[u];i[s].copy(d).applyMatrix4(a),t.copy(m).transformDirection(a).multiplyScalar(this.size),t.add(i[s]),s+=1,i[s].copy(t),s+=1}return this.geometry.verticesNeedUpdate=!0,this}}(),n.WireframeHelper=function(e,t){var r=void 0!==t?t:16777215,i=[0,0],o={},a=function(e,t){return e-t},s=["a","b","c"],h=new n.BufferGeometry;if(e.geometry instanceof n.Geometry){for(var c=e.geometry.vertices,l=e.geometry.faces,u=0,f=new Uint32Array(6*l.length),p=0,d=l.length;d>p;p++)for(var m=l[p],g=0;3>g;g++){i[0]=m[s[g]],i[1]=m[s[(g+1)%3]],i.sort(a);var v=i.toString();void 0===o[v]&&(f[2*u]=i[0],f[2*u+1]=i[1],o[v]=!0,u++)}for(var y=new Float32Array(2*u*3),p=0,d=u;d>p;p++)for(var g=0;2>g;g++){var x=c[f[2*p+g]],b=6*p+3*g;y[b+0]=x.x,y[b+1]=x.y,y[b+2]=x.z}h.addAttribute("position",new n.BufferAttribute(y,3))}else if(e.geometry instanceof n.BufferGeometry)if(void 0!==e.geometry.attributes.index){var c=e.geometry.attributes.position.array,w=e.geometry.attributes.index.array,A=e.geometry.drawcalls,u=0;0===A.length&&(A=[{count:w.length,index:0,start:0}]);for(var f=new Uint32Array(2*w.length),M=0,_=A.length;_>M;++M)for(var S=A[M].start,E=A[M].count,b=A[M].index,p=S,T=S+E;T>p;p+=3)for(var g=0;3>g;g++){i[0]=b+w[p+g],i[1]=b+w[p+(g+1)%3],i.sort(a);var v=i.toString();void 0===o[v]&&(f[2*u]=i[0],f[2*u+1]=i[1],o[v]=!0,u++)}for(var y=new Float32Array(2*u*3),p=0,d=u;d>p;p++)for(var g=0;2>g;g++){var b=6*p+3*g,C=3*f[2*p+g];y[b+0]=c[C],y[b+1]=c[C+1],y[b+2]=c[C+2]}h.addAttribute("position",new n.BufferAttribute(y,3))}else{for(var c=e.geometry.attributes.position.array,u=c.length/3,L=u/3,y=new Float32Array(2*u*3),p=0,d=L;d>p;p++)for(var g=0;3>g;g++){var b=18*p+6*g,P=9*p+3*g;y[b+0]=c[P],y[b+1]=c[P+1],y[b+2]=c[P+2];var C=9*p+3*((g+1)%3);y[b+3]=c[C],y[b+4]=c[C+1],y[b+5]=c[C+2]}h.addAttribute("position",new n.BufferAttribute(y,3))}n.Line.call(this,h,new n.LineBasicMaterial({color:r}),n.LinePieces),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1},n.WireframeHelper.prototype=Object.create(n.Line.prototype),n.WireframeHelper.prototype.constructor=n.WireframeHelper,n.ImmediateRenderObject=function(){n.Object3D.call(this),this.render=function(e){}},n.ImmediateRenderObject.prototype=Object.create(n.Object3D.prototype),n.ImmediateRenderObject.prototype.constructor=n.ImmediateRenderObject,n.MorphBlendMesh=function(e,t){n.Mesh.call(this,e,t),this.animationsMap={},this.animationsList=[];var r=this.geometry.morphTargets.length,i="__default",o=0,a=r-1,s=r/1;this.createAnimation(i,o,a,s),this.setAnimationWeight(i,1)},n.MorphBlendMesh.prototype=Object.create(n.Mesh.prototype),n.MorphBlendMesh.prototype.constructor=n.MorphBlendMesh,n.MorphBlendMesh.prototype.createAnimation=function(e,t,r,i){var n={startFrame:t,endFrame:r,length:r-t+1,fps:i,duration:(r-t)/i,lastFrame:0,currentFrame:0,active:!1,time:0,direction:1,weight:1,directionBackwards:!1,mirroredLoop:!1};this.animationsMap[e]=n,this.animationsList.push(n)},n.MorphBlendMesh.prototype.autoCreateAnimations=function(e){for(var t,r=/([a-z]+)_?(\d+)/,i={},n=this.geometry,o=0,a=n.morphTargets.length;a>o;o++){var s=n.morphTargets[o],h=s.name.match(r);if(h&&h.length>1){var c=h[1];i[c]||(i[c]={start:1/0,end:-(1/0)});var l=i[c];ol.end&&(l.end=o),t||(t=c)}}for(var c in i){var l=i[c];this.createAnimation(c,l.start,l.end,e)}this.firstAnimation=t},n.MorphBlendMesh.prototype.setAnimationDirectionForward=function(e){var t=this.animationsMap[e];t&&(t.direction=1,t.directionBackwards=!1)},n.MorphBlendMesh.prototype.setAnimationDirectionBackward=function(e){var t=this.animationsMap[e];t&&(t.direction=-1,t.directionBackwards=!0)},n.MorphBlendMesh.prototype.setAnimationFPS=function(e,t){var r=this.animationsMap[e];r&&(r.fps=t,r.duration=(r.end-r.start)/r.fps)},n.MorphBlendMesh.prototype.setAnimationDuration=function(e,t){var r=this.animationsMap[e];r&&(r.duration=t,r.fps=(r.end-r.start)/r.duration)},n.MorphBlendMesh.prototype.setAnimationWeight=function(e,t){var r=this.animationsMap[e];r&&(r.weight=t)},n.MorphBlendMesh.prototype.setAnimationTime=function(e,t){var r=this.animationsMap[e];r&&(r.time=t)},n.MorphBlendMesh.prototype.getAnimationTime=function(e){var t=0,r=this.animationsMap[e];return r&&(t=r.time),t},n.MorphBlendMesh.prototype.getAnimationDuration=function(e){var t=-1,r=this.animationsMap[e];return r&&(t=r.duration),t},n.MorphBlendMesh.prototype.playAnimation=function(e){var t=this.animationsMap[e];t?(t.time=0,t.active=!0):n.warn("THREE.MorphBlendMesh: animation["+e+"] undefined in .playAnimation()")},n.MorphBlendMesh.prototype.stopAnimation=function(e){var t=this.animationsMap[e];t&&(t.active=!1)},n.MorphBlendMesh.prototype.update=function(e){for(var t=0,r=this.animationsList.length;r>t;t++){var i=this.animationsList[t];if(i.active){var o=i.duration/i.length;i.time+=i.direction*e,i.mirroredLoop?(i.time>i.duration||i.time<0)&&(i.direction*=-1,i.time>i.duration&&(i.time=i.duration,i.directionBackwards=!0),i.time<0&&(i.time=0,i.directionBackwards=!1)):(i.time=i.time%i.duration,i.time<0&&(i.time+=i.duration));var a=i.startFrame+n.Math.clamp(Math.floor(i.time/o),0,i.length-1),s=i.weight;a!==i.currentFrame&&(this.morphTargetInfluences[i.lastFrame]=0,this.morphTargetInfluences[i.currentFrame]=1*s,this.morphTargetInfluences[a]=0,i.lastFrame=i.currentFrame,i.currentFrame=a);var h=i.time%o/o;i.directionBackwards&&(h=1-h),this.morphTargetInfluences[i.currentFrame]=h*s,this.morphTargetInfluences[i.lastFrame]=(1-h)*s}}},"undefined"!=typeof e&&e.exports&&(t=e.exports=n),t.THREE=n},function(e,t,r){function i(e,t){return function(r,i,n){return"function"==typeof i&&void 0===n&&s(r)?e(r,i):t(r,a(i,n,3))}}var n=r(10),o=r(11),a=r(16),s=r(14),h=i(n,o);e.exports=h},function(e,t){function r(e,t){for(var r=-1,i=e.length;++r-1&&e%1==0&&u>=e}function h(e){return c(e)?e:Object(e)}function c(e){var t=typeof e;return"function"==t||!!e&&"object"==t}var l=r(12),u=Math.pow(2,53)-1,f=o(i),p=a(),d=n("length");e.exports=f},function(e,t,r){function i(e,t){return e=+e,t=null==t?m:t,e>-1&&e%1==0&&t>e}function n(e){return"number"==typeof e&&e>-1&&e%1==0&&m>=e}function o(e){for(var t=s(e),r=t.length,o=r&&e.length,a=o&&n(o)&&(c(e)||g.nonEnumArgs&&h(e)),l=-1,u=[];++l0;++o-1&&e%1==0&&h>=e}function n(e){var t=r(e)?e.length:void 0;return i(t)&&s.call(e)==o}var o="[object Arguments]",a=Object.prototype,s=a.toString,h=Math.pow(2,53)-1;e.exports=n},function(e,t){function r(e){return"string"==typeof e?e:null==e?"":e+""}function i(e){return!!e&&"object"==typeof e}function n(e){return"number"==typeof e&&e>-1&&e%1==0&&v>=e}function o(e){return null==e?!1:d.call(e)==h?m.test(p.call(e)):i(e)&&u.test(e)}function a(e){return e=r(e),e&&l.test(e)?e.replace(c,"\\$&"):e}var s="[object Array]",h="[object Function]",c=/[.*+?^${}()|[\]\/\\]/g,l=RegExp(c.source),u=/^\[object .+?Constructor\]$/,f=Object.prototype,p=Function.prototype.toString,d=f.toString,m=RegExp("^"+a(d).replace(/toString|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),g=o(g=Array.isArray)&&g,v=Math.pow(2,53)-1,y=g||function(e){return i(e)&&n(e.length)&&d.call(e)==s};e.exports=y},function(e,t){function r(e){return"string"==typeof e?e:null==e?"":e+""}function i(e){return!!e&&"object"==typeof e}function n(e){return null==e?!1:f.call(e)==a?p.test(u.call(e)):i(e)&&c.test(e)}function o(e){return e=r(e),e&&h.test(e)?e.replace(s,"\\$&"):e}var a="[object Function]",s=/[.*+?^${}()|[\]\/\\]/g,h=RegExp(s.source),c=/^\[object .+?Constructor\]$/,l=Object.prototype,u=Function.prototype.toString,f=l.toString,p=RegExp("^"+o(f).replace(/toString|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");e.exports=n},function(e,t){function r(e,t,r){if("function"!=typeof e)return i;if(void 0===t)return e;switch(r){case 1:return function(r){return e.call(t,r)};case 3:return function(r,i,n){return e.call(t,r,i,n)};case 4:return function(r,i,n,o){return e.call(t,r,i,n,o)};case 5:return function(r,i,n,o,a){return e.call(t,r,i,n,o,a)}}return function(){return e.apply(t,arguments)}}function i(e){return e}e.exports=r},function(e,t,r){function i(e,t,r){for(var i=-1,n=a(t),o=n.length;++i-1&&e%1==0&&t>e}function a(e){return"number"==typeof e&&e>-1&&e%1==0&&v>=e}function s(e){for(var t=c(e),r=t.length,i=r&&e.length,n=!!i&&a(i)&&(f(e)||u(e)),s=-1,h=[];++s0;++i-1&&e%1==0&&l>=e}function a(e){return r(e)&&n(e)&&h.call(e,"callee")&&!c.call(e,"callee")}var s=Object.prototype,h=s.hasOwnProperty,c=s.propertyIsEnumerable,l=9007199254740991,u=i("length");e.exports=a},function(e,t){function r(e){return!!e&&"object"==typeof e}function i(e,t){var r=null==e?void 0:e[t];return s(r)?r:void 0}function n(e){return"number"==typeof e&&e>-1&&e%1==0&&v>=e}function o(e){return a(e)&&d.call(e)==c}function a(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function s(e){return null==e?!1:o(e)?m.test(f.call(e)):r(e)&&l.test(e)}var h="[object Array]",c="[object Function]",l=/^\[object .+?Constructor\]$/,u=Object.prototype,f=Function.prototype.toString,p=u.hasOwnProperty,d=u.toString,m=RegExp("^"+f.call(p).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),g=i(Array,"isArray"),v=9007199254740991,y=g||function(e){return r(e)&&n(e.length)&&d.call(e)==h};e.exports=y},function(e,t,r){function i(e){return a(function(t,r){var i=-1,a=null==t?0:r.length,s=a>2?r[a-2]:void 0,h=a>2?r[2]:void 0,c=a>1?r[a-1]:void 0;for("function"==typeof s?(s=n(s,c,5),a-=2):(s="function"==typeof c?c:void 0,a-=s?1:0),h&&o(r[0],r[1],h)&&(s=3>a?void 0:s,a=1);++i-1&&e%1==0&&t>e}function o(e,t,r){if(!s(r))return!1;var o=typeof t;if("number"==o?i(r)&&n(t,r.length):"string"==o&&t in r){var a=r[t];return e===e?e===a:a!==a}return!1}function a(e){return"number"==typeof e&&e>-1&&e%1==0&&c>=e}function s(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}var h=/^\d+$/,c=9007199254740991,l=r("length");e.exports=o},function(e,t){function r(e,t){if("function"!=typeof e)throw new TypeError(i);return t=n(void 0===t?e.length-1:+t||0,0),function(){for(var r=arguments,i=-1,o=n(r.length-t,0),a=Array(o);++ir;r++);},t.findObject=function(e){return e instanceof t?e:e&&e instanceof o.Object3D?f.get?f.get(e):f[e.id]:void 0},t}()},function(e,t,r){"use strict";var i,n,o,a,s,h,c,l=r(45),u=r(58),f=Function.prototype.apply,p=Function.prototype.call,d=Object.create,m=Object.defineProperty,g=Object.defineProperties,v=Object.prototype.hasOwnProperty,y={configurable:!0,enumerable:!1,writable:!0};i=function(e,t){var r;return u(t),v.call(this,"__ee__")?r=this.__ee__:(r=y.value=d(null),m(this,"__ee__",y),y.value=null),r[e]?"object"==typeof r[e]?r[e].push(t):r[e]=[r[e],t]:r[e]=t,this},n=function(e,t){var r,n;return u(t),n=this,i.call(this,e,r=function(){o.call(n,e,r),f.call(t,this,arguments)}),r.__eeOnceListener__=t,this},o=function(e,t){var r,i,n,o;if(u(t),!v.call(this,"__ee__"))return this;if(r=this.__ee__,!r[e])return this;if(i=r[e],"object"==typeof i)for(o=0;n=i[o];++o)(n===t||n.__eeOnceListener__===t)&&(2===i.length?r[e]=i[o?0:1]:i.splice(o,1));else(i===t||i.__eeOnceListener__===t)&&delete r[e];return this},a=function(e){var t,r,i,n,o;if(v.call(this,"__ee__")&&(n=this.__ee__[e]))if("object"==typeof n){for(r=arguments.length,o=new Array(r-1),t=1;r>t;++t)o[t-1]=arguments[t];for(n=n.slice(),t=0;i=n[t];++t)f.call(i,this,o)}else switch(arguments.length){case 1:p.call(n,this);break;case 2:p.call(n,this,arguments[1]);break;case 3:p.call(n,this,arguments[1],arguments[2]);break;default:for(r=arguments.length,o=new Array(r-1),t=1;r>t;++t)o[t-1]=arguments[t];f.call(n,this,o)}},s={on:i,once:n,off:o,emit:a},h={on:l(i),once:l(n),off:l(o),emit:l(a)},c=g({},h),e.exports=t=function(e){return null==e?d(c):g(Object(e),h)},t.methods=s},function(e,t,r){"use strict";var i,n=r(46),o=r(53),a=r(54),s=r(55);i=e.exports=function(e,t){var r,i,a,h,c;return arguments.length<2||"string"!=typeof e?(h=t,t=e,e=null):h=arguments[2],null==e?(r=a=!0,i=!1):(r=s.call(e,"c"),i=s.call(e,"e"),a=s.call(e,"w")),c={value:t,configurable:r,enumerable:i,writable:a},h?n(o(h),c):c},i.gs=function(e,t,r){var i,h,c,l;return"string"!=typeof e?(c=r,r=t,t=e,e=null):c=arguments[3],null==t?t=void 0:a(t)?null==r?r=void 0:a(r)||(c=r,r=void 0):(c=t,t=r=void 0),null==e?(i=!0,h=!1):(i=s.call(e,"c"),h=s.call(e,"e")),l={get:t,set:r,configurable:i,enumerable:h},c?n(o(c),l):l}},function(e,t,r){"use strict";e.exports=r(47)()?Object.assign:r(48)},function(e,t){"use strict";e.exports=function(){var e,t=Object.assign;return"function"!=typeof t?!1:(e={foo:"raz"},t(e,{bar:"dwa"},{trzy:"trzy"}),e.foo+e.bar+e.trzy==="razdwatrzy")}},function(e,t,r){"use strict";var i=r(49),n=r(52),o=Math.max;e.exports=function(e,t){var r,a,s,h=o(arguments.length,2);for(e=Object(n(e)),s=function(i){try{e[i]=t[i]}catch(n){r||(r=n)}},a=1;h>a;++a)t=arguments[a],i(t).forEach(s);if(void 0!==r)throw r;return e}},function(e,t,r){"use strict";e.exports=r(50)()?Object.keys:r(51)},function(e,t){"use strict";e.exports=function(){try{return Object.keys("primitive"),!0}catch(e){return!1}}},function(e,t){"use strict";var r=Object.keys;e.exports=function(e){return r(null==e?e:Object(e))}},function(e,t){"use strict";e.exports=function(e){if(null==e)throw new TypeError("Cannot use null or undefined");return e}},function(e,t){"use strict";var r=Array.prototype.forEach,i=Object.create,n=function(e,t){var r;for(r in e)t[r]=e[r]};e.exports=function(e){var t=i(null);return r.call(arguments,function(e){null!=e&&n(Object(e),t)}),t}},function(e,t){"use strict";e.exports=function(e){return"function"==typeof e}},function(e,t,r){"use strict";e.exports=r(56)()?String.prototype.contains:r(57)},function(e,t){"use strict";var r="razdwatrzy";e.exports=function(){return"function"!=typeof r.contains?!1:r.contains("dwa")===!0&&r.contains("foo")===!1}},function(e,t){"use strict";var r=String.prototype.indexOf;e.exports=function(e){return r.call(this,e,arguments[1])>-1}},function(e,t){"use strict";e.exports=function(e){if("function"!=typeof e)throw new TypeError(e+" is not a function");return e}},function(e,t,r){e.exports=function(){"use strict";var e=(r(7),r(8));return function(t,r){var i=new e.Object3D;return i.name="empty",t.add(i),i}}()},function(e,t,r){var i=r(8);i.DeviceOrientationControls=function(e){var t=this;this.object=e,this.object.rotation.reorder("YXZ"),this.enabled=!0,this.deviceOrientation={},this.screenOrientation=0;var r=function(e){t.deviceOrientation=e},n=function(){t.screenOrientation=window.orientation||0},o=function(){var e=new i.Vector3(0,0,1),t=new i.Euler,r=new i.Quaternion,n=new i.Quaternion(-Math.sqrt(.5),0,0,Math.sqrt(.5));return function(i,o,a,s,h){t.set(a,o,-s,"YXZ"),i.setFromEuler(t),i.multiply(n),i.multiply(r.setFromAxisAngle(e,-h))}}();this.connect=function(){n(),window.addEventListener("orientationchange",n,!1),window.addEventListener("deviceorientation",r,!1),t.enabled=!0},this.disconnect=function(){window.removeEventListener("orientationchange",n,!1),window.removeEventListener("deviceorientation",r,!1),t.enabled=!1},this.update=function(){if(t.enabled!==!1){var e=t.deviceOrientation.alpha?i.Math.degToRad(t.deviceOrientation.alpha):0,r=t.deviceOrientation.beta?i.Math.degToRad(t.deviceOrientation.beta):0,n=t.deviceOrientation.gamma?i.Math.degToRad(t.deviceOrientation.gamma):0,a=t.screenOrientation?i.Math.degToRad(t.screenOrientation):0;o(t.object.quaternion,e,r,n,a)}},this.connect()}},function(e,t,r){var i=r(8);i.OrbitControls=function(e,t){function r(){return 2*Math.PI/60/60*m.autoRotateSpeed}function n(){return Math.pow(.95,m.zoomSpeed)}function o(e){if(m.enabled!==!1){if(e.preventDefault(),e.button===m.mouseButtons.ORBIT){if(m.noRotate===!0)return;U=D.ROTATE,v.set(e.clientX,e.clientY)}else if(e.button===m.mouseButtons.ZOOM){if(m.noZoom===!0)return;U=D.DOLLY,S.set(e.clientX,e.clientY)}else if(e.button===m.mouseButtons.PAN){if(m.noPan===!0)return;U=D.PAN,b.set(e.clientX,e.clientY)}U!==D.NONE&&(document.addEventListener("mousemove",a,!1),document.addEventListener("mouseup",s,!1),m.dispatchEvent(k))}}function a(e){if(m.enabled!==!1){e.preventDefault();var t=m.domElement===document?m.domElement.body:m.domElement;if(U===D.ROTATE){if(m.noRotate===!0)return;y.set(e.clientX,e.clientY),x.subVectors(y,v),m.rotateLeft(2*Math.PI*x.x/t.clientWidth*m.rotateSpeed),m.rotateUp(2*Math.PI*x.y/t.clientHeight*m.rotateSpeed),v.copy(y)}else if(U===D.DOLLY){if(m.noZoom===!0)return;E.set(e.clientX,e.clientY),T.subVectors(E,S),T.y>0?m.dollyIn():m.dollyOut(),S.copy(E)}else if(U===D.PAN){if(m.noPan===!0)return;w.set(e.clientX,e.clientY),A.subVectors(w,b),m.pan(A.x,A.y),b.copy(w)}U!==D.NONE&&m.update()}}function s(){m.enabled!==!1&&(document.removeEventListener("mousemove",a,!1),document.removeEventListener("mouseup",s,!1),m.dispatchEvent(N),U=D.NONE)}function h(e){if(m.enabled!==!1&&m.noZoom!==!0&&U===D.NONE){e.preventDefault(),e.stopPropagation();var t=0;void 0!==e.wheelDelta?t=e.wheelDelta:void 0!==e.detail&&(t=-e.detail),t>0?m.dollyOut():m.dollyIn(),m.update(),m.dispatchEvent(k),m.dispatchEvent(N)}}function c(e){if(m.enabled!==!1&&m.noKeys!==!0&&m.noPan!==!0)switch(e.keyCode){case m.keys.UP:m.pan(0,m.keyPanSpeed),m.update();break;case m.keys.BOTTOM:m.pan(0,-m.keyPanSpeed),m.update();break;case m.keys.LEFT:m.pan(m.keyPanSpeed,0),m.update();break;case m.keys.RIGHT:m.pan(-m.keyPanSpeed,0),m.update()}}function l(e){if(m.enabled!==!1){switch(e.touches.length){case 1:if(m.noRotate===!0)return;U=D.TOUCH_ROTATE,v.set(e.touches[0].pageX,e.touches[0].pageY);break;case 2:if(m.noZoom===!0)return;U=D.TOUCH_DOLLY;var t=e.touches[0].pageX-e.touches[1].pageX,r=e.touches[0].pageY-e.touches[1].pageY,i=Math.sqrt(t*t+r*r);S.set(0,i);break;case 3:if(m.noPan===!0)return;U=D.TOUCH_PAN,b.set(e.touches[0].pageX,e.touches[0].pageY);break;default:U=D.NONE}U!==D.NONE&&m.dispatchEvent(k)}}function u(e){if(m.enabled!==!1){e.preventDefault(),e.stopPropagation();var t=m.domElement===document?m.domElement.body:m.domElement;switch(e.touches.length){case 1:if(m.noRotate===!0)return;if(U!==D.TOUCH_ROTATE)return;y.set(e.touches[0].pageX,e.touches[0].pageY),x.subVectors(y,v),m.rotateLeft(2*Math.PI*x.x/t.clientWidth*m.rotateSpeed),m.rotateUp(2*Math.PI*x.y/t.clientHeight*m.rotateSpeed),v.copy(y),m.update();break;case 2:if(m.noZoom===!0)return;if(U!==D.TOUCH_DOLLY)return;var r=e.touches[0].pageX-e.touches[1].pageX,i=e.touches[0].pageY-e.touches[1].pageY,n=Math.sqrt(r*r+i*i);E.set(0,n),T.subVectors(E,S),T.y>0?m.dollyOut():m.dollyIn(),S.copy(E),m.update();break;case 3:if(m.noPan===!0)return;if(U!==D.TOUCH_PAN)return;w.set(e.touches[0].pageX,e.touches[0].pageY),A.subVectors(w,b),m.pan(A.x,A.y),b.copy(w),m.update();break;default:U=D.NONE}}}function f(){m.enabled!==!1&&(m.dispatchEvent(N),U=D.NONE)}this.object=e,this.domElement=void 0!==t?t:document,this.enabled=!0,this.target=new i.Vector3,this.center=this.target,this.noZoom=!1,this.zoomSpeed=1,this.minDistance=0,this.maxDistance=1/0,this.noRotate=!1,this.rotateSpeed=1,this.noPan=!1,this.keyPanSpeed=7,this.autoRotate=!1,this.autoRotateSpeed=2,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-(1/0),this.maxAzimuthAngle=1/0,this.noKeys=!1,this.keys={LEFT:37,UP:38,RIGHT:39,BOTTOM:40},this.mouseButtons={ORBIT:i.MOUSE.LEFT,ZOOM:i.MOUSE.MIDDLE,PAN:i.MOUSE.RIGHT};var p,d,m=this,g=1e-6,v=new i.Vector2,y=new i.Vector2,x=new i.Vector2,b=new i.Vector2,w=new i.Vector2,A=new i.Vector2,M=new i.Vector3,_=new i.Vector3,S=new i.Vector2,E=new i.Vector2,T=new i.Vector2,C=0,L=0,P=1,R=new i.Vector3,F=new i.Vector3,B=new i.Quaternion,D={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_DOLLY:4,TOUCH_PAN:5},U=D.NONE;this.target0=this.target.clone(),this.position0=this.object.position.clone();var V=(new i.Quaternion).setFromUnitVectors(e.up,new i.Vector3(0,1,0)),O=V.clone().inverse(),z={type:"change"},k={type:"start"},N={type:"end"};this.rotateLeft=function(e){void 0===e&&(e=r()),L-=e},this.rotateUp=function(e){void 0===e&&(e=r()),C-=e},this.panLeft=function(e){var t=this.object.matrix.elements;M.set(t[0],t[1],t[2]),M.multiplyScalar(-e),R.add(M)},this.panUp=function(e){var t=this.object.matrix.elements;M.set(t[4],t[5],t[6]),M.multiplyScalar(e),R.add(M)},this.pan=function(e,t){var r=m.domElement===document?m.domElement.body:m.domElement;if(void 0!==m.object.fov){var i=m.object.position,n=i.clone().sub(m.target),o=n.length();o*=Math.tan(m.object.fov/2*Math.PI/180),m.panLeft(2*e*o/r.clientHeight),m.panUp(2*t*o/r.clientHeight)}else void 0!==m.object.top?(m.panLeft(e*(m.object.right-m.object.left)/r.clientWidth),m.panUp(t*(m.object.top-m.object.bottom)/r.clientHeight)):console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled.")},this.dollyIn=function(e){void 0===e&&(e=n()),P/=e},this.dollyOut=function(e){void 0===e&&(e=n()),P*=e},this.update=function(){var e=this.object.position;_.copy(e).sub(this.target),_.applyQuaternion(V),p=Math.atan2(_.x,_.z),d=Math.atan2(Math.sqrt(_.x*_.x+_.z*_.z),_.y),this.autoRotate&&U===D.NONE&&this.rotateLeft(r()),p+=L,d+=C,p=Math.max(this.minAzimuthAngle,Math.min(this.maxAzimuthAngle,p)),d=Math.max(this.minPolarAngle,Math.min(this.maxPolarAngle,d)),d=Math.max(g,Math.min(Math.PI-g,d));var t=_.length()*P;t=Math.max(this.minDistance,Math.min(this.maxDistance,t)),this.target.add(R),_.x=t*Math.sin(d)*Math.sin(p),_.y=t*Math.cos(d),_.z=t*Math.sin(d)*Math.cos(p),_.applyQuaternion(O),e.copy(this.target).add(_),this.object.lookAt(this.target),L=0,C=0,P=1,R.set(0,0,0),(F.distanceToSquared(this.object.position)>g||8*(1-B.dot(this.object.quaternion))>g)&&(this.dispatchEvent(z), -F.copy(this.object.position),B.copy(this.object.quaternion))},this.reset=function(){U=D.NONE,this.target.copy(this.target0),this.object.position.copy(this.position0),this.update()},this.getPolarAngle=function(){return d},this.getAzimuthalAngle=function(){return p},this.domElement.addEventListener("contextmenu",function(e){e.preventDefault()},!1),this.domElement.addEventListener("mousedown",o,!1),this.domElement.addEventListener("mousewheel",h,!1),this.domElement.addEventListener("DOMMouseScroll",h,!1),this.domElement.addEventListener("touchstart",l,!1),this.domElement.addEventListener("touchend",f,!1),this.domElement.addEventListener("touchmove",u,!1),window.addEventListener("keydown",c,!1),this.update()},i.OrbitControls.prototype=Object.create(i.EventDispatcher.prototype),i.OrbitControls.prototype.constructor=i.OrbitControls},function(e,t,r){var i=r(8);!function(){function e(e,t){r.push({type:e,format:t})}var t=console.log,r=[];e(i.Matrix4,function(e){var t=e.elements;return[[t[0],t[1],t[2],t[3]],[t[4],t[5],t[6],t[7]],[t[8],t[9],t[10],t[11]],[t[12],t[13],t[14],t[15]]]}),e(i.Matrix3,function(e){var t=e.elements;return[[t[0],t[1],t[2]],[t[3],t[4],t[5]],[t[6],t[7],t[8]]]}),e(i.Vector2,function(e){return{Vector2:{x:e.x,y:e.y}}}),e(i.Vector3,function(e){return{Vector3:{x:e.x,y:e.y,z:e.z}}}),e(i.Vector4,function(e){return{Vector4:{x:e.x,y:e.y,z:e.z,w:e.w}}}),e(i.Euler,function(e){return{Vector4:{x:e.x,y:e.y,z:e.z,order:e.order}}}),e(i.Ray,function(e){return{"Ray origin":{x:e.origin.x,y:e.origin.y,z:e.origin.z},"Ray direction":{x:e.direction.x,y:e.direction.y,z:e.direction.z}}}),console.log=function(){var e=!1;[].forEach.call(arguments,function(t){r.forEach(function(r){t instanceof r.type&&(e=!0)})}),e?[].forEach.call(arguments,function(e){t.apply(console,[e]),r.forEach(function(t){e instanceof t.type&&console.table(t.format(e))})}):t.apply(console,arguments)}}()},function(e,t,r){var i=r(8);i.VRStereoEffect=function(e,t,r){function n(e,t,r){var n=new i.Matrix4,o=n.elements,a=Math.tan(e.upDegrees*R),s=Math.tan(e.downDegrees*R),h=Math.tan(e.leftDegrees*R),c=Math.tan(e.rightDegrees*R),l=2/(h+c),u=2/(a+s);return o[0]=l,o[4]=0,o[8]=-((h-c)*l*.5),o[12]=0,o[1]=0,o[5]=u,o[9]=(a-s)*u*.5,o[13]=0,o[2]=0,o[6]=0,o[10]=r/(t-r),o[14]=r*t/(t-r),o[3]=0,o[7]=0,o[11]=-1,o[15]=0,n}function o(){var t,r;u&&f?(t=c,r=l):(t=g||e.domElement.offsetWidth||window.innerWidth,r=v||e.domElement.offsetHeight||window.innerHeight),e.setSize(t,r)}function a(){var e,t,r,i,a,s,h,f;return u?(u.getEyeParameters?(r=u.getEyeParameters("left"),i=u.getEyeParameters("right"),a=r.renderRect,s=i.renderRect,c=s.x+s.width,l=Math.max(a.y+a.height,s.y+s.height),e=r.currentFieldOfView,t=i.currentFieldOfView,u.setFieldOfView(e,t,C,L),x.copy(r.eyeTranslation),b.copy(i.eyeTranslation),E=r.renderRect,T=i.renderRect):u.getRecommendedEyeRenderRect&&(h=u.getRecommendedEyeRenderRect("left"),f=u.getRecommendedEyeRenderRect("right"),c=h.width+f.width,l=Math.max(h.height,f.height),u.getCurrentEyeFieldOfView?(e=u.getCurrentEyeFieldOfView("left"),t=u.getCurrentEyeFieldOfView("right")):(e=u.getRecommendedEyeFieldOfView("left"),t=u.getRecommendedEyeFieldOfView("right")),x.copy(u.getEyeTranslation("left")),b.copy(u.getEyeTranslation("right")),E.x=h.left,E.y=h.top,E.width=h.width,E.height=h.height,T.x=f.left,T.y=f.top,T.width=f.width,T.height=f.height),o(),_.projectionMatrix=n(e,C,L),void(S.projectionMatrix=n(t,C,L))):(_.fov=80,void(S.fov=80))}function s(e){var t,r;for(t=0;t degrees, and the cosine of that","// earth shadow hack","const float cutoffAngle = pi/1.95;","const float steepness = 1.5;","vec3 totalRayleigh(vec3 lambda)","{","return (8.0 * pow(pi, 3.0) * pow(pow(n, 2.0) - 1.0, 2.0) * (6.0 + 3.0 * pn)) / (3.0 * N * pow(lambda, vec3(4.0)) * (6.0 - 7.0 * pn));","}","// A simplied version of the total Reayleigh scattering to works on browsers that use ANGLE","vec3 simplifiedRayleigh()","{","return 0.0005 / vec3(94, 40, 18);","}","float rayleighPhase(float cosTheta)","{ ","return (3.0 / (16.0*pi)) * (1.0 + pow(cosTheta, 2.0));","// return (1.0 / (3.0*pi)) * (1.0 + pow(cosTheta, 2.0));","// return (3.0 / 4.0) * (1.0 + pow(cosTheta, 2.0));","}","vec3 totalMie(vec3 lambda, vec3 K, float T)","{","float c = (0.2 * T ) * 10E-18;","return 0.434 * c * pi * pow((2.0 * pi) / lambda, vec3(v - 2.0)) * K;","}","float hgPhase(float cosTheta, float g)","{","return (1.0 / (4.0*pi)) * ((1.0 - pow(g, 2.0)) / pow(1.0 - 2.0*g*cosTheta + pow(g, 2.0), 1.5));","}","float sunIntensity(float zenithAngleCos)","{","return EE * max(0.0, 1.0 - exp(-((cutoffAngle - acos(zenithAngleCos))/steepness)));","}","// float logLuminance(vec3 c)","// {","// return log(c.r * 0.2126 + c.g * 0.7152 + c.b * 0.0722);","// }","// Filmic ToneMapping http://filmicgames.com/archives/75","float A = 0.15;","float B = 0.50;","float C = 0.10;","float D = 0.20;","float E = 0.02;","float F = 0.30;","float W = 1000.0;","vec3 Uncharted2Tonemap(vec3 x)","{","return ((x*(A*x+C*B)+D*E)/(x*(A*x+B)+D*F))-E/F;","}","void main() ","{","float sunfade = 1.0-clamp(1.0-exp((sunPosition.y/450000.0)),0.0,1.0);","// luminance = 1.0 ;// vWorldPosition.y / 450000. + 0.5; //sunPosition.y / 450000. * 1. + 0.5;","// gl_FragColor = vec4(sunfade, sunfade, sunfade, 1.0);","reileighCoefficient = reileighCoefficient - (1.0* (1.0-sunfade));","float sunE = sunIntensity(dot(sunDirection, up));","// extinction (absorbtion + out scattering) ","// rayleigh coefficients","vec3 betaR = simplifiedRayleigh() * reileighCoefficient;","// mie coefficients","vec3 betaM = totalMie(lambda, K, turbidity) * mieCoefficient;","// optical length","// cutoff angle at 90 to avoid singularity in next formula.","float zenithAngle = acos(max(0.0, dot(up, normalize(vWorldPosition - cameraPos))));","float sR = rayleighZenithLength / (cos(zenithAngle) + 0.15 * pow(93.885 - ((zenithAngle * 180.0) / pi), -1.253));","float sM = mieZenithLength / (cos(zenithAngle) + 0.15 * pow(93.885 - ((zenithAngle * 180.0) / pi), -1.253));","// combined extinction factor ","vec3 Fex = exp(-(betaR * sR + betaM * sM));","// in scattering","float cosTheta = dot(normalize(vWorldPosition - cameraPos), sunDirection);","float rPhase = rayleighPhase(cosTheta*0.5+0.5);","vec3 betaRTheta = betaR * rPhase;","float mPhase = hgPhase(cosTheta, mieDirectionalG);","vec3 betaMTheta = betaM * mPhase;","vec3 Lin = pow(sunE * ((betaRTheta + betaMTheta) / (betaR + betaM)) * (1.0 - Fex),vec3(1.5));","Lin *= mix(vec3(1.0),pow(sunE * ((betaRTheta + betaMTheta) / (betaR + betaM)) * Fex,vec3(1.0/2.0)),clamp(pow(1.0-dot(up, sunDirection),5.0),0.0,1.0));","//nightsky","vec3 direction = normalize(vWorldPosition - cameraPos);","float theta = acos(direction.y); // elevation --> y-axis, [-pi/2, pi/2]","float phi = atan(direction.z, direction.x); // azimuth --> x-axis [-pi/2, pi/2]","vec2 uv = vec2(phi, theta) / vec2(2.0*pi, pi) + vec2(0.5, 0.0);","// vec3 L0 = texture2D(skySampler, uv).rgb+0.1 * Fex;","vec3 L0 = vec3(0.1) * Fex;","// composition + solar disc","//if (cosTheta > sunAngularDiameterCos)","float sundisk = smoothstep(sunAngularDiameterCos,sunAngularDiameterCos+0.00002,cosTheta);","// if (normalize(vWorldPosition - cameraPos).y>0.0)","L0 += (sunE * 19000.0 * Fex)*sundisk;","vec3 whiteScale = 1.0/Uncharted2Tonemap(vec3(W));","vec3 texColor = (Lin+L0); ","texColor *= 0.04 ;","texColor += vec3(0.0,0.001,0.0025)*0.3;","float g_fMaxLuminance = 1.0;","float fLumScaled = 0.1 / luminance; ","float fLumCompressed = (fLumScaled * (1.0 + (fLumScaled / (g_fMaxLuminance * g_fMaxLuminance)))) / (1.0 + fLumScaled); ","float ExposureBias = fLumCompressed;","vec3 curr = Uncharted2Tonemap((log2(2.0/pow(luminance,4.0)))*texColor);","vec3 color = curr*whiteScale;","vec3 retColor = pow(color,vec3(1.0/(1.2+(1.2*sunfade))));","gl_FragColor.rgb = retColor;","gl_FragColor.a = 1.0;","}"].join("\n")},i.Sky=function(){var e=i.ShaderLib.sky,t=i.UniformsUtils.clone(e.uniforms),r=new i.ShaderMaterial({fragmentShader:e.fragmentShader,vertexShader:e.vertexShader,uniforms:t,side:i.BackSide}),n=new i.SphereGeometry(45e4,32,15),o=new i.Mesh(n,r);this.mesh=o,this.uniforms=t}},function(e,t,r){e.exports=function(){"use strict";var e=(r(7),r(8));return r(74),function(t,r){var i,n,o,a=t;for("string"==typeof r||Array.isArray(r)?n=r:r&&(n=r.src);!(a instanceof e.Scene)&&a.parent;)a=a.parent;return o=a.getObjectByName("audio-listener"),i=new e.Audio(o),i.load(n),this.start=i.start.bind(i),this.volume=i.volume.bind(i),t.add(i),i}}()},function(e,t,r){var i=r(8);i.Audio=function(e){i.Object3D.call(this),this.type="Audio",this.started=!1,e.context?(this.context=e.context,this.gain=this.context.createGain(),this.gain.connect(e.input),this.panner=this.context.createPanner(),this.panner.connect(this.gain)):this.source=new Audio},i.Audio.prototype=Object.create(i.Object3D.prototype),i.Audio.prototype.load=function(e){var t,r,i,n=this,o=this.source instanceof window.HTMLAudioElement?this.source:new Audio;for("string"==typeof e&&(e=[e]),r=0;ru)&&(u=5),E=P*u,p.font=b.font,a=t.exec(p.font),m=parseFloat(a&&a[1])||50,w=1.5*m,o=new c,e=0===b.text?"0":String(b.text||""),u){for(e=e.trim()+" ",A=0;AS?o?o.add(T):o=new c(T):!o&&c.measure(T)>=E?(C.push(new c(T)),T="",o=new c,R=!0):(o.wrap=!0,C.push(o),o=new c(T),R=!0),T=""):T+=r;o&&C.push(o)}else C.push(new c(e));E&&R||(E=C.reduce(function(e,t){return Math.max(e,t.totalWidth)},0)),E=Math.min(E,2048),F=C.length*w,s&&s.mipmap===!1?(f.width=E,f.height=F):(f.width=h(E),f.height=h(F)),d.scale.set(f.width/P,f.height/P,1),p.font=b.font,p.textAlign=b.textAlign,p.textBaseline=b.textBaseline,p.direction=b.direction,p.fillStyle=b.fillStyle,v=(f.width-E)/2,_=(f.height-F)/2+w/2,l=""===p.direction||"inherit"===p.direction,M="center"===p.textAlign?f.width/2:"right"===p.textAlign||"end"===p.textAlign&&("ltr"===p.direction||l&&"ltr"===L)||"start"===p.textAlign&&("rtl"===p.direction||l&&"rtl"===L)?f.width-v:v,C.forEach(function(e){var t,r;"justify"===b.textAlign&&e.wrap&&e.words.length>1?(t=M,r=(E-e.wordsWidth)/(e.words.length-1),e.words.forEach(function(e){p.fillText(e,t,_),t+=r+c.measure(e)})):p.fillText(e.text(),M,_),_+=w}),y=E/P,x=C.length*w/P,g.needsUpdate=!0,d.name=e.trim()}var u,f,p,d,m,g,v=this,y=0,x=0,b={text:"",font:"80px sans-serif",textAlign:"center",textBaseline:"",direction:"",fillStyle:"white",resolution:256,wrap:5};return c.prototype.text=function(){return this.words.join(" ")},c.prototype.add=function(e){var t;this.words.length&&(this.totalWidth+=this.spaceWidth),this.words.push(e),t=c.measure(e),this.totalWidth+=t,this.wordsWidth+=t},c.prototype.measure=function(e){var t=this.totalWidth;return e&&(t+=c.measure(e),this.words.length&&(t+=this.spaceWidth)),t},c.measure=function(e){return p.measureText(e).width},f=document.createElement("canvas"),p=f.getContext("2d"),g=new e.Texture(f),f.width===h(f.width)&&f.height===h(f.height)&&(g.minFilter=e.LinearMipMapLinearFilter,g.generateMipmaps=!0),u=new e.MeshBasicMaterial({side:e.DoubleSide,transparent:!0,map:g}),d=new e.Mesh(a,u),m=new e.Object3D,m.name="text",m.add(d),r.add(m),"string"==typeof s?b.text=s:s&&Object.keys(b).forEach(function(e){b[e]=s[e]||b[e]}),l(),Object.keys(b).forEach(function(e){Object.defineProperty(v,e,{get:function(){return b[e]},set:function(t){b[e]=t,l()}})}),Object.defineProperty(v,"width",{get:function(){return y}}),Object.defineProperty(v,"height",{get:function(){return x}}),this.material=u,m}}()},function(e,t,r){e.exports=function(){"use strict";var e=r(7),t=r(8);return function(r,i){var n,o;return n=new t.TorusGeometry(void 0===i.radius?.5:i.radius,void 0===i.tube?.125:i.tube,void 0===i.radialSegments?12:i.radialSegments,void 0===i.tubularSegments?16:i.tubularSegments,i.arc),o=new t.Mesh(n,e.standard()),o.name="torus",r.add(o),o}}()},function(e,t,r){e.exports=function(){"use strict";var e,t=r(8),i=r(28),n=/\.(webm|ogg|ogv|m4v|mp4|mov)/i;return e=function(r,o){function a(e){return e>0&&0===(e&e-1)}function s(){var e=p.videoWidth/p.videoHeight;o&&o.sphere||l.applyMatrix((new t.Matrix4).makeScale(1,m/e,1)),m=e,p.videoWidth===p.videoHeight&&a(p.videoWidth)&&a(p.videoHeight)?(d.minFilter=t.LinearMipMapLinearFilter,d.generateMipmaps=!0):(d.minFilter=t.LinearFilter,d.generateMipmaps=!1),u.map=d,u.visible=!0,g&&p.play()}function h(e){e.forEach(function(e){var t,r,o;if(e){if(t=i.exec(e),t&&(t[1]&&t[1]!==window.location.hostĪ©||t[2]&&t[2]!==window.location.port)){if(void 0===p.crossOrigin)return void console.warn("Browser does not support cross-origin video");p.crossOrigin="anonymous"}o=document.createElement("source"),o.src=e,r=n.exec(e),(!r||p.canPlayType("video/"+r[1]))&&p.appendChild(o)}})}function c(){document.hidden||document.mozHidden||document.msHidden||document.webkitHidden?p.pause():g&&p.play()}var l,u,f,p,d,m=1,g=!1,v=this;return p=document.createElement("video"),p.loop=!0,p.addEventListener("loadedmetadata",s,!1),Array.isArray(o)&&h(o),"string"==typeof o?h([o]):"string"==typeof o.src?h([o.src]):Array.isArray(o.src)&&h(o.src),p.load(),d=new t.VideoTexture(p,t.UVMapping),d.format=t.RGBFormat,o&&o.sphere?(l=new t.SphereGeometry(994,60,60,(parseFloat(o.phiStart)||0)*Math.PI*2,(parseFloat(o.phiLength)||1)*Math.PI*2,(parseFloat(o.thetaStart)||0)*Math.PI,(parseFloat(o.thetaLength)||1)*Math.PI),l.applyMatrix((new t.Matrix4).makeScale(-1,1,1)),l.applyMatrix((new t.Matrix4).makeRotationY(-Math.PI/2))):l=new t.PlaneBufferGeometry(1,1,8),u=new t.MeshBasicMaterial({side:t.DoubleSide,map:d,visible:!1}),f=new t.Mesh(l,u),o&&o.stereo&&("vertical"===o.stereo?d.repeat.y=.5:d.repeat.x=.5,f.userData.stereo=o.stereo),p.readyState&&s(),this.play=function(){return g=!0,p.play(),this},this.pause=function(){return g=!1,p.pause(),this},this.canPlayType=e.canPlayType,Object.defineProperty(this,"width",{get:function(){return p.videoWidth}}),Object.defineProperty(this,"height",{get:function(){return p.videoHeight}}),Object.defineProperty(this,"paused",{get:function(){return!g}}),Object.defineProperty(this,"volume",{get:function(){return p.volume},set:function(e){p.volume=e}}),Object.defineProperty(this,"muted",{get:function(){return p.muted},set:function(e){p.muted=e}}),Object.defineProperty(this,"duration",{get:function(){return p.duration||0}}),Object.defineProperty(this,"currentTime",{get:function(){return p.currentTime},set:function(e){p.readyState&&e=0&&(p.currentTime=e)}}),["loadedmetadata","play","pause","playing","progress"].forEach(function(e){p.addEventListener(e,v.emit.bind(v,e))}),p.addEventListener("error",function(e){p.error.code===window.MediaError.MEDIA_ERR_DECODE&&p.childNodes.length>1&&(u.visible=!1,p.removeChild(p.firstChild),p.load()),v.emit(event,e)},!0),this.element=p,window.addEventListener("touchstart",function y(){g?p.play():p.load(),window.removeEventListener("touchstart",y,!0)},!0),document.addEventListener("visibilitychange",c),document.addEventListener("mozvisibilitychange",c),document.addEventListener("msvisibilitychange",c),document.addEventListener("webkitvisibilitychange",c),f.name="video",this.raycastable=!(o&&o.sphere),r.add(f),f},e.canPlayType=function(e){var t=document.createElement("video");return t.canPlayType(e)},e}()},function(e,t){e.exports='\n \n'},function(e,t){e.exports='\n \n'},function(e,t){e.exports='\n \n'},function(e,t){e.exports='\n \n'}])); +!function(e){function t(i){if(r[i])return r[i].exports;var n=r[i]={exports:{},id:i,loaded:!1};return e[i].call(n.exports,n,n.exports,t),n.loaded=!0,n.exports}var r={};return t.m=e,t.c=r,t.p="",t(0)}(function(e){for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t))switch(typeof e[t]){case"function":break;case"object":e[t]=function(t){var r=t.slice(1),i=e[t[0]];return function(e,t,n){i.apply(this,[e,t,n].concat(r))}}(e[t]);break;default:e[t]=e[e[t]]}return e}([function(e,t,r){!function(){"use strict";function e(){r(2),n=r(6)}function t(){function e(e,t){var r,i=document.createElement("span");return i.innerHTML=e,i.id=t,r=i.firstChild,r.setAttribute("width",18),r.setAttribute("height",18),a.appendChild(i),i}function t(){n.orientationEnabled()?n.disableOrientation():n.enableOrientation()}function i(){n.controlMode()&&(c.classList.remove("unsupported"),u.classList.remove("unsupported"))}var a,s,h,c,u,l,p=new o,d=document.body,f=document.fullscreenEnabled||document.webkitFullscreenEnabled||document.mozFullScreenEnabled||document.msFullscreenEnabled,m=d.webkitRequestFullscreen||d.mozRequestFullScreen||d.msRequestFullscreen;l=document.createElement("meta"),l.setAttribute("name","viewport"),l.setAttribute("content","width=device-width, initial-scale=1, user-scalable=no"),document.head.appendChild(l),a=document.createElement("div"),a.id="buttons",document.body.appendChild(a),m&&f&&(s=e(r(80),"fs-enable"),s.setAttribute("title","Enable Full Screen"),s.addEventListener("click",m.bind(d),!1),h=e(r(81),"fs-disable"),h.setAttribute("title","Exit Full Screen"),h.addEventListener("click",n.exitFullscreen,!1)),n.on("fullscreenchange",function(){n.isFullscreen()?(h.style.display="inline-block",s.style.display="none"):(h.style.display="",s.style.display=""),n.vrMode()?p.enable():p.disable()}),c=e(r(82),"vr"),c.setAttribute("title","Toggle Virtual Reality"),c.className="unsupported",c.addEventListener("click",n.requestVR,!1),u=e(r(83),"orientation"),u.setAttribute("title","Toggle Orientation"),u.className="unsupported",u.addEventListener("click",t,!1),n.on("devicechange",i),i(),window.addEventListener("keydown",function(e){e.keyCode==="Z".charCodeAt(0)?n.zeroSensor():e.keyCode==="O".charCodeAt(0)?n.enableOrientation():13===e.keyCode&&n.requestVR()},!1),n.resize()}function i(){e(),n.init(),document.body?t():window.addEventListener("load",t,!1),window.addEventListener("resize",n.resize,!1),window.VR=n,window.THREE=n.THREE}var n,o=r(1).NoSleep;i(),n.start()}()},function(e,t){!function(e){function t(e,t,r){var i=document.createElement("source");i.src=r,i.type="video/"+t,e.appendChild(i)}var r={Android:/Android/gi.test(navigator.userAgent),iOS:/AppleWebKit/.test(navigator.userAgent)&&/Mobile\/\w+/.test(navigator.userAgent)},i={WebM:"data:video/webm;base64,GkXfo0AgQoaBAUL3gQFC8oEEQvOBCEKCQAR3ZWJtQoeBAkKFgQIYU4BnQI0VSalmQCgq17FAAw9CQE2AQAZ3aGFtbXlXQUAGd2hhbW15RIlACECPQAAAAAAAFlSua0AxrkAu14EBY8WBAZyBACK1nEADdW5khkAFVl9WUDglhohAA1ZQOIOBAeBABrCBCLqBCB9DtnVAIueBAKNAHIEAAIAwAQCdASoIAAgAAUAmJaQAA3AA/vz0AAA=",MP4:"data:video/mp4;base64,AAAAHGZ0eXBpc29tAAACAGlzb21pc28ybXA0MQAAAAhmcmVlAAAAG21kYXQAAAGzABAHAAABthADAowdbb9/AAAC6W1vb3YAAABsbXZoZAAAAAB8JbCAfCWwgAAAA+gAAAAAAAEAAAEAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAIVdHJhawAAAFx0a2hkAAAAD3wlsIB8JbCAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAQAAAAAAIAAAACAAAAAABsW1kaWEAAAAgbWRoZAAAAAB8JbCAfCWwgAAAA+gAAAAAVcQAAAAAAC1oZGxyAAAAAAAAAAB2aWRlAAAAAAAAAAAAAAAAVmlkZW9IYW5kbGVyAAAAAVxtaW5mAAAAFHZtaGQAAAABAAAAAAAAAAAAAAAkZGluZgAAABxkcmVmAAAAAAAAAAEAAAAMdXJsIAAAAAEAAAEcc3RibAAAALhzdHNkAAAAAAAAAAEAAACobXA0dgAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAIAAgASAAAAEgAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABj//wAAAFJlc2RzAAAAAANEAAEABDwgEQAAAAADDUAAAAAABS0AAAGwAQAAAbWJEwAAAQAAAAEgAMSNiB9FAEQBFGMAAAGyTGF2YzUyLjg3LjQGAQIAAAAYc3R0cwAAAAAAAAABAAAAAQAAAAAAAAAcc3RzYwAAAAAAAAABAAAAAQAAAAEAAAABAAAAFHN0c3oAAAAAAAAAEwAAAAEAAAAUc3RjbwAAAAAAAAABAAAALAAAAGB1ZHRhAAAAWG1ldGEAAAAAAAAAIWhkbHIAAAAAAAAAAG1kaXJhcHBsAAAAAAAAAAAAAAAAK2lsc3QAAAAjqXRvbwAAABtkYXRhAAAAAQAAAABMYXZmNTIuNzguMw=="},n=function(){return r.iOS?this.noSleepTimer=null:r.Android&&(this.noSleepVideo=document.createElement("video"),this.noSleepVideo.setAttribute("loop",""),t(this.noSleepVideo,"webm",i.WebM),t(this.noSleepVideo,"mp4",i.MP4)),this};n.prototype.enable=function(e){r.iOS?(this.disable(),this.noSleepTimer=window.setInterval(function(){window.location=window.location,window.setTimeout(window.stop,0)},e||15e3)):r.Android&&this.noSleepVideo.play()},n.prototype.disable=function(){r.iOS?this.noSleepTimer&&(window.clearInterval(this.noSleepTimer),this.noSleepTimer=null):r.Android&&this.noSleepVideo.pause()},e.NoSleep=n}(this)},function(e,t,r){var i=r(3);"string"==typeof i&&(i=[[e.id,i,""]]);r(5)(i,{});i.locals&&(e.exports=i.locals)},function(e,t,r){t=e.exports=r(4)(),t.push([e.id,"body{font-family:Helvetica Neue,Helvetica,Arial,sans-serif;color:#eee;overflow:hidden;background:#282828;height:100%;width:100%;margin:0;padding:0}canvas{width:100%!important;height:100%!important;top:0;left:0}#buttons{position:absolute;bottom:0;left:0;padding:9pt;margin:8px;border-radius:8px;background-color:hsla(0,0%,50%,.6)}#buttons>*{margin:0 10px;display:inline-block;width:18px;height:18px;cursor:pointer}#buttons>:first-child{margin-left:0}#buttons>.unsupported,#fs-disable{display:none}",""])},function(e,t){e.exports=function(){var e=[];return e.toString=function(){for(var e=[],t=0;t=0&&H.splice(t,1),t=j.indexOf(N.findObject(e)),t>=0&&j.splice(t,1),e.children.forEach(n)}function o(){var e,t,r,i,o,a,s=[];for(E.ray.origin.setFromMatrixPosition(y.matrixWorld),E.ray.direction.set(0,0,.5).unproject(y).sub(E.ray.origin).normalize(),i=E.intersectObjects(H,!0),e=0;en&&(a=Date.now(),s=a-i,s>1e3&&(navigator.vibrate&&navigator.vibrate(100),i=Date.now(),R.emit("shake")))),e=c.x,t=c.y,r=c.z,z=!0},!1)}function d(){function e(){document.body.insertBefore(w.domElement,document.body.firstChild||null),l()}if(!w){w=new v.WebGLRenderer({antialias:!0}),w.domElement.addEventListener("webglcontextlost",function(e){console.log("lost context",e)}),x=new v.Scene,C=new N(x,r(59),null,{name:"body"}).moveTo(0,1.5,4),b=C.object,L=new N(b,function(e){return y=new v.PerspectiveCamera(60,window.innerWidth/window.innerHeight,D,F),e.add(y),y}).moveTo(0,1e-4,1e-4),M=new v.AudioListener,M.name="audio-listener",y.add(M),A=new v.VRControls(y),A.freeze=!P,S=new v.VRStereoEffect(w),S.near=D,S.far=F,S.addEventListener("fullscreenchange",function(e){var r;t()?G&&(_.enabled=!1,A.freeze=!1,A.reset(),r=window.screen,r.lockOrientation?r.lockOrientation("landscape-primary"):r.mozLockOrientation?r.mozLockOrientation("landscape-primary"):r.orientation&&r.orientation.lock&&r.orientation.lock("landscape-primary")):R.exitVR(),y.position.set(0,1e-4,1e-4),y.rotation.set(0,0,0),R.emit("fullscreenchange",e)}),A.addEventListener("devicechange",function(){z=!0,void 0===P&&(P="deviceorientation"===A.mode()),A.freeze=!P&&!G,R.emit("devicechange",A.mode(),S.hmd())}),_=new v.OrbitControls(y),_.target0.set(0,1e-4,0),_.target.copy(_.target0),_.update();var n=new v.DirectionalLight(16777215,.8);n.name="directional-light",n.position.set(20,100,100),n.castShadow=!0,n.shadowCameraVisible=!0,n.shadowMapWidth=2048,n.shadowMapHeight=2048,n.shadowCameraLeft=-10,n.shadowCameraRight=10,n.shadowCameraTop=10,n.shadowCameraBottom=-10,n.shadowCameraFar=150,n.shadowCameraNear=100,n.shadowDarkness=1,x.add(n),x.add(new v.AmbientLight(4473924)),R&&(R.camera=L,R.body=C,R.scene=x,R.canvas=w.domElement,R.renderer=w,R.zeroSensor=A.zeroSensor),E=new v.Raycaster,document.body?e():window.addEventListener("load",e,!1),R.canvas.addEventListener("mozfullscreenerror",i,!1),R.canvas.addEventListener("webkitfullscreenerror",i,!1),R.canvas.addEventListener("fullscreenerror",i,!1)}}function f(){v=r(8),r(60),r(61),r(62),v.ImageUtils.crossOrigin="",g=r(44),r(63),r(64)}function m(){d(),p(),l(),document.addEventListener("visibilitychange",u),document.addEventListener("mozvisibilitychange",u),document.addEventListener("msvisibilitychange",u),document.addEventListener("webkitvisibilitychange",u)}var v,g,y,x,b,w,M,A,S,_,E,T,C,L,P,R,D=.1,F=1e6,O=r(7),U=function(){},k=U,B=(document.exitFullscreen||document.mozCancelFullScreen||document.webkitExitFullscreen||document.msExitFullscreen||U).bind(document),V=!1,G=!1,z=!1,N=r(43),I=["box","cylinder","torus","sphere","empty","sound","floor","sky","panorama","image","video","text","grid"],j=[],H=[],W=0,X=[];f(),e.exports=R={init:m,render:a,start:c,stop:h,resize:l,THREE:v,materials:O,animate:function(e){var t;"function"==typeof e&&(t=X.indexOf(e),0>t&&X.push(e))},end:function(e){var t;return e?void("function"==typeof e&&(t=X.indexOf(e),t>=0&&X.splice(t,1))):void(X.length=0)},requestVR:function(){!G&&S&&(G=!0,S.requestFullScreen())},exitVR:function(){return G=!1,t()?void B():(_.enabled=!0,A.freeze=!P,void y.rotation.set(0,0,0))},vrMode:function(){return G&&t()},orientationEnabled:function(){return!!P},enableOrientation:function(){P=!0,G||(A.freeze=!1)},disableOrientation:function(){P=!1,y.rotation.set(0,0,0),A.freeze=!G},isFullscreen:t,requestFullscreen:k,exitFullscreen:function(){t()&&B()},controlMode:function(){return A&&A.mode()},zeroSensor:U,vibrate:navigator.vibrate?navigator.vibrate.bind(navigator):U,times:function(e,t){var r;for(r=0;e>r;r++)t(r)},camera:L,body:C,scene:x,renderer:w||null,canvas:w&&w.domElement||null},I.forEach(function(e){var t,i=r(65)("./"+e);R[e]=function(e){var t=new N(x,i,b,e);return j.push(t),t.raycastable&&H.push(t.object),t},N.prototype[e]=function(e){var t=new N(this.object,i,b,e);return j.push(t),t.raycastable&&H.push(t.object),t};for(t in i)i.hasOwnProperty(t)&&"function"==typeof i[t]&&(R[e][t]=i[t],N.prototype[e][t]=i[t])}),g(R),Object.defineProperty(R,"target",{get:function(){return T}})}()},function(e,t,r){e.exports=function(){"use strict";function e(e,t,r){function i(){var e,t,i;s&&(o.naturalWidth>2048||o.naturalHeight>2048)&&(e=2048/Math.max(o.naturalWidth,o.naturalHeight),t=document.createElement("canvas"),t.width=Math.floor(o.naturalWidth*e),t.height=Math.floor(o.naturalHeight*e),i=t.getContext("2d"),i.drawImage(o,0,0,o.naturalWidth,o.naturalHeight,0,0,t.width,t.height),o=t),u.image=o,u.needsUpdate=!0,"function"==typeof r&&setTimeout(r.bind(null,u,o),1)}var o,a,u,p;return a=c.exec(e),p=!!a,a||(a=h.exec(e)),l[e]?o=l[e]:(o=document.createElement("img"),a&&(a[1]&&a[1]!==window.location.hostname||a[2]&&a[2]!==window.location.port)&&(o.crossOrigin="anonymous"),o.src=e,l[e]=o),u=new n.Texture(void 0,t),o.naturalWidth||p?setTimeout(i,1):o.addEventListener("load",i),u}function t(t){function r(r){if("string"==typeof r){if(h.test(r)||c.test(r))return e(r);r=f[r]}return"function"==typeof r?r(t):r}var i,s=p[t.type]||n.MeshLambertMaterial;return"string"==typeof t&&(t={map:t}),i=a({},t),o({ambient:t.ambient||t.color,emissive:t.emissive||t.color,map:r(t.map),specularMap:r(t.specularMap),normalMap:r(t.normalMap),alphaMap:r(t.alphaMap),envMap:r(t.envMap),lightMap:r(t.lightMap)},function(e,t){void 0!==e&&(i[t]=e)}),delete i.type,new s(i)}var i,n=r(8),o=r(9),a=r(17),s=navigator.userAgent.match(/(iPad|iPhone|iPod)/g),h=r(28),c=/^data:image\/(?:png|jpe?g|gif);/,u="http://pov-tc.pbs.org/pov/flv/2015/webvr-starter-kit/",l={},p={lambert:n.MeshLambertMaterial,basic:n.MeshBasicMaterial,phong:n.MeshPhongMaterial,normal:n.MeshNormalMaterial,depth:n.MeshDepthMaterial},d={asphalt:{repeat:12},"brick-tiles":{repeat:2},bricks:{type:"phong",repeat:4,normalMap:"bricks-normal.jpg",specularMap:"bricks-specular.jpg"},checkerboard:{repeat:10,map:"checkerboard.png"},grass:{repeat:12},"metal-floor":{type:"phong",shininess:100,repeat:2},metal:{type:"phong",shininess:100,shading:n.SmoothShading,repeat:2},stone:{repeat:8},tiles:{repeat:4},"weathered-wood":{repeat:8},wood:{repeat:4}},f={};return u=function(){var e,t;return document.currentScript?e=document.currentScript.getAttribute("src"):(t=document.getElementsByTagName("script"),e=t[t.length-1].getAttribute("src")),h.test(e)?"http://pov-tc.pbs.org/pov/flv/2015/webvr-starter-kit/":e.replace(/[a-z\-\.]+\.js$/i,"")}(),i={standard:function(){return new n.MeshLambertMaterial},textures:f,imageTexture:e,material:t,library:["standard"]},o(d,function(o,s){function h(t,i){function o(e){return/^[a-z0-9\/\-]+\.(png|jpg)$/i.test(e)?u+e:e}return i=i||{},function(s){var h=e(o(r(29)("./"+t)));return s=a({},i,s),s.repeat&&(s.repeat>0?h.repeat.set(s.repeat,s.repeat):s.repeat instanceof n.Vector2&&h.repeat.copy(s.repeat),h.wrapS=h.wrapT=n.RepeatWrapping),h}}var c,l=h(o.map||s+".jpg",o);c=a({},o,{map:l}),f[s]=l,o.normalMap&&(c.normalMap=f[s+"-normal"]=h(o.normalMap,o)),o.specularMap&&(c.specularMap=f[s+"-specular"]=h(o.specularMap,o)),i.library.push(s),i[s]=function(e){var r=a({},c,e);return t(r)}}),i}()},function(e,t,r){var i,n,o={REVISION:"72dev"};i=o,n="function"==typeof i?i.call(t,r,t,e):i,!(void 0!==n&&(e.exports=n)),(void 0===self.requestAnimationFrame||void 0===self.cancelAnimationFrame)&&!function(){for(var e=0,t=["ms","moz","webkit","o"],r=0;re?-1:e>0?1:+e}),void 0===Function.prototype.name&&void 0!==Object.defineProperty&&Object.defineProperty(Function.prototype,"name",{get:function(){return this.toString().match(/^\s*function\s*(\S*)\s*\(/)[1]}}),o.MOUSE={LEFT:0,MIDDLE:1,RIGHT:2},o.CullFaceNone=0,o.CullFaceBack=1,o.CullFaceFront=2,o.CullFaceFrontBack=3,o.FrontFaceDirectionCW=0,o.FrontFaceDirectionCCW=1,o.BasicShadowMap=0,o.PCFShadowMap=1,o.PCFSoftShadowMap=2,o.FrontSide=0,o.BackSide=1,o.DoubleSide=2,o.FlatShading=1,o.SmoothShading=2,o.NoColors=0,o.FaceColors=1,o.VertexColors=2,o.NoBlending=0,o.NormalBlending=1,o.AdditiveBlending=2,o.SubtractiveBlending=3,o.MultiplyBlending=4,o.CustomBlending=5,o.AddEquation=100,o.SubtractEquation=101,o.ReverseSubtractEquation=102,o.MinEquation=103,o.MaxEquation=104,o.ZeroFactor=200,o.OneFactor=201,o.SrcColorFactor=202,o.OneMinusSrcColorFactor=203,o.SrcAlphaFactor=204,o.OneMinusSrcAlphaFactor=205,o.DstAlphaFactor=206,o.OneMinusDstAlphaFactor=207,o.DstColorFactor=208,o.OneMinusDstColorFactor=209,o.SrcAlphaSaturateFactor=210,o.NeverDepth=0,o.AlwaysDepth=1,o.LessDepth=2,o.LessEqualDepth=3,o.EqualDepth=4,o.GreaterEqualDepth=5,o.GreaterDepth=6,o.NotEqualDepth=7,o.MultiplyOperation=0,o.MixOperation=1,o.AddOperation=2,o.UVMapping=300,o.CubeReflectionMapping=301,o.CubeRefractionMapping=302,o.EquirectangularReflectionMapping=303,o.EquirectangularRefractionMapping=304,o.SphericalReflectionMapping=305,o.RepeatWrapping=1e3,o.ClampToEdgeWrapping=1001,o.MirroredRepeatWrapping=1002,o.NearestFilter=1003,o.NearestMipMapNearestFilter=1004,o.NearestMipMapLinearFilter=1005,o.LinearFilter=1006,o.LinearMipMapNearestFilter=1007,o.LinearMipMapLinearFilter=1008,o.UnsignedByteType=1009,o.ByteType=1010,o.ShortType=1011,o.UnsignedShortType=1012,o.IntType=1013,o.UnsignedIntType=1014,o.FloatType=1015,o.HalfFloatType=1025,o.UnsignedShort4444Type=1016,o.UnsignedShort5551Type=1017,o.UnsignedShort565Type=1018,o.AlphaFormat=1019,o.RGBFormat=1020,o.RGBAFormat=1021,o.LuminanceFormat=1022,o.LuminanceAlphaFormat=1023,o.RGBEFormat=o.RGBAFormat,o.RGB_S3TC_DXT1_Format=2001,o.RGBA_S3TC_DXT1_Format=2002,o.RGBA_S3TC_DXT3_Format=2003,o.RGBA_S3TC_DXT5_Format=2004,o.RGB_PVRTC_4BPPV1_Format=2100,o.RGB_PVRTC_2BPPV1_Format=2101,o.RGBA_PVRTC_4BPPV1_Format=2102,o.RGBA_PVRTC_2BPPV1_Format=2103,o.Projector=function(){console.error("THREE.Projector has been moved to /examples/js/renderers/Projector.js."),this.projectVector=function(e,t){console.warn("THREE.Projector: .projectVector() is now vector.project()."),e.project(t)},this.unprojectVector=function(e,t){console.warn("THREE.Projector: .unprojectVector() is now vector.unproject()."),e.unproject(t)},this.pickingRay=function(e,t){console.error("THREE.Projector: .pickingRay() is now raycaster.setFromCamera().")}},o.CanvasRenderer=function(){console.error("THREE.CanvasRenderer has been moved to /examples/js/renderers/CanvasRenderer.js"),this.domElement=document.createElement("canvas"),this.clear=function(){},this.render=function(){},this.setClearColor=function(){},this.setSize=function(){}},o.Color=function(e){return 3===arguments.length?this.setRGB(arguments[0],arguments[1],arguments[2]):this.set(e)},o.Color.prototype={constructor:o.Color,r:1,g:1,b:1,set:function(e){return e instanceof o.Color?this.copy(e):"number"==typeof e?this.setHex(e):"string"==typeof e&&this.setStyle(e),this},setHex:function(e){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(255&e)/255,this},setRGB:function(e,t,r){return this.r=e,this.g=t,this.b=r,this},setHSL:function(){function e(e,t,r){return 0>r&&(r+=1),r>1&&(r-=1),1/6>r?e+6*(t-e)*r:.5>r?t:2/3>r?e+6*(t-e)*(2/3-r):e}return function(t,r,i){if(t=o.Math.euclideanModulo(t,1),r=o.Math.clamp(r,0,1),i=o.Math.clamp(i,0,1),0===r)this.r=this.g=this.b=i;else{var n=.5>=i?i*(1+r):i+r-i*r,a=2*i-n;this.r=e(a,n,t+1/3),this.g=e(a,n,t),this.b=e(a,n,t-1/3)}return this}}(),setStyle:function(e){var t,r=function(t){var r=parseFloat(t);return 1>r&&console.warn("THREE.Color: Alpha component of color "+e+" will be ignored."),r};if(t=/^((?:rgb|hsl)a?)\(\s*([^\)]*)\)/.exec(e)){var i,n=t[1],a=t[2];switch(n){case"rgb":if(i=/^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*$/.exec(a))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,this;if(i=/^(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*$/.exec(a))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,this;break;case"rgba":if(i=/^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*([0-9]*\.?[0-9]+)\s*$/.exec(a))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,r(i[4]),this;if(i=/^(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*([0-9]*\.?[0-9]+)\s*$/.exec(a))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,r(i[4]),this;break;case"hsl":if(i=/^([0-9]*\.?[0-9]+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*$/.exec(a)){var s=parseFloat(i[1]),h=parseInt(i[2],10)/100,c=parseInt(i[3],10)/100;return this.setHSL(s,h,c)}break;case"hsla":if(i=/^([0-9]*\.?[0-9]+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*([0-9]*\.?[0-9]+)\s*$/.exec(a)){var s=parseFloat(i[1]),h=parseInt(i[2],10)/100,c=parseInt(i[3],10)/100;return r(i[4]),this.setHSL(s,h,c)}}}else if(t=/^\#([A-Fa-f0-9]+)$/.exec(e)){var u=t[1],l=u.length;if(3===l)return this.r=parseInt(u.charAt(0)+u.charAt(0),16)/255,this.g=parseInt(u.charAt(1)+u.charAt(1),16)/255,this.b=parseInt(u.charAt(2)+u.charAt(2),16)/255,this;if(6===l)return this.r=parseInt(u.charAt(0)+u.charAt(1),16)/255,this.g=parseInt(u.charAt(2)+u.charAt(3),16)/255,this.b=parseInt(u.charAt(4)+u.charAt(5),16)/255,this}if(e&&e.length>0){var u=o.ColorKeywords[e];void 0!==u?this.setHex(u):console.warn("THREE.Color: Unknown color "+e)}return this},clone:function(){return new this.constructor(this.r,this.g,this.b)},copy:function(e){return this.r=e.r,this.g=e.g,this.b=e.b,this},copyGammaToLinear:function(e,t){return void 0===t&&(t=2),this.r=Math.pow(e.r,t),this.g=Math.pow(e.g,t),this.b=Math.pow(e.b,t),this},copyLinearToGamma:function(e,t){void 0===t&&(t=2);var r=t>0?1/t:1;return this.r=Math.pow(e.r,r),this.g=Math.pow(e.g,r),this.b=Math.pow(e.b,r),this},convertGammaToLinear:function(){var e=this.r,t=this.g,r=this.b;return this.r=e*e,this.g=t*t,this.b=r*r,this},convertLinearToGamma:function(){return this.r=Math.sqrt(this.r),this.g=Math.sqrt(this.g),this.b=Math.sqrt(this.b),this},getHex:function(){return 255*this.r<<16^255*this.g<<8^255*this.b<<0},getHexString:function(){return("000000"+this.getHex().toString(16)).slice(-6)},getHSL:function(e){var t,r,i=e||{h:0,s:0,l:0},n=this.r,o=this.g,a=this.b,s=Math.max(n,o,a),h=Math.min(n,o,a),c=(h+s)/2;if(h===s)t=0,r=0;else{var u=s-h;switch(r=.5>=c?u/(s+h):u/(2-s-h),s){case n:t=(o-a)/u+(a>o?6:0);break;case o:t=(a-n)/u+2;break;case a:t=(n-o)/u+4}t/=6}return i.h=t,i.s=r,i.l=c,i},getStyle:function(){return"rgb("+(255*this.r|0)+","+(255*this.g|0)+","+(255*this.b|0)+")"},offsetHSL:function(e,t,r){var i=this.getHSL();return i.h+=e,i.s+=t,i.l+=r,this.setHSL(i.h,i.s,i.l),this},add:function(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this},addColors:function(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this},addScalar:function(e){return this.r+=e,this.g+=e,this.b+=e,this},multiply:function(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this},multiplyScalar:function(e){return this.r*=e,this.g*=e,this.b*=e,this},lerp:function(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this},equals:function(e){return e.r===this.r&&e.g===this.g&&e.b===this.b},fromArray:function(e){return this.r=e[0],this.g=e[1],this.b=e[2],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}},o.ColorKeywords={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},o.Quaternion=function(e,t,r,i){this._x=e||0,this._y=t||0,this._z=r||0,this._w=void 0!==i?i:1},o.Quaternion.prototype={constructor:o.Quaternion,get x(){return this._x},set x(e){this._x=e,this.onChangeCallback()},get y(){return this._y},set y(e){this._y=e,this.onChangeCallback()},get z(){return this._z},set z(e){this._z=e,this.onChangeCallback()},get w(){return this._w},set w(e){this._w=e,this.onChangeCallback()},set:function(e,t,r,i){return this._x=e,this._y=t,this._z=r,this._w=i,this.onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._w)},copy:function(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this.onChangeCallback(),this},setFromEuler:function(e,t){if(e instanceof o.Euler==!1)throw new Error("THREE.Quaternion: .setFromEuler() now expects a Euler rotation rather than a Vector3 and order.");var r=Math.cos(e._x/2),i=Math.cos(e._y/2),n=Math.cos(e._z/2),a=Math.sin(e._x/2),s=Math.sin(e._y/2),h=Math.sin(e._z/2),c=e.order;return"XYZ"===c?(this._x=a*i*n+r*s*h,this._y=r*s*n-a*i*h,this._z=r*i*h+a*s*n,this._w=r*i*n-a*s*h):"YXZ"===c?(this._x=a*i*n+r*s*h,this._y=r*s*n-a*i*h,this._z=r*i*h-a*s*n,this._w=r*i*n+a*s*h):"ZXY"===c?(this._x=a*i*n-r*s*h,this._y=r*s*n+a*i*h,this._z=r*i*h+a*s*n,this._w=r*i*n-a*s*h):"ZYX"===c?(this._x=a*i*n-r*s*h,this._y=r*s*n+a*i*h,this._z=r*i*h-a*s*n,this._w=r*i*n+a*s*h):"YZX"===c?(this._x=a*i*n+r*s*h,this._y=r*s*n+a*i*h,this._z=r*i*h-a*s*n,this._w=r*i*n-a*s*h):"XZY"===c&&(this._x=a*i*n-r*s*h,this._y=r*s*n-a*i*h,this._z=r*i*h+a*s*n,this._w=r*i*n+a*s*h),t!==!1&&this.onChangeCallback(),this},setFromAxisAngle:function(e,t){var r=t/2,i=Math.sin(r);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(r),this.onChangeCallback(),this},setFromRotationMatrix:function(e){var t,r=e.elements,i=r[0],n=r[4],o=r[8],a=r[1],s=r[5],h=r[9],c=r[2],u=r[6],l=r[10],p=i+s+l;return p>0?(t=.5/Math.sqrt(p+1),this._w=.25/t,this._x=(u-h)*t,this._y=(o-c)*t,this._z=(a-n)*t):i>s&&i>l?(t=2*Math.sqrt(1+i-s-l),this._w=(u-h)/t,this._x=.25*t,this._y=(n+a)/t,this._z=(o+c)/t):s>l?(t=2*Math.sqrt(1+s-i-l),this._w=(o-c)/t,this._x=(n+a)/t,this._y=.25*t,this._z=(h+u)/t):(t=2*Math.sqrt(1+l-i-s),this._w=(a-n)/t,this._x=(o+c)/t,this._y=(h+u)/t,this._z=.25*t),this.onChangeCallback(),this},setFromUnitVectors:function(){var e,t,r=1e-6;return function(i,n){return void 0===e&&(e=new o.Vector3),t=i.dot(n)+1,r>t?(t=0,Math.abs(i.x)>Math.abs(i.z)?e.set(-i.y,i.x,0):e.set(0,-i.z,i.y)):e.crossVectors(i,n),this._x=e.x,this._y=e.y,this._z=e.z,this._w=t,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(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._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 e=this.length();return 0===e?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this.onChangeCallback(),this},multiply:function(e,t){return void 0!==t?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."), +this.multiplyQuaternions(e,t)):this.multiplyQuaternions(this,e)},multiplyQuaternions:function(e,t){var r=e._x,i=e._y,n=e._z,o=e._w,a=t._x,s=t._y,h=t._z,c=t._w;return this._x=r*c+o*a+i*h-n*s,this._y=i*c+o*s+n*a-r*h,this._z=n*c+o*h+r*s-i*a,this._w=o*c-r*a-i*s-n*h,this.onChangeCallback(),this},multiplyVector3:function(e){return console.warn("THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead."),e.applyQuaternion(this)},slerp:function(e,t){if(0===t)return this;if(1===t)return this.copy(e);var r=this._x,i=this._y,n=this._z,o=this._w,a=o*e._w+r*e._x+i*e._y+n*e._z;if(0>a?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,a=-a):this.copy(e),a>=1)return this._w=o,this._x=r,this._y=i,this._z=n,this;var s=Math.acos(a),h=Math.sqrt(1-a*a);if(Math.abs(h)<.001)return this._w=.5*(o+this._w),this._x=.5*(r+this._x),this._y=.5*(i+this._y),this._z=.5*(n+this._z),this;var c=Math.sin((1-t)*s)/h,u=Math.sin(t*s)/h;return this._w=o*c+this._w*u,this._x=r*c+this._x*u,this._y=i*c+this._y*u,this._z=n*c+this._z*u,this.onChangeCallback(),this},equals:function(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w},fromArray:function(e,t){return void 0===t&&(t=0),this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this.onChangeCallback(),this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e},onChange:function(e){return this.onChangeCallback=e,this},onChangeCallback:function(){}},o.Quaternion.slerp=function(e,t,r,i){return r.copy(e).slerp(t,i)},o.Vector2=function(e,t){this.x=e||0,this.y=t||0},o.Vector2.prototype={constructor:o.Vector2,set:function(e,t){return this.x=e,this.y=t,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setComponent:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}},getComponent:function(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}},clone:function(){return new this.constructor(this.x,this.y)},copy:function(e){return this.x=e.x,this.y=e.y,this},add:function(e,t){return void 0!==t?(console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this)},addScalar:function(e){return this.x+=e,this.y+=e,this},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this},addScaledVector:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this},sub:function(e,t){return void 0!==t?(console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this)},subScalar:function(e){return this.x-=e,this.y-=e,this},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this},multiply:function(e){return this.x*=e.x,this.y*=e.y,this},multiplyScalar:function(e){return this.x*=e,this.y*=e,this},divide:function(e){return this.x/=e.x,this.y/=e.y,this},divideScalar:function(e){if(0!==e){var t=1/e;this.x*=t,this.y*=t}else this.x=0,this.y=0;return this},min:function(e){return this.x>e.x&&(this.x=e.x),this.y>e.y&&(this.y=e.y),this},max:function(e){return this.xt.x&&(this.x=t.x),this.yt.y&&(this.y=t.y),this},clampScalar:function(){var e,t;return function(r,i){return void 0===e&&(e=new o.Vector2,t=new o.Vector2),e.set(r,r),t.set(i,i),this.clamp(e,t)}}(),floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this},negate:function(){return this.x=-this.x,this.y=-this.y,this},dot:function(e){return this.x*e.x+this.y*e.y},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)},normalize:function(){return this.divideScalar(this.length())},distanceTo:function(e){return Math.sqrt(this.distanceToSquared(e))},distanceToSquared:function(e){var t=this.x-e.x,r=this.y-e.y;return t*t+r*r},setLength:function(e){var t=this.length();return 0!==t&&e!==t&&this.multiplyScalar(e/t),this},lerp:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this},lerpVectors:function(e,t,r){return this.subVectors(t,e).multiplyScalar(r).add(e),this},equals:function(e){return e.x===this.x&&e.y===this.y},fromArray:function(e,t){return void 0===t&&(t=0),this.x=e[t],this.y=e[t+1],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.x,e[t+1]=this.y,e},fromAttribute:function(e,t,r){return void 0===r&&(r=0),t=t*e.itemSize+r,this.x=e.array[t],this.y=e.array[t+1],this}},o.Vector3=function(e,t,r){this.x=e||0,this.y=t||0,this.z=r||0},o.Vector3.prototype={constructor:o.Vector3,set:function(e,t,r){return this.x=e,this.y=t,this.z=r,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setZ:function(e){return this.z=e,this},setComponent:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}},getComponent:function(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}},clone:function(){return new this.constructor(this.x,this.y,this.z)},copy:function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this},add:function(e,t){return void 0!==t?(console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this.z+=e.z,this)},addScalar:function(e){return this.x+=e,this.y+=e,this.z+=e,this},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this},addScaledVector:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this},sub:function(e,t){return void 0!==t?(console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this.z-=e.z,this)},subScalar:function(e){return this.x-=e,this.y-=e,this.z-=e,this},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this},multiply:function(e,t){return void 0!==t?(console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(e,t)):(this.x*=e.x,this.y*=e.y,this.z*=e.z,this)},multiplyScalar:function(e){return this.x*=e,this.y*=e,this.z*=e,this},multiplyVectors:function(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this},applyEuler:function(){var e;return function(t){return t instanceof o.Euler==!1&&console.error("THREE.Vector3: .applyEuler() now expects a Euler rotation rather than a Vector3 and order."),void 0===e&&(e=new o.Quaternion),this.applyQuaternion(e.setFromEuler(t)),this}}(),applyAxisAngle:function(){var e;return function(t,r){return void 0===e&&(e=new o.Quaternion),this.applyQuaternion(e.setFromAxisAngle(t,r)),this}}(),applyMatrix3:function(e){var t=this.x,r=this.y,i=this.z,n=e.elements;return this.x=n[0]*t+n[3]*r+n[6]*i,this.y=n[1]*t+n[4]*r+n[7]*i,this.z=n[2]*t+n[5]*r+n[8]*i,this},applyMatrix4:function(e){var t=this.x,r=this.y,i=this.z,n=e.elements;return this.x=n[0]*t+n[4]*r+n[8]*i+n[12],this.y=n[1]*t+n[5]*r+n[9]*i+n[13],this.z=n[2]*t+n[6]*r+n[10]*i+n[14],this},applyProjection:function(e){var t=this.x,r=this.y,i=this.z,n=e.elements,o=1/(n[3]*t+n[7]*r+n[11]*i+n[15]);return this.x=(n[0]*t+n[4]*r+n[8]*i+n[12])*o,this.y=(n[1]*t+n[5]*r+n[9]*i+n[13])*o,this.z=(n[2]*t+n[6]*r+n[10]*i+n[14])*o,this},applyQuaternion:function(e){var t=this.x,r=this.y,i=this.z,n=e.x,o=e.y,a=e.z,s=e.w,h=s*t+o*i-a*r,c=s*r+a*t-n*i,u=s*i+n*r-o*t,l=-n*t-o*r-a*i;return this.x=h*s+l*-n+c*-a-u*-o,this.y=c*s+l*-o+u*-n-h*-a,this.z=u*s+l*-a+h*-o-c*-n,this},project:function(){var e;return function(t){return void 0===e&&(e=new o.Matrix4),e.multiplyMatrices(t.projectionMatrix,e.getInverse(t.matrixWorld)),this.applyProjection(e)}}(),unproject:function(){var e;return function(t){return void 0===e&&(e=new o.Matrix4),e.multiplyMatrices(t.matrixWorld,e.getInverse(t.projectionMatrix)),this.applyProjection(e)}}(),transformDirection:function(e){var t=this.x,r=this.y,i=this.z,n=e.elements;return this.x=n[0]*t+n[4]*r+n[8]*i,this.y=n[1]*t+n[5]*r+n[9]*i,this.z=n[2]*t+n[6]*r+n[10]*i,this.normalize(),this},divide:function(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this},divideScalar:function(e){if(0!==e){var t=1/e;this.x*=t,this.y*=t,this.z*=t}else this.x=0,this.y=0,this.z=0;return this},min:function(e){return this.x>e.x&&(this.x=e.x),this.y>e.y&&(this.y=e.y),this.z>e.z&&(this.z=e.z),this},max:function(e){return this.xt.x&&(this.x=t.x),this.yt.y&&(this.y=t.y),this.zt.z&&(this.z=t.z),this},clampScalar:function(){var e,t;return function(r,i){return void 0===e&&(e=new o.Vector3,t=new o.Vector3),e.set(r,r,r),t.set(i,i,i),this.clamp(e,t)}}(),floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},dot:function(e){return this.x*e.x+this.y*e.y+this.z*e.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)},normalize:function(){return this.divideScalar(this.length())},setLength:function(e){var t=this.length();return 0!==t&&e!==t&&this.multiplyScalar(e/t),this},lerp:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this},lerpVectors:function(e,t,r){return this.subVectors(t,e).multiplyScalar(r).add(e),this},cross:function(e,t){if(void 0!==t)return console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(e,t);var r=this.x,i=this.y,n=this.z;return this.x=i*e.z-n*e.y,this.y=n*e.x-r*e.z,this.z=r*e.y-i*e.x,this},crossVectors:function(e,t){var r=e.x,i=e.y,n=e.z,o=t.x,a=t.y,s=t.z;return this.x=i*s-n*a,this.y=n*o-r*s,this.z=r*a-i*o,this},projectOnVector:function(){var e,t;return function(r){return void 0===e&&(e=new o.Vector3),e.copy(r).normalize(),t=this.dot(e),this.copy(e).multiplyScalar(t)}}(),projectOnPlane:function(){var e;return function(t){return void 0===e&&(e=new o.Vector3),e.copy(this).projectOnVector(t),this.sub(e)}}(),reflect:function(){var e;return function(t){return void 0===e&&(e=new o.Vector3),this.sub(e.copy(t).multiplyScalar(2*this.dot(t)))}}(),angleTo:function(e){var t=this.dot(e)/(this.length()*e.length());return Math.acos(o.Math.clamp(t,-1,1))},distanceTo:function(e){return Math.sqrt(this.distanceToSquared(e))},distanceToSquared:function(e){var t=this.x-e.x,r=this.y-e.y,i=this.z-e.z;return t*t+r*r+i*i},setEulerFromRotationMatrix:function(e,t){console.error("THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.")},setEulerFromQuaternion:function(e,t){console.error("THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.")},getPositionFromMatrix:function(e){return console.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition()."),this.setFromMatrixPosition(e)},getScaleFromMatrix:function(e){return console.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale()."),this.setFromMatrixScale(e)},getColumnFromMatrix:function(e,t){return console.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn()."),this.setFromMatrixColumn(e,t)},setFromMatrixPosition:function(e){return this.x=e.elements[12],this.y=e.elements[13],this.z=e.elements[14],this},setFromMatrixScale:function(e){var t=this.set(e.elements[0],e.elements[1],e.elements[2]).length(),r=this.set(e.elements[4],e.elements[5],e.elements[6]).length(),i=this.set(e.elements[8],e.elements[9],e.elements[10]).length();return this.x=t,this.y=r,this.z=i,this},setFromMatrixColumn:function(e,t){var r=4*e,i=t.elements;return this.x=i[r],this.y=i[r+1],this.z=i[r+2],this},equals:function(e){return e.x===this.x&&e.y===this.y&&e.z===this.z},fromArray:function(e,t){return void 0===t&&(t=0),this.x=e[t],this.y=e[t+1],this.z=e[t+2],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e},fromAttribute:function(e,t,r){return void 0===r&&(r=0),t=t*e.itemSize+r,this.x=e.array[t],this.y=e.array[t+1],this.z=e.array[t+2],this}},o.Vector4=function(e,t,r,i){this.x=e||0,this.y=t||0,this.z=r||0,this.w=void 0!==i?i:1},o.Vector4.prototype={constructor:o.Vector4,set:function(e,t,r,i){return this.x=e,this.y=t,this.z=r,this.w=i,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setZ:function(e){return this.z=e,this},setW:function(e){return this.w=e,this},setComponent:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}},getComponent:function(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}},clone:function(){return new this.constructor(this.x,this.y,this.z,this.w)},copy:function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=void 0!==e.w?e.w:1,this},add:function(e,t){return void 0!==t?(console.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this)},addScalar:function(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this},addScaledVector:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this},sub:function(e,t){return void 0!==t?(console.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this)},subScalar:function(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this},multiplyScalar:function(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this},applyMatrix4:function(e){var t=this.x,r=this.y,i=this.z,n=this.w,o=e.elements;return this.x=o[0]*t+o[4]*r+o[8]*i+o[12]*n,this.y=o[1]*t+o[5]*r+o[9]*i+o[13]*n,this.z=o[2]*t+o[6]*r+o[10]*i+o[14]*n,this.w=o[3]*t+o[7]*r+o[11]*i+o[15]*n,this},divideScalar:function(e){if(0!==e){var t=1/e;this.x*=t,this.y*=t,this.z*=t,this.w*=t}else this.x=0,this.y=0,this.z=0,this.w=1;return this},setAxisAngleFromQuaternion:function(e){this.w=2*Math.acos(e.w);var t=Math.sqrt(1-e.w*e.w);return 1e-4>t?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this},setAxisAngleFromRotationMatrix:function(e){var t,r,i,n,o=.01,a=.1,s=e.elements,h=s[0],c=s[4],u=s[8],l=s[1],p=s[5],d=s[9],f=s[2],m=s[6],v=s[10];if(Math.abs(c-l)y&&g>x?o>g?(r=0,i=.707106781,n=.707106781):(r=Math.sqrt(g),i=b/r,n=w/r):y>x?o>y?(r=.707106781,i=0,n=.707106781):(i=Math.sqrt(y),r=b/i,n=M/i):o>x?(r=.707106781,i=.707106781,n=0):(n=Math.sqrt(x),r=w/n,i=M/n),this.set(r,i,n,t),this}var A=Math.sqrt((m-d)*(m-d)+(u-f)*(u-f)+(l-c)*(l-c));return Math.abs(A)<.001&&(A=1),this.x=(m-d)/A,this.y=(u-f)/A,this.z=(l-c)/A,this.w=Math.acos((h+p+v-1)/2),this},min:function(e){return this.x>e.x&&(this.x=e.x),this.y>e.y&&(this.y=e.y),this.z>e.z&&(this.z=e.z),this.w>e.w&&(this.w=e.w),this},max:function(e){return this.xt.x&&(this.x=t.x),this.yt.y&&(this.y=t.y),this.zt.z&&(this.z=t.z),this.wt.w&&(this.w=t.w),this},clampScalar:function(){var e,t;return function(r,i){return void 0===e&&(e=new o.Vector4,t=new o.Vector4),e.set(r,r,r,r),t.set(i,i,i,i),this.clamp(e,t)}}(),floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this.w=this.w<0?Math.ceil(this.w):Math.floor(this.w),this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this},dot:function(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.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)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)},normalize:function(){return this.divideScalar(this.length())},setLength:function(e){var t=this.length();return 0!==t&&e!==t&&this.multiplyScalar(e/t),this},lerp:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this},lerpVectors:function(e,t,r){return this.subVectors(t,e).multiplyScalar(r).add(e),this},equals:function(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w},fromArray:function(e,t){return void 0===t&&(t=0),this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e},fromAttribute:function(e,t,r){return void 0===r&&(r=0),t=t*e.itemSize+r,this.x=e.array[t],this.y=e.array[t+1],this.z=e.array[t+2],this.w=e.array[t+3],this}},o.Euler=function(e,t,r,i){this._x=e||0,this._y=t||0,this._z=r||0,this._order=i||o.Euler.DefaultOrder},o.Euler.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"],o.Euler.DefaultOrder="XYZ",o.Euler.prototype={constructor:o.Euler,get x(){return this._x},set x(e){this._x=e,this.onChangeCallback()},get y(){return this._y},set y(e){this._y=e,this.onChangeCallback()},get z(){return this._z},set z(e){this._z=e,this.onChangeCallback()},get order(){return this._order},set order(e){this._order=e,this.onChangeCallback()},set:function(e,t,r,i){return this._x=e,this._y=t,this._z=r,this._order=i||this._order,this.onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._order)},copy:function(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this.onChangeCallback(),this},setFromRotationMatrix:function(e,t,r){var i=o.Math.clamp,n=e.elements,a=n[0],s=n[4],h=n[8],c=n[1],u=n[5],l=n[9],p=n[2],d=n[6],f=n[10];return t=t||this._order,"XYZ"===t?(this._y=Math.asin(i(h,-1,1)),Math.abs(h)<.99999?(this._x=Math.atan2(-l,f),this._z=Math.atan2(-s,a)):(this._x=Math.atan2(d,u),this._z=0)):"YXZ"===t?(this._x=Math.asin(-i(l,-1,1)),Math.abs(l)<.99999?(this._y=Math.atan2(h,f),this._z=Math.atan2(c,u)):(this._y=Math.atan2(-p,a),this._z=0)):"ZXY"===t?(this._x=Math.asin(i(d,-1,1)),Math.abs(d)<.99999?(this._y=Math.atan2(-p,f),this._z=Math.atan2(-s,u)):(this._y=0,this._z=Math.atan2(c,a))):"ZYX"===t?(this._y=Math.asin(-i(p,-1,1)),Math.abs(p)<.99999?(this._x=Math.atan2(d,f),this._z=Math.atan2(c,a)):(this._x=0,this._z=Math.atan2(-s,u))):"YZX"===t?(this._z=Math.asin(i(c,-1,1)),Math.abs(c)<.99999?(this._x=Math.atan2(-l,u),this._y=Math.atan2(-p,a)):(this._x=0,this._y=Math.atan2(h,f))):"XZY"===t?(this._z=Math.asin(-i(s,-1,1)),Math.abs(s)<.99999?(this._x=Math.atan2(d,u),this._y=Math.atan2(h,a)):(this._x=Math.atan2(-l,f),this._y=0)):console.warn("THREE.Euler: .setFromRotationMatrix() given unsupported order: "+t),this._order=t,r!==!1&&this.onChangeCallback(),this},setFromQuaternion:function(){var e;return function(t,r,i){return void 0===e&&(e=new o.Matrix4),e.makeRotationFromQuaternion(t),this.setFromRotationMatrix(e,r,i),this}}(),setFromVector3:function(e,t){return this.set(e.x,e.y,e.z,t||this._order)},reorder:function(){var e=new o.Quaternion;return function(t){e.setFromEuler(this),this.setFromQuaternion(e,t)}}(),equals:function(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order},fromArray:function(e){return this._x=e[0],this._y=e[1],this._z=e[2],void 0!==e[3]&&(this._order=e[3]),this.onChangeCallback(),this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e},toVector3:function(e){return e?e.set(this._x,this._y,this._z):new o.Vector3(this._x,this._y,this._z)},onChange:function(e){return this.onChangeCallback=e,this},onChangeCallback:function(){}},o.Line3=function(e,t){this.start=void 0!==e?e:new o.Vector3,this.end=void 0!==t?t:new o.Vector3},o.Line3.prototype={constructor:o.Line3,set:function(e,t){return this.start.copy(e),this.end.copy(t),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.start.copy(e.start),this.end.copy(e.end),this},center:function(e){var t=e||new o.Vector3;return t.addVectors(this.start,this.end).multiplyScalar(.5)},delta:function(e){var t=e||new o.Vector3;return t.subVectors(this.end,this.start)},distanceSq:function(){return this.start.distanceToSquared(this.end)},distance:function(){return this.start.distanceTo(this.end)},at:function(e,t){var r=t||new o.Vector3;return this.delta(r).multiplyScalar(e).add(this.start)},closestPointToPointParameter:function(){var e=new o.Vector3,t=new o.Vector3;return function(r,i){e.subVectors(r,this.start),t.subVectors(this.end,this.start);var n=t.dot(t),a=t.dot(e),s=a/n;return i&&(s=o.Math.clamp(s,0,1)),s}}(),closestPointToPoint:function(e,t,r){var i=this.closestPointToPointParameter(e,t),n=r||new o.Vector3;return this.delta(n).multiplyScalar(i).add(this.start)},applyMatrix4:function(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this},equals:function(e){return e.start.equals(this.start)&&e.end.equals(this.end)}},o.Box2=function(e,t){this.min=void 0!==e?e:new o.Vector2(1/0,1/0),this.max=void 0!==t?t:new o.Vector2(-(1/0),-(1/0))},o.Box2.prototype={constructor:o.Box2,set:function(e,t){return this.min.copy(e),this.max.copy(t),this},setFromPoints:function(e){this.makeEmpty();for(var t=0,r=e.length;r>t;t++)this.expandByPoint(e[t]);return this},setFromCenterAndSize:function(){var e=new o.Vector2;return function(t,r){var i=e.copy(r).multiplyScalar(.5);return this.min.copy(t).sub(i),this.max.copy(t).add(i),this}}(),clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.min.copy(e.min),this.max.copy(e.max),this},makeEmpty:function(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-(1/0),this},empty:function(){return this.max.xthis.max.x||e.ythis.max.y?!1:!0},containsBox:function(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y?!0:!1},getParameter:function(e,t){var r=t||new o.Vector2;return r.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))},isIntersectionBox:function(e){return e.max.xthis.max.x||e.max.ythis.max.y?!1:!0},clampPoint:function(e,t){var r=t||new o.Vector2;return r.copy(e).clamp(this.min,this.max)},distanceToPoint:function(){var e=new o.Vector2;return function(t){var r=e.copy(t).clamp(this.min,this.max);return r.sub(t).length()}}(),intersect:function(e){return this.min.max(e.min),this.max.min(e.max),this},union:function(e){return this.min.min(e.min),this.max.max(e.max),this},translate:function(e){return this.min.add(e),this.max.add(e),this},equals:function(e){return e.min.equals(this.min)&&e.max.equals(this.max)}},o.Box3=function(e,t){this.min=void 0!==e?e:new o.Vector3(1/0,1/0,1/0),this.max=void 0!==t?t:new o.Vector3(-(1/0),-(1/0),-(1/0))},o.Box3.prototype={constructor:o.Box3,set:function(e,t){return this.min.copy(e),this.max.copy(t),this},setFromPoints:function(e){this.makeEmpty();for(var t=0,r=e.length;r>t;t++)this.expandByPoint(e[t]);return this},setFromCenterAndSize:function(){var e=new o.Vector3;return function(t,r){var i=e.copy(r).multiplyScalar(.5);return this.min.copy(t).sub(i),this.max.copy(t).add(i),this}}(),setFromObject:function(){var e=new o.Vector3;return function(t){var r=this;return t.updateMatrixWorld(!0),this.makeEmpty(),t.traverse(function(t){var i=t.geometry;if(void 0!==i)if(i instanceof o.Geometry)for(var n=i.vertices,a=0,s=n.length;s>a;a++)e.copy(n[a]),e.applyMatrix4(t.matrixWorld),r.expandByPoint(e);else if(i instanceof o.BufferGeometry&&void 0!==i.attributes.position)for(var h=i.attributes.position.array,a=0,s=h.length;s>a;a+=3)e.set(h[a],h[a+1],h[a+2]),e.applyMatrix4(t.matrixWorld),r.expandByPoint(e)}),this}}(),clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.min.copy(e.min),this.max.copy(e.max),this},makeEmpty:function(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-(1/0),this},empty:function(){return this.max.xthis.max.x||e.ythis.max.y||e.zthis.max.z?!1:!0},containsBox:function(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z?!0:!1},getParameter:function(e,t){var r=t||new o.Vector3;return r.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))},isIntersectionBox:function(e){return e.max.xthis.max.x||e.max.ythis.max.y||e.max.zthis.max.z?!1:!0},clampPoint:function(e,t){var r=t||new o.Vector3;return r.copy(e).clamp(this.min,this.max)},distanceToPoint:function(){var e=new o.Vector3;return function(t){var r=e.copy(t).clamp(this.min,this.max);return r.sub(t).length()}}(),getBoundingSphere:function(){var e=new o.Vector3;return function(t){var r=t||new o.Sphere;return r.center=this.center(),r.radius=.5*this.size(e).length(),r}}(),intersect:function(e){return this.min.max(e.min),this.max.min(e.max),this},union:function(e){return this.min.min(e.min),this.max.max(e.max),this},applyMatrix4:function(){var e=[new o.Vector3,new o.Vector3,new o.Vector3,new o.Vector3,new o.Vector3,new o.Vector3,new o.Vector3,new o.Vector3];return function(t){return e[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),e[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),e[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),e[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),e[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),e[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),e[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),e[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.makeEmpty(),this.setFromPoints(e),this}}(),translate:function(e){return this.min.add(e),this.max.add(e),this},equals:function(e){return e.min.equals(this.min)&&e.max.equals(this.max)}},o.Matrix3=function(){this.elements=new Float32Array([1,0,0,0,1,0,0,0,1]),arguments.length>0&&console.error("THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.")},o.Matrix3.prototype={constructor:o.Matrix3,set:function(e,t,r,i,n,o,a,s,h){var c=this.elements;return c[0]=e,c[3]=t,c[6]=r,c[1]=i,c[4]=n,c[7]=o,c[2]=a,c[5]=s,c[8]=h,this},identity:function(){return this.set(1,0,0,0,1,0,0,0,1),this},clone:function(){return(new this.constructor).fromArray(this.elements)},copy:function(e){var t=e.elements;return this.set(t[0],t[3],t[6],t[1],t[4],t[7],t[2],t[5],t[8]),this},multiplyVector3:function(e){return console.warn("THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead."),e.applyMatrix3(this)},multiplyVector3Array:function(e){return console.warn("THREE.Matrix3: .multiplyVector3Array() has been renamed. Use matrix.applyToVector3Array( array ) instead."),this.applyToVector3Array(e)},applyToVector3Array:function(){var e;return function(t,r,i){void 0===e&&(e=new o.Vector3),void 0===r&&(r=0),void 0===i&&(i=t.length);for(var n=0,a=r;i>n;n+=3,a+=3)e.fromArray(t,a),e.applyMatrix3(this),e.toArray(t,a);return t}}(),applyToBuffer:function(){var e;return function(t,r,i){void 0===e&&(e=new o.Vector3),void 0===r&&(r=0),void 0===i&&(i=t.length/t.itemSize);for(var n=0,a=r;i>n;n++,a++)e.x=t.getX(a),e.y=t.getY(a),e.z=t.getZ(a),e.applyMatrix3(this),t.setXYZ(e.x,e.y,e.z);return t}}(),multiplyScalar:function(e){var t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this},determinant:function(){var e=this.elements,t=e[0],r=e[1],i=e[2],n=e[3],o=e[4],a=e[5],s=e[6],h=e[7],c=e[8];return t*o*c-t*a*h-r*n*c+r*a*s+i*n*h-i*o*s},getInverse:function(e,t){var r=e.elements,i=this.elements;i[0]=r[10]*r[5]-r[6]*r[9],i[1]=-r[10]*r[1]+r[2]*r[9],i[2]=r[6]*r[1]-r[2]*r[5],i[3]=-r[10]*r[4]+r[6]*r[8],i[4]=r[10]*r[0]-r[2]*r[8],i[5]=-r[6]*r[0]+r[2]*r[4],i[6]=r[9]*r[4]-r[5]*r[8],i[7]=-r[9]*r[0]+r[1]*r[8],i[8]=r[5]*r[0]-r[1]*r[4];var n=r[0]*i[0]+r[1]*i[3]+r[2]*i[6];if(0===n){var o="Matrix3.getInverse(): can't invert matrix, determinant is 0";if(t)throw new Error(o);return console.warn(o),this.identity(),this}return this.multiplyScalar(1/n),this},transpose:function(){var e,t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this},flattenToArrayOffset:function(e,t){var r=this.elements;return e[t]=r[0],e[t+1]=r[1],e[t+2]=r[2],e[t+3]=r[3],e[t+4]=r[4],e[t+5]=r[5], +e[t+6]=r[6],e[t+7]=r[7],e[t+8]=r[8],e},getNormalMatrix:function(e){return this.getInverse(e).transpose(),this},transposeIntoArray:function(e){var t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this},fromArray:function(e){return this.elements.set(e),this},toArray:function(){var e=this.elements;return[e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8]]}},o.Matrix4=function(){this.elements=new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),arguments.length>0&&console.error("THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.")},o.Matrix4.prototype={constructor:o.Matrix4,set:function(e,t,r,i,n,o,a,s,h,c,u,l,p,d,f,m){var v=this.elements;return v[0]=e,v[4]=t,v[8]=r,v[12]=i,v[1]=n,v[5]=o,v[9]=a,v[13]=s,v[2]=h,v[6]=c,v[10]=u,v[14]=l,v[3]=p,v[7]=d,v[11]=f,v[15]=m,this},identity:function(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this},clone:function(){return(new o.Matrix4).fromArray(this.elements)},copy:function(e){return this.elements.set(e.elements),this},extractPosition:function(e){return console.warn("THREE.Matrix4: .extractPosition() has been renamed to .copyPosition()."),this.copyPosition(e)},copyPosition:function(e){var t=this.elements,r=e.elements;return t[12]=r[12],t[13]=r[13],t[14]=r[14],this},extractBasis:function(e,t,r){var i=this.elements;return e.set(i[0],i[1],i[2]),t.set(i[4],i[5],i[6]),r.set(i[8],i[9],i[10]),this},makeBasis:function(e,t,r){return this.set(e.x,t.x,r.x,0,e.y,t.y,r.y,0,e.z,t.z,r.z,0,0,0,0,1),this},extractRotation:function(){var e;return function(t){void 0===e&&(e=new o.Vector3);var r=this.elements,i=t.elements,n=1/e.set(i[0],i[1],i[2]).length(),a=1/e.set(i[4],i[5],i[6]).length(),s=1/e.set(i[8],i[9],i[10]).length();return r[0]=i[0]*n,r[1]=i[1]*n,r[2]=i[2]*n,r[4]=i[4]*a,r[5]=i[5]*a,r[6]=i[6]*a,r[8]=i[8]*s,r[9]=i[9]*s,r[10]=i[10]*s,this}}(),makeRotationFromEuler:function(e){e instanceof o.Euler==!1&&console.error("THREE.Matrix: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");var t=this.elements,r=e.x,i=e.y,n=e.z,a=Math.cos(r),s=Math.sin(r),h=Math.cos(i),c=Math.sin(i),u=Math.cos(n),l=Math.sin(n);if("XYZ"===e.order){var p=a*u,d=a*l,f=s*u,m=s*l;t[0]=h*u,t[4]=-h*l,t[8]=c,t[1]=d+f*c,t[5]=p-m*c,t[9]=-s*h,t[2]=m-p*c,t[6]=f+d*c,t[10]=a*h}else if("YXZ"===e.order){var v=h*u,g=h*l,y=c*u,x=c*l;t[0]=v+x*s,t[4]=y*s-g,t[8]=a*c,t[1]=a*l,t[5]=a*u,t[9]=-s,t[2]=g*s-y,t[6]=x+v*s,t[10]=a*h}else if("ZXY"===e.order){var v=h*u,g=h*l,y=c*u,x=c*l;t[0]=v-x*s,t[4]=-a*l,t[8]=y+g*s,t[1]=g+y*s,t[5]=a*u,t[9]=x-v*s,t[2]=-a*c,t[6]=s,t[10]=a*h}else if("ZYX"===e.order){var p=a*u,d=a*l,f=s*u,m=s*l;t[0]=h*u,t[4]=f*c-d,t[8]=p*c+m,t[1]=h*l,t[5]=m*c+p,t[9]=d*c-f,t[2]=-c,t[6]=s*h,t[10]=a*h}else if("YZX"===e.order){var b=a*h,w=a*c,M=s*h,A=s*c;t[0]=h*u,t[4]=A-b*l,t[8]=M*l+w,t[1]=l,t[5]=a*u,t[9]=-s*u,t[2]=-c*u,t[6]=w*l+M,t[10]=b-A*l}else if("XZY"===e.order){var b=a*h,w=a*c,M=s*h,A=s*c;t[0]=h*u,t[4]=-l,t[8]=c*u,t[1]=b*l+A,t[5]=a*u,t[9]=w*l-M,t[2]=M*l-w,t[6]=s*u,t[10]=A*l+b}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this},setRotationFromQuaternion:function(e){return console.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion()."),this.makeRotationFromQuaternion(e)},makeRotationFromQuaternion:function(e){var t=this.elements,r=e.x,i=e.y,n=e.z,o=e.w,a=r+r,s=i+i,h=n+n,c=r*a,u=r*s,l=r*h,p=i*s,d=i*h,f=n*h,m=o*a,v=o*s,g=o*h;return t[0]=1-(p+f),t[4]=u-g,t[8]=l+v,t[1]=u+g,t[5]=1-(c+f),t[9]=d-m,t[2]=l-v,t[6]=d+m,t[10]=1-(c+p),t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this},lookAt:function(){var e,t,r;return function(i,n,a){void 0===e&&(e=new o.Vector3),void 0===t&&(t=new o.Vector3),void 0===r&&(r=new o.Vector3);var s=this.elements;return r.subVectors(i,n).normalize(),0===r.length()&&(r.z=1),e.crossVectors(a,r).normalize(),0===e.length()&&(r.x+=1e-4,e.crossVectors(a,r).normalize()),t.crossVectors(r,e),s[0]=e.x,s[4]=t.x,s[8]=r.x,s[1]=e.y,s[5]=t.y,s[9]=r.y,s[2]=e.z,s[6]=t.z,s[10]=r.z,this}}(),multiply:function(e,t){return void 0!==t?(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(e,t)):this.multiplyMatrices(this,e)},multiplyMatrices:function(e,t){var r=e.elements,i=t.elements,n=this.elements,o=r[0],a=r[4],s=r[8],h=r[12],c=r[1],u=r[5],l=r[9],p=r[13],d=r[2],f=r[6],m=r[10],v=r[14],g=r[3],y=r[7],x=r[11],b=r[15],w=i[0],M=i[4],A=i[8],S=i[12],_=i[1],E=i[5],T=i[9],C=i[13],L=i[2],P=i[6],R=i[10],D=i[14],F=i[3],O=i[7],U=i[11],k=i[15];return n[0]=o*w+a*_+s*L+h*F,n[4]=o*M+a*E+s*P+h*O,n[8]=o*A+a*T+s*R+h*U,n[12]=o*S+a*C+s*D+h*k,n[1]=c*w+u*_+l*L+p*F,n[5]=c*M+u*E+l*P+p*O,n[9]=c*A+u*T+l*R+p*U,n[13]=c*S+u*C+l*D+p*k,n[2]=d*w+f*_+m*L+v*F,n[6]=d*M+f*E+m*P+v*O,n[10]=d*A+f*T+m*R+v*U,n[14]=d*S+f*C+m*D+v*k,n[3]=g*w+y*_+x*L+b*F,n[7]=g*M+y*E+x*P+b*O,n[11]=g*A+y*T+x*R+b*U,n[15]=g*S+y*C+x*D+b*k,this},multiplyToArray:function(e,t,r){var i=this.elements;return this.multiplyMatrices(e,t),r[0]=i[0],r[1]=i[1],r[2]=i[2],r[3]=i[3],r[4]=i[4],r[5]=i[5],r[6]=i[6],r[7]=i[7],r[8]=i[8],r[9]=i[9],r[10]=i[10],r[11]=i[11],r[12]=i[12],r[13]=i[13],r[14]=i[14],r[15]=i[15],this},multiplyScalar:function(e){var t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this},multiplyVector3:function(e){return console.warn("THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) or vector.applyProjection( matrix ) instead."),e.applyProjection(this)},multiplyVector4:function(e){return console.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead."),e.applyMatrix4(this)},multiplyVector3Array:function(e){return console.warn("THREE.Matrix4: .multiplyVector3Array() has been renamed. Use matrix.applyToVector3Array( array ) instead."),this.applyToVector3Array(e)},applyToVector3Array:function(){var e;return function(t,r,i){void 0===e&&(e=new o.Vector3),void 0===r&&(r=0),void 0===i&&(i=t.length);for(var n=0,a=r;i>n;n+=3,a+=3)e.fromArray(t,a),e.applyMatrix4(this),e.toArray(t,a);return t}}(),applyToBuffer:function(){var e;return function(t,r,i){void 0===e&&(e=new o.Vector3),void 0===r&&(r=0),void 0===i&&(i=t.length/t.itemSize);for(var n=0,a=r;i>n;n++,a++)e.x=t.getX(a),e.y=t.getY(a),e.z=t.getZ(a),e.applyMatrix4(this),t.setXYZ(e.x,e.y,e.z);return t}}(),rotateAxis:function(e){console.warn("THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead."),e.transformDirection(this)},crossVector:function(e){return console.warn("THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead."),e.applyMatrix4(this)},determinant:function(){var e=this.elements,t=e[0],r=e[4],i=e[8],n=e[12],o=e[1],a=e[5],s=e[9],h=e[13],c=e[2],u=e[6],l=e[10],p=e[14],d=e[3],f=e[7],m=e[11],v=e[15];return d*(+n*s*u-i*h*u-n*a*l+r*h*l+i*a*p-r*s*p)+f*(+t*s*p-t*h*l+n*o*l-i*o*p+i*h*c-n*s*c)+m*(+t*h*u-t*a*p-n*o*u+r*o*p+n*a*c-r*h*c)+v*(-i*a*c-t*s*u+t*a*l+i*o*u-r*o*l+r*s*c)},transpose:function(){var e,t=this.elements;return e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this},flattenToArrayOffset:function(e,t){var r=this.elements;return e[t]=r[0],e[t+1]=r[1],e[t+2]=r[2],e[t+3]=r[3],e[t+4]=r[4],e[t+5]=r[5],e[t+6]=r[6],e[t+7]=r[7],e[t+8]=r[8],e[t+9]=r[9],e[t+10]=r[10],e[t+11]=r[11],e[t+12]=r[12],e[t+13]=r[13],e[t+14]=r[14],e[t+15]=r[15],e},getPosition:function(){var e;return function(){void 0===e&&(e=new o.Vector3),console.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead.");var t=this.elements;return e.set(t[12],t[13],t[14])}}(),setPosition:function(e){var t=this.elements;return t[12]=e.x,t[13]=e.y,t[14]=e.z,this},getInverse:function(e,t){var r=this.elements,i=e.elements,n=i[0],o=i[4],a=i[8],s=i[12],h=i[1],c=i[5],u=i[9],l=i[13],p=i[2],d=i[6],f=i[10],m=i[14],v=i[3],g=i[7],y=i[11],x=i[15];r[0]=u*m*g-l*f*g+l*d*y-c*m*y-u*d*x+c*f*x,r[4]=s*f*g-a*m*g-s*d*y+o*m*y+a*d*x-o*f*x,r[8]=a*l*g-s*u*g+s*c*y-o*l*y-a*c*x+o*u*x,r[12]=s*u*d-a*l*d-s*c*f+o*l*f+a*c*m-o*u*m,r[1]=l*f*v-u*m*v-l*p*y+h*m*y+u*p*x-h*f*x,r[5]=a*m*v-s*f*v+s*p*y-n*m*y-a*p*x+n*f*x,r[9]=s*u*v-a*l*v-s*h*y+n*l*y+a*h*x-n*u*x,r[13]=a*l*p-s*u*p+s*h*f-n*l*f-a*h*m+n*u*m,r[2]=c*m*v-l*d*v+l*p*g-h*m*g-c*p*x+h*d*x,r[6]=s*d*v-o*m*v-s*p*g+n*m*g+o*p*x-n*d*x,r[10]=o*l*v-s*c*v+s*h*g-n*l*g-o*h*x+n*c*x,r[14]=s*c*p-o*l*p-s*h*d+n*l*d+o*h*m-n*c*m,r[3]=u*d*v-c*f*v-u*p*g+h*f*g+c*p*y-h*d*y,r[7]=o*f*v-a*d*v+a*p*g-n*f*g-o*p*y+n*d*y,r[11]=a*c*v-o*u*v-a*h*g+n*u*g+o*h*y-n*c*y,r[15]=o*u*p-a*c*p+a*h*d-n*u*d-o*h*f+n*c*f;var b=n*r[0]+h*r[4]+p*r[8]+v*r[12];if(0===b){var w="THREE.Matrix4.getInverse(): can't invert matrix, determinant is 0";if(t)throw new Error(w);return console.warn(w),this.identity(),this}return this.multiplyScalar(1/b),this},translate:function(e){console.error("THREE.Matrix4: .translate() has been removed.")},rotateX:function(e){console.error("THREE.Matrix4: .rotateX() has been removed.")},rotateY:function(e){console.error("THREE.Matrix4: .rotateY() has been removed.")},rotateZ:function(e){console.error("THREE.Matrix4: .rotateZ() has been removed.")},rotateByAxis:function(e,t){console.error("THREE.Matrix4: .rotateByAxis() has been removed.")},scale:function(e){var t=this.elements,r=e.x,i=e.y,n=e.z;return t[0]*=r,t[4]*=i,t[8]*=n,t[1]*=r,t[5]*=i,t[9]*=n,t[2]*=r,t[6]*=i,t[10]*=n,t[3]*=r,t[7]*=i,t[11]*=n,this},getMaxScaleOnAxis:function(){var e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],r=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],i=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,Math.max(r,i)))},makeTranslation:function(e,t,r){return this.set(1,0,0,e,0,1,0,t,0,0,1,r,0,0,0,1),this},makeRotationX:function(e){var t=Math.cos(e),r=Math.sin(e);return this.set(1,0,0,0,0,t,-r,0,0,r,t,0,0,0,0,1),this},makeRotationY:function(e){var t=Math.cos(e),r=Math.sin(e);return this.set(t,0,r,0,0,1,0,0,-r,0,t,0,0,0,0,1),this},makeRotationZ:function(e){var t=Math.cos(e),r=Math.sin(e);return this.set(t,-r,0,0,r,t,0,0,0,0,1,0,0,0,0,1),this},makeRotationAxis:function(e,t){var r=Math.cos(t),i=Math.sin(t),n=1-r,o=e.x,a=e.y,s=e.z,h=n*o,c=n*a;return this.set(h*o+r,h*a-i*s,h*s+i*a,0,h*a+i*s,c*a+r,c*s-i*o,0,h*s-i*a,c*s+i*o,n*s*s+r,0,0,0,0,1),this},makeScale:function(e,t,r){return this.set(e,0,0,0,0,t,0,0,0,0,r,0,0,0,0,1),this},compose:function(e,t,r){return this.makeRotationFromQuaternion(t),this.scale(r),this.setPosition(e),this},decompose:function(){var e,t;return function(r,i,n){void 0===e&&(e=new o.Vector3),void 0===t&&(t=new o.Matrix4);var a=this.elements,s=e.set(a[0],a[1],a[2]).length(),h=e.set(a[4],a[5],a[6]).length(),c=e.set(a[8],a[9],a[10]).length(),u=this.determinant();0>u&&(s=-s),r.x=a[12],r.y=a[13],r.z=a[14],t.elements.set(this.elements);var l=1/s,p=1/h,d=1/c;return t.elements[0]*=l,t.elements[1]*=l,t.elements[2]*=l,t.elements[4]*=p,t.elements[5]*=p,t.elements[6]*=p,t.elements[8]*=d,t.elements[9]*=d,t.elements[10]*=d,i.setFromRotationMatrix(t),n.x=s,n.y=h,n.z=c,this}}(),makeFrustum:function(e,t,r,i,n,o){var a=this.elements,s=2*n/(t-e),h=2*n/(i-r),c=(t+e)/(t-e),u=(i+r)/(i-r),l=-(o+n)/(o-n),p=-2*o*n/(o-n);return a[0]=s,a[4]=0,a[8]=c,a[12]=0,a[1]=0,a[5]=h,a[9]=u,a[13]=0,a[2]=0,a[6]=0,a[10]=l,a[14]=p,a[3]=0,a[7]=0,a[11]=-1,a[15]=0,this},makePerspective:function(e,t,r,i){var n=r*Math.tan(o.Math.degToRad(.5*e)),a=-n,s=a*t,h=n*t;return this.makeFrustum(s,h,a,n,r,i)},makeOrthographic:function(e,t,r,i,n,o){var a=this.elements,s=t-e,h=r-i,c=o-n,u=(t+e)/s,l=(r+i)/h,p=(o+n)/c;return a[0]=2/s,a[4]=0,a[8]=0,a[12]=-u,a[1]=0,a[5]=2/h,a[9]=0,a[13]=-l,a[2]=0,a[6]=0,a[10]=-2/c,a[14]=-p,a[3]=0,a[7]=0,a[11]=0,a[15]=1,this},equals:function(e){for(var t=this.elements,r=e.elements,i=0;16>i;i++)if(t[i]!==r[i])return!1;return!0},fromArray:function(e){return this.elements.set(e),this},toArray:function(){var e=this.elements;return[e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15]]}},o.Ray=function(e,t){this.origin=void 0!==e?e:new o.Vector3,this.direction=void 0!==t?t:new o.Vector3},o.Ray.prototype={constructor:o.Ray,set:function(e,t){return this.origin.copy(e),this.direction.copy(t),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this},at:function(e,t){var r=t||new o.Vector3;return r.copy(this.direction).multiplyScalar(e).add(this.origin)},recast:function(){var e=new o.Vector3;return function(t){return this.origin.copy(this.at(t,e)),this}}(),closestPointToPoint:function(e,t){var r=t||new o.Vector3;r.subVectors(e,this.origin);var i=r.dot(this.direction);return 0>i?r.copy(this.origin):r.copy(this.direction).multiplyScalar(i).add(this.origin)},distanceToPoint:function(e){return Math.sqrt(this.distanceSqToPoint(e))},distanceSqToPoint:function(){var e=new o.Vector3;return function(t){var r=e.subVectors(t,this.origin).dot(this.direction);return 0>r?this.origin.distanceToSquared(t):(e.copy(this.direction).multiplyScalar(r).add(this.origin),e.distanceToSquared(t))}}(),distanceSqToSegment:function(){var e=new o.Vector3,t=new o.Vector3,r=new o.Vector3;return function(i,n,o,a){e.copy(i).add(n).multiplyScalar(.5),t.copy(n).sub(i).normalize(),r.copy(this.origin).sub(e);var s,h,c,u,l=.5*i.distanceTo(n),p=-this.direction.dot(t),d=r.dot(this.direction),f=-r.dot(t),m=r.lengthSq(),v=Math.abs(1-p*p);if(v>0)if(s=p*f-d,h=p*d-f,u=l*v,s>=0)if(h>=-u)if(u>=h){var g=1/v;s*=g,h*=g,c=s*(s+p*h+2*d)+h*(p*s+h+2*f)+m}else h=l,s=Math.max(0,-(p*h+d)),c=-s*s+h*(h+2*f)+m;else h=-l,s=Math.max(0,-(p*h+d)),c=-s*s+h*(h+2*f)+m;else-u>=h?(s=Math.max(0,-(-p*l+d)),h=s>0?-l:Math.min(Math.max(-l,-f),l),c=-s*s+h*(h+2*f)+m):u>=h?(s=0,h=Math.min(Math.max(-l,-f),l),c=h*(h+2*f)+m):(s=Math.max(0,-(p*l+d)),h=s>0?l:Math.min(Math.max(-l,-f),l),c=-s*s+h*(h+2*f)+m);else h=p>0?-l:l,s=Math.max(0,-(p*h+d)),c=-s*s+h*(h+2*f)+m;return o&&o.copy(this.direction).multiplyScalar(s).add(this.origin),a&&a.copy(t).multiplyScalar(h).add(e),c}}(),isIntersectionSphere:function(e){return this.distanceToPoint(e.center)<=e.radius},intersectSphere:function(){var e=new o.Vector3;return function(t,r){e.subVectors(t.center,this.origin);var i=e.dot(this.direction),n=e.dot(e)-i*i,o=t.radius*t.radius;if(n>o)return null;var a=Math.sqrt(o-n),s=i-a,h=i+a;return 0>s&&0>h?null:0>s?this.at(h,r):this.at(s,r)}}(),isIntersectionPlane:function(e){var t=e.distanceToPoint(this.origin);if(0===t)return!0;var r=e.normal.dot(this.direction);return 0>r*t?!0:!1},distanceToPlane:function(e){var t=e.normal.dot(this.direction);if(0===t)return 0===e.distanceToPoint(this.origin)?0:null;var r=-(this.origin.dot(e.normal)+e.constant)/t;return r>=0?r:null},intersectPlane:function(e,t){var r=this.distanceToPlane(e);return null===r?null:this.at(r,t)},isIntersectionBox:function(){var e=new o.Vector3;return function(t){return null!==this.intersectBox(t,e)}}(),intersectBox:function(e,t){var r,i,n,o,a,s,h=1/this.direction.x,c=1/this.direction.y,u=1/this.direction.z,l=this.origin;return h>=0?(r=(e.min.x-l.x)*h,i=(e.max.x-l.x)*h):(r=(e.max.x-l.x)*h,i=(e.min.x-l.x)*h),c>=0?(n=(e.min.y-l.y)*c,o=(e.max.y-l.y)*c):(n=(e.max.y-l.y)*c,o=(e.min.y-l.y)*c),r>o||n>i?null:((n>r||r!==r)&&(r=n),(i>o||i!==i)&&(i=o),u>=0?(a=(e.min.z-l.z)*u,s=(e.max.z-l.z)*u):(a=(e.max.z-l.z)*u,s=(e.min.z-l.z)*u),r>s||a>i?null:((a>r||r!==r)&&(r=a),(i>s||i!==i)&&(i=s),0>i?null:this.at(r>=0?r:i,t)))},intersectTriangle:function(){var e=new o.Vector3,t=new o.Vector3,r=new o.Vector3,i=new o.Vector3;return function(n,o,a,s,h){t.subVectors(o,n),r.subVectors(a,n),i.crossVectors(t,r);var c,u=this.direction.dot(i);if(u>0){if(s)return null;c=1}else{if(!(0>u))return null;c=-1,u=-u}e.subVectors(this.origin,n);var l=c*this.direction.dot(r.crossVectors(e,r));if(0>l)return null;var p=c*this.direction.dot(t.cross(e));if(0>p)return null;if(l+p>u)return null;var d=-c*e.dot(i);return 0>d?null:this.at(d/u,h)}}(),applyMatrix4:function(e){return this.direction.add(this.origin).applyMatrix4(e),this.origin.applyMatrix4(e),this.direction.sub(this.origin),this.direction.normalize(),this},equals:function(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}},o.Sphere=function(e,t){this.center=void 0!==e?e:new o.Vector3,this.radius=void 0!==t?t:0},o.Sphere.prototype={constructor:o.Sphere,set:function(e,t){return this.center.copy(e),this.radius=t,this},setFromPoints:function(){var e=new o.Box3;return function(t,r){var i=this.center;void 0!==r?i.copy(r):e.setFromPoints(t).center(i);for(var n=0,o=0,a=t.length;a>o;o++)n=Math.max(n,i.distanceToSquared(t[o]));return this.radius=Math.sqrt(n),this}}(),clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.center.copy(e.center),this.radius=e.radius,this},empty:function(){return this.radius<=0},containsPoint:function(e){return e.distanceToSquared(this.center)<=this.radius*this.radius},distanceToPoint:function(e){return e.distanceTo(this.center)-this.radius},intersectsSphere:function(e){var t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t},clampPoint:function(e,t){var r=this.center.distanceToSquared(e),i=t||new o.Vector3;return i.copy(e),r>this.radius*this.radius&&(i.sub(this.center).normalize(),i.multiplyScalar(this.radius).add(this.center)),i},getBoundingBox:function(e){var t=e||new o.Box3;return t.set(this.center,this.center),t.expandByScalar(this.radius),t},applyMatrix4:function(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this},translate:function(e){return this.center.add(e),this},equals:function(e){return e.center.equals(this.center)&&e.radius===this.radius}},o.Frustum=function(e,t,r,i,n,a){this.planes=[void 0!==e?e:new o.Plane,void 0!==t?t:new o.Plane,void 0!==r?r:new o.Plane,void 0!==i?i:new o.Plane,void 0!==n?n:new o.Plane,void 0!==a?a:new o.Plane]},o.Frustum.prototype={constructor:o.Frustum,set:function(e,t,r,i,n,o){var a=this.planes;return a[0].copy(e),a[1].copy(t),a[2].copy(r),a[3].copy(i),a[4].copy(n),a[5].copy(o),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){for(var t=this.planes,r=0;6>r;r++)t[r].copy(e.planes[r]);return this},setFromMatrix:function(e){var t=this.planes,r=e.elements,i=r[0],n=r[1],o=r[2],a=r[3],s=r[4],h=r[5],c=r[6],u=r[7],l=r[8],p=r[9],d=r[10],f=r[11],m=r[12],v=r[13],g=r[14],y=r[15];return t[0].setComponents(a-i,u-s,f-l,y-m).normalize(),t[1].setComponents(a+i,u+s,f+l,y+m).normalize(),t[2].setComponents(a+n,u+h,f+p,y+v).normalize(),t[3].setComponents(a-n,u-h,f-p,y-v).normalize(),t[4].setComponents(a-o,u-c,f-d,y-g).normalize(),t[5].setComponents(a+o,u+c,f+d,y+g).normalize(),this},intersectsObject:function(){var e=new o.Sphere;return function(t){var r=t.geometry;return null===r.boundingSphere&&r.computeBoundingSphere(),e.copy(r.boundingSphere),e.applyMatrix4(t.matrixWorld),this.intersectsSphere(e)}}(),intersectsSphere:function(e){for(var t=this.planes,r=e.center,i=-e.radius,n=0;6>n;n++){var o=t[n].distanceToPoint(r);if(i>o)return!1}return!0},intersectsBox:function(){var e=new o.Vector3,t=new o.Vector3;return function(r){for(var i=this.planes,n=0;6>n;n++){var o=i[n];e.x=o.normal.x>0?r.min.x:r.max.x,t.x=o.normal.x>0?r.max.x:r.min.x,e.y=o.normal.y>0?r.min.y:r.max.y,t.y=o.normal.y>0?r.max.y:r.min.y,e.z=o.normal.z>0?r.min.z:r.max.z,t.z=o.normal.z>0?r.max.z:r.min.z;var a=o.distanceToPoint(e),s=o.distanceToPoint(t);if(0>a&&0>s)return!1}return!0}}(),containsPoint:function(e){for(var t=this.planes,r=0;6>r;r++)if(t[r].distanceToPoint(e)<0)return!1;return!0}},o.Plane=function(e,t){this.normal=void 0!==e?e:new o.Vector3(1,0,0),this.constant=void 0!==t?t:0},o.Plane.prototype={constructor:o.Plane,set:function(e,t){return this.normal.copy(e),this.constant=t,this},setComponents:function(e,t,r,i){return this.normal.set(e,t,r),this.constant=i,this},setFromNormalAndCoplanarPoint:function(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this},setFromCoplanarPoints:function(){var e=new o.Vector3,t=new o.Vector3;return function(r,i,n){var o=e.subVectors(n,i).cross(t.subVectors(r,i)).normalize();return this.setFromNormalAndCoplanarPoint(o,r),this}}(),clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.normal.copy(e.normal),this.constant=e.constant,this},normalize:function(){var e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this},negate:function(){return this.constant*=-1,this.normal.negate(),this},distanceToPoint:function(e){return this.normal.dot(e)+this.constant},distanceToSphere:function(e){return this.distanceToPoint(e.center)-e.radius},projectPoint:function(e,t){return this.orthoPoint(e,t).sub(e).negate()},orthoPoint:function(e,t){var r=this.distanceToPoint(e),i=t||new o.Vector3;return i.copy(this.normal).multiplyScalar(r)},isIntersectionLine:function(e){var t=this.distanceToPoint(e.start),r=this.distanceToPoint(e.end);return 0>t&&r>0||0>r&&t>0},intersectLine:function(){var e=new o.Vector3;return function(t,r){var i=r||new o.Vector3,n=t.delta(e),a=this.normal.dot(n);if(0===a)return 0===this.distanceToPoint(t.start)?i.copy(t.start):void 0;var s=-(t.start.dot(this.normal)+this.constant)/a;return 0>s||s>1?void 0:i.copy(n).multiplyScalar(s).add(t.start)}}(),coplanarPoint:function(e){var t=e||new o.Vector3;return t.copy(this.normal).multiplyScalar(-this.constant)},applyMatrix4:function(){var e=new o.Vector3,t=new o.Vector3,r=new o.Matrix3;return function(i,n){var o=n||r.getNormalMatrix(i),a=e.copy(this.normal).applyMatrix3(o),s=this.coplanarPoint(t);return s.applyMatrix4(i),this.setFromNormalAndCoplanarPoint(a,s),this}}(),translate:function(e){return this.constant=this.constant-e.dot(this.normal),this},equals:function(e){return e.normal.equals(this.normal)&&e.constant===this.constant}},o.Math={generateUUID:function(){var e,t="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),r=new Array(36),i=0;return function(){for(var n=0;36>n;n++)8===n||13===n||18===n||23===n?r[n]="-":14===n?r[n]="4":(2>=i&&(i=33554432+16777216*Math.random()|0),e=15&i,i>>=4,r[n]=t[19===n?3&e|8:e]);return r.join("")}}(),clamp:function(e,t,r){return t>e?t:e>r?r:e},clampBottom:function(e,t){return t>e?t:e},euclideanModulo:function(e,t){return(e%t+t)%t},mapLinear:function(e,t,r,i,n){return i+(e-t)*(n-i)/(r-t)},smoothstep:function(e,t,r){return t>=e?0:e>=r?1:(e=(e-t)/(r-t),e*e*(3-2*e))},smootherstep:function(e,t,r){return t>=e?0:e>=r?1:(e=(e-t)/(r-t),e*e*e*(e*(6*e-15)+10))},random16:function(){return(65280*Math.random()+255*Math.random())/65535},randInt:function(e,t){return e+Math.floor(Math.random()*(t-e+1))},randFloat:function(e,t){return e+Math.random()*(t-e)},randFloatSpread:function(e){return e*(.5-Math.random())},degToRad:function(){var e=Math.PI/180;return function(t){return t*e}}(),radToDeg:function(){var e=180/Math.PI;return function(t){return t*e}}(),isPowerOfTwo:function(e){return 0===(e&e-1)&&0!==e},nextPowerOfTwo:function(e){return e--,e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,e++,e}},o.Spline=function(e){function t(e,t,r,i,n,o,a){var s=.5*(r-e),h=.5*(i-t);return(2*(t-r)+s+h)*a+(-3*(t-r)-2*s-h)*o+s*n+t}this.points=e;var r,i,n,a,s,h,c,u,l,p=[],d={x:0,y:0,z:0};this.initFromArray=function(e){this.points=[];for(var t=0;tthis.points.length-2?this.points.length-1:i+1,p[3]=i>this.points.length-3?this.points.length-1:i+2,h=this.points[p[0]],c=this.points[p[1]],u=this.points[p[2]],l=this.points[p[3]],a=n*n,s=n*a,d.x=t(h.x,c.x,u.x,l.x,n,a,s),d.y=t(h.y,c.y,u.y,l.y,n,a,s),d.z=t(h.z,c.z,u.z,l.z,n,a,s),d},this.getControlPointsArray=function(){var e,t,r=this.points.length,i=[];for(e=0;r>e;e++)t=this.points[e],i[e]=[t.x,t.y,t.z];return i},this.getLength=function(e){var t,r,i,n,a=0,s=0,h=0,c=new o.Vector3,u=new o.Vector3,l=[],p=0;for(l[0]=0,e||(e=100),i=this.points.length*e,c.copy(this.points[0]),t=1;i>t;t++)r=t/i,n=this.getPoint(r),u.copy(n),p+=u.distanceTo(c),c.copy(n),a=(this.points.length-1)*r,s=Math.floor(a),s!==h&&(l[s]=p,h=s);return l[l.length]=p,{chunks:l,total:p}},this.reparametrizeByArcLength=function(e){var t,r,i,n,a,s,h,c,u=[],l=new o.Vector3,p=this.getLength();for(u.push(l.copy(this.points[0]).clone()),t=1;tr;r++)i=n+r*(1/h)*(a-n),c=this.getPoint(i),u.push(l.copy(c).clone());u.push(l.copy(this.points[t]).clone())}this.points=u}},o.Triangle=function(e,t,r){this.a=void 0!==e?e:new o.Vector3,this.b=void 0!==t?t:new o.Vector3,this.c=void 0!==r?r:new o.Vector3},o.Triangle.normal=function(){var e=new o.Vector3;return function(t,r,i,n){var a=n||new o.Vector3;a.subVectors(i,r),e.subVectors(t,r),a.cross(e);var s=a.lengthSq();return s>0?a.multiplyScalar(1/Math.sqrt(s)):a.set(0,0,0)}}(),o.Triangle.barycoordFromPoint=function(){var e=new o.Vector3,t=new o.Vector3,r=new o.Vector3;return function(i,n,a,s,h){e.subVectors(s,n),t.subVectors(a,n),r.subVectors(i,n);var c=e.dot(e),u=e.dot(t),l=e.dot(r),p=t.dot(t),d=t.dot(r),f=c*p-u*u,m=h||new o.Vector3;if(0===f)return m.set(-2,-1,-1);var v=1/f,g=(p*l-u*d)*v,y=(c*d-u*l)*v;return m.set(1-g-y,y,g)}}(),o.Triangle.containsPoint=function(){var e=new o.Vector3;return function(t,r,i,n){var a=o.Triangle.barycoordFromPoint(t,r,i,n,e);return a.x>=0&&a.y>=0&&a.x+a.y<=1}}(),o.Triangle.prototype={constructor:o.Triangle,set:function(e,t,r){return this.a.copy(e),this.b.copy(t),this.c.copy(r),this},setFromPointsAndIndices:function(e,t,r,i){return this.a.copy(e[t]),this.b.copy(e[r]),this.c.copy(e[i]),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this},area:function(){var e=new o.Vector3,t=new o.Vector3;return function(){return e.subVectors(this.c,this.b),t.subVectors(this.a,this.b),.5*e.cross(t).length()}}(),midpoint:function(e){var t=e||new o.Vector3;return t.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)},normal:function(e){return o.Triangle.normal(this.a,this.b,this.c,e)},plane:function(e){var t=e||new o.Plane;return t.setFromCoplanarPoints(this.a,this.b,this.c)},barycoordFromPoint:function(e,t){return o.Triangle.barycoordFromPoint(e,this.a,this.b,this.c,t)},containsPoint:function(e){return o.Triangle.containsPoint(e,this.a,this.b,this.c)},equals:function(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}},o.Clock=function(e){this.autoStart=void 0!==e?e:!0,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1},o.Clock.prototype={constructor:o.Clock,start:function(){this.startTime=void 0!==self.performance&&void 0!==self.performance.now?self.performance.now():Date.now(),this.oldTime=this.startTime,this.running=!0},stop:function(){this.getElapsedTime(),this.running=!1},getElapsedTime:function(){return this.getDelta(),this.elapsedTime},getDelta:function(){var e=0;if(this.autoStart&&!this.running&&this.start(),this.running){var t=void 0!==self.performance&&void 0!==self.performance.now?self.performance.now():Date.now();e=.001*(t-this.oldTime),this.oldTime=t,this.elapsedTime+=e}return e}},o.EventDispatcher=function(){},o.EventDispatcher.prototype={constructor:o.EventDispatcher,apply:function(e){e.addEventListener=o.EventDispatcher.prototype.addEventListener,e.hasEventListener=o.EventDispatcher.prototype.hasEventListener,e.removeEventListener=o.EventDispatcher.prototype.removeEventListener,e.dispatchEvent=o.EventDispatcher.prototype.dispatchEvent},addEventListener:function(e,t){void 0===this._listeners&&(this._listeners={});var r=this._listeners;void 0===r[e]&&(r[e]=[]),-1===r[e].indexOf(t)&&r[e].push(t)},hasEventListener:function(e,t){if(void 0===this._listeners)return!1;var r=this._listeners;return void 0!==r[e]&&-1!==r[e].indexOf(t)?!0:!1},removeEventListener:function(e,t){if(void 0!==this._listeners){var r=this._listeners,i=r[e];if(void 0!==i){var n=i.indexOf(t);-1!==n&&i.splice(n,1)}}},dispatchEvent:function(e){if(void 0!==this._listeners){var t=this._listeners,r=t[e.type];if(void 0!==r){e.target=this;for(var i=[],n=r.length,o=0;n>o;o++)i[o]=r[o];for(var o=0;n>o;o++)i[o].call(this,e)}}}},function(e){function t(e,t){return e.distance-t.distance}e.Raycaster=function(t,r,i,n){this.ray=new e.Ray(t,r),this.near=i||0,this.far=n||1/0,this.params={Mesh:{},Line:{},LOD:{},Points:{threshold:1},Sprite:{}},Object.defineProperties(this.params,{PointCloud:{get:function(){return console.warn("THREE.Raycaster: params.PointCloud has been renamed to params.Points."),this.Points}}})};var r=function(e,t,i,n){if(e.visible!==!1&&(e.raycast(t,i),n===!0))for(var o=e.children,a=0,s=o.length;s>a;a++)r(o[a],t,i,!0)};e.Raycaster.prototype={constructor:e.Raycaster,linePrecision:1,set:function(e,t){this.ray.set(e,t)},setFromCamera:function(t,r){r instanceof e.PerspectiveCamera?(this.ray.origin.setFromMatrixPosition(r.matrixWorld),this.ray.direction.set(t.x,t.y,.5).unproject(r).sub(this.ray.origin).normalize()):r instanceof e.OrthographicCamera?(this.ray.origin.set(t.x,t.y,-1).unproject(r),this.ray.direction.set(0,0,-1).transformDirection(r.matrixWorld)):console.error("THREE.Raycaster: Unsupported camera type.")},intersectObject:function(e,i){var n=[];return r(e,this,n,i),n.sort(t),n},intersectObjects:function(e,i){var n=[];if(Array.isArray(e)===!1)return console.warn("THREE.Raycaster.intersectObjects: objects is not an Array."),n;for(var o=0,a=e.length;a>o;o++)r(e[o],this,n,i);return n.sort(t),n}}}(o),o.Object3D=function(){Object.defineProperty(this,"id",{value:o.Object3DIdCount++}),this.uuid=o.Math.generateUUID(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=o.Object3D.DefaultUp.clone();var e=new o.Vector3,t=new o.Euler,r=new o.Quaternion,i=new o.Vector3(1,1,1),n=function(){r.setFromEuler(t,!1)},a=function(){t.setFromQuaternion(r,void 0,!1)};t.onChange(n),r.onChange(a),Object.defineProperties(this,{position:{enumerable:!0,value:e},rotation:{enumerable:!0,value:t},quaternion:{enumerable:!0,value:r},scale:{enumerable:!0,value:i},modelViewMatrix:{value:new o.Matrix4},normalMatrix:{value:new o.Matrix3}}),this.rotationAutoUpdate=!0,this.matrix=new o.Matrix4,this.matrixWorld=new o.Matrix4,this.matrixAutoUpdate=o.Object3D.DefaultMatrixAutoUpdate,this.matrixWorldNeedsUpdate=!1,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.userData={}},o.Object3D.DefaultUp=new o.Vector3(0,1,0),o.Object3D.DefaultMatrixAutoUpdate=!0,o.Object3D.prototype={constructor:o.Object3D,get eulerOrder(){return console.warn("THREE.Object3D: .eulerOrder has been moved to .rotation.order."),this.rotation.order},set eulerOrder(e){console.warn("THREE.Object3D: .eulerOrder has been moved to .rotation.order."),this.rotation.order=e},get useQuaternion(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")},set useQuaternion(e){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")},set renderDepth(e){console.warn("THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead.")},applyMatrix:function(e){this.matrix.multiplyMatrices(e,this.matrix),this.matrix.decompose(this.position,this.quaternion,this.scale)},setRotationFromAxisAngle:function(e,t){this.quaternion.setFromAxisAngle(e,t)},setRotationFromEuler:function(e){this.quaternion.setFromEuler(e,!0)},setRotationFromMatrix:function(e){this.quaternion.setFromRotationMatrix(e)},setRotationFromQuaternion:function(e){this.quaternion.copy(e)},rotateOnAxis:function(){var e=new o.Quaternion;return function(t,r){return e.setFromAxisAngle(t,r),this.quaternion.multiply(e),this}}(),rotateX:function(){var e=new o.Vector3(1,0,0);return function(t){return this.rotateOnAxis(e,t)}}(),rotateY:function(){ +var e=new o.Vector3(0,1,0);return function(t){return this.rotateOnAxis(e,t)}}(),rotateZ:function(){var e=new o.Vector3(0,0,1);return function(t){return this.rotateOnAxis(e,t)}}(),translateOnAxis:function(){var e=new o.Vector3;return function(t,r){return e.copy(t).applyQuaternion(this.quaternion),this.position.add(e.multiplyScalar(r)),this}}(),translate:function(e,t){return console.warn("THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead."),this.translateOnAxis(t,e)},translateX:function(){var e=new o.Vector3(1,0,0);return function(t){return this.translateOnAxis(e,t)}}(),translateY:function(){var e=new o.Vector3(0,1,0);return function(t){return this.translateOnAxis(e,t)}}(),translateZ:function(){var e=new o.Vector3(0,0,1);return function(t){return this.translateOnAxis(e,t)}}(),localToWorld:function(e){return e.applyMatrix4(this.matrixWorld)},worldToLocal:function(){var e=new o.Matrix4;return function(t){return t.applyMatrix4(e.getInverse(this.matrixWorld))}}(),lookAt:function(){var e=new o.Matrix4;return function(t){e.lookAt(t,this.position,this.up),this.quaternion.setFromRotationMatrix(e)}}(),add:function(e){if(arguments.length>1){for(var t=0;t1)for(var t=0;tr;r++){var n=this.children[r],o=n.getObjectByProperty(e,t);if(void 0!==o)return o}return void 0},getWorldPosition:function(e){var t=e||new o.Vector3;return this.updateMatrixWorld(!0),t.setFromMatrixPosition(this.matrixWorld)},getWorldQuaternion:function(){var e=new o.Vector3,t=new o.Vector3;return function(r){var i=r||new o.Quaternion;return this.updateMatrixWorld(!0),this.matrixWorld.decompose(e,i,t),i}}(),getWorldRotation:function(){var e=new o.Quaternion;return function(t){var r=t||new o.Euler;return this.getWorldQuaternion(e),r.setFromQuaternion(e,this.rotation.order,!1)}}(),getWorldScale:function(){var e=new o.Vector3,t=new o.Quaternion;return function(r){var i=r||new o.Vector3;return this.updateMatrixWorld(!0),this.matrixWorld.decompose(e,t,i),i}}(),getWorldDirection:function(){var e=new o.Quaternion;return function(t){var r=t||new o.Vector3;return this.getWorldQuaternion(e),r.set(0,0,1).applyQuaternion(e)}}(),raycast:function(){},traverse:function(e){e(this);for(var t=this.children,r=0,i=t.length;i>r;r++)t[r].traverse(e)},traverseVisible:function(e){if(this.visible!==!1){e(this);for(var t=this.children,r=0,i=t.length;i>r;r++)t[r].traverseVisible(e)}},traverseAncestors:function(e){var t=this.parent;null!==t&&(e(t),t.traverseAncestors(e))},updateMatrix:function(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0},updateMatrixWorld:function(e){this.matrixAutoUpdate===!0&&this.updateMatrix(),(this.matrixWorldNeedsUpdate===!0||e===!0)&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,e=!0);for(var t=0,r=this.children.length;r>t;t++)this.children[t].updateMatrixWorld(e)},toJSON:function(e){function t(e){var t=[];for(var r in e){var i=e[r];delete i.metadata,t.push(i)}return t}var r=void 0===e,i={};if(r&&(e={geometries:{},materials:{},textures:{},images:{}},i.metadata={version:4.4,type:"Object",generator:"Object3D.toJSON"}),i.uuid=this.uuid,i.type=this.type,""!==this.name&&(i.name=this.name),"{}"!==JSON.stringify(this.userData)&&(i.userData=this.userData),this.visible!==!0&&(i.visible=this.visible),i.matrix=this.matrix.toArray(),this.children.length>0){i.children=[];for(var n=0;n0&&(o.geometries=a),s.length>0&&(o.materials=s),h.length>0&&(o.textures=h),c.length>0&&(o.images=c)}return o.object=i,o},clone:function(e){return(new this.constructor).copy(this,e)},copy:function(e,t){if(void 0===t&&(t=!0),this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.rotationAutoUpdate=e.rotationAutoUpdate,this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(var r=0;rt;t++)this.vertexNormals[t]=e.vertexNormals[t].clone();for(var t=0,r=e.vertexColors.length;r>t;t++)this.vertexColors[t]=e.vertexColors[t].clone();return this}},o.Face4=function(e,t,r,i,n,a,s){return console.warn("THREE.Face4 has been removed. A THREE.Face3 will be created instead."),new o.Face3(e,t,r,n,a,s)},o.BufferAttribute=function(e,t){this.uuid=o.Math.generateUUID(),this.array=e,this.itemSize=t,this.dynamic=!1,this.updateRange={offset:0,count:-1},this.version=0},o.BufferAttribute.prototype={constructor:o.BufferAttribute,get length(){return console.warn("THREE.BufferAttribute: .length has been deprecated. Please use .count."),this.array.length},get count(){return this.array.length/this.itemSize},set needsUpdate(e){e===!0&&this.version++},setDynamic:function(e){return this.dynamic=e,this},copy:function(e){return this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.dynamic=e.dynamic,this},copyAt:function(e,t,r){e*=this.itemSize,r*=t.itemSize;for(var i=0,n=this.itemSize;n>i;i++)this.array[e+i]=t.array[r+i];return this},copyArray:function(e){return this.array.set(e),this},copyColorsArray:function(e){for(var t=this.array,r=0,i=0,n=e.length;n>i;i++){var a=e[i];void 0===a&&(console.warn("THREE.BufferAttribute.copyColorsArray(): color is undefined",i),a=new o.Color),t[r++]=a.r,t[r++]=a.g,t[r++]=a.b}return this},copyIndicesArray:function(e){for(var t=this.array,r=0,i=0,n=e.length;n>i;i++){var o=e[i];t[r++]=o.a,t[r++]=o.b,t[r++]=o.c}return this},copyVector2sArray:function(e){for(var t=this.array,r=0,i=0,n=e.length;n>i;i++){var a=e[i];void 0===a&&(console.warn("THREE.BufferAttribute.copyVector2sArray(): vector is undefined",i),a=new o.Vector2),t[r++]=a.x,t[r++]=a.y}return this},copyVector3sArray:function(e){for(var t=this.array,r=0,i=0,n=e.length;n>i;i++){var a=e[i];void 0===a&&(console.warn("THREE.BufferAttribute.copyVector3sArray(): vector is undefined",i),a=new o.Vector3),t[r++]=a.x,t[r++]=a.y,t[r++]=a.z}return this},copyVector4sArray:function(e){for(var t=this.array,r=0,i=0,n=e.length;n>i;i++){var a=e[i];void 0===a&&(console.warn("THREE.BufferAttribute.copyVector4sArray(): vector is undefined",i),a=new o.Vector4),t[r++]=a.x,t[r++]=a.y,t[r++]=a.z,t[r++]=a.w}return this},set:function(e,t){return void 0===t&&(t=0),this.array.set(e,t),this},getX:function(e){return this.array[e*this.itemSize]},setX:function(e,t){return this.array[e*this.itemSize]=t,this},getY:function(e){return this.array[e*this.itemSize+1]},setY:function(e,t){return this.array[e*this.itemSize+1]=t,this},getZ:function(e){return this.array[e*this.itemSize+2]},setZ:function(e,t){return this.array[e*this.itemSize+2]=t,this},getW:function(e){return this.array[e*this.itemSize+3]},setW:function(e,t){return this.array[e*this.itemSize+3]=t,this},setXY:function(e,t,r){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=r,this},setXYZ:function(e,t,r,i){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=r,this.array[e+2]=i,this},setXYZW:function(e,t,r,i,n){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=r,this.array[e+2]=i,this.array[e+3]=n,this},clone:function(){return(new this.constructor).copy(this)}},o.Int8Attribute=function(e,t){return new o.BufferAttribute(new Int8Array(e),t)},o.Uint8Attribute=function(e,t){return new o.BufferAttribute(new Uint8Array(e),t)},o.Uint8ClampedAttribute=function(e,t){return new o.BufferAttribute(new Uint8ClampedArray(e),t)},o.Int16Attribute=function(e,t){return new o.BufferAttribute(new Int16Array(e),t)},o.Uint16Attribute=function(e,t){return new o.BufferAttribute(new Uint16Array(e),t)},o.Int32Attribute=function(e,t){return new o.BufferAttribute(new Int32Array(e),t)},o.Uint32Attribute=function(e,t){return new o.BufferAttribute(new Uint32Array(e),t)},o.Float32Attribute=function(e,t){return new o.BufferAttribute(new Float32Array(e),t)},o.Float64Attribute=function(e,t){return new o.BufferAttribute(new Float64Array(e),t)},o.DynamicBufferAttribute=function(e,t){return console.warn("THREE.DynamicBufferAttribute has been removed. Use new THREE.BufferAttribute().setDynamic( true ) instead."),new o.BufferAttribute(e,t).setDynamic(!0)},o.InstancedBufferAttribute=function(e,t,r){o.BufferAttribute.call(this,e,t),this.meshPerAttribute=r||1},o.InstancedBufferAttribute.prototype=Object.create(o.BufferAttribute.prototype),o.InstancedBufferAttribute.prototype.constructor=o.InstancedBufferAttribute,o.InstancedBufferAttribute.prototype.copy=function(e){return o.BufferAttribute.prototype.copy.call(this,e),this.meshPerAttribute=e.meshPerAttribute,this},o.InterleavedBuffer=function(e,t){this.uuid=o.Math.generateUUID(),this.array=e,this.stride=t,this.dynamic=!1,this.updateRange={offset:0,count:-1},this.version=0},o.InterleavedBuffer.prototype={constructor:o.InterleavedBuffer,get length(){return this.array.length},get count(){return this.array.length/this.stride},set needsUpdate(e){e===!0&&this.version++},setDynamic:function(e){return this.dynamic=e,this},copy:function(e){this.array=new e.array.constructor(e.array),this.stride=e.stride,this.dynamic=e.dynamic},copyAt:function(e,t,r){e*=this.stride,r*=t.stride;for(var i=0,n=this.stride;n>i;i++)this.array[e+i]=t.array[r+i];return this},set:function(e,t){return void 0===t&&(t=0),this.array.set(e,t),this},clone:function(){return(new this.constructor).copy(this)}},o.InstancedInterleavedBuffer=function(e,t,r){o.InterleavedBuffer.call(this,e,t),this.meshPerAttribute=r||1},o.InstancedInterleavedBuffer.prototype=Object.create(o.InterleavedBuffer.prototype),o.InstancedInterleavedBuffer.prototype.constructor=o.InstancedInterleavedBuffer,o.InstancedInterleavedBuffer.prototype.copy=function(e){return o.InterleavedBuffer.prototype.copy.call(this,e),this.meshPerAttribute=e.meshPerAttribute,this},o.InterleavedBufferAttribute=function(e,t,r){this.uuid=o.Math.generateUUID(),this.data=e,this.itemSize=t,this.offset=r},o.InterleavedBufferAttribute.prototype={constructor:o.InterleavedBufferAttribute,get length(){return console.warn("THREE.BufferAttribute: .length has been deprecated. Please use .count."),this.array.length},get count(){return this.data.array.length/this.data.stride},setX:function(e,t){return this.data.array[e*this.data.stride+this.offset]=t,this},setY:function(e,t){return this.data.array[e*this.data.stride+this.offset+1]=t,this},setZ:function(e,t){return this.data.array[e*this.data.stride+this.offset+2]=t,this},setW:function(e,t){return this.data.array[e*this.data.stride+this.offset+3]=t,this},getX:function(e){return this.data.array[e*this.data.stride+this.offset]},getY:function(e){return this.data.array[e*this.data.stride+this.offset+1]},getZ:function(e){return this.data.array[e*this.data.stride+this.offset+2]},getW:function(e){return this.data.array[e*this.data.stride+this.offset+3]},setXY:function(e,t,r){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=r,this},setXYZ:function(e,t,r,i){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=r,this.data.array[e+2]=i,this},setXYZW:function(e,t,r,i,n){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=r,this.data.array[e+2]=i,this.data.array[e+3]=n,this}},o.Geometry=function(){Object.defineProperty(this,"id",{value:o.GeometryIdCount++}),this.uuid=o.Math.generateUUID(),this.name="",this.type="Geometry",this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]],this.morphTargets=[],this.morphColors=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingBox=null,this.boundingSphere=null,this.verticesNeedUpdate=!1,this.elementsNeedUpdate=!1,this.uvsNeedUpdate=!1,this.normalsNeedUpdate=!1,this.colorsNeedUpdate=!1,this.lineDistancesNeedUpdate=!1,this.groupsNeedUpdate=!1},o.Geometry.prototype={constructor:o.Geometry,applyMatrix:function(e){for(var t=(new o.Matrix3).getNormalMatrix(e),r=0,i=this.vertices.length;i>r;r++){var n=this.vertices[r];n.applyMatrix4(e)}for(var r=0,i=this.faces.length;i>r;r++){var a=this.faces[r];a.normal.applyMatrix3(t).normalize();for(var s=0,h=a.vertexNormals.length;h>s;s++)a.vertexNormals[s].applyMatrix3(t).normalize()}null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this.verticesNeedUpdate=!0,this.normalsNeedUpdate=!0},rotateX:function(){var e;return function(t){return void 0===e&&(e=new o.Matrix4),e.makeRotationX(t),this.applyMatrix(e),this}}(),rotateY:function(){var e;return function(t){return void 0===e&&(e=new o.Matrix4),e.makeRotationY(t),this.applyMatrix(e),this}}(),rotateZ:function(){var e;return function(t){return void 0===e&&(e=new o.Matrix4),e.makeRotationZ(t),this.applyMatrix(e),this}}(),translate:function(){var e;return function(t,r,i){return void 0===e&&(e=new o.Matrix4),e.makeTranslation(t,r,i),this.applyMatrix(e),this}}(),scale:function(){var e;return function(t,r,i){return void 0===e&&(e=new o.Matrix4),e.makeScale(t,r,i),this.applyMatrix(e),this}}(),lookAt:function(){var e;return function(t){void 0===e&&(e=new o.Object3D),e.lookAt(t),e.updateMatrix(),this.applyMatrix(e.matrix)}}(),fromBufferGeometry:function(e){var t=this,r=null!==e.index?e.index.array:void 0,i=e.attributes,n=i.position.array,a=void 0!==i.normal?i.normal.array:void 0,s=void 0!==i.color?i.color.array:void 0,h=void 0!==i.uv?i.uv.array:void 0,c=void 0!==i.uv2?i.uv2.array:void 0;void 0!==c&&(this.faceVertexUvs[1]=[]);for(var u=[],l=[],p=[],d=0,f=0,m=0;d0)for(var d=0;df;f+=3)v(r[f],r[f+1],r[f+2]);else for(var d=0;dr;r++){var n=this.faces[r],a=this.vertices[n.a],s=this.vertices[n.b],h=this.vertices[n.c];e.subVectors(h,s),t.subVectors(a,s),e.cross(t),e.normalize(),n.normal.copy(e)}},computeVertexNormals:function(e){var t,r,i,n,a,s;for(s=new Array(this.vertices.length),t=0,r=this.vertices.length;r>t;t++)s[t]=new o.Vector3;if(e){var h,c,u,l=new o.Vector3,p=new o.Vector3;for(i=0,n=this.faces.length;n>i;i++)a=this.faces[i],h=this.vertices[a.a],c=this.vertices[a.b],u=this.vertices[a.c],l.subVectors(u,c),p.subVectors(h,c),l.cross(p),s[a.a].add(l),s[a.b].add(l),s[a.c].add(l)}else for(i=0,n=this.faces.length;n>i;i++)a=this.faces[i],s[a.a].add(a.normal),s[a.b].add(a.normal),s[a.c].add(a.normal);for(t=0,r=this.vertices.length;r>t;t++)s[t].normalize();for(i=0,n=this.faces.length;n>i;i++){a=this.faces[i];var d=a.vertexNormals;3===d.length?(d[0].copy(s[a.a]),d[1].copy(s[a.b]),d[2].copy(s[a.c])):(d[0]=s[a.a].clone(),d[1]=s[a.b].clone(),d[2]=s[a.c].clone())}},computeMorphNormals:function(){var e,t,r,i,n;for(r=0,i=this.faces.length;i>r;r++)for(n=this.faces[r],n.__originalFaceNormal?n.__originalFaceNormal.copy(n.normal):n.__originalFaceNormal=n.normal.clone(),n.__originalVertexNormals||(n.__originalVertexNormals=[]),e=0,t=n.vertexNormals.length;t>e;e++)n.__originalVertexNormals[e]?n.__originalVertexNormals[e].copy(n.vertexNormals[e]):n.__originalVertexNormals[e]=n.vertexNormals[e].clone();var a=new o.Geometry;for(a.faces=this.faces,e=0,t=this.morphTargets.length;t>e;e++){if(!this.morphNormals[e]){this.morphNormals[e]={},this.morphNormals[e].faceNormals=[],this.morphNormals[e].vertexNormals=[];var s,h,c=this.morphNormals[e].faceNormals,u=this.morphNormals[e].vertexNormals;for(r=0,i=this.faces.length;i>r;r++)s=new o.Vector3,h={a:new o.Vector3,b:new o.Vector3,c:new o.Vector3},c.push(s),u.push(h)}var l=this.morphNormals[e];a.vertices=this.morphTargets[e].vertices,a.computeFaceNormals(),a.computeVertexNormals();var s,h;for(r=0,i=this.faces.length;i>r;r++)n=this.faces[r],s=l.faceNormals[r],h=l.vertexNormals[r],s.copy(n.normal),h.a.copy(n.vertexNormals[0]),h.b.copy(n.vertexNormals[1]),h.c.copy(n.vertexNormals[2])}for(r=0,i=this.faces.length;i>r;r++)n=this.faces[r],n.normal=n.__originalFaceNormal,n.vertexNormals=n.__originalVertexNormals},computeTangents:function(){console.warn("THREE.Geometry: .computeTangents() has been removed.")},computeLineDistances:function(){for(var e=0,t=this.vertices,r=0,i=t.length;i>r;r++)r>0&&(e+=t[r].distanceTo(t[r-1])),this.lineDistances[r]=e},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new o.Box3),this.boundingBox.setFromPoints(this.vertices)},computeBoundingSphere:function(){null===this.boundingSphere&&(this.boundingSphere=new o.Sphere),this.boundingSphere.setFromPoints(this.vertices)},merge:function(e,t,r){if(e instanceof o.Geometry==!1)return void console.error("THREE.Geometry.merge(): geometry not an instance of THREE.Geometry.",e);var i,n=this.vertices.length,a=this.vertices,s=e.vertices,h=this.faces,c=e.faces,u=this.faceVertexUvs[0],l=e.faceVertexUvs[0];void 0===r&&(r=0),void 0!==t&&(i=(new o.Matrix3).getNormalMatrix(t));for(var p=0,d=s.length;d>p;p++){var f=s[p],m=f.clone();void 0!==t&&m.applyMatrix4(t),a.push(m)}for(p=0,d=c.length;d>p;p++){var v,g,y,x=c[p],b=x.vertexNormals,w=x.vertexColors;v=new o.Face3(x.a+n,x.b+n,x.c+n),v.normal.copy(x.normal),void 0!==i&&v.normal.applyMatrix3(i).normalize();for(var M=0,A=b.length;A>M;M++)g=b[M].clone(),void 0!==i&&g.applyMatrix3(i).normalize(),v.vertexNormals.push(g);v.color.copy(x.color);for(var M=0,A=w.length;A>M;M++)y=w[M],v.vertexColors.push(y.clone());v.materialIndex=x.materialIndex+r,h.push(v)}for(p=0,d=l.length;d>p;p++){var S=l[p],_=[];if(void 0!==S){for(var M=0,A=S.length;A>M;M++)_.push(S[M].clone());u.push(_)}}},mergeMesh:function(e){return e instanceof o.Mesh==!1?void console.error("THREE.Geometry.mergeMesh(): mesh not an instance of THREE.Mesh.",e):(e.matrixAutoUpdate&&e.updateMatrix(),void this.merge(e.geometry,e.matrix))},mergeVertices:function(){var e,t,r,i,n,o,a,s,h={},c=[],u=[],l=4,p=Math.pow(10,l);for(r=0,i=this.vertices.length;i>r;r++)e=this.vertices[r],t=Math.round(e.x*p)+"_"+Math.round(e.y*p)+"_"+Math.round(e.z*p),void 0===h[t]?(h[t]=r,c.push(this.vertices[r]),u[r]=c.length-1):u[r]=u[h[t]];var d=[];for(r=0,i=this.faces.length;i>r;r++){n=this.faces[r],n.a=u[n.a],n.b=u[n.b],n.c=u[n.c],o=[n.a,n.b,n.c];for(var f=-1,m=0;3>m;m++)if(o[m]===o[(m+1)%3]){f=m,d.push(r);break}}for(r=d.length-1;r>=0;r--){var v=d[r];for(this.faces.splice(v,1),a=0,s=this.faceVertexUvs.length;s>a;a++)this.faceVertexUvs[a].splice(v,1)}var g=this.vertices.length-c.length;return this.vertices=c,g},toJSON:function(){function e(e,t,r){return r?e|1<0,M=g.vertexNormals.length>0,A=1!==g.color.r||1!==g.color.g||1!==g.color.b,S=g.vertexColors.length>0,_=0;if(_=e(_,0,0),_=e(_,1,y),_=e(_,2,x),_=e(_,3,b),_=e(_,4,w),_=e(_,5,M),_=e(_,6,A),_=e(_,7,S),u.push(_),u.push(g.a,g.b,g.c),b){var E=this.faceVertexUvs[0][h];u.push(i(E[0]),i(E[1]),i(E[2]))}if(w&&u.push(t(g.normal)),M){var T=g.vertexNormals;u.push(t(T[0]),t(T[1]),t(T[2]))}if(A&&u.push(r(g.color)),S){var C=g.vertexColors;u.push(r(C[0]),r(C[1]),r(C[2]))}}return n.data={},n.data.vertices=s,n.data.normals=l,d.length>0&&(n.data.colors=d),m.length>0&&(n.data.uvs=[m]),n.data.faces=u,n},clone:function(){return(new this.constructor).copy(this)},copy:function(e){this.vertices=[],this.faces=[],this.faceVertexUvs=[[]];for(var t=e.vertices,r=0,i=t.length;i>r;r++)this.vertices.push(t[r].clone());for(var n=e.faces,r=0,i=n.length;i>r;r++)this.faces.push(n[r].clone());for(var r=0,i=e.faceVertexUvs.length;i>r;r++){var o=e.faceVertexUvs[r];void 0===this.faceVertexUvs[r]&&(this.faceVertexUvs[r]=[]);for(var a=0,s=o.length;s>a;a++){for(var h=o[a],c=[],u=0,l=h.length;l>u;u++){var p=h[u];c.push(p.clone())}this.faceVertexUvs[r].push(c)}}return this},dispose:function(){this.dispatchEvent({type:"dispose"})}},o.EventDispatcher.prototype.apply(o.Geometry.prototype),o.GeometryIdCount=0,o.DirectGeometry=function(){Object.defineProperty(this,"id",{value:o.GeometryIdCount++}),this.uuid=o.Math.generateUUID(),this.name="",this.type="DirectGeometry",this.indices=[],this.vertices=[],this.normals=[],this.colors=[],this.uvs=[],this.uvs2=[],this.groups=[],this.morphTargets={},this.skinWeights=[],this.skinIndices=[],this.boundingBox=null,this.boundingSphere=null,this.verticesNeedUpdate=!1,this.normalsNeedUpdate=!1,this.colorsNeedUpdate=!1,this.uvsNeedUpdate=!1,this.groupsNeedUpdate=!1},o.DirectGeometry.prototype={constructor:o.DirectGeometry,computeBoundingBox:o.Geometry.prototype.computeBoundingBox,computeBoundingSphere:o.Geometry.prototype.computeBoundingSphere,computeFaceNormals:function(){console.warn("THREE.DirectGeometry: computeFaceNormals() is not a method of this type of geometry.")},computeVertexNormals:function(){console.warn("THREE.DirectGeometry: computeVertexNormals() is not a method of this type of geometry.")},computeGroups:function(e){for(var t,r,i=[],n=e.faces,o=0;o0,a=i[1]&&i[1].length>0,s=e.morphTargets,h=s.length;if(h>0){for(var c=[],u=0;h>u;u++)c[u]=[];this.morphTargets.position=c}var l=e.morphNormals,p=l.length;if(p>0){for(var d=[],u=0;p>u;u++)d[u]=[];this.morphTargets.normal=d}for(var f=e.skinIndices,m=e.skinWeights,v=f.length===r.length,g=m.length===r.length,u=0;uS;S++){var _=s[S].vertices;c[S].push(_[y.a],_[y.b],_[y.c])}for(var S=0;p>S;S++){var E=l[S].vertexNormals[u];d[S].push(E.a,E.b,E.c)}v&&this.skinIndices.push(f[y.a],f[y.b],f[y.c]),g&&this.skinWeights.push(m[y.a],m[y.b],m[y.c])}return this.computeGroups(e),this.verticesNeedUpdate=e.verticesNeedUpdate,this.normalsNeedUpdate=e.normalsNeedUpdate,this.colorsNeedUpdate=e.colorsNeedUpdate,this.uvsNeedUpdate=e.uvsNeedUpdate,this.groupsNeedUpdate=e.groupsNeedUpdate,this},dispose:function(){this.dispatchEvent({type:"dispose"})}},o.EventDispatcher.prototype.apply(o.DirectGeometry.prototype),o.BufferGeometry=function(){Object.defineProperty(this,"id",{value:o.GeometryIdCount++}),this.uuid=o.Math.generateUUID(),this.name="",this.type="BufferGeometry",this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0}},o.BufferGeometry.prototype={constructor:o.BufferGeometry,addIndex:function(e){this.index=e},addAttribute:function(e,t){return t instanceof o.BufferAttribute==!1&&t instanceof o.InterleavedBufferAttribute==!1?(console.warn("THREE.BufferGeometry: .addAttribute() now expects ( name, attribute )."),void this.addAttribute(e,new o.BufferAttribute(arguments[1],arguments[2]))):("index"===e&&(console.warn("THREE.BufferGeometry.addAttribute: Use .addIndex() for index attribute."),this.addIndex(t)),void(this.attributes[e]=t))},getAttribute:function(e){return this.attributes[e]},removeAttribute:function(e){delete this.attributes[e]},get drawcalls(){return console.error("THREE.BufferGeometry: .drawcalls has been renamed to .groups."),this.groups},get offsets(){return console.warn("THREE.BufferGeometry: .offsets has been renamed to .groups."),this.groups},addDrawCall:function(e,t,r){void 0!==r&&console.warn("THREE.BufferGeometry: .addDrawCall() no longer supports indexOffset."),console.warn("THREE.BufferGeometry: .addDrawCall() is now .addGroup()."),this.addGroup(e,t)},clearDrawCalls:function(){console.warn("THREE.BufferGeometry: .clearDrawCalls() is now .clearGroups()."),this.clearGroups()},addGroup:function(e,t,r){this.groups.push({start:e,count:t,materialIndex:void 0!==r?r:0})},clearGroups:function(){this.groups=[]},setDrawRange:function(e,t){this.drawRange.start=e,this.drawRange.count=t},applyMatrix:function(e){var t=this.attributes.position;void 0!==t&&(e.applyToVector3Array(t.array),t.needsUpdate=!0);var r=this.attributes.normal;if(void 0!==r){var i=(new o.Matrix3).getNormalMatrix(e);i.applyToVector3Array(r.array),r.needsUpdate=!0}null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere()},rotateX:function(){var e;return function(t){return void 0===e&&(e=new o.Matrix4),e.makeRotationX(t),this.applyMatrix(e),this}}(),rotateY:function(){var e;return function(t){return void 0===e&&(e=new o.Matrix4),e.makeRotationY(t),this.applyMatrix(e),this}}(),rotateZ:function(){var e;return function(t){return void 0===e&&(e=new o.Matrix4),e.makeRotationZ(t),this.applyMatrix(e),this}}(),translate:function(){var e;return function(t,r,i){return void 0===e&&(e=new o.Matrix4),e.makeTranslation(t,r,i),this.applyMatrix(e),this}}(),scale:function(){var e;return function(t,r,i){return void 0===e&&(e=new o.Matrix4),e.makeScale(t,r,i),this.applyMatrix(e),this}}(),lookAt:function(){var e;return function(t){void 0===e&&(e=new o.Object3D),e.lookAt(t),e.updateMatrix(),this.applyMatrix(e.matrix)}}(),center:function(){this.computeBoundingBox();var e=this.boundingBox.center().negate();return this.translate(e.x,e.y,e.z),e},setFromObject:function(e){var t=e.geometry;if(e instanceof o.Points||e instanceof o.Line){var r=new o.Float32Attribute(3*t.vertices.length,3),i=new o.Float32Attribute(3*t.colors.length,3);if(this.addAttribute("position",r.copyVector3sArray(t.vertices)),this.addAttribute("color",i.copyColorsArray(t.colors)),t.lineDistances&&t.lineDistances.length===t.vertices.length){var n=new o.Float32Attribute(t.lineDistances.length,1);this.addAttribute("lineDistance",n.copyArray(t.lineDistances))}null!==t.boundingSphere&&(this.boundingSphere=t.boundingSphere.clone()),null!==t.boundingBox&&(this.boundingBox=t.boundingBox.clone())}else e instanceof o.Mesh&&t instanceof o.Geometry&&this.fromGeometry(t);return this},updateFromObject:function(e){var t=e.geometry;if(e instanceof o.Mesh){var r=t.__directGeometry;if(void 0===r)return this.fromGeometry(t);r.verticesNeedUpdate=t.verticesNeedUpdate,r.normalsNeedUpdate=t.normalsNeedUpdate,r.colorsNeedUpdate=t.colorsNeedUpdate,r.uvsNeedUpdate=t.uvsNeedUpdate,r.groupsNeedUpdate=t.groupsNeedUpdate,t.verticesNeedUpdate=!1,t.normalsNeedUpdate=!1,t.colorsNeedUpdate=!1,t.uvsNeedUpdate=!1,t.groupsNeedUpdate=!1,t=r}if(t.verticesNeedUpdate===!0){var i=this.attributes.position;void 0!==i&&(i.copyVector3sArray(t.vertices),i.needsUpdate=!0),t.verticesNeedUpdate=!1}if(t.normalsNeedUpdate===!0){var i=this.attributes.normal;void 0!==i&&(i.copyVector3sArray(t.normals),i.needsUpdate=!0),t.normalsNeedUpdate=!1}if(t.colorsNeedUpdate===!0){var i=this.attributes.color;void 0!==i&&(i.copyColorsArray(t.colors),i.needsUpdate=!0),t.colorsNeedUpdate=!1}if(t.lineDistancesNeedUpdate){var i=this.attributes.lineDistance;void 0!==i&&(i.copyArray(t.lineDistances),i.needsUpdate=!0),t.lineDistancesNeedUpdate=!1}return t.groupsNeedUpdate&&(t.computeGroups(e.geometry),this.groups=t.groups,t.groupsNeedUpdate=!1),this},fromGeometry:function(e){return e.__directGeometry=(new o.DirectGeometry).fromGeometry(e),this.fromDirectGeometry(e.__directGeometry)},fromDirectGeometry:function(e){var t=new Float32Array(3*e.vertices.length);if(this.addAttribute("position",new o.BufferAttribute(t,3).copyVector3sArray(e.vertices)),e.normals.length>0){var r=new Float32Array(3*e.normals.length);this.addAttribute("normal",new o.BufferAttribute(r,3).copyVector3sArray(e.normals)); +}if(e.colors.length>0){var i=new Float32Array(3*e.colors.length);this.addAttribute("color",new o.BufferAttribute(i,3).copyColorsArray(e.colors))}if(e.uvs.length>0){var n=new Float32Array(2*e.uvs.length);this.addAttribute("uv",new o.BufferAttribute(n,2).copyVector2sArray(e.uvs))}if(e.uvs2.length>0){var a=new Float32Array(2*e.uvs2.length);this.addAttribute("uv2",new o.BufferAttribute(a,2).copyVector2sArray(e.uvs2))}if(e.indices.length>0){var s=e.vertices.length>65535?Uint32Array:Uint16Array,h=new s(3*e.indices.length);this.addIndex(new o.BufferAttribute(h,1).copyIndicesArray(e.indices))}this.groups=e.groups;for(var c in e.morphTargets){for(var u=[],l=e.morphTargets[c],p=0,d=l.length;d>p;p++){var f=l[p],m=new o.Float32Attribute(3*f.length,3);u.push(m.copyVector3sArray(f))}this.morphAttributes[c]=u}if(e.skinIndices.length>0){var v=new o.Float32Attribute(4*e.skinIndices.length,4);this.addAttribute("skinIndex",v.copyVector4sArray(e.skinIndices))}if(e.skinWeights.length>0){var g=new o.Float32Attribute(4*e.skinWeights.length,4);this.addAttribute("skinWeight",g.copyVector4sArray(e.skinWeights))}return null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone()),this},computeBoundingBox:function(){var e=new o.Vector3;return function(){null===this.boundingBox&&(this.boundingBox=new o.Box3);var t=this.attributes.position.array;if(t){var r=this.boundingBox;r.makeEmpty();for(var i=0,n=t.length;n>i;i+=3)e.fromArray(t,i),r.expandByPoint(e)}(void 0===t||0===t.length)&&(this.boundingBox.min.set(0,0,0),this.boundingBox.max.set(0,0,0)),(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox: Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}}(),computeBoundingSphere:function(){var e=new o.Box3,t=new o.Vector3;return function(){null===this.boundingSphere&&(this.boundingSphere=new o.Sphere);var r=this.attributes.position.array;if(r){e.makeEmpty();for(var i=this.boundingSphere.center,n=0,a=r.length;a>n;n+=3)t.fromArray(r,n),e.expandByPoint(t);e.center(i);for(var s=0,n=0,a=r.length;a>n;n+=3)t.fromArray(r,n),s=Math.max(s,i.distanceToSquared(t));this.boundingSphere.radius=Math.sqrt(s),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}}(),computeFaceNormals:function(){},computeVertexNormals:function(){var e=this.index,t=this.attributes,r=this.groups;if(t.position){var i=t.position.array;if(void 0===t.normal)this.addAttribute("normal",new o.BufferAttribute(new Float32Array(i.length),3));else for(var n=t.normal.array,a=0,s=n.length;s>a;a++)n[a]=0;var h,c,u,n=t.normal.array,l=new o.Vector3,p=new o.Vector3,d=new o.Vector3,f=new o.Vector3,m=new o.Vector3;if(e){var v=e.array;0===r.length&&this.addGroup(0,v.length);for(var g=0,y=r.length;y>g;++g)for(var x=r[g],b=x.start,w=x.count,a=b,s=b+w;s>a;a+=3)h=3*v[a+0],c=3*v[a+1],u=3*v[a+2],l.fromArray(i,h),p.fromArray(i,c),d.fromArray(i,u),f.subVectors(d,p),m.subVectors(l,p),f.cross(m),n[h]+=f.x,n[h+1]+=f.y,n[h+2]+=f.z,n[c]+=f.x,n[c+1]+=f.y,n[c+2]+=f.z,n[u]+=f.x,n[u+1]+=f.y,n[u+2]+=f.z}else for(var a=0,s=i.length;s>a;a+=9)l.fromArray(i,a),p.fromArray(i,a+3),d.fromArray(i,a+6),f.subVectors(d,p),m.subVectors(l,p),f.cross(m),n[a]=f.x,n[a+1]=f.y,n[a+2]=f.z,n[a+3]=f.x,n[a+4]=f.y,n[a+5]=f.z,n[a+6]=f.x,n[a+7]=f.y,n[a+8]=f.z;this.normalizeNormals(),t.normal.needsUpdate=!0}},computeTangents:function(){console.warn("THREE.BufferGeometry: .computeTangents() has been removed.")},computeOffsets:function(e){console.warn("THREE.BufferGeometry: .computeOffsets() has been removed.")},merge:function(e,t){if(e instanceof o.BufferGeometry==!1)return void console.error("THREE.BufferGeometry.merge(): geometry not an instance of THREE.BufferGeometry.",e);void 0===t&&(t=0);var r=this.attributes;for(var i in r)if(void 0!==e.attributes[i])for(var n=r[i],a=n.array,s=e.attributes[i],h=s.array,c=s.itemSize,u=0,l=c*t;uo;o+=3)e=n[o],t=n[o+1],r=n[o+2],i=1/Math.sqrt(e*e+t*t+r*r),n[o]*=i,n[o+1]*=i,n[o+2]*=i},toJSON:function(){var e={metadata:{version:4.4,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,""!==this.name&&(e.name=this.name),void 0!==this.parameters){var t=this.parameters;for(var r in t)void 0!==t[r]&&(e[r]=t[r]);return e}e.data={attributes:{}};var i=this.index;if(null!==i){var n=Array.prototype.slice.call(i.array);e.data.index={type:i.array.constructor.name,array:n}}var o=this.attributes;for(var r in o){var a=o[r],n=Array.prototype.slice.call(a.array);e.data.attributes[r]={itemSize:a.itemSize,type:a.array.constructor.name,array:n}}var s=this.groups;s.length>0&&(e.data.groups=JSON.parse(JSON.stringify(s)));var h=this.boundingSphere;return null!==h&&(e.data.boundingSphere={center:h.center.toArray(),radius:h.radius}),e},clone:function(){return(new this.constructor).copy(this)},copy:function(e){var t=e.index;null!==t&&this.addIndex(t.clone());var r=e.attributes;for(var i in r){var n=r[i];this.addAttribute(i,n.clone())}for(var o=e.groups,a=0,s=o.length;s>a;a++){var h=o[a];this.addGroup(h.start,h.count)}return this},dispose:function(){this.dispatchEvent({type:"dispose"})}},o.EventDispatcher.prototype.apply(o.BufferGeometry.prototype),o.BufferGeometry.MaxIndex=65535,o.InstancedBufferGeometry=function(){o.BufferGeometry.call(this),this.type="InstancedBufferGeometry",this.maxInstancedCount=void 0},o.InstancedBufferGeometry.prototype=Object.create(o.BufferGeometry.prototype),o.InstancedBufferGeometry.prototype.constructor=o.InstancedBufferGeometry,o.InstancedBufferGeometry.prototype.addGroup=function(e,t,r){this.groups.push({start:e,count:t,instances:r})},o.InstancedBufferGeometry.prototype.copy=function(e){var t=e.index;null!==t&&this.addIndex(t.clone());var r=e.attributes;for(var i in r){var n=r[i];this.addAttribute(i,n.clone())}for(var o=e.groups,a=0,s=o.length;s>a;a++){var h=o[a];this.addGroup(h.start,h.count,h.instances)}return this},o.EventDispatcher.prototype.apply(o.InstancedBufferGeometry.prototype),o.Camera=function(){o.Object3D.call(this),this.type="Camera",this.matrixWorldInverse=new o.Matrix4,this.projectionMatrix=new o.Matrix4},o.Camera.prototype=Object.create(o.Object3D.prototype),o.Camera.prototype.constructor=o.Camera,o.Camera.prototype.getWorldDirection=function(){var e=new o.Quaternion;return function(t){var r=t||new o.Vector3;return this.getWorldQuaternion(e),r.set(0,0,-1).applyQuaternion(e)}}(),o.Camera.prototype.lookAt=function(){var e=new o.Matrix4;return function(t){e.lookAt(this.position,t,this.up),this.quaternion.setFromRotationMatrix(e)}}(),o.Camera.prototype.clone=function(){return(new this.constructor).copy(this)},o.Camera.prototype.copy=function(e){return o.Object3D.prototype.copy.call(this,e),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this},o.CubeCamera=function(e,t,r){o.Object3D.call(this),this.type="CubeCamera";var i=90,n=1,a=new o.PerspectiveCamera(i,n,e,t);a.up.set(0,-1,0),a.lookAt(new o.Vector3(1,0,0)),this.add(a);var s=new o.PerspectiveCamera(i,n,e,t);s.up.set(0,-1,0),s.lookAt(new o.Vector3(-1,0,0)),this.add(s);var h=new o.PerspectiveCamera(i,n,e,t);h.up.set(0,0,1),h.lookAt(new o.Vector3(0,1,0)),this.add(h);var c=new o.PerspectiveCamera(i,n,e,t);c.up.set(0,0,-1),c.lookAt(new o.Vector3(0,-1,0)),this.add(c);var u=new o.PerspectiveCamera(i,n,e,t);u.up.set(0,-1,0),u.lookAt(new o.Vector3(0,0,1)),this.add(u);var l=new o.PerspectiveCamera(i,n,e,t);l.up.set(0,-1,0),l.lookAt(new o.Vector3(0,0,-1)),this.add(l),this.renderTarget=new o.WebGLRenderTargetCube(r,r,{format:o.RGBFormat,magFilter:o.LinearFilter,minFilter:o.LinearFilter}),this.updateCubeMap=function(e,t){null===this.parent&&this.updateMatrixWorld();var r=this.renderTarget,i=r.generateMipmaps;r.generateMipmaps=!1,r.activeCubeFace=0,e.render(t,a,r),r.activeCubeFace=1,e.render(t,s,r),r.activeCubeFace=2,e.render(t,h,r),r.activeCubeFace=3,e.render(t,c,r),r.activeCubeFace=4,e.render(t,u,r),r.generateMipmaps=i,r.activeCubeFace=5,e.render(t,l,r),e.setRenderTarget(null)}},o.CubeCamera.prototype=Object.create(o.Object3D.prototype),o.CubeCamera.prototype.constructor=o.CubeCamera,o.OrthographicCamera=function(e,t,r,i,n,a){o.Camera.call(this),this.type="OrthographicCamera",this.zoom=1,this.left=e,this.right=t,this.top=r,this.bottom=i,this.near=void 0!==n?n:.1,this.far=void 0!==a?a:2e3,this.updateProjectionMatrix()},o.OrthographicCamera.prototype=Object.create(o.Camera.prototype),o.OrthographicCamera.prototype.constructor=o.OrthographicCamera,o.OrthographicCamera.prototype.updateProjectionMatrix=function(){var e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),r=(this.right+this.left)/2,i=(this.top+this.bottom)/2;this.projectionMatrix.makeOrthographic(r-e,r+e,i+t,i-t,this.near,this.far)},o.OrthographicCamera.prototype.copy=function(e){return o.Camera.prototype.copy.call(this,e),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this},o.OrthographicCamera.prototype.toJSON=function(e){var t=o.Object3D.prototype.toJSON.call(this,e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,t},o.PerspectiveCamera=function(e,t,r,i){o.Camera.call(this),this.type="PerspectiveCamera",this.zoom=1,this.fov=void 0!==e?e:50,this.aspect=void 0!==t?t:1,this.near=void 0!==r?r:.1,this.far=void 0!==i?i:2e3,this.updateProjectionMatrix()},o.PerspectiveCamera.prototype=Object.create(o.Camera.prototype),o.PerspectiveCamera.prototype.constructor=o.PerspectiveCamera,o.PerspectiveCamera.prototype.setLens=function(e,t){void 0===t&&(t=24),this.fov=2*o.Math.radToDeg(Math.atan(t/(2*e))),this.updateProjectionMatrix()},o.PerspectiveCamera.prototype.setViewOffset=function(e,t,r,i,n,o){this.fullWidth=e,this.fullHeight=t,this.x=r,this.y=i,this.width=n,this.height=o,this.updateProjectionMatrix()},o.PerspectiveCamera.prototype.updateProjectionMatrix=function(){var e=o.Math.radToDeg(2*Math.atan(Math.tan(.5*o.Math.degToRad(this.fov))/this.zoom));if(this.fullWidth){var t=this.fullWidth/this.fullHeight,r=Math.tan(o.Math.degToRad(.5*e))*this.near,i=-r,n=t*i,a=t*r,s=Math.abs(a-n),h=Math.abs(r-i);this.projectionMatrix.makeFrustum(n+this.x*s/this.fullWidth,n+(this.x+this.width)*s/this.fullWidth,r-(this.y+this.height)*h/this.fullHeight,r-this.y*h/this.fullHeight,this.near,this.far)}else this.projectionMatrix.makePerspective(e,this.aspect,this.near,this.far)},o.PerspectiveCamera.prototype.copy=function(e){return o.Camera.prototype.copy.call(this,e),this.fov=e.fov,this.aspect=e.aspect,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this},o.PerspectiveCamera.prototype.toJSON=function(e){var t=o.Object3D.prototype.toJSON.call(this,e);return t.object.zoom=this.zoom,t.object.fov=this.fov,t.object.aspect=this.aspect,t.object.near=this.near,t.object.far=this.far,t},o.Light=function(e){o.Object3D.call(this),this.type="Light",this.color=new o.Color(e)},o.Light.prototype=Object.create(o.Object3D.prototype),o.Light.prototype.constructor=o.Light,o.Light.prototype.copy=function(e){return o.Object3D.prototype.copy.call(this,e),this.color.copy(e.color),this},o.AmbientLight=function(e){o.Light.call(this,e),this.type="AmbientLight"},o.AmbientLight.prototype=Object.create(o.Light.prototype),o.AmbientLight.prototype.constructor=o.AmbientLight,o.AmbientLight.prototype.toJSON=function(e){var t=o.Object3D.prototype.toJSON.call(this,e);return t.object.color=this.color.getHex(),t},o.DirectionalLight=function(e,t){o.Light.call(this,e),this.type="DirectionalLight",this.position.set(0,1,0),this.updateMatrix(),this.target=new o.Object3D,this.intensity=void 0!==t?t:1,this.castShadow=!1,this.onlyShadow=!1,this.shadowCameraNear=50,this.shadowCameraFar=5e3,this.shadowCameraLeft=-500,this.shadowCameraRight=500,this.shadowCameraTop=500,this.shadowCameraBottom=-500,this.shadowCameraVisible=!1,this.shadowBias=0,this.shadowDarkness=.5,this.shadowMapWidth=512,this.shadowMapHeight=512,this.shadowMap=null,this.shadowMapSize=null,this.shadowCamera=null,this.shadowMatrix=null},o.DirectionalLight.prototype=Object.create(o.Light.prototype),o.DirectionalLight.prototype.constructor=o.DirectionalLight,o.DirectionalLight.prototype.copy=function(e){return o.Light.prototype.copy.call(this,e),this.intensity=e.intensity,this.target=e.target.clone(),this.castShadow=e.castShadow,this.onlyShadow=e.onlyShadow,this.shadowCameraNear=e.shadowCameraNear,this.shadowCameraFar=e.shadowCameraFar,this.shadowCameraLeft=e.shadowCameraLeft,this.shadowCameraRight=e.shadowCameraRight,this.shadowCameraTop=e.shadowCameraTop,this.shadowCameraBottom=e.shadowCameraBottom,this.shadowCameraVisible=e.shadowCameraVisible,this.shadowBias=e.shadowBias,this.shadowDarkness=e.shadowDarkness,this.shadowMapWidth=e.shadowMapWidth,this.shadowMapHeight=e.shadowMapHeight,this},o.DirectionalLight.prototype.toJSON=function(e){var t=o.Object3D.prototype.toJSON.call(this,e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,t},o.HemisphereLight=function(e,t,r){o.Light.call(this,e),this.type="HemisphereLight",this.position.set(0,100,0),this.updateMatrix(),this.groundColor=new o.Color(t),this.intensity=void 0!==r?r:1},o.HemisphereLight.prototype=Object.create(o.Light.prototype),o.HemisphereLight.prototype.constructor=o.HemisphereLight,o.HemisphereLight.prototype.copy=function(e){return o.Light.prototype.copy.call(this,e),this.groundColor.copy(e.groundColor),this.intensity=e.intensity,this},o.HemisphereLight.prototype.toJSON=function(e){var t=o.Object3D.prototype.toJSON.call(this,e);return t.object.color=this.color.getHex(),t.object.groundColor=this.groundColor.getHex(),t.object.intensity=this.intensity,t},o.PointLight=function(e,t,r,i){o.Light.call(this,e),this.type="PointLight",this.intensity=void 0!==t?t:1,this.distance=void 0!==r?r:0,this.decay=void 0!==i?i:1},o.PointLight.prototype=Object.create(o.Light.prototype),o.PointLight.prototype.constructor=o.PointLight,o.PointLight.prototype.copy=function(e){return o.Light.prototype.copy.call(this,e),this.intensity=e.intensity,this.distance=e.distance,this.decay=e.decay,this},o.PointLight.prototype.toJSON=function(e){var t=o.Object3D.prototype.toJSON.call(this,e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,t.object.distance=this.distance,t.object.decay=this.decay,t},o.SpotLight=function(e,t,r,i,n,a){o.Light.call(this,e),this.type="SpotLight",this.position.set(0,1,0),this.updateMatrix(),this.target=new o.Object3D,this.intensity=void 0!==t?t:1,this.distance=void 0!==r?r:0,this.angle=void 0!==i?i:Math.PI/3,this.exponent=void 0!==n?n:10,this.decay=void 0!==a?a:1,this.castShadow=!1,this.onlyShadow=!1,this.shadowCameraNear=50,this.shadowCameraFar=5e3,this.shadowCameraFov=50,this.shadowCameraVisible=!1,this.shadowBias=0,this.shadowDarkness=.5,this.shadowMapWidth=512,this.shadowMapHeight=512,this.shadowMap=null,this.shadowMapSize=null,this.shadowCamera=null,this.shadowMatrix=null},o.SpotLight.prototype=Object.create(o.Light.prototype),o.SpotLight.prototype.constructor=o.SpotLight,o.SpotLight.prototype.copy=function(e){return o.Light.prototype.copy.call(this,e),this.intensity=e.intensity,this.distance=e.distance,this.angle=e.angle,this.exponent=e.exponent,this.decay=e.decay,this.target=e.target.clone(),this.castShadow=e.castShadow,this.onlyShadow=e.onlyShadow,this.shadowCameraNear=e.shadowCameraNear,this.shadowCameraFar=e.shadowCameraFar,this.shadowCameraFov=e.shadowCameraFov,this.shadowCameraVisible=e.shadowCameraVisible,this.shadowBias=e.shadowBias,this.shadowDarkness=e.shadowDarkness,this.shadowMapWidth=e.shadowMapWidth,this.shadowMapHeight=e.shadowMapHeight,this},o.SpotLight.prototype.toJSON=function(e){var t=o.Object3D.prototype.toJSON.call(this,e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,t.object.distance=this.distance,t.object.angle=this.angle,t.object.exponent=this.exponent,t.object.decay=this.decay,t},o.Cache={enabled:!1,files:{},add:function(e,t){this.enabled!==!1&&(this.files[e]=t)},get:function(e){return this.enabled!==!1?this.files[e]:void 0},remove:function(e){delete this.files[e]},clear:function(){this.files={}}},o.Loader=function(){this.onLoadStart=function(){},this.onLoadProgress=function(){},this.onLoadComplete=function(){}},o.Loader.prototype={constructor:o.Loader,crossOrigin:void 0,extractUrlBase:function(e){var t=e.split("/");return 1===t.length?"./":(t.pop(),t.join("/")+"/")},initMaterials:function(e,t,r){for(var i=[],n=0;nt;t+=2){var i=this.handlers[t],n=this.handlers[t+1];if(i.test(e))return n}return null}},o.XHRLoader=function(e){this.manager=void 0!==e?e:o.DefaultLoadingManager},o.XHRLoader.prototype={constructor:o.XHRLoader,load:function(e,t,r,i){var n=this,a=o.Cache.get(e);if(void 0!==a)return t&&setTimeout(function(){t(a)},0),a;var s=new XMLHttpRequest;return s.open("GET",e,!0),s.addEventListener("load",function(r){o.Cache.add(e,this.response),t&&t(this.response),n.manager.itemEnd(e)},!1),void 0!==r&&s.addEventListener("progress",function(e){r(e)},!1),s.addEventListener("error",function(t){i&&i(t),n.manager.itemError(e)},!1),void 0!==this.crossOrigin&&(s.crossOrigin=this.crossOrigin),void 0!==this.responseType&&(s.responseType=this.responseType),void 0!==this.withCredentials&&(s.withCredentials=this.withCredentials),s.send(null),n.manager.itemStart(e),s},setResponseType:function(e){this.responseType=e},setCrossOrigin:function(e){this.crossOrigin=e},setWithCredentials:function(e){this.withCredentials=e}},o.ImageLoader=function(e){this.manager=void 0!==e?e:o.DefaultLoadingManager},o.ImageLoader.prototype={constructor:o.ImageLoader,load:function(e,t,r,i){var n=this,a=o.Cache.get(e);if(void 0!==a)return t&&setTimeout(function(){t(a)},0),a;var s=document.createElement("img");return s.addEventListener("load",function(r){o.Cache.add(e,this),t&&t(this),n.manager.itemEnd(e)},!1),void 0!==r&&s.addEventListener("progress",function(e){r(e)},!1),s.addEventListener("error",function(t){i&&i(t),n.manager.itemError(e)},!1),void 0!==this.crossOrigin&&(s.crossOrigin=this.crossOrigin),n.manager.itemStart(e),s.src=e,s},setCrossOrigin:function(e){this.crossOrigin=e}},o.JSONLoader=function(e){"boolean"==typeof e&&(console.warn("THREE.JSONLoader: showStatus parameter has been removed from constructor."),e=void 0),this.manager=void 0!==e?e:o.DefaultLoadingManager,this.withCredentials=!1},o.JSONLoader.prototype={constructor:o.JSONLoader,get statusDomElement(){return void 0===this._statusDomElement&&(this._statusDomElement=document.createElement("div")),console.warn("THREE.JSONLoader: .statusDomElement has been removed."),this._statusDomElement},load:function(e,t,r,i){var n=this,a=this.texturePath&&"string"==typeof this.texturePath?this.texturePath:o.Loader.prototype.extractUrlBase(e),s=new o.XHRLoader(this.manager);s.setCrossOrigin(this.crossOrigin),s.setWithCredentials(this.withCredentials),s.load(e,function(r){var i=JSON.parse(r),o=i.metadata;if(void 0!==o){if("object"===o.type)return void console.error("THREE.JSONLoader: "+e+" should be loaded with THREE.ObjectLoader instead.");if("scene"===o.type)return void console.error("THREE.JSONLoader: "+e+" should be loaded with THREE.SceneLoader instead.")}var s=n.parse(i,a);t(s.geometry,s.materials)})},setCrossOrigin:function(e){this.crossOrigin=e},setTexturePath:function(e){this.texturePath=e},parse:function(e,t){function r(t){function r(e,t){return e&1<i;i++)a.faceVertexUvs[i]=[]}for(h=0,c=F.length;c>h;)M=new o.Vector3,M.x=F[h++]*t,M.y=F[h++]*t,M.z=F[h++]*t,a.vertices.push(M);for(h=0,c=D.length;c>h;)if(f=D[h++],m=r(f,0),v=r(f,1),g=r(f,3),y=r(f,4),x=r(f,5),b=r(f,6),w=r(f,7),m){if(S=new o.Face3,S.a=D[h],S.b=D[h+1],S.c=D[h+3],_=new o.Face3,_.a=D[h+1],_.b=D[h+2],_.c=D[h+3],h+=4,v&&(d=D[h++],S.materialIndex=d,_.materialIndex=d),s=a.faces.length,g)for(i=0;k>i;i++)for(C=e.uvs[i],a.faceVertexUvs[i][s]=[],a.faceVertexUvs[i][s+1]=[],n=0;4>n;n++)p=D[h++],P=C[2*p],R=C[2*p+1],L=new o.Vector2(P,R),2!==n&&a.faceVertexUvs[i][s].push(L),0!==n&&a.faceVertexUvs[i][s+1].push(L);if(y&&(l=3*D[h++],S.normal.set(O[l++],O[l++],O[l]),_.normal.copy(S.normal)),x)for(i=0;4>i;i++)l=3*D[h++],T=new o.Vector3(O[l++],O[l++],O[l]),2!==i&&S.vertexNormals.push(T),0!==i&&_.vertexNormals.push(T);if(b&&(u=D[h++],E=U[u],S.color.setHex(E),_.color.setHex(E)),w)for(i=0;4>i;i++)u=D[h++],E=U[u],2!==i&&S.vertexColors.push(new o.Color(E)),0!==i&&_.vertexColors.push(new o.Color(E));a.faces.push(S),a.faces.push(_)}else{if(A=new o.Face3,A.a=D[h++],A.b=D[h++],A.c=D[h++],v&&(d=D[h++],A.materialIndex=d),s=a.faces.length,g)for(i=0;k>i;i++)for(C=e.uvs[i],a.faceVertexUvs[i][s]=[],n=0;3>n;n++)p=D[h++],P=C[2*p],R=C[2*p+1],L=new o.Vector2(P,R),a.faceVertexUvs[i][s].push(L);if(y&&(l=3*D[h++],A.normal.set(O[l++],O[l++],O[l])),x)for(i=0;3>i;i++)l=3*D[h++],T=new o.Vector3(O[l++],O[l++],O[l]),A.vertexNormals.push(T);if(b&&(u=D[h++],A.color.setHex(U[u])),w)for(i=0;3>i;i++)u=D[h++],A.vertexColors.push(new o.Color(U[u]));a.faces.push(A)}}function i(){var t=void 0!==e.influencesPerVertex?e.influencesPerVertex:2;if(e.skinWeights)for(var r=0,i=e.skinWeights.length;i>r;r+=t){var n=e.skinWeights[r],s=t>1?e.skinWeights[r+1]:0,h=t>2?e.skinWeights[r+2]:0,c=t>3?e.skinWeights[r+3]:0;a.skinWeights.push(new o.Vector4(n,s,h,c))}if(e.skinIndices)for(var r=0,i=e.skinIndices.length;i>r;r+=t){var u=e.skinIndices[r],l=t>1?e.skinIndices[r+1]:0,p=t>2?e.skinIndices[r+2]:0,d=t>3?e.skinIndices[r+3]:0;a.skinIndices.push(new o.Vector4(u,l,p,d))}a.bones=e.bones,a.bones&&a.bones.length>0&&(a.skinWeights.length!==a.skinIndices.length||a.skinIndices.length!==a.vertices.length)&&console.warn("When skinning, number of vertices ("+a.vertices.length+"), skinIndices ("+a.skinIndices.length+"), and skinWeights ("+a.skinWeights.length+") should match."),a.animation=e.animation,a.animations=e.animations}function n(t){if(void 0!==e.morphTargets){var r,i,n,s,h,c;for(r=0,i=e.morphTargets.length;i>r;r++)for(a.morphTargets[r]={},a.morphTargets[r].name=e.morphTargets[r].name,a.morphTargets[r].vertices=[],h=a.morphTargets[r].vertices,c=e.morphTargets[r].vertices,n=0,s=c.length;s>n;n+=3){var u=new o.Vector3;u.x=c[n]*t,u.y=c[n+1]*t,u.z=c[n+2]*t,h.push(u)}}if(void 0!==e.morphColors){var r,i,l,p,d,f,m;for(r=0,i=e.morphColors.length;i>r;r++)for(a.morphColors[r]={},a.morphColors[r].name=e.morphColors[r].name,a.morphColors[r].colors=[],d=a.morphColors[r].colors,f=e.morphColors[r].colors,l=0,p=f.length;p>l;l+=3)m=new o.Color(16755200),m.setRGB(f[l],f[l+1],f[l+2]),d.push(m)}}var a=new o.Geometry,s=void 0!==e.scale?1/e.scale:1;if(r(s),i(),n(s),a.computeFaceNormals(),a.computeBoundingSphere(),void 0===e.materials||0===e.materials.length)return{geometry:a};var h=o.Loader.prototype.initMaterials(e.materials,t,this.crossOrigin);return{geometry:a,materials:h}}},o.LoadingManager=function(e,t,r){var i=this,n=!1,o=0,a=0;this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=r,this.itemStart=function(e){a++,n===!1&&void 0!==i.onStart&&i.onStart(e,o,a),n=!0},this.itemEnd=function(e){o++,void 0!==i.onProgress&&i.onProgress(e,o,a),o===a&&(n=!1,void 0!==i.onLoad&&i.onLoad())},this.itemError=function(e){void 0!==i.onError&&i.onError(e)}},o.DefaultLoadingManager=new o.LoadingManager,o.BufferGeometryLoader=function(e){this.manager=void 0!==e?e:o.DefaultLoadingManager},o.BufferGeometryLoader.prototype={constructor:o.BufferGeometryLoader,load:function(e,t,r,i){var n=this,a=new o.XHRLoader(n.manager);a.setCrossOrigin(this.crossOrigin),a.load(e,function(e){t(n.parse(JSON.parse(e)))},r,i)},setCrossOrigin:function(e){this.crossOrigin=e},parse:function(e){var t=new o.BufferGeometry,r=e.data.index;if(void 0!==r){var i=new self[r.type](r.array);t.addIndex(new o.BufferAttribute(i,1))}var n=e.data.attributes;for(var a in n){var s=n[a],i=new self[s.type](s.array);t.addAttribute(a,new o.BufferAttribute(i,s.itemSize))}var h=e.data.groups||e.data.drawcalls||e.data.offsets;if(void 0!==h)for(var c=0,u=h.length;c!==u;++c){var l=h[c];t.addGroup(l.start,l.count)}var p=e.data.boundingSphere;if(void 0!==p){var d=new o.Vector3;void 0!==p.center&&d.fromArray(p.center),t.boundingSphere=new o.Sphere(d,p.radius)}return t}},o.MaterialLoader=function(e){this.manager=void 0!==e?e:o.DefaultLoadingManager,this.textures={}},o.MaterialLoader.prototype={constructor:o.MaterialLoader,load:function(e,t,r,i){var n=this,a=new o.XHRLoader(n.manager);a.setCrossOrigin(this.crossOrigin),a.load(e,function(e){t(n.parse(JSON.parse(e)))},r,i)},setCrossOrigin:function(e){this.crossOrigin=e},setTextures:function(e){this.textures=e},getTexture:function(e){var t=this.textures;return void 0===t[e]&&console.warn("THREE.MaterialLoader: Undefined texture",e),t[e]},parse:function(e){var t=new o[e.type];if(t.uuid=e.uuid,void 0!==e.name&&(t.name=e.name),void 0!==e.color&&t.color.setHex(e.color),void 0!==e.emissive&&t.emissive.setHex(e.emissive),void 0!==e.specular&&t.specular.setHex(e.specular),void 0!==e.shininess&&(t.shininess=e.shininess),void 0!==e.uniforms&&(t.uniforms=e.uniforms),void 0!==e.vertexShader&&(t.vertexShader=e.vertexShader),void 0!==e.fragmentShader&&(t.fragmentShader=e.fragmentShader),void 0!==e.vertexColors&&(t.vertexColors=e.vertexColors),void 0!==e.shading&&(t.shading=e.shading),void 0!==e.blending&&(t.blending=e.blending),void 0!==e.side&&(t.side=e.side),void 0!==e.opacity&&(t.opacity=e.opacity),void 0!==e.transparent&&(t.transparent=e.transparent),void 0!==e.alphaTest&&(t.alphaTest=e.alphaTest),void 0!==e.depthTest&&(t.depthTest=e.depthTest),void 0!==e.depthWrite&&(t.depthWrite=e.depthWrite),void 0!==e.wireframe&&(t.wireframe=e.wireframe),void 0!==e.wireframeLinewidth&&(t.wireframeLinewidth=e.wireframeLinewidth),void 0!==e.size&&(t.size=e.size),void 0!==e.sizeAttenuation&&(t.sizeAttenuation=e.sizeAttenuation),void 0!==e.map&&(t.map=this.getTexture(e.map)),void 0!==e.alphaMap&&(t.alphaMap=this.getTexture(e.alphaMap),t.transparent=!0),void 0!==e.bumpMap&&(t.bumpMap=this.getTexture(e.bumpMap)),void 0!==e.bumpScale&&(t.bumpScale=e.bumpScale),void 0!==e.normalMap&&(t.normalMap=this.getTexture(e.normalMap)),e.normalScale&&(t.normalScale=new o.Vector2(e.normalScale,e.normalScale)),void 0!==e.displacementMap&&(t.displacementMap=this.getTexture(e.displacementMap)),void 0!==e.displacementScale&&(t.displacementScale=e.displacementScale),void 0!==e.displacementBias&&(t.displacementBias=e.displacementBias),void 0!==e.specularMap&&(t.specularMap=this.getTexture(e.specularMap)),void 0!==e.envMap&&(t.envMap=this.getTexture(e.envMap),t.combine=o.MultiplyOperation),e.reflectivity&&(t.reflectivity=e.reflectivity),void 0!==e.lightMap&&(t.lightMap=this.getTexture(e.lightMap)),void 0!==e.lightMapIntensity&&(t.lightMapIntensity=e.lightMapIntensity),void 0!==e.aoMap&&(t.aoMap=this.getTexture(e.aoMap)),void 0!==e.aoMapIntensity&&(t.aoMapIntensity=e.aoMapIntensity),void 0!==e.materials)for(var r=0,i=e.materials.length;i>r;r++)t.materials.push(this.parse(e.materials[r]));return t}},o.ObjectLoader=function(e){this.manager=void 0!==e?e:o.DefaultLoadingManager,this.texturePath=""},o.ObjectLoader.prototype={constructor:o.ObjectLoader,load:function(e,t,r,i){""===this.texturePath&&(this.texturePath=e.substring(0,e.lastIndexOf("/")+1));var n=this,a=new o.XHRLoader(n.manager);a.setCrossOrigin(this.crossOrigin),a.load(e,function(e){n.parse(JSON.parse(e),t)},r,i)},setTexturePath:function(e){this.texturePath=e},setCrossOrigin:function(e){this.crossOrigin=e},parse:function(e,t){var r=this.parseGeometries(e.geometries),i=this.parseImages(e.images,function(){void 0!==t&&t(a)}),n=this.parseTextures(e.textures,i),o=this.parseMaterials(e.materials,n),a=this.parseObject(e.object,r,o);return(void 0===e.images||0===e.images.length)&&void 0!==t&&t(a),a},parseGeometries:function(e){var t={};if(void 0!==e)for(var r=new o.JSONLoader,i=new o.BufferGeometryLoader,n=0,a=e.length;a>n;n++){var s,h=e[n];switch(h.type){case"PlaneGeometry":case"PlaneBufferGeometry":s=new o[h.type](h.width,h.height,h.widthSegments,h.heightSegments);break;case"BoxGeometry":case"CubeGeometry":s=new o.BoxGeometry(h.width,h.height,h.depth,h.widthSegments,h.heightSegments,h.depthSegments);break;case"CircleBufferGeometry":s=new o.CircleBufferGeometry(h.radius,h.segments,h.thetaStart,h.thetaLength); +break;case"CircleGeometry":s=new o.CircleGeometry(h.radius,h.segments,h.thetaStart,h.thetaLength);break;case"CylinderGeometry":s=new o.CylinderGeometry(h.radiusTop,h.radiusBottom,h.height,h.radialSegments,h.heightSegments,h.openEnded,h.thetaStart,h.thetaLength);break;case"SphereGeometry":s=new o.SphereGeometry(h.radius,h.widthSegments,h.heightSegments,h.phiStart,h.phiLength,h.thetaStart,h.thetaLength);break;case"SphereBufferGeometry":s=new o.SphereBufferGeometry(h.radius,h.widthSegments,h.heightSegments,h.phiStart,h.phiLength,h.thetaStart,h.thetaLength);break;case"DodecahedronGeometry":s=new o.DodecahedronGeometry(h.radius,h.detail);break;case"IcosahedronGeometry":s=new o.IcosahedronGeometry(h.radius,h.detail);break;case"OctahedronGeometry":s=new o.OctahedronGeometry(h.radius,h.detail);break;case"TetrahedronGeometry":s=new o.TetrahedronGeometry(h.radius,h.detail);break;case"RingGeometry":s=new o.RingGeometry(h.innerRadius,h.outerRadius,h.thetaSegments,h.phiSegments,h.thetaStart,h.thetaLength);break;case"TorusGeometry":s=new o.TorusGeometry(h.radius,h.tube,h.radialSegments,h.tubularSegments,h.arc);break;case"TorusKnotGeometry":s=new o.TorusKnotGeometry(h.radius,h.tube,h.radialSegments,h.tubularSegments,h.p,h.q,h.heightScale);break;case"TextGeometry":s=new o.TextGeometry(h.text,h.data);break;case"BufferGeometry":s=i.parse(h);break;case"Geometry":s=r.parse(h.data,this.texturePath).geometry;break;default:console.warn('THREE.ObjectLoader: Unsupported geometry type "'+h.type+'"');continue}s.uuid=h.uuid,void 0!==h.name&&(s.name=h.name),t[h.uuid]=s}return t},parseMaterials:function(e,t){var r={};if(void 0!==e){var i=new o.MaterialLoader;i.setTextures(t);for(var n=0,a=e.length;a>n;n++){var s=i.parse(e[n]);r[s.uuid]=s}}return r},parseImages:function(e,t){var r=this,i={};if(void 0!==e&&e.length>0){var n=new o.LoadingManager(t),a=new o.ImageLoader(n);a.setCrossOrigin(this.crossOrigin);for(var s=function(e){return e=r.texturePath+e,r.manager.itemStart(e),a.load(e,function(){r.manager.itemEnd(e)})},h=0,c=e.length;c>h;h++){var u=e[h];i[u.uuid]=s(u.url)}}return i},parseTextures:function(e,t){function r(e){return"number"==typeof e?e:(console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.",e),o[e])}var i={};if(void 0!==e)for(var n=0,a=e.length;a>n;n++){var s=e[n];void 0===s.image&&console.warn('THREE.ObjectLoader: No "image" specified for',s.uuid),void 0===t[s.image]&&console.warn("THREE.ObjectLoader: Undefined image",s.image);var h=new o.Texture(t[s.image]);h.needsUpdate=!0,h.uuid=s.uuid,void 0!==s.name&&(h.name=s.name),void 0!==s.mapping&&(h.mapping=r(s.mapping)),void 0!==s.offset&&(h.offset=new o.Vector2(s.offset[0],s.offset[1])),void 0!==s.repeat&&(h.repeat=new o.Vector2(s.repeat[0],s.repeat[1])),void 0!==s.minFilter&&(h.minFilter=r(s.minFilter)),void 0!==s.magFilter&&(h.magFilter=r(s.magFilter)),void 0!==s.anisotropy&&(h.anisotropy=s.anisotropy),Array.isArray(s.wrap)&&(h.wrapS=r(s.wrap[0]),h.wrapT=r(s.wrap[1])),i[s.uuid]=h}return i},parseObject:function(){var e=new o.Matrix4;return function(t,r,i){var n,a=function(e){return void 0===r[e]&&console.warn("THREE.ObjectLoader: Undefined geometry",e),r[e]},s=function(e){return void 0===i[e]&&console.warn("THREE.ObjectLoader: Undefined material",e),i[e]};switch(t.type){case"Scene":n=new o.Scene;break;case"PerspectiveCamera":n=new o.PerspectiveCamera(t.fov,t.aspect,t.near,t.far);break;case"OrthographicCamera":n=new o.OrthographicCamera(t.left,t.right,t.top,t.bottom,t.near,t.far);break;case"AmbientLight":n=new o.AmbientLight(t.color);break;case"DirectionalLight":n=new o.DirectionalLight(t.color,t.intensity);break;case"PointLight":n=new o.PointLight(t.color,t.intensity,t.distance,t.decay);break;case"SpotLight":n=new o.SpotLight(t.color,t.intensity,t.distance,t.angle,t.exponent,t.decay);break;case"HemisphereLight":n=new o.HemisphereLight(t.color,t.groundColor,t.intensity);break;case"Mesh":n=new o.Mesh(a(t.geometry),s(t.material));break;case"LOD":n=new o.LOD;break;case"Line":n=new o.Line(a(t.geometry),s(t.material),t.mode);break;case"PointCloud":case"Points":n=new o.Points(a(t.geometry),s(t.material));break;case"Sprite":n=new o.Sprite(s(t.material));break;case"Group":n=new o.Group;break;default:n=new o.Object3D}if(n.uuid=t.uuid,void 0!==t.name&&(n.name=t.name),void 0!==t.matrix?(e.fromArray(t.matrix),e.decompose(n.position,n.quaternion,n.scale)):(void 0!==t.position&&n.position.fromArray(t.position),void 0!==t.rotation&&n.rotation.fromArray(t.rotation),void 0!==t.scale&&n.scale.fromArray(t.scale)),void 0!==t.castShadow&&(n.castShadow=t.castShadow),void 0!==t.receiveShadow&&(n.receiveShadow=t.receiveShadow),void 0!==t.visible&&(n.visible=t.visible),void 0!==t.userData&&(n.userData=t.userData),void 0!==t.children)for(var h in t.children)n.add(this.parseObject(t.children[h],r,i));if("LOD"===t.type)for(var c=t.levels,u=0;ul;++l)u(l);else h.load(e,function(e){var r=n._parser(e,!0);if(r.isCubemap)for(var i=r.mipmaps.length/r.mipmapCount,h=0;i>h;h++){a[h]={mipmaps:[]};for(var c=0;c0&&(t.alphaTest=this.alphaTest),this.wireframe===!0&&(t.wireframe=this.wireframe),this.wireframeLinewidth>1&&(t.wireframeLinewidth=this.wireframeLinewidth),t},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.name=e.name,this.side=e.side,this.opacity=e.opacity,this.transparent=e.transparent,this.blending=e.blending,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.alphaTest=e.alphaTest,this.overdraw=e.overdraw,this.visible=e.visible,this},update:function(){this.dispatchEvent({type:"update"})},dispose:function(){this.dispatchEvent({type:"dispose"})},get wrapAround(){console.warn("THREE."+this.type+": .wrapAround has been removed.")},set wrapAround(e){console.warn("THREE."+this.type+": .wrapAround has been removed.")},get wrapRGB(){return console.warn("THREE."+this.type+": .wrapRGB has been removed."),new o.Color}},o.EventDispatcher.prototype.apply(o.Material.prototype),o.MaterialIdCount=0,o.LineBasicMaterial=function(e){o.Material.call(this),this.type="LineBasicMaterial",this.color=new o.Color(16777215),this.linewidth=1,this.linecap="round",this.linejoin="round",this.vertexColors=o.NoColors,this.fog=!0,this.setValues(e)},o.LineBasicMaterial.prototype=Object.create(o.Material.prototype),o.LineBasicMaterial.prototype.constructor=o.LineBasicMaterial,o.LineBasicMaterial.prototype.copy=function(e){return o.Material.prototype.copy.call(this,e),this.color.copy(e.color),this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.vertexColors=e.vertexColors,this.fog=e.fog,this},o.LineDashedMaterial=function(e){o.Material.call(this),this.type="LineDashedMaterial",this.color=new o.Color(16777215),this.linewidth=1,this.scale=1,this.dashSize=3,this.gapSize=1,this.vertexColors=!1,this.fog=!0,this.setValues(e)},o.LineDashedMaterial.prototype=Object.create(o.Material.prototype),o.LineDashedMaterial.prototype.constructor=o.LineDashedMaterial,o.LineDashedMaterial.prototype.copy=function(e){return o.Material.prototype.copy.call(this,e),this.color.copy(e.color),this.linewidth=e.linewidth,this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this.vertexColors=e.vertexColors,this.fog=e.fog,this},o.MeshBasicMaterial=function(e){o.Material.call(this),this.type="MeshBasicMaterial",this.color=new o.Color(16777215),this.map=null,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=o.MultiplyOperation,this.reflectivity=1,this.refractionRatio=.98,this.fog=!0,this.shading=o.SmoothShading,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.vertexColors=o.NoColors,this.skinning=!1,this.morphTargets=!1,this.setValues(e)},o.MeshBasicMaterial.prototype=Object.create(o.Material.prototype),o.MeshBasicMaterial.prototype.constructor=o.MeshBasicMaterial,o.MeshBasicMaterial.prototype.copy=function(e){return o.Material.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.fog=e.fog,this.shading=e.shading,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.vertexColors=e.vertexColors,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this},o.MeshLambertMaterial=function(e){o.Material.call(this),this.type="MeshLambertMaterial",this.color=new o.Color(16777215),this.emissive=new o.Color(0),this.map=null,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=o.MultiplyOperation,this.reflectivity=1,this.refractionRatio=.98,this.fog=!0,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.vertexColors=o.NoColors,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(e)},o.MeshLambertMaterial.prototype=Object.create(o.Material.prototype),o.MeshLambertMaterial.prototype.constructor=o.MeshLambertMaterial,o.MeshLambertMaterial.prototype.copy=function(e){return o.Material.prototype.copy.call(this,e),this.color.copy(e.color),this.emissive.copy(e.emissive),this.map=e.map,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.fog=e.fog,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.vertexColors=e.vertexColors,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},o.MeshPhongMaterial=function(e){o.Material.call(this),this.type="MeshPhongMaterial",this.color=new o.Color(16777215),this.emissive=new o.Color(0),this.specular=new o.Color(1118481),this.shininess=30,this.metal=!1,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalScale=new o.Vector2(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=o.MultiplyOperation,this.reflectivity=1,this.refractionRatio=.98,this.fog=!0,this.shading=o.SmoothShading,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.vertexColors=o.NoColors,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(e)},o.MeshPhongMaterial.prototype=Object.create(o.Material.prototype),o.MeshPhongMaterial.prototype.constructor=o.MeshPhongMaterial,o.MeshPhongMaterial.prototype.copy=function(e){return o.Material.prototype.copy.call(this,e),this.color.copy(e.color),this.emissive.copy(e.emissive),this.specular.copy(e.specular),this.shininess=e.shininess,this.metal=e.metal,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissiveMap=e.emissiveMap,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.fog=e.fog,this.shading=e.shading,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.vertexColors=e.vertexColors,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},o.MeshDepthMaterial=function(e){o.Material.call(this),this.type="MeshDepthMaterial",this.morphTargets=!1,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)},o.MeshDepthMaterial.prototype=Object.create(o.Material.prototype),o.MeshDepthMaterial.prototype.constructor=o.MeshDepthMaterial,o.MeshDepthMaterial.prototype.copy=function(e){return o.Material.prototype.copy.call(this,e),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this},o.MeshNormalMaterial=function(e){o.Material.call(this,e),this.type="MeshNormalMaterial",this.wireframe=!1,this.wireframeLinewidth=1,this.morphTargets=!1,this.setValues(e)},o.MeshNormalMaterial.prototype=Object.create(o.Material.prototype),o.MeshNormalMaterial.prototype.constructor=o.MeshNormalMaterial,o.MeshNormalMaterial.prototype.copy=function(e){return o.Material.prototype.copy.call(this,e),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this},o.MultiMaterial=function(e){this.uuid=o.Math.generateUUID(),this.type="MultiMaterial",this.materials=e instanceof Array?e:[],this.visible=!0},o.MultiMaterial.prototype={constructor:o.MultiMaterial,toJSON:function(){for(var e={metadata:{version:4.2,type:"material",generator:"MaterialExporter"},uuid:this.uuid,type:this.type,materials:[]},t=0,r=this.materials.length;r>t;t++)e.materials.push(this.materials[t].toJSON());return e.visible=this.visible,e},clone:function(){for(var e=new this.constructor,t=0;t2048||t.height>2048?t.toDataURL("image/jpeg",.6):t.toDataURL("image/png")}if(void 0!==e.textures[this.uuid])return e.textures[this.uuid];var r={metadata:{version:4.4,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,mapping:this.mapping,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],wrap:[this.wrapS,this.wrapT],minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy};if(void 0!==this.image){var i=this.image;void 0===i.uuid&&(i.uuid=o.Math.generateUUID()),void 0===e.images[i.uuid]&&(e.images[i.uuid]={uuid:i.uuid,url:t(i)}),r.image=i.uuid}return e.textures[this.uuid]=r,r},dispose:function(){this.dispatchEvent({type:"dispose"})},transformUv:function(e){if(this.mapping===o.UVMapping){if(e.multiply(this.repeat),e.add(this.offset),e.x<0||e.x>1)switch(this.wrapS){case o.RepeatWrapping:e.x=e.x-Math.floor(e.x);break;case o.ClampToEdgeWrapping:e.x=e.x<0?0:1;break;case o.MirroredRepeatWrapping:1===Math.abs(Math.floor(e.x)%2)?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x)}if(e.y<0||e.y>1)switch(this.wrapT){case o.RepeatWrapping:e.y=e.y-Math.floor(e.y);break;case o.ClampToEdgeWrapping:e.y=e.y<0?0:1;break;case o.MirroredRepeatWrapping:1===Math.abs(Math.floor(e.y)%2)?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y)}this.flipY&&(e.y=1-e.y)}}},o.EventDispatcher.prototype.apply(o.Texture.prototype),o.TextureIdCount=0,o.CanvasTexture=function(e,t,r,i,n,a,s,h,c){o.Texture.call(this,e,t,r,i,n,a,s,h,c),this.needsUpdate=!0},o.CanvasTexture.prototype=Object.create(o.Texture.prototype),o.CanvasTexture.prototype.constructor=o.CanvasTexture,o.CubeTexture=function(e,t,r,i,n,a,s,h,c){t=void 0!==t?t:o.CubeReflectionMapping,o.Texture.call(this,e,t,r,i,n,a,s,h,c),this.images=e,this.flipY=!1},o.CubeTexture.prototype=Object.create(o.Texture.prototype),o.CubeTexture.prototype.constructor=o.CubeTexture,o.CubeTexture.prototype.copy=function(e){return o.Texture.prototype.copy.call(this,e),this.images=e.images,this},o.CompressedTexture=function(e,t,r,i,n,a,s,h,c,u,l){o.Texture.call(this,null,a,s,h,c,u,i,n,l),this.image={width:t,height:r},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1},o.CompressedTexture.prototype=Object.create(o.Texture.prototype),o.CompressedTexture.prototype.constructor=o.CompressedTexture,o.DataTexture=function(e,t,r,i,n,a,s,h,c,u,l){o.Texture.call(this,null,a,s,h,c,u,i,n,l),this.image={data:e,width:t,height:r},this.magFilter=void 0!==c?c:o.NearestFilter,this.minFilter=void 0!==u?u:o.NearestFilter,this.flipY=!1,this.generateMipmaps=!1},o.DataTexture.prototype=Object.create(o.Texture.prototype),o.DataTexture.prototype.constructor=o.DataTexture,o.VideoTexture=function(e,t,r,i,n,a,s,h,c){o.Texture.call(this,e,t,r,i,n,a,s,h,c),this.generateMipmaps=!1;var u=this,l=function(){requestAnimationFrame(l),e.readyState===e.HAVE_ENOUGH_DATA&&(u.needsUpdate=!0)};l()},o.VideoTexture.prototype=Object.create(o.Texture.prototype),o.VideoTexture.prototype.constructor=o.VideoTexture,o.Group=function(){o.Object3D.call(this),this.type="Group"},o.Group.prototype=Object.create(o.Object3D.prototype),o.Group.prototype.constructor=o.Group,o.Points=function(e,t){o.Object3D.call(this),this.type="Points",this.geometry=void 0!==e?e:new o.Geometry,this.material=void 0!==t?t:new o.PointsMaterial({color:16777215*Math.random()})},o.Points.prototype=Object.create(o.Object3D.prototype),o.Points.prototype.constructor=o.Points,o.Points.prototype.raycast=function(){var e=new o.Matrix4,t=new o.Ray;return function(r,i){function n(e,n){var o=t.distanceSqToPoint(e);if(u>o){var s=t.closestPointToPoint(e);s.applyMatrix4(a.matrixWorld);var h=r.ray.origin.distanceTo(s);if(hr.far)return;i.push({distance:h,distanceToRay:Math.sqrt(o),point:s.clone(),index:n,face:null,object:a})}}var a=this,s=a.geometry,h=r.params.Points.threshold;if(e.getInverse(this.matrixWorld),t.copy(r.ray).applyMatrix4(e),null===s.boundingBox||t.isIntersectionBox(s.boundingBox)!==!1){var c=h/((this.scale.x+this.scale.y+this.scale.z)/3),u=c*c,l=new o.Vector3;if(s instanceof o.BufferGeometry){var p=s.index,d=s.attributes,f=d.position.array;if(null!==p)for(var m=p.array,v=0,g=m.length;g>v;v++){var y=m[v];l.fromArray(f,3*y),n(l,y)}else for(var v=0,x=f.length/3;x>v;v++)l.fromArray(f,3*v),n(l,v)}else for(var b=s.vertices,v=0,x=b.length;x>v;v++)n(b[v],v)}}}(),o.Points.prototype.clone=function(){return new this.constructor(this.geometry,this.material).copy(this)},o.Points.prototype.toJSON=function(e){var t=o.Object3D.prototype.toJSON.call(this,e);return void 0===e.geometries[this.geometry.uuid]&&(e.geometries[this.geometry.uuid]=this.geometry.toJSON()),void 0===e.materials[this.material.uuid]&&(e.materials[this.material.uuid]=this.material.toJSON()),t.object.geometry=this.geometry.uuid,t.object.material=this.material.uuid,t},o.PointCloud=function(e,t){return console.warn("THREE.PointCloud has been renamed to THREE.Points."),new o.Points(e,t)},o.ParticleSystem=function(e,t){return console.warn("THREE.ParticleSystem has been renamed to THREE.Points."),new o.Points(e,t)},o.Line=function(e,t,r){return 1===r?(console.warn("THREE.Line: parameter THREE.LinePieces no longer supported. Created THREE.LineSegments instead."),new o.LineSegments(e,t)):(o.Object3D.call(this),this.type="Line",this.geometry=void 0!==e?e:new o.Geometry,void(this.material=void 0!==t?t:new o.LineBasicMaterial({color:16777215*Math.random()})))},o.Line.prototype=Object.create(o.Object3D.prototype),o.Line.prototype.constructor=o.Line,o.Line.prototype.raycast=function(){var e=new o.Matrix4,t=new o.Ray,r=new o.Sphere;return function(i,n){var a=i.linePrecision,s=a*a,h=this.geometry;if(null===h.boundingSphere&&h.computeBoundingSphere(),r.copy(h.boundingSphere),r.applyMatrix4(this.matrixWorld),i.ray.isIntersectionSphere(r)!==!1){e.getInverse(this.matrixWorld),t.copy(i.ray).applyMatrix4(e);var c=new o.Vector3,u=new o.Vector3,l=new o.Vector3,p=new o.Vector3,d=this instanceof o.LineSegments?2:1;if(h instanceof o.BufferGeometry){var f=h.index,m=h.attributes;if(null!==f)for(var v=f.array,g=m.position.array,y=0,x=v.length-1;x>y;y+=d){var b=v[y],w=v[y+1];c.fromArray(g,3*b),u.fromArray(g,3*w);var M=t.distanceSqToSegment(c,u,p,l);if(!(M>s)){p.applyMatrix4(this.matrixWorld);var A=i.ray.origin.distanceTo(p);Ai.far||n.push({distance:A,point:l.clone().applyMatrix4(this.matrixWorld),index:y,face:null,faceIndex:null,object:this})}}else for(var g=m.position.array,y=0,x=g.length/3-1;x>y;y+=d){c.fromArray(g,3*y),u.fromArray(g,3*y+3);var M=t.distanceSqToSegment(c,u,p,l);if(!(M>s)){p.applyMatrix4(this.matrixWorld);var A=i.ray.origin.distanceTo(p);Ai.far||n.push({distance:A,point:l.clone().applyMatrix4(this.matrixWorld),index:y,face:null,faceIndex:null,object:this})}}}else if(h instanceof o.Geometry)for(var S=h.vertices,_=S.length,y=0;_-1>y;y+=d){var M=t.distanceSqToSegment(S[y],S[y+1],p,l);if(!(M>s)){p.applyMatrix4(this.matrixWorld);var A=i.ray.origin.distanceTo(p);Ai.far||n.push({distance:A,point:l.clone().applyMatrix4(this.matrixWorld),index:y,face:null,faceIndex:null,object:this})}}}}}(),o.Line.prototype.clone=function(){return new this.constructor(this.geometry,this.material).copy(this)},o.Line.prototype.toJSON=function(e){var t=o.Object3D.prototype.toJSON.call(this,e);return void 0===e.geometries[this.geometry.uuid]&&(e.geometries[this.geometry.uuid]=this.geometry.toJSON()),void 0===e.materials[this.material.uuid]&&(e.materials[this.material.uuid]=this.material.toJSON()),t.object.geometry=this.geometry.uuid, +t.object.material=this.material.uuid,t},o.LineStrip=0,o.LinePieces=1,o.LineSegments=function(e,t){o.Line.call(this,e,t),this.type="LineSegments"},o.LineSegments.prototype=Object.create(o.Line.prototype),o.LineSegments.prototype.constructor=o.LineSegments,o.Mesh=function(e,t){o.Object3D.call(this),this.type="Mesh",this.geometry=void 0!==e?e:new o.Geometry,this.material=void 0!==t?t:new o.MeshBasicMaterial({color:16777215*Math.random()}),this.updateMorphTargets()},o.Mesh.prototype=Object.create(o.Object3D.prototype),o.Mesh.prototype.constructor=o.Mesh,o.Mesh.prototype.updateMorphTargets=function(){if(void 0!==this.geometry.morphTargets&&this.geometry.morphTargets.length>0){this.morphTargetBase=-1,this.morphTargetInfluences=[],this.morphTargetDictionary={};for(var e=0,t=this.geometry.morphTargets.length;t>e;e++)this.morphTargetInfluences.push(0),this.morphTargetDictionary[this.geometry.morphTargets[e].name]=e}},o.Mesh.prototype.getMorphTargetIndexByName=function(e){return void 0!==this.morphTargetDictionary[e]?this.morphTargetDictionary[e]:(console.warn("THREE.Mesh.getMorphTargetIndexByName: morph target "+e+" does not exist. Returning 0."),0)},o.Mesh.prototype.raycast=function(){function e(e,t,r,i,n,a,s){return o.Triangle.barycoordFromPoint(e,t,r,i,f),n.multiplyScalar(f.x),a.multiplyScalar(f.y),s.multiplyScalar(f.z),n.add(a).add(s),n.clone()}var t=new o.Matrix4,r=new o.Ray,i=new o.Sphere,n=new o.Vector3,a=new o.Vector3,s=new o.Vector3,h=new o.Vector3,c=new o.Vector3,u=new o.Vector3,l=new o.Vector2,p=new o.Vector2,d=new o.Vector2,f=new o.Vector3,m=new o.Vector3,v=new o.Vector3;return function(f,g){var y=this.geometry,x=this.material;if(void 0!==x&&(null===y.boundingSphere&&y.computeBoundingSphere(),i.copy(y.boundingSphere),i.applyMatrix4(this.matrixWorld),f.ray.isIntersectionSphere(i)!==!1&&(t.getInverse(this.matrixWorld),r.copy(f.ray).applyMatrix4(t),null===y.boundingBox||r.isIntersectionBox(y.boundingBox)!==!1))){var b,w,M;if(y instanceof o.BufferGeometry){var A=y.index,S=y.attributes;if(null!==A)for(var _=A.array,E=S.position.array,T=0,C=_.length;C>T;T+=3){if(b=_[T],w=_[T+1],M=_[T+2],n.fromArray(E,3*b),a.fromArray(E,3*w),s.fromArray(E,3*M),x.side===o.BackSide){if(null===r.intersectTriangle(s,a,n,!0,m))continue}else if(null===r.intersectTriangle(n,a,s,x.side!==o.DoubleSide,m))continue;v.copy(m),v.applyMatrix4(this.matrixWorld);var L=f.ray.origin.distanceTo(v);if(!(Lf.far)){var P;if(void 0!==S.uv){var R=S.uv.array;l.fromArray(R,2*b),p.fromArray(R,2*w),d.fromArray(R,2*M),P=e(m,n,a,s,l,p,d)}g.push({distance:L,point:v.clone(),uv:P,face:new o.Face3(b,w,M,o.Triangle.normal(n,a,s)),faceIndex:Math.floor(T/3),object:this})}}else for(var E=S.position.array,T=0,C=E.length;C>T;T+=9){if(n.fromArray(E,T),a.fromArray(E,T+3),s.fromArray(E,T+6),x.side===o.BackSide){if(null===r.intersectTriangle(s,a,n,!0,m))continue}else if(null===r.intersectTriangle(n,a,s,x.side!==o.DoubleSide,m))continue;v.copy(m),v.applyMatrix4(this.matrixWorld);var L=f.ray.origin.distanceTo(v);if(!(Lf.far)){var P;if(void 0!==S.uv){var R=S.uv.array;l.fromArray(R,T),p.fromArray(R,T+2),d.fromArray(R,T+4),P=e(m,n,a,s,l,p,d)}b=T/3,w=b+1,M=b+2,g.push({distance:L,point:v.clone(),uv:P,face:new o.Face3(b,w,M,o.Triangle.normal(n,a,s)),index:b,object:this})}}}else if(y instanceof o.Geometry)for(var D=x instanceof o.MeshFaceMaterial,F=D===!0?x.materials:null,O=y.vertices,U=y.faces,k=0,B=U.length;B>k;k++){var V=U[k],G=D===!0?F[V.materialIndex]:x;if(void 0!==G){if(b=O[V.a],w=O[V.b],M=O[V.c],G.morphTargets===!0){var z=y.morphTargets,N=this.morphTargetInfluences;n.set(0,0,0),a.set(0,0,0),s.set(0,0,0);for(var I=0,j=z.length;j>I;I++){var H=N[I];if(0!==H){var W=z[I].vertices;n.addScaledVector(h.subVectors(W[V.a],b),H),a.addScaledVector(c.subVectors(W[V.b],w),H),s.addScaledVector(u.subVectors(W[V.c],M),H)}}n.add(b),a.add(w),s.add(M),b=n,w=a,M=s}if(G.side===o.BackSide){if(null===r.intersectTriangle(M,w,b,!0,m))continue}else if(null===r.intersectTriangle(b,w,M,G.side!==o.DoubleSide,m))continue;v.copy(m),v.applyMatrix4(this.matrixWorld);var L=f.ray.origin.distanceTo(v);if(!(Lf.far)){var P;if(y.faceVertexUvs[0].length>0){var R=y.faceVertexUvs[0][k];l.copy(R[0]),p.copy(R[1]),d.copy(R[2]),P=e(m,b,w,M,l,p,d)}g.push({distance:L,point:v.clone(),uv:P,face:V,faceIndex:k,object:this})}}}}}}(),o.Mesh.prototype.clone=function(){return new this.constructor(this.geometry,this.material).copy(this)},o.Mesh.prototype.toJSON=function(e){var t=o.Object3D.prototype.toJSON.call(this,e);return void 0===e.geometries[this.geometry.uuid]&&(e.geometries[this.geometry.uuid]=this.geometry.toJSON(e)),void 0===e.materials[this.material.uuid]&&(e.materials[this.material.uuid]=this.material.toJSON(e)),t.object.geometry=this.geometry.uuid,t.object.material=this.material.uuid,t},o.Bone=function(e){o.Object3D.call(this),this.type="Bone",this.skin=e},o.Bone.prototype=Object.create(o.Object3D.prototype),o.Bone.prototype.constructor=o.Bone,o.Bone.prototype.copy=function(e){return o.Object3D.prototype.copy.call(this,e),this.skin=e.skin,this},o.Skeleton=function(e,t,r){if(this.useVertexTexture=void 0!==r?r:!0,this.identityMatrix=new o.Matrix4,e=e||[],this.bones=e.slice(0),this.useVertexTexture){var i=Math.sqrt(4*this.bones.length);i=o.Math.nextPowerOfTwo(Math.ceil(i)),i=Math.max(i,4),this.boneTextureWidth=i,this.boneTextureHeight=i,this.boneMatrices=new Float32Array(this.boneTextureWidth*this.boneTextureHeight*4),this.boneTexture=new o.DataTexture(this.boneMatrices,this.boneTextureWidth,this.boneTextureHeight,o.RGBAFormat,o.FloatType)}else this.boneMatrices=new Float32Array(16*this.bones.length);if(void 0===t)this.calculateInverses();else if(this.bones.length===t.length)this.boneInverses=t.slice(0);else{console.warn("THREE.Skeleton bonInverses is the wrong length."),this.boneInverses=[];for(var n=0,a=this.bones.length;a>n;n++)this.boneInverses.push(new o.Matrix4)}},o.Skeleton.prototype.calculateInverses=function(){this.boneInverses=[];for(var e=0,t=this.bones.length;t>e;e++){var r=new o.Matrix4;this.bones[e]&&r.getInverse(this.bones[e].matrixWorld),this.boneInverses.push(r)}},o.Skeleton.prototype.pose=function(){for(var e,t=0,r=this.bones.length;r>t;t++)e=this.bones[t],e&&e.matrixWorld.getInverse(this.boneInverses[t]);for(var t=0,r=this.bones.length;r>t;t++)e=this.bones[t],e&&(e.parent?(e.matrix.getInverse(e.parent.matrixWorld),e.matrix.multiply(e.matrixWorld)):e.matrix.copy(e.matrixWorld),e.matrix.decompose(e.position,e.quaternion,e.scale))},o.Skeleton.prototype.update=function(){var e=new o.Matrix4;return function(){for(var t=0,r=this.bones.length;r>t;t++){var i=this.bones[t]?this.bones[t].matrixWorld:this.identityMatrix;e.multiplyMatrices(i,this.boneInverses[t]),e.flattenToArrayOffset(this.boneMatrices,16*t)}this.useVertexTexture&&(this.boneTexture.needsUpdate=!0)}}(),o.Skeleton.prototype.clone=function(){return new o.Skeleton(this.bones,this.boneInverses,this.useVertexTexture)},o.SkinnedMesh=function(e,t,r){o.Mesh.call(this,e,t),this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new o.Matrix4,this.bindMatrixInverse=new o.Matrix4;var i=[];if(this.geometry&&void 0!==this.geometry.bones){for(var n,a,s=0,h=this.geometry.bones.length;h>s;++s)a=this.geometry.bones[s],n=new o.Bone(this),i.push(n),n.name=a.name,n.position.fromArray(a.pos),n.quaternion.fromArray(a.rotq),void 0!==a.scl&&n.scale.fromArray(a.scl);for(var s=0,h=this.geometry.bones.length;h>s;++s)a=this.geometry.bones[s],-1!==a.parent?i[a.parent].add(i[s]):this.add(i[s])}this.normalizeSkinWeights(),this.updateMatrixWorld(!0),this.bind(new o.Skeleton(i,void 0,r),this.matrixWorld)},o.SkinnedMesh.prototype=Object.create(o.Mesh.prototype),o.SkinnedMesh.prototype.constructor=o.SkinnedMesh,o.SkinnedMesh.prototype.bind=function(e,t){this.skeleton=e,void 0===t&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),t=this.matrixWorld),this.bindMatrix.copy(t),this.bindMatrixInverse.getInverse(t)},o.SkinnedMesh.prototype.pose=function(){this.skeleton.pose()},o.SkinnedMesh.prototype.normalizeSkinWeights=function(){if(this.geometry instanceof o.Geometry)for(var e=0;en;n++){var a=e.morphTargets[n],s=a.name.match(i);if(s&&s.length>1){var h=s[1];r[h]||(r[h]={start:1/0,end:-(1/0)});var c=r[h];nc.end&&(c.end=n),t||(t=h)}}e.firstAnimation=t},o.MorphAnimMesh.prototype.setAnimationLabel=function(e,t,r){this.geometry.animations||(this.geometry.animations={}),this.geometry.animations[e]={start:t,end:r}},o.MorphAnimMesh.prototype.playAnimation=function(e,t){var r=this.geometry.animations[e];r?(this.setFrameRange(r.start,r.end),this.duration=1e3*((r.end-r.start)/t),this.time=0):console.warn("THREE.MorphAnimMesh: animation["+e+"] undefined in .playAnimation()")},o.MorphAnimMesh.prototype.updateAnimation=function(e){var t=this.duration/this.length;this.time+=this.direction*e,this.mirroredLoop?(this.time>this.duration||this.time<0)&&(this.direction*=-1,this.time>this.duration&&(this.time=this.duration,this.directionBackwards=!0),this.time<0&&(this.time=0,this.directionBackwards=!1)):(this.time=this.time%this.duration,this.time<0&&(this.time+=this.duration));var r=this.startKeyframe+o.Math.clamp(Math.floor(this.time/t),0,this.length-1),i=this.morphTargetInfluences;r!==this.currentKeyframe&&(i[this.lastKeyframe]=0,i[this.currentKeyframe]=1,i[r]=0,this.lastKeyframe=this.currentKeyframe,this.currentKeyframe=r);var n=this.time%t/t;this.directionBackwards&&(n=1-n),i[this.currentKeyframe]=n,i[this.lastKeyframe]=1-n},o.MorphAnimMesh.prototype.interpolateTargets=function(e,t,r){for(var i=this.morphTargetInfluences,n=0,o=i.length;o>n;n++)i[n]=0;e>-1&&(i[e]=1-r),t>-1&&(i[t]=r)},o.MorphAnimMesh.prototype.copy=function(e){return o.Mesh.prototype.copy.call(this,e),this.duration=e.duration,this.mirroredLoop=e.mirroredLoop,this.time=e.time,this.lastKeyframe=e.lastKeyframe,this.currentKeyframe=e.currentKeyframe,this.direction=e.direction,this.directionBackwards=e.directionBackwards,this},o.LOD=function(){o.Object3D.call(this),this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]},objects:{get:function(){return console.warn("THREE.LOD: .objects has been renamed to .levels."),this.levels}}})},o.LOD.prototype=Object.create(o.Object3D.prototype),o.LOD.prototype.constructor=o.LOD,o.LOD.prototype.addLevel=function(e,t){void 0===t&&(t=0),t=Math.abs(t);for(var r=this.levels,i=0;ir&&!(e1){e.setFromMatrixPosition(r.matrixWorld),t.setFromMatrixPosition(this.matrixWorld);var n=e.distanceTo(t);i[0].object.visible=!0;for(var o=1,a=i.length;a>o&&n>=i[o].distance;o++)i[o-1].object.visible=!1,i[o].object.visible=!0;for(;a>o;o++)i[o].object.visible=!1}}}(),o.LOD.prototype.copy=function(e){o.Object3D.prototype.copy.call(this,e,!1);for(var t=e.levels,r=0,i=t.length;i>r;r++){var n=t[r];this.addLevel(n.object.clone(),n.distance)}return this},o.LOD.prototype.toJSON=function(e){var t=o.Object3D.prototype.toJSON.call(this,e);t.object.levels=[];for(var r=this.levels,i=0,n=r.length;n>i;i++){var a=r[i];t.object.levels.push({object:a.object.uuid,distance:a.distance})}return t},o.Sprite=function(){var e=new Uint16Array([0,1,2,0,2,3]),t=new Float32Array([-.5,-.5,0,.5,-.5,0,.5,.5,0,-.5,.5,0]),r=new Float32Array([0,0,1,0,1,1,0,1]),i=new o.BufferGeometry;return i.addIndex(new o.BufferAttribute(e,1)),i.addAttribute("position",new o.BufferAttribute(t,3)),i.addAttribute("uv",new o.BufferAttribute(r,2)),function(e){o.Object3D.call(this),this.type="Sprite",this.geometry=i,this.material=void 0!==e?e:new o.SpriteMaterial}}(),o.Sprite.prototype=Object.create(o.Object3D.prototype),o.Sprite.prototype.constructor=o.Sprite,o.Sprite.prototype.raycast=function(){var e=new o.Vector3;return function(t,r){e.setFromMatrixPosition(this.matrixWorld);var i=t.ray.distanceSqToPoint(e),n=this.scale.x*this.scale.y;i>n||r.push({distance:Math.sqrt(i),point:this.position,face:null,object:this})}}(),o.Sprite.prototype.clone=function(){return new this.constructor(this.material).copy(this)},o.Sprite.prototype.toJSON=function(e){var t=o.Object3D.prototype.toJSON.call(this,e);return void 0===e.materials[this.material.uuid]&&(e.materials[this.material.uuid]=this.material.toJSON()),t.object.material=this.material.uuid,t},o.Particle=o.Sprite,o.LensFlare=function(e,t,r,i,n){o.Object3D.call(this),this.lensFlares=[],this.positionScreen=new o.Vector3,this.customUpdateCallback=void 0,void 0!==e&&this.add(e,t,r,i,n)},o.LensFlare.prototype=Object.create(o.Object3D.prototype),o.LensFlare.prototype.constructor=o.LensFlare,o.LensFlare.prototype.add=function(e,t,r,i,n,a){void 0===t&&(t=-1),void 0===r&&(r=0),void 0===a&&(a=1),void 0===n&&(n=new o.Color(16777215)),void 0===i&&(i=o.NormalBlending),r=Math.min(r,Math.max(0,r)),this.lensFlares.push({texture:e,size:t,distance:r,x:0,y:0,z:0,scale:1,rotation:0,opacity:a,color:n,blending:i})},o.LensFlare.prototype.updateLensFlares=function(){var e,t,r=this.lensFlares.length,i=2*-this.positionScreen.x,n=2*-this.positionScreen.y;for(e=0;r>e;e++)t=this.lensFlares[e],t.x=this.positionScreen.x+i*t.distance,t.y=this.positionScreen.y+n*t.distance,t.wantedRotation=t.x*Math.PI*.25,t.rotation+=.25*(t.wantedRotation-t.rotation)},o.LensFlare.prototype.copy=function(e){o.Object3D.prototype.copy.call(this,e),this.positionScreen.copy(e.positionScreen),this.customUpdateCallback=e.customUpdateCallback;for(var t=0,r=e.lensFlares.length;r>t;t++)this.lensFlares.push(e.lensFlares[t]);return this},o.Scene=function(){o.Object3D.call(this),this.type="Scene",this.fog=null,this.overrideMaterial=null,this.autoUpdate=!0},o.Scene.prototype=Object.create(o.Object3D.prototype),o.Scene.prototype.constructor=o.Scene,o.Scene.prototype.copy=function(e){return o.Object3D.prototype.copy.call(this,e),null!==e.fog&&(this.fog=e.fog.clone()),null!==e.overrideMaterial&&(this.overrideMaterial=e.overrideMaterial.clone()),this.autoUpdate=e.autoUpdate,this.matrixAutoUpdate=e.matrixAutoUpdate,this},o.Fog=function(e,t,r){this.name="",this.color=new o.Color(e),this.near=void 0!==t?t:1,this.far=void 0!==r?r:1e3},o.Fog.prototype.clone=function(){return new o.Fog(this.color.getHex(),this.near,this.far)},o.FogExp2=function(e,t){this.name="",this.color=new o.Color(e),this.density=void 0!==t?t:25e-5},o.FogExp2.prototype.clone=function(){return new o.FogExp2(this.color.getHex(),this.density)},o.ShaderChunk={},o.ShaderChunk.alphamap_fragment="#ifdef USE_ALPHAMAP\n\n diffuseColor.a *= texture2D( alphaMap, vUv ).g;\n\n#endif\n",o.ShaderChunk.alphamap_pars_fragment="#ifdef USE_ALPHAMAP\n\n uniform sampler2D alphaMap;\n\n#endif\n",o.ShaderChunk.alphatest_fragment="#ifdef ALPHATEST\n\n if ( diffuseColor.a < ALPHATEST ) discard;\n\n#endif\n",o.ShaderChunk.aomap_fragment="#ifdef USE_AOMAP\n\n totalAmbientLight *= ( texture2D( aoMap, vUv2 ).r - 1.0 ) * aoMapIntensity + 1.0;\n\n#endif\n",o.ShaderChunk.aomap_pars_fragment="#ifdef USE_AOMAP\n\n uniform sampler2D aoMap;\n uniform float aoMapIntensity;\n\n#endif",o.ShaderChunk.begin_vertex="\nvec3 transformed = vec3( position );\n",o.ShaderChunk.beginnormal_vertex="\nvec3 objectNormal = vec3( normal );\n",o.ShaderChunk.bumpmap_pars_fragment="#ifdef USE_BUMPMAP\n\n uniform sampler2D bumpMap;\n uniform float bumpScale;\n\n // Derivative maps - bump mapping unparametrized surfaces by Morten Mikkelsen\n // http://mmikkelsen3d.blogspot.sk/2011/07/derivative-maps.html\n\n // Evaluate the derivative of the height w.r.t. screen-space using forward differencing (listing 2)\n\n vec2 dHdxy_fwd() {\n\n vec2 dSTdx = dFdx( vUv );\n vec2 dSTdy = dFdy( vUv );\n\n float Hll = bumpScale * texture2D( bumpMap, vUv ).x;\n float dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\n float dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;\n\n return vec2( dBx, dBy );\n\n }\n\n vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy ) {\n\n vec3 vSigmaX = dFdx( surf_pos );\n vec3 vSigmaY = dFdy( surf_pos );\n vec3 vN = surf_norm; // normalized\n\n vec3 R1 = cross( vSigmaY, vN );\n vec3 R2 = cross( vN, vSigmaX );\n\n float fDet = dot( vSigmaX, R1 );\n\n vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n return normalize( abs( fDet ) * surf_norm - vGrad );\n\n }\n\n#endif\n",o.ShaderChunk.color_fragment="#ifdef USE_COLOR\n\n diffuseColor.rgb *= vColor;\n\n#endif",o.ShaderChunk.color_pars_fragment="#ifdef USE_COLOR\n\n varying vec3 vColor;\n\n#endif\n",o.ShaderChunk.color_pars_vertex="#ifdef USE_COLOR\n\n varying vec3 vColor;\n\n#endif",o.ShaderChunk.color_vertex="#ifdef USE_COLOR\n\n vColor.xyz = color.xyz;\n\n#endif",o.ShaderChunk.common="#define PI 3.14159\n#define PI2 6.28318\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\nvec3 transformDirection( in vec3 normal, in mat4 matrix ) {\n\n return normalize( ( matrix * vec4( normal, 0.0 ) ).xyz );\n\n}\n\n// http://en.wikibooks.org/wiki/GLSL_Programming/Applying_Matrix_Transformations\nvec3 inverseTransformDirection( in vec3 normal, in mat4 matrix ) {\n\n return normalize( ( vec4( normal, 0.0 ) * matrix ).xyz );\n\n}\n\nvec3 projectOnPlane(in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\n float distance = dot( planeNormal, point - pointOnPlane );\n\n return - distance * planeNormal + point;\n\n}\n\nfloat sideOfPlane( in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\n return sign( dot( point - pointOnPlane, planeNormal ) );\n\n}\n\nvec3 linePlaneIntersect( in vec3 pointOnLine, in vec3 lineDirection, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\n return lineDirection * ( dot( planeNormal, pointOnPlane - pointOnLine ) / dot( planeNormal, lineDirection ) ) + pointOnLine;\n\n}\n\nfloat calcLightAttenuation( float lightDistance, float cutoffDistance, float decayExponent ) {\n\n if ( decayExponent > 0.0 ) {\n\n return pow( saturate( -lightDistance / cutoffDistance + 1.0 ), decayExponent );\n\n }\n\n return 1.0;\n\n}\n\nvec3 F_Schlick( in vec3 specularColor, in float dotLH ) {\n\n // Original approximation by Christophe Schlick '94\n //;float fresnel = pow( 1.0 - dotLH, 5.0 );\n\n // Optimized variant (presented by Epic at SIGGRAPH '13)\n float fresnel = exp2( ( -5.55437 * dotLH - 6.98316 ) * dotLH );\n\n return ( 1.0 - specularColor ) * fresnel + specularColor;\n\n}\n\nfloat G_BlinnPhong_Implicit( /* in float dotNL, in float dotNV */ ) {\n\n // geometry term is (nā‹…l)(nā‹…v) / 4(nā‹…l)(nā‹…v)\n\n return 0.25;\n\n}\n\nfloat D_BlinnPhong( in float shininess, in float dotNH ) {\n\n // factor of 1/PI in distribution term omitted\n\n return ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n\n}\n\nvec3 BRDF_BlinnPhong( in vec3 specularColor, in float shininess, in vec3 normal, in vec3 lightDir, in vec3 viewDir ) {\n\n vec3 halfDir = normalize( lightDir + viewDir );\n\n //float dotNL = saturate( dot( normal, lightDir ) );\n //float dotNV = saturate( dot( normal, viewDir ) );\n float dotNH = saturate( dot( normal, halfDir ) );\n float dotLH = saturate( dot( lightDir, halfDir ) );\n\n vec3 F = F_Schlick( specularColor, dotLH );\n\n float G = G_BlinnPhong_Implicit( /* dotNL, dotNV */ );\n\n float D = D_BlinnPhong( shininess, dotNH );\n\n return F * G * D;\n\n}\n\nvec3 inputToLinear( in vec3 a ) {\n\n #ifdef GAMMA_INPUT\n\n return pow( a, vec3( float( GAMMA_FACTOR ) ) );\n\n #else\n\n return a;\n\n #endif\n\n}\n\nvec3 linearToOutput( in vec3 a ) {\n\n #ifdef GAMMA_OUTPUT\n\n return pow( a, vec3( 1.0 / float( GAMMA_FACTOR ) ) );\n\n #else\n\n return a;\n\n #endif\n\n}\n",o.ShaderChunk.defaultnormal_vertex="#ifdef FLIP_SIDED\n\n objectNormal = -objectNormal;\n\n#endif\n\nvec3 transformedNormal = normalMatrix * objectNormal;\n",o.ShaderChunk.displacementmap_vertex="#ifdef USE_DISPLACEMENTMAP\n\n transformed += normal * ( texture2D( displacementMap, uv ).x * displacementScale + displacementBias );\n\n#endif\n",o.ShaderChunk.displacementmap_pars_vertex="#ifdef USE_DISPLACEMENTMAP\n\n uniform sampler2D displacementMap;\n uniform float displacementScale;\n uniform float displacementBias;\n\n#endif\n",o.ShaderChunk.emissivemap_fragment="#ifdef USE_EMISSIVEMAP\n\n vec4 emissiveColor = texture2D( emissiveMap, vUv );\n\n emissiveColor.rgb = inputToLinear( emissiveColor.rgb );\n\n totalEmissiveLight *= emissiveColor.rgb;\n\n#endif\n",o.ShaderChunk.emissivemap_pars_fragment="#ifdef USE_EMISSIVEMAP\n\n uniform sampler2D emissiveMap;\n\n#endif\n",o.ShaderChunk.envmap_fragment="#ifdef USE_ENVMAP\n\n #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\n vec3 cameraToVertex = normalize( vWorldPosition - cameraPosition );\n\n // Transforming Normal Vectors with the Inverse Transformation\n vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\n #ifdef ENVMAP_MODE_REFLECTION\n\n vec3 reflectVec = reflect( cameraToVertex, worldNormal );\n\n #else\n\n vec3 reflectVec = refract( cameraToVertex, worldNormal, refractionRatio );\n\n #endif\n\n #else\n\n vec3 reflectVec = vReflect;\n\n #endif\n\n #ifdef DOUBLE_SIDED\n float flipNormal = ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n #else\n float flipNormal = 1.0;\n #endif\n\n #ifdef ENVMAP_TYPE_CUBE\n vec4 envColor = textureCube( envMap, flipNormal * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\n #elif defined( ENVMAP_TYPE_EQUIREC )\n vec2 sampleUV;\n sampleUV.y = saturate( flipNormal * reflectVec.y * 0.5 + 0.5 );\n sampleUV.x = atan( flipNormal * reflectVec.z, flipNormal * reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n vec4 envColor = texture2D( envMap, sampleUV );\n\n #elif defined( ENVMAP_TYPE_SPHERE )\n vec3 reflectView = flipNormal * normalize((viewMatrix * vec4( reflectVec, 0.0 )).xyz + vec3(0.0,0.0,1.0));\n vec4 envColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5 );\n #endif\n\n envColor.xyz = inputToLinear( envColor.xyz );\n\n #ifdef ENVMAP_BLENDING_MULTIPLY\n\n outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\n #elif defined( ENVMAP_BLENDING_MIX )\n\n outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\n #elif defined( ENVMAP_BLENDING_ADD )\n\n outgoingLight += envColor.xyz * specularStrength * reflectivity;\n\n #endif\n\n#endif\n",o.ShaderChunk.envmap_pars_fragment="#ifdef USE_ENVMAP\n\n uniform float reflectivity;\n #ifdef ENVMAP_TYPE_CUBE\n uniform samplerCube envMap;\n #else\n uniform sampler2D envMap;\n #endif\n uniform float flipEnvMap;\n\n #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\n uniform float refractionRatio;\n\n #else\n\n varying vec3 vReflect;\n\n #endif\n\n#endif\n",o.ShaderChunk.envmap_pars_vertex="#if defined( USE_ENVMAP ) && ! defined( USE_BUMPMAP ) && ! defined( USE_NORMALMAP ) && ! defined( PHONG )\n\n varying vec3 vReflect;\n\n uniform float refractionRatio;\n\n#endif\n",o.ShaderChunk.envmap_vertex="#if defined( USE_ENVMAP ) && ! defined( USE_BUMPMAP ) && ! defined( USE_NORMALMAP ) && ! defined( PHONG )\n\n vec3 worldNormal = transformDirection( objectNormal, modelMatrix );\n\n vec3 cameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\n #ifdef ENVMAP_MODE_REFLECTION\n\n vReflect = reflect( cameraToVertex, worldNormal );\n\n #else\n\n vReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\n #endif\n\n#endif\n",o.ShaderChunk.fog_fragment="#ifdef USE_FOG\n\n #ifdef USE_LOGDEPTHBUF_EXT\n\n float depth = gl_FragDepthEXT / gl_FragCoord.w;\n\n #else\n\n float depth = gl_FragCoord.z / gl_FragCoord.w;\n\n #endif\n\n #ifdef FOG_EXP2\n\n float fogFactor = whiteCompliment( exp2( - fogDensity * fogDensity * depth * depth * LOG2 ) );\n\n #else\n\n float fogFactor = smoothstep( fogNear, fogFar, depth );\n\n #endif\n \n outgoingLight = mix( outgoingLight, fogColor, fogFactor );\n\n#endif",o.ShaderChunk.fog_pars_fragment="#ifdef USE_FOG\n\n uniform vec3 fogColor;\n\n #ifdef FOG_EXP2\n\n uniform float fogDensity;\n\n #else\n\n uniform float fogNear;\n uniform float fogFar;\n #endif\n\n#endif",o.ShaderChunk.lightmap_fragment="#ifdef USE_LIGHTMAP\n\n totalAmbientLight += texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n\n#endif\n",o.ShaderChunk.lightmap_pars_fragment="#ifdef USE_LIGHTMAP\n\n uniform sampler2D lightMap;\n uniform float lightMapIntensity;\n\n#endif",o.ShaderChunk.lights_lambert_pars_vertex="uniform vec3 ambientLightColor;\n\n#if MAX_DIR_LIGHTS > 0\n\n uniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];\n uniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n\n#endif\n\n#if MAX_HEMI_LIGHTS > 0\n\n uniform vec3 hemisphereLightSkyColor[ MAX_HEMI_LIGHTS ];\n uniform vec3 hemisphereLightGroundColor[ MAX_HEMI_LIGHTS ];\n uniform vec3 hemisphereLightDirection[ MAX_HEMI_LIGHTS ];\n\n#endif\n\n#if MAX_POINT_LIGHTS > 0\n\n uniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];\n uniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\n uniform float pointLightDistance[ MAX_POINT_LIGHTS ];\n uniform float pointLightDecay[ MAX_POINT_LIGHTS ];\n\n#endif\n\n#if MAX_SPOT_LIGHTS > 0\n\n uniform vec3 spotLightColor[ MAX_SPOT_LIGHTS ];\n uniform vec3 spotLightPosition[ MAX_SPOT_LIGHTS ];\n uniform vec3 spotLightDirection[ MAX_SPOT_LIGHTS ];\n uniform float spotLightDistance[ MAX_SPOT_LIGHTS ];\n uniform float spotLightAngleCos[ MAX_SPOT_LIGHTS ];\n uniform float spotLightExponent[ MAX_SPOT_LIGHTS ];\n uniform float spotLightDecay[ MAX_SPOT_LIGHTS ];\n\n#endif\n",o.ShaderChunk.lights_lambert_vertex="vLightFront = vec3( 0.0 );\n\n#ifdef DOUBLE_SIDED\n\n vLightBack = vec3( 0.0 );\n\n#endif\n\nvec3 normal = normalize( transformedNormal );\n\n#if MAX_POINT_LIGHTS > 0\n\n for ( int i = 0; i < MAX_POINT_LIGHTS; i ++ ) {\n\n vec3 lightColor = pointLightColor[ i ];\n\n vec3 lVector = pointLightPosition[ i ] - mvPosition.xyz;\n vec3 lightDir = normalize( lVector );\n\n // attenuation\n\n float attenuation = calcLightAttenuation( length( lVector ), pointLightDistance[ i ], pointLightDecay[ i ] );\n\n // diffuse\n\n float dotProduct = dot( normal, lightDir );\n\n vLightFront += lightColor * attenuation * saturate( dotProduct );\n\n #ifdef DOUBLE_SIDED\n\n vLightBack += lightColor * attenuation * saturate( - dotProduct );\n\n #endif\n\n }\n\n#endif\n\n#if MAX_SPOT_LIGHTS > 0\n\n for ( int i = 0; i < MAX_SPOT_LIGHTS; i ++ ) {\n\n vec3 lightColor = spotLightColor[ i ];\n\n vec3 lightPosition = spotLightPosition[ i ];\n vec3 lVector = lightPosition - mvPosition.xyz;\n vec3 lightDir = normalize( lVector );\n\n float spotEffect = dot( spotLightDirection[ i ], lightDir );\n\n if ( spotEffect > spotLightAngleCos[ i ] ) {\n\n spotEffect = saturate( pow( saturate( spotEffect ), spotLightExponent[ i ] ) );\n\n // attenuation\n\n float attenuation = calcLightAttenuation( length( lVector ), spotLightDistance[ i ], spotLightDecay[ i ] );\n\n attenuation *= spotEffect;\n\n // diffuse\n\n float dotProduct = dot( normal, lightDir );\n\n vLightFront += lightColor * attenuation * saturate( dotProduct );\n\n #ifdef DOUBLE_SIDED\n\n vLightBack += lightColor * attenuation * saturate( - dotProduct );\n\n #endif\n\n }\n\n }\n\n#endif\n\n#if MAX_DIR_LIGHTS > 0\n\n for ( int i = 0; i < MAX_DIR_LIGHTS; i ++ ) {\n\n vec3 lightColor = directionalLightColor[ i ];\n\n vec3 lightDir = directionalLightDirection[ i ];\n\n // diffuse\n\n float dotProduct = dot( normal, lightDir );\n\n vLightFront += lightColor * saturate( dotProduct );\n\n #ifdef DOUBLE_SIDED\n\n vLightBack += lightColor * saturate( - dotProduct );\n\n #endif\n\n }\n\n#endif\n\n#if MAX_HEMI_LIGHTS > 0\n\n for ( int i = 0; i < MAX_HEMI_LIGHTS; i ++ ) {\n\n vec3 lightDir = hemisphereLightDirection[ i ];\n\n // diffuse\n\n float dotProduct = dot( normal, lightDir );\n\n float hemiDiffuseWeight = 0.5 * dotProduct + 0.5;\n\n vLightFront += mix( hemisphereLightGroundColor[ i ], hemisphereLightSkyColor[ i ], hemiDiffuseWeight );\n\n #ifdef DOUBLE_SIDED\n\n float hemiDiffuseWeightBack = - 0.5 * dotProduct + 0.5;\n\n vLightBack += mix( hemisphereLightGroundColor[ i ], hemisphereLightSkyColor[ i ], hemiDiffuseWeightBack );\n\n #endif\n\n }\n\n#endif\n\nvLightFront += ambientLightColor;\n\n#ifdef DOUBLE_SIDED\n\n vLightBack += ambientLightColor;\n\n#endif\n",o.ShaderChunk.lights_phong_fragment="#ifndef FLAT_SHADED\n\n vec3 normal = normalize( vNormal );\n\n #ifdef DOUBLE_SIDED\n\n normal = normal * ( -1.0 + 2.0 * float( gl_FrontFacing ) );\n\n #endif\n\n#else\n\n vec3 fdx = dFdx( vViewPosition );\n vec3 fdy = dFdy( vViewPosition );\n vec3 normal = normalize( cross( fdx, fdy ) );\n\n#endif\n\n#ifdef USE_NORMALMAP\n\n normal = perturbNormal2Arb( -vViewPosition, normal );\n\n#elif defined( USE_BUMPMAP )\n\n normal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd() );\n\n#endif\n\nvec3 viewDir = normalize( vViewPosition );\n\nvec3 totalDiffuseLight = vec3( 0.0 );\nvec3 totalSpecularLight = vec3( 0.0 );\n\n#if MAX_POINT_LIGHTS > 0\n\n for ( int i = 0; i < MAX_POINT_LIGHTS; i ++ ) {\n\n vec3 lightColor = pointLightColor[ i ];\n\n vec3 lightPosition = pointLightPosition[ i ];\n vec3 lVector = lightPosition + vViewPosition.xyz;\n vec3 lightDir = normalize( lVector );\n\n // attenuation\n\n float attenuation = calcLightAttenuation( length( lVector ), pointLightDistance[ i ], pointLightDecay[ i ] );\n\n // diffuse\n\n float cosineTerm = saturate( dot( normal, lightDir ) );\n\n totalDiffuseLight += lightColor * attenuation * cosineTerm;\n\n // specular\n\n vec3 brdf = BRDF_BlinnPhong( specular, shininess, normal, lightDir, viewDir );\n\n totalSpecularLight += brdf * specularStrength * lightColor * attenuation * cosineTerm;\n\n\n }\n\n#endif\n\n#if MAX_SPOT_LIGHTS > 0\n\n for ( int i = 0; i < MAX_SPOT_LIGHTS; i ++ ) {\n\n vec3 lightColor = spotLightColor[ i ];\n\n vec3 lightPosition = spotLightPosition[ i ];\n vec3 lVector = lightPosition + vViewPosition.xyz;\n vec3 lightDir = normalize( lVector );\n\n float spotEffect = dot( spotLightDirection[ i ], lightDir );\n\n if ( spotEffect > spotLightAngleCos[ i ] ) {\n\n spotEffect = saturate( pow( saturate( spotEffect ), spotLightExponent[ i ] ) );\n\n // attenuation\n\n float attenuation = calcLightAttenuation( length( lVector ), spotLightDistance[ i ], spotLightDecay[ i ] );\n\n attenuation *= spotEffect;\n\n // diffuse\n\n float cosineTerm = saturate( dot( normal, lightDir ) );\n\n totalDiffuseLight += lightColor * attenuation * cosineTerm;\n\n // specular\n\n vec3 brdf = BRDF_BlinnPhong( specular, shininess, normal, lightDir, viewDir );\n\n totalSpecularLight += brdf * specularStrength * lightColor * attenuation * cosineTerm;\n\n }\n\n }\n\n#endif\n\n#if MAX_DIR_LIGHTS > 0\n\n for( int i = 0; i < MAX_DIR_LIGHTS; i ++ ) {\n\n vec3 lightColor = directionalLightColor[ i ];\n\n vec3 lightDir = directionalLightDirection[ i ];\n\n // diffuse\n\n float cosineTerm = saturate( dot( normal, lightDir ) );\n\n totalDiffuseLight += lightColor * cosineTerm;\n\n // specular\n\n vec3 brdf = BRDF_BlinnPhong( specular, shininess, normal, lightDir, viewDir );\n\n totalSpecularLight += brdf * specularStrength * lightColor * cosineTerm;\n\n }\n\n#endif\n\n#if MAX_HEMI_LIGHTS > 0\n\n for( int i = 0; i < MAX_HEMI_LIGHTS; i ++ ) {\n\n vec3 lightDir = hemisphereLightDirection[ i ];\n\n // diffuse\n\n float dotProduct = dot( normal, lightDir );\n\n float hemiDiffuseWeight = 0.5 * dotProduct + 0.5;\n\n vec3 lightColor = mix( hemisphereLightGroundColor[ i ], hemisphereLightSkyColor[ i ], hemiDiffuseWeight );\n\n totalDiffuseLight += lightColor;\n\n // specular (sky term only)\n\n vec3 brdf = BRDF_BlinnPhong( specular, shininess, normal, lightDir, viewDir );\n\n totalSpecularLight += brdf * specularStrength * lightColor * max( dotProduct, 0.0 );\n\n }\n\n#endif\n\n#ifdef METAL\n\n outgoingLight += diffuseColor.rgb * ( totalDiffuseLight + totalAmbientLight ) * specular + totalSpecularLight + totalEmissiveLight;\n\n#else\n\n outgoingLight += diffuseColor.rgb * ( totalDiffuseLight + totalAmbientLight ) + totalSpecularLight + totalEmissiveLight;\n\n#endif\n", +o.ShaderChunk.lights_phong_pars_fragment="uniform vec3 ambientLightColor;\n\n#if MAX_DIR_LIGHTS > 0\n\n uniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];\n uniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n\n#endif\n\n#if MAX_HEMI_LIGHTS > 0\n\n uniform vec3 hemisphereLightSkyColor[ MAX_HEMI_LIGHTS ];\n uniform vec3 hemisphereLightGroundColor[ MAX_HEMI_LIGHTS ];\n uniform vec3 hemisphereLightDirection[ MAX_HEMI_LIGHTS ];\n\n#endif\n\n#if MAX_POINT_LIGHTS > 0\n\n uniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];\n\n uniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\n uniform float pointLightDistance[ MAX_POINT_LIGHTS ];\n uniform float pointLightDecay[ MAX_POINT_LIGHTS ];\n\n#endif\n\n#if MAX_SPOT_LIGHTS > 0\n\n uniform vec3 spotLightColor[ MAX_SPOT_LIGHTS ];\n uniform vec3 spotLightPosition[ MAX_SPOT_LIGHTS ];\n uniform vec3 spotLightDirection[ MAX_SPOT_LIGHTS ];\n uniform float spotLightAngleCos[ MAX_SPOT_LIGHTS ];\n uniform float spotLightExponent[ MAX_SPOT_LIGHTS ];\n uniform float spotLightDistance[ MAX_SPOT_LIGHTS ];\n uniform float spotLightDecay[ MAX_SPOT_LIGHTS ];\n\n#endif\n\n#if MAX_SPOT_LIGHTS > 0 || defined( USE_ENVMAP )\n\n varying vec3 vWorldPosition;\n\n#endif\n\nvarying vec3 vViewPosition;\n\n#ifndef FLAT_SHADED\n\n varying vec3 vNormal;\n\n#endif\n",o.ShaderChunk.lights_phong_pars_vertex="#if MAX_SPOT_LIGHTS > 0 || defined( USE_ENVMAP )\n\n varying vec3 vWorldPosition;\n\n#endif\n",o.ShaderChunk.lights_phong_vertex="#if MAX_SPOT_LIGHTS > 0 || defined( USE_ENVMAP )\n\n vWorldPosition = worldPosition.xyz;\n\n#endif\n",o.ShaderChunk.linear_to_gamma_fragment="\n outgoingLight = linearToOutput( outgoingLight );\n",o.ShaderChunk.logdepthbuf_fragment="#if defined(USE_LOGDEPTHBUF) && defined(USE_LOGDEPTHBUF_EXT)\n\n gl_FragDepthEXT = log2(vFragDepth) * logDepthBufFC * 0.5;\n\n#endif",o.ShaderChunk.logdepthbuf_pars_fragment="#ifdef USE_LOGDEPTHBUF\n\n uniform float logDepthBufFC;\n\n #ifdef USE_LOGDEPTHBUF_EXT\n\n varying float vFragDepth;\n\n #endif\n\n#endif\n",o.ShaderChunk.logdepthbuf_pars_vertex="#ifdef USE_LOGDEPTHBUF\n\n #ifdef USE_LOGDEPTHBUF_EXT\n\n varying float vFragDepth;\n\n #endif\n\n uniform float logDepthBufFC;\n\n#endif",o.ShaderChunk.logdepthbuf_vertex="#ifdef USE_LOGDEPTHBUF\n\n gl_Position.z = log2(max( EPSILON, gl_Position.w + 1.0 )) * logDepthBufFC;\n\n #ifdef USE_LOGDEPTHBUF_EXT\n\n vFragDepth = 1.0 + gl_Position.w;\n\n#else\n\n gl_Position.z = (gl_Position.z - 1.0) * gl_Position.w;\n\n #endif\n\n#endif",o.ShaderChunk.map_fragment="#ifdef USE_MAP\n\n vec4 texelColor = texture2D( map, vUv );\n\n texelColor.xyz = inputToLinear( texelColor.xyz );\n\n diffuseColor *= texelColor;\n\n#endif\n",o.ShaderChunk.map_pars_fragment="#ifdef USE_MAP\n\n uniform sampler2D map;\n\n#endif",o.ShaderChunk.map_particle_fragment="#ifdef USE_MAP\n\n diffuseColor *= texture2D( map, vec2( gl_PointCoord.x, 1.0 - gl_PointCoord.y ) * offsetRepeat.zw + offsetRepeat.xy );\n\n#endif\n",o.ShaderChunk.map_particle_pars_fragment="#ifdef USE_MAP\n\n uniform vec4 offsetRepeat;\n uniform sampler2D map;\n\n#endif\n",o.ShaderChunk.morphnormal_vertex="#ifdef USE_MORPHNORMALS\n\n objectNormal += ( morphNormal0 - normal ) * morphTargetInfluences[ 0 ];\n objectNormal += ( morphNormal1 - normal ) * morphTargetInfluences[ 1 ];\n objectNormal += ( morphNormal2 - normal ) * morphTargetInfluences[ 2 ];\n objectNormal += ( morphNormal3 - normal ) * morphTargetInfluences[ 3 ];\n\n#endif\n",o.ShaderChunk.morphtarget_pars_vertex="#ifdef USE_MORPHTARGETS\n\n #ifndef USE_MORPHNORMALS\n\n uniform float morphTargetInfluences[ 8 ];\n\n #else\n\n uniform float morphTargetInfluences[ 4 ];\n\n #endif\n\n#endif",o.ShaderChunk.morphtarget_vertex="#ifdef USE_MORPHTARGETS\n\n transformed += ( morphTarget0 - position ) * morphTargetInfluences[ 0 ];\n transformed += ( morphTarget1 - position ) * morphTargetInfluences[ 1 ];\n transformed += ( morphTarget2 - position ) * morphTargetInfluences[ 2 ];\n transformed += ( morphTarget3 - position ) * morphTargetInfluences[ 3 ];\n\n #ifndef USE_MORPHNORMALS\n\n transformed += ( morphTarget4 - position ) * morphTargetInfluences[ 4 ];\n transformed += ( morphTarget5 - position ) * morphTargetInfluences[ 5 ];\n transformed += ( morphTarget6 - position ) * morphTargetInfluences[ 6 ];\n transformed += ( morphTarget7 - position ) * morphTargetInfluences[ 7 ];\n\n #endif\n\n#endif\n",o.ShaderChunk.normalmap_pars_fragment="#ifdef USE_NORMALMAP\n\n uniform sampler2D normalMap;\n uniform vec2 normalScale;\n\n // Per-Pixel Tangent Space Normal Mapping\n // http://hacksoflife.blogspot.ch/2009/11/per-pixel-tangent-space-normal-mapping.html\n\n vec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm ) {\n\n vec3 q0 = dFdx( eye_pos.xyz );\n vec3 q1 = dFdy( eye_pos.xyz );\n vec2 st0 = dFdx( vUv.st );\n vec2 st1 = dFdy( vUv.st );\n\n vec3 S = normalize( q0 * st1.t - q1 * st0.t );\n vec3 T = normalize( -q0 * st1.s + q1 * st0.s );\n vec3 N = normalize( surf_norm );\n\n vec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n mapN.xy = normalScale * mapN.xy;\n mat3 tsn = mat3( S, T, N );\n return normalize( tsn * mapN );\n\n }\n\n#endif\n",o.ShaderChunk.project_vertex="#ifdef USE_SKINNING\n\n vec4 mvPosition = modelViewMatrix * skinned;\n\n#else\n\n vec4 mvPosition = modelViewMatrix * vec4( transformed, 1.0 );\n\n#endif\n\ngl_Position = projectionMatrix * mvPosition;\n",o.ShaderChunk.shadowmap_fragment="#ifdef USE_SHADOWMAP\n\n #ifdef SHADOWMAP_DEBUG\n\n vec3 frustumColors[3];\n frustumColors[0] = vec3( 1.0, 0.5, 0.0 );\n frustumColors[1] = vec3( 0.0, 1.0, 0.8 );\n frustumColors[2] = vec3( 0.0, 0.5, 1.0 );\n\n #endif\n\n float fDepth;\n vec3 shadowColor = vec3( 1.0 );\n\n for( int i = 0; i < MAX_SHADOWS; i ++ ) {\n\n vec3 shadowCoord = vShadowCoord[ i ].xyz / vShadowCoord[ i ].w;\n\n // if ( something && something ) breaks ATI OpenGL shader compiler\n // if ( all( something, something ) ) using this instead\n\n bvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\n bool inFrustum = all( inFrustumVec );\n\n bvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\n\n bool frustumTest = all( frustumTestVec );\n\n if ( frustumTest ) {\n\n shadowCoord.z += shadowBias[ i ];\n\n #if defined( SHADOWMAP_TYPE_PCF )\n\n // Percentage-close filtering\n // (9 pixel kernel)\n // http://fabiensanglard.net/shadowmappingPCF/\n\n float shadow = 0.0;\n\n /*\n // nested loops breaks shader compiler / validator on some ATI cards when using OpenGL\n // must enroll loop manually\n\n for ( float y = -1.25; y <= 1.25; y += 1.25 )\n for ( float x = -1.25; x <= 1.25; x += 1.25 ) {\n\n vec4 rgbaDepth = texture2D( shadowMap[ i ], vec2( x * xPixelOffset, y * yPixelOffset ) + shadowCoord.xy );\n\n // doesn't seem to produce any noticeable visual difference compared to simple texture2D lookup\n //vec4 rgbaDepth = texture2DProj( shadowMap[ i ], vec4( vShadowCoord[ i ].w * ( vec2( x * xPixelOffset, y * yPixelOffset ) + shadowCoord.xy ), 0.05, vShadowCoord[ i ].w ) );\n\n float fDepth = unpackDepth( rgbaDepth );\n\n if ( fDepth < shadowCoord.z )\n shadow += 1.0;\n\n }\n\n shadow /= 9.0;\n\n */\n\n const float shadowDelta = 1.0 / 9.0;\n\n float xPixelOffset = 1.0 / shadowMapSize[ i ].x;\n float yPixelOffset = 1.0 / shadowMapSize[ i ].y;\n\n float dx0 = -1.25 * xPixelOffset;\n float dy0 = -1.25 * yPixelOffset;\n float dx1 = 1.25 * xPixelOffset;\n float dy1 = 1.25 * yPixelOffset;\n\n fDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, dy0 ) ) );\n if ( fDepth < shadowCoord.z ) shadow += shadowDelta;\n\n fDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( 0.0, dy0 ) ) );\n if ( fDepth < shadowCoord.z ) shadow += shadowDelta;\n\n fDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, dy0 ) ) );\n if ( fDepth < shadowCoord.z ) shadow += shadowDelta;\n\n fDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, 0.0 ) ) );\n if ( fDepth < shadowCoord.z ) shadow += shadowDelta;\n\n fDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy ) );\n if ( fDepth < shadowCoord.z ) shadow += shadowDelta;\n\n fDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, 0.0 ) ) );\n if ( fDepth < shadowCoord.z ) shadow += shadowDelta;\n\n fDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, dy1 ) ) );\n if ( fDepth < shadowCoord.z ) shadow += shadowDelta;\n\n fDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( 0.0, dy1 ) ) );\n if ( fDepth < shadowCoord.z ) shadow += shadowDelta;\n\n fDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, dy1 ) ) );\n if ( fDepth < shadowCoord.z ) shadow += shadowDelta;\n\n shadowColor = shadowColor * vec3( ( 1.0 - shadowDarkness[ i ] * shadow ) );\n\n #elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\n // Percentage-close filtering\n // (9 pixel kernel)\n // http://fabiensanglard.net/shadowmappingPCF/\n\n float shadow = 0.0;\n\n float xPixelOffset = 1.0 / shadowMapSize[ i ].x;\n float yPixelOffset = 1.0 / shadowMapSize[ i ].y;\n\n float dx0 = -1.0 * xPixelOffset;\n float dy0 = -1.0 * yPixelOffset;\n float dx1 = 1.0 * xPixelOffset;\n float dy1 = 1.0 * yPixelOffset;\n\n mat3 shadowKernel;\n mat3 depthKernel;\n\n depthKernel[0][0] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, dy0 ) ) );\n depthKernel[0][1] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, 0.0 ) ) );\n depthKernel[0][2] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, dy1 ) ) );\n depthKernel[1][0] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( 0.0, dy0 ) ) );\n depthKernel[1][1] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy ) );\n depthKernel[1][2] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( 0.0, dy1 ) ) );\n depthKernel[2][0] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, dy0 ) ) );\n depthKernel[2][1] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, 0.0 ) ) );\n depthKernel[2][2] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, dy1 ) ) );\n\n vec3 shadowZ = vec3( shadowCoord.z );\n shadowKernel[0] = vec3(lessThan(depthKernel[0], shadowZ ));\n shadowKernel[0] *= vec3(0.25);\n\n shadowKernel[1] = vec3(lessThan(depthKernel[1], shadowZ ));\n shadowKernel[1] *= vec3(0.25);\n\n shadowKernel[2] = vec3(lessThan(depthKernel[2], shadowZ ));\n shadowKernel[2] *= vec3(0.25);\n\n vec2 fractionalCoord = 1.0 - fract( shadowCoord.xy * shadowMapSize[i].xy );\n\n shadowKernel[0] = mix( shadowKernel[1], shadowKernel[0], fractionalCoord.x );\n shadowKernel[1] = mix( shadowKernel[2], shadowKernel[1], fractionalCoord.x );\n\n vec4 shadowValues;\n shadowValues.x = mix( shadowKernel[0][1], shadowKernel[0][0], fractionalCoord.y );\n shadowValues.y = mix( shadowKernel[0][2], shadowKernel[0][1], fractionalCoord.y );\n shadowValues.z = mix( shadowKernel[1][1], shadowKernel[1][0], fractionalCoord.y );\n shadowValues.w = mix( shadowKernel[1][2], shadowKernel[1][1], fractionalCoord.y );\n\n shadow = dot( shadowValues, vec4( 1.0 ) );\n\n shadowColor = shadowColor * vec3( ( 1.0 - shadowDarkness[ i ] * shadow ) );\n\n #else\n\n vec4 rgbaDepth = texture2D( shadowMap[ i ], shadowCoord.xy );\n float fDepth = unpackDepth( rgbaDepth );\n\n if ( fDepth < shadowCoord.z )\n\n // spot with multiple shadows is darker\n\n shadowColor = shadowColor * vec3( 1.0 - shadowDarkness[ i ] );\n\n // spot with multiple shadows has the same color as single shadow spot\n\n // shadowColor = min( shadowColor, vec3( shadowDarkness[ i ] ) );\n\n #endif\n\n }\n\n\n #ifdef SHADOWMAP_DEBUG\n\n if ( inFrustum ) outgoingLight *= frustumColors[ i ];\n\n #endif\n\n }\n\n outgoingLight = outgoingLight * shadowColor;\n\n#endif\n",o.ShaderChunk.shadowmap_pars_fragment="#ifdef USE_SHADOWMAP\n\n uniform sampler2D shadowMap[ MAX_SHADOWS ];\n uniform vec2 shadowMapSize[ MAX_SHADOWS ];\n\n uniform float shadowDarkness[ MAX_SHADOWS ];\n uniform float shadowBias[ MAX_SHADOWS ];\n\n varying vec4 vShadowCoord[ MAX_SHADOWS ];\n\n float unpackDepth( const in vec4 rgba_depth ) {\n\n const vec4 bit_shift = vec4( 1.0 / ( 256.0 * 256.0 * 256.0 ), 1.0 / ( 256.0 * 256.0 ), 1.0 / 256.0, 1.0 );\n float depth = dot( rgba_depth, bit_shift );\n return depth;\n\n }\n\n#endif",o.ShaderChunk.shadowmap_pars_vertex="#ifdef USE_SHADOWMAP\n\n varying vec4 vShadowCoord[ MAX_SHADOWS ];\n uniform mat4 shadowMatrix[ MAX_SHADOWS ];\n\n#endif",o.ShaderChunk.shadowmap_vertex="#ifdef USE_SHADOWMAP\n\n for( int i = 0; i < MAX_SHADOWS; i ++ ) {\n\n vShadowCoord[ i ] = shadowMatrix[ i ] * worldPosition;\n\n }\n\n#endif",o.ShaderChunk.skinbase_vertex="#ifdef USE_SKINNING\n\n mat4 boneMatX = getBoneMatrix( skinIndex.x );\n mat4 boneMatY = getBoneMatrix( skinIndex.y );\n mat4 boneMatZ = getBoneMatrix( skinIndex.z );\n mat4 boneMatW = getBoneMatrix( skinIndex.w );\n\n#endif",o.ShaderChunk.skinning_pars_vertex="#ifdef USE_SKINNING\n\n uniform mat4 bindMatrix;\n uniform mat4 bindMatrixInverse;\n\n #ifdef BONE_TEXTURE\n\n uniform sampler2D boneTexture;\n uniform int boneTextureWidth;\n uniform int boneTextureHeight;\n\n mat4 getBoneMatrix( const in float i ) {\n\n float j = i * 4.0;\n float x = mod( j, float( boneTextureWidth ) );\n float y = floor( j / float( boneTextureWidth ) );\n\n float dx = 1.0 / float( boneTextureWidth );\n float dy = 1.0 / float( boneTextureHeight );\n\n y = dy * ( y + 0.5 );\n\n vec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n vec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n vec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n vec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n\n mat4 bone = mat4( v1, v2, v3, v4 );\n\n return bone;\n\n }\n\n #else\n\n uniform mat4 boneGlobalMatrices[ MAX_BONES ];\n\n mat4 getBoneMatrix( const in float i ) {\n\n mat4 bone = boneGlobalMatrices[ int(i) ];\n return bone;\n\n }\n\n #endif\n\n#endif\n",o.ShaderChunk.skinning_vertex="#ifdef USE_SKINNING\n\n vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\n vec4 skinned = vec4( 0.0 );\n skinned += boneMatX * skinVertex * skinWeight.x;\n skinned += boneMatY * skinVertex * skinWeight.y;\n skinned += boneMatZ * skinVertex * skinWeight.z;\n skinned += boneMatW * skinVertex * skinWeight.w;\n skinned = bindMatrixInverse * skinned;\n\n#endif\n",o.ShaderChunk.skinnormal_vertex="#ifdef USE_SKINNING\n\n mat4 skinMatrix = mat4( 0.0 );\n skinMatrix += skinWeight.x * boneMatX;\n skinMatrix += skinWeight.y * boneMatY;\n skinMatrix += skinWeight.z * boneMatZ;\n skinMatrix += skinWeight.w * boneMatW;\n skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n\n objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n\n#endif\n",o.ShaderChunk.specularmap_fragment="float specularStrength;\n\n#ifdef USE_SPECULARMAP\n\n vec4 texelSpecular = texture2D( specularMap, vUv );\n specularStrength = texelSpecular.r;\n\n#else\n\n specularStrength = 1.0;\n\n#endif",o.ShaderChunk.specularmap_pars_fragment="#ifdef USE_SPECULARMAP\n\n uniform sampler2D specularMap;\n\n#endif",o.ShaderChunk.uv2_pars_fragment="#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\n varying vec2 vUv2;\n\n#endif",o.ShaderChunk.uv2_pars_vertex="#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\n attribute vec2 uv2;\n varying vec2 vUv2;\n\n#endif",o.ShaderChunk.uv2_vertex="#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\n vUv2 = uv2;\n\n#endif",o.ShaderChunk.uv_pars_fragment="#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP )\n\n varying vec2 vUv;\n\n#endif",o.ShaderChunk.uv_pars_vertex="#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP )\n\n varying vec2 vUv;\n uniform vec4 offsetRepeat;\n\n#endif\n",o.ShaderChunk.uv_vertex="#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP )\n\n vUv = uv * offsetRepeat.zw + offsetRepeat.xy;\n\n#endif",o.ShaderChunk.worldpos_vertex="#if defined( USE_ENVMAP ) || defined( PHONG ) || defined( LAMBERT ) || defined ( USE_SHADOWMAP )\n\n #ifdef USE_SKINNING\n\n vec4 worldPosition = modelMatrix * skinned;\n\n #else\n\n vec4 worldPosition = modelMatrix * vec4( transformed, 1.0 );\n\n #endif\n\n#endif\n",o.UniformsUtils={merge:function(e){for(var t={},r=0;r dashSize ) {"," discard;"," }"," vec3 outgoingLight = vec3( 0.0 );"," vec4 diffuseColor = vec4( diffuse, opacity );",o.ShaderChunk.logdepthbuf_fragment,o.ShaderChunk.color_fragment," outgoingLight = diffuseColor.rgb;",o.ShaderChunk.fog_fragment," gl_FragColor = vec4( outgoingLight, diffuseColor.a );","}"].join("\n")},depth:{uniforms:{mNear:{type:"f",value:1},mFar:{type:"f",value:2e3},opacity:{type:"f",value:1}},vertexShader:[o.ShaderChunk.common,o.ShaderChunk.morphtarget_pars_vertex,o.ShaderChunk.logdepthbuf_pars_vertex,"void main() {",o.ShaderChunk.begin_vertex,o.ShaderChunk.morphtarget_vertex,o.ShaderChunk.project_vertex,o.ShaderChunk.logdepthbuf_vertex,"}"].join("\n"),fragmentShader:["uniform float mNear;","uniform float mFar;","uniform float opacity;",o.ShaderChunk.common,o.ShaderChunk.logdepthbuf_pars_fragment,"void main() {",o.ShaderChunk.logdepthbuf_fragment," #ifdef USE_LOGDEPTHBUF_EXT"," float depth = gl_FragDepthEXT / gl_FragCoord.w;"," #else"," float depth = gl_FragCoord.z / gl_FragCoord.w;"," #endif"," float color = 1.0 - smoothstep( mNear, mFar, depth );"," gl_FragColor = vec4( vec3( color ), opacity );","}"].join("\n")},normal:{uniforms:{opacity:{type:"f",value:1}},vertexShader:["varying vec3 vNormal;",o.ShaderChunk.common,o.ShaderChunk.morphtarget_pars_vertex,o.ShaderChunk.logdepthbuf_pars_vertex,"void main() {"," vNormal = normalize( normalMatrix * normal );",o.ShaderChunk.begin_vertex,o.ShaderChunk.morphtarget_vertex,o.ShaderChunk.project_vertex,o.ShaderChunk.logdepthbuf_vertex,"}"].join("\n"),fragmentShader:["uniform float opacity;","varying vec3 vNormal;",o.ShaderChunk.common,o.ShaderChunk.logdepthbuf_pars_fragment,"void main() {"," gl_FragColor = vec4( 0.5 * normalize( vNormal ) + 0.5, opacity );",o.ShaderChunk.logdepthbuf_fragment,"}"].join("\n")},cube:{uniforms:{tCube:{type:"t",value:null},tFlip:{type:"f",value:-1}},vertexShader:["varying vec3 vWorldPosition;",o.ShaderChunk.common,o.ShaderChunk.logdepthbuf_pars_vertex,"void main() {"," vWorldPosition = transformDirection( position, modelMatrix );"," gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",o.ShaderChunk.logdepthbuf_vertex,"}"].join("\n"),fragmentShader:["uniform samplerCube tCube;","uniform float tFlip;","varying vec3 vWorldPosition;",o.ShaderChunk.common,o.ShaderChunk.logdepthbuf_pars_fragment,"void main() {"," gl_FragColor = textureCube( tCube, vec3( tFlip * vWorldPosition.x, vWorldPosition.yz ) );",o.ShaderChunk.logdepthbuf_fragment,"}"].join("\n") +},equirect:{uniforms:{tEquirect:{type:"t",value:null},tFlip:{type:"f",value:-1}},vertexShader:["varying vec3 vWorldPosition;",o.ShaderChunk.common,o.ShaderChunk.logdepthbuf_pars_vertex,"void main() {"," vWorldPosition = transformDirection( position, modelMatrix );"," gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",o.ShaderChunk.logdepthbuf_vertex,"}"].join("\n"),fragmentShader:["uniform sampler2D tEquirect;","uniform float tFlip;","varying vec3 vWorldPosition;",o.ShaderChunk.common,o.ShaderChunk.logdepthbuf_pars_fragment,"void main() {","vec3 direction = normalize( vWorldPosition );","vec2 sampleUV;","sampleUV.y = saturate( tFlip * direction.y * -0.5 + 0.5 );","sampleUV.x = atan( direction.z, direction.x ) * RECIPROCAL_PI2 + 0.5;","gl_FragColor = texture2D( tEquirect, sampleUV );",o.ShaderChunk.logdepthbuf_fragment,"}"].join("\n")},depthRGBA:{uniforms:{},vertexShader:[o.ShaderChunk.common,o.ShaderChunk.morphtarget_pars_vertex,o.ShaderChunk.skinning_pars_vertex,o.ShaderChunk.logdepthbuf_pars_vertex,"void main() {",o.ShaderChunk.skinbase_vertex,o.ShaderChunk.begin_vertex,o.ShaderChunk.morphtarget_vertex,o.ShaderChunk.skinning_vertex,o.ShaderChunk.project_vertex,o.ShaderChunk.logdepthbuf_vertex,"}"].join("\n"),fragmentShader:[o.ShaderChunk.common,o.ShaderChunk.logdepthbuf_pars_fragment,"vec4 pack_depth( const in float depth ) {"," const vec4 bit_shift = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );"," const vec4 bit_mask = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );"," vec4 res = mod( depth * bit_shift * vec4( 255 ), vec4( 256 ) ) / vec4( 255 );"," res -= res.xxyz * bit_mask;"," return res;","}","void main() {",o.ShaderChunk.logdepthbuf_fragment," #ifdef USE_LOGDEPTHBUF_EXT"," gl_FragData[ 0 ] = pack_depth( gl_FragDepthEXT );"," #else"," gl_FragData[ 0 ] = pack_depth( gl_FragCoord.z );"," #endif","}"].join("\n")}},o.WebGLRenderer=function(e){function t(e,t,r,i){oe===!0&&(e*=i,t*=i,r*=i),je.clearColor(e,t,r,i)}function r(){Ye.init(),je.viewport(Le,Pe,Re,De),t(se.r,se.g,se.b,he)}function i(){Ae=null,Te=null,Ee="",_e=-1,Ge=!0,Ye.reset()}function n(e){e.preventDefault(),i(),r(),Qe.clear()}function a(e){var t=e.target;t.removeEventListener("dispose",a),c(t),Ne.textures--}function s(e){var t=e.target;t.removeEventListener("dispose",s),u(t),Ne.textures--}function h(e){var t=e.target;t.removeEventListener("dispose",h),l(t)}function c(e){var t=Qe.get(e);if(e.image&&t.__image__webglTextureCube)je.deleteTexture(t.__image__webglTextureCube);else{if(void 0===t.__webglInit)return;je.deleteTexture(t.__webglTexture)}Qe["delete"](e)}function u(e){var t=Qe.get(e);if(e&&void 0!==t.__webglTexture){if(je.deleteTexture(t.__webglTexture),e instanceof o.WebGLRenderTargetCube)for(var r=0;6>r;r++)je.deleteFramebuffer(t.__webglFramebuffer[r]),je.deleteRenderbuffer(t.__webglRenderbuffer[r]);else je.deleteFramebuffer(t.__webglFramebuffer),je.deleteRenderbuffer(t.__webglRenderbuffer);Qe["delete"](e)}}function l(e){p(e),Qe["delete"](e)}function p(e){var t=Qe.get(e).program.program;if(void 0!==t){e.program=void 0;for(var r=0,i=Me.length;r!==i;++r){var n=Me[r];if(n.program===t){var o=--n.usedTimes;if(0===o){var a=i-1;Me[r]=Me[a],Me.pop(),je.deleteProgram(t),Ne.programs=a}break}}}}function d(e,t,r,i){var n;if(r instanceof o.InstancedBufferGeometry&&(n=Xe.get("ANGLE_instanced_arrays"),null===n))return void console.error("THREE.WebGLRenderer.setupVertexAttributes: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");void 0===i&&(i=0),Ye.initAttributes();var a=r.attributes,s=t.getAttributes(),h=e.defaultAttributeValues;for(var c in s){var u=s[c];if(u>=0){var l=a[c];if(void 0!==l){Ye.enableAttribute(u);var p=l.itemSize,d=Ke.getAttributeBuffer(l);if(l instanceof o.InterleavedBufferAttribute){var f=l.data,m=f.stride,v=l.offset;if(je.bindBuffer(je.ARRAY_BUFFER,d),je.vertexAttribPointer(u,p,je.FLOAT,!1,m*f.array.BYTES_PER_ELEMENT,(i*m+v)*f.array.BYTES_PER_ELEMENT),f instanceof o.InstancedInterleavedBuffer){if(null===n)return void console.error("THREE.WebGLRenderer.setupVertexAttributes: using THREE.InstancedBufferAttribute but hardware does not support extension ANGLE_instanced_arrays.");n.vertexAttribDivisorANGLE(u,f.meshPerAttribute),void 0===r.maxInstancedCount&&(r.maxInstancedCount=f.meshPerAttribute*f.count)}}else if(je.bindBuffer(je.ARRAY_BUFFER,d),je.vertexAttribPointer(u,p,je.FLOAT,!1,0,i*p*4),l instanceof o.InstancedBufferAttribute){if(null===n)return void console.error("THREE.WebGLRenderer.setupVertexAttributes: using THREE.InstancedBufferAttribute but hardware does not support extension ANGLE_instanced_arrays.");n.vertexAttribDivisorANGLE(u,l.meshPerAttribute),void 0===r.maxInstancedCount&&(r.maxInstancedCount=l.meshPerAttribute*l.count)}}else if(void 0!==h){var g=h[c];if(void 0!==g)switch(g.length){case 2:je.vertexAttrib2fv(u,g);break;case 3:je.vertexAttrib3fv(u,g);break;case 4:je.vertexAttrib4fv(u,g);break;default:je.vertexAttrib1fv(u,g)}}}}Ye.disableUnusedAttributes()}function f(e,t){return t[0]-e[0]}function m(e,t){return e.object.renderOrder!==t.object.renderOrder?e.object.renderOrder-t.object.renderOrder:e.material.id!==t.material.id?e.material.id-t.material.id:e.z!==t.z?e.z-t.z:e.id-t.id}function v(e,t){return e.object.renderOrder!==t.object.renderOrder?e.object.renderOrder-t.object.renderOrder:e.z!==t.z?t.z-e.z:e.id-t.id}function g(e){var t,r;e.material.transparent?(t=ve,r=++ge):(t=fe,r=++me),ra;a++){var h=i[a],c=n[h.materialIndex];c.visible===!0&&y(e,r,c,Be.z,h)}else y(e,r,t,Be.z)}}for(var u=e.children,a=0,s=u.length;s>a;a++)x(u[a])}}function b(e,t,r,i,n){for(var o=0,a=e.length;a>o;o++){var s=e[o],h=s.object,c=s.geometry,u=void 0===n?s.material:n,l=s.group;h.modelViewMatrix.multiplyMatrices(t.matrixWorldInverse,h.matrixWorld),h.normalMatrix.getNormalMatrix(h.modelViewMatrix),we.renderBufferDirect(t,r,i,c,u,h,l)}}function w(e,t,r,i,n){for(var o=n,a=0,s=e.length;s>a;a++){var h=e[a];h.modelViewMatrix.multiplyMatrices(t.matrixWorldInverse,h.matrixWorld),h.normalMatrix.getNormalMatrix(h.modelViewMatrix),void 0===n&&(o=h.material),A(o);var c=_(t,r,i,o,h);Ee="",h.render(function(e){we.renderBufferImmediate(e,c,o)})}}function M(e,t,r,i){var n=Qe.get(e),a=Ze.getParameters(e,t,r,i),s=Ze.getProgramCode(e,a),c=!0;if(n.program)if(n.program.code!==s)p(e);else{if(void 0!==a.shaderID)return;c=!1}else e.addEventListener("dispose",h);if(a.shaderID){var u=o.ShaderLib[a.shaderID];n.__webglShader={name:e.type,uniforms:o.UniformsUtils.clone(u.uniforms),vertexShader:u.vertexShader,fragmentShader:u.fragmentShader}}else n.__webglShader={name:e.type,uniforms:e.uniforms,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader};e.__webglShader=n.__webglShader;var l=Ze.getProgram(e,a,s);c&&l.usedTimes++,n.program=l,e.program=l;var d=l.getAttributes();if(e.morphTargets){e.numSupportedMorphTargets=0;for(var f=0;f=0&&e.numSupportedMorphTargets++}if(e.morphNormals)for(e.numSupportedMorphNormals=0,f=0;f=0&&e.numSupportedMorphNormals++;n.uniformsList=[];var m=n.program.getUniforms();for(var v in n.__webglShader.uniforms){var g=m[v];g&&n.uniformsList.push([n.__webglShader.uniforms[v],g])}}function A(e){S(e),e.transparent===!0?Ye.setBlending(e.blending,e.blendEquation,e.blendSrc,e.blendDst,e.blendEquationAlpha,e.blendSrcAlpha,e.blendDstAlpha):Ye.setBlending(o.NoBlending),Ye.setDepthFunc(e.depthFunc),Ye.setDepthTest(e.depthTest),Ye.setDepthWrite(e.depthWrite),Ye.setColorWrite(e.colorWrite),Ye.setPolygonOffset(e.polygonOffset,e.polygonOffsetFactor,e.polygonOffsetUnits)}function S(e){e.side!==o.DoubleSide?Ye.enable(je.CULL_FACE):Ye.disable(je.CULL_FACE),Ye.setFlipSided(e.side===o.BackSide)}function _(e,t,r,i,n){Ce=0;var a=Qe.get(i);(i.needsUpdate||!a.program)&&(M(i,t,r,n),i.needsUpdate=!1);var s=!1,h=!1,c=!1,u=a.program,l=u.getUniforms(),p=a.__webglShader.uniforms;if(u.id!==Ae&&(je.useProgram(u.program),Ae=u.id,s=!0,h=!0,c=!0),i.id!==_e&&(-1===_e&&(c=!0),_e=i.id,h=!0),(s||e!==Te)&&(je.uniformMatrix4fv(l.projectionMatrix,!1,e.projectionMatrix.elements),qe.logarithmicDepthBuffer&&je.uniform1f(l.logDepthBufFC,2/(Math.log(e.far+1)/Math.LN2)),e!==Te&&(Te=e),(i instanceof o.ShaderMaterial||i instanceof o.MeshPhongMaterial||i.envMap)&&void 0!==l.cameraPosition&&(Be.setFromMatrixPosition(e.matrixWorld),je.uniform3f(l.cameraPosition,Be.x,Be.y,Be.z)),(i instanceof o.MeshPhongMaterial||i instanceof o.MeshLambertMaterial||i instanceof o.MeshBasicMaterial||i instanceof o.ShaderMaterial||i.skinning)&&void 0!==l.viewMatrix&&je.uniformMatrix4fv(l.viewMatrix,!1,e.matrixWorldInverse.elements)),i.skinning)if(n.bindMatrix&&void 0!==l.bindMatrix&&je.uniformMatrix4fv(l.bindMatrix,!1,n.bindMatrix.elements),n.bindMatrixInverse&&void 0!==l.bindMatrixInverse&&je.uniformMatrix4fv(l.bindMatrixInverse,!1,n.bindMatrixInverse.elements),qe.floatVertexTextures&&n.skeleton&&n.skeleton.useVertexTexture){if(void 0!==l.boneTexture){var d=k();je.uniform1i(l.boneTexture,d),we.setTexture(n.skeleton.boneTexture,d)}void 0!==l.boneTextureWidth&&je.uniform1i(l.boneTextureWidth,n.skeleton.boneTextureWidth),void 0!==l.boneTextureHeight&&je.uniform1i(l.boneTextureHeight,n.skeleton.boneTextureHeight)}else n.skeleton&&n.skeleton.boneMatrices&&void 0!==l.boneGlobalMatrices&&je.uniformMatrix4fv(l.boneGlobalMatrices,!1,n.skeleton.boneMatrices);return h&&(r&&i.fog&&P(p,r),(i instanceof o.MeshPhongMaterial||i instanceof o.MeshLambertMaterial||i.lights)&&(Ge&&(c=!0,G(t,e),Ge=!1),c?(D(p,ze),F(p,!0)):F(p,!1)),(i instanceof o.MeshBasicMaterial||i instanceof o.MeshLambertMaterial||i instanceof o.MeshPhongMaterial)&&E(p,i),i instanceof o.LineBasicMaterial?T(p,i):i instanceof o.LineDashedMaterial?(T(p,i),C(p,i)):i instanceof o.PointsMaterial?L(p,i):i instanceof o.MeshPhongMaterial?R(p,i):i instanceof o.MeshDepthMaterial?(p.mNear.value=e.near,p.mFar.value=e.far,p.opacity.value=i.opacity):i instanceof o.MeshNormalMaterial&&(p.opacity.value=i.opacity),n.receiveShadow&&!i._shadowPass&&O(p,t),B(a.uniformsList)),U(l,n),void 0!==l.modelMatrix&&je.uniformMatrix4fv(l.modelMatrix,!1,n.matrixWorld.elements),u}function E(e,t){e.opacity.value=t.opacity,e.diffuse.value=t.color,t.emissive&&(e.emissive.value=t.emissive),e.map.value=t.map,e.specularMap.value=t.specularMap,e.alphaMap.value=t.alphaMap,t.aoMap&&(e.aoMap.value=t.aoMap,e.aoMapIntensity.value=t.aoMapIntensity);var r;if(t.map?r=t.map:t.specularMap?r=t.specularMap:t.displacementMap?r=t.displacementMap:t.normalMap?r=t.normalMap:t.bumpMap?r=t.bumpMap:t.alphaMap?r=t.alphaMap:t.emissiveMap&&(r=t.emissiveMap),void 0!==r){var i=r.offset,n=r.repeat;e.offsetRepeat.value.set(i.x,i.y,n.x,n.y)}e.envMap.value=t.envMap,e.flipEnvMap.value=t.envMap instanceof o.WebGLRenderTargetCube?1:-1,e.reflectivity.value=t.reflectivity,e.refractionRatio.value=t.refractionRatio}function T(e,t){e.diffuse.value=t.color,e.opacity.value=t.opacity}function C(e,t){e.dashSize.value=t.dashSize,e.totalSize.value=t.dashSize+t.gapSize,e.scale.value=t.scale}function L(e,t){if(e.psColor.value=t.color,e.opacity.value=t.opacity,e.size.value=t.size,e.scale.value=K.height/2,e.map.value=t.map,null!==t.map){var r=t.map.offset,i=t.map.repeat;e.offsetRepeat.value.set(r.x,r.y,i.x,i.y)}}function P(e,t){e.fogColor.value=t.color,t instanceof o.Fog?(e.fogNear.value=t.near,e.fogFar.value=t.far):t instanceof o.FogExp2&&(e.fogDensity.value=t.density)}function R(e,t){e.specular.value=t.specular,e.shininess.value=t.shininess,t.lightMap&&(e.lightMap.value=t.lightMap,e.lightMapIntensity.value=t.lightMapIntensity),t.emissiveMap&&(e.emissiveMap.value=t.emissiveMap),t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale),t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale)),t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}function D(e,t){e.ambientLightColor.value=t.ambient,e.directionalLightColor.value=t.directional.colors,e.directionalLightDirection.value=t.directional.positions,e.pointLightColor.value=t.point.colors,e.pointLightPosition.value=t.point.positions,e.pointLightDistance.value=t.point.distances,e.pointLightDecay.value=t.point.decays,e.spotLightColor.value=t.spot.colors,e.spotLightPosition.value=t.spot.positions,e.spotLightDistance.value=t.spot.distances,e.spotLightDirection.value=t.spot.directions,e.spotLightAngleCos.value=t.spot.anglesCos,e.spotLightExponent.value=t.spot.exponents,e.spotLightDecay.value=t.spot.decays,e.hemisphereLightSkyColor.value=t.hemi.skyColors,e.hemisphereLightGroundColor.value=t.hemi.groundColors,e.hemisphereLightDirection.value=t.hemi.positions}function F(e,t){e.ambientLightColor.needsUpdate=t,e.directionalLightColor.needsUpdate=t,e.directionalLightDirection.needsUpdate=t,e.pointLightColor.needsUpdate=t,e.pointLightPosition.needsUpdate=t,e.pointLightDistance.needsUpdate=t,e.pointLightDecay.needsUpdate=t,e.spotLightColor.needsUpdate=t,e.spotLightPosition.needsUpdate=t,e.spotLightDistance.needsUpdate=t,e.spotLightDirection.needsUpdate=t,e.spotLightAngleCos.needsUpdate=t,e.spotLightExponent.needsUpdate=t,e.spotLightDecay.needsUpdate=t,e.hemisphereLightSkyColor.needsUpdate=t,e.hemisphereLightGroundColor.needsUpdate=t,e.hemisphereLightDirection.needsUpdate=t}function O(e,t){if(e.shadowMatrix)for(var r=0,i=0,n=t.length;n>i;i++){var a=t[i];a.castShadow&&(a instanceof o.SpotLight||a instanceof o.DirectionalLight)&&(e.shadowMap.value[r]=a.shadowMap,e.shadowMapSize.value[r]=a.shadowMapSize,e.shadowMatrix.value[r]=a.shadowMatrix,e.shadowDarkness.value[r]=a.shadowDarkness,e.shadowBias.value[r]=a.shadowBias,r++)}}function U(e,t){je.uniformMatrix4fv(e.modelViewMatrix,!1,t.modelViewMatrix.elements),e.normalMatrix&&je.uniformMatrix3fv(e.normalMatrix,!1,t.normalMatrix.elements)}function k(){var e=Ce;return e>=qe.maxTextures&&console.warn("WebGLRenderer: trying to use "+e+" texture units while this GPU supports only "+qe.maxTextures),Ce+=1,e}function B(e){for(var t,r,i=0,n=e.length;n>i;i++){var a=e[i][0];if(a.needsUpdate!==!1){var s=a.type,h=a.value,c=e[i][1];switch(s){case"1i":je.uniform1i(c,h);break;case"1f":je.uniform1f(c,h);break;case"2f":je.uniform2f(c,h[0],h[1]);break;case"3f":je.uniform3f(c,h[0],h[1],h[2]);break;case"4f":je.uniform4f(c,h[0],h[1],h[2],h[3]);break;case"1iv":je.uniform1iv(c,h);break;case"3iv":je.uniform3iv(c,h);break;case"1fv":je.uniform1fv(c,h);break;case"2fv":je.uniform2fv(c,h);break;case"3fv":je.uniform3fv(c,h);break;case"4fv":je.uniform4fv(c,h);break;case"Matrix3fv":je.uniformMatrix3fv(c,!1,h);break;case"Matrix4fv":je.uniformMatrix4fv(c,!1,h);break;case"i":je.uniform1i(c,h);break;case"f":je.uniform1f(c,h);break;case"v2":je.uniform2f(c,h.x,h.y);break;case"v3":je.uniform3f(c,h.x,h.y,h.z);break;case"v4":je.uniform4f(c,h.x,h.y,h.z,h.w);break;case"c":je.uniform3f(c,h.r,h.g,h.b);break;case"iv1":je.uniform1iv(c,h);break;case"iv":je.uniform3iv(c,h);break;case"fv1":je.uniform1fv(c,h);break;case"fv":je.uniform3fv(c,h);break;case"v2v":void 0===a._array&&(a._array=new Float32Array(2*h.length));for(var u=0,l=0,p=h.length;p>u;u++,l+=2)a._array[l+0]=h[u].x,a._array[l+1]=h[u].y;je.uniform2fv(c,a._array);break;case"v3v":void 0===a._array&&(a._array=new Float32Array(3*h.length));for(var u=0,d=0,p=h.length;p>u;u++,d+=3)a._array[d+0]=h[u].x,a._array[d+1]=h[u].y,a._array[d+2]=h[u].z;je.uniform3fv(c,a._array);break;case"v4v":void 0===a._array&&(a._array=new Float32Array(4*h.length));for(var u=0,f=0,p=h.length;p>u;u++,f+=4)a._array[f+0]=h[u].x,a._array[f+1]=h[u].y,a._array[f+2]=h[u].z,a._array[f+3]=h[u].w;je.uniform4fv(c,a._array);break;case"m3":je.uniformMatrix3fv(c,!1,h.elements);break;case"m3v":void 0===a._array&&(a._array=new Float32Array(9*h.length));for(var u=0,p=h.length;p>u;u++)h[u].flattenToArrayOffset(a._array,9*u);je.uniformMatrix3fv(c,!1,a._array);break;case"m4":je.uniformMatrix4fv(c,!1,h.elements);break;case"m4v":void 0===a._array&&(a._array=new Float32Array(16*h.length));for(var u=0,p=h.length;p>u;u++)h[u].flattenToArrayOffset(a._array,16*u);je.uniformMatrix4fv(c,!1,a._array);break;case"t":if(t=h,r=k(),je.uniform1i(c,r),!t)continue;t instanceof o.CubeTexture||Array.isArray(t.image)&&6===t.image.length?j(t,r):t instanceof o.WebGLRenderTargetCube?H(t,r):we.setTexture(t,r);break;case"tv":void 0===a._array&&(a._array=[]);for(var u=0,p=a.value.length;p>u;u++)a._array[u]=k();je.uniform1iv(c,a._array);for(var u=0,p=a.value.length;p>u;u++)t=a.value[u],r=a._array[u],t&&we.setTexture(t,r);break;default:console.warn("THREE.WebGLRenderer: Unknown uniform type: "+s)}}}}function V(e,t,r,i){e[t+0]=r.r*i,e[t+1]=r.g*i,e[t+2]=r.b*i}function G(e,t){var r,i,n,a,s,h,c,u,l=0,p=0,d=0,f=ze,m=t.matrixWorldInverse,v=f.directional.colors,g=f.directional.positions,y=f.point.colors,x=f.point.positions,b=f.point.distances,w=f.point.decays,M=f.spot.colors,A=f.spot.positions,S=f.spot.distances,_=f.spot.directions,E=f.spot.anglesCos,T=f.spot.exponents,C=f.spot.decays,L=f.hemi.skyColors,P=f.hemi.groundColors,R=f.hemi.positions,D=0,F=0,O=0,U=0,k=0,B=0,G=0,z=0,N=0,I=0,j=0,H=0;for(r=0,i=e.length;i>r;r++)if(n=e[r],!n.onlyShadow)if(a=n.color,c=n.intensity,u=n.distance,n instanceof o.AmbientLight){if(!n.visible)continue;l+=a.r,p+=a.g,d+=a.b}else if(n instanceof o.DirectionalLight){if(k+=1,!n.visible)continue;Ve.setFromMatrixPosition(n.matrixWorld),Be.setFromMatrixPosition(n.target.matrixWorld),Ve.sub(Be),Ve.transformDirection(m),N=3*D,g[N+0]=Ve.x,g[N+1]=Ve.y,g[N+2]=Ve.z,V(v,N,a,c),D+=1}else if(n instanceof o.PointLight){if(B+=1,!n.visible)continue;I=3*F,V(y,I,a,c),Be.setFromMatrixPosition(n.matrixWorld),Be.applyMatrix4(m),x[I+0]=Be.x,x[I+1]=Be.y,x[I+2]=Be.z,b[F]=u,w[F]=0===n.distance?0:n.decay,F+=1}else if(n instanceof o.SpotLight){if(G+=1,!n.visible)continue;j=3*O,V(M,j,a,c),Ve.setFromMatrixPosition(n.matrixWorld),Be.copy(Ve).applyMatrix4(m),A[j+0]=Be.x,A[j+1]=Be.y,A[j+2]=Be.z,S[O]=u,Be.setFromMatrixPosition(n.target.matrixWorld),Ve.sub(Be),Ve.transformDirection(m),_[j+0]=Ve.x,_[j+1]=Ve.y,_[j+2]=Ve.z,E[O]=Math.cos(n.angle),T[O]=n.exponent,C[O]=0===n.distance?0:n.decay,O+=1}else if(n instanceof o.HemisphereLight){if(z+=1,!n.visible)continue;Ve.setFromMatrixPosition(n.matrixWorld),Ve.transformDirection(m),H=3*U,R[H+0]=Ve.x,R[H+1]=Ve.y,R[H+2]=Ve.z,s=n.color,h=n.groundColor,V(L,H,s,c),V(P,H,h,c),U+=1}for(r=3*D,i=Math.max(v.length,3*k);i>r;r++)v[r]=0;for(r=3*F,i=Math.max(y.length,3*B);i>r;r++)y[r]=0;for(r=3*O,i=Math.max(M.length,3*G);i>r;r++)M[r]=0;for(r=3*U,i=Math.max(L.length,3*z);i>r;r++)L[r]=0;for(r=3*U,i=Math.max(P.length,3*z);i>r;r++)P[r]=0;f.directional.length=D,f.point.length=F,f.spot.length=O,f.hemi.length=U,f.ambient[0]=l,f.ambient[1]=p,f.ambient[2]=d}function z(e,t,r){var i;if(r?(je.texParameteri(e,je.TEXTURE_WRAP_S,Q(t.wrapS)),je.texParameteri(e,je.TEXTURE_WRAP_T,Q(t.wrapT)),je.texParameteri(e,je.TEXTURE_MAG_FILTER,Q(t.magFilter)),je.texParameteri(e,je.TEXTURE_MIN_FILTER,Q(t.minFilter))):(je.texParameteri(e,je.TEXTURE_WRAP_S,je.CLAMP_TO_EDGE),je.texParameteri(e,je.TEXTURE_WRAP_T,je.CLAMP_TO_EDGE),(t.wrapS!==o.ClampToEdgeWrapping||t.wrapT!==o.ClampToEdgeWrapping)&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping. ( "+t.sourceFile+" )"),je.texParameteri(e,je.TEXTURE_MAG_FILTER,Y(t.magFilter)),je.texParameteri(e,je.TEXTURE_MIN_FILTER,Y(t.minFilter)),t.minFilter!==o.NearestFilter&&t.minFilter!==o.LinearFilter&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter. ( "+t.sourceFile+" )")),i=Xe.get("EXT_texture_filter_anisotropic")){if(t.type===o.FloatType&&null===Xe.get("OES_texture_float_linear"))return;if(t.type===o.HalfFloatType&&null===Xe.get("OES_texture_half_float_linear"))return;(t.anisotropy>1||Qe.get(t).__currentAnisotropy)&&(je.texParameterf(e,i.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(t.anisotropy,we.getMaxAnisotropy())),Qe.get(t).__currentAnisotropy=t.anisotropy)}}function N(e,t,r){void 0===e.__webglInit&&(e.__webglInit=!0,t.__webglInit=!0,t.addEventListener("dispose",a),e.__webglTexture=je.createTexture(),Ne.textures++),Ye.activeTexture(je.TEXTURE0+r),Ye.bindTexture(je.TEXTURE_2D,e.__webglTexture),je.pixelStorei(je.UNPACK_FLIP_Y_WEBGL,t.flipY),je.pixelStorei(je.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.premultiplyAlpha),je.pixelStorei(je.UNPACK_ALIGNMENT,t.unpackAlignment),t.image=I(t.image,qe.maxTextureSize);var i=t.image,n=o.Math.isPowerOfTwo(i.width)&&o.Math.isPowerOfTwo(i.height),s=Q(t.format),h=Q(t.type);z(je.TEXTURE_2D,t,n);var c,u=t.mipmaps;if(t instanceof o.DataTexture)if(u.length>0&&n){for(var l=0,p=u.length;p>l;l++)c=u[l],Ye.texImage2D(je.TEXTURE_2D,l,s,c.width,c.height,0,s,h,c.data);t.generateMipmaps=!1}else Ye.texImage2D(je.TEXTURE_2D,0,s,i.width,i.height,0,s,h,i.data);else if(t instanceof o.CompressedTexture)for(var l=0,p=u.length;p>l;l++)c=u[l],t.format!==o.RGBAFormat&&t.format!==o.RGBFormat?Ye.getCompressedTextureFormats().indexOf(s)>-1?Ye.compressedTexImage2D(je.TEXTURE_2D,l,s,c.width,c.height,0,c.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):Ye.texImage2D(je.TEXTURE_2D,l,s,c.width,c.height,0,s,h,c.data);else if(u.length>0&&n){for(var l=0,p=u.length;p>l;l++)c=u[l],Ye.texImage2D(je.TEXTURE_2D,l,s,s,h,c);t.generateMipmaps=!1}else Ye.texImage2D(je.TEXTURE_2D,0,s,s,h,t.image);t.generateMipmaps&&n&&je.generateMipmap(je.TEXTURE_2D),e.__version=t.version,t.onUpdate&&t.onUpdate(t)}function I(e,t){if(e.width>t||e.height>t){var r=t/Math.max(e.width,e.height),i=document.createElement("canvas");i.width=Math.floor(e.width*r),i.height=Math.floor(e.height*r);var n=i.getContext("2d");return n.drawImage(e,0,0,e.width,e.height,0,0,i.width,i.height),console.warn("THREE.WebGLRenderer: image is too big ("+e.width+"x"+e.height+"). Resized to "+i.width+"x"+i.height,e),i}return e}function j(e,t){var r=Qe.get(e);if(6===e.image.length)if(e.version>0&&r.__version!==e.version){r.__image__webglTextureCube||(e.addEventListener("dispose",a),r.__image__webglTextureCube=je.createTexture(),Ne.textures++),Ye.activeTexture(je.TEXTURE0+t),Ye.bindTexture(je.TEXTURE_CUBE_MAP,r.__image__webglTextureCube),je.pixelStorei(je.UNPACK_FLIP_Y_WEBGL,e.flipY);for(var i=e instanceof o.CompressedTexture,n=e.image[0]instanceof o.DataTexture,s=[],h=0;6>h;h++)!we.autoScaleCubemaps||i||n?s[h]=n?e.image[h].image:e.image[h]:s[h]=I(e.image[h],qe.maxCubemapSize);var c=s[0],u=o.Math.isPowerOfTwo(c.width)&&o.Math.isPowerOfTwo(c.height),l=Q(e.format),p=Q(e.type);z(je.TEXTURE_CUBE_MAP,e,u);for(var h=0;6>h;h++)if(i)for(var d,f=s[h].mipmaps,m=0,v=f.length;v>m;m++)d=f[m],e.format!==o.RGBAFormat&&e.format!==o.RGBFormat?Ye.getCompressedTextureFormats().indexOf(l)>-1?Ye.compressedTexImage2D(je.TEXTURE_CUBE_MAP_POSITIVE_X+h,m,l,d.width,d.height,0,d.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setCubeTexture()"):Ye.texImage2D(je.TEXTURE_CUBE_MAP_POSITIVE_X+h,m,l,d.width,d.height,0,l,p,d.data);else n?Ye.texImage2D(je.TEXTURE_CUBE_MAP_POSITIVE_X+h,0,l,s[h].width,s[h].height,0,l,p,s[h].data):Ye.texImage2D(je.TEXTURE_CUBE_MAP_POSITIVE_X+h,0,l,l,p,s[h]);e.generateMipmaps&&u&&je.generateMipmap(je.TEXTURE_CUBE_MAP),r.__version=e.version,e.onUpdate&&e.onUpdate(e)}else Ye.activeTexture(je.TEXTURE0+t),Ye.bindTexture(je.TEXTURE_CUBE_MAP,r.__image__webglTextureCube)}function H(e,t){Ye.activeTexture(je.TEXTURE0+t),Ye.bindTexture(je.TEXTURE_CUBE_MAP,Qe.get(e).__webglTexture)}function W(e,t,r){je.bindFramebuffer(je.FRAMEBUFFER,e),je.framebufferTexture2D(je.FRAMEBUFFER,je.COLOR_ATTACHMENT0,r,Qe.get(t).__webglTexture,0)}function X(e,t){je.bindRenderbuffer(je.RENDERBUFFER,e),t.depthBuffer&&!t.stencilBuffer?(je.renderbufferStorage(je.RENDERBUFFER,je.DEPTH_COMPONENT16,t.width,t.height),je.framebufferRenderbuffer(je.FRAMEBUFFER,je.DEPTH_ATTACHMENT,je.RENDERBUFFER,e)):t.depthBuffer&&t.stencilBuffer?(je.renderbufferStorage(je.RENDERBUFFER,je.DEPTH_STENCIL,t.width,t.height),je.framebufferRenderbuffer(je.FRAMEBUFFER,je.DEPTH_STENCIL_ATTACHMENT,je.RENDERBUFFER,e)):je.renderbufferStorage(je.RENDERBUFFER,je.RGBA4,t.width,t.height)}function q(e){e instanceof o.WebGLRenderTargetCube?(Ye.bindTexture(je.TEXTURE_CUBE_MAP,Qe.get(e).__webglTexture),je.generateMipmap(je.TEXTURE_CUBE_MAP),Ye.bindTexture(je.TEXTURE_CUBE_MAP,null)):(Ye.bindTexture(je.TEXTURE_2D,Qe.get(e).__webglTexture),je.generateMipmap(je.TEXTURE_2D),Ye.bindTexture(je.TEXTURE_2D,null))}function Y(e){return e===o.NearestFilter||e===o.NearestMipMapNearestFilter||e===o.NearestMipMapLinearFilter?je.NEAREST:je.LINEAR}function Q(e){var t;if(e===o.RepeatWrapping)return je.REPEAT;if(e===o.ClampToEdgeWrapping)return je.CLAMP_TO_EDGE;if(e===o.MirroredRepeatWrapping)return je.MIRRORED_REPEAT;if(e===o.NearestFilter)return je.NEAREST;if(e===o.NearestMipMapNearestFilter)return je.NEAREST_MIPMAP_NEAREST;if(e===o.NearestMipMapLinearFilter)return je.NEAREST_MIPMAP_LINEAR;if(e===o.LinearFilter)return je.LINEAR;if(e===o.LinearMipMapNearestFilter)return je.LINEAR_MIPMAP_NEAREST;if(e===o.LinearMipMapLinearFilter)return je.LINEAR_MIPMAP_LINEAR;if(e===o.UnsignedByteType)return je.UNSIGNED_BYTE;if(e===o.UnsignedShort4444Type)return je.UNSIGNED_SHORT_4_4_4_4;if(e===o.UnsignedShort5551Type)return je.UNSIGNED_SHORT_5_5_5_1;if(e===o.UnsignedShort565Type)return je.UNSIGNED_SHORT_5_6_5;if(e===o.ByteType)return je.BYTE;if(e===o.ShortType)return je.SHORT;if(e===o.UnsignedShortType)return je.UNSIGNED_SHORT;if(e===o.IntType)return je.INT;if(e===o.UnsignedIntType)return je.UNSIGNED_INT;if(e===o.FloatType)return je.FLOAT;if(t=Xe.get("OES_texture_half_float"),null!==t&&e===o.HalfFloatType)return t.HALF_FLOAT_OES;if(e===o.AlphaFormat)return je.ALPHA;if(e===o.RGBFormat)return je.RGB;if(e===o.RGBAFormat)return je.RGBA;if(e===o.LuminanceFormat)return je.LUMINANCE;if(e===o.LuminanceAlphaFormat)return je.LUMINANCE_ALPHA;if(e===o.AddEquation)return je.FUNC_ADD;if(e===o.SubtractEquation)return je.FUNC_SUBTRACT;if(e===o.ReverseSubtractEquation)return je.FUNC_REVERSE_SUBTRACT;if(e===o.ZeroFactor)return je.ZERO;if(e===o.OneFactor)return je.ONE;if(e===o.SrcColorFactor)return je.SRC_COLOR;if(e===o.OneMinusSrcColorFactor)return je.ONE_MINUS_SRC_COLOR;if(e===o.SrcAlphaFactor)return je.SRC_ALPHA;if(e===o.OneMinusSrcAlphaFactor)return je.ONE_MINUS_SRC_ALPHA;if(e===o.DstAlphaFactor)return je.DST_ALPHA;if(e===o.OneMinusDstAlphaFactor)return je.ONE_MINUS_DST_ALPHA;if(e===o.DstColorFactor)return je.DST_COLOR;if(e===o.OneMinusDstColorFactor)return je.ONE_MINUS_DST_COLOR;if(e===o.SrcAlphaSaturateFactor)return je.SRC_ALPHA_SATURATE;if(t=Xe.get("WEBGL_compressed_texture_s3tc"),null!==t){if(e===o.RGB_S3TC_DXT1_Format)return t.COMPRESSED_RGB_S3TC_DXT1_EXT;if(e===o.RGBA_S3TC_DXT1_Format)return t.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(e===o.RGBA_S3TC_DXT3_Format)return t.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(e===o.RGBA_S3TC_DXT5_Format)return t.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(t=Xe.get("WEBGL_compressed_texture_pvrtc"),null!==t){if(e===o.RGB_PVRTC_4BPPV1_Format)return t.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(e===o.RGB_PVRTC_2BPPV1_Format)return t.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(e===o.RGBA_PVRTC_4BPPV1_Format)return t.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(e===o.RGBA_PVRTC_2BPPV1_Format)return t.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(t=Xe.get("EXT_blend_minmax"),null!==t){if(e===o.MinEquation)return t.MIN_EXT;if(e===o.MaxEquation)return t.MAX_EXT}return 0}console.log("THREE.WebGLRenderer",o.REVISION),e=e||{};var K=void 0!==e.canvas?e.canvas:document.createElement("canvas"),Z=void 0!==e.context?e.context:null,J=K.width,$=K.height,ee=1,te=void 0!==e.alpha?e.alpha:!1,re=void 0!==e.depth?e.depth:!0,ie=void 0!==e.stencil?e.stencil:!0,ne=void 0!==e.antialias?e.antialias:!1,oe=void 0!==e.premultipliedAlpha?e.premultipliedAlpha:!0,ae=void 0!==e.preserveDrawingBuffer?e.preserveDrawingBuffer:!1,se=new o.Color(0),he=0,ce=[],ue=[],le=-1,pe=[],de=-1,fe=[],me=-1,ve=[],ge=-1,ye=new Float32Array(8),xe=[],be=[];this.domElement=K,this.context=null,this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.gammaFactor=2,this.gammaInput=!1,this.gammaOutput=!1,this.maxMorphTargets=8,this.maxMorphNormals=4,this.autoScaleCubemaps=!0;var we=this,Me=[],Ae=null,Se=null,_e=-1,Ee="",Te=null,Ce=0,Le=0,Pe=0,Re=K.width,De=K.height,Fe=0,Oe=0,Ue=new o.Frustum,ke=new o.Matrix4,Be=new o.Vector3,Ve=new o.Vector3,Ge=!0,ze={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[],decays:[]},spot:{length:0,colors:[],positions:[],distances:[],directions:[],anglesCos:[],exponents:[],decays:[]},hemi:{length:0,skyColors:[],groundColors:[],positions:[]}},Ne={programs:0,geometries:0,textures:0},Ie={calls:0,vertices:0,faces:0,points:0};this.info={render:Ie,memory:Ne,programs:Me};var je;try{var He={alpha:te,depth:re,stencil:ie,antialias:ne,premultipliedAlpha:oe,preserveDrawingBuffer:ae};if(je=Z||K.getContext("webgl",He)||K.getContext("experimental-webgl",He),null===je)throw null!==K.getContext("webgl")?"Error creating WebGL context with your selected attributes.":"Error creating WebGL context.";K.addEventListener("webglcontextlost",n,!1)}catch(We){console.error("THREE.WebGLRenderer: "+We)}var Xe=new o.WebGLExtensions(je);Xe.get("OES_texture_float"),Xe.get("OES_texture_float_linear"),Xe.get("OES_texture_half_float"),Xe.get("OES_texture_half_float_linear"),Xe.get("OES_standard_derivatives"),Xe.get("ANGLE_instanced_arrays"),Xe.get("OES_element_index_uint")&&(o.BufferGeometry.MaxIndex=4294967296);var qe=new o.WebGLCapabilities(je,Xe,e),Ye=new o.WebGLState(je,Xe,Q),Qe=new o.WebGLProperties,Ke=new o.WebGLObjects(je,Qe,this.info),Ze=new o.WebGLPrograms(this,qe),Je=new o.WebGLBufferRenderer(je,Xe,Ie),$e=new o.WebGLIndexedBufferRenderer(je,Xe,Ie);r(),this.context=je,this.capabilities=qe,this.extensions=Xe,this.state=Ye;var et=new o.WebGLShadowMap(this,ce,Ke);this.shadowMap=et;var tt=new o.SpritePlugin(this,xe),rt=new o.LensFlarePlugin(this,be);this.getContext=function(){return je},this.getContextAttributes=function(){return je.getContextAttributes()},this.forceContextLoss=function(){Xe.get("WEBGL_lose_context").loseContext()},this.getMaxAnisotropy=function(){var e;return function(){if(void 0!==e)return e;var t=Xe.get("EXT_texture_filter_anisotropic");return e=null!==t?je.getParameter(t.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0}}(),this.getPrecision=function(){return qe.precision},this.getPixelRatio=function(){return ee},this.setPixelRatio=function(e){void 0!==e&&(ee=e)},this.getSize=function(){return{width:J,height:$}},this.setSize=function(e,t,r){J=e,$=t,K.width=e*ee,K.height=t*ee,r!==!1&&(K.style.width=e+"px",K.style.height=t+"px"),this.setViewport(0,0,e,t)},this.setViewport=function(e,t,r,i){Le=e*ee,Pe=t*ee,Re=r*ee,De=i*ee,je.viewport(Le,Pe,Re,De)},this.setScissor=function(e,t,r,i){je.scissor(e*ee,t*ee,r*ee,i*ee)},this.enableScissorTest=function(e){Ye.setScissorTest(e)},this.getClearColor=function(){return se},this.setClearColor=function(e,r){se.set(e),he=void 0!==r?r:1,t(se.r,se.g,se.b,he)},this.getClearAlpha=function(){ +return he},this.setClearAlpha=function(e){he=e,t(se.r,se.g,se.b,he)},this.clear=function(e,t,r){var i=0;(void 0===e||e)&&(i|=je.COLOR_BUFFER_BIT),(void 0===t||t)&&(i|=je.DEPTH_BUFFER_BIT),(void 0===r||r)&&(i|=je.STENCIL_BUFFER_BIT),je.clear(i)},this.clearColor=function(){je.clear(je.COLOR_BUFFER_BIT)},this.clearDepth=function(){je.clear(je.DEPTH_BUFFER_BIT)},this.clearStencil=function(){je.clear(je.STENCIL_BUFFER_BIT)},this.clearTarget=function(e,t,r,i){this.setRenderTarget(e),this.clear(t,r,i)},this.resetGLState=i,this.dispose=function(){K.removeEventListener("webglcontextlost",n,!1)},this.renderBufferImmediate=function(e,t,r){Ye.initAttributes();var i=Qe.get(e);e.hasPositions&&!i.position&&(i.position=je.createBuffer()),e.hasNormals&&!i.normal&&(i.normal=je.createBuffer()),e.hasUvs&&!i.uv&&(i.uv=je.createBuffer()),e.hasColors&&!i.color&&(i.color=je.createBuffer());var n=t.getAttributes();if(e.hasPositions&&(je.bindBuffer(je.ARRAY_BUFFER,i.position),je.bufferData(je.ARRAY_BUFFER,e.positionArray,je.DYNAMIC_DRAW),Ye.enableAttribute(n.position),je.vertexAttribPointer(n.position,3,je.FLOAT,!1,0,0)),e.hasNormals){if(je.bindBuffer(je.ARRAY_BUFFER,i.normal),"MeshPhongMaterial"!==r.type&&r.shading===o.FlatShading)for(var a=0,s=3*e.count;s>a;a+=9){var h=e.normalArray,c=(h[a+0]+h[a+3]+h[a+6])/3,u=(h[a+1]+h[a+4]+h[a+7])/3,l=(h[a+2]+h[a+5]+h[a+8])/3;h[a+0]=c,h[a+1]=u,h[a+2]=l,h[a+3]=c,h[a+4]=u,h[a+5]=l,h[a+6]=c,h[a+7]=u,h[a+8]=l}je.bufferData(je.ARRAY_BUFFER,e.normalArray,je.DYNAMIC_DRAW),Ye.enableAttribute(n.normal),je.vertexAttribPointer(n.normal,3,je.FLOAT,!1,0,0)}e.hasUvs&&r.map&&(je.bindBuffer(je.ARRAY_BUFFER,i.uv),je.bufferData(je.ARRAY_BUFFER,e.uvArray,je.DYNAMIC_DRAW),Ye.enableAttribute(n.uv),je.vertexAttribPointer(n.uv,2,je.FLOAT,!1,0,0)),e.hasColors&&r.vertexColors!==o.NoColors&&(je.bindBuffer(je.ARRAY_BUFFER,i.color),je.bufferData(je.ARRAY_BUFFER,e.colorArray,je.DYNAMIC_DRAW),Ye.enableAttribute(n.color),je.vertexAttribPointer(n.color,3,je.FLOAT,!1,0,0)),Ye.disableUnusedAttributes(),je.drawArrays(je.TRIANGLES,0,e.count),e.count=0},this.renderBufferDirect=function(e,t,r,i,n,a,s){A(n);var h=_(e,t,r,n,a),c=!1,u=i.id+"_"+h.id+"_"+n.wireframe;u!==Ee&&(Ee=u,c=!0);var l=a.morphTargetInfluences;if(void 0!==l){for(var p=[],m=0,v=l.length;v>m;m++){var g=l[m];p.push([g,m])}p.sort(f),p.length>8&&(p.length=8);for(var y=i.morphAttributes,m=0,v=p.length;v>m;m++){var g=p[m];if(ye[m]=g[0],0!==g[0]){var x=g[1];n.morphTargets===!0&&y.position&&i.addAttribute("morphTarget"+m,y.position[x]),n.morphNormals===!0&&y.normal&&i.addAttribute("morphNormal"+m,y.normal[x])}else n.morphTargets===!0&&i.removeAttribute("morphTarget"+m),n.morphNormals===!0&&i.removeAttribute("morphNormal"+m)}var b=h.getUniforms();null!==b.morphTargetInfluences&&je.uniform1fv(b.morphTargetInfluences,ye),c=!0}var x=i.index,w=i.attributes.position;n.wireframe===!0&&(x=Ke.getWireframeAttribute(i));var M;if(null!==x?(M=$e,M.setIndex(x)):M=Je,c&&(d(n,h,i),null!==x&&je.bindBuffer(je.ELEMENT_ARRAY_BUFFER,Ke.getAttributeBuffer(x))),void 0===s){var S;S=null!==x?x.count:w instanceof o.InterleavedBufferAttribute?w.data.array.length/3:w.count;var E=i.drawRange;s={start:E.start,count:Math.min(E.count,S)}}if(a instanceof o.Mesh)n.wireframe===!0?(Ye.setLineWidth(n.wireframeLinewidth*ee),M.setMode(je.LINES)):M.setMode(je.TRIANGLES),i instanceof o.InstancedBufferGeometry&&i.maxInstancedCount>0?M.renderInstances(i):M.render(s.start,s.count);else if(a instanceof o.Line){var T=n.linewidth;void 0===T&&(T=1),Ye.setLineWidth(T*ee),a instanceof o.LineSegments?M.setMode(je.LINES):M.setMode(je.LINE_STRIP),M.render(s.start,s.count)}else a instanceof o.Points&&(M.setMode(je.POINTS),M.render(s.start,s.count))},this.render=function(e,t,r,i){var n=e.fog;if(Ee="",_e=-1,Te=null,Ge=!0,e.autoUpdate===!0&&e.updateMatrixWorld(),null===t.parent&&t.updateMatrixWorld(),t.matrixWorldInverse.getInverse(t.matrixWorld),ke.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),Ue.setFromMatrix(ke),ce.length=0,le=-1,de=-1,me=-1,ge=-1,xe.length=0,be.length=0,x(e),ue.length=le+1,pe.length=de+1,fe.length=me+1,ve.length=ge+1,we.sortObjects===!0&&(ue.sort(m),pe.sort(v)),et.render(e,t),Ie.calls=0,Ie.vertices=0,Ie.faces=0,Ie.points=0,this.setRenderTarget(r),(this.autoClear||i)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil),e.overrideMaterial){var a=e.overrideMaterial;b(ue,t,ce,n,a),b(pe,t,ce,n,a),w(fe,t,ce,n,a),w(ve,t,ce,n,a)}else Ye.setBlending(o.NoBlending),b(ue,t,ce,n),w(fe,t,ce,n),b(pe,t,ce,n),w(ve,t,ce,n);tt.render(e,t),rt.render(e,t,Fe,Oe),r&&r.generateMipmaps&&r.minFilter!==o.NearestFilter&&r.minFilter!==o.LinearFilter&&q(r),Ye.setDepthTest(!0),Ye.setDepthWrite(!0),Ye.setColorWrite(!0)},this.setFaceCulling=function(e,t){e===o.CullFaceNone?Ye.disable(je.CULL_FACE):(t===o.FrontFaceDirectionCW?je.frontFace(je.CW):je.frontFace(je.CCW),e===o.CullFaceBack?je.cullFace(je.BACK):e===o.CullFaceFront?je.cullFace(je.FRONT):je.cullFace(je.FRONT_AND_BACK),Ye.enable(je.CULL_FACE))},this.setTexture=function(e,t){var r=Qe.get(e);if(e.version>0&&r.__version!==e.version){var i=e.image;return void 0===i?void console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined",e):i.complete===!1?void console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete",e):void N(r,e,t)}Ye.activeTexture(je.TEXTURE0+t),Ye.bindTexture(je.TEXTURE_2D,r.__webglTexture)},this.setRenderTarget=function(e){var t=e instanceof o.WebGLRenderTargetCube;if(e&&void 0===Qe.get(e).__webglFramebuffer){var r=Qe.get(e);void 0===e.depthBuffer&&(e.depthBuffer=!0),void 0===e.stencilBuffer&&(e.stencilBuffer=!0),e.addEventListener("dispose",s),r.__webglTexture=je.createTexture(),Ne.textures++;var i=o.Math.isPowerOfTwo(e.width)&&o.Math.isPowerOfTwo(e.height),n=Q(e.format),a=Q(e.type);if(t){r.__webglFramebuffer=[],r.__webglRenderbuffer=[],Ye.bindTexture(je.TEXTURE_CUBE_MAP,r.__webglTexture),z(je.TEXTURE_CUBE_MAP,e,i);for(var h=0;6>h;h++)r.__webglFramebuffer[h]=je.createFramebuffer(),r.__webglRenderbuffer[h]=je.createRenderbuffer(),Ye.texImage2D(je.TEXTURE_CUBE_MAP_POSITIVE_X+h,0,n,e.width,e.height,0,n,a,null),W(r.__webglFramebuffer[h],e,je.TEXTURE_CUBE_MAP_POSITIVE_X+h),X(r.__webglRenderbuffer[h],e);e.generateMipmaps&&i&&je.generateMipmap(je.TEXTURE_CUBE_MAP)}else r.__webglFramebuffer=je.createFramebuffer(),e.shareDepthFrom?r.__webglRenderbuffer=e.shareDepthFrom.__webglRenderbuffer:r.__webglRenderbuffer=je.createRenderbuffer(),Ye.bindTexture(je.TEXTURE_2D,r.__webglTexture),z(je.TEXTURE_2D,e,i),Ye.texImage2D(je.TEXTURE_2D,0,n,e.width,e.height,0,n,a,null),W(r.__webglFramebuffer,e,je.TEXTURE_2D),e.shareDepthFrom?e.depthBuffer&&!e.stencilBuffer?je.framebufferRenderbuffer(je.FRAMEBUFFER,je.DEPTH_ATTACHMENT,je.RENDERBUFFER,r.__webglRenderbuffer):e.depthBuffer&&e.stencilBuffer&&je.framebufferRenderbuffer(je.FRAMEBUFFER,je.DEPTH_STENCIL_ATTACHMENT,je.RENDERBUFFER,r.__webglRenderbuffer):X(r.__webglRenderbuffer,e),e.generateMipmaps&&i&&je.generateMipmap(je.TEXTURE_2D);t?Ye.bindTexture(je.TEXTURE_CUBE_MAP,null):Ye.bindTexture(je.TEXTURE_2D,null),je.bindRenderbuffer(je.RENDERBUFFER,null),je.bindFramebuffer(je.FRAMEBUFFER,null)}var c,u,l,p,d;if(e){var r=Qe.get(e);c=t?r.__webglFramebuffer[e.activeCubeFace]:r.__webglFramebuffer,u=e.width,l=e.height,p=0,d=0}else c=null,u=Re,l=De,p=Le,d=Pe;c!==Se&&(je.bindFramebuffer(je.FRAMEBUFFER,c),je.viewport(p,d,u,l),Se=c),Fe=u,Oe=l},this.readRenderTargetPixels=function(e,t,r,i,n,a){if(!(e instanceof o.WebGLRenderTarget))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");if(Qe.get(e).__webglFramebuffer){if(e.format!==o.RGBAFormat)return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA format. readPixels can read only RGBA format.");var s=!1;Qe.get(e).__webglFramebuffer!==Se&&(je.bindFramebuffer(je.FRAMEBUFFER,Qe.get(e).__webglFramebuffer),s=!0),je.checkFramebufferStatus(je.FRAMEBUFFER)===je.FRAMEBUFFER_COMPLETE?je.readPixels(t,r,i,n,je.RGBA,je.UNSIGNED_BYTE,a):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete."),s&&je.bindFramebuffer(je.FRAMEBUFFER,Se)}},this.supportsFloatTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsFloatTextures() is now .extensions.get( 'OES_texture_float' )."),Xe.get("OES_texture_float")},this.supportsHalfFloatTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get( 'OES_texture_half_float' )."),Xe.get("OES_texture_half_float")},this.supportsStandardDerivatives=function(){return console.warn("THREE.WebGLRenderer: .supportsStandardDerivatives() is now .extensions.get( 'OES_standard_derivatives' )."),Xe.get("OES_standard_derivatives")},this.supportsCompressedTextureS3TC=function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTextureS3TC() is now .extensions.get( 'WEBGL_compressed_texture_s3tc' )."),Xe.get("WEBGL_compressed_texture_s3tc")},this.supportsCompressedTexturePVRTC=function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTexturePVRTC() is now .extensions.get( 'WEBGL_compressed_texture_pvrtc' )."),Xe.get("WEBGL_compressed_texture_pvrtc")},this.supportsBlendMinMax=function(){return console.warn("THREE.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get( 'EXT_blend_minmax' )."),Xe.get("EXT_blend_minmax")},this.supportsVertexTextures=function(){return qe.vertexTextures},this.supportsInstancedArrays=function(){return console.warn("THREE.WebGLRenderer: .supportsInstancedArrays() is now .extensions.get( 'ANGLE_instanced_arrays' )."),Xe.get("ANGLE_instanced_arrays")},this.initMaterial=function(){console.warn("THREE.WebGLRenderer: .initMaterial() has been removed.")},this.addPrePlugin=function(){console.warn("THREE.WebGLRenderer: .addPrePlugin() has been removed.")},this.addPostPlugin=function(){console.warn("THREE.WebGLRenderer: .addPostPlugin() has been removed.")},this.updateShadowMap=function(){console.warn("THREE.WebGLRenderer: .updateShadowMap() has been removed.")},Object.defineProperties(this,{shadowMapEnabled:{get:function(){return et.enabled},set:function(e){console.warn("THREE.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled."),et.enabled=e}},shadowMapType:{get:function(){return et.type},set:function(e){console.warn("THREE.WebGLRenderer: .shadowMapType is now .shadowMap.type."),et.type=e}},shadowMapCullFace:{get:function(){return et.cullFace},set:function(e){console.warn("THREE.WebGLRenderer: .shadowMapCullFace is now .shadowMap.cullFace."),et.cullFace=e}},shadowMapDebug:{get:function(){return et.debug},set:function(e){console.warn("THREE.WebGLRenderer: .shadowMapDebug is now .shadowMap.debug."),et.debug=e}}})},o.WebGLRenderTarget=function(e,t,r){this.uuid=o.Math.generateUUID(),this.width=e,this.height=t,r=r||{},this.wrapS=void 0!==r.wrapS?r.wrapS:o.ClampToEdgeWrapping,this.wrapT=void 0!==r.wrapT?r.wrapT:o.ClampToEdgeWrapping,this.magFilter=void 0!==r.magFilter?r.magFilter:o.LinearFilter,this.minFilter=void 0!==r.minFilter?r.minFilter:o.LinearMipMapLinearFilter,this.anisotropy=void 0!==r.anisotropy?r.anisotropy:1,this.offset=new o.Vector2(0,0),this.repeat=new o.Vector2(1,1),this.format=void 0!==r.format?r.format:o.RGBAFormat,this.type=void 0!==r.type?r.type:o.UnsignedByteType,this.depthBuffer=void 0!==r.depthBuffer?r.depthBuffer:!0,this.stencilBuffer=void 0!==r.stencilBuffer?r.stencilBuffer:!0,this.generateMipmaps=!0,this.shareDepthFrom=void 0!==r.shareDepthFrom?r.shareDepthFrom:null},o.WebGLRenderTarget.prototype={constructor:o.WebGLRenderTarget,setSize:function(e,t){(this.width!==e||this.height!==t)&&(this.width=e,this.height=t,this.dispose())},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.width=e.width,this.height=e.height,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.format=e.format,this.type=e.type,this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.generateMipmaps=e.generateMipmaps,this.shareDepthFrom=e.shareDepthFrom,this},dispose:function(){this.dispatchEvent({type:"dispose"})}},o.EventDispatcher.prototype.apply(o.WebGLRenderTarget.prototype),o.WebGLRenderTargetCube=function(e,t,r){o.WebGLRenderTarget.call(this,e,t,r),this.activeCubeFace=0},o.WebGLRenderTargetCube.prototype=Object.create(o.WebGLRenderTarget.prototype),o.WebGLRenderTargetCube.prototype.constructor=o.WebGLRenderTargetCube,o.WebGLBufferRenderer=function(e,t,r){function i(e){s=e}function n(t,i){e.drawArrays(s,t,i),r.calls++,r.vertices+=i,s===e.TRIANGLES&&(r.faces+=i/3)}function a(e){var r=t.get("ANGLE_instanced_arrays");if(null===r)return void console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");var i=e.attributes.position;i instanceof o.InterleavedBufferAttribute?r.drawArraysInstancedANGLE(s,0,i.data.count,e.maxInstancedCount):r.drawArraysInstancedANGLE(s,0,i.count,e.maxInstancedCount)}var s;this.setMode=i,this.render=n,this.renderInstances=a},o.WebGLIndexedBufferRenderer=function(e,t,r){function i(e){s=e}function n(r){r.array instanceof Uint32Array&&t.get("OES_element_index_uint")?(h=e.UNSIGNED_INT,c=4):(h=e.UNSIGNED_SHORT,c=2)}function o(t,i){e.drawElements(s,i,h,t*c),r.calls++,r.vertices+=i,s===e.TRIANGLES&&(r.faces+=i/3)}function a(e){var r=t.get("ANGLE_instanced_arrays");if(null===r)return void console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");var i=e.index;r.drawElementsInstancedANGLE(s,i.array.length,h,0,e.maxInstancedCount)}var s,h,c;this.setMode=i,this.setIndex=n,this.render=o,this.renderInstances=a},o.WebGLExtensions=function(e){var t={};this.get=function(r){if(void 0!==t[r])return t[r];var i;switch(r){case"EXT_texture_filter_anisotropic":i=e.getExtension("EXT_texture_filter_anisotropic")||e.getExtension("MOZ_EXT_texture_filter_anisotropic")||e.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":i=e.getExtension("WEBGL_compressed_texture_s3tc")||e.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":i=e.getExtension("WEBGL_compressed_texture_pvrtc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:i=e.getExtension(r)}return null===i&&console.warn("THREE.WebGLRenderer: "+r+" extension not supported."),t[r]=i,i}},o.WebGLCapabilities=function(e,t,r){function i(t){if("highp"===t){if(e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.HIGH_FLOAT).precision>0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.HIGH_FLOAT).precision>0)return"highp";t="mediump"}return"mediump"===t&&e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.MEDIUM_FLOAT).precision>0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}this.getMaxPrecision=i,this.precision=void 0!==r.precision?r.precision:"highp",this.logarithmicDepthBuffer=void 0!==r.logarithmicDepthBuffer?r.logarithmicDepthBuffer:!1,this.maxTextures=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS),this.maxVertexTextures=e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS),this.maxTextureSize=e.getParameter(e.MAX_TEXTURE_SIZE),this.maxCubemapSize=e.getParameter(e.MAX_CUBE_MAP_TEXTURE_SIZE),this.maxAttributes=e.getParameter(e.MAX_VERTEX_ATTRIBS),this.maxVertexUniforms=e.getParameter(e.MAX_VERTEX_UNIFORM_VECTORS),this.maxVaryings=e.getParameter(e.MAX_VARYING_VECTORS),this.maxFragmentUniforms=e.getParameter(e.MAX_FRAGMENT_UNIFORM_VECTORS),this.vertexTextures=this.maxVertexTextures>0,this.floatFragmentTextures=!!t.get("OES_texture_float"),this.floatVertexTextures=this.vertexTextures&&this.floatFragmentTextures;var n=i(this.precision);n!==this.precision&&(console.warn("THREE.WebGLRenderer:",this.precision,"not supported, using",n,"instead."),this.precision=n),this.logarithmicDepthBuffer&&(this.logarithmicDepthBuffer=!!t.get("EXT_frag_depth"))},o.WebGLGeometries=function(e,t,r){function i(e){var t=e.geometry;if(void 0!==u[t.id])return u[t.id];t.addEventListener("dispose",n);var i;return t instanceof o.BufferGeometry?i=t:t instanceof o.Geometry&&(void 0===t._bufferGeometry&&(t._bufferGeometry=(new o.BufferGeometry).setFromObject(e)),i=t._bufferGeometry),u[t.id]=i,r.memory.geometries++,i}function n(e){var i=e.target,o=u[i.id];h(o.attributes),i.removeEventListener("dispose",n),delete u[i.id];var a=t.get(i);a.wireframe&&s(a.wireframe),r.memory.geometries--}function a(e){return e instanceof o.InterleavedBufferAttribute?t.get(e.data).__webglBuffer:t.get(e).__webglBuffer}function s(t){var r=a(t);void 0!==r&&(e.deleteBuffer(r),c(t))}function h(e){for(var t in e)s(e[t])}function c(e){e instanceof o.InterleavedBufferAttribute?t["delete"](e.data):t["delete"](e)}var u={};this.get=i},o.WebGLObjects=function(e,t,r){function i(t){var r=l.get(t);t.geometry instanceof o.Geometry&&r.updateFromObject(t);var i=r.index,a=r.attributes;null!==i&&n(i,e.ELEMENT_ARRAY_BUFFER);for(var s in a)n(a[s],e.ARRAY_BUFFER);var h=r.morphAttributes;for(var s in h)for(var c=h[s],u=0,p=c.length;p>u;u++)n(c[u],e.ARRAY_BUFFER);return r}function n(e,r){var i=e instanceof o.InterleavedBufferAttribute?e.data:e,n=t.get(i);void 0===n.__webglBuffer?a(n,i,r):n.version!==i.version&&s(n,i,r)}function a(t,r,i){t.__webglBuffer=e.createBuffer(),e.bindBuffer(i,t.__webglBuffer);var n=r.dynamic?e.DYNAMIC_DRAW:e.STATIC_DRAW;e.bufferData(i,r.array,n),t.version=r.version}function s(t,r,i){e.bindBuffer(i,t.__webglBuffer),r.dynamic===!1||-1===r.updateRange.count?e.bufferSubData(i,0,r.array):0===r.updateRange.count?console.error("THREE.WebGLObjects.updateBuffer: dynamic THREE.BufferAttribute marked as needsUpdate but updateRange.count is 0, ensure you are using set methods or updating manually."):(e.bufferSubData(i,r.updateRange.offset*r.array.BYTES_PER_ELEMENT,r.array.subarray(r.updateRange.offset,r.updateRange.offset+r.updateRange.count)),r.updateRange.count=0),t.version=r.version}function h(e){return e instanceof o.InterleavedBufferAttribute?t.get(e.data).__webglBuffer:t.get(e).__webglBuffer}function c(r){var i=t.get(r);if(void 0!==i.wireframe)return i.wireframe;var a=[],s=r.index,h=r.attributes,c=h.position;if(null!==s)for(var l={},p=s.array,d=0,f=p.length;f>d;d+=3){var m=p[d+0],v=p[d+1],g=p[d+2];u(l,m,v)&&a.push(m,v),u(l,v,g)&&a.push(v,g),u(l,g,m)&&a.push(g,m)}else for(var p=h.position.array,d=0,f=p.length/3-1;f>d;d+=3){var m=d+0,v=d+1,g=d+2;a.push(m,v,v,g,g,m)}var y=c.count>65535?Uint32Array:Uint16Array,x=new o.BufferAttribute(new y(a),1);return n(x,e.ELEMENT_ARRAY_BUFFER),i.wireframe=x,x}function u(e,t,r){if(t>r){var i=t;t=r,r=i}var n=e[t];return void 0===n?(e[t]=[r],!0):-1===n.indexOf(r)?(n.push(r),!0):!1}var l=new o.WebGLGeometries(e,t,r);this.getAttributeBuffer=h,this.getWireframeAttribute=c,this.update=i},o.WebGLProgram=function(){function e(e){var t=[];for(var r in e){var i=e[r];i!==!1&&t.push("#define "+r+" "+i)}return t.join("\n")}function t(e,t,r){for(var i={},n=e.getProgramParameter(t,e.ACTIVE_UNIFORMS),o=0;n>o;o++){var a=e.getActiveUniform(t,o),s=a.name,h=e.getUniformLocation(t,s),c=s.lastIndexOf("[0]");-1!==c&&c===s.length-3&&(i[s.substr(0,c)]=h),i[s]=h}return i}function r(e,t,r){for(var i={},n=e.getProgramParameter(t,e.ACTIVE_ATTRIBUTES),o=0;n>o;o++){var a=e.getActiveAttrib(t,o),s=a.name;i[s]=e.getAttribLocation(t,s)}return i}function i(e){return""!==e}var n=0;return function(a,s,h,c){var u=a.context,l=h.defines,p=h.__webglShader.vertexShader,d=h.__webglShader.fragmentShader,f="SHADOWMAP_TYPE_BASIC";c.shadowMapType===o.PCFShadowMap?f="SHADOWMAP_TYPE_PCF":c.shadowMapType===o.PCFSoftShadowMap&&(f="SHADOWMAP_TYPE_PCF_SOFT");var m="ENVMAP_TYPE_CUBE",v="ENVMAP_MODE_REFLECTION",g="ENVMAP_BLENDING_MULTIPLY";if(c.envMap){switch(h.envMap.mapping){case o.CubeReflectionMapping:case o.CubeRefractionMapping:m="ENVMAP_TYPE_CUBE";break;case o.EquirectangularReflectionMapping:case o.EquirectangularRefractionMapping:m="ENVMAP_TYPE_EQUIREC";break;case o.SphericalReflectionMapping:m="ENVMAP_TYPE_SPHERE"}switch(h.envMap.mapping){case o.CubeRefractionMapping:case o.EquirectangularRefractionMapping:v="ENVMAP_MODE_REFRACTION"}switch(h.combine){case o.MultiplyOperation:g="ENVMAP_BLENDING_MULTIPLY";break;case o.MixOperation:g="ENVMAP_BLENDING_MIX";break;case o.AddOperation:g="ENVMAP_BLENDING_ADD"}}var y,x,b=a.gammaFactor>0?a.gammaFactor:1,w=e(l),M=u.createProgram();h instanceof o.RawShaderMaterial?(y="",x=""):(y=["precision "+c.precision+" float;","precision "+c.precision+" int;","#define SHADER_NAME "+h.__webglShader.name,w,c.supportsVertexTextures?"#define VERTEX_TEXTURES":"",a.gammaInput?"#define GAMMA_INPUT":"",a.gammaOutput?"#define GAMMA_OUTPUT":"","#define GAMMA_FACTOR "+b,"#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SPOT_LIGHTS "+c.maxSpotLights,"#define MAX_HEMI_LIGHTS "+c.maxHemiLights,"#define MAX_SHADOWS "+c.maxShadows,"#define MAX_BONES "+c.maxBones,c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":"",c.envMap?"#define "+v:"",c.lightMap?"#define USE_LIGHTMAP":"",c.aoMap?"#define USE_AOMAP":"",c.emissiveMap?"#define USE_EMISSIVEMAP":"",c.bumpMap?"#define USE_BUMPMAP":"",c.normalMap?"#define USE_NORMALMAP":"",c.displacementMap&&c.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",c.specularMap?"#define USE_SPECULARMAP":"",c.alphaMap?"#define USE_ALPHAMAP":"",c.vertexColors?"#define USE_COLOR":"",c.flatShading?"#define FLAT_SHADED":"",c.skinning?"#define USE_SKINNING":"",c.useVertexTexture?"#define BONE_TEXTURE":"",c.morphTargets?"#define USE_MORPHTARGETS":"",c.morphNormals&&c.flatShading===!1?"#define USE_MORPHNORMALS":"",c.doubleSided?"#define DOUBLE_SIDED":"",c.flipSided?"#define FLIP_SIDED":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapEnabled?"#define "+f:"",c.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",c.sizeAttenuation?"#define USE_SIZEATTENUATION":"",c.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",c.logarithmicDepthBuffer&&a.extensions.get("EXT_frag_depth")?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_COLOR"," attribute vec3 color;","#endif","#ifdef USE_MORPHTARGETS"," attribute vec3 morphTarget0;"," attribute vec3 morphTarget1;"," attribute vec3 morphTarget2;"," attribute vec3 morphTarget3;"," #ifdef USE_MORPHNORMALS"," attribute vec3 morphNormal0;"," attribute vec3 morphNormal1;"," attribute vec3 morphNormal2;"," attribute vec3 morphNormal3;"," #else"," attribute vec3 morphTarget4;"," attribute vec3 morphTarget5;"," attribute vec3 morphTarget6;"," attribute vec3 morphTarget7;"," #endif","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif","\n"].filter(i).join("\n"),x=[c.bumpMap||c.normalMap||c.flatShading||h.derivatives?"#extension GL_OES_standard_derivatives : enable":"",c.logarithmicDepthBuffer&&a.extensions.get("EXT_frag_depth")?"#extension GL_EXT_frag_depth : enable":"","precision "+c.precision+" float;","precision "+c.precision+" int;","#define SHADER_NAME "+h.__webglShader.name,w,"#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SPOT_LIGHTS "+c.maxSpotLights,"#define MAX_HEMI_LIGHTS "+c.maxHemiLights,"#define MAX_SHADOWS "+c.maxShadows,c.alphaTest?"#define ALPHATEST "+c.alphaTest:"",a.gammaInput?"#define GAMMA_INPUT":"",a.gammaOutput?"#define GAMMA_OUTPUT":"","#define GAMMA_FACTOR "+b,c.useFog&&c.fog?"#define USE_FOG":"",c.useFog&&c.fogExp?"#define FOG_EXP2":"",c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":"",c.envMap?"#define "+m:"",c.envMap?"#define "+v:"",c.envMap?"#define "+g:"",c.lightMap?"#define USE_LIGHTMAP":"",c.aoMap?"#define USE_AOMAP":"",c.emissiveMap?"#define USE_EMISSIVEMAP":"",c.bumpMap?"#define USE_BUMPMAP":"",c.normalMap?"#define USE_NORMALMAP":"",c.specularMap?"#define USE_SPECULARMAP":"",c.alphaMap?"#define USE_ALPHAMAP":"",c.vertexColors?"#define USE_COLOR":"",c.flatShading?"#define FLAT_SHADED":"",c.metal?"#define METAL":"",c.doubleSided?"#define DOUBLE_SIDED":"",c.flipSided?"#define FLIP_SIDED":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapEnabled?"#define "+f:"",c.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",c.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",c.logarithmicDepthBuffer&&a.extensions.get("EXT_frag_depth")?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","\n"].filter(i).join("\n"));var A=y+p,S=x+d,_=o.WebGLShader(u,u.VERTEX_SHADER,A),E=o.WebGLShader(u,u.FRAGMENT_SHADER,S);u.attachShader(M,_),u.attachShader(M,E),void 0!==h.index0AttributeName?u.bindAttribLocation(M,0,h.index0AttributeName):c.morphTargets===!0&&u.bindAttribLocation(M,0,"position"),u.linkProgram(M);var T=u.getProgramInfoLog(M),C=u.getShaderInfoLog(_),L=u.getShaderInfoLog(E),P=!0,R=!0;u.getProgramParameter(M,u.LINK_STATUS)===!1?(P=!1,console.error("THREE.WebGLProgram: shader error: ",u.getError(),"gl.VALIDATE_STATUS",u.getProgramParameter(M,u.VALIDATE_STATUS),"gl.getProgramInfoLog",T,C,L)):""!==T?console.warn("THREE.WebGLProgram: gl.getProgramInfoLog()",T):(""===C||""===L)&&(R=!1),R&&(this.diagnostics={runnable:P,material:h,programLog:T,vertexShader:{log:C,prefix:y},fragmentShader:{log:L,prefix:x}}),u.deleteShader(_),u.deleteShader(E);var D;this.getUniforms=function(){return void 0===D&&(D=t(u,M)),D};var F;return this.getAttributes=function(){return void 0===F&&(F=r(u,M)),F},Object.defineProperties(this,{uniforms:{get:function(){return console.warn("THREE.WebGLProgram: .uniforms is now .getUniforms()."),this.getUniforms()}},attributes:{get:function(){return console.warn("THREE.WebGLProgram: .attributes is now .getAttributes()."),this.getAttributes()}}}),this.id=n++,this.code=s,this.usedTimes=1,this.program=M,this.vertexShader=_,this.fragmentShader=E,this}}(),o.WebGLPrograms=function(e,t){function r(e){if(t.floatVertexTextures&&e&&e.skeleton&&e.skeleton.useVertexTexture)return 1024;var r=t.maxVertexUniforms,i=Math.floor((r-20)/4),n=i;return void 0!==e&&e instanceof o.SkinnedMesh&&(n=Math.min(e.skeleton.bones.length,n),na;a++){var h=e[a];h.onlyShadow||h.visible===!1||(h instanceof o.DirectionalLight&&t++,h instanceof o.PointLight&&r++,h instanceof o.SpotLight&&i++,h instanceof o.HemisphereLight&&n++)}return{directional:t,point:r,spot:i,hemi:n}}function n(e){for(var t=0,r=0,i=e.length;i>r;r++){var n=e[r];n.castShadow&&(n instanceof o.SpotLight&&t++,n instanceof o.DirectionalLight&&t++)}return t}var a=[],s={MeshDepthMaterial:"depth",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points"},h=["precision","supportsVertexTextures","map","envMap","envMapMode","lightMap","aoMap","emissiveMap","bumpMap","normalMap","specularMap","alphaMap","combine","vertexColors","fog","useFog","fogExp","flatShading","sizeAttenuation","logarithmicDepthBuffer","skinning","maxBones","useVertexTexture","morphTargets","morphNormals","maxMorphTargets","maxMorphNormals","maxDirLights","maxPointLights","maxSpotLights","maxHemiLights","maxShadows","shadowMapEnabled","shadowMapType","shadowMapDebug","alphaTest","metal","doubleSided","flipSided"];this.getParameters=function(a,h,c,u){var l=s[a.type],p=i(h),d=n(h),f=r(u),m=e.getPrecision();null!==a.precision&&(m=t.getMaxPrecision(a.precision),m!==a.precision&&console.warn("THREE.WebGLRenderer.initMaterial:",a.precision,"not supported, using",m,"instead."));var v={shaderID:l,precision:m,supportsVertexTextures:t.vertexTextures,map:!!a.map,envMap:!!a.envMap,envMapMode:a.envMap&&a.envMap.mapping,lightMap:!!a.lightMap,aoMap:!!a.aoMap,emissiveMap:!!a.emissiveMap,bumpMap:!!a.bumpMap,normalMap:!!a.normalMap,displacementMap:!!a.displacementMap,specularMap:!!a.specularMap,alphaMap:!!a.alphaMap,combine:a.combine,vertexColors:a.vertexColors,fog:c,useFog:a.fog,fogExp:c instanceof o.FogExp2,flatShading:a.shading===o.FlatShading,sizeAttenuation:a.sizeAttenuation,logarithmicDepthBuffer:e.logarithmicDepthBuffer,skinning:a.skinning,maxBones:f,useVertexTexture:t.floatVertexTextures&&u&&u.skeleton&&u.skeleton.useVertexTexture,morphTargets:a.morphTargets,morphNormals:a.morphNormals,maxMorphTargets:e.maxMorphTargets,maxMorphNormals:e.maxMorphNormals,maxDirLights:p.directional,maxPointLights:p.point,maxSpotLights:p.spot,maxHemiLights:p.hemi,maxShadows:d,shadowMapEnabled:e.shadowMap.enabled&&u.receiveShadow&&d>0,shadowMapType:e.shadowMap.type,shadowMapDebug:e.shadowMap.debug,alphaTest:a.alphaTest,metal:a.metal,doubleSided:a.side===o.DoubleSide,flipSided:a.side===o.BackSide};return v},this.getProgramCode=function(e,t){var r=[];if(t.shaderID?r.push(t.shaderID):(r.push(e.fragmentShader),r.push(e.vertexShader)),void 0!==e.defines)for(var i in e.defines)r.push(i),r.push(e.defines[i]);for(var n=0;ns;s++){var c=a[s];if(c.code===i){n=c;break}}return void 0===n&&(n=new o.WebGLProgram(e,i,t,r),a.push(n)),n}},o.WebGLProperties=function(){var e={};this.get=function(t){var r=t.uuid,i=e[r];return void 0===i&&(i={},e[r]=i),i},this["delete"]=function(t){delete e[t.uuid]},this.clear=function(){e={}}},o.WebGLShader=function(){var e=function(e){for(var t=e.split("\n"),r=0;r0&&t.morphTargets,a=e instanceof o.SkinnedMesh&&t.skinning;return r=e.customDepthMaterial?e.customDepthMaterial:a?n?g:v:n?m:f,r.visible=t.visible,r.wireframe=t.wireframe,r.wireframeLinewidth=t.wireframeLinewidth,r}function n(e,t){if(e.visible!==!1){if((e instanceof o.Mesh||e instanceof o.Line||e instanceof o.Points)&&e.castShadow&&(e.frustumCulled===!1||h.intersectsObject(e)===!0)){var r=e.material;r.visible===!0&&(e.modelViewMatrix.multiplyMatrices(t.matrixWorldInverse,e.matrixWorld),l.push(e))}for(var i=e.children,a=0,s=i.length;s>a;a++)n(i[a],t)}}var a=e.context,s=e.state,h=new o.Frustum,c=new o.Matrix4,u=(new o.Vector3,new o.Vector3,new o.Vector3),l=[],p=o.ShaderLib.depthRGBA,d=o.UniformsUtils.clone(p.uniforms),f=new o.ShaderMaterial({uniforms:d,vertexShader:p.vertexShader,fragmentShader:p.fragmentShader}),m=new o.ShaderMaterial({uniforms:d,vertexShader:p.vertexShader,fragmentShader:p.fragmentShader,morphTargets:!0}),v=new o.ShaderMaterial({uniforms:d,vertexShader:p.vertexShader,fragmentShader:p.fragmentShader,skinning:!0}),g=new o.ShaderMaterial({uniforms:d,vertexShader:p.vertexShader,fragmentShader:p.fragmentShader,morphTargets:!0,skinning:!0});f._shadowPass=!0,m._shadowPass=!0,v._shadowPass=!0,g._shadowPass=!0;var y=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=o.PCFShadowMap,this.cullFace=o.CullFaceFront,this.render=function(p,d){if(y.enabled!==!1&&(y.autoUpdate!==!1||y.needsUpdate!==!1)){a.clearColor(1,1,1,1),s.disable(a.BLEND),s.enable(a.CULL_FACE), +a.frontFace(a.CCW),y.cullFace===o.CullFaceFront?a.cullFace(a.FRONT):a.cullFace(a.BACK),s.setDepthTest(!0);for(var f=0,m=t.length;m>f;f++){var v=t[f];if(v.castShadow){if(!v.shadowMap){var g=o.LinearFilter;y.type===o.PCFSoftShadowMap&&(g=o.NearestFilter);var x={minFilter:g,magFilter:g,format:o.RGBAFormat};v.shadowMap=new o.WebGLRenderTarget(v.shadowMapWidth,v.shadowMapHeight,x),v.shadowMapSize=new o.Vector2(v.shadowMapWidth,v.shadowMapHeight),v.shadowMatrix=new o.Matrix4}if(!v.shadowCamera){if(v instanceof o.SpotLight)v.shadowCamera=new o.PerspectiveCamera(v.shadowCameraFov,v.shadowMapWidth/v.shadowMapHeight,v.shadowCameraNear,v.shadowCameraFar);else{if(!(v instanceof o.DirectionalLight)){console.error("THREE.ShadowMapPlugin: Unsupported light type for shadow",v);continue}v.shadowCamera=new o.OrthographicCamera(v.shadowCameraLeft,v.shadowCameraRight,v.shadowCameraTop,v.shadowCameraBottom,v.shadowCameraNear,v.shadowCameraFar)}p.add(v.shadowCamera),p.autoUpdate===!0&&p.updateMatrixWorld()}v.shadowCameraVisible&&!v.cameraHelper&&(v.cameraHelper=new o.CameraHelper(v.shadowCamera),p.add(v.cameraHelper));var b=v.shadowMap,w=v.shadowMatrix,M=v.shadowCamera;M.position.setFromMatrixPosition(v.matrixWorld),u.setFromMatrixPosition(v.target.matrixWorld),M.lookAt(u),M.updateMatrixWorld(),M.matrixWorldInverse.getInverse(M.matrixWorld),v.cameraHelper&&(v.cameraHelper.visible=v.shadowCameraVisible),v.shadowCameraVisible&&v.cameraHelper.update(),w.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),w.multiply(M.projectionMatrix),w.multiply(M.matrixWorldInverse),c.multiplyMatrices(M.projectionMatrix,M.matrixWorldInverse),h.setFromMatrix(c),e.setRenderTarget(b),e.clear(),l.length=0,n(p,M);for(var A=0,S=l.length;S>A;A++){var _=l[A],E=r.update(_),T=_.material;if(T instanceof o.MeshFaceMaterial)for(var C=E.groups,L=T.materials,P=0,R=C.length;R>P;P++){var D=C[P],F=L[D.materialIndex];F.visible===!0&&e.renderBufferDirect(M,t,null,E,i(_,F),_,D)}else e.renderBufferDirect(M,t,null,E,i(_,T),_)}}}var O=e.getClearColor(),U=e.getClearAlpha();e.setClearColor(O,U),s.enable(a.BLEND),y.cullFace===o.CullFaceFront&&a.cullFace(a.BACK),e.resetGLState(),y.needsUpdate=!1}}},o.WebGLState=function(e,t,r){var i=this,n=new Uint8Array(16),a=new Uint8Array(16),s={},h=null,c=null,u=null,l=null,p=null,d=null,f=null,m=null,v=null,g=null,y=null,x=null,b=null,w=null,M=null,A=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS),S=void 0,_={};this.init=function(){e.clearColor(0,0,0,1),e.clearDepth(1),e.clearStencil(0),this.enable(e.DEPTH_TEST),e.depthFunc(e.LEQUAL),e.frontFace(e.CCW),e.cullFace(e.BACK),this.enable(e.CULL_FACE),this.enable(e.BLEND),e.blendEquation(e.FUNC_ADD),e.blendFunc(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA)},this.initAttributes=function(){for(var e=0,t=n.length;t>e;e++)n[e]=0},this.enableAttribute=function(t){n[t]=1,0===a[t]&&(e.enableVertexAttribArray(t),a[t]=1)},this.disableUnusedAttributes=function(){for(var t=0,r=a.length;r>t;t++)a[t]!==n[t]&&(e.disableVertexAttribArray(t),a[t]=0)},this.enable=function(t){s[t]!==!0&&(e.enable(t),s[t]=!0)},this.disable=function(t){s[t]!==!1&&(e.disable(t),s[t]=!1)},this.getCompressedTextureFormats=function(){if(null===h&&(h=[],t.get("WEBGL_compressed_texture_pvrtc")||t.get("WEBGL_compressed_texture_s3tc")))for(var r=e.getParameter(e.COMPRESSED_TEXTURE_FORMATS),i=0;i0;var o;o=c?{vertexShader:["uniform lowp int renderType;","uniform vec3 screenPosition;","uniform vec2 scale;","uniform float rotation;","uniform sampler2D occlusionMap;","attribute vec2 position;","attribute vec2 uv;","varying vec2 vUV;","varying float vVisibility;","void main() {","vUV = uv;","vec2 pos = position;","if( renderType == 2 ) {","vec4 visibility = texture2D( occlusionMap, vec2( 0.1, 0.1 ) );","visibility += texture2D( occlusionMap, vec2( 0.5, 0.1 ) );","visibility += texture2D( occlusionMap, vec2( 0.9, 0.1 ) );","visibility += texture2D( occlusionMap, vec2( 0.9, 0.5 ) );","visibility += texture2D( occlusionMap, vec2( 0.9, 0.9 ) );","visibility += texture2D( occlusionMap, vec2( 0.5, 0.9 ) );","visibility += texture2D( occlusionMap, vec2( 0.1, 0.9 ) );","visibility += texture2D( occlusionMap, vec2( 0.1, 0.5 ) );","visibility += texture2D( occlusionMap, vec2( 0.5, 0.5 ) );","vVisibility = visibility.r / 9.0;","vVisibility *= 1.0 - visibility.g / 9.0;","vVisibility *= visibility.b / 9.0;","vVisibility *= 1.0 - visibility.a / 9.0;","pos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;","pos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;","}","gl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );","}"].join("\n"),fragmentShader:["uniform lowp int renderType;","uniform sampler2D map;","uniform float opacity;","uniform vec3 color;","varying vec2 vUV;","varying float vVisibility;","void main() {","if( renderType == 0 ) {","gl_FragColor = vec4( 1.0, 0.0, 1.0, 0.0 );","} else if( renderType == 1 ) {","gl_FragColor = texture2D( map, vUV );","} else {","vec4 texture = texture2D( map, vUV );","texture.a *= opacity * vVisibility;","gl_FragColor = texture;","gl_FragColor.rgb *= color;","}","}"].join("\n")}:{vertexShader:["uniform lowp int renderType;","uniform vec3 screenPosition;","uniform vec2 scale;","uniform float rotation;","attribute vec2 position;","attribute vec2 uv;","varying vec2 vUV;","void main() {","vUV = uv;","vec2 pos = position;","if( renderType == 2 ) {","pos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;","pos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;","}","gl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );","}"].join("\n"),fragmentShader:["precision mediump float;","uniform lowp int renderType;","uniform sampler2D map;","uniform sampler2D occlusionMap;","uniform float opacity;","uniform vec3 color;","varying vec2 vUV;","void main() {","if( renderType == 0 ) {","gl_FragColor = vec4( texture2D( map, vUV ).rgb, 0.0 );","} else if( renderType == 1 ) {","gl_FragColor = texture2D( map, vUV );","} else {","float visibility = texture2D( occlusionMap, vec2( 0.5, 0.1 ) ).a;","visibility += texture2D( occlusionMap, vec2( 0.9, 0.5 ) ).a;","visibility += texture2D( occlusionMap, vec2( 0.5, 0.9 ) ).a;","visibility += texture2D( occlusionMap, vec2( 0.1, 0.5 ) ).a;","visibility = ( 1.0 - visibility / 4.0 );","vec4 texture = texture2D( map, vUV );","texture.a *= opacity * visibility;","gl_FragColor = texture;","gl_FragColor.rgb *= color;","}","}"].join("\n")},a=r(o),s={vertex:p.getAttribLocation(a,"position"),uv:p.getAttribLocation(a,"uv")},h={renderType:p.getUniformLocation(a,"renderType"),map:p.getUniformLocation(a,"map"),occlusionMap:p.getUniformLocation(a,"occlusionMap"),opacity:p.getUniformLocation(a,"opacity"),color:p.getUniformLocation(a,"color"),scale:p.getUniformLocation(a,"scale"),rotation:p.getUniformLocation(a,"rotation"),screenPosition:p.getUniformLocation(a,"screenPosition")}};this.render=function(r,m,v,g){if(0!==t.length){var y=new o.Vector3,x=g/v,b=.5*v,w=.5*g,M=16/g,A=new o.Vector2(M*x,M),S=new o.Vector3(1,1,0),_=new o.Vector2(1,1);void 0===a&&f(),p.useProgram(a),d.initAttributes(),d.enableAttribute(s.vertex),d.enableAttribute(s.uv),d.disableUnusedAttributes(),p.uniform1i(h.occlusionMap,0),p.uniform1i(h.map,1),p.bindBuffer(p.ARRAY_BUFFER,i),p.vertexAttribPointer(s.vertex,2,p.FLOAT,!1,16,0),p.vertexAttribPointer(s.uv,2,p.FLOAT,!1,16,8),p.bindBuffer(p.ELEMENT_ARRAY_BUFFER,n),d.disable(p.CULL_FACE),p.depthMask(!1);for(var E=0,T=t.length;T>E;E++){M=16/g,A.set(M*x,M);var C=t[E];if(y.set(C.matrixWorld.elements[12],C.matrixWorld.elements[13],C.matrixWorld.elements[14]),y.applyMatrix4(m.matrixWorldInverse),y.applyProjection(m.projectionMatrix),S.copy(y),_.x=S.x*b+b,_.y=S.y*w+w,c||_.x>0&&_.x0&&_.yL;L++){var R=C.lensFlares[L];R.opacity>.001&&R.scale>.001&&(S.x=R.x,S.y=R.y,S.z=R.z,M=R.size*R.scale/g,A.x=M*x,A.y=M,p.uniform3f(h.screenPosition,S.x,S.y,S.z),p.uniform2f(h.scale,A.x,A.y),p.uniform1f(h.rotation,R.rotation),p.uniform1f(h.opacity,R.opacity),p.uniform3f(h.color,R.color.r,R.color.g,R.color.b),d.setBlending(R.blending,R.blendEquation,R.blendSrc,R.blendDst),e.setTexture(R.texture,1),p.drawElements(p.TRIANGLES,6,p.UNSIGNED_SHORT,0))}}}d.enable(p.CULL_FACE),d.enable(p.DEPTH_TEST),p.depthMask(!0),e.resetGLState()}}},o.SpritePlugin=function(e,t){function r(){var t=l.createProgram(),r=l.createShader(l.VERTEX_SHADER),i=l.createShader(l.FRAGMENT_SHADER);return l.shaderSource(r,["precision "+e.getPrecision()+" float;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform float rotation;","uniform vec2 scale;","uniform vec2 uvOffset;","uniform vec2 uvScale;","attribute vec2 position;","attribute vec2 uv;","varying vec2 vUV;","void main() {","vUV = uvOffset + uv * uvScale;","vec2 alignedPosition = position * scale;","vec2 rotatedPosition;","rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;","rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;","vec4 finalPosition;","finalPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );","finalPosition.xy += rotatedPosition;","finalPosition = projectionMatrix * finalPosition;","gl_Position = finalPosition;","}"].join("\n")),l.shaderSource(i,["precision "+e.getPrecision()+" float;","uniform vec3 color;","uniform sampler2D map;","uniform float opacity;","uniform int fogType;","uniform vec3 fogColor;","uniform float fogDensity;","uniform float fogNear;","uniform float fogFar;","uniform float alphaTest;","varying vec2 vUV;","void main() {","vec4 texture = texture2D( map, vUV );","if ( texture.a < alphaTest ) discard;","gl_FragColor = vec4( color * texture.xyz, texture.a * opacity );","if ( fogType > 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")),l.compileShader(r),l.compileShader(i),l.attachShader(t,r),l.attachShader(t,i),l.linkProgram(t),t}function i(e,t){return e.z!==t.z?t.z-e.z:t.id-e.id}var n,a,s,h,c,u,l=e.context,p=e.state,d=new o.Vector3,f=new o.Quaternion,m=new o.Vector3,v=function(){var e=new Float32Array([-.5,-.5,0,0,.5,-.5,1,0,.5,.5,1,1,-.5,.5,0,1]),t=new Uint16Array([0,1,2,0,2,3]);n=l.createBuffer(),a=l.createBuffer(),l.bindBuffer(l.ARRAY_BUFFER,n),l.bufferData(l.ARRAY_BUFFER,e,l.STATIC_DRAW),l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,a),l.bufferData(l.ELEMENT_ARRAY_BUFFER,t,l.STATIC_DRAW),s=r(),h={position:l.getAttribLocation(s,"position"),uv:l.getAttribLocation(s,"uv")},c={uvOffset:l.getUniformLocation(s,"uvOffset"),uvScale:l.getUniformLocation(s,"uvScale"),rotation:l.getUniformLocation(s,"rotation"),scale:l.getUniformLocation(s,"scale"),color:l.getUniformLocation(s,"color"),map:l.getUniformLocation(s,"map"),opacity:l.getUniformLocation(s,"opacity"),modelViewMatrix:l.getUniformLocation(s,"modelViewMatrix"),projectionMatrix:l.getUniformLocation(s,"projectionMatrix"),fogType:l.getUniformLocation(s,"fogType"),fogDensity:l.getUniformLocation(s,"fogDensity"),fogNear:l.getUniformLocation(s,"fogNear"),fogFar:l.getUniformLocation(s,"fogFar"),fogColor:l.getUniformLocation(s,"fogColor"),alphaTest:l.getUniformLocation(s,"alphaTest")};var i=document.createElement("canvas");i.width=8,i.height=8;var p=i.getContext("2d");p.fillStyle="white",p.fillRect(0,0,8,8),u=new o.Texture(i),u.needsUpdate=!0};this.render=function(r,g){if(0!==t.length){void 0===s&&v(),l.useProgram(s),p.initAttributes(),p.enableAttribute(h.position),p.enableAttribute(h.uv),p.disableUnusedAttributes(),p.disable(l.CULL_FACE),p.enable(l.BLEND),l.bindBuffer(l.ARRAY_BUFFER,n),l.vertexAttribPointer(h.position,2,l.FLOAT,!1,16,0),l.vertexAttribPointer(h.uv,2,l.FLOAT,!1,16,8),l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,a),l.uniformMatrix4fv(c.projectionMatrix,!1,g.projectionMatrix.elements),p.activeTexture(l.TEXTURE0),l.uniform1i(c.map,0);var y=0,x=0,b=r.fog;b?(l.uniform3f(c.fogColor,b.color.r,b.color.g,b.color.b),b instanceof o.Fog?(l.uniform1f(c.fogNear,b.near),l.uniform1f(c.fogFar,b.far),l.uniform1i(c.fogType,1),y=1,x=1):b instanceof o.FogExp2&&(l.uniform1f(c.fogDensity,b.density),l.uniform1i(c.fogType,2),y=2,x=2)):(l.uniform1i(c.fogType,0),y=0,x=0);for(var w=0,M=t.length;M>w;w++){var A=t[w];A.modelViewMatrix.multiplyMatrices(g.matrixWorldInverse,A.matrixWorld),A.z=-A.modelViewMatrix.elements[14]}t.sort(i);for(var S=[],w=0,M=t.length;M>w;w++){var A=t[w],_=A.material;l.uniform1f(c.alphaTest,_.alphaTest),l.uniformMatrix4fv(c.modelViewMatrix,!1,A.modelViewMatrix.elements),A.matrixWorld.decompose(d,f,m),S[0]=m.x,S[1]=m.y;var E=0;r.fog&&_.fog&&(E=x),y!==E&&(l.uniform1i(c.fogType,E),y=E),null!==_.map?(l.uniform2f(c.uvOffset,_.map.offset.x,_.map.offset.y),l.uniform2f(c.uvScale,_.map.repeat.x,_.map.repeat.y)):(l.uniform2f(c.uvOffset,0,0),l.uniform2f(c.uvScale,1,1)),l.uniform1f(c.opacity,_.opacity),l.uniform3f(c.color,_.color.r,_.color.g,_.color.b),l.uniform1f(c.rotation,_.rotation),l.uniform2fv(c.scale,S),p.setBlending(_.blending,_.blendEquation,_.blendSrc,_.blendDst),p.setDepthTest(_.depthTest),p.setDepthWrite(_.depthWrite),_.map&&_.map.image&&_.map.image.width?e.setTexture(_.map,0):e.setTexture(u,0),l.drawElements(l.TRIANGLES,6,l.UNSIGNED_SHORT,0)}p.enable(l.CULL_FACE),e.resetGLState()}}},o.GeometryUtils={merge:function(e,t,r){console.warn("THREE.GeometryUtils: .merge() has been moved to Geometry. Use geometry.merge( geometry2, matrix, materialIndexOffset ) instead.");var i;t instanceof o.Mesh&&(t.matrixAutoUpdate&&t.updateMatrix(),i=t.matrix,t=t.geometry),e.merge(t,i,r)},center:function(e){return console.warn("THREE.GeometryUtils: .center() has been moved to Geometry. Use geometry.center() instead."),e.center()}},o.ImageUtils={crossOrigin:void 0,loadTexture:function(e,t,r,i){var n=new o.ImageLoader;n.crossOrigin=this.crossOrigin;var a=new o.Texture(void 0,t);return n.load(e,function(e){a.image=e,a.needsUpdate=!0,r&&r(a)},void 0,function(e){i&&i(e)}),a.sourceFile=e,a},loadTextureCube:function(e,t,r,i){var n=[],a=new o.ImageLoader;a.crossOrigin=this.crossOrigin;for(var s=new o.CubeTexture(n,t),h=0,c=function(t){a.load(e[t],function(e){s.images[t]=e,h+=1,6===h&&(s.needsUpdate=!0,r&&r(s))},void 0,i)},u=0,l=e.length;l>u;++u)c(u);return s},loadCompressedTexture:function(){console.error("THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.")},loadCompressedTextureCube:function(){console.error("THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead.")},getNormalMap:function(e,t){var r=function(e,t){return[e[1]*t[2]-e[2]*t[1],e[2]*t[0]-e[0]*t[2],e[0]*t[1]-e[1]*t[0]]},i=function(e,t){return[e[0]-t[0],e[1]-t[1],e[2]-t[2]]},n=function(e){var t=Math.sqrt(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]);return[e[0]/t,e[1]/t,e[2]/t]};t=1|t;var o=e.width,a=e.height,s=document.createElement("canvas");s.width=o,s.height=a;var h=s.getContext("2d");h.drawImage(e,0,0);for(var c=h.getImageData(0,0,o,a).data,u=h.createImageData(o,a),l=u.data,p=0;o>p;p++)for(var d=0;a>d;d++){var f=0>d-1?0:d-1,m=d+1>a-1?a-1:d+1,v=0>p-1?0:p-1,g=p+1>o-1?o-1:p+1,y=[],x=[0,0,c[4*(d*o+p)]/255*t];y.push([-1,0,c[4*(d*o+v)]/255*t]),y.push([-1,-1,c[4*(f*o+v)]/255*t]),y.push([0,-1,c[4*(f*o+p)]/255*t]),y.push([1,-1,c[4*(f*o+g)]/255*t]),y.push([1,0,c[4*(d*o+g)]/255*t]),y.push([1,1,c[4*(m*o+g)]/255*t]),y.push([0,1,c[4*(m*o+p)]/255*t]),y.push([-1,1,c[4*(m*o+v)]/255*t]);for(var b=[],w=y.length,M=0;w>M;M++){var A=y[M],S=y[(M+1)%w];A=i(A,x),S=i(S,x),b.push(n(r(A,S)))}for(var _=[0,0,0],M=0;Mc;c++)n[3*c]=a,n[3*c+1]=s,n[3*c+2]=h;var u=new o.DataTexture(n,e,t,o.RGBFormat);return u.needsUpdate=!0,u}},o.SceneUtils={createMultiMaterialObject:function(e,t){for(var r=new o.Group,i=0,n=t.length;n>i;i++)r.add(new o.Mesh(e,t[i]));return r},detach:function(e,t,r){e.applyMatrix(t.matrixWorld),t.remove(e),r.add(e)},attach:function(e,t,r){var i=new o.Matrix4;i.getInverse(r.matrixWorld),e.applyMatrix(i),t.remove(e),r.add(e)}},o.FontUtils={faces:{},face:"helvetiker",weight:"normal",style:"normal",size:150,divisions:10,getFace:function(){try{return this.faces[this.face.toLowerCase()][this.weight][this.style]}catch(e){throw"The font "+this.face+" with "+this.weight+" weight and "+this.style+" style is missing."}},loadFace:function(e){var t=e.familyName.toLowerCase(),r=this;return r.faces[t]=r.faces[t]||{},r.faces[t][e.cssFontWeight]=r.faces[t][e.cssFontWeight]||{},r.faces[t][e.cssFontWeight][e.cssFontStyle]=e,r.faces[t][e.cssFontWeight][e.cssFontStyle]=e,e},drawText:function(e){var t,r=this.getFace(),i=this.size/r.resolution,n=0,a=String(e).split(""),s=a.length,h=[];for(t=0;s>t;t++){var c=new o.Path,u=this.extractGlyphPoints(a[t],r,i,n,c);n+=u.offset,h.push(u.path)}var l=n/2;return{paths:h,offset:l}},extractGlyphPoints:function(e,t,r,i,n){var a,s,h,c,u,l,p,d,f,m,v,g,y,x,b,w,M,A,S,_=[],E=t.glyphs[e]||t.glyphs["?"];if(E){if(E.o)for(c=E._cachedOutline||(E._cachedOutline=E.o.split(" ")),l=c.length,p=r,d=r,a=0;l>a;)switch(u=c[a++]){case"m":f=c[a++]*p+i,m=c[a++]*d,n.moveTo(f,m);break;case"l":f=c[a++]*p+i,m=c[a++]*d,n.lineTo(f,m);break;case"q":if(v=c[a++]*p+i,g=c[a++]*d,b=c[a++]*p+i,w=c[a++]*d,n.quadraticCurveTo(b,w,v,g),S=_[_.length-1])for(y=S.x,x=S.y,s=1,h=this.divisions;h>=s;s++){var T=s/h;o.Shape.Utils.b2(T,y,b,v),o.Shape.Utils.b2(T,x,w,g)}break;case"b":if(v=c[a++]*p+i,g=c[a++]*d,b=c[a++]*p+i,w=c[a++]*d,M=c[a++]*p+i,A=c[a++]*d,n.bezierCurveTo(b,w,M,A,v,g),S=_[_.length-1])for(y=S.x,x=S.y,s=1,h=this.divisions;h>=s;s++){var T=s/h;o.Shape.Utils.b3(T,y,b,M,v),o.Shape.Utils.b3(T,x,w,A,g)}}return{offset:E.ha*r,path:n}}}},o.FontUtils.generateShapes=function(e,t){t=t||{};var r=void 0!==t.size?t.size:100,i=void 0!==t.curveSegments?t.curveSegments:4,n=void 0!==t.font?t.font:"helvetiker",a=void 0!==t.weight?t.weight:"normal",s=void 0!==t.style?t.style:"normal";o.FontUtils.size=r,o.FontUtils.divisions=i,o.FontUtils.face=n,o.FontUtils.weight=a,o.FontUtils.style=s;for(var h=o.FontUtils.drawText(e),c=h.paths,u=[],l=0,p=c.length;p>l;l++)Array.prototype.push.apply(u,c[l].toShapes());return u},function(e){var t=1e-10,r=function(e,t){var r=e.length;if(3>r)return null;var o,a,s,h=[],c=[],u=[];if(i(e)>0)for(a=0;r>a;a++)c[a]=a;else for(a=0;r>a;a++)c[a]=r-1-a;var l=r,p=2*l;for(a=l-1;l>2;){if(p--<=0)return console.warn("THREE.FontUtils: Warning, unable to triangulate polygon! in Triangulate.process()"),t?u:h;if(o=a,o>=l&&(o=0),a=o+1,a>=l&&(a=0),s=a+1,s>=l&&(s=0),n(e,o,a,s,l,c)){var d,f,m,v,g;for(d=c[o],f=c[a],m=c[s],h.push([e[d],e[f],e[m]]),u.push([c[o],c[a],c[s]]),v=a,g=a+1;l>g;v++,g++)c[v]=c[g];l--,p=2*l}}return t?u:h},i=function(e){for(var t=e.length,r=0,i=t-1,n=0;t>n;i=n++)r+=e[i].x*e[n].y-e[n].x*e[i].y;return.5*r},n=function(e,r,i,n,o,a){var s,h,c,u,l,p,d,f,m;if(h=e[a[r]].x,c=e[a[r]].y,u=e[a[i]].x,l=e[a[i]].y,p=e[a[n]].x,d=e[a[n]].y,t>(u-h)*(d-c)-(l-c)*(p-h))return!1;var v,g,y,x,b,w,M,A,S,_,E,T,C,L,P;for(v=p-u,g=d-l,y=h-p,x=c-d,b=u-h,w=l-c,s=0;o>s;s++)if(f=e[a[s]].x,m=e[a[s]].y,!(f===h&&m===c||f===u&&m===l||f===p&&m===d)&&(M=f-h,A=m-c,S=f-u,_=m-l,E=f-p,T=m-d,P=v*_-g*S,C=b*A-w*M,L=y*T-x*E,P>=-t&&L>=-t&&C>=-t))return!1;return!0};return e.Triangulate=r,e.Triangulate.area=i,e}(o.FontUtils),o.typeface_js={faces:o.FontUtils.faces,loadFace:o.FontUtils.loadFace},"undefined"!=typeof self&&(self._typeface_js=o.typeface_js),o.Audio=function(e){o.Object3D.call(this),this.type="Audio",this.context=e.context,this.source=this.context.createBufferSource(),this.source.onended=this.onEnded.bind(this),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.panner=this.context.createPanner(),this.panner.connect(this.gain),this.autoplay=!1,this.startTime=0,this.playbackRate=1,this.isPlaying=!1},o.Audio.prototype=Object.create(o.Object3D.prototype),o.Audio.prototype.constructor=o.Audio,o.Audio.prototype.load=function(e){var t=this,r=new XMLHttpRequest;return r.open("GET",e,!0),r.responseType="arraybuffer",r.onload=function(e){t.context.decodeAudioData(this.response,function(e){t.source.buffer=e,t.autoplay&&t.play()})},r.send(),this},o.Audio.prototype.play=function(){if(this.isPlaying===!0)return void console.warn("THREE.Audio: Audio is already playing.");var e=this.context.createBufferSource();e.buffer=this.source.buffer,e.loop=this.source.loop,e.onended=this.source.onended,e.start(0,this.startTime),e.playbackRate.value=this.playbackRate,this.isPlaying=!0,this.source=e,this.connect()},o.Audio.prototype.pause=function(){this.source.stop(),this.startTime=this.context.currentTime},o.Audio.prototype.stop=function(){this.source.stop(),this.startTime=0},o.Audio.prototype.connect=function(){void 0!==this.filter?(this.source.connect(this.filter),this.filter.connect(this.panner)):this.source.connect(this.panner)},o.Audio.prototype.disconnect=function(){void 0!==this.filter?(this.source.disconnect(this.filter),this.filter.disconnect(this.panner)):this.source.disconnect(this.panner)},o.Audio.prototype.setFilter=function(e){this.isPlaying===!0?(this.disconnect(),this.filter=e,this.connect()):this.filter=e},o.Audio.prototype.getFilter=function(){return this.filter},o.Audio.prototype.setPlaybackRate=function(e){this.playbackRate=e,this.isPlaying===!0&&(this.source.playbackRate.value=this.playbackRate)},o.Audio.prototype.getPlaybackRate=function(){return this.playbackRate},o.Audio.prototype.onEnded=function(){this.isPlaying=!1},o.Audio.prototype.setLoop=function(e){this.source.loop=e},o.Audio.prototype.getLoop=function(){return this.source.loop},o.Audio.prototype.setRefDistance=function(e){this.panner.refDistance=e},o.Audio.prototype.getRefDistance=function(){return this.panner.refDistance},o.Audio.prototype.setRolloffFactor=function(e){this.panner.rolloffFactor=e},o.Audio.prototype.getRolloffFactor=function(){return this.panner.rolloffFactor},o.Audio.prototype.setVolume=function(e){this.gain.gain.value=e},o.Audio.prototype.getVolume=function(){return this.gain.gain.value},o.Audio.prototype.updateMatrixWorld=function(){var e=new o.Vector3;return function(t){o.Object3D.prototype.updateMatrixWorld.call(this,t),e.setFromMatrixPosition(this.matrixWorld),this.panner.setPosition(e.x,e.y,e.z)}}(),o.AudioListener=function(){o.Object3D.call(this),this.type="AudioListener",this.context=new(window.AudioContext||window.webkitAudioContext)},o.AudioListener.prototype=Object.create(o.Object3D.prototype),o.AudioListener.prototype.constructor=o.AudioListener,o.AudioListener.prototype.updateMatrixWorld=function(){var e=new o.Vector3,t=new o.Quaternion,r=new o.Vector3,i=new o.Vector3;return function(n){o.Object3D.prototype.updateMatrixWorld.call(this,n);var a=this.context.listener,s=this.up;this.matrixWorld.decompose(e,t,r),i.set(0,0,-1).applyQuaternion(t),a.setPosition(e.x,e.y,e.z),a.setOrientation(i.x,i.y,i.z,s.x,s.y,s.z)}}(),o.Curve=function(){},o.Curve.prototype.getPoint=function(e){return console.warn("THREE.Curve: Warning, getPoint() not implemented!"),null},o.Curve.prototype.getPointAt=function(e){var t=this.getUtoTmapping(e);return this.getPoint(t)},o.Curve.prototype.getPoints=function(e){e||(e=5);var t,r=[];for(t=0;e>=t;t++)r.push(this.getPoint(t/e));return r},o.Curve.prototype.getSpacedPoints=function(e){e||(e=5);var t,r=[];for(t=0;e>=t;t++)r.push(this.getPointAt(t/e));return r},o.Curve.prototype.getLength=function(){var e=this.getLengths();return e[e.length-1]},o.Curve.prototype.getLengths=function(e){if(e||(e=this.__arcLengthDivisions?this.__arcLengthDivisions:200),this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;var t,r,i=[],n=this.getPoint(0),o=0;for(i.push(0),r=1;e>=r;r++)t=this.getPoint(r/e),o+=t.distanceTo(n),i.push(o),n=t;return this.cacheArcLengths=i,i},o.Curve.prototype.updateArcLengths=function(){this.needsUpdate=!0,this.getLengths()},o.Curve.prototype.getUtoTmapping=function(e,t){var r,i=this.getLengths(),n=0,o=i.length;r=t?t:e*i[o-1];for(var a,s=0,h=o-1;h>=s;)if(n=Math.floor(s+(h-s)/2),a=i[n]-r,0>a)s=n+1;else{if(!(a>0)){h=n;break}h=n-1}if(n=h,i[n]===r){var c=n/(o-1);return c}var u=i[n],l=i[n+1],p=l-u,d=(r-u)/p,c=(n+d)/(o-1);return c},o.Curve.prototype.getTangent=function(e){var t=1e-4,r=e-t,i=e+t;0>r&&(r=0),i>1&&(i=1);var n=this.getPoint(r),o=this.getPoint(i),a=o.clone().sub(n);return a.normalize()},o.Curve.prototype.getTangentAt=function(e){var t=this.getUtoTmapping(e);return this.getTangent(t)},o.Curve.Utils={tangentQuadraticBezier:function(e,t,r,i){return 2*(1-e)*(r-t)+2*e*(i-r)},tangentCubicBezier:function(e,t,r,i,n){return-3*t*(1-e)*(1-e)+3*r*(1-e)*(1-e)-6*e*r*(1-e)+6*e*i*(1-e)-3*e*e*i+3*e*e*n},tangentSpline:function(e,t,r,i,n){var o=6*e*e-6*e,a=3*e*e-4*e+1,s=-6*e*e+6*e,h=3*e*e-2*e;return o+a+s+h},interpolate:function(e,t,r,i,n){var o=.5*(r-e),a=.5*(i-t),s=n*n,h=n*s;return(2*t-2*r+o+a)*h+(-3*t+3*r-2*o-a)*s+o*n+t}},o.Curve.create=function(e,t){return e.prototype=Object.create(o.Curve.prototype),e.prototype.constructor=e,e.prototype.getPoint=t,e},o.CurvePath=function(){this.curves=[],this.bends=[],this.autoClose=!1},o.CurvePath.prototype=Object.create(o.Curve.prototype),o.CurvePath.prototype.constructor=o.CurvePath,o.CurvePath.prototype.add=function(e){this.curves.push(e)},o.CurvePath.prototype.checkConnection=function(){},o.CurvePath.prototype.closePath=function(){var e=this.curves[0].getPoint(0),t=this.curves[this.curves.length-1].getPoint(1);e.equals(t)||this.curves.push(new o.LineCurve(t,e))},o.CurvePath.prototype.getPoint=function(e){for(var t,r,i=e*this.getLength(),n=this.getCurveLengths(),o=0;o=i){t=n[o]-i,r=this.curves[o];var a=1-t/r.getLength();return r.getPointAt(a)}o++}return null},o.CurvePath.prototype.getLength=function(){var e=this.getCurveLengths();return e[e.length-1]},o.CurvePath.prototype.getCurveLengths=function(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;var e,t=[],r=0,i=this.curves.length;for(e=0;i>e;e++)r+=this.curves[e].getLength(),t.push(r);return this.cacheLengths=t,t},o.CurvePath.prototype.getBoundingBox=function(){var e,t,r,i,n,a,s=this.getPoints();e=t=Number.NEGATIVE_INFINITY,i=n=Number.POSITIVE_INFINITY;var h,c,u,l,p=s[0]instanceof o.Vector3;for(l=p?new o.Vector3:new o.Vector2,c=0,u=s.length;u>c;c++)h=s[c],h.x>e?e=h.x:h.xt?t=h.y:h.yr?r=h.z:h.zr;r++)n=this.getWrapPoints(n,t[r]);return n},o.CurvePath.prototype.getTransformedSpacedPoints=function(e,t){var r,i,n=this.getSpacedPoints(e);for(t||(t=this.bends),r=0,i=t.length;i>r;r++)n=this.getWrapPoints(n,t[r]);return n},o.CurvePath.prototype.getWrapPoints=function(e,t){var r,i,n,o,a,s,h=this.getBoundingBox();for(r=0,i=e.length;i>r;r++){n=e[r],o=n.x,a=n.y,s=o/h.maxX,s=t.getUtoTmapping(s,o);var c=t.getPoint(s),u=t.getTangent(s);u.set(-u.y,u.x).multiplyScalar(a),n.x=c.x+u.x,n.y=c.y+u.y}return e},o.Path=function(e){o.CurvePath.call(this),this.actions=[],e&&this.fromPoints(e)},o.Path.prototype=Object.create(o.CurvePath.prototype),o.Path.prototype.constructor=o.Path,o.PathActions={MOVE_TO:"moveTo",LINE_TO:"lineTo",QUADRATIC_CURVE_TO:"quadraticCurveTo",BEZIER_CURVE_TO:"bezierCurveTo",CSPLINE_THRU:"splineThru",ARC:"arc",ELLIPSE:"ellipse"},o.Path.prototype.fromPoints=function(e){this.moveTo(e[0].x,e[0].y);for(var t=1,r=e.length;r>t;t++)this.lineTo(e[t].x,e[t].y)},o.Path.prototype.moveTo=function(e,t){var r=Array.prototype.slice.call(arguments);this.actions.push({action:o.PathActions.MOVE_TO,args:r})},o.Path.prototype.lineTo=function(e,t){var r=Array.prototype.slice.call(arguments),i=this.actions[this.actions.length-1].args,n=i[i.length-2],a=i[i.length-1],s=new o.LineCurve(new o.Vector2(n,a),new o.Vector2(e,t));this.curves.push(s),this.actions.push({action:o.PathActions.LINE_TO,args:r})},o.Path.prototype.quadraticCurveTo=function(e,t,r,i){var n=Array.prototype.slice.call(arguments),a=this.actions[this.actions.length-1].args,s=a[a.length-2],h=a[a.length-1],c=new o.QuadraticBezierCurve(new o.Vector2(s,h),new o.Vector2(e,t),new o.Vector2(r,i));this.curves.push(c),this.actions.push({action:o.PathActions.QUADRATIC_CURVE_TO,args:n})},o.Path.prototype.bezierCurveTo=function(e,t,r,i,n,a){var s=Array.prototype.slice.call(arguments),h=this.actions[this.actions.length-1].args,c=h[h.length-2],u=h[h.length-1],l=new o.CubicBezierCurve(new o.Vector2(c,u),new o.Vector2(e,t),new o.Vector2(r,i),new o.Vector2(n,a));this.curves.push(l),this.actions.push({action:o.PathActions.BEZIER_CURVE_TO,args:s})},o.Path.prototype.splineThru=function(e){var t=Array.prototype.slice.call(arguments),r=this.actions[this.actions.length-1].args,i=r[r.length-2],n=r[r.length-1],a=[new o.Vector2(i,n)];Array.prototype.push.apply(a,e);var s=new o.SplineCurve(a);this.curves.push(s),this.actions.push({action:o.PathActions.CSPLINE_THRU,args:t})},o.Path.prototype.arc=function(e,t,r,i,n,o){var a=this.actions[this.actions.length-1].args,s=a[a.length-2],h=a[a.length-1];this.absarc(e+s,t+h,r,i,n,o)},o.Path.prototype.absarc=function(e,t,r,i,n,o){this.absellipse(e,t,r,r,i,n,o)},o.Path.prototype.ellipse=function(e,t,r,i,n,o,a,s){var h=this.actions[this.actions.length-1].args,c=h[h.length-2],u=h[h.length-1];this.absellipse(e+c,t+u,r,i,n,o,a,s)},o.Path.prototype.absellipse=function(e,t,r,i,n,a,s,h){var c=[e,t,r,i,n,a,s,h||0],u=new o.EllipseCurve(e,t,r,i,n,a,s,h);this.curves.push(u);var l=u.getPoint(1);c.push(l.x),c.push(l.y),this.actions.push({action:o.PathActions.ELLIPSE,args:c})},o.Path.prototype.getSpacedPoints=function(e,t){e||(e=40);for(var r=[],i=0;e>i;i++)r.push(this.getPoint(i/e));return r},o.Path.prototype.getPoints=function(e,t){if(this.useSpacedPoints)return this.getSpacedPoints(e,t);e=e||12;var r,i,n,a,s,h,c,u,l,p,d,f,m,v,g,y,x,b,w=[];for(r=0,i=this.actions.length;i>r;r++)switch(n=this.actions[r],a=n.action,s=n.args,a){case o.PathActions.MOVE_TO:w.push(new o.Vector2(s[0],s[1]));break;case o.PathActions.LINE_TO:w.push(new o.Vector2(s[0],s[1]));break;case o.PathActions.QUADRATIC_CURVE_TO:for(h=s[2],c=s[3],p=s[0],d=s[1],w.length>0?(v=w[w.length-1],f=v.x,m=v.y):(v=this.actions[r-1].args,f=v[v.length-2],m=v[v.length-1]),g=1;e>=g;g++)y=g/e,x=o.Shape.Utils.b2(y,f,p,h),b=o.Shape.Utils.b2(y,m,d,c),w.push(new o.Vector2(x,b));break;case o.PathActions.BEZIER_CURVE_TO:for(h=s[4],c=s[5],p=s[0],d=s[1],u=s[2],l=s[3],w.length>0?(v=w[w.length-1],f=v.x,m=v.y):(v=this.actions[r-1].args,f=v[v.length-2],m=v[v.length-1]),g=1;e>=g;g++)y=g/e,x=o.Shape.Utils.b3(y,f,p,u,h),b=o.Shape.Utils.b3(y,m,d,l,c),w.push(new o.Vector2(x,b));break;case o.PathActions.CSPLINE_THRU:v=this.actions[r-1].args;var M=new o.Vector2(v[v.length-2],v[v.length-1]),A=[M],S=e*s[0].length;A=A.concat(s[0]);var _=new o.SplineCurve(A);for(g=1;S>=g;g++)w.push(_.getPointAt(g/S));break;case o.PathActions.ARC:var E,T=s[0],C=s[1],L=s[2],P=s[3],R=s[4],D=!!s[5],F=R-P,O=2*e;for(g=1;O>=g;g++)y=g/O,D||(y=1-y),E=P+y*F,x=T+L*Math.cos(E),b=C+L*Math.sin(E),w.push(new o.Vector2(x,b));break;case o.PathActions.ELLIPSE:var E,U,k,T=s[0],C=s[1],B=s[2],V=s[3],P=s[4],R=s[5],D=!!s[6],G=s[7],F=R-P,O=2*e;for(0!==G&&(U=Math.cos(G),k=Math.sin(G)),g=1;O>=g;g++){if(y=g/O,D||(y=1-y),E=P+y*F,x=T+B*Math.cos(E),b=C+V*Math.sin(E),0!==G){var z=x,N=b;x=(z-T)*U-(N-C)*k+T,b=(z-T)*k+(N-C)*U+C}w.push(new o.Vector2(x,b))}}var I=w[w.length-1],j=1e-10;return Math.abs(I.x-w[0].x)t;t++)i=e[t],a=i.args,n=i.action,n===o.PathActions.MOVE_TO&&0!==h.actions.length&&(s.push(h),h=new o.Path),h[n].apply(h,a);return 0!==h.actions.length&&s.push(h),s}function i(e){for(var t=[],r=0,i=e.length;i>r;r++){var n=e[r],a=new o.Shape;a.actions=n.actions,a.curves=n.curves,t.push(a)}return t}function n(e,t){for(var r=1e-10,i=t.length,n=!1,o=i-1,a=0;i>a;o=a++){var s=t[o],h=t[a],c=h.x-s.x,u=h.y-s.y;if(Math.abs(u)>r){if(0>u&&(s=t[a],c=-c,h=t[o],u=-u),e.yh.y)continue;if(e.y===s.y){if(e.x===s.x)return!0}else{var l=u*(e.x-s.x)-c*(e.y-s.y);if(0===l)return!0;if(0>l)continue;n=!n}}else{if(e.y!==s.y)continue;if(h.x<=e.x&&e.x<=s.x||s.x<=e.x&&e.x<=h.x)return!0}}return n}var a=r(this.actions);if(0===a.length)return[];if(t===!0)return i(a);var s,h,c,u=[];if(1===a.length)return h=a[0],c=new o.Shape,c.actions=h.actions,c.curves=h.curves,u.push(c),u;var l=!o.Shape.Utils.isClockWise(a[0].getPoints());l=e?!l:l;var p,d=[],f=[],m=[],v=0;f[v]=void 0,m[v]=[];var g,y;for(g=0,y=a.length;y>g;g++)h=a[g],p=h.getPoints(),s=o.Shape.Utils.isClockWise(p),s=e?!s:s,s?(!l&&f[v]&&v++,f[v]={s:new o.Shape,p:p},f[v].s.actions=h.actions,f[v].s.curves=h.curves,l&&v++,m[v]=[]):m[v].push({h:h,p:p[0]});if(!f[0])return i(a);if(f.length>1){for(var x=!1,b=[],w=0,M=f.length;M>w;w++)d[w]=[];for(var w=0,M=f.length;M>w;w++)for(var A=m[w],S=0;S0&&(x||(m=d))}var C,L,P;for(g=0,y=f.length;y>g;g++)for(c=f[g].s,u.push(c),C=m[g],L=0,P=C.length;P>L;L++)c.holes.push(C[L].h);return u},o.Shape=function(){o.Path.apply(this,arguments),this.holes=[]},o.Shape.prototype=Object.create(o.Path.prototype),o.Shape.prototype.constructor=o.Shape,o.Shape.prototype.extrude=function(e){var t=new o.ExtrudeGeometry(this,e);return t},o.Shape.prototype.makeGeometry=function(e){var t=new o.ShapeGeometry(this,e);return t},o.Shape.prototype.getPointsHoles=function(e){var t,r=this.holes.length,i=[];for(t=0;r>t;t++)i[t]=this.holes[t].getTransformedPoints(e,this.bends);return i},o.Shape.prototype.getSpacedPointsHoles=function(e){var t,r=this.holes.length,i=[];for(t=0;r>t;t++)i[t]=this.holes[t].getTransformedSpacedPoints(e,this.bends);return i},o.Shape.prototype.extractAllPoints=function(e){return{shape:this.getTransformedPoints(e),holes:this.getPointsHoles(e)}},o.Shape.prototype.extractPoints=function(e){return this.useSpacedPoints?this.extractAllSpacedPoints(e):this.extractAllPoints(e)},o.Shape.prototype.extractAllSpacedPoints=function(e){return{shape:this.getTransformedSpacedPoints(e),holes:this.getSpacedPointsHoles(e)}},o.Shape.Utils={triangulateShape:function(e,t){function r(e,t,r){return e.x!==t.x?e.xa){var m;if(d>0){if(0>f||f>d)return[];if(m=u*l-c*p,0>m||m>d)return[]}else{if(f>0||d>f)return[];if(m=u*l-c*p,m>0||d>m)return[]}if(0===m)return!o||0!==f&&f!==d?[e]:[];if(m===d)return!o||0!==f&&f!==d?[t]:[];if(0===f)return[i];if(f===d)return[n];var v=m/d;return[{x:e.x+v*s,y:e.y+v*h}]}if(0!==f||u*l!==c*p)return[];var g=0===s&&0===h,y=0===c&&0===u;if(g&&y)return e.x!==i.x||e.y!==i.y?[]:[e];if(g)return r(i,n,e)?[e]:[];if(y)return r(e,t,i)?[i]:[];var x,b,w,M,A,S,_,E;return 0!==s?(e.x=w?_>M?[]:M===_?o?[]:[A]:E>=M?[A,b]:[A,S]:w>E?[]:w===E?o?[]:[x]:E>=M?[x,b]:[x,S]}function n(e,t,r,i){var n=1e-10,o=t.x-e.x,a=t.y-e.y,s=r.x-e.x,h=r.y-e.y,c=i.x-e.x,u=i.y-e.y,l=o*h-a*s,p=o*u-a*c;if(Math.abs(l)>n){var d=c*h-u*s;return l>0?p>=0&&d>=0:p>=0||d>=0}return p>0}function a(e,t){function r(e,t){var r=y.length-1,i=e-1;0>i&&(i=r);var o=e+1;o>r&&(o=0);var a=n(y[e],y[i],y[o],s[t]);if(!a)return!1;var h=s.length-1,c=t-1;0>c&&(c=h);var u=t+1;return u>h&&(u=0),a=n(s[t],s[c],s[u],y[e]),a?!0:!1}function o(e,t){var r,n,o;for(r=0;r0)return!0;return!1}function a(e,r){var n,o,a,s,h;for(n=0;n0)return!0;return!1}for(var s,h,c,u,l,p,d,f,m,v,g,y=e.concat(),x=[],b=[],w=0,M=t.length;M>w;w++)x.push(w);for(var A=0,S=2*x.length;x.length>0;){if(S--,0>S){console.log("Infinite Loop! Holes left:"+x.length+", Probably Hole outside Shape!");break}for(c=A;c=0)break;b[d]=!0}if(h>=0)break}}return y}for(var s,h,c,u,l,p,d={},f=e.concat(),m=0,v=t.length;v>m;m++)Array.prototype.push.apply(f,t[m]);for(s=0,h=f.length;h>s;s++)l=f[s].x+":"+f[s].y,void 0!==d[l]&&console.warn("THREE.Shape: Duplicate point",l),d[l]=s;var g=a(e,t),y=o.FontUtils.Triangulate(g,!1);for(s=0,h=y.length;h>s;s++)for(u=y[s],c=0;3>c;c++)l=u[c].x+":"+u[c].y,p=d[l],void 0!==p&&(u[c]=p);return y.concat()},isClockWise:function(e){return o.FontUtils.Triangulate.area(e)<0},b2p0:function(e,t){var r=1-e;return r*r*t},b2p1:function(e,t){return 2*(1-e)*e*t},b2p2:function(e,t){return e*e*t},b2:function(e,t,r,i){return this.b2p0(e,t)+this.b2p1(e,r)+this.b2p2(e,i)},b3p0:function(e,t){var r=1-e;return r*r*r*t},b3p1:function(e,t){var r=1-e;return 3*r*r*e*t},b3p2:function(e,t){var r=1-e;return 3*r*e*e*t},b3p3:function(e,t){return e*e*e*t},b3:function(e,t,r,i,n){return this.b3p0(e,t)+this.b3p1(e,r)+this.b3p2(e,i)+this.b3p3(e,n)}},o.LineCurve=function(e,t){this.v1=e,this.v2=t},o.LineCurve.prototype=Object.create(o.Curve.prototype),o.LineCurve.prototype.constructor=o.LineCurve,o.LineCurve.prototype.getPoint=function(e){var t=this.v2.clone().sub(this.v1);return t.multiplyScalar(e).add(this.v1),t},o.LineCurve.prototype.getPointAt=function(e){return this.getPoint(e)},o.LineCurve.prototype.getTangent=function(e){var t=this.v2.clone().sub(this.v1);return t.normalize()},o.QuadraticBezierCurve=function(e,t,r){this.v0=e,this.v1=t,this.v2=r},o.QuadraticBezierCurve.prototype=Object.create(o.Curve.prototype),o.QuadraticBezierCurve.prototype.constructor=o.QuadraticBezierCurve,o.QuadraticBezierCurve.prototype.getPoint=function(e){var t=new o.Vector2;return t.x=o.Shape.Utils.b2(e,this.v0.x,this.v1.x,this.v2.x),t.y=o.Shape.Utils.b2(e,this.v0.y,this.v1.y,this.v2.y),t},o.QuadraticBezierCurve.prototype.getTangent=function(e){var t=new o.Vector2;return t.x=o.Curve.Utils.tangentQuadraticBezier(e,this.v0.x,this.v1.x,this.v2.x),t.y=o.Curve.Utils.tangentQuadraticBezier(e,this.v0.y,this.v1.y,this.v2.y),t.normalize()},o.CubicBezierCurve=function(e,t,r,i){this.v0=e,this.v1=t,this.v2=r,this.v3=i},o.CubicBezierCurve.prototype=Object.create(o.Curve.prototype),o.CubicBezierCurve.prototype.constructor=o.CubicBezierCurve,o.CubicBezierCurve.prototype.getPoint=function(e){var t,r;return t=o.Shape.Utils.b3(e,this.v0.x,this.v1.x,this.v2.x,this.v3.x),r=o.Shape.Utils.b3(e,this.v0.y,this.v1.y,this.v2.y,this.v3.y),new o.Vector2(t,r)},o.CubicBezierCurve.prototype.getTangent=function(e){var t,r;t=o.Curve.Utils.tangentCubicBezier(e,this.v0.x,this.v1.x,this.v2.x,this.v3.x),r=o.Curve.Utils.tangentCubicBezier(e,this.v0.y,this.v1.y,this.v2.y,this.v3.y);var i=new o.Vector2(t,r);return i.normalize(),i},o.SplineCurve=function(e){this.points=void 0==e?[]:e},o.SplineCurve.prototype=Object.create(o.Curve.prototype),o.SplineCurve.prototype.constructor=o.SplineCurve,o.SplineCurve.prototype.getPoint=function(e){var t=this.points,r=(t.length-1)*e,i=Math.floor(r),n=r-i,a=t[0===i?i:i-1],s=t[i],h=t[i>t.length-2?t.length-1:i+1],c=t[i>t.length-3?t.length-1:i+2],u=new o.Vector2;return u.x=o.Curve.Utils.interpolate(a.x,s.x,h.x,c.x,n),u.y=o.Curve.Utils.interpolate(a.y,s.y,h.y,c.y,n),u},o.EllipseCurve=function(e,t,r,i,n,o,a,s){this.aX=e,this.aY=t,this.xRadius=r,this.yRadius=i,this.aStartAngle=n,this.aEndAngle=o,this.aClockwise=a,this.aRotation=s||0},o.EllipseCurve.prototype=Object.create(o.Curve.prototype),o.EllipseCurve.prototype.constructor=o.EllipseCurve,o.EllipseCurve.prototype.getPoint=function(e){var t=this.aEndAngle-this.aStartAngle;0>t&&(t+=2*Math.PI),t>2*Math.PI&&(t-=2*Math.PI);var r;r=this.aClockwise===!0?this.aEndAngle+(1-e)*(2*Math.PI-t):this.aStartAngle+e*t;var i=this.aX+this.xRadius*Math.cos(r),n=this.aY+this.yRadius*Math.sin(r);if(0!==this.aRotation){var a=Math.cos(this.aRotation),s=Math.sin(this.aRotation),h=i,c=n;i=(h-this.aX)*a-(c-this.aY)*s+this.aX,n=(h-this.aX)*s+(c-this.aY)*a+this.aY}return new o.Vector2(i,n)},o.ArcCurve=function(e,t,r,i,n,a){o.EllipseCurve.call(this,e,t,r,r,i,n,a)},o.ArcCurve.prototype=Object.create(o.EllipseCurve.prototype),o.ArcCurve.prototype.constructor=o.ArcCurve,o.LineCurve3=o.Curve.create(function(e,t){this.v1=e,this.v2=t},function(e){var t=new o.Vector3;return t.subVectors(this.v2,this.v1),t.multiplyScalar(e),t.add(this.v1),t}),o.QuadraticBezierCurve3=o.Curve.create(function(e,t,r){this.v0=e,this.v1=t,this.v2=r},function(e){var t=new o.Vector3;return t.x=o.Shape.Utils.b2(e,this.v0.x,this.v1.x,this.v2.x),t.y=o.Shape.Utils.b2(e,this.v0.y,this.v1.y,this.v2.y),t.z=o.Shape.Utils.b2(e,this.v0.z,this.v1.z,this.v2.z),t}),o.CubicBezierCurve3=o.Curve.create(function(e,t,r,i){this.v0=e,this.v1=t,this.v2=r,this.v3=i},function(e){var t=new o.Vector3;return t.x=o.Shape.Utils.b3(e,this.v0.x,this.v1.x,this.v2.x,this.v3.x),t.y=o.Shape.Utils.b3(e,this.v0.y,this.v1.y,this.v2.y,this.v3.y),t.z=o.Shape.Utils.b3(e,this.v0.z,this.v1.z,this.v2.z,this.v3.z),t}),o.SplineCurve3=o.Curve.create(function(e){console.warn("THREE.SplineCurve3 will be deprecated. Please use THREE.CatmullRomCurve3"),this.points=void 0==e?[]:e},function(e){var t=this.points,r=(t.length-1)*e,i=Math.floor(r),n=r-i,a=t[0==i?i:i-1],s=t[i],h=t[i>t.length-2?t.length-1:i+1],c=t[i>t.length-3?t.length-1:i+2],u=new o.Vector3;return u.x=o.Curve.Utils.interpolate(a.x,s.x,h.x,c.x,n),u.y=o.Curve.Utils.interpolate(a.y,s.y,h.y,c.y,n),u.z=o.Curve.Utils.interpolate(a.z,s.z,h.z,c.z,n),u}),o.CatmullRomCurve3=function(){function e(){}var t=new o.Vector3,r=new e,i=new e,n=new e;return e.prototype.init=function(e,t,r,i){this.c0=e,this.c1=r,this.c2=-3*e+3*t-2*r-i,this.c3=2*e-2*t+r+i},e.prototype.initNonuniformCatmullRom=function(e,t,r,i,n,o,a){var s=(t-e)/n-(r-e)/(n+o)+(r-t)/o,h=(r-t)/o-(i-t)/(o+a)+(i-r)/a;s*=o,h*=o,this.init(t,r,s,h)},e.prototype.initCatmullRom=function(e,t,r,i,n){this.init(t,r,n*(r-e),n*(i-t))},e.prototype.calc=function(e){var t=e*e,r=t*e;return this.c0+this.c1*e+this.c2*t+this.c3*r},o.Curve.create(function(e){this.points=e||[]},function(e){var a,s,h,c,u=this.points;c=u.length,2>c&&console.log("duh, you need at least 2 points"),a=(c-1)*e,s=Math.floor(a),h=a-s,0===h&&s===c-1&&(s=c-2,h=1);var l,p,d,f;if(0===s?(t.subVectors(u[0],u[1]).add(u[0]),l=t):l=u[s-1],p=u[s],d=u[s+1],c>s+2?f=u[s+2]:(t.subVectors(u[c-1],u[c-2]).add(u[c-2]),f=t),void 0===this.type||"centripetal"===this.type||"chordal"===this.type){var m="chordal"===this.type?.5:.25,v=Math.pow(l.distanceToSquared(p),m),g=Math.pow(p.distanceToSquared(d),m),y=Math.pow(d.distanceToSquared(f),m);1e-4>g&&(g=1),1e-4>v&&(v=g),1e-4>y&&(y=g),r.initNonuniformCatmullRom(l.x,p.x,d.x,f.x,v,g,y),i.initNonuniformCatmullRom(l.y,p.y,d.y,f.y,v,g,y),n.initNonuniformCatmullRom(l.z,p.z,d.z,f.z,v,g,y)}else if("catmullrom"===this.type){var x=void 0!==this.tension?this.tension:.5;r.initCatmullRom(l.x,p.x,d.x,f.x,x),i.initCatmullRom(l.y,p.y,d.y,f.y,x),n.initCatmullRom(l.z,p.z,d.z,f.z,x)}var b=new o.Vector3(r.calc(h),i.calc(h),n.calc(h));return b})}(),o.ClosedSplineCurve3=o.Curve.create(function(e){this.points=void 0==e?[]:e},function(e){var t=this.points,r=(t.length-0)*e,i=Math.floor(r),n=r-i;i+=i>0?0:(Math.floor(Math.abs(i)/t.length)+1)*t.length;var a=t[(i-1)%t.length],s=t[i%t.length],h=t[(i+1)%t.length],c=t[(i+2)%t.length],u=new o.Vector3;return u.x=o.Curve.Utils.interpolate(a.x,s.x,h.x,c.x,n),u.y=o.Curve.Utils.interpolate(a.y,s.y,h.y,c.y,n),u.z=o.Curve.Utils.interpolate(a.z,s.z,h.z,c.z,n),u}),o.AnimationHandler={LINEAR:0,CATMULLROM:1,CATMULLROM_FORWARD:2,add:function(){console.warn("THREE.AnimationHandler.add() has been deprecated.")},get:function(){console.warn("THREE.AnimationHandler.get() has been deprecated.")},remove:function(){console.warn("THREE.AnimationHandler.remove() has been deprecated.")},animations:[],init:function(e){if(e.initialized===!0)return e;for(var t=0;te;e++){var r=this.hierarchy[e];void 0===r.animationCache&&(r.animationCache={animations:{},blending:{positionWeight:0,quaternionWeight:0,scaleWeight:0}});var i=this.data.name,n=r.animationCache.animations,o=n[i];void 0===o&&(o={prevKey:{pos:0,rot:0,scl:0},nextKey:{pos:0,rot:0,scl:0},originalMatrix:r.matrix},n[i]=o);for(var a=0;3>a;a++){for(var s=this.keyTypes[a],h=this.data.hierarchy[e].keys[0],c=this.getNextKeyWith(s,e,1);c.timeh.index;)h=c,c=this.getNextKeyWith(s,e,c.index+1);o.prevKey[s]=h,o.nextKey[s]=c}}},resetBlendWeights:function(){for(var e=0,t=this.hierarchy.length;t>e;e++){var r=this.hierarchy[e],i=r.animationCache;if(void 0!==i){var n=i.blending;n.positionWeight=0,n.quaternionWeight=0,n.scaleWeight=0}}},update:function(){var e=[],t=new o.Vector3,r=new o.Vector3,i=new o.Quaternion,n=function(e,t){var r,i,n,o,s,h,c,u,l,p=[],d=[];return r=(e.length-1)*t,i=Math.floor(r),n=r-i,p[0]=0===i?i:i-1,p[1]=i,p[2]=i>e.length-2?i:i+1,p[3]=i>e.length-3?i:i+2,h=e[p[0]],c=e[p[1]],u=e[p[2]],l=e[p[3]],o=n*n,s=n*o,d[0]=a(h[0],c[0],u[0],l[0],n,o,s),d[1]=a(h[1],c[1],u[1],l[1],n,o,s),d[2]=a(h[2],c[2],u[2],l[2],n,o,s),d},a=function(e,t,r,i,n,o,a){var s=.5*(r-e),h=.5*(i-t);return(2*(t-r)+s+h)*a+(-3*(t-r)-2*s-h)*o+s*n+t};return function(a){if(this.isPlaying!==!1&&(this.currentTime+=a*this.timeScale,0!==this.weight)){var s=this.data.length;(this.currentTime>s||this.currentTime<0)&&(this.loop?(this.currentTime%=s,this.currentTime<0&&(this.currentTime+=s),this.reset()):this.stop());for(var h=0,c=this.hierarchy.length;c>h;h++)for(var u=this.hierarchy[h],l=u.animationCache.animations[this.data.name],p=u.animationCache.blending,d=0;3>d;d++){var f=this.keyTypes[d],m=l.prevKey[f],v=l.nextKey[f];if(this.timeScale>0&&v.time<=this.currentTime||this.timeScale<0&&m.time>=this.currentTime){for(m=this.data.hierarchy[h].keys[0],v=this.getNextKeyWith(f,h,1);v.timem.index;)m=v,v=this.getNextKeyWith(f,h,v.index+1);l.prevKey[f]=m,l.nextKey[f]=v}var g=(this.currentTime-m.time)/(v.time-m.time),y=m[f],x=v[f];if(0>g&&(g=0),g>1&&(g=1),"pos"===f){if(this.interpolationType===o.AnimationHandler.LINEAR){r.x=y[0]+(x[0]-y[0])*g,r.y=y[1]+(x[1]-y[1])*g,r.z=y[2]+(x[2]-y[2])*g;var b=this.weight/(this.weight+p.positionWeight);u.position.lerp(r,b),p.positionWeight+=this.weight}else if(this.interpolationType===o.AnimationHandler.CATMULLROM||this.interpolationType===o.AnimationHandler.CATMULLROM_FORWARD){e[0]=this.getPrevKeyWith("pos",h,m.index-1).pos,e[1]=y,e[2]=x,e[3]=this.getNextKeyWith("pos",h,v.index+1).pos,g=.33*g+.33;var w=n(e,g),b=this.weight/(this.weight+p.positionWeight);p.positionWeight+=this.weight;var M=u.position;if(M.x=M.x+(w[0]-M.x)*b,M.y=M.y+(w[1]-M.y)*b,M.z=M.z+(w[2]-M.z)*b,this.interpolationType===o.AnimationHandler.CATMULLROM_FORWARD){var A=n(e,1.01*g);t.set(A[0],A[1],A[2]),t.sub(M),t.y=0,t.normalize();var S=Math.atan2(t.x,t.z);u.rotation.set(0,S,0)}}}else if("rot"===f)if(o.Quaternion.slerp(y,x,i,g),0===p.quaternionWeight)u.quaternion.copy(i),p.quaternionWeight=this.weight;else{var b=this.weight/(this.weight+p.quaternionWeight);o.Quaternion.slerp(u.quaternion,i,u.quaternion,b),p.quaternionWeight+=this.weight}else if("scl"===f){r.x=y[0]+(x[0]-y[0])*g,r.y=y[1]+(x[1]-y[1])*g,r.z=y[2]+(x[2]-y[2])*g;var b=this.weight/(this.weight+p.scaleWeight);u.scale.lerp(r,b),p.scaleWeight+=this.weight}}return!0}}}(),getNextKeyWith:function(e,t,r){var i=this.data.hierarchy[t].keys;for(this.interpolationType===o.AnimationHandler.CATMULLROM||this.interpolationType===o.AnimationHandler.CATMULLROM_FORWARD?r=r0?r:0:r>=0?r:r+i.length;r>=0;r--)if(void 0!==i[r][e])return i[r];return this.data.hierarchy[t].keys[i.length-1]}},o.KeyFrameAnimation=function(e){this.root=e.node,this.data=o.AnimationHandler.init(e),this.hierarchy=o.AnimationHandler.parse(this.root),this.currentTime=0,this.timeScale=.001,this.isPlaying=!1,this.isPaused=!0,this.loop=!0;for(var t=0,r=this.hierarchy.length;r>t;t++){var i=this.data.hierarchy[t].keys,n=this.data.hierarchy[t].sids,a=this.hierarchy[t];if(i.length&&n){for(var s=0;st;t++){r=this.hierarchy[t],i=this.data.hierarchy[t],void 0===i.animationCache&&(i.animationCache={},i.animationCache.prevKey=null,i.animationCache.nextKey=null,i.animationCache.originalMatrix=r.matrix);var a=this.data.hierarchy[t].keys;a.length&&(i.animationCache.prevKey=a[0],i.animationCache.nextKey=a[1],this.startTime=Math.min(a[0].time,this.startTime),this.endTime=Math.max(a[a.length-1].time,this.endTime))}this.update(0)}this.isPaused=!1,o.AnimationHandler.play(this)},stop:function(){this.isPlaying=!1,this.isPaused=!1,o.AnimationHandler.stop(this);for(var e=0;et&&(this.currentTime%=t),this.currentTime=Math.min(this.currentTime,t);for(var r=0,i=this.hierarchy.length;i>r;r++){var n=this.hierarchy[r],o=this.data.hierarchy[r],a=o.keys,s=o.animationCache;if(a.length){var h=s.prevKey,c=s.nextKey;if(c.time<=this.currentTime){for(;c.timeh.index;)h=c,c=a[h.index+1];s.prevKey=h,s.nextKey=c}c.time>=this.currentTime?h.interpolate(c,this.currentTime):h.interpolate(c,c.time),this.data.hierarchy[r].node.updateMatrix(),n.matrixWorldNeedsUpdate=!0}}}},getNextKeyWith:function(e,t,r){var i=this.data.hierarchy[t].keys;for(r%=i.length;r=0?r:r+i.length;r>=0;r--)if(i[r].hasTarget(e))return i[r];return i[i.length-1]}},o.MorphAnimation=function(e){this.mesh=e,this.frames=e.morphTargetInfluences.length,this.currentTime=0,this.duration=1e3,this.loop=!0,this.lastFrame=0,this.currentFrame=0,this.isPlaying=!1},o.MorphAnimation.prototype={constructor:o.MorphAnimation,play:function(){this.isPlaying=!0},pause:function(){this.isPlaying=!1},update:function(e){if(this.isPlaying!==!1){this.currentTime+=e,this.loop===!0&&this.currentTime>this.duration&&(this.currentTime%=this.duration),this.currentTime=Math.min(this.currentTime,this.duration);var t=this.duration/this.frames,r=Math.floor(this.currentTime/t),i=this.mesh.morphTargetInfluences;r!==this.currentFrame&&(i[this.lastFrame]=0,i[this.currentFrame]=1,i[r]=0,this.lastFrame=this.currentFrame,this.currentFrame=r);var n=this.currentTime%t/t;i[r]=n,i[this.lastFrame]=1-n}}},o.BoxGeometry=function(e,t,r,i,n,a){function s(e,t,r,i,n,a,s,c){var u,l,p,d=h.widthSegments,f=h.heightSegments,m=n/2,v=a/2,g=h.vertices.length;"x"===e&&"y"===t||"y"===e&&"x"===t?u="z":"x"===e&&"z"===t||"z"===e&&"x"===t?(u="y",f=h.depthSegments):("z"===e&&"y"===t||"y"===e&&"z"===t)&&(u="x",d=h.depthSegments);var y=d+1,x=f+1,b=n/d,w=a/f,M=new o.Vector3;for(M[u]=s>0?1:-1,p=0;x>p;p++)for(l=0;y>l;l++){var A=new o.Vector3;A[e]=(l*b-m)*r,A[t]=(p*w-v)*i,A[u]=s,h.vertices.push(A)}for(p=0;f>p;p++)for(l=0;d>l;l++){var S=l+y*p,_=l+y*(p+1),E=l+1+y*(p+1),T=l+1+y*p,C=new o.Vector2(l/d,1-p/f),L=new o.Vector2(l/d,1-(p+1)/f),P=new o.Vector2((l+1)/d,1-(p+1)/f),R=new o.Vector2((l+1)/d,1-p/f),D=new o.Face3(S+g,_+g,T+g);D.normal.copy(M),D.vertexNormals.push(M.clone(),M.clone(),M.clone()),D.materialIndex=c,h.faces.push(D),h.faceVertexUvs[0].push([C,L,R]),D=new o.Face3(_+g,E+g,T+g),D.normal.copy(M),D.vertexNormals.push(M.clone(),M.clone(),M.clone()),D.materialIndex=c,h.faces.push(D),h.faceVertexUvs[0].push([L.clone(),P,R.clone()])}}o.Geometry.call(this),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:r,widthSegments:i,heightSegments:n,depthSegments:a},this.widthSegments=i||1,this.heightSegments=n||1,this.depthSegments=a||1;var h=this,c=e/2,u=t/2,l=r/2;s("z","y",-1,-1,r,t,c,0),s("z","y",1,-1,r,t,-c,1),s("x","z",1,1,e,r,u,2),s("x","z",1,-1,e,r,-u,3),s("x","y",1,-1,e,t,l,4),s("x","y",-1,-1,e,t,-l,5),this.mergeVertices()},o.BoxGeometry.prototype=Object.create(o.Geometry.prototype),o.BoxGeometry.prototype.constructor=o.BoxGeometry,o.BoxGeometry.prototype.clone=function(){var e=new o.BoxGeometry(this.parameters.width,this.parameters.height,this.parameters.depth,this.parameters.widthSegments,this.parameters.heightSegments,this.parameters.depthSegments);return e},o.CubeGeometry=o.BoxGeometry,o.CircleGeometry=function(e,t,r,i){o.Geometry.call(this),this.type="CircleGeometry",this.parameters={radius:e,segments:t,thetaStart:r,thetaLength:i},e=e||50,t=void 0!==t?Math.max(3,t):8,r=void 0!==r?r:0,i=void 0!==i?i:2*Math.PI;var n,a=[],s=new o.Vector3,h=new o.Vector2(.5,.5);for(this.vertices.push(s),a.push(h),n=0;t>=n;n++){var c=new o.Vector3,u=r+n/t*i;c.x=e*Math.cos(u),c.y=e*Math.sin(u),this.vertices.push(c),a.push(new o.Vector2((c.x/e+1)/2,(c.y/e+1)/2))}var l=new o.Vector3(0,0,1);for(n=1;t>=n;n++)this.faces.push(new o.Face3(n,n+1,0,[l.clone(),l.clone(),l.clone()])),this.faceVertexUvs[0].push([a[n].clone(),a[n+1].clone(),h.clone()]);this.computeFaceNormals(),this.boundingSphere=new o.Sphere(new o.Vector3,e)},o.CircleGeometry.prototype=Object.create(o.Geometry.prototype),o.CircleGeometry.prototype.constructor=o.CircleGeometry,o.CircleGeometry.prototype.clone=function(){var e=new o.CircleGeometry(this.parameters.radius,this.parameters.segments,this.parameters.thetaStart,this.parameters.thetaLength);return e},o.CircleBufferGeometry=function(e,t,r,i){o.BufferGeometry.call(this),this.type="CircleBufferGeometry",this.parameters={radius:e,segments:t,thetaStart:r,thetaLength:i},e=e||50,t=void 0!==t?Math.max(3,t):8,r=void 0!==r?r:0,i=void 0!==i?i:2*Math.PI;var n=t+2,a=new Float32Array(3*n),s=new Float32Array(3*n),h=new Float32Array(2*n);s[3]=1,h[0]=.5,h[1]=.5;for(var c=0,u=3,l=2;t>=c;c++,u+=3,l+=2){var p=r+c/t*i;a[u]=e*Math.cos(p),a[u+1]=e*Math.sin(p),s[u+2]=1,h[l]=(a[u]/e+1)/2,h[l+1]=(a[u+1]/e+1)/2}for(var d=[],u=1;t>=u;u++)d.push(u),d.push(u+1),d.push(0);this.addIndex(new o.BufferAttribute(new Uint16Array(d),1)),this.addAttribute("position",new o.BufferAttribute(a,3)),this.addAttribute("normal",new o.BufferAttribute(s,3)),this.addAttribute("uv",new o.BufferAttribute(h,2)),this.boundingSphere=new o.Sphere(new o.Vector3,e)},o.CircleBufferGeometry.prototype=Object.create(o.BufferGeometry.prototype),o.CircleBufferGeometry.prototype.constructor=o.CircleBufferGeometry,o.CircleBufferGeometry.prototype.clone=function(){var e=new o.CircleBufferGeometry(this.parameters.radius,this.parameters.segments,this.parameters.thetaStart,this.parameters.thetaLength);return e.copy(this),e},o.CylinderGeometry=function(e,t,r,i,n,a,s,h){o.Geometry.call(this),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:r,radialSegments:i, +heightSegments:n,openEnded:a,thetaStart:s,thetaLength:h},e=void 0!==e?e:20,t=void 0!==t?t:20,r=void 0!==r?r:100,i=i||8,n=n||1,a=void 0!==a?a:!1,s=void 0!==s?s:0,h=void 0!==h?h:2*Math.PI;var c,u,l=r/2,p=[],d=[];for(u=0;n>=u;u++){var f=[],m=[],v=u/n,g=v*(t-e)+e;for(c=0;i>=c;c++){var y=c/i,x=new o.Vector3;x.x=g*Math.sin(y*h+s),x.y=-v*r+l,x.z=g*Math.cos(y*h+s),this.vertices.push(x),f.push(this.vertices.length-1),m.push(new o.Vector2(y,1-v))}p.push(f),d.push(m)}var b,w,M=(t-e)/r;for(c=0;i>c;c++)for(0!==e?(b=this.vertices[p[0][c]].clone(),w=this.vertices[p[0][c+1]].clone()):(b=this.vertices[p[1][c]].clone(),w=this.vertices[p[1][c+1]].clone()),b.setY(Math.sqrt(b.x*b.x+b.z*b.z)*M).normalize(),w.setY(Math.sqrt(w.x*w.x+w.z*w.z)*M).normalize(),u=0;n>u;u++){var A=p[u][c],S=p[u+1][c],_=p[u+1][c+1],E=p[u][c+1],T=b.clone(),C=b.clone(),L=w.clone(),P=w.clone(),R=d[u][c].clone(),D=d[u+1][c].clone(),F=d[u+1][c+1].clone(),O=d[u][c+1].clone();this.faces.push(new o.Face3(A,S,E,[T,C,P])),this.faceVertexUvs[0].push([R,D,O]),this.faces.push(new o.Face3(S,_,E,[C.clone(),L,P.clone()])),this.faceVertexUvs[0].push([D.clone(),F,O.clone()])}if(a===!1&&e>0)for(this.vertices.push(new o.Vector3(0,l,0)),c=0;i>c;c++){var A=p[0][c],S=p[0][c+1],_=this.vertices.length-1,T=new o.Vector3(0,1,0),C=new o.Vector3(0,1,0),L=new o.Vector3(0,1,0),R=d[0][c].clone(),D=d[0][c+1].clone(),F=new o.Vector2(D.x,0);this.faces.push(new o.Face3(A,S,_,[T,C,L],void 0,1)),this.faceVertexUvs[0].push([R,D,F])}if(a===!1&&t>0)for(this.vertices.push(new o.Vector3(0,-l,0)),c=0;i>c;c++){var A=p[n][c+1],S=p[n][c],_=this.vertices.length-1,T=new o.Vector3(0,-1,0),C=new o.Vector3(0,-1,0),L=new o.Vector3(0,-1,0),R=d[n][c+1].clone(),D=d[n][c].clone(),F=new o.Vector2(D.x,1);this.faces.push(new o.Face3(A,S,_,[T,C,L],void 0,2)),this.faceVertexUvs[0].push([R,D,F])}this.computeFaceNormals()},o.CylinderGeometry.prototype=Object.create(o.Geometry.prototype),o.CylinderGeometry.prototype.constructor=o.CylinderGeometry,o.CylinderGeometry.prototype.clone=function(){var e=new o.CylinderGeometry(this.parameters.radiusTop,this.parameters.radiusBottom,this.parameters.height,this.parameters.radialSegments,this.parameters.heightSegments,this.parameters.openEnded,this.parameters.thetaStart,this.parameters.thetaLength);return e},o.EdgesGeometry=function(e,t){o.BufferGeometry.call(this),t=void 0!==t?t:1;var r,i=Math.cos(o.Math.degToRad(t)),n=[0,0],a={},s=function(e,t){return e-t},h=["a","b","c"];e instanceof o.BufferGeometry?(r=new o.Geometry,r.fromBufferGeometry(e)):r=e.clone(),r.mergeVertices(),r.computeFaceNormals();for(var c=r.vertices,u=r.faces,l=0,p=u.length;p>l;l++)for(var d=u[l],f=0;3>f;f++){n[0]=d[h[f]],n[1]=d[h[(f+1)%3]],n.sort(s);var m=n.toString();void 0===a[m]?a[m]={vert1:n[0],vert2:n[1],face1:l,face2:void 0}:a[m].face2=l}var v=[];for(var m in a){var g=a[m];if(void 0===g.face2||u[g.face1].normal.dot(u[g.face2].normal)<=i){var y=c[g.vert1];v.push(y.x),v.push(y.y),v.push(y.z),y=c[g.vert2],v.push(y.x),v.push(y.y),v.push(y.z)}}this.addAttribute("position",new o.BufferAttribute(new Float32Array(v),3))},o.EdgesGeometry.prototype=Object.create(o.BufferGeometry.prototype),o.EdgesGeometry.prototype.constructor=o.EdgesGeometry,o.ExtrudeGeometry=function(e,t){return"undefined"==typeof e?void(e=[]):(o.Geometry.call(this),this.type="ExtrudeGeometry",e=Array.isArray(e)?e:[e],this.addShapeList(e,t),void this.computeFaceNormals())},o.ExtrudeGeometry.prototype=Object.create(o.Geometry.prototype),o.ExtrudeGeometry.prototype.constructor=o.ExtrudeGeometry,o.ExtrudeGeometry.prototype.addShapeList=function(e,t){for(var r=e.length,i=0;r>i;i++){var n=e[i];this.addShape(n,t)}},o.ExtrudeGeometry.prototype.addShape=function(e,t){function r(e,t,r){return t||console.error("THREE.ExtrudeGeometry: vec does not exist"),t.clone().multiplyScalar(r).add(e)}function i(e,t,r){var i,n,a=1e-10,s=1,h=e.x-t.x,c=e.y-t.y,u=r.x-e.x,l=r.y-e.y,p=h*h+c*c,d=h*l-c*u;if(Math.abs(d)>a){var f=Math.sqrt(p),m=Math.sqrt(u*u+l*l),v=t.x-c/f,g=t.y+h/f,y=r.x-l/m,x=r.y+u/m,b=((y-v)*l-(x-g)*u)/(h*l-c*u);i=v+h*b-e.x,n=g+c*b-e.y;var w=i*i+n*n;if(2>=w)return new o.Vector2(i,n);s=Math.sqrt(w/2)}else{var M=!1;h>a?u>a&&(M=!0):-a>h?-a>u&&(M=!0):Math.sign(c)===Math.sign(l)&&(M=!0),M?(i=-c,n=h,s=Math.sqrt(p)):(i=h,n=c,s=Math.sqrt(p/2))}return new o.Vector2(i/s,n/s)}function n(){if(b){var e=0,t=j*e;for(X=0;H>X;X++)I=U[X],c(I[2]+t,I[1]+t,I[0]+t);for(e=M+2*x,t=j*e,X=0;H>X;X++)I=U[X],c(I[0]+t,I[1]+t,I[2]+t)}else{for(X=0;H>X;X++)I=U[X],c(I[2],I[1],I[0]);for(X=0;H>X;X++)I=U[X],c(I[0]+j*M,I[1]+j*M,I[2]+j*M)}}function a(){var e=0;for(s(k,e),e+=k.length,T=0,C=F.length;C>T;T++)E=F[T],s(E,e),e+=E.length}function s(e,t){var r,i;for(X=e.length;--X>=0;){r=X,i=X-1,0>i&&(i=e.length-1);var n=0,o=M+2*x;for(n=0;o>n;n++){var a=j*n,s=j*(n+1),h=t+r+a,c=t+i+a,l=t+i+s,p=t+r+s;u(h,c,l,p,e,n,o,r,i)}}}function h(e,t,r){L.vertices.push(new o.Vector3(e,t,r))}function c(e,t,r){e+=P,t+=P,r+=P,L.faces.push(new o.Face3(e,t,r));var i=_.generateTopUV(L,e,t,r);L.faceVertexUvs[0].push(i)}function u(e,t,r,i,n,a,s,h,c){e+=P,t+=P,r+=P,i+=P,L.faces.push(new o.Face3(e,t,i)),L.faces.push(new o.Face3(t,r,i));var u=_.generateSideWallUV(L,e,t,r,i);L.faceVertexUvs[0].push([u[0],u[1],u[3]]),L.faceVertexUvs[0].push([u[1],u[2],u[3]])}var l,p,d,f,m,v=void 0!==t.amount?t.amount:100,g=void 0!==t.bevelThickness?t.bevelThickness:6,y=void 0!==t.bevelSize?t.bevelSize:g-2,x=void 0!==t.bevelSegments?t.bevelSegments:3,b=void 0!==t.bevelEnabled?t.bevelEnabled:!0,w=void 0!==t.curveSegments?t.curveSegments:12,M=void 0!==t.steps?t.steps:1,A=t.extrudePath,S=!1,_=void 0!==t.UVGenerator?t.UVGenerator:o.ExtrudeGeometry.WorldUVGenerator;A&&(l=A.getSpacedPoints(M),S=!0,b=!1,p=void 0!==t.frames?t.frames:new o.TubeGeometry.FrenetFrames(A,M,!1),d=new o.Vector3,f=new o.Vector3,m=new o.Vector3),b||(x=0,g=0,y=0);var E,T,C,L=this,P=this.vertices.length,R=e.extractPoints(w),D=R.shape,F=R.holes,O=!o.Shape.Utils.isClockWise(D);if(O){for(D=D.reverse(),T=0,C=F.length;C>T;T++)E=F[T],o.Shape.Utils.isClockWise(E)&&(F[T]=E.reverse());O=!1}var U=o.Shape.Utils.triangulateShape(D,F),k=D;for(T=0,C=F.length;C>T;T++)E=F[T],D=D.concat(E);for(var B,V,G,z,N,I,j=D.length,H=U.length,W=[],X=0,q=k.length,Y=q-1,Q=X+1;q>X;X++,Y++,Q++)Y===q&&(Y=0),Q===q&&(Q=0),W[X]=i(k[X],k[Y],k[Q]);var K,Z=[],J=W.concat();for(T=0,C=F.length;C>T;T++){for(E=F[T],K=[],X=0,q=E.length,Y=q-1,Q=X+1;q>X;X++,Y++,Q++)Y===q&&(Y=0),Q===q&&(Q=0),K[X]=i(E[X],E[Y],E[Q]);Z.push(K),J=J.concat(K)}for(B=0;x>B;B++){for(G=B/x,z=g*(1-G),V=y*Math.sin(G*Math.PI/2),X=0,q=k.length;q>X;X++)N=r(k[X],W[X],V),h(N.x,N.y,-z);for(T=0,C=F.length;C>T;T++)for(E=F[T],K=Z[T],X=0,q=E.length;q>X;X++)N=r(E[X],K[X],V),h(N.x,N.y,-z)}for(V=y,X=0;j>X;X++)N=b?r(D[X],J[X],V):D[X],S?(f.copy(p.normals[0]).multiplyScalar(N.x),d.copy(p.binormals[0]).multiplyScalar(N.y),m.copy(l[0]).add(f).add(d),h(m.x,m.y,m.z)):h(N.x,N.y,0);var $;for($=1;M>=$;$++)for(X=0;j>X;X++)N=b?r(D[X],J[X],V):D[X],S?(f.copy(p.normals[$]).multiplyScalar(N.x),d.copy(p.binormals[$]).multiplyScalar(N.y),m.copy(l[$]).add(f).add(d),h(m.x,m.y,m.z)):h(N.x,N.y,v/M*$);for(B=x-1;B>=0;B--){for(G=B/x,z=g*(1-G),V=y*Math.sin(G*Math.PI/2),X=0,q=k.length;q>X;X++)N=r(k[X],W[X],V),h(N.x,N.y,v+z);for(T=0,C=F.length;C>T;T++)for(E=F[T],K=Z[T],X=0,q=E.length;q>X;X++)N=r(E[X],K[X],V),S?h(N.x,N.y+l[M-1].y,l[M-1].x+z):h(N.x,N.y,v+z)}n(),a()},o.ExtrudeGeometry.WorldUVGenerator={generateTopUV:function(e,t,r,i){var n=e.vertices,a=n[t],s=n[r],h=n[i];return[new o.Vector2(a.x,a.y),new o.Vector2(s.x,s.y),new o.Vector2(h.x,h.y)]},generateSideWallUV:function(e,t,r,i,n){var a=e.vertices,s=a[t],h=a[r],c=a[i],u=a[n];return Math.abs(s.y-h.y)<.01?[new o.Vector2(s.x,1-s.z),new o.Vector2(h.x,1-h.z),new o.Vector2(c.x,1-c.z),new o.Vector2(u.x,1-u.z)]:[new o.Vector2(s.y,1-s.z),new o.Vector2(h.y,1-h.z),new o.Vector2(c.y,1-c.z),new o.Vector2(u.y,1-u.z)]}},o.ShapeGeometry=function(e,t){o.Geometry.call(this),this.type="ShapeGeometry",Array.isArray(e)===!1&&(e=[e]),this.addShapeList(e,t),this.computeFaceNormals()},o.ShapeGeometry.prototype=Object.create(o.Geometry.prototype),o.ShapeGeometry.prototype.constructor=o.ShapeGeometry,o.ShapeGeometry.prototype.addShapeList=function(e,t){for(var r=0,i=e.length;i>r;r++)this.addShape(e[r],t);return this},o.ShapeGeometry.prototype.addShape=function(e,t){void 0===t&&(t={});var r,i,n,a=void 0!==t.curveSegments?t.curveSegments:12,s=t.material,h=void 0===t.UVGenerator?o.ExtrudeGeometry.WorldUVGenerator:t.UVGenerator,c=this.vertices.length,u=e.extractPoints(a),l=u.shape,p=u.holes,d=!o.Shape.Utils.isClockWise(l);if(d){for(l=l.reverse(),r=0,i=p.length;i>r;r++)n=p[r],o.Shape.Utils.isClockWise(n)&&(p[r]=n.reverse());d=!1}var f=o.Shape.Utils.triangulateShape(l,p);for(r=0,i=p.length;i>r;r++)n=p[r],l=l.concat(n);var m,v,g=l.length,y=f.length;for(r=0;g>r;r++)m=l[r],this.vertices.push(new o.Vector3(m.x,m.y,0));for(r=0;y>r;r++){v=f[r];var x=v[0]+c,b=v[1]+c,w=v[2]+c;this.faces.push(new o.Face3(x,b,w,null,null,s)),this.faceVertexUvs[0].push(h.generateTopUV(this,x,b,w))}},o.LatheGeometry=function(e,t,r,i){o.Geometry.call(this),this.type="LatheGeometry",this.parameters={points:e,segments:t,phiStart:r,phiLength:i},t=t||12,r=r||0,i=i||2*Math.PI;for(var n=1/(e.length-1),a=1/t,s=0,h=t;h>=s;s++)for(var c=r+s*a*i,u=Math.cos(c),l=Math.sin(c),p=0,d=e.length;d>p;p++){var f=e[p],m=new o.Vector3;m.x=u*f.x-l*f.y,m.y=l*f.x+u*f.y,m.z=f.z,this.vertices.push(m)}for(var v=e.length,s=0,h=t;h>s;s++)for(var p=0,d=e.length-1;d>p;p++){var g=p+v*s,y=g,x=g+v,u=g+1+v,b=g+1,w=s*a,M=p*n,A=w+a,S=M+n;this.faces.push(new o.Face3(y,x,b)),this.faceVertexUvs[0].push([new o.Vector2(w,M),new o.Vector2(A,M),new o.Vector2(w,S)]),this.faces.push(new o.Face3(x,u,b)),this.faceVertexUvs[0].push([new o.Vector2(A,M),new o.Vector2(A,S),new o.Vector2(w,S)])}this.mergeVertices(),this.computeFaceNormals(),this.computeVertexNormals()},o.LatheGeometry.prototype=Object.create(o.Geometry.prototype),o.LatheGeometry.prototype.constructor=o.LatheGeometry,o.PlaneGeometry=function(e,t,r,i){o.Geometry.call(this),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:r,heightSegments:i},this.fromBufferGeometry(new o.PlaneBufferGeometry(e,t,r,i))},o.PlaneGeometry.prototype=Object.create(o.Geometry.prototype),o.PlaneGeometry.prototype.constructor=o.PlaneGeometry,o.PlaneGeometry.prototype.clone=function(){var e=new o.PlaneGeometry(this.parameters.width,this.parameters.height,this.parameters.widthSegments,this.parameters.heightSegments);return e},o.PlaneBufferGeometry=function(e,t,r,i){o.BufferGeometry.call(this),this.type="PlaneBufferGeometry",this.parameters={width:e,height:t,widthSegments:r,heightSegments:i};for(var n=e/2,a=t/2,s=Math.floor(r)||1,h=Math.floor(i)||1,c=s+1,u=h+1,l=e/s,p=t/h,d=new Float32Array(c*u*3),f=new Float32Array(c*u*3),m=new Float32Array(c*u*2),v=0,g=0,y=0;u>y;y++)for(var x=y*p-a,b=0;c>b;b++){var w=b*l-n;d[v]=w,d[v+1]=-x,f[v+2]=1,m[g]=b/s,m[g+1]=1-y/h,v+=3,g+=2}v=0;for(var M=new(d.length/3>65535?Uint32Array:Uint16Array)(s*h*6),y=0;h>y;y++)for(var b=0;s>b;b++){var A=b+c*y,S=b+c*(y+1),_=b+1+c*(y+1),E=b+1+c*y;M[v]=A,M[v+1]=S,M[v+2]=E,M[v+3]=S,M[v+4]=_,M[v+5]=E,v+=6}this.addIndex(new o.BufferAttribute(M,1)),this.addAttribute("position",new o.BufferAttribute(d,3)),this.addAttribute("normal",new o.BufferAttribute(f,3)),this.addAttribute("uv",new o.BufferAttribute(m,2))},o.PlaneBufferGeometry.prototype=Object.create(o.BufferGeometry.prototype),o.PlaneBufferGeometry.prototype.constructor=o.PlaneBufferGeometry,o.PlaneBufferGeometry.prototype.clone=function(){var e=new o.PlaneBufferGeometry(this.parameters.width,this.parameters.height,this.parameters.widthSegments,this.parameters.heightSegments);return e.copy(this),e},o.RingGeometry=function(e,t,r,i,n,a){o.Geometry.call(this),this.type="RingGeometry",this.parameters={innerRadius:e,outerRadius:t,thetaSegments:r,phiSegments:i,thetaStart:n,thetaLength:a},e=e||0,t=t||50,n=void 0!==n?n:0,a=void 0!==a?a:2*Math.PI,r=void 0!==r?Math.max(3,r):8,i=void 0!==i?Math.max(1,i):8;var s,h,c=[],u=e,l=(t-e)/i;for(s=0;i+1>s;s++){for(h=0;r+1>h;h++){var p=new o.Vector3,d=n+h/r*a;p.x=u*Math.cos(d),p.y=u*Math.sin(d),this.vertices.push(p),c.push(new o.Vector2((p.x/t+1)/2,(p.y/t+1)/2))}u+=l}var f=new o.Vector3(0,0,1);for(s=0;i>s;s++){var m=s*(r+1);for(h=0;r>h;h++){var d=h+m,v=d,g=d+r+1,y=d+r+2;this.faces.push(new o.Face3(v,g,y,[f.clone(),f.clone(),f.clone()])),this.faceVertexUvs[0].push([c[v].clone(),c[g].clone(),c[y].clone()]),v=d,g=d+r+2,y=d+1,this.faces.push(new o.Face3(v,g,y,[f.clone(),f.clone(),f.clone()])),this.faceVertexUvs[0].push([c[v].clone(),c[g].clone(),c[y].clone()])}}this.computeFaceNormals(),this.boundingSphere=new o.Sphere(new o.Vector3,u)},o.RingGeometry.prototype=Object.create(o.Geometry.prototype),o.RingGeometry.prototype.constructor=o.RingGeometry,o.RingGeometry.prototype.clone=function(){var e=new o.RingGeometry(this.parameters.innerRadius,this.parameters.outerRadius,this.parameters.thetaSegments,this.parameters.phiSegments,this.parameters.thetaStart,this.parameters.thetaLength);return e},o.SphereGeometry=function(e,t,r,i,n,a,s){o.Geometry.call(this),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:r,phiStart:i,phiLength:n,thetaStart:a,thetaLength:s},this.fromBufferGeometry(new o.SphereBufferGeometry(e,t,r,i,n,a,s))},o.SphereGeometry.prototype=Object.create(o.Geometry.prototype),o.SphereGeometry.prototype.constructor=o.SphereGeometry,o.SphereGeometry.prototype.clone=function(){var e=new o.SphereGeometry(this.parameters.radius,this.parameters.widthSegments,this.parameters.heightSegments,this.parameters.phiStart,this.parameters.phiLength,this.parameters.thetaStart,this.parameters.thetaLength);return e},o.SphereBufferGeometry=function(e,t,r,i,n,a,s){o.BufferGeometry.call(this),this.type="SphereBufferGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:r,phiStart:i,phiLength:n,thetaStart:a,thetaLength:s},e=e||50,t=Math.max(3,Math.floor(t)||8),r=Math.max(2,Math.floor(r)||6),i=void 0!==i?i:0,n=void 0!==n?n:2*Math.PI,a=void 0!==a?a:0,s=void 0!==s?s:Math.PI;for(var h=a+s,c=(t+1)*(r+1),u=new o.BufferAttribute(new Float32Array(3*c),3),l=new o.BufferAttribute(new Float32Array(3*c),3),p=new o.BufferAttribute(new Float32Array(2*c),2),d=0,f=[],m=new o.Vector3,v=0;r>=v;v++){for(var g=[],y=v/r,x=0;t>=x;x++){var b=x/t,w=-e*Math.cos(i+b*n)*Math.sin(a+y*s),M=e*Math.cos(a+y*s),A=e*Math.sin(i+b*n)*Math.sin(a+y*s);m.set(w,M,A).normalize(),u.setXYZ(d,w,M,A),l.setXYZ(d,m.x,m.y,m.z),p.setXY(d,b,1-y),g.push(d),d++}f.push(g)}for(var S=[],v=0;r>v;v++)for(var x=0;t>x;x++){var _=f[v][x+1],E=f[v][x],T=f[v+1][x],C=f[v+1][x+1];(0!==v||a>0)&&S.push(_,E,C),(v!==r-1||h=c;c++)for(var u=0;i>=u;u++){var l=u/i*n,p=c/r*Math.PI*2;a.x=e*Math.cos(l),a.y=e*Math.sin(l);var d=new o.Vector3;d.x=(e+t*Math.cos(p))*Math.cos(l),d.y=(e+t*Math.cos(p))*Math.sin(l),d.z=t*Math.sin(p),this.vertices.push(d),s.push(new o.Vector2(u/i,c/r)),h.push(d.clone().sub(a).normalize())}for(var c=1;r>=c;c++)for(var u=1;i>=u;u++){var f=(i+1)*c+u-1,m=(i+1)*(c-1)+u-1,v=(i+1)*(c-1)+u,g=(i+1)*c+u,y=new o.Face3(f,m,g,[h[f].clone(),h[m].clone(),h[g].clone()]);this.faces.push(y),this.faceVertexUvs[0].push([s[f].clone(),s[m].clone(),s[g].clone()]),y=new o.Face3(m,v,g,[h[m].clone(),h[v].clone(),h[g].clone()]),this.faces.push(y),this.faceVertexUvs[0].push([s[m].clone(),s[v].clone(),s[g].clone()])}this.computeFaceNormals()},o.TorusGeometry.prototype=Object.create(o.Geometry.prototype),o.TorusGeometry.prototype.constructor=o.TorusGeometry,o.TorusGeometry.prototype.clone=function(){var e=new o.TorusGeometry(this.parameters.radius,this.parameters.tube,this.parameters.radialSegments,this.parameters.tubularSegments,this.parameters.arc);return e},o.TorusKnotGeometry=function(e,t,r,i,n,a,s){function h(e,t,r,i,n){var a=Math.cos(e),s=Math.sin(e),h=t/r*e,c=Math.cos(h),u=i*(2+c)*.5*a,l=i*(2+c)*s*.5,p=n*i*Math.sin(h)*.5;return new o.Vector3(u,l,p)}o.Geometry.call(this),this.type="TorusKnotGeometry",this.parameters={radius:e,tube:t,radialSegments:r,tubularSegments:i,p:n,q:a,heightScale:s},e=e||100,t=t||40,r=r||64,i=i||8,n=n||2,a=a||3,s=s||1;for(var c=new Array(r),u=new o.Vector3,l=new o.Vector3,p=new o.Vector3,d=0;r>d;++d){c[d]=new Array(i);var f=d/r*2*n*Math.PI,m=h(f,a,n,e,s),v=h(f+.01,a,n,e,s);u.subVectors(v,m),l.addVectors(v,m),p.crossVectors(u,l),l.crossVectors(p,u),p.normalize(),l.normalize();for(var g=0;i>g;++g){var y=g/i*2*Math.PI,x=-t*Math.cos(y),b=t*Math.sin(y),w=new o.Vector3;w.x=m.x+x*l.x+b*p.x,w.y=m.y+x*l.y+b*p.y,w.z=m.z+x*l.z+b*p.z,c[d][g]=this.vertices.push(w)-1}}for(var d=0;r>d;++d)for(var g=0;i>g;++g){var M=(d+1)%r,A=(g+1)%i,S=c[d][g],_=c[M][g],E=c[M][A],T=c[d][A],C=new o.Vector2(d/r,g/i),L=new o.Vector2((d+1)/r,g/i),P=new o.Vector2((d+1)/r,(g+1)/i),R=new o.Vector2(d/r,(g+1)/i);this.faces.push(new o.Face3(S,_,T)),this.faceVertexUvs[0].push([C,L,R]),this.faces.push(new o.Face3(_,E,T)),this.faceVertexUvs[0].push([L.clone(),P,R.clone()])}this.computeFaceNormals(),this.computeVertexNormals()},o.TorusKnotGeometry.prototype=Object.create(o.Geometry.prototype),o.TorusKnotGeometry.prototype.constructor=o.TorusKnotGeometry,o.TorusKnotGeometry.prototype.clone=function(){var e=new o.TorusKnotGeometry(this.parameters.radius,this.parameters.tube,this.parameters.radialSegments,this.parameters.tubularSegments,this.parameters.p,this.parameters.q,this.parameters.heightScale);return e},o.TubeGeometry=function(e,t,r,i,n,a){function s(e,t,r){return P.vertices.push(new o.Vector3(e,t,r))-1}o.Geometry.call(this),this.type="TubeGeometry",this.parameters={path:e,segments:t,radius:r,radialSegments:i,closed:n},t=t||64,r=r||1,i=i||8,n=n||!1,a=a||o.TubeGeometry.NoTaper;var h,c,u,l,p,d,f,m,v,g,y,x,b,w,M,A,S,_,E,T,C,L=[],P=this,R=t+1,D=new o.Vector3,F=new o.TubeGeometry.FrenetFrames(e,t,n),O=F.tangents,U=F.normals,k=F.binormals;for(this.tangents=O,this.normals=U,this.binormals=k,g=0;R>g;g++)for(L[g]=[],l=g/(R-1),v=e.getPointAt(l),h=O[g],c=U[g],u=k[g],d=r*a(l),y=0;i>y;y++)p=y/i*2*Math.PI,f=-d*Math.cos(p),m=d*Math.sin(p),D.copy(v),D.x+=f*c.x+m*u.x,D.y+=f*c.y+m*u.y,D.z+=f*c.z+m*u.z,L[g][y]=s(D.x,D.y,D.z);for(g=0;t>g;g++)for(y=0;i>y;y++)x=n?(g+1)%t:g+1,b=(y+1)%i,w=L[g][y],M=L[x][y],A=L[x][b],S=L[g][b],_=new o.Vector2(g/t,y/i),E=new o.Vector2((g+1)/t,y/i),T=new o.Vector2((g+1)/t,(y+1)/i),C=new o.Vector2(g/t,(y+1)/i),this.faces.push(new o.Face3(w,M,S)),this.faceVertexUvs[0].push([_,E,C]),this.faces.push(new o.Face3(M,A,S)),this.faceVertexUvs[0].push([E.clone(),T,C.clone()]);this.computeFaceNormals(),this.computeVertexNormals()},o.TubeGeometry.prototype=Object.create(o.Geometry.prototype),o.TubeGeometry.prototype.constructor=o.TubeGeometry,o.TubeGeometry.NoTaper=function(e){return 1},o.TubeGeometry.SinusoidalTaper=function(e){return Math.sin(Math.PI*e)},o.TubeGeometry.FrenetFrames=function(e,t,r){function i(){f[0]=new o.Vector3,m[0]=new o.Vector3,a=Number.MAX_VALUE,s=Math.abs(d[0].x),h=Math.abs(d[0].y),c=Math.abs(d[0].z),a>=s&&(a=s,p.set(1,0,0)),a>=h&&(a=h,p.set(0,1,0)),a>=c&&p.set(0,0,1),v.crossVectors(d[0],p).normalize(),f[0].crossVectors(d[0],v),m[0].crossVectors(d[0],f[0])}var n,a,s,h,c,u,l,p=new o.Vector3,d=[],f=[],m=[],v=new o.Vector3,g=new o.Matrix4,y=t+1,x=1e-4;for(this.tangents=d,this.normals=f,this.binormals=m,u=0;y>u;u++)l=u/(y-1),d[u]=e.getTangentAt(l),d[u].normalize();for(i(),u=1;y>u;u++)f[u]=f[u-1].clone(),m[u]=m[u-1].clone(),v.crossVectors(d[u-1],d[u]),v.length()>x&&(v.normalize(),n=Math.acos(o.Math.clamp(d[u-1].dot(d[u]),-1,1)),f[u].applyMatrix4(g.makeRotationAxis(v,n))),m[u].crossVectors(d[u],f[u]);if(r)for(n=Math.acos(o.Math.clamp(f[0].dot(f[y-1]),-1,1)),n/=y-1,d[0].dot(v.crossVectors(f[0],f[y-1]))>0&&(n=-n),u=1;y>u;u++)f[u].applyMatrix4(g.makeRotationAxis(d[u],n*u)),m[u].crossVectors(d[u],f[u])},o.PolyhedronGeometry=function(e,t,r,i){function n(e){var t=e.normalize().clone();t.index=l.vertices.push(t)-1;var r=h(e)/2/Math.PI+.5,i=c(e)/Math.PI+.5;return t.uv=new o.Vector2(r,1-i),t}function a(e,t,r,i){var n=new o.Face3(e.index,t.index,r.index,[e.clone(),t.clone(),r.clone()],void 0,i);l.faces.push(n),b.copy(e).add(t).add(r).divideScalar(3);var a=h(b);l.faceVertexUvs[0].push([u(e.uv,e,a),u(t.uv,t,a),u(r.uv,r,a)])}function s(e,t){for(var r=Math.pow(2,t),i=n(l.vertices[e.a]),o=n(l.vertices[e.b]),s=n(l.vertices[e.c]),h=[],c=e.materialIndex,u=0;r>=u;u++){h[u]=[];for(var p=n(i.clone().lerp(s,u/r)),d=n(o.clone().lerp(s,u/r)),f=r-u,m=0;f>=m;m++)0===m&&u===r?h[u][m]=p:h[u][m]=n(p.clone().lerp(d,m/f))}for(var u=0;r>u;u++)for(var m=0;2*(r-u)-1>m;m++){var v=Math.floor(m/2);m%2===0?a(h[u][v+1],h[u+1][v],h[u][v],c):a(h[u][v+1],h[u+1][v+1],h[u+1][v],c)}}function h(e){return Math.atan2(e.z,-e.x)}function c(e){return Math.atan2(-e.y,Math.sqrt(e.x*e.x+e.z*e.z))}function u(e,t,r){return 0>r&&1===e.x&&(e=new o.Vector2(e.x-1,e.y)),0===t.x&&0===t.z&&(e=new o.Vector2(r/2/Math.PI+.5,e.y)),e.clone()}o.Geometry.call(this),this.type="PolyhedronGeometry",this.parameters={vertices:e,indices:t,radius:r,detail:i},r=r||1,i=i||0;for(var l=this,p=0,d=e.length;d>p;p+=3)n(new o.Vector3(e[p],e[p+1],e[p+2]));for(var f=this.vertices,m=[],p=0,v=0,d=t.length;d>p;p+=3,v++){var g=f[t[p]],y=f[t[p+1]],x=f[t[p+2]];m[v]=new o.Face3(g.index,y.index,x.index,[g.clone(),y.clone(),x.clone()],void 0,v)}for(var b=new o.Vector3,p=0,d=m.length;d>p;p++)s(m[p],i);for(var p=0,d=this.faceVertexUvs[0].length;d>p;p++){var w=this.faceVertexUvs[0][p],M=w[0].x,A=w[1].x,S=w[2].x,_=Math.max(M,Math.max(A,S)),E=Math.min(M,Math.min(A,S));_>.9&&.1>E&&(.2>M&&(w[0].x+=1),.2>A&&(w[1].x+=1),.2>S&&(w[2].x+=1))}for(var p=0,d=this.vertices.length;d>p;p++)this.vertices[p].multiplyScalar(r);this.mergeVertices(),this.computeFaceNormals(),this.boundingSphere=new o.Sphere(new o.Vector3,r)},o.PolyhedronGeometry.prototype=Object.create(o.Geometry.prototype),o.PolyhedronGeometry.prototype.constructor=o.PolyhedronGeometry,o.PolyhedronGeometry.prototype.clone=function(){var e=new o.PolyhedronGeometry(this.parameters.vertices,this.parameters.indices,this.parameters.radius,this.parameters.detail);return e.copy(this)},o.PolyhedronGeometry.prototype.copy=function(e){return o.Geometry.prototype.copy.call(this,e),this},o.DodecahedronGeometry=function(e,t){var r=(1+Math.sqrt(5))/2,i=1/r,n=[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-i,-r,0,-i,r,0,i,-r,0,i,r,-i,-r,0,-i,r,0,i,-r,0,i,r,0,-r,0,-i,r,0,-i,-r,0,i,r,0,i],a=[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9];o.PolyhedronGeometry.call(this,n,a,e,t),this.type="DodecahedronGeometry",this.parameters={radius:e,detail:t}},o.DodecahedronGeometry.prototype=Object.create(o.PolyhedronGeometry.prototype),o.DodecahedronGeometry.prototype.constructor=o.DodecahedronGeometry,o.DodecahedronGeometry.prototype.clone=function(){var e=new o.DodecahedronGeometry(this.parameters.radius,this.parameters.detail);return e.copy(this),e},o.IcosahedronGeometry=function(e,t){var r=(1+Math.sqrt(5))/2,i=[-1,r,0,1,r,0,-1,-r,0,1,-r,0,0,-1,r,0,1,r,0,-1,-r,0,1,-r,r,0,-1,r,0,1,-r,0,-1,-r,0,1],n=[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1];o.PolyhedronGeometry.call(this,i,n,e,t),this.type="IcosahedronGeometry",this.parameters={radius:e,detail:t}},o.IcosahedronGeometry.prototype=Object.create(o.PolyhedronGeometry.prototype),o.IcosahedronGeometry.prototype.constructor=o.IcosahedronGeometry,o.IcosahedronGeometry.prototype.clone=function(){var e=new o.IcosahedronGeometry(this.parameters.radius,this.parameters.detail);return e.copy(this),e},o.OctahedronGeometry=function(e,t){var r=[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],i=[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2];o.PolyhedronGeometry.call(this,r,i,e,t),this.type="OctahedronGeometry",this.parameters={radius:e,detail:t}},o.OctahedronGeometry.prototype=Object.create(o.PolyhedronGeometry.prototype),o.OctahedronGeometry.prototype.constructor=o.OctahedronGeometry,o.OctahedronGeometry.prototype.clone=function(){var e=new o.OctahedronGeometry(this.parameters.radius,this.parameters.detail);return e.copy(this),e},o.TetrahedronGeometry=function(e,t){var r=[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],i=[2,1,0,0,3,2,1,3,0,2,3,1];o.PolyhedronGeometry.call(this,r,i,e,t),this.type="TetrahedronGeometry",this.parameters={radius:e,detail:t}},o.TetrahedronGeometry.prototype=Object.create(o.PolyhedronGeometry.prototype),o.TetrahedronGeometry.prototype.constructor=o.TetrahedronGeometry,o.TetrahedronGeometry.prototype.clone=function(){var e=new o.TetrahedronGeometry(this.parameters.radius,this.parameters.detail);return e.copy(this),e},o.ParametricGeometry=function(e,t,r){o.Geometry.call(this),this.type="ParametricGeometry",this.parameters={func:e,slices:t,stacks:r};var i,n,a,s,h,c=this.vertices,u=this.faces,l=this.faceVertexUvs[0],p=t+1;for(i=0;r>=i;i++)for(h=i/r,n=0;t>=n;n++)s=n/t,a=e(s,h),c.push(a);var d,f,m,v,g,y,x,b;for(i=0;r>i;i++)for(n=0;t>n;n++)d=i*p+n,f=i*p+n+1,m=(i+1)*p+n+1,v=(i+1)*p+n,g=new o.Vector2(n/t,i/r),y=new o.Vector2((n+1)/t,i/r),x=new o.Vector2((n+1)/t,(i+1)/r),b=new o.Vector2(n/t,(i+1)/r),u.push(new o.Face3(d,f,v)),l.push([g,y,b]),u.push(new o.Face3(f,m,v)),l.push([y.clone(),x,b.clone()]);this.computeFaceNormals(),this.computeVertexNormals()},o.ParametricGeometry.prototype=Object.create(o.Geometry.prototype),o.ParametricGeometry.prototype.constructor=o.ParametricGeometry,o.WireframeGeometry=function(e){o.BufferGeometry.call(this);var t=[0,0],r={},i=function(e,t){return e-t},n=["a","b","c"];if(e instanceof o.Geometry){for(var a=e.vertices,s=e.faces,h=0,c=new Uint32Array(6*s.length),u=0,l=s.length;l>u;u++)for(var p=s[u],d=0;3>d;d++){t[0]=p[n[d]],t[1]=p[n[(d+1)%3]],t.sort(i);var f=t.toString();void 0===r[f]&&(c[2*h]=t[0],c[2*h+1]=t[1],r[f]=!0,h++)}for(var m=new Float32Array(2*h*3),u=0,l=h;l>u;u++)for(var d=0;2>d;d++){var v=a[c[2*u+d]],g=6*u+3*d;m[g+0]=v.x,m[g+1]=v.y,m[g+2]=v.z}this.addAttribute("position",new o.BufferAttribute(m,3))}else if(e instanceof o.BufferGeometry)if(null!==e.index){var y=e.index.array,a=e.attributes.position,x=e.drawcalls,h=0;0===x.length&&e.addDrawCall(0,y.length);for(var c=new Uint32Array(2*y.length),b=0,w=x.length;w>b;++b)for(var M=x[b],A=M.start,S=M.count,u=A,_=A+S;_>u;u+=3)for(var d=0;3>d;d++){t[0]=y[u+d],t[1]=y[u+(d+1)%3],t.sort(i);var f=t.toString();void 0===r[f]&&(c[2*h]=t[0],c[2*h+1]=t[1],r[f]=!0,h++)}for(var m=new Float32Array(2*h*3),u=0,l=h;l>u;u++)for(var d=0;2>d;d++){var g=6*u+3*d,E=c[2*u+d];m[g+0]=a.getX(E),m[g+1]=a.getY(E),m[g+2]=a.getZ(E)}this.addAttribute("position",new o.BufferAttribute(m,3))}else{for(var a=e.attributes.position.array,h=a.length/3,T=h/3,m=new Float32Array(2*h*3),u=0,l=T;l>u;u++)for(var d=0;3>d;d++){var g=18*u+6*d,C=9*u+3*d;m[g+0]=a[C],m[g+1]=a[C+1],m[g+2]=a[C+2];var E=9*u+3*((d+1)%3);m[g+3]=a[E],m[g+4]=a[E+1],m[g+5]=a[E+2]}this.addAttribute("position",new o.BufferAttribute(m,3))}},o.WireframeGeometry.prototype=Object.create(o.BufferGeometry.prototype),o.WireframeGeometry.prototype.constructor=o.WireframeGeometry,o.AxisHelper=function(e){e=e||1;var t=new Float32Array([0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e]),r=new Float32Array([1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1]),i=new o.BufferGeometry;i.addAttribute("position",new o.BufferAttribute(t,3)),i.addAttribute("color",new o.BufferAttribute(r,3));var n=new o.LineBasicMaterial({vertexColors:o.VertexColors});o.LineSegments.call(this,i,n)},o.AxisHelper.prototype=Object.create(o.LineSegments.prototype),o.AxisHelper.prototype.constructor=o.AxisHelper,o.ArrowHelper=function(){var e=new o.Geometry;e.vertices.push(new o.Vector3(0,0,0),new o.Vector3(0,1,0));var t=new o.CylinderGeometry(0,.5,1,5,1);return t.translate(0,-.5,0),function(r,i,n,a,s,h){o.Object3D.call(this),void 0===a&&(a=16776960),void 0===n&&(n=1),void 0===s&&(s=.2*n),void 0===h&&(h=.2*s),this.position.copy(i),n>s&&(this.line=new o.Line(e,new o.LineBasicMaterial({color:a})),this.line.matrixAutoUpdate=!1,this.add(this.line)),this.cone=new o.Mesh(t,new o.MeshBasicMaterial({color:a})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(r),this.setLength(n,s,h)}}(),o.ArrowHelper.prototype=Object.create(o.Object3D.prototype),o.ArrowHelper.prototype.constructor=o.ArrowHelper,o.ArrowHelper.prototype.setDirection=function(){var e,t=new o.Vector3;return function(r){r.y>.99999?this.quaternion.set(0,0,0,1):r.y<-.99999?this.quaternion.set(1,0,0,0):(t.set(r.z,0,-r.x).normalize(),e=Math.acos(r.y),this.quaternion.setFromAxisAngle(t,e))}}(),o.ArrowHelper.prototype.setLength=function(e,t,r){void 0===t&&(t=.2*e),void 0===r&&(r=.2*t),e>t&&(this.line.scale.set(1,e-t,1),this.line.updateMatrix()),this.cone.scale.set(r,t,r),this.cone.position.y=e,this.cone.updateMatrix()},o.ArrowHelper.prototype.setColor=function(e){void 0!==this.line&&this.line.material.color.set(e),this.cone.material.color.set(e)},o.BoxHelper=function(e){var t=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),r=new Float32Array(24),i=new o.BufferGeometry;i.addIndex(new o.BufferAttribute(t,1)),i.addAttribute("position",new o.BufferAttribute(r,3)),o.LineSegments.call(this,i,new o.LineBasicMaterial({color:16776960})),void 0!==e&&this.update(e)},o.BoxHelper.prototype=Object.create(o.LineSegments.prototype),o.BoxHelper.prototype.constructor=o.BoxHelper,o.BoxHelper.prototype.update=function(){var e=new o.Box3;return function(t){if(e.setFromObject(t),!e.empty()){var r=e.min,i=e.max,n=this.geometry.attributes.position,o=n.array;o[0]=i.x,o[1]=i.y,o[2]=i.z,o[3]=r.x,o[4]=i.y,o[5]=i.z,o[6]=r.x,o[7]=r.y,o[8]=i.z,o[9]=i.x,o[10]=r.y,o[11]=i.z,o[12]=i.x,o[13]=i.y,o[14]=r.z,o[15]=r.x,o[16]=i.y,o[17]=r.z,o[18]=r.x,o[19]=r.y,o[20]=r.z,o[21]=i.x,o[22]=r.y,o[23]=r.z,n.needsUpdate=!0,this.geometry.computeBoundingSphere()}}}(),o.BoundingBoxHelper=function(e,t){var r=void 0!==t?t:8947848;this.object=e,this.box=new o.Box3,o.Mesh.call(this,new o.BoxGeometry(1,1,1),new o.MeshBasicMaterial({color:r,wireframe:!0}))},o.BoundingBoxHelper.prototype=Object.create(o.Mesh.prototype),o.BoundingBoxHelper.prototype.constructor=o.BoundingBoxHelper,o.BoundingBoxHelper.prototype.update=function(){this.box.setFromObject(this.object),this.box.size(this.scale),this.box.center(this.position)},o.CameraHelper=function(e){function t(e,t,i){r(e,i),r(t,i)}function r(e,t){i.vertices.push(new o.Vector3),i.colors.push(new o.Color(t)),void 0===a[e]&&(a[e]=[]),a[e].push(i.vertices.length-1)}var i=new o.Geometry,n=new o.LineBasicMaterial({color:16777215,vertexColors:o.FaceColors}),a={},s=16755200,h=16711680,c=43775,u=16777215,l=3355443;t("n1","n2",s),t("n2","n4",s),t("n4","n3",s),t("n3","n1",s),t("f1","f2",s),t("f2","f4",s), +t("f4","f3",s),t("f3","f1",s),t("n1","f1",s),t("n2","f2",s),t("n3","f3",s),t("n4","f4",s),t("p","n1",h),t("p","n2",h),t("p","n3",h),t("p","n4",h),t("u1","u2",c),t("u2","u3",c),t("u3","u1",c),t("c","t",u),t("p","c",l),t("cn1","cn2",l),t("cn3","cn4",l),t("cf1","cf2",l),t("cf3","cf4",l),o.LineSegments.call(this,i,n),this.camera=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=a,this.update()},o.CameraHelper.prototype=Object.create(o.LineSegments.prototype),o.CameraHelper.prototype.constructor=o.CameraHelper,o.CameraHelper.prototype.update=function(){var e,t,r=new o.Vector3,i=new o.Camera,n=function(n,o,a,s){r.set(o,a,s).unproject(i);var h=t[n];if(void 0!==h)for(var c=0,u=h.length;u>c;c++)e.vertices[h[c]].copy(r)};return function(){e=this.geometry,t=this.pointMap;var r=1,o=1;i.projectionMatrix.copy(this.camera.projectionMatrix),n("c",0,0,-1),n("t",0,0,1),n("n1",-r,-o,-1),n("n2",r,-o,-1),n("n3",-r,o,-1),n("n4",r,o,-1),n("f1",-r,-o,1),n("f2",r,-o,1),n("f3",-r,o,1),n("f4",r,o,1),n("u1",.7*r,1.1*o,-1),n("u2",.7*-r,1.1*o,-1),n("u3",0,2*o,-1),n("cf1",-r,0,1),n("cf2",r,0,1),n("cf3",0,-o,1),n("cf4",0,o,1),n("cn1",-r,0,-1),n("cn2",r,0,-1),n("cn3",0,-o,-1),n("cn4",0,o,-1),e.verticesNeedUpdate=!0}}(),o.DirectionalLightHelper=function(e,t){o.Object3D.call(this),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,t=t||1;var r=new o.Geometry;r.vertices.push(new o.Vector3(-t,t,0),new o.Vector3(t,t,0),new o.Vector3(t,-t,0),new o.Vector3(-t,-t,0),new o.Vector3(-t,t,0));var i=new o.LineBasicMaterial({fog:!1});i.color.copy(this.light.color).multiplyScalar(this.light.intensity),this.lightPlane=new o.Line(r,i),this.add(this.lightPlane),r=new o.Geometry,r.vertices.push(new o.Vector3,new o.Vector3),i=new o.LineBasicMaterial({fog:!1}),i.color.copy(this.light.color).multiplyScalar(this.light.intensity),this.targetLine=new o.Line(r,i),this.add(this.targetLine),this.update()},o.DirectionalLightHelper.prototype=Object.create(o.Object3D.prototype),o.DirectionalLightHelper.prototype.constructor=o.DirectionalLightHelper,o.DirectionalLightHelper.prototype.dispose=function(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()},o.DirectionalLightHelper.prototype.update=function(){var e=new o.Vector3,t=new o.Vector3,r=new o.Vector3;return function(){e.setFromMatrixPosition(this.light.matrixWorld),t.setFromMatrixPosition(this.light.target.matrixWorld),r.subVectors(t,e),this.lightPlane.lookAt(r),this.lightPlane.material.color.copy(this.light.color).multiplyScalar(this.light.intensity),this.targetLine.geometry.vertices[1].copy(r),this.targetLine.geometry.verticesNeedUpdate=!0,this.targetLine.material.color.copy(this.lightPlane.material.color)}}(),o.EdgesHelper=function(e,t,r){var i=void 0!==t?t:16777215;o.LineSegments.call(this,new o.EdgesGeometry(e.geometry,r),new o.LineBasicMaterial({color:i})),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1},o.EdgesHelper.prototype=Object.create(o.LineSegments.prototype),o.EdgesHelper.prototype.constructor=o.EdgesHelper,o.FaceNormalsHelper=function(e,t,r,i){this.object=e,this.size=void 0!==t?t:1;var n=void 0!==r?r:16776960,a=void 0!==i?i:1,s=0,h=this.object.geometry;h instanceof o.Geometry?s=h.faces.length:console.warn("THREE.FaceNormalsHelper: only THREE.Geometry is supported. Use THREE.VertexNormalsHelper, instead.");var c=new o.BufferGeometry,u=new o.Float32Attribute(2*s*3,3);c.addAttribute("position",u),o.LineSegments.call(this,c,new o.LineBasicMaterial({color:n,linewidth:a})),this.matrixAutoUpdate=!1,this.update()},o.FaceNormalsHelper.prototype=Object.create(o.LineSegments.prototype),o.FaceNormalsHelper.prototype.constructor=o.FaceNormalsHelper,o.FaceNormalsHelper.prototype.update=function(){var e=new o.Vector3,t=new o.Vector3,r=new o.Matrix3;return function(){this.object.updateMatrixWorld(!0),r.getNormalMatrix(this.object.matrixWorld);for(var i=this.object.matrixWorld,n=this.geometry.attributes.position,o=this.object.geometry,a=o.vertices,s=o.faces,h=0,c=0,u=s.length;u>c;c++){var l=s[c],p=l.normal;e.copy(a[l.a]).add(a[l.b]).add(a[l.c]).divideScalar(3).applyMatrix4(i),t.copy(p).applyMatrix3(r).normalize().multiplyScalar(this.size).add(e),n.setXYZ(h,e.x,e.y,e.z),h+=1,n.setXYZ(h,t.x,t.y,t.z),h+=1}return n.needsUpdate=!0,this}}(),o.GridHelper=function(e,t){var r=new o.Geometry,i=new o.LineBasicMaterial({vertexColors:o.VertexColors});this.color1=new o.Color(4473924),this.color2=new o.Color(8947848);for(var n=-e;e>=n;n+=t){r.vertices.push(new o.Vector3(-e,0,n),new o.Vector3(e,0,n),new o.Vector3(n,0,-e),new o.Vector3(n,0,e));var a=0===n?this.color1:this.color2;r.colors.push(a,a,a,a)}o.LineSegments.call(this,r,i)},o.GridHelper.prototype=Object.create(o.LineSegments.prototype),o.GridHelper.prototype.constructor=o.GridHelper,o.GridHelper.prototype.setColors=function(e,t){this.color1.set(e),this.color2.set(t),this.geometry.colorsNeedUpdate=!0},o.HemisphereLightHelper=function(e,t){o.Object3D.call(this),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.colors=[new o.Color,new o.Color];var r=new o.SphereGeometry(t,4,2);r.rotateX(-Math.PI/2);for(var i=0,n=8;n>i;i++)r.faces[i].color=this.colors[4>i?0:1];var a=new o.MeshBasicMaterial({vertexColors:o.FaceColors,wireframe:!0});this.lightSphere=new o.Mesh(r,a),this.add(this.lightSphere),this.update()},o.HemisphereLightHelper.prototype=Object.create(o.Object3D.prototype),o.HemisphereLightHelper.prototype.constructor=o.HemisphereLightHelper,o.HemisphereLightHelper.prototype.dispose=function(){this.lightSphere.geometry.dispose(),this.lightSphere.material.dispose()},o.HemisphereLightHelper.prototype.update=function(){var e=new o.Vector3;return function(){this.colors[0].copy(this.light.color).multiplyScalar(this.light.intensity),this.colors[1].copy(this.light.groundColor).multiplyScalar(this.light.intensity),this.lightSphere.lookAt(e.setFromMatrixPosition(this.light.matrixWorld).negate()),this.lightSphere.geometry.colorsNeedUpdate=!0}}(),o.PointLightHelper=function(e,t){this.light=e,this.light.updateMatrixWorld();var r=new o.SphereGeometry(t,4,2),i=new o.MeshBasicMaterial({wireframe:!0,fog:!1});i.color.copy(this.light.color).multiplyScalar(this.light.intensity),o.Mesh.call(this,r,i),this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1},o.PointLightHelper.prototype=Object.create(o.Mesh.prototype),o.PointLightHelper.prototype.constructor=o.PointLightHelper,o.PointLightHelper.prototype.dispose=function(){this.geometry.dispose(),this.material.dispose()},o.PointLightHelper.prototype.update=function(){this.material.color.copy(this.light.color).multiplyScalar(this.light.intensity)},o.SkeletonHelper=function(e){this.bones=this.getBoneList(e);for(var t=new o.Geometry,r=0;rl;l++)for(var d=c[l],f=0,m=d.vertexNormals.length;m>f;f++){var v=h[d[i[f]]],g=d.vertexNormals[f];e.copy(v).applyMatrix4(n),t.copy(g).applyMatrix3(r).normalize().multiplyScalar(this.size).add(e),a.setXYZ(u,e.x,e.y,e.z),u+=1,a.setXYZ(u,t.x,t.y,t.z),u+=1}else if(s instanceof o.BufferGeometry)for(var y=s.attributes.position,x=s.attributes.normal,u=0,f=0,m=y.count;m>f;f++)e.set(y.getX(f),y.getY(f),y.getZ(f)).applyMatrix4(n),t.set(x.getX(f),x.getY(f),x.getZ(f)),t.applyMatrix3(r).normalize().multiplyScalar(this.size).add(e),a.setXYZ(u,e.x,e.y,e.z),u+=1,a.setXYZ(u,t.x,t.y,t.z),u+=1;return a.needsUpdate=!0,this}}(),o.WireframeHelper=function(e,t){var r=void 0!==t?t:16777215;o.LineSegments.call(this,new o.WireframeGeometry(e.geometry),new o.LineBasicMaterial({color:r})),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1},o.WireframeHelper.prototype=Object.create(o.LineSegments.prototype),o.WireframeHelper.prototype.constructor=o.WireframeHelper,o.ImmediateRenderObject=function(){o.Object3D.call(this),this.render=function(e){}},o.ImmediateRenderObject.prototype=Object.create(o.Object3D.prototype),o.ImmediateRenderObject.prototype.constructor=o.ImmediateRenderObject,o.MorphBlendMesh=function(e,t){o.Mesh.call(this,e,t),this.animationsMap={},this.animationsList=[];var r=this.geometry.morphTargets.length,i="__default",n=0,a=r-1,s=r/1;this.createAnimation(i,n,a,s),this.setAnimationWeight(i,1)},o.MorphBlendMesh.prototype=Object.create(o.Mesh.prototype),o.MorphBlendMesh.prototype.constructor=o.MorphBlendMesh,o.MorphBlendMesh.prototype.createAnimation=function(e,t,r,i){var n={start:t,end:r,length:r-t+1,fps:i,duration:(r-t)/i,lastFrame:0,currentFrame:0,active:!1,time:0,direction:1,weight:1,directionBackwards:!1,mirroredLoop:!1};this.animationsMap[e]=n,this.animationsList.push(n)},o.MorphBlendMesh.prototype.autoCreateAnimations=function(e){for(var t,r=/([a-z]+)_?(\d+)/,i={},n=this.geometry,o=0,a=n.morphTargets.length;a>o;o++){var s=n.morphTargets[o],h=s.name.match(r);if(h&&h.length>1){var c=h[1];i[c]||(i[c]={start:1/0,end:-(1/0)});var u=i[c];ou.end&&(u.end=o),t||(t=c)}}for(var c in i){var u=i[c];this.createAnimation(c,u.start,u.end,e)}this.firstAnimation=t},o.MorphBlendMesh.prototype.setAnimationDirectionForward=function(e){var t=this.animationsMap[e];t&&(t.direction=1,t.directionBackwards=!1)},o.MorphBlendMesh.prototype.setAnimationDirectionBackward=function(e){var t=this.animationsMap[e];t&&(t.direction=-1,t.directionBackwards=!0)},o.MorphBlendMesh.prototype.setAnimationFPS=function(e,t){var r=this.animationsMap[e];r&&(r.fps=t,r.duration=(r.end-r.start)/r.fps)},o.MorphBlendMesh.prototype.setAnimationDuration=function(e,t){var r=this.animationsMap[e];r&&(r.duration=t,r.fps=(r.end-r.start)/r.duration)},o.MorphBlendMesh.prototype.setAnimationWeight=function(e,t){var r=this.animationsMap[e];r&&(r.weight=t)},o.MorphBlendMesh.prototype.setAnimationTime=function(e,t){var r=this.animationsMap[e];r&&(r.time=t)},o.MorphBlendMesh.prototype.getAnimationTime=function(e){var t=0,r=this.animationsMap[e];return r&&(t=r.time),t},o.MorphBlendMesh.prototype.getAnimationDuration=function(e){var t=-1,r=this.animationsMap[e];return r&&(t=r.duration),t},o.MorphBlendMesh.prototype.playAnimation=function(e){var t=this.animationsMap[e];t?(t.time=0,t.active=!0):console.warn("THREE.MorphBlendMesh: animation["+e+"] undefined in .playAnimation()")},o.MorphBlendMesh.prototype.stopAnimation=function(e){var t=this.animationsMap[e];t&&(t.active=!1)},o.MorphBlendMesh.prototype.update=function(e){for(var t=0,r=this.animationsList.length;r>t;t++){var i=this.animationsList[t];if(i.active){var n=i.duration/i.length;i.time+=i.direction*e,i.mirroredLoop?(i.time>i.duration||i.time<0)&&(i.direction*=-1,i.time>i.duration&&(i.time=i.duration,i.directionBackwards=!0),i.time<0&&(i.time=0,i.directionBackwards=!1)):(i.time=i.time%i.duration,i.time<0&&(i.time+=i.duration));var a=i.start+o.Math.clamp(Math.floor(i.time/n),0,i.length-1),s=i.weight;a!==i.currentFrame&&(this.morphTargetInfluences[i.lastFrame]=0,this.morphTargetInfluences[i.currentFrame]=1*s,this.morphTargetInfluences[a]=0,i.lastFrame=i.currentFrame,i.currentFrame=a);var h=i.time%n/n;i.directionBackwards&&(h=1-h),i.currentFrame!==i.lastFrame?(this.morphTargetInfluences[i.currentFrame]=h*s,this.morphTargetInfluences[i.lastFrame]=(1-h)*s):this.morphTargetInfluences[i.currentFrame]=s}}}},function(e,t,r){function i(e,t){return function(r,i,n){return"function"==typeof i&&void 0===n&&s(r)?e(r,i):t(r,a(i,n,3))}}var n=r(10),o=r(11),a=r(16),s=r(14),h=i(n,o);e.exports=h},function(e,t){function r(e,t){for(var r=-1,i=e.length;++r-1&&e%1==0&&l>=e}function h(e){return c(e)?e:Object(e)}function c(e){var t=typeof e;return"function"==t||!!e&&"object"==t}var u=r(12),l=Math.pow(2,53)-1,p=o(i),d=a(),f=n("length");e.exports=p},function(e,t,r){function i(e,t){return e=+e,t=null==t?m:t,e>-1&&e%1==0&&t>e}function n(e){return"number"==typeof e&&e>-1&&e%1==0&&m>=e}function o(e){for(var t=s(e),r=t.length,o=r&&e.length,a=o&&n(o)&&(c(e)||v.nonEnumArgs&&h(e)),u=-1,l=[];++u0;++o-1&&e%1==0&&h>=e}function n(e){var t=r(e)?e.length:void 0;return i(t)&&s.call(e)==o}var o="[object Arguments]",a=Object.prototype,s=a.toString,h=Math.pow(2,53)-1;e.exports=n},function(e,t){function r(e){return"string"==typeof e?e:null==e?"":e+""}function i(e){return!!e&&"object"==typeof e}function n(e){return"number"==typeof e&&e>-1&&e%1==0&&g>=e}function o(e){return null==e?!1:f.call(e)==h?m.test(d.call(e)):i(e)&&l.test(e)}function a(e){return e=r(e),e&&u.test(e)?e.replace(c,"\\$&"):e}var s="[object Array]",h="[object Function]",c=/[.*+?^${}()|[\]\/\\]/g,u=RegExp(c.source),l=/^\[object .+?Constructor\]$/,p=Object.prototype,d=Function.prototype.toString,f=p.toString,m=RegExp("^"+a(f).replace(/toString|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),v=o(v=Array.isArray)&&v,g=Math.pow(2,53)-1,y=v||function(e){return i(e)&&n(e.length)&&f.call(e)==s};e.exports=y},function(e,t){function r(e){return"string"==typeof e?e:null==e?"":e+""}function i(e){return!!e&&"object"==typeof e}function n(e){return null==e?!1:p.call(e)==a?d.test(l.call(e)):i(e)&&c.test(e)}function o(e){return e=r(e),e&&h.test(e)?e.replace(s,"\\$&"):e}var a="[object Function]",s=/[.*+?^${}()|[\]\/\\]/g,h=RegExp(s.source),c=/^\[object .+?Constructor\]$/,u=Object.prototype,l=Function.prototype.toString,p=u.toString,d=RegExp("^"+o(p).replace(/toString|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");e.exports=n},function(e,t){function r(e,t,r){if("function"!=typeof e)return i;if(void 0===t)return e;switch(r){case 1:return function(r){return e.call(t,r)};case 3:return function(r,i,n){return e.call(t,r,i,n)};case 4:return function(r,i,n,o){return e.call(t,r,i,n,o)};case 5:return function(r,i,n,o,a){return e.call(t,r,i,n,o,a)}}return function(){return e.apply(t,arguments)}}function i(e){return e}e.exports=r},function(e,t,r){function i(e,t,r){for(var i=-1,n=a(t),o=n.length;++i-1&&e%1==0&&t>e}function a(e){return"number"==typeof e&&e>-1&&e%1==0&&g>=e}function s(e){for(var t=c(e),r=t.length,i=r&&e.length,n=!!i&&a(i)&&(p(e)||l(e)),s=-1,h=[];++s0;++i-1&&e%1==0&&u>=e}function a(e){return r(e)&&n(e)&&h.call(e,"callee")&&!c.call(e,"callee")}var s=Object.prototype,h=s.hasOwnProperty,c=s.propertyIsEnumerable,u=9007199254740991,l=i("length");e.exports=a},function(e,t){function r(e){return!!e&&"object"==typeof e}function i(e,t){var r=null==e?void 0:e[t];return s(r)?r:void 0}function n(e){return"number"==typeof e&&e>-1&&e%1==0&&g>=e}function o(e){return a(e)&&f.call(e)==c}function a(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function s(e){return null==e?!1:o(e)?m.test(p.call(e)):r(e)&&u.test(e)}var h="[object Array]",c="[object Function]",u=/^\[object .+?Constructor\]$/,l=Object.prototype,p=Function.prototype.toString,d=l.hasOwnProperty,f=l.toString,m=RegExp("^"+p.call(d).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),v=i(Array,"isArray"),g=9007199254740991,y=v||function(e){return r(e)&&n(e.length)&&f.call(e)==h};e.exports=y},function(e,t,r){function i(e){return a(function(t,r){var i=-1,a=null==t?0:r.length,s=a>2?r[a-2]:void 0,h=a>2?r[2]:void 0,c=a>1?r[a-1]:void 0;for("function"==typeof s?(s=n(s,c,5),a-=2):(s="function"==typeof c?c:void 0,a-=s?1:0),h&&o(r[0],r[1],h)&&(s=3>a?void 0:s,a=1);++i-1&&e%1==0&&t>e}function o(e,t,r){if(!s(r))return!1;var o=typeof t;if("number"==o?i(r)&&n(t,r.length):"string"==o&&t in r){var a=r[t];return e===e?e===a:a!==a}return!1}function a(e){return"number"==typeof e&&e>-1&&e%1==0&&c>=e}function s(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}var h=/^\d+$/,c=9007199254740991,u=r("length");e.exports=o},function(e,t){function r(e,t){if("function"!=typeof e)throw new TypeError(i);return t=n(void 0===t?e.length-1:+t||0,0),function(){for(var r=arguments,i=-1,o=n(r.length-t,0),a=Array(o);++ir;r++);},t.findObject=function(e){return e instanceof t?e:e&&e instanceof o.Object3D?p.get?p.get(e):p[e.id]:void 0},t}()},function(e,t,r){"use strict";var i,n,o,a,s,h,c,u=r(45),l=r(58),p=Function.prototype.apply,d=Function.prototype.call,f=Object.create,m=Object.defineProperty,v=Object.defineProperties,g=Object.prototype.hasOwnProperty,y={configurable:!0,enumerable:!1,writable:!0};i=function(e,t){var r;return l(t),g.call(this,"__ee__")?r=this.__ee__:(r=y.value=f(null),m(this,"__ee__",y),y.value=null),r[e]?"object"==typeof r[e]?r[e].push(t):r[e]=[r[e],t]:r[e]=t,this},n=function(e,t){var r,n;return l(t),n=this,i.call(this,e,r=function(){o.call(n,e,r),p.call(t,this,arguments)}),r.__eeOnceListener__=t,this},o=function(e,t){var r,i,n,o;if(l(t),!g.call(this,"__ee__"))return this;if(r=this.__ee__,!r[e])return this;if(i=r[e],"object"==typeof i)for(o=0;n=i[o];++o)(n===t||n.__eeOnceListener__===t)&&(2===i.length?r[e]=i[o?0:1]:i.splice(o,1));else(i===t||i.__eeOnceListener__===t)&&delete r[e];return this},a=function(e){var t,r,i,n,o;if(g.call(this,"__ee__")&&(n=this.__ee__[e]))if("object"==typeof n){for(r=arguments.length,o=new Array(r-1),t=1;r>t;++t)o[t-1]=arguments[t];for(n=n.slice(),t=0;i=n[t];++t)p.call(i,this,o)}else switch(arguments.length){case 1:d.call(n,this);break;case 2:d.call(n,this,arguments[1]);break;case 3:d.call(n,this,arguments[1],arguments[2]);break;default:for(r=arguments.length,o=new Array(r-1),t=1;r>t;++t)o[t-1]=arguments[t];p.call(n,this,o)}},s={on:i,once:n,off:o,emit:a},h={on:u(i),once:u(n),off:u(o),emit:u(a)},c=v({},h),e.exports=t=function(e){return null==e?f(c):v(Object(e),h)},t.methods=s},function(e,t,r){"use strict";var i,n=r(46),o=r(53),a=r(54),s=r(55);i=e.exports=function(e,t){var r,i,a,h,c;return arguments.length<2||"string"!=typeof e?(h=t,t=e,e=null):h=arguments[2],null==e?(r=a=!0,i=!1):(r=s.call(e,"c"),i=s.call(e,"e"),a=s.call(e,"w")),c={value:t,configurable:r,enumerable:i,writable:a},h?n(o(h),c):c},i.gs=function(e,t,r){var i,h,c,u;return"string"!=typeof e?(c=r,r=t,t=e,e=null):c=arguments[3],null==t?t=void 0:a(t)?null==r?r=void 0:a(r)||(c=r,r=void 0):(c=t,t=r=void 0),null==e?(i=!0,h=!1):(i=s.call(e,"c"),h=s.call(e,"e")),u={get:t,set:r,configurable:i,enumerable:h},c?n(o(c),u):u}},function(e,t,r){"use strict";e.exports=r(47)()?Object.assign:r(48)},function(e,t){"use strict";e.exports=function(){var e,t=Object.assign;return"function"!=typeof t?!1:(e={foo:"raz"},t(e,{bar:"dwa"},{trzy:"trzy"}),e.foo+e.bar+e.trzy==="razdwatrzy")}},function(e,t,r){"use strict";var i=r(49),n=r(52),o=Math.max;e.exports=function(e,t){var r,a,s,h=o(arguments.length,2);for(e=Object(n(e)),s=function(i){try{e[i]=t[i]}catch(n){r||(r=n)}},a=1;h>a;++a)t=arguments[a],i(t).forEach(s);if(void 0!==r)throw r;return e}},function(e,t,r){"use strict";e.exports=r(50)()?Object.keys:r(51)},function(e,t){"use strict";e.exports=function(){try{return Object.keys("primitive"),!0}catch(e){return!1}}},function(e,t){"use strict";var r=Object.keys;e.exports=function(e){return r(null==e?e:Object(e))}},function(e,t){"use strict";e.exports=function(e){if(null==e)throw new TypeError("Cannot use null or undefined");return e}},function(e,t){"use strict";var r=Array.prototype.forEach,i=Object.create,n=function(e,t){var r;for(r in e)t[r]=e[r]};e.exports=function(e){var t=i(null);return r.call(arguments,function(e){null!=e&&n(Object(e),t)}),t}},function(e,t){"use strict";e.exports=function(e){return"function"==typeof e}},function(e,t,r){"use strict";e.exports=r(56)()?String.prototype.contains:r(57)},function(e,t){"use strict";var r="razdwatrzy";e.exports=function(){return"function"!=typeof r.contains?!1:r.contains("dwa")===!0&&r.contains("foo")===!1}},function(e,t){"use strict";var r=String.prototype.indexOf;e.exports=function(e){return r.call(this,e,arguments[1])>-1}},function(e,t){"use strict";e.exports=function(e){if("function"!=typeof e)throw new TypeError(e+" is not a function");return e}},function(e,t,r){e.exports=function(){"use strict";var e=(r(7),r(8));return function(t,r){var i=new e.Object3D;return i.name="empty",t.add(i),i}}()},function(e,t,r){var i=r(8);i.DeviceOrientationControls=function(e){var t=this;this.object=e,this.object.rotation.reorder("YXZ"),this.enabled=!0,this.deviceOrientation={},this.screenOrientation=0;var r=function(e){t.deviceOrientation=e; +},n=function(){t.screenOrientation=window.orientation||0},o=function(){var e=new i.Vector3(0,0,1),t=new i.Euler,r=new i.Quaternion,n=new i.Quaternion(-Math.sqrt(.5),0,0,Math.sqrt(.5));return function(i,o,a,s,h){t.set(a,o,-s,"YXZ"),i.setFromEuler(t),i.multiply(n),i.multiply(r.setFromAxisAngle(e,-h))}}();this.connect=function(){n(),window.addEventListener("orientationchange",n,!1),window.addEventListener("deviceorientation",r,!1),t.enabled=!0},this.disconnect=function(){window.removeEventListener("orientationchange",n,!1),window.removeEventListener("deviceorientation",r,!1),t.enabled=!1},this.update=function(){if(t.enabled!==!1){var e=t.deviceOrientation.alpha?i.Math.degToRad(t.deviceOrientation.alpha):0,r=t.deviceOrientation.beta?i.Math.degToRad(t.deviceOrientation.beta):0,n=t.deviceOrientation.gamma?i.Math.degToRad(t.deviceOrientation.gamma):0,a=t.screenOrientation?i.Math.degToRad(t.screenOrientation):0;o(t.object.quaternion,e,r,n,a)}},this.connect()}},function(e,t,r){var i=r(8);i.OrbitControls=function(e,t){function r(){return 2*Math.PI/60/60*m.autoRotateSpeed}function n(){return Math.pow(.95,m.zoomSpeed)}function o(e){if(m.enabled!==!1){if(e.preventDefault(),e.button===m.mouseButtons.ORBIT){if(m.noRotate===!0)return;U=O.ROTATE,g.set(e.clientX,e.clientY)}else if(e.button===m.mouseButtons.ZOOM){if(m.noZoom===!0)return;U=O.DOLLY,_.set(e.clientX,e.clientY)}else if(e.button===m.mouseButtons.PAN){if(m.noPan===!0)return;U=O.PAN,b.set(e.clientX,e.clientY)}U!==O.NONE&&(document.addEventListener("mousemove",a,!1),document.addEventListener("mouseup",s,!1),m.dispatchEvent(G))}}function a(e){if(m.enabled!==!1){e.preventDefault();var t=m.domElement===document?m.domElement.body:m.domElement;if(U===O.ROTATE){if(m.noRotate===!0)return;y.set(e.clientX,e.clientY),x.subVectors(y,g),m.rotateLeft(2*Math.PI*x.x/t.clientWidth*m.rotateSpeed),m.rotateUp(2*Math.PI*x.y/t.clientHeight*m.rotateSpeed),g.copy(y)}else if(U===O.DOLLY){if(m.noZoom===!0)return;E.set(e.clientX,e.clientY),T.subVectors(E,_),T.y>0?m.dollyIn():m.dollyOut(),_.copy(E)}else if(U===O.PAN){if(m.noPan===!0)return;w.set(e.clientX,e.clientY),M.subVectors(w,b),m.pan(M.x,M.y),b.copy(w)}U!==O.NONE&&m.update()}}function s(){m.enabled!==!1&&(document.removeEventListener("mousemove",a,!1),document.removeEventListener("mouseup",s,!1),m.dispatchEvent(z),U=O.NONE)}function h(e){if(m.enabled!==!1&&m.noZoom!==!0&&U===O.NONE){e.preventDefault(),e.stopPropagation();var t=0;void 0!==e.wheelDelta?t=e.wheelDelta:void 0!==e.detail&&(t=-e.detail),t>0?m.dollyOut():m.dollyIn(),m.update(),m.dispatchEvent(G),m.dispatchEvent(z)}}function c(e){if(m.enabled!==!1&&m.noKeys!==!0&&m.noPan!==!0)switch(e.keyCode){case m.keys.UP:m.pan(0,m.keyPanSpeed),m.update();break;case m.keys.BOTTOM:m.pan(0,-m.keyPanSpeed),m.update();break;case m.keys.LEFT:m.pan(m.keyPanSpeed,0),m.update();break;case m.keys.RIGHT:m.pan(-m.keyPanSpeed,0),m.update()}}function u(e){if(m.enabled!==!1){switch(e.touches.length){case 1:if(m.noRotate===!0)return;U=O.TOUCH_ROTATE,g.set(e.touches[0].pageX,e.touches[0].pageY);break;case 2:if(m.noZoom===!0)return;U=O.TOUCH_DOLLY;var t=e.touches[0].pageX-e.touches[1].pageX,r=e.touches[0].pageY-e.touches[1].pageY,i=Math.sqrt(t*t+r*r);_.set(0,i);break;case 3:if(m.noPan===!0)return;U=O.TOUCH_PAN,b.set(e.touches[0].pageX,e.touches[0].pageY);break;default:U=O.NONE}U!==O.NONE&&m.dispatchEvent(G)}}function l(e){if(m.enabled!==!1){e.preventDefault(),e.stopPropagation();var t=m.domElement===document?m.domElement.body:m.domElement;switch(e.touches.length){case 1:if(m.noRotate===!0)return;if(U!==O.TOUCH_ROTATE)return;y.set(e.touches[0].pageX,e.touches[0].pageY),x.subVectors(y,g),m.rotateLeft(2*Math.PI*x.x/t.clientWidth*m.rotateSpeed),m.rotateUp(2*Math.PI*x.y/t.clientHeight*m.rotateSpeed),g.copy(y),m.update();break;case 2:if(m.noZoom===!0)return;if(U!==O.TOUCH_DOLLY)return;var r=e.touches[0].pageX-e.touches[1].pageX,i=e.touches[0].pageY-e.touches[1].pageY,n=Math.sqrt(r*r+i*i);E.set(0,n),T.subVectors(E,_),T.y>0?m.dollyOut():m.dollyIn(),_.copy(E),m.update();break;case 3:if(m.noPan===!0)return;if(U!==O.TOUCH_PAN)return;w.set(e.touches[0].pageX,e.touches[0].pageY),M.subVectors(w,b),m.pan(M.x,M.y),b.copy(w),m.update();break;default:U=O.NONE}}}function p(){m.enabled!==!1&&(m.dispatchEvent(z),U=O.NONE)}this.object=e,this.domElement=void 0!==t?t:document,this.enabled=!0,this.target=new i.Vector3,this.center=this.target,this.noZoom=!1,this.zoomSpeed=1,this.minDistance=0,this.maxDistance=1/0,this.noRotate=!1,this.rotateSpeed=1,this.noPan=!1,this.keyPanSpeed=7,this.autoRotate=!1,this.autoRotateSpeed=2,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-(1/0),this.maxAzimuthAngle=1/0,this.noKeys=!1,this.keys={LEFT:37,UP:38,RIGHT:39,BOTTOM:40},this.mouseButtons={ORBIT:i.MOUSE.LEFT,ZOOM:i.MOUSE.MIDDLE,PAN:i.MOUSE.RIGHT};var d,f,m=this,v=1e-6,g=new i.Vector2,y=new i.Vector2,x=new i.Vector2,b=new i.Vector2,w=new i.Vector2,M=new i.Vector2,A=new i.Vector3,S=new i.Vector3,_=new i.Vector2,E=new i.Vector2,T=new i.Vector2,C=0,L=0,P=1,R=new i.Vector3,D=new i.Vector3,F=new i.Quaternion,O={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_DOLLY:4,TOUCH_PAN:5},U=O.NONE;this.target0=this.target.clone(),this.position0=this.object.position.clone();var k=(new i.Quaternion).setFromUnitVectors(e.up,new i.Vector3(0,1,0)),B=k.clone().inverse(),V={type:"change"},G={type:"start"},z={type:"end"};this.rotateLeft=function(e){void 0===e&&(e=r()),L-=e},this.rotateUp=function(e){void 0===e&&(e=r()),C-=e},this.panLeft=function(e){var t=this.object.matrix.elements;A.set(t[0],t[1],t[2]),A.multiplyScalar(-e),R.add(A)},this.panUp=function(e){var t=this.object.matrix.elements;A.set(t[4],t[5],t[6]),A.multiplyScalar(e),R.add(A)},this.pan=function(e,t){var r=m.domElement===document?m.domElement.body:m.domElement;if(void 0!==m.object.fov){var i=m.object.position,n=i.clone().sub(m.target),o=n.length();o*=Math.tan(m.object.fov/2*Math.PI/180),m.panLeft(2*e*o/r.clientHeight),m.panUp(2*t*o/r.clientHeight)}else void 0!==m.object.top?(m.panLeft(e*(m.object.right-m.object.left)/r.clientWidth),m.panUp(t*(m.object.top-m.object.bottom)/r.clientHeight)):console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled.")},this.dollyIn=function(e){void 0===e&&(e=n()),P/=e},this.dollyOut=function(e){void 0===e&&(e=n()),P*=e},this.update=function(){var e=this.object.position;S.copy(e).sub(this.target),S.applyQuaternion(k),d=Math.atan2(S.x,S.z),f=Math.atan2(Math.sqrt(S.x*S.x+S.z*S.z),S.y),this.autoRotate&&U===O.NONE&&this.rotateLeft(r()),d+=L,f+=C,d=Math.max(this.minAzimuthAngle,Math.min(this.maxAzimuthAngle,d)),f=Math.max(this.minPolarAngle,Math.min(this.maxPolarAngle,f)),f=Math.max(v,Math.min(Math.PI-v,f));var t=S.length()*P;t=Math.max(this.minDistance,Math.min(this.maxDistance,t)),this.target.add(R),S.x=t*Math.sin(f)*Math.sin(d),S.y=t*Math.cos(f),S.z=t*Math.sin(f)*Math.cos(d),S.applyQuaternion(B),e.copy(this.target).add(S),this.object.lookAt(this.target),L=0,C=0,P=1,R.set(0,0,0),(D.distanceToSquared(this.object.position)>v||8*(1-F.dot(this.object.quaternion))>v)&&(this.dispatchEvent(V),D.copy(this.object.position),F.copy(this.object.quaternion))},this.reset=function(){U=O.NONE,this.target.copy(this.target0),this.object.position.copy(this.position0),this.update()},this.getPolarAngle=function(){return f},this.getAzimuthalAngle=function(){return d},this.domElement.addEventListener("contextmenu",function(e){e.preventDefault()},!1),this.domElement.addEventListener("mousedown",o,!1),this.domElement.addEventListener("mousewheel",h,!1),this.domElement.addEventListener("DOMMouseScroll",h,!1),this.domElement.addEventListener("touchstart",u,!1),this.domElement.addEventListener("touchend",p,!1),this.domElement.addEventListener("touchmove",l,!1),window.addEventListener("keydown",c,!1),this.update()},i.OrbitControls.prototype=Object.create(i.EventDispatcher.prototype),i.OrbitControls.prototype.constructor=i.OrbitControls},function(e,t,r){var i=r(8);!function(){function e(e,t){r.push({type:e,format:t})}var t=console.log,r=[];e(i.Matrix4,function(e){var t=e.elements;return[[t[0],t[1],t[2],t[3]],[t[4],t[5],t[6],t[7]],[t[8],t[9],t[10],t[11]],[t[12],t[13],t[14],t[15]]]}),e(i.Matrix3,function(e){var t=e.elements;return[[t[0],t[1],t[2]],[t[3],t[4],t[5]],[t[6],t[7],t[8]]]}),e(i.Vector2,function(e){return{Vector2:{x:e.x,y:e.y}}}),e(i.Vector3,function(e){return{Vector3:{x:e.x,y:e.y,z:e.z}}}),e(i.Vector4,function(e){return{Vector4:{x:e.x,y:e.y,z:e.z,w:e.w}}}),e(i.Euler,function(e){return{Vector4:{x:e.x,y:e.y,z:e.z,order:e.order}}}),e(i.Ray,function(e){return{"Ray origin":{x:e.origin.x,y:e.origin.y,z:e.origin.z},"Ray direction":{x:e.direction.x,y:e.direction.y,z:e.direction.z}}}),console.log=function(){var e=!1;[].forEach.call(arguments,function(t){r.forEach(function(r){t instanceof r.type&&(e=!0)})}),e?[].forEach.call(arguments,function(e){t.apply(console,[e]),r.forEach(function(t){e instanceof t.type&&console.table(t.format(e))})}):t.apply(console,arguments)}}()},function(e,t,r){var i=r(8);i.VRStereoEffect=function(e,t,r){function n(e,t,r){var n=new i.Matrix4,o=n.elements,a=Math.tan(e.upDegrees*R),s=Math.tan(e.downDegrees*R),h=Math.tan(e.leftDegrees*R),c=Math.tan(e.rightDegrees*R),u=2/(h+c),l=2/(a+s);return o[0]=u,o[4]=0,o[8]=-((h-c)*u*.5),o[12]=0,o[1]=0,o[5]=l,o[9]=(a-s)*l*.5,o[13]=0,o[2]=0,o[6]=0,o[10]=r/(t-r),o[14]=r*t/(t-r),o[3]=0,o[7]=0,o[11]=-1,o[15]=0,n}function o(){var t,r;l&&p?(t=c,r=u):(t=v||e.domElement.offsetWidth||window.innerWidth,r=g||e.domElement.offsetHeight||window.innerHeight),e.setSize(t,r)}function a(){var e,t,r,i,a,s,h,p;return l?(l.getEyeParameters?(r=l.getEyeParameters("left"),i=l.getEyeParameters("right"),a=r.renderRect,s=i.renderRect,c=s.x+s.width,u=Math.max(a.y+a.height,s.y+s.height),e=r.currentFieldOfView,t=i.currentFieldOfView,l.setFieldOfView(e,t,C,L),x.copy(r.eyeTranslation),b.copy(i.eyeTranslation),E=r.renderRect,T=i.renderRect):l.getRecommendedEyeRenderRect&&(h=l.getRecommendedEyeRenderRect("left"),p=l.getRecommendedEyeRenderRect("right"),c=h.width+p.width,u=Math.max(h.height,p.height),l.getCurrentEyeFieldOfView?(e=l.getCurrentEyeFieldOfView("left"),t=l.getCurrentEyeFieldOfView("right")):(e=l.getRecommendedEyeFieldOfView("left"),t=l.getRecommendedEyeFieldOfView("right")),x.copy(l.getEyeTranslation("left")),b.copy(l.getEyeTranslation("right")),E.x=h.left,E.y=h.top,E.width=h.width,E.height=h.height,T.x=p.left,T.y=p.top,T.width=p.width,T.height=p.height),o(),S.projectionMatrix=n(e,C,L),void(_.projectionMatrix=n(t,C,L))):(S.fov=80,void(_.fov=80))}function s(e){var t,r;for(t=0;t degrees, and the cosine of that","// earth shadow hack","const float cutoffAngle = pi/1.95;","const float steepness = 1.5;","vec3 totalRayleigh(vec3 lambda)","{","return (8.0 * pow(pi, 3.0) * pow(pow(n, 2.0) - 1.0, 2.0) * (6.0 + 3.0 * pn)) / (3.0 * N * pow(lambda, vec3(4.0)) * (6.0 - 7.0 * pn));","}","// A simplied version of the total Reayleigh scattering to works on browsers that use ANGLE","vec3 simplifiedRayleigh()","{","return 0.0005 / vec3(94, 40, 18);","}","float rayleighPhase(float cosTheta)","{ ","return (3.0 / (16.0*pi)) * (1.0 + pow(cosTheta, 2.0));","// return (1.0 / (3.0*pi)) * (1.0 + pow(cosTheta, 2.0));","// return (3.0 / 4.0) * (1.0 + pow(cosTheta, 2.0));","}","vec3 totalMie(vec3 lambda, vec3 K, float T)","{","float c = (0.2 * T ) * 10E-18;","return 0.434 * c * pi * pow((2.0 * pi) / lambda, vec3(v - 2.0)) * K;","}","float hgPhase(float cosTheta, float g)","{","return (1.0 / (4.0*pi)) * ((1.0 - pow(g, 2.0)) / pow(1.0 - 2.0*g*cosTheta + pow(g, 2.0), 1.5));","}","float sunIntensity(float zenithAngleCos)","{","return EE * max(0.0, 1.0 - exp(-((cutoffAngle - acos(zenithAngleCos))/steepness)));","}","// float logLuminance(vec3 c)","// {","// return log(c.r * 0.2126 + c.g * 0.7152 + c.b * 0.0722);","// }","// Filmic ToneMapping http://filmicgames.com/archives/75","float A = 0.15;","float B = 0.50;","float C = 0.10;","float D = 0.20;","float E = 0.02;","float F = 0.30;","float W = 1000.0;","vec3 Uncharted2Tonemap(vec3 x)","{","return ((x*(A*x+C*B)+D*E)/(x*(A*x+B)+D*F))-E/F;","}","void main() ","{","float sunfade = 1.0-clamp(1.0-exp((sunPosition.y/450000.0)),0.0,1.0);","// luminance = 1.0 ;// vWorldPosition.y / 450000. + 0.5; //sunPosition.y / 450000. * 1. + 0.5;","// gl_FragColor = vec4(sunfade, sunfade, sunfade, 1.0);","reileighCoefficient = reileighCoefficient - (1.0* (1.0-sunfade));","float sunE = sunIntensity(dot(sunDirection, up));","// extinction (absorbtion + out scattering) ","// rayleigh coefficients","vec3 betaR = simplifiedRayleigh() * reileighCoefficient;","// mie coefficients","vec3 betaM = totalMie(lambda, K, turbidity) * mieCoefficient;","// optical length","// cutoff angle at 90 to avoid singularity in next formula.","float zenithAngle = acos(max(0.0, dot(up, normalize(vWorldPosition - cameraPos))));","float sR = rayleighZenithLength / (cos(zenithAngle) + 0.15 * pow(93.885 - ((zenithAngle * 180.0) / pi), -1.253));","float sM = mieZenithLength / (cos(zenithAngle) + 0.15 * pow(93.885 - ((zenithAngle * 180.0) / pi), -1.253));","// combined extinction factor ","vec3 Fex = exp(-(betaR * sR + betaM * sM));","// in scattering","float cosTheta = dot(normalize(vWorldPosition - cameraPos), sunDirection);","float rPhase = rayleighPhase(cosTheta*0.5+0.5);","vec3 betaRTheta = betaR * rPhase;","float mPhase = hgPhase(cosTheta, mieDirectionalG);","vec3 betaMTheta = betaM * mPhase;","vec3 Lin = pow(sunE * ((betaRTheta + betaMTheta) / (betaR + betaM)) * (1.0 - Fex),vec3(1.5));","Lin *= mix(vec3(1.0),pow(sunE * ((betaRTheta + betaMTheta) / (betaR + betaM)) * Fex,vec3(1.0/2.0)),clamp(pow(1.0-dot(up, sunDirection),5.0),0.0,1.0));","//nightsky","vec3 direction = normalize(vWorldPosition - cameraPos);","float theta = acos(direction.y); // elevation --> y-axis, [-pi/2, pi/2]","float phi = atan(direction.z, direction.x); // azimuth --> x-axis [-pi/2, pi/2]","vec2 uv = vec2(phi, theta) / vec2(2.0*pi, pi) + vec2(0.5, 0.0);","// vec3 L0 = texture2D(skySampler, uv).rgb+0.1 * Fex;","vec3 L0 = vec3(0.1) * Fex;","// composition + solar disc","//if (cosTheta > sunAngularDiameterCos)","float sundisk = smoothstep(sunAngularDiameterCos,sunAngularDiameterCos+0.00002,cosTheta);","// if (normalize(vWorldPosition - cameraPos).y>0.0)","L0 += (sunE * 19000.0 * Fex)*sundisk;","vec3 whiteScale = 1.0/Uncharted2Tonemap(vec3(W));","vec3 texColor = (Lin+L0); ","texColor *= 0.04 ;","texColor += vec3(0.0,0.001,0.0025)*0.3;","float g_fMaxLuminance = 1.0;","float fLumScaled = 0.1 / luminance; ","float fLumCompressed = (fLumScaled * (1.0 + (fLumScaled / (g_fMaxLuminance * g_fMaxLuminance)))) / (1.0 + fLumScaled); ","float ExposureBias = fLumCompressed;","vec3 curr = Uncharted2Tonemap((log2(2.0/pow(luminance,4.0)))*texColor);","vec3 color = curr*whiteScale;","vec3 retColor = pow(color,vec3(1.0/(1.2+(1.2*sunfade))));","gl_FragColor.rgb = retColor;","gl_FragColor.a = 1.0;","}"].join("\n")},i.Sky=function(){var e=i.ShaderLib.sky,t=i.UniformsUtils.clone(e.uniforms),r=new i.ShaderMaterial({fragmentShader:e.fragmentShader,vertexShader:e.vertexShader,uniforms:t,side:i.BackSide}),n=new i.SphereGeometry(45e4,32,15),o=new i.Mesh(n,r);this.mesh=o,this.uniforms=t}},function(e,t,r){e.exports=function(){"use strict";var e=(r(7),r(8));return r(75),function(t,r){var i,n,o,a=t;for("string"==typeof r||Array.isArray(r)?n=r:r&&(n=r.src);!(a instanceof e.Scene)&&a.parent;)a=a.parent;return o=a.getObjectByName("audio-listener"),i=new e.Audio(o),i.load(n),this.start=i.start.bind(i),this.volume=i.volume.bind(i),t.add(i),i}}()},function(e,t,r){var i=r(8);i.Audio=function(e){i.Object3D.call(this),this.type="Audio",this.started=!1,e.context?(this.context=e.context,this.gain=this.context.createGain(),this.gain.connect(e.input),this.panner=this.context.createPanner(),this.panner.connect(this.gain)):this.source=new Audio},i.Audio.prototype=Object.create(i.Object3D.prototype),i.Audio.prototype.load=function(e){var t,r,i,n=this,o=this.source instanceof window.HTMLAudioElement?this.source:new Audio;for("string"==typeof e&&(e=[e]),r=0;rl)&&(l=5),E=P*l,d.font=b.font,a=t.exec(d.font),m=parseFloat(a&&a[1])||50,w=1.5*m,o=new c,e=0===b.text?"0":String(b.text||""),l){for(e=e.trim()+" ",M=0;M_?o?o.add(T):o=new c(T):!o&&c.measure(T)>=E?(C.push(new c(T)),T="",o=new c,R=!0):(o.wrap=!0,C.push(o),o=new c(T),R=!0),T=""):T+=r;o&&C.push(o)}else C.push(new c(e));E&&R||(E=C.reduce(function(e,t){return Math.max(e,t.totalWidth)},0)),E=Math.min(E,2048),D=C.length*w,s&&s.mipmap===!1?(p.width=E,p.height=D):(p.width=h(E),p.height=h(D)),f.scale.set(p.width/P,p.height/P,1),d.font=b.font,d.textAlign=b.textAlign,d.textBaseline=b.textBaseline,d.direction=b.direction,d.fillStyle=b.fillStyle,g=(p.width-E)/2,S=(p.height-D)/2+w/2,u=""===d.direction||"inherit"===d.direction,A="center"===d.textAlign?p.width/2:"right"===d.textAlign||"end"===d.textAlign&&("ltr"===d.direction||u&&"ltr"===L)||"start"===d.textAlign&&("rtl"===d.direction||u&&"rtl"===L)?p.width-g:g,C.forEach(function(e){var t,r;"justify"===b.textAlign&&e.wrap&&e.words.length>1?(t=A,r=(E-e.wordsWidth)/(e.words.length-1),e.words.forEach(function(e){d.fillText(e,t,S),t+=r+c.measure(e)})):d.fillText(e.text(),A,S),S+=w}),y=E/P,x=C.length*w/P,v.needsUpdate=!0,f.name=e.trim()}var l,p,d,f,m,v,g=this,y=0,x=0,b={text:"",font:"80px sans-serif",textAlign:"center",textBaseline:"", +direction:"",fillStyle:"white",resolution:256,wrap:5};return c.prototype.text=function(){return this.words.join(" ")},c.prototype.add=function(e){var t;this.words.length&&(this.totalWidth+=this.spaceWidth),this.words.push(e),t=c.measure(e),this.totalWidth+=t,this.wordsWidth+=t},c.prototype.measure=function(e){var t=this.totalWidth;return e&&(t+=c.measure(e),this.words.length&&(t+=this.spaceWidth)),t},c.measure=function(e){return d.measureText(e).width},p=document.createElement("canvas"),d=p.getContext("2d"),v=new e.Texture(p),p.width===h(p.width)&&p.height===h(p.height)&&(v.minFilter=e.LinearMipMapLinearFilter,v.generateMipmaps=!0),l=new e.MeshBasicMaterial({side:e.DoubleSide,transparent:!0,map:v}),f=new e.Mesh(a,l),m=new e.Object3D,m.name="text",m.add(f),r.add(m),"string"==typeof s?b.text=s:s&&Object.keys(b).forEach(function(e){b[e]=s[e]||b[e]}),u(),Object.keys(b).forEach(function(e){Object.defineProperty(g,e,{get:function(){return b[e]},set:function(t){b[e]=t,u()}})}),Object.defineProperty(g,"width",{get:function(){return y}}),Object.defineProperty(g,"height",{get:function(){return x}}),this.material=l,m}}()},function(e,t,r){e.exports=function(){"use strict";var e=r(7),t=r(8);return function(r,i){var n,o;return n=new t.TorusGeometry(void 0===i.radius?.5:i.radius,void 0===i.tube?.125:i.tube,void 0===i.radialSegments?12:i.radialSegments,void 0===i.tubularSegments?16:i.tubularSegments,i.arc),o=new t.Mesh(n,e.standard()),o.name="torus",r.add(o),o}}()},function(e,t,r){e.exports=function(){"use strict";var e,t=r(8),i=r(28),n=/\.(webm|ogg|ogv|m4v|mp4|mov)/i;return e=function(r,o){function a(e){return e>0&&0===(e&e-1)}function s(){var e=d.videoWidth/d.videoHeight;o&&o.sphere||u.applyMatrix((new t.Matrix4).makeScale(1,m/e,1)),m=e,d.videoWidth===d.videoHeight&&a(d.videoWidth)&&a(d.videoHeight)?(f.minFilter=t.LinearMipMapLinearFilter,f.generateMipmaps=!0):(f.minFilter=t.LinearFilter,f.generateMipmaps=!1),l.map=f,l.visible=!0,v&&d.play()}function h(e){e.forEach(function(e){var t,r,o;if(e){if(t=i.exec(e),t&&(t[1]&&t[1]!==window.location.hostĪ©||t[2]&&t[2]!==window.location.port)){if(void 0===d.crossOrigin)return void console.warn("Browser does not support cross-origin video");d.crossOrigin="anonymous"}o=document.createElement("source"),o.src=e,r=n.exec(e),(!r||d.canPlayType("video/"+r[1]))&&d.appendChild(o)}})}function c(){document.hidden||document.mozHidden||document.msHidden||document.webkitHidden?d.pause():v&&d.play()}var u,l,p,d,f,m=1,v=!1,g=this;return d=document.createElement("video"),d.loop=!0,d.addEventListener("loadedmetadata",s,!1),Array.isArray(o)&&h(o),"string"==typeof o?h([o]):"string"==typeof o.src?h([o.src]):Array.isArray(o.src)&&h(o.src),d.load(),f=new t.VideoTexture(d,t.UVMapping),f.format=t.RGBFormat,o&&o.sphere?(u=new t.SphereGeometry(994,60,60,(parseFloat(o.phiStart)||0)*Math.PI*2,(parseFloat(o.phiLength)||1)*Math.PI*2,(parseFloat(o.thetaStart)||0)*Math.PI,(parseFloat(o.thetaLength)||1)*Math.PI),u.applyMatrix((new t.Matrix4).makeScale(-1,1,1)),u.applyMatrix((new t.Matrix4).makeRotationY(-Math.PI/2))):u=new t.PlaneBufferGeometry(1,1,8),l=new t.MeshBasicMaterial({side:t.DoubleSide,map:f,visible:!1}),p=new t.Mesh(u,l),o&&o.stereo&&("vertical"===o.stereo?f.repeat.y=.5:f.repeat.x=.5,p.userData.stereo=o.stereo),d.readyState&&s(),this.play=function(){return v=!0,d.play(),this},this.pause=function(){return v=!1,d.pause(),this},this.canPlayType=e.canPlayType,Object.defineProperty(this,"width",{get:function(){return d.videoWidth}}),Object.defineProperty(this,"height",{get:function(){return d.videoHeight}}),Object.defineProperty(this,"paused",{get:function(){return!v}}),Object.defineProperty(this,"volume",{get:function(){return d.volume},set:function(e){d.volume=e}}),Object.defineProperty(this,"muted",{get:function(){return d.muted},set:function(e){d.muted=e}}),Object.defineProperty(this,"duration",{get:function(){return d.duration||0}}),Object.defineProperty(this,"currentTime",{get:function(){return d.currentTime},set:function(e){d.readyState&&e=0&&(d.currentTime=e)}}),["loadedmetadata","play","pause","playing","progress"].forEach(function(e){d.addEventListener(e,g.emit.bind(g,e))}),d.addEventListener("error",function(e){d.error.code===window.MediaError.MEDIA_ERR_DECODE&&d.childNodes.length>1&&(l.visible=!1,d.removeChild(d.firstChild),d.load()),g.emit(event,e)},!0),this.element=d,window.addEventListener("touchstart",function y(){v?d.play():d.load(),window.removeEventListener("touchstart",y,!0)},!0),document.addEventListener("visibilitychange",c),document.addEventListener("mozvisibilitychange",c),document.addEventListener("msvisibilitychange",c),document.addEventListener("webkitvisibilitychange",c),p.name="video",this.raycastable=!(o&&o.sphere),r.add(p),p},e.canPlayType=function(e){var t=document.createElement("video");return t.canPlayType(e)},e}()},function(e,t){e.exports='\n \n'},function(e,t){e.exports='\n \n'},function(e,t){e.exports='\n \n'},function(e,t){e.exports='\n \n'}])); //# sourceMappingURL=vr.js.map \ No newline at end of file diff --git a/build/vr.js.map b/build/vr.js.map index 7b7562b..95f5816 100644 --- a/build/vr.js.map +++ b/build/vr.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack:///vr.js","webpack:///webpack/bootstrap 461708ddfb6ad82cfbc9","webpack:///./src/entry.js","webpack:///./bower_components/nosleep/NoSleep.js","webpack:///./src/css/style.css?21aa","webpack:///./src/css/style.css","webpack:///./~/css-loader/lib/css-base.js","webpack:///./~/style-loader/addStyles.js","webpack:///./src/vr.js","webpack:///./src/materials.js","webpack:///./~/three/three.js","webpack:///./~/lodash.foreach/index.js","webpack:///./~/lodash.foreach/~/lodash._arrayeach/index.js","webpack:///./~/lodash.foreach/~/lodash._baseeach/index.js","webpack:///./~/lodash.foreach/~/lodash._baseeach/~/lodash.keys/index.js","webpack:///./~/lodash.foreach/~/lodash._baseeach/~/lodash.keys/~/lodash.isarguments/index.js","webpack:///./~/lodash.foreach/~/lodash.isarray/index.js","webpack:///./~/lodash.foreach/~/lodash._baseeach/~/lodash.keys/~/lodash.isnative/index.js","webpack:///./~/lodash.foreach/~/lodash._bindcallback/index.js","webpack:///./~/lodash.assign/index.js","webpack:///./~/lodash.assign/~/lodash._baseassign/index.js","webpack:///./~/lodash.assign/~/lodash._baseassign/~/lodash._basecopy/index.js","webpack:///./~/lodash.assign/~/lodash.keys/index.js","webpack:///./~/lodash.assign/~/lodash.keys/~/lodash._getnative/index.js","webpack:///./~/lodash.assign/~/lodash.keys/~/lodash.isarguments/index.js","webpack:///./~/lodash.assign/~/lodash.keys/~/lodash.isarray/index.js","webpack:///./~/lodash.assign/~/lodash._createassigner/index.js","webpack:///./~/lodash.assign/~/lodash._createassigner/~/lodash._isiterateecall/index.js","webpack:///./~/lodash.assign/~/lodash._createassigner/~/lodash.restparam/index.js","webpack:///./src/utils/urlregex.js","webpack:///./src/images ^\\.\\/.*$","webpack:///./src/images/asphalt.jpg","webpack:///./src/images/brick-tiles.jpg","webpack:///./src/images/bricks-normal.jpg","webpack:///./src/images/bricks-specular.jpg","webpack:///./src/images/bricks.jpg","webpack:///./src/images/checkerboard.png","webpack:///./src/images/grass.jpg","webpack:///./src/images/metal-floor.jpg","webpack:///./src/images/metal.jpg","webpack:///./src/images/stone.jpg","webpack:///./src/images/tiles.jpg","webpack:///./src/images/weathered-wood.jpg","webpack:///./src/images/wood.jpg","webpack:///./src/vr-object.js","webpack:///./~/event-emitter/index.js","webpack:///./~/event-emitter/~/d/index.js","webpack:///./~/event-emitter/~/es5-ext/object/assign/index.js","webpack:///./~/event-emitter/~/es5-ext/object/assign/is-implemented.js","webpack:///./~/event-emitter/~/es5-ext/object/assign/shim.js","webpack:///./~/event-emitter/~/es5-ext/object/keys/index.js","webpack:///./~/event-emitter/~/es5-ext/object/keys/is-implemented.js","webpack:///./~/event-emitter/~/es5-ext/object/keys/shim.js","webpack:///./~/event-emitter/~/es5-ext/object/valid-value.js","webpack:///./~/event-emitter/~/es5-ext/object/normalize-options.js","webpack:///./~/event-emitter/~/es5-ext/object/is-callable.js","webpack:///./~/event-emitter/~/es5-ext/string/#/contains/index.js","webpack:///./~/event-emitter/~/es5-ext/string/#/contains/is-implemented.js","webpack:///./~/event-emitter/~/es5-ext/string/#/contains/shim.js","webpack:///./~/event-emitter/~/es5-ext/object/valid-callable.js","webpack:///./src/objects/empty.js","webpack:///./bower_components/DeviceOrientationControls/index.js","webpack:///./bower_components/OrbitControls/index.js","webpack:///./bower_components/AugmentedConsole/index.js","webpack:///./src/lib/VRStereoEffect.js","webpack:///./src/lib/VRControls.js","webpack:///./src/objects ^\\.\\/.*$","webpack:///./src/objects/box.js","webpack:///./src/objects/cylinder.js","webpack:///./src/objects/floor.js","webpack:///./src/objects/image.js","webpack:///./src/objects/panorama.js","webpack:///./src/objects/sky.js","webpack:///./bower_components/SkyShader/index.js","webpack:///./src/objects/sound.js","webpack:///./src/lib/ThreeAudio.js","webpack:///./src/objects/sphere.js","webpack:///./src/objects/text.js","webpack:///./src/objects/torus.js","webpack:///./src/objects/video.js","webpack:///./bower_components/open-iconic/svg/fullscreen-enter.svg","webpack:///./bower_components/open-iconic/svg/fullscreen-exit.svg","webpack:///./bower_components/open-iconic/svg/eye.svg","webpack:///./bower_components/open-iconic/svg/compass.svg"],"names":["modules","__webpack_require__","moduleId","installedModules","exports","module","id","loaded","call","m","c","p","i","Object","prototype","hasOwnProperty","_m","args","slice","fn","a","b","apply","this","concat","initRequirements","VR","initUI","svgButton","source","svg","span","document","createElement","innerHTML","firstChild","setAttribute","container","appendChild","toggleOrientation","orientationEnabled","disableOrientation","enableOrientation","deviceChange","controlMode","vrButton","classList","remove","orientationButton","enableFullscreen","disableFullscreen","element","noSleep","NoSleep","fullScreenElement","body","fullscreenEnabled","webkitFullscreenEnabled","mozFullScreenEnabled","msFullscreenEnabled","requestFullscreen","webkitRequestFullscreen","mozRequestFullScreen","msRequestFullscreen","head","addEventListener","bind","exitFullscreen","on","isFullscreen","style","display","vrMode","enable","disable","className","requestVR","window","evt","keyCode","charCodeAt","zeroSensor","resize","initialize","init","THREE","start","root","addSourceToVideo","type","dataURI","src","ua","Android","test","navigator","userAgent","iOS","media","WebM","MP4","noSleepTimer","noSleepVideo","duration","setInterval","location","setTimeout","stop","play","clearInterval","pause","content","locals","push","list","toString","result","length","item","join","mediaQuery","alreadyImportedModules","addStylesToDom","styles","options","domStyle","stylesInDom","refs","j","parts","addStyle","listToStyles","newStyles","css","sourceMap","part","createStyleElement","styleElement","getHeadElement","createLinkElement","linkElement","rel","obj","update","singleton","styleIndex","singletonCounter","singletonElement","applyToSingletonTag","URL","createObjectURL","revokeObjectURL","Blob","btoa","updateLink","parentNode","removeChild","href","applyToTag","newObj","index","styleSheet","cssText","replaceText","cssNode","createTextNode","childNodes","insertBefore","unescape","encodeURIComponent","JSON","stringify","blob","oldSrc","memoize","memo","arguments","isOldIE","toLowerCase","getElementsByTagName","newList","mayRemove","textStore","replacement","filter","Boolean","fullscreenElement","mozFullScreenElement","webkitFullscreenElement","msFullscreenElement","fullScreenError","vrEffect","exit","pruneObject","object","raycastable","indexOf","splice","vrObjects","VRObject","findObject","children","forEach","raycast","intersect","intersects","parent","vrObject","prune","raycaster","ray","origin","setFromMatrixPosition","camera","matrixWorld","direction","set","unproject","sub","normalize","intersectObjects","scene","Mesh","target","emit","render","now","Date","delta","Math","min","lastTick","vrControls","animationCallbacks","cb","updateMatrixWorld","renderLoop","going","requestAnimationFrame","visibilityChange","hidden","mozHidden","msHidden","webkitHidden","audioListener","volume","width","height","innerWidth","innerHeight","aspect","updateProjectionMatrix","renderer","setSize","initShake","lastX","lastY","lastZ","lastTime","threshold","time","diff","dist","current","accelerationIncludingGravity","deltaX","deltaY","deltaZ","undefined","abs","x","y","z","sqrt","vibrate","orientationPossible","initScene","attachCanvas","domElement","WebGLRenderer","antialias","event","console","log","Scene","bodyWrapper","name","moveTo","cameraWrapper","PerspectiveCamera","NEAR","FAR","add","AudioListener","VRControls","freeze","VRStereoEffect","near","far","screen","mouseControls","enabled","reset","lockOrientation","mozLockOrientation","orientation","lock","exitVR","position","rotation","mode","hmd","OrbitControls","target0","copy","dLight","DirectionalLight","castShadow","shadowCameraVisible","shadowMapWidth","shadowMapHeight","shadowCameraLeft","shadowCameraRight","shadowCameraTop","shadowCameraBottom","shadowCameraFar","shadowCameraNear","shadowDarkness","AmbientLight","canvas","Raycaster","ImageUtils","crossOrigin","eventEmitter","materials","nop","mozCancelFullScreen","webkitExitFullscreen","msExitFullscreen","objectMethods","animate","callback","end","requestFullScreen","times","n","method","key","creator","defineProperty","get","imageTexture","mapping","imageLoaded","scale","ctx","image","naturalWidth","naturalHeight","max","floor","getContext","drawImage","texture","needsUpdate","parse","isDataUri","dataUri","exec","urlRegex","images","hostname","port","Texture","material","threeTexture","textures","opts","Material","materialTypes","MeshLambertMaterial","map","assign","ambient","color","emissive","specularMap","normalMap","alphaMap","envMap","lightMap","val","match","assetPath","lambert","basic","MeshBasicMaterial","phong","MeshPhongMaterial","normal","MeshNormalMaterial","depth","MeshDepthMaterial","textureFiles","asphalt","repeat","brick-tiles","bricks","checkerboard","grass","metal-floor","shininess","metal","shading","SmoothShading","stone","tiles","weathered-wood","wood","url","scripts","currentScript","getAttribute","replace","standard","library","props","textureFactory","file","imagePath","Vector2","wrapS","wrapT","RepeatWrapping","materialDef","self","REVISION","sign","warn","error","MOUSE","LEFT","MIDDLE","RIGHT","CullFaceNone","CullFaceBack","CullFaceFront","CullFaceFrontBack","FrontFaceDirectionCW","FrontFaceDirectionCCW","BasicShadowMap","PCFShadowMap","PCFSoftShadowMap","FrontSide","BackSide","DoubleSide","NoShading","FlatShading","NoColors","FaceColors","VertexColors","NoBlending","NormalBlending","AdditiveBlending","SubtractiveBlending","MultiplyBlending","CustomBlending","AddEquation","SubtractEquation","ReverseSubtractEquation","MinEquation","MaxEquation","ZeroFactor","OneFactor","SrcColorFactor","OneMinusSrcColorFactor","SrcAlphaFactor","OneMinusSrcAlphaFactor","DstAlphaFactor","OneMinusDstAlphaFactor","DstColorFactor","OneMinusDstColorFactor","SrcAlphaSaturateFactor","MultiplyOperation","MixOperation","AddOperation","UVMapping","CubeReflectionMapping","CubeRefractionMapping","EquirectangularReflectionMapping","EquirectangularRefractionMapping","SphericalReflectionMapping","ClampToEdgeWrapping","MirroredRepeatWrapping","NearestFilter","NearestMipMapNearestFilter","NearestMipMapLinearFilter","LinearFilter","LinearMipMapNearestFilter","LinearMipMapLinearFilter","UnsignedByteType","ByteType","ShortType","UnsignedShortType","IntType","UnsignedIntType","FloatType","HalfFloatType","UnsignedShort4444Type","UnsignedShort5551Type","UnsignedShort565Type","AlphaFormat","RGBFormat","RGBAFormat","LuminanceFormat","LuminanceAlphaFormat","RGBEFormat","RGB_S3TC_DXT1_Format","RGBA_S3TC_DXT1_Format","RGBA_S3TC_DXT3_Format","RGBA_S3TC_DXT5_Format","RGB_PVRTC_4BPPV1_Format","RGB_PVRTC_2BPPV1_Format","RGBA_PVRTC_4BPPV1_Format","RGBA_PVRTC_2BPPV1_Format","Projector","projectVector","vector","project","unprojectVector","pickingRay","CanvasRenderer","clear","setClearColor","Color","setRGB","constructor","r","g","value","setHex","setStyle","hex","setHSL","h","s","l","hue2rgb","q","t","parseInt","ColorKeywords","copyGammaToLinear","gammaFactor","pow","copyLinearToGamma","safeInverse","convertGammaToLinear","convertLinearToGamma","getHex","getHexString","getHSL","optionalTarget","hue","saturation","hsl","lightness","getStyle","offsetHSL","addColors","color1","color2","addScalar","multiply","multiplyScalar","lerp","alpha","equals","fromArray","array","toArray","offset","clone","aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkgrey","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkslategrey","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dimgrey","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","green","greenyellow","grey","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightgrey","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightslategrey","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","slategrey","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen","Quaternion","w","_x","_y","_z","_w",{"end":{"file":"vr.js","comments_before":[],"nlb":false,"endpos":56519,"endcol":7,"endline":2191,"pos":56518,"col":6,"line":2191,"value":"x","type":"name","_comments_dumped":true},"start":{"file":"vr.js","comments_before":[],"nlb":false,"endpos":56519,"endcol":7,"endline":2191,"pos":56518,"col":6,"line":2191,"value":"x","type":"name","_comments_dumped":true},"name":"x"},"onChangeCallback","quaternion","setFromEuler","euler","Euler","Error","c1","cos","c2","c3","s1","sin","s2","s3","order","setFromAxisAngle","axis","angle","halfAngle","setFromRotationMatrix","te","elements","m11","m12","m13","m21","m22","m23","m31","m32","m33","trace","setFromUnitVectors","v1","EPS","vFrom","vTo","Vector3","dot","crossVectors","inverse","conjugate","v","lengthSq","multiplyQuaternions","qax","qay","qaz","qaw","qbx","qby","qbz","qbw","multiplyVector3","applyQuaternion","slerp","qb","cosHalfTheta","halfTheta","acos","sinHalfTheta","ratioA","ratioB","onChange","qa","qm","setX","setY","setComponent","getComponent","addVectors","subVectors","subScalar","divide","divideScalar","scalar","invScalar","clamp","clampScalar","minVal","maxVal","ceil","round","roundToZero","negate","distanceTo","distanceToSquared","dx","dy","setLength","oldLength","lerpVectors","v2","fromAttribute","attribute","itemSize","setZ","multiplyVectors","applyEuler","applyAxisAngle","applyMatrix3","e","applyMatrix4","applyProjection","d","qx","qy","qz","qw","ix","iy","iz","iw","matrix","Matrix4","multiplyMatrices","projectionMatrix","getInverse","transformDirection","lengthManhattan","cross","ax","ay","az","bx","by","bz","projectOnVector","projectOnPlane","planeNormal","reflect","angleTo","theta","dz","setEulerFromRotationMatrix","setEulerFromQuaternion","getPositionFromMatrix","getScaleFromMatrix","setFromMatrixScale","getColumnFromMatrix","setFromMatrixColumn","sx","sy","sz","me","Vector4","setW","setAxisAngleFromQuaternion","setAxisAngleFromRotationMatrix","epsilon","epsilon2","PI","xx","yy","zz","xy","xz","yz","_order","DefaultOrder","RotationOrders","asin","atan2","setFromQuaternion","makeRotationFromQuaternion","setFromVector3","reorder","newOrder","toVector3","optionalResult","Line3","line","center","distanceSq","distance","at","closestPointToPointParameter","startP","startEnd","point","clampToLine","startEnd2","startEnd_startP","closestPointToPoint","Box2","Infinity","setFromPoints","points","makeEmpty","il","expandByPoint","setFromCenterAndSize","size","halfSize","box","empty","expandByVector","expandByScalar","containsPoint","containsBox","getParameter","isIntersectionBox","clampPoint","distanceToPoint","clampedPoint","union","translate","Box3","setFromObject","scope","traverse","node","geometry","Geometry","vertices","BufferGeometry","attributes","positions","getBoundingSphere","Sphere","radius","Matrix3","Float32Array","n11","n12","n13","n21","n22","n23","n31","n32","n33","identity","multiplyVector3Array","applyToVector3Array","determinant","f","throwOnInvertible","det","msg","transpose","tmp","flattenToArrayOffset","getNormalMatrix","transposeIntoArray","n14","n24","n34","n41","n42","n43","n44","extractPosition","copyPosition","extractBasis","xAxis","yAxis","zAxis","makeBasis","extractRotation","scaleX","scaleY","scaleZ","makeRotationFromEuler","ae","af","be","bf","ce","cf","de","df","ac","ad","bc","bd","setRotationFromQuaternion","x2","y2","z2","wx","wy","wz","lookAt","eye","up","a11","a12","a13","a14","a21","a22","a23","a24","a31","a32","a33","a34","a41","a42","a43","a44","b11","b12","b13","b14","b21","b22","b23","b24","b31","b32","b33","b34","b41","b42","b43","b44","multiplyToArray","multiplyVector4","rotateAxis","crossVector","getPosition","setPosition","rotateX","rotateY","rotateZ","rotateByAxis","getMaxScaleOnAxis","scaleXSq","scaleYSq","scaleZSq","makeTranslation","makeRotationX","makeRotationY","makeRotationZ","makeRotationAxis","tx","ty","makeScale","compose","decompose","invSX","invSY","invSZ","makeFrustum","left","right","bottom","top","makePerspective","fov","ymax","degToRad","ymin","xmin","xmax","makeOrthographic","Ray","recast","directionDistance","distanceSqToSegment","segCenter","segDir","v0","optionalPointOnRay","optionalPointOnSegment","s0","sqrDist","extDet","segExtent","a01","b0","b1","invDet","isIntersectionSphere","sphere","intersectSphere","tca","d2","radius2","thc","t0","t1","isIntersectionPlane","plane","distToPoint","denominator","distanceToPlane","constant","intersectPlane","intersectBox","tmin","tmax","tymin","tymax","tzmin","tzmax","invdirx","invdiry","invdirz","intersectTriangle","edge1","edge2","backfaceCulling","DdN","DdQxE2","DdE1xQ","QdN","matrix4","optionalCenter","maxRadiusSq","intersectsSphere","radiusSum","deltaLengthSq","getBoundingBox","Frustum","p0","p1","p2","p3","p4","p5","planes","Plane","frustum","setFromMatrix","me0","me1","me2","me3","me4","me5","me6","me7","me8","me9","me10","me11","me12","me13","me14","me15","setComponents","intersectsObject","boundingSphere","computeBoundingSphere","negRadius","intersectsBox","d1","setFromNormalAndCoplanarPoint","setFromCoplanarPoints","inverseNormalLength","distanceToSphere","projectPoint","orthoPoint","perpendicularMagnitude","isIntersectionLine","startSign","endSign","intersectLine","coplanarPoint","m1","optionalNormalMatrix","normalMatrix","newNormal","newCoplanarPoint","generateUUID","chars","split","uuid","Array","rnd","random","clampBottom","mapLinear","a1","a2","b2","smoothstep","smootherstep","random16","randInt","low","high","randFloat","randFloatSpread","range","degreeToRadiansFactor","degrees","radToDeg","radianToDegreesFactor","radians","isPowerOfTwo","nextPowerOfTwo","Spline","interpolate","t2","t3","intPoint","weight","w2","w3","pa","pb","pc","pd","v3","initFromArray","getPoint","k","getControlPointsArray","coords","getLength","nSubDivisions","nSamples","oldIntPoint","oldPosition","tmpVec","chunkLengths","totalLength","chunks","total","reparametrizeByArcLength","samplingCoef","indexCurrent","indexNext","realDistance","sampling","newpoints","sl","Triangle","resultLengthSq","barycoordFromPoint","dot00","dot01","dot02","dot11","dot12","denom","invDenom","u","setFromPointsAndIndices","i0","i1","i2","triangle","area","midpoint","Clock","autoStart","startTime","oldTime","elapsedTime","running","performance","getElapsedTime","getDelta","newTime","EventDispatcher","hasEventListener","removeEventListener","dispatchEvent","listener","_listeners","listeners","listenerArray","params","Sprite","PointCloud","LOD","Line","descSort","intersectObject","recursive","precision","linePrecision","setFromCamera","OrthographicCamera","sort","objects","Object3D","Object3DIdCount","DefaultUp","onRotationChange","onQuaternionChange","defineProperties","enumerable","rotationAutoUpdate","matrixAutoUpdate","matrixWorldNeedsUpdate","visible","receiveShadow","frustumCulled","renderOrder","userData","eulerOrder","useQuaternion","applyMatrix","setRotationFromAxisAngle","setRotationFromEuler","setRotationFromMatrix","rotateOnAxis","q1","translateOnAxis","translateX","translateY","translateZ","localToWorld","worldToLocal","getChildByName","getObjectByName","getObjectById","getObjectByProperty","child","getWorldPosition","getWorldQuaternion","getWorldRotation","getWorldScale","getWorldDirection","traverseVisible","traverseAncestors","updateMatrix","force","toJSON","output","metadata","version","generator","geometries","parseGeometry","json","parseMaterial","parseObject","data","intensity","PointLight","decay","SpotLight","exponent","HemisphereLight","groundColor","Face3","materialIndex","vertexNormals","vertexColors","vertexTangents","face","Face4","BufferAttribute","copyAt","index1","index2","setXY","setXYZ","setXYZW","Int8Attribute","Uint8Attribute","Uint8ClampedAttribute","Int16Attribute","Uint16Attribute","Int32Attribute","Uint32Attribute","Float32Attribute","Float64Attribute","DynamicBufferAttribute","updateRange","count","create","GeometryIdCount","attributesKeys","drawcalls","offsets","boundingBox","addAttribute","keys","addDrawCall","indexOffset","computeBoundingBox","fromGeometry","settings","faces","faceVertexUvs","hasFaceVertexUv","hasFaceVertexNormals","normals","colors","uvs","i3","na","nb","nc","fc","vca","vcb","vcc","uva","uvb","uvc","bb","isNaN","computeFaceNormals","computeVertexNormals","vA","vB","vC","pA","pB","pC","ab","indices","jl","normalizeNormals","computeTangents","handleTriangle","uvA","uvB","uvC","x1","y1","z1","sdir","tdir","tan1","tan2","handleVertex","n2","tmp2","tangents","uv","nVertices","tangent","iA","iB","iC","computeOffsets","facesCount","sortedIndices","Uint16Array","indexPtr","vertexPtr","duplicatedVertices","newVerticeMaps","faceVertices","Int32Array","vertexMap","revVertexMap","findex","vo","vid","faceMax","new_offset","new_vid","reorderBuffers","merge","attribute1","attributeArray1","attribute2","attributeArray2","attributeSize","indexBuffer","indexMap","vertexCount","sortedAttributes","attr","sourceArray","attrArray","attrSize","sortedAttr","numItems","sourceAttr","dispose","morphTargets","morphColors","morphNormals","skinWeights","skinIndices","lineDistances","hasTangents","dynamic","verticesNeedUpdate","elementsNeedUpdate","uvsNeedUpdate","normalsNeedUpdate","tangentsNeedUpdate","colorsNeedUpdate","lineDistancesNeedUpdate","groupsNeedUpdate","vertex","fromBufferGeometry","tempNormals","tempUVs","addFace","drawcall","fl","areaWeighted","vl","computeMorphNormals","__originalFaceNormal","__originalVertexNormals","tmpGeo","faceNormals","faceNormal","dstNormalsFace","dstNormalsVertex","context","ub","uc","vertexIndex","faceIndex","computeLineDistances","materialIndexOffset","vertexOffset","vertices1","vertices2","faces1","faces2","uvs1","uvs2","vertexCopy","faceCopy","faceVertexNormals","faceVertexColors","uvCopy","mergeMesh","mesh","mergeVertices","verticesMap","unique","changes","precisionPoints","faceIndicesToRemove","dupIndex","idx","setBit","getNormalIndex","hash","normalsHash","getColorIndex","colorsHash","getUvIndex","uvsHash","parameters","hasMaterial","hasFaceUv","hasFaceNormal","hasFaceVertexNormal","hasFaceColor","hasFaceVertexColor","faceType","uvsCopy","kl","Camera","matrixWorldInverse","CubeCamera","cubeResolution","cameraPX","cameraNX","cameraPY","cameraNY","cameraPZ","cameraNZ","renderTarget","WebGLRenderTargetCube","format","magFilter","minFilter","updateCubeMap","generateMipmaps","activeCubeFace","zoom","cx","cy","setLens","focalLength","frameHeight","atan","setViewOffset","fullWidth","fullHeight","Light","light","AreaLight","constantAttenuation","linearAttenuation","quadraticAttenuation","onlyShadow","shadowBias","shadowCascade","shadowCascadeOffset","shadowCascadeCount","shadowCascadeBias","shadowCascadeWidth","shadowCascadeHeight","shadowCascadeNearZ","shadowCascadeFarZ","shadowCascadeArray","shadowMap","shadowMapSize","shadowCamera","shadowMatrix","skyColor","shadowCameraFov","Cache","files","Loader","showStatus","statusDomElement","addStatusElement","imageLoader","ImageLoader","onLoadStart","onLoadProgress","onLoadComplete","fontSize","textAlign","background","padding","zIndex","updateProgress","progress","message","toFixed","extractUrlBase","pop","initMaterials","texturePath","createMaterial","needsTangents","ShaderMaterial","nearest_pow2","LN2","create_texture","where","sourceFile","wrap","anisotropy","fullPath","loader","Handlers","load","wrapMap","mirror","rgb2hex","rgb","mtype","mpars","opacity","bumpMap","wireframe","blending","transparent","depthTest","depthWrite","flipSided","side","doubleSided","colorDiffuse","DbgColor","colorSpecular","specular","colorEmissive","transparency","specularCoef","mapDiffuse","mapDiffuseRepeat","mapDiffuseOffset","mapDiffuseWrap","mapDiffuseAnisotropy","mapLight","mapLightRepeat","mapLightOffset","mapLightWrap","mapLightAnisotropy","mapBump","mapBumpRepeat","mapBumpOffset","mapBumpWrap","mapBumpAnisotropy","mapNormal","mapNormalRepeat","mapNormalOffset","mapNormalWrap","mapNormalAnisotropy","mapSpecular","mapSpecularRepeat","mapSpecularOffset","mapSpecularWrap","mapSpecularAnisotropy","mapAlpha","mapAlphaRepeat","mapAlphaOffset","mapAlphaWrap","mapAlphaAnisotropy","mapBumpScale","bumpScale","mapNormalFactor","normalScale","DbgName","handlers","regex","XHRLoader","manager","DefaultLoadingManager","onLoad","onProgress","onError","cached","request","XMLHttpRequest","open","response","itemEnd","responseType","send","itemStart","setResponseType","setCrossOrigin","JSONLoader","withCredentials","loadAjaxJSON","callbackProgress","xhr","onreadystatechange","readyState","DONE","status","responseText","LOADING","getResponseHeader","HEADERS_RECEIVED","parseModel","isBitSet","fi","zLength","colorIndex","normalIndex","uvIndex","isQuad","faceA","faceB","uvLayer","nUvLayers","parseSkin","influencesPerVertex","bones","animation","animations","parseMorphing","dstVertices","srcVertices","cl","dstColors","srcColors","LoadingManager","BufferGeometryLoader","text","typedArray","MaterialLoader","uniforms","vertexShader","fragmentShader","sizeAttenuation","ObjectLoader","substring","lastIndexOf","setTexturePath","parseGeometries","parseImages","parseTextures","parseMaterials","geometryLoader","bufferGeometryLoader","widthSegments","heightSegments","BoxGeometry","depthSegments","CircleGeometry","segments","CylinderGeometry","radiusTop","radiusBottom","radialSegments","openEnded","SphereGeometry","phiStart","phiLength","thetaStart","thetaLength","IcosahedronGeometry","detail","TorusGeometry","tube","tubularSegments","arc","TorusKnotGeometry","heightScale","getTexture","loadImage","path","getGeometry","getMaterial","Group","TextureLoader","DataTextureLoader","BinaryTextureLoader","_parser","DataTexture","buffer","texData","mipmaps","mipmapCount","CompressedTextureLoader","CompressedTexture","loadTexture","texDatas","isCubemap","MaterialIdCount","blendSrc","blendDst","blendEquation","blendSrcAlpha","blendDstAlpha","blendEquationAlpha","colorWrite","polygonOffset","polygonOffsetFactor","polygonOffsetUnits","alphaTest","overdraw","_needsUpdate","setValues","values","newValue","currentValue","Number","PointCloudMaterial","SpriteMaterial","LineBasicMaterial","linewidth","linecap","linejoin","fog","LineDashedMaterial","dashSize","gapSize","combine","reflectivity","refractionRatio","wireframeLinewidth","wireframeLinecap","wireframeLinejoin","skinning","wrapAround","wrapRGB","MeshFaceMaterial","ParticleBasicMaterial","ParticleSystemMaterial","defines","lights","defaultAttributeValues","uv2","index0AttributeName","UniformsUtils","RawShaderMaterial","TextureIdCount","DEFAULT_IMAGE","DEFAULT_MAPPING","premultiplyAlpha","flipY","unpackAlignment","onUpdate","CubeTexture","VideoTexture","video","HAVE_ENOUGH_DATA","inverseMatrix","localThreshold","testPoint","rayPointDistance","intersectPoint","distanceToRay","oi","ol","pointCount","ParticleSystem","LineStrip","LinePieces","precisionSq","vStart","vEnd","interSegment","interRay","step","distSq","offsetIndex","nbVertices","updateMorphTargets","morphTargetBase","morphTargetForcedOrder","morphTargetInfluences","morphTargetDictionary","ml","getMorphTargetIndexByName","intersectionPoint","isFaceMaterial","objectMaterials","morphInfluences","tl","influence","targets","Bone","skin","Skeleton","boneInverses","useVertexTexture","identityMatrix","boneTextureWidth","boneTextureHeight","boneMatrices","boneTexture","calculateInverses","bl","pose","bone","offsetMatrix","SkinnedMesh","bindMode","bindMatrix","bindMatrixInverse","gbone","pos","rotq","scl","normalizeSkinWeights","skeleton","sw","MorphAnimMesh","mirroredLoop","lastKeyframe","currentKeyframe","directionBackwards","setFrameRange","startKeyframe","endKeyframe","setDirectionForward","setDirectionBackward","parseAnimations","firstAnimation","pattern","morph","label","setAnimationLabel","playAnimation","fps","updateAnimation","frameTime","keyframe","mix","interpolateTargets","influences","addLevel","getObjectForDistance","matrixPosition","Particle","LensFlare","lensFlares","positionScreen","customUpdateCallback","updateLensFlares","flare","vecX","vecY","wantedRotation","overrideMaterial","autoUpdate","Fog","FogExp2","density","ShaderChunk","merged","uniforms_src","uniforms_dst","parameter_src","UniformsLib","common","diffuse","offsetRepeat","flipEnvMap","bump","normalmap","fogDensity","fogNear","fogFar","fogColor","ambientLightColor","directionalLightDirection","directionalLightColor","hemisphereLightDirection","hemisphereLightSkyColor","hemisphereLightGroundColor","pointLightColor","pointLightPosition","pointLightDistance","pointLightDecay","spotLightColor","spotLightPosition","spotLightDirection","spotLightDistance","spotLightAngleCos","spotLightExponent","spotLightDecay","particle","psColor","shadowmap","ShaderLib","particle_basic","dashed","totalSize","mNear","mFar","cube","tCube","tFlip","equirect","tEquirect","depthRGBA","createParticleBuffers","__webglVertexBuffer","_gl","createBuffer","__webglColorBuffer","_this","info","memory","createLineBuffers","__webglLineDistanceBuffer","createMeshBuffers","geometryGroup","__webglNormalBuffer","__webglTangentBuffer","__webglUVBuffer","__webglUV2Buffer","__webglSkinIndicesBuffer","__webglSkinWeightsBuffer","__webglFaceBuffer","__webglLineBuffer","numMorphTargets","__webglMorphTargetsBuffers","numMorphNormals","__webglMorphNormalsBuffers","initCustomAttributes","nvertices","__webglCustomAttributesList","__webglInitialized","createUniqueBuffers","belongsToAttribute","initParticleBuffers","__vertexArray","__colorArray","__webglParticleCount","initLineBuffers","__lineDistanceArray","__webglLineCount","initMeshBuffers","faces3","ntris","nlines","getBufferMaterial","__normalArray","__uvArray","__uv2Array","__tangentArray","__skinIndexArray","__skinWeightArray","UintArray","extensions","Uint32Array","__typeArray","__faceArray","__lineArray","__morphTargetsArrays","__morphNormalsArrays","__webglFaceCount","originalAttribute","property","__original","__inittedArrays","materialNeedsFaceNormals","setParticleBuffers","hint","ca","cal","customAttribute","vertexArray","colorArray","dirtyVertices","dirtyColors","customAttributes","bindBuffer","ARRAY_BUFFER","bufferData","boundTo","setLineBuffers","dl","lineDistanceArray","dirtyLineDistances","setMeshBuffers","faceColor","n1","n3","sw1","sw2","sw3","si1","si2","si3","vn","uvi","uv2i","vk","vkl","vka","nka","chf","needsFaceNormals","offset_uv","offset_uv2","offset_face","offset_normal","offset_tangent","offset_line","offset_color","offset_skin","offset_morphTarget","offset_custom","uvArray","uv2Array","normalArray","tangentArray","skinIndexArray","skinWeightArray","morphTargetsArrays","morphNormalsArrays","faceArray","lineArray","dirtyElements","dirtyUvs","dirtyNormals","dirtyTangents","dirtyMorphTargets","morphTargetsNeedUpdate","chunk_faces3","obj_faces","obj_uvs","obj_uvs2","obj_skinIndices","obj_skinWeights","ELEMENT_ARRAY_BUFFER","pp","setupVertexAttributes","program","startIndex","geometryAttributes","programAttributes","programAttributesKeys","programAttribute","geometryAttribute","state","enableAttribute","vertexAttribPointer","FLOAT","vertexAttrib2fv","vertexAttrib3fv","disableUnusedAttributes","setupMorphTargets","numSupportedMorphTargets","__webglMorphTargetInfluences","activeInfluenceIndices","numericalSort","numSupportedMorphNormals","influenceIndex","uniform1fv","painterSortStable","reversePainterSortStable","projectObject","initObject","sprites","webglObjects","_webglObjects","_frustum","webglObject","unrollBufferMaterial","sortObjects","_vector3","_projScreenMatrix","renderObjects","renderList","setupMatrices","setMaterial","setMaterialFaces","renderBufferDirect","renderBuffer","renderObjectsImmediate","materialType","renderImmediateObject","unrollImmediateBufferMaterial","globject","opaque","transparentObjects","opaqueObjects","__webglInit","_modelViewMatrix","_normalMatrix","onObjectRemoved","onGeometryDispose","initGeometryGroups","__webglActive","addBuffer","geometryGroupsList","geometryGroups","ImmediateRenderObject","immediateRenderCallback","addBufferImmediate","_webglObjectsImmediate","makeGroups","usesFaceMaterial","groupHash","group","maxVerticesInGroup","hash_map","groups","groupsList","counter","geometryGroupCounter","addBuffers","objlist","updateObject","bufferType","DYNAMIC_DRAW","STATIC_DRAW","bufferSubData","BYTES_PER_ELEMENT","subarray","customAttributesDirty","areCustomAttributesDirty","clearCustomAttributes","removeObject","removeInstances","o","initMaterial","onMaterialDispose","shaderID","shaderIDs","shader","__webglShader","maxLightCount","allocateLights","maxShadows","allocateShadows","maxBones","allocateBones","_precision","supportsVertexTextures","_supportsVertexTextures","envMapMode","useFog","fogExp","flatShading","logarithmicDepthBuffer","_logarithmicDepthBuffer","_supportsBoneTextures","maxMorphTargets","maxMorphNormals","maxDirLights","directional","maxPointLights","maxSpotLights","spot","maxHemiLights","hemi","shadowMapEnabled","shadowMapType","shadowMapDebug","shadowMapCascade","code","pl","_programs","programInfo","usedTimes","WebGLProgram","programs","base","uniformsList","setBlending","setDepthTest","setDepthWrite","setColorWrite","setPolygonOffset","setProgram","_usedTextureUnits","deallocateMaterial","refreshProgram","refreshMaterial","refreshLights","p_uniforms","m_uniforms","_currentProgram","useProgram","_currentMaterialId","_currentCamera","uniformMatrix4fv","uniform1f","logDepthBufFC","cameraPosition","uniform3f","viewMatrix","textureUnit","getTextureUnit","uniform1i","setTexture","boneGlobalMatrices","refreshUniformsFog","_lightsNeedUpdate","setupLights","refreshUniformsLights","_lights","markUniformsLightsNeedsUpdate","refreshUniformsCommon","refreshUniformsLine","refreshUniformsDash","refreshUniformsParticle","refreshUniformsPhong","refreshUniformsLambert","_shadowPass","refreshUniformsShadow","loadUniformsGeneric","loadUniformsMatrices","modelMatrix","uvScaleMap","_canvas","distances","decays","directions","anglesCos","exponents","skyColors","groundColors","modelViewMatrix","uniformMatrix3fv","_maxTextures","uniform","uniform2f","uniform4f","uniform1iv","uniform3iv","uniform2fv","uniform3fv","uniform4fv","_array","setCubeTexture","setCubeTextureDynamic","setColorLinear","ll","zlights","dirColors","dirPositions","pointColors","pointPositions","pointDistances","pointDecays","spotColors","spotPositions","spotDistances","spotDirections","spotAnglesCos","spotExponents","spotDecays","hemiSkyColors","hemiGroundColors","hemiPositions","dirLength","pointLength","spotLength","hemiLength","dirCount","spotCount","hemiCount","dirOffset","pointOffset","spotOffset","hemiOffset","_direction","setTextureParameters","textureType","isImagePowerOfTwo","extension","texParameteri","TEXTURE_WRAP_S","paramThreeToGL","TEXTURE_WRAP_T","TEXTURE_MAG_FILTER","TEXTURE_MIN_FILTER","CLAMP_TO_EDGE","filterFallback","__currentAnisotropy","texParameterf","TEXTURE_MAX_ANISOTROPY_EXT","getMaxAnisotropy","clampToMaxSize","maxSize","slot","__webglTextureCube","onTextureDispose","createTexture","activeTexture","TEXTURE0","bindTexture","TEXTURE_CUBE_MAP","pixelStorei","UNPACK_FLIP_Y_WEBGL","isCompressed","isDataTexture","cubeImage","autoScaleCubemaps","_maxCubemapSize","glFormat","glType","mipmap","getCompressedTextureFormats","compressedTexImage2D","TEXTURE_CUBE_MAP_POSITIVE_X","texImage2D","generateMipmap","__webglTexture","setupFrameBuffer","framebuffer","textureTarget","bindFramebuffer","FRAMEBUFFER","framebufferTexture2D","COLOR_ATTACHMENT0","setupRenderBuffer","renderbuffer","bindRenderbuffer","RENDERBUFFER","depthBuffer","stencilBuffer","renderbufferStorage","DEPTH_COMPONENT16","framebufferRenderbuffer","DEPTH_ATTACHMENT","DEPTH_STENCIL","DEPTH_STENCIL_ATTACHMENT","RGBA4","updateRenderTargetMipmap","TEXTURE_2D","NEAREST","LINEAR","REPEAT","MIRRORED_REPEAT","NEAREST_MIPMAP_NEAREST","NEAREST_MIPMAP_LINEAR","LINEAR_MIPMAP_NEAREST","LINEAR_MIPMAP_LINEAR","UNSIGNED_BYTE","UNSIGNED_SHORT_4_4_4_4","UNSIGNED_SHORT_5_5_5_1","UNSIGNED_SHORT_5_6_5","BYTE","SHORT","UNSIGNED_SHORT","INT","UNSIGNED_INT","HALF_FLOAT_OES","ALPHA","RGB","RGBA","LUMINANCE","LUMINANCE_ALPHA","FUNC_ADD","FUNC_SUBTRACT","FUNC_REVERSE_SUBTRACT","ZERO","ONE","SRC_COLOR","ONE_MINUS_SRC_COLOR","SRC_ALPHA","ONE_MINUS_SRC_ALPHA","DST_ALPHA","ONE_MINUS_DST_ALPHA","DST_COLOR","ONE_MINUS_DST_COLOR","SRC_ALPHA_SATURATE","COMPRESSED_RGB_S3TC_DXT1_EXT","COMPRESSED_RGBA_S3TC_DXT1_EXT","COMPRESSED_RGBA_S3TC_DXT3_EXT","COMPRESSED_RGBA_S3TC_DXT5_EXT","COMPRESSED_RGB_PVRTC_4BPPV1_IMG","COMPRESSED_RGB_PVRTC_2BPPV1_IMG","COMPRESSED_RGBA_PVRTC_4BPPV1_IMG","COMPRESSED_RGBA_PVRTC_2BPPV1_IMG","MIN_EXT","MAX_EXT","nVertexUniforms","MAX_VERTEX_UNIFORM_VECTORS","nVertexMatrices","dirLights","pointLights","spotLights","hemiLights","_context","pixelRatio","_alpha","_depth","_stencil","stencil","_antialias","_premultipliedAlpha","premultipliedAlpha","_preserveDrawingBuffer","preserveDrawingBuffer","_clearColor","_clearAlpha","autoClear","autoClearColor","autoClearDepth","autoClearStencil","gammaInput","gammaOutput","shadowMapCullFace","calls","_currentFramebuffer","_currentGeometryProgram","_viewportX","_viewportY","_viewportWidth","_viewportHeight","_currentWidth","_currentHeight","preventDefault","resetGLState","setDefaultGLState","WebGLState","getShaderPrecisionFormat","rangeMin","rangeMax","WebGLExtensions","glClearColor","clearColor","clearDepth","clearStencil","DEPTH_TEST","depthFunc","LEQUAL","frontFace","CCW","cullFace","BACK","CULL_FACE","BLEND","blendFunc","viewport","MAX_TEXTURE_IMAGE_UNITS","_maxVertexTextures","MAX_VERTEX_TEXTURE_IMAGE_UNITS","_maxTextureSize","MAX_TEXTURE_SIZE","MAX_CUBE_MAP_TEXTURE_SIZE","_vertexShaderPrecisionHighpFloat","VERTEX_SHADER","HIGH_FLOAT","_vertexShaderPrecisionMediumpFloat","MEDIUM_FLOAT","_fragmentShaderPrecisionHighpFloat","FRAGMENT_SHADER","_fragmentShaderPrecisionMediumpFloat","formats","COMPRESSED_TEXTURE_FORMATS","highpAvailable","mediumpAvailable","shadowMapPlugin","ShadowMapPlugin","spritePlugin","SpritePlugin","lensFlarePlugin","LensFlarePlugin","forceContextLoss","loseContext","supportsFloatTextures","supportsHalfFloatTextures","supportsStandardDerivatives","supportsCompressedTextureS3TC","supportsCompressedTexturePVRTC","supportsBlendMinMax","MAX_TEXTURE_MAX_ANISOTROPY_EXT","getPrecision","getPixelRatio","setPixelRatio","updateStyle","setViewport","setScissor","scissor","enableScissorTest","SCISSOR_TEST","getClearColor","getClearAlpha","setClearAlpha","bits","COLOR_BUFFER_BIT","DEPTH_BUFFER_BIT","STENCIL_BUFFER_BIT","clearTarget","setRenderTarget","deallocateGeometry","deallocateTexture","onRenderTargetDispose","deallocateRenderTarget","deleteBuffers","buffers","deleteBuffer","deleteTexture","deleteFramebuffer","__webglFramebuffer","deleteRenderbuffer","__webglRenderbuffer","deleteProgram","newPrograms","renderBufferImmediate","initAttributes","hasPositions","hasNormals","hasUvs","__webglUvBuffer","hasColors","positionArray","nx","ny","nz","nax","nbx","ncx","nay","nby","ncy","naz","nbz","ncz","drawArrays","TRIANGLES","updateBuffers","wireframeBit","geometryProgram","LINES","drawElements","POINTS","LINE_STRIP","setLineWidth","skinIndex","skinWeight","lineDistance","forceClear","setFaceCulling","frontFaceDirection","CW","FRONT","FRONT_AND_BACK","setDoubleSided","setFlipSided","uploadTexture","UNPACK_PREMULTIPLY_ALPHA_WEBGL","UNPACK_ALIGNMENT","isCube","isTargetPowerOfTwo","createFramebuffer","createRenderbuffer","shareDepthFrom","vx","vy","readRenderTargetPixels","WebGLRenderTarget","restore","checkFramebufferStatus","FRAMEBUFFER_COMPLETE","readPixels","addPrePlugin","addPostPlugin","updateShadowMap","gl","getExtension","programIdCount","generateDefines","chunk","cacheUniformLocations","identifiers","getUniformLocation","cacheAttributeLocations","getAttribLocation","shadowMapTypeDefine","envMapTypeDefine","envMapModeDefine","envMapBlendingDefine","prefix_vertex","prefix_fragment","gammaFactorDefine","customDefines","createProgram","glVertexShader","WebGLShader","glFragmentShader","attachShader","bindAttribLocation","linkProgram","programLogInfo","getProgramInfoLog","getProgramParameter","LINK_STATUS","getError","VALIDATE_STATUS","deleteShader","addLineNumbers","string","lines","createShader","shaderSource","compileShader","getShaderParameter","COMPILE_STATUS","getShaderInfoLog","newAttributes","Uint8Array","enabledAttributes","currentBlending","currentBlendEquation","currentBlendSrc","currentBlendDst","currentBlendEquationAlpha","currentBlendSrcAlpha","currentBlendDstAlpha","currentDepthTest","currentDepthWrite","currentColorWrite","currentDoubleSided","currentFlipSided","currentLineWidth","currentPolygonOffset","currentPolygonOffsetFactor","currentPolygonOffsetUnits","enableVertexAttribArray","disableVertexAttribArray","blendEquationSeparate","blendFuncSeparate","depthMask","colorMask","lineWidth","polygonoffset","factor","units","POLYGON_OFFSET_FILL","flares","prefix","vertexBuffer","elementBuffer","hasVertexTexture","tempTexture","occlusionTexture","renderType","occlusionMap","screenPosition","viewportWidth","viewportHeight","tempPosition","invAspect","halfViewportWidth","halfViewportHeight","screenPositionPixels","TEXTURE1","copyTexImage2D","sprite","_renderer","_renderList","createVirtualLight","cascade","virtualLight","isVirtual","pointsWorld","pointsFrustum","nearZ","farZ","updateVirtualLight","updateShadowCamera","_min","_max","getObjectMaterial","_depthMaterial","_depthMaterialMorph","_depthMaterialSkin","_depthMaterialMorphSkin","_matrixPosition","depthShader","depthUniforms","originalCamera","gyro","Gyroscope","shadowFilter","pars","cameraHelper","CameraHelper","objectMaterial","useMorphing","useSkinning","customDepthMaterial","clearAlpha","spritePosition","spriteRotation","spriteScale","uvOffset","uvScale","fogType","fillStyle","fillRect","oldFogType","sceneFogType","GeometryUtils","geometry1","geometry2","loadTextureCube","loadCompressedTexture","loadCompressedTextureCube","getNormalMap","subtract","getImageData","imageData","createImageData","ly","uy","lx","ux","num_points","putImageData","generateDataTexture","SceneUtils","createMultiMaterialObject","detach","attach","FontUtils","divisions","getFace","loadFace","family","familyName","ThreeFont","cssFontWeight","cssFontStyle","drawText","resolution","String","fontPaths","Path","ret","extractGlyphPoints","paths","outline","action","cpx","cpy","cpx0","cpy0","cpx1","cpy1","cpx2","cpy2","laste","pts","glyph","glyphs","_cachedOutline","lineTo","quadraticCurveTo","Shape","Utils","bezierCurveTo","b3","ha","generateShapes","curveSegments","font","shapes","toShapes","namespace","EPSILON","process","contour","verts","vertIndices","nv","snip","px","py","aX","aY","bX","bY","cX","cY","apx","apy","bpx","bpy","cCROSSap","bCROSScp","aCROSSbp","Triangulate","_typeface_js","typeface_js","Audio","createBufferSource","onended","onEnded","gain","createGain","connect","destination","panner","createPanner","autoplay","isPlaying","onload","decodeAudioData","loop","currentTime","setLoop","setRefDistance","refDistance","setRolloffFactor","rolloffFactor","setVolume","AudioContext","webkitAudioContext","velocity","positionPrev","setOrientation","setVelocity","Curve","getPointAt","getUtoTmapping","getPoints","getSpacedPoints","lengths","getLengths","cacheArcLengths","cache","last","sum","updateArcLengths","targetArcLength","arcLengths","comparison","lengthBefore","lengthAfter","segmentLength","segmentFraction","getTangent","pt1","pt2","vec","getTangentAt","tangentQuadraticBezier","tangentCubicBezier","tangentSpline","h00","h10","h01","h11","getPointFunc","CurvePath","curves","bends","autoClose","curve","checkConnection","closePath","startPoint","endPoint","LineCurve","curveLengths","getCurveLengths","lens","cacheLengths","sums","maxX","maxY","maxZ","minX","minY","minZ","NEGATIVE_INFINITY","POSITIVE_INFINITY","createPointsGeometry","createGeometry","createSpacedPointsGeometry","addWrapPath","bendpath","getTransformedPoints","oldPts","getWrapPoints","getTransformedSpacedPoints","oldX","oldY","xNorm","bounds","pathPt","translationObject","quaternionObject","scaleObject","translationWorld","quaternionWorld","scaleWorld","actions","fromPoints","PathActions","MOVE_TO","LINE_TO","QUADRATIC_CURVE_TO","BEZIER_CURVE_TO","CSPLINE_THRU","ARC","ELLIPSE","vectors","vlen","lastargs","x0","y0","aCPx","aCPy","QuadraticBezierCurve","aCP1x","aCP1y","aCP2x","aCP2y","CubicBezierCurve","splineThru","npts","SplineCurve","aRadius","aStartAngle","aEndAngle","aClockwise","absarc","absellipse","ellipse","xRadius","yRadius","EllipseCurve","lastPoint","closedPath","useSpacedPoints","spts","spline","deltaAngle","tdivisions","isCCW","noHoles","extractSubpaths","inActions","subPaths","lastPath","toShapesNoHoles","inSubpaths","tmpPath","tmpShape","isPointInsidePolygon","inPt","inPolygon","polyLen","inside","edgeLowPt","edgeHighPt","edgeDx","edgeDy","perpEdge","solid","holesFirst","isClockWise","tmpPoints","betterShapeHoles","newShapes","newShapeHoles","mainIdx","ambigious","toChange","sIdx","sLen","sho","hIdx","ho","hole_unassigned","s2Idx","froms","tos","hole","tmpHoles","holes","extrude","extruded","ExtrudeGeometry","makeGeometry","ShapeGeometry","getPointsHoles","holesPts","getSpacedPointsHoles","extractAllPoints","shape","extractPoints","extractAllSpacedPoints","triangulateShape","point_in_segment_2D_colin","inSegPt1","inSegPt2","inOtherPt","intersect_segments_2D","inSeg1Pt1","inSeg1Pt2","inSeg2Pt1","inSeg2Pt2","inExcludeAdjacentSegs","seg1dx","seg1dy","seg2dx","seg2dy","seg1seg2dx","seg1seg2dy","limit","perpSeg1","perpSeg2","factorSeg1","seg1Pt","seg2Pt","seg1min","seg1max","seg1minVal","seg1maxVal","seg2min","seg2max","seg2minVal","seg2maxVal","isPointInsideAngle","inVertex","inLegFromPt","inLegToPt","legFromPtX","legFromPtY","legToPtX","legToPtY","otherPtX","otherPtY","from2toAngle","from2otherAngle","other2toAngle","removeHoles","isCutLineInsideAngles","inShapeIdx","inHoleIdx","lastShapeIdx","prevShapeIdx","nextShapeIdx","insideAngle","lastHoleIdx","prevHoleIdx","nextHoleIdx","intersectsShapeEdge","inShapePt","inHolePt","nextIdx","intersection","intersectsHoleEdge","ihIdx","chkHole","indepHoles","holeIndex","shapeIndex","shapePt","holePt","holeIdx","cutKey","tmpShape1","tmpShape2","tmpHole1","tmpHole2","failedCuts","hl","minShapeIndex","h2","allPointsMap","allpoints","shapeWithoutHoles","triangles","b2p0","b2p1","b2p2","b3p0","b3p1","b3p2","b3p3","point0","point1","point2","point3","ArcCurve","LineCurve3","QuadraticBezierCurve3","CubicBezierCurve3","SplineCurve3","ClosedSplineCurve3","AnimationHandler","CATMULLROM","CATMULLROM_FORWARD","initialized","hierarchy","rot","quat","usedMorphTargets","morphTargetName","morphTargetsInfluences","parseRecurseHierarchy","deltaTimeMS","resetBlendWeights","Animation","timeScale","interpolationType","keyTypes","animationCache","positionWeight","quaternionWeight","scaleWeight","prevKey","nextKey","originalMatrix","getNextKeyWith","newVector","newQuat","interpolateCatmullRom","prevXYZ","nextXYZ","proportionalWeight","getPrevKeyWith","currentPoint","forwardPoint","KeyFrameAnimation","isPaused","sids","sid","next","endTime","original","hasTarget","MorphAnimation","frames","lastFrame","currentFrame","interpolation","frame","buildPlane","udir","vdir","gridX","gridY","width_half","height_half","gridX1","gridY1","segment_width","segment_height","uvd","depth_half","centerUV","segment","CubeGeometry","heightHalf","verticesRow","uvsRow","tanTheta","v4","n4","uv1","uv3","uv4","addShapeList","addShape","scalePt2","pt","getBevelVec","inPrev","inNext","v_trans_x","v_trans_y","shrink_by","v_prev_x","v_prev_y","v_next_x","v_next_y","v_prev_lensq","colinear0","v_prev_len","v_next_len","ptPrevShift_x","ptPrevShift_y","ptNextShift_x","ptNextShift_y","sf","v_trans_lensq","direction_eq","buildLidFaces","bevelEnabled","layer","flen","f3","steps","bevelSegments","buildSideFaces","layeroffset","sidewalls","ahole","slen1","slen2","f4","shapesOffset","uvgen","generateTopUV","wallContour","stepIndex","stepsLength","contourIndex1","contourIndex2","extrudeMaterial","generateSideWallUV","extrudePts","splineTube","binormal","position2","amount","bevelThickness","bevelSize","extrudePath","extrudeByPath","UVGenerator","WorldUVGenerator","TubeGeometry","FrenetFrames","shapePoints","reverse","bs","vert","contourMovements","oneHoleMovements","holesMovements","verticesMovements","binormals","indexA","indexB","indexC","indexD","LatheGeometry","inversePointLength","inverseSegments","phi","np","u0","u1","PlaneGeometry","PlaneBufferGeometry","offset2","RingGeometry","innerRadius","outerRadius","thetaSegments","phiSegments","radiusStep","thetaSegment","TextGeometry","textShapes","getPos","in_q","in_p","cu","su","quOverP","cs","tz","grid","tang","bitan","ip","jp","closed","taper","NoTaper","numpoints","pos2","SinusoidalTaper","initialNormal3","smallest","MAX_VALUE","mat","PolyhedronGeometry","prepare","that","azimuth","inclination","make","centroid","azi","correctUV","subdivide","cols","aj","bj","rows","DodecahedronGeometry","OctahedronGeometry","TetrahedronGeometry","ParametricGeometry","func","slices","stacks","sliceCount","AxisHelper","ArrowHelper","lineGeometry","coneGeometry","dir","headLength","headWidth","cone","setDirection","setColor","BoxHelper","BoundingBoxHelper","addLine","addPoint","pointMap","hexFrustum","hexCone","hexUp","hexTarget","hexCross","setPoint","DirectionalLightHelper","lightPlane","targetLine","EdgesHelper","thresholdAngle","thresholdDot","edge","sortFunction","numEdges","vert1","vert2","face1","face2","FaceNormalsHelper","objectVertices","objectFaces","objectWorldMatrix","GridHelper","setColors","colorCenterLine","colorGrid","HemisphereLightHelper","sphereSize","lightSphere","PointLightHelper","SkeletonHelper","getBoneList","boneList","matrixWorldInv","boneMatrix","SpotLightHelper","vector2","coneLength","coneWidth","VertexNormalsHelper","worldMatrix","vertexId","VertexTangentsHelper","WireframeHelper","edges","numTris","renderCallback","MorphBlendMesh","animationsMap","animationsList","numFrames","startFrame","endFrame","createAnimation","setAnimationWeight","active","autoCreateAnimations","frameRanges","setAnimationDirectionForward","setAnimationDirectionBackward","setAnimationFPS","setAnimationDuration","setAnimationTime","getAnimationTime","getAnimationDuration","stopAnimation","createForEach","arrayFunc","eachFunc","collection","iteratee","thisArg","isArray","bindCallback","arrayEach","baseEach","baseForOwn","baseFor","baseProperty","createBaseEach","fromRight","isLength","iterable","toObject","createBaseFor","keysFunc","MAX_SAFE_INTEGER","isObject","isIndex","shimKeys","keysIn","propsLength","allowIndexes","support","nonEnumArgs","isArguments","Ctor","isProto","skipIndexes","isNative","objectProto","propertyIsEnumerable","nativeKeys","valueOf","isObjectLike","objToString","argsTag","baseToString","funcTag","reIsNative","fnToString","reIsHostCtor","escapeRegExp","reHasRegExpChars","reRegExpChars","arrayTag","RegExp","Function","nativeIsArray","argCount","accumulator","other","assignWith","customizer","baseAssign","createAssigner","baseCopy","isArrayLike","reIsUint","getNative","isFunction","assigner","restParam","sources","guard","isIterateeCall","TypeError","FUNC_ERROR_TEXT","nativeMax","rest","otherArgs","webpackContext","req","webpackContextResolve","./asphalt.jpg","./brick-tiles.jpg","./bricks-normal.jpg","./bricks-specular.jpg","./bricks.jpg","./checkerboard.png","./grass.jpg","./metal-floor.jpg","./metal.jpg","./stone.jpg","./tiles.jpg","./weathered-wood.jpg","./wood.jpg","resolve","scratchVector1","scratchVector2","isNear","wasNear","NEAR_DISTANCE","allObjects","parseFloat","prop","WeakMap","hide","show","moveX","moveY","moveUp","moveDown","moveZ","setScale","once","off","methods","descriptors","callable","descriptor","configurable","writable","__ee__","__eeOnceListener__","candidate","normalizeOpts","isCallable","contains","dscr","desc","gs","foo","bar","trzy","dest","str","searchString","DeviceOrientationControls","deviceOrientation","screenOrientation","onDeviceOrientationChangeEvent","onScreenOrientationChangeEvent","setObjectQuaternion","zee","q0","beta","gamma","orient","disconnect","getAutoRotationAngle","autoRotateSpeed","getZoomScale","zoomSpeed","onMouseDown","button","mouseButtons","ORBIT","noRotate","STATE","ROTATE","rotateStart","clientX","clientY","ZOOM","noZoom","DOLLY","dollyStart","PAN","noPan","panStart","NONE","onMouseMove","onMouseUp","startEvent","rotateEnd","rotateDelta","rotateLeft","clientWidth","rotateSpeed","rotateUp","clientHeight","dollyEnd","dollyDelta","dollyIn","dollyOut","panEnd","panDelta","pan","endEvent","onMouseWheel","stopPropagation","wheelDelta","onKeyDown","noKeys","UP","keyPanSpeed","BOTTOM","touchstart","touches","TOUCH_ROTATE","pageX","pageY","TOUCH_DOLLY","TOUCH_PAN","touchmove","touchend","minDistance","maxDistance","autoRotate","minPolarAngle","maxPolarAngle","minAzimuthAngle","maxAzimuthAngle","panOffset","phiDelta","thetaDelta","lastPosition","lastQuaternion","position0","quatInverse","changeEvent","panLeft","panUp","targetDistance","dollyScale","getPolarAngle","getAzimuthalAngle","addSupportedType","supportedTypes","_oldConsole","Ray origin","Ray direction","special","table","perspectiveMatrixFromVRFieldOfView","zNear","zFar","outMat","out","upTan","upDegrees","RADIANS","downTan","downDegrees","leftTan","leftDegrees","rightTan","rightDegrees","xScale","yScale","hmdDevice","hmdWidth","hmdHeight","offsetWidth","offsetHeight","updateProjection","fovLeft","fovRight","leftEyeParams","rightEyeParams","leftEyeRect","rightEyeRect","leftEyeViewport","rightEyeViewport","getEyeParameters","renderRect","currentFieldOfView","setFieldOfView","eyeOffsetLeft","eyeTranslation","eyeOffsetRight","leftRenderRect","rightRenderRect","getRecommendedEyeRenderRect","getCurrentEyeFieldOfView","getRecommendedEyeFieldOfView","getEyeTranslation","cameraLeft","cameraRight","gotVRDevices","devices","device","HMDVRDevice","hardwareUnitId","deviceName","setTimewarp","fullScreenParam","vrDisplay","poll","clearTimeout","pollTimeout","scan","onFullscreenChange","vrPreview","separation","getVRDevices","then","mozGetVRDevices","leftScene","rightScene","drawingBufferWidth","stereo","PositionSensorVRDevice","sensorDevice","resetSensor","deviceOrientationChange","deviceControls","vrState","zeroAngle","vrBrowser","getState","hasOrientation","hasPosition","./box","./box.js","./cylinder","./cylinder.js","./empty","./empty.js","./floor","./floor.js","./image","./image.js","./panorama","./panorama.js","./sky","./sky.js","./sound","./sound.js","./sphere","./sphere.js","./text","./text.js","./torus","./torus.js","./video","./video.js","cylinder","radiusSegments","tex","TAU","HALF_PI","mod","sinTheta","cosTheta","sinPhi","cosPhi","altitude","sunPosition","exp","Sky","setOptions","param","setAltitude","setAzimuth","luminance","turbidity","reileigh","mieCoefficient","mieDirectionalG","skyShader","skyUniforms","skyMat","skyGeo","skyMesh","started","input","HTMLAudioElement","canPlayType","onerror","linearRampToValueAtTime","fontSizeRegex","newLineRegex","spaceRegex","log2","word","spaceWidth","measureText","totalWidth","wordsWidth","words","letter","inherit","lineHeight","measure","getComputedStyle","wrapped","trim","charAt","reduce","previous","textBaseline","space","fillText","textWidth","textHeight","wordWidth","extRegex","num","loadedMetadata","newAspectRatio","videoWidth","videoHeight","aspectRatio","playing","setSource","ext","hostĪ©","vol","muted","MediaError","MEDIA_ERR_DECODE","touchStart"],"mappings":";;;;;;CAAS,SAAUA,GCInB,QAAAC,GAAAC,GAGA,GAAAC,EAAAD,GACA,MAAAC,GAAAD,GAAAE,OAGA,IAAAC,GAAAF,EAAAD,IACAE,WACAE,GAAAJ,EACAK,QAAA,EAUA,OANAP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A24D,YAAA,gjFAIA34D,EAAA24D,YAAA,iGAIA34D,EAAA24D,YAAA;AAIA34D,EAAA24D,YAAA,gHAIA34D,EAAA24D,YAAA,6TAIA34D,EAAA24D,YAAA,iPAIA34D,EAAA24D,YAAA,seAIA34D,EAAA24D,YAAA,qKAIA34D,EAAA24D,YAAA,4EAIA34D,EAAA24D,YAAA,68OAIA34D,EAAA24D,YAAA,mMAIA34D,EAAA24D,YAAA,waAIA34D,EAAA24D,YAAA,4XAIA34D,EAAA24D,YAAA,4JAIA34D,EAAA24D,YAAA,kvBAIA34D,EAAA24D,YAAA,mJAIA34D,EAAA24D,YAAA,4GAIA34D,EAAA24D,YAAA,kKAIA34D,EAAA24D,YAAA,mJAIA34D,EAAA24D,YAAA,2KAIA34D,EAAA24D,YAAA,gEAIA34D,EAAA24D,YAAA,6KAIA34D,EAAA24D,YAAA,4EAIA34D,EAAA24D,YAAA,uFAIA34D,EAAA24D,YAAA,4eAIA34D,EAAA24D,YAAA,yMAIA34D,EAAA24D,YAAA,iFAIA34D,EAAA24D,YAAA,wEAIA34D,EAAA24D,YAAA,woCAIA34D,EAAA24D,YAAA,uNAIA34D,EAAA24D,YAAA,kxDAIA34D,EAAA24D,YAAA,gGAIA34D,EAAA24D,YAAA,2RAIA34D,EAAA24D,YAAA,0MAIA34D,EAAA24D,YAAA,sNAIA34D,EAAA24D,YAAA,weAIA34D,EAAA24D,YAAA,klCAIA34D,EAAA24D,YAAA,iVAIA34D,EAAA24D,YAAA,61CAIA34D,EAAA24D,YAAA,kPAIA34D,EAAA24D,YAAA,+MAIA34D,EAAA24D,YAAA,2HAIA34D,EAAA24D,YAAA,iJAIA34D,EAAA24D,YAAA,4EAIA34D,EAAA24D,YAAA,ktBAIA34D,EAAA24D,YAAA,idAIA34D,EAAA24D,YAAA,4zOAIA34D,EAAA24D,YAAA,gYAIA34D,EAAA24D,YAAA,0gBAIA34D,EAAA24D,YAAA;AAIA34D,EAAA24D,YAAA,gNAIA34D,EAAA24D,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BACA,yBAEAjrD,EAAA24D,YAAA,OACA34D,EAAA24D,YAAA,oBACA34D,EAAA24D,YAAA,kBACA34D,EAAA24D,YAAA,uBACA34D,EAAA24D,YAAA,uBACA34D,EAAA24D,YAAA,qBACA34D,EAAA24D,YAAA,kBACA34D,EAAA24D,YAAA,wBACA34D,EAAA24D,YAAA,0BACA34D,EAAA24D,YAAA,0BAEA,gBAEA,qCACA,iDAEA34D,EAAA24D,YAAA,qBACA34D,EAAA24D,YAAA,aACA34D,EAAA24D,YAAA,eACA34D,EAAA24D,YAAA,kBACA34D,EAAA24D,YAAA,mBACA34D,EAAA24D,YAAA,qBAEA,qCAEA34D,EAAA24D,YAAA,kBACA34D,EAAA24D,YAAA,gBACA34D,EAAA24D,YAAA,mBAEA34D,EAAA24D,YAAA,yBAEA34D,EAAA24D,YAAA,aAEA,yDAEA,KAEAz2D,KAAA,OAIAmR,SAEA03C,SAAA/qD,EAAAuxD,cAAAzZ,OAEA93C,EAAAg5D,YAAA,OACAh5D,EAAAg5D,YAAA,IACAh5D,EAAAg5D,YAAA,OACAh5D,EAAAg5D,YAAA,WAGApmD,UAAkBxS,KAAA,IAAAkc,MAAA,GAAAtc,GAAAic,MAAA,IAClB60C,SAAkB1wD,KAAA,KAAAkc,MAAA,GAAAtc,GAAAirB,QAAA,WAKlB+/B,cAEA,kBAEA,4BAEA,sBAEA,4BAEA,SAEAhrD,EAAA24D,YAAA,OACA34D,EAAA24D,YAAA,gBACA34D,EAAA24D,YAAA,qBACA34D,EAAA24D,YAAA,mBACA34D,EAAA24D,YAAA,2BACA34D,EAAA24D,YAAA,kBACA34D,EAAA24D,YAAA,wBACA34D,EAAA24D,YAAA,qBACA34D,EAAA24D,YAAA,sBACA34D,EAAA24D,YAAA,wBAEA,gBAEA34D,EAAA24D,YAAA,WACA34D,EAAA24D,YAAA,gBACA34D,EAAA24D,YAAA,aAEA34D,EAAA24D,YAAA,mBACA34D,EAAA24D,YAAA,gBACA34D,EAAA24D,YAAA,kBAC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B1wD,KAAA,KAAAkc,MAAA,GAAAtc,GAAAirB,QAAA,WAKlB+/B,cAEA,gBAEA,8BAEA,sBAEA,yBAEA,SAEAhrD,EAAA24D,YAAA,OACA34D,EAAA24D,YAAA,gBACA34D,EAAA24D,YAAA,qBACA34D,EAAA24D,YAAA,mBACA34D,EAAA24D,YAAA,yBACA34D,EAAA24D,YAAA,kBACA34D,EAAA24D,YAAA,wBACA34D,EAAA24D,YAAA,qBACA34D,EAAA24D,YAAA,sBACA34D,EAAA24D,YAAA,wBAEA,gBAEA34D,EAAA24D,YAAA,WACA34D,EAAA24D,YAAA,gBACA34D,EAAA24D,YAAA,aAEA34D,EAAA24D,YAAA,mBACA34D,EAAA24D,YAAA,gBACA34D,EAAA24D,YAAA,kBACA34D,EAAA24D,YAAA,qBAEA,sBAEA,6CAEA,SAEA34D,EAAA24D,YAAA,mBACA34D,EAAA24D,YAAA,gBACA34D,EAAA24D,YAAA,eACA34D,EAAA24D,YAAA,mBAEA,oCAEA34D,EAAA24D,YAAA,gBACA34D,EAAA24D,YAAA,cACA34D,EAAA24D,YAAA,oBACA34D,EAAA24D,YAAA,iBAEA,KAEAz2D,KAAA,MAEA+oD,gBAEA,gBAEA,wBACA,yBACA,yBACA,2BACA,yBAEAjrD,EAAA24D,YAAA,OACA34D,EAAA24D,YAAA,oBACA34D,EAAA24D,YAAA,kBACA34D,EAAA24D,YAAA,uBACA34D,EAAA24D,YAAA,uBACA34D,EAAA24D,YAAA,qBACA34D,EAAA24D,YAAA,kBACA34D,EAAA24D,YAAA,2BACA34D,EAAA24D,YAAA,wBACA34D,EAAA24D,YAAA,sBACA34D,EAAA24D,YAAA,wBACA34D,EAAA24D,YAAA,0BACA34D,EAAA24D,YAAA,0BAEA,gBAEA,qCACA,iDAEA34D,EAAA24D,YAAA,qBACA34D,EAAA24D,YAAA,aACA34D,EAAA24D,YAAA,eACA34D,EAAA24D,YAAA,kBACA34D,EAAA24D,YAAA,mBACA34D,EAAA24D,YAAA,qBAE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zCvBC,EAAAD,QAAA,iblFmwzCM,SAASC,EAAQD,GmFnwzCvBC,EAAAD,QAAA","file":"vr.js","sourcesContent":["/******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId])\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\texports: {},\n/******/ \t\t\tid: moduleId,\n/******/ \t\t\tloaded: false\n/******/ \t\t};\n/******/\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n/******/\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.loaded = true;\n/******/\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/\n/******/\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n/******/\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(0);\n/******/ })\n/************************************************************************/\n/******/ ((function(modules) {\n\t// Check all modules for deduplicated modules\n\tfor(var i in modules) {\n\t\tif(Object.prototype.hasOwnProperty.call(modules, i)) {\n\t\t\tswitch(typeof modules[i]) {\n\t\t\tcase \"function\": break;\n\t\t\tcase \"object\":\n\t\t\t\t// Module can be created from a template\n\t\t\t\tmodules[i] = (function(_m) {\n\t\t\t\t\tvar args = _m.slice(1), fn = modules[_m[0]];\n\t\t\t\t\treturn function (a,b,c) {\n\t\t\t\t\t\tfn.apply(this, [a,b,c].concat(args));\n\t\t\t\t\t};\n\t\t\t\t}(modules[i]));\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\t// Module is a copy of another module\n\t\t\t\tmodules[i] = modules[modules[i]];\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\treturn modules;\n}([\n/* 0 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t(function () {\n\t\t'use strict';\n\t\n\t\t//global-ish declarations\n\t\tvar VR,\n\t\t\tNoSleep = __webpack_require__(1).NoSleep;\n\t\n\t\tfunction initRequirements() {\n\t\t\t//load styles\n\t\t\t__webpack_require__(2);\n\t\n\t\t\tVR = __webpack_require__(6);\n\t\t}\n\t\n\t\tfunction initUI() {\n\t\t\tvar container,\n\t\t\t\tenableFullscreen,\n\t\t\t\tdisableFullscreen,\n\t\t\t\tvrButton,\n\t\t\t\torientationButton,\n\t\t\t\telement,\n\t\n\t\t\t\tnoSleep = new NoSleep(),\n\t\n\t\t\t\tfullScreenElement = document.body,\n\t\n\t\t\t\tfullscreenEnabled = document.fullscreenEnabled ||\n\t\t\t\t\tdocument.webkitFullscreenEnabled ||\n\t\t\t\t\tdocument.mozFullScreenEnabled ||\n\t\t\t\t\tdocument.msFullscreenEnabled,\n\t\n\t\t\t\trequestFullscreen = fullScreenElement.webkitRequestFullscreen ||\n\t\t\t\t\tfullScreenElement.mozRequestFullScreen ||\n\t\t\t\t\tfullScreenElement.msRequestFullscreen;\n\t\n\t\t\tfunction svgButton(source, id) {\n\t\t\t\tvar span = document.createElement('span'),\n\t\t\t\t\tsvg;\n\t\n\t\t\t\tspan.innerHTML = source;\n\t\t\t\tspan.id = id;\n\t\n\t\t\t\tsvg = span.firstChild;\n\t\t\t\tsvg.setAttribute('width', 18);\n\t\t\t\tsvg.setAttribute('height', 18);\n\t\n\t\t\t\tcontainer.appendChild(span);\n\t\n\t\t\t\treturn span;\n\t\t\t}\n\t\n\t\t\tfunction toggleOrientation() {\n\t\t\t\tif (VR.orientationEnabled()) {\n\t\t\t\t\tVR.disableOrientation();\n\t\t\t\t} else {\n\t\t\t\t\tVR.enableOrientation();\n\t\t\t\t}\n\t\t\t}\n\t\n\t\t\tfunction deviceChange() {\n\t\t\t\tif (VR.controlMode()) {\n\t\t\t\t\tvrButton.classList.remove('unsupported');\n\t\t\t\t\torientationButton.classList.remove('unsupported');\n\t\t\t\t}\n\t\n\t\t\t\t//todo: enable this\n\t\t\t\t//info.innerHTML = hmd && hmd.deviceName ? 'HMD: ' + hmd.deviceName : '';\n\t\t\t\t//info.className = hmd && hmd.deviceId !== 'debug-0' ? 'has-hmd' : '';\n\t\t\t}\n\t\n\t\t\t//set up meta viewport tag for mobile devices\n\t\t\telement = document.createElement('meta');\n\t\t\telement.setAttribute('name', 'viewport');\n\t\t\telement.setAttribute('content', 'width=device-width, initial-scale=1, user-scalable=no');\n\t\t\tdocument.head.appendChild(element);\n\t\n\t\t\tcontainer = document.createElement('div');\n\t\t\tcontainer.id = 'buttons';\n\t\t\tdocument.body.appendChild(container);\n\t\n\t\t\t//todo: use icons instead of text\n\t\t\tif (requestFullscreen && fullscreenEnabled) {\n\t\t\t\tenableFullscreen = svgButton(__webpack_require__(79), 'fs-enable');\n\t\t\t\tenableFullscreen.setAttribute('title', 'Enable Full Screen');\n\t\t\t\tenableFullscreen.addEventListener('click', requestFullscreen.bind(fullScreenElement), false);\n\t\n\t\t\t\tdisableFullscreen = svgButton(__webpack_require__(80), 'fs-disable');\n\t\t\t\tdisableFullscreen.setAttribute('title', 'Exit Full Screen');\n\t\t\t\tdisableFullscreen.addEventListener('click', VR.exitFullscreen, false);\n\t\t\t}\n\t\n\t\t\tVR.on('fullscreenchange', function () {\n\t\t\t\tif (VR.isFullscreen()) {\n\t\t\t\t\tdisableFullscreen.style.display = 'inline-block';\n\t\t\t\t\tenableFullscreen.style.display = 'none';\n\t\t\t\t} else {\n\t\t\t\t\tdisableFullscreen.style.display = '';\n\t\t\t\t\tenableFullscreen.style.display = '';\n\t\t\t\t}\n\t\n\t\t\t\t//disable sleep on mobile devices in VR mode\n\t\t\t\tif (VR.vrMode()) {\n\t\t\t\t\tnoSleep.enable();\n\t\t\t\t} else {\n\t\t\t\t\tnoSleep.disable();\n\t\t\t\t}\n\t\t\t});\n\t\n\t\t\tvrButton = svgButton(__webpack_require__(81), 'vr');\n\t\t\tvrButton.setAttribute('title', 'Toggle Virtual Reality');\n\t\t\tvrButton.className = 'unsupported';\n\t\t\tvrButton.addEventListener('click', VR.requestVR, false);\n\t\n\t\t\torientationButton = svgButton(__webpack_require__(82), 'orientation');\n\t\t\torientationButton.setAttribute('title', 'Toggle Orientation');\n\t\t\torientationButton.className = 'unsupported';\n\t\t\torientationButton.addEventListener('click', toggleOrientation, false);\n\t\n\t\t\t//report on HMD\n\t\t\tVR.on('devicechange', deviceChange);\n\t\t\tdeviceChange();\n\t\n\t\t\t//keyboard shortcuts for making life a little easier\n\t\t\twindow.addEventListener('keydown', function (evt) {\n\t\t\t\tif (evt.keyCode === 'Z'.charCodeAt(0)) {\n\t\t\t\t\tVR.zeroSensor();\n\t\t\t\t} else if (evt.keyCode === 'O'.charCodeAt(0)) {\n\t\t\t\t\tVR.enableOrientation();\n\t\t\t\t} else if (evt.keyCode === 13) {\n\t\t\t\t\tVR.requestVR();\n\t\t\t\t}\n\t\t\t}, false);\n\t\n\t\t\tVR.resize();\n\t\t}\n\t\n\t\tfunction initialize() {\n\t\t\tinitRequirements();\n\t\n\t\t\t//todo: set up button/info elements\n\t\n\t\t\tVR.init();\n\t\n\t\t\tif (document.body) {\n\t\t\t\tinitUI();\n\t\t\t} else {\n\t\t\t\twindow.addEventListener('load', initUI, false);\n\t\t\t}\n\t\n\t\t\twindow.addEventListener('resize', VR.resize, false);\n\t\n\t\t\t/*\n\t\t\texport global things\n\t\t\t*/\n\t\t\twindow.VR = VR;\n\t\t\twindow.THREE = VR.THREE;\n\t\t}\n\t\n\t\tinitialize();\n\t\tVR.start();\n\t}());\n\n\n/***/ },\n/* 1 */\n/***/ function(module, exports) {\n\n\t/**\n\t * NoSleep.js v0.5.0 - git.io/vfn01\n\t * Rich Tibbett\n\t * MIT license\n\t **/\n\t(function(root) {\n\t // UA matching\n\t var ua = {\n\t Android: /Android/ig.test(navigator.userAgent),\n\t iOS: /AppleWebKit/.test(navigator.userAgent) && /Mobile\\/\\w+/.test(navigator.userAgent)\n\t };\n\t\n\t var media = {\n\t WebM: \"data:video/webm;base64,GkXfo0AgQoaBAUL3gQFC8oEEQvOBCEKCQAR3ZWJtQoeBAkKFgQIYU4BnQI0VSalmQCgq17FAAw9CQE2AQAZ3aGFtbXlXQUAGd2hhbW15RIlACECPQAAAAAAAFlSua0AxrkAu14EBY8WBAZyBACK1nEADdW5khkAFVl9WUDglhohAA1ZQOIOBAeBABrCBCLqBCB9DtnVAIueBAKNAHIEAAIAwAQCdASoIAAgAAUAmJaQAA3AA/vz0AAA=\",\n\t MP4: \"data:video/mp4;base64,AAAAHGZ0eXBpc29tAAACAGlzb21pc28ybXA0MQAAAAhmcmVlAAAAG21kYXQAAAGzABAHAAABthADAowdbb9/AAAC6W1vb3YAAABsbXZoZAAAAAB8JbCAfCWwgAAAA+gAAAAAAAEAAAEAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAIVdHJhawAAAFx0a2hkAAAAD3wlsIB8JbCAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAQAAAAAAIAAAACAAAAAABsW1kaWEAAAAgbWRoZAAAAAB8JbCAfCWwgAAAA+gAAAAAVcQAAAAAAC1oZGxyAAAAAAAAAAB2aWRlAAAAAAAAAAAAAAAAVmlkZW9IYW5kbGVyAAAAAVxtaW5mAAAAFHZtaGQAAAABAAAAAAAAAAAAAAAkZGluZgAAABxkcmVmAAAAAAAAAAEAAAAMdXJsIAAAAAEAAAEcc3RibAAAALhzdHNkAAAAAAAAAAEAAACobXA0dgAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAIAAgASAAAAEgAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABj//wAAAFJlc2RzAAAAAANEAAEABDwgEQAAAAADDUAAAAAABS0AAAGwAQAAAbWJEwAAAQAAAAEgAMSNiB9FAEQBFGMAAAGyTGF2YzUyLjg3LjQGAQIAAAAYc3R0cwAAAAAAAAABAAAAAQAAAAAAAAAcc3RzYwAAAAAAAAABAAAAAQAAAAEAAAABAAAAFHN0c3oAAAAAAAAAEwAAAAEAAAAUc3RjbwAAAAAAAAABAAAALAAAAGB1ZHRhAAAAWG1ldGEAAAAAAAAAIWhkbHIAAAAAAAAAAG1kaXJhcHBsAAAAAAAAAAAAAAAAK2lsc3QAAAAjqXRvbwAAABtkYXRhAAAAAQAAAABMYXZmNTIuNzguMw==\"\n\t };\n\t\n\t function addSourceToVideo(element, type, dataURI) {\n\t var source = document.createElement('source');\n\t source.src = dataURI;\n\t source.type = \"video/\" + type;\n\t element.appendChild(source);\n\t }\n\t\n\t // NoSleep instance constructor\n\t var NoSleep = function() {\n\t if (ua.iOS) {\n\t this.noSleepTimer = null;\n\t } else if (ua.Android) {\n\t // Set up no sleep video element\n\t this.noSleepVideo = document.createElement('video');\n\t this.noSleepVideo.setAttribute(\"loop\", \"\");\n\t\n\t // Append nosleep video sources\n\t addSourceToVideo(this.noSleepVideo, \"webm\", media.WebM);\n\t addSourceToVideo(this.noSleepVideo, \"mp4\", media.MP4);\n\t }\n\t\n\t return this;\n\t };\n\t\n\t // Enable NoSleep instance\n\t NoSleep.prototype.enable = function(duration) {\n\t if (ua.iOS) {\n\t this.disable();\n\t this.noSleepTimer = window.setInterval(function() {\n\t window.location = window.location;\n\t window.setTimeout(window.stop, 0);\n\t }, duration || 15000);\n\t } else if (ua.Android) {\n\t this.noSleepVideo.play();\n\t }\n\t };\n\t\n\t // Disable NoSleep instance\n\t NoSleep.prototype.disable = function() {\n\t if (ua.iOS) {\n\t if (this.noSleepTimer) {\n\t window.clearInterval(this.noSleepTimer);\n\t this.noSleepTimer = null;\n\t }\n\t } else if (ua.Android) {\n\t this.noSleepVideo.pause();\n\t }\n\t };\n\t\n\t // Append NoSleep API to root object\n\t root.NoSleep = NoSleep;\n\t})(this);\n\n\n/***/ },\n/* 2 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t// style-loader: Adds some css to the DOM by adding a