Skip to content

Instantly share code, notes, and snippets.

@arscan
Last active January 2, 2016 13:39
Show Gist options
  • Save arscan/8311277 to your computer and use it in GitHub Desktop.
Save arscan/8311277 to your computer and use it in GitHub Desktop.
testing,can delete

webgl-encom-globe

;ENCOM = (function(){
/* encom fucntions */
var extend = function(first, second) {
for(var i in first){
second[i] = first[i];
}
};
var sCurve = function(t) {
return 1/(1 + Math.exp(-t*12 + 6));
};
// http://stackoverflow.com/a/13542669
var shadeColor = function(color, percent) {
var num = parseInt(color.slice(1),16),
amt = Math.round(2.55 * percent),
R = (num >> 16) + amt,
G = (num >> 8 & 0x00FF) + amt,
B = (num & 0x0000FF) + amt;
return "#" + (0x1000000 + (R<255?R<1?0:R:255)*0x10000 + (G<255?G<1?0:G:255)*0x100 + (B<255?B<1?0:B:255)).toString(16).slice(1);
}
var renderToCanvas = function (width, height, renderFunction) {
var buffer = document.createElement('canvas');
buffer.width = width;
buffer.height = height;
renderFunction(buffer.getContext('2d'));
return buffer;
};
var drawCurvedRectangle = function(ctx, left, top, width, height, radius){
console.log("drawing");
ctx.beginPath();
ctx.moveTo(left + radius, top);
ctx.lineTo(left + width - radius, top);
ctx.quadraticCurveTo(left + width, top, left + width, top + radius);
ctx.lineTo(left + width, top + height - radius);
ctx.quadraticCurveTo(left + width, top + height, left + width - radius, top + height);
ctx.lineTo(left + radius, top + height);
ctx.quadraticCurveTo(left, top + height, left, top + height - radius);
ctx.lineTo(left, top + radius);
ctx.quadraticCurveTo(left, top, left + radius, top);
ctx.stroke();
ctx.fill();
ctx.closePath();
}
// based on from http://stemkoski.github.io/Three.js/Texture-Animation.html
var TextureAnimator = function(texture, tilesVert, tilesHoriz, numTiles, tileDispDuration, repeatAtTile)
{
var _this = this;
// note: texture passed by reference, will be updated by the update function.
if(repeatAtTile == undefined){
repeatAtTile=-1;
}
this.shutDownFlag = (this.repeatAtTile < 0);
this.done = false;
this.tilesHorizontal = tilesHoriz;
this.tilesVertical = tilesVert;
// how many images does this spritesheet contain?
// usually equals tilesHoriz * tilesVert, but not necessarily,
// if there at blank tiles at the bottom of the spritesheet.
this.numberOfTiles = numTiles;
texture.wrapS = texture.wrapT = THREE.RepeatWrapping;
texture.repeat.set( 1 / this.tilesHorizontal, 1 / this.tilesVertical );
// how long should each image be displayed?
this.tileDisplayDuration = tileDispDuration;
// how long has the current image been displayed?
this.currentDisplayTime = 0;
// which image is currently being displayed?
this.currentTile = 0;
texture.offset.y = 1;
this.update = function( milliSec )
{
this.currentDisplayTime += milliSec;
while (!this.done && this.currentDisplayTime > this.tileDisplayDuration)
{
if(this.shutDownFlag && this.currentTile >= numTiles){
this.done = true;
this.shutDownCb();
} else {
this.currentDisplayTime -= this.tileDisplayDuration;
this.currentTile++;
if (this.currentTile == numTiles && !this.shutDownFlag)
this.currentTile = repeatAtTile;
var currentColumn = this.currentTile % this.tilesHorizontal;
texture.offset.x = currentColumn / this.tilesHorizontal;
var currentRow = Math.floor( this.currentTile / this.tilesHorizontal );
texture.offset.y = 1-(currentRow / this.tilesVertical) - 1/this.tilesVertical;
}
}
};
this.shutDown = function(cb){
_this.shutDownFlag = true;
_this.shutDownCb = cb;
}
}
/* globe */
/* private globe function */
var globe_latLonToXY = function(width, height, lat,lon){
var x = Math.floor(width/2.0 + (width/360.0)*lon);
var y = Math.floor(height - (height/2.0 + (height/180.0)*lat));
return {x: x, y:y};
};
var globe_pixelData;
var globe_isPixelBlack = function(context, x, y, width, height){
if(globe_pixelData == undefined){
globe_pixelData = context.getImageData(0,0,width, height);
}
return globe_pixelData.data[(y * globe_pixelData.width + x) * 4] === 0;
};
var globe_samplePoints = function(projectionContext, width, height, latoffset, lonoffset, latinc, loninc, cb){
var points = [];
for(var lat = 90-latoffset; lat > -90; lat -= latinc){
for(var lon = -180+lonoffset; lon < 180; lon += loninc){
var point = globe_latLonToXY(width, height, lat, lon);
if(globe_isPixelBlack(projectionContext,point.x, point.y, width, height)){
cb({lat: lat, lon: lon});
points.push({lat: lat, lon: lon});
}
}
}
return points;
};
var globe_mapPoint = function(lat, lng, scale) {
if(!scale){
scale = 500;
}
var phi = (90 - lat) * Math.PI / 180;
var theta = (180 - lng) * Math.PI / 180;
var x = scale * Math.sin(phi) * Math.cos(theta);
var y = scale * Math.cos(phi);
var z = scale * Math.sin(phi) * Math.sin(theta);
return {x: x, y: y, z:z};
}
var globe_addPointAnimation = function(when, verticleIndex, position){
var pCount = this.globe_pointAnimations.length-1;
while(pCount > 0 && this.globe_pointAnimations[pCount].when < when){
pCount--;
}
this.globe_pointAnimations.splice(pCount+1,0, {when: when, verticleIndex: verticleIndex, position: position});
};
var globe_runPointAnimations = function(){
var next;
if(!this.firstRunTime){
this.firstRunTime = Date.now();
}
if(this.globe_pointAnimations.length == 0){
return;
}
while(this.globe_pointAnimations.length > 0 && this.firstRunTime + (next = this.globe_pointAnimations.pop()).when < Date.now()){
this.globe_particles.geometry.vertices[next.verticleIndex].x = next.position.x;
this.globe_particles.geometry.vertices[next.verticleIndex].y = next.position.y;
this.globe_particles.geometry.vertices[next.verticleIndex].z = next.position.z;
this.globe_particles.geometry.verticesNeedUpdate = true;
}
if(this.firstRunTime + next.when >= Date.now()){
this.globe_pointAnimations.push(next);
}
};
var globe_createLabel = function(text, x, y, z, size, color, underlineColor) {
var canvas = document.createElement("canvas");
var context = canvas.getContext("2d");
context.font = size + "pt Inconsolata";
var textWidth = context.measureText(text).width;
canvas.width = textWidth;
canvas.height = size + 10;
if(underlineColor){
canvas.height += 30;
}
context = canvas.getContext("2d");
context.font = size + "pt Inconsolata";
context.textAlign = "center";
context.textBaseline = "middle";
context.strokeStyle = 'black';
context.miterLimit = 2;
context.lineJoin = 'circle';
context.lineWidth = 6;
context.strokeText(text, canvas.width / 2, canvas.height / 2);
context.lineWidth = 1;
context.fillStyle = color;
context.fillText(text, canvas.width / 2, canvas.height / 2);
if(underlineColor){
context.strokeStyle=underlineColor;
context.lineWidth=2;
context.beginPath();
context.moveTo(0, canvas.height-10);
context.lineTo(canvas.width-1, canvas.height-10);
context.stroke();
}
var texture = new THREE.Texture(canvas);
texture.needsUpdate = true;
var material = new THREE.SpriteMaterial({
map : texture,
useScreenCoordinates: false,
opacity:0,
depthTest: false,
fog: true
});
var sprite = new THREE.Sprite(material);
sprite.position = {x: x*1.1, y: y + (y < 0 ? -15 : 30), z: z*1.1};
sprite.scale.set(canvas.width, canvas.height);
new TWEEN.Tween( {opacity: 0})
.to( {opacity: 1}, 500 )
.onUpdate(function(){
material.opacity = this.opacity
}).delay(1000)
.start();
return sprite;
}
var globe_createSatelliteCanvas = function(numFrames, pixels, rows, waveStart, numWaves) {
var canvas = document.createElement("canvas");
var cols = numFrames / rows;
var waveInterval = Math.floor((numFrames-waveStart)/numWaves);
var waveDist = pixels - 25; // width - center of satellite
var distPerFrame = waveDist / (numFrames-waveStart)
canvas.width=numFrames*pixels / rows;
canvas.height=pixels*rows;
var ctx=canvas.getContext("2d");
var offsetx = 0,
offsety = 0;
var curRow = 0;
for(var i = 0; i< numFrames; i++){
if(i - curRow * cols >= cols){
offsetx = 0;
offsety += pixels;
curRow++;
}
var centerx = offsetx + 25;
var centery = offsety + Math.floor(pixels/2);
/* white circle around red core */
// i have between 0 and wavestart to fade in
// i have between wavestart and waveend - (time between waves*2)
// to do a full spin close and then back open
// i have between waveend-2*(timebetween waves)/2 and waveend to rotate Math.PI/4 degrees
// this is probably the ugliest code in all of here -- basically I just messed arund with stuff until it looked ok
ctx.lineWidth=2;
ctx.strokeStyle="#FFFFFF";
var buffer=Math.PI/16;
var start = -Math.PI + Math.PI/4;
var radius = 8;
var repeatAt = Math.floor(numFrames-2*(numFrames-waveStart)/numWaves)+1;
/* fade in and out */
if(i<waveStart){
radius = radius*i/waveStart;
}
var swirlDone = Math.floor((repeatAt-waveStart) / 2) + waveStart;
for(var n = 0; n < 4; n++){
ctx.beginPath();
if(i < waveStart || i>=numFrames){
ctx.arc(centerx, centery, radius,n* Math.PI/2 + start+buffer, n*Math.PI/2 + start+Math.PI/2-2*buffer);
} else if(i > waveStart && i < swirlDone){
var totalTimeToComplete = swirlDone - waveStart;
var distToGo = 3*Math.PI/2;
var currentStep = (i-waveStart);
var movementPerStep = distToGo / totalTimeToComplete;
var startAngle = -Math.PI + Math.PI/4 + buffer + movementPerStep*currentStep;
ctx.arc(centerx, centery, radius,Math.max(n*Math.PI/2 + start,startAngle), Math.max(n*Math.PI/2 + start + Math.PI/2 - 2*buffer, startAngle +Math.PI/2 - 2*buffer));
} else if(i >= swirlDone && i< repeatAt){
var totalTimeToComplete = repeatAt - swirlDone;
var distToGo = n*2*Math.PI/4;
var currentStep = (i-swirlDone);
var movementPerStep = distToGo / totalTimeToComplete;
var startAngle = Math.PI/2 + Math.PI/4 + buffer + movementPerStep*currentStep;
ctx.arc(centerx, centery, radius,startAngle, startAngle + Math.PI/2 - 2*buffer);
} else if(i >= repeatAt && i < (numFrames-repeatAt)/2 + repeatAt){
var totalTimeToComplete = (numFrames-repeatAt)/2;
var distToGo = Math.PI/2;
var currentStep = (i-repeatAt);
var movementPerStep = distToGo / totalTimeToComplete;
var startAngle = n*(Math.PI/2)+ Math.PI/4 + buffer + movementPerStep*currentStep;
ctx.arc(centerx, centery, radius,startAngle, startAngle + Math.PI/2 - 2*buffer);
} else{
ctx.arc(centerx, centery, radius,n* Math.PI/2 + start+buffer, n*Math.PI/2 + start+Math.PI/2-2*buffer);
}
ctx.stroke();
}
// frame i'm on * distance per frame
/* waves going out */
var frameOn;
for(var wi = 0; wi<numWaves; wi++){
frameOn = i-(waveInterval*wi)-waveStart;
if(frameOn > 0 && frameOn * distPerFrame < pixels - 25){
ctx.strokeStyle="rgba(255,255,255," + (.9-frameOn*distPerFrame/(pixels-25)) + ")";
ctx.lineWidth=2;
ctx.beginPath();
ctx.arc(centerx, centery, frameOn * distPerFrame, -Math.PI/12, Math.PI/12);
ctx.stroke();
}
}
/* red circle in middle */
ctx.fillStyle="#000";
ctx.beginPath();
ctx.arc(centerx,centery,3,0,2*Math.PI);
ctx.fill();
ctx.strokeStyle="#FF0000";
ctx.lineWidth=2;
ctx.beginPath();
if(i<waveStart){
ctx.arc(centerx,centery,3*i/waveStart,0,2*Math.PI);
} else {
ctx.arc(centerx,centery,3,0,2*Math.PI);
}
ctx.stroke();
offsetx += pixels;
}
return canvas;
};
var globe_createSpecialMarkerCanvas = function() {
var canvas = document.createElement("canvas");
canvas.width=100;
canvas.height=100;
var ctx=canvas.getContext("2d");
ctx.strokeStyle="#FFCC00";
ctx.lineWidth=3;
ctx.beginPath();
ctx.arc(canvas.width/2, canvas.height/2, canvas.width/3+10, 0, 2* Math.PI);
ctx.stroke();
ctx.fillStyle="#FFCC00";
ctx.beginPath();
ctx.arc(canvas.width/2, canvas.height/2, canvas.width/4, 0, 2* Math.PI);
ctx.fill();
return canvas;
}
var globe_mainParticles = function(){
var material, geometry;
var colors = [];
var sprite = this.hexTexture;
var myColors1 = pusher.color('#ffcc00').hueSet();
var myColors = [];
for(var i = 0; i< myColors1.length; i++){
myColors.push(myColors1[i]);
// myColors.push(myColors1[i].shade(.2 + Math.random()/2.0));
// myColors.push(myColors1[i].shade(.2 + Math.random()/2.0));
}
var geometry = new THREE.Geometry();
for ( i = 0; i < this.points.length; i ++ ) {
var vertex = new THREE.Vector3();
var point = globe_mapPoint(this.points[i].lat, this.points[i].lon, 500);
var delay = this.swirlTime*((180+this.points[i].lon)/360.0);
vertex.x = 0;
vertex.y = 0;
vertex.z = this.cameraDistance+1;
geometry.vertices.push( vertex );
globe_addPointAnimation.call(this,delay, i, {
x : point.x*this.swirlMultiplier,
y : point.y*this.swirlMultiplier,
z : point.z*this.swirlMultiplier});
for(var a = 0; a < 4; a++){
globe_addPointAnimation.call(this,delay + 500 + (60)*a, i, {
x : point.x*(this.swirlMultiplier - (.1 + a/40.0)),
y : point.y*(this.swirlMultiplier - (.1 + a/40.0)),
z : point.z*(this.swirlMultiplier - (.1 + a/40.0))});
}
globe_addPointAnimation.call(this,delay + 690, i, {
x : point.x,
y : point.y,
z : point.z});
colors[i] = new THREE.Color( myColors[Math.floor(Math.random() * myColors.length)].hex6());
}
geometry.colors = colors;
material = new THREE.ParticleSystemMaterial( { size: 13, map: sprite, vertexColors: true, transparent: false} );
this.globe_particles = new THREE.ParticleSystem( geometry, material );
this.globe_particles.geometry.dynamic=true;
this.scene.add( this.globe_particles );
};
var globe_swirls = function(){
var geometrySpline;
var sPoint;
var _this = this;
this.swirlMaterial = new THREE.LineBasicMaterial({
color: 0x8FD8D8,
transparent: true,
linewidth: 2,
opacity: .8
});
for(var i = 0; i<75; i++){
geometrySpline = new THREE.Geometry();
var lat = Math.random()*180 + 90;
var lon = Math.random()*5;
var lenBase = 4 + Math.floor(Math.random()*5);
if(Math.random()<.3){
lon = Math.random()*30 - 50;
lenBase = 3 + Math.floor(Math.random()*3);
}
for(var j = 0; j< lenBase; j++){
var thisPoint = globe_mapPoint(lat, lon - j * 5);
sPoint = new THREE.Vector3(thisPoint.x*this.swirlMultiplier, thisPoint.y*this.swirlMultiplier, thisPoint.z*this.swirlMultiplier);
geometrySpline.vertices.push(sPoint);
}
this.swirl.add(new THREE.Line(geometrySpline, this.swirlMaterial));
}
this.scene.add(this.swirl);
};
var globe_removeMarker = function(marker){
var pos = marker.line.geometry.vertices[1];
var _this = this;
var scaleDownBy = 1+ Math.random()*.2;
if(!marker.active){
return;
}
marker.active = false;
for(var i = marker.startSmokeIndex; i< marker.smokeCount + marker.startSmokeIndex; i++){
var realI = i % _this.smokeAttributes.active.value.length;
_this.smokeAttributes.active.value[realI] = 0.0;
_this.smokeAttributes.active.needsUpdate = true;
}
new TWEEN.Tween({posx: pos.x, posy: pos.y, posz: pos.z, opacity: 1})
.to( {posx: pos.x/scaleDownBy, posy: pos.y/scaleDownBy, posz: pos.z/scaleDownBy, opacity: 0}, 1000 )
.onUpdate(function(){
marker.line.geometry.vertices[1].set(this.posx, this.posy, this.posz);
marker.line.geometry.verticesNeedUpdate = true;
marker.label.material.opacity = this.opacity;
marker.top.material.opacity = this.opacity;
marker.top.position.set(this.posx, this.posy, this.posz);
})
.onComplete(function(){
_this.scene.remove(marker.label);
_this.scene.remove(marker.top);
})
.start();
this.quills.push({
line: marker.line,
latlng: marker.latlng
});
if(this.quills.length > this.maxQuills){
globe_removeQuill.call(this, this.quills.shift());
}
};
var globe_removeQuill = function(quill){
var pos = quill.line.geometry.vertices[1];
var pos2 = quill.line.geometry.vertices[0];
var _this = this;
var scaleDownBy = 1+ Math.random()*.2;
delete this.markerIndex[quill.latlng];
new TWEEN.Tween({posx: pos.x, posy: pos.y, posz: pos.z, opacity: 1})
.to( {posx: pos2.x, posy: pos2.y, posz: pos2.z}, 1000 )
.onUpdate(function(){
quill.line.geometry.vertices[1].set(this.posx, this.posy, this.posz);
quill.line.geometry.verticesNeedUpdate = true;
})
.onComplete(function(){
_this.scene.remove(quill.line);
})
.start();
};
var globe_updateSatellites = function(renderTime){
for(var i = 0; i< this.satelliteAnimations.length; i++){
this.satelliteAnimations[i].update(renderTime);
}
};
var globe_registerMarker = function(marker, lat, lng){
var labelKey = Math.floor(lat/20) + '-' + Math.floor(lng/40);
if(Math.abs(lat)>80){
labelKey = Math.floor(lat/20);
}
this.markerCoords[labelKey] = marker;
};
var globe_findNearbyMarkers = function(lat, lng){
var ret = [];
var labelKey = Math.floor(lat/20) + '-' + Math.floor(lng/40);
if(Math.abs(lat)>80){
labelKey = Math.floor(lat/20);
}
if(this.markerCoords[labelKey]){
ret.push(this.markerCoords[labelKey]);
}
return ret;
};
/* globe constructor */
function globe(opts){
if(!opts){
opts = {};
}
var baseSampleMultiplier = .85;
var defaults = {
mapUrl: "equirectangle_projection.png",
size: 100,
width: document.width,
height: document.height,
swirlMultiplier: 1.15,
swirlTime: 3500,
cameraDistance: 1700,
samples: [
{
offsetLat: 0,
offsetLon: 0,
incLat: baseSampleMultiplier * 2,
incLon: baseSampleMultiplier * 4
},
{
offsetLat: baseSampleMultiplier,
offsetLon: baseSampleMultiplier * 2,
incLat: baseSampleMultiplier * 2,
incLon: baseSampleMultiplier * 4
}
],
points: [],
globe_pointAnimations: [],
swirl: new THREE.Object3D(),
markers: [],
quills: [],
markerCoords: {},
maxMarkers: 20,
maxQuills:100,
markerIndex: {},
satelliteAnimations: [],
satelliteMeshes: []
};
this.smokeIndex = 0;
extend(opts, defaults);
for(var i in defaults){
if(!this[i]){
this[i] = defaults[i];
}
}
}
/* public globe functions */
globe.prototype.init = function(cb){
var projectionContext,
img = document.createElement('img'),
projectionCanvas = document.createElement('canvas'),
_this = this;
document.body.appendChild(projectionCanvas);
projectionContext = projectionCanvas.getContext('2d');
var numRegistered = 0;
var registerCallback = function(){
numRegistered++;
return function(){
numRegistered--;
if(numRegistered == 0){
//image has loaded, may rsume
projectionCanvas.width = img.width;
projectionCanvas.height = img.height;
projectionContext.drawImage(img, 0, 0, img.width, img.height);
for (var i = 0; i< _this.samples.length; i++){
globe_samplePoints(projectionContext,img.width, img.height, _this.samples[i].offsetLat, _this.samples[i].offsetLon, _this.samples[i].incLat, _this.samples[i].incLon, function(point){
if((point.lat > -60 || Math.random() > .9) && Math.random()>.2){ // thin it out (especially antartica)
_this.points.push(point);
}
});
}
document.body.removeChild(projectionCanvas);
// create the webgl context, renderer and camera
if(_this.containerId){
_this.container = document.getElementById(_this.containerId);
_this.width = _this.container.clientWidth;
_this.height = _this.container.clientHeight;
} else {
_this.container = document.createElement( 'div' );
_this.container.width = _this.width;
_this.container.height = _this.height;
document.body.appendChild( _this.container );
}
// TEMP
// _this.container.appendChild( _this.specialPointCanvas);
_this.renderer = new THREE.WebGLRenderer( { antialias:true } );
// _this.renderer = new THREE.CanvasRenderer( { clearAlpha: 1 } );
_this.renderer.setSize( _this.width, _this.height);
// _this.renderer.autoClear = false;
_this.container.appendChild( _this.renderer.domElement );
// create the camera
_this.camera = new THREE.PerspectiveCamera( 50, _this.width / _this.height, 1, _this.cameraDistance + 275 );
_this.camera.position.z = _this.cameraDistance;
_this.cameraAngle=(Math.PI * 2) * .5;
// create the scene
_this.scene = new THREE.Scene();
_this.scene.fog = new THREE.Fog( 0x000000, _this.cameraDistance-200, _this.cameraDistance+275 );
// add the globe particles
globe_mainParticles.call(_this);
// add the swirls
globe_swirls.call(_this);
// pregenerate the satellite canvas
var numFrames = 50;
var pixels = 100;
var rows = 10;
var waveStart = Math.floor(numFrames/8);
var numWaves = 8;
var repeatAt = Math.floor(numFrames-2*(numFrames-waveStart)/numWaves)+1;
_this.satelliteCanvas = globe_createSatelliteCanvas.call(this, numFrames, pixels, rows, waveStart, numWaves);
// initialize the smoke
// create particle system
_this.smokeParticleGeometry = new THREE.Geometry();
_this.smokeVertexShader = [
"#define PI 3.141592653589793238462643",
"#define DISTANCE 600.0",
"attribute float myStartTime;",
"attribute float myStartLat;",
"attribute float myStartLon;",
"attribute float active;",
"uniform float currentTime;",
"uniform vec3 color;",
"varying vec4 vColor;",
"",
"vec3 getPos(float lat, float lon)",
"{",
"if (lon < -180.0){",
" lon = 180.0;",
"}",
"float phi = (90.0 - lat) * PI / 180.0;",
"float theta = (180.0 - lon) * PI / 180.0;",
"float x = DISTANCE * sin(phi) * cos(theta);",
"float y = DISTANCE * cos(phi);",
"float z = DISTANCE * sin(phi) * sin(theta);",
"return vec3(x, y, z);",
"}",
"",
"void main()",
"{",
"float dt = currentTime - myStartTime;",
"if (dt < 0.0){",
"dt = 0.0;",
"}",
"if (dt > 0.0 && active > 0.0) {",
"dt = mod(dt,1500.0);",
"}",
"float opacity = 1.0 - dt/ 1500.0;",
"if (dt == 0.0){",
"opacity = 0.0;",
"}",
"float cameraAngle = (2.0 * PI) / (20000.0/currentTime);",
"float myAngle = (180.0-myStartLon) * PI / 180.0;",
"opacity = opacity * (cos(myAngle - cameraAngle - PI) + 1.0)/2.0;",
"float newPosRaw = myStartLon - (dt / 50.0);",
"vec3 newPos = getPos(myStartLat, myStartLon - ( dt / 50.0));",
"vColor = vec4( color, opacity );", // set color associated to vertex; use later in fragment shader.
"vec4 mvPosition = modelViewMatrix * vec4( newPos, 1.0 );",
"gl_PointSize = 2.5 - (dt / 1500.0);",
"gl_Position = projectionMatrix * mvPosition;",
"}"
].join("\n");
_this.smokeFragmentShader = [
"varying vec4 vColor;",
"void main()",
"{",
"gl_FragColor = vColor;",
"}"
].join("\n");
_this.smokeAttributes = {
myStartTime: {type: 'f', value: []},
myStartLat: {type: 'f', value: []},
myStartLon: {type: 'f', value: []},
active: {type: 'f', value: []}
};
_this.smokeUniforms = {
currentTime: { type: 'f', value: 0.0},
color: { type: 'c', value: new THREE.Color("#aaa")},
}
_this.smokeMaterial = new THREE.ShaderMaterial( {
uniforms: _this.smokeUniforms,
attributes: _this.smokeAttributes,
vertexShader: _this.smokeVertexShader,
fragmentShader: _this.smokeFragmentShader,
transparent: true
});
for(var i = 0; i< 2000; i++){
var vertex = new THREE.Vector3();
vertex.set(1000,1000,1000);
_this.smokeParticleGeometry.vertices.push( vertex );
_this.smokeAttributes.myStartTime.value[i] = 0.0;
_this.smokeAttributes.myStartLat.value[i] = 0.0;
_this.smokeAttributes.myStartLon.value[i] = 0.0;
_this.smokeAttributes.active.value[i] = 0.0;
}
_this.smokeAttributes.myStartTime.needsUpdate = true;
_this.smokeAttributes.myStartLat.needsUpdate = true;
_this.smokeAttributes.myStartLon.needsUpdate = true;
_this.smokeAttributes.active.needsUpdate = true;
var particleSystem = new THREE.ParticleSystem( _this.smokeParticleGeometry, _this.smokeMaterial);
_this.scene.add( particleSystem);
cb();
}
}
};
this.markerTopTexture = new THREE.ImageUtils.loadTexture( 'markertop.png', undefined, registerCallback());
this.hexTexture = THREE.ImageUtils.loadTexture( "hex.png", undefined, registerCallback());
this.specialMarkerTexture = new THREE.Texture(globe_createSpecialMarkerCanvas.call(this));
this.specialMarkerTexture.needsUpdate = true;
img.addEventListener('load', registerCallback());
img.src = this.mapUrl;
};
globe.prototype.addMarker = function(lat, lng, text){
var _this = this;
var point = globe_mapPoint(lat,lng);
/* check to see if we have somebody at that exact lat-lng right now */
var checkExisting = this.markerIndex[lat + "-" + lng];
if(checkExisting){
return false;
}
// always make at least a line for the quill
//
/* add line */
var markerGeometry = new THREE.Geometry();
var markerMaterial = new THREE.LineBasicMaterial({
color: 0x8FD8D8,
});
markerGeometry.vertices.push(new THREE.Vector3(point.x, point.y, point.z));
markerGeometry.vertices.push(new THREE.Vector3(point.x, point.y, point.z));
var line = new THREE.Line(markerGeometry, markerMaterial);
this.scene.add(line);
line._globe_multiplier = 1.2; // if normal line, make it 1.2 times the radius in orbit
var existingMarkers = globe_findNearbyMarkers.call(_this, lat, lng);
var allOld = true;
for(var i = 0; i< existingMarkers.length; i++){
if(Date.now() - existingMarkers[i].creationDate < 10000){
allOld = false;
}
}
this.markerIndex[lat + "-" + lng] = true;
if(existingMarkers.length == 0 || allOld){
// get rid of old ones
for(var i = 0; i< existingMarkers.length; i++){
globe_removeMarker.call(this, existingMarkers[i]);
}
// create the new one
/* add the text */
var textSprite = globe_createLabel(text, point.x*1.18, point.y*1.18, point.z*1.18, 18, "white");
this.scene.add(textSprite);
/* add the top */
var markerTopMaterial = new THREE.SpriteMaterial({map: _this.markerTopTexture, color: 0xFD7D8, depthTest: false, fog: true});
var markerTopSprite = new THREE.Sprite(markerTopMaterial);
markerTopSprite.scale.set(15, 15);
markerTopSprite.position.set(point.x*1.2, point.y*1.2, point.z*1.2);
/* add the smoke */
var startSmokeIndex = _this.smokeIndex;
for(var i = 0; i< 30; i++){
_this.smokeParticleGeometry.vertices[_this.smokeIndex].set(point.x * 1.2, point.y * 1.2, point.z * 1.2);
_this.smokeParticleGeometry.verticesNeedUpdate = true;
_this.smokeAttributes.myStartTime.value[_this.smokeIndex] = _this.totalRunTime + (i*50 + 1500);
_this.smokeAttributes.myStartLat.value[_this.smokeIndex] = lat;
_this.smokeAttributes.myStartLon.value[_this.smokeIndex] = lng;
_this.smokeAttributes.active.value[_this.smokeIndex] = 1.0;
_this.smokeAttributes.myStartTime.needsUpdate = true;
_this.smokeAttributes.myStartLat.needsUpdate = true;
_this.smokeAttributes.myStartLon.needsUpdate = true;
_this.smokeAttributes.active.needsUpdate = true;
_this.smokeIndex++;
_this.smokeIndex = _this.smokeIndex % _this.smokeParticleGeometry.vertices.length;
}
var m = {
line: line,
label: textSprite,
top: markerTopSprite,
startSmokeIndex: startSmokeIndex,
smokeCount: 30,
active: true,
creationDate: Date.now(),
latlng: lat + "-" + lng
};
this.markers.push(m);
globe_registerMarker.call(_this,m, lat, lng);
setTimeout(function(){
_this.scene.add(markerTopSprite);
}, 1500)
} else {
line._globe_multiplier = 1 + (.05 + Math.random() * .15); // randomize how far out
this.quills.push({
line: line,
latlng: lat + "-" + lng
});
if(this.quills.length > this.maxQuills){
globe_removeQuill.call(this, this.quills.shift());
}
}
new TWEEN.Tween(point)
.to( {x: point.x*line._globe_multiplier, y: point.y*line._globe_multiplier, z: point.z*line._globe_multiplier}, 1500 )
.easing( TWEEN.Easing.Elastic.InOut )
.onUpdate(function(){
markerGeometry.vertices[1].x = this.x;
markerGeometry.vertices[1].y = this.y;
markerGeometry.vertices[1].z = this.z;
markerGeometry.verticesNeedUpdate = true;
})
.start();
}
globe.prototype.addConnectedPoints = function(lat1, lng1, text1, lat2, lng2, text2){
var _this = this;
var point1 = globe_mapPoint(lat1,lng1);
var point2 = globe_mapPoint(lat2,lng2);
var markerMaterial = new THREE.SpriteMaterial({map: _this.specialMarkerTexture, opacity: .7, depthTest: false, fog: true});
// var markerMaterial = new THREE.SpriteMaterial({map: _this.markerTopTexture});
var marker1 = new THREE.Sprite(markerMaterial);
var marker2 = new THREE.Sprite(markerMaterial);
marker1.scale.set(0, 0);
marker2.scale.set(0, 0);
marker1.position.set(point1.x*1.2, point1.y*1.2, point1.z*1.2);
marker2.position.set(point2.x*1.2, point2.y*1.2, point2.z*1.2);
this.scene.add(marker1);
this.scene.add(marker2);
var textSprite1 = globe_createLabel(text1.toUpperCase(), point1.x*1.25, point1.y*1.25, point1.z*1.25, 25, "white", "#FFCC00");
var textSprite2 = globe_createLabel(text2.toUpperCase(), point2.x*1.25, point2.y*1.25, point2.z*1.25, 25, "white", "#FFCC00");
this.scene.add(textSprite1);
this.scene.add(textSprite2);
new TWEEN.Tween({x: 0, y: 0})
.to({x: 50, y: 50}, 2000)
.easing( TWEEN.Easing.Elastic.InOut )
.onUpdate(function(){
marker1.scale.set(this.x, this.y);
})
.start();
new TWEEN.Tween({x: 0, y: 0})
.to({x: 45, y: 45}, 2000)
.easing( TWEEN.Easing.Elastic.InOut )
.onUpdate(function(){
marker2.scale.set(this.x, this.y);
})
.delay(2200)
.start();
var geometrySpline = new THREE.Geometry();
var materialSpline = new THREE.LineBasicMaterial({
color: 0xFFCC00,
transparent: true,
linewidth: 2,
opacity: .5
});
var geometrySpline2 = new THREE.Geometry();
var materialSpline2 = new THREE.LineBasicMaterial({
color: 0xFFCC00,
linewidth: 1,
transparent: true,
opacity: .5
});
var latdist = (lat2 - lat1)/99;
var londist = (lng2 - lng1)/99;
var startPoint = globe_mapPoint(lat1, lng1);
var pointList = [];
var pointList2 = [];
for(var j = 0; j< 100; j++){
// var nextlat = ((90 + lat1 + j*1)%180)-90;
// var nextlon = ((180 + lng1 + j*1)%360)-180;
var nextlat = (((90 + lat1 + j*latdist)%180)-90) * (.5 + Math.cos(j*(5*Math.PI/2)/99)/2) + (j*lat2/99/2);
var nextlon = ((180 + lng1 + j*londist)%360)-180;
pointList.push({lat: nextlat, lon: nextlon, index: j});
if(j == 0 || j == 99){
pointList2.push({lat: nextlat, lon: nextlon, index: j});
} else {
pointList2.push({lat: nextlat+1, lon: nextlon, index: j});
}
// var thisPoint = globe_mapPoint(nextlat, nextlon);
sPoint = new THREE.Vector3(startPoint.x*1.2, startPoint.y*1.2, startPoint.z*1.2);
sPoint2 = new THREE.Vector3(startPoint.x*1.2, startPoint.y*1.2, startPoint.z*1.2);
// sPoint = new THREE.Vector3(thisPoint.x*1.2, thisPoint.y*1.2, thisPoint.z*1.2);
sPoint.globe_index = j;
sPoint2.globe_index = j;
geometrySpline.vertices.push(sPoint);
geometrySpline2.vertices.push(sPoint2);
}
var currentLat = lat1;
var currentLon = lng1;
var currentPoint;
var currentVert;
var update = function(){
var nextSpot = pointList.shift();
var nextSpot2 = pointList2.shift();
for(var x = 0; x< geometrySpline.vertices.length; x++){
currentVert = geometrySpline.vertices[x];
currentPoint = globe_mapPoint(nextSpot.lat, nextSpot.lon);
currentVert2 = geometrySpline2.vertices[x];
currentPoint2 = globe_mapPoint(nextSpot2.lat, nextSpot2.lon);
if(x >= nextSpot.index){
currentVert.set(currentPoint.x*1.2, currentPoint.y*1.2, currentPoint.z*1.2);
currentVert2.set(currentPoint2.x*1.19, currentPoint2.y*1.19, currentPoint2.z*1.19);
}
geometrySpline.verticesNeedUpdate = true;
geometrySpline2.verticesNeedUpdate = true;
}
if(pointList.length > 0){
setTimeout(update,30);
}
};
setTimeout(function(){
update();
}, 2000);
this.scene.add(new THREE.Line(geometrySpline, materialSpline));
this.scene.add(new THREE.Line(geometrySpline2, materialSpline2, THREE.LinePieces));
}
globe.prototype.addSatellite = function(lat, lon, dist, newTexture){
var point = globe_mapPoint(lat,lon);
point.x *= dist;
point.y *= dist;
point.z *= dist;
var numFrames = 50;
var pixels = 100;
var rows = 10;
var waveStart = Math.floor(numFrames/8);
var numWaves = 8;
var repeatAt = Math.floor(numFrames-2*(numFrames-waveStart)/numWaves)+1;
if(newTexture || !this.satelliteTexture){
this.satelliteTexture = new THREE.Texture(this.satelliteCanvas)
this.satelliteTexture.needsUpdate = true;
var animator = new TextureAnimator(this.satelliteTexture,rows, numFrames/rows, numFrames, 80, repeatAt);
this.satelliteAnimations.push(animator);
}
var material = new THREE.MeshBasicMaterial({
map : this.satelliteTexture,
transparent: true
});
var geo = new THREE.PlaneGeometry(150,150,1,1);
var mesh = new THREE.Mesh(geo, material);
mesh.tiltMultiplier = Math.PI/2 * (1 - Math.abs(lat / 90));
mesh.tiltDirection = (lat > 0 ? -1 : 1);
mesh.lon = lon;
this.satelliteMeshes.push(mesh);
mesh.position.set(point.x, point.y, point.z);
mesh.rotation.z = -1*(lat/90)* Math.PI/2;
mesh.rotation.y = (lon/180)* Math.PI
this.scene.add(mesh);
return {mesh: mesh, shutDownFunc: (animator ? animator.shutDown : function(){})};
};
globe.prototype.removeSatellite = function(sat){
var _this = this;
function kill(){
var pos = -1;
for(var i = 0; i < _this.satelliteMeshes.length; i++){
if(sat.mesh == _this.satelliteMeshes[i]){
pos = i;
}
}
// cannot remove the first one
if(pos >= 0){
_this.scene.remove(sat.mesh);
_this.satelliteMeshes.splice(pos,1);
}
}
// don't shut down the first one
if(this.satelliteAnimations.length > 1){
sat.shutDownFunc(kill);
} else {
kill();
}
};
globe.prototype.tick = function(){
globe_runPointAnimations.call(this);
TWEEN.update();
if(!this.lastRenderDate){
this.lastRenderDate = new Date();
}
if(!this.firstRenderDate){
this.firstRenderDate = new Date();
}
this.totalRunTime = new Date() - this.firstRenderDate;
var renderTime = new Date() - this.lastRenderDate;
this.lastRenderDate = new Date();
var rotateCameraBy = (2 * Math.PI)/(20000/renderTime);
this.cameraAngle += rotateCameraBy;
this.camera.position.x = this.cameraDistance * Math.cos(this.cameraAngle);
this.camera.position.y = 400;
this.camera.position.z = this.cameraDistance * Math.sin(this.cameraAngle);
for(var i = 0; i< this.satelliteMeshes.length; i++){
var mesh = this.satelliteMeshes[i];
// this.satelliteMeshes[i].rotation.y-=rotateCameraBy;
mesh.lookAt(this.camera.position);
mesh.rotateZ(mesh.tiltDirection * Math.PI/2);
mesh.rotateZ(Math.sin(this.cameraAngle + (mesh.lon / 180) * Math.PI) * mesh.tiltMultiplier * mesh.tiltDirection * -1);
}
if(this.swirlTime > this.totalRunTime){
if(this.totalRunTime/this.swirlTime < .1){
this.swirlMaterial.opacity = (this.totalRunTime/this.swirlTime)*10 - .2;
} else if(this.totalRunTime/this.swirlTime < .9){
this.swirlMaterial.opacity = .8;
}if(this.totalRunTime/this.swirlTime > .9){
this.swirlMaterial.opacity = Math.max(1-this.totalRunTime/this.swirlTime,0);
}
this.swirl.rotateY((2 * Math.PI)/(this.swirlTime/renderTime));
} else if(this.swirl){
this.scene.remove(this.swirl);
delete[this.swirl];
}
// do the particles
this.smokeUniforms.currentTime.value = this.totalRunTime;
this.camera.lookAt( this.scene.position );
this.renderer.render( this.scene, this.camera );
globe_updateSatellites.call(this, renderTime);
}
/* Box */
var box_createSideCanvas = function(){
var sideCanvas = renderToCanvas(200, 100, function(ctx){
var gradient = ctx.createLinearGradient(0, -100, 0, 100);
gradient.addColorStop(0, "#fff");
gradient.addColorStop(1, "transparent");
ctx.fillStyle = gradient;
ctx.fillRect(0,0,200, 100);
}.bind(this));
// this.container.appendChild( sideCanvas );
return sideCanvas;
};
var Box = function(opts){
// create the webgl context, renderer and camera
if(opts.containerId){
this.container = document.getElementById(opts.containerId);
this.width = this.container.clientWidth - 5;
this.height = this.container.clientHeight - 5;
} else {
this.container = document.createElement( 'div' );
this.container.width = this.width;
this.container.height = this.height;
document.body.appendChild( this.container );
}
this.cameraDistance = 75;
this.trackers = [];
this.trackerBalls = [];
// TEMP
// _this.container.appendChild( _this.specialPointCanvas);
this.renderer = new THREE.WebGLRenderer( { antialias : true } );
// this.renderer = new THREE.CanvasRenderer( { clearAlpha: 1 } );
this.renderer.setSize( this.width, this.height);
// this.renderer.autoClear = false;
this.container.appendChild( this.renderer.domElement );
this.camera = new THREE.PerspectiveCamera( 50, this.width / this.height, 1, 500 );
// this.camera = new THREE.OrthographicCamera( this.width/-2, this.width /2, this.height /2, this.height/-2, 1, 1000 );
this.camera.position.z = this.cameraDistance;
this.cameraAngle=(Math.PI * 2) * .5;
this.boxWidth = 50;
this.boxHeight = 20;
this.boxDepth = 50;
this.scene = new THREE.Scene();
this.scene.fog = new THREE.Fog( 0x000000, this.cameraDistance-200, this.cameraDistance+550 );
/* tracker */
var tracker = {};
this.trackerGeometry = new THREE.Geometry();
var trackerMaterial = new THREE.LineBasicMaterial({
color: 0xFFFFFF,
opacity: .3,
transparent: true
});
var trackerBallCanvas = renderToCanvas(10, 10, function(ctx){
ctx.beginPath();
ctx.fillStyle = "#aaa";
ctx.arc(5,5,3,0, 2* Math.PI, true);
ctx.closePath();
ctx.fill();
});
this.trackerBallTexture = new THREE.Texture(trackerBallCanvas);
this.trackerBallTexture.needsUpdate = true;
// this.container.appendChild(this.trackerBallCanvas);
this.trackerBallMaterial = new THREE.SpriteMaterial({size: 10,
map: this.trackerBallTexture,
opacity: 0,
depthTest: false});
var forwardToBackCount = 0;
for(var i = 0; i< 7; i++){
var trackerX = Math.random() * this.boxWidth - this.boxWidth/2;
var trackerY = Math.floor(.5 + Math.random()) * this.boxHeight;
var trackerZ = Math.random() * this.boxDepth - this.boxDepth/2;
var verts = [];
var count = 0;
var randSeed = Math.random();
var randSeed2 = Math.random() + .3;
var randSeed3 = Math.random();
if(Math.random() < .5 && forwardToBackCount < 5){
// x axis
forwardToBackCount++;
var vert0 = new THREE.Vector3(trackerX, trackerY, this.boxDepth/2);
var vert1 = new THREE.Vector3(trackerX, trackerY, -this.boxDepth/2);
this.trackerGeometry.vertices.push(vert0);
this.trackerGeometry.vertices.push(vert1);
var ball = new THREE.Sprite(this.trackerBallMaterial);
ball.position.set(10,10,10);
ball.scale.set(1,1);
this.scene.add(ball);
this.trackerBalls.push(ball);
this.trackers.push({
update: (function(geo, a, balls, l, w, d, h, rand, rand2, rand3){
return function(time){
var posTime = Math.max(time, 3000);
geo.vertices[a-2].x = Math.max(-w*rand3/2,Math.min(w*rand3/2, w * Math.cos(rand2 * (rand * w + posTime/1000)) / 2));
geo.vertices[a-2].z = sCurve(Math.min(1, time/2000)) * d/2;
geo.vertices[a-1].x = Math.max(-w*rand3/2,Math.min(w*rand3/2, w * Math.cos(rand2 * (rand * w + posTime/1000)) / 2));
geo.vertices[a-1].z = -sCurve(Math.min(1, time/2000)) * d/2;
geo.verticesNeedUpdate = true;
balls[l-1].position.set(geo.vertices[a-2].x, geo.vertices[a-2].y, geo.vertices[a-2].z);
}
})(this.trackerGeometry, this.trackerGeometry.vertices.length, this.trackerBalls, this.trackerBalls.length, this.boxWidth, this.boxDepth, this.boxHeight,randSeed, randSeed2, randSeed3)
});
if(Math.random() < .3){
var vert2 = new THREE.Vector3(trackerX, this.boxHeight, this.boxDepth/2);
var vert3 = new THREE.Vector3(trackerX, 0, this.boxDepth/2);
this.trackerGeometry.vertices.push(vert2);
this.trackerGeometry.vertices.push(vert3);
var ball = new THREE.Sprite(this.trackerBallMaterial);
ball.position.set(10,10,10);
ball.scale.set(1,1);
this.scene.add(ball);
this.trackerBalls.push(ball);
this.trackers.push({
update: (function(geo, a, balls, l, w, d, h, rand, rand2, rand3){
return function(time){
var posTime = Math.max(time, 3000);
geo.vertices[a-2].x = Math.max(-w*rand3/2,Math.min(w*rand3/2,w * Math.cos(rand2 * (rand * w + posTime/1000)) / 2));
geo.vertices[a-2].y = sCurve(Math.min(1, time/2000)) * h/2 + h/2;
geo.vertices[a-1].x = Math.max(-w*rand3/2, Math.min(w*rand3/2,w * Math.cos(rand2 * (rand * w + posTime/1000)) / 2));
geo.vertices[a-1].y = h/2 -sCurve(Math.min(1, time/2000)) * h/2;
geo.verticesNeedUpdate = true;
balls[l-1].position.set(geo.vertices[a-2].x, geo.vertices[a-2].y, geo.vertices[a-2].z);
}
})(this.trackerGeometry, this.trackerGeometry.vertices.length, this.trackerBalls, this.trackerBalls.length, this.boxWidth, this.boxDepth,this.boxHeight, randSeed, randSeed2, randSeed3)
});
} else if(Math.random() > .7){
var vert2 = new THREE.Vector3(trackerX, this.boxHeight, -this.boxDepth/2);
var vert3 = new THREE.Vector3(trackerX, 0, -this.boxDepth/2);
this.trackerGeometry.vertices.push(vert2);
this.trackerGeometry.vertices.push(vert3);
var ball = new THREE.Sprite(this.trackerBallMaterial);
ball.position.set(10,10,10);
ball.scale.set(1,1);
this.scene.add(ball);
this.trackerBalls.push(ball);
this.trackers.push({
update: (function(geo, a, balls, l, w, d, h, rand, rand2, rand3){
return function(time){
var posTime = Math.max(time, 3000);
geo.vertices[a-2].x = Math.max(-w*rand3/2,Math.min(w*rand3/2,w * Math.cos(rand2 * (rand * w + posTime/1000)) / 2));
geo.vertices[a-2].y = sCurve(Math.min(1, time/2000)) * h/2 + h/2;
geo.vertices[a-1].x = Math.max(-w*rand3/2,Math.min(w*rand3/2,w * Math.cos(rand2 * (rand * w + posTime/1000)) / 2));
geo.vertices[a-1].y = h/2-sCurve(Math.min(1, time/2000)) * h/2;
geo.verticesNeedUpdate = true;
balls[l-1].position.set(geo.vertices[a-2].x, 0, geo.vertices[a-2].z);
}
})(this.trackerGeometry, this.trackerGeometry.vertices.length, this.trackerBalls, this.trackerBalls.length, this.boxWidth, this.boxDepth, this.boxHeight, randSeed, randSeed2, randSeed3)
});
}
} else {
// y axis
var vert0 = new THREE.Vector3(this.boxWidth/2, trackerY, trackerZ);
var vert1 = new THREE.Vector3(-this.boxWidth/2, trackerY, trackerZ);
this.trackerGeometry.vertices.push(vert0);
this.trackerGeometry.vertices.push(vert1);
var ball = new THREE.Sprite(this.trackerBallMaterial);
ball.position.set(10,10,10);
ball.scale.set(1,1);
this.scene.add(ball);
this.trackerBalls.push(ball);
this.trackers.push({
update: (function(geo, a, balls, l, w, d, h, rand, rand2, rand3){
return function(time){
var posTime = Math.max(time, 3000);
geo.vertices[a-2].z = Math.max(-d*rand3/2, Math.min(d*rand3/2, d * Math.cos(rand2 * (rand * d + posTime/1000)) / 2));
geo.vertices[a-1].z = Math.max(-d*rand3/2, Math.min(d*rand3/2, d * Math.cos(rand2 * (rand * d + posTime/1000)) / 2));
geo.vertices[a-2].x = sCurve(Math.min(1, time/2000)) * w/2;
geo.vertices[a-1].x = -sCurve(Math.min(1, time/2000)) * w/2
geo.verticesNeedUpdate = true;
balls[l-1].position.set(geo.vertices[a-2].x, geo.vertices[a-2].y, geo.vertices[a-2].z);
}
})(this.trackerGeometry, this.trackerGeometry.vertices.length, this.trackerBalls, this.trackerBalls.length, this.boxWidth, this.boxDepth, this.boxHeight, randSeed, randSeed2, randSeed3)
});
if(Math.random() < .3){
var vert2 = new THREE.Vector3(this.boxWidth/2, this.boxHeight, trackerZ);
var vert3 = new THREE.Vector3(this.boxWidth/2, 0, trackerZ);
this.trackerGeometry.vertices.push(vert2);
this.trackerGeometry.vertices.push(vert3);
var ball = new THREE.Sprite(this.trackerBallMaterial);
ball.position.set(10,10,10);
ball.scale.set(1,1);
this.scene.add(ball);
this.trackerBalls.push(ball);
this.trackers.push({
update: (function(geo, a, balls, l, w, d, h, rand, rand2, rand3){
return function(time){
var posTime = Math.max(time, 3000);
geo.vertices[a-2].z = Math.max(-d*rand3/2, Math.min(d*rand3/2, d * Math.cos(rand2 * (rand * d + posTime/1000)) / 2));
geo.vertices[a-1].z = Math.max(-d*rand3/2, Math.min(d*rand3/2, d * Math.cos(rand2 * (rand * d + posTime/1000)) / 2));
geo.vertices[a-2].y = h/2 + sCurve(Math.min(1, time/2000)) * h/2;
geo.vertices[a-1].y = h/2 - sCurve(Math.min(1, time/2000)) * h/2;
geo.verticesNeedUpdate = true;
balls[l-1].position.set(geo.vertices[a-2].x, geo.vertices[a-2].y, geo.vertices[a-2].z);
}
})(this.trackerGeometry, this.trackerGeometry.vertices.length, this.trackerBalls, this.trackerBalls.length, this.boxWidth, this.boxDepth, this.boxHeight, randSeed, randSeed2, randSeed3)
});
} else if(Math.random() > .7){
var vert2 = new THREE.Vector3(-this.boxWidth/2, this.boxHeight, trackerZ);
var vert3 = new THREE.Vector3(-this.boxWidth/2, 0, trackerZ);
this.trackerGeometry.vertices.push(vert2);
this.trackerGeometry.vertices.push(vert3);
var ball = new THREE.Sprite(this.trackerBallMaterial);
ball.position.set(10,10,10);
ball.scale.set(1,1);
this.scene.add(ball);
this.trackerBalls.push(ball);
this.trackers.push({
update: (function(geo, a, balls, l, w, d, h, rand, rand2, rand3){
return function(time){
var posTime = Math.max(time, 3000);
geo.vertices[a-2].z = Math.max(-d*rand3/2, Math.min(d*rand3/2, d * Math.cos(rand2 * (rand * d + time/1000)) / 2));
geo.vertices[a-1].z = Math.max(-d*rand3/2, Math.min(d*rand3/2, d * Math.cos(rand2 * (rand * d + time/1000)) / 2));
geo.vertices[a-2].y = h/2 + sCurve(Math.min(1, time/2000)) * h/2;
geo.vertices[a-1].y = h/2 - sCurve(Math.min(1, time/2000)) * h/2;
geo.verticesNeedUpdate = true;
balls[l-1].position.set(geo.vertices[a-2].x, geo.vertices[a-2].y, geo.vertices[a-2].z);
}
})(this.trackerGeometry, this.trackerGeometry.vertices.length, this.trackerBalls, this.trackerBalls.length, this.boxWidth, this.boxDepth, this.boxHeight, randSeed, randSeed2, randSeed3)
});
}
}
}
this.scene.add(new THREE.Line(this.trackerGeometry, trackerMaterial, THREE.LinePieces));
/* sides of box */
var boxTexture = new THREE.Texture(box_createSideCanvas.call(this));
boxTexture.needsUpdate = true;
// this.container.appendChild( this.satelliteCanvas);
this.sideMaterial = new THREE.MeshBasicMaterial({
map : boxTexture,
transparent: true,
opacity: 0
});
this.sideMaterial.side = THREE.DoubleSide;
var face1 = new THREE.PlaneGeometry(this.boxWidth,this.boxHeight/4,1,1);
var face2 = new THREE.PlaneGeometry(this.boxWidth,this.boxHeight/4,1,1);
var face3 = new THREE.PlaneGeometry(this.boxDepth,this.boxHeight/4,1,1);
var face4 = new THREE.PlaneGeometry(this.boxDepth,this.boxHeight/4,1,1);
var mesh1 = new THREE.Mesh(face1, this.sideMaterial);
var mesh2 = new THREE.Mesh(face2, this.sideMaterial);
var mesh3 = new THREE.Mesh(face3, this.sideMaterial);
var mesh4 = new THREE.Mesh(face4, this.sideMaterial);
mesh1.position = {x: 0, y: 7*this.boxHeight/8, z: this.boxDepth/2};
mesh2.position = {x: 0, y: 7*this.boxHeight/8, z: -this.boxDepth/2};
mesh3.position = {x: -this.boxWidth/2, y: 7*this.boxHeight/8, z: 0};
mesh4.position = {x: this.boxWidth/2, y: 7*this.boxHeight/8, z: 0};
mesh3.rotateY(Math.PI/2);
mesh4.rotateY(Math.PI/2);
this.scene.add(mesh1);
this.scene.add(mesh2);
this.scene.add(mesh3);
this.scene.add(mesh4);
// create particle system
this.particleGeometry = new THREE.Geometry();
this.particleVertexShader = [
"attribute vec3 color;",
"attribute float opacity;",
"varying vec4 vColor;",
"void main()",
"{",
"vColor = vec4( color, opacity );", // set color associated to vertex; use later in fragment shader.
"vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",
"gl_PointSize = 1.0;",
"gl_Position = projectionMatrix * mvPosition;",
"}"
].join("\n");
this.particleFragmentShader = [
"varying vec4 vColor;",
"void main()",
"{",
"gl_FragColor = vColor;",
"}"
].join("\n");
this.shaderAttributes = {
color: { type: 'c', value: []},
opacity: {type: 'f', value: []}
};
this.shaderMaterial = new THREE.ShaderMaterial( {
uniforms: {},
attributes: this.shaderAttributes,
vertexShader: this.particleVertexShader,
fragmentShader: this.particleFragmentShader,
transparent: true
});
for(var i = 0; i< this.boxWidth * this.boxDepth; i++){
var x = i % this.boxWidth - this.boxWidth/2;
var z = (Math.floor(i / this.boxDepth) -this.boxDepth/2 );
var vertex = new THREE.Vector3();
vertex.x = x;
vertex.y = (this.boxHeight)*Math.sin(x/8)*Math.cos(z/8) * (((this.boxDepth/2)-Math.abs(x))/this.boxWidth/2) * ((this.boxDepth/2-Math.abs(z))/this.boxDepth/2);
vertex.z = z;
this.particleGeometry.vertices.push( vertex );
this.shaderAttributes.color.value[i] = new THREE.Color(0x00eeee);
this.shaderAttributes.opacity.value[i] = 0.0;
}
this.particleColors = [];
for(var i = 0; i< 5; i++){
this.particleColors.push(new THREE.Color(pusher.color("#00eeee").blend("#ffcc00", i/4).hex6()));
}
var particleSystem = new THREE.ParticleSystem( this.particleGeometry, this.shaderMaterial);
this.scene.add( particleSystem);
this.frameGeometry = new THREE.Geometry();
var frameMaterial = new THREE.LineBasicMaterial({
color: 0xFFFFFF,
opacity: .5,
transparent: true
});
var maxTime = 2000;
this.frameSegments = [];
var addFrameAnimation = function(point, start, end, startTime, endTime){
this.frameSegments.push({
point: point,
startTime: 1000 + startTime + start[1] * 200,
endTime: 1000 + endTime + start[1] * 200,
func: function(t){
return {x: start[0] + (end[0]-start[0])*(t/(endTime-startTime)),
y: start[1] + (end[1]-start[1])*(t/(endTime-startTime)),
z: start[2] + (end[2]-start[2])*(t/(endTime-startTime))
};
}
});
}
for(var i = 0; i < 2; i++){
this.frameGeometry.vertices.push(new THREE.Vector3(this.boxWidth/2, i*2 - 2, this.boxDepth/2));
this.frameGeometry.vertices.push(new THREE.Vector3(this.boxWidth/2, i*2 - 2, this.boxDepth/2));
addFrameAnimation.call(this, this.frameGeometry.vertices[this.frameGeometry.vertices.length-1], [this.boxWidth/2, i*2 - 2, this.boxDepth/2], [this.boxWidth/2, i*2 - 2, -this.boxDepth/2], 0, 1000);
this.frameGeometry.vertices.push(new THREE.Vector3(this.boxWidth/2, i*2 -2, -this.boxDepth/2));
this.frameGeometry.vertices.push(new THREE.Vector3(this.boxWidth/2, i*2 - 2, -this.boxDepth/2));
addFrameAnimation.call(this, this.frameGeometry.vertices[this.frameGeometry.vertices.length-1], [this.boxWidth/2, i*2 - 2, -this.boxDepth/2], [-this.boxWidth/2, i*2 - 2, -this.boxDepth/2], 500, 1500);
this.frameGeometry.vertices.push(new THREE.Vector3(-this.boxWidth/2, i*2 - 2, -this.boxDepth/2));
this.frameGeometry.vertices.push(new THREE.Vector3(-this.boxWidth/2, i*2 - 2, -this.boxDepth/2));
addFrameAnimation.call(this, this.frameGeometry.vertices[this.frameGeometry.vertices.length-1], [-this.boxWidth/2, i*2 - 2, -this.boxDepth/2], [-this.boxWidth/2, i*2 - 2, this.boxDepth/2], 1000, 2000);
this.frameGeometry.vertices.push(new THREE.Vector3(-this.boxWidth/2, i*2 - 2, this.boxDepth/2));
this.frameGeometry.vertices.push(new THREE.Vector3(-this.boxWidth/2, i*2 - 2, this.boxDepth/2));
addFrameAnimation.call(this, this.frameGeometry.vertices[this.frameGeometry.vertices.length-1], [-this.boxWidth/2, i*2 - 2, this.boxDepth/2], [this.boxWidth/2, i*2 - 2, this.boxDepth/2], 1500, 2500);
}
this.frameGeometry.vertices.push(new THREE.Vector3(this.boxWidth/2, -2, this.boxDepth/2));
this.frameGeometry.vertices.push(new THREE.Vector3(this.boxWidth/2, -2, this.boxDepth/2));
addFrameAnimation.call(this, this.frameGeometry.vertices[this.frameGeometry.vertices.length-1], [this.boxWidth/2, -2, this.boxDepth/2], [this.boxWidth/2, 0, this.boxDepth/2], 0, 500);
this.frameGeometry.vertices.push(new THREE.Vector3(this.boxWidth/2, -2, -this.boxDepth/2));
this.frameGeometry.vertices.push(new THREE.Vector3(this.boxWidth/2, -2, -this.boxDepth/2));
addFrameAnimation.call(this, this.frameGeometry.vertices[this.frameGeometry.vertices.length-1], [this.boxWidth/2, -2, -this.boxDepth/2], [this.boxWidth/2, 0, -this.boxDepth/2], 500, 1000);
this.frameGeometry.vertices.push(new THREE.Vector3(-this.boxWidth/2, -2, -this.boxDepth/2));
this.frameGeometry.vertices.push(new THREE.Vector3(-this.boxWidth/2, -2, -this.boxDepth/2));
addFrameAnimation.call(this, this.frameGeometry.vertices[this.frameGeometry.vertices.length-1], [-this.boxWidth/2, -2, -this.boxDepth/2], [-this.boxWidth/2, 0, -this.boxDepth/2], 1000, 1500);
this.frameGeometry.vertices.push(new THREE.Vector3(-this.boxWidth/2, -2, this.boxDepth/2));
this.frameGeometry.vertices.push(new THREE.Vector3(-this.boxWidth/2, -2, this.boxDepth/2));
addFrameAnimation.call(this, this.frameGeometry.vertices[this.frameGeometry.vertices.length-1], [-this.boxWidth/2, -2, this.boxDepth/2], [-this.boxWidth/2, 0, this.boxDepth/2], 1500, 2000);
var line = new THREE.Line(this.frameGeometry, frameMaterial, THREE.LinePieces);
this.scene.add(line);
};
Box.prototype.tick = function(){
var startTime = 2000;
var maxTime = 5000;
if(!this.lastRenderDate){
this.lastRenderDate = new Date();
}
if(!this.firstRenderDate){
this.firstRenderDate = new Date();
}
var totalRunTime = new Date() - this.firstRenderDate - startTime;
if(totalRunTime < 0)
return;
var renderTime = new Date() - this.lastRenderDate;
this.lastRenderDate = new Date();
/* run intro animations */
var percentComplete = Math.min(totalRunTime, maxTime - startTime) / (maxTime - startTime);
if(!this.animationsDone){
if(totalRunTime > maxTime){
this.animationsDone = true;
totalRunTime = maxTime;
}
/* do the frame */
for(var i = 0; i<this.frameSegments.length; i++){
var fStartTime = this.frameSegments[i].startTime;
var fEndTime = this.frameSegments[i].endTime;
if(totalRunTime > fStartTime){
var point = this.frameSegments[i].point;
var func = this.frameSegments[i].func;
var newPoint = func(Math.min(totalRunTime,fEndTime) - fStartTime);
if(point.x !== newPoint.x || point.y !== newPoint.y || point.z !== newPoint.z){
point.x = newPoint.x;
point.y = newPoint.y;
point.z = newPoint.z;
this.frameGeometry.verticesNeedUpdate = true;
}
}
}
/* do the particles */
// this.particleMaterial.opacity = Math.pow(percentComplete, 2) / 2;
/* do the sides */
this.trackerBallMaterial.opacity = sCurve(percentComplete);
if(totalRunTime > 1000){
this.sideMaterial.opacity = Math.pow((Math.min(totalRunTime, maxTime)-1000) / (maxTime-1000), 2);
}
}
/* move the lines */
for(var i = 0; i< this.trackers.length; i++){
this.trackers[i].update(totalRunTime);
}
/* move the particles inside */
for(var i = 0; i< this.particleGeometry.vertices.length; i++){
var x = (i %this.boxWidth) - this.boxWidth/2;
var z = (Math.floor(i / this.boxDepth) -this.boxDepth/2 );
var y = Math.sin(Math.PI * 2 * (((totalRunTime / 100) % this.boxHeight)/this.boxHeight)) * this.boxHeight * Math.sin(x/8)*Math.cos(z/8) * (((this.boxWidth/2)-Math.abs(x))/(this.boxWidth/2)) * (((this.boxDepth/2)-Math.abs(z))/(this.boxDepth/2));
var maxColors = this.particleColors.length - 1;
this.particleGeometry.vertices[i].x = x;
this.particleGeometry.vertices[i].y = y
this.particleGeometry.vertices[i].z = z;
// fix that 36...
if(!this.animationsDone){
this.shaderAttributes.opacity.value[i] = Math.min(1,(36 - Math.sqrt(Math.pow(x,2) + Math.pow(z,2)))/36 * sCurve(percentComplete) + Math.max(y,0)/10);
}
this.shaderAttributes.color.value[i] = this.particleColors[Math.min(maxColors,Math.max(0,Math.floor(y)))];
}
if(!this.animationsDone){
this.shaderAttributes.opacity.needsUpdate = true;
}
this.shaderAttributes.color.needsUpdate = true;
this.particleGeometry.verticesNeedUpdate = true;
var rotateCameraBy = (2 * Math.PI)/(20000/renderTime);
this.cameraAngle += rotateCameraBy;
this.camera.position.x = this.cameraDistance * Math.cos(this.cameraAngle);
this.camera.position.y = this.cameraDistance/2;
this.camera.position.z = this.cameraDistance * Math.sin(this.cameraAngle);
this.camera.lookAt( this.scene.position );
this.renderer.render( this.scene, this.camera );
};
/* Satbar */
var SatBar = function(canvasId){
this.canvas = document.getElementById(canvasId);
this.width = this.canvas.width;
this.height = this.canvas.height;
this.context = this.canvas.getContext("2d");
// this.context.font = "8pt Arial";
this.context.font = "7pt Inconsolata";
this.context.textAlign = "center";
this.context.textBaseline = "middle";
};
var satbar_drawBox = function(context,x,y,size, zone, percent){
if(!percent){
percent = 1;
}
context.strokeStyle="#00EEEE";
context.fillStyle="#00EEEE";
context.beginPath();
context.moveTo(x, y-size*percent/2);
context.lineTo(x, y+size*percent/2);
context.stroke();
context.beginPath();
context.moveTo(x-size*percent/2, y);
context.lineTo(x+size*percent/2, y);
context.stroke();
if(zone !== undefined && zone>-1){
context.fillRect(x-size*percent/2 + (zone%2)*size*percent/2, y-size*percent/2 + Math.floor(zone/2)*size*percent/2, size*percent/2,size*percent/2);
}
context.beginPath();
context.arc(x,y,size*percent/4,0,Math.PI*2);
context.fillStyle="#000";
context.fill();
context.fillStyle="#00EEEE";
context.rect(x-size*percent/2,y-size*percent/2,size*percent,size*percent);
context.stroke();
// this.context.rect(5,15,20,20);
};
var satbar_drawLines = function(context,x,width, percent){
context.strokeStyle="#00EEEE";
context.lineWidth=2;
context.moveTo(x, 15);
context.lineTo(x+width * percent, 15);
context.moveTo(x, 35);
context.lineTo(x+width * percent, 35);
context.moveTo(35 + percent*(width-35)/3 + 5, 15);
context.lineTo(35 + percent*(width-35)/3 + 5, 20);
context.moveTo(35 + 2*percent*(width-35)/3, 15);
context.lineTo(35 + 2*percent*(width-35)/3, 20);
context.moveTo(35 + percent*(width-35)/3 + 5, 30);
context.lineTo(35 + percent*(width-35)/3 + 5, 35);
context.moveTo(35 + 2*percent*(width-35)/3, 30);
context.lineTo(35 + 2*percent*(width-35)/3, 35);
context.stroke();
if(percent >.8){
context.fillStyle=shadeColor("#000000",100*(percent*percent));
context.fillText("satellite", 35 + (width-35)/6, 25);
context.fillText("data", 35+percent*(width-35)/2, 25);
context.fillText("uplink", 35+percent*5*(width-35)/6, 25);
}
};
SatBar.prototype.tick = function(){
if(!this.firstTick){
this.firstTick = new Date();
}
var timeSinceStarted = new Date() - this.firstTick;
var finishTime = 2000;
if(timeSinceStarted > 2200){
// we've finished rendereding
return;
}
var percentComplete = Math.min(1,timeSinceStarted/finishTime);
this.context.clearRect(0,0,this.width, this.height);
/* draw lines */
satbar_drawLines(this.context, 35, this.width, percentComplete);
/* draw insignia
*/
satbar_drawBox(this.context, 15, 25, 20, 1, Math.min(1,percentComplete*2));
}
SatBar.prototype.setZone = function(zone){
zone = Math.max(-1,zone);
zone = Math.min(3,zone);
this.context.clearRect(0,0,35, 35);
satbar_drawBox(this.context, 15, 25, 20, zone, 1);
}
var LocationBar = function(canvasId, loclist){
this.canvas = document.getElementById(canvasId);
this.width = this.canvas.width;
this.height = this.canvas.height;
this.locations = {};
this.locations = loclist;
this.context = this.canvas.getContext("2d");
// this.context.font = "8pt Arial";
this.context.font = "8pt Inconsolata";
this.context.textAlign = "top";
this.context.textBaseline = "left";
};
var locationbar_drawLocation = function(key, y, percentage){
this.context.strokeStyle="#00EEEE";
this.context.lineWidth=1;
this.context.beginPath();
this.context.moveTo(0, y+22);
this.context.lineTo(this.width * percentage, y+22);
this.context.stroke();
this.context.closePath()
this.context.strokeStyle="#666";
this.context.beginPath();
this.context.moveTo(0, y+30);
this.context.lineTo(this.width * percentage, y+30);
this.context.stroke();
this.context.closePath()
if(this.locations[key].color == undefined){
this.locations[key].color = Math.floor(Math.random()*2)
}
var labelWidth = this.context.measureText(this.locations[key].label1).width;
if(this.locations[key].color){
this.context.fillStyle = "#00EEEE";
} else {
this.context.fillStyle = "#FFCC00";
}
this.context.fillRect(0, y+2,labelWidth+8,10);
this.context.fillStyle = "#000";
this.context.fillText(this.locations[key].label1, 4, y+11);
this.context.fillStyle = "#FFF";
this.context.fillText(this.locations[key].label2, 14 + labelWidth, y+11);
this.context.fillStyle = "#00EEEE";
for(var i = 0; i<this.locations[key].points.length; i++){
this.context.beginPath();
this.context.arc(this.width * percentage * this.locations[key].points[i], y+22,2,0,Math.PI*2);
this.context.fill();
}
};
LocationBar.prototype.tick = function(){
if(!this.firstTick){
this.firstTick = new Date();
}
var timeSinceStarted = new Date() - this.firstTick;
var finishTime = 2000;
// if(timeSinceStarted > 2200){
// // we've finished rendereding
// return;
// }
var percentComplete = Math.min(1,timeSinceStarted/finishTime);
this.context.clearRect(0,0,this.width, this.height);
var count = 0;
for(var i in this.locations){
if(!this.locations[i].blank){
locationbar_drawLocation.call(this, i, count*45+10, percentComplete);
}
count++;
}
}
var SimpleClock = function(canvasId){
if(this.firstTick == undefined){
this.firstTick = new Date();
}
var canvas = document.getElementById(canvasId);
this.context = canvas.getContext("2d");
this.width = canvas.width;
this.height = canvas.height;
this.centerx = this.width/2;
this.centery = this.height/2;
this.backBuffer = renderToCanvas(this.width, this.height, function(ctx){
var x = canvas.width / 2;
var y = canvas.height / 2;
ctx.beginPath();
ctx.strokeStyle="#666";
ctx.arc(x, y, 8, 0, Math.PI*2);
ctx.stroke();
ctx.closePath();
ctx.beginPath();
ctx.strokeStyle="#333";
ctx.arc(x, y, 16, 0, Math.PI*2);
ctx.stroke();
ctx.beginPath();
ctx.strokeStyle="#666";
ctx.arc(x, y, 24, 0, Math.PI*2);
ctx.stroke();
ctx.closePath();
ctx.strokeStyle="#333";
ctx.beginPath();
ctx.moveTo(x,y+8)
ctx.lineTo(x,y+24)
ctx.moveTo(x,y-8)
ctx.lineTo(x,y-24)
ctx.moveTo(x+8,y)
ctx.lineTo(x+24,y)
ctx.moveTo(x-8,y)
ctx.lineTo(x-24,y)
ctx.stroke();
ctx.closePath();
});
}
SimpleClock.prototype.tick = function(){
var timeSinceStarted = new Date() - this.firstTick;
this.context.clearRect(0,0,this.width, this.height);
this.context.drawImage(this.backBuffer, 0, 0);
this.context.strokeStyle="#666";
this.context.beginPath();
this.context.moveTo(this.centerx, this.centery);
this.context.lineTo(this.centerx + 24*Math.sin(timeSinceStarted/10000), this.centery - 24*Math.cos(timeSinceStarted/10000));
this.context.moveTo(this.centerx, this.centery);
this.context.lineTo(this.centerx + 24*Math.sin(timeSinceStarted/100000), this.centery - 24*Math.cos(timeSinceStarted/100000));
this.context.stroke();
this.context.closePath();
};
var timertrees_drawTree = function(x,height){
this.context.beginPath();
this.context.lineWidth=1;
this.context.moveTo(x, this.height-9);
this.context.lineTo(x, height);
this.context.stroke();
this.context.closePath();
this.context.beginPath();
this.context.arc(x, height, 2, 0, Math.PI*2);
this.context.fill();
this.context.closePath();
}
var timertrees_render = function(){
var i = 0,
lineLocation = 0,
prevLocations = [],
start = .25 + (12-moment.utc().hour())/24,
end = .75 + (12-moment.utc().hour())/24,
lines = [];
var locationOk = function(loc, width){
var j = 0;
for( ; j< prevLocations.length; j++){
if(Math.abs(loc-prevLocations[j]) < 5){
return false;
}
}
return true;
}
if(start < 0){
lines.push({left: 0, right: end * this.width});
lines.push({left: (1 + start) * this.width, right: this.width});
} else if(start > .5) {
lines.push({left: 0, right: (1-end) * this.width});
lines.push({left: start * this.width, right: this.width});
} else {
lines.push({left: start * this.width, right: end * this.width})
}
this.context.beginPath();
this.context.lineWidth=1;
this.context.strokeStyle="#666";
this.context.moveTo(0, this.height-9);
this.context.lineTo(this.width-1,this.height-9);
this.context.stroke();
this.context.closePath();
for(var sub = i; sub< lines.length; sub++){
this.context.beginPath();
this.context.strokeStyle="#FFCC00";
this.context.lineWidth=2;
this.context.moveTo(lines[sub].left, this.height-9);
this.context.lineTo(lines[sub].right,this.height-9);
this.context.stroke();
this.context.closePath();
}
this.context.textAlign = "center";
this.context.fillStyle="#666";
this.context.font = "5pt Inconsolata";
this.context.textBaseline = "bottom";
this.context.fillText("asfdiuojfd", this.width/10, this.height);
this.context.fillText("807ujkoasd", 3*this.width/10, this.height);
this.context.fillText("asdfiounfalk", 5*this.width/10, this.height);
this.context.fillText("kjljk", 7*this.width/10, this.height);
this.context.fillText("adfoiuh", 9*this.width/10, this.height);
this.context.lineWidth=1;
this.context.strokeStyle="#00EEEE";
this.context.fillStyle="#00EEEE";
for( ; i< 20; i++){
lineLocation = Math.random() * this.width-2;
while(!locationOk(lineLocation)){
lineLocation = Math.random() * this.width-2;
}
prevLocations.push(lineLocation);
var endLocation = Math.random() * (this.height - 13) + 2;
timertrees_drawTree.call(this, lineLocation, endLocation);
}
};
var TimerTrees = function(canvasId){
if(this.firstTick == undefined){
this.firstTick = new Date();
}
var canvas = document.getElementById(canvasId);
this.context = canvas.getContext("2d");
this.width = canvas.width;
this.height = canvas.height;
timertrees_render.call(this);
};
var stockchart_addGrid = function(ctx, ticks, width, height){
ctx.beginPath();
ctx.lineWidth=2;
ctx.strokeStyle="#666";
ctx.moveTo(30, height-1);
ctx.lineTo(width-1,height-1);
ctx.stroke();
ctx.closePath();
/* draw the grid */
var newY = 0;
for(var i = 0; i< ticks;i++){
var y = i*(height/ticks);
ctx.beginPath();
ctx.lineWidth=1;
ctx.strokeStyle="#666";
ctx.moveTo(30, y);
ctx.lineTo(width-1,y);
ctx.stroke();
ctx.closePath();
}
newX = 30;
while(newX < width){
ctx.beginPath();
ctx.lineWidth=1;
ctx.strokeStyle="#666";
ctx.moveTo(newX, 0);
ctx.lineTo(newX,height);
ctx.stroke();
ctx.closePath();
newX += height/ticks;
}
// draw the far right line.
// this might be a bit hokey
ctx.beginPath();
ctx.lineWidth=1;
ctx.strokeStyle="#666";
ctx.moveTo(width-1, 0);
ctx.lineTo(width-1,height);
ctx.stroke();
ctx.closePath();
};
var StockChart = function(containerId, opts){
var defaults = {
ticks: 7,
holdTime: 10000,
swipeTime: 800,
}
extend(opts, defaults);
this.opts = defaults;
this.frames = [];
if(this.firstTick == null){
this.firstTick = new Date();
}
this.container = document.getElementById(containerId);
this.container.width = '500';
this.container.height = '105'
this.width = this.container.width;
this.height = this.container.height;
this.currentFrame = -1;
for(var j = 0; j < 4; j++){
var data = [];
for(var i = 0; i< 50; i++){
data.push(100-((20+i) + Math.random()*30));
}
var quarter = "";
if(j == 0){
quarter = "1st Quarter";
} else if(j==1){
quarter = "2nd Quarter";
} else if(j==2){
quarter = "3rd Quarter";
} else if(j==3){
quarter = "4th Quarter";
}
this.addFrame(quarter, data);
this.frames[this.frames.length-1].id = "stock-chart-canvas" + j;
this.frames[this.frames.length-1].div = document.createElement("div");
this.frames[this.frames.length-1].div.appendChild( this.frames[j] );
this.container.appendChild(this.frames[this.frames.length-1].div);
}
};
StockChart.prototype.addFrame = function(label, data) {
// get bounds of the data
var max, min;
for(var i = 0; i< data.length; i++){
if(max == undefined || max < data[i]){
max = data[i];
}
if(min == undefined || min > data[i]){
min = data[i];
}
}
var increment = (max - min) / this.opts.ticks;
var heightIncrement = (this.height) / this.opts.ticks;
var frameCanvas = renderToCanvas(this.width, this.height, function(ctx){
// draw the y ticks
ctx.fillStyle = "#000";
ctx.fillRect(0,0,this.width, this.height);
stockchart_addGrid(ctx, this.opts.ticks, this.width, this.height);
ctx.font = "5pt Inconsolata";
ctx.fillStyle="#fff";
for(var i = 0; i < this.opts.ticks; i++){
ctx.fillText(('' + (min + (this.opts.ticks - i -1)* increment)).substring(0,6), 0, heightIncrement*i+10);
ctx.beginPath();
ctx.lineWidth="1";
ctx.strokeStyle="#666";
ctx.moveTo(0, heightIncrement * (i + 1));
ctx.lineTo(30,heightIncrement * (i + 1));
ctx.stroke();
ctx.closePath();
}
var xIncrement = (this.width - 30)/(data.length-1);
ctx.beginPath();
ctx.moveTo(30,this.height-1);
ctx.lineWidth = "1px";
for(var i = 0; i < data.length; i++){
ctx.lineTo(30 + i*xIncrement, data[i]);
}
ctx.lineTo(this.width, this.height-1);
ctx.stroke();
var gradient = ctx.createLinearGradient(0, 0, 0, this.height);
gradient.addColorStop(0, shadeColor("#00eeee",-60));
gradient.addColorStop(1, 'rgba(0,238,238,.5)');
ctx.fillStyle = gradient;
ctx.fill();
ctx.closePath();
ctx.fillStyle = "rgba(255,255,255,.5)";
for(var i = 0; i < data.length; i++){
ctx.beginPath();
ctx.arc(30 + i*xIncrement, data[i], 2, 0, 2*Math.PI);
ctx.fill();
}
// draw the label
ctx.font = "7pt Inconsolata";
var textWidth = ctx.measureText(label).width;
ctx.textAlign = "left";
ctx.fillStyle="#000";
ctx.strokeStyle="#00eeee";
ctx.textBaseline = "top";
drawCurvedRectangle(ctx, 40, 1, textWidth + 10, 16, 2);
ctx.strokeStyle="#fff";
ctx.fillStyle="#fff";
ctx.fillText(label, 45, 3);
}.bind(this));
this.frames.push(frameCanvas);
};
StockChart.prototype.tick = function(){
if(!this.firstTick){
this.firstTick = new Date();
}
var timeSinceStarted = new Date() - this.firstTick;
var ticks = timeSinceStarted % (this.opts.holdTime * this.frames.length);
var thisFrame = Math.floor(ticks / (this.opts.holdTime));
if(thisFrame !== this.currentFrame){
// this.frames[this.currentFrame].div.style.width = "0px";
this.currentFrame = thisFrame;
this.frames[this.currentFrame].div.style.zIndex = Math.floor(timeSinceStarted/this.opts.holdTime);
this.percentDone = 0;
}
if(this.percentDone < 1){
this.percentDone = Math.min((ticks - this.currentFrame * this.opts.holdTime) / this.opts.swipeTime, 1);
this.frames[this.currentFrame].div.style.width = (this.width * sCurve(this.percentDone)) + "px";
}
};
var StockChartSmall = function(canvasId, opts){
var defaults = {
ticks: 5
}
var darkerColor = shadeColor("#00eeee",-50);
extend(opts, defaults);
this.opts = defaults;
if(this.firstTick == null){
this.firstTick = new Date();
}
var canvas = document.getElementById(canvasId);
this.context = canvas.getContext("2d");
this.width = canvas.width;
this.height = canvas.height;
var gradient = this.context.createLinearGradient(0, 0, 0, this.height);
gradient.addColorStop(0, darkerColor);
gradient.addColorStop(1, "black");
this.context.fillStyle = gradient;
this.context.fillRect(0,0,this.width,this.height);
this.context.beginPath();
this.context.lineWidth=1;
this.context.strokeStyle=darkerColor;
this.context.moveTo(0, this.height-1);
this.context.lineTo(this.width-1,this.height-1);
this.context.stroke();
this.context.closePath();
/* draw the grid */
var newY = 0;
for(var i = 0; i< this.opts.ticks; i++){
var y = i*(this.height/this.opts.ticks);
this.context.beginPath();
this.context.lineWidth=1;
this.context.strokeStyle=darkerColor;
this.context.moveTo(1, y);
this.context.lineTo(this.width-1,y);
this.context.stroke();
this.context.closePath();
}
newX = 1;
while(newX < this.width){
this.context.beginPath();
this.context.lineWidth=1;
this.context.strokeStyle=darkerColor;
this.context.moveTo(newX, 0);
this.context.lineTo(newX,this.height);
this.context.stroke();
this.context.closePath();
newX += this.height/this.opts.ticks;
}
// draw the far right line.
// this might be a bit hokey
this.context.beginPath();
this.context.lineWidth=1;
this.context.strokeStyle=darkerColor;
this.context.moveTo(this.width-1, 0);
this.context.lineTo(this.width-1,this.height);
this.context.stroke();
this.context.closePath();
var data = [];
for(var i = 0; i< 20; i++){
data.push(Math.random()*this.height);
}
var xIncrement = (this.width)/(data.length-1);
this.context.strokeStyle = "#aaa"
this.context.beginPath();
this.context.moveTo(0,0);
for(var i = 0; i < data.length; i++){
this.context.lineWidth = "1px";
this.context.lineTo(i*xIncrement, this.height - data[i]);
}
this.context.lineTo(this.width, 0);
this.context.stroke();
this.context.fillStyle = "#000";
this.context.fill();
}
/* Swirls */
var SwirlPoint = function(label, radius, canvas){
this.hitTime = Date.now();
this.hit = true;
this.startTime = Date.now();
this.startRadians = Math.random() * Math.PI * 2;
this.radius = radius;
this.label = label;
this.canvas = canvas;
this.context = this.canvas.getContext("2d");
this.x = this.canvas.width / 2;
this.y = this.canvas.height / 2;
this.animate();
}
SwirlPoint.prototype.animate = function(){
var timeSinceStart = Date.now() - this.startTime;
var radians = this.startRadians + (timeSinceStart/10000) * Math.PI * 2;
this.x = this.canvas.width / 2 + Math.sin(radians) * this.radius;
this.y = this.canvas.height / 2 + Math.cos(radians) * this.radius;
};
SwirlPoint.prototype.draw = function(currentTime){
if(Date.now() - this.hitTime < 1000){
this.context.fillStyle = "#ffcc00";
} else {
this.context.fillStyle = "#aaa";
}
if(this.hit){
this.hit = false;
if(this.x < this.canvas.width / 2){
this.context.fillText(this.label, this.x + 10, this.y-10);
} else {
this.context.fillText(this.label, this.x + 10, this.y+10);
}
}
this.context.beginPath();
this.context.arc(this.x, this.y, 1, 0, Math.PI * 2);
this.context.fill();
this.context.closePath();
};
var Swirls = function(containerId, opts){
this.container = document.getElementById(containerId);
this.container.width = 290;
this.container.height = 225
this.canvas = document.createElement("canvas");
this.canvas.width = this.container.width;
this.canvas.height = this.container.height;
this.context = this.canvas.getContext("2d");
this.container.appendChild(this.canvas);
this.width = this.container.width;
this.height = this.container.height;
this.points = {};
this.background = renderToCanvas(this.width, this.height, function(ctx){
ctx.fillStyle = "#111";
ctx.fillRect(5,5, this.width -10, this.height-10);
ctx.strokeStyle = "#666"
ctx.beginPath();
ctx.moveTo(this.width/2 + .5,5);
ctx.lineTo(this.width/2 + .5,this.height - 5);
ctx.stroke();
ctx.closePath();
ctx.beginPath();
ctx.moveTo(5,this.height/2);
ctx.lineTo(this.width-5,this.height/2);
ctx.stroke();
ctx.closePath();
ctx.beginPath();
ctx.lineWidth = 4;
ctx.moveTo(0,20);
ctx.lineTo(0,0);
ctx.lineTo(20, 0);
ctx.stroke();
ctx.closePath();
ctx.beginPath();
ctx.lineWidth = 4;
ctx.moveTo(this.width,20);
ctx.lineTo(this.width,0);
ctx.lineTo(this.width -20, 0);
ctx.stroke();
ctx.closePath();
ctx.beginPath();
ctx.lineWidth = 4;
ctx.moveTo(this.width,this.height-20);
ctx.lineTo(this.width,this.height);
ctx.lineTo(this.width -20, this.height);
ctx.stroke();
ctx.closePath();
ctx.beginPath();
ctx.lineWidth = 4;
ctx.moveTo(this.width,this.height-20);
ctx.lineTo(this.width,this.height);
ctx.lineTo(this.width -20, this.height);
ctx.stroke();
ctx.closePath();
ctx.beginPath();
ctx.lineWidth = 4;
ctx.moveTo(0,this.height-20);
ctx.lineTo(0,this.height);
ctx.lineTo(20, this.height);
ctx.stroke();
ctx.closePath();
ctx.fillStyle = "#666";
ctx.fillRect(this.width/2-1.5, 2, 4, 6);
ctx.fillRect(this.width/2-1.5, this.height-8, 4, 6);
ctx.fillRect(2, this.height/2-2, 6, 4);
ctx.fillRect(this.width-8, this.height/2-2, 6, 4);
}.bind(this));
this.context.drawImage(this.background, 0, 0);
this.context.fillStyle = "#fff";
};
Swirls.prototype.tick = function(){
this.context.globalAlpha = .02;
this.context.drawImage(this.background, 0, 0);
this.context.globalAlpha = 1.0;
/*
this.context.beginPath();
this.context.arc(Math.random() * this.width, Math.random() * this.height, 2, 0, Math.PI * 2);
this.context.fill();
this.context.closePath();
*/
for(var p in this.points){
this.points[p].animate();
this.points[p].draw();
}
};
Swirls.prototype.hit = function(label){
if(this.points[label]){
this.points[label].hitTime = Date.now();
this.points[label].hit = true;
return;
}
this.points[label] = new SwirlPoint(label, Math.random() * 100, this.canvas);
};
var Logo = function(containerId, text){
if(typeof text == "undefined"){
text = "GITHUB";
}
this.container = document.getElementById(containerId);
this.container.width = 180;
this.container.height = 100
this.canvas = document.createElement("canvas");
this.canvas.width = this.container.width;
this.canvas.height = this.container.height;
this.context = this.canvas.getContext("2d");
this.container.appendChild(this.canvas);
this.width = this.container.width;
this.height = this.container.height;
this.context.strokeStyle = "#00eeee";
this.context.lineWidth = 3;
this.context.font = "bold 18px Inconsolata";
var textWidth = this.context.measureText(text).width;
drawCurvedRectangle(this.context, (this.width - textWidth -24)/2, 30, textWidth + 24, 60, 3);
drawCurvedRectangle(this.context, (this.width - textWidth -10)/2, 65, textWidth + 10, 20, 3);
this.context.textAlign = "center";
this.context.fillStyle="#00eeee";
this.context.textBaseline = "bottom";
this.context.fillText(text, this.width/2, 85);
var buffer = 4;
var startPos = (this.width-textWidth-24)/2 + buffer + 2;
var barWidth = (textWidth + 20 - buffer * 6) / 5;
for(var i = 0; i < 5; i++){
var height = Math.floor(Math.random() * 25);
if(Math.random() < .5){
this.context.fillStyle = "#ffcc00";
} else {
this.context.fillStyle = "#ff9933";
}
this.context.fillRect(startPos + i * (barWidth + buffer), 36 + (25 - height), barWidth, height);
}
};
return {
globe: globe,
SatBar: SatBar,
LocationBar: LocationBar,
SimpleClock: SimpleClock,
TimerTrees: TimerTrees,
StockChart: StockChart,
StockChartSmall: StockChartSmall,
Box: Box,
Swirls: Swirls,
Logo: Logo
};
})();
;GLOBEUTILS = (function(){
var globeImage = document.getElementById('globeImage');
var myColors1 = pusher.color('orange').hueSet();
var myColors = [];
for(var i = 0; i< myColors1.length; i++){
myColors.push(myColors1[i].shade(.2 + Math.random()/2.0));
myColors.push(myColors1[i].shade(.2 + Math.random()/2.0));
}
var latLonToXY = function(width, height, lat,lon){
var x = Math.floor(width/2.0 + (width/360.0)*lon);
var y = Math.floor(height - (height/2.0 + (height/180.0)*lat));
return {x: x, y:y};
}
var drawLatLon= function(context, lat,lon){
var point = latLonToXY(pointCanvas.width, pointCanvas.height, lat,lon);
drawHex(context, point.x, point.y, 4.0);
// context.fillStyle="#FF0000";
// context.fillRect(point.x, point.y, 4, 4);
}
var isPixelBlack = function(context, x, y){
// console.log(context.getImageData(x,y,1,1));
return context.getImageData(x,y,1,1).data[0] === 0;
}
var samplePoints = function(globeContext, width, height, latoffset, lonoffset, latinc, loninc, cb){
for(var lat = 90-latoffset; lat > -90; lat -= latinc){
for(var lon = -180+lonoffset; lon < 180; lon += loninc){
var point = latLonToXY(width, height, lat, lon);
if(isPixelBlack(globeContext,point.x, point.y)){
cb({lat: lat, lon: lon});
//drawLatLon(pointContext,lat,lon);
}
}
}
}
var drawHex = function(ctx, x, y, width){
var sqrt3 = Math.sqrt(3);
ctx.fillStyle= myColors[Math.floor(Math.random()*myColors.length)].hex6();
ctx.beginPath();
ctx.moveTo(x, y - width);
ctx.lineTo(x+width*sqrt3/2.0, y - width/2.0);
ctx.lineTo(x+width*sqrt3/2.0, y + width/2.0);
ctx.lineTo(x, y + width);
ctx.lineTo(x-width*sqrt3/2.0, y + width/2.0);
ctx.lineTo(x-width*sqrt3/2.0, y - width/2.0);
ctx.closePath();
ctx.fill();
}
// samplePoints(0, 0,2,4, function(){});
// samplePoints(1,2, 2,4, function(){});
// samplePoints(1.25,2.5);
//
var landPoints = function(img, samples, cb){
// note:i don't think this is working because i need to wait for the document to finish loading
var points = [];
var loaded = false;
var getPoints = function(){
if(loaded){
return;
}
loaded = true;
var globeCanvas = document.createElement('canvas');
document.body.appendChild(globeCanvas);
var globeContext = globeCanvas.getContext('2d');
globeCanvas.width = img.width;
globeCanvas.height = img.height;
globeContext.drawImage(img, 0, 0, img.width, img.height);
console.log(img.height);
for (var i = 0; i< samples.length; i++){
samplePoints(globeContext,img.width, img.height, samples[i].offsetLat, samples[i].offsetLon, samples[i].incLat, samples[i].incLon, function(point){
points.push(point);
});
}
cb(points);
document.body.removeChild(globeCanvas);
};
img.addEventListener('load', getPoints);
// in case we alread finished loading the image
if(img.complete){
getPoints();
}
setTimeout(function(){
console.log(img.complete);
},1000);
};
return {
landPoints: landPoints
};
})();
module.exports = function(grunt) {
grunt.initConfig({
watch: {
options: {
livereload: true,
},
all: {
files: ['*.*'],
},
},
});
grunt.loadNpmTasks('grunt-contrib-watch');
};
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>GITHUB Boardroom</title>
<link href="styles.css" rel="stylesheet" type="text/css" />
<script src="three.min.js"></script>
<!-- <script src="http://threejs.org/build/three.min.js"></script> -->
<script src="tween.min.js"></script>
<script src="moment.min.js"></script>
<script src="moment-timezone.min.js"></script>
<script src="moment-timezone-locations.js"></script>
<script src="stats.js"></script>
<script src="pusher.color.js"></script>
<script src="encomsphere.js"></script>
<script src="/streamserver.v0.js"></script>
<script src="http://code.jquery.com/jquery-2.0.3.min.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/jquery-easing/1.3/jquery.easing.min.js"></script>
<script src="scripts.js"></script>
</head>
<body>
<div id="container">
<div id="globalization">
<div class="header" id="globalization-header">GLOBALIZATION</div>
<canvas id="satbar" width="180px" height="36px"></canvas>
<div class="location-slider" id="location-slider-northamerica"">
<span class="location-area" id="location-area-northamerica">No America</span>
<span class="location-city" id="location-city-northamerica"></span>
<div class="location-line"></div>
<ul>
</ul>
<div class="clear"></div>
</div>
<div class="location-slider" id="location-slider-southamerica" >
<span class="location-area" id="location-area-southamerica">So America</span>
<span class="location-city" id="location-city-southamerica"></span>
<div class="location-line"></div>
<ul>
</ul>
<div class="clear"></div>
</div>
<div class="location-slider" id="location-slider-europe">
<span class="location-area other" id="location-area-europe">Europe</span>
<span class="location-city" id="location-city-europe"></span>
<div class="location-line"></div>
<ul>
</ul>
<div class="clear"></div>
</div>
<div class="location-slider" id="location-slider-asia">
<span class="location-area other" id="location-area-asia">Asia</span>
<span class="location-city" id="location-city-asia"></span>
<div class="location-line"></div>
<ul>
</ul>
<div class="clear"></div>
</div>
<div class="location-slider" id="location-slider-australia">
<span class="location-area" id="location-area-australia">Australia</span>
<span class="location-city" id="location-city-australia"></span>
<div class="location-line"></div>
<ul>
</ul>
<div class="clear"></div>
</div>
<div class="location-slider" id="location-slider-africa">
<span class="location-area other" id="location-area-africa">Africa</span>
<span class="location-city" id="location-city-africa"></span>
<div class="location-line"></div>
<ul>
</ul>
<div class="clear"></div>
</div>
<div class="location-slider" id="location-slider-antarctica">
<span class="location-area other" id="location-area-antarctica">Antarctica</span>
<span class="location-city" id="location-city-antarctica"></span>
<div class="location-line"></div>
<ul>
</ul>
<div class="clear"></div>
</div>
<div class="location-slider location-gap" id="location-slider-other">
<span class="location-area" id="location-area-other">Other</span>
<span class="location-city" id="location-city-other"></span>
<div class="location-line"></div>
<ul>
</ul>
<div class="clear"></div>
</div>
<div class="location-slider" id="location-slider-unknown">
<span class="location-area" id="location-area-unknown">Location</span>
<span class="location-city" id="location-city-unknown">Not Specified</span>
<div class="location-line"></div>
<ul>
</ul>
<div class="clear"></div>
</div>
<div id="logo">
<div id="logo-cover-up"></div>
<div id="logo-cover-side-1"></div>
<div id="logo-cover-side-2"></div>
</div>
</div>
<div id="globe"></div>
<div id="globe-footer">
<div id="footer-reveal"></div>
<div id="ms-stats"></div>
<div id="fps-stats"></div>
</div>
<div id="user-interaction">
<div class="header header-other" id="user-interaction-header">
USER INTERACTION SCIENCE
</div>
<div id="user-interaction-container">
<div id="interaction">
<h3>Some fancy Interaction</h3>
<div>
</div>
</div>
<div id="interaction-overlay"></div>
<div id="cube" width ="290" height="225">
<div id="cube-labels">
<div id="cube-label-1">Yeah</div>
<div id="cube-label-2">Why</div>
<div id="cube-label-3">Not</div>
</div>
</div>
<div id="swirls">
</div>
</div>
</div>
<div id="growth">
<div class="header header-other" id="growth-header">
GROWTH PROJECTION
</div>
<div id="growth-container">
<div id = "ticker">
<div id="ticker-text">GITHUB</div>
<div id="ticker-subtext">[INC]</div>
<div id="ticker-lines">
<div class="ticker-line" id="ticker-line-1">.</div>
<div class="ticker-line" id="ticker-line-2">.</div>
</div>
<div id="ticker-value">
+32.5%
</div>
<div id="ticker-ytd">
YEAR-TO-DATE
</div>
<canvas id="stock-chart-small" width="72px" height="40px"></canvas>
</div>
<div id="stock-chart" width="500px" height="105px"></div>
<div id = "stock-subcharts">
<div class="stock-subchart">
<div class="stock-subchart-label">
OPEN
</div>
<div class="stock-subchart-chart">
<div class="stock-subchart-bar subchart-20"> </div>
<div class="stock-subchart-bar subchart-white"> </div>
<div class="stock-subchart-bar subchart-5 subchart-yellow"> </div>
<div class="stock-subchart-bar subchart-10"> </div>
<div class="stock-subchart-bar subchart-15 subchart-white"> </div>
<div class="stock-subchart-bar subchart-5 subchart-yellow"> </div>
<div class="stock-subchart-bar subchart-15"> </div>
<div class="stock-subchart-bar subchart-20"> </div>
<div class="stock-subchart-bar subchart-white"> </div>
<div class="stock-subchart-bar subchart-15 subchart-white"> </div>
<div class="stock-subchart-bar subchart-5 subchart-yellow"> </div>
<div class="stock-subchart-bar subchart-15"> </div>
<div class="stock-subchart-bar subchart-20"> </div>
</div>
</div>
<div class="stock-subchart">
<div class="stock-subchart-label">
HIGH
</div>
<div class="stock-subchart-chart">
<div class="stock-subchart-bar subchart-20"> </div>
<div class="stock-subchart-bar subchart-white"> </div>
<div class="stock-subchart-bar subchart-5 subchart-yellow"> </div>
<div class="stock-subchart-bar subchart-10"> </div>
<div class="stock-subchart-bar subchart-15 subchart-white"> </div>
<div class="stock-subchart-bar subchart-5 subchart-yellow"> </div>
<div class="stock-subchart-bar subchart-15"> </div>
<div class="stock-subchart-bar subchart-20"> </div>
<div class="stock-subchart-bar subchart-white"> </div>
<div class="stock-subchart-bar subchart-15 subchart-white"> </div>
<div class="stock-subchart-bar subchart-5 subchart-yellow"> </div>
<div class="stock-subchart-bar subchart-15"> </div>
<div class="stock-subchart-bar subchart-20"> </div>
</div>
</div>
<div class="stock-subchart">
<div class="stock-subchart-label">
LOW
</div>
<div class="stock-subchart-chart">
<div class="stock-subchart-bar subchart-20"> </div>
<div class="stock-subchart-bar subchart-white"> </div>
<div class="stock-subchart-bar subchart-5 subchart-yellow"> </div>
<div class="stock-subchart-bar subchart-10"> </div>
<div class="stock-subchart-bar subchart-15 subchart-white"> </div>
<div class="stock-subchart-bar subchart-5 subchart-yellow"> </div>
<div class="stock-subchart-bar subchart-15"> </div>
<div class="stock-subchart-bar subchart-20"> </div>
<div class="stock-subchart-bar subchart-white"> </div>
<div class="stock-subchart-bar subchart-15 subchart-white"> </div>
<div class="stock-subchart-bar subchart-5 subchart-yellow"> </div>
<div class="stock-subchart-bar subchart-15"> </div>
<div class="stock-subchart-bar subchart-20"> </div>
</div>
</div>
<div class="stock-subchart">
<div class="stock-subchart-label">
CLOSE
</div>
<div class="stock-subchart-chart">
<div class="stock-subchart-bar subchart-20"> </div>
<div class="stock-subchart-bar subchart-white"> </div>
<div class="stock-subchart-bar subchart-5 subchart-yellow"> </div>
<div class="stock-subchart-bar subchart-10"> </div>
<div class="stock-subchart-bar subchart-15 subchart-white"> </div>
<div class="stock-subchart-bar subchart-5 subchart-yellow"> </div>
<div class="stock-subchart-bar subchart-15"> </div>
<div class="stock-subchart-bar subchart-20"> </div>
<div class="stock-subchart-bar subchart-white"> </div>
<div class="stock-subchart-bar subchart-15 subchart-white"> </div>
<div class="stock-subchart-bar subchart-5 subchart-yellow"> </div>
<div class="stock-subchart-bar subchart-15"> </div>
<div class="stock-subchart-bar subchart-20"> </div>
</div>
</div>
<div class="stock-subchart">
<div class="stock-subchart-label">
VOLUME
</div>
<div class="stock-subchart-chart">
<div class="stock-subchart-bar subchart-20"> </div>
<div class="stock-subchart-bar subchart-white"> </div>
<div class="stock-subchart-bar subchart-5 subchart-yellow"> </div>
<div class="stock-subchart-bar subchart-10"> </div>
<div class="stock-subchart-bar subchart-15 subchart-white"> </div>
<div class="stock-subchart-bar subchart-5 subchart-yellow"> </div>
<div class="stock-subchart-bar subchart-15"> </div>
<div class="stock-subchart-bar subchart-20"> </div>
<div class="stock-subchart-bar subchart-white"> </div>
<div class="stock-subchart-bar subchart-15 subchart-white"> </div>
<div class="stock-subchart-bar subchart-5 subchart-yellow"> </div>
<div class="stock-subchart-bar subchart-15"> </div>
<div class="stock-subchart-bar subchart-20"> </div>
</div>
</div>
</div>
</div>
</div>
<div id="media">
<div class="header" id="media-header">
USER SNAPSHOTS
</div>
<div id="media-container">
<div id="media-top" class="media-box">
<div class="media-scanlines"></div>
<div class="user-pic larger"><span></span></div>
<div class="user-pic"><span></span></div>
<div class="user-pic"><span></span></div>
<div class="user-pic"><span></span></div>
<div class="user-pic"><span></span></div>
</div>
<div id="media-top-blinkies" class="media-blinkies">
<h3>Some kind of title</h3>
<div class="last bar border-20 border-yellow">hi</div>
<div class="bar border-40 border-blue">hi</div>
<div class="bar border-20 border-white">hi</div>
<div class="bar border-25 border-yellow">hi</div>
<div class="last bar border-35 border-blue">hi</div>
<div class="blinkies-big-label">month</div>
<div class="blinkies-small-label">num</div>
<div class="blinkies-big-number">3</div>
<div class="blinkies-small-number">1 4</div>
<h3>yay blinkies!</h3>
<div class="blinky blank"></div>
<div class="blinky blank"></div>
<div class="blinky white"></div>
<div class="blinky blank"></div>
<div class="blinky blank"></div>
<div class="blinky blue"></div>
<div class="blinky yellow"></div>
<div class="blinky blank"></div>
<div class="blinky blue"></div>
<div class="blinky blue"></div>
<div class="blinky blank"></div>
<div class="blinky yellow"></div>
<div class="blinky white"></div>
<div class="blinky blank"></div>
<div class="blinky blue"></div>
<div class="blinky blue"></div>
<div class="blinky blank"></div>
<div class="blinky white"></div>
<div class="blinky blank"></div>
<div class="blinky blank"></div>
<div class="blinky blank"></div>
<div class="blinky blue"></div>
<div class="blinky blank"></div>
<div class="blinky white"></div>
<div class="blinky blue"></div>
<div class="blinky white"></div>
<div class="blinky blank"></div>
<div class="blinky yellow"></div>
<div class="blinky blue"></div>
<div class="blinky blank"></div>
<div class="blinky yellow"></div>
<div class="blinky blank"></div>
<div class="blinky blank"></div>
<div class="blinky blue"></div>
<div class="blinky blank"></div>
<div class="blinky blue"></div>
<div class="blinky yellow"></div>
<div class="blinky blank"></div>
<div class="blinky blank"></div>
<div class="blinky yellow"></div>
<div class="blinky white"></div>
<div class="blinky white"></div>
<div class="blinky blank"></div>
<div class="blinky yellow"></div>
<div class="blinky blank"></div>
</div>
<div id="media-top-info" class="media-info">
<span>i could put something useful here</span>
<span>but i can't think</span>
<span>of what</span>
<span>I could possibly</span>
<span>say</span>
</div>
<div id="media-bottom" class="media-box">
<div class="media-scanlines"></div>
<div class="user-pic larger"><span></span></div>
<div class="user-pic"><span></span></div>
<div class="user-pic"><span></span></div>
<div class="user-pic"><span></span></div>
<div class="user-pic"><span></span></div>
</div>
<div id="media-bottom-blinkies" class="media-blinkies">
<h3>Some kind of title</h3>
<div class="bar border-20 border-white">hi</div>
<div class="bar border-40 border-yellow">hi</div>
<div class="bar border-20 border-white">hi</div>
<div class="last bar border-25 border-blue">hi</div>
<div class="last bar border-35 border-blue">hi</div>
<div class="blinkies-big-label">month</div>
<div class="blinkies-small-label">num</div>
<div class="blinkies-big-number">2</div>
<div class="blinkies-small-number">1 4</div>
<h3>yay blinkies!</h3>
<div class="blinky blank"></div>
<div class="blinky blue"></div>
<div class="blinky yellow"></div>
<div class="blinky blank"></div>
<div class="blinky blue"></div>
<div class="blinky blank"></div>
<div class="blinky white"></div>
<div class="blinky blank"></div>
<div class="blinky blank"></div>
<div class="blinky white"></div>
<div class="blinky blank"></div>
<div class="blinky blank"></div>
<div class="blinky blue"></div>
<div class="blinky blank"></div>
<div class="blinky blue"></div>
<div class="blinky yellow"></div>
<div class="blinky blank"></div>
<div class="blinky yellow"></div>
<div class="blinky blue"></div>
<div class="blinky yellow"></div>
<div class="blinky white"></div>
<div class="blinky blank"></div>
<div class="blinky white"></div>
<div class="blinky blank"></div>
<div class="blinky blank"></div>
<div class="blinky blue"></div>
<div class="blinky white"></div>
<div class="blinky blank"></div>
<div class="blinky yellow"></div>
<div class="blinky blank"></div>
<div class="blinky blue"></div>
<div class="blinky blue"></div>
<div class="blinky blank"></div>
<div class="blinky blue"></div>
<div class="blinky blank"></div>
<div class="blinky blank"></div>
<div class="blinky white"></div>
<div class="blinky blank"></div>
<div class="blinky blue"></div>
<div class="blinky blank"></div>
<div class="blinky blank"></div>
<div class="blinky yellow"></div>
<div class="blinky blank"></div>
<div class="blinky yellow"></div>
<div class="blinky white"></div>
</div>
<div id="media-bottom-info" class="media-info">
<span>all this bottom info</span>
<span>something else interesting</span>
<span>why?</span>
<span>rob scanlon made this</span>
</div>
</div>
</div>
<div id="timer">
<div class="header header-other2" id="timer-header">
TIME SINCE START
</div>
<div id="clockbar">
<div id="clock">
00:00:00:00
</div>
<canvas id="simpleclock" width="80px" height="80px"></canvas>
</div>
<div id="timerbar">
<div class="section-timerbar">
<div class="buffer-timerbar">
<small>San Francisco</small>
<span id="san-francisco-time">12:32:91</span>
</div>
</div>
<div class="section-timerbar">
<div class="buffer-timerbar">
<small>New York</small>
<span id="new-york-time">12:32:91</span>
</div>
</div>
<div class="section-timerbar">
<div class="buffer-timerbar">
<small>London</small>
<span id="london-time">12:32:91</span>
</div>
</div>
<div class="section-timerbar">
<div class="buffer-timerbar">
<small>Berlin</small>
<span id="berlin-time">12:32:91</span>
</div>
</div>
<div class="section-timerbar">
<div class="buffer-timerbar">
<small>Bangalore</small>
<span id="bangalore-time">12:32:91</span>
</div>
</div>
<div class="section-timerbar">
<div class="buffer-timerbar">
<small>Sydney</small>
<span id="sydney-time">12:32:91</span>
</div>
</div>
</div>
<canvas id="timer-trees" width="490px" height="30px"></canvas>
</div>
<div id="bottom-border"></div>
<div id="screensaver">
<div id="screensaver-info">
<img src="github-screensaver.gif">
<span>Loading resources...</span>
</div>
</div>
</div>
<body>
</html>
$(function(){
$(".header").css("visibility", "hidden");
$(".content-container").css("visibility", "hidden");
var animateContainers = function(){
var outside = $("#container-outside");
var inside = $("#container-inside");
outside.css({
'position' : 'absolute',
'left' : '50%',
'top' : '50%',
'margin-left' : -outside.width()/2,
'margin-top' : -outside.height()/2
});
inside.css({
'position' : 'absolute',
'left' : '50%',
'top' : '50%',
'margin-left' : -inside.width()/2,
'margin-top' : -inside.height()/2
});
var outsideOffset = outside.offset();
var insideOffset = inside.offset();
var outsideWidth = outside.width();
var outsideHeight = outside.height();
var insideWidth = inside.width();
var insideHeight = inside.height();
var outsideBlockerTopRight = $("<div>");
var outsideBlockerBottomLeft = $("<div>");
var insideBlockerTopRight = $("<div>");
var insideBlockerBottomLeft = $("<div>");
$('body').append(outsideBlockerTopRight)
.append(outsideBlockerBottomLeft)
.append(insideBlockerTopRight)
.append(insideBlockerBottomLeft);
outsideBlockerTopRight.css({
"background-color": "#000",
// "background-color": "#aa0000",
// opacity: .5,
position: "absolute",
top: outsideOffset.top - 5,
left: outsideOffset.left - 5,
width: outside.outerWidth() + 10,
height: outside.outerHeight(),
"z-index": 15
});
outsideBlockerBottomLeft.css({
"background-color": "#000",
// "background-color": "#00aa00",
// opacity: .5,
position: "absolute",
top: outsideOffset.top + 5,
left: outsideOffset.left - 5,
width: outsideWidth,
height: outsideHeight + 10,
"z-index": 15
});
insideBlockerTopRight.css({
"background-color": "#000",
// "background-color": "#0000aa",
// opacity: .5,
position: "absolute",
top: insideOffset.top-3,
left: insideOffset.left-5,
width: insideWidth + 15,
height: insideHeight,
"z-index": 25
});
insideBlockerBottomLeft.css({
"background-color": "#000",
// "background-color": "#aa00aa",
// opacity: .5,
position: "absolute",
top: insideOffset.top +5,
left: insideOffset.left -3,
width: insideWidth,
height: insideHeight,
"z-index": 25
});
outsideBlockerTopRight.animate({
height: 10,
}, 500).animate({
width: 0,
}, 500);
outsideBlockerBottomLeft.animate({
width: 20,
}, 500);
outsideBlockerBottomLeft.delay(500).animate({
height: 0,
top: (outsideOffset.top + outsideHeight)/2,
}, 500);
insideBlockerBottomLeft.animate({
width: 0,
}, 300);
insideBlockerTopRight.delay(300).animate({
height: 10,
}, 500);
insideBlockerTopRight.animate({
width: 0,
left: insideOffset.left + insideWidth
}, 500);
setTimeout(function(){
outsideBlockerTopRight.remove();
outsideBlockerBottomLeft.remove();
insideBlockerTopRight.remove();
insideBlockerBottomLeft.remove();
}, 3000);
};
var animateHeaders = function() {
setTimeout(function doHeaderAnimations(){
$(".header-animator-outside").css({visibility: "visible"}).animate({
top: "25px",
height: "538px"
}, 500);
$(".header-animator-inside").css({visibility: "visible"}).delay(100).animate({
top: "39px",
height: "510px"
}, 500);
}, 500);
setTimeout(function showHeaders(){
$(".header").css("visibility", "visible");
$(".content-container").css("visibility", "visible");
}, 1000);
setTimeout(function hideAnimations(){
$(".header-animator-outside").css("display", "none");
$(".header-animator-inside").css("display", "none");
}, 1500);
};
var animateContentBoxes = function(item, extraDelay) {
var itemContent = item.find(".content");
var height = item.height();
var width = item.width();
var left = item.position().left;
var top = item.position().top;
var border = item.css("border");
var boxShadow = item.css("box-shadow");
var contentBorder = itemContent.css("border");
var contentBoxShadow = itemContent.css("box-shadow");
itemContent.children().each(function(index, element){
$(element).css("visibility", "hidden");
});
item.height(0)
.width(0)
.css("top", top + height/2)
.css("left", left + width/2);
setTimeout(function doHeaderAnimations(){
item.animate({
height: height,
width: width,
left: left,
top: top
}, 500);
item.css({
opacity: 1
});
}, 1500 + extraDelay);
setTimeout(function(){
itemContent.children().each(function(index, element){
$(element).css("visibility", "visible");
});
}, 2200);
};
var animateKeyboard = function(){
var keyboard = $("#keyboard");
var spaceBar = $("#k-space");
var spaceBarWidth = spaceBar.width();
spaceBar.width(0);
keyboard.delay(2000).animate({
opacity: 1
}, 2000);
spaceBar.delay(2100).animate({
width: spaceBarWidth
},1000);
}
var webglTick = (function(){
var canvas = document.getElementById('webglCanvas');
var renderer = new THREE.WebGLRenderer( { antialias : true, canvas: canvas } );
var cameraDistance = 100;
var camera = new THREE.PerspectiveCamera( 50, canvas.width / canvas.height, 1, 400 );
var cameraAngle=0;
var scene = new THREE.Scene();
var splineGeometry = new THREE.Geometry();
var splineMaterial = new THREE.LineBasicMaterial({
color: 0x6FC0BA,
opacity: 0,
transparent: true
});
var backdropGeometry = new THREE.Geometry();
var backdropMaterial = new THREE.LineBasicMaterial({
color: 0x1b2f2d,
opacity: 1,
transparent: true
});
var cameraUp = false;
renderer.setSize(canvas.width, canvas.height);
camera.position.z = cameraDistance;
camera.lookAt(scene.position);
lastRenderDate = new Date();
var calc = function(x){
return (x+200)*(x+100)*(x+280)*(x+10)*(x-300)*(x-250)*(x-150) / Math.pow(10,14)/1.5;
}
for(var i = 0; i< 500; i++){
var y = calc(i-250) * Math.sin(2 * Math.PI * (i % 6) / 6 + i/500) + Math.cos(i) * 5;
var z = calc(i-250) * Math.cos(2 * Math.PI * (i % 6) / 6 + i/500);
splineGeometry.vertices.push(new THREE.Vector3(i - 250, y, z));
}
splineGeometry.verticesNeedUpdate = true;
var splineLine = new THREE.Line(splineGeometry, splineMaterial);
scene.add(splineLine);
for(var i = 0; i< 25; i++){
backdropGeometry.vertices.push(new THREE.Vector3(-500,100-i*8,-100));
backdropGeometry.vertices.push(new THREE.Vector3(500,100-i*8,-100));
}
var backdropLine = new THREE.Line(backdropGeometry, backdropMaterial, THREE.LinePieces);
scene.add(backdropLine);
renderer.render( scene, camera );
var firstRun = null;
var introAnimationDone = false;
return function tick(){
if(firstRun === null){
firstRun = Date.now();
}
// renderer.render( this.scene, this.camera );
var renderTime = new Date() - lastRenderDate;
var timeSinceStart = Date.now() - firstRun;
lastRenderDate = new Date();
var rotateCameraBy = (2 * Math.PI)/(10000/renderTime);
cameraAngle += rotateCameraBy;
if(timeSinceStart < 3000){
backdropMaterial.opacity = Math.max(0,(timeSinceStart-2000)/3000);
splineMaterial.opacity = timeSinceStart/3000;
} else if(!introAnimationDone){
introAnimationDone = true;
backdropMaterial.opacity = .333;
splineMaterial.opacity = 1;
}
camera.position.x = Math.sin(cameraAngle) * 20;
renderer.render(scene, camera );
splineLine.rotation.x += .01;
requestAnimationFrame(tick);
};
})();
var writeResponse = function(txt){
$("#command-lines").append("<div class='response'>&gt;&gt;encom-sh: " + txt + "</div>");
};
var currentDir = "encom_root";
var writePrompt = function(){
$("#command-lines").append('<div class="command"><span class="prompt">encom-sh:' + currentDir + '$&nbsp;</span><span class="command-text"></span></div>');
};
var writeLs = function(exec){
var output = "";
if(typeof exec != "undefined"){
output = [
'<div class="ls">encom_root</div>',
'<div class="ls">bandwidth</div>',
'<div class="ls">framework</div>',
'<div class="ls">@arscan</div>',
'<div class="ls ls-exec">' + exec + '</div>',
'<div class="ls">webgl_test</div>',
'<div class="ls">flynn_5</div>',
'<div class="ls">&nbsp;</div>',
'<div class="ls">os12_demo</div>',
'<div class="ls">munkowitz</div>',
].join('');
} else {
output = [
'<div class="ls ls-github">github</div>',
'<div class="ls ls-test">test</div>',
'<div class="ls ls-wikipedia">wikipedia</div>',
'<div class="ls ls-bitcoin">bitcoin</div>',
'<div class="ls ls-unknown">unknown</div>'
].join('');
}
$("#command-lines").append(output);
};
/* I could make this much more involved, but i'm not really interested in spending time on this part of the app */
/* sorry for disappointing anybody looking at this to see how much functionality there is */
var executeCommand = function(){
var command = $(".command-text").last().text();
if(command == "run github.exe"){
if(currentDir == "github"){
$(".ls-exec").addClass("ls-highlight")
$(".container-border").animate({opacity: 0}, 500);
setTimeout(function(){
document.location = "http://streams.robscanlon.com/github/arscan/8311277";
}, 500);
} else {
writeResponse("<span class='alert'>Error:</span> No such file");
writePrompt();
}
} else if(command == "run wikipedia.exe"){
if(currentDir == "wikipedia"){
$(".ls-exec").addClass("ls-highlight")
$(".container-border").animate({opacity: 0}, 500);
setTimeout(function(){
document.location = "http://streams.robscanlon.com/wikipedia/arscan/8311277";
}, 500);
} else {
writeResponse("<span class='alert'>Error:</span> No such file");
writePrompt();
}
} else if(command == "cd github"){
$(".ls-github").addClass("ls-highlight")
currentDir = "github";
$(".folder-label").removeClass("selected");
$("#launch-github .folder-label").addClass("selected");
writeResponse("Changed directory to <span class='highlight'>github</span>");
writePrompt();
} else if(command == "cd wikipedia"){
$(".ls-wikipedia").addClass("ls-highlight")
$(".folder-label").removeClass("selected");
$("#launch-wikipedia .folder-label").addClass("selected");
currentDir = "wikipedia";
writeResponse("Changed directory to <span class='highlight'>wikipedia</span>");
writePrompt();
} else if(command.indexOf("cd encom") == 0 || command == "cd /"){
currentDir = "encom_root";
writeResponse("Changed directory to <span class='highlight'>encom_root</span>");
writePrompt();
} else if(command.indexOf("cd ") == 0){
writeResponse("<span class='alert'>Access denied</span>");
writePrompt();
} else if(command.indexOf("ls") == 0 && currentDir == "encom_root"){
writeLs();
writePrompt();
} else if(command.indexOf("ls") == 0){
writeLs(currentDir + ".exe");
writePrompt();
} else if(command.indexOf("run") == 0){
writeResponse("<span class='alert'>Access denied</span>");
writePrompt();
} else {
writeResponse("command not found");
writePrompt();
}
var cl = $("#command-lines");
$("#command-line").scrollTop(cl.height())
}
var keyBuffer = [];
var keysRunning = false;
var runKeySimulator = function(){
var key = keyBuffer.shift();
keyClick(key);
if(keyBuffer.length > 0){
setTimeout(runKeySimulator,10 + Math.random() * 150);
} else {
keysRunning = false;
}
}
var simulateKey = function(key){
keyBuffer.push(key);
if(!keysRunning){
keysRunning = true;
setTimeout(runKeySimulator,100);
}
};
var simulateCommand = function(command){
var cs = command.split("");
for(var i = 0; i < cs.length; i++){
simulateKey(charToKeyCode(cs[i]));
}
};
var charToKeyCode = function(char){
var cc = char.charCodeAt(0);
if(cc <= 122 && cc >=97){
return cc - 32;
} else if (char === "."){
return 190;
} else if (char === " "){
return 32;
} else if (char === "$"){
return 13;
}
return 0;
};
var toggleKey = function(element){
element.css({
"background-color": "#fff",
"color": "#000"
});
setTimeout(function(){
element.css({
"background-color": "#888",
"color": "#888"
});
}, 200);
setTimeout(function(){
element.css({
"background-color": "#000",
"color": "#00eeee"
});
}, 300);
};
var writeKeyStroke = function(keycode){
var txt = $(".command-text").last();
switch(keycode){
case 8:
txt.text(txt.text().substring(0,txt.text().length-1));
break;
case 27:
txt.text("");
break;
case 13:
executeCommand();
break;
case 189:
txt.append("_");
break;
case 187:
txt.append("=");
break;
case 219:
txt.append("{");
break;
case 221:
txt.append("}");
break;
case 186:
txt.append(";");
break;
case 222:
txt.append("'");
break;
case 188:
txt.append(",");
break;
case 190:
txt.append(".");
break;
case 191:
txt.append("/");
break;
case 192:
txt.append("~");
break;
case 500:
txt.append("");
break;
default:
var key = String.fromCharCode(keycode).toLowerCase();
txt.append(key)
};
};
var keyClick = function(keycode){
// light up the keyboard
toggleKey($("#k-" + keycode));
if(keycode === 16){
toggleKey($("#k-0"));
}
// write it to the screen
writeKeyStroke(keycode);
};
$(document).keydown(function(event){
console.log(event.which);
var keycode = event.which;
event.preventDefault();
keyClick(keycode);
});
$("#launch-github").click(function(){
$(this).find(".folder-big").css("background-color", "#fff");
simulateCommand("cd github$");
simulateCommand("ls$");
simulateCommand("run github.exe$");
});
$("#launch-wikipedia").click(function(){
$(this).find(".folder-big").css("background-color", "#fff");
simulateCommand("cd wikipedia$");
simulateCommand("ls$");
simulateCommand("run wikipedia.exe$");
});
$("#launch-test").click(function(){
$(this).find(".folder-big").css("background-color", "#fff");
simulateCommand("cd test$");
});
$("#launch-bitcoin").click(function(){
$(this).find(".folder-big").css("background-color", "#fff");
simulateCommand("cd bitcoin$");
});
$("#launch-unknown").click(function(){
$(this).find(".folder-big").css("background-color", "#fff");
simulateCommand("cd unknown$");
});
setTimeout(webglTick, 2000);
setTimeout(animateHeaders, 500);
animateContentBoxes($("#readme"), 0);
animateContentBoxes($("#bandwidth"), 100);
animateContentBoxes($("#globalization"), 200);
animateContainers();
animateKeyboard();
$("#keyboard div").mousedown(function(event){
event.preventDefault();
keyClick(parseInt($(this).attr("id").split("-")[1]));
});
/* preload this */
setTimeout(function(){
$("<img src='github-screensaver.gif' />");
}, 4000);
});
body {
background-color: black;
font-family: 'Inconsolata', sans-serif;
font-size:6pt;
/* color: #6fc0ba; */
color: #fff;
}
a {
color: #00eeee;
}
strong {
color: #ffcc00;
}
h2, p, li {
font-size: 8pt;
line-height: 12pt;
}
ul {
list-style: none;
margin: 0px;
padding-left: 5px;
}
.container-border{
border: 2px solid #6fc0ba;
border-radius: 5px;
box-shadow: 0 0 2px #005b8e, inset 0 0 2px #005b8e;
}
#container-outside{
position:absolute;
width: 1140px;
height: 610px;
z-index: 10;
}
#container-inside {
position:absolute;
left: 40px;
top:20px;
width: 1100px;
height: 600px;
z-index: 20;
}
#left-column{
position: absolute;
left: 52px;
width: 380px;
}
#right-column{
position: absolute;
left: 500px;
width: 480px;
}
.header{
border-top: 1px solid #1d2c33;
border-bottom: 1px solid #1d2c33;
/* box-shadow: 0 0 6px #005b8e, inset 0 0 6px #005b8e; */
color: #fff;
padding: 2px 0;
visibility: hidden;
width: 100%;
}
.header-left-section {
float: left;
width: 80%;
background-color: #000;
margin-left: -5px;
padding: 0 8px;
}
.header-right-section {
float: right;
width: 10%;
background-color: #000;
text-align: right;
margin-right: -5px;
padding: 0 8px;
}
.alt-1 {
color: #00eeee;
}
.alt-2 {
color: #ffcc00;
}
#header-top-left {
position: absolute;
top: 25px;
}
#header-top-right {
position: absolute;
top: 25px;
}
#header-bottom-left {
position: absolute;
top: 550px;
}
#header-bottom-left .header-left-section{
width: 45%
}
#header-bottom-left .header-right-section{
width: 45%
}
#bottom-boxes-1 {
margin-top: 1px;
float: right;
border: 1px solid #6fc0ba;
border-radius: 2px;
height: 4px;
width: 35px;
}
#bottom-boxes-2 {
margin-top: 1px;
margin-right: 20px;
float: right;
border: 1px solid #1b2f2d;
border-radius: 2px;
height: 4px;
width: 25px;
}
#bottom-boxes-3 {
margin-top: 1px;
margin-right: 4px;
float: right;
border: 1px solid #6fc0ba;
border-radius: 2px;
height: 4px;
width: 30px;
}
#header-bottom-right {
position: absolute;
top: 550px;
}
.header-animator-left {
position: absolute;
top: 300px;
width: 100%;
height: 2px;
border-top: 1px solid #1d2c33;
border-bottom: 1px solid #1d2c33;
visibility: hidden;
}
.header-animator-right {
position: absolute;
top: 300px;
width: 100%;
height: 2px;
border-top: 1px solid #1d2c33;
border-bottom: 1px solid #1d2c33;
visibility: hidden;
}
.content-container {
border: 2px solid #6fc0ba;
border-radius: 2px;
/* box-shadow: 0 0 6px #005b8e, inset 0 0 6px #005b8e; */
padding: 3px;
opacity: 0;
}
.content {
border: 1px solid #1b2f2d;
/* box-shadow: 0 0 6px #005b8e, inset 0 0 6px #005b8e; */
}
.content-container h2 {
color: #fff;
margin: 0;
border-bottom: 1px solid #1b2f2d;
padding: 2px 4px;
font-weight: bold;
}
.content-container h2 em{
font-style: normal;
float: right;
font-size: .8em;
padding-top: 1px;
color: #00eeee;
}
.content-container p {
margin: 2px 0 0;
padding: 4px 6px;
}
#readme {
position: absolute;
top: 60px;
overflow: hidden;
}
#readme .content {
height: 300px;
overflow: hidden;
}
#bandwidth {
position: absolute;
top: 390px;
}
#globalization {
position: absolute;
top: 60px;
width: 470px;
}
#globalization .content {
height: 260px;
overflow: hidden;
}
#command-line {
width: 318px;
float: left;
height: 129px;
margin-top: 5px;
padding: 5px;
overflow: hidden;
}
#command-lines {
white-space: nowrap;
}
#command-line-header {
border-bottom: 1px dashed #fff;
padding-bottom: 3px;
}
.command {
clear: both;
padding-top: 5px;
font-size: 8pt;
}
.command-text {
color: #aaa;
}
.response {
padding-top: 3px;
padding-left: 25px;
font-size: 7pt;
}
.response .alert{
font-color: #aa0000;
}
.response .highlight{
color: #ffcc00;
}
.ls {
float: left;
width: 40px;
padding: 2px;
margin-right: 25px;
margin-top: 5px;
}
.ls-highlight {
background-color: #fff;
color: #000;
}
.folder-container {
margin: 8px 18px 0;
float: left;
cursor: pointer;
}
.folder-label{
background-color: #000;
color: #fff;
font-size: 10px;
margin-bottom: 5px;
padding: 1px;
width: 70px;
text-transform: uppercase;
border-radius: 2px;
}
.folder-container:hover .folder-label{
background-color: #feb400;
color: #000;
}
.folder-label.selected{
background-color: #feb400;
color: #000;
}
#launch-github {
margin-top: 30px;
}
.selected-folder {
background-color: #feb400;
color: #000;
}
.folder-big {
background-image: url(encom_folder_big.png);
padding: 0px;
margin: 0px;
width:95px;
height: 63px;
}
.folder-small {
background-image: url(encom_folder_small.png);
padding: 0px;
margin: 0px;
width:80px;
height: 49px;
}
#keyboard {
margin-left: 8px;
position: absolute;
top: 355px;
width: 470px;
opacity: 0;
}
#keyboard div{
background-color: rgba(255,255,255,0);
border-radius: 5px;
float: left;
width: 35px;
text-align:center;
padding-top: 10px;
margin-top: 5px;
height: 20px;
font-size: 12px;
text-transform: uppercase;
color: #00eeee;
cursor: pointer;
}
#keyboard #k-9{
clear: both;
margin-left:10px;
}
#keyboard #k-500{
clear: both;
margin-left:20px;
}
#keyboard #k-16{
clear: both;
margin-left:5px;
}
#keyboard #k-32 {
clear: both;
width: 300px;
height: 5px;
border: 1px solid #00eeee;
border-radius: 3px;
margin-top: 10px;
margin-left: 80px;
}
#far-right-column {
position: absolute;
left: 1000px;
height: 600px;
width: 80px;
}
#encom-logo {
position: absolute;
font-size: 10px;
padding-left: 4px;
top: 25px;
left: 20px;
color: #6fc0ba;
border-left: 1px solid #6fc0ba;
border-top: 1px solid #6fc0ba;
border-bottom: 1px solid #6fc0ba;
border-radius: 4px;
}
#thumbprint {
position: absolute;
left: 15px;
top: 500px;
z-index: 200;
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Github Boardroom Light table</title>
<link href='http://fonts.googleapis.com/css?family=Inconsolata' rel='stylesheet' type='text/css'>
<link href="light-table-styles.css" rel="stylesheet" type="text/css" />
<script src="http://code.jquery.com/jquery-2.0.3.min.js"></script>
<script src="three.min.js"></script>
<script src="light-table-scripts.js"></script>
</head>
<body>
<div id="container-outside" class="container-border">
</div>
<div id="container-inside" class="container-border">
<div id="left-column">
<div class="header" id="header-top-left">
<div class="header-left-section">ENCOM TOUCH APP <span class="alt-1">OS</span><span class="alt-2">12</span></div>
<div class="header-right-section">OS | 012</div>
</div>
<div id="readme" class="content-container">
<div class="content">
<h2>
README <span class="alt-1">.TXT</span>
<em>END. PROGRAM</em>
</h2>
<p>
Hello <strong>User</strong>. Welcome to Encom's <strong>OS12</strong>, the worlds most secure operating system.
</p>
<p>
If you have not seen Tron: Legacy, please familiarize yourself with <a href="http://work.gmunk.com/TRON-Board-Room" onclick="alert('please do not visit yet, dont want referals to show up'); return false" target="_blank">this background material</a> before proceeding to the boardroom
visualization. The boardroom is currently configured to display live data from <strong>Github</strong> and <strong>Wikipedia</strong>,
with more live streams to come. Click on the appropriate stream in the window to the right if
you would like to continue.
</p>
<p>
The boardroom visualization requires the use of <a href="http://get.webgl.org/" target="_blank">WebGL</a>. The test below indicates the availability of WebGL
on this system.
</p>
<p>
This was created by <a href="https://twitter.com/arscan" target="_blank">@arscan</a> as a learning exercise. It is not affiliated with
Disney, Tron: Legacy, Encom, Wikipedia or Github in any way. The source is available on <a href="http://github.com/arscan" target="_blank">Github</a>.
</p>
</div>
</div>
<div id="bandwidth" class="content-container">
<div class="content">
<h2>
WEBGL <span class="alt-1">.TEST</span>
<em>END. PROGRAM</em>
</h2>
<canvas height="100px" width= "367px" id="webglCanvas"/>
</div>
</div>
<div class="header" id="header-bottom-left">
<div class="header-left-section">DOCKING CHANNEL</div>
<div class="header-right-section">
<div id="bottom-boxes-1"></div>
<div id="bottom-boxes-2"></div>
<div id="bottom-boxes-3"></div>
</div>
</div>
<!-- probably should remove these and have them created in the script-->
<div class="header-animator-left header-animator-inside"></div>
<div class="header-animator-left header-animator-outside"></div>
</div>
<div id="right-column">
<div class="header" id="header-top-right">
<div class="header-left-section">CENTRAL SYSTEM DATA ... <span class="alt-1">LAUNCH ENCOM GLOBALIZATION</span></div>
<div class="header-right-section">OIA | 012</div>
</div>
<div id="globalization" class="content-container">
<div class="content">
<h2>
BOARDROOM VISUALIZATION ... PLEASE SELECT DATA <span class="alt-1">.STREAM</span>
<em>END. PROGRAM</em>
</h2>
<div class="folder-container" id="launch-github">
<div class="folder-label">
Github Stream
</div>
<div class="folder-big"></div>
</div>
<div id="command-line">
<div id="command-line-header">
Last Login: Wed Nov 26 11:26:49 on llvm992
</div>
<div id="command-lines">
<div class="command"><span class="prompt">encom-sh:encom_root$&nbsp;</span><span class="command-text"></span></div>
</div>
</div>
<div class="folder-container" id="launch-test">
<div class="folder-label">
Test Stream
</div>
<div class="folder-small"></div>
</div>
<div class="folder-container" id="launch-wikipedia">
<div id="folder-2" class="folder-label">
Wikipedia
</div>
<div class="folder-small"></div>
</div>
<div class="folder-container" id="launch-bitcoin">
<div class="folder-label">
Bitcoin
</div>
<div class="folder-small"></div>
</div>
<div class="folder-container" id="launch-unknown">
<div id="folder-2" class="folder-label">
Unknown
</div>
<div class="folder-small"></div>
</div>
</div>
</div>
<div id="keyboard">
<div id="k-27">ESC</div>
<div id="k-49">1</div>
<div id="k-50">2</div>
<div id="k-51">3</div>
<div id="k-52">4</div>
<div id="k-53">5</div>
<div id="k-54">6</div>
<div id="k-55">7</div>
<div id="k-56">8</div>
<div id="k-57">9</div>
<div id="k-48">0</div>
<div id="k-189">_</div>
<div id="k-8">BACK</div>
<div id="k-9">TAB</div>
<div id="k-81">q</div>
<div id="k-87">w</div>
<div id="k-69">e</div>
<div id="k-82">r</div>
<div id="k-84">t</div>
<div id="k-89">y</div>
<div id="k-85">u</div>
<div id="k-73">i</div>
<div id="k-79">o</div>
<div id="k-80">p</div>
<div id="k-219">()</div>
<div id="k-500">CAPS</div>
<div id="k-65">a</div>
<div id="k-83">s</div>
<div id="k-68">d</div>
<div id="k-70">f</div>
<div id="k-71">g</div>
<div id="k-72">h</div>
<div id="k-74">j</div>
<div id="k-75">k</div>
<div id="k-76">l</div>
<div id="k-186">;</div>
<div id="k-13">ENTER</div>
<div id="k-16">SHIFT</div>
<div id="k-90">z</div>
<div id="k-88">x</div>
<div id="k-67">c</div>
<div id="k-86">v</div>
<div id="k-66">b</div>
<div id="k-78">n</div>
<div id="k-77">m</div>
<div id="k-188">,</div>
<div id="k-190">.</div>
<div id="k-191">/</div>
<div id="k-0">SHIFT</div>
<div id="k-32"></div>
</div>
<div class="header" id="header-bottom-right">
<div class="header-left-section">TOUCHPOINT KEYBOARD ... <span class="alt-1">INTERACTION SEQUENCING</span></div>
<div class="header-right-section">SYS | O12</div>
</div>
<!-- probably should remove these and have them created in the script-->
<div class="header-animator-right header-animator-inside"></div>
<div class="header-animator-right header-animator-outside"></div>
</div>
<div id="far-right-column">
<div id="encom-logo">E N C O M</div>
<img id="thumbprint" src="thumbprint.png" />
</div>
</div>
</body>
</html>
moment.tz.add({
"zones": {
"America/Los_Angeles": [
"-7:52:58 - LMT 1883_10_18_12_7_2 -7:52:58",
"-8 US P%sT 1946 -8",
"-8 CA P%sT 1967 -8",
"-8 US P%sT"
],
"America/New_York": [
"-4:56:2 - LMT 1883_10_18_12_3_58 -4:56:2",
"-5 US E%sT 1920 -5",
"-5 NYC E%sT 1942 -5",
"-5 US E%sT 1946 -5",
"-5 NYC E%sT 1967 -5",
"-5 US E%sT"
],
"Asia/Colombo": [
"5:19:24 - LMT 1880 5:19:24",
"5:19:32 - MMT 1906 5:19:32",
"5:30 - IST 1942_0_5 5:30",
"6 - IHST 1942_8 6",
"6:30 - IST 1945_9_16_2 6:30",
"5:30 - IST 1996_4_25_0 5:30",
"6:30 - LKT 1996_9_26_0_30 6:30",
"6 - LKT 2006_3_15_0_30 6",
"5:30 - IST"
],
"Australia/Sydney": [
"10:4:52 - LMT 1895_1 10:4:52",
"10 Aus EST 1971 10",
"10 AN EST"
],
"Europe/Berlin": [
"0:53:28 - LMT 1893_3 0:53:28",
"1 C-Eur CE%sT 1945_4_24_2 2",
"1 SovietZone CE%sT 1946 1",
"1 Germany CE%sT 1980 1",
"1 EU CE%sT"
],
"Europe/London": [
"-0:1:15 - LMT 1847_11_1_0 -0:1:15",
"0 GB-Eire %s 1968_9_27 1",
"1 - BST 1971_9_31_2",
"0 GB-Eire %s 1996",
"0 EU GMT/BST"
]
},
"rules": {
"US": [
"1918 1919 2 0 8 2 0 1 D",
"1918 1919 9 0 8 2 0 0 S",
"1942 1942 1 9 7 2 0 1 W",
"1945 1945 7 14 7 23 1 1 P",
"1945 1945 8 30 7 2 0 0 S",
"1967 2006 9 0 8 2 0 0 S",
"1967 1973 3 0 8 2 0 1 D",
"1974 1974 0 6 7 2 0 1 D",
"1975 1975 1 23 7 2 0 1 D",
"1976 1986 3 0 8 2 0 1 D",
"1987 2006 3 1 0 2 0 1 D",
"2007 9999 2 8 0 2 0 1 D",
"2007 9999 10 1 0 2 0 0 S"
],
"CA": [
"1948 1948 2 14 7 2 0 1 D",
"1949 1949 0 1 7 2 0 0 S",
"1950 1966 3 0 8 2 0 1 D",
"1950 1961 8 0 8 2 0 0 S",
"1962 1966 9 0 8 2 0 0 S"
],
"NYC": [
"1920 1920 2 0 8 2 0 1 D",
"1920 1920 9 0 8 2 0 0 S",
"1921 1966 3 0 8 2 0 1 D",
"1921 1954 8 0 8 2 0 0 S",
"1955 1966 9 0 8 2 0 0 S"
],
"Aus": [
"1917 1917 0 1 7 0:1 0 1",
"1917 1917 2 25 7 2 0 0",
"1942 1942 0 1 7 2 0 1",
"1942 1942 2 29 7 2 0 0",
"1942 1942 8 27 7 2 0 1",
"1943 1944 2 0 8 2 0 0",
"1943 1943 9 3 7 2 0 1"
],
"AN": [
"1971 1985 9 0 8 2 2 1",
"1972 1972 1 27 7 2 2 0",
"1973 1981 2 1 0 2 2 0",
"1982 1982 3 1 0 2 2 0",
"1983 1985 2 1 0 2 2 0",
"1986 1989 2 15 0 2 2 0",
"1986 1986 9 19 7 2 2 1",
"1987 1999 9 0 8 2 2 1",
"1990 1995 2 1 0 2 2 0",
"1996 2005 2 0 8 2 2 0",
"2000 2000 7 0 8 2 2 1",
"2001 2007 9 0 8 2 2 1",
"2006 2006 3 1 0 2 2 0",
"2007 2007 2 0 8 2 2 0",
"2008 9999 3 1 0 2 2 0",
"2008 9999 9 1 0 2 2 1"
],
"C-Eur": [
"1916 1916 3 30 7 23 0 1 S",
"1916 1916 9 1 7 1 0 0",
"1917 1918 3 15 1 2 2 1 S",
"1917 1918 8 15 1 2 2 0",
"1940 1940 3 1 7 2 2 1 S",
"1942 1942 10 2 7 2 2 0",
"1943 1943 2 29 7 2 2 1 S",
"1943 1943 9 4 7 2 2 0",
"1944 1945 3 1 1 2 2 1 S",
"1944 1944 9 2 7 2 2 0",
"1945 1945 8 16 7 2 2 0",
"1977 1980 3 1 0 2 2 1 S",
"1977 1977 8 0 8 2 2 0",
"1978 1978 9 1 7 2 2 0",
"1979 1995 8 0 8 2 2 0",
"1981 9999 2 0 8 2 2 1 S",
"1996 9999 9 0 8 2 2 0"
],
"SovietZone": [
"1945 1945 4 24 7 2 0 2 M",
"1945 1945 8 24 7 3 0 1 S",
"1945 1945 10 18 7 2 2 0"
],
"Germany": [
"1946 1946 3 14 7 2 2 1 S",
"1946 1946 9 7 7 2 2 0",
"1947 1949 9 1 0 2 2 0",
"1947 1947 3 6 7 3 2 1 S",
"1947 1947 4 11 7 2 2 2 M",
"1947 1947 5 29 7 3 0 1 S",
"1948 1948 3 18 7 2 2 1 S",
"1949 1949 3 10 7 2 2 1 S"
],
"EU": [
"1977 1980 3 1 0 1 1 1 S",
"1977 1977 8 0 8 1 1 0",
"1978 1978 9 1 7 1 1 0",
"1979 1995 8 0 8 1 1 0",
"1981 9999 2 0 8 1 1 1 S",
"1996 9999 9 0 8 1 1 0"
],
"GB-Eire": [
"1916 1916 4 21 7 2 2 1 BST",
"1916 1916 9 1 7 2 2 0 GMT",
"1917 1917 3 8 7 2 2 1 BST",
"1917 1917 8 17 7 2 2 0 GMT",
"1918 1918 2 24 7 2 2 1 BST",
"1918 1918 8 30 7 2 2 0 GMT",
"1919 1919 2 30 7 2 2 1 BST",
"1919 1919 8 29 7 2 2 0 GMT",
"1920 1920 2 28 7 2 2 1 BST",
"1920 1920 9 25 7 2 2 0 GMT",
"1921 1921 3 3 7 2 2 1 BST",
"1921 1921 9 3 7 2 2 0 GMT",
"1922 1922 2 26 7 2 2 1 BST",
"1922 1922 9 8 7 2 2 0 GMT",
"1923 1923 3 16 0 2 2 1 BST",
"1923 1924 8 16 0 2 2 0 GMT",
"1924 1924 3 9 0 2 2 1 BST",
"1925 1926 3 16 0 2 2 1 BST",
"1925 1938 9 2 0 2 2 0 GMT",
"1927 1927 3 9 0 2 2 1 BST",
"1928 1929 3 16 0 2 2 1 BST",
"1930 1930 3 9 0 2 2 1 BST",
"1931 1932 3 16 0 2 2 1 BST",
"1933 1933 3 9 0 2 2 1 BST",
"1934 1934 3 16 0 2 2 1 BST",
"1935 1935 3 9 0 2 2 1 BST",
"1936 1937 3 16 0 2 2 1 BST",
"1938 1938 3 9 0 2 2 1 BST",
"1939 1939 3 16 0 2 2 1 BST",
"1939 1939 10 16 0 2 2 0 GMT",
"1940 1940 1 23 0 2 2 1 BST",
"1941 1941 4 2 0 1 2 2 BDST",
"1941 1943 7 9 0 1 2 1 BST",
"1942 1944 3 2 0 1 2 2 BDST",
"1944 1944 8 16 0 1 2 1 BST",
"1945 1945 3 2 1 1 2 2 BDST",
"1945 1945 6 9 0 1 2 1 BST",
"1945 1946 9 2 0 2 2 0 GMT",
"1946 1946 3 9 0 2 2 1 BST",
"1947 1947 2 16 7 2 2 1 BST",
"1947 1947 3 13 7 1 2 2 BDST",
"1947 1947 7 10 7 1 2 1 BST",
"1947 1947 10 2 7 2 2 0 GMT",
"1948 1948 2 14 7 2 2 1 BST",
"1948 1948 9 31 7 2 2 0 GMT",
"1949 1949 3 3 7 2 2 1 BST",
"1949 1949 9 30 7 2 2 0 GMT",
"1950 1952 3 14 0 2 2 1 BST",
"1950 1952 9 21 0 2 2 0 GMT",
"1953 1953 3 16 0 2 2 1 BST",
"1953 1960 9 2 0 2 2 0 GMT",
"1954 1954 3 9 0 2 2 1 BST",
"1955 1956 3 16 0 2 2 1 BST",
"1957 1957 3 9 0 2 2 1 BST",
"1958 1959 3 16 0 2 2 1 BST",
"1960 1960 3 9 0 2 2 1 BST",
"1961 1963 2 0 8 2 2 1 BST",
"1961 1968 9 23 0 2 2 0 GMT",
"1964 1967 2 19 0 2 2 1 BST",
"1968 1968 1 18 7 2 2 1 BST",
"1972 1980 2 16 0 2 2 1 BST",
"1972 1980 9 23 0 2 2 0 GMT",
"1981 1995 2 0 8 1 1 1 BST",
"1981 1989 9 23 0 1 1 0 GMT",
"1990 1995 9 22 0 1 1 0 GMT"
]
},
"links": {}
});
(function(){function t(t){function n(t){t+="";var e=t.split(":"),n=~t.indexOf("-")?-1:1,s=Math.abs(+e[0]),r=parseInt(e[1],10)||0,i=parseInt(e[2],10)||0;return n*(60*s+r+i/60)}function s(t,e,s,r,i,u,a,o,h,f){this.name=t,this.startYear=+e,this.endYear=+s,this.month=+r,this.day=+i,this.dayRule=+u,this.time=n(a),this.timeRule=+o,this.offset=n(h),this.letters=f||""}function r(t,e){this.rule=e,this.start=e.start(t)}function i(t,e){return t.isLast?-1:e.isLast?1:e.start-t.start}function u(t){this.name=t,this.rules=[]}function a(e,s,r,i,u,a){var o,h="string"==typeof u?u.split("_"):[9999];for(this.name=e,this.offset=n(s),this.ruleSet=r,this.letters=i,o=0;h.length>o;o++)h[o]=+h[o];this.until=t.utc(h).subtract("m",n(a))}function o(t,e){return t.until-e.until}function h(t){this.name=d(t),this.displayName=t,this.zones=[]}function f(t){var e,n,s;for(e in t)for(s=t[e],n=0;s.length>n;n++)l(e+" "+s[n])}function l(t){if(g[t])return g[t];var e=t.split(/\s/),n=d(e[0]),r=new s(n,e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9],e[10]);return g[t]=r,z(n).add(r),r}function d(t){return(t||"").toLowerCase().replace(/\//g,"_")}function c(t){var e,n,s;for(e in t)for(s=t[e],n=0;s.length>n;n++)p(e+" "+s[n])}function m(t){var e;for(e in t)A[d(e)]=d(t[e])}function p(t){if(b[t])return b[t];var e=t.split(/\s/),n=d(e[0]),s=new a(n,e[1],z(e[2]),e[3],e[4],e[5]);return b[t]=s,y(e[0]).add(s),s}function z(t){return t=d(t),Y[t]||(Y[t]=new u(t)),Y[t]}function y(t){var e=d(t);return A[e]&&(e=A[e]),M[e]||(M[e]=new h(t)),M[e]}function v(t){t&&(t.zones&&c(t.zones),t.rules&&f(t.rules),t.links&&m(t.links))}var R,w=t.fn.zoneName,_=t.fn.zoneAbbr,g={},Y={},b={},M={},A={},k=1,L=2,N=7,q=8;return s.prototype={contains:function(t){return t>=this.startYear&&this.endYear>=t},start:function(e){return e=Math.min(Math.max(e,this.startYear),this.endYear),t.utc([e,this.month,this.date(e),0,this.time])},date:function(t){return this.dayRule===N?this.day:this.dayRule===q?this.lastWeekday(t):this.weekdayAfter(t)},weekdayAfter:function(e){for(var n=this.day,s=t([e,this.month,1]).day(),r=this.dayRule+1-s;n>r;)r+=7;return r},lastWeekday:function(e){var n=this.day,s=n%7,r=t([e,this.month+1,1]).day(),i=t([e,this.month,1]).daysInMonth(),u=i+(s-(r-1))-7*~~(n/7);return s>=r&&(u-=7),u}},r.prototype={equals:function(t){return t&&t.rule===this.rule?864e5>Math.abs(t.start-this.start):!1}},u.prototype={add:function(t){this.rules.push(t)},ruleYears:function(t,e){var n,s,u,a=t.year(),o=[];for(n=0;this.rules.length>n;n++)s=this.rules[n],s.contains(a)?o.push(new r(a,s)):s.contains(a+1)&&o.push(new r(a+1,s));return o.push(new r(a-1,this.lastYearRule(a-1))),e&&(u=new r(a-1,e.lastRule()),u.start=e.until.clone().utc(),u.isLast=e.ruleSet!==this,o.push(u)),o.sort(i),o},rule:function(t,e,n){var s,r,i,u,a,o=this.ruleYears(t,n),h=0;for(n&&(r=n.offset+n.lastRule().offset,i=9e4*Math.abs(r)),a=o.length-1;a>-1;a--)u=s,s=o[a],s.equals(u)||(n&&!s.isLast&&i>=Math.abs(s.start-n.until)&&(h+=r-e),s.rule.timeRule===L&&(h=e),s.rule.timeRule!==k&&s.start.add("m",-h),h=s.rule.offset+e);for(a=0;o.length>a;a++)if(s=o[a],t>=s.start&&!s.isLast)return s.rule;return R},lastYearRule:function(t){var e,n,s,r=R,i=-1e30;for(e=0;this.rules.length>e;e++)n=this.rules[e],t>=n.startYear&&(s=n.start(t),s>i&&(i=s,r=n));return r}},a.prototype={rule:function(t,e){return this.ruleSet.rule(t,this.offset,e)},lastRule:function(){return this._lastRule||(this._lastRule=this.rule(this.until)),this._lastRule},format:function(t){return this.letters.replace("%s",t.letters)}},h.prototype={zoneAndRule:function(t){var e,n,s;for(t=t.clone().utc(),e=0;this.zones.length>e&&(n=this.zones[e],!(n.until>t));e++)s=n;return[n,n.rule(t,s)]},add:function(t){this.zones.push(t),this.zones.sort(o)},format:function(t){var e=this.zoneAndRule(t);return e[0].format(e[1])},offset:function(t){var e=this.zoneAndRule(t);return-(e[0].offset+e[1].offset)}},t.updateOffset=function(t){var e;t._z&&(e=t._z.offset(t),16>Math.abs(e)&&(e/=60),t.zone(e))},t.fn.tz=function(e){return e?(this._z=y(e),this._z&&t.updateOffset(this),this):this._z?this._z.displayName:void 0},t.fn.zoneName=function(){return this._z?this._z.format(this):w.call(this)},t.fn.zoneAbbr=function(){return this._z?this._z.format(this):_.call(this)},t.tz=function(){var e,n=[],s=arguments.length-1;for(e=0;s>e;e++)n[e]=arguments[e];return t.apply(null,n).tz(arguments[s])},t.tz.add=v,t.tz.addRule=l,t.tz.addZone=p,t.tz.version=e,R=l("- 0 9999 0 0 0 0 0 0"),t}var e="0.0.1";"function"==typeof define&&define.amd?define("moment-timezone",["moment"],t):"undefined"!=typeof window&&window.moment?t(window.moment):"undefined"!=typeof module&&(module.exports=t(require("./moment")))}).apply(this);
//! moment.js
//! version : 2.5.0
//! authors : Tim Wood, Iskren Chernev, Moment.js contributors
//! license : MIT
//! momentjs.com
(function(a){function b(a,b){return function(c){return i(a.call(this,c),b)}}function c(a,b){return function(c){return this.lang().ordinal(a.call(this,c),b)}}function d(){}function e(a){u(a),g(this,a)}function f(a){var b=o(a),c=b.year||0,d=b.month||0,e=b.week||0,f=b.day||0,g=b.hour||0,h=b.minute||0,i=b.second||0,j=b.millisecond||0;this._milliseconds=+j+1e3*i+6e4*h+36e5*g,this._days=+f+7*e,this._months=+d+12*c,this._data={},this._bubble()}function g(a,b){for(var c in b)b.hasOwnProperty(c)&&(a[c]=b[c]);return b.hasOwnProperty("toString")&&(a.toString=b.toString),b.hasOwnProperty("valueOf")&&(a.valueOf=b.valueOf),a}function h(a){return 0>a?Math.ceil(a):Math.floor(a)}function i(a,b,c){for(var d=Math.abs(a)+"",e=a>=0;d.length<b;)d="0"+d;return(e?c?"+":"":"-")+d}function j(a,b,c,d){var e,f,g=b._milliseconds,h=b._days,i=b._months;g&&a._d.setTime(+a._d+g*c),(h||i)&&(e=a.minute(),f=a.hour()),h&&a.date(a.date()+h*c),i&&a.month(a.month()+i*c),g&&!d&&cb.updateOffset(a),(h||i)&&(a.minute(e),a.hour(f))}function k(a){return"[object Array]"===Object.prototype.toString.call(a)}function l(a){return"[object Date]"===Object.prototype.toString.call(a)||a instanceof Date}function m(a,b,c){var d,e=Math.min(a.length,b.length),f=Math.abs(a.length-b.length),g=0;for(d=0;e>d;d++)(c&&a[d]!==b[d]||!c&&q(a[d])!==q(b[d]))&&g++;return g+f}function n(a){if(a){var b=a.toLowerCase().replace(/(.)s$/,"$1");a=Qb[a]||Rb[b]||b}return a}function o(a){var b,c,d={};for(c in a)a.hasOwnProperty(c)&&(b=n(c),b&&(d[b]=a[c]));return d}function p(b){var c,d;if(0===b.indexOf("week"))c=7,d="day";else{if(0!==b.indexOf("month"))return;c=12,d="month"}cb[b]=function(e,f){var g,h,i=cb.fn._lang[b],j=[];if("number"==typeof e&&(f=e,e=a),h=function(a){var b=cb().utc().set(d,a);return i.call(cb.fn._lang,b,e||"")},null!=f)return h(f);for(g=0;c>g;g++)j.push(h(g));return j}}function q(a){var b=+a,c=0;return 0!==b&&isFinite(b)&&(c=b>=0?Math.floor(b):Math.ceil(b)),c}function r(a,b){return new Date(Date.UTC(a,b+1,0)).getUTCDate()}function s(a){return t(a)?366:365}function t(a){return a%4===0&&a%100!==0||a%400===0}function u(a){var b;a._a&&-2===a._pf.overflow&&(b=a._a[ib]<0||a._a[ib]>11?ib:a._a[jb]<1||a._a[jb]>r(a._a[hb],a._a[ib])?jb:a._a[kb]<0||a._a[kb]>23?kb:a._a[lb]<0||a._a[lb]>59?lb:a._a[mb]<0||a._a[mb]>59?mb:a._a[nb]<0||a._a[nb]>999?nb:-1,a._pf._overflowDayOfYear&&(hb>b||b>jb)&&(b=jb),a._pf.overflow=b)}function v(a){a._pf={empty:!1,unusedTokens:[],unusedInput:[],overflow:-2,charsLeftOver:0,nullInput:!1,invalidMonth:null,invalidFormat:!1,userInvalidated:!1,iso:!1}}function w(a){return null==a._isValid&&(a._isValid=!isNaN(a._d.getTime())&&a._pf.overflow<0&&!a._pf.empty&&!a._pf.invalidMonth&&!a._pf.nullInput&&!a._pf.invalidFormat&&!a._pf.userInvalidated,a._strict&&(a._isValid=a._isValid&&0===a._pf.charsLeftOver&&0===a._pf.unusedTokens.length)),a._isValid}function x(a){return a?a.toLowerCase().replace("_","-"):a}function y(a,b){return b._isUTC?cb(a).zone(b._offset||0):cb(a).local()}function z(a,b){return b.abbr=a,ob[a]||(ob[a]=new d),ob[a].set(b),ob[a]}function A(a){delete ob[a]}function B(a){var b,c,d,e,f=0,g=function(a){if(!ob[a]&&pb)try{require("./lang/"+a)}catch(b){}return ob[a]};if(!a)return cb.fn._lang;if(!k(a)){if(c=g(a))return c;a=[a]}for(;f<a.length;){for(e=x(a[f]).split("-"),b=e.length,d=x(a[f+1]),d=d?d.split("-"):null;b>0;){if(c=g(e.slice(0,b).join("-")))return c;if(d&&d.length>=b&&m(e,d,!0)>=b-1)break;b--}f++}return cb.fn._lang}function C(a){return a.match(/\[[\s\S]/)?a.replace(/^\[|\]$/g,""):a.replace(/\\/g,"")}function D(a){var b,c,d=a.match(tb);for(b=0,c=d.length;c>b;b++)d[b]=Vb[d[b]]?Vb[d[b]]:C(d[b]);return function(e){var f="";for(b=0;c>b;b++)f+=d[b]instanceof Function?d[b].call(e,a):d[b];return f}}function E(a,b){return a.isValid()?(b=F(b,a.lang()),Sb[b]||(Sb[b]=D(b)),Sb[b](a)):a.lang().invalidDate()}function F(a,b){function c(a){return b.longDateFormat(a)||a}var d=5;for(ub.lastIndex=0;d>=0&&ub.test(a);)a=a.replace(ub,c),ub.lastIndex=0,d-=1;return a}function G(a,b){var c,d=b._strict;switch(a){case"DDDD":return Gb;case"YYYY":case"GGGG":case"gggg":return d?Hb:xb;case"YYYYYY":case"YYYYY":case"GGGGG":case"ggggg":return d?Ib:yb;case"S":if(d)return Eb;case"SS":if(d)return Fb;case"SSS":case"DDD":return d?Gb:wb;case"MMM":case"MMMM":case"dd":case"ddd":case"dddd":return Ab;case"a":case"A":return B(b._l)._meridiemParse;case"X":return Db;case"Z":case"ZZ":return Bb;case"T":return Cb;case"SSSS":return zb;case"MM":case"DD":case"YY":case"GG":case"gg":case"HH":case"hh":case"mm":case"ss":case"ww":case"WW":return d?Fb:vb;case"M":case"D":case"d":case"H":case"h":case"m":case"s":case"w":case"W":case"e":case"E":return d?Eb:vb;default:return c=new RegExp(O(N(a.replace("\\","")),"i"))}}function H(a){a=a||"";var b=a.match(Bb)||[],c=b[b.length-1]||[],d=(c+"").match(Nb)||["-",0,0],e=+(60*d[1])+q(d[2]);return"+"===d[0]?-e:e}function I(a,b,c){var d,e=c._a;switch(a){case"M":case"MM":null!=b&&(e[ib]=q(b)-1);break;case"MMM":case"MMMM":d=B(c._l).monthsParse(b),null!=d?e[ib]=d:c._pf.invalidMonth=b;break;case"D":case"DD":null!=b&&(e[jb]=q(b));break;case"DDD":case"DDDD":null!=b&&(c._dayOfYear=q(b));break;case"YY":e[hb]=q(b)+(q(b)>68?1900:2e3);break;case"YYYY":case"YYYYY":case"YYYYYY":e[hb]=q(b);break;case"a":case"A":c._isPm=B(c._l).isPM(b);break;case"H":case"HH":case"h":case"hh":e[kb]=q(b);break;case"m":case"mm":e[lb]=q(b);break;case"s":case"ss":e[mb]=q(b);break;case"S":case"SS":case"SSS":case"SSSS":e[nb]=q(1e3*("0."+b));break;case"X":c._d=new Date(1e3*parseFloat(b));break;case"Z":case"ZZ":c._useUTC=!0,c._tzm=H(b);break;case"w":case"ww":case"W":case"WW":case"d":case"dd":case"ddd":case"dddd":case"e":case"E":a=a.substr(0,1);case"gg":case"gggg":case"GG":case"GGGG":case"GGGGG":a=a.substr(0,2),b&&(c._w=c._w||{},c._w[a]=b)}}function J(a){var b,c,d,e,f,g,h,i,j,k,l=[];if(!a._d){for(d=L(a),a._w&&null==a._a[jb]&&null==a._a[ib]&&(f=function(b){var c=parseInt(b,10);return b?b.length<3?c>68?1900+c:2e3+c:c:null==a._a[hb]?cb().weekYear():a._a[hb]},g=a._w,null!=g.GG||null!=g.W||null!=g.E?h=Y(f(g.GG),g.W||1,g.E,4,1):(i=B(a._l),j=null!=g.d?U(g.d,i):null!=g.e?parseInt(g.e,10)+i._week.dow:0,k=parseInt(g.w,10)||1,null!=g.d&&j<i._week.dow&&k++,h=Y(f(g.gg),k,j,i._week.doy,i._week.dow)),a._a[hb]=h.year,a._dayOfYear=h.dayOfYear),a._dayOfYear&&(e=null==a._a[hb]?d[hb]:a._a[hb],a._dayOfYear>s(e)&&(a._pf._overflowDayOfYear=!0),c=T(e,0,a._dayOfYear),a._a[ib]=c.getUTCMonth(),a._a[jb]=c.getUTCDate()),b=0;3>b&&null==a._a[b];++b)a._a[b]=l[b]=d[b];for(;7>b;b++)a._a[b]=l[b]=null==a._a[b]?2===b?1:0:a._a[b];l[kb]+=q((a._tzm||0)/60),l[lb]+=q((a._tzm||0)%60),a._d=(a._useUTC?T:S).apply(null,l)}}function K(a){var b;a._d||(b=o(a._i),a._a=[b.year,b.month,b.day,b.hour,b.minute,b.second,b.millisecond],J(a))}function L(a){var b=new Date;return a._useUTC?[b.getUTCFullYear(),b.getUTCMonth(),b.getUTCDate()]:[b.getFullYear(),b.getMonth(),b.getDate()]}function M(a){a._a=[],a._pf.empty=!0;var b,c,d,e,f,g=B(a._l),h=""+a._i,i=h.length,j=0;for(d=F(a._f,g).match(tb)||[],b=0;b<d.length;b++)e=d[b],c=(h.match(G(e,a))||[])[0],c&&(f=h.substr(0,h.indexOf(c)),f.length>0&&a._pf.unusedInput.push(f),h=h.slice(h.indexOf(c)+c.length),j+=c.length),Vb[e]?(c?a._pf.empty=!1:a._pf.unusedTokens.push(e),I(e,c,a)):a._strict&&!c&&a._pf.unusedTokens.push(e);a._pf.charsLeftOver=i-j,h.length>0&&a._pf.unusedInput.push(h),a._isPm&&a._a[kb]<12&&(a._a[kb]+=12),a._isPm===!1&&12===a._a[kb]&&(a._a[kb]=0),J(a),u(a)}function N(a){return a.replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(a,b,c,d,e){return b||c||d||e})}function O(a){return a.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}function P(a){var b,c,d,e,f;if(0===a._f.length)return a._pf.invalidFormat=!0,a._d=new Date(0/0),void 0;for(e=0;e<a._f.length;e++)f=0,b=g({},a),v(b),b._f=a._f[e],M(b),w(b)&&(f+=b._pf.charsLeftOver,f+=10*b._pf.unusedTokens.length,b._pf.score=f,(null==d||d>f)&&(d=f,c=b));g(a,c||b)}function Q(a){var b,c=a._i,d=Jb.exec(c);if(d){for(a._pf.iso=!0,b=4;b>0;b--)if(d[b]){a._f=Lb[b-1]+(d[6]||" ");break}for(b=0;4>b;b++)if(Mb[b][1].exec(c)){a._f+=Mb[b][0];break}c.match(Bb)&&(a._f+="Z"),M(a)}else a._d=new Date(c)}function R(b){var c=b._i,d=qb.exec(c);c===a?b._d=new Date:d?b._d=new Date(+d[1]):"string"==typeof c?Q(b):k(c)?(b._a=c.slice(0),J(b)):l(c)?b._d=new Date(+c):"object"==typeof c?K(b):b._d=new Date(c)}function S(a,b,c,d,e,f,g){var h=new Date(a,b,c,d,e,f,g);return 1970>a&&h.setFullYear(a),h}function T(a){var b=new Date(Date.UTC.apply(null,arguments));return 1970>a&&b.setUTCFullYear(a),b}function U(a,b){if("string"==typeof a)if(isNaN(a)){if(a=b.weekdaysParse(a),"number"!=typeof a)return null}else a=parseInt(a,10);return a}function V(a,b,c,d,e){return e.relativeTime(b||1,!!c,a,d)}function W(a,b,c){var d=gb(Math.abs(a)/1e3),e=gb(d/60),f=gb(e/60),g=gb(f/24),h=gb(g/365),i=45>d&&["s",d]||1===e&&["m"]||45>e&&["mm",e]||1===f&&["h"]||22>f&&["hh",f]||1===g&&["d"]||25>=g&&["dd",g]||45>=g&&["M"]||345>g&&["MM",gb(g/30)]||1===h&&["y"]||["yy",h];return i[2]=b,i[3]=a>0,i[4]=c,V.apply({},i)}function X(a,b,c){var d,e=c-b,f=c-a.day();return f>e&&(f-=7),e-7>f&&(f+=7),d=cb(a).add("d",f),{week:Math.ceil(d.dayOfYear()/7),year:d.year()}}function Y(a,b,c,d,e){var f,g,h=new Date(i(a,6,!0)+"-01-01").getUTCDay();return c=null!=c?c:e,f=e-h+(h>d?7:0),g=7*(b-1)+(c-e)+f+1,{year:g>0?a:a-1,dayOfYear:g>0?g:s(a-1)+g}}function Z(a){var b=a._i,c=a._f;return"undefined"==typeof a._pf&&v(a),null===b?cb.invalid({nullInput:!0}):("string"==typeof b&&(a._i=b=B().preparse(b)),cb.isMoment(b)?(a=g({},b),a._d=new Date(+b._d)):c?k(c)?P(a):M(a):R(a),new e(a))}function $(a,b){cb.fn[a]=cb.fn[a+"s"]=function(a){var c=this._isUTC?"UTC":"";return null!=a?(this._d["set"+c+b](a),cb.updateOffset(this),this):this._d["get"+c+b]()}}function _(a){cb.duration.fn[a]=function(){return this._data[a]}}function ab(a,b){cb.duration.fn["as"+a]=function(){return+this/b}}function bb(a){var b=!1,c=cb;"undefined"==typeof ender&&(a?(fb.moment=function(){return!b&&console&&console.warn&&(b=!0,console.warn("Accessing Moment through the global scope is deprecated, and will be removed in an upcoming release.")),c.apply(null,arguments)},g(fb.moment,c)):fb.moment=cb)}for(var cb,db,eb="2.5.0",fb=this,gb=Math.round,hb=0,ib=1,jb=2,kb=3,lb=4,mb=5,nb=6,ob={},pb="undefined"!=typeof module&&module.exports&&"undefined"!=typeof require,qb=/^\/?Date\((\-?\d+)/i,rb=/(\-)?(?:(\d*)\.)?(\d+)\:(\d+)(?:\:(\d+)\.?(\d{3})?)?/,sb=/^(-)?P(?:(?:([0-9,.]*)Y)?(?:([0-9,.]*)M)?(?:([0-9,.]*)D)?(?:T(?:([0-9,.]*)H)?(?:([0-9,.]*)M)?(?:([0-9,.]*)S)?)?|([0-9,.]*)W)$/,tb=/(\[[^\[]*\])|(\\)?(Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|mm?|ss?|S{1,4}|X|zz?|ZZ?|.)/g,ub=/(\[[^\[]*\])|(\\)?(LT|LL?L?L?|l{1,4})/g,vb=/\d\d?/,wb=/\d{1,3}/,xb=/\d{1,4}/,yb=/[+\-]?\d{1,6}/,zb=/\d+/,Ab=/[0-9]*['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+|[\u0600-\u06FF\/]+(\s*?[\u0600-\u06FF]+){1,2}/i,Bb=/Z|[\+\-]\d\d:?\d\d/gi,Cb=/T/i,Db=/[\+\-]?\d+(\.\d{1,3})?/,Eb=/\d/,Fb=/\d\d/,Gb=/\d{3}/,Hb=/\d{4}/,Ib=/[+\-]?\d{6}/,Jb=/^\s*\d{4}-(?:(\d\d-\d\d)|(W\d\d$)|(W\d\d-\d)|(\d\d\d))((T| )(\d\d(:\d\d(:\d\d(\.\d+)?)?)?)?([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/,Kb="YYYY-MM-DDTHH:mm:ssZ",Lb=["YYYY-MM-DD","GGGG-[W]WW","GGGG-[W]WW-E","YYYY-DDD"],Mb=[["HH:mm:ss.SSSS",/(T| )\d\d:\d\d:\d\d\.\d{1,3}/],["HH:mm:ss",/(T| )\d\d:\d\d:\d\d/],["HH:mm",/(T| )\d\d:\d\d/],["HH",/(T| )\d\d/]],Nb=/([\+\-]|\d\d)/gi,Ob="Date|Hours|Minutes|Seconds|Milliseconds".split("|"),Pb={Milliseconds:1,Seconds:1e3,Minutes:6e4,Hours:36e5,Days:864e5,Months:2592e6,Years:31536e6},Qb={ms:"millisecond",s:"second",m:"minute",h:"hour",d:"day",D:"date",w:"week",W:"isoWeek",M:"month",y:"year",DDD:"dayOfYear",e:"weekday",E:"isoWeekday",gg:"weekYear",GG:"isoWeekYear"},Rb={dayofyear:"dayOfYear",isoweekday:"isoWeekday",isoweek:"isoWeek",weekyear:"weekYear",isoweekyear:"isoWeekYear"},Sb={},Tb="DDD w W M D d".split(" "),Ub="M D H h m s w W".split(" "),Vb={M:function(){return this.month()+1},MMM:function(a){return this.lang().monthsShort(this,a)},MMMM:function(a){return this.lang().months(this,a)},D:function(){return this.date()},DDD:function(){return this.dayOfYear()},d:function(){return this.day()},dd:function(a){return this.lang().weekdaysMin(this,a)},ddd:function(a){return this.lang().weekdaysShort(this,a)},dddd:function(a){return this.lang().weekdays(this,a)},w:function(){return this.week()},W:function(){return this.isoWeek()},YY:function(){return i(this.year()%100,2)},YYYY:function(){return i(this.year(),4)},YYYYY:function(){return i(this.year(),5)},YYYYYY:function(){var a=this.year(),b=a>=0?"+":"-";return b+i(Math.abs(a),6)},gg:function(){return i(this.weekYear()%100,2)},gggg:function(){return this.weekYear()},ggggg:function(){return i(this.weekYear(),5)},GG:function(){return i(this.isoWeekYear()%100,2)},GGGG:function(){return this.isoWeekYear()},GGGGG:function(){return i(this.isoWeekYear(),5)},e:function(){return this.weekday()},E:function(){return this.isoWeekday()},a:function(){return this.lang().meridiem(this.hours(),this.minutes(),!0)},A:function(){return this.lang().meridiem(this.hours(),this.minutes(),!1)},H:function(){return this.hours()},h:function(){return this.hours()%12||12},m:function(){return this.minutes()},s:function(){return this.seconds()},S:function(){return q(this.milliseconds()/100)},SS:function(){return i(q(this.milliseconds()/10),2)},SSS:function(){return i(this.milliseconds(),3)},SSSS:function(){return i(this.milliseconds(),3)},Z:function(){var a=-this.zone(),b="+";return 0>a&&(a=-a,b="-"),b+i(q(a/60),2)+":"+i(q(a)%60,2)},ZZ:function(){var a=-this.zone(),b="+";return 0>a&&(a=-a,b="-"),b+i(q(a/60),2)+i(q(a)%60,2)},z:function(){return this.zoneAbbr()},zz:function(){return this.zoneName()},X:function(){return this.unix()},Q:function(){return this.quarter()}},Wb=["months","monthsShort","weekdays","weekdaysShort","weekdaysMin"];Tb.length;)db=Tb.pop(),Vb[db+"o"]=c(Vb[db],db);for(;Ub.length;)db=Ub.pop(),Vb[db+db]=b(Vb[db],2);for(Vb.DDDD=b(Vb.DDD,3),g(d.prototype,{set:function(a){var b,c;for(c in a)b=a[c],"function"==typeof b?this[c]=b:this["_"+c]=b},_months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),months:function(a){return this._months[a.month()]},_monthsShort:"Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),monthsShort:function(a){return this._monthsShort[a.month()]},monthsParse:function(a){var b,c,d;for(this._monthsParse||(this._monthsParse=[]),b=0;12>b;b++)if(this._monthsParse[b]||(c=cb.utc([2e3,b]),d="^"+this.months(c,"")+"|^"+this.monthsShort(c,""),this._monthsParse[b]=new RegExp(d.replace(".",""),"i")),this._monthsParse[b].test(a))return b},_weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),weekdays:function(a){return this._weekdays[a.day()]},_weekdaysShort:"Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),weekdaysShort:function(a){return this._weekdaysShort[a.day()]},_weekdaysMin:"Su_Mo_Tu_We_Th_Fr_Sa".split("_"),weekdaysMin:function(a){return this._weekdaysMin[a.day()]},weekdaysParse:function(a){var b,c,d;for(this._weekdaysParse||(this._weekdaysParse=[]),b=0;7>b;b++)if(this._weekdaysParse[b]||(c=cb([2e3,1]).day(b),d="^"+this.weekdays(c,"")+"|^"+this.weekdaysShort(c,"")+"|^"+this.weekdaysMin(c,""),this._weekdaysParse[b]=new RegExp(d.replace(".",""),"i")),this._weekdaysParse[b].test(a))return b},_longDateFormat:{LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D YYYY",LLL:"MMMM D YYYY LT",LLLL:"dddd, MMMM D YYYY LT"},longDateFormat:function(a){var b=this._longDateFormat[a];return!b&&this._longDateFormat[a.toUpperCase()]&&(b=this._longDateFormat[a.toUpperCase()].replace(/MMMM|MM|DD|dddd/g,function(a){return a.slice(1)}),this._longDateFormat[a]=b),b},isPM:function(a){return"p"===(a+"").toLowerCase().charAt(0)},_meridiemParse:/[ap]\.?m?\.?/i,meridiem:function(a,b,c){return a>11?c?"pm":"PM":c?"am":"AM"},_calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},calendar:function(a,b){var c=this._calendar[a];return"function"==typeof c?c.apply(b):c},_relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},relativeTime:function(a,b,c,d){var e=this._relativeTime[c];return"function"==typeof e?e(a,b,c,d):e.replace(/%d/i,a)},pastFuture:function(a,b){var c=this._relativeTime[a>0?"future":"past"];return"function"==typeof c?c(b):c.replace(/%s/i,b)},ordinal:function(a){return this._ordinal.replace("%d",a)},_ordinal:"%d",preparse:function(a){return a},postformat:function(a){return a},week:function(a){return X(a,this._week.dow,this._week.doy).week},_week:{dow:0,doy:6},_invalidDate:"Invalid date",invalidDate:function(){return this._invalidDate}}),cb=function(b,c,d,e){return"boolean"==typeof d&&(e=d,d=a),Z({_i:b,_f:c,_l:d,_strict:e,_isUTC:!1})},cb.utc=function(b,c,d,e){var f;return"boolean"==typeof d&&(e=d,d=a),f=Z({_useUTC:!0,_isUTC:!0,_l:d,_i:b,_f:c,_strict:e}).utc()},cb.unix=function(a){return cb(1e3*a)},cb.duration=function(a,b){var c,d,e,g=a,h=null;return cb.isDuration(a)?g={ms:a._milliseconds,d:a._days,M:a._months}:"number"==typeof a?(g={},b?g[b]=a:g.milliseconds=a):(h=rb.exec(a))?(c="-"===h[1]?-1:1,g={y:0,d:q(h[jb])*c,h:q(h[kb])*c,m:q(h[lb])*c,s:q(h[mb])*c,ms:q(h[nb])*c}):(h=sb.exec(a))&&(c="-"===h[1]?-1:1,e=function(a){var b=a&&parseFloat(a.replace(",","."));return(isNaN(b)?0:b)*c},g={y:e(h[2]),M:e(h[3]),d:e(h[4]),h:e(h[5]),m:e(h[6]),s:e(h[7]),w:e(h[8])}),d=new f(g),cb.isDuration(a)&&a.hasOwnProperty("_lang")&&(d._lang=a._lang),d},cb.version=eb,cb.defaultFormat=Kb,cb.updateOffset=function(){},cb.lang=function(a,b){var c;return a?(b?z(x(a),b):null===b?(A(a),a="en"):ob[a]||B(a),c=cb.duration.fn._lang=cb.fn._lang=B(a),c._abbr):cb.fn._lang._abbr},cb.langData=function(a){return a&&a._lang&&a._lang._abbr&&(a=a._lang._abbr),B(a)},cb.isMoment=function(a){return a instanceof e},cb.isDuration=function(a){return a instanceof f},db=Wb.length-1;db>=0;--db)p(Wb[db]);for(cb.normalizeUnits=function(a){return n(a)},cb.invalid=function(a){var b=cb.utc(0/0);return null!=a?g(b._pf,a):b._pf.userInvalidated=!0,b},cb.parseZone=function(a){return cb(a).parseZone()},g(cb.fn=e.prototype,{clone:function(){return cb(this)},valueOf:function(){return+this._d+6e4*(this._offset||0)},unix:function(){return Math.floor(+this/1e3)},toString:function(){return this.clone().lang("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")},toDate:function(){return this._offset?new Date(+this):this._d},toISOString:function(){var a=cb(this).utc();return 0<a.year()&&a.year()<=9999?E(a,"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]"):E(a,"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]")},toArray:function(){var a=this;return[a.year(),a.month(),a.date(),a.hours(),a.minutes(),a.seconds(),a.milliseconds()]},isValid:function(){return w(this)},isDSTShifted:function(){return this._a?this.isValid()&&m(this._a,(this._isUTC?cb.utc(this._a):cb(this._a)).toArray())>0:!1},parsingFlags:function(){return g({},this._pf)},invalidAt:function(){return this._pf.overflow},utc:function(){return this.zone(0)},local:function(){return this.zone(0),this._isUTC=!1,this},format:function(a){var b=E(this,a||cb.defaultFormat);return this.lang().postformat(b)},add:function(a,b){var c;return c="string"==typeof a?cb.duration(+b,a):cb.duration(a,b),j(this,c,1),this},subtract:function(a,b){var c;return c="string"==typeof a?cb.duration(+b,a):cb.duration(a,b),j(this,c,-1),this},diff:function(a,b,c){var d,e,f=y(a,this),g=6e4*(this.zone()-f.zone());return b=n(b),"year"===b||"month"===b?(d=432e5*(this.daysInMonth()+f.daysInMonth()),e=12*(this.year()-f.year())+(this.month()-f.month()),e+=(this-cb(this).startOf("month")-(f-cb(f).startOf("month")))/d,e-=6e4*(this.zone()-cb(this).startOf("month").zone()-(f.zone()-cb(f).startOf("month").zone()))/d,"year"===b&&(e/=12)):(d=this-f,e="second"===b?d/1e3:"minute"===b?d/6e4:"hour"===b?d/36e5:"day"===b?(d-g)/864e5:"week"===b?(d-g)/6048e5:d),c?e:h(e)},from:function(a,b){return cb.duration(this.diff(a)).lang(this.lang()._abbr).humanize(!b)},fromNow:function(a){return this.from(cb(),a)},calendar:function(){var a=y(cb(),this).startOf("day"),b=this.diff(a,"days",!0),c=-6>b?"sameElse":-1>b?"lastWeek":0>b?"lastDay":1>b?"sameDay":2>b?"nextDay":7>b?"nextWeek":"sameElse";return this.format(this.lang().calendar(c,this))},isLeapYear:function(){return t(this.year())},isDST:function(){return this.zone()<this.clone().month(0).zone()||this.zone()<this.clone().month(5).zone()},day:function(a){var b=this._isUTC?this._d.getUTCDay():this._d.getDay();return null!=a?(a=U(a,this.lang()),this.add({d:a-b})):b},month:function(a){var b,c=this._isUTC?"UTC":"";return null!=a?"string"==typeof a&&(a=this.lang().monthsParse(a),"number"!=typeof a)?this:(b=this.date(),this.date(1),this._d["set"+c+"Month"](a),this.date(Math.min(b,this.daysInMonth())),cb.updateOffset(this),this):this._d["get"+c+"Month"]()},startOf:function(a){switch(a=n(a)){case"year":this.month(0);case"month":this.date(1);case"week":case"isoWeek":case"day":this.hours(0);case"hour":this.minutes(0);case"minute":this.seconds(0);case"second":this.milliseconds(0)}return"week"===a?this.weekday(0):"isoWeek"===a&&this.isoWeekday(1),this},endOf:function(a){return a=n(a),this.startOf(a).add("isoWeek"===a?"week":a,1).subtract("ms",1)},isAfter:function(a,b){return b="undefined"!=typeof b?b:"millisecond",+this.clone().startOf(b)>+cb(a).startOf(b)},isBefore:function(a,b){return b="undefined"!=typeof b?b:"millisecond",+this.clone().startOf(b)<+cb(a).startOf(b)},isSame:function(a,b){return b=b||"ms",+this.clone().startOf(b)===+y(a,this).startOf(b)},min:function(a){return a=cb.apply(null,arguments),this>a?this:a},max:function(a){return a=cb.apply(null,arguments),a>this?this:a},zone:function(a){var b=this._offset||0;return null==a?this._isUTC?b:this._d.getTimezoneOffset():("string"==typeof a&&(a=H(a)),Math.abs(a)<16&&(a=60*a),this._offset=a,this._isUTC=!0,b!==a&&j(this,cb.duration(b-a,"m"),1,!0),this)},zoneAbbr:function(){return this._isUTC?"UTC":""},zoneName:function(){return this._isUTC?"Coordinated Universal Time":""},parseZone:function(){return this._tzm?this.zone(this._tzm):"string"==typeof this._i&&this.zone(this._i),this},hasAlignedHourOffset:function(a){return a=a?cb(a).zone():0,(this.zone()-a)%60===0},daysInMonth:function(){return r(this.year(),this.month())},dayOfYear:function(a){var b=gb((cb(this).startOf("day")-cb(this).startOf("year"))/864e5)+1;return null==a?b:this.add("d",a-b)},quarter:function(){return Math.ceil((this.month()+1)/3)},weekYear:function(a){var b=X(this,this.lang()._week.dow,this.lang()._week.doy).year;return null==a?b:this.add("y",a-b)},isoWeekYear:function(a){var b=X(this,1,4).year;return null==a?b:this.add("y",a-b)},week:function(a){var b=this.lang().week(this);return null==a?b:this.add("d",7*(a-b))},isoWeek:function(a){var b=X(this,1,4).week;return null==a?b:this.add("d",7*(a-b))},weekday:function(a){var b=(this.day()+7-this.lang()._week.dow)%7;return null==a?b:this.add("d",a-b)},isoWeekday:function(a){return null==a?this.day()||7:this.day(this.day()%7?a:a-7)},get:function(a){return a=n(a),this[a]()},set:function(a,b){return a=n(a),"function"==typeof this[a]&&this[a](b),this},lang:function(b){return b===a?this._lang:(this._lang=B(b),this)}}),db=0;db<Ob.length;db++)$(Ob[db].toLowerCase().replace(/s$/,""),Ob[db]);$("year","FullYear"),cb.fn.days=cb.fn.day,cb.fn.months=cb.fn.month,cb.fn.weeks=cb.fn.week,cb.fn.isoWeeks=cb.fn.isoWeek,cb.fn.toJSON=cb.fn.toISOString,g(cb.duration.fn=f.prototype,{_bubble:function(){var a,b,c,d,e=this._milliseconds,f=this._days,g=this._months,i=this._data;i.milliseconds=e%1e3,a=h(e/1e3),i.seconds=a%60,b=h(a/60),i.minutes=b%60,c=h(b/60),i.hours=c%24,f+=h(c/24),i.days=f%30,g+=h(f/30),i.months=g%12,d=h(g/12),i.years=d},weeks:function(){return h(this.days()/7)},valueOf:function(){return this._milliseconds+864e5*this._days+this._months%12*2592e6+31536e6*q(this._months/12)},humanize:function(a){var b=+this,c=W(b,!a,this.lang());return a&&(c=this.lang().pastFuture(b,c)),this.lang().postformat(c)},add:function(a,b){var c=cb.duration(a,b);return this._milliseconds+=c._milliseconds,this._days+=c._days,this._months+=c._months,this._bubble(),this},subtract:function(a,b){var c=cb.duration(a,b);return this._milliseconds-=c._milliseconds,this._days-=c._days,this._months-=c._months,this._bubble(),this},get:function(a){return a=n(a),this[a.toLowerCase()+"s"]()},as:function(a){return a=n(a),this["as"+a.charAt(0).toUpperCase()+a.slice(1)+"s"]()},lang:cb.fn.lang,toIsoString:function(){var a=Math.abs(this.years()),b=Math.abs(this.months()),c=Math.abs(this.days()),d=Math.abs(this.hours()),e=Math.abs(this.minutes()),f=Math.abs(this.seconds()+this.milliseconds()/1e3);return this.asSeconds()?(this.asSeconds()<0?"-":"")+"P"+(a?a+"Y":"")+(b?b+"M":"")+(c?c+"D":"")+(d||e||f?"T":"")+(d?d+"H":"")+(e?e+"M":"")+(f?f+"S":""):"P0D"}});for(db in Pb)Pb.hasOwnProperty(db)&&(ab(db,Pb[db]),_(db.toLowerCase()));ab("Weeks",6048e5),cb.duration.fn.asMonths=function(){return(+this-31536e6*this.years())/2592e6+12*this.years()},cb.lang("en",{ordinal:function(a){var b=a%10,c=1===q(a%100/10)?"th":1===b?"st":2===b?"nd":3===b?"rd":"th";return a+c}}),pb?(module.exports=cb,bb(!0)):"function"==typeof define&&define.amd?define("moment",function(b,c,d){return d.config&&d.config()&&d.config().noGlobal!==!0&&bb(d.config().noGlobal===a),cb}):bb()}).call(this);
{
"name": "webgl-encom-globe",
"version": "0.0.0",
"description": "webgl-encom-globe =================",
"main": "encomsphere.js",
"dependencies": {
"grunt": "~0.4.2"
},
"devDependencies": {
"grunt": "~0.4.2",
"grunt-contrib-watch": "~0.5.3"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "git://github.com//arscan/webgl-encom-globe.git"
},
"author": "rscanlon@mit.edu",
"license": "MIT"
}
/* ----------------------------------------------------------------------------
pusher.color.js
A color parsing and manipulation library
----------------------------------------------------------------------------
The MIT License (MIT). Copyright (c) 2013, Pusher Inc.
*/
(function(){function normalize360(v){v=v%360;return v<0?360+v:v}function unsigned(i){return i>>>0}function trimLc(s){return s.replace(/^\s+/,"").replace(/\s+$/,"").toLowerCase()}function slice(obj,index){return Array.prototype.slice.call(obj,index)}function append(arr,value){arr.push(value);return arr}function clamp(x,a,b){return!(x>a)?a:!(x<b)?b:x}function mix(x,y,a){return(1-a)*x+a*y}function f2b(f){f=Math.round(255*f);if(!(f>0))return 0;else if(!(f<255))return 255;else return f&255}function b2f(b){return b/255}function rgbToHsl(r,g,b){var max=Math.max(r,g,b),min=Math.min(r,g,b);var h,s,l=(max+min)/2;if(max==min){h=s=0}else{var d=max-min;s=l>.5?d/(2-max-min):d/(max+min);switch(max){case r:h=(g-b)/d+(g<b?6:0);break;case g:h=(b-r)/d+2;break;case b:h=(r-g)/d+4;break}h/=6}return[h,s,l]}function hslToRgb(h,s,l){var r,g,b;if(s==0){r=g=b=l}else{function hue2rgb(p,q,t){if(t<0)t+=1;if(t>1)t-=1;if(t<1/6)return p+(q-p)*6*t;if(t<1/2)return q;if(t<2/3)return p+(q-p)*(2/3-t)*6;return p}var q=l<.5?l*(1+s):l+s-l*s;var p=2*l-q;r=hue2rgb(p,q,h+1/3);g=hue2rgb(p,q,h);b=hue2rgb(p,q,h-1/3)}return[r,g,b]}function hex4ToRgba(color){var rgba=[parseInt(color.substr(1,1),16),parseInt(color.substr(2,1),16),parseInt(color.substr(3,1),16),1];for(var i=0;i<3;++i)rgba[i]=(rgba[i]*16+rgba[i])/255;return rgba}function hex7ToRgba(color){return[parseInt(color.substr(1,2),16)/255,parseInt(color.substr(3,2),16)/255,parseInt(color.substr(5,2),16)/255,1]}var namedColors={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,216],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[216,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};function rgbaToHsva(rgba){var r=rgba[0];var g=rgba[1];var b=rgba[2];var min=Math.min(Math.min(r,g),b),max=Math.max(Math.max(r,g),b),delta=max-min;var value=max;var saturation,hue;if(max==min){hue=0}else if(max==r){hue=60*((g-b)/(max-min))%360}else if(max==g){hue=60*((b-r)/(max-min))+120}else if(max==b){hue=60*((r-g)/(max-min))+240}if(hue<0){hue+=360}if(max==0){saturation=0}else{saturation=1-min/max}return[Math.round(hue),Math.round(saturation*100),Math.round(value*100),rgba[3]]}function hsvaToRgba(hsva){var h=normalize360(hsva[0]);var s=hsva[1];var v=hsva[2];var s=s/100;var v=v/100;var hi=Math.floor(h/60%6);var f=h/60-hi;var p=v*(1-s);var q=v*(1-f*s);var t=v*(1-(1-f)*s);var rgb=[];switch(hi){case 0:rgb=[v,t,p];break;case 1:rgb=[q,v,p];break;case 2:rgb=[p,v,t];break;case 3:rgb=[p,q,v];break;case 4:rgb=[t,p,v];break;case 5:rgb=[v,p,q];break}return[rgb[0],rgb[1],rgb[2],hsva[3]]}function rgbaToHsl(c){var hsl=rgbToHsl(c[0],c[1],c[2]);hsl[0]=normalize360(Math.floor(hsl[0]*360));hsl[1]=Math.floor(hsl[1]*100);hsl[2]=Math.floor(hsl[2]*100);return hsl}function rgbaToHsla(c){var hsl=rgbaToHsl(c);hsl.push(c[3]);return hsl}function hslToRgba(c){var h=parseFloat(c[0])/360;var s=parseFloat(c[1])/100;var l=parseFloat(c[2])/100;var rgb=hslToRgb(h,s,l);return[rgb[0],rgb[1],rgb[2],1]}function hslaToRgba(c){var h=parseFloat(c[0])/360;var s=parseFloat(c[1])/100;var l=parseFloat(c[2])/100;var rgb=hslToRgb(h,s,l);return[rgb[0],rgb[1],rgb[2],parseFloat(c[3])]}var parse={byteOrPercent:function(s){var m;if(typeof s=="string"&&(m=s.match(/^([0-9]+)%$/)))return Math.floor(parseFloat(m[1])*255/100);else return parseFloat(s)},floatOrPercent:function(s){var m;if(typeof s=="string"&&(m=s.match(/^([0-9]+)%$/)))return parseFloat(m[1])/100;else return parseFloat(s)},numberOrPercent:function(s,scale){var m;if(typeof s=="string"&&(m=s.match(/^([0-9]+)%$/)))return parseFloat(m[1])/100*scale;else return parseFloat(s)},rgba:function(v){for(var i=0;i<3;++i)v[i]=b2f(parse.byteOrPercent(v[i]));v[3]=parse.floatOrPercent(v[i]);return new Color(v)},rgba8:function(v){return new Color([b2f(parse.byteOrPercent(v[0])),b2f(parse.byteOrPercent(v[1])),b2f(parse.byteOrPercent(v[2])),b2f(parse.byteOrPercent(v[3]))])},float3:function(v){for(var i=0;i<3;++i)v[i]=parse.floatOrPercent(v[i]);v[3]=1;return new Color(v)},float4:function(v){for(var i=0;i<3;++i)v[i]=parse.floatOrPercent(v[i]);v[3]=parse.floatOrPercent(v[i]);return new Color(v)},hsla:function(v){v[0]=parse.numberOrPercent(v[0],360);v[1]=parse.numberOrPercent(v[1],100);v[2]=parse.numberOrPercent(v[2],100);v[3]=parse.numberOrPercent(v[3],1);return new Color(hslaToRgba(v))},hsva:function(v){v[0]=normalize360(parseFloat(v[0]));v[1]=Math.max(0,Math.min(100,parseFloat(v[1])));v[2]=Math.max(0,Math.min(100,parseFloat(v[2])));v[3]=parse.floatOrPercent(v[3]);return new Color(hsvaToRgba(v))}};var supportedFormats={keyword:{},hex3:{},hex7:{},rgb:{parse:function(v){v=v.slice(0);v.push(1);return parse.rgba(v)}},rgba:{parse:parse.rgba},hsl:{parse:function(v){v=v.slice(0);v.push(1);return parse.hsla(v)}},hsla:{parse:parse.hsla},hsv:{parse:function(v){v=v.slice(0);v.push(1);return parse.hsva(v)}},hsva:{parse:parse.hsva},rgb8:{parse:function(v){v=v.slice(0);v.push(1);return parse.rgba(v)}},rgba8:{parse:function(v){return parse.rgba8(v)}},packed_rgba:{parse:function(v){v=[v>>24&255,v>>16&255,v>>8&255,(v&255)/255];return parse.rgba(v)},output:function(v){return unsigned(f2b(v[0])<<24|f2b(v[1])<<16|f2b(v[2])<<8|f2b(v[3]))}},packed_argb:{parse:function(v){v=[v>>16&255,v>>8&255,v>>0&255,(v>>24&255)/255];return parse.rgba(v)},output:function(v){return unsigned(f2b(v[3])<<24|f2b(v[0])<<16|f2b(v[1])<<8|f2b(v[2]))}},float3:{parse:parse.float3},float4:{parse:parse.float4}};function Color(value){this._value=value}var color=function(){var match=null;if(arguments[0]instanceof Color){return new Color(arguments[0]._value)}else if(typeof arguments[0]=="string"){var first=arguments[0][0];if(first=="#"){if(match=arguments[0].match(/^#([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])$/i)){return new Color(hex4ToRgba(match[0]))}else if(match=arguments[0].match(/^#([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])$/i)){return new Color(hex7ToRgba(match[0]))}}else if(match=supportedFormats[arguments[0].toLowerCase()]){if(arguments.length==2)return match.parse(arguments[1]);else return match.parse(slice(arguments,1))}else if(match=arguments[0].match(/^\s*([A-Z][A-Z0-9_]+)\s*\(\s*([\-0-9A-FX]+)\s*\)\s*$/i)){var format=supportedFormats[match[1].toLowerCase()];return format.parse(match[2])}else if(match=arguments[0].match(/^\s*([A-Z][A-Z0-9]+)\s*\(\s*([0-9\.]+%?)\s*,\s*([0-9\.]+%?)\s*,\s*([0-9\.]+%?)\s*(,\s*([0-9\.]+%?)\s*)?\)\s*$/i)){var format=supportedFormats[match[1].toLowerCase()];if(match[5]===undefined){var v=[match[2],match[3],match[4]];return format.parse(v)}else{var v=[match[2],match[3],match[4],match[6]];return format.parse(v)}}else if(arguments.length==1&&(match=namedColors[trimLc(arguments[0])])){var v=match;return new Color([b2f(v[0]),b2f(v[1]),b2f(v[2]),1])}}throw"Could not parse color '"+arguments[0]+"'"};var fixed={white:color("white"),black:color("black"),gray:color("gray")};function modifyComponent(index,arg){if(arg==undefined)return f2b(this._value[index]);var v=slice(this._value,0);if(typeof arg=="string"){var m;if(m=arg.match(/^([+\-\\*]=?)([0-9.]+)/)){var op=m[1];var offset=parseFloat(m[2]);switch(op[0]){case"+":v[index]+=offset/255;break;case"-":v[index]-=offset/255;break;case"*":v[index]*=offset;break}if(op[1]=="="){this._value=v;return this}else return new Color(v)}}else{var clone=this.clone();clone._value[index]=arg;return clone}}function modifyHsva(i){return function(){function change(obj,op,value){value=parseFloat(value);var hsva=rgbaToHsva(obj._value);var c=0;switch(op){case"=":hsva[i]=value;c=1;break;case"+":hsva[i]+=value;c=1;break;case"+=":hsva[i]+=value;break;case"-":hsva[i]-=value;c=1;break;case"-=":hsva[i]-=value;break;case"*":hsva[i]*=value;c=1;break;case"*=":hsva[i]*=value;break;default:throw"Bad op "+op}if(i==0)hsva[i]=normalize360(hsva[i]);else if(i==1||i==2){if(hsva[i]<0)hsva[i]=0;else if(hsva[i]>99)hsva[i]=99}if(c)obj=obj.clone();obj._value=hsvaToRgba(hsva);return obj}if(arguments.length==0)return rgbaToHsva(this._value)[i];else if(arguments.length==1){var m;if(typeof arguments[0]=="string"&&(m=arguments[0].match(/^([\+\-\*]=?)([0-9.]+)/)))return change(this,m[1],m[2]);else return change(this,"=",arguments[0])}else if(arguments.length==2)return change(this,arguments[0],arguments[1])}}var methods={clone:function(){return new Color(this._value.slice(0))},html:function(){var self=this;var v=this._value;var _fmt={hex3:function(){return self.hex3()},hex6:function(){return self.hex6()},rgb:function(){return"rgb("+self.rgb().join(",")+")"},rgba:function(){return"rgba("+self.rgba().join(",")+")"},hsl:function(){return"hsl("+rgbaToHsl(v).join(",")+")"},hsla:function(){return"hsla("+rgbaToHsla(v).join(",")+")"},keyword:function(){var dist=3*255*255+1;var keyword;for(name in namedColors){var c=namedColors[name];var d=0;for(var i=0;i<3;++i){var t=v[i]-b2f(c[i]);d+=t*t}if(d<dist){keyword=name;dist=d}}return keyword}};var type=arguments[0]||"rgba";return _fmt[type]()},red:function(){return modifyComponent.call(this,0,arguments[0])},green:function(){return modifyComponent.call(this,1,arguments[0])},blue:function(){return modifyComponent.call(this,2,arguments[0])},alpha:function(){if(arguments.length==1){c=this.clone();c._value[3]=parse.floatOrPercent(arguments[0]);return c}else return this._value[3]},alpha8:function(){if(arguments.length==1){c=this.clone();c._value[3]=parse.byteOrPercent(arguments[0])/255;return c}else return Math.floor(this._value[3]*255)},grayvalue:function(){var c=this._value;return(c[0]+c[1]+c[2])/3},grayvalue8:function(){return f2b(this.grayvalue())},luminanceFast:function(){var c=this._value;return c[0]*.2126+c[1]*.7152+c[2]*.0722},luminance:function(){function linearize(c){return c<.03928?c/12.92:Math.pow((c+.055)/1.055,2.4)}var r=linearize(this._value[0]);var g=linearize(this._value[1]);var b=linearize(this._value[2]);return r*.2126+g*.7152+b*.0722},luminance8:function(){return f2b(this.luminance())},luminanceFast8:function(){return f2b(this.luminanceFast())},hsv:function(){return rgbaToHsva(this._value).slice(0,3)},hsva:function(){return rgbaToHsva(this._value)},packed_rgba:function(){return supportedFormats.packed_rgba.output(this._value)},packed_argb:function(){return supportedFormats.packed_argb.output(this._value)},hue:modifyHsva(0),saturation:modifyHsva(1),value:modifyHsva(2),clamp:function(){var v=this._value;return new Color([clamp(v[0],0,1),clamp(v[1],0,1),clamp(v[2],0,1),clamp(v[3],0,1)])},blend:function(colorToBlend,amount){if(typeof amount!=="number")amount=parse.floatOrPercent(amount);var c=this;var c2=color(colorToBlend);return new Color([mix(c._value[0],c2._value[0],amount),mix(c._value[1],c2._value[1],amount),mix(c._value[2],c2._value[2],amount),mix(c._value[3],c2._value[3],amount)])},add:function(d){var u=this._value;var v=color(d)._value;return new Color([u[0]+v[0]*v[3],u[1]+v[1]*v[3],u[2]+v[2]*v[3],u[3]])},inc:function(d){var u=this._value;var v=color(d)._value;u[0]+=v[0]*v[3];u[1]+=v[1]*v[3];u[2]+=v[2]*v[3];return this},dec:function(d){var u=this._value;var v=color(d)._value;u[0]-=v[0]*v[3];u[1]-=v[1]*v[3];u[2]-=v[2]*v[3];return this},subtract:function(d){var u=this._value;var v=color(d)._value;return new Color([u[0]-v[0]*v[3],u[1]-v[1]*v[3],u[2]-v[2]*v[3],u[3]])},multiply:function(d){var u=this._value;var v=color(d)._value;return new Color([u[0]*v[0],u[1]*v[1],u[2]*v[2],u[3]*v[3]])},scale:function(d){var u=this._value;return new Color([u[0]*d,u[1]*d,u[2]*d,u[3]])},xor:function(d){var u=this.rgba8();var v=color(d).rgba8();return color("rgba8",u[0]^v[0],u[1]^v[1],u[2]^v[2],u[3])},tint:function(amount){return this.blend(fixed.white,amount)},shade:function(amount){return this.blend(fixed.black,amount)},tone:function(amount){return this.blend(fixed.gray,amount)},complement:function(){var hsva=this.hsva();hsva[0]=normalize360(hsva[0]+180);return new Color(hsvaToRgba(hsva))},triad:function(){return[new Color(this._value),this.hue("+120"),this.hue("+240")]},hueSet:function(){var h=0;var set=[];for(var s=100;s>=30;s-=35)for(var v=100;v>=30;v-=35)set.push(this.hue("+",h).saturation(s).value(v));return set},hueRange:function(range,count){var base=this.hue();var set=[];for(var i=0;i<count;++i){var h=base+2*(i/(count-1)-.5)*range;set.push(this.hue("=",h))}return set},contrastWhiteBlack:function(){return this.value()<50?color("white"):color("black")},contrastGray:function(){var hsva=this.hsva();var value=hsva[2]<30?hsva[2]+20:hsva[2]-20;return new Color(hsvaToRgba([hsva[0],0,value,hsva[3]]))},contrastText:function(){var c=this._value;var b=.241*c[0]*c[0]+.691*c[1]*c[1]+.068*c[2]*c[2];return b<.51?color("white"):color("black")},hex3:function(){function hex(d,max){return Math.min(Math.round(f2b(d)/16),15).toString(16)}return"#"+hex(this._value[0])+hex(this._value[1])+hex(this._value[2])},hex6:function(){function hex(d,max){var h=f2b(d).toString(16);return h.length<2?"0"+h:h}return"#"+hex(this._value[0])+hex(this._value[1])+hex(this._value[2])},rgb:function(){var v=this._value;return[f2b(v[0]),f2b(v[1]),f2b(v[2])]},rgba:function(){var v=this._value;return[f2b(v[0]),f2b(v[1]),f2b(v[2]),v[3]]},rgb8:function(){var v=this._value;return[f2b(v[0]),f2b(v[1]),f2b(v[2])]},rgba8:function(){var v=this._value;return[f2b(v[0]),f2b(v[1]),f2b(v[2]),this.alpha8()]},float3:function(){return[this._value[0],this._value[1],this._value[2]]},float4:function(){return[this._value[0],this._value[1],this._value[2],this._value[3]]}};methods["sub"]=methods["subtract"];methods["mul"]=methods["multiply"];for(var name in methods)Color.prototype[name]=methods[name];color.float3=function(r,g,b){return new Color([r,g,b,1])};color.float4=function(r,g,b,a){return new Color([r,g,b,a])};color.version="0.2.5";color.Color=Color;if(typeof module!=="undefined"&&module.exports){module.exports=color}else if(typeof window!=="undefined"){window.pusher=window.pusher||{};window.pusher.color=color}else if(typeof self!="undefined"){self.pusher=self.pusher||{};self.pusher.color=color}})();
var box;
function animate(){
requestAnimationFrame(animate);
box.tick();
}
function start(){
animate();
}
$(function() {
box = new ENCOM.Box({containerId: "box"});
animate();
});
var globe, satbar, simpleclock, startDate, box, swirls, sliderHeads, slider, lastTime, screensaver, locationAreas, locationAreaColors, logo;
startDate = new Date();
sliderHeads = {};
locationAreaColors = [];
for(var i = 0; i< 20; i++){
locationAreaColors[i] = pusher.color('#00eeee').blend('#ffcc00', i/20).hex6();
}
lastTime = Date.now();
function animate(){
var animateTime = Date.now() - lastTime;
lastTime = Date.now();
globe.tick();
satbar.tick();
$("#clock").text(getTime());
simpleclock.tick();
box.tick();
stockchart.tick();
swirls.tick();
updateSliders(animateTime);
requestAnimationFrame(animate);
}
var updateSliders = function(animateTime){
var incDistance = Math.floor(200 * animateTime / 1000);
var rem = [];
for(var s in sliderHeads){
var slider = sliderHeads[s];
slider.margin += incDistance;
if(slider.margin > 200){
rem.push(slider);
} else {
slider.element.css("margin-left", slider.margin + "px");
}
}
for(var i = 0; i< rem.length; i++){
delete sliderHeads[rem[i].area];
rem[i].element.siblings().remove();
}
if(Math.random()<.1){
$(".location-slider ul").each(function(index, val){
var ch = $(val).children();
if(ch.length > 10){
ch.slice(10-ch.length).remove();
}
});
}
}
function findArea(lat, lng){
if(lat <= -40){
return "antarctica";
}
if(lat > 12 && lng > -180 && lng < -45){
return "northamerica";
}
if(lat <= 12 && lat > -40 && lng > -90 && lng < -30){
return "southamerica";
}
if(lat < -10 && lng >= 105 && lng <=155){
return "australia";
}
if(lat > 20 && lng >= 60 && lng <=160){
return "asia";
}
if(lat > 10 && lat < 40 && lng >= 35 && lng <=60){
return "asia";
}
if(lat > -40 && lat < 35 && lng >= -20 && lng <=50){
return "africa";
}
if(lat >= 35 && lng >= -10 && lng <=40){
return "europe";
}
return "other";
}
function getTime(){
var elapsed = new Date() - startDate;
var mili = Math.floor((elapsed/10) % 100);
var seconds = Math.floor((elapsed / 1000) % 60);
var minutes = Math.floor((elapsed / 60000) % 100);
var hours = Math.floor((elapsed / 3600000) % 100);
return (hours < 10 ? "0":"") + hours + ":" + (minutes < 10 ? "0":"") + minutes + ":" + (seconds< 10? "0": "") + seconds + ":" + (mili < 10? "0" : "") + mili;
}
function start(){
// $("#screensaver").css("display","none");
// the globe and other canvas-based renders will render their intros automatically
// so start the render loop
animate();
var mediaBoxes = $('.media-box .user-pic');
var blinkies = $('.blinky');
var blinkiesColors = ["#000", "#ffcc00", "#00eeee", "#fff"];
var userIndex = 0;
var lastUserDate = Date.now();
var currentUsers = [];
// render the other elements intro animations
$("#fps").delay(100).animate({
height: "25px"
}, 500).animate({
width: "180px"}, 800);
$("#ms").delay(600).animate({
height: "25px"
}, 500).animate({
width: "180px"}, 800);
$("#globalization").delay(600).animate({
top: "0px",
left: "0px",
width: "180px"
}, 500);
$("#globalization .location-slider").each(function(index, element){
$(element).delay(600 + index * 200).animate({
width: "180px"
}, 1000);
});
$("#logo-cover-up").delay(3000).animate({
height: "0px"
}, 2500);
$("#logo-cover-side-1").delay(3000).animate({
left: "200px"
}, 2500);
$("#logo-cover-side-2").delay(3000).animate({
width: "0px"
}, 2500);
$("#user-interaction").delay(500).animate({
width: "600px"
}, 1500);
$("#growth").delay(1000).animate({
width: "600px"
}, 1500);
$("#media").delay(1500).animate({
width: "450px"
}, 1500);
$("#timer").delay(2000).animate({
width: "450px"
}, 1500);
$("#bottom-border").delay(100).animate({
width: "1900px"
}, 4000);
/*
var mediaWidth = $(".media-box").css("width");
var mediaHeight = $(".media-box").css("height");
$(".media-box").css("width","0").css("height","0");
$(".media-box").delay(2000).animate({
width: mediaWidth,
height: mediaHeight
}, 500);
*/
console.log($("#media-bottom").css("height"));
var interactionContainer = $("#interaction > div")[0];
setTimeout(function(){
StreamServer.onMessage(function (datain) {
var chunks = datain.message.split("*");
var data = {};
if(datain.location){
data.location = datain.location.name;
if(datain.location.lat && datain.location.lng){
data.latlng = {"lat": datain.location.lat, "lng": datain.location.lng};
globe.addMarker(datain.location.lat, datain.location.lng, datain.location.name);
}
}
data.actor = chunks[3].trim();
data.repo = chunks[0].trim();
data.type = chunks[5].trim();
data.pic = chunks[6].trim();
/* do the globalization */
// figure out which one I'm in
var area = "unknown";
if(data.latlng){
area = findArea(data.latlng.lat, data.latlng.lng);
$("#location-city-" + area).text(data.location);
}
locationAreas[area].count = locationAreas[area].count + 1;
locationAreas[area].count = Math.min(19,locationAreas[area].count);
locationAreas[area].ref.css("background-color", locationAreaColors[locationAreas[area].count]);
$("#location-slider-" + area + " ul :first-child").css("margin-left", "-=5px");
$("#location-slider-" + area + " ul").prepend("<li style='color: " + locationAreaColors[locationAreas[area].count] + "'/>");
sliderHeads[area] = {area: area, element: $("#location-slider-" + area + " ul :first-child"), margin: 0};
// cleanup
var lastChild = interactionContainer.lastChild;
lastChild.innerHTML = '<li>' + data.actor + '</li><li>' + data.repo + '</li><li>' + data.type + '</li>';
interactionContainer.insertBefore(interactionContainer.lastChild, interactionContainer.firstChild);
swirls.hit(data.type);
$(blinkies[Math.floor(Math.random() * blinkies.length)]).css('background-color', blinkiesColors[Math.floor(Math.random() * blinkiesColors.length)]);
var showUser = true;
if(currentUsers.length < 10 || Date.now() - lastUserDate > 1000){
for(var i = 0; i< currentUsers.length && showUser; i++){
if(currentUsers[i] == data.pic){
showUser = false;
}
}
if(showUser){
var img = document.createElement('img');
var profileImageLoaded = function(ui){
var mb = $(mediaBoxes[ui]);
mb.css('background-image', 'url(http://0.gravatar.com/avatar/' + data.pic + '?s=' + mb.width() +')');
mb.find('span').text(data.actor);
};
img.addEventListener('load', profileImageLoaded.bind(this, userIndex));
img.src = 'http://0.gravatar.com/avatar/' + data.pic + '?s=' + $(mediaBoxes[userIndex]).width();
currentUsers[userIndex] = data.pic;
userIndex++;
userIndex = userIndex % 10;
lastUserDate = Date.now();
}
}
});
}, 2000);
setTimeout(function(){
for(var i = 0; i< 2; i++){
for(var j = 0; j< 4; j++){
globe.addSatellite(50 * i - 30 + 15 * Math.random(), 90 * j - 120 + 30 * i, 1.3 + Math.random()/10);
}
}
}, 5000);
setInterval(function(){
satbar.setZone(Math.floor(Math.random()*4-1));
}, 7000);
setTimeout(function(){
globe.addConnectedPoints(49.25, -123.1, "Vancouver", 35.68, 129.69, "Tokyo");
}, 2000);
setInterval(function(){
$("#san-francisco-time").text(moment().tz("America/Los_Angeles").format("HH:mm:ss"));
$("#new-york-time").text(moment().tz("America/New_York").format("HH:mm:ss"));
$("#london-time").text(moment().tz("Europe/London").format("HH:mm:ss"));
$("#berlin-time").text(moment().tz("Europe/Berlin").format("HH:mm:ss"));
$("#bangalore-time").text(moment().tz("Asia/Colombo").format("HH:mm:ss"));
$("#sydney-time").text(moment().tz("Australia/Sydney").format("HH:mm:ss"));
}, 1000);
}
$(function() {
locationAreas = {
antarctica: {count: 10, ref: $("#location-area-antarctica")},
northamerica: {count: 10, ref: $("#location-area-northamerica")},
southamerica: {count: 10, ref: $("#location-area-southamerica")},
europe: {count: 10, ref: $("#location-area-europe")},
asia: {count: 10, ref: $("#location-area-asia")},
australia: {count: 10, ref: $("#location-area-australia")},
africa: {count: 10, ref: $("#location-area-africa")},
other: {count: 10, ref: $("#location-area-other")},
unknown: {count: 10, ref: $("#location-area-unknown")}
};
setInterval(function(){
for(var a in locationAreas){
var loc = locationAreas[a];
loc.count = loc.count -1;
loc.count = Math.max(loc.count, 0);
loc.ref.css("background-color", locationAreaColors[loc.count]);
}
}, 3000);
WebFontConfig = {
google: {
families: ['Inconsolata']
},
active: function(){
globe = new ENCOM.globe({containerId: "globe"});
simpleclock = new ENCOM.SimpleClock("simpleclock");
globe.init(function(){
// called after the globe is complete
box = new ENCOM.Box({containerId: "cube"});
satbar = new ENCOM.SatBar("satbar");
timertrees = new ENCOM.TimerTrees("timer-trees");
stockchart = new ENCOM.StockChart("stock-chart");
stockchartsmall = new ENCOM.StockChartSmall("stock-chart-small");
swirls = new ENCOM.Swirls("swirls");
logo = new ENCOM.Logo("logo");
var screenSaver = $("#screensaver-info");
$("#screensaver-info span").text("Initializing...");
setTimeout(function(){
$("#screensaver-info span").css("visibility", "hidden");
screenSaver.animate({
opacity: 0,
},{
step: function(now, tween){
screenSaver.css('transform', 'scale(' + now + ',' + now + '');
},
duration: 600,
easing: "easeInOutBack",
complete: start});
}, 2000);
});
}
};
(function() {
var wf = document.createElement('script');
wf.src = ('https:' == document.location.protocol ? 'https' : 'http') +
'://ajax.googleapis.com/ajax/libs/webfont/1.4.7/webfont.js';
wf.type = 'text/javascript';
wf.async = 'true';
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(wf, s);
})();
var interactionContainer = $("#interaction > div");
for(var i = 0; i< 50; i++){
interactionContainer.append('<ul class="interaction-data"></ul>');
}
});
/**
* @author mrdoob / http://mrdoob.com/
*/
/**
* @author robscanlon / http://robscanlon.com
*/
var Stats = function (fpsContainer, msContainer) {
var startTime = Date.now(), prevTime = startTime;
var ms = 0, msMin = Infinity, msMax = 0;
var fps = 0, fpsMin = Infinity, fpsMax = 0;
var frames = 0;
var fpsDiv = document.createElement( 'div' );
fpsDiv.id = 'fps';
fpsContainer.appendChild( fpsDiv );
var fpsDescription = document.createElement( 'div' );
fpsDescription.id = 'fpsDescription';
fpsDescription.innerHTML = 'Frames per Second';
fpsDiv.appendChild( fpsDescription );
var fpsText = document.createElement( 'div' );
fpsText.id = 'fpsText';
fpsText.innerHTML = 'FPS';
fpsDiv.appendChild( fpsText );
var fpsGraph = document.createElement( 'div' );
fpsGraph.id = 'fpsGraph';
fpsDiv.appendChild( fpsGraph );
while ( fpsGraph.children.length < 74 ) {
var bar = document.createElement( 'span' );
fpsGraph.appendChild( bar );
}
var msDiv = document.createElement( 'div' );
msDiv.id = 'ms';
msContainer.appendChild( msDiv );
var msDescription = document.createElement( 'div' );
msDescription.id = 'msDescription';
msDescription.innerHTML = 'Refresh Time';
msDiv.appendChild( msDescription );
var msText = document.createElement( 'div' );
msText.id = 'msText';
msText.innerHTML = 'MS';
msDiv.appendChild( msText );
var msGraph = document.createElement( 'div' );
msGraph.id = 'msGraph';
msDiv.appendChild( msGraph );
while ( msGraph.children.length < 74 ) {
var bar = document.createElement( 'span' );
msGraph.appendChild( bar );
}
var updateGraph = function ( dom, value ) {
var child = dom.appendChild( dom.firstChild );
child.style.height = value + 'px';
}
return {
REVISION: 11,
begin: function () {
startTime = Date.now();
},
end: function () {
var time = Date.now();
ms = time - startTime;
msMin = Math.min( msMin, ms );
msMax = Math.max( msMax, ms );
msText.textContent = ms + ' MS (' + msMin + '-' + msMax + ')';
updateGraph( msGraph, Math.min( 26, 26 - ( ms / 200 ) * 26 ) );
frames ++;
if ( time > prevTime + 1000 ) {
fps = Math.round( ( frames * 1000 ) / ( time - prevTime ) );
fpsMin = Math.min( fpsMin, fps );
fpsMax = Math.max( fpsMax, fps );
fpsText.textContent = fps + ' FPS (' + fpsMin + '-' + fpsMax + ')';
updateGraph( fpsGraph, Math.min( 26, 26 - ( fps / 100 ) * 26 ) );
prevTime = time;
frames = 0;
}
return time;
},
update: function () {
startTime = this.end();
}
}
};
// stats.js - http://github.com/mrdoob/stats.js
var Stats=function(){var l=Date.now(),m=l,g=0,n=Infinity,o=0,h=0,p=Infinity,q=0,r=0,s=0,f=document.createElement("div");f.id="stats";f.addEventListener("mousedown",function(b){b.preventDefault();t(++s%2)},!1);f.style.cssText="width:80px;opacity:0.9;cursor:pointer";var a=document.createElement("div");a.id="fps";a.style.cssText="padding:0 0 3px 3px;text-align:left;background-color:#002";f.appendChild(a);var i=document.createElement("div");i.id="fpsText";i.style.cssText="color:#0ff;font-family:Helvetica,Arial,sans-serif;font-size:9px;font-weight:bold;line-height:15px";
i.innerHTML="FPS";a.appendChild(i);var c=document.createElement("div");c.id="fpsGraph";c.style.cssText="position:relative;width:74px;height:30px;background-color:#0ff";for(a.appendChild(c);74>c.children.length;){var j=document.createElement("span");j.style.cssText="width:1px;height:30px;float:left;background-color:#113";c.appendChild(j)}var d=document.createElement("div");d.id="ms";d.style.cssText="padding:0 0 3px 3px;text-align:left;background-color:#020;display:none";f.appendChild(d);var k=document.createElement("div");
k.id="msText";k.style.cssText="color:#0f0;font-family:Helvetica,Arial,sans-serif;font-size:9px;font-weight:bold;line-height:15px";k.innerHTML="MS";d.appendChild(k);var e=document.createElement("div");e.id="msGraph";e.style.cssText="position:relative;width:74px;height:30px;background-color:#0f0";for(d.appendChild(e);74>e.children.length;)j=document.createElement("span"),j.style.cssText="width:1px;height:30px;float:left;background-color:#131",e.appendChild(j);var t=function(b){s=b;switch(s){case 0:a.style.display=
"block";d.style.display="none";break;case 1:a.style.display="none",d.style.display="block"}};return{REVISION:11,domElement:f,setMode:t,begin:function(){l=Date.now()},end:function(){var b=Date.now();g=b-l;n=Math.min(n,g);o=Math.max(o,g);k.textContent=g+" MS ("+n+"-"+o+")";var a=Math.min(30,30-30*(g/200));e.appendChild(e.firstChild).style.height=a+"px";r++;b>m+1E3&&(h=Math.round(1E3*r/(b-m)),p=Math.min(p,h),q=Math.max(q,h),i.textContent=h+" FPS ("+p+"-"+q+")",a=Math.min(30,30-30*(h/100)),c.appendChild(c.firstChild).style.height=
a+"px",m=b,r=0);return b},update:function(){l=this.end()}}};
var StreamServer = (function () {
var mockUsers = ['9cca89218cefc2a2b79703d50b2f14ab9',
'001f39d886b094178d85d5acd0d8782a',
'1693351cfdf5a44cafa40f89b988eb4f',
'ec8150609d2d6616944b3751ef3309ec',
'5262283473c69b7d3ae4f26a4ce6a9fb',
'031ae086c509b79708580b4b64a8ab5b',
'8b3190da895e48686a313429f8b3850b',
'4bcdf0f5141a89c3fb4d18e2786fc6f7',
'b4b7e21776a1081ba754619d20e33f4c',
'ab2cf758040cee7fccd35f11ce2f72b2',
'32ef4e3e388cbadc756a008cade3ee6a',
'4abd5fbf19328cc23f60ca6453d9429c',
'f40bd5ee6bf6678ff2bca248113d6599',
'4d0c8fd9e76d64831f089f32ca91879a',
'0da57fdee303740e5d241fdfd0a93d0d',
'cb053688f95dbebf60e5c19a3d05110c',
'b441107a51951ba60e0359afd6e3029f',
'f1b47bf9bf001c9feb1b5d982c8fa04f',
'2639272b28fda236c5c163d38a96bee6',
'8876ddcc2f9e391eaa241ce131eca8ab',
'df71b16a1ace7c8525c5bd42d768ab80',
'4aa1c1f60ca46e6c8953f774e6cbab31',
'b68f5d39138103e8c3b8a6095be84072'
];
var onMessageFn = function(){};
var onStreamLoadedFn = function(){};
/* private function */
var loadScript = function(url, callback)
{
// Adding the script tag to the head as suggested before
var head = document.getElementsByTagName('head')[0];
var script = document.createElement('script');
script.type = 'text/javascript';
script.src = url;
// Then bind the event to the callback function.
// There are several events for cross browser compatibility.
script.onreadystatechange = callback;
script.onload = callback;
// Fire the loading
head.appendChild(script);
};
/* public functions */
var onStreamLoaded = function(cb) {
onStreamLoadedFn = cb;
}
var onMessage = function(cb) {
onMessageFn = cb;
}
onStreamLoadedFn();
setInterval(function(){
onMessageFn({
location: {
name: "test",
lat: Math.random() * 180 - 90,
lng: Math.random() * 360 - 180
},
message: "repo*second*third*user*fifth*java java asdfasdf ajav asdfja sdfjasdfjadsf jasjdf asjdf jasfdj asdfj asdfj asdfj *" + mockUsers[Math.floor(Math.random() * mockUsers.length)]
});
}, 100);
/* expose what we want */
return {
onStreamLoaded: onStreamLoaded,
onMessage: onMessage
};
}());
/* 775 by 363 */
body {
background-color: #000000;
font-family: 'Inconsolata', sans-serif;
color: #fff;
}
div {
/*border: 1px solid #333333;*/
}
.clear {
clear: both;
}
#screensaver {
/*
width:100%;
height:100%;
position:fixed;
margin: 0em;
left: 0;
top: 0;
background-color:#000000;
color: #FFFFFF;
font-size: 59px;
*/
}
#screensaver-info {
position: absolute;
right: 0;
left: 0;
top: 0;
bottom: 0;
margin: auto;
max-width: 100%;
max-height: 100%;
width:600px;
height: 200px;
text-align: center;
line-height: 10px;
color: #333;
}
#screensaver-info span{
visibility: hidden;
}
.wf-active #screensaver-info span{
visibility: inherit;
}
#container {
width: 1900px;
height: 700px;
margin: auto;
top: 0;
left: 0;
right: 0;
bottom: 0;
position:absolute;
/*border: 1px solid #00EEEE;*/
/*border-bottom: 1px solid #333;*/
}
#bottom-border {
position:absolute;
top: 705px;
width: 0px;
height: 1px;
margin: 0;
padding: 0;
border-top: 1px solid #333;
}
.header{
color: #fff;
text-transform:capitalize;
margin-bottom: 10px;
padding: 3px;
border-top: 3px solid #FFCC00;
border-bottom: 1px solid #FFCC00;
white-space: nowrap;
overflow: hidden;
}
.header:before{
content: "";
display: block;
position: absolute;
left: 0px;
top: 33px;
width: 100%;
height: 3px;
background: #FFCC00;
}
.header-other{
border-color: #00EEEE;
}
.header-other:before{
content: "";
display: block;
position: absolute;
left: 0px;
top: 33px;
width: 100%;
height: 3px;
background: #00EEEE;
}
.header-other2{
border-color: #FF9933;
}
.header-other2:before{
content: "";
display: block;
position: absolute;
left: 0px;
top: 33px;
width: 100%;
height: 3px;
background: #FF9933;
}
#globalization{
position: absolute;
top: -10px;
left: -10px;
width: 0px;
overflow: hidden;
background: hsla(0, 0%, 0%, 0.45);
height: 700px;
}
#satbar {
margin-bottom: 20px;
}
.location-slider {
font-size: 8pt;
color: #000;
border-bottom: 2px solid #333;
margin-bottom: 15px;
width: 0px;
height: 34px;
overflow: hidden;
white-space: nowrap;
}
.location-slider ul{
height: 5px;
overflow: hidden;
}
.location-area {
background-color: #ffcc00;
padding: 0 2px;
}
.location-area.other {
background-color: #00eeee;
}
.location-city {
color: #fff;
padding: 0 2px;
}
.location-line{
margin-top: 10px;
border-bottom: 1px solid #00eeee;
}
.location-slider ul {
margin: 0;
padding-left: 15px;
position: relative;
top: -9px;
height: 10px;
}
.location-slider li {
color: #00eeee;
font-size: 10pt;
margin-bottom: -6px;
width: 5px;
float: left;
/*display: inline-block;*/
}
.location-gap {
margin-top: 60px;
}
#logo {
position: absolute;
bottom: 10px;
width: 180px;
height: 100px;
}
#logo-cover-up {
position: absolute;
top: 32px;
height: 58px;
left: 10px;
width: 160px;
background-color: #000;
}
#logo-cover-side-1 {
position: absolute;
top: 90px;
height: 20px;
left: 10px;
width: 160px;
background-color: #000;
}
#logo-cover-side-2 {
position: absolute;
top: 25px;
height: 8px;
left: 10px;
width: 160px;
background-color: #000;
}
#globe{
position:absolute;
width:600px;
height:650px;
left: 190px;
top: 0;
}
#globe-footer{
position:absolute;
width:650px;
height:35px;
top: 665px;
left: 190px;
overflow: hidden;
}
#user-interaction{
position: absolute;
top: 0px;
left: 820px;
width: 0px;
height: 495px;
overflow: hidden;
background: hsla(0, 0%, 0%, 0.45);
}
#user-interaction-container{
width: 600px;
height: 100%;
}
#user-interaction h3{
padding: 4px;
font-size: 3pt;
margin: 0px;
}
#interaction {
padding: 2px 5px;
margin-top:6px;
float: left;
border-right: 1px solid #333;
width: 286px;
height: 445px;
font-size: 10px;
overflow: hidden;
}
.interaction-data {
padding: 1px 5px;
white-space: nowrap;
color: #00eeee;
padding: 0px;
margin: 5px;
}
.interaction-data li {
display: inline-block;
padding: 0px;
padding-right: 10px;
}
.interaction-data :first-child {
color: #fff;
}
.interaction-data :last-child {
color: #fff;
}
#interaction-overlay {
position:absolute;
width: 296px;
height: 200px;
bottom: 0px;
background: -webkit-linear-gradient(transparent, #000); /* For Safari */
background: -o-linear-gradient(transparent, #000); /* For Opera 11.1 to 12.0 */
background: -moz-linear-gradient(transparent, #000); /* For Firefox 3.6 to 15 */
background: linear-gradient(transparent, #000); /* Standard syntax */
}
#cube {
position: absolute;
left: 302px;
width: 290px;
height: 225px;
border-bottom: 1px solid #333;
}
#cube-labels {
position: absolute;
bottom: 5px;
left: 5px;
font-size: 4pt;
padding: 0;
margin: 0;
}
#cube-labels div {
margin: 3px 0 0 0;
padding:0 0 0 3px;
}
#cube-label-1{
border-left: 42px solid #00eeee;
}
#cube-label-2{
border-left: 10px solid #ffcc00;
}
#cube-label-3{
border-left: 25px solid #aaa;
}
#swirls {
position: absolute;
bottom: 0;
height: 225px;
width: 290px;
left: 305px;
}
#growth{
position: absolute;
top: 500px;
left: 820px;
width: 0px;
height: 195px;
overflow: hidden;
background: hsla(0, 0%, 0%, 0.45);
}
#growth-container{
width: 600px;
height: 100%;
}
#ticker {
float: left;
width: 90px;
height: 105px;
margin-top: 10px;
margin-left: 10px;
color: #fff;
}
#ticker-text{
margin: 0px;
padding: 0px;
font-weight:bold;
font-size: 18pt;
line-height: 17pt;
}
#ticker-subtext{
margin: 0px;
vertical-align: top;
padding: 0px;
font-size: 10pt;
display: inline-block;
width: 34px;
}
#ticker-lines{
display: inline-block;
vertical-align: top;
width: 34px;
margin: 0px;
padding: 0px;
overflow: hidden;
margin-top: 2px;
margin-left: -5px;
}
.ticker-line{
margin: 0;
padding: 0;
font-size: 3px;
border-left: 20px solid #00eeee;
background-color: #666;
}
#ticker-value{
font-size: 18pt;
font-weight: bold;
}
#ticker-ytd{
font-size: 8pt;
border-bottom: 1px solid #333;
padding-bottom: 10px;
margin-right: 18px;
margin-bottom: 10px;
}
#ticker-line-1{
border-left: 8px solid #00eeee;
margin-bottom: 2px;
}
#stock-chart
{
position: absolute;
top: 50px;
left: 105px;
width: 496px;
height:105px;
overflow: hidden;
}
#stock-chart canvas {
}
#stock-chart div {
position: absolute;
top: 0px;
left: -2px;
width: 0px;
overflow: hidden;
height: 105px;
border-right: 1px solid #ffcc00;
}
#stock-chart div canvas{
margin-left: 2px;
}
#stock-subcharts
{
position: absolute;
top: 161px;
left: 110px;
border: 0px;
color: #fff;
width: 500px;
height: 28px;
}
.stock-subchart{
display: block;
float: left;
width: 100px;
height: 25px;
overflow: hidden;
}
.stock-subchart-label{
display: inline-block;
font-size: 5pt;
}
.stock-subchart-chart{
display: inline-block;
width: 60px;
height: 25px;
opacity: .3;
}
.stock-subchart-chart:hover{
opacity: 1;
}
.stock-subchart-bar{
float: left;
background-color: #000;
width: 3px;
margin-left: 1px;
height: 20px;
border-bottom: 10px solid #00eeee;
}
.stock-subchart-bar.subchart-5{
height: 20px;
border-bottom: 5px solid #00eeee;
}
.stock-subchart-bar.subchart-10{
height: 15px;
border-bottom: 10px solid #00eeee;
}
.stock-subchart-bar.subchart-15{
height: 10px;
border-bottom: 15px solid #00eeee;
}
.stock-subchart-bar.subchart-20{
height: 5px;
border-bottom: 20px solid #00eeee;
}
.stock-subchart-bar.subchart-yellow{
border-color: #ffcc00;
}
.stock-subchart-bar.subchart-white{
border-color: #aaa;
}
#media{
position: absolute;
top: 0px;
left: 1440px;
width: 0px;
height: 495px;
overflow: hidden;
}
#media-container{
width: 450px;
height: 100%;
}
.media-scanlines{
position:absolute;
width: 380px;
height: 190px;
background: transparent url(scanlines.png) repeat;
z-index: 5;
opacity: .4;
}
#media-top .media-scanlines{
top: 46px;
}
#media-bottom .media-scanlines{
top: 274px;
}
.media-box{
float: left;
width: 380px;
height: 190px;
padding: 3px;
margin: 5px;
border: 1px solid #00eeee;
}
.user-pic{
position: relative;
margin: 3px;
height: 89px;
width: 89px;
float: left;
}
#media-bottom .user-pic{
float: right;
}
.user-pic.larger{
height: 184px;
width: 184px;
}
.user-pic span{
display: box;
position: absolute;
bottom: 0px;
background: hsla(0, 0%, 100%, 0.45);
color: #000;
width: 100%;
font-size: 10px;
text-align: center;
}
.user-pic.larger span{
font-size: 13px;
text-align: center;
}
.media-blinkies{
float: left;
height: 200px;
width: 50px;
color: #fff;
font-size: 4px;
}
.media-blinkies h3{
margin-top: 5px;
padding: 0px;
font-size: 4px;
}
.media-blinkies .bar{
border-left: 20px solid #fff;
margin-top: 2px;
padding-left: 3px;
}
.blinkies-big-number{
display: inline-block;
width: 35px;
font-size: 50px;
text-align: center;
line-height: 40px;
}
.blinkies-big-label{
display: inline-block;
width: 35px;
font-size: 6px;
text-align: center;
}
.blinkies-small-number{
display: inline-block;
width: 10px;
font-size: 20px;
text-align: center;
line-height: 20px;
}
.blinkies-small-label{
display: inline-block;
width: 10px;
font-size: 6px;
text-align: center;
}
.blinky{
display: inline-block;
width: 2px;
height: 3px;
background-color: #fff;
margin: 3px;
}
.blinky.blue{
background-color: #00eeee;
}
.blinky.blank{
background-color: #000;
}
.blinky.yellow{
background-color: #ffcc00;
}
.bar.border-10{
border-left: 20px solid #fff;
}
.bar.border-20{
border-left: 20px solid #fff;
}
.bar.border-25{
border-left: 25px solid #fff;
}
.bar.border-30{
border-left: 30px solid #fff;
}
.bar.border-35{
border-left: 35px solid #fff;
}
.bar.border-40{
border-left: 40px solid #fff;
}
.bar.border-blue{
border-color: #00eeee;
}
.bar.border-yellow{
border-color: #ffcc00;
}
.bar.border-white{
border-color: #fff;
}
.bar.last{
margin-bottom: 10px;
}
.media-info{
padding-top: 3px;
margin:0 5px;
font-size: 6px;
color: #fff;
float: left;
width: 500px;
border-bottom: 1px solid #aaa;
margin-bottom: 10px;
opacity: .4;
}
.media-info span{
padding-right: 30px;
}
#timer{
position: absolute;
top: 500px;
left: 1440px;
width: 0px;
height: 195px;
overflow: hidden;
}
#clock {
float: left;
font-size: 66px;
color: #AAA;
overflow: hidden;
margin-top:8px;
}
/*
#globe-footer-reveal{
position:absolute;
width:600px;
height:35px;
top: 665px;
left: 190px;
}
*/
#fps {
position: absolute;
left: 0;
bottom: 0px;
padding:0 0 3px 3px;
text-align:left;
background-color:#000;
/*width: 180px;*/
width: 0px;
height: 0px;
overflow:hidden;
border-left: 1px solid #aaa;
}
#fpsDescription {
position: absolute;
top: 0px;
left: 10px;
width:100px;
color:#fff;
font-family:Helvetica,Arial,sans-serif;
font-size:7px;
font-weight:bold;
line-height:15px;
}
#fpsText {
position: absolute;
top: 12px;
left: 10px;
width:100px;
color:#FFCC00;
font-family:Helvetica,Arial,sans-serif;
font-size:7px;
font-weight:bold;
line-height:15px;
}
#fpsGraph {
position: absolute;
bottom: 4px;
left: 90px;
width:74px;
height:26px;
background-color:#aaa;
border-bottom: 1px solid #666;
}
#fpsGraph span {
width:1px;
height:26px;
float:right;
background-color:#000;
}
#ms {
position: absolute;
left: 200px;
bottom: 0px;
padding:0 0 3px 3px;
text-align:left;
background-color:#000;
/*width: 200px;*/
/*height: 31px;*/
width: 0px;
height: 0px;
overflow:hidden;
border-left: 1px solid #aaa;
}
#msDescription {
position: absolute;
top: 0px;
left: 10px;
width:100px;
color:#fff;
font-family:Helvetica,Arial,sans-serif;
font-size:7px;
font-weight:bold;
line-height:15px;
}
#msText {
position: absolute;
top: 12px;
left: 10px;
width:100px;
color:#00EEEE;
font-family:Helvetica,Arial,sans-serif;
font-size:7px;
font-weight:bold;
line-height:15px;
}
#msGraph {
position: absolute;
bottom: 4px;
left: 80px;
width:74px;
height:26px;
background-color:#aaa;
order: 1px solid #666;
border-bottom: 1px solid #666;
}
#msGraph span {
width:1px;
height:26px;
float:right;
background-color:#000;
}
#clockbar {
overflow: hidden;
height: 80px;
}
#simpleclock {
float: left;
margin-top: 5px;
margin-left: 5px;
}
#timerbar {
clear: both;
margin:10px 0;
overflow: hidden;
height: 28px;
}
.section-timerbar{
width: 65px;
border: 1px solid #00EEEE;
float:left;
color: #FFFFFF;
font-size: 8px;
padding:4px;
margin-bottom: 10px;
text-align: center;
}
.buffer-timerbar{
margin-left: -5px;
background-color: #000;
padding-left:5px;
width: 110%;
}
.buffer-timerbar > small {
font-size: 8px;
display: block;
color: #aaa;
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<script src="three.min.js"></script>
<!-- <script src="http://threejs.org/build/three.min.js"></script> -->
<script src="tween.min.js"></script>
<script src="moment.min.js"></script>
<script src="moment-timezone.min.js"></script>
<script src="moment-timezone-locations.js"></script>
<script src="stats.js"></script>
<script src="pusher.color.js"></script>
<script src="encomsphere.js"></script>
<script src="http://code.jquery.com/jquery-2.0.3.min.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/jquery-easing/1.3/jquery.easing.min.js"></script>
<script src="scripts-test.js"></script>
<style>
#box{
width: 500px;
height: 300px;
}
</style>
<link href='http://fonts.googleapis.com/css?family=Inconsolata&subset=latin,latin-ext' rel='stylesheet' type='text/css'>
</head>
<body>
<div id="container">
<div id="box">
</div>
</div>
<body>
</html>
This file has been truncated, but you can view the full file.
// three.js - http://github.com/mrdoob/three.js
'use strict';var THREE={REVISION:"63"};self.console=self.console||{info:function(){},log:function(){},debug:function(){},warn:function(){},error:function(){}};String.prototype.trim=String.prototype.trim||function(){return this.replace(/^\s+|\s+$/g,"")};THREE.extend=function(a,b){if(Object.keys)for(var c=Object.keys(b),d=0,e=c.length;d<e;d++){var f=c[d];Object.defineProperty(a,f,Object.getOwnPropertyDescriptor(b,f))}else for(f in c={}.hasOwnProperty,b)c.call(b,f)&&(a[f]=b[f]);return a};
(function(){for(var a=0,b=["ms","moz","webkit","o"],c=0;c<b.length&&!self.requestAnimationFrame;++c)self.requestAnimationFrame=self[b[c]+"RequestAnimationFrame"],self.cancelAnimationFrame=self[b[c]+"CancelAnimationFrame"]||self[b[c]+"CancelRequestAnimationFrame"];void 0===self.requestAnimationFrame&&void 0!==self.setTimeout&&(self.requestAnimationFrame=function(b){var c=Date.now(),f=Math.max(0,16-(c-a)),h=self.setTimeout(function(){b(c+f)},f);a=c+f;return h});void 0===self.cancelAnimationFrame&&void 0!==
self.clearTimeout&&(self.cancelAnimationFrame=function(a){self.clearTimeout(a)})})();THREE.CullFaceNone=0;THREE.CullFaceBack=1;THREE.CullFaceFront=2;THREE.CullFaceFrontBack=3;THREE.FrontFaceDirectionCW=0;THREE.FrontFaceDirectionCCW=1;THREE.BasicShadowMap=0;THREE.PCFShadowMap=1;THREE.PCFSoftShadowMap=2;THREE.FrontSide=0;THREE.BackSide=1;THREE.DoubleSide=2;THREE.NoShading=0;THREE.FlatShading=1;THREE.SmoothShading=2;THREE.NoColors=0;THREE.FaceColors=1;THREE.VertexColors=2;THREE.NoBlending=0;
THREE.NormalBlending=1;THREE.AdditiveBlending=2;THREE.SubtractiveBlending=3;THREE.MultiplyBlending=4;THREE.CustomBlending=5;THREE.AddEquation=100;THREE.SubtractEquation=101;THREE.ReverseSubtractEquation=102;THREE.ZeroFactor=200;THREE.OneFactor=201;THREE.SrcColorFactor=202;THREE.OneMinusSrcColorFactor=203;THREE.SrcAlphaFactor=204;THREE.OneMinusSrcAlphaFactor=205;THREE.DstAlphaFactor=206;THREE.OneMinusDstAlphaFactor=207;THREE.DstColorFactor=208;THREE.OneMinusDstColorFactor=209;
THREE.SrcAlphaSaturateFactor=210;THREE.MultiplyOperation=0;THREE.MixOperation=1;THREE.AddOperation=2;THREE.UVMapping=function(){};THREE.CubeReflectionMapping=function(){};THREE.CubeRefractionMapping=function(){};THREE.SphericalReflectionMapping=function(){};THREE.SphericalRefractionMapping=function(){};THREE.RepeatWrapping=1E3;THREE.ClampToEdgeWrapping=1001;THREE.MirroredRepeatWrapping=1002;THREE.NearestFilter=1003;THREE.NearestMipMapNearestFilter=1004;THREE.NearestMipMapLinearFilter=1005;
THREE.LinearFilter=1006;THREE.LinearMipMapNearestFilter=1007;THREE.LinearMipMapLinearFilter=1008;THREE.UnsignedByteType=1009;THREE.ByteType=1010;THREE.ShortType=1011;THREE.UnsignedShortType=1012;THREE.IntType=1013;THREE.UnsignedIntType=1014;THREE.FloatType=1015;THREE.UnsignedShort4444Type=1016;THREE.UnsignedShort5551Type=1017;THREE.UnsignedShort565Type=1018;THREE.AlphaFormat=1019;THREE.RGBFormat=1020;THREE.RGBAFormat=1021;THREE.LuminanceFormat=1022;THREE.LuminanceAlphaFormat=1023;
THREE.RGB_S3TC_DXT1_Format=2001;THREE.RGBA_S3TC_DXT1_Format=2002;THREE.RGBA_S3TC_DXT3_Format=2003;THREE.RGBA_S3TC_DXT5_Format=2004;THREE.Color=function(a){void 0!==a&&this.set(a);return this};
THREE.Color.prototype={constructor:THREE.Color,r:1,g:1,b:1,set:function(a){a instanceof THREE.Color?this.copy(a):"number"===typeof a?this.setHex(a):"string"===typeof a&&this.setStyle(a);return this},setHex:function(a){a=Math.floor(a);this.r=(a>>16&255)/255;this.g=(a>>8&255)/255;this.b=(a&255)/255;return this},setRGB:function(a,b,c){this.r=a;this.g=b;this.b=c;return this},setHSL:function(a,b,c){if(0===b)this.r=this.g=this.b=c;else{var d=function(a,b,c){0>c&&(c+=1);1<c&&(c-=1);return c<1/6?a+6*(b-a)*
c:0.5>c?b:c<2/3?a+6*(b-a)*(2/3-c):a},b=0.5>=c?c*(1+b):c+b-c*b,c=2*c-b;this.r=d(c,b,a+1/3);this.g=d(c,b,a);this.b=d(c,b,a-1/3)}return this},setStyle:function(a){if(/^rgb\((\d+), ?(\d+), ?(\d+)\)$/i.test(a))return a=/^rgb\((\d+), ?(\d+), ?(\d+)\)$/i.exec(a),this.r=Math.min(255,parseInt(a[1],10))/255,this.g=Math.min(255,parseInt(a[2],10))/255,this.b=Math.min(255,parseInt(a[3],10))/255,this;if(/^rgb\((\d+)\%, ?(\d+)\%, ?(\d+)\%\)$/i.test(a))return a=/^rgb\((\d+)\%, ?(\d+)\%, ?(\d+)\%\)$/i.exec(a),this.r=
Math.min(100,parseInt(a[1],10))/100,this.g=Math.min(100,parseInt(a[2],10))/100,this.b=Math.min(100,parseInt(a[3],10))/100,this;if(/^\#([0-9a-f]{6})$/i.test(a))return a=/^\#([0-9a-f]{6})$/i.exec(a),this.setHex(parseInt(a[1],16)),this;if(/^\#([0-9a-f])([0-9a-f])([0-9a-f])$/i.test(a))return a=/^\#([0-9a-f])([0-9a-f])([0-9a-f])$/i.exec(a),this.setHex(parseInt(a[1]+a[1]+a[2]+a[2]+a[3]+a[3],16)),this;if(/^(\w+)$/i.test(a))return this.setHex(THREE.ColorKeywords[a]),this},copy:function(a){this.r=a.r;this.g=
a.g;this.b=a.b;return this},copyGammaToLinear:function(a){this.r=a.r*a.r;this.g=a.g*a.g;this.b=a.b*a.b;return this},copyLinearToGamma:function(a){this.r=Math.sqrt(a.r);this.g=Math.sqrt(a.g);this.b=Math.sqrt(a.b);return this},convertGammaToLinear:function(){var a=this.r,b=this.g,c=this.b;this.r=a*a;this.g=b*b;this.b=c*c;return this},convertLinearToGamma:function(){this.r=Math.sqrt(this.r);this.g=Math.sqrt(this.g);this.b=Math.sqrt(this.b);return 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(){var a={h:0,s:0,l:0};return function(){var b=this.r,c=this.g,d=this.b,e=Math.max(b,c,d),f=Math.min(b,c,d),h,g=(f+e)/2;if(f===e)f=h=0;else{var i=e-f,f=0.5>=g?i/(e+f):i/(2-e-f);switch(e){case b:h=(c-d)/i+(c<d?6:0);break;case c:h=(d-b)/i+2;break;case d:h=(b-c)/i+4}h/=6}a.h=h;a.s=f;a.l=g;return a}}(),getStyle:function(){return"rgb("+(255*this.r|0)+","+(255*this.g|0)+","+(255*this.b|0)+")"},
offsetHSL:function(a,b,c){var d=this.getHSL();d.h+=a;d.s+=b;d.l+=c;this.setHSL(d.h,d.s,d.l);return this},add:function(a){this.r+=a.r;this.g+=a.g;this.b+=a.b;return this},addColors:function(a,b){this.r=a.r+b.r;this.g=a.g+b.g;this.b=a.b+b.b;return this},addScalar:function(a){this.r+=a;this.g+=a;this.b+=a;return this},multiply:function(a){this.r*=a.r;this.g*=a.g;this.b*=a.b;return this},multiplyScalar:function(a){this.r*=a;this.g*=a;this.b*=a;return this},lerp:function(a,b){this.r+=(a.r-this.r)*b;this.g+=
(a.g-this.g)*b;this.b+=(a.b-this.b)*b;return this},equals:function(a){return a.r===this.r&&a.g===this.g&&a.b===this.b},fromArray:function(a){this.r=a[0];this.g=a[1];this.b=a[2];return this},toArray:function(){return[this.r,this.g,this.b]},clone:function(){return(new THREE.Color).setRGB(this.r,this.g,this.b)}};
THREE.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};THREE.Quaternion=function(a,b,c,d){this._x=a||0;this._y=b||0;this._z=c||0;this._w=void 0!==d?d:1};
THREE.Quaternion.prototype={constructor:THREE.Quaternion,_x:0,_y:0,_z:0,_w:0,_euler:void 0,_updateEuler:function(){void 0!==this._euler&&this._euler.setFromQuaternion(this,void 0,!1)},get x(){return this._x},set x(a){this._x=a;this._updateEuler()},get y(){return this._y},set y(a){this._y=a;this._updateEuler()},get z(){return this._z},set z(a){this._z=a;this._updateEuler()},get w(){return this._w},set w(a){this._w=a;this._updateEuler()},set:function(a,b,c,d){this._x=a;this._y=b;this._z=c;this._w=d;
this._updateEuler();return this},copy:function(a){this._x=a._x;this._y=a._y;this._z=a._z;this._w=a._w;this._updateEuler();return this},setFromEuler:function(a,b){if(!1===a instanceof THREE.Euler)throw Error("ERROR: Quaternion's .setFromEuler() now expects a Euler rotation rather than a Vector3 and order. Please update your code.");var c=Math.cos(a._x/2),d=Math.cos(a._y/2),e=Math.cos(a._z/2),f=Math.sin(a._x/2),h=Math.sin(a._y/2),g=Math.sin(a._z/2);"XYZ"===a.order?(this._x=f*d*e+c*h*g,this._y=c*h*
e-f*d*g,this._z=c*d*g+f*h*e,this._w=c*d*e-f*h*g):"YXZ"===a.order?(this._x=f*d*e+c*h*g,this._y=c*h*e-f*d*g,this._z=c*d*g-f*h*e,this._w=c*d*e+f*h*g):"ZXY"===a.order?(this._x=f*d*e-c*h*g,this._y=c*h*e+f*d*g,this._z=c*d*g+f*h*e,this._w=c*d*e-f*h*g):"ZYX"===a.order?(this._x=f*d*e-c*h*g,this._y=c*h*e+f*d*g,this._z=c*d*g-f*h*e,this._w=c*d*e+f*h*g):"YZX"===a.order?(this._x=f*d*e+c*h*g,this._y=c*h*e+f*d*g,this._z=c*d*g-f*h*e,this._w=c*d*e-f*h*g):"XZY"===a.order&&(this._x=f*d*e-c*h*g,this._y=c*h*e-f*d*g,this._z=
c*d*g+f*h*e,this._w=c*d*e+f*h*g);!1!==b&&this._updateEuler();return this},setFromAxisAngle:function(a,b){var c=b/2,d=Math.sin(c);this._x=a.x*d;this._y=a.y*d;this._z=a.z*d;this._w=Math.cos(c);this._updateEuler();return this},setFromRotationMatrix:function(a){var b=a.elements,c=b[0],a=b[4],d=b[8],e=b[1],f=b[5],h=b[9],g=b[2],i=b[6],b=b[10],k=c+f+b;0<k?(c=0.5/Math.sqrt(k+1),this._w=0.25/c,this._x=(i-h)*c,this._y=(d-g)*c,this._z=(e-a)*c):c>f&&c>b?(c=2*Math.sqrt(1+c-f-b),this._w=(i-h)/c,this._x=0.25*c,
this._y=(a+e)/c,this._z=(d+g)/c):f>b?(c=2*Math.sqrt(1+f-c-b),this._w=(d-g)/c,this._x=(a+e)/c,this._y=0.25*c,this._z=(h+i)/c):(c=2*Math.sqrt(1+b-c-f),this._w=(e-a)/c,this._x=(d+g)/c,this._y=(h+i)/c,this._z=0.25*c);this._updateEuler();return this},inverse:function(){this.conjugate().normalize();return this},conjugate:function(){this._x*=-1;this._y*=-1;this._z*=-1;this._updateEuler();return this},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 a=this.length();0===a?(this._z=this._y=this._x=0,this._w=1):(a=1/a,this._x*=a,this._y*=a,this._z*=a,this._w*=a);return this},multiply:function(a,b){return void 0!==b?(console.warn("DEPRECATED: Quaternion's .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(a,b)):this.multiplyQuaternions(this,a)},multiplyQuaternions:function(a,b){var c=a._x,d=a._y,e=a._z,f=
a._w,h=b._x,g=b._y,i=b._z,k=b._w;this._x=c*k+f*h+d*i-e*g;this._y=d*k+f*g+e*h-c*i;this._z=e*k+f*i+c*g-d*h;this._w=f*k-c*h-d*g-e*i;this._updateEuler();return this},multiplyVector3:function(a){console.warn("DEPRECATED: Quaternion's .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead.");return a.applyQuaternion(this)},slerp:function(a,b){var c=this._x,d=this._y,e=this._z,f=this._w,h=f*a._w+c*a._x+d*a._y+e*a._z;0>h?(this._w=-a._w,this._x=-a._x,this._y=-a._y,this._z=
-a._z,h=-h):this.copy(a);if(1<=h)return this._w=f,this._x=c,this._y=d,this._z=e,this;var g=Math.acos(h),i=Math.sqrt(1-h*h);if(0.0010>Math.abs(i))return this._w=0.5*(f+this._w),this._x=0.5*(c+this._x),this._y=0.5*(d+this._y),this._z=0.5*(e+this._z),this;h=Math.sin((1-b)*g)/i;g=Math.sin(b*g)/i;this._w=f*h+this._w*g;this._x=c*h+this._x*g;this._y=d*h+this._y*g;this._z=e*h+this._z*g;this._updateEuler();return this},equals:function(a){return a._x===this._x&&a._y===this._y&&a._z===this._z&&a._w===this._w},
fromArray:function(a){this._x=a[0];this._y=a[1];this._z=a[2];this._w=a[3];this._updateEuler();return this},toArray:function(){return[this._x,this._y,this._z,this._w]},clone:function(){return new THREE.Quaternion(this._x,this._y,this._z,this._w)}};THREE.Quaternion.slerp=function(a,b,c,d){return c.copy(a).slerp(b,d)};THREE.Vector2=function(a,b){this.x=a||0;this.y=b||0};
THREE.Vector2.prototype={constructor:THREE.Vector2,set:function(a,b){this.x=a;this.y=b;return this},setX:function(a){this.x=a;return this},setY:function(a){this.y=a;return this},setComponent:function(a,b){switch(a){case 0:this.x=b;break;case 1:this.y=b;break;default:throw Error("index is out of range: "+a);}},getComponent:function(a){switch(a){case 0:return this.x;case 1:return this.y;default:throw Error("index is out of range: "+a);}},copy:function(a){this.x=a.x;this.y=a.y;return this},add:function(a,
b){if(void 0!==b)return console.warn("DEPRECATED: Vector2's .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(a,b);this.x+=a.x;this.y+=a.y;return this},addVectors:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;return this},addScalar:function(a){this.x+=a;this.y+=a;return this},sub:function(a,b){if(void 0!==b)return console.warn("DEPRECATED: Vector2's .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(a,b);this.x-=a.x;this.y-=
a.y;return this},subVectors:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;return this},divideScalar:function(a){0!==a?(a=1/a,this.x*=a,this.y*=a):this.y=this.x=0;return this},min:function(a){this.x>a.x&&(this.x=a.x);this.y>a.y&&(this.y=a.y);return this},max:function(a){this.x<a.x&&(this.x=a.x);this.y<a.y&&(this.y=a.y);return this},clamp:function(a,b){this.x<a.x?this.x=a.x:this.x>b.x&&(this.x=b.x);this.y<a.y?this.y=a.y:this.y>b.y&&(this.y=b.y);
return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.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(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(a){var b=this.x-a.x,a=this.y-a.y;return b*b+a*a},setLength:function(a){var b=this.length();0!==b&&a!==b&&this.multiplyScalar(a/
b);return this},lerp:function(a,b){this.x+=(a.x-this.x)*b;this.y+=(a.y-this.y)*b;return this},equals:function(a){return a.x===this.x&&a.y===this.y},fromArray:function(a){this.x=a[0];this.y=a[1];return this},toArray:function(){return[this.x,this.y]},clone:function(){return new THREE.Vector2(this.x,this.y)}};THREE.Vector3=function(a,b,c){this.x=a||0;this.y=b||0;this.z=c||0};
THREE.Vector3.prototype={constructor:THREE.Vector3,set:function(a,b,c){this.x=a;this.y=b;this.z=c;return this},setX:function(a){this.x=a;return this},setY:function(a){this.y=a;return this},setZ:function(a){this.z=a;return this},setComponent:function(a,b){switch(a){case 0:this.x=b;break;case 1:this.y=b;break;case 2:this.z=b;break;default:throw Error("index is out of range: "+a);}},getComponent:function(a){switch(a){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw Error("index is out of range: "+
a);}},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;return this},add:function(a,b){if(void 0!==b)return console.warn("DEPRECATED: Vector3's .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(a,b);this.x+=a.x;this.y+=a.y;this.z+=a.z;return this},addScalar:function(a){this.x+=a;this.y+=a;this.z+=a;return this},addVectors:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;return this},sub:function(a,b){if(void 0!==b)return console.warn("DEPRECATED: Vector3's .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),
this.subVectors(a,b);this.x-=a.x;this.y-=a.y;this.z-=a.z;return this},subVectors:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;return this},multiply:function(a,b){if(void 0!==b)return console.warn("DEPRECATED: Vector3's .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(a,b);this.x*=a.x;this.y*=a.y;this.z*=a.z;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;return this},multiplyVectors:function(a,b){this.x=a.x*
b.x;this.y=a.y*b.y;this.z=a.z*b.z;return this},applyMatrix3:function(a){var b=this.x,c=this.y,d=this.z,a=a.elements;this.x=a[0]*b+a[3]*c+a[6]*d;this.y=a[1]*b+a[4]*c+a[7]*d;this.z=a[2]*b+a[5]*c+a[8]*d;return this},applyMatrix4:function(a){var b=this.x,c=this.y,d=this.z,a=a.elements;this.x=a[0]*b+a[4]*c+a[8]*d+a[12];this.y=a[1]*b+a[5]*c+a[9]*d+a[13];this.z=a[2]*b+a[6]*c+a[10]*d+a[14];return this},applyProjection:function(a){var b=this.x,c=this.y,d=this.z,a=a.elements,e=1/(a[3]*b+a[7]*c+a[11]*d+a[15]);
this.x=(a[0]*b+a[4]*c+a[8]*d+a[12])*e;this.y=(a[1]*b+a[5]*c+a[9]*d+a[13])*e;this.z=(a[2]*b+a[6]*c+a[10]*d+a[14])*e;return this},applyQuaternion:function(a){var b=this.x,c=this.y,d=this.z,e=a.x,f=a.y,h=a.z,a=a.w,g=a*b+f*d-h*c,i=a*c+h*b-e*d,k=a*d+e*c-f*b,b=-e*b-f*c-h*d;this.x=g*a+b*-e+i*-h-k*-f;this.y=i*a+b*-f+k*-e-g*-h;this.z=k*a+b*-h+g*-f-i*-e;return this},transformDirection:function(a){var b=this.x,c=this.y,d=this.z,a=a.elements;this.x=a[0]*b+a[4]*c+a[8]*d;this.y=a[1]*b+a[5]*c+a[9]*d;this.z=a[2]*
b+a[6]*c+a[10]*d;this.normalize();return this},divide:function(a){this.x/=a.x;this.y/=a.y;this.z/=a.z;return this},divideScalar:function(a){0!==a?(a=1/a,this.x*=a,this.y*=a,this.z*=a):this.z=this.y=this.x=0;return this},min:function(a){this.x>a.x&&(this.x=a.x);this.y>a.y&&(this.y=a.y);this.z>a.z&&(this.z=a.z);return this},max:function(a){this.x<a.x&&(this.x=a.x);this.y<a.y&&(this.y=a.y);this.z<a.z&&(this.z=a.z);return this},clamp:function(a,b){this.x<a.x?this.x=a.x:this.x>b.x&&(this.x=b.x);this.y<
a.y?this.y=a.y:this.y>b.y&&(this.y=b.y);this.z<a.z?this.z=a.z:this.z>b.z&&(this.z=b.z);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.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(a){var b=this.length();0!==b&&a!==b&&this.multiplyScalar(a/b);return this},lerp:function(a,b){this.x+=(a.x-this.x)*b;this.y+=(a.y-this.y)*b;this.z+=(a.z-this.z)*b;return this},cross:function(a,b){if(void 0!==b)return console.warn("DEPRECATED: Vector3's .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(a,b);var c=this.x,d=this.y,e=this.z;this.x=d*a.z-e*a.y;this.y=e*a.x-c*a.z;this.z=c*a.y-d*a.x;return this},crossVectors:function(a,b){var c=
a.x,d=a.y,e=a.z,f=b.x,h=b.y,g=b.z;this.x=d*g-e*h;this.y=e*f-c*g;this.z=c*h-d*f;return this},angleTo:function(a){a=this.dot(a)/(this.length()*a.length());return Math.acos(THREE.Math.clamp(a,-1,1))},distanceTo:function(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(a){var b=this.x-a.x,c=this.y-a.y,a=this.z-a.z;return b*b+c*c+a*a},setEulerFromRotationMatrix:function(){console.error("REMOVED: Vector3's setEulerFromRotationMatrix has been removed in favor of Euler.setFromRotationMatrix(), please update your code.")},
setEulerFromQuaternion:function(){console.error("REMOVED: Vector3's setEulerFromQuaternion: has been removed in favor of Euler.setFromQuaternion(), please update your code.")},getPositionFromMatrix:function(a){this.x=a.elements[12];this.y=a.elements[13];this.z=a.elements[14];return this},getScaleFromMatrix:function(a){var b=this.set(a.elements[0],a.elements[1],a.elements[2]).length(),c=this.set(a.elements[4],a.elements[5],a.elements[6]).length(),a=this.set(a.elements[8],a.elements[9],a.elements[10]).length();
this.x=b;this.y=c;this.z=a;return this},getColumnFromMatrix:function(a,b){var c=4*a,d=b.elements;this.x=d[c];this.y=d[c+1];this.z=d[c+2];return this},equals:function(a){return a.x===this.x&&a.y===this.y&&a.z===this.z},fromArray:function(a){this.x=a[0];this.y=a[1];this.z=a[2];return this},toArray:function(){return[this.x,this.y,this.z]},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)}};
THREE.extend(THREE.Vector3.prototype,{applyEuler:function(){var a=new THREE.Quaternion;return function(b){!1===b instanceof THREE.Euler&&console.error("ERROR: Vector3's .applyEuler() now expects a Euler rotation rather than a Vector3 and order. Please update your code.");this.applyQuaternion(a.setFromEuler(b));return this}}(),applyAxisAngle:function(){var a=new THREE.Quaternion;return function(b,c){this.applyQuaternion(a.setFromAxisAngle(b,c));return this}}(),projectOnVector:function(){var a=new THREE.Vector3;
return function(b){a.copy(b).normalize();b=this.dot(a);return this.copy(a).multiplyScalar(b)}}(),projectOnPlane:function(){var a=new THREE.Vector3;return function(b){a.copy(this).projectOnVector(b);return this.sub(a)}}(),reflect:function(){var a=new THREE.Vector3;return function(b){a.copy(this).projectOnVector(b).multiplyScalar(2);return this.subVectors(a,this)}}()});THREE.Vector4=function(a,b,c,d){this.x=a||0;this.y=b||0;this.z=c||0;this.w=void 0!==d?d:1};
THREE.Vector4.prototype={constructor:THREE.Vector4,set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},setX:function(a){this.x=a;return this},setY:function(a){this.y=a;return this},setZ:function(a){this.z=a;return this},setW:function(a){this.w=a;return this},setComponent:function(a,b){switch(a){case 0:this.x=b;break;case 1:this.y=b;break;case 2:this.z=b;break;case 3:this.w=b;break;default:throw Error("index is out of range: "+a);}},getComponent:function(a){switch(a){case 0:return this.x;
case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw Error("index is out of range: "+a);}},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=void 0!==a.w?a.w:1;return this},add:function(a,b){if(void 0!==b)return console.warn("DEPRECATED: Vector4's .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(a,b);this.x+=a.x;this.y+=a.y;this.z+=a.z;this.w+=a.w;return this},addScalar:function(a){this.x+=a;this.y+=a;this.z+=a;this.w+=a;return this},
addVectors:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;this.w=a.w+b.w;return this},sub:function(a,b){if(void 0!==b)return console.warn("DEPRECATED: Vector4's .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(a,b);this.x-=a.x;this.y-=a.y;this.z-=a.z;this.w-=a.w;return this},subVectors:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;this.w=a.w-b.w;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;this.w*=a;return this},
applyMatrix4:function(a){var b=this.x,c=this.y,d=this.z,e=this.w,a=a.elements;this.x=a[0]*b+a[4]*c+a[8]*d+a[12]*e;this.y=a[1]*b+a[5]*c+a[9]*d+a[13]*e;this.z=a[2]*b+a[6]*c+a[10]*d+a[14]*e;this.w=a[3]*b+a[7]*c+a[11]*d+a[15]*e;return this},divideScalar:function(a){0!==a?(a=1/a,this.x*=a,this.y*=a,this.z*=a,this.w*=a):(this.z=this.y=this.x=0,this.w=1);return this},setAxisAngleFromQuaternion:function(a){this.w=2*Math.acos(a.w);var b=Math.sqrt(1-a.w*a.w);1E-4>b?(this.x=1,this.z=this.y=0):(this.x=a.x/b,
this.y=a.y/b,this.z=a.z/b);return this},setAxisAngleFromRotationMatrix:function(a){var b,c,d,a=a.elements,e=a[0];d=a[4];var f=a[8],h=a[1],g=a[5],i=a[9];c=a[2];b=a[6];var k=a[10];if(0.01>Math.abs(d-h)&&0.01>Math.abs(f-c)&&0.01>Math.abs(i-b)){if(0.1>Math.abs(d+h)&&0.1>Math.abs(f+c)&&0.1>Math.abs(i+b)&&0.1>Math.abs(e+g+k-3))return this.set(1,0,0,0),this;a=Math.PI;e=(e+1)/2;g=(g+1)/2;k=(k+1)/2;d=(d+h)/4;f=(f+c)/4;i=(i+b)/4;e>g&&e>k?0.01>e?(b=0,d=c=0.707106781):(b=Math.sqrt(e),c=d/b,d=f/b):g>k?0.01>g?
(b=0.707106781,c=0,d=0.707106781):(c=Math.sqrt(g),b=d/c,d=i/c):0.01>k?(c=b=0.707106781,d=0):(d=Math.sqrt(k),b=f/d,c=i/d);this.set(b,c,d,a);return this}a=Math.sqrt((b-i)*(b-i)+(f-c)*(f-c)+(h-d)*(h-d));0.0010>Math.abs(a)&&(a=1);this.x=(b-i)/a;this.y=(f-c)/a;this.z=(h-d)/a;this.w=Math.acos((e+g+k-1)/2);return this},min:function(a){this.x>a.x&&(this.x=a.x);this.y>a.y&&(this.y=a.y);this.z>a.z&&(this.z=a.z);this.w>a.w&&(this.w=a.w);return this},max:function(a){this.x<a.x&&(this.x=a.x);this.y<a.y&&(this.y=
a.y);this.z<a.z&&(this.z=a.z);this.w<a.w&&(this.w=a.w);return this},clamp:function(a,b){this.x<a.x?this.x=a.x:this.x>b.x&&(this.x=b.x);this.y<a.y?this.y=a.y:this.y>b.y&&(this.y=b.y);this.z<a.z?this.z=a.z:this.z>b.z&&(this.z=b.z);this.w<a.w?this.w=a.w:this.w>b.w&&(this.w=b.w);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z+this.w*a.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(a){var b=this.length();0!==b&&a!==b&&this.multiplyScalar(a/b);return this},lerp:function(a,b){this.x+=(a.x-this.x)*b;this.y+=(a.y-this.y)*b;this.z+=(a.z-this.z)*b;this.w+=(a.w-this.w)*b;return this},equals:function(a){return a.x===this.x&&a.y===this.y&&a.z===this.z&&
a.w===this.w},fromArray:function(a){this.x=a[0];this.y=a[1];this.z=a[2];this.w=a[3];return this},toArray:function(){return[this.x,this.y,this.z,this.w]},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)}};THREE.Euler=function(a,b,c,d){this._x=a||0;this._y=b||0;this._z=c||0;this._order=d||THREE.Euler.DefaultOrder};THREE.Euler.RotationOrders="XYZ YZX ZXY XZY YXZ ZYX".split(" ");THREE.Euler.DefaultOrder="XYZ";
THREE.Euler.prototype={constructor:THREE.Euler,_x:0,_y:0,_z:0,_order:THREE.Euler.DefaultOrder,_quaternion:void 0,_updateQuaternion:function(){void 0!==this._quaternion&&this._quaternion.setFromEuler(this,!1)},get x(){return this._x},set x(a){this._x=a;this._updateQuaternion()},get y(){return this._y},set y(a){this._y=a;this._updateQuaternion()},get z(){return this._z},set z(a){this._z=a;this._updateQuaternion()},get order(){return this._order},set order(a){this._order=a;this._updateQuaternion()},
set:function(a,b,c,d){this._x=a;this._y=b;this._z=c;this._order=d||this._order;this._updateQuaternion();return this},copy:function(a){this._x=a._x;this._y=a._y;this._z=a._z;this._order=a._order;this._updateQuaternion();return this},setFromRotationMatrix:function(a,b){function c(a){return Math.min(Math.max(a,-1),1)}var d=a.elements,e=d[0],f=d[4],h=d[8],g=d[1],i=d[5],k=d[9],m=d[2],l=d[6],d=d[10],b=b||this._order;"XYZ"===b?(this._y=Math.asin(c(h)),0.99999>Math.abs(h)?(this._x=Math.atan2(-k,d),this._z=
Math.atan2(-f,e)):(this._x=Math.atan2(l,i),this._z=0)):"YXZ"===b?(this._x=Math.asin(-c(k)),0.99999>Math.abs(k)?(this._y=Math.atan2(h,d),this._z=Math.atan2(g,i)):(this._y=Math.atan2(-m,e),this._z=0)):"ZXY"===b?(this._x=Math.asin(c(l)),0.99999>Math.abs(l)?(this._y=Math.atan2(-m,d),this._z=Math.atan2(-f,i)):(this._y=0,this._z=Math.atan2(g,e))):"ZYX"===b?(this._y=Math.asin(-c(m)),0.99999>Math.abs(m)?(this._x=Math.atan2(l,d),this._z=Math.atan2(g,e)):(this._x=0,this._z=Math.atan2(-f,i))):"YZX"===b?(this._z=
Math.asin(c(g)),0.99999>Math.abs(g)?(this._x=Math.atan2(-k,i),this._y=Math.atan2(-m,e)):(this._x=0,this._y=Math.atan2(h,d))):"XZY"===b?(this._z=Math.asin(-c(f)),0.99999>Math.abs(f)?(this._x=Math.atan2(l,i),this._y=Math.atan2(h,e)):(this._x=Math.atan2(-k,d),this._y=0)):console.warn("WARNING: Euler.setFromRotationMatrix() given unsupported order: "+b);this._order=b;this._updateQuaternion();return this},setFromQuaternion:function(a,b,c){function d(a){return Math.min(Math.max(a,-1),1)}var e=a.x*a.x,f=
a.y*a.y,h=a.z*a.z,g=a.w*a.w,b=b||this._order;"XYZ"===b?(this._x=Math.atan2(2*(a.x*a.w-a.y*a.z),g-e-f+h),this._y=Math.asin(d(2*(a.x*a.z+a.y*a.w))),this._z=Math.atan2(2*(a.z*a.w-a.x*a.y),g+e-f-h)):"YXZ"===b?(this._x=Math.asin(d(2*(a.x*a.w-a.y*a.z))),this._y=Math.atan2(2*(a.x*a.z+a.y*a.w),g-e-f+h),this._z=Math.atan2(2*(a.x*a.y+a.z*a.w),g-e+f-h)):"ZXY"===b?(this._x=Math.asin(d(2*(a.x*a.w+a.y*a.z))),this._y=Math.atan2(2*(a.y*a.w-a.z*a.x),g-e-f+h),this._z=Math.atan2(2*(a.z*a.w-a.x*a.y),g-e+f-h)):"ZYX"===
b?(this._x=Math.atan2(2*(a.x*a.w+a.z*a.y),g-e-f+h),this._y=Math.asin(d(2*(a.y*a.w-a.x*a.z))),this._z=Math.atan2(2*(a.x*a.y+a.z*a.w),g+e-f-h)):"YZX"===b?(this._x=Math.atan2(2*(a.x*a.w-a.z*a.y),g-e+f-h),this._y=Math.atan2(2*(a.y*a.w-a.x*a.z),g+e-f-h),this._z=Math.asin(d(2*(a.x*a.y+a.z*a.w)))):"XZY"===b?(this._x=Math.atan2(2*(a.x*a.w+a.y*a.z),g-e+f-h),this._y=Math.atan2(2*(a.x*a.z+a.y*a.w),g+e-f-h),this._z=Math.asin(d(2*(a.z*a.w-a.x*a.y)))):console.warn("WARNING: Euler.setFromQuaternion() given unsupported order: "+
b);this._order=b;!1!==c&&this._updateQuaternion();return this},reorder:function(){var a=new THREE.Quaternion;return function(b){a.setFromEuler(this);this.setFromQuaternion(a,b)}}(),fromArray:function(a){this._x=a[0];this._y=a[1];this._z=a[2];void 0!==a[3]&&(this._order=a[3]);this._updateQuaternion();return this},toArray:function(){return[this._x,this._y,this._z,this._order]},equals:function(a){return a._x===this._x&&a._y===this._y&&a._z===this._z&&a._order===this._order},clone:function(){return new THREE.Euler(this._x,
this._y,this._z,this._order)}};THREE.Line3=function(a,b){this.start=void 0!==a?a:new THREE.Vector3;this.end=void 0!==b?b:new THREE.Vector3};
THREE.Line3.prototype={constructor:THREE.Line3,set:function(a,b){this.start.copy(a);this.end.copy(b);return this},copy:function(a){this.start.copy(a.start);this.end.copy(a.end);return this},center:function(a){return(a||new THREE.Vector3).addVectors(this.start,this.end).multiplyScalar(0.5)},delta:function(a){return(a||new THREE.Vector3).subVectors(this.end,this.start)},distanceSq:function(){return this.start.distanceToSquared(this.end)},distance:function(){return this.start.distanceTo(this.end)},at:function(a,
b){var c=b||new THREE.Vector3;return this.delta(c).multiplyScalar(a).add(this.start)},closestPointToPointParameter:function(){var a=new THREE.Vector3,b=new THREE.Vector3;return function(c,d){a.subVectors(c,this.start);b.subVectors(this.end,this.start);var e=b.dot(b),e=b.dot(a)/e;d&&(e=THREE.Math.clamp(e,0,1));return e}}(),closestPointToPoint:function(a,b,c){a=this.closestPointToPointParameter(a,b);c=c||new THREE.Vector3;return this.delta(c).multiplyScalar(a).add(this.start)},applyMatrix4:function(a){this.start.applyMatrix4(a);
this.end.applyMatrix4(a);return this},equals:function(a){return a.start.equals(this.start)&&a.end.equals(this.end)},clone:function(){return(new THREE.Line3).copy(this)}};THREE.Box2=function(a,b){this.min=void 0!==a?a:new THREE.Vector2(Infinity,Infinity);this.max=void 0!==b?b:new THREE.Vector2(-Infinity,-Infinity)};
THREE.Box2.prototype={constructor:THREE.Box2,set:function(a,b){this.min.copy(a);this.max.copy(b);return this},setFromPoints:function(a){if(0<a.length){var b=a[0];this.min.copy(b);this.max.copy(b);for(var c=1,d=a.length;c<d;c++)b=a[c],b.x<this.min.x?this.min.x=b.x:b.x>this.max.x&&(this.max.x=b.x),b.y<this.min.y?this.min.y=b.y:b.y>this.max.y&&(this.max.y=b.y)}else this.makeEmpty();return this},setFromCenterAndSize:function(){var a=new THREE.Vector2;return function(b,c){var d=a.copy(c).multiplyScalar(0.5);
this.min.copy(b).sub(d);this.max.copy(b).add(d);return this}}(),copy:function(a){this.min.copy(a.min);this.max.copy(a.max);return this},makeEmpty:function(){this.min.x=this.min.y=Infinity;this.max.x=this.max.y=-Infinity;return this},empty:function(){return this.max.x<this.min.x||this.max.y<this.min.y},center:function(a){return(a||new THREE.Vector2).addVectors(this.min,this.max).multiplyScalar(0.5)},size:function(a){return(a||new THREE.Vector2).subVectors(this.max,this.min)},expandByPoint:function(a){this.min.min(a);
this.max.max(a);return this},expandByVector:function(a){this.min.sub(a);this.max.add(a);return this},expandByScalar:function(a){this.min.addScalar(-a);this.max.addScalar(a);return this},containsPoint:function(a){return a.x<this.min.x||a.x>this.max.x||a.y<this.min.y||a.y>this.max.y?!1:!0},containsBox:function(a){return this.min.x<=a.min.x&&a.max.x<=this.max.x&&this.min.y<=a.min.y&&a.max.y<=this.max.y?!0:!1},getParameter:function(a){return new THREE.Vector2((a.x-this.min.x)/(this.max.x-this.min.x),
(a.y-this.min.y)/(this.max.y-this.min.y))},isIntersectionBox:function(a){return a.max.x<this.min.x||a.min.x>this.max.x||a.max.y<this.min.y||a.min.y>this.max.y?!1:!0},clampPoint:function(a,b){return(b||new THREE.Vector2).copy(a).clamp(this.min,this.max)},distanceToPoint:function(){var a=new THREE.Vector2;return function(b){return a.copy(b).clamp(this.min,this.max).sub(b).length()}}(),intersect:function(a){this.min.max(a.min);this.max.min(a.max);return this},union:function(a){this.min.min(a.min);this.max.max(a.max);
return this},translate:function(a){this.min.add(a);this.max.add(a);return this},equals:function(a){return a.min.equals(this.min)&&a.max.equals(this.max)},clone:function(){return(new THREE.Box2).copy(this)}};THREE.Box3=function(a,b){this.min=void 0!==a?a:new THREE.Vector3(Infinity,Infinity,Infinity);this.max=void 0!==b?b:new THREE.Vector3(-Infinity,-Infinity,-Infinity)};
THREE.Box3.prototype={constructor:THREE.Box3,set:function(a,b){this.min.copy(a);this.max.copy(b);return this},addPoint:function(a){a.x<this.min.x?this.min.x=a.x:a.x>this.max.x&&(this.max.x=a.x);a.y<this.min.y?this.min.y=a.y:a.y>this.max.y&&(this.max.y=a.y);a.z<this.min.z?this.min.z=a.z:a.z>this.max.z&&(this.max.z=a.z)},setFromPoints:function(a){if(0<a.length){var b=a[0];this.min.copy(b);this.max.copy(b);for(var b=1,c=a.length;b<c;b++)this.addPoint(a[b])}else this.makeEmpty();return this},setFromCenterAndSize:function(){var a=
new THREE.Vector3;return function(b,c){var d=a.copy(c).multiplyScalar(0.5);this.min.copy(b).sub(d);this.max.copy(b).add(d);return this}}(),setFromObject:function(){var a=new THREE.Vector3;return function(b){var c=this;b.updateMatrixWorld(!0);this.makeEmpty();b.traverse(function(b){if(void 0!==b.geometry&&void 0!==b.geometry.vertices)for(var e=b.geometry.vertices,f=0,h=e.length;f<h;f++)a.copy(e[f]),a.applyMatrix4(b.matrixWorld),c.expandByPoint(a)});return this}}(),copy:function(a){this.min.copy(a.min);
this.max.copy(a.max);return this},makeEmpty:function(){this.min.x=this.min.y=this.min.z=Infinity;this.max.x=this.max.y=this.max.z=-Infinity;return this},empty:function(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z},center:function(a){return(a||new THREE.Vector3).addVectors(this.min,this.max).multiplyScalar(0.5)},size:function(a){return(a||new THREE.Vector3).subVectors(this.max,this.min)},expandByPoint:function(a){this.min.min(a);this.max.max(a);return this},expandByVector:function(a){this.min.sub(a);
this.max.add(a);return this},expandByScalar:function(a){this.min.addScalar(-a);this.max.addScalar(a);return this},containsPoint:function(a){return a.x<this.min.x||a.x>this.max.x||a.y<this.min.y||a.y>this.max.y||a.z<this.min.z||a.z>this.max.z?!1:!0},containsBox:function(a){return this.min.x<=a.min.x&&a.max.x<=this.max.x&&this.min.y<=a.min.y&&a.max.y<=this.max.y&&this.min.z<=a.min.z&&a.max.z<=this.max.z?!0:!1},getParameter:function(a){return new THREE.Vector3((a.x-this.min.x)/(this.max.x-this.min.x),
(a.y-this.min.y)/(this.max.y-this.min.y),(a.z-this.min.z)/(this.max.z-this.min.z))},isIntersectionBox:function(a){return a.max.x<this.min.x||a.min.x>this.max.x||a.max.y<this.min.y||a.min.y>this.max.y||a.max.z<this.min.z||a.min.z>this.max.z?!1:!0},clampPoint:function(a,b){return(b||new THREE.Vector3).copy(a).clamp(this.min,this.max)},distanceToPoint:function(){var a=new THREE.Vector3;return function(b){return a.copy(b).clamp(this.min,this.max).sub(b).length()}}(),getBoundingSphere:function(){var a=
new THREE.Vector3;return function(b){b=b||new THREE.Sphere;b.center=this.center();b.radius=0.5*this.size(a).length();return b}}(),intersect:function(a){this.min.max(a.min);this.max.min(a.max);return this},union:function(a){this.min.min(a.min);this.max.max(a.max);return this},applyMatrix4:function(){var a=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];return function(b){a[0].set(this.min.x,this.min.y,
this.min.z).applyMatrix4(b);a[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(b);a[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(b);a[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(b);a[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(b);a[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(b);a[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(b);a[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(b);this.makeEmpty();this.setFromPoints(a);return this}}(),translate:function(a){this.min.add(a);
this.max.add(a);return this},equals:function(a){return a.min.equals(this.min)&&a.max.equals(this.max)},clone:function(){return(new THREE.Box3).copy(this)}};THREE.Matrix3=function(a,b,c,d,e,f,h,g,i){this.elements=new Float32Array(9);this.set(void 0!==a?a:1,b||0,c||0,d||0,void 0!==e?e:1,f||0,h||0,g||0,void 0!==i?i:1)};
THREE.Matrix3.prototype={constructor:THREE.Matrix3,set:function(a,b,c,d,e,f,h,g,i){var k=this.elements;k[0]=a;k[3]=b;k[6]=c;k[1]=d;k[4]=e;k[7]=f;k[2]=h;k[5]=g;k[8]=i;return this},identity:function(){this.set(1,0,0,0,1,0,0,0,1);return this},copy:function(a){a=a.elements;this.set(a[0],a[3],a[6],a[1],a[4],a[7],a[2],a[5],a[8]);return this},multiplyVector3:function(a){console.warn("DEPRECATED: Matrix3's .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead.");return a.applyMatrix3(this)},
multiplyVector3Array:function(){var a=new THREE.Vector3;return function(b){for(var c=0,d=b.length;c<d;c+=3)a.x=b[c],a.y=b[c+1],a.z=b[c+2],a.applyMatrix3(this),b[c]=a.x,b[c+1]=a.y,b[c+2]=a.z;return b}}(),multiplyScalar:function(a){var b=this.elements;b[0]*=a;b[3]*=a;b[6]*=a;b[1]*=a;b[4]*=a;b[7]*=a;b[2]*=a;b[5]*=a;b[8]*=a;return this},determinant:function(){var a=this.elements,b=a[0],c=a[1],d=a[2],e=a[3],f=a[4],h=a[5],g=a[6],i=a[7],a=a[8];return b*f*a-b*h*i-c*e*a+c*h*g+d*e*i-d*f*g},getInverse:function(a,
b){var c=a.elements,d=this.elements;d[0]=c[10]*c[5]-c[6]*c[9];d[1]=-c[10]*c[1]+c[2]*c[9];d[2]=c[6]*c[1]-c[2]*c[5];d[3]=-c[10]*c[4]+c[6]*c[8];d[4]=c[10]*c[0]-c[2]*c[8];d[5]=-c[6]*c[0]+c[2]*c[4];d[6]=c[9]*c[4]-c[5]*c[8];d[7]=-c[9]*c[0]+c[1]*c[8];d[8]=c[5]*c[0]-c[1]*c[4];c=c[0]*d[0]+c[1]*d[3]+c[2]*d[6];if(0===c){if(b)throw Error("Matrix3.getInverse(): can't invert matrix, determinant is 0");console.warn("Matrix3.getInverse(): can't invert matrix, determinant is 0");this.identity();return this}this.multiplyScalar(1/
c);return this},transpose:function(){var a,b=this.elements;a=b[1];b[1]=b[3];b[3]=a;a=b[2];b[2]=b[6];b[6]=a;a=b[5];b[5]=b[7];b[7]=a;return this},getNormalMatrix:function(a){this.getInverse(a).transpose();return this},transposeIntoArray:function(a){var b=this.elements;a[0]=b[0];a[1]=b[3];a[2]=b[6];a[3]=b[1];a[4]=b[4];a[5]=b[7];a[6]=b[2];a[7]=b[5];a[8]=b[8];return this},clone:function(){var a=this.elements;return new THREE.Matrix3(a[0],a[3],a[6],a[1],a[4],a[7],a[2],a[5],a[8])}};THREE.Matrix4=function(a,b,c,d,e,f,h,g,i,k,m,l,p,t,s,q){var n=this.elements=new Float32Array(16);n[0]=void 0!==a?a:1;n[4]=b||0;n[8]=c||0;n[12]=d||0;n[1]=e||0;n[5]=void 0!==f?f:1;n[9]=h||0;n[13]=g||0;n[2]=i||0;n[6]=k||0;n[10]=void 0!==m?m:1;n[14]=l||0;n[3]=p||0;n[7]=t||0;n[11]=s||0;n[15]=void 0!==q?q:1};
THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,d,e,f,h,g,i,k,m,l,p,t,s,q){var n=this.elements;n[0]=a;n[4]=b;n[8]=c;n[12]=d;n[1]=e;n[5]=f;n[9]=h;n[13]=g;n[2]=i;n[6]=k;n[10]=m;n[14]=l;n[3]=p;n[7]=t;n[11]=s;n[15]=q;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.elements.set(a.elements);return this},extractPosition:function(a){console.warn("DEPRECATED: Matrix4's .extractPosition() has been renamed to .copyPosition().");
return this.copyPosition(a)},copyPosition:function(a){var b=this.elements,a=a.elements;b[12]=a[12];b[13]=a[13];b[14]=a[14];return this},extractRotation:function(){var a=new THREE.Vector3;return function(b){var c=this.elements,b=b.elements,d=1/a.set(b[0],b[1],b[2]).length(),e=1/a.set(b[4],b[5],b[6]).length(),f=1/a.set(b[8],b[9],b[10]).length();c[0]=b[0]*d;c[1]=b[1]*d;c[2]=b[2]*d;c[4]=b[4]*e;c[5]=b[5]*e;c[6]=b[6]*e;c[8]=b[8]*f;c[9]=b[9]*f;c[10]=b[10]*f;return this}}(),makeRotationFromEuler:function(a){!1===
a instanceof THREE.Euler&&console.error("ERROR: Matrix's .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order. Please update your code.");var b=this.elements,c=a.x,d=a.y,e=a.z,f=Math.cos(c),c=Math.sin(c),h=Math.cos(d),d=Math.sin(d),g=Math.cos(e),e=Math.sin(e);if("XYZ"===a.order){var a=f*g,i=f*e,k=c*g,m=c*e;b[0]=h*g;b[4]=-h*e;b[8]=d;b[1]=i+k*d;b[5]=a-m*d;b[9]=-c*h;b[2]=m-a*d;b[6]=k+i*d;b[10]=f*h}else"YXZ"===a.order?(a=h*g,i=h*e,k=d*g,m=d*e,b[0]=a+m*c,b[4]=k*c-i,b[8]=
f*d,b[1]=f*e,b[5]=f*g,b[9]=-c,b[2]=i*c-k,b[6]=m+a*c,b[10]=f*h):"ZXY"===a.order?(a=h*g,i=h*e,k=d*g,m=d*e,b[0]=a-m*c,b[4]=-f*e,b[8]=k+i*c,b[1]=i+k*c,b[5]=f*g,b[9]=m-a*c,b[2]=-f*d,b[6]=c,b[10]=f*h):"ZYX"===a.order?(a=f*g,i=f*e,k=c*g,m=c*e,b[0]=h*g,b[4]=k*d-i,b[8]=a*d+m,b[1]=h*e,b[5]=m*d+a,b[9]=i*d-k,b[2]=-d,b[6]=c*h,b[10]=f*h):"YZX"===a.order?(a=f*h,i=f*d,k=c*h,m=c*d,b[0]=h*g,b[4]=m-a*e,b[8]=k*e+i,b[1]=e,b[5]=f*g,b[9]=-c*g,b[2]=-d*g,b[6]=i*e+k,b[10]=a-m*e):"XZY"===a.order&&(a=f*h,i=f*d,k=c*h,m=c*d,b[0]=
h*g,b[4]=-e,b[8]=d*g,b[1]=a*e+m,b[5]=f*g,b[9]=i*e-k,b[2]=k*e-i,b[6]=c*g,b[10]=m*e+a);b[3]=0;b[7]=0;b[11]=0;b[12]=0;b[13]=0;b[14]=0;b[15]=1;return this},setRotationFromQuaternion:function(a){console.warn("DEPRECATED: Matrix4's .setRotationFromQuaternion() has been deprecated in favor of makeRotationFromQuaternion. Please update your code.");return this.makeRotationFromQuaternion(a)},makeRotationFromQuaternion:function(a){var b=this.elements,c=a.x,d=a.y,e=a.z,f=a.w,h=c+c,g=d+d,i=e+e,a=c*h,k=c*g,c=
c*i,m=d*g,d=d*i,e=e*i,h=f*h,g=f*g,f=f*i;b[0]=1-(m+e);b[4]=k-f;b[8]=c+g;b[1]=k+f;b[5]=1-(a+e);b[9]=d-h;b[2]=c-g;b[6]=d+h;b[10]=1-(a+m);b[3]=0;b[7]=0;b[11]=0;b[12]=0;b[13]=0;b[14]=0;b[15]=1;return this},lookAt:function(){var a=new THREE.Vector3,b=new THREE.Vector3,c=new THREE.Vector3;return function(d,e,f){var h=this.elements;c.subVectors(d,e).normalize();0===c.length()&&(c.z=1);a.crossVectors(f,c).normalize();0===a.length()&&(c.x+=1E-4,a.crossVectors(f,c).normalize());b.crossVectors(c,a);h[0]=a.x;
h[4]=b.x;h[8]=c.x;h[1]=a.y;h[5]=b.y;h[9]=c.y;h[2]=a.z;h[6]=b.z;h[10]=c.z;return this}}(),multiply:function(a,b){return void 0!==b?(console.warn("DEPRECATED: Matrix4's .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(a,b)):this.multiplyMatrices(this,a)},multiplyMatrices:function(a,b){var c=a.elements,d=b.elements,e=this.elements,f=c[0],h=c[4],g=c[8],i=c[12],k=c[1],m=c[5],l=c[9],p=c[13],t=c[2],s=c[6],q=c[10],n=c[14],u=c[3],r=c[7],v=c[11],c=c[15],
z=d[0],G=d[4],w=d[8],y=d[12],E=d[1],A=d[5],K=d[9],D=d[13],F=d[2],O=d[6],x=d[10],I=d[14],B=d[3],M=d[7],J=d[11],d=d[15];e[0]=f*z+h*E+g*F+i*B;e[4]=f*G+h*A+g*O+i*M;e[8]=f*w+h*K+g*x+i*J;e[12]=f*y+h*D+g*I+i*d;e[1]=k*z+m*E+l*F+p*B;e[5]=k*G+m*A+l*O+p*M;e[9]=k*w+m*K+l*x+p*J;e[13]=k*y+m*D+l*I+p*d;e[2]=t*z+s*E+q*F+n*B;e[6]=t*G+s*A+q*O+n*M;e[10]=t*w+s*K+q*x+n*J;e[14]=t*y+s*D+q*I+n*d;e[3]=u*z+r*E+v*F+c*B;e[7]=u*G+r*A+v*O+c*M;e[11]=u*w+r*K+v*x+c*J;e[15]=u*y+r*D+v*I+c*d;return this},multiplyToArray:function(a,b,
c){var d=this.elements;this.multiplyMatrices(a,b);c[0]=d[0];c[1]=d[1];c[2]=d[2];c[3]=d[3];c[4]=d[4];c[5]=d[5];c[6]=d[6];c[7]=d[7];c[8]=d[8];c[9]=d[9];c[10]=d[10];c[11]=d[11];c[12]=d[12];c[13]=d[13];c[14]=d[14];c[15]=d[15];return this},multiplyScalar:function(a){var b=this.elements;b[0]*=a;b[4]*=a;b[8]*=a;b[12]*=a;b[1]*=a;b[5]*=a;b[9]*=a;b[13]*=a;b[2]*=a;b[6]*=a;b[10]*=a;b[14]*=a;b[3]*=a;b[7]*=a;b[11]*=a;b[15]*=a;return this},multiplyVector3:function(a){console.warn("DEPRECATED: Matrix4's .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) or vector.applyProjection( matrix ) instead.");
return a.applyProjection(this)},multiplyVector4:function(a){console.warn("DEPRECATED: Matrix4's .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead.");return a.applyMatrix4(this)},multiplyVector3Array:function(){var a=new THREE.Vector3;return function(b){for(var c=0,d=b.length;c<d;c+=3)a.x=b[c],a.y=b[c+1],a.z=b[c+2],a.applyProjection(this),b[c]=a.x,b[c+1]=a.y,b[c+2]=a.z;return b}}(),rotateAxis:function(a){console.warn("DEPRECATED: Matrix4's .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead.");
a.transformDirection(this)},crossVector:function(a){console.warn("DEPRECATED: Matrix4's .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead.");return a.applyMatrix4(this)},determinant:function(){var a=this.elements,b=a[0],c=a[4],d=a[8],e=a[12],f=a[1],h=a[5],g=a[9],i=a[13],k=a[2],m=a[6],l=a[10],p=a[14];return a[3]*(+e*g*m-d*i*m-e*h*l+c*i*l+d*h*p-c*g*p)+a[7]*(+b*g*p-b*i*l+e*f*l-d*f*p+d*i*k-e*g*k)+a[11]*(+b*i*m-b*h*p-e*f*m+c*f*p+e*h*k-c*i*k)+a[15]*(-d*h*k-b*g*m+b*h*l+d*f*m-c*f*
l+c*g*k)},transpose:function(){var a=this.elements,b;b=a[1];a[1]=a[4];a[4]=b;b=a[2];a[2]=a[8];a[8]=b;b=a[6];a[6]=a[9];a[9]=b;b=a[3];a[3]=a[12];a[12]=b;b=a[7];a[7]=a[13];a[13]=b;b=a[11];a[11]=a[14];a[14]=b;return this},flattenToArray:function(a){var b=this.elements;a[0]=b[0];a[1]=b[1];a[2]=b[2];a[3]=b[3];a[4]=b[4];a[5]=b[5];a[6]=b[6];a[7]=b[7];a[8]=b[8];a[9]=b[9];a[10]=b[10];a[11]=b[11];a[12]=b[12];a[13]=b[13];a[14]=b[14];a[15]=b[15];return a},flattenToArrayOffset:function(a,b){var c=this.elements;
a[b]=c[0];a[b+1]=c[1];a[b+2]=c[2];a[b+3]=c[3];a[b+4]=c[4];a[b+5]=c[5];a[b+6]=c[6];a[b+7]=c[7];a[b+8]=c[8];a[b+9]=c[9];a[b+10]=c[10];a[b+11]=c[11];a[b+12]=c[12];a[b+13]=c[13];a[b+14]=c[14];a[b+15]=c[15];return a},getPosition:function(){var a=new THREE.Vector3;return function(){console.warn("DEPRECATED: Matrix4's .getPosition() has been removed. Use Vector3.getPositionFromMatrix( matrix ) instead.");var b=this.elements;return a.set(b[12],b[13],b[14])}}(),setPosition:function(a){var b=this.elements;
b[12]=a.x;b[13]=a.y;b[14]=a.z;return this},getInverse:function(a,b){var c=this.elements,d=a.elements,e=d[0],f=d[4],h=d[8],g=d[12],i=d[1],k=d[5],m=d[9],l=d[13],p=d[2],t=d[6],s=d[10],q=d[14],n=d[3],u=d[7],r=d[11],d=d[15];c[0]=m*q*u-l*s*u+l*t*r-k*q*r-m*t*d+k*s*d;c[4]=g*s*u-h*q*u-g*t*r+f*q*r+h*t*d-f*s*d;c[8]=h*l*u-g*m*u+g*k*r-f*l*r-h*k*d+f*m*d;c[12]=g*m*t-h*l*t-g*k*s+f*l*s+h*k*q-f*m*q;c[1]=l*s*n-m*q*n-l*p*r+i*q*r+m*p*d-i*s*d;c[5]=h*q*n-g*s*n+g*p*r-e*q*r-h*p*d+e*s*d;c[9]=g*m*n-h*l*n-g*i*r+e*l*r+h*i*d-
e*m*d;c[13]=h*l*p-g*m*p+g*i*s-e*l*s-h*i*q+e*m*q;c[2]=k*q*n-l*t*n+l*p*u-i*q*u-k*p*d+i*t*d;c[6]=g*t*n-f*q*n-g*p*u+e*q*u+f*p*d-e*t*d;c[10]=f*l*n-g*k*n+g*i*u-e*l*u-f*i*d+e*k*d;c[14]=g*k*p-f*l*p-g*i*t+e*l*t+f*i*q-e*k*q;c[3]=m*t*n-k*s*n-m*p*u+i*s*u+k*p*r-i*t*r;c[7]=f*s*n-h*t*n+h*p*u-e*s*u-f*p*r+e*t*r;c[11]=h*k*n-f*m*n-h*i*u+e*m*u+f*i*r-e*k*r;c[15]=f*m*p-h*k*p+h*i*t-e*m*t-f*i*s+e*k*s;c=e*c[0]+i*c[4]+p*c[8]+n*c[12];if(0==c){if(b)throw Error("Matrix4.getInverse(): can't invert matrix, determinant is 0");console.warn("Matrix4.getInverse(): can't invert matrix, determinant is 0");
this.identity();return this}this.multiplyScalar(1/c);return this},translate:function(){console.warn("DEPRECATED: Matrix4's .translate() has been removed.")},rotateX:function(){console.warn("DEPRECATED: Matrix4's .rotateX() has been removed.")},rotateY:function(){console.warn("DEPRECATED: Matrix4's .rotateY() has been removed.")},rotateZ:function(){console.warn("DEPRECATED: Matrix4's .rotateZ() has been removed.")},rotateByAxis:function(){console.warn("DEPRECATED: Matrix4's .rotateByAxis() has been removed.")},
scale:function(a){var b=this.elements,c=a.x,d=a.y,a=a.z;b[0]*=c;b[4]*=d;b[8]*=a;b[1]*=c;b[5]*=d;b[9]*=a;b[2]*=c;b[6]*=d;b[10]*=a;b[3]*=c;b[7]*=d;b[11]*=a;return this},getMaxScaleOnAxis:function(){var a=this.elements;return Math.sqrt(Math.max(a[0]*a[0]+a[1]*a[1]+a[2]*a[2],Math.max(a[4]*a[4]+a[5]*a[5]+a[6]*a[6],a[8]*a[8]+a[9]*a[9]+a[10]*a[10])))},makeTranslation:function(a,b,c){this.set(1,0,0,a,0,1,0,b,0,0,1,c,0,0,0,1);return this},makeRotationX:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(1,
0,0,0,0,b,-a,0,0,a,b,0,0,0,0,1);return this},makeRotationY:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(b,0,a,0,0,1,0,0,-a,0,b,0,0,0,0,1);return this},makeRotationZ:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(b,-a,0,0,a,b,0,0,0,0,1,0,0,0,0,1);return this},makeRotationAxis:function(a,b){var c=Math.cos(b),d=Math.sin(b),e=1-c,f=a.x,h=a.y,g=a.z,i=e*f,k=e*h;this.set(i*f+c,i*h-d*g,i*g+d*h,0,i*h+d*g,k*h+c,k*g-d*f,0,i*g-d*h,k*g+d*f,e*g*g+c,0,0,0,0,1);return this},makeScale:function(a,b,c){this.set(a,
0,0,0,0,b,0,0,0,0,c,0,0,0,0,1);return this},compose:function(a,b,c){this.makeRotationFromQuaternion(b);this.scale(c);this.setPosition(a);return this},decompose:function(){var a=new THREE.Vector3,b=new THREE.Matrix4;return function(c,d,e){var f=this.elements,h=a.set(f[0],f[1],f[2]).length(),g=a.set(f[4],f[5],f[6]).length(),i=a.set(f[8],f[9],f[10]).length();c.x=f[12];c.y=f[13];c.z=f[14];b.elements.set(this.elements);var c=1/h,f=1/g,k=1/i;b.elements[0]*=c;b.elements[1]*=c;b.elements[2]*=c;b.elements[4]*=
f;b.elements[5]*=f;b.elements[6]*=f;b.elements[8]*=k;b.elements[9]*=k;b.elements[10]*=k;d.setFromRotationMatrix(b);e.x=h;e.y=g;e.z=i;return this}}(),makeFrustum:function(a,b,c,d,e,f){var h=this.elements;h[0]=2*e/(b-a);h[4]=0;h[8]=(b+a)/(b-a);h[12]=0;h[1]=0;h[5]=2*e/(d-c);h[9]=(d+c)/(d-c);h[13]=0;h[2]=0;h[6]=0;h[10]=-(f+e)/(f-e);h[14]=-2*f*e/(f-e);h[3]=0;h[7]=0;h[11]=-1;h[15]=0;return this},makePerspective:function(a,b,c,d){var a=c*Math.tan(THREE.Math.degToRad(0.5*a)),e=-a;return this.makeFrustum(e*
b,a*b,e,a,c,d)},makeOrthographic:function(a,b,c,d,e,f){var h=this.elements,g=b-a,i=c-d,k=f-e;h[0]=2/g;h[4]=0;h[8]=0;h[12]=-((b+a)/g);h[1]=0;h[5]=2/i;h[9]=0;h[13]=-((c+d)/i);h[2]=0;h[6]=0;h[10]=-2/k;h[14]=-((f+e)/k);h[3]=0;h[7]=0;h[11]=0;h[15]=1;return this},fromArray:function(a){this.elements.set(a);return this},toArray:function(){var a=this.elements;return[a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7],a[8],a[9],a[10],a[11],a[12],a[13],a[14],a[15]]},clone:function(){var a=this.elements;return new THREE.Matrix4(a[0],
a[4],a[8],a[12],a[1],a[5],a[9],a[13],a[2],a[6],a[10],a[14],a[3],a[7],a[11],a[15])}};THREE.Ray=function(a,b){this.origin=void 0!==a?a:new THREE.Vector3;this.direction=void 0!==b?b:new THREE.Vector3};
THREE.Ray.prototype={constructor:THREE.Ray,set:function(a,b){this.origin.copy(a);this.direction.copy(b);return this},copy:function(a){this.origin.copy(a.origin);this.direction.copy(a.direction);return this},at:function(a,b){return(b||new THREE.Vector3).copy(this.direction).multiplyScalar(a).add(this.origin)},recast:function(){var a=new THREE.Vector3;return function(b){this.origin.copy(this.at(b,a));return this}}(),closestPointToPoint:function(a,b){var c=b||new THREE.Vector3;c.subVectors(a,this.origin);
var d=c.dot(this.direction);return 0>d?c.copy(this.origin):c.copy(this.direction).multiplyScalar(d).add(this.origin)},distanceToPoint:function(){var a=new THREE.Vector3;return function(b){var c=a.subVectors(b,this.origin).dot(this.direction);if(0>c)return this.origin.distanceTo(b);a.copy(this.direction).multiplyScalar(c).add(this.origin);return a.distanceTo(b)}}(),distanceSqToSegment:function(a,b,c,d){var e=a.clone().add(b).multiplyScalar(0.5),f=b.clone().sub(a).normalize(),h=0.5*a.distanceTo(b),
g=this.origin.clone().sub(e),a=-this.direction.dot(f),b=g.dot(this.direction),i=-g.dot(f),k=g.lengthSq(),m=Math.abs(1-a*a),l,p;0<=m?(g=a*i-b,l=a*b-i,p=h*m,0<=g?l>=-p?l<=p?(h=1/m,g*=h,l*=h,a=g*(g+a*l+2*b)+l*(a*g+l+2*i)+k):(l=h,g=Math.max(0,-(a*l+b)),a=-g*g+l*(l+2*i)+k):(l=-h,g=Math.max(0,-(a*l+b)),a=-g*g+l*(l+2*i)+k):l<=-p?(g=Math.max(0,-(-a*h+b)),l=0<g?-h:Math.min(Math.max(-h,-i),h),a=-g*g+l*(l+2*i)+k):l<=p?(g=0,l=Math.min(Math.max(-h,-i),h),a=l*(l+2*i)+k):(g=Math.max(0,-(a*h+b)),l=0<g?h:Math.min(Math.max(-h,
-i),h),a=-g*g+l*(l+2*i)+k)):(l=0<a?-h:h,g=Math.max(0,-(a*l+b)),a=-g*g+l*(l+2*i)+k);c&&c.copy(this.direction.clone().multiplyScalar(g).add(this.origin));d&&d.copy(f.clone().multiplyScalar(l).add(e));return a},isIntersectionSphere:function(a){return this.distanceToPoint(a.center)<=a.radius},isIntersectionPlane:function(a){var b=a.distanceToPoint(this.origin);return 0===b||0>a.normal.dot(this.direction)*b?!0:!1},distanceToPlane:function(a){var b=a.normal.dot(this.direction);if(0==b)return 0==a.distanceToPoint(this.origin)?
0:null;a=-(this.origin.dot(a.normal)+a.constant)/b;return 0<=a?a:null},intersectPlane:function(a,b){var c=this.distanceToPlane(a);return null===c?null:this.at(c,b)},isIntersectionBox:function(){var a=new THREE.Vector3;return function(b){return null!==this.intersectBox(b,a)}}(),intersectBox:function(a,b){var c,d,e,f,h;d=1/this.direction.x;f=1/this.direction.y;h=1/this.direction.z;var g=this.origin;0<=d?(c=(a.min.x-g.x)*d,d*=a.max.x-g.x):(c=(a.max.x-g.x)*d,d*=a.min.x-g.x);0<=f?(e=(a.min.y-g.y)*f,f*=
a.max.y-g.y):(e=(a.max.y-g.y)*f,f*=a.min.y-g.y);if(c>f||e>d)return null;if(e>c||c!==c)c=e;if(f<d||d!==d)d=f;0<=h?(e=(a.min.z-g.z)*h,h*=a.max.z-g.z):(e=(a.max.z-g.z)*h,h*=a.min.z-g.z);if(c>h||e>d)return null;if(e>c||c!==c)c=e;if(h<d||d!==d)d=h;return 0>d?null:this.at(0<=c?c:d,b)},intersectTriangle:function(){var a=new THREE.Vector3,b=new THREE.Vector3,c=new THREE.Vector3,d=new THREE.Vector3;return function(e,f,h,g,i){b.subVectors(f,e);c.subVectors(h,e);d.crossVectors(b,c);f=this.direction.dot(d);if(0<
f){if(g)return null;g=1}else if(0>f)g=-1,f=-f;else return null;a.subVectors(this.origin,e);e=g*this.direction.dot(c.crossVectors(a,c));if(0>e)return null;h=g*this.direction.dot(b.cross(a));if(0>h||e+h>f)return null;e=-g*a.dot(d);return 0>e?null:this.at(e/f,i)}}(),applyMatrix4:function(a){this.direction.add(this.origin).applyMatrix4(a);this.origin.applyMatrix4(a);this.direction.sub(this.origin);this.direction.normalize();return this},equals:function(a){return a.origin.equals(this.origin)&&a.direction.equals(this.direction)},
clone:function(){return(new THREE.Ray).copy(this)}};THREE.Sphere=function(a,b){this.center=void 0!==a?a:new THREE.Vector3;this.radius=void 0!==b?b:0};
THREE.Sphere.prototype={constructor:THREE.Sphere,set:function(a,b){this.center.copy(a);this.radius=b;return this},setFromPoints:function(){var a=new THREE.Box3;return function(b,c){var d=this.center;void 0!==c?d.copy(c):a.setFromPoints(b).center(d);for(var e=0,f=0,h=b.length;f<h;f++)e=Math.max(e,d.distanceToSquared(b[f]));this.radius=Math.sqrt(e);return this}}(),copy:function(a){this.center.copy(a.center);this.radius=a.radius;return this},empty:function(){return 0>=this.radius},containsPoint:function(a){return a.distanceToSquared(this.center)<=
this.radius*this.radius},distanceToPoint:function(a){return a.distanceTo(this.center)-this.radius},intersectsSphere:function(a){var b=this.radius+a.radius;return a.center.distanceToSquared(this.center)<=b*b},clampPoint:function(a,b){var c=this.center.distanceToSquared(a),d=b||new THREE.Vector3;d.copy(a);c>this.radius*this.radius&&(d.sub(this.center).normalize(),d.multiplyScalar(this.radius).add(this.center));return d},getBoundingBox:function(a){a=a||new THREE.Box3;a.set(this.center,this.center);a.expandByScalar(this.radius);
return a},applyMatrix4:function(a){this.center.applyMatrix4(a);this.radius*=a.getMaxScaleOnAxis();return this},translate:function(a){this.center.add(a);return this},equals:function(a){return a.center.equals(this.center)&&a.radius===this.radius},clone:function(){return(new THREE.Sphere).copy(this)}};THREE.Frustum=function(a,b,c,d,e,f){this.planes=[void 0!==a?a:new THREE.Plane,void 0!==b?b:new THREE.Plane,void 0!==c?c:new THREE.Plane,void 0!==d?d:new THREE.Plane,void 0!==e?e:new THREE.Plane,void 0!==f?f:new THREE.Plane]};
THREE.Frustum.prototype={constructor:THREE.Frustum,set:function(a,b,c,d,e,f){var h=this.planes;h[0].copy(a);h[1].copy(b);h[2].copy(c);h[3].copy(d);h[4].copy(e);h[5].copy(f);return this},copy:function(a){for(var b=this.planes,c=0;6>c;c++)b[c].copy(a.planes[c]);return this},setFromMatrix:function(a){var b=this.planes,c=a.elements,a=c[0],d=c[1],e=c[2],f=c[3],h=c[4],g=c[5],i=c[6],k=c[7],m=c[8],l=c[9],p=c[10],t=c[11],s=c[12],q=c[13],n=c[14],c=c[15];b[0].setComponents(f-a,k-h,t-m,c-s).normalize();b[1].setComponents(f+
a,k+h,t+m,c+s).normalize();b[2].setComponents(f+d,k+g,t+l,c+q).normalize();b[3].setComponents(f-d,k-g,t-l,c-q).normalize();b[4].setComponents(f-e,k-i,t-p,c-n).normalize();b[5].setComponents(f+e,k+i,t+p,c+n).normalize();return this},intersectsObject:function(){var a=new THREE.Sphere;return function(b){var c=b.geometry;null===c.boundingSphere&&c.computeBoundingSphere();a.copy(c.boundingSphere);a.applyMatrix4(b.matrixWorld);return this.intersectsSphere(a)}}(),intersectsSphere:function(a){for(var b=this.planes,
c=a.center,a=-a.radius,d=0;6>d;d++)if(b[d].distanceToPoint(c)<a)return!1;return!0},intersectsBox:function(){var a=new THREE.Vector3,b=new THREE.Vector3;return function(c){for(var d=this.planes,e=0;6>e;e++){var f=d[e];a.x=0<f.normal.x?c.min.x:c.max.x;b.x=0<f.normal.x?c.max.x:c.min.x;a.y=0<f.normal.y?c.min.y:c.max.y;b.y=0<f.normal.y?c.max.y:c.min.y;a.z=0<f.normal.z?c.min.z:c.max.z;b.z=0<f.normal.z?c.max.z:c.min.z;var h=f.distanceToPoint(a),f=f.distanceToPoint(b);if(0>h&&0>f)return!1}return!0}}(),containsPoint:function(a){for(var b=
this.planes,c=0;6>c;c++)if(0>b[c].distanceToPoint(a))return!1;return!0},clone:function(){return(new THREE.Frustum).copy(this)}};THREE.Plane=function(a,b){this.normal=void 0!==a?a:new THREE.Vector3(1,0,0);this.constant=void 0!==b?b:0};
THREE.Plane.prototype={constructor:THREE.Plane,set:function(a,b){this.normal.copy(a);this.constant=b;return this},setComponents:function(a,b,c,d){this.normal.set(a,b,c);this.constant=d;return this},setFromNormalAndCoplanarPoint:function(a,b){this.normal.copy(a);this.constant=-b.dot(this.normal);return this},setFromCoplanarPoints:function(){var a=new THREE.Vector3,b=new THREE.Vector3;return function(c,d,e){d=a.subVectors(e,d).cross(b.subVectors(c,d)).normalize();this.setFromNormalAndCoplanarPoint(d,
c);return this}}(),copy:function(a){this.normal.copy(a.normal);this.constant=a.constant;return this},normalize:function(){var a=1/this.normal.length();this.normal.multiplyScalar(a);this.constant*=a;return this},negate:function(){this.constant*=-1;this.normal.negate();return this},distanceToPoint:function(a){return this.normal.dot(a)+this.constant},distanceToSphere:function(a){return this.distanceToPoint(a.center)-a.radius},projectPoint:function(a,b){return this.orthoPoint(a,b).sub(a).negate()},orthoPoint:function(a,
b){var c=this.distanceToPoint(a);return(b||new THREE.Vector3).copy(this.normal).multiplyScalar(c)},isIntersectionLine:function(a){var b=this.distanceToPoint(a.start),a=this.distanceToPoint(a.end);return 0>b&&0<a||0>a&&0<b},intersectLine:function(){var a=new THREE.Vector3;return function(b,c){var d=c||new THREE.Vector3,e=b.delta(a),f=this.normal.dot(e);if(0==f){if(0==this.distanceToPoint(b.start))return d.copy(b.start)}else return f=-(b.start.dot(this.normal)+this.constant)/f,0>f||1<f?void 0:d.copy(e).multiplyScalar(f).add(b.start)}}(),
coplanarPoint:function(a){return(a||new THREE.Vector3).copy(this.normal).multiplyScalar(-this.constant)},applyMatrix4:function(){var a=new THREE.Vector3,b=new THREE.Vector3;return function(c,d){var d=d||(new THREE.Matrix3).getNormalMatrix(c),e=a.copy(this.normal).applyMatrix3(d),f=this.coplanarPoint(b);f.applyMatrix4(c);this.setFromNormalAndCoplanarPoint(e,f);return this}}(),translate:function(a){this.constant-=a.dot(this.normal);return this},equals:function(a){return a.normal.equals(this.normal)&&
a.constant==this.constant},clone:function(){return(new THREE.Plane).copy(this)}};THREE.Math={PI2:2*Math.PI,generateUUID:function(){var a="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),b=Array(36),c=0,d;return function(){for(var e=0;36>e;e++)8==e||13==e||18==e||23==e?b[e]="-":14==e?b[e]="4":(2>=c&&(c=33554432+16777216*Math.random()|0),d=c&15,c>>=4,b[e]=a[19==e?d&3|8:d]);return b.join("")}}(),clamp:function(a,b,c){return a<b?b:a>c?c:a},clampBottom:function(a,b){return a<b?b:a},mapLinear:function(a,b,c,d,e){return d+(a-b)*(e-d)/(c-b)},smoothstep:function(a,
b,c){if(a<=b)return 0;if(a>=c)return 1;a=(a-b)/(c-b);return a*a*(3-2*a)},smootherstep:function(a,b,c){if(a<=b)return 0;if(a>=c)return 1;a=(a-b)/(c-b);return a*a*a*(a*(6*a-15)+10)},random16:function(){return(65280*Math.random()+255*Math.random())/65535},randInt:function(a,b){return a+Math.floor(Math.random()*(b-a+1))},randFloat:function(a,b){return a+Math.random()*(b-a)},randFloatSpread:function(a){return a*(0.5-Math.random())},sign:function(a){return 0>a?-1:0<a?1:0},degToRad:function(){var a=Math.PI/
180;return function(b){return b*a}}(),radToDeg:function(){var a=180/Math.PI;return function(b){return b*a}}()};THREE.Spline=function(a){function b(a,b,c,d,e,f,h){a=0.5*(c-a);d=0.5*(d-b);return(2*(b-c)+a+d)*h+(-3*(b-c)-2*a-d)*f+a*e+b}this.points=a;var c=[],d={x:0,y:0,z:0},e,f,h,g,i,k,m,l,p;this.initFromArray=function(a){this.points=[];for(var b=0;b<a.length;b++)this.points[b]={x:a[b][0],y:a[b][1],z:a[b][2]}};this.getPoint=function(a){e=(this.points.length-1)*a;f=Math.floor(e);h=e-f;c[0]=0===f?f:f-1;c[1]=f;c[2]=f>this.points.length-2?this.points.length-1:f+1;c[3]=f>this.points.length-3?this.points.length-1:
f+2;k=this.points[c[0]];m=this.points[c[1]];l=this.points[c[2]];p=this.points[c[3]];g=h*h;i=h*g;d.x=b(k.x,m.x,l.x,p.x,h,g,i);d.y=b(k.y,m.y,l.y,p.y,h,g,i);d.z=b(k.z,m.z,l.z,p.z,h,g,i);return d};this.getControlPointsArray=function(){var a,b,c=this.points.length,d=[];for(a=0;a<c;a++)b=this.points[a],d[a]=[b.x,b.y,b.z];return d};this.getLength=function(a){var b,c,d,e=b=b=0,f=new THREE.Vector3,h=new THREE.Vector3,g=[],i=0;g[0]=0;a||(a=100);c=this.points.length*a;f.copy(this.points[0]);for(a=1;a<c;a++)b=
a/c,d=this.getPoint(b),h.copy(d),i+=h.distanceTo(f),f.copy(d),b*=this.points.length-1,b=Math.floor(b),b!=e&&(g[b]=i,e=b);g[g.length]=i;return{chunks:g,total:i}};this.reparametrizeByArcLength=function(a){var b,c,d,e,f,h,g=[],i=new THREE.Vector3,k=this.getLength();g.push(i.copy(this.points[0]).clone());for(b=1;b<this.points.length;b++){c=k.chunks[b]-k.chunks[b-1];h=Math.ceil(a*c/k.total);e=(b-1)/(this.points.length-1);f=b/(this.points.length-1);for(c=1;c<h-1;c++)d=e+c*(1/h)*(f-e),d=this.getPoint(d),
g.push(i.copy(d).clone());g.push(i.copy(this.points[b]).clone())}this.points=g}};THREE.Triangle=function(a,b,c){this.a=void 0!==a?a:new THREE.Vector3;this.b=void 0!==b?b:new THREE.Vector3;this.c=void 0!==c?c:new THREE.Vector3};THREE.Triangle.normal=function(){var a=new THREE.Vector3;return function(b,c,d,e){e=e||new THREE.Vector3;e.subVectors(d,c);a.subVectors(b,c);e.cross(a);b=e.lengthSq();return 0<b?e.multiplyScalar(1/Math.sqrt(b)):e.set(0,0,0)}}();
THREE.Triangle.barycoordFromPoint=function(){var a=new THREE.Vector3,b=new THREE.Vector3,c=new THREE.Vector3;return function(d,e,f,h,g){a.subVectors(h,e);b.subVectors(f,e);c.subVectors(d,e);var d=a.dot(a),e=a.dot(b),f=a.dot(c),i=b.dot(b),h=b.dot(c),k=d*i-e*e,g=g||new THREE.Vector3;if(0==k)return g.set(-2,-1,-1);k=1/k;i=(i*f-e*h)*k;d=(d*h-e*f)*k;return g.set(1-i-d,d,i)}}();
THREE.Triangle.containsPoint=function(){var a=new THREE.Vector3;return function(b,c,d,e){b=THREE.Triangle.barycoordFromPoint(b,c,d,e,a);return 0<=b.x&&0<=b.y&&1>=b.x+b.y}}();
THREE.Triangle.prototype={constructor:THREE.Triangle,set:function(a,b,c){this.a.copy(a);this.b.copy(b);this.c.copy(c);return this},setFromPointsAndIndices:function(a,b,c,d){this.a.copy(a[b]);this.b.copy(a[c]);this.c.copy(a[d]);return this},copy:function(a){this.a.copy(a.a);this.b.copy(a.b);this.c.copy(a.c);return this},area:function(){var a=new THREE.Vector3,b=new THREE.Vector3;return function(){a.subVectors(this.c,this.b);b.subVectors(this.a,this.b);return 0.5*a.cross(b).length()}}(),midpoint:function(a){return(a||
new THREE.Vector3).addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)},normal:function(a){return THREE.Triangle.normal(this.a,this.b,this.c,a)},plane:function(a){return(a||new THREE.Plane).setFromCoplanarPoints(this.a,this.b,this.c)},barycoordFromPoint:function(a,b){return THREE.Triangle.barycoordFromPoint(a,this.a,this.b,this.c,b)},containsPoint:function(a){return THREE.Triangle.containsPoint(a,this.a,this.b,this.c)},equals:function(a){return a.a.equals(this.a)&&a.b.equals(this.b)&&a.c.equals(this.c)},
clone:function(){return(new THREE.Triangle).copy(this)}};THREE.Vertex=function(a){console.warn("THREE.Vertex has been DEPRECATED. Use THREE.Vector3 instead.");return a};THREE.UV=function(a,b){console.warn("THREE.UV has been DEPRECATED. Use THREE.Vector2 instead.");return new THREE.Vector2(a,b)};THREE.Clock=function(a){this.autoStart=void 0!==a?a:!0;this.elapsedTime=this.oldTime=this.startTime=0;this.running=!1};
THREE.Clock.prototype={constructor:THREE.Clock,start:function(){this.oldTime=this.startTime=void 0!==self.performance&&void 0!==self.performance.now?self.performance.now():Date.now();this.running=!0},stop:function(){this.getElapsedTime();this.running=!1},getElapsedTime:function(){this.getDelta();return this.elapsedTime},getDelta:function(){var a=0;this.autoStart&&!this.running&&this.start();if(this.running){var b=void 0!==self.performance&&void 0!==self.performance.now?self.performance.now():Date.now(),
a=0.0010*(b-this.oldTime);this.oldTime=b;this.elapsedTime+=a}return a}};THREE.EventDispatcher=function(){};
THREE.EventDispatcher.prototype={constructor:THREE.EventDispatcher,apply:function(a){a.addEventListener=THREE.EventDispatcher.prototype.addEventListener;a.hasEventListener=THREE.EventDispatcher.prototype.hasEventListener;a.removeEventListener=THREE.EventDispatcher.prototype.removeEventListener;a.dispatchEvent=THREE.EventDispatcher.prototype.dispatchEvent},addEventListener:function(a,b){void 0===this._listeners&&(this._listeners={});var c=this._listeners;void 0===c[a]&&(c[a]=[]);-1===c[a].indexOf(b)&&
c[a].push(b)},hasEventListener:function(a,b){if(void 0===this._listeners)return!1;var c=this._listeners;return void 0!==c[a]&&-1!==c[a].indexOf(b)?!0:!1},removeEventListener:function(a,b){if(void 0!==this._listeners){var c=this._listeners,d=c[a].indexOf(b);-1!==d&&c[a].splice(d,1)}},dispatchEvent:function(){var a=[];return function(b){if(void 0!==this._listeners){var c=this._listeners[b.type];if(void 0!==c){b.target=this;for(var d=c.length,e=0;e<d;e++)a[e]=c[e];for(e=0;e<d;e++)a[e].call(this,b)}}}}()};(function(a){a.Raycaster=function(b,c,d,e){this.ray=new a.Ray(b,c);this.near=d||0;this.far=e||Infinity};var b=new a.Sphere,c=new a.Ray;new a.Plane;new a.Vector3;var d=new a.Vector3,e=new a.Matrix4,f=function(a,b){return a.distance-b.distance},h=new a.Vector3,g=new a.Vector3,i=new a.Vector3,k=function(f,m,t){if(f instanceof a.Sprite){d.getPositionFromMatrix(f.matrixWorld);var s=m.ray.distanceToPoint(d);if(s>f.scale.x)return t;t.push({distance:s,point:f.position,face:null,object:f})}else if(f instanceof
a.LOD)d.getPositionFromMatrix(f.matrixWorld),s=m.ray.origin.distanceTo(d),k(f.getObjectForDistance(s),m,t);else if(f instanceof a.Mesh){var q=f.geometry;null===q.boundingSphere&&q.computeBoundingSphere();b.copy(q.boundingSphere);b.applyMatrix4(f.matrixWorld);if(!1===m.ray.isIntersectionSphere(b))return t;e.getInverse(f.matrixWorld);c.copy(m.ray).applyMatrix4(e);if(null!==q.boundingBox&&!1===c.isIntersectionBox(q.boundingBox))return t;if(q instanceof a.BufferGeometry){var n=f.material;if(void 0===
n||!1===q.dynamic)return t;var u,r,v=m.precision;if(void 0!==q.attributes.index)for(var z=q.offsets,G=q.attributes.index.array,w=q.attributes.position.array,y=q.offsets.length,E=q.attributes.index.array.length/3,E=0;E<y;++E)for(var s=z[E].start,A=z[E].index,q=s,K=s+z[E].count;q<K;q+=3)s=A+G[q],u=A+G[q+1],r=A+G[q+2],h.set(w[3*s],w[3*s+1],w[3*s+2]),g.set(w[3*u],w[3*u+1],w[3*u+2]),i.set(w[3*r],w[3*r+1],w[3*r+2]),u=n.side===a.BackSide?c.intersectTriangle(i,g,h,!0):c.intersectTriangle(h,g,i,n.side!==a.DoubleSide),
null!==u&&(u.applyMatrix4(f.matrixWorld),s=m.ray.origin.distanceTo(u),s<v||(s<m.near||s>m.far)||t.push({distance:s,point:u,face:null,faceIndex:null,object:f}));else{w=q.attributes.position.array;E=q.attributes.position.array.length;for(q=0;q<E;q+=3)s=q,u=q+1,r=q+2,h.set(w[3*s],w[3*s+1],w[3*s+2]),g.set(w[3*u],w[3*u+1],w[3*u+2]),i.set(w[3*r],w[3*r+1],w[3*r+2]),u=n.side===a.BackSide?c.intersectTriangle(i,g,h,!0):c.intersectTriangle(h,g,i,n.side!==a.DoubleSide),null!==u&&(u.applyMatrix4(f.matrixWorld),
s=m.ray.origin.distanceTo(u),s<v||(s<m.near||s>m.far)||t.push({distance:s,point:u,face:null,faceIndex:null,object:f}))}}else if(q instanceof a.Geometry){G=f.material instanceof a.MeshFaceMaterial;w=!0===G?f.material.materials:null;v=m.precision;z=q.vertices;y=0;for(E=q.faces.length;y<E;y++)A=q.faces[y],n=!0===G?w[A.materialIndex]:f.material,void 0!==n&&(s=z[A.a],u=z[A.b],r=z[A.c],u=n.side===a.BackSide?c.intersectTriangle(r,u,s,!0):c.intersectTriangle(s,u,r,n.side!==a.DoubleSide),null!==u&&(u.applyMatrix4(f.matrixWorld),
s=m.ray.origin.distanceTo(u),s<v||(s<m.near||s>m.far)||t.push({distance:s,point:u,face:A,faceIndex:y,object:f})))}}else if(f instanceof a.Line){v=m.linePrecision;n=v*v;q=f.geometry;null===q.boundingSphere&&q.computeBoundingSphere();b.copy(q.boundingSphere);b.applyMatrix4(f.matrixWorld);if(!1===m.ray.isIntersectionSphere(b))return t;e.getInverse(f.matrixWorld);c.copy(m.ray).applyMatrix4(e);if(q instanceof a.Geometry){z=q.vertices;v=z.length;u=new a.Vector3;r=new a.Vector3;E=f.type===a.LineStrip?1:
2;for(q=0;q<v-1;q+=E)c.distanceSqToSegment(z[q],z[q+1],r,u)>n||(s=c.origin.distanceTo(r),s<m.near||s>m.far||t.push({distance:s,point:u.clone().applyMatrix4(f.matrixWorld),face:null,faceIndex:null,object:f}))}}},m=function(a,b,c){for(var a=a.getDescendants(),d=0,e=a.length;d<e;d++)k(a[d],b,c)};a.Raycaster.prototype.precision=1E-4;a.Raycaster.prototype.linePrecision=1;a.Raycaster.prototype.set=function(a,b){this.ray.set(a,b)};a.Raycaster.prototype.intersectObject=function(a,b){var c=[];!0===b&&m(a,
this,c);k(a,this,c);c.sort(f);return c};a.Raycaster.prototype.intersectObjects=function(a,b){for(var c=[],d=0,e=a.length;d<e;d++)k(a[d],this,c),!0===b&&m(a[d],this,c);c.sort(f);return c}})(THREE);THREE.Object3D=function(){this.id=THREE.Object3DIdCount++;this.uuid=THREE.Math.generateUUID();this.name="";this.parent=void 0;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this._rotation=new THREE.Euler;this._quaternion=new THREE.Quaternion;this.scale=new THREE.Vector3(1,1,1);this._rotation._quaternion=this.quaternion;this._quaternion._euler=this.rotation;this.renderDepth=null;this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;
this.visible=this.matrixWorldNeedsUpdate=this.matrixAutoUpdate=!0;this.receiveShadow=this.castShadow=!1;this.frustumCulled=!0;this.userData={}};
THREE.Object3D.prototype={constructor:THREE.Object3D,get rotation(){return this._rotation},set rotation(a){this._rotation=a;this._rotation._quaternion=this._quaternion;this._quaternion._euler=this._rotation;this._rotation._updateQuaternion()},get quaternion(){return this._quaternion},set quaternion(a){this._quaternion=a;this._quaternion._euler=this._rotation;this._rotation._quaternion=this._quaternion;this._quaternion._updateEuler()},get eulerOrder(){console.warn("DEPRECATED: Object3D's .eulerOrder has been moved to Object3D's .rotation.order.");
return this.rotation.order},set eulerOrder(a){console.warn("DEPRECATED: Object3D's .eulerOrder has been moved to Object3D's .rotation.order.");this.rotation.order=a},get useQuaternion(){console.warn("DEPRECATED: Object3D's .useQuaternion has been removed. The library now uses quaternions by default.")},set useQuaternion(a){console.warn("DEPRECATED: Object3D's .useQuaternion has been removed. The library now uses quaternions by default.")},applyMatrix:function(){var a=new THREE.Matrix4;return function(b){this.matrix.multiplyMatrices(b,
this.matrix);this.position.getPositionFromMatrix(this.matrix);this.scale.getScaleFromMatrix(this.matrix);a.extractRotation(this.matrix);this.quaternion.setFromRotationMatrix(a)}}(),setRotationFromAxisAngle:function(a,b){this.quaternion.setFromAxisAngle(a,b)},setRotationFromEuler:function(a){this.quaternion.setFromEuler(a,!0)},setRotationFromMatrix:function(a){this.quaternion.setFromRotationMatrix(a)},setRotationFromQuaternion:function(a){this.quaternion.copy(a)},rotateOnAxis:function(){var a=new THREE.Quaternion;
return function(b,c){a.setFromAxisAngle(b,c);this.quaternion.multiply(a);return this}}(),rotateX:function(){var a=new THREE.Vector3(1,0,0);return function(b){return this.rotateOnAxis(a,b)}}(),rotateY:function(){var a=new THREE.Vector3(0,1,0);return function(b){return this.rotateOnAxis(a,b)}}(),rotateZ:function(){var a=new THREE.Vector3(0,0,1);return function(b){return this.rotateOnAxis(a,b)}}(),translateOnAxis:function(){var a=new THREE.Vector3;return function(b,c){a.copy(b);a.applyQuaternion(this.quaternion);
this.position.add(a.multiplyScalar(c));return this}}(),translate:function(a,b){console.warn("DEPRECATED: Object3D's .translate() has been removed. Use .translateOnAxis( axis, distance ) instead. Note args have been changed.");return this.translateOnAxis(b,a)},translateX:function(){var a=new THREE.Vector3(1,0,0);return function(b){return this.translateOnAxis(a,b)}}(),translateY:function(){var a=new THREE.Vector3(0,1,0);return function(b){return this.translateOnAxis(a,b)}}(),translateZ:function(){var a=
new THREE.Vector3(0,0,1);return function(b){return this.translateOnAxis(a,b)}}(),localToWorld:function(a){return a.applyMatrix4(this.matrixWorld)},worldToLocal:function(){var a=new THREE.Matrix4;return function(b){return b.applyMatrix4(a.getInverse(this.matrixWorld))}}(),lookAt:function(){var a=new THREE.Matrix4;return function(b){a.lookAt(b,this.position,this.up);this.quaternion.setFromRotationMatrix(a)}}(),add:function(a){if(a===this)console.warn("THREE.Object3D.add: An object can't be added as a child of itself.");
else if(a instanceof THREE.Object3D){void 0!==a.parent&&a.parent.remove(a);a.parent=this;a.dispatchEvent({type:"added"});this.children.push(a);for(var b=this;void 0!==b.parent;)b=b.parent;void 0!==b&&b instanceof THREE.Scene&&b.__addObject(a)}},remove:function(a){var b=this.children.indexOf(a);if(-1!==b){a.parent=void 0;a.dispatchEvent({type:"removed"});this.children.splice(b,1);for(b=this;void 0!==b.parent;)b=b.parent;void 0!==b&&b instanceof THREE.Scene&&b.__removeObject(a)}},traverse:function(a){a(this);
for(var b=0,c=this.children.length;b<c;b++)this.children[b].traverse(a)},getObjectById:function(a,b){for(var c=0,d=this.children.length;c<d;c++){var e=this.children[c];if(e.id===a||!0===b&&(e=e.getObjectById(a,b),void 0!==e))return e}},getObjectByName:function(a,b){for(var c=0,d=this.children.length;c<d;c++){var e=this.children[c];if(e.name===a||!0===b&&(e=e.getObjectByName(a,b),void 0!==e))return e}},getChildByName:function(a,b){console.warn("DEPRECATED: Object3D's .getChildByName() has been renamed to .getObjectByName().");
return this.getObjectByName(a,b)},getDescendants:function(a){void 0===a&&(a=[]);Array.prototype.push.apply(a,this.children);for(var b=0,c=this.children.length;b<c;b++)this.children[b].getDescendants(a);return a},updateMatrix:function(){this.matrix.compose(this.position,this.quaternion,this.scale);this.matrixWorldNeedsUpdate=!0},updateMatrixWorld:function(a){!0===this.matrixAutoUpdate&&this.updateMatrix();if(!0===this.matrixWorldNeedsUpdate||!0===a)void 0===this.parent?this.matrixWorld.copy(this.matrix):
this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,a=!0;for(var b=0,c=this.children.length;b<c;b++)this.children[b].updateMatrixWorld(a)},clone:function(a,b){void 0===a&&(a=new THREE.Object3D);void 0===b&&(b=!0);a.name=this.name;a.up.copy(this.up);a.position.copy(this.position);a.quaternion.copy(this.quaternion);a.scale.copy(this.scale);a.renderDepth=this.renderDepth;a.rotationAutoUpdate=this.rotationAutoUpdate;a.matrix.copy(this.matrix);a.matrixWorld.copy(this.matrixWorld);
a.matrixAutoUpdate=this.matrixAutoUpdate;a.matrixWorldNeedsUpdate=this.matrixWorldNeedsUpdate;a.visible=this.visible;a.castShadow=this.castShadow;a.receiveShadow=this.receiveShadow;a.frustumCulled=this.frustumCulled;a.userData=JSON.parse(JSON.stringify(this.userData));if(!0===b)for(var c=0;c<this.children.length;c++)a.add(this.children[c].clone());return a}};THREE.EventDispatcher.prototype.apply(THREE.Object3D.prototype);THREE.Object3DIdCount=0;THREE.Projector=function(){function a(){if(i===m){var a=new THREE.RenderableVertex;k.push(a);m++;i++;return a}return k[i++]}function b(a,b){return a.z!==b.z?b.z-a.z:a.id!==b.id?a.id-b.id:0}function c(a,b){var c=0,d=1,e=a.z+a.w,f=b.z+b.w,h=-a.z+a.w,g=-b.z+b.w;if(0<=e&&0<=f&&0<=h&&0<=g)return!0;if(0>e&&0>f||0>h&&0>g)return!1;0>e?c=Math.max(c,e/(e-f)):0>f&&(d=Math.min(d,e/(e-f)));0>h?c=Math.max(c,h/(h-g)):0>g&&(d=Math.min(d,h/(h-g)));if(d<c)return!1;a.lerp(b,c);b.lerp(a,1-d);return!0}var d,e,f=[],h=
0,g,i,k=[],m=0,l,p,t=[],s=0,q,n,u=[],r=0,v,z,G=[],w=0,y={objects:[],sprites:[],lights:[],elements:[]},E=new THREE.Vector3,A=new THREE.Vector4,K=new THREE.Box3(new THREE.Vector3(-1,-1,-1),new THREE.Vector3(1,1,1)),D=new THREE.Box3,F=Array(3),O=new THREE.Matrix4,x=new THREE.Matrix4,I,B=new THREE.Matrix4,M=new THREE.Matrix3,J=new THREE.Matrix3,ca=new THREE.Vector3,na=new THREE.Frustum,pa=new THREE.Vector4,C=new THREE.Vector4;this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);
x.multiplyMatrices(b.projectionMatrix,b.matrixWorldInverse);return a.applyProjection(x)};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);x.multiplyMatrices(b.matrixWorld,b.projectionMatrixInverse);return a.applyProjection(x)};this.pickingRay=function(a,b){a.z=-1;var c=new THREE.Vector3(a.x,a.y,1);this.unprojectVector(a,b);this.unprojectVector(c,b);c.sub(a).normalize();return new THREE.Raycaster(a,c)};var Q=function(a){if(e===h){var b=new THREE.RenderableObject;
f.push(b);h++;e++;d=b}else d=f[e++];d.id=a.id;d.object=a;null!==a.renderDepth?d.z=a.renderDepth:(E.getPositionFromMatrix(a.matrixWorld),E.applyProjection(x),d.z=E.z);return d},R=function(a){if(!1!==a.visible){a instanceof THREE.Light?y.lights.push(a):a instanceof THREE.Mesh||a instanceof THREE.Line?(!1===a.frustumCulled||!0===na.intersectsObject(a))&&y.objects.push(Q(a)):a instanceof THREE.Sprite&&y.sprites.push(Q(a));for(var b=0,c=a.children.length;b<c;b++)R(a.children[b])}};this.projectScene=function(d,
f,h,m){var E=!1,Q,$,ea,V,P,Y,U,ja,sa,ha,Ka,Ga;z=n=p=0;y.elements.length=0;!0===d.autoUpdate&&d.updateMatrixWorld();void 0===f.parent&&f.updateMatrixWorld();O.copy(f.matrixWorldInverse.getInverse(f.matrixWorld));x.multiplyMatrices(f.projectionMatrix,O);J.getNormalMatrix(O);na.setFromMatrix(x);e=0;y.objects.length=0;y.sprites.length=0;y.lights.length=0;R(d);!0===h&&y.objects.sort(b);d=0;for(h=y.objects.length;d<h;d++)if(U=y.objects[d].object,I=U.matrixWorld,i=0,U instanceof THREE.Mesh){ja=U.geometry;
ea=ja.vertices;sa=ja.faces;ja=ja.faceVertexUvs;M.getNormalMatrix(I);Ka=U.material instanceof THREE.MeshFaceMaterial;Ga=!0===Ka?U.material:null;Q=0;for($=ea.length;Q<$;Q++){g=a();g.positionWorld.copy(ea[Q]).applyMatrix4(I);g.positionScreen.copy(g.positionWorld).applyMatrix4(x);var ka=1/g.positionScreen.w;g.positionScreen.x*=ka;g.positionScreen.y*=ka;g.positionScreen.z*=ka;g.visible=!(-1>g.positionScreen.x||1<g.positionScreen.x||-1>g.positionScreen.y||1<g.positionScreen.y||-1>g.positionScreen.z||1<
g.positionScreen.z)}ea=0;for(Q=sa.length;ea<Q;ea++)if($=sa[ea],ka=!0===Ka?Ga.materials[$.materialIndex]:U.material,void 0!==ka&&(Y=ka.side,V=k[$.a],P=k[$.b],ha=k[$.c],F[0]=V.positionScreen,F[1]=P.positionScreen,F[2]=ha.positionScreen,!0===V.visible||!0===P.visible||!0===ha.visible||K.isIntersectionBox(D.setFromPoints(F))))if(E=0>(ha.positionScreen.x-V.positionScreen.x)*(P.positionScreen.y-V.positionScreen.y)-(ha.positionScreen.y-V.positionScreen.y)*(P.positionScreen.x-V.positionScreen.x),Y===THREE.DoubleSide||
E===(Y===THREE.FrontSide)){if(p===s){var Da=new THREE.RenderableFace3;t.push(Da);s++;p++;l=Da}else l=t[p++];l.id=U.id;l.v1.copy(V);l.v2.copy(P);l.v3.copy(ha);l.normalModel.copy($.normal);!1===E&&(Y===THREE.BackSide||Y===THREE.DoubleSide)&&l.normalModel.negate();l.normalModel.applyMatrix3(M).normalize();l.normalModelView.copy(l.normalModel).applyMatrix3(J);l.centroidModel.copy($.centroid).applyMatrix4(I);ha=$.vertexNormals;V=0;for(P=Math.min(ha.length,3);V<P;V++)Da=l.vertexNormalsModel[V],Da.copy(ha[V]),
!1===E&&(Y===THREE.BackSide||Y===THREE.DoubleSide)&&Da.negate(),Da.applyMatrix3(M).normalize(),l.vertexNormalsModelView[V].copy(Da).applyMatrix3(J);l.vertexNormalsLength=ha.length;E=0;for(V=Math.min(ja.length,3);E<V;E++)if(ha=ja[E][ea],void 0!==ha){P=0;for(Y=ha.length;P<Y;P++)l.uvs[E][P]=ha[P]}l.color=$.color;l.material=ka;ca.copy(l.centroidModel).applyProjection(x);l.z=ca.z;y.elements.push(l)}}else if(U instanceof THREE.Line){B.multiplyMatrices(x,I);ea=U.geometry.vertices;V=a();V.positionScreen.copy(ea[0]).applyMatrix4(B);
sa=U.type===THREE.LinePieces?2:1;Q=1;for($=ea.length;Q<$;Q++)V=a(),V.positionScreen.copy(ea[Q]).applyMatrix4(B),0<(Q+1)%sa||(P=k[i-2],pa.copy(V.positionScreen),C.copy(P.positionScreen),!0===c(pa,C)&&(pa.multiplyScalar(1/pa.w),C.multiplyScalar(1/C.w),n===r?(ja=new THREE.RenderableLine,u.push(ja),r++,n++,q=ja):q=u[n++],q.id=U.id,q.v1.positionScreen.copy(pa),q.v2.positionScreen.copy(C),q.z=Math.max(pa.z,C.z),q.material=U.material,U.material.vertexColors===THREE.VertexColors&&(q.vertexColors[0].copy(U.geometry.colors[Q]),
q.vertexColors[1].copy(U.geometry.colors[Q-1])),y.elements.push(q)))}d=0;for(h=y.sprites.length;d<h;d++)U=y.sprites[d].object,I=U.matrixWorld,U instanceof THREE.Sprite&&(A.set(I.elements[12],I.elements[13],I.elements[14],1),A.applyMatrix4(x),ka=1/A.w,A.z*=ka,-1<A.z&&1>A.z&&(z===w?(sa=new THREE.RenderableSprite,G.push(sa),w++,z++,v=sa):v=G[z++],v.id=U.id,v.x=A.x*ka,v.y=A.y*ka,v.z=A.z,v.object=U,v.rotation=U.rotation,v.scale.x=U.scale.x*Math.abs(v.x-(A.x+f.projectionMatrix.elements[0])/(A.w+f.projectionMatrix.elements[12])),
v.scale.y=U.scale.y*Math.abs(v.y-(A.y+f.projectionMatrix.elements[5])/(A.w+f.projectionMatrix.elements[13])),v.material=U.material,y.elements.push(v)));!0===m&&y.elements.sort(b);return y}};THREE.Face3=function(a,b,c,d,e,f){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=e instanceof THREE.Color?e:new THREE.Color;this.vertexColors=e instanceof Array?e:[];this.vertexTangents=[];this.materialIndex=void 0!==f?f:0;this.centroid=new THREE.Vector3};
THREE.Face3.prototype={constructor:THREE.Face3,clone:function(){var a=new THREE.Face3(this.a,this.b,this.c);a.normal.copy(this.normal);a.color.copy(this.color);a.centroid.copy(this.centroid);a.materialIndex=this.materialIndex;var b,c;b=0;for(c=this.vertexNormals.length;b<c;b++)a.vertexNormals[b]=this.vertexNormals[b].clone();b=0;for(c=this.vertexColors.length;b<c;b++)a.vertexColors[b]=this.vertexColors[b].clone();b=0;for(c=this.vertexTangents.length;b<c;b++)a.vertexTangents[b]=this.vertexTangents[b].clone();
return a}};THREE.Face4=function(a,b,c,d,e,f,h){console.warn("THREE.Face4 has been removed. A THREE.Face3 will be created instead.");return new THREE.Face3(a,b,c,e,f,h)};THREE.Geometry=function(){this.id=THREE.GeometryIdCount++;this.uuid=THREE.Math.generateUUID();this.name="";this.vertices=[];this.colors=[];this.faces=[];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.morphNormals=[];this.skinWeights=[];this.skinIndices=[];this.lineDistances=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1;this.dynamic=!0;this.buffersNeedUpdate=this.lineDistancesNeedUpdate=this.colorsNeedUpdate=this.tangentsNeedUpdate=this.normalsNeedUpdate=this.uvsNeedUpdate=
this.elementsNeedUpdate=this.verticesNeedUpdate=!1};
THREE.Geometry.prototype={constructor:THREE.Geometry,applyMatrix:function(a){for(var b=(new THREE.Matrix3).getNormalMatrix(a),c=0,d=this.vertices.length;c<d;c++)this.vertices[c].applyMatrix4(a);c=0;for(d=this.faces.length;c<d;c++){var e=this.faces[c];e.normal.applyMatrix3(b).normalize();for(var f=0,h=e.vertexNormals.length;f<h;f++)e.vertexNormals[f].applyMatrix3(b).normalize();e.centroid.applyMatrix4(a)}this.boundingBox instanceof THREE.Box3&&this.computeBoundingBox();this.boundingSphere instanceof
THREE.Sphere&&this.computeBoundingSphere()},computeCentroids:function(){var a,b,c;a=0;for(b=this.faces.length;a<b;a++)c=this.faces[a],c.centroid.set(0,0,0),c.centroid.add(this.vertices[c.a]),c.centroid.add(this.vertices[c.b]),c.centroid.add(this.vertices[c.c]),c.centroid.divideScalar(3)},computeFaceNormals:function(){for(var a=new THREE.Vector3,b=new THREE.Vector3,c=0,d=this.faces.length;c<d;c++){var e=this.faces[c],f=this.vertices[e.a],h=this.vertices[e.b];a.subVectors(this.vertices[e.c],h);b.subVectors(f,
h);a.cross(b);a.normalize();e.normal.copy(a)}},computeVertexNormals:function(a){var b,c,d,e;if(void 0===this.__tmpVertices){e=this.__tmpVertices=Array(this.vertices.length);b=0;for(c=this.vertices.length;b<c;b++)e[b]=new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)d=this.faces[b],d.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}else{e=this.__tmpVertices;b=0;for(c=this.vertices.length;b<c;b++)e[b].set(0,0,0)}if(a){var f,h,g=new THREE.Vector3,i=new THREE.Vector3;new THREE.Vector3;
new THREE.Vector3;new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)d=this.faces[b],a=this.vertices[d.a],f=this.vertices[d.b],h=this.vertices[d.c],g.subVectors(h,f),i.subVectors(a,f),g.cross(i),e[d.a].add(g),e[d.b].add(g),e[d.c].add(g)}else{b=0;for(c=this.faces.length;b<c;b++)d=this.faces[b],e[d.a].add(d.normal),e[d.b].add(d.normal),e[d.c].add(d.normal)}b=0;for(c=this.vertices.length;b<c;b++)e[b].normalize();b=0;for(c=this.faces.length;b<c;b++)d=this.faces[b],d.vertexNormals[0].copy(e[d.a]),d.vertexNormals[1].copy(e[d.b]),
d.vertexNormals[2].copy(e[d.c])},computeMorphNormals:function(){var a,b,c,d,e;c=0;for(d=this.faces.length;c<d;c++){e=this.faces[c];e.__originalFaceNormal?e.__originalFaceNormal.copy(e.normal):e.__originalFaceNormal=e.normal.clone();e.__originalVertexNormals||(e.__originalVertexNormals=[]);a=0;for(b=e.vertexNormals.length;a<b;a++)e.__originalVertexNormals[a]?e.__originalVertexNormals[a].copy(e.vertexNormals[a]):e.__originalVertexNormals[a]=e.vertexNormals[a].clone()}var f=new THREE.Geometry;f.faces=
this.faces;a=0;for(b=this.morphTargets.length;a<b;a++){if(!this.morphNormals[a]){this.morphNormals[a]={};this.morphNormals[a].faceNormals=[];this.morphNormals[a].vertexNormals=[];e=this.morphNormals[a].faceNormals;var h=this.morphNormals[a].vertexNormals,g,i;c=0;for(d=this.faces.length;c<d;c++)g=new THREE.Vector3,i={a:new THREE.Vector3,b:new THREE.Vector3,c:new THREE.Vector3},e.push(g),h.push(i)}h=this.morphNormals[a];f.vertices=this.morphTargets[a].vertices;f.computeFaceNormals();f.computeVertexNormals();
c=0;for(d=this.faces.length;c<d;c++)e=this.faces[c],g=h.faceNormals[c],i=h.vertexNormals[c],g.copy(e.normal),i.a.copy(e.vertexNormals[0]),i.b.copy(e.vertexNormals[1]),i.c.copy(e.vertexNormals[2])}c=0;for(d=this.faces.length;c<d;c++)e=this.faces[c],e.normal=e.__originalFaceNormal,e.vertexNormals=e.__originalVertexNormals},computeTangents:function(){var a,b,c,d,e,f,h,g,i,k,m,l,p,t,s,q,n,u=[],r=[];c=new THREE.Vector3;var v=new THREE.Vector3,z=new THREE.Vector3,G=new THREE.Vector3,w=new THREE.Vector3;
a=0;for(b=this.vertices.length;a<b;a++)u[a]=new THREE.Vector3,r[a]=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;a++)e=this.faces[a],f=this.faceVertexUvs[0][a],d=e.a,n=e.b,e=e.c,h=this.vertices[d],g=this.vertices[n],i=this.vertices[e],k=f[0],m=f[1],l=f[2],f=g.x-h.x,p=i.x-h.x,t=g.y-h.y,s=i.y-h.y,g=g.z-h.z,h=i.z-h.z,i=m.x-k.x,q=l.x-k.x,m=m.y-k.y,k=l.y-k.y,l=1/(i*k-q*m),c.set((k*f-m*p)*l,(k*t-m*s)*l,(k*g-m*h)*l),v.set((i*p-q*f)*l,(i*s-q*t)*l,(i*h-q*g)*l),u[d].add(c),u[n].add(c),u[e].add(c),r[d].add(v),
r[n].add(v),r[e].add(v);v=["a","b","c","d"];a=0;for(b=this.faces.length;a<b;a++){e=this.faces[a];for(c=0;c<Math.min(e.vertexNormals.length,3);c++)w.copy(e.vertexNormals[c]),d=e[v[c]],n=u[d],z.copy(n),z.sub(w.multiplyScalar(w.dot(n))).normalize(),G.crossVectors(e.vertexNormals[c],n),d=G.dot(r[d]),d=0>d?-1:1,e.vertexTangents[c]=new THREE.Vector4(z.x,z.y,z.z,d)}this.hasTangents=!0},computeLineDistances:function(){for(var a=0,b=this.vertices,c=0,d=b.length;c<d;c++)0<c&&(a+=b[c].distanceTo(b[c-1])),this.lineDistances[c]=
a},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new THREE.Box3);this.boundingBox.setFromPoints(this.vertices)},computeBoundingSphere:function(){null===this.boundingSphere&&(this.boundingSphere=new THREE.Sphere);this.boundingSphere.setFromPoints(this.vertices)},mergeVertices:function(){var a={},b=[],c=[],d,e=Math.pow(10,4),f,h;this.__tmpVertices=void 0;f=0;for(h=this.vertices.length;f<h;f++)d=this.vertices[f],d=Math.round(d.x*e)+"_"+Math.round(d.y*e)+"_"+Math.round(d.z*
e),void 0===a[d]?(a[d]=f,b.push(this.vertices[f]),c[f]=b.length-1):c[f]=c[a[d]];a=[];f=0;for(h=this.faces.length;f<h;f++){e=this.faces[f];e.a=c[e.a];e.b=c[e.b];e.c=c[e.c];e=[e.a,e.b,e.c];for(d=0;3>d;d++)if(e[d]==e[(d+1)%3]){a.push(f);break}}for(f=a.length-1;0<=f;f--){e=a[f];this.faces.splice(e,1);c=0;for(h=this.faceVertexUvs.length;c<h;c++)this.faceVertexUvs[c].splice(e,1)}f=this.vertices.length-b.length;this.vertices=b;return f},clone:function(){for(var a=new THREE.Geometry,b=this.vertices,c=0,d=
b.length;c<d;c++)a.vertices.push(b[c].clone());b=this.faces;c=0;for(d=b.length;c<d;c++)a.faces.push(b[c].clone());b=this.faceVertexUvs[0];c=0;for(d=b.length;c<d;c++){for(var e=b[c],f=[],h=0,g=e.length;h<g;h++)f.push(new THREE.Vector2(e[h].x,e[h].y));a.faceVertexUvs[0].push(f)}return a},dispose:function(){this.dispatchEvent({type:"dispose"})}};THREE.EventDispatcher.prototype.apply(THREE.Geometry.prototype);THREE.GeometryIdCount=0;THREE.BufferGeometry=function(){this.id=THREE.GeometryIdCount++;this.uuid=THREE.Math.generateUUID();this.name="";this.attributes={};this.dynamic=!0;this.offsets=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1;this.morphTargets=[]};
THREE.BufferGeometry.prototype={constructor:THREE.BufferGeometry,addAttribute:function(a,b,c,d){this.attributes[a]={itemSize:d,array:new b(c*d)}},applyMatrix:function(a){var b,c;this.attributes.position&&(b=this.attributes.position.array);this.attributes.normal&&(c=this.attributes.normal.array);void 0!==b&&(a.multiplyVector3Array(b),this.verticesNeedUpdate=!0);void 0!==c&&((new THREE.Matrix3).getNormalMatrix(a).multiplyVector3Array(c),this.normalizeNormals(),this.normalsNeedUpdate=!0)},computeBoundingBox:function(){null===
this.boundingBox&&(this.boundingBox=new THREE.Box3);var a=this.attributes.position.array;if(a){var b=this.boundingBox,c,d,e;3<=a.length&&(b.min.x=b.max.x=a[0],b.min.y=b.max.y=a[1],b.min.z=b.max.z=a[2]);for(var f=3,h=a.length;f<h;f+=3)c=a[f],d=a[f+1],e=a[f+2],c<b.min.x?b.min.x=c:c>b.max.x&&(b.max.x=c),d<b.min.y?b.min.y=d:d>b.max.y&&(b.max.y=d),e<b.min.z?b.min.z=e:e>b.max.z&&(b.max.z=e)}if(void 0===a||0===a.length)this.boundingBox.min.set(0,0,0),this.boundingBox.max.set(0,0,0)},computeBoundingSphere:function(){var a=
new THREE.Box3,b=new THREE.Vector3;return function(){null===this.boundingSphere&&(this.boundingSphere=new THREE.Sphere);var c=this.attributes.position.array;if(c){for(var d=this.boundingSphere.center,e=0,f=c.length;e<f;e+=3)b.set(c[e],c[e+1],c[e+2]),a.addPoint(b);a.center(d);for(var h=0,e=0,f=c.length;e<f;e+=3)b.set(c[e],c[e+1],c[e+2]),h=Math.max(h,d.distanceToSquared(b));this.boundingSphere.radius=Math.sqrt(h)}}}(),computeVertexNormals:function(){if(this.attributes.position){var a,b,c,d;a=this.attributes.position.array.length;
if(void 0===this.attributes.normal)this.attributes.normal={itemSize:3,array:new Float32Array(a)};else{a=0;for(b=this.attributes.normal.array.length;a<b;a++)this.attributes.normal.array[a]=0}var e=this.attributes.position.array,f=this.attributes.normal.array,h,g,i,k,m,l,p=new THREE.Vector3,t=new THREE.Vector3,s=new THREE.Vector3,q=new THREE.Vector3,n=new THREE.Vector3;if(this.attributes.index){var u=this.attributes.index.array,r=this.offsets;c=0;for(d=r.length;c<d;++c){b=r[c].start;h=r[c].count;var v=
r[c].index;a=b;for(b+=h;a<b;a+=3)h=v+u[a],g=v+u[a+1],i=v+u[a+2],k=e[3*h],m=e[3*h+1],l=e[3*h+2],p.set(k,m,l),k=e[3*g],m=e[3*g+1],l=e[3*g+2],t.set(k,m,l),k=e[3*i],m=e[3*i+1],l=e[3*i+2],s.set(k,m,l),q.subVectors(s,t),n.subVectors(p,t),q.cross(n),f[3*h]+=q.x,f[3*h+1]+=q.y,f[3*h+2]+=q.z,f[3*g]+=q.x,f[3*g+1]+=q.y,f[3*g+2]+=q.z,f[3*i]+=q.x,f[3*i+1]+=q.y,f[3*i+2]+=q.z}}else{a=0;for(b=e.length;a<b;a+=9)k=e[a],m=e[a+1],l=e[a+2],p.set(k,m,l),k=e[a+3],m=e[a+4],l=e[a+5],t.set(k,m,l),k=e[a+6],m=e[a+7],l=e[a+8],
s.set(k,m,l),q.subVectors(s,t),n.subVectors(p,t),q.cross(n),f[a]=q.x,f[a+1]=q.y,f[a+2]=q.z,f[a+3]=q.x,f[a+4]=q.y,f[a+5]=q.z,f[a+6]=q.x,f[a+7]=q.y,f[a+8]=q.z}this.normalizeNormals();this.normalsNeedUpdate=!0}},normalizeNormals:function(){for(var a=this.attributes.normal.array,b,c,d,e=0,f=a.length;e<f;e+=3)b=a[e],c=a[e+1],d=a[e+2],b=1/Math.sqrt(b*b+c*c+d*d),a[e]*=b,a[e+1]*=b,a[e+2]*=b},computeTangents:function(){function a(a){na.x=d[3*a];na.y=d[3*a+1];na.z=d[3*a+2];pa.copy(na);Q=g[a];J.copy(Q);J.sub(na.multiplyScalar(na.dot(Q))).normalize();
ca.crossVectors(pa,Q);R=ca.dot(i[a]);C=0>R?-1:1;h[4*a]=J.x;h[4*a+1]=J.y;h[4*a+2]=J.z;h[4*a+3]=C}if(void 0===this.attributes.index||void 0===this.attributes.position||void 0===this.attributes.normal||void 0===this.attributes.uv)console.warn("Missing required attributes (index, position, normal or uv) in BufferGeometry.computeTangents()");else{var b=this.attributes.index.array,c=this.attributes.position.array,d=this.attributes.normal.array,e=this.attributes.uv.array,f=c.length/3;void 0===this.attributes.tangent&&
(this.attributes.tangent={itemSize:4,array:new Float32Array(4*f)});for(var h=this.attributes.tangent.array,g=[],i=[],k=0;k<f;k++)g[k]=new THREE.Vector3,i[k]=new THREE.Vector3;var m,l,p,t,s,q,n,u,r,v,z,G,w,y,E,f=new THREE.Vector3,k=new THREE.Vector3,A,K,D,F,O,x,I,B=this.offsets;D=0;for(F=B.length;D<F;++D){K=B[D].start;O=B[D].count;var M=B[D].index;A=K;for(K+=O;A<K;A+=3)O=M+b[A],x=M+b[A+1],I=M+b[A+2],m=c[3*O],l=c[3*O+1],p=c[3*O+2],t=c[3*x],s=c[3*x+1],q=c[3*x+2],n=c[3*I],u=c[3*I+1],r=c[3*I+2],v=e[2*
O],z=e[2*O+1],G=e[2*x],w=e[2*x+1],y=e[2*I],E=e[2*I+1],t-=m,m=n-m,s-=l,l=u-l,q-=p,p=r-p,G-=v,v=y-v,w-=z,z=E-z,E=1/(G*z-v*w),f.set((z*t-w*m)*E,(z*s-w*l)*E,(z*q-w*p)*E),k.set((G*m-v*t)*E,(G*l-v*s)*E,(G*p-v*q)*E),g[O].add(f),g[x].add(f),g[I].add(f),i[O].add(k),i[x].add(k),i[I].add(k)}var J=new THREE.Vector3,ca=new THREE.Vector3,na=new THREE.Vector3,pa=new THREE.Vector3,C,Q,R;D=0;for(F=B.length;D<F;++D){K=B[D].start;O=B[D].count;M=B[D].index;A=K;for(K+=O;A<K;A+=3)O=M+b[A],x=M+b[A+1],I=M+b[A+2],a(O),a(x),
a(I)}this.tangentsNeedUpdate=this.hasTangents=!0}},clone:function(){var a=new THREE.BufferGeometry,b=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],c;for(c in this.attributes){for(var d=this.attributes[c],e=d.array,f={itemSize:d.itemSize,numItems:d.numItems,array:null},d=0,h=b.length;d<h;d++){var g=b[d];if(e instanceof g){f.array=new g(e);break}}a.attributes[c]=f}d=0;for(h=this.offsets.length;d<h;d++)b=this.offsets[d],a.offsets.push({start:b.start,
index:b.index,count:b.count});return a},dispose:function(){this.dispatchEvent({type:"dispose"})}};THREE.EventDispatcher.prototype.apply(THREE.BufferGeometry.prototype);THREE.Camera=function(){THREE.Object3D.call(this);this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=new THREE.Matrix4;this.projectionMatrixInverse=new THREE.Matrix4};THREE.Camera.prototype=Object.create(THREE.Object3D.prototype);THREE.Camera.prototype.lookAt=function(){var a=new THREE.Matrix4;return function(b){a.lookAt(this.position,b,this.up);this.quaternion.setFromRotationMatrix(a)}}();
THREE.Camera.prototype.clone=function(a){void 0===a&&(a=new THREE.Camera);THREE.Object3D.prototype.clone.call(this,a);a.matrixWorldInverse.copy(this.matrixWorldInverse);a.projectionMatrix.copy(this.projectionMatrix);a.projectionMatrixInverse.copy(this.projectionMatrixInverse);return a};THREE.OrthographicCamera=function(a,b,c,d,e,f){THREE.Camera.call(this);this.left=a;this.right=b;this.top=c;this.bottom=d;this.near=void 0!==e?e:0.1;this.far=void 0!==f?f:2E3;this.updateProjectionMatrix()};THREE.OrthographicCamera.prototype=Object.create(THREE.Camera.prototype);THREE.OrthographicCamera.prototype.updateProjectionMatrix=function(){this.projectionMatrix.makeOrthographic(this.left,this.right,this.top,this.bottom,this.near,this.far)};
THREE.OrthographicCamera.prototype.clone=function(){var a=new THREE.OrthographicCamera;THREE.Camera.prototype.clone.call(this,a);a.left=this.left;a.right=this.right;a.top=this.top;a.bottom=this.bottom;a.near=this.near;a.far=this.far;return a};THREE.PerspectiveCamera=function(a,b,c,d){THREE.Camera.call(this);this.fov=void 0!==a?a:50;this.aspect=void 0!==b?b:1;this.near=void 0!==c?c:0.1;this.far=void 0!==d?d:2E3;this.updateProjectionMatrix()};THREE.PerspectiveCamera.prototype=Object.create(THREE.Camera.prototype);THREE.PerspectiveCamera.prototype.setLens=function(a,b){void 0===b&&(b=24);this.fov=2*THREE.Math.radToDeg(Math.atan(b/(2*a)));this.updateProjectionMatrix()};
THREE.PerspectiveCamera.prototype.setViewOffset=function(a,b,c,d,e,f){this.fullWidth=a;this.fullHeight=b;this.x=c;this.y=d;this.width=e;this.height=f;this.updateProjectionMatrix()};
THREE.PerspectiveCamera.prototype.updateProjectionMatrix=function(){if(this.fullWidth){var a=this.fullWidth/this.fullHeight,b=Math.tan(THREE.Math.degToRad(0.5*this.fov))*this.near,c=-b,d=a*c,a=Math.abs(a*b-d),c=Math.abs(b-c);this.projectionMatrix.makeFrustum(d+this.x*a/this.fullWidth,d+(this.x+this.width)*a/this.fullWidth,b-(this.y+this.height)*c/this.fullHeight,b-this.y*c/this.fullHeight,this.near,this.far)}else this.projectionMatrix.makePerspective(this.fov,this.aspect,this.near,this.far)};
THREE.PerspectiveCamera.prototype.clone=function(){var a=new THREE.PerspectiveCamera;THREE.Camera.prototype.clone.call(this,a);a.fov=this.fov;a.aspect=this.aspect;a.near=this.near;a.far=this.far;return a};THREE.Light=function(a){THREE.Object3D.call(this);this.color=new THREE.Color(a)};THREE.Light.prototype=Object.create(THREE.Object3D.prototype);THREE.Light.prototype.clone=function(a){void 0===a&&(a=new THREE.Light);THREE.Object3D.prototype.clone.call(this,a);a.color.copy(this.color);return a};THREE.AmbientLight=function(a){THREE.Light.call(this,a)};THREE.AmbientLight.prototype=Object.create(THREE.Light.prototype);THREE.AmbientLight.prototype.clone=function(){var a=new THREE.AmbientLight;THREE.Light.prototype.clone.call(this,a);return a};THREE.AreaLight=function(a,b){THREE.Light.call(this,a);this.normal=new THREE.Vector3(0,-1,0);this.right=new THREE.Vector3(1,0,0);this.intensity=void 0!==b?b:1;this.height=this.width=1;this.constantAttenuation=1.5;this.linearAttenuation=0.5;this.quadraticAttenuation=0.1};THREE.AreaLight.prototype=Object.create(THREE.Light.prototype);THREE.DirectionalLight=function(a,b){THREE.Light.call(this,a);this.position.set(0,1,0);this.target=new THREE.Object3D;this.intensity=void 0!==b?b:1;this.onlyShadow=this.castShadow=!1;this.shadowCameraNear=50;this.shadowCameraFar=5E3;this.shadowCameraLeft=-500;this.shadowCameraTop=this.shadowCameraRight=500;this.shadowCameraBottom=-500;this.shadowCameraVisible=!1;this.shadowBias=0;this.shadowDarkness=0.5;this.shadowMapHeight=this.shadowMapWidth=512;this.shadowCascade=!1;this.shadowCascadeOffset=new THREE.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,0.99,0.998];this.shadowCascadeFarZ=[0.99,0.998,1];this.shadowCascadeArray=[];this.shadowMatrix=this.shadowCamera=this.shadowMapSize=this.shadowMap=null};THREE.DirectionalLight.prototype=Object.create(THREE.Light.prototype);
THREE.DirectionalLight.prototype.clone=function(){var a=new THREE.DirectionalLight;THREE.Light.prototype.clone.call(this,a);a.target=this.target.clone();a.intensity=this.intensity;a.castShadow=this.castShadow;a.onlyShadow=this.onlyShadow;return a};THREE.HemisphereLight=function(a,b,c){THREE.Light.call(this,a);this.position.set(0,100,0);this.groundColor=new THREE.Color(b);this.intensity=void 0!==c?c:1};THREE.HemisphereLight.prototype=Object.create(THREE.Light.prototype);THREE.HemisphereLight.prototype.clone=function(){var a=new THREE.HemisphereLight;THREE.Light.prototype.clone.call(this,a);a.groundColor.copy(this.groundColor);a.intensity=this.intensity;return a};THREE.PointLight=function(a,b,c){THREE.Light.call(this,a);this.intensity=void 0!==b?b:1;this.distance=void 0!==c?c:0};THREE.PointLight.prototype=Object.create(THREE.Light.prototype);THREE.PointLight.prototype.clone=function(){var a=new THREE.PointLight;THREE.Light.prototype.clone.call(this,a);a.intensity=this.intensity;a.distance=this.distance;return a};THREE.SpotLight=function(a,b,c,d,e){THREE.Light.call(this,a);this.position.set(0,1,0);this.target=new THREE.Object3D;this.intensity=void 0!==b?b:1;this.distance=void 0!==c?c:0;this.angle=void 0!==d?d:Math.PI/3;this.exponent=void 0!==e?e:10;this.onlyShadow=this.castShadow=!1;this.shadowCameraNear=50;this.shadowCameraFar=5E3;this.shadowCameraFov=50;this.shadowCameraVisible=!1;this.shadowBias=0;this.shadowDarkness=0.5;this.shadowMapHeight=this.shadowMapWidth=512;this.shadowMatrix=this.shadowCamera=this.shadowMapSize=
this.shadowMap=null};THREE.SpotLight.prototype=Object.create(THREE.Light.prototype);THREE.SpotLight.prototype.clone=function(){var a=new THREE.SpotLight;THREE.Light.prototype.clone.call(this,a);a.target=this.target.clone();a.intensity=this.intensity;a.distance=this.distance;a.angle=this.angle;a.exponent=this.exponent;a.castShadow=this.castShadow;a.onlyShadow=this.onlyShadow;return a};THREE.Loader=function(a){this.statusDomElement=(this.showStatus=a)?THREE.Loader.prototype.addStatusElement():null;this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){}};
THREE.Loader.prototype={constructor:THREE.Loader,crossOrigin:"anonymous",addStatusElement:function(){var a=document.createElement("div");a.style.position="absolute";a.style.right="0px";a.style.top="0px";a.style.fontSize="0.8em";a.style.textAlign="left";a.style.background="rgba(0,0,0,0.25)";a.style.color="#fff";a.style.width="120px";a.style.padding="0.5em 0.5em 0.5em 0.5em";a.style.zIndex=1E3;a.innerHTML="Loading ...";return a},updateProgress:function(a){var b="Loaded ",b=a.total?b+((100*a.loaded/
a.total).toFixed(0)+"%"):b+((a.loaded/1E3).toFixed(2)+" KB");this.statusDomElement.innerHTML=b},extractUrlBase:function(a){a=a.split("/");a.pop();return(1>a.length?".":a.join("/"))+"/"},initMaterials:function(a,b){for(var c=[],d=0;d<a.length;++d)c[d]=THREE.Loader.prototype.createMaterial(a[d],b);return c},needsTangents:function(a){for(var b=0,c=a.length;b<c;b++)if(a[b]instanceof THREE.ShaderMaterial)return!0;return!1},createMaterial:function(a,b){function c(a){a=Math.log(a)/Math.LN2;return Math.floor(a)==
a}function d(a){a=Math.log(a)/Math.LN2;return Math.pow(2,Math.round(a))}function e(a,e,f,g,i,k,n){var u=/\.dds$/i.test(f),r=b+"/"+f;if(u){var v=THREE.ImageUtils.loadCompressedTexture(r);a[e]=v}else v=document.createElement("canvas"),a[e]=new THREE.Texture(v);a[e].sourceFile=f;g&&(a[e].repeat.set(g[0],g[1]),1!==g[0]&&(a[e].wrapS=THREE.RepeatWrapping),1!==g[1]&&(a[e].wrapT=THREE.RepeatWrapping));i&&a[e].offset.set(i[0],i[1]);k&&(f={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping},void 0!==
f[k[0]]&&(a[e].wrapS=f[k[0]]),void 0!==f[k[1]]&&(a[e].wrapT=f[k[1]]));n&&(a[e].anisotropy=n);if(!u){var z=a[e],a=new Image;a.onload=function(){if(!c(this.width)||!c(this.height)){var a=d(this.width),b=d(this.height);z.image.width=a;z.image.height=b;z.image.getContext("2d").drawImage(this,0,0,a,b)}else z.image=this;z.needsUpdate=!0};a.crossOrigin=h.crossOrigin;a.src=r}}function f(a){return(255*a[0]<<16)+(255*a[1]<<8)+255*a[2]}var h=this,g="MeshLambertMaterial",i={color:15658734,opacity:1,map:null,
lightMap:null,normalMap:null,bumpMap:null,wireframe:!1};if(a.shading){var k=a.shading.toLowerCase();"phong"===k?g="MeshPhongMaterial":"basic"===k&&(g="MeshBasicMaterial")}void 0!==a.blending&&void 0!==THREE[a.blending]&&(i.blending=THREE[a.blending]);if(void 0!==a.transparent||1>a.opacity)i.transparent=a.transparent;void 0!==a.depthTest&&(i.depthTest=a.depthTest);void 0!==a.depthWrite&&(i.depthWrite=a.depthWrite);void 0!==a.visible&&(i.visible=a.visible);void 0!==a.flipSided&&(i.side=THREE.BackSide);
void 0!==a.doubleSided&&(i.side=THREE.DoubleSide);void 0!==a.wireframe&&(i.wireframe=a.wireframe);void 0!==a.vertexColors&&("face"===a.vertexColors?i.vertexColors=THREE.FaceColors:a.vertexColors&&(i.vertexColors=THREE.VertexColors));a.colorDiffuse?i.color=f(a.colorDiffuse):a.DbgColor&&(i.color=a.DbgColor);a.colorSpecular&&(i.specular=f(a.colorSpecular));a.colorAmbient&&(i.ambient=f(a.colorAmbient));a.transparency&&(i.opacity=a.transparency);a.specularCoef&&(i.shininess=a.specularCoef);a.mapDiffuse&&
b&&e(i,"map",a.mapDiffuse,a.mapDiffuseRepeat,a.mapDiffuseOffset,a.mapDiffuseWrap,a.mapDiffuseAnisotropy);a.mapLight&&b&&e(i,"lightMap",a.mapLight,a.mapLightRepeat,a.mapLightOffset,a.mapLightWrap,a.mapLightAnisotropy);a.mapBump&&b&&e(i,"bumpMap",a.mapBump,a.mapBumpRepeat,a.mapBumpOffset,a.mapBumpWrap,a.mapBumpAnisotropy);a.mapNormal&&b&&e(i,"normalMap",a.mapNormal,a.mapNormalRepeat,a.mapNormalOffset,a.mapNormalWrap,a.mapNormalAnisotropy);a.mapSpecular&&b&&e(i,"specularMap",a.mapSpecular,a.mapSpecularRepeat,
a.mapSpecularOffset,a.mapSpecularWrap,a.mapSpecularAnisotropy);a.mapBumpScale&&(i.bumpScale=a.mapBumpScale);a.mapNormal?(g=THREE.ShaderLib.normalmap,k=THREE.UniformsUtils.clone(g.uniforms),k.tNormal.value=i.normalMap,a.mapNormalFactor&&k.uNormalScale.value.set(a.mapNormalFactor,a.mapNormalFactor),i.map&&(k.tDiffuse.value=i.map,k.enableDiffuse.value=!0),i.specularMap&&(k.tSpecular.value=i.specularMap,k.enableSpecular.value=!0),i.lightMap&&(k.tAO.value=i.lightMap,k.enableAO.value=!0),k.uDiffuseColor.value.setHex(i.color),
k.uSpecularColor.value.setHex(i.specular),k.uAmbientColor.value.setHex(i.ambient),k.uShininess.value=i.shininess,void 0!==i.opacity&&(k.uOpacity.value=i.opacity),g=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,vertexShader:g.vertexShader,uniforms:k,lights:!0,fog:!0}),i.transparent&&(g.transparent=!0)):g=new THREE[g](i);void 0!==a.DbgName&&(g.name=a.DbgName);return g}};THREE.XHRLoader=function(a){this.manager=void 0!==a?a:THREE.DefaultLoadingManager};
THREE.XHRLoader.prototype={constructor:THREE.XHRLoader,load:function(a,b,c,d){var e=this,f=new XMLHttpRequest;void 0!==b&&f.addEventListener("load",function(c){b(c.target.responseText);e.manager.itemEnd(a)},!1);void 0!==c&&f.addEventListener("progress",function(a){c(a)},!1);void 0!==d&&f.addEventListener("error",function(a){d(a)},!1);void 0!==this.crossOrigin&&(f.crossOrigin=this.crossOrigin);f.open("GET",a,!0);f.send(null);e.manager.itemStart(a)},setCrossOrigin:function(a){this.crossOrigin=a}};THREE.ImageLoader=function(a){this.manager=void 0!==a?a:THREE.DefaultLoadingManager};
THREE.ImageLoader.prototype={constructor:THREE.ImageLoader,load:function(a,b,c,d){var e=this,f=document.createElement("img");void 0!==b&&f.addEventListener("load",function(){e.manager.itemEnd(a);b(this)},!1);void 0!==c&&f.addEventListener("progress",function(a){c(a)},!1);void 0!==d&&f.addEventListener("error",function(a){d(a)},!1);void 0!==this.crossOrigin&&(f.crossOrigin=this.crossOrigin);f.src=a;e.manager.itemStart(a);return f},setCrossOrigin:function(a){this.crossOrigin=a}};THREE.JSONLoader=function(a){THREE.Loader.call(this,a);this.withCredentials=!1};THREE.JSONLoader.prototype=Object.create(THREE.Loader.prototype);THREE.JSONLoader.prototype.load=function(a,b,c){c=c&&"string"===typeof c?c:this.extractUrlBase(a);this.onLoadStart();this.loadAjaxJSON(this,a,b,c)};
THREE.JSONLoader.prototype.loadAjaxJSON=function(a,b,c,d,e){var f=new XMLHttpRequest,h=0;f.onreadystatechange=function(){if(f.readyState===f.DONE)if(200===f.status||0===f.status){if(f.responseText){var g=JSON.parse(f.responseText),g=a.parse(g,d);c(g.geometry,g.materials)}else console.warn("THREE.JSONLoader: ["+b+"] seems to be unreachable or file there is empty");a.onLoadComplete()}else console.error("THREE.JSONLoader: Couldn't load ["+b+"] ["+f.status+"]");else f.readyState===f.LOADING?e&&(0===h&&
(h=f.getResponseHeader("Content-Length")),e({total:h,loaded:f.responseText.length})):f.readyState===f.HEADERS_RECEIVED&&void 0!==e&&(h=f.getResponseHeader("Content-Length"))};f.open("GET",b,!0);f.withCredentials=this.withCredentials;f.send(null)};
THREE.JSONLoader.prototype.parse=function(a,b){var c=new THREE.Geometry,d=void 0!==a.scale?1/a.scale:1,e,f,h,g,i,k,m,l,p,t,s,q,n,u,r=a.faces;p=a.vertices;var v=a.normals,z=a.colors,G=0;if(void 0!==a.uvs){for(e=0;e<a.uvs.length;e++)a.uvs[e].length&&G++;for(e=0;e<G;e++)c.faceVertexUvs[e]=[]}g=0;for(i=p.length;g<i;)k=new THREE.Vector3,k.x=p[g++]*d,k.y=p[g++]*d,k.z=p[g++]*d,c.vertices.push(k);g=0;for(i=r.length;g<i;)if(p=r[g++],t=p&1,h=p&2,e=p&8,m=p&16,s=p&32,k=p&64,p&=128,t){t=new THREE.Face3;t.a=r[g];
t.b=r[g+1];t.c=r[g+3];q=new THREE.Face3;q.a=r[g+1];q.b=r[g+2];q.c=r[g+3];g+=4;h&&(h=r[g++],t.materialIndex=h,q.materialIndex=h);h=c.faces.length;if(e)for(e=0;e<G;e++){n=a.uvs[e];c.faceVertexUvs[e][h]=[];c.faceVertexUvs[e][h+1]=[];for(f=0;4>f;f++)l=r[g++],u=n[2*l],l=n[2*l+1],u=new THREE.Vector2(u,l),2!==f&&c.faceVertexUvs[e][h].push(u),0!==f&&c.faceVertexUvs[e][h+1].push(u)}m&&(m=3*r[g++],t.normal.set(v[m++],v[m++],v[m]),q.normal.copy(t.normal));if(s)for(e=0;4>e;e++)m=3*r[g++],s=new THREE.Vector3(v[m++],
v[m++],v[m]),2!==e&&t.vertexNormals.push(s),0!==e&&q.vertexNormals.push(s);k&&(k=r[g++],k=z[k],t.color.setHex(k),q.color.setHex(k));if(p)for(e=0;4>e;e++)k=r[g++],k=z[k],2!==e&&t.vertexColors.push(new THREE.Color(k)),0!==e&&q.vertexColors.push(new THREE.Color(k));c.faces.push(t);c.faces.push(q)}else{t=new THREE.Face3;t.a=r[g++];t.b=r[g++];t.c=r[g++];h&&(h=r[g++],t.materialIndex=h);h=c.faces.length;if(e)for(e=0;e<G;e++){n=a.uvs[e];c.faceVertexUvs[e][h]=[];for(f=0;3>f;f++)l=r[g++],u=n[2*l],l=n[2*l+1],
u=new THREE.Vector2(u,l),c.faceVertexUvs[e][h].push(u)}m&&(m=3*r[g++],t.normal.set(v[m++],v[m++],v[m]));if(s)for(e=0;3>e;e++)m=3*r[g++],s=new THREE.Vector3(v[m++],v[m++],v[m]),t.vertexNormals.push(s);k&&(k=r[g++],t.color.setHex(z[k]));if(p)for(e=0;3>e;e++)k=r[g++],t.vertexColors.push(new THREE.Color(z[k]));c.faces.push(t)}if(a.skinWeights){g=0;for(i=a.skinWeights.length;g<i;g+=2)r=a.skinWeights[g],v=a.skinWeights[g+1],c.skinWeights.push(new THREE.Vector4(r,v,0,0))}if(a.skinIndices){g=0;for(i=a.skinIndices.length;g<
i;g+=2)r=a.skinIndices[g],v=a.skinIndices[g+1],c.skinIndices.push(new THREE.Vector4(r,v,0,0))}c.bones=a.bones;c.animation=a.animation;c.animations=a.animations;if(void 0!==a.morphTargets){g=0;for(i=a.morphTargets.length;g<i;g++){c.morphTargets[g]={};c.morphTargets[g].name=a.morphTargets[g].name;c.morphTargets[g].vertices=[];z=c.morphTargets[g].vertices;G=a.morphTargets[g].vertices;r=0;for(v=G.length;r<v;r+=3)p=new THREE.Vector3,p.x=G[r]*d,p.y=G[r+1]*d,p.z=G[r+2]*d,z.push(p)}}if(void 0!==a.morphColors){g=
0;for(i=a.morphColors.length;g<i;g++){c.morphColors[g]={};c.morphColors[g].name=a.morphColors[g].name;c.morphColors[g].colors=[];v=c.morphColors[g].colors;z=a.morphColors[g].colors;d=0;for(r=z.length;d<r;d+=3)G=new THREE.Color(16755200),G.setRGB(z[d],z[d+1],z[d+2]),v.push(G)}}c.computeCentroids();c.computeFaceNormals();c.computeBoundingSphere();if(void 0===a.materials)return{geometry:c};d=this.initMaterials(a.materials,b);this.needsTangents(d)&&c.computeTangents();return{geometry:c,materials:d}};THREE.LoadingManager=function(a,b,c){var d=this,e=0,f=0;this.onLoad=a;this.onProgress=b;this.onError=c;this.itemStart=function(){f++};this.itemEnd=function(a){e++;if(void 0!==d.onProgress)d.onProgress(a,e,f);if(e===f&&void 0!==d.onLoad)d.onLoad()}};THREE.DefaultLoadingManager=new THREE.LoadingManager;THREE.BufferGeometryLoader=function(a){this.manager=void 0!==a?a:THREE.DefaultLoadingManager};
THREE.BufferGeometryLoader.prototype={constructor:THREE.BufferGeometryLoader,load:function(a,b){var c=this,d=new THREE.XHRLoader;d.setCrossOrigin(this.crossOrigin);d.load(a,function(a){b(c.parse(JSON.parse(a)))})},setCrossOrigin:function(a){this.crossOrigin=a},parse:function(a){var b=new THREE.BufferGeometry,c=a.attributes,d=a.offsets,a=a.boundingSphere,e;for(e in c){var f=c[e];b.attributes[e]={itemSize:f.itemSize,array:new self[f.type](f.array)}}void 0!==d&&(b.offsets=JSON.parse(JSON.stringify(d)));
void 0!==a&&(b.boundingSphere=new THREE.Sphere((new THREE.Vector3).fromArray(void 0!==a.center?a.center:[0,0,0]),a.radius));return b}};THREE.GeometryLoader=function(a){this.manager=void 0!==a?a:THREE.DefaultLoadingManager};THREE.GeometryLoader.prototype={constructor:THREE.GeometryLoader,load:function(a,b){var c=this,d=new THREE.XHRLoader;d.setCrossOrigin(this.crossOrigin);d.load(a,function(a){b(c.parse(JSON.parse(a)))})},setCrossOrigin:function(a){this.crossOrigin=a},parse:function(){}};THREE.MaterialLoader=function(a){this.manager=void 0!==a?a:THREE.DefaultLoadingManager};
THREE.MaterialLoader.prototype={constructor:THREE.MaterialLoader,load:function(a,b){var c=this,d=new THREE.XHRLoader;d.setCrossOrigin(this.crossOrigin);d.load(a,function(a){b(c.parse(JSON.parse(a)))})},setCrossOrigin:function(a){this.crossOrigin=a},parse:function(a){var b=new THREE[a.type];void 0!==a.color&&b.color.setHex(a.color);void 0!==a.ambient&&b.ambient.setHex(a.ambient);void 0!==a.emissive&&b.emissive.setHex(a.emissive);void 0!==a.specular&&b.specular.setHex(a.specular);void 0!==a.shininess&&
(b.shininess=a.shininess);void 0!==a.vertexColors&&(b.vertexColors=a.vertexColors);void 0!==a.blending&&(b.blending=a.blending);void 0!==a.side&&(b.side=a.side);void 0!==a.opacity&&(b.opacity=a.opacity);void 0!==a.transparent&&(b.transparent=a.transparent);void 0!==a.wireframe&&(b.wireframe=a.wireframe);if(void 0!==a.materials)for(var c=0,d=a.materials.length;c<d;c++)b.materials.push(this.parse(a.materials[c]));return b}};THREE.ObjectLoader=function(a){this.manager=void 0!==a?a:THREE.DefaultLoadingManager};
THREE.ObjectLoader.prototype={constructor:THREE.ObjectLoader,load:function(a,b){var c=this,d=new THREE.XHRLoader(c.manager);d.setCrossOrigin(this.crossOrigin);d.load(a,function(a){b(c.parse(JSON.parse(a)))})},setCrossOrigin:function(a){this.crossOrigin=a},parse:function(a){var b=this.parseGeometries(a.geometries),c=this.parseMaterials(a.materials);return this.parseObject(a.object,b,c)},parseGeometries:function(a){var b={};if(void 0!==a)for(var c=new THREE.JSONLoader,d=new THREE.BufferGeometryLoader,
e=0,f=a.length;e<f;e++){var h,g=a[e];switch(g.type){case "PlaneGeometry":h=new THREE.PlaneGeometry(g.width,g.height,g.widthSegments,g.heightSegments);break;case "CircleGeometry":h=new THREE.CircleGeometry(g.radius,g.segments);break;case "CubeGeometry":h=new THREE.CubeGeometry(g.width,g.height,g.depth,g.widthSegments,g.heightSegments,g.depthSegments);break;case "CylinderGeometry":h=new THREE.CylinderGeometry(g.radiusTop,g.radiusBottom,g.height,g.radialSegments,g.heightSegments,g.openEnded);break;case "SphereGeometry":h=
new THREE.SphereGeometry(g.radius,g.widthSegments,g.heightSegments,g.phiStart,g.phiLength,g.thetaStart,g.thetaLength);break;case "IcosahedronGeometry":h=new THREE.IcosahedronGeometry(g.radius,g.detail);break;case "TorusGeometry":h=new THREE.TorusGeometry(g.radius,g.tube,g.radialSegments,g.tubularSegments,g.arc);break;case "TorusKnotGeometry":h=new THREE.TorusKnotGeometry(g.radius,g.tube,g.radialSegments,g.tubularSegments,g.p,g.q,g.heightScale);break;case "BufferGeometry":h=d.parse(g.data);break;case "Geometry":h=
c.parse(g.data).geometry}h.uuid=g.uuid;void 0!==g.name&&(h.name=g.name);b[g.uuid]=h}return b},parseMaterials:function(a){var b={};if(void 0!==a)for(var c=new THREE.MaterialLoader,d=0,e=a.length;d<e;d++){var f=a[d],h=c.parse(f);h.uuid=f.uuid;void 0!==f.name&&(h.name=f.name);b[f.uuid]=h}return b},parseObject:function(){var a=new THREE.Matrix4;return function(b,c,d){var e;switch(b.type){case "Scene":e=new THREE.Scene;break;case "PerspectiveCamera":e=new THREE.PerspectiveCamera(b.fov,b.aspect,b.near,
b.far);break;case "OrthographicCamera":e=new THREE.OrthographicCamera(b.left,b.right,b.top,b.bottom,b.near,b.far);break;case "AmbientLight":e=new THREE.AmbientLight(b.color);break;case "DirectionalLight":e=new THREE.DirectionalLight(b.color,b.intensity);break;case "PointLight":e=new THREE.PointLight(b.color,b.intensity,b.distance);break;case "SpotLight":e=new THREE.SpotLight(b.color,b.intensity,b.distance,b.angle,b.exponent);break;case "HemisphereLight":e=new THREE.HemisphereLight(b.color,b.groundColor,
b.intensity);break;case "Mesh":e=c[b.geometry];var f=d[b.material];void 0===e&&console.error("THREE.ObjectLoader: Undefined geometry "+b.geometry);void 0===f&&console.error("THREE.ObjectLoader: Undefined material "+b.material);e=new THREE.Mesh(e,f);break;case "Sprite":f=d[b.material];void 0===f&&console.error("THREE.ObjectLoader: Undefined material "+b.material);e=new THREE.Sprite(f);break;default:e=new THREE.Object3D}e.uuid=b.uuid;void 0!==b.name&&(e.name=b.name);void 0!==b.matrix?(a.fromArray(b.matrix),
a.decompose(e.position,e.quaternion,e.scale)):(void 0!==b.position&&e.position.fromArray(b.position),void 0!==b.rotation&&e.rotation.fromArray(b.rotation),void 0!==b.scale&&e.scale.fromArray(b.scale));void 0!==b.visible&&(e.visible=b.visible);void 0!==b.userData&&(e.userData=b.userData);if(void 0!==b.children)for(var h in b.children)e.add(this.parseObject(b.children[h],c,d));return e}}()};THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){};this.geometryHandlers={};this.hierarchyHandlers={};this.addGeometryHandler("ascii",THREE.JSONLoader)};
THREE.SceneLoader.prototype={constructor:THREE.SceneLoader,load:function(a,b){var c=this,d=new THREE.XHRLoader(c.manager);d.setCrossOrigin(this.crossOrigin);d.load(a,function(d){c.parse(JSON.parse(d),b,a)})},setCrossOrigin:function(a){this.crossOrigin=a},addGeometryHandler:function(a,b){this.geometryHandlers[a]={loaderClass:b}},addHierarchyHandler:function(a,b){this.hierarchyHandlers[a]={loaderClass:b}},parse:function(a,b,c){function d(a,b){return"relativeToHTML"==b?a:p+"/"+a}function e(){f(y.scene,
A.objects)}function f(a,b){var c,e,h,i,k,m;for(m in b){var p=y.objects[m],n=b[m];if(void 0===p){if(n.type&&n.type in l.hierarchyHandlers){if(void 0===n.loading){c={type:1,url:1,material:1,position:1,rotation:1,scale:1,visible:1,children:1,userData:1,skin:1,morph:1,mirroredLoop:1,duration:1};var u={},v;for(v in n)v in c||(u[v]=n[v]);s=y.materials[n.material];n.loading=!0;c=l.hierarchyHandlers[n.type].loaderObject;c.options?c.load(d(n.url,A.urlBaseType),g(m,a,s,n)):c.load(d(n.url,A.urlBaseType),g(m,
a,s,n),u)}}else if(void 0!==n.geometry){if(t=y.geometries[n.geometry]){p=!1;s=y.materials[n.material];p=s instanceof THREE.ShaderMaterial;e=n.position;h=n.rotation;i=n.scale;c=n.matrix;k=n.quaternion;n.material||(s=new THREE.MeshFaceMaterial(y.face_materials[n.geometry]));s instanceof THREE.MeshFaceMaterial&&0===s.materials.length&&(s=new THREE.MeshFaceMaterial(y.face_materials[n.geometry]));if(s instanceof THREE.MeshFaceMaterial)for(u=0;u<s.materials.length;u++)p=p||s.materials[u]instanceof THREE.ShaderMaterial;
p&&t.computeTangents();n.skin?p=new THREE.SkinnedMesh(t,s):n.morph?(p=new THREE.MorphAnimMesh(t,s),void 0!==n.duration&&(p.duration=n.duration),void 0!==n.time&&(p.time=n.time),void 0!==n.mirroredLoop&&(p.mirroredLoop=n.mirroredLoop),s.morphNormals&&t.computeMorphNormals()):p=new THREE.Mesh(t,s);p.name=m;c?(p.matrixAutoUpdate=!1,p.matrix.set(c[0],c[1],c[2],c[3],c[4],c[5],c[6],c[7],c[8],c[9],c[10],c[11],c[12],c[13],c[14],c[15])):(p.position.fromArray(e),k?p.quaternion.fromArray(k):p.rotation.fromArray(h),
p.scale.fromArray(i));p.visible=n.visible;p.castShadow=n.castShadow;p.receiveShadow=n.receiveShadow;a.add(p);y.objects[m]=p}}else if("AmbientLight"===n.type||"PointLight"===n.type||"DirectionalLight"===n.type||"SpotLight"===n.type||"HemisphereLight"===n.type||"AreaLight"===n.type){u=n.color;c=n.intensity;e=n.distance;h=n.position;i=n.rotation;switch(n.type){case "AmbientLight":r=new THREE.AmbientLight(u);break;case "PointLight":r=new THREE.PointLight(u,c,e);r.position.fromArray(h);break;case "DirectionalLight":r=
new THREE.DirectionalLight(u,c);r.position.fromArray(n.direction);break;case "SpotLight":r=new THREE.SpotLight(u,c,e,1);r.angle=n.angle;r.position.fromArray(h);r.target.set(h[0],h[1]-e,h[2]);r.target.applyEuler(new THREE.Euler(i[0],i[1],i[2],"XYZ"));break;case "HemisphereLight":r=new THREE.DirectionalLight(u,c,e);r.target.set(h[0],h[1]-e,h[2]);r.target.applyEuler(new THREE.Euler(i[0],i[1],i[2],"XYZ"));break;case "AreaLight":r=new THREE.AreaLight(u,c),r.position.fromArray(h),r.width=n.size,r.height=
n.size_y}a.add(r);r.name=m;y.lights[m]=r;y.objects[m]=r}else"PerspectiveCamera"===n.type||"OrthographicCamera"===n.type?(e=n.position,h=n.rotation,k=n.quaternion,"PerspectiveCamera"===n.type?q=new THREE.PerspectiveCamera(n.fov,n.aspect,n.near,n.far):"OrthographicCamera"===n.type&&(q=new THREE.OrthographicCamera(n.left,n.right,n.top,n.bottom,n.near,n.far)),q.name=m,q.position.fromArray(e),void 0!==k?q.quaternion.fromArray(k):void 0!==h&&q.rotation.fromArray(h),a.add(q),y.cameras[m]=q,y.objects[m]=
q):(e=n.position,h=n.rotation,i=n.scale,k=n.quaternion,p=new THREE.Object3D,p.name=m,p.position.fromArray(e),k?p.quaternion.fromArray(k):p.rotation.fromArray(h),p.scale.fromArray(i),p.visible=void 0!==n.visible?n.visible:!1,a.add(p),y.objects[m]=p,y.empties[m]=p);if(p){if(void 0!==n.userData)for(var z in n.userData)p.userData[z]=n.userData[z];if(void 0!==n.groups)for(u=0;u<n.groups.length;u++)c=n.groups[u],void 0===y.groups[c]&&(y.groups[c]=[]),y.groups[c].push(m)}}void 0!==p&&void 0!==n.children&&
f(p,n.children)}}function h(a){return function(b,c){b.name=a;y.geometries[a]=b;y.face_materials[a]=c;e();v-=1;l.onLoadComplete();k()}}function g(a,b,c,d){return function(f){var f=f.content?f.content:f.dae?f.scene:f,h=d.rotation,g=d.quaternion,i=d.scale;f.position.fromArray(d.position);g?f.quaternion.fromArray(g):f.rotation.fromArray(h);f.scale.fromArray(i);c&&f.traverse(function(a){a.material=c});var m=void 0!==d.visible?d.visible:!0;f.traverse(function(a){a.visible=m});b.add(f);f.name=a;y.objects[a]=
f;e();v-=1;l.onLoadComplete();k()}}function i(a){return function(b,c){b.name=a;y.geometries[a]=b;y.face_materials[a]=c}}function k(){l.callbackProgress({totalModels:G,totalTextures:w,loadedModels:G-v,loadedTextures:w-z},y);l.onLoadProgress();if(0===v&&0===z){for(var a=0;a<E.length;a++){var c=E[a],d=y.objects[c.targetName];d?c.object.target=d:(c.object.target=new THREE.Object3D,y.scene.add(c.object.target));c.object.target.userData.targetInverse=c.object}b(y)}}function m(a,b){b(a);if(void 0!==a.children)for(var c in a.children)m(a.children[c],
b)}var l=this,p=THREE.Loader.prototype.extractUrlBase(c),t,s,q,n,u,r,v,z,G,w,y,E=[],A=a,K;for(K in this.geometryHandlers)a=this.geometryHandlers[K].loaderClass,this.geometryHandlers[K].loaderObject=new a;for(K in this.hierarchyHandlers)a=this.hierarchyHandlers[K].loaderClass,this.hierarchyHandlers[K].loaderObject=new a;z=v=0;y={scene:new THREE.Scene,geometries:{},face_materials:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},empties:{},groups:{}};if(A.transform&&(K=A.transform.position,
a=A.transform.rotation,c=A.transform.scale,K&&y.scene.position.fromArray(K),a&&y.scene.rotation.fromArray(a),c&&y.scene.scale.fromArray(c),K||a||c))y.scene.updateMatrix(),y.scene.updateMatrixWorld();K=function(a){return function(){z-=a;k();l.onLoadComplete()}};for(var D in A.fogs)a=A.fogs[D],"linear"===a.type?n=new THREE.Fog(0,a.near,a.far):"exp2"===a.type&&(n=new THREE.FogExp2(0,a.density)),a=a.color,n.color.setRGB(a[0],a[1],a[2]),y.fogs[D]=n;for(var F in A.geometries)n=A.geometries[F],n.type in
this.geometryHandlers&&(v+=1,l.onLoadStart());for(var O in A.objects)m(A.objects[O],function(a){a.type&&a.type in l.hierarchyHandlers&&(v+=1,l.onLoadStart())});G=v;for(F in A.geometries)if(n=A.geometries[F],"cube"===n.type)t=new THREE.CubeGeometry(n.width,n.height,n.depth,n.widthSegments,n.heightSegments,n.depthSegments),t.name=F,y.geometries[F]=t;else if("plane"===n.type)t=new THREE.PlaneGeometry(n.width,n.height,n.widthSegments,n.heightSegments),t.name=F,y.geometries[F]=t;else if("sphere"===n.type)t=
new THREE.SphereGeometry(n.radius,n.widthSegments,n.heightSegments),t.name=F,y.geometries[F]=t;else if("cylinder"===n.type)t=new THREE.CylinderGeometry(n.topRad,n.botRad,n.height,n.radSegs,n.heightSegs),t.name=F,y.geometries[F]=t;else if("torus"===n.type)t=new THREE.TorusGeometry(n.radius,n.tube,n.segmentsR,n.segmentsT),t.name=F,y.geometries[F]=t;else if("icosahedron"===n.type)t=new THREE.IcosahedronGeometry(n.radius,n.subdivisions),t.name=F,y.geometries[F]=t;else if(n.type in this.geometryHandlers){O=
{};for(u in n)"type"!==u&&"url"!==u&&(O[u]=n[u]);this.geometryHandlers[n.type].loaderObject.load(d(n.url,A.urlBaseType),h(F),O)}else"embedded"===n.type&&(O=A.embeds[n.id],O.metadata=A.metadata,O&&(O=this.geometryHandlers.ascii.loaderObject.parse(O,""),i(F)(O.geometry,O.materials)));for(var x in A.textures)if(F=A.textures[x],F.url instanceof Array){z+=F.url.length;for(u=0;u<F.url.length;u++)l.onLoadStart()}else z+=1,l.onLoadStart();w=z;for(x in A.textures){F=A.textures[x];void 0!==F.mapping&&void 0!==
THREE[F.mapping]&&(F.mapping=new THREE[F.mapping]);if(F.url instanceof Array){O=F.url.length;n=[];for(u=0;u<O;u++)n[u]=d(F.url[u],A.urlBaseType);u=(u=/\.dds$/i.test(n[0]))?THREE.ImageUtils.loadCompressedTextureCube(n,F.mapping,K(O)):THREE.ImageUtils.loadTextureCube(n,F.mapping,K(O))}else u=/\.dds$/i.test(F.url),O=d(F.url,A.urlBaseType),n=K(1),u=u?THREE.ImageUtils.loadCompressedTexture(O,F.mapping,n):THREE.ImageUtils.loadTexture(O,F.mapping,n),void 0!==THREE[F.minFilter]&&(u.minFilter=THREE[F.minFilter]),
void 0!==THREE[F.magFilter]&&(u.magFilter=THREE[F.magFilter]),F.anisotropy&&(u.anisotropy=F.anisotropy),F.repeat&&(u.repeat.set(F.repeat[0],F.repeat[1]),1!==F.repeat[0]&&(u.wrapS=THREE.RepeatWrapping),1!==F.repeat[1]&&(u.wrapT=THREE.RepeatWrapping)),F.offset&&u.offset.set(F.offset[0],F.offset[1]),F.wrap&&(O={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping},void 0!==O[F.wrap[0]]&&(u.wrapS=O[F.wrap[0]]),void 0!==O[F.wrap[1]]&&(u.wrapT=O[F.wrap[1]]));y.textures[x]=u}var I,B;for(I in A.materials){x=
A.materials[I];for(B in x.parameters)"envMap"===B||"map"===B||"lightMap"===B||"bumpMap"===B?x.parameters[B]=y.textures[x.parameters[B]]:"shading"===B?x.parameters[B]="flat"===x.parameters[B]?THREE.FlatShading:THREE.SmoothShading:"side"===B?x.parameters[B]="double"==x.parameters[B]?THREE.DoubleSide:"back"==x.parameters[B]?THREE.BackSide:THREE.FrontSide:"blending"===B?x.parameters[B]=x.parameters[B]in THREE?THREE[x.parameters[B]]:THREE.NormalBlending:"combine"===B?x.parameters[B]=x.parameters[B]in THREE?
THREE[x.parameters[B]]:THREE.MultiplyOperation:"vertexColors"===B?"face"==x.parameters[B]?x.parameters[B]=THREE.FaceColors:x.parameters[B]&&(x.parameters[B]=THREE.VertexColors):"wrapRGB"===B&&(K=x.parameters[B],x.parameters[B]=new THREE.Vector3(K[0],K[1],K[2]));void 0!==x.parameters.opacity&&1>x.parameters.opacity&&(x.parameters.transparent=!0);x.parameters.normalMap?(K=THREE.ShaderLib.normalmap,F=THREE.UniformsUtils.clone(K.uniforms),u=x.parameters.color,O=x.parameters.specular,n=x.parameters.ambient,
D=x.parameters.shininess,F.tNormal.value=y.textures[x.parameters.normalMap],x.parameters.normalScale&&F.uNormalScale.value.set(x.parameters.normalScale[0],x.parameters.normalScale[1]),x.parameters.map&&(F.tDiffuse.value=x.parameters.map,F.enableDiffuse.value=!0),x.parameters.envMap&&(F.tCube.value=x.parameters.envMap,F.enableReflection.value=!0,F.uReflectivity.value=x.parameters.reflectivity),x.parameters.lightMap&&(F.tAO.value=x.parameters.lightMap,F.enableAO.value=!0),x.parameters.specularMap&&
(F.tSpecular.value=y.textures[x.parameters.specularMap],F.enableSpecular.value=!0),x.parameters.displacementMap&&(F.tDisplacement.value=y.textures[x.parameters.displacementMap],F.enableDisplacement.value=!0,F.uDisplacementBias.value=x.parameters.displacementBias,F.uDisplacementScale.value=x.parameters.displacementScale),F.uDiffuseColor.value.setHex(u),F.uSpecularColor.value.setHex(O),F.uAmbientColor.value.setHex(n),F.uShininess.value=D,x.parameters.opacity&&(F.uOpacity.value=x.parameters.opacity),
s=new THREE.ShaderMaterial({fragmentShader:K.fragmentShader,vertexShader:K.vertexShader,uniforms:F,lights:!0,fog:!0})):s=new THREE[x.type](x.parameters);s.name=I;y.materials[I]=s}for(I in A.materials)if(x=A.materials[I],x.parameters.materials){B=[];for(u=0;u<x.parameters.materials.length;u++)B.push(y.materials[x.parameters.materials[u]]);y.materials[I].materials=B}e();y.cameras&&A.defaults.camera&&(y.currentCamera=y.cameras[A.defaults.camera]);y.fogs&&A.defaults.fog&&(y.scene.fog=y.fogs[A.defaults.fog]);
l.callbackSync(y);k()}};THREE.TextureLoader=function(a){this.manager=void 0!==a?a:THREE.DefaultLoadingManager};THREE.TextureLoader.prototype={constructor:THREE.TextureLoader,load:function(a,b){var c=new THREE.ImageLoader(this.manager);c.setCrossOrigin(this.crossOrigin);c.load(a,function(a){a=new THREE.Texture(a);a.needsUpdate=!0;void 0!==b&&b(a)})},setCrossOrigin:function(a){this.crossOrigin=a}};THREE.Material=function(){this.id=THREE.MaterialIdCount++;this.uuid=THREE.Math.generateUUID();this.name="";this.side=THREE.FrontSide;this.opacity=1;this.transparent=!1;this.blending=THREE.NormalBlending;this.blendSrc=THREE.SrcAlphaFactor;this.blendDst=THREE.OneMinusSrcAlphaFactor;this.blendEquation=THREE.AddEquation;this.depthWrite=this.depthTest=!0;this.polygonOffset=!1;this.overdraw=this.alphaTest=this.polygonOffsetUnits=this.polygonOffsetFactor=0;this.needsUpdate=this.visible=!0};
THREE.Material.prototype={constructor:THREE.Material,setValues:function(a){if(void 0!==a)for(var b in a){var c=a[b];if(void 0===c)console.warn("THREE.Material: '"+b+"' parameter is undefined.");else if(b in this){var d=this[b];d instanceof THREE.Color?d.set(c):d instanceof THREE.Vector3&&c instanceof THREE.Vector3?d.copy(c):this[b]="overdraw"==b?Number(c):c}}},clone:function(a){void 0===a&&(a=new THREE.Material);a.name=this.name;a.side=this.side;a.opacity=this.opacity;a.transparent=this.transparent;
a.blending=this.blending;a.blendSrc=this.blendSrc;a.blendDst=this.blendDst;a.blendEquation=this.blendEquation;a.depthTest=this.depthTest;a.depthWrite=this.depthWrite;a.polygonOffset=this.polygonOffset;a.polygonOffsetFactor=this.polygonOffsetFactor;a.polygonOffsetUnits=this.polygonOffsetUnits;a.alphaTest=this.alphaTest;a.overdraw=this.overdraw;a.visible=this.visible;return a},dispose:function(){this.dispatchEvent({type:"dispose"})}};THREE.EventDispatcher.prototype.apply(THREE.Material.prototype);
THREE.MaterialIdCount=0;THREE.LineBasicMaterial=function(a){THREE.Material.call(this);this.color=new THREE.Color(16777215);this.linewidth=1;this.linejoin=this.linecap="round";this.vertexColors=!1;this.fog=!0;this.setValues(a)};THREE.LineBasicMaterial.prototype=Object.create(THREE.Material.prototype);
THREE.LineBasicMaterial.prototype.clone=function(){var a=new THREE.LineBasicMaterial;THREE.Material.prototype.clone.call(this,a);a.color.copy(this.color);a.linewidth=this.linewidth;a.linecap=this.linecap;a.linejoin=this.linejoin;a.vertexColors=this.vertexColors;a.fog=this.fog;return a};THREE.LineDashedMaterial=function(a){THREE.Material.call(this);this.color=new THREE.Color(16777215);this.scale=this.linewidth=1;this.dashSize=3;this.gapSize=1;this.vertexColors=!1;this.fog=!0;this.setValues(a)};THREE.LineDashedMaterial.prototype=Object.create(THREE.Material.prototype);
THREE.LineDashedMaterial.prototype.clone=function(){var a=new THREE.LineDashedMaterial;THREE.Material.prototype.clone.call(this,a);a.color.copy(this.color);a.linewidth=this.linewidth;a.scale=this.scale;a.dashSize=this.dashSize;a.gapSize=this.gapSize;a.vertexColors=this.vertexColors;a.fog=this.fog;return a};THREE.MeshBasicMaterial=function(a){THREE.Material.call(this);this.color=new THREE.Color(16777215);this.envMap=this.specularMap=this.lightMap=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refractionRatio=0.98;this.fog=!0;this.shading=THREE.SmoothShading;this.wireframe=!1;this.wireframeLinewidth=1;this.wireframeLinejoin=this.wireframeLinecap="round";this.vertexColors=THREE.NoColors;this.morphTargets=this.skinning=!1;this.setValues(a)};
THREE.MeshBasicMaterial.prototype=Object.create(THREE.Material.prototype);
THREE.MeshBasicMaterial.prototype.clone=function(){var a=new THREE.MeshBasicMaterial;THREE.Material.prototype.clone.call(this,a);a.color.copy(this.color);a.map=this.map;a.lightMap=this.lightMap;a.specularMap=this.specularMap;a.envMap=this.envMap;a.combine=this.combine;a.reflectivity=this.reflectivity;a.refractionRatio=this.refractionRatio;a.fog=this.fog;a.shading=this.shading;a.wireframe=this.wireframe;a.wireframeLinewidth=this.wireframeLinewidth;a.wireframeLinecap=this.wireframeLinecap;a.wireframeLinejoin=
this.wireframeLinejoin;a.vertexColors=this.vertexColors;a.skinning=this.skinning;a.morphTargets=this.morphTargets;return a};THREE.MeshLambertMaterial=function(a){THREE.Material.call(this);this.color=new THREE.Color(16777215);this.ambient=new THREE.Color(16777215);this.emissive=new THREE.Color(0);this.wrapAround=!1;this.wrapRGB=new THREE.Vector3(1,1,1);this.envMap=this.specularMap=this.lightMap=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refractionRatio=0.98;this.fog=!0;this.shading=THREE.SmoothShading;this.wireframe=!1;this.wireframeLinewidth=1;this.wireframeLinejoin=this.wireframeLinecap=
"round";this.vertexColors=THREE.NoColors;this.morphNormals=this.morphTargets=this.skinning=!1;this.setValues(a)};THREE.MeshLambertMaterial.prototype=Object.create(THREE.Material.prototype);
THREE.MeshLambertMaterial.prototype.clone=function(){var a=new THREE.MeshLambertMaterial;THREE.Material.prototype.clone.call(this,a);a.color.copy(this.color);a.ambient.copy(this.ambient);a.emissive.copy(this.emissive);a.wrapAround=this.wrapAround;a.wrapRGB.copy(this.wrapRGB);a.map=this.map;a.lightMap=this.lightMap;a.specularMap=this.specularMap;a.envMap=this.envMap;a.combine=this.combine;a.reflectivity=this.reflectivity;a.refractionRatio=this.refractionRatio;a.fog=this.fog;a.shading=this.shading;
a.wireframe=this.wireframe;a.wireframeLinewidth=this.wireframeLinewidth;a.wireframeLinecap=this.wireframeLinecap;a.wireframeLinejoin=this.wireframeLinejoin;a.vertexColors=this.vertexColors;a.skinning=this.skinning;a.morphTargets=this.morphTargets;a.morphNormals=this.morphNormals;return a};THREE.MeshPhongMaterial=function(a){THREE.Material.call(this);this.color=new THREE.Color(16777215);this.ambient=new THREE.Color(16777215);this.emissive=new THREE.Color(0);this.specular=new THREE.Color(1118481);this.shininess=30;this.metal=!1;this.perPixel=!0;this.wrapAround=!1;this.wrapRGB=new THREE.Vector3(1,1,1);this.bumpMap=this.lightMap=this.map=null;this.bumpScale=1;this.normalMap=null;this.normalScale=new THREE.Vector2(1,1);this.envMap=this.specularMap=null;this.combine=THREE.MultiplyOperation;
this.reflectivity=1;this.refractionRatio=0.98;this.fog=!0;this.shading=THREE.SmoothShading;this.wireframe=!1;this.wireframeLinewidth=1;this.wireframeLinejoin=this.wireframeLinecap="round";this.vertexColors=THREE.NoColors;this.morphNormals=this.morphTargets=this.skinning=!1;this.setValues(a)};THREE.MeshPhongMaterial.prototype=Object.create(THREE.Material.prototype);
THREE.MeshPhongMaterial.prototype.clone=function(){var a=new THREE.MeshPhongMaterial;THREE.Material.prototype.clone.call(this,a);a.color.copy(this.color);a.ambient.copy(this.ambient);a.emissive.copy(this.emissive);a.specular.copy(this.specular);a.shininess=this.shininess;a.metal=this.metal;a.perPixel=this.perPixel;a.wrapAround=this.wrapAround;a.wrapRGB.copy(this.wrapRGB);a.map=this.map;a.lightMap=this.lightMap;a.bumpMap=this.bumpMap;a.bumpScale=this.bumpScale;a.normalMap=this.normalMap;a.normalScale.copy(this.normalScale);
a.specularMap=this.specularMap;a.envMap=this.envMap;a.combine=this.combine;a.reflectivity=this.reflectivity;a.refractionRatio=this.refractionRatio;a.fog=this.fog;a.shading=this.shading;a.wireframe=this.wireframe;a.wireframeLinewidth=this.wireframeLinewidth;a.wireframeLinecap=this.wireframeLinecap;a.wireframeLinejoin=this.wireframeLinejoin;a.vertexColors=this.vertexColors;a.skinning=this.skinning;a.morphTargets=this.morphTargets;a.morphNormals=this.morphNormals;return a};THREE.MeshDepthMaterial=function(a){THREE.Material.call(this);this.wireframe=!1;this.wireframeLinewidth=1;this.setValues(a)};THREE.MeshDepthMaterial.prototype=Object.create(THREE.Material.prototype);THREE.MeshDepthMaterial.prototype.clone=function(){var a=new THREE.MeshDepthMaterial;THREE.Material.prototype.clone.call(this,a);a.wireframe=this.wireframe;a.wireframeLinewidth=this.wireframeLinewidth;return a};THREE.MeshNormalMaterial=function(a){THREE.Material.call(this,a);this.shading=THREE.FlatShading;this.wireframe=!1;this.wireframeLinewidth=1;this.morphTargets=!1;this.setValues(a)};THREE.MeshNormalMaterial.prototype=Object.create(THREE.Material.prototype);THREE.MeshNormalMaterial.prototype.clone=function(){var a=new THREE.MeshNormalMaterial;THREE.Material.prototype.clone.call(this,a);a.shading=this.shading;a.wireframe=this.wireframe;a.wireframeLinewidth=this.wireframeLinewidth;return a};THREE.MeshFaceMaterial=function(a){this.materials=a instanceof Array?a:[]};THREE.MeshFaceMaterial.prototype.clone=function(){for(var a=new THREE.MeshFaceMaterial,b=0;b<this.materials.length;b++)a.materials.push(this.materials[b].clone());return a};THREE.ParticleSystemMaterial=function(a){THREE.Material.call(this);this.color=new THREE.Color(16777215);this.map=null;this.size=1;this.sizeAttenuation=!0;this.vertexColors=!1;this.fog=!0;this.setValues(a)};THREE.ParticleSystemMaterial.prototype=Object.create(THREE.Material.prototype);
THREE.ParticleSystemMaterial.prototype.clone=function(){var a=new THREE.ParticleSystemMaterial;THREE.Material.prototype.clone.call(this,a);a.color.copy(this.color);a.map=this.map;a.size=this.size;a.sizeAttenuation=this.sizeAttenuation;a.vertexColors=this.vertexColors;a.fog=this.fog;return a};THREE.ParticleBasicMaterial=THREE.ParticleSystemMaterial;THREE.ShaderMaterial=function(a){THREE.Material.call(this);this.vertexShader=this.fragmentShader="void main() {}";this.uniforms={};this.defines={};this.attributes=null;this.shading=THREE.SmoothShading;this.linewidth=1;this.wireframe=!1;this.wireframeLinewidth=1;this.lights=this.fog=!1;this.vertexColors=THREE.NoColors;this.morphNormals=this.morphTargets=this.skinning=!1;this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv2:[0,0]};this.index0AttributeName="position";this.setValues(a)};
THREE.ShaderMaterial.prototype=Object.create(THREE.Material.prototype);
THREE.ShaderMaterial.prototype.clone=function(){var a=new THREE.ShaderMaterial;THREE.Material.prototype.clone.call(this,a);a.fragmentShader=this.fragmentShader;a.vertexShader=this.vertexShader;a.uniforms=THREE.UniformsUtils.clone(this.uniforms);a.attributes=this.attributes;a.defines=this.defines;a.shading=this.shading;a.wireframe=this.wireframe;a.wireframeLinewidth=this.wireframeLinewidth;a.fog=this.fog;a.lights=this.lights;a.vertexColors=this.vertexColors;a.skinning=this.skinning;a.morphTargets=
this.morphTargets;a.morphNormals=this.morphNormals;return a};THREE.SpriteMaterial=function(a){THREE.Material.call(this);this.color=new THREE.Color(16777215);this.map=null;this.rotation=0;this.fog=!1;this.uvOffset=new THREE.Vector2(0,0);this.uvScale=new THREE.Vector2(1,1);this.setValues(a)};THREE.SpriteMaterial.prototype=Object.create(THREE.Material.prototype);
THREE.SpriteMaterial.prototype.clone=function(){var a=new THREE.SpriteMaterial;THREE.Material.prototype.clone.call(this,a);a.color.copy(this.color);a.map=this.map;a.rotation=this.rotation;a.uvOffset.copy(this.uvOffset);a.uvScale.copy(this.uvScale);a.fog=this.fog;return a};THREE.SpriteCanvasMaterial=function(a){THREE.Material.call(this);this.color=new THREE.Color(16777215);this.program=function(){};this.setValues(a)};THREE.SpriteCanvasMaterial.prototype=Object.create(THREE.Material.prototype);THREE.SpriteCanvasMaterial.prototype.clone=function(){var a=new THREE.SpriteCanvasMaterial;THREE.Material.prototype.clone.call(this,a);a.color.copy(this.color);a.program=this.program;return a};THREE.ParticleCanvasMaterial=THREE.SpriteCanvasMaterial;THREE.Texture=function(a,b,c,d,e,f,h,g,i){this.id=THREE.TextureIdCount++;this.uuid=THREE.Math.generateUUID();this.name="";this.image=a;this.mipmaps=[];this.mapping=void 0!==b?b:new THREE.UVMapping;this.wrapS=void 0!==c?c:THREE.ClampToEdgeWrapping;this.wrapT=void 0!==d?d:THREE.ClampToEdgeWrapping;this.magFilter=void 0!==e?e:THREE.LinearFilter;this.minFilter=void 0!==f?f:THREE.LinearMipMapLinearFilter;this.anisotropy=void 0!==i?i:1;this.format=void 0!==h?h:THREE.RGBAFormat;this.type=void 0!==g?g:THREE.UnsignedByteType;
this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.generateMipmaps=!0;this.premultiplyAlpha=!1;this.flipY=!0;this.unpackAlignment=4;this.needsUpdate=!1;this.onUpdate=null};
THREE.Texture.prototype={constructor:THREE.Texture,clone:function(a){void 0===a&&(a=new THREE.Texture);a.image=this.image;a.mipmaps=this.mipmaps.slice(0);a.mapping=this.mapping;a.wrapS=this.wrapS;a.wrapT=this.wrapT;a.magFilter=this.magFilter;a.minFilter=this.minFilter;a.anisotropy=this.anisotropy;a.format=this.format;a.type=this.type;a.offset.copy(this.offset);a.repeat.copy(this.repeat);a.generateMipmaps=this.generateMipmaps;a.premultiplyAlpha=this.premultiplyAlpha;a.flipY=this.flipY;a.unpackAlignment=
this.unpackAlignment;return a},dispose:function(){this.dispatchEvent({type:"dispose"})}};THREE.EventDispatcher.prototype.apply(THREE.Texture.prototype);THREE.TextureIdCount=0;THREE.CompressedTexture=function(a,b,c,d,e,f,h,g,i,k,m){THREE.Texture.call(this,null,f,h,g,i,k,d,e,m);this.image={width:b,height:c};this.mipmaps=a;this.generateMipmaps=!1};THREE.CompressedTexture.prototype=Object.create(THREE.Texture.prototype);THREE.CompressedTexture.prototype.clone=function(){var a=new THREE.CompressedTexture;THREE.Texture.prototype.clone.call(this,a);return a};THREE.DataTexture=function(a,b,c,d,e,f,h,g,i,k,m){THREE.Texture.call(this,null,f,h,g,i,k,d,e,m);this.image={data:a,width:b,height:c}};THREE.DataTexture.prototype=Object.create(THREE.Texture.prototype);THREE.DataTexture.prototype.clone=function(){var a=new THREE.DataTexture;THREE.Texture.prototype.clone.call(this,a);return a};THREE.ParticleSystem=function(a,b){THREE.Object3D.call(this);this.geometry=void 0!==a?a:new THREE.Geometry;this.material=void 0!==b?b:new THREE.ParticleSystemMaterial({color:16777215*Math.random()});this.frustumCulled=this.sortParticles=!1};THREE.ParticleSystem.prototype=Object.create(THREE.Object3D.prototype);
THREE.ParticleSystem.prototype.clone=function(a){void 0===a&&(a=new THREE.ParticleSystem(this.geometry,this.material));a.sortParticles=this.sortParticles;THREE.Object3D.prototype.clone.call(this,a);return a};THREE.Line=function(a,b,c){THREE.Object3D.call(this);this.geometry=void 0!==a?a:new THREE.Geometry;this.material=void 0!==b?b:new THREE.LineBasicMaterial({color:16777215*Math.random()});this.type=void 0!==c?c:THREE.LineStrip};THREE.LineStrip=0;THREE.LinePieces=1;THREE.Line.prototype=Object.create(THREE.Object3D.prototype);THREE.Line.prototype.clone=function(a){void 0===a&&(a=new THREE.Line(this.geometry,this.material,this.type));THREE.Object3D.prototype.clone.call(this,a);return a};THREE.Mesh=function(a,b){THREE.Object3D.call(this);this.geometry=void 0!==a?a:new THREE.Geometry;this.material=void 0!==b?b:new THREE.MeshBasicMaterial({color:16777215*Math.random()});this.updateMorphTargets()};THREE.Mesh.prototype=Object.create(THREE.Object3D.prototype);
THREE.Mesh.prototype.updateMorphTargets=function(){if(0<this.geometry.morphTargets.length){this.morphTargetBase=-1;this.morphTargetForcedOrder=[];this.morphTargetInfluences=[];this.morphTargetDictionary={};for(var a=0,b=this.geometry.morphTargets.length;a<b;a++)this.morphTargetInfluences.push(0),this.morphTargetDictionary[this.geometry.morphTargets[a].name]=a}};
THREE.Mesh.prototype.getMorphTargetIndexByName=function(a){if(void 0!==this.morphTargetDictionary[a])return this.morphTargetDictionary[a];console.log("THREE.Mesh.getMorphTargetIndexByName: morph target "+a+" does not exist. Returning 0.");return 0};THREE.Mesh.prototype.clone=function(a){void 0===a&&(a=new THREE.Mesh(this.geometry,this.material));THREE.Object3D.prototype.clone.call(this,a);return a};THREE.Bone=function(a){THREE.Object3D.call(this);this.skin=a;this.skinMatrix=new THREE.Matrix4};THREE.Bone.prototype=Object.create(THREE.Object3D.prototype);THREE.Bone.prototype.update=function(a,b){this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixWorldNeedsUpdate)a?this.skinMatrix.multiplyMatrices(a,this.matrix):this.skinMatrix.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,b=!0;var c,d=this.children.length;for(c=0;c<d;c++)this.children[c].update(this.skinMatrix,b)};THREE.SkinnedMesh=function(a,b,c){THREE.Mesh.call(this,a,b);this.useVertexTexture=void 0!==c?c:!0;this.identityMatrix=new THREE.Matrix4;this.bones=[];this.boneMatrices=[];var d,e,f;if(this.geometry&&void 0!==this.geometry.bones){for(a=0;a<this.geometry.bones.length;a++)c=this.geometry.bones[a],d=c.pos,e=c.rotq,f=c.scl,b=this.addBone(),b.name=c.name,b.position.set(d[0],d[1],d[2]),b.quaternion.set(e[0],e[1],e[2],e[3]),void 0!==f?b.scale.set(f[0],f[1],f[2]):b.scale.set(1,1,1);for(a=0;a<this.bones.length;a++)c=
this.geometry.bones[a],b=this.bones[a],-1===c.parent?this.add(b):this.bones[c.parent].add(b);a=this.bones.length;this.useVertexTexture?(this.boneTextureHeight=this.boneTextureWidth=a=256<a?64:64<a?32:16<a?16:8,this.boneMatrices=new Float32Array(4*this.boneTextureWidth*this.boneTextureHeight),this.boneTexture=new THREE.DataTexture(this.boneMatrices,this.boneTextureWidth,this.boneTextureHeight,THREE.RGBAFormat,THREE.FloatType),this.boneTexture.minFilter=THREE.NearestFilter,this.boneTexture.magFilter=
THREE.NearestFilter,this.boneTexture.generateMipmaps=!1,this.boneTexture.flipY=!1):this.boneMatrices=new Float32Array(16*a);this.pose()}};THREE.SkinnedMesh.prototype=Object.create(THREE.Mesh.prototype);THREE.SkinnedMesh.prototype.addBone=function(a){void 0===a&&(a=new THREE.Bone(this));this.bones.push(a);return a};
THREE.SkinnedMesh.prototype.updateMatrixWorld=function(){var a=new THREE.Matrix4;return function(b){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||b)this.parent?this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1;for(var b=0,c=this.children.length;b<c;b++){var d=this.children[b];d instanceof THREE.Bone?d.update(this.identityMatrix,!1):d.updateMatrixWorld(!0)}if(void 0==this.boneInverses){this.boneInverses=
[];b=0;for(c=this.bones.length;b<c;b++)d=new THREE.Matrix4,d.getInverse(this.bones[b].skinMatrix),this.boneInverses.push(d)}b=0;for(c=this.bones.length;b<c;b++)a.multiplyMatrices(this.bones[b].skinMatrix,this.boneInverses[b]),a.flattenToArrayOffset(this.boneMatrices,16*b);this.useVertexTexture&&(this.boneTexture.needsUpdate=!0)}}();THREE.SkinnedMesh.prototype.pose=function(){this.updateMatrixWorld(!0);this.normalizeSkinWeights()};
THREE.SkinnedMesh.prototype.normalizeSkinWeights=function(){if(this.geometry instanceof THREE.Geometry)for(var a=0;a<this.geometry.skinIndices.length;a++){var b=this.geometry.skinWeights[a],c=1/b.lengthManhattan();Infinity!==c?b.multiplyScalar(c):b.set(1)}};THREE.SkinnedMesh.prototype.clone=function(a){void 0===a&&(a=new THREE.SkinnedMesh(this.geometry,this.material,this.useVertexTexture));THREE.Mesh.prototype.clone.call(this,a);return a};THREE.MorphAnimMesh=function(a,b){THREE.Mesh.call(this,a,b);this.duration=1E3;this.mirroredLoop=!1;this.currentKeyframe=this.lastKeyframe=this.time=0;this.direction=1;this.directionBackwards=!1;this.setFrameRange(0,this.geometry.morphTargets.length-1)};THREE.MorphAnimMesh.prototype=Object.create(THREE.Mesh.prototype);THREE.MorphAnimMesh.prototype.setFrameRange=function(a,b){this.startKeyframe=a;this.endKeyframe=b;this.length=this.endKeyframe-this.startKeyframe+1};
THREE.MorphAnimMesh.prototype.setDirectionForward=function(){this.direction=1;this.directionBackwards=!1};THREE.MorphAnimMesh.prototype.setDirectionBackward=function(){this.direction=-1;this.directionBackwards=!0};
THREE.MorphAnimMesh.prototype.parseAnimations=function(){var a=this.geometry;a.animations||(a.animations={});for(var b,c=a.animations,d=/([a-z]+)(\d+)/,e=0,f=a.morphTargets.length;e<f;e++){var h=a.morphTargets[e].name.match(d);if(h&&1<h.length){h=h[1];c[h]||(c[h]={start:Infinity,end:-Infinity});var g=c[h];e<g.start&&(g.start=e);e>g.end&&(g.end=e);b||(b=h)}}a.firstAnimation=b};
THREE.MorphAnimMesh.prototype.setAnimationLabel=function(a,b,c){this.geometry.animations||(this.geometry.animations={});this.geometry.animations[a]={start:b,end:c}};THREE.MorphAnimMesh.prototype.playAnimation=function(a,b){var c=this.geometry.animations[a];c?(this.setFrameRange(c.start,c.end),this.duration=1E3*((c.end-c.start)/b),this.time=0):console.warn("animation["+a+"] undefined")};
THREE.MorphAnimMesh.prototype.updateAnimation=function(a){var b=this.duration/this.length;this.time+=this.direction*a;if(this.mirroredLoop){if(this.time>this.duration||0>this.time)this.direction*=-1,this.time>this.duration&&(this.time=this.duration,this.directionBackwards=!0),0>this.time&&(this.time=0,this.directionBackwards=!1)}else this.time%=this.duration,0>this.time&&(this.time+=this.duration);a=this.startKeyframe+THREE.Math.clamp(Math.floor(this.time/b),0,this.length-1);a!==this.currentKeyframe&&
(this.morphTargetInfluences[this.lastKeyframe]=0,this.morphTargetInfluences[this.currentKeyframe]=1,this.morphTargetInfluences[a]=0,this.lastKeyframe=this.currentKeyframe,this.currentKeyframe=a);b=this.time%b/b;this.directionBackwards&&(b=1-b);this.morphTargetInfluences[this.currentKeyframe]=b;this.morphTargetInfluences[this.lastKeyframe]=1-b};
THREE.MorphAnimMesh.prototype.clone=function(a){void 0===a&&(a=new THREE.MorphAnimMesh(this.geometry,this.material));a.duration=this.duration;a.mirroredLoop=this.mirroredLoop;a.time=this.time;a.lastKeyframe=this.lastKeyframe;a.currentKeyframe=this.currentKeyframe;a.direction=this.direction;a.directionBackwards=this.directionBackwards;THREE.Mesh.prototype.clone.call(this,a);return a};THREE.LOD=function(){THREE.Object3D.call(this);this.objects=[]};THREE.LOD.prototype=Object.create(THREE.Object3D.prototype);THREE.LOD.prototype.addLevel=function(a,b){void 0===b&&(b=0);for(var b=Math.abs(b),c=0;c<this.objects.length&&!(b<this.objects[c].distance);c++);this.objects.splice(c,0,{distance:b,object:a});this.add(a)};THREE.LOD.prototype.getObjectForDistance=function(a){for(var b=1,c=this.objects.length;b<c&&!(a<this.objects[b].distance);b++);return this.objects[b-1].object};
THREE.LOD.prototype.update=function(){var a=new THREE.Vector3,b=new THREE.Vector3;return function(c){if(1<this.objects.length){a.getPositionFromMatrix(c.matrixWorld);b.getPositionFromMatrix(this.matrixWorld);c=a.distanceTo(b);this.objects[0].object.visible=!0;for(var d=1,e=this.objects.length;d<e;d++)if(c>=this.objects[d].distance)this.objects[d-1].object.visible=!1,this.objects[d].object.visible=!0;else break;for(;d<e;d++)this.objects[d].object.visible=!1}}}();THREE.LOD.prototype.clone=function(){};THREE.Sprite=function(a){THREE.Object3D.call(this);this.material=void 0!==a?a:new THREE.SpriteMaterial};THREE.Sprite.prototype=Object.create(THREE.Object3D.prototype);THREE.Sprite.prototype.updateMatrix=function(){this.matrix.compose(this.position,this.quaternion,this.scale);this.matrixWorldNeedsUpdate=!0};THREE.Sprite.prototype.clone=function(a){void 0===a&&(a=new THREE.Sprite(this.material));THREE.Object3D.prototype.clone.call(this,a);return a};THREE.Particle=THREE.Sprite;THREE.Scene=function(){THREE.Object3D.call(this);this.overrideMaterial=this.fog=null;this.autoUpdate=!0;this.matrixAutoUpdate=!1;this.__lights=[];this.__objectsAdded=[];this.__objectsRemoved=[]};THREE.Scene.prototype=Object.create(THREE.Object3D.prototype);
THREE.Scene.prototype.__addObject=function(a){if(a instanceof THREE.Light)-1===this.__lights.indexOf(a)&&this.__lights.push(a),a.target&&void 0===a.target.parent&&this.add(a.target);else if(!(a instanceof THREE.Camera||a instanceof THREE.Bone)){this.__objectsAdded.push(a);var b=this.__objectsRemoved.indexOf(a);-1!==b&&this.__objectsRemoved.splice(b,1)}for(b=0;b<a.children.length;b++)this.__addObject(a.children[b])};
THREE.Scene.prototype.__removeObject=function(a){if(a instanceof THREE.Light){var b=this.__lights.indexOf(a);-1!==b&&this.__lights.splice(b,1);if(a.shadowCascadeArray)for(b=0;b<a.shadowCascadeArray.length;b++)this.__removeObject(a.shadowCascadeArray[b])}else a instanceof THREE.Camera||(this.__objectsRemoved.push(a),b=this.__objectsAdded.indexOf(a),-1!==b&&this.__objectsAdded.splice(b,1));for(b=0;b<a.children.length;b++)this.__removeObject(a.children[b])};
THREE.Scene.prototype.clone=function(a){void 0===a&&(a=new THREE.Scene);THREE.Object3D.prototype.clone.call(this,a);null!==this.fog&&(a.fog=this.fog.clone());null!==this.overrideMaterial&&(a.overrideMaterial=this.overrideMaterial.clone());a.autoUpdate=this.autoUpdate;a.matrixAutoUpdate=this.matrixAutoUpdate;return a};THREE.Fog=function(a,b,c){this.name="";this.color=new THREE.Color(a);this.near=void 0!==b?b:1;this.far=void 0!==c?c:1E3};THREE.Fog.prototype.clone=function(){return new THREE.Fog(this.color.getHex(),this.near,this.far)};THREE.FogExp2=function(a,b){this.name="";this.color=new THREE.Color(a);this.density=void 0!==b?b:2.5E-4};THREE.FogExp2.prototype.clone=function(){return new THREE.FogExp2(this.color.getHex(),this.density)};THREE.CanvasRenderer=function(a){function b(a,b,c){for(var d=0,e=z.length;d<e;d++){var f=z[d];Ka.copy(f.color);if(f instanceof THREE.DirectionalLight){var h=ta.getPositionFromMatrix(f.matrixWorld).normalize(),g=b.dot(h);0>=g||(g*=f.intensity,c.add(Ka.multiplyScalar(g)))}else f instanceof THREE.PointLight&&(h=ta.getPositionFromMatrix(f.matrixWorld),g=b.dot(ta.subVectors(h,a).normalize()),0>=g||(g*=0==f.distance?1:1-Math.min(a.distanceTo(h)/f.distance,1),0!=g&&(g*=f.intensity,c.add(Ka.multiplyScalar(g)))))}}
function c(a,b,c,d){m(b);l(c);p(d);t(a.getStyle());D.stroke();Ea.expandByScalar(2*b)}function d(a){s(a.getStyle());D.fill()}function e(a,b,c,e,f,h,g,j,i,k,m,l,n){if(!(n instanceof THREE.DataTexture||void 0===n.image||0===n.image.width)){if(!0===n.needsUpdate){var p=n.wrapS===THREE.RepeatWrapping,q=n.wrapT===THREE.RepeatWrapping;Ga[n.id]=D.createPattern(n.image,!0===p&&!0===q?"repeat":!0===p&&!1===q?"repeat-x":!1===p&&!0===q?"repeat-y":"no-repeat");n.needsUpdate=!1}void 0===Ga[n.id]?s("rgba(0,0,0,1)"):
s(Ga[n.id]);var p=n.offset.x/n.repeat.x,q=n.offset.y/n.repeat.y,t=n.image.width*n.repeat.x,r=n.image.height*n.repeat.y,g=(g+p)*t,j=(1-j+q)*r,c=c-a,e=e-b,f=f-a,h=h-b,i=(i+p)*t-g,k=(1-k+q)*r-j,m=(m+p)*t-g,l=(1-l+q)*r-j,p=i*l-m*k;0===p?(void 0===ka[n.id]&&(b=document.createElement("canvas"),b.width=n.image.width,b.height=n.image.height,b=b.getContext("2d"),b.drawImage(n.image,0,0),ka[n.id]=b.getImageData(0,0,n.image.width,n.image.height).data),b=ka[n.id],g=4*(Math.floor(g)+Math.floor(j)*n.image.width),
V.setRGB(b[g]/255,b[g+1]/255,b[g+2]/255),d(V)):(p=1/p,n=(l*c-k*f)*p,k=(l*e-k*h)*p,c=(i*f-m*c)*p,e=(i*h-m*e)*p,a=a-n*g-c*j,g=b-k*g-e*j,D.save(),D.transform(n,k,c,e,a,g),D.fill(),D.restore())}}function f(a,b,c,d,e,f,h,g,j,i,k,m,n){var l,p;l=n.width-1;p=n.height-1;h*=l;g*=p;c-=a;d-=b;e-=a;f-=b;j=j*l-h;i=i*p-g;k=k*l-h;m=m*p-g;p=1/(j*m-k*i);l=(m*c-i*e)*p;i=(m*d-i*f)*p;c=(j*e-k*c)*p;d=(j*f-k*d)*p;a=a-l*h-c*g;b=b-i*h-d*g;D.save();D.transform(l,i,c,d,a,b);D.clip();D.drawImage(n,0,0);D.restore()}function h(a,
b,c,d){ua[0]=255*a.r|0;ua[1]=255*a.g|0;ua[2]=255*a.b|0;ua[4]=255*b.r|0;ua[5]=255*b.g|0;ua[6]=255*b.b|0;ua[8]=255*c.r|0;ua[9]=255*c.g|0;ua[10]=255*c.b|0;ua[12]=255*d.r|0;ua[13]=255*d.g|0;ua[14]=255*d.b|0;j.putImageData(Oa,0,0);Fa.drawImage(Pa,0,0);return La}function g(a,b,c){var d=b.x-a.x,e=b.y-a.y,f=d*d+e*e;0!==f&&(c/=Math.sqrt(f),d*=c,e*=c,b.x+=d,b.y+=e,a.x-=d,a.y-=e)}function i(a){x!==a&&(x=D.globalAlpha=a)}function k(a){I!==a&&(a===THREE.NormalBlending?D.globalCompositeOperation="source-over":
a===THREE.AdditiveBlending?D.globalCompositeOperation="lighter":a===THREE.SubtractiveBlending&&(D.globalCompositeOperation="darker"),I=a)}function m(a){J!==a&&(J=D.lineWidth=a)}function l(a){ca!==a&&(ca=D.lineCap=a)}function p(a){na!==a&&(na=D.lineJoin=a)}function t(a){B!==a&&(B=D.strokeStyle=a)}function s(a){M!==a&&(M=D.fillStyle=a)}function q(a,b){if(pa!==a||C!==b)D.setLineDash([a,b]),pa=a,C=b}console.log("THREE.CanvasRenderer",THREE.REVISION);var n=THREE.Math.smoothstep,a=a||{},u=this,r,v,z,G=
new THREE.Projector,w=void 0!==a.canvas?a.canvas:document.createElement("canvas"),y=w.width,E=w.height,A=Math.floor(y/2),K=Math.floor(E/2),D=w.getContext("2d"),F=new THREE.Color(0),O=0,x=1,I=0,B=null,M=null,J=null,ca=null,na=null,pa=null,C=0,Q,R,L,da;new THREE.RenderableVertex;new THREE.RenderableVertex;var za,Ba,ba,Aa,$,ea,V=new THREE.Color,P=new THREE.Color,Y=new THREE.Color,U=new THREE.Color,ja=new THREE.Color,sa=new THREE.Color,ha=new THREE.Color,Ka=new THREE.Color,Ga={},ka={},Da,Ua,Qa,wa,bb,
cb,Ma,fb,sb,pb,va=new THREE.Box2,la=new THREE.Box2,Ea=new THREE.Box2,gb=new THREE.Color,ra=new THREE.Color,fa=new THREE.Color,ta=new THREE.Vector3,Pa,j,Oa,ua,La,Fa,Ra=16;Pa=document.createElement("canvas");Pa.width=Pa.height=2;j=Pa.getContext("2d");j.fillStyle="rgba(0,0,0,1)";j.fillRect(0,0,2,2);Oa=j.getImageData(0,0,2,2);ua=Oa.data;La=document.createElement("canvas");La.width=La.height=Ra;Fa=La.getContext("2d");Fa.translate(-Ra/2,-Ra/2);Fa.scale(Ra,Ra);Ra--;void 0===D.setLineDash&&(D.setLineDash=
void 0!==D.mozDash?function(a){D.mozDash=null!==a[0]?a:null}:function(){});this.domElement=w;this.devicePixelRatio=void 0!==a.devicePixelRatio?a.devicePixelRatio:void 0!==self.devicePixelRatio?self.devicePixelRatio:1;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.supportsVertexTextures=function(){};this.setFaceCulling=function(){};this.setSize=function(a,b,c){y=a*this.devicePixelRatio;E=b*this.devicePixelRatio;A=Math.floor(y/2);K=Math.floor(E/2);
w.width=y;w.height=E;1!==this.devicePixelRatio&&!1!==c&&(w.style.width=a+"px",w.style.height=b+"px");va.set(new THREE.Vector2(-A,-K),new THREE.Vector2(A,K));la.set(new THREE.Vector2(-A,-K),new THREE.Vector2(A,K));x=1;I=0;na=ca=J=M=B=null};this.setClearColor=function(a,b){F.set(a);O=void 0!==b?b:1;la.set(new THREE.Vector2(-A,-K),new THREE.Vector2(A,K))};this.setClearColorHex=function(a,b){console.warn("DEPRECATED: .setClearColorHex() is being removed. Use .setClearColor() instead.");this.setClearColor(a,
b)};this.getMaxAnisotropy=function(){return 0};this.clear=function(){D.setTransform(1,0,0,-1,A,K);!1===la.empty()&&(la.intersect(va),la.expandByScalar(2),1>O&&D.clearRect(la.min.x|0,la.min.y|0,la.max.x-la.min.x|0,la.max.y-la.min.y|0),0<O&&(k(THREE.NormalBlending),i(1),s("rgba("+Math.floor(255*F.r)+","+Math.floor(255*F.g)+","+Math.floor(255*F.b)+","+O+")"),D.fillRect(la.min.x|0,la.min.y|0,la.max.x-la.min.x|0,la.max.y-la.min.y|0)),la.makeEmpty())};this.render=function(a,j){if(!1===j instanceof THREE.Camera)console.error("THREE.CanvasRenderer.render: camera is not an instance of THREE.Camera.");
else{!0===this.autoClear&&this.clear();D.setTransform(1,0,0,-1,A,K);u.info.render.vertices=0;u.info.render.faces=0;r=G.projectScene(a,j,this.sortObjects,this.sortElements);v=r.elements;z=r.lights;Q=j;gb.setRGB(0,0,0);ra.setRGB(0,0,0);fa.setRGB(0,0,0);for(var y=0,F=z.length;y<F;y++){var B=z[y],E=B.color;B instanceof THREE.AmbientLight?gb.add(E):B instanceof THREE.DirectionalLight?ra.add(E):B instanceof THREE.PointLight&&fa.add(E)}y=0;for(F=v.length;y<F;y++){var x=v[y],w=x.material;if(!(void 0===w||
!1===w.visible)){Ea.makeEmpty();if(x instanceof THREE.RenderableSprite){R=x;R.x*=A;R.y*=K;var B=R,E=x,I=w;i(I.opacity);k(I.blending);x=E.scale.x*A;w=E.scale.y*K;Ea.min.set(B.x-0.5*x,B.y-0.5*w);Ea.max.set(B.x+0.5*x,B.y+0.5*w);!1===va.isIntersectionBox(Ea)?Ea.makeEmpty():I instanceof THREE.SpriteMaterial||I instanceof THREE.ParticleSystemMaterial?(null!==I.map?(E=I.map.image,D.save(),D.translate(B.x,B.y),D.rotate(-I.rotation),D.scale(x,-w),D.drawImage(E,0,0,E.width,E.height,-0.5,-0.5,1,1)):(s(I.color.getStyle()),
D.save(),D.translate(B.x,B.y),D.rotate(-E.rotation),D.scale(x,w),D.fillRect(-0.5,-0.5,1,1)),D.restore()):I instanceof THREE.SpriteCanvasMaterial&&(t(I.color.getStyle()),s(I.color.getStyle()),D.save(),D.translate(B.x,B.y),D.rotate(-E.rotation),D.scale(x,w),I.program(D),D.restore())}else if(x instanceof THREE.RenderableLine){if(R=x.v1,L=x.v2,R.positionScreen.x*=A,R.positionScreen.y*=K,L.positionScreen.x*=A,L.positionScreen.y*=K,Ea.setFromPoints([R.positionScreen,L.positionScreen]),!0===va.isIntersectionBox(Ea))if(B=
R,E=L,I=x,x=w,i(x.opacity),k(x.blending),D.beginPath(),D.moveTo(B.positionScreen.x,B.positionScreen.y),D.lineTo(E.positionScreen.x,E.positionScreen.y),x instanceof THREE.LineBasicMaterial){m(x.linewidth);l(x.linecap);p(x.linejoin);if(x.vertexColors!==THREE.VertexColors)t(x.color.getStyle());else if(w=I.vertexColors[0].getStyle(),I=I.vertexColors[1].getStyle(),w===I)t(w);else{try{var O=D.createLinearGradient(B.positionScreen.x,B.positionScreen.y,E.positionScreen.x,E.positionScreen.y);O.addColorStop(0,
w);O.addColorStop(1,I)}catch(C){O=w}t(O)}D.stroke();Ea.expandByScalar(2*x.linewidth)}else x instanceof THREE.LineDashedMaterial&&(m(x.linewidth),l(x.linecap),p(x.linejoin),t(x.color.getStyle()),q(x.dashSize,x.gapSize),D.stroke(),Ea.expandByScalar(2*x.linewidth),q(null,null))}else if(x instanceof THREE.RenderableFace3){R=x.v1;L=x.v2;da=x.v3;if(-1>R.positionScreen.z||1<R.positionScreen.z)continue;if(-1>L.positionScreen.z||1<L.positionScreen.z)continue;if(-1>da.positionScreen.z||1<da.positionScreen.z)continue;
R.positionScreen.x*=A;R.positionScreen.y*=K;L.positionScreen.x*=A;L.positionScreen.y*=K;da.positionScreen.x*=A;da.positionScreen.y*=K;0<w.overdraw&&(g(R.positionScreen,L.positionScreen,w.overdraw),g(L.positionScreen,da.positionScreen,w.overdraw),g(da.positionScreen,R.positionScreen,w.overdraw));Ea.setFromPoints([R.positionScreen,L.positionScreen,da.positionScreen]);if(!0===va.isIntersectionBox(Ea)){B=R;E=L;I=da;u.info.render.vertices+=3;u.info.render.faces++;i(w.opacity);k(w.blending);za=B.positionScreen.x;
Ba=B.positionScreen.y;ba=E.positionScreen.x;Aa=E.positionScreen.y;$=I.positionScreen.x;ea=I.positionScreen.y;var J=za,M=Ba,ca=ba,ka=Aa,na=$,pa=ea;D.beginPath();D.moveTo(J,M);D.lineTo(ca,ka);D.lineTo(na,pa);D.closePath();(w instanceof THREE.MeshLambertMaterial||w instanceof THREE.MeshPhongMaterial)&&null===w.map?(sa.copy(w.color),ha.copy(w.emissive),w.vertexColors===THREE.FaceColors&&sa.multiply(x.color),!1===w.wireframe&&w.shading===THREE.SmoothShading&&3===x.vertexNormalsLength?(P.copy(gb),Y.copy(gb),
U.copy(gb),b(x.v1.positionWorld,x.vertexNormalsModel[0],P),b(x.v2.positionWorld,x.vertexNormalsModel[1],Y),b(x.v3.positionWorld,x.vertexNormalsModel[2],U),P.multiply(sa).add(ha),Y.multiply(sa).add(ha),U.multiply(sa).add(ha),ja.addColors(Y,U).multiplyScalar(0.5),Qa=h(P,Y,U,ja),f(za,Ba,ba,Aa,$,ea,0,0,1,0,0,1,Qa)):(V.copy(gb),b(x.centroidModel,x.normalModel,V),V.multiply(sa).add(ha),!0===w.wireframe?c(V,w.wireframeLinewidth,w.wireframeLinecap,w.wireframeLinejoin):d(V))):w instanceof THREE.MeshBasicMaterial||
w instanceof THREE.MeshLambertMaterial||w instanceof THREE.MeshPhongMaterial?null!==w.map?w.map.mapping instanceof THREE.UVMapping&&(wa=x.uvs[0],e(za,Ba,ba,Aa,$,ea,wa[0].x,wa[0].y,wa[1].x,wa[1].y,wa[2].x,wa[2].y,w.map)):null!==w.envMap?w.envMap.mapping instanceof THREE.SphericalReflectionMapping&&(ta.copy(x.vertexNormalsModelView[0]),bb=0.5*ta.x+0.5,cb=0.5*ta.y+0.5,ta.copy(x.vertexNormalsModelView[1]),Ma=0.5*ta.x+0.5,fb=0.5*ta.y+0.5,ta.copy(x.vertexNormalsModelView[2]),sb=0.5*ta.x+0.5,pb=0.5*ta.y+
0.5,e(za,Ba,ba,Aa,$,ea,bb,cb,Ma,fb,sb,pb,w.envMap)):(V.copy(w.color),w.vertexColors===THREE.FaceColors&&V.multiply(x.color),!0===w.wireframe?c(V,w.wireframeLinewidth,w.wireframeLinecap,w.wireframeLinejoin):d(V)):w instanceof THREE.MeshDepthMaterial?(Da=Q.near,Ua=Q.far,P.r=P.g=P.b=1-n(B.positionScreen.z*B.positionScreen.w,Da,Ua),Y.r=Y.g=Y.b=1-n(E.positionScreen.z*E.positionScreen.w,Da,Ua),U.r=U.g=U.b=1-n(I.positionScreen.z*I.positionScreen.w,Da,Ua),ja.addColors(Y,U).multiplyScalar(0.5),Qa=h(P,Y,U,
ja),f(za,Ba,ba,Aa,$,ea,0,0,1,0,0,1,Qa)):w instanceof THREE.MeshNormalMaterial&&(B=void 0,w.shading===THREE.FlatShading?(B=x.normalModelView,V.setRGB(B.x,B.y,B.z).multiplyScalar(0.5).addScalar(0.5),!0===w.wireframe?c(V,w.wireframeLinewidth,w.wireframeLinecap,w.wireframeLinejoin):d(V)):w.shading===THREE.SmoothShading&&(B=x.vertexNormalsModelView[0],P.setRGB(B.x,B.y,B.z).multiplyScalar(0.5).addScalar(0.5),B=x.vertexNormalsModelView[1],Y.setRGB(B.x,B.y,B.z).multiplyScalar(0.5).addScalar(0.5),B=x.vertexNormalsModelView[2],
U.setRGB(B.x,B.y,B.z).multiplyScalar(0.5).addScalar(0.5),ja.addColors(Y,U).multiplyScalar(0.5),Qa=h(P,Y,U,ja),f(za,Ba,ba,Aa,$,ea,0,0,1,0,0,1,Qa)))}}la.union(Ea)}}D.setTransform(1,0,0,1,0,0)}}};THREE.ShaderChunk={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",
envmap_pars_fragment:"#ifdef USE_ENVMAP\nuniform float reflectivity;\nuniform samplerCube envMap;\nuniform float flipEnvMap;\nuniform int combine;\n#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP )\nuniform bool useRefract;\nuniform float refractionRatio;\n#else\nvarying vec3 vReflect;\n#endif\n#endif",envmap_fragment:"#ifdef USE_ENVMAP\nvec3 reflectVec;\n#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP )\nvec3 cameraToVertex = normalize( vWorldPosition - cameraPosition );\nif ( useRefract ) {\nreflectVec = refract( cameraToVertex, normal, refractionRatio );\n} else { \nreflectVec = reflect( cameraToVertex, normal );\n}\n#else\nreflectVec = vReflect;\n#endif\n#ifdef DOUBLE_SIDED\nfloat flipNormal = ( -1.0 + 2.0 * float( gl_FrontFacing ) );\nvec4 cubeColor = textureCube( envMap, flipNormal * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n#else\nvec4 cubeColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n#endif\n#ifdef GAMMA_INPUT\ncubeColor.xyz *= cubeColor.xyz;\n#endif\nif ( combine == 1 ) {\ngl_FragColor.xyz = mix( gl_FragColor.xyz, cubeColor.xyz, specularStrength * reflectivity );\n} else if ( combine == 2 ) {\ngl_FragColor.xyz += cubeColor.xyz * specularStrength * reflectivity;\n} else {\ngl_FragColor.xyz = mix( gl_FragColor.xyz, gl_FragColor.xyz * cubeColor.xyz, specularStrength * reflectivity );\n}\n#endif",
envmap_pars_vertex:"#if defined( USE_ENVMAP ) && ! defined( USE_BUMPMAP ) && ! defined( USE_NORMALMAP )\nvarying vec3 vReflect;\nuniform float refractionRatio;\nuniform bool useRefract;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( PHONG ) || defined( LAMBERT ) || defined ( USE_SHADOWMAP )\n#ifdef USE_SKINNING\nvec4 worldPosition = modelMatrix * skinned;\n#endif\n#if defined( USE_MORPHTARGETS ) && ! defined( USE_SKINNING )\nvec4 worldPosition = modelMatrix * vec4( morphed, 1.0 );\n#endif\n#if ! defined( USE_MORPHTARGETS ) && ! defined( USE_SKINNING )\nvec4 worldPosition = modelMatrix * vec4( position, 1.0 );\n#endif\n#endif",
envmap_vertex:"#if defined( USE_ENVMAP ) && ! defined( USE_BUMPMAP ) && ! defined( USE_NORMALMAP )\nvec3 worldNormal = mat3( modelMatrix[ 0 ].xyz, modelMatrix[ 1 ].xyz, modelMatrix[ 2 ].xyz ) * objectNormal;\nworldNormal = normalize( worldNormal );\nvec3 cameraToVertex = normalize( worldPosition.xyz - cameraPosition );\nif ( useRefract ) {\nvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n} else {\nvReflect = reflect( cameraToVertex, worldNormal );\n}\n#endif",map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif",
map_particle_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, vec2( gl_PointCoord.x, 1.0 - gl_PointCoord.y ) );\n#endif",map_pars_vertex:"#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP )\nvarying vec2 vUv;\nuniform vec4 offsetRepeat;\n#endif",map_pars_fragment:"#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP )\nvarying vec2 vUv;\n#endif\n#ifdef USE_MAP\nuniform sampler2D map;\n#endif",
map_vertex:"#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP )\nvUv = uv * offsetRepeat.zw + offsetRepeat.xy;\n#endif",map_fragment:"#ifdef USE_MAP\nvec4 texelColor = texture2D( map, vUv );\n#ifdef GAMMA_INPUT\ntexelColor.xyz *= texelColor.xyz;\n#endif\ngl_FragColor = gl_FragColor * texelColor;\n#endif",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\nvarying vec2 vUv2;\nuniform sampler2D lightMap;\n#endif",lightmap_pars_vertex:"#ifdef USE_LIGHTMAP\nvarying vec2 vUv2;\n#endif",
lightmap_fragment:"#ifdef USE_LIGHTMAP\ngl_FragColor = gl_FragColor * texture2D( lightMap, vUv2 );\n#endif",lightmap_vertex:"#ifdef USE_LIGHTMAP\nvUv2 = uv2;\n#endif",bumpmap_pars_fragment:"#ifdef USE_BUMPMAP\nuniform sampler2D bumpMap;\nuniform float bumpScale;\nvec2 dHdxy_fwd() {\nvec2 dSTdx = dFdx( vUv );\nvec2 dSTdy = dFdy( vUv );\nfloat Hll = bumpScale * texture2D( bumpMap, vUv ).x;\nfloat dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\nfloat dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;\nreturn vec2( dBx, dBy );\n}\nvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy ) {\nvec3 vSigmaX = dFdx( surf_pos );\nvec3 vSigmaY = dFdy( surf_pos );\nvec3 vN = surf_norm;\nvec3 R1 = cross( vSigmaY, vN );\nvec3 R2 = cross( vN, vSigmaX );\nfloat fDet = dot( vSigmaX, R1 );\nvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\nreturn normalize( abs( fDet ) * surf_norm - vGrad );\n}\n#endif",
normalmap_pars_fragment:"#ifdef USE_NORMALMAP\nuniform sampler2D normalMap;\nuniform vec2 normalScale;\nvec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm ) {\nvec3 q0 = dFdx( eye_pos.xyz );\nvec3 q1 = dFdy( eye_pos.xyz );\nvec2 st0 = dFdx( vUv.st );\nvec2 st1 = dFdy( vUv.st );\nvec3 S = normalize( q0 * st1.t - q1 * st0.t );\nvec3 T = normalize( -q0 * st1.s + q1 * st0.s );\nvec3 N = normalize( surf_norm );\nvec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\nmapN.xy = normalScale * mapN.xy;\nmat3 tsn = mat3( S, T, N );\nreturn normalize( tsn * mapN );\n}\n#endif",
specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\nuniform sampler2D specularMap;\n#endif",specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\nvec4 texelSpecular = texture2D( specularMap, vUv );\nspecularStrength = texelSpecular.r;\n#else\nspecularStrength = 1.0;\n#endif",lights_lambert_pars_vertex:"uniform vec3 ambient;\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 ambientLightColor;\n#if MAX_DIR_LIGHTS > 0\nuniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_HEMI_LIGHTS > 0\nuniform vec3 hemisphereLightSkyColor[ MAX_HEMI_LIGHTS ];\nuniform vec3 hemisphereLightGroundColor[ MAX_HEMI_LIGHTS ];\nuniform vec3 hemisphereLightDirection[ MAX_HEMI_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nuniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];\nuniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\nuniform float pointLightDistance[ MAX_POINT_LIGHTS ];\n#endif\n#if MAX_SPOT_LIGHTS > 0\nuniform vec3 spotLightColor[ MAX_SPOT_LIGHTS ];\nuniform vec3 spotLightPosition[ MAX_SPOT_LIGHTS ];\nuniform vec3 spotLightDirection[ MAX_SPOT_LIGHTS ];\nuniform float spotLightDistance[ MAX_SPOT_LIGHTS ];\nuniform float spotLightAngleCos[ MAX_SPOT_LIGHTS ];\nuniform float spotLightExponent[ MAX_SPOT_LIGHTS ];\n#endif\n#ifdef WRAP_AROUND\nuniform vec3 wrapRGB;\n#endif",
lights_lambert_vertex:"vLightFront = vec3( 0.0 );\n#ifdef DOUBLE_SIDED\nvLightBack = vec3( 0.0 );\n#endif\ntransformedNormal = normalize( transformedNormal );\n#if MAX_DIR_LIGHTS > 0\nfor( int i = 0; i < MAX_DIR_LIGHTS; i ++ ) {\nvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\nvec3 dirVector = normalize( lDirection.xyz );\nfloat dotProduct = dot( transformedNormal, dirVector );\nvec3 directionalLightWeighting = vec3( max( dotProduct, 0.0 ) );\n#ifdef DOUBLE_SIDED\nvec3 directionalLightWeightingBack = vec3( max( -dotProduct, 0.0 ) );\n#ifdef WRAP_AROUND\nvec3 directionalLightWeightingHalfBack = vec3( max( -0.5 * dotProduct + 0.5, 0.0 ) );\n#endif\n#endif\n#ifdef WRAP_AROUND\nvec3 directionalLightWeightingHalf = vec3( max( 0.5 * dotProduct + 0.5, 0.0 ) );\ndirectionalLightWeighting = mix( directionalLightWeighting, directionalLightWeightingHalf, wrapRGB );\n#ifdef DOUBLE_SIDED\ndirectionalLightWeightingBack = mix( directionalLightWeightingBack, directionalLightWeightingHalfBack, wrapRGB );\n#endif\n#endif\nvLightFront += directionalLightColor[ i ] * directionalLightWeighting;\n#ifdef DOUBLE_SIDED\nvLightBack += directionalLightColor[ i ] * directionalLightWeightingBack;\n#endif\n}\n#endif\n#if MAX_POINT_LIGHTS > 0\nfor( int i = 0; i < MAX_POINT_LIGHTS; i ++ ) {\nvec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );\nvec3 lVector = lPosition.xyz - mvPosition.xyz;\nfloat lDistance = 1.0;\nif ( pointLightDistance[ i ] > 0.0 )\nlDistance = 1.0 - min( ( length( lVector ) / pointLightDistance[ i ] ), 1.0 );\nlVector = normalize( lVector );\nfloat dotProduct = dot( transformedNormal, lVector );\nvec3 pointLightWeighting = vec3( max( dotProduct, 0.0 ) );\n#ifdef DOUBLE_SIDED\nvec3 pointLightWeightingBack = vec3( max( -dotProduct, 0.0 ) );\n#ifdef WRAP_AROUND\nvec3 pointLightWeightingHalfBack = vec3( max( -0.5 * dotProduct + 0.5, 0.0 ) );\n#endif\n#endif\n#ifdef WRAP_AROUND\nvec3 pointLightWeightingHalf = vec3( max( 0.5 * dotProduct + 0.5, 0.0 ) );\npointLightWeighting = mix( pointLightWeighting, pointLightWeightingHalf, wrapRGB );\n#ifdef DOUBLE_SIDED\npointLightWeightingBack = mix( pointLightWeightingBack, pointLightWeightingHalfBack, wrapRGB );\n#endif\n#endif\nvLightFront += pointLightColor[ i ] * pointLightWeighting * lDistance;\n#ifdef DOUBLE_SIDED\nvLightBack += pointLightColor[ i ] * pointLightWeightingBack * lDistance;\n#endif\n}\n#endif\n#if MAX_SPOT_LIGHTS > 0\nfor( int i = 0; i < MAX_SPOT_LIGHTS; i ++ ) {\nvec4 lPosition = viewMatrix * vec4( spotLightPosition[ i ], 1.0 );\nvec3 lVector = lPosition.xyz - mvPosition.xyz;\nfloat spotEffect = dot( spotLightDirection[ i ], normalize( spotLightPosition[ i ] - worldPosition.xyz ) );\nif ( spotEffect > spotLightAngleCos[ i ] ) {\nspotEffect = max( pow( spotEffect, spotLightExponent[ i ] ), 0.0 );\nfloat lDistance = 1.0;\nif ( spotLightDistance[ i ] > 0.0 )\nlDistance = 1.0 - min( ( length( lVector ) / spotLightDistance[ i ] ), 1.0 );\nlVector = normalize( lVector );\nfloat dotProduct = dot( transformedNormal, lVector );\nvec3 spotLightWeighting = vec3( max( dotProduct, 0.0 ) );\n#ifdef DOUBLE_SIDED\nvec3 spotLightWeightingBack = vec3( max( -dotProduct, 0.0 ) );\n#ifdef WRAP_AROUND\nvec3 spotLightWeightingHalfBack = vec3( max( -0.5 * dotProduct + 0.5, 0.0 ) );\n#endif\n#endif\n#ifdef WRAP_AROUND\nvec3 spotLightWeightingHalf = vec3( max( 0.5 * dotProduct + 0.5, 0.0 ) );\nspotLightWeighting = mix( spotLightWeighting, spotLightWeightingHalf, wrapRGB );\n#ifdef DOUBLE_SIDED\nspotLightWeightingBack = mix( spotLightWeightingBack, spotLightWeightingHalfBack, wrapRGB );\n#endif\n#endif\nvLightFront += spotLightColor[ i ] * spotLightWeighting * lDistance * spotEffect;\n#ifdef DOUBLE_SIDED\nvLightBack += spotLightColor[ i ] * spotLightWeightingBack * lDistance * spotEffect;\n#endif\n}\n}\n#endif\n#if MAX_HEMI_LIGHTS > 0\nfor( int i = 0; i < MAX_HEMI_LIGHTS; i ++ ) {\nvec4 lDirection = viewMatrix * vec4( hemisphereLightDirection[ i ], 0.0 );\nvec3 lVector = normalize( lDirection.xyz );\nfloat dotProduct = dot( transformedNormal, lVector );\nfloat hemiDiffuseWeight = 0.5 * dotProduct + 0.5;\nfloat hemiDiffuseWeightBack = -0.5 * dotProduct + 0.5;\nvLightFront += mix( hemisphereLightGroundColor[ i ], hemisphereLightSkyColor[ i ], hemiDiffuseWeight );\n#ifdef DOUBLE_SIDED\nvLightBack += mix( hemisphereLightGroundColor[ i ], hemisphereLightSkyColor[ i ], hemiDiffuseWeightBack );\n#endif\n}\n#endif\nvLightFront = vLightFront * diffuse + ambient * ambientLightColor + emissive;\n#ifdef DOUBLE_SIDED\nvLightBack = vLightBack * diffuse + ambient * ambientLightColor + emissive;\n#endif",
lights_phong_pars_vertex:"#ifndef PHONG_PER_PIXEL\n#if MAX_POINT_LIGHTS > 0\nuniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\nuniform float pointLightDistance[ MAX_POINT_LIGHTS ];\nvarying vec4 vPointLight[ MAX_POINT_LIGHTS ];\n#endif\n#if MAX_SPOT_LIGHTS > 0\nuniform vec3 spotLightPosition[ MAX_SPOT_LIGHTS ];\nuniform float spotLightDistance[ MAX_SPOT_LIGHTS ];\nvarying vec4 vSpotLight[ MAX_SPOT_LIGHTS ];\n#endif\n#endif\n#if MAX_SPOT_LIGHTS > 0 || defined( USE_BUMPMAP )\nvarying vec3 vWorldPosition;\n#endif",
lights_phong_vertex:"#ifndef PHONG_PER_PIXEL\n#if MAX_POINT_LIGHTS > 0\nfor( int i = 0; i < MAX_POINT_LIGHTS; i ++ ) {\nvec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );\nvec3 lVector = lPosition.xyz - mvPosition.xyz;\nfloat lDistance = 1.0;\nif ( pointLightDistance[ i ] > 0.0 )\nlDistance = 1.0 - min( ( length( lVector ) / pointLightDistance[ i ] ), 1.0 );\nvPointLight[ i ] = vec4( lVector, lDistance );\n}\n#endif\n#if MAX_SPOT_LIGHTS > 0\nfor( int i = 0; i < MAX_SPOT_LIGHTS; i ++ ) {\nvec4 lPosition = viewMatrix * vec4( spotLightPosition[ i ], 1.0 );\nvec3 lVector = lPosition.xyz - mvPosition.xyz;\nfloat lDistance = 1.0;\nif ( spotLightDistance[ i ] > 0.0 )\nlDistance = 1.0 - min( ( length( lVector ) / spotLightDistance[ i ] ), 1.0 );\nvSpotLight[ i ] = vec4( lVector, lDistance );\n}\n#endif\n#endif\n#if MAX_SPOT_LIGHTS > 0 || defined( USE_BUMPMAP )\nvWorldPosition = worldPosition.xyz;\n#endif",
lights_phong_pars_fragment:"uniform vec3 ambientLightColor;\n#if MAX_DIR_LIGHTS > 0\nuniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_HEMI_LIGHTS > 0\nuniform vec3 hemisphereLightSkyColor[ MAX_HEMI_LIGHTS ];\nuniform vec3 hemisphereLightGroundColor[ MAX_HEMI_LIGHTS ];\nuniform vec3 hemisphereLightDirection[ MAX_HEMI_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nuniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];\n#ifdef PHONG_PER_PIXEL\nuniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\nuniform float pointLightDistance[ MAX_POINT_LIGHTS ];\n#else\nvarying vec4 vPointLight[ MAX_POINT_LIGHTS ];\n#endif\n#endif\n#if MAX_SPOT_LIGHTS > 0\nuniform vec3 spotLightColor[ MAX_SPOT_LIGHTS ];\nuniform vec3 spotLightPosition[ MAX_SPOT_LIGHTS ];\nuniform vec3 spotLightDirection[ MAX_SPOT_LIGHTS ];\nuniform float spotLightAngleCos[ MAX_SPOT_LIGHTS ];\nuniform float spotLightExponent[ MAX_SPOT_LIGHTS ];\n#ifdef PHONG_PER_PIXEL\nuniform float spotLightDistance[ MAX_SPOT_LIGHTS ];\n#else\nvarying vec4 vSpotLight[ MAX_SPOT_LIGHTS ];\n#endif\n#endif\n#if MAX_SPOT_LIGHTS > 0 || defined( USE_BUMPMAP )\nvarying vec3 vWorldPosition;\n#endif\n#ifdef WRAP_AROUND\nuniform vec3 wrapRGB;\n#endif\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;",
lights_phong_fragment:"vec3 normal = normalize( vNormal );\nvec3 viewPosition = normalize( vViewPosition );\n#ifdef DOUBLE_SIDED\nnormal = normal * ( -1.0 + 2.0 * float( gl_FrontFacing ) );\n#endif\n#ifdef USE_NORMALMAP\nnormal = perturbNormal2Arb( -vViewPosition, normal );\n#elif defined( USE_BUMPMAP )\nnormal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd() );\n#endif\n#if MAX_POINT_LIGHTS > 0\nvec3 pointDiffuse = vec3( 0.0 );\nvec3 pointSpecular = vec3( 0.0 );\nfor ( int i = 0; i < MAX_POINT_LIGHTS; i ++ ) {\n#ifdef PHONG_PER_PIXEL\nvec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );\nvec3 lVector = lPosition.xyz + vViewPosition.xyz;\nfloat lDistance = 1.0;\nif ( pointLightDistance[ i ] > 0.0 )\nlDistance = 1.0 - min( ( length( lVector ) / pointLightDistance[ i ] ), 1.0 );\nlVector = normalize( lVector );\n#else\nvec3 lVector = normalize( vPointLight[ i ].xyz );\nfloat lDistance = vPointLight[ i ].w;\n#endif\nfloat dotProduct = dot( normal, lVector );\n#ifdef WRAP_AROUND\nfloat pointDiffuseWeightFull = max( dotProduct, 0.0 );\nfloat pointDiffuseWeightHalf = max( 0.5 * dotProduct + 0.5, 0.0 );\nvec3 pointDiffuseWeight = mix( vec3 ( pointDiffuseWeightFull ), vec3( pointDiffuseWeightHalf ), wrapRGB );\n#else\nfloat pointDiffuseWeight = max( dotProduct, 0.0 );\n#endif\npointDiffuse += diffuse * pointLightColor[ i ] * pointDiffuseWeight * lDistance;\nvec3 pointHalfVector = normalize( lVector + viewPosition );\nfloat pointDotNormalHalf = max( dot( normal, pointHalfVector ), 0.0 );\nfloat pointSpecularWeight = specularStrength * max( pow( pointDotNormalHalf, shininess ), 0.0 );\n#ifdef PHYSICALLY_BASED_SHADING\nfloat specularNormalization = ( shininess + 2.0001 ) / 8.0;\nvec3 schlick = specular + vec3( 1.0 - specular ) * pow( 1.0 - dot( lVector, pointHalfVector ), 5.0 );\npointSpecular += schlick * pointLightColor[ i ] * pointSpecularWeight * pointDiffuseWeight * lDistance * specularNormalization;\n#else\npointSpecular += specular * pointLightColor[ i ] * pointSpecularWeight * pointDiffuseWeight * lDistance;\n#endif\n}\n#endif\n#if MAX_SPOT_LIGHTS > 0\nvec3 spotDiffuse = vec3( 0.0 );\nvec3 spotSpecular = vec3( 0.0 );\nfor ( int i = 0; i < MAX_SPOT_LIGHTS; i ++ ) {\n#ifdef PHONG_PER_PIXEL\nvec4 lPosition = viewMatrix * vec4( spotLightPosition[ i ], 1.0 );\nvec3 lVector = lPosition.xyz + vViewPosition.xyz;\nfloat lDistance = 1.0;\nif ( spotLightDistance[ i ] > 0.0 )\nlDistance = 1.0 - min( ( length( lVector ) / spotLightDistance[ i ] ), 1.0 );\nlVector = normalize( lVector );\n#else\nvec3 lVector = normalize( vSpotLight[ i ].xyz );\nfloat lDistance = vSpotLight[ i ].w;\n#endif\nfloat spotEffect = dot( spotLightDirection[ i ], normalize( spotLightPosition[ i ] - vWorldPosition ) );\nif ( spotEffect > spotLightAngleCos[ i ] ) {\nspotEffect = max( pow( spotEffect, spotLightExponent[ i ] ), 0.0 );\nfloat dotProduct = dot( normal, lVector );\n#ifdef WRAP_AROUND\nfloat spotDiffuseWeightFull = max( dotProduct, 0.0 );\nfloat spotDiffuseWeightHalf = max( 0.5 * dotProduct + 0.5, 0.0 );\nvec3 spotDiffuseWeight = mix( vec3 ( spotDiffuseWeightFull ), vec3( spotDiffuseWeightHalf ), wrapRGB );\n#else\nfloat spotDiffuseWeight = max( dotProduct, 0.0 );\n#endif\nspotDiffuse += diffuse * spotLightColor[ i ] * spotDiffuseWeight * lDistance * spotEffect;\nvec3 spotHalfVector = normalize( lVector + viewPosition );\nfloat spotDotNormalHalf = max( dot( normal, spotHalfVector ), 0.0 );\nfloat spotSpecularWeight = specularStrength * max( pow( spotDotNormalHalf, shininess ), 0.0 );\n#ifdef PHYSICALLY_BASED_SHADING\nfloat specularNormalization = ( shininess + 2.0001 ) / 8.0;\nvec3 schlick = specular + vec3( 1.0 - specular ) * pow( 1.0 - dot( lVector, spotHalfVector ), 5.0 );\nspotSpecular += schlick * spotLightColor[ i ] * spotSpecularWeight * spotDiffuseWeight * lDistance * specularNormalization * spotEffect;\n#else\nspotSpecular += specular * spotLightColor[ i ] * spotSpecularWeight * spotDiffuseWeight * lDistance * spotEffect;\n#endif\n}\n}\n#endif\n#if MAX_DIR_LIGHTS > 0\nvec3 dirDiffuse = vec3( 0.0 );\nvec3 dirSpecular = vec3( 0.0 );\nfor( int i = 0; i < MAX_DIR_LIGHTS; i ++ ) {\nvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\nvec3 dirVector = normalize( lDirection.xyz );\nfloat dotProduct = dot( normal, dirVector );\n#ifdef WRAP_AROUND\nfloat dirDiffuseWeightFull = max( dotProduct, 0.0 );\nfloat dirDiffuseWeightHalf = max( 0.5 * dotProduct + 0.5, 0.0 );\nvec3 dirDiffuseWeight = mix( vec3( dirDiffuseWeightFull ), vec3( dirDiffuseWeightHalf ), wrapRGB );\n#else\nfloat dirDiffuseWeight = max( dotProduct, 0.0 );\n#endif\ndirDiffuse += diffuse * directionalLightColor[ i ] * dirDiffuseWeight;\nvec3 dirHalfVector = normalize( dirVector + viewPosition );\nfloat dirDotNormalHalf = max( dot( normal, dirHalfVector ), 0.0 );\nfloat dirSpecularWeight = specularStrength * max( pow( dirDotNormalHalf, shininess ), 0.0 );\n#ifdef PHYSICALLY_BASED_SHADING\nfloat specularNormalization = ( shininess + 2.0001 ) / 8.0;\nvec3 schlick = specular + vec3( 1.0 - specular ) * pow( 1.0 - dot( dirVector, dirHalfVector ), 5.0 );\ndirSpecular += schlick * directionalLightColor[ i ] * dirSpecularWeight * dirDiffuseWeight * specularNormalization;\n#else\ndirSpecular += specular * directionalLightColor[ i ] * dirSpecularWeight * dirDiffuseWeight;\n#endif\n}\n#endif\n#if MAX_HEMI_LIGHTS > 0\nvec3 hemiDiffuse = vec3( 0.0 );\nvec3 hemiSpecular = vec3( 0.0 );\nfor( int i = 0; i < MAX_HEMI_LIGHTS; i ++ ) {\nvec4 lDirection = viewMatrix * vec4( hemisphereLightDirection[ i ], 0.0 );\nvec3 lVector = normalize( lDirection.xyz );\nfloat dotProduct = dot( normal, lVector );\nfloat hemiDiffuseWeight = 0.5 * dotProduct + 0.5;\nvec3 hemiColor = mix( hemisphereLightGroundColor[ i ], hemisphereLightSkyColor[ i ], hemiDiffuseWeight );\nhemiDiffuse += diffuse * hemiColor;\nvec3 hemiHalfVectorSky = normalize( lVector + viewPosition );\nfloat hemiDotNormalHalfSky = 0.5 * dot( normal, hemiHalfVectorSky ) + 0.5;\nfloat hemiSpecularWeightSky = specularStrength * max( pow( hemiDotNormalHalfSky, shininess ), 0.0 );\nvec3 lVectorGround = -lVector;\nvec3 hemiHalfVectorGround = normalize( lVectorGround + viewPosition );\nfloat hemiDotNormalHalfGround = 0.5 * dot( normal, hemiHalfVectorGround ) + 0.5;\nfloat hemiSpecularWeightGround = specularStrength * max( pow( hemiDotNormalHalfGround, shininess ), 0.0 );\n#ifdef PHYSICALLY_BASED_SHADING\nfloat dotProductGround = dot( normal, lVectorGround );\nfloat specularNormalization = ( shininess + 2.0001 ) / 8.0;\nvec3 schlickSky = specular + vec3( 1.0 - specular ) * pow( 1.0 - dot( lVector, hemiHalfVectorSky ), 5.0 );\nvec3 schlickGround = specular + vec3( 1.0 - specular ) * pow( 1.0 - dot( lVectorGround, hemiHalfVectorGround ), 5.0 );\nhemiSpecular += hemiColor * specularNormalization * ( schlickSky * hemiSpecularWeightSky * max( dotProduct, 0.0 ) + schlickGround * hemiSpecularWeightGround * max( dotProductGround, 0.0 ) );\n#else\nhemiSpecular += specular * hemiColor * ( hemiSpecularWeightSky + hemiSpecularWeightGround ) * hemiDiffuseWeight;\n#endif\n}\n#endif\nvec3 totalDiffuse = vec3( 0.0 );\nvec3 totalSpecular = vec3( 0.0 );\n#if MAX_DIR_LIGHTS > 0\ntotalDiffuse += dirDiffuse;\ntotalSpecular += dirSpecular;\n#endif\n#if MAX_HEMI_LIGHTS > 0\ntotalDiffuse += hemiDiffuse;\ntotalSpecular += hemiSpecular;\n#endif\n#if MAX_POINT_LIGHTS > 0\ntotalDiffuse += pointDiffuse;\ntotalSpecular += pointSpecular;\n#endif\n#if MAX_SPOT_LIGHTS > 0\ntotalDiffuse += spotDiffuse;\ntotalSpecular += spotSpecular;\n#endif\n#ifdef METAL\ngl_FragColor.xyz = gl_FragColor.xyz * ( emissive + totalDiffuse + ambientLightColor * ambient + totalSpecular );\n#else\ngl_FragColor.xyz = gl_FragColor.xyz * ( emissive + totalDiffuse + ambientLightColor * ambient ) + totalSpecular;\n#endif",
color_pars_fragment:"#ifdef USE_COLOR\nvarying vec3 vColor;\n#endif",color_fragment:"#ifdef USE_COLOR\ngl_FragColor = gl_FragColor * vec4( vColor, 1.0 );\n#endif",color_pars_vertex:"#ifdef USE_COLOR\nvarying vec3 vColor;\n#endif",color_vertex:"#ifdef USE_COLOR\n#ifdef GAMMA_INPUT\nvColor = color * color;\n#else\nvColor = color;\n#endif\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\n#ifdef BONE_TEXTURE\nuniform sampler2D boneTexture;\nuniform int boneTextureWidth;\nuniform int boneTextureHeight;\nmat4 getBoneMatrix( const in float i ) {\nfloat j = i * 4.0;\nfloat x = mod( j, float( boneTextureWidth ) );\nfloat y = floor( j / float( boneTextureWidth ) );\nfloat dx = 1.0 / float( boneTextureWidth );\nfloat dy = 1.0 / float( boneTextureHeight );\ny = dy * ( y + 0.5 );\nvec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\nvec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\nvec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\nvec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\nmat4 bone = mat4( v1, v2, v3, v4 );\nreturn bone;\n}\n#else\nuniform mat4 boneGlobalMatrices[ MAX_BONES ];\nmat4 getBoneMatrix( const in float i ) {\nmat4 bone = boneGlobalMatrices[ int(i) ];\nreturn bone;\n}\n#endif\n#endif",
skinbase_vertex:"#ifdef USE_SKINNING\nmat4 boneMatX = getBoneMatrix( skinIndex.x );\nmat4 boneMatY = getBoneMatrix( skinIndex.y );\n#endif",skinning_vertex:"#ifdef USE_SKINNING\n#ifdef USE_MORPHTARGETS\nvec4 skinVertex = vec4( morphed, 1.0 );\n#else\nvec4 skinVertex = vec4( position, 1.0 );\n#endif\nvec4 skinned = boneMatX * skinVertex * skinWeight.x;\nskinned \t += boneMatY * skinVertex * skinWeight.y;\n#endif",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n#ifndef USE_MORPHNORMALS\nuniform float morphTargetInfluences[ 8 ];\n#else\nuniform float morphTargetInfluences[ 4 ];\n#endif\n#endif",
morphtarget_vertex:"#ifdef USE_MORPHTARGETS\nvec3 morphed = vec3( 0.0 );\nmorphed += ( morphTarget0 - position ) * morphTargetInfluences[ 0 ];\nmorphed += ( morphTarget1 - position ) * morphTargetInfluences[ 1 ];\nmorphed += ( morphTarget2 - position ) * morphTargetInfluences[ 2 ];\nmorphed += ( morphTarget3 - position ) * morphTargetInfluences[ 3 ];\n#ifndef USE_MORPHNORMALS\nmorphed += ( morphTarget4 - position ) * morphTargetInfluences[ 4 ];\nmorphed += ( morphTarget5 - position ) * morphTargetInfluences[ 5 ];\nmorphed += ( morphTarget6 - position ) * morphTargetInfluences[ 6 ];\nmorphed += ( morphTarget7 - position ) * morphTargetInfluences[ 7 ];\n#endif\nmorphed += position;\n#endif",
default_vertex:"vec4 mvPosition;\n#ifdef USE_SKINNING\nmvPosition = modelViewMatrix * skinned;\n#endif\n#if !defined( USE_SKINNING ) && defined( USE_MORPHTARGETS )\nmvPosition = modelViewMatrix * vec4( morphed, 1.0 );\n#endif\n#if !defined( USE_SKINNING ) && ! defined( USE_MORPHTARGETS )\nmvPosition = modelViewMatrix * vec4( position, 1.0 );\n#endif\ngl_Position = projectionMatrix * mvPosition;",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\nvec3 morphedNormal = vec3( 0.0 );\nmorphedNormal += ( morphNormal0 - normal ) * morphTargetInfluences[ 0 ];\nmorphedNormal += ( morphNormal1 - normal ) * morphTargetInfluences[ 1 ];\nmorphedNormal += ( morphNormal2 - normal ) * morphTargetInfluences[ 2 ];\nmorphedNormal += ( morphNormal3 - normal ) * morphTargetInfluences[ 3 ];\nmorphedNormal += normal;\n#endif",
skinnormal_vertex:"#ifdef USE_SKINNING\nmat4 skinMatrix = skinWeight.x * boneMatX;\nskinMatrix \t+= skinWeight.y * boneMatY;\n#ifdef USE_MORPHNORMALS\nvec4 skinnedNormal = skinMatrix * vec4( morphedNormal, 0.0 );\n#else\nvec4 skinnedNormal = skinMatrix * vec4( normal, 0.0 );\n#endif\n#endif",defaultnormal_vertex:"vec3 objectNormal;\n#ifdef USE_SKINNING\nobjectNormal = skinnedNormal.xyz;\n#endif\n#if !defined( USE_SKINNING ) && defined( USE_MORPHNORMALS )\nobjectNormal = morphedNormal;\n#endif\n#if !defined( USE_SKINNING ) && ! defined( USE_MORPHNORMALS )\nobjectNormal = normal;\n#endif\n#ifdef FLIP_SIDED\nobjectNormal = -objectNormal;\n#endif\nvec3 transformedNormal = normalMatrix * objectNormal;",
shadowmap_pars_fragment:"#ifdef USE_SHADOWMAP\nuniform sampler2D shadowMap[ MAX_SHADOWS ];\nuniform vec2 shadowMapSize[ MAX_SHADOWS ];\nuniform float shadowDarkness[ MAX_SHADOWS ];\nuniform float shadowBias[ MAX_SHADOWS ];\nvarying vec4 vShadowCoord[ MAX_SHADOWS ];\nfloat unpackDepth( const in vec4 rgba_depth ) {\nconst vec4 bit_shift = vec4( 1.0 / ( 256.0 * 256.0 * 256.0 ), 1.0 / ( 256.0 * 256.0 ), 1.0 / 256.0, 1.0 );\nfloat depth = dot( rgba_depth, bit_shift );\nreturn depth;\n}\n#endif",shadowmap_fragment:"#ifdef USE_SHADOWMAP\n#ifdef SHADOWMAP_DEBUG\nvec3 frustumColors[3];\nfrustumColors[0] = vec3( 1.0, 0.5, 0.0 );\nfrustumColors[1] = vec3( 0.0, 1.0, 0.8 );\nfrustumColors[2] = vec3( 0.0, 0.5, 1.0 );\n#endif\n#ifdef SHADOWMAP_CASCADE\nint inFrustumCount = 0;\n#endif\nfloat fDepth;\nvec3 shadowColor = vec3( 1.0 );\nfor( int i = 0; i < MAX_SHADOWS; i ++ ) {\nvec3 shadowCoord = vShadowCoord[ i ].xyz / vShadowCoord[ i ].w;\nbvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\nbool inFrustum = all( inFrustumVec );\n#ifdef SHADOWMAP_CASCADE\ninFrustumCount += int( inFrustum );\nbvec3 frustumTestVec = bvec3( inFrustum, inFrustumCount == 1, shadowCoord.z <= 1.0 );\n#else\nbvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\n#endif\nbool frustumTest = all( frustumTestVec );\nif ( frustumTest ) {\nshadowCoord.z += shadowBias[ i ];\n#if defined( SHADOWMAP_TYPE_PCF )\nfloat shadow = 0.0;\nconst float shadowDelta = 1.0 / 9.0;\nfloat xPixelOffset = 1.0 / shadowMapSize[ i ].x;\nfloat yPixelOffset = 1.0 / shadowMapSize[ i ].y;\nfloat dx0 = -1.25 * xPixelOffset;\nfloat dy0 = -1.25 * yPixelOffset;\nfloat dx1 = 1.25 * xPixelOffset;\nfloat dy1 = 1.25 * yPixelOffset;\nfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, dy0 ) ) );\nif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\nfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( 0.0, dy0 ) ) );\nif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\nfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, dy0 ) ) );\nif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\nfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, 0.0 ) ) );\nif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\nfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy ) );\nif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\nfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, 0.0 ) ) );\nif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\nfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, dy1 ) ) );\nif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\nfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( 0.0, dy1 ) ) );\nif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\nfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, dy1 ) ) );\nif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\nshadowColor = shadowColor * vec3( ( 1.0 - shadowDarkness[ i ] * shadow ) );\n#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\nfloat shadow = 0.0;\nfloat xPixelOffset = 1.0 / shadowMapSize[ i ].x;\nfloat yPixelOffset = 1.0 / shadowMapSize[ i ].y;\nfloat dx0 = -1.0 * xPixelOffset;\nfloat dy0 = -1.0 * yPixelOffset;\nfloat dx1 = 1.0 * xPixelOffset;\nfloat dy1 = 1.0 * yPixelOffset;\nmat3 shadowKernel;\nmat3 depthKernel;\ndepthKernel[0][0] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, dy0 ) ) );\ndepthKernel[0][1] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, 0.0 ) ) );\ndepthKernel[0][2] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, dy1 ) ) );\ndepthKernel[1][0] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( 0.0, dy0 ) ) );\ndepthKernel[1][1] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy ) );\ndepthKernel[1][2] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( 0.0, dy1 ) ) );\ndepthKernel[2][0] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, dy0 ) ) );\ndepthKernel[2][1] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, 0.0 ) ) );\ndepthKernel[2][2] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, dy1 ) ) );\nvec3 shadowZ = vec3( shadowCoord.z );\nshadowKernel[0] = vec3(lessThan(depthKernel[0], shadowZ ));\nshadowKernel[0] *= vec3(0.25);\nshadowKernel[1] = vec3(lessThan(depthKernel[1], shadowZ ));\nshadowKernel[1] *= vec3(0.25);\nshadowKernel[2] = vec3(lessThan(depthKernel[2], shadowZ ));\nshadowKernel[2] *= vec3(0.25);\nvec2 fractionalCoord = 1.0 - fract( shadowCoord.xy * shadowMapSize[i].xy );\nshadowKernel[0] = mix( shadowKernel[1], shadowKernel[0], fractionalCoord.x );\nshadowKernel[1] = mix( shadowKernel[2], shadowKernel[1], fractionalCoord.x );\nvec4 shadowValues;\nshadowValues.x = mix( shadowKernel[0][1], shadowKernel[0][0], fractionalCoord.y );\nshadowValues.y = mix( shadowKernel[0][2], shadowKernel[0][1], fractionalCoord.y );\nshadowValues.z = mix( shadowKernel[1][1], shadowKernel[1][0], fractionalCoord.y );\nshadowValues.w = mix( shadowKernel[1][2], shadowKernel[1][1], fractionalCoord.y );\nshadow = dot( shadowValues, vec4( 1.0 ) );\nshadowColor = shadowColor * vec3( ( 1.0 - shadowDarkness[ i ] * shadow ) );\n#else\nvec4 rgbaDepth = texture2D( shadowMap[ i ], shadowCoord.xy );\nfloat fDepth = unpackDepth( rgbaDepth );\nif ( fDepth < shadowCoord.z )\nshadowColor = shadowColor * vec3( 1.0 - shadowDarkness[ i ] );\n#endif\n}\n#ifdef SHADOWMAP_DEBUG\n#ifdef SHADOWMAP_CASCADE\nif ( inFrustum && inFrustumCount == 1 ) gl_FragColor.xyz *= frustumColors[ i ];\n#else\nif ( inFrustum ) gl_FragColor.xyz *= frustumColors[ i ];\n#endif\n#endif\n}\n#ifdef GAMMA_OUTPUT\nshadowColor *= shadowColor;\n#endif\ngl_FragColor.xyz = gl_FragColor.xyz * shadowColor;\n#endif",
shadowmap_pars_vertex:"#ifdef USE_SHADOWMAP\nvarying vec4 vShadowCoord[ MAX_SHADOWS ];\nuniform mat4 shadowMatrix[ MAX_SHADOWS ];\n#endif",shadowmap_vertex:"#ifdef USE_SHADOWMAP\nfor( int i = 0; i < MAX_SHADOWS; i ++ ) {\nvShadowCoord[ i ] = shadowMatrix[ i ] * worldPosition;\n}\n#endif",alphatest_fragment:"#ifdef ALPHATEST\nif ( gl_FragColor.a < ALPHATEST ) discard;\n#endif",linear_to_gamma_fragment:"#ifdef GAMMA_OUTPUT\ngl_FragColor.xyz = sqrt( gl_FragColor.xyz );\n#endif"};
THREE.UniformsUtils={merge:function(a){var b,c,d,e={};for(b=0;b<a.length;b++)for(c in d=this.clone(a[b]),d)e[c]=d[c];return e},clone:function(a){var b,c,d,e={};for(b in a)for(c in e[b]={},a[b])d=a[b][c],e[b][c]=d instanceof THREE.Color||d instanceof THREE.Vector2||d instanceof THREE.Vector3||d instanceof THREE.Vector4||d instanceof THREE.Matrix4||d instanceof THREE.Texture?d.clone():d instanceof Array?d.slice():d;return e}};
THREE.UniformsLib={common:{diffuse:{type:"c",value:new THREE.Color(15658734)},opacity:{type:"f",value:1},map:{type:"t",value:null},offsetRepeat:{type:"v4",value:new THREE.Vector4(0,0,1,1)},lightMap:{type:"t",value:null},specularMap:{type:"t",value:null},envMap:{type:"t",value:null},flipEnvMap:{type:"f",value:-1},useRefract:{type:"i",value:0},reflectivity:{type:"f",value:1},refractionRatio:{type:"f",value:0.98},combine:{type:"i",value:0},morphTargetInfluences:{type:"f",value:0}},bump:{bumpMap:{type:"t",
value:null},bumpScale:{type:"f",value:1}},normalmap:{normalMap:{type:"t",value:null},normalScale:{type:"v2",value:new THREE.Vector2(1,1)}},fog:{fogDensity:{type:"f",value:2.5E-4},fogNear:{type:"f",value:1},fogFar:{type:"f",value:2E3},fogColor:{type:"c",value:new THREE.Color(16777215)}},lights:{ambientLightColor:{type:"fv",value:[]},directionalLightDirection:{type:"fv",value:[]},directionalLightColor:{type:"fv",value:[]},hemisphereLightDirection:{type:"fv",value:[]},hemisphereLightSkyColor:{type:"fv",
value:[]},hemisphereLightGroundColor:{type:"fv",value:[]},pointLightColor:{type:"fv",value:[]},pointLightPosition:{type:"fv",value:[]},pointLightDistance:{type:"fv1",value:[]},spotLightColor:{type:"fv",value:[]},spotLightPosition:{type:"fv",value:[]},spotLightDirection:{type:"fv",value:[]},spotLightDistance:{type:"fv1",value:[]},spotLightAngleCos:{type:"fv1",value:[]},spotLightExponent:{type:"fv1",value:[]}},particle:{psColor:{type:"c",value:new THREE.Color(15658734)},opacity:{type:"f",value:1},size:{type:"f",
value:1},scale:{type:"f",value:1},map:{type:"t",value:null},fogDensity:{type:"f",value:2.5E-4},fogNear:{type:"f",value:1},fogFar:{type:"f",value:2E3},fogColor:{type:"c",value:new THREE.Color(16777215)}},shadowmap:{shadowMap:{type:"tv",value:[]},shadowMapSize:{type:"v2v",value:[]},shadowBias:{type:"fv1",value:[]},shadowDarkness:{type:"fv1",value:[]},shadowMatrix:{type:"m4v",value:[]}}};
THREE.ShaderLib={basic:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.common,THREE.UniformsLib.fog,THREE.UniformsLib.shadowmap]),vertexShader:[THREE.ShaderChunk.map_pars_vertex,THREE.ShaderChunk.lightmap_pars_vertex,THREE.ShaderChunk.envmap_pars_vertex,THREE.ShaderChunk.color_pars_vertex,THREE.ShaderChunk.morphtarget_pars_vertex,THREE.ShaderChunk.skinning_pars_vertex,THREE.ShaderChunk.shadowmap_pars_vertex,"void main() {",THREE.ShaderChunk.map_vertex,THREE.ShaderChunk.lightmap_vertex,THREE.ShaderChunk.color_vertex,
THREE.ShaderChunk.skinbase_vertex,"#ifdef USE_ENVMAP",THREE.ShaderChunk.morphnormal_vertex,THREE.ShaderChunk.skinnormal_vertex,THREE.ShaderChunk.defaultnormal_vertex,"#endif",THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderChunk.default_vertex,THREE.ShaderChunk.worldpos_vertex,THREE.ShaderChunk.envmap_vertex,THREE.ShaderChunk.shadowmap_vertex,"}"].join("\n"),fragmentShader:["uniform vec3 diffuse;\nuniform float opacity;",THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_pars_fragment,
THREE.ShaderChunk.lightmap_pars_fragment,THREE.ShaderChunk.envmap_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,THREE.ShaderChunk.shadowmap_pars_fragment,THREE.ShaderChunk.specularmap_pars_fragment,"void main() {\ngl_FragColor = vec4( diffuse, opacity );",THREE.ShaderChunk.map_fragment,THREE.ShaderChunk.alphatest_fragment,THREE.ShaderChunk.specularmap_fragment,THREE.ShaderChunk.lightmap_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.envmap_fragment,THREE.ShaderChunk.shadowmap_fragment,
THREE.ShaderChunk.linear_to_gamma_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n")},lambert:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.common,THREE.UniformsLib.fog,THREE.UniformsLib.lights,THREE.UniformsLib.shadowmap,{ambient:{type:"c",value:new THREE.Color(16777215)},emissive:{type:"c",value:new THREE.Color(0)},wrapRGB:{type:"v3",value:new THREE.Vector3(1,1,1)}}]),vertexShader:["#define LAMBERT\nvarying vec3 vLightFront;\n#ifdef DOUBLE_SIDED\nvarying vec3 vLightBack;\n#endif",
THREE.ShaderChunk.map_pars_vertex,THREE.ShaderChunk.lightmap_pars_vertex,THREE.ShaderChunk.envmap_pars_vertex,THREE.ShaderChunk.lights_lambert_pars_vertex,THREE.ShaderChunk.color_pars_vertex,THREE.ShaderChunk.morphtarget_pars_vertex,THREE.ShaderChunk.skinning_pars_vertex,THREE.ShaderChunk.shadowmap_pars_vertex,"void main() {",THREE.ShaderChunk.map_vertex,THREE.ShaderChunk.lightmap_vertex,THREE.ShaderChunk.color_vertex,THREE.ShaderChunk.morphnormal_vertex,THREE.ShaderChunk.skinbase_vertex,THREE.ShaderChunk.skinnormal_vertex,
THREE.ShaderChunk.defaultnormal_vertex,THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderChunk.default_vertex,THREE.ShaderChunk.worldpos_vertex,THREE.ShaderChunk.envmap_vertex,THREE.ShaderChunk.lights_lambert_vertex,THREE.ShaderChunk.shadowmap_vertex,"}"].join("\n"),fragmentShader:["uniform float opacity;\nvarying vec3 vLightFront;\n#ifdef DOUBLE_SIDED\nvarying vec3 vLightBack;\n#endif",THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_pars_fragment,THREE.ShaderChunk.lightmap_pars_fragment,
THREE.ShaderChunk.envmap_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,THREE.ShaderChunk.shadowmap_pars_fragment,THREE.ShaderChunk.specularmap_pars_fragment,"void main() {\ngl_FragColor = vec4( vec3 ( 1.0 ), opacity );",THREE.ShaderChunk.map_fragment,THREE.ShaderChunk.alphatest_fragment,THREE.ShaderChunk.specularmap_fragment,"#ifdef DOUBLE_SIDED\nif ( gl_FrontFacing )\ngl_FragColor.xyz *= vLightFront;\nelse\ngl_FragColor.xyz *= vLightBack;\n#else\ngl_FragColor.xyz *= vLightFront;\n#endif",THREE.ShaderChunk.lightmap_fragment,
THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.envmap_fragment,THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.linear_to_gamma_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n")},phong:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.common,THREE.UniformsLib.bump,THREE.UniformsLib.normalmap,THREE.UniformsLib.fog,THREE.UniformsLib.lights,THREE.UniformsLib.shadowmap,{ambient:{type:"c",value:new THREE.Color(16777215)},emissive:{type:"c",value:new THREE.Color(0)},specular:{type:"c",
value:new THREE.Color(1118481)},shininess:{type:"f",value:30},wrapRGB:{type:"v3",value:new THREE.Vector3(1,1,1)}}]),vertexShader:["#define PHONG\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;",THREE.ShaderChunk.map_pars_vertex,THREE.ShaderChunk.lightmap_pars_vertex,THREE.ShaderChunk.envmap_pars_vertex,THREE.ShaderChunk.lights_phong_pars_vertex,THREE.ShaderChunk.color_pars_vertex,THREE.ShaderChunk.morphtarget_pars_vertex,THREE.ShaderChunk.skinning_pars_vertex,THREE.ShaderChunk.shadowmap_pars_vertex,
"void main() {",THREE.ShaderChunk.map_vertex,THREE.ShaderChunk.lightmap_vertex,THREE.ShaderChunk.color_vertex,THREE.ShaderChunk.morphnormal_vertex,THREE.ShaderChunk.skinbase_vertex,THREE.ShaderChunk.skinnormal_vertex,THREE.ShaderChunk.defaultnormal_vertex,"vNormal = normalize( transformedNormal );",THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderChunk.default_vertex,"vViewPosition = -mvPosition.xyz;",THREE.ShaderChunk.worldpos_vertex,THREE.ShaderChunk.envmap_vertex,
THREE.ShaderChunk.lights_phong_vertex,THREE.ShaderChunk.shadowmap_vertex,"}"].join("\n"),fragmentShader:["uniform vec3 diffuse;\nuniform float opacity;\nuniform vec3 ambient;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;",THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_pars_fragment,THREE.ShaderChunk.lightmap_pars_fragment,THREE.ShaderChunk.envmap_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,THREE.ShaderChunk.lights_phong_pars_fragment,THREE.ShaderChunk.shadowmap_pars_fragment,
THREE.ShaderChunk.bumpmap_pars_fragment,THREE.ShaderChunk.normalmap_pars_fragment,THREE.ShaderChunk.specularmap_pars_fragment,"void main() {\ngl_FragColor = vec4( vec3 ( 1.0 ), opacity );",THREE.ShaderChunk.map_fragment,THREE.ShaderChunk.alphatest_fragment,THREE.ShaderChunk.specularmap_fragment,THREE.ShaderChunk.lights_phong_fragment,THREE.ShaderChunk.lightmap_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.envmap_fragment,THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.linear_to_gamma_fragment,
THREE.ShaderChunk.fog_fragment,"}"].join("\n")},particle_basic:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.particle,THREE.UniformsLib.shadowmap]),vertexShader:["uniform float size;\nuniform float scale;",THREE.ShaderChunk.color_pars_vertex,THREE.ShaderChunk.shadowmap_pars_vertex,"void main() {",THREE.ShaderChunk.color_vertex,"vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n#ifdef USE_SIZEATTENUATION\ngl_PointSize = size * ( scale / length( mvPosition.xyz ) );\n#else\ngl_PointSize = size;\n#endif\ngl_Position = projectionMatrix * mvPosition;",
THREE.ShaderChunk.worldpos_vertex,THREE.ShaderChunk.shadowmap_vertex,"}"].join("\n"),fragmentShader:["uniform vec3 psColor;\nuniform float opacity;",THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_particle_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,THREE.ShaderChunk.shadowmap_pars_fragment,"void main() {\ngl_FragColor = vec4( psColor, opacity );",THREE.ShaderChunk.map_particle_fragment,THREE.ShaderChunk.alphatest_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.shadowmap_fragment,
THREE.ShaderChunk.fog_fragment,"}"].join("\n")},dashed:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.common,THREE.UniformsLib.fog,{scale:{type:"f",value:1},dashSize:{type:"f",value:1},totalSize:{type:"f",value:2}}]),vertexShader:["uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;",THREE.ShaderChunk.color_pars_vertex,"void main() {",THREE.ShaderChunk.color_vertex,"vLineDistance = scale * lineDistance;\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\ngl_Position = projectionMatrix * mvPosition;\n}"].join("\n"),
fragmentShader:["uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;",THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,"void main() {\nif ( mod( vLineDistance, totalSize ) > dashSize ) {\ndiscard;\n}\ngl_FragColor = vec4( diffuse, opacity );",THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n")},depth:{uniforms:{mNear:{type:"f",value:1},mFar:{type:"f",value:2E3},opacity:{type:"f",
value:1}},vertexShader:"void main() {\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform float mNear;\nuniform float mFar;\nuniform float opacity;\nvoid main() {\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\nfloat color = 1.0 - smoothstep( mNear, mFar, depth );\ngl_FragColor = vec4( vec3( color ), opacity );\n}"},normal:{uniforms:{opacity:{type:"f",value:1}},vertexShader:["varying vec3 vNormal;",THREE.ShaderChunk.morphtarget_pars_vertex,"void main() {\nvNormal = normalize( normalMatrix * normal );",
THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.default_vertex,"}"].join("\n"),fragmentShader:"uniform float opacity;\nvarying vec3 vNormal;\nvoid main() {\ngl_FragColor = vec4( 0.5 * normalize( vNormal ) + 0.5, opacity );\n}"},normalmap:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.fog,THREE.UniformsLib.lights,THREE.UniformsLib.shadowmap,{enableAO:{type:"i",value:0},enableDiffuse:{type:"i",value:0},enableSpecular:{type:"i",value:0},enableReflection:{type:"i",value:0},enableDisplacement:{type:"i",
value:0},tDisplacement:{type:"t",value:null},tDiffuse:{type:"t",value:null},tCube:{type:"t",value:null},tNormal:{type:"t",value:null},tSpecular:{type:"t",value:null},tAO:{type:"t",value:null},uNormalScale:{type:"v2",value:new THREE.Vector2(1,1)},uDisplacementBias:{type:"f",value:0},uDisplacementScale:{type:"f",value:1},uDiffuseColor:{type:"c",value:new THREE.Color(16777215)},uSpecularColor:{type:"c",value:new THREE.Color(1118481)},uAmbientColor:{type:"c",value:new THREE.Color(16777215)},uShininess:{type:"f",
value:30},uOpacity:{type:"f",value:1},useRefract:{type:"i",value:0},uRefractionRatio:{type:"f",value:0.98},uReflectivity:{type:"f",value:0.5},uOffset:{type:"v2",value:new THREE.Vector2(0,0)},uRepeat:{type:"v2",value:new THREE.Vector2(1,1)},wrapRGB:{type:"v3",value:new THREE.Vector3(1,1,1)}}]),fragmentShader:["uniform vec3 uAmbientColor;\nuniform vec3 uDiffuseColor;\nuniform vec3 uSpecularColor;\nuniform float uShininess;\nuniform float uOpacity;\nuniform bool enableDiffuse;\nuniform bool enableSpecular;\nuniform bool enableAO;\nuniform bool enableReflection;\nuniform sampler2D tDiffuse;\nuniform sampler2D tNormal;\nuniform sampler2D tSpecular;\nuniform sampler2D tAO;\nuniform samplerCube tCube;\nuniform vec2 uNormalScale;\nuniform bool useRefract;\nuniform float uRefractionRatio;\nuniform float uReflectivity;\nvarying vec3 vTangent;\nvarying vec3 vBinormal;\nvarying vec3 vNormal;\nvarying vec2 vUv;\nuniform vec3 ambientLightColor;\n#if MAX_DIR_LIGHTS > 0\nuniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_HEMI_LIGHTS > 0\nuniform vec3 hemisphereLightSkyColor[ MAX_HEMI_LIGHTS ];\nuniform vec3 hemisphereLightGroundColor[ MAX_HEMI_LIGHTS ];\nuniform vec3 hemisphereLightDirection[ MAX_HEMI_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nuniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];\nuniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\nuniform float pointLightDistance[ MAX_POINT_LIGHTS ];\n#endif\n#if MAX_SPOT_LIGHTS > 0\nuniform vec3 spotLightColor[ MAX_SPOT_LIGHTS ];\nuniform vec3 spotLightPosition[ MAX_SPOT_LIGHTS ];\nuniform vec3 spotLightDirection[ MAX_SPOT_LIGHTS ];\nuniform float spotLightAngleCos[ MAX_SPOT_LIGHTS ];\nuniform float spotLightExponent[ MAX_SPOT_LIGHTS ];\nuniform float spotLightDistance[ MAX_SPOT_LIGHTS ];\n#endif\n#ifdef WRAP_AROUND\nuniform vec3 wrapRGB;\n#endif\nvarying vec3 vWorldPosition;\nvarying vec3 vViewPosition;",
THREE.ShaderChunk.shadowmap_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,"void main() {\ngl_FragColor = vec4( vec3( 1.0 ), uOpacity );\nvec3 specularTex = vec3( 1.0 );\nvec3 normalTex = texture2D( tNormal, vUv ).xyz * 2.0 - 1.0;\nnormalTex.xy *= uNormalScale;\nnormalTex = normalize( normalTex );\nif( enableDiffuse ) {\n#ifdef GAMMA_INPUT\nvec4 texelColor = texture2D( tDiffuse, vUv );\ntexelColor.xyz *= texelColor.xyz;\ngl_FragColor = gl_FragColor * texelColor;\n#else\ngl_FragColor = gl_FragColor * texture2D( tDiffuse, vUv );\n#endif\n}\nif( enableAO ) {\n#ifdef GAMMA_INPUT\nvec4 aoColor = texture2D( tAO, vUv );\naoColor.xyz *= aoColor.xyz;\ngl_FragColor.xyz = gl_FragColor.xyz * aoColor.xyz;\n#else\ngl_FragColor.xyz = gl_FragColor.xyz * texture2D( tAO, vUv ).xyz;\n#endif\n}\nif( enableSpecular )\nspecularTex = texture2D( tSpecular, vUv ).xyz;\nmat3 tsb = mat3( normalize( vTangent ), normalize( vBinormal ), normalize( vNormal ) );\nvec3 finalNormal = tsb * normalTex;\n#ifdef FLIP_SIDED\nfinalNormal = -finalNormal;\n#endif\nvec3 normal = normalize( finalNormal );\nvec3 viewPosition = normalize( vViewPosition );\n#if MAX_POINT_LIGHTS > 0\nvec3 pointDiffuse = vec3( 0.0 );\nvec3 pointSpecular = vec3( 0.0 );\nfor ( int i = 0; i < MAX_POINT_LIGHTS; i ++ ) {\nvec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );\nvec3 pointVector = lPosition.xyz + vViewPosition.xyz;\nfloat pointDistance = 1.0;\nif ( pointLightDistance[ i ] > 0.0 )\npointDistance = 1.0 - min( ( length( pointVector ) / pointLightDistance[ i ] ), 1.0 );\npointVector = normalize( pointVector );\n#ifdef WRAP_AROUND\nfloat pointDiffuseWeightFull = max( dot( normal, pointVector ), 0.0 );\nfloat pointDiffuseWeightHalf = max( 0.5 * dot( normal, pointVector ) + 0.5, 0.0 );\nvec3 pointDiffuseWeight = mix( vec3 ( pointDiffuseWeightFull ), vec3( pointDiffuseWeightHalf ), wrapRGB );\n#else\nfloat pointDiffuseWeight = max( dot( normal, pointVector ), 0.0 );\n#endif\npointDiffuse += pointDistance * pointLightColor[ i ] * uDiffuseColor * pointDiffuseWeight;\nvec3 pointHalfVector = normalize( pointVector + viewPosition );\nfloat pointDotNormalHalf = max( dot( normal, pointHalfVector ), 0.0 );\nfloat pointSpecularWeight = specularTex.r * max( pow( pointDotNormalHalf, uShininess ), 0.0 );\n#ifdef PHYSICALLY_BASED_SHADING\nfloat specularNormalization = ( uShininess + 2.0001 ) / 8.0;\nvec3 schlick = uSpecularColor + vec3( 1.0 - uSpecularColor ) * pow( 1.0 - dot( pointVector, pointHalfVector ), 5.0 );\npointSpecular += schlick * pointLightColor[ i ] * pointSpecularWeight * pointDiffuseWeight * pointDistance * specularNormalization;\n#else\npointSpecular += pointDistance * pointLightColor[ i ] * uSpecularColor * pointSpecularWeight * pointDiffuseWeight;\n#endif\n}\n#endif\n#if MAX_SPOT_LIGHTS > 0\nvec3 spotDiffuse = vec3( 0.0 );\nvec3 spotSpecular = vec3( 0.0 );\nfor ( int i = 0; i < MAX_SPOT_LIGHTS; i ++ ) {\nvec4 lPosition = viewMatrix * vec4( spotLightPosition[ i ], 1.0 );\nvec3 spotVector = lPosition.xyz + vViewPosition.xyz;\nfloat spotDistance = 1.0;\nif ( spotLightDistance[ i ] > 0.0 )\nspotDistance = 1.0 - min( ( length( spotVector ) / spotLightDistance[ i ] ), 1.0 );\nspotVector = normalize( spotVector );\nfloat spotEffect = dot( spotLightDirection[ i ], normalize( spotLightPosition[ i ] - vWorldPosition ) );\nif ( spotEffect > spotLightAngleCos[ i ] ) {\nspotEffect = max( pow( spotEffect, spotLightExponent[ i ] ), 0.0 );\n#ifdef WRAP_AROUND\nfloat spotDiffuseWeightFull = max( dot( normal, spotVector ), 0.0 );\nfloat spotDiffuseWeightHalf = max( 0.5 * dot( normal, spotVector ) + 0.5, 0.0 );\nvec3 spotDiffuseWeight = mix( vec3 ( spotDiffuseWeightFull ), vec3( spotDiffuseWeightHalf ), wrapRGB );\n#else\nfloat spotDiffuseWeight = max( dot( normal, spotVector ), 0.0 );\n#endif\nspotDiffuse += spotDistance * spotLightColor[ i ] * uDiffuseColor * spotDiffuseWeight * spotEffect;\nvec3 spotHalfVector = normalize( spotVector + viewPosition );\nfloat spotDotNormalHalf = max( dot( normal, spotHalfVector ), 0.0 );\nfloat spotSpecularWeight = specularTex.r * max( pow( spotDotNormalHalf, uShininess ), 0.0 );\n#ifdef PHYSICALLY_BASED_SHADING\nfloat specularNormalization = ( uShininess + 2.0001 ) / 8.0;\nvec3 schlick = uSpecularColor + vec3( 1.0 - uSpecularColor ) * pow( 1.0 - dot( spotVector, spotHalfVector ), 5.0 );\nspotSpecular += schlick * spotLightColor[ i ] * spotSpecularWeight * spotDiffuseWeight * spotDistance * specularNormalization * spotEffect;\n#else\nspotSpecular += spotDistance * spotLightColor[ i ] * uSpecularColor * spotSpecularWeight * spotDiffuseWeight * spotEffect;\n#endif\n}\n}\n#endif\n#if MAX_DIR_LIGHTS > 0\nvec3 dirDiffuse = vec3( 0.0 );\nvec3 dirSpecular = vec3( 0.0 );\nfor( int i = 0; i < MAX_DIR_LIGHTS; i++ ) {\nvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\nvec3 dirVector = normalize( lDirection.xyz );\n#ifdef WRAP_AROUND\nfloat directionalLightWeightingFull = max( dot( normal, dirVector ), 0.0 );\nfloat directionalLightWeightingHalf = max( 0.5 * dot( normal, dirVector ) + 0.5, 0.0 );\nvec3 dirDiffuseWeight = mix( vec3( directionalLightWeightingFull ), vec3( directionalLightWeightingHalf ), wrapRGB );\n#else\nfloat dirDiffuseWeight = max( dot( normal, dirVector ), 0.0 );\n#endif\ndirDiffuse += directionalLightColor[ i ] * uDiffuseColor * dirDiffuseWeight;\nvec3 dirHalfVector = normalize( dirVector + viewPosition );\nfloat dirDotNormalHalf = max( dot( normal, dirHalfVector ), 0.0 );\nfloat dirSpecularWeight = specularTex.r * max( pow( dirDotNormalHalf, uShininess ), 0.0 );\n#ifdef PHYSICALLY_BASED_SHADING\nfloat specularNormalization = ( uShininess + 2.0001 ) / 8.0;\nvec3 schlick = uSpecularColor + vec3( 1.0 - uSpecularColor ) * pow( 1.0 - dot( dirVector, dirHalfVector ), 5.0 );\ndirSpecular += schlick * directionalLightColor[ i ] * dirSpecularWeight * dirDiffuseWeight * specularNormalization;\n#else\ndirSpecular += directionalLightColor[ i ] * uSpecularColor * dirSpecularWeight * dirDiffuseWeight;\n#endif\n}\n#endif\n#if MAX_HEMI_LIGHTS > 0\nvec3 hemiDiffuse = vec3( 0.0 );\nvec3 hemiSpecular = vec3( 0.0 );\nfor( int i = 0; i < MAX_HEMI_LIGHTS; i ++ ) {\nvec4 lDirection = viewMatrix * vec4( hemisphereLightDirection[ i ], 0.0 );\nvec3 lVector = normalize( lDirection.xyz );\nfloat dotProduct = dot( normal, lVector );\nfloat hemiDiffuseWeight = 0.5 * dotProduct + 0.5;\nvec3 hemiColor = mix( hemisphereLightGroundColor[ i ], hemisphereLightSkyColor[ i ], hemiDiffuseWeight );\nhemiDiffuse += uDiffuseColor * hemiColor;\nvec3 hemiHalfVectorSky = normalize( lVector + viewPosition );\nfloat hemiDotNormalHalfSky = 0.5 * dot( normal, hemiHalfVectorSky ) + 0.5;\nfloat hemiSpecularWeightSky = specularTex.r * max( pow( hemiDotNormalHalfSky, uShininess ), 0.0 );\nvec3 lVectorGround = -lVector;\nvec3 hemiHalfVectorGround = normalize( lVectorGround + viewPosition );\nfloat hemiDotNormalHalfGround = 0.5 * dot( normal, hemiHalfVectorGround ) + 0.5;\nfloat hemiSpecularWeightGround = specularTex.r * max( pow( hemiDotNormalHalfGround, uShininess ), 0.0 );\n#ifdef PHYSICALLY_BASED_SHADING\nfloat dotProductGround = dot( normal, lVectorGround );\nfloat specularNormalization = ( uShininess + 2.0001 ) / 8.0;\nvec3 schlickSky = uSpecularColor + vec3( 1.0 - uSpecularColor ) * pow( 1.0 - dot( lVector, hemiHalfVectorSky ), 5.0 );\nvec3 schlickGround = uSpecularColor + vec3( 1.0 - uSpecularColor ) * pow( 1.0 - dot( lVectorGround, hemiHalfVectorGround ), 5.0 );\nhemiSpecular += hemiColor * specularNormalization * ( schlickSky * hemiSpecularWeightSky * max( dotProduct, 0.0 ) + schlickGround * hemiSpecularWeightGround * max( dotProductGround, 0.0 ) );\n#else\nhemiSpecular += uSpecularColor * hemiColor * ( hemiSpecularWeightSky + hemiSpecularWeightGround ) * hemiDiffuseWeight;\n#endif\n}\n#endif\nvec3 totalDiffuse = vec3( 0.0 );\nvec3 totalSpecular = vec3( 0.0 );\n#if MAX_DIR_LIGHTS > 0\ntotalDiffuse += dirDiffuse;\ntotalSpecular += dirSpecular;\n#endif\n#if MAX_HEMI_LIGHTS > 0\ntotalDiffuse += hemiDiffuse;\ntotalSpecular += hemiSpecular;\n#endif\n#if MAX_POINT_LIGHTS > 0\ntotalDiffuse += pointDiffuse;\ntotalSpecular += pointSpecular;\n#endif\n#if MAX_SPOT_LIGHTS > 0\ntotalDiffuse += spotDiffuse;\ntotalSpecular += spotSpecular;\n#endif\n#ifdef METAL\ngl_FragColor.xyz = gl_FragColor.xyz * ( totalDiffuse + ambientLightColor * uAmbientColor + totalSpecular );\n#else\ngl_FragColor.xyz = gl_FragColor.xyz * ( totalDiffuse + ambientLightColor * uAmbientColor ) + totalSpecular;\n#endif\nif ( enableReflection ) {\nvec3 vReflect;\nvec3 cameraToVertex = normalize( vWorldPosition - cameraPosition );\nif ( useRefract ) {\nvReflect = refract( cameraToVertex, normal, uRefractionRatio );\n} else {\nvReflect = reflect( cameraToVertex, normal );\n}\nvec4 cubeColor = textureCube( tCube, vec3( -vReflect.x, vReflect.yz ) );\n#ifdef GAMMA_INPUT\ncubeColor.xyz *= cubeColor.xyz;\n#endif\ngl_FragColor.xyz = mix( gl_FragColor.xyz, cubeColor.xyz, specularTex.r * uReflectivity );\n}",
THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.linear_to_gamma_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n"),vertexShader:["attribute vec4 tangent;\nuniform vec2 uOffset;\nuniform vec2 uRepeat;\nuniform bool enableDisplacement;\n#ifdef VERTEX_TEXTURES\nuniform sampler2D tDisplacement;\nuniform float uDisplacementScale;\nuniform float uDisplacementBias;\n#endif\nvarying vec3 vTangent;\nvarying vec3 vBinormal;\nvarying vec3 vNormal;\nvarying vec2 vUv;\nvarying vec3 vWorldPosition;\nvarying vec3 vViewPosition;",
THREE.ShaderChunk.skinning_pars_vertex,THREE.ShaderChunk.shadowmap_pars_vertex,"void main() {",THREE.ShaderChunk.skinbase_vertex,THREE.ShaderChunk.skinnormal_vertex,"#ifdef USE_SKINNING\nvNormal = normalize( normalMatrix * skinnedNormal.xyz );\nvec4 skinnedTangent = skinMatrix * vec4( tangent.xyz, 0.0 );\nvTangent = normalize( normalMatrix * skinnedTangent.xyz );\n#else\nvNormal = normalize( normalMatrix * normal );\nvTangent = normalize( normalMatrix * tangent.xyz );\n#endif\nvBinormal = normalize( cross( vNormal, vTangent ) * tangent.w );\nvUv = uv * uRepeat + uOffset;\nvec3 displacedPosition;\n#ifdef VERTEX_TEXTURES\nif ( enableDisplacement ) {\nvec3 dv = texture2D( tDisplacement, uv ).xyz;\nfloat df = uDisplacementScale * dv.x + uDisplacementBias;\ndisplacedPosition = position + normalize( normal ) * df;\n} else {\n#ifdef USE_SKINNING\nvec4 skinVertex = vec4( position, 1.0 );\nvec4 skinned = boneMatX * skinVertex * skinWeight.x;\nskinned \t += boneMatY * skinVertex * skinWeight.y;\ndisplacedPosition = skinned.xyz;\n#else\ndisplacedPosition = position;\n#endif\n}\n#else\n#ifdef USE_SKINNING\nvec4 skinVertex = vec4( position, 1.0 );\nvec4 skinned = boneMatX * skinVertex * skinWeight.x;\nskinned \t += boneMatY * skinVertex * skinWeight.y;\ndisplacedPosition = skinned.xyz;\n#else\ndisplacedPosition = position;\n#endif\n#endif\nvec4 mvPosition = modelViewMatrix * vec4( displacedPosition, 1.0 );\nvec4 worldPosition = modelMatrix * vec4( displacedPosition, 1.0 );\ngl_Position = projectionMatrix * mvPosition;\nvWorldPosition = worldPosition.xyz;\nvViewPosition = -mvPosition.xyz;\n#ifdef USE_SHADOWMAP\nfor( int i = 0; i < MAX_SHADOWS; i ++ ) {\nvShadowCoord[ i ] = shadowMatrix[ i ] * worldPosition;\n}\n#endif\n}"].join("\n")},
cube:{uniforms:{tCube:{type:"t",value:null},tFlip:{type:"f",value:-1}},vertexShader:"varying vec3 vWorldPosition;\nvoid main() {\nvec4 worldPosition = modelMatrix * vec4( position, 1.0 );\nvWorldPosition = worldPosition.xyz;\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform samplerCube tCube;\nuniform float tFlip;\nvarying vec3 vWorldPosition;\nvoid main() {\ngl_FragColor = textureCube( tCube, vec3( tFlip * vWorldPosition.x, vWorldPosition.yz ) );\n}"},
depthRGBA:{uniforms:{},vertexShader:[THREE.ShaderChunk.morphtarget_pars_vertex,THREE.ShaderChunk.skinning_pars_vertex,"void main() {",THREE.ShaderChunk.skinbase_vertex,THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderChunk.default_vertex,"}"].join("\n"),fragmentShader:"vec4 pack_depth( const in float depth ) {\nconst vec4 bit_shift = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );\nconst vec4 bit_mask = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );\nvec4 res = fract( depth * bit_shift );\nres -= res.xxyz * bit_mask;\nreturn res;\n}\nvoid main() {\ngl_FragData[ 0 ] = pack_depth( gl_FragCoord.z );\n}"}};THREE.WebGLRenderer=function(a){function b(a,b){var c=a.vertices.length,d=b.material;if(d.attributes){void 0===a.__webglCustomAttributesList&&(a.__webglCustomAttributesList=[]);for(var e in d.attributes){var f=d.attributes[e];if(!f.__webglInitialized||f.createUniqueBuffers){f.__webglInitialized=!0;var h=1;"v2"===f.type?h=2:"v3"===f.type?h=3:"v4"===f.type?h=4:"c"===f.type&&(h=3);f.size=h;f.array=new Float32Array(c*h);f.buffer=j.createBuffer();f.buffer.belongsToAttribute=e;f.needsUpdate=!0}a.__webglCustomAttributesList.push(f)}}}
function c(a,b){var c=b.geometry,h=a.faces3,g=3*h.length,i=1*h.length,k=3*h.length,h=d(b,a),m=f(h),l=e(h),n=h.vertexColors?h.vertexColors:!1;a.__vertexArray=new Float32Array(3*g);l&&(a.__normalArray=new Float32Array(3*g));c.hasTangents&&(a.__tangentArray=new Float32Array(4*g));n&&(a.__colorArray=new Float32Array(3*g));m&&(0<c.faceVertexUvs.length&&(a.__uvArray=new Float32Array(2*g)),1<c.faceVertexUvs.length&&(a.__uv2Array=new Float32Array(2*g)));b.geometry.skinWeights.length&&b.geometry.skinIndices.length&&
(a.__skinIndexArray=new Float32Array(4*g),a.__skinWeightArray=new Float32Array(4*g));a.__faceArray=new Uint16Array(3*i);a.__lineArray=new Uint16Array(2*k);if(a.numMorphTargets){a.__morphTargetsArrays=[];c=0;for(m=a.numMorphTargets;c<m;c++)a.__morphTargetsArrays.push(new Float32Array(3*g))}if(a.numMorphNormals){a.__morphNormalsArrays=[];c=0;for(m=a.numMorphNormals;c<m;c++)a.__morphNormalsArrays.push(new Float32Array(3*g))}a.__webglFaceCount=3*i;a.__webglLineCount=2*k;if(h.attributes){void 0===a.__webglCustomAttributesList&&
(a.__webglCustomAttributesList=[]);for(var p in h.attributes){var i=h.attributes[p],k={},q;for(q in i)k[q]=i[q];if(!k.__webglInitialized||k.createUniqueBuffers)k.__webglInitialized=!0,c=1,"v2"===k.type?c=2:"v3"===k.type?c=3:"v4"===k.type?c=4:"c"===k.type&&(c=3),k.size=c,k.array=new Float32Array(g*c),k.buffer=j.createBuffer(),k.buffer.belongsToAttribute=p,i.needsUpdate=!0,k.__original=i;a.__webglCustomAttributesList.push(k)}}a.__inittedArrays=!0}function d(a,b){return a.material instanceof THREE.MeshFaceMaterial?
a.material.materials[b.materialIndex]:a.material}function e(a){return a instanceof THREE.MeshBasicMaterial&&!a.envMap||a instanceof THREE.MeshDepthMaterial?!1:a&&void 0!==a.shading&&a.shading===THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading}function f(a){return a.map||a.lightMap||a.bumpMap||a.normalMap||a.specularMap||a instanceof THREE.ShaderMaterial?!0:!1}function h(a){va[a]||(j.enableVertexAttribArray(a),va[a]=!0)}function g(){for(var a in va)va[a]&&(j.disableVertexAttribArray(a),va[a]=
!1)}function i(a,b){return a.z!==b.z?b.z-a.z:a.id-b.id}function k(a,b){return b[0]-a[0]}function m(a,b,c){if(a.length)for(var d=0,e=a.length;d<e;d++)ea=Ba=null,Aa=$=U=Y=ka=Ga=ja=-1,ta=!0,a[d].render(b,c,sb,pb),ea=Ba=null,Aa=$=U=Y=ka=Ga=ja=-1,ta=!0}function l(a,b,c,d,e,f,h,g){var j,i,k,m;b?(i=a.length-1,m=b=-1):(i=0,b=a.length,m=1);for(var l=i;l!==b;l+=m)if(j=a[l],j.render){i=j.object;k=j.buffer;if(g)j=g;else{j=j[c];if(!j)continue;h&&L.setBlending(j.blending,j.blendEquation,j.blendSrc,j.blendDst);
L.setDepthTest(j.depthTest);L.setDepthWrite(j.depthWrite);A(j.polygonOffset,j.polygonOffsetFactor,j.polygonOffsetUnits)}L.setMaterialFaces(j);k instanceof THREE.BufferGeometry?L.renderBufferDirect(d,e,f,j,k,i):L.renderBuffer(d,e,f,j,k,i)}}function p(a,b,c,d,e,f,h){for(var g,j,i=0,k=a.length;i<k;i++)if(g=a[i],j=g.object,j.visible){if(h)g=h;else{g=g[b];if(!g)continue;f&&L.setBlending(g.blending,g.blendEquation,g.blendSrc,g.blendDst);L.setDepthTest(g.depthTest);L.setDepthWrite(g.depthWrite);A(g.polygonOffset,
g.polygonOffsetFactor,g.polygonOffsetUnits)}L.renderImmediateObject(c,d,e,g,j)}}function t(a,d){var e,f,h,g;if(void 0===a.__webglInit&&(a.__webglInit=!0,a._modelViewMatrix=new THREE.Matrix4,a._normalMatrix=new THREE.Matrix3,void 0!==a.geometry&&void 0===a.geometry.__webglInit&&(a.geometry.__webglInit=!0,a.geometry.addEventListener("dispose",Cb)),f=a.geometry,void 0!==f))if(f instanceof THREE.BufferGeometry){var i,k;for(i in f.attributes)k="index"===i?j.ELEMENT_ARRAY_BUFFER:j.ARRAY_BUFFER,g=f.attributes[i],
void 0===g.numItems&&(g.numItems=g.array.length),g.buffer=j.createBuffer(),j.bindBuffer(k,g.buffer),j.bufferData(k,g.array,j.STATIC_DRAW)}else if(a instanceof THREE.Mesh){h=a.material;if(void 0===f.geometryGroups){i=f;var m,l,n;k={};var p=i.morphTargets.length,q=i.morphNormals.length,t=h instanceof THREE.MeshFaceMaterial;i.geometryGroups={};h=0;for(m=i.faces.length;h<m;h++)l=i.faces[h],l=t?l.materialIndex:0,void 0===k[l]&&(k[l]={hash:l,counter:0}),n=k[l].hash+"_"+k[l].counter,void 0===i.geometryGroups[n]&&
(i.geometryGroups[n]={faces3:[],materialIndex:l,vertices:0,numMorphTargets:p,numMorphNormals:q}),65535<i.geometryGroups[n].vertices+3&&(k[l].counter+=1,n=k[l].hash+"_"+k[l].counter,void 0===i.geometryGroups[n]&&(i.geometryGroups[n]={faces3:[],materialIndex:l,vertices:0,numMorphTargets:p,numMorphNormals:q})),i.geometryGroups[n].faces3.push(h),i.geometryGroups[n].vertices+=3;i.geometryGroupsList=[];for(g in i.geometryGroups)i.geometryGroups[g].id=V++,i.geometryGroupsList.push(i.geometryGroups[g])}for(e in f.geometryGroups)if(g=
f.geometryGroups[e],!g.__webglVertexBuffer){i=g;i.__webglVertexBuffer=j.createBuffer();i.__webglNormalBuffer=j.createBuffer();i.__webglTangentBuffer=j.createBuffer();i.__webglColorBuffer=j.createBuffer();i.__webglUVBuffer=j.createBuffer();i.__webglUV2Buffer=j.createBuffer();i.__webglSkinIndicesBuffer=j.createBuffer();i.__webglSkinWeightsBuffer=j.createBuffer();i.__webglFaceBuffer=j.createBuffer();i.__webglLineBuffer=j.createBuffer();p=k=void 0;if(i.numMorphTargets){i.__webglMorphTargetsBuffers=[];
k=0;for(p=i.numMorphTargets;k<p;k++)i.__webglMorphTargetsBuffers.push(j.createBuffer())}if(i.numMorphNormals){i.__webglMorphNormalsBuffers=[];k=0;for(p=i.numMorphNormals;k<p;k++)i.__webglMorphNormalsBuffers.push(j.createBuffer())}L.info.memory.geometries++;c(g,a);f.verticesNeedUpdate=!0;f.morphTargetsNeedUpdate=!0;f.elementsNeedUpdate=!0;f.uvsNeedUpdate=!0;f.normalsNeedUpdate=!0;f.tangentsNeedUpdate=!0;f.colorsNeedUpdate=!0}}else a instanceof THREE.Line?f.__webglVertexBuffer||(g=f,g.__webglVertexBuffer=
j.createBuffer(),g.__webglColorBuffer=j.createBuffer(),g.__webglLineDistanceBuffer=j.createBuffer(),L.info.memory.geometries++,g=f,i=g.vertices.length,g.__vertexArray=new Float32Array(3*i),g.__colorArray=new Float32Array(3*i),g.__lineDistanceArray=new Float32Array(1*i),g.__webglLineCount=i,b(g,a),f.verticesNeedUpdate=!0,f.colorsNeedUpdate=!0,f.lineDistancesNeedUpdate=!0):a instanceof THREE.ParticleSystem&&!f.__webglVertexBuffer&&(g=f,g.__webglVertexBuffer=j.createBuffer(),g.__webglColorBuffer=j.createBuffer(),
L.info.memory.geometries++,g=f,i=g.vertices.length,g.__vertexArray=new Float32Array(3*i),g.__colorArray=new Float32Array(3*i),g.__sortArray=[],g.__webglParticleCount=i,b(g,a),f.verticesNeedUpdate=!0,f.colorsNeedUpdate=!0);if(void 0===a.__webglActive){if(a instanceof THREE.Mesh)if(f=a.geometry,f instanceof THREE.BufferGeometry)s(d.__webglObjects,f,a);else{if(f instanceof THREE.Geometry)for(e in f.geometryGroups)g=f.geometryGroups[e],s(d.__webglObjects,g,a)}else a instanceof THREE.Line||a instanceof
THREE.ParticleSystem?(f=a.geometry,s(d.__webglObjects,f,a)):a instanceof THREE.ImmediateRenderObject||a.immediateRenderCallback?d.__webglObjectsImmediate.push({id:null,object:a,opaque:null,transparent:null,z:0}):a instanceof THREE.Sprite?d.__webglSprites.push(a):a instanceof THREE.LensFlare&&d.__webglFlares.push(a);a.__webglActive=!0}}function s(a,b,c){a.push({id:null,buffer:b,object:c,opaque:null,transparent:null,z:0})}function q(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return!0;
return!1}function n(a){for(var b in a.attributes)a.attributes[b].needsUpdate=!1}function u(a,b){a instanceof THREE.Mesh||a instanceof THREE.ParticleSystem||a instanceof THREE.Line?r(b.__webglObjects,a):a instanceof THREE.Sprite?v(b.__webglSprites,a):a instanceof THREE.LensFlare?v(b.__webglFlares,a):(a instanceof THREE.ImmediateRenderObject||a.immediateRenderCallback)&&r(b.__webglObjectsImmediate,a);delete a.__webglActive}function r(a,b){for(var c=a.length-1;0<=c;c--)a[c].object===b&&a.splice(c,1)}
function v(a,b){for(var c=a.length-1;0<=c;c--)a[c]===b&&a.splice(c,1)}function z(a,b,c,d,e){P=0;d.needsUpdate&&(d.program&&Gb(d),L.initMaterial(d,b,c,e),d.needsUpdate=!1);d.morphTargets&&!e.__webglMorphTargetInfluences&&(e.__webglMorphTargetInfluences=new Float32Array(L.maxMorphTargets));var f=!1,g=d.program,h=g.uniforms,i=d.uniforms;g!==Ba&&(j.useProgram(g),Ba=g,f=!0);d.id!==Aa&&(Aa=d.id,f=!0);if(f||a!==ea)j.uniformMatrix4fv(h.projectionMatrix,!1,a.projectionMatrix.elements),a!==ea&&(ea=a);if(d.skinning)if(yb&&
e.useVertexTexture){if(null!==h.boneTexture){var k=G();j.uniform1i(h.boneTexture,k);L.setTexture(e.boneTexture,k)}null!==h.boneTextureWidth&&j.uniform1i(h.boneTextureWidth,e.boneTextureWidth);null!==h.boneTextureHeight&&j.uniform1i(h.boneTextureHeight,e.boneTextureHeight)}else null!==h.boneGlobalMatrices&&j.uniformMatrix4fv(h.boneGlobalMatrices,!1,e.boneMatrices);if(f){c&&d.fog&&(i.fogColor.value=c.color,c instanceof THREE.Fog?(i.fogNear.value=c.near,i.fogFar.value=c.far):c instanceof THREE.FogExp2&&
(i.fogDensity.value=c.density));if(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d.lights){if(ta){for(var m,l=k=0,n=0,p,q,t,r=Pa,s=r.directional.colors,u=r.directional.positions,v=r.point.colors,z=r.point.positions,x=r.point.distances,A=r.spot.colors,E=r.spot.positions,D=r.spot.distances,K=r.spot.directions,O=r.spot.anglesCos,C=r.spot.exponents,J=r.hemi.skyColors,V=r.hemi.groundColors,M=r.hemi.positions,Q=0,U=0,Y=0,za=0,$=0,dc=0,X=0,W=0,R=m=0,c=t=R=0,f=b.length;c<f;c++)m=
b[c],m.onlyShadow||(p=m.color,q=m.intensity,t=m.distance,m instanceof THREE.AmbientLight?m.visible&&(L.gammaInput?(k+=p.r*p.r,l+=p.g*p.g,n+=p.b*p.b):(k+=p.r,l+=p.g,n+=p.b)):m instanceof THREE.DirectionalLight?($+=1,m.visible&&(fa.getPositionFromMatrix(m.matrixWorld),ra.getPositionFromMatrix(m.target.matrixWorld),fa.sub(ra),fa.normalize(),0===fa.x&&0===fa.y&&0===fa.z||(m=3*Q,u[m]=fa.x,u[m+1]=fa.y,u[m+2]=fa.z,L.gammaInput?w(s,m,p,q*q):y(s,m,p,q),Q+=1))):m instanceof THREE.PointLight?(dc+=1,m.visible&&
(R=3*U,L.gammaInput?w(v,R,p,q*q):y(v,R,p,q),ra.getPositionFromMatrix(m.matrixWorld),z[R]=ra.x,z[R+1]=ra.y,z[R+2]=ra.z,x[U]=t,U+=1)):m instanceof THREE.SpotLight?(X+=1,m.visible&&(R=3*Y,L.gammaInput?w(A,R,p,q*q):y(A,R,p,q),ra.getPositionFromMatrix(m.matrixWorld),E[R]=ra.x,E[R+1]=ra.y,E[R+2]=ra.z,D[Y]=t,fa.copy(ra),ra.getPositionFromMatrix(m.target.matrixWorld),fa.sub(ra),fa.normalize(),K[R]=fa.x,K[R+1]=fa.y,K[R+2]=fa.z,O[Y]=Math.cos(m.angle),C[Y]=m.exponent,Y+=1)):m instanceof THREE.HemisphereLight&&
(W+=1,m.visible&&(fa.getPositionFromMatrix(m.matrixWorld),fa.normalize(),0===fa.x&&0===fa.y&&0===fa.z||(t=3*za,M[t]=fa.x,M[t+1]=fa.y,M[t+2]=fa.z,p=m.color,m=m.groundColor,L.gammaInput?(q*=q,w(J,t,p,q),w(V,t,m,q)):(y(J,t,p,q),y(V,t,m,q)),za+=1))));c=3*Q;for(f=Math.max(s.length,3*$);c<f;c++)s[c]=0;c=3*U;for(f=Math.max(v.length,3*dc);c<f;c++)v[c]=0;c=3*Y;for(f=Math.max(A.length,3*X);c<f;c++)A[c]=0;c=3*za;for(f=Math.max(J.length,3*W);c<f;c++)J[c]=0;c=3*za;for(f=Math.max(V.length,3*W);c<f;c++)V[c]=0;r.directional.length=
Q;r.point.length=U;r.spot.length=Y;r.hemi.length=za;r.ambient[0]=k;r.ambient[1]=l;r.ambient[2]=n;ta=!1}c=Pa;i.ambientLightColor.value=c.ambient;i.directionalLightColor.value=c.directional.colors;i.directionalLightDirection.value=c.directional.positions;i.pointLightColor.value=c.point.colors;i.pointLightPosition.value=c.point.positions;i.pointLightDistance.value=c.point.distances;i.spotLightColor.value=c.spot.colors;i.spotLightPosition.value=c.spot.positions;i.spotLightDistance.value=c.spot.distances;
i.spotLightDirection.value=c.spot.directions;i.spotLightAngleCos.value=c.spot.anglesCos;i.spotLightExponent.value=c.spot.exponents;i.hemisphereLightSkyColor.value=c.hemi.skyColors;i.hemisphereLightGroundColor.value=c.hemi.groundColors;i.hemisphereLightDirection.value=c.hemi.positions}if(d instanceof THREE.MeshBasicMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.MeshPhongMaterial){i.opacity.value=d.opacity;L.gammaInput?i.diffuse.value.copyGammaToLinear(d.color):i.diffuse.value=
d.color;i.map.value=d.map;i.lightMap.value=d.lightMap;i.specularMap.value=d.specularMap;d.bumpMap&&(i.bumpMap.value=d.bumpMap,i.bumpScale.value=d.bumpScale);d.normalMap&&(i.normalMap.value=d.normalMap,i.normalScale.value.copy(d.normalScale));var ba;d.map?ba=d.map:d.specularMap?ba=d.specularMap:d.normalMap?ba=d.normalMap:d.bumpMap&&(ba=d.bumpMap);void 0!==ba&&(c=ba.offset,ba=ba.repeat,i.offsetRepeat.value.set(c.x,c.y,ba.x,ba.y));i.envMap.value=d.envMap;i.flipEnvMap.value=d.envMap instanceof THREE.WebGLRenderTargetCube?
1:-1;i.reflectivity.value=d.reflectivity;i.refractionRatio.value=d.refractionRatio;i.combine.value=d.combine;i.useRefract.value=d.envMap&&d.envMap.mapping instanceof THREE.CubeRefractionMapping}d instanceof THREE.LineBasicMaterial?(i.diffuse.value=d.color,i.opacity.value=d.opacity):d instanceof THREE.LineDashedMaterial?(i.diffuse.value=d.color,i.opacity.value=d.opacity,i.dashSize.value=d.dashSize,i.totalSize.value=d.dashSize+d.gapSize,i.scale.value=d.scale):d instanceof THREE.ParticleSystemMaterial?
(i.psColor.value=d.color,i.opacity.value=d.opacity,i.size.value=d.size,i.scale.value=B.height/2,i.map.value=d.map):d instanceof THREE.MeshPhongMaterial?(i.shininess.value=d.shininess,L.gammaInput?(i.ambient.value.copyGammaToLinear(d.ambient),i.emissive.value.copyGammaToLinear(d.emissive),i.specular.value.copyGammaToLinear(d.specular)):(i.ambient.value=d.ambient,i.emissive.value=d.emissive,i.specular.value=d.specular),d.wrapAround&&i.wrapRGB.value.copy(d.wrapRGB)):d instanceof THREE.MeshLambertMaterial?
(L.gammaInput?(i.ambient.value.copyGammaToLinear(d.ambient),i.emissive.value.copyGammaToLinear(d.emissive)):(i.ambient.value=d.ambient,i.emissive.value=d.emissive),d.wrapAround&&i.wrapRGB.value.copy(d.wrapRGB)):d instanceof THREE.MeshDepthMaterial?(i.mNear.value=a.near,i.mFar.value=a.far,i.opacity.value=d.opacity):d instanceof THREE.MeshNormalMaterial&&(i.opacity.value=d.opacity);if(e.receiveShadow&&!d._shadowPass&&i.shadowMatrix){c=ba=0;for(f=b.length;c<f;c++)if(k=b[c],k.castShadow&&(k instanceof
THREE.SpotLight||k instanceof THREE.DirectionalLight&&!k.shadowCascade))i.shadowMap.value[ba]=k.shadowMap,i.shadowMapSize.value[ba]=k.shadowMapSize,i.shadowMatrix.value[ba]=k.shadowMatrix,i.shadowDarkness.value[ba]=k.shadowDarkness,i.shadowBias.value[ba]=k.shadowBias,ba++}b=d.uniformsList;i=0;for(ba=b.length;i<ba;i++)if(f=g.uniforms[b[i][1]])if(c=b[i][0],l=c.type,k=c.value,"i"===l)j.uniform1i(f,k);else if("f"===l)j.uniform1f(f,k);else if("v2"===l)j.uniform2f(f,k.x,k.y);else if("v3"===l)j.uniform3f(f,
k.x,k.y,k.z);else if("v4"===l)j.uniform4f(f,k.x,k.y,k.z,k.w);else if("c"===l)j.uniform3f(f,k.r,k.g,k.b);else if("iv1"===l)j.uniform1iv(f,k);else if("iv"===l)j.uniform3iv(f,k);else if("fv1"===l)j.uniform1fv(f,k);else if("fv"===l)j.uniform3fv(f,k);else if("v2v"===l){void 0===c._array&&(c._array=new Float32Array(2*k.length));l=0;for(n=k.length;l<n;l++)r=2*l,c._array[r]=k[l].x,c._array[r+1]=k[l].y;j.uniform2fv(f,c._array)}else if("v3v"===l){void 0===c._array&&(c._array=new Float32Array(3*k.length));l=
0;for(n=k.length;l<n;l++)r=3*l,c._array[r]=k[l].x,c._array[r+1]=k[l].y,c._array[r+2]=k[l].z;j.uniform3fv(f,c._array)}else if("v4v"===l){void 0===c._array&&(c._array=new Float32Array(4*k.length));l=0;for(n=k.length;l<n;l++)r=4*l,c._array[r]=k[l].x,c._array[r+1]=k[l].y,c._array[r+2]=k[l].z,c._array[r+3]=k[l].w;j.uniform4fv(f,c._array)}else if("m4"===l)void 0===c._array&&(c._array=new Float32Array(16)),k.flattenToArray(c._array),j.uniformMatrix4fv(f,!1,c._array);else if("m4v"===l){void 0===c._array&&
(c._array=new Float32Array(16*k.length));l=0;for(n=k.length;l<n;l++)k[l].flattenToArrayOffset(c._array,16*l);j.uniformMatrix4fv(f,!1,c._array)}else if("t"===l){if(r=k,k=G(),j.uniform1i(f,k),r)if(r.image instanceof Array&&6===r.image.length){if(c=r,f=k,6===c.image.length)if(c.needsUpdate){c.image.__webglTextureCube||(c.addEventListener("dispose",Db),c.image.__webglTextureCube=j.createTexture(),L.info.memory.textures++);j.activeTexture(j.TEXTURE0+f);j.bindTexture(j.TEXTURE_CUBE_MAP,c.image.__webglTextureCube);
j.pixelStorei(j.UNPACK_FLIP_Y_WEBGL,c.flipY);f=c instanceof THREE.CompressedTexture;k=[];for(l=0;6>l;l++)L.autoScaleCubemaps&&!f?(n=k,r=l,s=c.image[l],v=ac,s.width<=v&&s.height<=v||(z=Math.max(s.width,s.height),u=Math.floor(s.width*v/z),v=Math.floor(s.height*v/z),z=document.createElement("canvas"),z.width=u,z.height=v,z.getContext("2d").drawImage(s,0,0,s.width,s.height,0,0,u,v),s=z),n[r]=s):k[l]=c.image[l];l=k[0];n=0===(l.width&l.width-1)&&0===(l.height&l.height-1);r=I(c.format);s=I(c.type);F(j.TEXTURE_CUBE_MAP,
c,n);for(l=0;6>l;l++)if(f){v=k[l].mipmaps;z=0;for(x=v.length;z<x;z++)u=v[z],c.format!==THREE.RGBAFormat?j.compressedTexImage2D(j.TEXTURE_CUBE_MAP_POSITIVE_X+l,z,r,u.width,u.height,0,u.data):j.texImage2D(j.TEXTURE_CUBE_MAP_POSITIVE_X+l,z,r,u.width,u.height,0,r,s,u.data)}else j.texImage2D(j.TEXTURE_CUBE_MAP_POSITIVE_X+l,0,r,r,s,k[l]);c.generateMipmaps&&n&&j.generateMipmap(j.TEXTURE_CUBE_MAP);c.needsUpdate=!1;if(c.onUpdate)c.onUpdate()}else j.activeTexture(j.TEXTURE0+f),j.bindTexture(j.TEXTURE_CUBE_MAP,
c.image.__webglTextureCube)}else r instanceof THREE.WebGLRenderTargetCube?(c=r,j.activeTexture(j.TEXTURE0+k),j.bindTexture(j.TEXTURE_CUBE_MAP,c.__webglTexture)):L.setTexture(r,k)}else if("tv"===l){void 0===c._array&&(c._array=[]);l=0;for(n=c.value.length;l<n;l++)c._array[l]=G();j.uniform1iv(f,c._array);l=0;for(n=c.value.length;l<n;l++)r=c.value[l],k=c._array[l],r&&L.setTexture(r,k)}else console.warn("THREE.WebGLRenderer: Unknown uniform type: "+l);if((d instanceof THREE.ShaderMaterial||d instanceof
THREE.MeshPhongMaterial||d.envMap)&&null!==h.cameraPosition)ra.getPositionFromMatrix(a.matrixWorld),j.uniform3f(h.cameraPosition,ra.x,ra.y,ra.z);(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.ShaderMaterial||d.skinning)&&null!==h.viewMatrix&&j.uniformMatrix4fv(h.viewMatrix,!1,a.matrixWorldInverse.elements)}j.uniformMatrix4fv(h.modelViewMatrix,!1,e._modelViewMatrix.elements);h.normalMatrix&&j.uniformMatrix3fv(h.normalMatrix,!1,e._normalMatrix.elements);
null!==h.modelMatrix&&j.uniformMatrix4fv(h.modelMatrix,!1,e.matrixWorld.elements);return g}function G(){var a=P;a>=Mb&&console.warn("WebGLRenderer: trying to use "+a+" texture units while this GPU supports only "+Mb);P+=1;return a}function w(a,b,c,d){a[b]=c.r*c.r*d;a[b+1]=c.g*c.g*d;a[b+2]=c.b*c.b*d}function y(a,b,c,d){a[b]=c.r*d;a[b+1]=c.g*d;a[b+2]=c.b*d}function E(a){a!==wa&&(j.lineWidth(a),wa=a)}function A(a,b,c){Da!==a&&(a?j.enable(j.POLYGON_OFFSET_FILL):j.disable(j.POLYGON_OFFSET_FILL),Da=a);
if(a&&(Ua!==b||Qa!==c))j.polygonOffset(b,c),Ua=b,Qa=c}function K(a){for(var a=a.split("\n"),b=0,c=a.length;b<c;b++)a[b]=b+1+": "+a[b];return a.join("\n")}function D(a,b){var c;"fragment"===a?c=j.createShader(j.FRAGMENT_SHADER):"vertex"===a&&(c=j.createShader(j.VERTEX_SHADER));j.shaderSource(c,b);j.compileShader(c);return!j.getShaderParameter(c,j.COMPILE_STATUS)?(console.error(j.getShaderInfoLog(c)),console.error(K(b)),null):c}function F(a,b,c){c?(j.texParameteri(a,j.TEXTURE_WRAP_S,I(b.wrapS)),j.texParameteri(a,
j.TEXTURE_WRAP_T,I(b.wrapT)),j.texParameteri(a,j.TEXTURE_MAG_FILTER,I(b.magFilter)),j.texParameteri(a,j.TEXTURE_MIN_FILTER,I(b.minFilter))):(j.texParameteri(a,j.TEXTURE_WRAP_S,j.CLAMP_TO_EDGE),j.texParameteri(a,j.TEXTURE_WRAP_T,j.CLAMP_TO_EDGE),j.texParameteri(a,j.TEXTURE_MAG_FILTER,x(b.magFilter)),j.texParameteri(a,j.TEXTURE_MIN_FILTER,x(b.minFilter)));if(La&&b.type!==THREE.FloatType&&(1<b.anisotropy||b.__oldAnisotropy))j.texParameterf(a,La.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(b.anisotropy,Nb)),b.__oldAnisotropy=
b.anisotropy}function O(a,b){j.bindRenderbuffer(j.RENDERBUFFER,a);b.depthBuffer&&!b.stencilBuffer?(j.renderbufferStorage(j.RENDERBUFFER,j.DEPTH_COMPONENT16,b.width,b.height),j.framebufferRenderbuffer(j.FRAMEBUFFER,j.DEPTH_ATTACHMENT,j.RENDERBUFFER,a)):b.depthBuffer&&b.stencilBuffer?(j.renderbufferStorage(j.RENDERBUFFER,j.DEPTH_STENCIL,b.width,b.height),j.framebufferRenderbuffer(j.FRAMEBUFFER,j.DEPTH_STENCIL_ATTACHMENT,j.RENDERBUFFER,a)):j.renderbufferStorage(j.RENDERBUFFER,j.RGBA4,b.width,b.height)}
function x(a){return a===THREE.NearestFilter||a===THREE.NearestMipMapNearestFilter||a===THREE.NearestMipMapLinearFilter?j.NEAREST:j.LINEAR}function I(a){if(a===THREE.RepeatWrapping)return j.REPEAT;if(a===THREE.ClampToEdgeWrapping)return j.CLAMP_TO_EDGE;if(a===THREE.MirroredRepeatWrapping)return j.MIRRORED_REPEAT;if(a===THREE.NearestFilter)return j.NEAREST;if(a===THREE.NearestMipMapNearestFilter)return j.NEAREST_MIPMAP_NEAREST;if(a===THREE.NearestMipMapLinearFilter)return j.NEAREST_MIPMAP_LINEAR;if(a===
THREE.LinearFilter)return j.LINEAR;if(a===THREE.LinearMipMapNearestFilter)return j.LINEAR_MIPMAP_NEAREST;if(a===THREE.LinearMipMapLinearFilter)return j.LINEAR_MIPMAP_LINEAR;if(a===THREE.UnsignedByteType)return j.UNSIGNED_BYTE;if(a===THREE.UnsignedShort4444Type)return j.UNSIGNED_SHORT_4_4_4_4;if(a===THREE.UnsignedShort5551Type)return j.UNSIGNED_SHORT_5_5_5_1;if(a===THREE.UnsignedShort565Type)return j.UNSIGNED_SHORT_5_6_5;if(a===THREE.ByteType)return j.BYTE;if(a===THREE.ShortType)return j.SHORT;if(a===
THREE.UnsignedShortType)return j.UNSIGNED_SHORT;if(a===THREE.IntType)return j.INT;if(a===THREE.UnsignedIntType)return j.UNSIGNED_INT;if(a===THREE.FloatType)return j.FLOAT;if(a===THREE.AlphaFormat)return j.ALPHA;if(a===THREE.RGBFormat)return j.RGB;if(a===THREE.RGBAFormat)return j.RGBA;if(a===THREE.LuminanceFormat)return j.LUMINANCE;if(a===THREE.LuminanceAlphaFormat)return j.LUMINANCE_ALPHA;if(a===THREE.AddEquation)return j.FUNC_ADD;if(a===THREE.SubtractEquation)return j.FUNC_SUBTRACT;if(a===THREE.ReverseSubtractEquation)return j.FUNC_REVERSE_SUBTRACT;
if(a===THREE.ZeroFactor)return j.ZERO;if(a===THREE.OneFactor)return j.ONE;if(a===THREE.SrcColorFactor)return j.SRC_COLOR;if(a===THREE.OneMinusSrcColorFactor)return j.ONE_MINUS_SRC_COLOR;if(a===THREE.SrcAlphaFactor)return j.SRC_ALPHA;if(a===THREE.OneMinusSrcAlphaFactor)return j.ONE_MINUS_SRC_ALPHA;if(a===THREE.DstAlphaFactor)return j.DST_ALPHA;if(a===THREE.OneMinusDstAlphaFactor)return j.ONE_MINUS_DST_ALPHA;if(a===THREE.DstColorFactor)return j.DST_COLOR;if(a===THREE.OneMinusDstColorFactor)return j.ONE_MINUS_DST_COLOR;
if(a===THREE.SrcAlphaSaturateFactor)return j.SRC_ALPHA_SATURATE;if(void 0!==Fa){if(a===THREE.RGB_S3TC_DXT1_Format)return Fa.COMPRESSED_RGB_S3TC_DXT1_EXT;if(a===THREE.RGBA_S3TC_DXT1_Format)return Fa.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(a===THREE.RGBA_S3TC_DXT3_Format)return Fa.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(a===THREE.RGBA_S3TC_DXT5_Format)return Fa.COMPRESSED_RGBA_S3TC_DXT5_EXT}return 0}console.log("THREE.WebGLRenderer",THREE.REVISION);var a=a||{},B=void 0!==a.canvas?a.canvas:document.createElement("canvas"),
M=void 0!==a.precision?a.precision:"highp",J=void 0!==a.alpha?a.alpha:!1,ca=void 0!==a.premultipliedAlpha?a.premultipliedAlpha:!0,na=void 0!==a.antialias?a.antialias:!1,pa=void 0!==a.stencil?a.stencil:!0,C=void 0!==a.preserveDrawingBuffer?a.preserveDrawingBuffer:!1,Q=new THREE.Color(0),R=0;this.domElement=B;this.context=null;this.devicePixelRatio=void 0!==a.devicePixelRatio?a.devicePixelRatio:void 0!==self.devicePixelRatio?self.devicePixelRatio:1;this.autoUpdateObjects=this.sortObjects=this.autoClearStencil=
this.autoClearDepth=this.autoClearColor=this.autoClear=!0;this.shadowMapEnabled=this.physicallyBasedShading=this.gammaOutput=this.gammaInput=!1;this.shadowMapAutoUpdate=!0;this.shadowMapType=THREE.PCFShadowMap;this.shadowMapCullFace=THREE.CullFaceFront;this.shadowMapCascade=this.shadowMapDebug=!1;this.maxMorphTargets=8;this.maxMorphNormals=4;this.autoScaleCubemaps=!0;this.renderPluginsPre=[];this.renderPluginsPost=[];this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,
faces:0,points:0}};var L=this,da=[],za=0,Ba=null,ba=null,Aa=-1,$=null,ea=null,V=0,P=0,Y=-1,U=-1,ja=-1,sa=-1,ha=-1,Ka=-1,Ga=-1,ka=-1,Da=null,Ua=null,Qa=null,wa=null,bb=0,cb=0,Ma=B.width,fb=B.height,sb=0,pb=0,va={},la=new THREE.Frustum,Ea=new THREE.Matrix4,gb=new THREE.Matrix4,ra=new THREE.Vector3,fa=new THREE.Vector3,ta=!0,Pa={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]},spot:{length:0,colors:[],positions:[],distances:[],directions:[],
anglesCos:[],exponents:[]},hemi:{length:0,skyColors:[],groundColors:[],positions:[]}},j,Oa,ua,La,Fa;try{var Ra={alpha:J,premultipliedAlpha:ca,antialias:na,stencil:pa,preserveDrawingBuffer:C};j=B.getContext("webgl",Ra)||B.getContext("experimental-webgl",Ra);if(null===j)throw"Error creating WebGL context.";}catch(Zb){console.error(Zb)}Oa=j.getExtension("OES_texture_float");j.getExtension("OES_texture_float_linear");ua=j.getExtension("OES_standard_derivatives");La=j.getExtension("EXT_texture_filter_anisotropic")||
j.getExtension("MOZ_EXT_texture_filter_anisotropic")||j.getExtension("WEBKIT_EXT_texture_filter_anisotropic");Fa=j.getExtension("WEBGL_compressed_texture_s3tc")||j.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||j.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");Oa||console.log("THREE.WebGLRenderer: Float textures not supported.");ua||console.log("THREE.WebGLRenderer: Standard derivatives not supported.");La||console.log("THREE.WebGLRenderer: Anisotropic texture filtering not supported.");
Fa||console.log("THREE.WebGLRenderer: S3TC compressed textures not supported.");void 0===j.getShaderPrecisionFormat&&(j.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}});j.clearColor(0,0,0,1);j.clearDepth(1);j.clearStencil(0);j.enable(j.DEPTH_TEST);j.depthFunc(j.LEQUAL);j.frontFace(j.CCW);j.cullFace(j.BACK);j.enable(j.CULL_FACE);j.enable(j.BLEND);j.blendEquation(j.FUNC_ADD);j.blendFunc(j.SRC_ALPHA,j.ONE_MINUS_SRC_ALPHA);j.viewport(bb,cb,Ma,fb);j.clearColor(Q.r,Q.g,Q.b,
R);this.context=j;var Mb=j.getParameter(j.MAX_TEXTURE_IMAGE_UNITS),$b=j.getParameter(j.MAX_VERTEX_TEXTURE_IMAGE_UNITS);j.getParameter(j.MAX_TEXTURE_SIZE);var ac=j.getParameter(j.MAX_CUBE_MAP_TEXTURE_SIZE),Nb=La?j.getParameter(La.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0,Bb=0<$b,yb=Bb&&Oa;Fa&&j.getParameter(j.COMPRESSED_TEXTURE_FORMATS);var bc=j.getShaderPrecisionFormat(j.VERTEX_SHADER,j.HIGH_FLOAT),cc=j.getShaderPrecisionFormat(j.VERTEX_SHADER,j.MEDIUM_FLOAT);j.getShaderPrecisionFormat(j.VERTEX_SHADER,j.LOW_FLOAT);
var qc=j.getShaderPrecisionFormat(j.FRAGMENT_SHADER,j.HIGH_FLOAT),rc=j.getShaderPrecisionFormat(j.FRAGMENT_SHADER,j.MEDIUM_FLOAT);j.getShaderPrecisionFormat(j.FRAGMENT_SHADER,j.LOW_FLOAT);j.getShaderPrecisionFormat(j.VERTEX_SHADER,j.HIGH_INT);j.getShaderPrecisionFormat(j.VERTEX_SHADER,j.MEDIUM_INT);j.getShaderPrecisionFormat(j.VERTEX_SHADER,j.LOW_INT);j.getShaderPrecisionFormat(j.FRAGMENT_SHADER,j.HIGH_INT);j.getShaderPrecisionFormat(j.FRAGMENT_SHADER,j.MEDIUM_INT);j.getShaderPrecisionFormat(j.FRAGMENT_SHADER,
j.LOW_INT);var sc=0<bc.precision&&0<qc.precision,Ob=0<cc.precision&&0<rc.precision;"highp"===M&&!sc&&(Ob?(M="mediump",console.warn("WebGLRenderer: highp not supported, using mediump")):(M="lowp",console.warn("WebGLRenderer: highp and mediump not supported, using lowp")));"mediump"===M&&!Ob&&(M="lowp",console.warn("WebGLRenderer: mediump not supported, using lowp"));this.getContext=function(){return j};this.supportsVertexTextures=function(){return Bb};this.supportsFloatTextures=function(){return Oa};
this.supportsStandardDerivatives=function(){return ua};this.supportsCompressedTextureS3TC=function(){return Fa};this.getMaxAnisotropy=function(){return Nb};this.getPrecision=function(){return M};this.setSize=function(a,b,c){B.width=a*this.devicePixelRatio;B.height=b*this.devicePixelRatio;1!==this.devicePixelRatio&&!1!==c&&(B.style.width=a+"px",B.style.height=b+"px");this.setViewport(0,0,B.width,B.height)};this.setViewport=function(a,b,c,d){bb=void 0!==a?a:0;cb=void 0!==b?b:0;Ma=void 0!==c?c:B.width;
fb=void 0!==d?d:B.height;j.viewport(bb,cb,Ma,fb)};this.setScissor=function(a,b,c,d){j.scissor(a,b,c,d)};this.enableScissorTest=function(a){a?j.enable(j.SCISSOR_TEST):j.disable(j.SCISSOR_TEST)};this.setClearColor=function(a,b){Q.set(a);R=void 0!==b?b:1;j.clearColor(Q.r,Q.g,Q.b,R)};this.setClearColorHex=function(a,b){console.warn("DEPRECATED: .setClearColorHex() is being removed. Use .setClearColor() instead.");this.setClearColor(a,b)};this.getClearColor=function(){return Q};this.getClearAlpha=function(){return R};
this.clear=function(a,b,c){var d=0;if(void 0===a||a)d|=j.COLOR_BUFFER_BIT;if(void 0===b||b)d|=j.DEPTH_BUFFER_BIT;if(void 0===c||c)d|=j.STENCIL_BUFFER_BIT;j.clear(d)};this.clearTarget=function(a,b,c,d){this.setRenderTarget(a);this.clear(b,c,d)};this.addPostPlugin=function(a){a.init(this);this.renderPluginsPost.push(a)};this.addPrePlugin=function(a){a.init(this);this.renderPluginsPre.push(a)};this.updateShadowMap=function(a,b){Ba=null;Aa=$=ka=Ga=ja=-1;ta=!0;U=Y=-1;this.shadowMapPlugin.update(a,b)};
var Cb=function(a){a=a.target;a.removeEventListener("dispose",Cb);a.__webglInit=void 0;if(a instanceof THREE.BufferGeometry){var b=a.attributes,c;for(c in b)void 0!==b[c].buffer&&j.deleteBuffer(b[c].buffer);L.info.memory.geometries--}else if(void 0!==a.geometryGroups)for(b in a.geometryGroups){c=a.geometryGroups[b];if(void 0!==c.numMorphTargets)for(var d=0,e=c.numMorphTargets;d<e;d++)j.deleteBuffer(c.__webglMorphTargetsBuffers[d]);if(void 0!==c.numMorphNormals){d=0;for(e=c.numMorphNormals;d<e;d++)j.deleteBuffer(c.__webglMorphNormalsBuffers[d])}Hb(c)}else Hb(a)},
Db=function(a){a=a.target;a.removeEventListener("dispose",Db);a.image&&a.image.__webglTextureCube?j.deleteTexture(a.image.__webglTextureCube):a.__webglInit&&(a.__webglInit=!1,j.deleteTexture(a.__webglTexture));L.info.memory.textures--},Eb=function(a){a=a.target;a.removeEventListener("dispose",Eb);if(a&&a.__webglTexture)if(j.deleteTexture(a.__webglTexture),a instanceof THREE.WebGLRenderTargetCube)for(var b=0;6>b;b++)j.deleteFramebuffer(a.__webglFramebuffer[b]),j.deleteRenderbuffer(a.__webglRenderbuffer[b]);
else j.deleteFramebuffer(a.__webglFramebuffer),j.deleteRenderbuffer(a.__webglRenderbuffer);L.info.memory.textures--},Fb=function(a){a=a.target;a.removeEventListener("dispose",Fb);Gb(a)},Hb=function(a){void 0!==a.__webglVertexBuffer&&j.deleteBuffer(a.__webglVertexBuffer);void 0!==a.__webglNormalBuffer&&j.deleteBuffer(a.__webglNormalBuffer);void 0!==a.__webglTangentBuffer&&j.deleteBuffer(a.__webglTangentBuffer);void 0!==a.__webglColorBuffer&&j.deleteBuffer(a.__webglColorBuffer);void 0!==a.__webglUVBuffer&&
j.deleteBuffer(a.__webglUVBuffer);void 0!==a.__webglUV2Buffer&&j.deleteBuffer(a.__webglUV2Buffer);void 0!==a.__webglSkinIndicesBuffer&&j.deleteBuffer(a.__webglSkinIndicesBuffer);void 0!==a.__webglSkinWeightsBuffer&&j.deleteBuffer(a.__webglSkinWeightsBuffer);void 0!==a.__webglFaceBuffer&&j.deleteBuffer(a.__webglFaceBuffer);void 0!==a.__webglLineBuffer&&j.deleteBuffer(a.__webglLineBuffer);void 0!==a.__webglLineDistanceBuffer&&j.deleteBuffer(a.__webglLineDistanceBuffer);if(void 0!==a.__webglCustomAttributesList)for(var b in a.__webglCustomAttributesList)j.deleteBuffer(a.__webglCustomAttributesList[b].buffer);
L.info.memory.geometries--},Gb=function(a){var b=a.program;if(void 0!==b){a.program=void 0;var c,d,e=!1,a=0;for(c=da.length;a<c;a++)if(d=da[a],d.program===b){d.usedTimes--;0===d.usedTimes&&(e=!0);break}if(!0===e){e=[];a=0;for(c=da.length;a<c;a++)d=da[a],d.program!==b&&e.push(d);da=e;j.deleteProgram(b);L.info.memory.programs--}}};this.renderBufferImmediate=function(a,b,c){a.hasPositions&&!a.__webglVertexBuffer&&(a.__webglVertexBuffer=j.createBuffer());a.hasNormals&&!a.__webglNormalBuffer&&(a.__webglNormalBuffer=
j.createBuffer());a.hasUvs&&!a.__webglUvBuffer&&(a.__webglUvBuffer=j.createBuffer());a.hasColors&&!a.__webglColorBuffer&&(a.__webglColorBuffer=j.createBuffer());a.hasPositions&&(j.bindBuffer(j.ARRAY_BUFFER,a.__webglVertexBuffer),j.bufferData(j.ARRAY_BUFFER,a.positionArray,j.DYNAMIC_DRAW),j.enableVertexAttribArray(b.attributes.position),j.vertexAttribPointer(b.attributes.position,3,j.FLOAT,!1,0,0));if(a.hasNormals){j.bindBuffer(j.ARRAY_BUFFER,a.__webglNormalBuffer);if(c.shading===THREE.FlatShading){var d,
e,f,h,g,i,k,l,m,n,p,q=3*a.count;for(p=0;p<q;p+=9)n=a.normalArray,d=n[p],e=n[p+1],f=n[p+2],h=n[p+3],i=n[p+4],l=n[p+5],g=n[p+6],k=n[p+7],m=n[p+8],d=(d+h+g)/3,e=(e+i+k)/3,f=(f+l+m)/3,n[p]=d,n[p+1]=e,n[p+2]=f,n[p+3]=d,n[p+4]=e,n[p+5]=f,n[p+6]=d,n[p+7]=e,n[p+8]=f}j.bufferData(j.ARRAY_BUFFER,a.normalArray,j.DYNAMIC_DRAW);j.enableVertexAttribArray(b.attributes.normal);j.vertexAttribPointer(b.attributes.normal,3,j.FLOAT,!1,0,0)}a.hasUvs&&c.map&&(j.bindBuffer(j.ARRAY_BUFFER,a.__webglUvBuffer),j.bufferData(j.ARRAY_BUFFER,
a.uvArray,j.DYNAMIC_DRAW),j.enableVertexAttribArray(b.attributes.uv),j.vertexAttribPointer(b.attributes.uv,2,j.FLOAT,!1,0,0));a.hasColors&&c.vertexColors!==THREE.NoColors&&(j.bindBuffer(j.ARRAY_BUFFER,a.__webglColorBuffer),j.bufferData(j.ARRAY_BUFFER,a.colorArray,j.DYNAMIC_DRAW),j.enableVertexAttribArray(b.attributes.color),j.vertexAttribPointer(b.attributes.color,3,j.FLOAT,!1,0,0));j.drawArrays(j.TRIANGLES,0,a.count);a.count=0};this.renderBufferDirect=function(a,b,c,d,e,f){if(!1!==d.visible){var i,
k,l,m;i=z(a,b,c,d,f);b=i.attributes;a=e.attributes;c=!1;i=16777215*e.id+2*i.id+(d.wireframe?1:0);i!==$&&($=i,c=!0);c&&g();if(f instanceof THREE.Mesh)if(f=a.index){e=e.offsets;1<e.length&&(c=!0);for(var n=0,p=e.length;n<p;n++){var q=e[n].index;if(c){for(k in b)l=b[k],i=a[k],0<=l&&(i?(m=i.itemSize,j.bindBuffer(j.ARRAY_BUFFER,i.buffer),h(l),j.vertexAttribPointer(l,m,j.FLOAT,!1,0,4*q*m)):d.defaultAttributeValues&&(2===d.defaultAttributeValues[k].length?j.vertexAttrib2fv(l,d.defaultAttributeValues[k]):
3===d.defaultAttributeValues[k].length&&j.vertexAttrib3fv(l,d.defaultAttributeValues[k])));j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,f.buffer)}j.drawElements(j.TRIANGLES,e[n].count,j.UNSIGNED_SHORT,2*e[n].start);L.info.render.calls++;L.info.render.vertices+=e[n].count;L.info.render.faces+=e[n].count/3}}else{if(c)for(k in b)"index"!==k&&(l=b[k],i=a[k],0<=l&&(i?(m=i.itemSize,j.bindBuffer(j.ARRAY_BUFFER,i.buffer),h(l),j.vertexAttribPointer(l,m,j.FLOAT,!1,0,0)):d.defaultAttributeValues&&d.defaultAttributeValues[k]&&
(2===d.defaultAttributeValues[k].length?j.vertexAttrib2fv(l,d.defaultAttributeValues[k]):3===d.defaultAttributeValues[k].length&&j.vertexAttrib3fv(l,d.defaultAttributeValues[k]))));d=e.attributes.position;j.drawArrays(j.TRIANGLES,0,d.numItems/3);L.info.render.calls++;L.info.render.vertices+=d.numItems/3;L.info.render.faces+=d.numItems/3/3}else if(f instanceof THREE.ParticleSystem){if(c){for(k in b)l=b[k],i=a[k],0<=l&&(i?(m=i.itemSize,j.bindBuffer(j.ARRAY_BUFFER,i.buffer),h(l),j.vertexAttribPointer(l,
m,j.FLOAT,!1,0,0)):d.defaultAttributeValues&&d.defaultAttributeValues[k]&&(2===d.defaultAttributeValues[k].length?j.vertexAttrib2fv(l,d.defaultAttributeValues[k]):3===d.defaultAttributeValues[k].length&&j.vertexAttrib3fv(l,d.defaultAttributeValues[k])));d=a.position;j.drawArrays(j.POINTS,0,d.numItems/3);L.info.render.calls++;L.info.render.points+=d.numItems/3}}else if(f instanceof THREE.Line&&c){for(k in b)l=b[k],i=a[k],0<=l&&(i?(m=i.itemSize,j.bindBuffer(j.ARRAY_BUFFER,i.buffer),h(l),j.vertexAttribPointer(l,
m,j.FLOAT,!1,0,0)):d.defaultAttributeValues&&d.defaultAttributeValues[k]&&(2===d.defaultAttributeValues[k].length?j.vertexAttrib2fv(l,d.defaultAttributeValues[k]):3===d.defaultAttributeValues[k].length&&j.vertexAttrib3fv(l,d.defaultAttributeValues[k])));k=f.type===THREE.LineStrip?j.LINE_STRIP:j.LINES;E(d.linewidth);d=a.position;j.drawArrays(k,0,d.numItems/3);L.info.render.calls++;L.info.render.points+=d.numItems}}};this.renderBuffer=function(a,b,c,d,e,f){if(!1!==d.visible){var i,l,c=z(a,b,c,d,f),
a=c.attributes,b=!1,c=16777215*e.id+2*c.id+(d.wireframe?1:0);c!==$&&($=c,b=!0);b&&g();if(!d.morphTargets&&0<=a.position)b&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglVertexBuffer),h(a.position),j.vertexAttribPointer(a.position,3,j.FLOAT,!1,0,0));else if(f.morphTargetBase){c=d.program.attributes;-1!==f.morphTargetBase&&0<=c.position?(j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[f.morphTargetBase]),h(c.position),j.vertexAttribPointer(c.position,3,j.FLOAT,!1,0,0)):0<=c.position&&(j.bindBuffer(j.ARRAY_BUFFER,
e.__webglVertexBuffer),h(c.position),j.vertexAttribPointer(c.position,3,j.FLOAT,!1,0,0));if(f.morphTargetForcedOrder.length){var m=0;l=f.morphTargetForcedOrder;for(i=f.morphTargetInfluences;m<d.numSupportedMorphTargets&&m<l.length;)0<=c["morphTarget"+m]&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[l[m]]),h(c["morphTarget"+m]),j.vertexAttribPointer(c["morphTarget"+m],3,j.FLOAT,!1,0,0)),0<=c["morphNormal"+m]&&d.morphNormals&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphNormalsBuffers[l[m]]),
h(c["morphNormal"+m]),j.vertexAttribPointer(c["morphNormal"+m],3,j.FLOAT,!1,0,0)),f.__webglMorphTargetInfluences[m]=i[l[m]],m++}else{l=[];i=f.morphTargetInfluences;var n,p=i.length;for(n=0;n<p;n++)m=i[n],0<m&&l.push([m,n]);l.length>d.numSupportedMorphTargets?(l.sort(k),l.length=d.numSupportedMorphTargets):l.length>d.numSupportedMorphNormals?l.sort(k):0===l.length&&l.push([0,0]);for(m=0;m<d.numSupportedMorphTargets;)l[m]?(n=l[m][1],0<=c["morphTarget"+m]&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[n]),
h(c["morphTarget"+m]),j.vertexAttribPointer(c["morphTarget"+m],3,j.FLOAT,!1,0,0)),0<=c["morphNormal"+m]&&d.morphNormals&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphNormalsBuffers[n]),h(c["morphNormal"+m]),j.vertexAttribPointer(c["morphNormal"+m],3,j.FLOAT,!1,0,0)),f.__webglMorphTargetInfluences[m]=i[n]):f.__webglMorphTargetInfluences[m]=0,m++}null!==d.program.uniforms.morphTargetInfluences&&j.uniform1fv(d.program.uniforms.morphTargetInfluences,f.__webglMorphTargetInfluences)}if(b){if(e.__webglCustomAttributesList){i=
0;for(l=e.__webglCustomAttributesList.length;i<l;i++)c=e.__webglCustomAttributesList[i],0<=a[c.buffer.belongsToAttribute]&&(j.bindBuffer(j.ARRAY_BUFFER,c.buffer),h(a[c.buffer.belongsToAttribute]),j.vertexAttribPointer(a[c.buffer.belongsToAttribute],c.size,j.FLOAT,!1,0,0))}0<=a.color&&(0<f.geometry.colors.length||0<f.geometry.faces.length?(j.bindBuffer(j.ARRAY_BUFFER,e.__webglColorBuffer),h(a.color),j.vertexAttribPointer(a.color,3,j.FLOAT,!1,0,0)):d.defaultAttributeValues&&j.vertexAttrib3fv(a.color,
d.defaultAttributeValues.color));0<=a.normal&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglNormalBuffer),h(a.normal),j.vertexAttribPointer(a.normal,3,j.FLOAT,!1,0,0));0<=a.tangent&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglTangentBuffer),h(a.tangent),j.vertexAttribPointer(a.tangent,4,j.FLOAT,!1,0,0));0<=a.uv&&(f.geometry.faceVertexUvs[0]?(j.bindBuffer(j.ARRAY_BUFFER,e.__webglUVBuffer),h(a.uv),j.vertexAttribPointer(a.uv,2,j.FLOAT,!1,0,0)):d.defaultAttributeValues&&j.vertexAttrib2fv(a.uv,d.defaultAttributeValues.uv));
0<=a.uv2&&(f.geometry.faceVertexUvs[1]?(j.bindBuffer(j.ARRAY_BUFFER,e.__webglUV2Buffer),h(a.uv2),j.vertexAttribPointer(a.uv2,2,j.FLOAT,!1,0,0)):d.defaultAttributeValues&&j.vertexAttrib2fv(a.uv2,d.defaultAttributeValues.uv2));d.skinning&&(0<=a.skinIndex&&0<=a.skinWeight)&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglSkinIndicesBuffer),h(a.skinIndex),j.vertexAttribPointer(a.skinIndex,4,j.FLOAT,!1,0,0),j.bindBuffer(j.ARRAY_BUFFER,e.__webglSkinWeightsBuffer),h(a.skinWeight),j.vertexAttribPointer(a.skinWeight,
4,j.FLOAT,!1,0,0));0<=a.lineDistance&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglLineDistanceBuffer),h(a.lineDistance),j.vertexAttribPointer(a.lineDistance,1,j.FLOAT,!1,0,0))}f instanceof THREE.Mesh?(d.wireframe?(E(d.wireframeLinewidth),b&&j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,e.__webglLineBuffer),j.drawElements(j.LINES,e.__webglLineCount,j.UNSIGNED_SHORT,0)):(b&&j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,e.__webglFaceBuffer),j.drawElements(j.TRIANGLES,e.__webglFaceCount,j.UNSIGNED_SHORT,0)),L.info.render.calls++,
L.info.render.vertices+=e.__webglFaceCount,L.info.render.faces+=e.__webglFaceCount/3):f instanceof THREE.Line?(f=f.type===THREE.LineStrip?j.LINE_STRIP:j.LINES,E(d.linewidth),j.drawArrays(f,0,e.__webglLineCount),L.info.render.calls++):f instanceof THREE.ParticleSystem&&(j.drawArrays(j.POINTS,0,e.__webglParticleCount),L.info.render.calls++,L.info.render.points+=e.__webglParticleCount)}};this.render=function(a,b,c,d){if(!1===b instanceof THREE.Camera)console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");
else{var e,f,h,g,k=a.__lights,n=a.fog;Aa=-1;ta=!0;!0===a.autoUpdate&&a.updateMatrixWorld();void 0===b.parent&&b.updateMatrixWorld();b.matrixWorldInverse.getInverse(b.matrixWorld);Ea.multiplyMatrices(b.projectionMatrix,b.matrixWorldInverse);la.setFromMatrix(Ea);this.autoUpdateObjects&&this.initWebGLObjects(a);m(this.renderPluginsPre,a,b);L.info.render.calls=0;L.info.render.vertices=0;L.info.render.faces=0;L.info.render.points=0;this.setRenderTarget(c);(this.autoClear||d)&&this.clear(this.autoClearColor,
this.autoClearDepth,this.autoClearStencil);g=a.__webglObjects;d=0;for(e=g.length;d<e;d++)if(f=g[d],h=f.object,f.id=d,f.render=!1,h.visible&&(!(h instanceof THREE.Mesh||h instanceof THREE.ParticleSystem)||!h.frustumCulled||la.intersectsObject(h))){var q=h;q._modelViewMatrix.multiplyMatrices(b.matrixWorldInverse,q.matrixWorld);q._normalMatrix.getNormalMatrix(q._modelViewMatrix);var q=f,r=q.buffer,t=void 0,s=t=void 0,s=q.object.material;if(s instanceof THREE.MeshFaceMaterial)t=r.materialIndex,t=s.materials[t],
t.transparent?(q.transparent=t,q.opaque=null):(q.opaque=t,q.transparent=null);else if(t=s)t.transparent?(q.transparent=t,q.opaque=null):(q.opaque=t,q.transparent=null);f.render=!0;!0===this.sortObjects&&(null!==h.renderDepth?f.z=h.renderDepth:(ra.getPositionFromMatrix(h.matrixWorld),ra.applyProjection(Ea),f.z=ra.z))}this.sortObjects&&g.sort(i);g=a.__webglObjectsImmediate;d=0;for(e=g.length;d<e;d++)f=g[d],h=f.object,h.visible&&(h._modelViewMatrix.multiplyMatrices(b.matrixWorldInverse,h.matrixWorld),
h._normalMatrix.getNormalMatrix(h._modelViewMatrix),h=f.object.material,h.transparent?(f.transparent=h,f.opaque=null):(f.opaque=h,f.transparent=null));a.overrideMaterial?(d=a.overrideMaterial,this.setBlending(d.blending,d.blendEquation,d.blendSrc,d.blendDst),this.setDepthTest(d.depthTest),this.setDepthWrite(d.depthWrite),A(d.polygonOffset,d.polygonOffsetFactor,d.polygonOffsetUnits),l(a.__webglObjects,!1,"",b,k,n,!0,d),p(a.__webglObjectsImmediate,"",b,k,n,!1,d)):(d=null,this.setBlending(THREE.NoBlending),
l(a.__webglObjects,!0,"opaque",b,k,n,!1,d),p(a.__webglObjectsImmediate,"opaque",b,k,n,!1,d),l(a.__webglObjects,!1,"transparent",b,k,n,!0,d),p(a.__webglObjectsImmediate,"transparent",b,k,n,!0,d));m(this.renderPluginsPost,a,b);c&&(c.generateMipmaps&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter)&&(c instanceof THREE.WebGLRenderTargetCube?(j.bindTexture(j.TEXTURE_CUBE_MAP,c.__webglTexture),j.generateMipmap(j.TEXTURE_CUBE_MAP),j.bindTexture(j.TEXTURE_CUBE_MAP,null)):(j.bindTexture(j.TEXTURE_2D,
c.__webglTexture),j.generateMipmap(j.TEXTURE_2D),j.bindTexture(j.TEXTURE_2D,null)));this.setDepthTest(!0);this.setDepthWrite(!0)}};this.renderImmediateObject=function(a,b,c,d,e){var f=z(a,b,c,d,e);$=-1;L.setMaterialFaces(d);e.immediateRenderCallback?e.immediateRenderCallback(f,j,la):e.render(function(a){L.renderBufferImmediate(a,f,d)})};this.initWebGLObjects=function(a){a.__webglObjects||(a.__webglObjects=[],a.__webglObjectsImmediate=[],a.__webglSprites=[],a.__webglFlares=[]);for(;a.__objectsAdded.length;)t(a.__objectsAdded[0],
a),a.__objectsAdded.splice(0,1);for(;a.__objectsRemoved.length;)u(a.__objectsRemoved[0],a),a.__objectsRemoved.splice(0,1);for(var b=0,h=a.__webglObjects.length;b<h;b++){var g=a.__webglObjects[b].object;void 0===g.__webglInit&&(void 0!==g.__webglActive&&u(g,a),t(g,a));var i=g,l=i.geometry,m=void 0,p=void 0,r=void 0;if(l instanceof THREE.BufferGeometry){var s=j.DYNAMIC_DRAW,v=!l.dynamic,z=l.attributes,y=void 0,x=void 0;for(y in z)x=z[y],x.needsUpdate&&("index"===y?(j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,
x.buffer),j.bufferData(j.ELEMENT_ARRAY_BUFFER,x.array,s)):(j.bindBuffer(j.ARRAY_BUFFER,x.buffer),j.bufferData(j.ARRAY_BUFFER,x.array,s)),x.needsUpdate=!1),v&&!x.dynamic&&(x.array=null)}else if(i instanceof THREE.Mesh){for(var A=0,B=l.geometryGroupsList.length;A<B;A++)if(m=l.geometryGroupsList[A],r=d(i,m),l.buffersNeedUpdate&&c(m,i),p=r.attributes&&q(r),l.verticesNeedUpdate||l.morphTargetsNeedUpdate||l.elementsNeedUpdate||l.uvsNeedUpdate||l.normalsNeedUpdate||l.colorsNeedUpdate||l.tangentsNeedUpdate||
p){var w=m,E=i,D=j.DYNAMIC_DRAW,G=!l.dynamic,F=r;if(w.__inittedArrays){var K=e(F),I=F.vertexColors?F.vertexColors:!1,L=f(F),O=K===THREE.SmoothShading,C=void 0,J=void 0,V=void 0,M=void 0,Q=void 0,U=void 0,ba=void 0,R=void 0,Y=void 0,za=void 0,$=void 0,P=void 0,X=void 0,W=void 0,Ba=void 0,ea=void 0,Aa=void 0,ca=void 0,da=void 0,ha=void 0,fa=void 0,ja=void 0,ka=void 0,la=void 0,na=void 0,pa=void 0,sa=void 0,ta=void 0,ua=void 0,Ca=void 0,Da=void 0,Ga=void 0,Fa=void 0,Ka=void 0,Sa=void 0,La=void 0,va=
void 0,wa=void 0,Qa=void 0,Ra=void 0,db=0,eb=0,Oa=0,Pa=0,Ua=0,hb=0,Ta=0,tb=0,Za=0,qa=0,xa=0,N=0,Na=void 0,ib=w.__vertexArray,bb=w.__uvArray,cb=w.__uv2Array,Ma=w.__normalArray,Va=w.__tangentArray,jb=w.__colorArray,Wa=w.__skinIndexArray,Xa=w.__skinWeightArray,fb=w.__morphTargetsArrays,sb=w.__morphNormalsArrays,pb=w.__webglCustomAttributesList,H=void 0,Pb=w.__faceArray,vb=w.__lineArray,Ha=E.geometry,Bb=Ha.elementsNeedUpdate,yb=Ha.uvsNeedUpdate,Db=Ha.normalsNeedUpdate,Mb=Ha.tangentsNeedUpdate,Nb=Ha.colorsNeedUpdate,
Ob=Ha.morphTargetsNeedUpdate,ec=Ha.vertices,aa=w.faces3,kb=Ha.faces,Cb=Ha.faceVertexUvs[0],Eb=Ha.faceVertexUvs[1],fc=Ha.skinIndices,Qb=Ha.skinWeights,Rb=Ha.morphTargets,Fb=Ha.morphNormals;if(Ha.verticesNeedUpdate){C=0;for(J=aa.length;C<J;C++)M=kb[aa[C]],P=ec[M.a],X=ec[M.b],W=ec[M.c],ib[eb]=P.x,ib[eb+1]=P.y,ib[eb+2]=P.z,ib[eb+3]=X.x,ib[eb+4]=X.y,ib[eb+5]=X.z,ib[eb+6]=W.x,ib[eb+7]=W.y,ib[eb+8]=W.z,eb+=9;j.bindBuffer(j.ARRAY_BUFFER,w.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,ib,D)}if(Ob){Sa=0;
for(La=Rb.length;Sa<La;Sa++){C=xa=0;for(J=aa.length;C<J;C++)Qa=aa[C],M=kb[Qa],P=Rb[Sa].vertices[M.a],X=Rb[Sa].vertices[M.b],W=Rb[Sa].vertices[M.c],va=fb[Sa],va[xa]=P.x,va[xa+1]=P.y,va[xa+2]=P.z,va[xa+3]=X.x,va[xa+4]=X.y,va[xa+5]=X.z,va[xa+6]=W.x,va[xa+7]=W.y,va[xa+8]=W.z,F.morphNormals&&(O?(Ra=Fb[Sa].vertexNormals[Qa],ca=Ra.a,da=Ra.b,ha=Ra.c):ha=da=ca=Fb[Sa].faceNormals[Qa],wa=sb[Sa],wa[xa]=ca.x,wa[xa+1]=ca.y,wa[xa+2]=ca.z,wa[xa+3]=da.x,wa[xa+4]=da.y,wa[xa+5]=da.z,wa[xa+6]=ha.x,wa[xa+7]=ha.y,wa[xa+
8]=ha.z),xa+=9;j.bindBuffer(j.ARRAY_BUFFER,w.__webglMorphTargetsBuffers[Sa]);j.bufferData(j.ARRAY_BUFFER,fb[Sa],D);F.morphNormals&&(j.bindBuffer(j.ARRAY_BUFFER,w.__webglMorphNormalsBuffers[Sa]),j.bufferData(j.ARRAY_BUFFER,sb[Sa],D))}}if(Qb.length){C=0;for(J=aa.length;C<J;C++)M=kb[aa[C]],la=Qb[M.a],na=Qb[M.b],pa=Qb[M.c],Xa[qa]=la.x,Xa[qa+1]=la.y,Xa[qa+2]=la.z,Xa[qa+3]=la.w,Xa[qa+4]=na.x,Xa[qa+5]=na.y,Xa[qa+6]=na.z,Xa[qa+7]=na.w,Xa[qa+8]=pa.x,Xa[qa+9]=pa.y,Xa[qa+10]=pa.z,Xa[qa+11]=pa.w,sa=fc[M.a],ta=
fc[M.b],ua=fc[M.c],Wa[qa]=sa.x,Wa[qa+1]=sa.y,Wa[qa+2]=sa.z,Wa[qa+3]=sa.w,Wa[qa+4]=ta.x,Wa[qa+5]=ta.y,Wa[qa+6]=ta.z,Wa[qa+7]=ta.w,Wa[qa+8]=ua.x,Wa[qa+9]=ua.y,Wa[qa+10]=ua.z,Wa[qa+11]=ua.w,qa+=12;0<qa&&(j.bindBuffer(j.ARRAY_BUFFER,w.__webglSkinIndicesBuffer),j.bufferData(j.ARRAY_BUFFER,Wa,D),j.bindBuffer(j.ARRAY_BUFFER,w.__webglSkinWeightsBuffer),j.bufferData(j.ARRAY_BUFFER,Xa,D))}if(Nb&&I){C=0;for(J=aa.length;C<J;C++)M=kb[aa[C]],ba=M.vertexColors,R=M.color,3===ba.length&&I===THREE.VertexColors?(fa=
ba[0],ja=ba[1],ka=ba[2]):ka=ja=fa=R,jb[Za]=fa.r,jb[Za+1]=fa.g,jb[Za+2]=fa.b,jb[Za+3]=ja.r,jb[Za+4]=ja.g,jb[Za+5]=ja.b,jb[Za+6]=ka.r,jb[Za+7]=ka.g,jb[Za+8]=ka.b,Za+=9;0<Za&&(j.bindBuffer(j.ARRAY_BUFFER,w.__webglColorBuffer),j.bufferData(j.ARRAY_BUFFER,jb,D))}if(Mb&&Ha.hasTangents){C=0;for(J=aa.length;C<J;C++)M=kb[aa[C]],Y=M.vertexTangents,Ba=Y[0],ea=Y[1],Aa=Y[2],Va[Ta]=Ba.x,Va[Ta+1]=Ba.y,Va[Ta+2]=Ba.z,Va[Ta+3]=Ba.w,Va[Ta+4]=ea.x,Va[Ta+5]=ea.y,Va[Ta+6]=ea.z,Va[Ta+7]=ea.w,Va[Ta+8]=Aa.x,Va[Ta+9]=Aa.y,
Va[Ta+10]=Aa.z,Va[Ta+11]=Aa.w,Ta+=12;j.bindBuffer(j.ARRAY_BUFFER,w.__webglTangentBuffer);j.bufferData(j.ARRAY_BUFFER,Va,D)}if(Db&&K){C=0;for(J=aa.length;C<J;C++)if(M=kb[aa[C]],Q=M.vertexNormals,U=M.normal,3===Q.length&&O)for(Ca=0;3>Ca;Ca++)Ga=Q[Ca],Ma[hb]=Ga.x,Ma[hb+1]=Ga.y,Ma[hb+2]=Ga.z,hb+=3;else for(Ca=0;3>Ca;Ca++)Ma[hb]=U.x,Ma[hb+1]=U.y,Ma[hb+2]=U.z,hb+=3;j.bindBuffer(j.ARRAY_BUFFER,w.__webglNormalBuffer);j.bufferData(j.ARRAY_BUFFER,Ma,D)}if(yb&&Cb&&L){C=0;for(J=aa.length;C<J;C++)if(V=aa[C],za=
Cb[V],void 0!==za)for(Ca=0;3>Ca;Ca++)Fa=za[Ca],bb[Oa]=Fa.x,bb[Oa+1]=Fa.y,Oa+=2;0<Oa&&(j.bindBuffer(j.ARRAY_BUFFER,w.__webglUVBuffer),j.bufferData(j.ARRAY_BUFFER,bb,D))}if(yb&&Eb&&L){C=0;for(J=aa.length;C<J;C++)if(V=aa[C],$=Eb[V],void 0!==$)for(Ca=0;3>Ca;Ca++)Ka=$[Ca],cb[Pa]=Ka.x,cb[Pa+1]=Ka.y,Pa+=2;0<Pa&&(j.bindBuffer(j.ARRAY_BUFFER,w.__webglUV2Buffer),j.bufferData(j.ARRAY_BUFFER,cb,D))}if(Bb){C=0;for(J=aa.length;C<J;C++)Pb[Ua]=db,Pb[Ua+1]=db+1,Pb[Ua+2]=db+2,Ua+=3,vb[tb]=db,vb[tb+1]=db+1,vb[tb+2]=
db,vb[tb+3]=db+2,vb[tb+4]=db+1,vb[tb+5]=db+2,tb+=6,db+=3;j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,w.__webglFaceBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,Pb,D);j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,w.__webglLineBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,vb,D)}if(pb){Ca=0;for(Da=pb.length;Ca<Da;Ca++)if(H=pb[Ca],H.__original.needsUpdate){N=0;if(1===H.size)if(void 0===H.boundTo||"vertices"===H.boundTo){C=0;for(J=aa.length;C<J;C++)M=kb[aa[C]],H.array[N]=H.value[M.a],H.array[N+1]=H.value[M.b],H.array[N+2]=
H.value[M.c],N+=3}else{if("faces"===H.boundTo){C=0;for(J=aa.length;C<J;C++)Na=H.value[aa[C]],H.array[N]=Na,H.array[N+1]=Na,H.array[N+2]=Na,N+=3}}else if(2===H.size)if(void 0===H.boundTo||"vertices"===H.boundTo){C=0;for(J=aa.length;C<J;C++)M=kb[aa[C]],P=H.value[M.a],X=H.value[M.b],W=H.value[M.c],H.array[N]=P.x,H.array[N+1]=P.y,H.array[N+2]=X.x,H.array[N+3]=X.y,H.array[N+4]=W.x,H.array[N+5]=W.y,N+=6}else{if("faces"===H.boundTo){C=0;for(J=aa.length;C<J;C++)W=X=P=Na=H.value[aa[C]],H.array[N]=P.x,H.array[N+
1]=P.y,H.array[N+2]=X.x,H.array[N+3]=X.y,H.array[N+4]=W.x,H.array[N+5]=W.y,N+=6}}else if(3===H.size){var oa;oa="c"===H.type?["r","g","b"]:["x","y","z"];if(void 0===H.boundTo||"vertices"===H.boundTo){C=0;for(J=aa.length;C<J;C++)M=kb[aa[C]],P=H.value[M.a],X=H.value[M.b],W=H.value[M.c],H.array[N]=P[oa[0]],H.array[N+1]=P[oa[1]],H.array[N+2]=P[oa[2]],H.array[N+3]=X[oa[0]],H.array[N+4]=X[oa[1]],H.array[N+5]=X[oa[2]],H.array[N+6]=W[oa[0]],H.array[N+7]=W[oa[1]],H.array[N+8]=W[oa[2]],N+=9}else if("faces"===
H.boundTo){C=0;for(J=aa.length;C<J;C++)W=X=P=Na=H.value[aa[C]],H.array[N]=P[oa[0]],H.array[N+1]=P[oa[1]],H.array[N+2]=P[oa[2]],H.array[N+3]=X[oa[0]],H.array[N+4]=X[oa[1]],H.array[N+5]=X[oa[2]],H.array[N+6]=W[oa[0]],H.array[N+7]=W[oa[1]],H.array[N+8]=W[oa[2]],N+=9}else if("faceVertices"===H.boundTo){C=0;for(J=aa.length;C<J;C++)Na=H.value[aa[C]],P=Na[0],X=Na[1],W=Na[2],H.array[N]=P[oa[0]],H.array[N+1]=P[oa[1]],H.array[N+2]=P[oa[2]],H.array[N+3]=X[oa[0]],H.array[N+4]=X[oa[1]],H.array[N+5]=X[oa[2]],H.array[N+
6]=W[oa[0]],H.array[N+7]=W[oa[1]],H.array[N+8]=W[oa[2]],N+=9}}else if(4===H.size)if(void 0===H.boundTo||"vertices"===H.boundTo){C=0;for(J=aa.length;C<J;C++)M=kb[aa[C]],P=H.value[M.a],X=H.value[M.b],W=H.value[M.c],H.array[N]=P.x,H.array[N+1]=P.y,H.array[N+2]=P.z,H.array[N+3]=P.w,H.array[N+4]=X.x,H.array[N+5]=X.y,H.array[N+6]=X.z,H.array[N+7]=X.w,H.array[N+8]=W.x,H.array[N+9]=W.y,H.array[N+10]=W.z,H.array[N+11]=W.w,N+=12}else if("faces"===H.boundTo){C=0;for(J=aa.length;C<J;C++)W=X=P=Na=H.value[aa[C]],
H.array[N]=P.x,H.array[N+1]=P.y,H.array[N+2]=P.z,H.array[N+3]=P.w,H.array[N+4]=X.x,H.array[N+5]=X.y,H.array[N+6]=X.z,H.array[N+7]=X.w,H.array[N+8]=W.x,H.array[N+9]=W.y,H.array[N+10]=W.z,H.array[N+11]=W.w,N+=12}else if("faceVertices"===H.boundTo){C=0;for(J=aa.length;C<J;C++)Na=H.value[aa[C]],P=Na[0],X=Na[1],W=Na[2],H.array[N]=P.x,H.array[N+1]=P.y,H.array[N+2]=P.z,H.array[N+3]=P.w,H.array[N+4]=X.x,H.array[N+5]=X.y,H.array[N+6]=X.z,H.array[N+7]=X.w,H.array[N+8]=W.x,H.array[N+9]=W.y,H.array[N+10]=W.z,
H.array[N+11]=W.w,N+=12}j.bindBuffer(j.ARRAY_BUFFER,H.buffer);j.bufferData(j.ARRAY_BUFFER,H.array,D)}}G&&(delete w.__inittedArrays,delete w.__colorArray,delete w.__normalArray,delete w.__tangentArray,delete w.__uvArray,delete w.__uv2Array,delete w.__faceArray,delete w.__vertexArray,delete w.__lineArray,delete w.__skinIndexArray,delete w.__skinWeightArray)}}l.verticesNeedUpdate=!1;l.morphTargetsNeedUpdate=!1;l.elementsNeedUpdate=!1;l.uvsNeedUpdate=!1;l.normalsNeedUpdate=!1;l.colorsNeedUpdate=!1;l.tangentsNeedUpdate=
!1;l.buffersNeedUpdate=!1;r.attributes&&n(r)}else if(i instanceof THREE.Line){r=d(i,l);p=r.attributes&&q(r);if(l.verticesNeedUpdate||l.colorsNeedUpdate||l.lineDistancesNeedUpdate||p){var Ya=l,Sb=j.DYNAMIC_DRAW,Ib=void 0,Jb=void 0,Kb=void 0,Tb=void 0,ma=void 0,Ub=void 0,Gb=Ya.vertices,Hb=Ya.colors,kc=Ya.lineDistances,Zb=Gb.length,$b=Hb.length,ac=kc.length,Vb=Ya.__vertexArray,Wb=Ya.__colorArray,lc=Ya.__lineDistanceArray,bc=Ya.colorsNeedUpdate,cc=Ya.lineDistancesNeedUpdate,gc=Ya.__webglCustomAttributesList,
Xb=void 0,mc=void 0,ya=void 0,zb=void 0,Ia=void 0,ia=void 0;if(Ya.verticesNeedUpdate){for(Ib=0;Ib<Zb;Ib++)Tb=Gb[Ib],ma=3*Ib,Vb[ma]=Tb.x,Vb[ma+1]=Tb.y,Vb[ma+2]=Tb.z;j.bindBuffer(j.ARRAY_BUFFER,Ya.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,Vb,Sb)}if(bc){for(Jb=0;Jb<$b;Jb++)Ub=Hb[Jb],ma=3*Jb,Wb[ma]=Ub.r,Wb[ma+1]=Ub.g,Wb[ma+2]=Ub.b;j.bindBuffer(j.ARRAY_BUFFER,Ya.__webglColorBuffer);j.bufferData(j.ARRAY_BUFFER,Wb,Sb)}if(cc){for(Kb=0;Kb<ac;Kb++)lc[Kb]=kc[Kb];j.bindBuffer(j.ARRAY_BUFFER,Ya.__webglLineDistanceBuffer);
j.bufferData(j.ARRAY_BUFFER,lc,Sb)}if(gc){Xb=0;for(mc=gc.length;Xb<mc;Xb++)if(ia=gc[Xb],ia.needsUpdate&&(void 0===ia.boundTo||"vertices"===ia.boundTo)){ma=0;zb=ia.value.length;if(1===ia.size)for(ya=0;ya<zb;ya++)ia.array[ya]=ia.value[ya];else if(2===ia.size)for(ya=0;ya<zb;ya++)Ia=ia.value[ya],ia.array[ma]=Ia.x,ia.array[ma+1]=Ia.y,ma+=2;else if(3===ia.size)if("c"===ia.type)for(ya=0;ya<zb;ya++)Ia=ia.value[ya],ia.array[ma]=Ia.r,ia.array[ma+1]=Ia.g,ia.array[ma+2]=Ia.b,ma+=3;else for(ya=0;ya<zb;ya++)Ia=
ia.value[ya],ia.array[ma]=Ia.x,ia.array[ma+1]=Ia.y,ia.array[ma+2]=Ia.z,ma+=3;else if(4===ia.size)for(ya=0;ya<zb;ya++)Ia=ia.value[ya],ia.array[ma]=Ia.x,ia.array[ma+1]=Ia.y,ia.array[ma+2]=Ia.z,ia.array[ma+3]=Ia.w,ma+=4;j.bindBuffer(j.ARRAY_BUFFER,ia.buffer);j.bufferData(j.ARRAY_BUFFER,ia.array,Sb)}}}l.verticesNeedUpdate=!1;l.colorsNeedUpdate=!1;l.lineDistancesNeedUpdate=!1;r.attributes&&n(r)}else if(i instanceof THREE.ParticleSystem){r=d(i,l);p=r.attributes&&q(r);if(l.verticesNeedUpdate||l.colorsNeedUpdate||
i.sortParticles||p){var lb=l,hc=j.DYNAMIC_DRAW,Lb=i,Ja=void 0,mb=void 0,nb=void 0,T=void 0,ob=void 0,ub=void 0,Yb=lb.vertices,ic=Yb.length,jc=lb.colors,nc=jc.length,wb=lb.__vertexArray,xb=lb.__colorArray,qb=lb.__sortArray,oc=lb.verticesNeedUpdate,pc=lb.colorsNeedUpdate,rb=lb.__webglCustomAttributesList,$a=void 0,Ab=void 0,Z=void 0,ab=void 0,ga=void 0,S=void 0;if(Lb.sortParticles){gb.copy(Ea);gb.multiply(Lb.matrixWorld);for(Ja=0;Ja<ic;Ja++)nb=Yb[Ja],ra.copy(nb),ra.applyProjection(gb),qb[Ja]=[ra.z,
Ja];qb.sort(k);for(Ja=0;Ja<ic;Ja++)nb=Yb[qb[Ja][1]],T=3*Ja,wb[T]=nb.x,wb[T+1]=nb.y,wb[T+2]=nb.z;for(mb=0;mb<nc;mb++)T=3*mb,ub=jc[qb[mb][1]],xb[T]=ub.r,xb[T+1]=ub.g,xb[T+2]=ub.b;if(rb){$a=0;for(Ab=rb.length;$a<Ab;$a++)if(S=rb[$a],void 0===S.boundTo||"vertices"===S.boundTo)if(T=0,ab=S.value.length,1===S.size)for(Z=0;Z<ab;Z++)ob=qb[Z][1],S.array[Z]=S.value[ob];else if(2===S.size)for(Z=0;Z<ab;Z++)ob=qb[Z][1],ga=S.value[ob],S.array[T]=ga.x,S.array[T+1]=ga.y,T+=2;else if(3===S.size)if("c"===S.type)for(Z=
0;Z<ab;Z++)ob=qb[Z][1],ga=S.value[ob],S.array[T]=ga.r,S.array[T+1]=ga.g,S.array[T+2]=ga.b,T+=3;else for(Z=0;Z<ab;Z++)ob=qb[Z][1],ga=S.value[ob],S.array[T]=ga.x,S.array[T+1]=ga.y,S.array[T+2]=ga.z,T+=3;else if(4===S.size)for(Z=0;Z<ab;Z++)ob=qb[Z][1],ga=S.value[ob],S.array[T]=ga.x,S.array[T+1]=ga.y,S.array[T+2]=ga.z,S.array[T+3]=ga.w,T+=4}}else{if(oc)for(Ja=0;Ja<ic;Ja++)nb=Yb[Ja],T=3*Ja,wb[T]=nb.x,wb[T+1]=nb.y,wb[T+2]=nb.z;if(pc)for(mb=0;mb<nc;mb++)ub=jc[mb],T=3*mb,xb[T]=ub.r,xb[T+1]=ub.g,xb[T+2]=ub.b;
if(rb){$a=0;for(Ab=rb.length;$a<Ab;$a++)if(S=rb[$a],S.needsUpdate&&(void 0===S.boundTo||"vertices"===S.boundTo))if(ab=S.value.length,T=0,1===S.size)for(Z=0;Z<ab;Z++)S.array[Z]=S.value[Z];else if(2===S.size)for(Z=0;Z<ab;Z++)ga=S.value[Z],S.array[T]=ga.x,S.array[T+1]=ga.y,T+=2;else if(3===S.size)if("c"===S.type)for(Z=0;Z<ab;Z++)ga=S.value[Z],S.array[T]=ga.r,S.array[T+1]=ga.g,S.array[T+2]=ga.b,T+=3;else for(Z=0;Z<ab;Z++)ga=S.value[Z],S.array[T]=ga.x,S.array[T+1]=ga.y,S.array[T+2]=ga.z,T+=3;else if(4===
S.size)for(Z=0;Z<ab;Z++)ga=S.value[Z],S.array[T]=ga.x,S.array[T+1]=ga.y,S.array[T+2]=ga.z,S.array[T+3]=ga.w,T+=4}}if(oc||Lb.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,lb.__webglVertexBuffer),j.bufferData(j.ARRAY_BUFFER,wb,hc);if(pc||Lb.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,lb.__webglColorBuffer),j.bufferData(j.ARRAY_BUFFER,xb,hc);if(rb){$a=0;for(Ab=rb.length;$a<Ab;$a++)if(S=rb[$a],S.needsUpdate||Lb.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,S.buffer),j.bufferData(j.ARRAY_BUFFER,S.array,hc)}}l.verticesNeedUpdate=
!1;l.colorsNeedUpdate=!1;r.attributes&&n(r)}}};this.initMaterial=function(a,b,c,d){var e,f,h,g;a.addEventListener("dispose",Fb);var i,k,l,m,n;a instanceof THREE.MeshDepthMaterial?n="depth":a instanceof THREE.MeshNormalMaterial?n="normal":a instanceof THREE.MeshBasicMaterial?n="basic":a instanceof THREE.MeshLambertMaterial?n="lambert":a instanceof THREE.MeshPhongMaterial?n="phong":a instanceof THREE.LineBasicMaterial?n="basic":a instanceof THREE.LineDashedMaterial?n="dashed":a instanceof THREE.ParticleSystemMaterial&&
(n="particle_basic");if(n){var p=THREE.ShaderLib[n];a.uniforms=THREE.UniformsUtils.clone(p.uniforms);a.vertexShader=p.vertexShader;a.fragmentShader=p.fragmentShader}var q=e=0,r=0,t=p=0;for(f=b.length;t<f;t++)h=b[t],h.onlyShadow||(h instanceof THREE.DirectionalLight&&e++,h ins
View raw

(Sorry about that, but we can’t show files that are this big right now.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment