').attr('id', 'supply_' + name.replace(' ', '-'))
.addClass('supplyItem')
.text(_('{0}:{1}',_(name), num));
return div;
},
moveNorth: function() {
Engine.log('North');
if(World.curPos[1] > 0) World.move(World.NORTH);
},
moveSouth: function() {
Engine.log('South');
if(World.curPos[1] < World.RADIUS * 2) World.move(World.SOUTH);
},
moveWest: function() {
Engine.log('West');
if(World.curPos[0] > 0) World.move(World.WEST);
},
moveEast: function() {
Engine.log('East');
if(World.curPos[0] < World.RADIUS * 2) World.move(World.EAST);
},
move: function(direction) {
var oldTile = World.state.map[World.curPos[0]][World.curPos[1]];
World.curPos[0] += direction[0];
World.curPos[1] += direction[1];
World.narrateMove(oldTile, World.state.map[World.curPos[0]][World.curPos[1]]);
World.lightMap(World.curPos[0], World.curPos[1], World.state.mask);
World.drawMap();
World.doSpace();
// play random footstep
var randomFootstep = Math.floor(Math.random() * 5) + 1;
AudioEngine.playSound(AudioLibrary['FOOTSTEPS_' + randomFootstep]);
if(World.checkDanger()) {
if(World.danger) {
Notifications.notify(World, _('dangerous to be this far from the village without proper protection'));
} else {
Notifications.notify(World, _('safer here'));
}
}
},
keyDown: function(event) {
switch(event.which) {
case 38: // Up
case 87:
World.moveNorth();
break;
case 40: // Down
case 83:
World.moveSouth();
break;
case 37: // Left
case 65:
World.moveWest();
break;
case 39: // Right
case 68:
World.moveEast();
break;
default:
break;
}
},
swipeLeft: function(e) {
World.moveWest();
},
swipeRight: function(e) {
World.moveEast();
},
swipeUp: function(e) {
World.moveNorth();
},
swipeDown: function(e) {
World.moveSouth();
},
click: function(event) {
var map = $('#map'),
// measure clicks relative to the centre of the current location
centreX = map.offset().left + map.width() * World.curPos[0] / (World.RADIUS * 2),
centreY = map.offset().top + map.height() * World.curPos[1] / (World.RADIUS * 2),
clickX = event.pageX - centreX,
clickY = event.pageY - centreY;
if (clickX > clickY && clickX < -clickY) {
World.moveNorth();
}
if (clickX < clickY && clickX > -clickY) {
World.moveSouth();
}
if (clickX < clickY && clickX < -clickY) {
World.moveWest();
}
if (clickX > clickY && clickX > -clickY) {
World.moveEast();
}
},
checkDanger: function() {
World.danger = typeof World.danger == 'undefined' ? false: World.danger;
if(!World.danger) {
if($SM.get('stores["i armour"]', true) === 0 && World.getDistance() >= 8) {
World.danger = true;
return true;
}
if($SM.get('stores["s armour"]', true) === 0 && World.getDistance() >= 18) {
World.danger = true;
return true;
}
} else {
if(World.getDistance() < 8) {
World.danger = false;
return true;
}
if(World.getDistance < 18 && $SM.get('stores["i armour"]', true) > 0) {
World.danger = false;
return true;
}
}
return false;
},
useSupplies: function() {
World.foodMove++;
World.waterMove++;
// Food
var movesPerFood = World.MOVES_PER_FOOD;
movesPerFood *= $SM.hasPerk('slow metabolism') ? 2 : 1;
if(World.foodMove >= movesPerFood) {
World.foodMove = 0;
var num = Path.outfit['cured meat'];
num--;
if(num === 0) {
Notifications.notify(World, _('the meat has run out'));
} else if(num < 0) {
// Starvation! Hooray!
num = 0;
if(!World.starvation) {
Notifications.notify(World, _('starvation sets in'));
World.starvation = true;
} else {
$SM.set('character.starved', $SM.get('character.starved', true));
$SM.add('character.starved', 1);
if($SM.get('character.starved') >= 10 && !$SM.hasPerk('slow metabolism')) {
$SM.addPerk('slow metabolism');
}
World.die();
return false;
}
} else {
World.starvation = false;
World.setHp(World.health + World.meatHeal());
}
Path.outfit['cured meat'] = num;
}
// Water
var movesPerWater = World.MOVES_PER_WATER;
movesPerWater *= $SM.hasPerk('desert rat') ? 2 : 1;
if(World.waterMove >= movesPerWater) {
World.waterMove = 0;
var water = World.water;
water--;
if(water === 0) {
Notifications.notify(World, _('there is no more water'));
} else if(water < 0) {
water = 0;
if(!World.thirst) {
Notifications.notify(World, _('the thirst becomes unbearable'));
World.thirst = true;
} else {
$SM.set('character.dehydrated', $SM.get('character.dehydrated', true));
$SM.add('character.dehydrated', 1);
if($SM.get('character.dehydrated') >= 10 && !$SM.hasPerk('desert rat')) {
$SM.addPerk('desert rat');
}
World.die();
return false;
}
} else {
World.thirst = false;
}
World.setWater(water);
World.updateSupplies();
}
return true;
},
meatHeal: function() {
return World.MEAT_HEAL * ($SM.hasPerk('gastronome') ? 2 : 1);
},
medsHeal: function() {
return World.MEDS_HEAL;
},
checkFight: function() {
World.fightMove = typeof World.fightMove == 'number' ? World.fightMove : 0;
World.fightMove++;
if(World.fightMove > World.FIGHT_DELAY) {
var chance = World.FIGHT_CHANCE;
chance *= $SM.hasPerk('stealthy') ? 0.5 : 1;
if(Math.random() < chance) {
World.fightMove = 0;
Events.triggerFight();
}
}
},
doSpace: function() {
var curTile = World.state.map[World.curPos[0]][World.curPos[1]];
if(curTile == World.TILE.VILLAGE) {
World.goHome();
} else if(typeof World.LANDMARKS[curTile] != 'undefined') {
if(curTile != World.TILE.OUTPOST || !World.outpostUsed()) {
Events.startEvent(Events.Setpieces[World.LANDMARKS[curTile].scene]);
AudioEngine.playEventMusic(Events.Setpieces[World.LANDMARKS[curTile].scene].audio);
}
} else {
if(World.useSupplies()) {
World.checkFight();
}
}
},
getDistance: function(from, to) {
from = from || World.curPos;
to = to || World.VILLAGE_POS;
return Math.abs(from[0] - to[0]) + Math.abs(from[1] - to[1]);
},
getTerrain: function() {
return World.state.map[World.curPos[0]][World.curPos[1]];
},
getDamage: function(thing) {
return World.Weapons[thing].damage;
},
narrateMove: function(oldTile, newTile) {
var msg = null;
switch(oldTile) {
case World.TILE.FOREST:
switch(newTile) {
case World.TILE.FIELD:
msg = _("the trees yield to dry grass. the yellowed brush rustles in the wind.");
break;
case World.TILE.BARRENS:
msg = _("the trees are gone. parched earth and blowing dust are poor replacements.");
break;
}
break;
case World.TILE.FIELD:
switch(newTile) {
case World.TILE.FOREST:
msg = _("trees loom on the horizon. grasses gradually yield to a forest floor of dry branches and fallen leaves.");
break;
case World.TILE.BARRENS:
msg = _("the grasses thin. soon, only dust remains.");
break;
}
break;
case World.TILE.BARRENS:
switch(newTile) {
case World.TILE.FIELD:
msg = _("the barrens break at a sea of dying grass, swaying in the arid breeze.");
break;
case World.TILE.FOREST:
msg = _("a wall of gnarled trees rises from the dust. their branches twist into a skeletal canopy overhead.");
break;
}
break;
}
if(msg != null) {
Notifications.notify(World, msg);
}
},
newMask: function() {
var mask = new Array(World.RADIUS * 2 + 1);
for(var i = 0; i <= World.RADIUS * 2; i++) {
mask[i] = new Array(World.RADIUS * 2 + 1);
}
World.lightMap(World.RADIUS, World.RADIUS, mask);
return mask;
},
lightMap: function(x, y, mask) {
var r = World.LIGHT_RADIUS;
r *= $SM.hasPerk('scout') ? 2 : 1;
World.uncoverMap(x, y, r, mask);
return mask;
},
uncoverMap: function(x, y, r, mask) {
mask[x][y] = true;
for(var i = -r; i <= r; i++) {
for(var j = -r + Math.abs(i); j <= r - Math.abs(i); j++) {
if(y + j >= 0 && y + j <= World.RADIUS * 2 &&
x + i <= World.RADIUS * 2 &&
x + i >= 0) {
mask[x+i][y+j] = true;
}
}
}
},
testMap: function() {
if(!World.seenAll) {
var dark;
var mask = $SM.get('game.world.mask');
loop:
for(var i = 0; i < mask.length; i++) {
for(var j = 0; j < mask[i].length; j++) {
if(!mask[i][j]) {
dark = true;
break loop;
}
}
}
World.seenAll = !dark;
}
},
applyMap: function() {
if(!World.seenAll){
var x,y,mask = $SM.get('game.world.mask');
do {
x = Math.floor(Math.random() * (World.RADIUS * 2 + 1));
y = Math.floor(Math.random() * (World.RADIUS * 2 + 1));
} while (mask[x][y]);
World.uncoverMap(x, y, 5, mask);
}
World.testMap();
},
generateMap: function() {
var map = new Array(World.RADIUS * 2 + 1);
for(var i = 0; i <= World.RADIUS * 2; i++) {
map[i] = new Array(World.RADIUS * 2 + 1);
}
// The Village is always at the exact center
// Spiral out from there
map[World.RADIUS][World.RADIUS] = World.TILE.VILLAGE;
for(var r = 1; r <= World.RADIUS; r++) {
for(var t = 0; t < r * 8; t++) {
var x, y;
if(t < 2 * r) {
x = World.RADIUS - r + t;
y = World.RADIUS - r;
} else if(t < 4 * r) {
x = World.RADIUS + r;
y = World.RADIUS - (3 * r) + t;
} else if(t < 6 * r) {
x = World.RADIUS + (5 * r) - t;
y = World.RADIUS + r;
} else {
x = World.RADIUS - r;
y = World.RADIUS + (7 * r) - t;
}
map[x][y] = World.chooseTile(x, y, map);
}
}
// Place landmarks
for(var k in World.LANDMARKS) {
var landmark = World.LANDMARKS[k];
for(var l = 0; l < landmark.num; l++) {
var pos = World.placeLandmark(landmark.minRadius, landmark.maxRadius, k, map);
}
}
return map;
},
mapSearch: function(target,map,required){
var max = World.LANDMARKS[target].num;
if(!max){
// this restrict the research to numerable landmarks
return null;
}
// restrict research if only a fixed number (usually 1) is required
max = (required) ? Math.min(required,max) : max;
var index = 0;
var targets = [];
search: // label for coordinate research
for(var i = 0; i <= World.RADIUS * 2; i++){
for(var j = 0; j <= World.RADIUS * 2; j++){
if(map[i][j].charAt(0) === target){
// search result is stored as an object;
// items are listed as they appear in the map, tl-br
// each item has relative coordinates and a compass-type direction
targets[index] = {
x : i - World.RADIUS,
y : j - World.RADIUS,
};
index++;
if(index === max){
// optimisation: stop the research if maximum number of items has been reached
break search;
}
}
}
}
return targets;
},
compassDir: function(pos){
var dir = '';
var horz = pos.x < 0 ? 'west' : 'east';
var vert = pos.y < 0 ? 'north' : 'south';
if(Math.abs(pos.x) / 2 > Math.abs(pos.y)) {
dir = horz;
} else if(Math.abs(pos.y) / 2 > Math.abs(pos.x)){
dir = vert;
} else {
dir = vert + horz;
}
return dir;
},
placeLandmark: function(minRadius, maxRadius, landmark, map) {
var x = World.RADIUS, y = World.RADIUS;
while(!World.isTerrain(map[x][y])) {
var r = Math.floor(Math.random() * (maxRadius - minRadius)) + minRadius;
var xDist = Math.floor(Math.random() * r);
var yDist = r - xDist;
if(Math.random() < 0.5) xDist = -xDist;
if(Math.random() < 0.5) yDist = -yDist;
x = World.RADIUS + xDist;
if(x < 0) x = 0;
if(x > World.RADIUS * 2) x = World.RADIUS * 2;
y = World.RADIUS + yDist;
if(y < 0) y = 0;
if(y > World.RADIUS * 2) y = World.RADIUS * 2;
}
map[x][y] = landmark;
return [x, y];
},
isTerrain: function(tile) {
return tile == World.TILE.FOREST || tile == World.TILE.FIELD || tile == World.TILE.BARRENS;
},
chooseTile: function(x, y, map) {
var adjacent = [
y > 0 ? map[x][y-1] : null,
y < World.RADIUS * 2 ? map[x][y+1] : null,
x < World.RADIUS * 2 ? map[x+1][y] : null,
x > 0 ? map[x-1][y] : null
];
var chances = {};
var nonSticky = 1;
var cur;
for(var i in adjacent) {
if(adjacent[i] == World.TILE.VILLAGE) {
// Village must be in a forest to maintain thematic consistency, yo.
return World.TILE.FOREST;
} else if(typeof adjacent[i] == 'string') {
cur = chances[adjacent[i]];
cur = typeof cur == 'number' ? cur : 0;
chances[adjacent[i]] = cur + World.STICKINESS;
nonSticky -= World.STICKINESS;
}
}
for(var t in World.TILE) {
var tile = World.TILE[t];
if(World.isTerrain(tile)) {
cur = chances[tile];
cur = typeof cur == 'number' ? cur : 0;
cur += World.TILE_PROBS[tile] * nonSticky;
chances[tile] = cur;
}
}
var list = [];
for(var j in chances) {
list.push(chances[j] + '' + j);
}
list.sort(function(a, b) {
var n1 = parseFloat(a.substring(0, a.length - 1));
var n2 = parseFloat(b.substring(0, b.length - 1));
return n2 - n1;
});
var c = 0;
var r = Math.random();
for(var l in list) {
var prob = list[l];
c += parseFloat(prob.substring(0,prob.length - 1));
if(r < c) {
return prob.charAt(prob.length - 1);
}
}
return World.TILE.BARRENS;
},
markVisited: function(x, y) {
World.state.map[x][y] = World.state.map[x][y] + '!';
},
drawMap: function() {
var map = $('#map');
if(map.length === 0) {
map = new $('
').attr('id', 'map').appendTo('#worldOuter');
// register click handler
map.click(World.click);
}
var mapString = "";
for(var j = 0; j <= World.RADIUS * 2; j++) {
for(var i = 0; i <= World.RADIUS * 2; i++) {
var ttClass = "";
if(i > World.RADIUS) {
ttClass += " left";
} else {
ttClass += " right";
}
if(j > World.RADIUS) {
ttClass += " top";
} else {
ttClass += " bottom";
}
if(World.curPos[0] == i && World.curPos[1] == j) {
mapString += '
@'+_('Wanderer')+'
';
} else if(World.state.mask[i][j]) {
var c = World.state.map[i][j];
switch(c) {
case World.TILE.VILLAGE:
mapString += '
' + c + ''+_('The Village')+'
';
break;
default:
if(typeof World.LANDMARKS[c] != 'undefined' && (c != World.TILE.OUTPOST || !World.outpostUsed(i, j))) {
mapString += '
' + c + '' + World.LANDMARKS[c].label + '
';
} else {
if(c.length > 1) {
c = c[0];
}
mapString += c;
}
break;
}
} else {
mapString += ' ';
}
}
mapString += '
';
}
map.html(mapString);
},
die: function() {
if(!World.dead) {
World.dead = true;
Engine.log('player death');
Engine.event('game event', 'death');
Engine.keyLock = true;
// Dead! Discard any world changes and go home
Notifications.notify(World, _('the world fades'));
World.state = null;
Path.outfit = {};
$SM.remove('outfit');
AudioEngine.playSound(AudioLibrary.DEATH);
$('#outerSlider').animate({opacity: '0'}, 600, 'linear', function() {
$('#outerSlider').css('left', '0px');
$('#locationSlider').css('left', '0px');
$('#storesContainer').css({'top': '0px', 'right': '0px'});
Engine.activeModule = Room;
$('div.headerButton').removeClass('selected');
Room.tab.addClass('selected');
Engine.setTimeout(function(){
Room.onArrival();
$('#outerSlider').animate({opacity:'1'}, 600, 'linear');
Button.cooldown($('#embarkButton'));
Engine.keyLock = false;
Engine.tabNavigation = true;
}, 2000, true);
});
}
},
goHome: function() {
// Home safe! Commit the changes.
$SM.setM('game.world', World.state);
World.testMap();
if(World.state.sulphurmine && $SM.get('game.buildings["sulphur mine"]', true) === 0) {
$SM.add('game.buildings["sulphur mine"]', 1);
Engine.event('progress', 'sulphur mine');
}
if(World.state.ironmine && $SM.get('game.buildings["iron mine"]', true) === 0) {
$SM.add('game.buildings["iron mine"]', 1);
Engine.event('progress', 'iron mine');
}
if(World.state.coalmine && $SM.get('game.buildings["coal mine"]', true) === 0) {
$SM.add('game.buildings["coal mine"]', 1);
Engine.event('progress', 'coal mine');
}
if(World.state.ship && !$SM.get('features.location.spaceShip')) {
Ship.init();
Engine.event('progress', 'ship');
}
World.state = null;
if(Path.outfit['cured meat'] > 0) {
Button.setDisabled($('#embarkButton'), false);
}
for(var k in Path.outfit) {
$SM.add('stores["'+k+'"]', Path.outfit[k]);
if(World.leaveItAtHome(k)) {
Path.outfit[k] = 0;
}
}
$('#outerSlider').animate({left: '0px'}, 300);
Engine.activeModule = Path;
Path.onArrival();
Engine.restoreNavigation = true;
},
leaveItAtHome: function(thing) {
return thing != 'cured meat' && thing != 'bullets' && thing != 'energy cell' && thing != 'charm' && thing != 'medicine' &&
typeof World.Weapons[thing] == 'undefined' && typeof Room.Craftables[thing] == 'undefined';
},
getMaxHealth: function() {
if($SM.get('stores["s armour"]', true) > 0) {
return World.BASE_HEALTH + 35;
} else if($SM.get('stores["i armour"]', true) > 0) {
return World.BASE_HEALTH + 15;
} else if($SM.get('stores["l armour"]', true) > 0) {
return World.BASE_HEALTH + 5;
}
return World.BASE_HEALTH;
},
getHitChance: function() {
if($SM.hasPerk('precise')) {
return World.BASE_HIT_CHANCE + 0.1;
}
return World.BASE_HIT_CHANCE;
},
getMaxWater: function() {
if($SM.get('stores["water tank"]', true) > 0) {
return World.BASE_WATER + 50;
} else if($SM.get('stores.cask', true) > 0) {
return World.BASE_WATER + 20;
} else if($SM.get('stores.waterskin', true) > 0) {
return World.BASE_WATER + 10;
}
return World.BASE_WATER;
},
outpostUsed: function(x, y) {
x = typeof x == 'number' ? x : World.curPos[0];
y = typeof y == 'number' ? y : World.curPos[1];
var used = World.usedOutposts[x + ',' + y];
return typeof used != 'undefined' && used === true;
},
useOutpost: function() {
Notifications.notify(null, _('water replenished'));
World.setWater(World.getMaxWater());
// Mark this outpost as used
World.usedOutposts[World.curPos[0] + ',' + World.curPos[1]] = true;
},
onArrival: function() {
Engine.tabNavigation = false;
// Clear the embark cooldown
Button.clearCooldown($('#embarkButton'));
Engine.keyLock = false;
// Explore in a temporary world-state. We'll commit the changes if you return home safe.
World.state = $.extend(true, {}, $SM.get('game.world'));
World.setWater(World.getMaxWater());
World.setHp(World.getMaxHealth());
World.foodMove = 0;
World.waterMove = 0;
World.starvation = false;
World.thirst = false;
World.usedOutposts = {};
World.curPos = World.copyPos(World.VILLAGE_POS);
World.drawMap();
World.setTitle();
AudioEngine.playBackgroundMusic(AudioLibrary.MUSIC_WORLD);
World.dead = false;
$('div#bagspace-world > div').empty();
World.updateSupplies();
$('#bagspace-world').width($('#map').width());
},
setTitle: function() {
document.title = _('A Barren World');
},
copyPos: function(pos) {
return [pos[0], pos[1]];
},
handleStateUpdates: function(e){
}
};
================================================
FILE: main/gams/gfiles/html5/asciispace/index.html
================================================
Press any key to start
================================================
FILE: main/gams/gfiles/html5/asteroids/LICENSE
================================================
Copyright (c) 2010 Doug McInnes
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
================================================
FILE: main/gams/gfiles/html5/asteroids/README.md
================================================
HTML5-Asteroids
===============
Pure Javascript Asteroids, based on http://dougmcinnes.com/2010/05/12/html-5-asteroids/
Source https://github.com/dmcinnes/HTML5-Asteroids
================================================
FILE: main/gams/gfiles/html5/asteroids/game.js
================================================
// Canvas Asteroids
//
// Copyright (c) 2010 Doug McInnes
//
KEY_CODES = {
32: 'space',
37: 'left',
38: 'up',
39: 'right',
40: 'down',
70: 'f',
71: 'g',
72: 'h',
77: 'm',
80: 'p'
}
KEY_STATUS = { keyDown:false };
for (code in KEY_CODES) {
KEY_STATUS[KEY_CODES[code]] = false;
}
$(window).keydown(function (e) {
KEY_STATUS.keyDown = true;
if (KEY_CODES[e.keyCode]) {
e.preventDefault();
KEY_STATUS[KEY_CODES[e.keyCode]] = true;
}
}).keyup(function (e) {
KEY_STATUS.keyDown = false;
if (KEY_CODES[e.keyCode]) {
e.preventDefault();
KEY_STATUS[KEY_CODES[e.keyCode]] = false;
}
});
GRID_SIZE = 60;
Matrix = function (rows, columns) {
var i, j;
this.data = new Array(rows);
for (i = 0; i < rows; i++) {
this.data[i] = new Array(columns);
}
this.configure = function (rot, scale, transx, transy) {
var rad = (rot * Math.PI)/180;
var sin = Math.sin(rad) * scale;
var cos = Math.cos(rad) * scale;
this.set(cos, -sin, transx,
sin, cos, transy);
};
this.set = function () {
var k = 0;
for (i = 0; i < rows; i++) {
for (j = 0; j < columns; j++) {
this.data[i][j] = arguments[k];
k++;
}
}
}
this.multiply = function () {
var vector = new Array(rows);
for (i = 0; i < rows; i++) {
vector[i] = 0;
for (j = 0; j < columns; j++) {
vector[i] += this.data[i][j] * arguments[j];
}
}
return vector;
};
};
Sprite = function () {
this.init = function (name, points) {
this.name = name;
this.points = points;
this.vel = {
x: 0,
y: 0,
rot: 0
};
this.acc = {
x: 0,
y: 0,
rot: 0
};
};
this.children = {};
this.visible = false;
this.reap = false;
this.bridgesH = true;
this.bridgesV = true;
this.collidesWith = [];
this.x = 0;
this.y = 0;
this.rot = 0;
this.scale = 1;
this.currentNode = null;
this.nextSprite = null;
this.preMove = null;
this.postMove = null;
this.run = function(delta) {
this.move(delta);
this.updateGrid();
this.context.save();
this.configureTransform();
this.draw();
var canidates = this.findCollisionCanidates();
this.matrix.configure(this.rot, this.scale, this.x, this.y);
this.checkCollisionsAgainst(canidates);
this.context.restore();
if (this.bridgesH && this.currentNode && this.currentNode.dupe.horizontal) {
this.x += this.currentNode.dupe.horizontal;
this.context.save();
this.configureTransform();
this.draw();
this.checkCollisionsAgainst(canidates);
this.context.restore();
if (this.currentNode) {
this.x -= this.currentNode.dupe.horizontal;
}
}
if (this.bridgesV && this.currentNode && this.currentNode.dupe.vertical) {
this.y += this.currentNode.dupe.vertical;
this.context.save();
this.configureTransform();
this.draw();
this.checkCollisionsAgainst(canidates);
this.context.restore();
if (this.currentNode) {
this.y -= this.currentNode.dupe.vertical;
}
}
if (this.bridgesH && this.bridgesV &&
this.currentNode &&
this.currentNode.dupe.vertical &&
this.currentNode.dupe.horizontal) {
this.x += this.currentNode.dupe.horizontal;
this.y += this.currentNode.dupe.vertical;
this.context.save();
this.configureTransform();
this.draw();
this.checkCollisionsAgainst(canidates);
this.context.restore();
if (this.currentNode) {
this.x -= this.currentNode.dupe.horizontal;
this.y -= this.currentNode.dupe.vertical;
}
}
};
this.move = function (delta) {
if (!this.visible) return;
this.transPoints = null; // clear cached points
if ($.isFunction(this.preMove)) {
this.preMove(delta);
}
this.vel.x += this.acc.x * delta;
this.vel.y += this.acc.y * delta;
this.x += this.vel.x * delta;
this.y += this.vel.y * delta;
this.rot += this.vel.rot * delta;
if (this.rot > 360) {
this.rot -= 360;
} else if (this.rot < 0) {
this.rot += 360;
}
if ($.isFunction(this.postMove)) {
this.postMove(delta);
}
};
this.updateGrid = function () {
if (!this.visible) return;
var gridx = Math.floor(this.x / GRID_SIZE);
var gridy = Math.floor(this.y / GRID_SIZE);
gridx = (gridx >= this.grid.length) ? 0 : gridx;
gridy = (gridy >= this.grid[0].length) ? 0 : gridy;
gridx = (gridx < 0) ? this.grid.length-1 : gridx;
gridy = (gridy < 0) ? this.grid[0].length-1 : gridy;
var newNode = this.grid[gridx][gridy];
if (newNode != this.currentNode) {
if (this.currentNode) {
this.currentNode.leave(this);
}
newNode.enter(this);
this.currentNode = newNode;
}
if (KEY_STATUS.g && this.currentNode) {
this.context.lineWidth = 3.0;
this.context.strokeStyle = 'green';
this.context.strokeRect(gridx*GRID_SIZE+2, gridy*GRID_SIZE+2, GRID_SIZE-4, GRID_SIZE-4);
this.context.strokeStyle = 'black';
this.context.lineWidth = 1.0;
}
};
this.configureTransform = function () {
if (!this.visible) return;
var rad = (this.rot * Math.PI)/180;
this.context.translate(this.x, this.y);
this.context.rotate(rad);
this.context.scale(this.scale, this.scale);
};
this.draw = function () {
if (!this.visible) return;
this.context.lineWidth = 1.0 / this.scale;
for (child in this.children) {
this.children[child].draw();
}
this.context.beginPath();
this.context.moveTo(this.points[0], this.points[1]);
for (var i = 1; i < this.points.length/2; i++) {
var xi = i*2;
var yi = xi + 1;
this.context.lineTo(this.points[xi], this.points[yi]);
}
this.context.closePath();
this.context.stroke();
};
this.findCollisionCanidates = function () {
if (!this.visible || !this.currentNode) return [];
var cn = this.currentNode;
var canidates = [];
if (cn.nextSprite) canidates.push(cn.nextSprite);
if (cn.north.nextSprite) canidates.push(cn.north.nextSprite);
if (cn.south.nextSprite) canidates.push(cn.south.nextSprite);
if (cn.east.nextSprite) canidates.push(cn.east.nextSprite);
if (cn.west.nextSprite) canidates.push(cn.west.nextSprite);
if (cn.north.east.nextSprite) canidates.push(cn.north.east.nextSprite);
if (cn.north.west.nextSprite) canidates.push(cn.north.west.nextSprite);
if (cn.south.east.nextSprite) canidates.push(cn.south.east.nextSprite);
if (cn.south.west.nextSprite) canidates.push(cn.south.west.nextSprite);
return canidates
};
this.checkCollisionsAgainst = function (canidates) {
for (var i = 0; i < canidates.length; i++) {
var ref = canidates[i];
do {
this.checkCollision(ref);
ref = ref.nextSprite;
} while (ref)
}
};
this.checkCollision = function (other) {
if (!other.visible ||
this == other ||
this.collidesWith.indexOf(other.name) == -1) return;
var trans = other.transformedPoints();
var px, py;
var count = trans.length/2;
for (var i = 0; i < count; i++) {
px = trans[i*2];
py = trans[i*2 + 1];
// mozilla doesn't take into account transforms with isPointInPath >:-P
if (($.browser.mozilla) ? this.pointInPolygon(px, py) : this.context.isPointInPath(px, py)) {
other.collision(this);
this.collision(other);
return;
}
}
};
this.pointInPolygon = function (x, y) {
var points = this.transformedPoints();
var j = 2;
var y0, y1;
var oddNodes = false;
for (var i = 0; i < points.length; i += 2) {
y0 = points[i + 1];
y1 = points[j + 1];
if ((y0 < y && y1 >= y) ||
(y1 < y && y0 >= y)) {
if (points[i]+(y-y0)/(y1-y0)*(points[j]-points[i]) < x) {
oddNodes = !oddNodes;
}
}
j += 2
if (j == points.length) j = 0;
}
return oddNodes;
};
this.collision = function () {
};
this.die = function () {
this.visible = false;
this.reap = true;
if (this.currentNode) {
this.currentNode.leave(this);
this.currentNode = null;
}
};
this.transformedPoints = function () {
if (this.transPoints) return this.transPoints;
var trans = new Array(this.points.length);
this.matrix.configure(this.rot, this.scale, this.x, this.y);
for (var i = 0; i < this.points.length/2; i++) {
var xi = i*2;
var yi = xi + 1;
var pts = this.matrix.multiply(this.points[xi], this.points[yi], 1);
trans[xi] = pts[0];
trans[yi] = pts[1];
}
this.transPoints = trans; // cache translated points
return trans;
};
this.isClear = function () {
if (this.collidesWith.length == 0) return true;
var cn = this.currentNode;
if (cn == null) {
var gridx = Math.floor(this.x / GRID_SIZE);
var gridy = Math.floor(this.y / GRID_SIZE);
gridx = (gridx >= this.grid.length) ? 0 : gridx;
gridy = (gridy >= this.grid[0].length) ? 0 : gridy;
cn = this.grid[gridx][gridy];
}
return (cn.isEmpty(this.collidesWith) &&
cn.north.isEmpty(this.collidesWith) &&
cn.south.isEmpty(this.collidesWith) &&
cn.east.isEmpty(this.collidesWith) &&
cn.west.isEmpty(this.collidesWith) &&
cn.north.east.isEmpty(this.collidesWith) &&
cn.north.west.isEmpty(this.collidesWith) &&
cn.south.east.isEmpty(this.collidesWith) &&
cn.south.west.isEmpty(this.collidesWith));
};
this.wrapPostMove = function () {
if (this.x > Game.canvasWidth) {
this.x = 0;
} else if (this.x < 0) {
this.x = Game.canvasWidth;
}
if (this.y > Game.canvasHeight) {
this.y = 0;
} else if (this.y < 0) {
this.y = Game.canvasHeight;
}
};
};
Ship = function () {
this.init("ship",
[-5, 4,
0, -12,
5, 4]);
this.children.exhaust = new Sprite();
this.children.exhaust.init("exhaust",
[-3, 6,
0, 11,
3, 6]);
this.bulletCounter = 0;
this.postMove = this.wrapPostMove;
this.collidesWith = ["asteroid", "bigalien", "alienbullet"];
this.preMove = function (delta) {
if (KEY_STATUS.left) {
this.vel.rot = -6;
} else if (KEY_STATUS.right) {
this.vel.rot = 6;
} else {
this.vel.rot = 0;
}
if (KEY_STATUS.up) {
var rad = ((this.rot-90) * Math.PI)/180;
this.acc.x = 0.5 * Math.cos(rad);
this.acc.y = 0.5 * Math.sin(rad);
this.children.exhaust.visible = Math.random() > 0.1;
} else {
this.acc.x = 0;
this.acc.y = 0;
this.children.exhaust.visible = false;
}
if (this.bulletCounter > 0) {
this.bulletCounter -= delta;
}
if (KEY_STATUS.space) {
if (this.bulletCounter <= 0) {
this.bulletCounter = 10;
for (var i = 0; i < this.bullets.length; i++) {
if (!this.bullets[i].visible) {
SFX.laser();
var bullet = this.bullets[i];
var rad = ((this.rot-90) * Math.PI)/180;
var vectorx = Math.cos(rad);
var vectory = Math.sin(rad);
// move to the nose of the ship
bullet.x = this.x + vectorx * 4;
bullet.y = this.y + vectory * 4;
bullet.vel.x = 6 * vectorx + this.vel.x;
bullet.vel.y = 6 * vectory + this.vel.y;
bullet.visible = true;
break;
}
}
}
}
// limit the ship's speed
if (Math.sqrt(this.vel.x * this.vel.x + this.vel.y * this.vel.y) > 8) {
this.vel.x *= 0.95;
this.vel.y *= 0.95;
}
};
this.collision = function (other) {
SFX.explosion();
Game.explosionAt(other.x, other.y);
Game.FSM.state = 'player_died';
this.visible = false;
this.currentNode.leave(this);
this.currentNode = null;
Game.lives--;
};
};
Ship.prototype = new Sprite();
BigAlien = function () {
this.init("bigalien",
[-20, 0,
-12, -4,
12, -4,
20, 0,
12, 4,
-12, 4,
-20, 0,
20, 0]);
this.children.top = new Sprite();
this.children.top.init("bigalien_top",
[-8, -4,
-6, -6,
6, -6,
8, -4]);
this.children.top.visible = true;
this.children.bottom = new Sprite();
this.children.bottom.init("bigalien_top",
[ 8, 4,
6, 6,
-6, 6,
-8, 4]);
this.children.bottom.visible = true;
this.collidesWith = ["asteroid", "ship", "bullet"];
this.bridgesH = false;
this.bullets = [];
this.bulletCounter = 0;
this.newPosition = function () {
if (Math.random() < 0.5) {
this.x = -20;
this.vel.x = 1.5;
} else {
this.x = Game.canvasWidth + 20;
this.vel.x = -1.5;
}
this.y = Math.random() * Game.canvasHeight;
};
this.setup = function () {
this.newPosition();
for (var i = 0; i < 3; i++) {
var bull = new AlienBullet();
this.bullets.push(bull);
Game.sprites.push(bull);
}
};
this.preMove = function (delta) {
var cn = this.currentNode;
if (cn == null) return;
var topCount = 0;
if (cn.north.nextSprite) topCount++;
if (cn.north.east.nextSprite) topCount++;
if (cn.north.west.nextSprite) topCount++;
var bottomCount = 0;
if (cn.south.nextSprite) bottomCount++;
if (cn.south.east.nextSprite) bottomCount++;
if (cn.south.west.nextSprite) bottomCount++;
if (topCount > bottomCount) {
this.vel.y = 1;
} else if (topCount < bottomCount) {
this.vel.y = -1;
} else if (Math.random() < 0.01) {
this.vel.y = -this.vel.y;
}
this.bulletCounter -= delta;
if (this.bulletCounter <= 0) {
this.bulletCounter = 22;
for (var i = 0; i < this.bullets.length; i++) {
if (!this.bullets[i].visible) {
bullet = this.bullets[i];
var rad = 2 * Math.PI * Math.random();
var vectorx = Math.cos(rad);
var vectory = Math.sin(rad);
bullet.x = this.x;
bullet.y = this.y;
bullet.vel.x = 6 * vectorx;
bullet.vel.y = 6 * vectory;
bullet.visible = true;
SFX.laser();
break;
}
}
}
};
BigAlien.prototype.collision = function (other) {
if (other.name == "bullet") Game.score += 200;
SFX.explosion();
Game.explosionAt(other.x, other.y);
this.visible = false;
this.newPosition();
};
this.postMove = function () {
if (this.y > Game.canvasHeight) {
this.y = 0;
} else if (this.y < 0) {
this.y = Game.canvasHeight;
}
if ((this.vel.x > 0 && this.x > Game.canvasWidth + 20) ||
(this.vel.x < 0 && this.x < -20)) {
// why did the alien cross the road?
this.visible = false;
this.newPosition();
}
}
};
BigAlien.prototype = new Sprite();
Bullet = function () {
this.init("bullet", [0, 0]);
this.time = 0;
this.bridgesH = false;
this.bridgesV = false;
this.postMove = this.wrapPostMove;
// asteroid can look for bullets so doesn't have
// to be other way around
//this.collidesWith = ["asteroid"];
this.configureTransform = function () {};
this.draw = function () {
if (this.visible) {
this.context.save();
this.context.lineWidth = 2;
this.context.beginPath();
this.context.moveTo(this.x-1, this.y-1);
this.context.lineTo(this.x+1, this.y+1);
this.context.moveTo(this.x+1, this.y-1);
this.context.lineTo(this.x-1, this.y+1);
this.context.stroke();
this.context.restore();
}
};
this.preMove = function (delta) {
if (this.visible) {
this.time += delta;
}
if (this.time > 50) {
this.visible = false;
this.time = 0;
}
};
this.collision = function (other) {
this.time = 0;
this.visible = false;
this.currentNode.leave(this);
this.currentNode = null;
};
this.transformedPoints = function (other) {
return [this.x, this.y];
};
};
Bullet.prototype = new Sprite();
AlienBullet = function () {
this.init("alienbullet");
this.draw = function () {
if (this.visible) {
this.context.save();
this.context.lineWidth = 2;
this.context.beginPath();
this.context.moveTo(this.x, this.y);
this.context.lineTo(this.x-this.vel.x, this.y-this.vel.y);
this.context.stroke();
this.context.restore();
}
};
};
AlienBullet.prototype = new Bullet();
Asteroid = function () {
this.init("asteroid",
[-10, 0,
-5, 7,
-3, 4,
1, 10,
5, 4,
10, 0,
5, -6,
2, -10,
-4, -10,
-4, -5]);
this.visible = true;
this.scale = 6;
this.postMove = this.wrapPostMove;
this.collidesWith = ["ship", "bullet", "bigalien", "alienbullet"];
this.collision = function (other) {
SFX.explosion();
if (other.name == "bullet") Game.score += 120 / this.scale;
this.scale /= 3;
if (this.scale > 0.5) {
// break into fragments
for (var i = 0; i < 3; i++) {
var roid = $.extend(true, {}, this);
roid.vel.x = Math.random() * 6 - 3;
roid.vel.y = Math.random() * 6 - 3;
if (Math.random() > 0.5) {
roid.points.reverse();
}
roid.vel.rot = Math.random() * 2 - 1;
roid.move(roid.scale * 3); // give them a little push
Game.sprites.push(roid);
}
}
Game.explosionAt(other.x, other.y);
this.die();
};
};
Asteroid.prototype = new Sprite();
Explosion = function () {
this.init("explosion");
this.bridgesH = false;
this.bridgesV = false;
this.lines = [];
for (var i = 0; i < 5; i++) {
var rad = 2 * Math.PI * Math.random();
var x = Math.cos(rad);
var y = Math.sin(rad);
this.lines.push([x, y, x*2, y*2]);
}
this.draw = function () {
if (this.visible) {
this.context.save();
this.context.lineWidth = 1.0 / this.scale;
this.context.beginPath();
for (var i = 0; i < 5; i++) {
var line = this.lines[i];
this.context.moveTo(line[0], line[1]);
this.context.lineTo(line[2], line[3]);
}
this.context.stroke();
this.context.restore();
}
};
this.preMove = function (delta) {
if (this.visible) {
this.scale += delta;
}
if (this.scale > 8) {
this.die();
}
};
};
Explosion.prototype = new Sprite();
GridNode = function () {
this.north = null;
this.south = null;
this.east = null;
this.west = null;
this.nextSprite = null;
this.dupe = {
horizontal: null,
vertical: null
};
this.enter = function (sprite) {
sprite.nextSprite = this.nextSprite;
this.nextSprite = sprite;
};
this.leave = function (sprite) {
var ref = this;
while (ref && (ref.nextSprite != sprite)) {
ref = ref.nextSprite;
}
if (ref) {
ref.nextSprite = sprite.nextSprite;
sprite.nextSprite = null;
}
};
this.eachSprite = function(sprite, callback) {
var ref = this;
while (ref.nextSprite) {
ref = ref.nextSprite;
callback.call(sprite, ref);
}
};
this.isEmpty = function (collidables) {
var empty = true;
var ref = this;
while (ref.nextSprite) {
ref = ref.nextSprite;
empty = !ref.visible || collidables.indexOf(ref.name) == -1
if (!empty) break;
}
return empty;
};
};
// borrowed from typeface-0.14.js
// http://typeface.neocracy.org
Text = {
renderGlyph: function (ctx, face, char) {
var glyph = face.glyphs[char];
if (glyph.o) {
var outline;
if (glyph.cached_outline) {
outline = glyph.cached_outline;
} else {
outline = glyph.o.split(' ');
glyph.cached_outline = outline;
}
var outlineLength = outline.length;
for (var i = 0; i < outlineLength; ) {
var action = outline[i++];
switch(action) {
case 'm':
ctx.moveTo(outline[i++], outline[i++]);
break;
case 'l':
ctx.lineTo(outline[i++], outline[i++]);
break;
case 'q':
var cpx = outline[i++];
var cpy = outline[i++];
ctx.quadraticCurveTo(outline[i++], outline[i++], cpx, cpy);
break;
case 'b':
var x = outline[i++];
var y = outline[i++];
ctx.bezierCurveTo(outline[i++], outline[i++], outline[i++], outline[i++], x, y);
break;
}
}
}
if (glyph.ha) {
ctx.translate(glyph.ha, 0);
}
},
renderText: function(text, size, x, y) {
this.context.save();
this.context.translate(x, y);
var pixels = size * 72 / (this.face.resolution * 100);
this.context.scale(pixels, -1 * pixels);
this.context.beginPath();
var chars = text.split('');
var charsLength = chars.length;
for (var i = 0; i < charsLength; i++) {
this.renderGlyph(this.context, this.face, chars[i]);
}
this.context.fill();
this.context.restore();
},
context: null,
face: null
};
SFX = {
laser: new Audio('39459__THE_bizniss__laser.wav'),
explosion: new Audio('51467__smcameron__missile_explosion.wav')
};
// preload audio
for (var sfx in SFX) {
(function () {
var audio = SFX[sfx];
audio.muted = true;
audio.play();
SFX[sfx] = function () {
if (!this.muted) {
if (audio.duration == 0) {
// somehow dropped out
audio.load();
audio.play();
} else {
audio.muted = false;
audio.currentTime = 0;
}
}
return audio;
}
})();
}
// pre-mute audio
SFX.muted = true;
Game = {
score: 0,
totalAsteroids: 5,
lives: 0,
canvasWidth: 800,
canvasHeight: 600,
sprites: [],
ship: null,
bigAlien: null,
nextBigAlienTime: null,
spawnAsteroids: function (count) {
if (!count) count = this.totalAsteroids;
for (var i = 0; i < count; i++) {
var roid = new Asteroid();
roid.x = Math.random() * this.canvasWidth;
roid.y = Math.random() * this.canvasHeight;
while (!roid.isClear()) {
roid.x = Math.random() * this.canvasWidth;
roid.y = Math.random() * this.canvasHeight;
}
roid.vel.x = Math.random() * 4 - 2;
roid.vel.y = Math.random() * 4 - 2;
if (Math.random() > 0.5) {
roid.points.reverse();
}
roid.vel.rot = Math.random() * 2 - 1;
Game.sprites.push(roid);
}
},
explosionAt: function (x, y) {
var splosion = new Explosion();
splosion.x = x;
splosion.y = y;
splosion.visible = true;
Game.sprites.push(splosion);
},
FSM: {
boot: function () {
Game.spawnAsteroids(5);
this.state = 'waiting';
},
waiting: function () {
Text.renderText(window.ipad ? 'Touch Screen to Start' : 'Press Space to Start', 36, Game.canvasWidth/2 - 270, Game.canvasHeight/2);
if (KEY_STATUS.space || window.gameStart) {
KEY_STATUS.space = false; // hack so we don't shoot right away
window.gameStart = false;
this.state = 'start';
}
},
start: function () {
for (var i = 0; i < Game.sprites.length; i++) {
if (Game.sprites[i].name == 'asteroid') {
Game.sprites[i].die();
} else if (Game.sprites[i].name == 'bullet' ||
Game.sprites[i].name == 'bigalien') {
Game.sprites[i].visible = false;
}
}
Game.score = 0;
Game.lives = 2;
Game.totalAsteroids = 2;
Game.spawnAsteroids();
Game.nextBigAlienTime = Date.now() + 30000 + (30000 * Math.random());
this.state = 'spawn_ship';
},
spawn_ship: function () {
Game.ship.x = Game.canvasWidth / 2;
Game.ship.y = Game.canvasHeight / 2;
if (Game.ship.isClear()) {
Game.ship.rot = 0;
Game.ship.vel.x = 0;
Game.ship.vel.y = 0;
Game.ship.visible = true;
this.state = 'run';
}
},
run: function () {
for (var i = 0; i < Game.sprites.length; i++) {
if (Game.sprites[i].name == 'asteroid') {
break;
}
}
if (i == Game.sprites.length) {
this.state = 'new_level';
}
if (!Game.bigAlien.visible &&
Date.now() > Game.nextBigAlienTime) {
Game.bigAlien.visible = true;
Game.nextBigAlienTime = Date.now() + (30000 * Math.random());
}
},
new_level: function () {
if (this.timer == null) {
this.timer = Date.now();
}
// wait a second before spawning more asteroids
if (Date.now() - this.timer > 1000) {
this.timer = null;
Game.totalAsteroids++;
if (Game.totalAsteroids > 12) Game.totalAsteroids = 12;
Game.spawnAsteroids();
this.state = 'run';
}
},
player_died: function () {
if (Game.lives < 0) {
this.state = 'end_game';
} else {
if (this.timer == null) {
this.timer = Date.now();
}
// wait a second before spawning
if (Date.now() - this.timer > 1000) {
this.timer = null;
this.state = 'spawn_ship';
}
}
},
end_game: function () {
Text.renderText('GAME OVER', 50, Game.canvasWidth/2 - 160, Game.canvasHeight/2 + 10);
if (this.timer == null) {
this.timer = Date.now();
}
// wait 5 seconds then go back to waiting state
if (Date.now() - this.timer > 5000) {
this.timer = null;
this.state = 'waiting';
}
window.gameStart = false;
},
execute: function () {
this[this.state]();
},
state: 'boot'
}
};
$(function () {
var canvas = $("#canvas");
Game.canvasWidth = canvas.width();
Game.canvasHeight = canvas.height();
var context = canvas[0].getContext("2d");
Text.context = context;
Text.face = vector_battle;
var gridWidth = Math.round(Game.canvasWidth / GRID_SIZE);
var gridHeight = Math.round(Game.canvasHeight / GRID_SIZE);
var grid = new Array(gridWidth);
for (var i = 0; i < gridWidth; i++) {
grid[i] = new Array(gridHeight);
for (var j = 0; j < gridHeight; j++) {
grid[i][j] = new GridNode();
}
}
// set up the positional references
for (var i = 0; i < gridWidth; i++) {
for (var j = 0; j < gridHeight; j++) {
var node = grid[i][j];
node.north = grid[i][(j == 0) ? gridHeight-1 : j-1];
node.south = grid[i][(j == gridHeight-1) ? 0 : j+1];
node.west = grid[(i == 0) ? gridWidth-1 : i-1][j];
node.east = grid[(i == gridWidth-1) ? 0 : i+1][j];
}
}
// set up borders
for (var i = 0; i < gridWidth; i++) {
grid[i][0].dupe.vertical = Game.canvasHeight;
grid[i][gridHeight-1].dupe.vertical = -Game.canvasHeight;
}
for (var j = 0; j < gridHeight; j++) {
grid[0][j].dupe.horizontal = Game.canvasWidth;
grid[gridWidth-1][j].dupe.horizontal = -Game.canvasWidth;
}
var sprites = [];
Game.sprites = sprites;
// so all the sprites can use it
Sprite.prototype.context = context;
Sprite.prototype.grid = grid;
Sprite.prototype.matrix = new Matrix(2, 3);
var ship = new Ship();
ship.x = Game.canvasWidth / 2;
ship.y = Game.canvasHeight / 2;
sprites.push(ship);
ship.bullets = [];
for (var i = 0; i < 10; i++) {
var bull = new Bullet();
ship.bullets.push(bull);
sprites.push(bull);
}
Game.ship = ship;
var bigAlien = new BigAlien();
bigAlien.setup();
sprites.push(bigAlien);
Game.bigAlien = bigAlien;
var extraDude = new Ship();
extraDude.scale = 0.6;
extraDude.visible = true;
extraDude.preMove = null;
extraDude.children = [];
var i, j = 0;
var paused = false;
var showFramerate = false;
var avgFramerate = 0;
var frameCount = 0;
var elapsedCounter = 0;
var lastFrame = Date.now();
var thisFrame;
var elapsed;
var delta;
var canvasNode = canvas[0];
// shim layer with setTimeout fallback
// from here:
// http://paulirish.com/2011/requestanimationframe-for-smart-animating/
window.requestAnimFrame = (function () {
return window.requestAnimationFrame ||
window.webkitRequestAnimationFrame ||
window.mozRequestAnimationFrame ||
window.oRequestAnimationFrame ||
window.msRequestAnimationFrame ||
function (/* function */ callback, /* DOMElement */ element) {
window.setTimeout(callback, 1000 / 60);
};
})();
var mainLoop = function () {
context.clearRect(0, 0, Game.canvasWidth, Game.canvasHeight);
Game.FSM.execute();
if (KEY_STATUS.g) {
context.beginPath();
for (var i = 0; i < gridWidth; i++) {
context.moveTo(i * GRID_SIZE, 0);
context.lineTo(i * GRID_SIZE, Game.canvasHeight);
}
for (var j = 0; j < gridHeight; j++) {
context.moveTo(0, j * GRID_SIZE);
context.lineTo(Game.canvasWidth, j * GRID_SIZE);
}
context.closePath();
context.stroke();
}
thisFrame = Date.now();
elapsed = thisFrame - lastFrame;
lastFrame = thisFrame;
delta = elapsed / 30;
for (i = 0; i < sprites.length; i++) {
sprites[i].run(delta);
if (sprites[i].reap) {
sprites[i].reap = false;
sprites.splice(i, 1);
i--;
}
}
// score
var score_text = ''+Game.score;
Text.renderText(score_text, 18, Game.canvasWidth - 14 * score_text.length, 20);
// extra dudes
for (i = 0; i < Game.lives; i++) {
context.save();
extraDude.x = Game.canvasWidth - (8 * (i + 1));
extraDude.y = 32;
extraDude.configureTransform();
extraDude.draw();
context.restore();
}
if (showFramerate) {
Text.renderText(''+avgFramerate, 24, Game.canvasWidth - 38, Game.canvasHeight - 2);
}
frameCount++;
elapsedCounter += elapsed;
if (elapsedCounter > 1000) {
elapsedCounter -= 1000;
avgFramerate = frameCount;
frameCount = 0;
}
if (paused) {
Text.renderText('PAUSED', 72, Game.canvasWidth/2 - 160, 120);
} else {
requestAnimFrame(mainLoop, canvasNode);
}
};
mainLoop();
$(window).keydown(function (e) {
switch (KEY_CODES[e.keyCode]) {
case 'f': // show framerate
showFramerate = !showFramerate;
break;
case 'p': // pause
paused = !paused;
if (!paused) {
// start up again
lastFrame = Date.now();
mainLoop();
}
break;
case 'm': // mute
SFX.muted = !SFX.muted;
break;
}
});
});
// vim: fdl=0
================================================
FILE: main/gams/gfiles/html5/asteroids/index.html
================================================
================================================
FILE: main/gams/gfiles/html5/asteroids/ipad.js
================================================
var ipad = navigator.userAgent.match(/iPad/i) != null;
if (ipad) {
$(function () {
$('#left-controls, #right-controls').show();
$('body > *').hide();
$('body').css('margin', '0px').css('background', 'black').prepend($('#game-container').remove());
$('#game-container').width(1024).css('margin-top', 26).show();
$('#canvas').attr('width', 1020).attr('height', 660).css('background', 'white').css('margin', '0 1');
$('head').prepend($('
').attr('name', 'viewport').attr('content', 'width=device-width; height=device-height; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;'));
$('#left-controls, #right-controls').bind('touchstart touchmove touchend', function (e) {
if (e.type != 'touchend') {
for (k in KEY_STATUS) {
KEY_STATUS[k] = false;
}
}
var touches = e.type == 'touchend' ? e.originalEvent.changedTouches : e.originalEvent.touches
for (var i = 0; i < touches.length; i++) {
var ele = document.elementFromPoint(touches[i].pageX, touches[i].pageY);
KEY_STATUS[ele.id] = (e.type != 'touchend');
}
});
$(document).bind('touchstart', function (e) {
window.gameStart = true;
});
$(document).bind('gesturestart gesturechange gestureend touchstart touchmove touchend', function (e) {
e.preventDefault();
});
});
}
================================================
FILE: main/gams/gfiles/html5/asteroids/vector_battle_regular.typeface.js
================================================
// converted at http://typeface.neocracy.org
vector_battle = {"glyphs":{"S":{"x_min":65,"x_max":980,"ha":1045,"o":"m 963 17 l 963 716 l 65 716 l 65 1305 l 980 1305 l 980 1288 l 81 1288 l 81 733 l 980 733 l 980 0 l 65 0 l 65 17 l 963 17 "},"¦":{"x_min":0,"x_max":0,"ha":1361},"/":{"x_min":65.125,"x_max":980.296875,"ha":1045,"o":"m 81 0 l 65 0 l 963 1305 l 980 1305 l 81 0 "},"y":{"x_min":65.375,"x_max":980.546875,"ha":1046,"o":"m 958 1305 l 980 1305 l 528 716 l 528 0 l 512 0 l 512 716 l 65 1305 l 87 1305 l 519 738 l 958 1305 "},"Á":{"x_min":0,"x_max":0,"ha":1361},"g":{"x_min":65,"x_max":980,"ha":1045,"o":"m 980 1305 l 980 1132 l 963 1132 l 963 1288 l 81 1288 l 81 17 l 963 17 l 963 716 l 292 716 l 292 733 l 980 733 l 980 0 l 65 0 l 65 1305 l 980 1305 "},"²":{"x_min":0,"x_max":0,"ha":1361},"–":{"x_min":0,"x_max":0,"ha":1361},"ë":{"x_min":0,"x_max":0,"ha":1361},"ƒ":{"x_min":0,"x_max":0,"ha":1361},"Î":{"x_min":45.1875,"x_max":1008.875,"ha":1045,"o":"m 271 46 l 414 159 l 759 35 l 972 347 l 691 555 l 958 677 l 760 844 l 511 683 l 293 854 l 83 665 l 174 475 l 81 226 l 271 46 m 263 6 l 45 226 l 141 466 l 47 669 l 292 883 l 506 717 l 763 875 l 1005 677 l 739 547 l 1008 352 l 760 6 l 414 130 l 263 6 "},"e":{"x_min":65,"x_max":980.15625,"ha":1045,"o":"m 81 716 l 81 17 l 980 17 l 980 0 l 65 0 l 65 1305 l 980 1305 l 980 1288 l 81 1288 l 81 733 l 980 733 l 980 716 l 81 716 "},"Ã":{"x_min":0,"x_max":0,"ha":1361},"J":{"x_min":65.453125,"x_max":980.609375,"ha":1046,"o":"m 534 1288 l 534 1305 l 980 1305 l 980 0 l 494 0 l 65 437 l 87 437 l 498 17 l 964 17 l 964 1288 l 534 1288 "},"»":{"x_min":261.1875,"x_max":863.984375,"ha":1045,"o":"m 457 1038 l 476 1038 l 863 724 l 476 408 l 457 408 l 845 724 l 457 1038 m 261 1038 l 280 1038 l 668 724 l 280 408 l 261 408 l 649 724 l 261 1038 "},"‐":{"x_min":65,"x_max":980,"ha":1045,"o":"m 65 733 l 980 733 l 980 717 l 65 717 l 65 733 "},"©":{"x_min":128,"x_max":914,"ha":1045,"o":"m 128 350 l 128 1054 l 522 1110 l 914 1054 l 914 350 l 522 297 l 128 350 m 898 364 l 898 1043 l 522 1095 l 144 1043 l 144 364 l 522 313 l 898 364 m 759 502 l 759 487 l 291 487 l 291 944 l 759 944 l 759 931 l 310 931 l 310 502 l 759 502 "},"ò":{"x_min":0,"x_max":0,"ha":1361},"^":{"x_min":215,"x_max":832,"ha":1045,"o":"m 832 888 l 525 1285 l 215 888 l 215 907 l 525 1305 l 832 907 l 832 888 "},"«":{"x_min":261.1875,"x_max":863.984375,"ha":1045,"o":"m 863 1038 l 476 724 l 863 408 l 845 408 l 457 724 l 845 1038 l 863 1038 m 668 1038 l 280 724 l 668 408 l 649 408 l 261 724 l 649 1038 l 668 1038 "},"D":{"x_min":65,"x_max":980,"ha":1045,"o":"m 65 0 l 65 1305 l 552 1305 l 980 869 l 980 434 l 554 0 l 65 0 m 963 863 l 546 1288 l 81 1288 l 81 17 l 548 17 l 963 440 l 963 863 "},"∙":{"x_min":0,"x_max":0,"ha":1361},"ÿ":{"x_min":0,"x_max":0,"ha":1361},"í":{"x_min":0,"x_max":0,"ha":1361},"ˆ":{"x_min":215,"x_max":832,"ha":1045,"o":"m 832 888 l 525 1285 l 215 888 l 215 907 l 525 1305 l 832 907 l 832 888 "},"w":{"x_min":65,"x_max":980,"ha":1045,"o":"m 525 596 l 963 21 l 963 1304 l 980 1304 l 980 -1 l 963 -1 l 525 570 l 81 0 l 65 0 l 65 1305 l 81 1305 l 81 22 l 525 596 "},"$":{"x_min":64.84375,"x_max":980,"ha":1045,"o":"m 511 1288 l 81 1288 l 81 733 l 511 733 l 511 1288 m 528 17 l 963 17 l 963 716 l 528 716 l 528 17 m 980 0 l 64 0 l 64 17 l 511 17 l 511 716 l 65 716 l 65 1305 l 980 1305 l 980 1288 l 528 1288 l 528 733 l 980 733 l 980 0 "},"\\":{"x_min":65.125,"x_max":980.296875,"ha":1045,"o":"m 65 1305 l 81 1305 l 980 0 l 963 0 l 65 1305 "},"Ì":{"x_min":72,"x_max":1026.453125,"ha":1046,"o":"m 166 852 l 335 686 l 494 1092 l 835 963 l 1026 545 l 775 282 l 839 126 l 518 2 l 422 373 l 214 119 l 72 180 l 72 563 l 166 852 m 344 651 l 171 810 l 94 545 l 94 198 l 215 145 l 432 414 l 536 33 l 807 137 l 749 288 l 997 541 l 822 936 l 510 1062 l 344 651 "},"µ":{"x_min":0,"x_max":0,"ha":1361},"Ç":{"x_min":13.296875,"x_max":1020.828125,"ha":1045,"o":"m 718 381 l 646 525 l 419 525 l 336 381 l 718 381 m 978 236 l 745 360 l 307 360 l 58 236 l 978 236 m 250 21 l 786 21 l 978 216 l 58 216 l 250 21 m 1020 233 l 796 3 l 237 3 l 13 233 l 307 381 l 406 545 l 658 545 l 745 381 l 1020 233 "},"’":{"x_min":0,"x_max":0,"ha":1361},"-":{"x_min":65,"x_max":980,"ha":1045,"o":"m 65 733 l 980 733 l 980 717 l 65 717 l 65 733 "},"Q":{"x_min":65,"x_max":980,"ha":1045,"o":"m 808 174 l 963 333 l 963 1288 l 81 1288 l 81 17 l 653 17 l 799 166 l 595 374 l 595 391 l 808 174 m 980 0 l 963 0 l 808 158 l 653 0 l 65 0 l 65 1305 l 980 1305 l 980 333 l 816 166 l 980 0 "},"M":{"x_min":65,"x_max":980,"ha":1045,"o":"m 519 716 l 81 1288 l 81 0 l 65 0 l 65 1305 l 86 1305 l 519 738 l 958 1305 l 980 1305 l 980 0 l 963 0 l 963 1288 l 519 716 "},"C":{"x_min":65,"x_max":980.15625,"ha":1045,"o":"m 81 17 l 980 17 l 980 0 l 65 0 l 65 1305 l 980 1305 l 980 1288 l 81 1288 l 81 17 "},"œ":{"x_min":0,"x_max":0,"ha":1361},"!":{"x_min":397,"x_max":653,"ha":1045,"o":"m 413 197 l 413 17 l 636 17 l 636 197 l 413 197 m 397 216 l 653 216 l 653 0 l 397 0 l 397 216 m 530 334 l 514 334 l 514 1305 l 530 1305 l 530 334 "},"ç":{"x_min":0,"x_max":0,"ha":1361},"È":{"x_min":21.859375,"x_max":1010.125,"ha":1045,"o":"m 549 272 l 654 245 l 943 245 l 943 272 l 549 272 m 976 145 l 308 315 l 259 230 l 47 184 l 150 21 l 854 21 l 976 145 m 1010 152 l 859 0 l 144 0 l 21 197 l 240 243 l 296 340 l 498 289 l 959 289 l 959 229 l 714 229 l 1010 152 "},"{":{"x_min":196,"x_max":849.34375,"ha":1045,"o":"m 212 17 l 849 17 l 849 0 l 196 0 l 196 1305 l 849 1305 l 849 1288 l 212 1288 l 212 17 "},"X":{"x_min":65.125,"x_max":980.296875,"ha":1045,"o":"m 958 0 l 519 696 l 87 0 l 65 0 q 152 139 93 44 l 455 625 q 511 716 509 710 l 65 1305 l 87 1305 l 519 735 l 958 1305 l 980 1305 l 528 716 l 980 0 l 958 0 "},"ô":{"x_min":0,"x_max":0,"ha":1361},"¼":{"x_min":0,"x_max":0,"ha":1361},"#":{"x_min":109,"x_max":926,"ha":1046,"o":"m 316 517 l 718 517 l 718 802 l 316 802 l 316 517 m 718 500 l 316 500 l 316 200 l 300 200 l 300 500 l 109 500 l 109 517 l 300 517 l 300 802 l 109 802 l 109 819 l 300 819 l 300 1105 l 316 1105 l 316 819 l 718 819 l 718 1105 l 735 1105 l 735 819 l 926 819 l 926 802 l 735 802 l 735 517 l 926 517 l 926 500 l 735 500 l 735 200 l 718 200 l 718 500 "},"Ê":{"x_min":31,"x_max":1019.3125,"ha":1045,"o":"m 435 736 l 1014 736 l 1014 575 l 687 486 l 1019 260 l 792 30 l 686 139 l 291 28 l 31 379 l 31 729 l 294 970 l 679 970 l 435 736 m 995 719 l 392 719 l 632 950 l 298 950 l 55 723 l 55 383 l 301 51 l 690 160 l 793 57 l 988 255 l 649 494 l 995 586 l 995 719 "},")":{"x_min":196.3125,"x_max":849.609375,"ha":1046,"o":"m 833 1288 l 196 1288 l 196 1305 l 849 1305 l 849 0 l 196 0 l 196 17 l 833 17 l 833 1288 "},"Å":{"x_min":197.390625,"x_max":862.65625,"ha":1045,"o":"m 826 59 l 532 925 l 231 59 l 310 165 l 751 165 l 826 59 m 546 933 l 862 0 l 852 0 l 743 148 l 318 148 l 208 0 l 197 0 l 532 971 l 546 933 "},"ø":{"x_min":0,"x_max":0,"ha":1361},"â":{"x_min":0,"x_max":0,"ha":1361},"}":{"x_min":196.3125,"x_max":849.609375,"ha":1046,"o":"m 833 1288 l 196 1288 l 196 1305 l 849 1305 l 849 0 l 196 0 l 196 17 l 833 17 l 833 1288 "},"‰":{"x_min":0,"x_max":0,"ha":1361},"Ä":{"x_min":65,"x_max":980,"ha":1045,"o":"m 81 994 l 81 733 l 963 733 l 963 994 l 522 1289 l 81 994 m 980 0 l 963 0 l 963 716 l 81 716 l 81 0 l 65 0 l 65 1000 l 522 1305 l 980 1000 l 980 0 m 731 1525 l 980 1525 l 980 1508 l 731 1508 l 731 1525 m 65 1525 l 314 1525 l 314 1508 l 65 1508 l 65 1525 "},"¸":{"x_min":0,"x_max":0,"ha":1361},"a":{"x_min":65,"x_max":980,"ha":1045,"o":"m 81 994 l 81 733 l 963 733 l 963 994 l 522 1288 l 81 994 m 980 0 l 963 0 l 963 716 l 81 716 l 81 0 l 65 0 l 65 1000 l 522 1305 l 980 1000 l 980 0 "},"—":{"x_min":0,"x_max":0,"ha":1361},"=":{"x_min":65,"x_max":980,"ha":1045,"o":"m 65 433 l 980 433 l 980 416 l 65 416 l 65 433 m 65 732 l 980 732 l 980 716 l 65 716 l 65 732 "},"N":{"x_min":65,"x_max":980,"ha":1045,"o":"m 980 1305 l 980 0 l 963 0 l 963 66 l 81 1221 l 81 0 l 65 0 l 65 1305 l 81 1305 l 81 1243 l 963 88 l 963 1305 l 980 1305 "},"\u0011":{"x_min":0,"x_max":0,"ha":1361},"ú":{"x_min":0,"x_max":0,"ha":1361},"⁄":{"x_min":0,"x_max":0,"ha":1361},"2":{"x_min":64.84375,"x_max":980.15625,"ha":1045,"o":"m 64 1288 l 64 1305 l 980 1305 l 980 716 l 81 716 l 81 17 l 980 17 l 980 0 l 65 0 l 65 733 l 963 733 l 963 1288 l 64 1288 "},"ü":{"x_min":65,"x_max":980,"ha":1045,"o":"m 963 1305 l 980 1305 l 980 0 l 65 0 l 65 1305 l 81 1305 l 81 17 l 963 17 l 963 1305 m 731 1525 l 980 1525 l 980 1508 l 731 1508 l 731 1525 m 65 1525 l 314 1525 l 314 1508 l 65 1508 l 65 1525 "},"¯":{"x_min":0,"x_max":0,"ha":1361},"Z":{"x_min":65,"x_max":980,"ha":1045,"o":"m 84 17 l 980 17 l 980 0 l 65 0 l 65 22 l 958 1288 l 65 1288 l 65 1305 l 980 1305 l 980 1288 l 84 17 "},"u":{"x_min":65,"x_max":980,"ha":1045,"o":"m 963 1305 l 980 1305 l 980 0 l 65 0 l 65 1305 l 81 1305 l 81 17 l 963 17 l 963 1305 "},"˜":{"x_min":0,"x_max":0,"ha":1361},"Ó":{"x_min":0,"x_max":0,"ha":1361},"k":{"x_min":65,"x_max":980.15625,"ha":1045,"o":"m 955 1305 l 980 1305 l 86 716 l 980 0 l 955 0 l 81 699 l 81 0 l 65 0 l 65 1305 l 81 1305 l 81 732 l 955 1305 "},"Ù":{"x_min":0,"x_max":0,"ha":1361},"Ÿ":{"x_min":0,"x_max":0,"ha":1361},"¢":{"x_min":0,"x_max":0,"ha":1361},"ß":{"x_min":94,"x_max":899,"ha":1046,"o":"m 100 505 l 369 505 l 369 500 l 94 500 l 94 892 l 369 892 l 369 887 l 100 887 l 100 505 m 681 892 l 413 715 l 681 500 l 675 500 l 413 710 l 413 500 l 407 500 l 407 892 l 413 892 l 413 719 l 681 892 m 826 560 l 826 505 l 893 505 l 893 560 l 826 560 m 822 566 l 899 566 l 899 500 l 822 500 l 822 566 m 861 600 l 856 600 l 856 892 l 861 892 l 861 600 "},"é":{"x_min":0,"x_max":0,"ha":1361},"s":{"x_min":65,"x_max":980,"ha":1045,"o":"m 963 17 l 963 716 l 65 716 l 65 1305 l 980 1305 l 980 1288 l 81 1288 l 81 733 l 980 733 l 980 0 l 65 0 l 65 17 l 963 17 "},"B":{"x_min":65,"x_max":980,"ha":1045,"o":"m 65 0 l 65 1305 l 653 1305 l 980 972 l 980 849 l 857 724 l 980 600 l 980 333 l 653 0 l 65 0 m 846 716 l 81 716 l 81 17 l 650 17 l 963 336 l 963 597 l 846 716 m 81 733 l 846 733 l 963 852 l 963 969 l 650 1288 l 81 1288 l 81 733 "},"…":{"x_min":0,"x_max":0,"ha":1361},"?":{"x_min":64.84375,"x_max":980,"ha":1045,"o":"m 530 333 l 514 333 l 514 733 l 963 733 l 963 1288 l 64 1288 l 64 1305 l 980 1305 l 980 716 l 530 716 l 530 333 m 413 197 l 413 17 l 636 17 l 636 197 l 413 197 m 397 216 l 653 216 l 653 0 l 397 0 l 397 216 "},"H":{"x_min":65,"x_max":980,"ha":1045,"o":"m 980 1305 l 980 0 l 963 0 l 963 716 l 81 716 l 81 0 l 65 0 l 65 1305 l 81 1305 l 81 733 l 963 733 l 963 1305 l 980 1305 "},"î":{"x_min":0,"x_max":0,"ha":1361},"c":{"x_min":65,"x_max":980.15625,"ha":1045,"o":"m 81 17 l 980 17 l 980 0 l 65 0 l 65 1305 l 980 1305 l 980 1288 l 81 1288 l 81 17 "},"¶":{"x_min":0,"x_max":0,"ha":1361},"−":{"x_min":0,"x_max":0,"ha":1361},"•":{"x_min":0,"x_max":0,"ha":1361},"¥":{"x_min":0,"x_max":0,"ha":1361},"(":{"x_min":196,"x_max":849.34375,"ha":1045,"o":"m 212 17 l 849 17 l 849 0 l 196 0 l 196 1305 l 849 1305 l 849 1288 l 212 1288 l 212 17 "},"U":{"x_min":65,"x_max":980,"ha":1045,"o":"m 963 1305 l 980 1305 l 980 0 l 65 0 l 65 1305 l 81 1305 l 81 17 l 963 17 l 963 1305 "},"Ñ":{"x_min":0,"x_max":0,"ha":1361},"F":{"x_min":65,"x_max":980.15625,"ha":1045,"o":"m 65 0 l 65 1305 l 980 1305 l 980 1288 l 81 1288 l 81 733 l 980 733 l 980 716 l 81 716 l 81 0 l 65 0 "},"":{"x_min":0,"x_max":0,"ha":1361},":":{"x_min":441,"x_max":697,"ha":1045,"o":"m 457 714 l 457 533 l 680 533 l 680 714 l 457 714 m 441 733 l 697 733 l 697 516 l 441 516 l 441 733 m 457 197 l 457 17 l 680 17 l 680 197 l 457 197 m 441 216 l 697 216 l 697 0 l 441 0 l 441 216 "},"Û":{"x_min":0,"x_max":0,"ha":1361},"*":{"x_min":294,"x_max":751,"ha":1045,"o":"m 294 716 l 294 733 l 514 733 l 294 1024 l 311 1024 l 517 753 l 517 955 l 534 955 l 534 753 l 733 1024 l 751 1024 l 537 733 l 751 733 l 751 716 l 537 716 l 751 372 l 733 372 l 534 698 l 534 489 l 517 489 l 517 698 l 311 372 l 294 372 l 514 716 l 294 716 "},"†":{"x_min":0,"x_max":0,"ha":1361},"°":{"x_min":0,"x_max":0,"ha":1361},"V":{"x_min":65.125,"x_max":980.296875,"ha":1045,"o":"m 958 1305 l 980 1305 l 528 0 l 511 0 l 65 1305 l 87 1305 l 519 25 l 958 1305 "},"å":{"x_min":0,"x_max":0,"ha":1361}," ":{"x_min":0,"x_max":0,"ha":1361},"0":{"x_min":65,"x_max":980,"ha":1045,"o":"m 65 0 l 65 1305 l 980 1305 l 980 0 l 65 0 m 81 1288 l 81 55 l 963 1288 l 81 1288 m 81 17 l 962 17 l 962 1244 l 81 17 "},"”":{"x_min":0,"x_max":0,"ha":1361},"¾":{"x_min":0,"x_max":0,"ha":1361},"@":{"x_min":128,"x_max":914,"ha":1045,"o":"m 797 706 l 797 823 l 522 955 l 253 823 l 253 706 l 797 706 m 814 363 l 898 363 l 898 1043 l 144 1043 l 144 256 l 914 256 l 914 243 l 128 243 l 128 1055 l 914 1055 l 914 350 l 797 350 l 797 692 l 253 692 l 253 350 l 236 350 l 236 832 l 522 972 l 814 832 l 814 363 "},"ö":{"x_min":65,"x_max":980,"ha":1045,"o":"m 65 0 l 65 1305 l 980 1305 l 980 0 l 65 0 m 963 17 l 963 1288 l 81 1288 l 81 17 l 963 17 m 731 1525 l 980 1525 l 980 1508 l 731 1508 l 731 1525 m 65 1525 l 314 1525 l 314 1508 l 65 1508 l 65 1525 "},"i":{"x_min":65,"x_max":980,"ha":1045,"o":"m 528 1288 l 528 17 l 980 17 l 980 0 l 65 0 l 65 17 l 511 17 l 511 1288 l 65 1288 l 65 1305 l 980 1305 l 980 1288 l 528 1288 "},"Õ":{"x_min":0,"x_max":0,"ha":1361},"þ":{"x_min":0,"x_max":0,"ha":1361},"]":{"x_min":196.3125,"x_max":849.609375,"ha":1046,"o":"m 833 1288 l 196 1288 l 196 1305 l 849 1305 l 849 0 l 196 0 l 196 17 l 833 17 l 833 1288 "},"m":{"x_min":65,"x_max":980,"ha":1045,"o":"m 519 716 l 81 1288 l 81 0 l 65 0 l 65 1305 l 86 1305 l 519 738 l 958 1305 l 980 1305 l 980 0 l 963 0 l 963 1288 l 519 716 "},"8":{"x_min":65,"x_max":980,"ha":1045,"o":"m 65 0 l 65 1305 l 980 1305 l 980 0 l 65 0 m 81 1288 l 81 733 l 963 733 l 963 1288 l 81 1288 m 81 716 l 81 17 l 963 17 l 963 716 l 81 716 "},"R":{"x_min":65,"x_max":980,"ha":1045,"o":"m 963 733 l 963 1288 l 81 1288 l 81 733 l 963 733 m 980 716 l 86 716 l 980 0 l 955 0 l 81 697 l 81 0 l 65 0 l 65 1305 l 980 1305 l 980 716 "},"á":{"x_min":0,"x_max":0,"ha":1361},"×":{"x_min":0,"x_max":0,"ha":1361},"o":{"x_min":65,"x_max":980,"ha":1045,"o":"m 65 0 l 65 1305 l 980 1305 l 980 0 l 65 0 m 963 17 l 963 1288 l 81 1288 l 81 17 l 963 17 "},"5":{"x_min":65,"x_max":980,"ha":1045,"o":"m 963 17 l 963 716 l 65 716 l 65 1305 l 980 1305 l 980 1288 l 81 1288 l 81 733 l 980 733 l 980 0 l 65 0 l 65 17 l 963 17 "},"õ":{"x_min":0,"x_max":0,"ha":1361},"7":{"x_min":65.453125,"x_max":980.609375,"ha":1046,"o":"m 964 0 l 964 1288 l 65 1288 l 65 1305 l 980 1305 l 980 0 l 964 0 "},"K":{"x_min":65,"x_max":980.15625,"ha":1045,"o":"m 955 1305 l 980 1305 l 86 716 l 980 0 l 955 0 l 81 699 l 81 0 l 65 0 l 65 1305 l 81 1305 l 81 732 l 955 1305 "},",":{"x_min":435,"x_max":697,"ha":1045,"o":"m 451 197 l 451 -83 l 588 -83 l 588 17 l 680 17 l 680 197 l 451 197 m 435 216 l 697 216 l 697 0 l 604 0 l 604 -100 l 435 -100 l 435 216 "},"d":{"x_min":65,"x_max":980,"ha":1045,"o":"m 65 0 l 65 1305 l 552 1305 l 980 869 l 980 434 l 554 0 l 65 0 m 963 863 l 546 1288 l 81 1288 l 81 17 l 548 17 l 963 440 l 963 863 "},"¨":{"x_min":0,"x_max":0,"ha":1361},"Ô":{"x_min":0,"x_max":0,"ha":1361},"E":{"x_min":65,"x_max":980.15625,"ha":1045,"o":"m 81 716 l 81 17 l 980 17 l 980 0 l 65 0 l 65 1305 l 980 1305 l 980 1288 l 81 1288 l 81 733 l 980 733 l 980 716 l 81 716 "},"Y":{"x_min":65.375,"x_max":980.546875,"ha":1046,"o":"m 958 1305 l 980 1305 l 528 716 l 528 0 l 512 0 l 512 716 l 65 1305 l 87 1305 l 519 738 l 958 1305 "},"\"":{"x_min":435,"x_max":697,"ha":1045,"o":"m 451 1285 l 451 1005 l 588 1005 l 588 1105 l 680 1105 l 680 1285 l 451 1285 m 435 1305 l 697 1305 l 697 1088 l 604 1088 l 604 988 l 435 988 l 435 1305 "},"‹":{"x_min":261.1875,"x_max":668.59375,"ha":1045,"o":"m 668 1038 l 280 724 l 668 408 l 649 408 l 261 724 l 649 1038 l 668 1038 "},"ê":{"x_min":0,"x_max":0,"ha":1361},"Ï":{"x_min":37,"x_max":1004.421875,"ha":1046,"o":"m 37 253 l 37 669 l 261 911 l 517 664 l 763 901 l 1004 652 l 860 415 l 996 238 l 628 35 l 252 35 l 37 253 m 264 55 l 627 55 l 966 242 l 835 417 l 977 646 l 762 869 l 518 632 l 264 879 l 64 654 l 64 257 l 264 55 "},"„":{"x_min":0,"x_max":0,"ha":1361},"Â":{"x_min":0,"x_max":0,"ha":1361},"Í":{"x_min":6.640625,"x_max":1019.5,"ha":1045,"o":"m 133 208 l 254 247 l 518 34 l 898 193 l 980 433 l 618 562 l 790 694 l 532 802 l 192 741 l 149 678 l 405 473 l 41 381 l 133 208 m 118 177 l 6 397 l 362 482 l 114 678 l 175 759 l 533 829 l 835 696 l 659 568 l 1019 441 l 915 178 l 514 6 l 239 222 l 118 177 "},"´":{"x_min":0,"x_max":0,"ha":1361},"ì":{"x_min":0,"x_max":0,"ha":1361},"±":{"x_min":65,"x_max":980,"ha":1045,"o":"m 514 716 l 65 716 l 65 732 l 514 732 l 514 1175 l 531 1175 l 531 732 l 980 732 l 980 716 l 531 716 l 531 241 l 514 241 l 514 716 m 65 99 l 980 99 l 980 83 l 65 83 l 65 99 "},"Ú":{"x_min":0,"x_max":0,"ha":1361},"|":{"x_min":261,"x_max":277.609375,"ha":522,"o":"m 277 1305 l 277 0 l 261 0 l 261 1305 l 277 1305 "},"§":{"x_min":0,"x_max":0,"ha":1361},"Ý":{"x_min":0,"x_max":0,"ha":1361},"b":{"x_min":65,"x_max":980,"ha":1045,"o":"m 65 0 l 65 1305 l 653 1305 l 980 972 l 980 849 l 857 724 l 980 600 l 980 333 l 653 0 l 65 0 m 846 716 l 81 716 l 81 17 l 650 17 l 963 336 l 963 597 l 846 716 m 81 733 l 846 733 l 963 852 l 963 969 l 650 1288 l 81 1288 l 81 733 "},"q":{"x_min":65,"x_max":980,"ha":1045,"o":"m 808 174 l 963 333 l 963 1288 l 81 1288 l 81 17 l 653 17 l 799 166 l 595 374 l 595 391 l 808 174 m 980 0 l 963 0 l 808 158 l 653 0 l 65 0 l 65 1305 l 980 1305 l 980 333 l 816 166 l 980 0 "},"Ö":{"x_min":65,"x_max":980,"ha":1045,"o":"m 65 0 l 65 1305 l 980 1305 l 980 0 l 65 0 m 963 17 l 963 1288 l 81 1288 l 81 17 l 963 17 m 731 1525 l 980 1525 l 980 1508 l 731 1508 l 731 1525 m 65 1525 l 314 1525 l 314 1508 l 65 1508 l 65 1525 "},"z":{"x_min":65,"x_max":980,"ha":1045,"o":"m 84 17 l 980 17 l 980 0 l 65 0 l 65 22 l 958 1288 l 65 1288 l 65 1305 l 980 1305 l 980 1288 l 84 17 "},"™":{"x_min":26,"x_max":810,"ha":1045,"o":"m 211 782 l 204 782 l 204 1298 l 26 1298 l 26 1305 l 392 1305 l 392 1298 l 211 1298 l 211 782 m 626 1068 l 451 1298 l 451 783 l 444 783 l 444 1305 l 451 1305 l 626 1075 l 803 1305 l 810 1305 l 810 783 l 803 783 l 803 1298 l 626 1068 "},"ã":{"x_min":0,"x_max":0,"ha":1361},"æ":{"x_min":0,"x_max":0,"ha":1361},"®":{"x_min":128,"x_max":914,"ha":1045,"o":"m 748 744 l 748 931 l 318 931 l 318 744 l 748 744 m 764 731 l 320 731 l 764 486 l 740 486 l 318 718 l 318 486 l 302 486 l 302 944 l 764 944 l 764 731 m 128 350 l 128 1054 l 522 1110 l 914 1054 l 914 350 l 522 297 l 128 350 m 898 364 l 898 1043 l 522 1095 l 144 1043 l 144 364 l 522 313 l 898 364 "},"É":{"x_min":21.5,"x_max":1019.109375,"ha":1045,"o":"m 485 272 l 88 272 l 88 245 l 379 245 l 485 272 m 54 145 l 177 21 l 888 21 l 993 184 l 777 230 l 729 315 l 54 145 m 21 152 l 319 229 l 72 229 l 72 289 l 537 289 l 741 340 l 797 243 l 1019 197 l 895 0 l 172 0 l 21 152 "},"~":{"x_min":0,"x_max":0,"ha":1361},"³":{"x_min":0,"x_max":0,"ha":1361},"¡":{"x_min":0,"x_max":0,"ha":1361},"[":{"x_min":196,"x_max":849.34375,"ha":1045,"o":"m 212 17 l 849 17 l 849 0 l 196 0 l 196 1305 l 849 1305 l 849 1288 l 212 1288 l 212 17 "},"L":{"x_min":65,"x_max":980.15625,"ha":1045,"o":"m 980 0 l 65 0 l 65 1305 l 81 1305 l 81 17 l 980 17 l 980 0 "}," ":{"x_min":0,"x_max":0,"ha":1045},"%":{"x_min":27,"x_max":1018,"ha":1045,"o":"m 27 808 l 27 1277 l 384 1277 l 384 808 l 27 808 m 32 1272 l 32 827 l 377 1272 l 32 1272 m 32 813 l 377 813 l 377 1256 l 32 813 m 661 28 l 661 497 l 1018 497 l 1018 28 l 661 28 m 668 492 l 668 47 l 1011 492 l 668 492 m 668 33 l 1011 33 l 1011 476 l 668 33 m 81 0 l 64 0 l 963 1305 l 979 1305 l 81 0 "},"P":{"x_min":65,"x_max":980,"ha":1045,"o":"m 963 733 l 963 1288 l 81 1288 l 81 733 l 963 733 m 81 0 l 65 0 l 65 1305 l 980 1305 l 980 716 l 81 716 l 81 0 "},"À":{"x_min":0,"x_max":0,"ha":1361},"_":{"x_min":65,"x_max":980,"ha":1045,"o":"m 65 17 l 980 17 l 980 0 l 65 0 l 65 17 "},"ñ":{"x_min":0,"x_max":0,"ha":1361},"+":{"x_min":65,"x_max":980,"ha":1045,"o":"m 514 716 l 65 716 l 65 732 l 514 732 l 514 1175 l 531 1175 l 531 732 l 980 732 l 980 716 l 531 716 l 531 241 l 514 241 l 514 716 "},"‚":{"x_min":0,"x_max":0,"ha":1361},"½":{"x_min":0,"x_max":0,"ha":1361},"Æ":{"x_min":8.265625,"x_max":1038.234375,"ha":1046,"o":"m 438 366 l 438 46 l 662 46 l 662 366 l 550 413 l 438 366 m 662 391 l 556 879 l 438 391 l 550 438 l 662 391 m 684 46 l 997 205 l 684 357 l 684 46 m 1038 205 l 662 5 l 438 5 l 8 205 l 417 382 l 556 972 l 684 382 l 1038 205 m 417 46 l 417 357 l 62 205 l 417 46 "},"Ë":{"x_min":18.859375,"x_max":930,"ha":1045,"o":"m 41 216 l 276 33 l 609 33 l 759 264 l 908 279 l 908 480 l 569 433 l 690 666 l 650 716 l 317 656 l 317 433 l 108 477 l 41 216 m 18 212 l 90 503 l 292 462 l 292 674 l 658 738 l 713 670 l 607 462 l 930 506 l 930 252 l 769 252 l 618 11 l 260 11 l 18 212 "},"'":{"x_min":435,"x_max":697,"ha":1045,"o":"m 451 1285 l 451 1005 l 588 1005 l 588 1105 l 680 1105 l 680 1285 l 451 1285 m 435 1305 l 697 1305 l 697 1088 l 604 1088 l 604 988 l 435 988 l 435 1305 "},"Š":{"x_min":0,"x_max":0,"ha":1361},"ª":{"x_min":0,"x_max":0,"ha":1361},"Œ":{"x_min":0,"x_max":0,"ha":1361},"ð":{"x_min":0,"x_max":0,"ha":1361},"T":{"x_min":65,"x_max":980,"ha":1045,"o":"m 528 0 l 511 0 l 511 1288 l 65 1288 l 65 1305 l 980 1305 l 980 1288 l 528 1288 l 528 0 "},"š":{"x_min":0,"x_max":0,"ha":1361},"Þ":{"x_min":0,"x_max":0,"ha":1361},"j":{"x_min":65.453125,"x_max":980.609375,"ha":1046,"o":"m 534 1288 l 534 1305 l 980 1305 l 980 0 l 494 0 l 65 437 l 87 437 l 498 17 l 964 17 l 964 1288 l 534 1288 "},"1":{"x_min":512,"x_max":528.609375,"ha":1046,"o":"m 528 1305 l 528 0 l 512 0 l 512 1305 l 528 1305 "},"›":{"x_min":261.1875,"x_max":668.59375,"ha":1045,"o":"m 261 1038 l 280 1038 l 668 724 l 280 408 l 261 408 l 649 724 l 261 1038 "},"ä":{"x_min":65,"x_max":980,"ha":1045,"o":"m 81 994 l 81 733 l 963 733 l 963 994 l 522 1289 l 81 994 m 980 0 l 963 0 l 963 716 l 81 716 l 81 0 l 65 0 l 65 1000 l 522 1305 l 980 1000 l 980 0 m 731 1525 l 980 1525 l 980 1508 l 731 1508 l 731 1525 m 65 1525 l 314 1525 l 314 1508 l 65 1508 l 65 1525 "},"<":{"x_min":503.765625,"x_max":980.296875,"ha":1045,"o":"m 958 0 l 503 716 l 958 1305 l 980 1305 l 528 716 l 980 0 l 958 0 "},"£":{"x_min":0,"x_max":0,"ha":1361},"¹":{"x_min":0,"x_max":0,"ha":1361},"t":{"x_min":65,"x_max":980,"ha":1045,"o":"m 528 0 l 511 0 l 511 1288 l 65 1288 l 65 1305 l 980 1305 l 980 1288 l 528 1288 l 528 0 "},"¬":{"x_min":0,"x_max":0,"ha":1361},"ù":{"x_min":0,"x_max":0,"ha":1361},"W":{"x_min":65,"x_max":980,"ha":1045,"o":"m 525 596 l 963 21 l 963 1304 l 980 1304 l 980 -1 l 963 -1 l 525 570 l 81 0 l 65 0 l 65 1305 l 81 1305 l 81 22 l 525 596 "},"ï":{"x_min":0,"x_max":0,"ha":1361},">":{"x_min":65.125,"x_max":533.671875,"ha":1045,"o":"m 65 0 l 511 716 l 65 1305 l 87 1305 l 533 716 l 87 0 l 65 0 "},"v":{"x_min":65.125,"x_max":980.296875,"ha":1045,"o":"m 958 1305 l 980 1305 l 528 0 l 511 0 l 65 1305 l 87 1305 l 519 25 l 958 1305 "},"û":{"x_min":0,"x_max":0,"ha":1361},"Ò":{"x_min":0,"x_max":0,"ha":1361},"&":{"x_min":54.5,"x_max":1016.84375,"ha":1045,"o":"m 148 704 l 379 533 l 291 255 l 521 428 l 754 255 l 665 533 l 897 704 l 610 704 l 521 981 l 433 704 l 148 704 m 54 733 l 410 733 l 521 1080 l 631 733 l 1016 733 l 701 519 l 811 172 l 521 387 l 232 172 l 342 519 l 54 733 "},"Ð":{"x_min":0,"x_max":0,"ha":1361},"I":{"x_min":65,"x_max":980,"ha":1045,"o":"m 528 1288 l 528 17 l 980 17 l 980 0 l 65 0 l 65 17 l 511 17 l 511 1288 l 65 1288 l 65 1305 l 980 1305 l 980 1288 l 528 1288 "},"ˉ":{"x_min":0,"x_max":0,"ha":1361},"G":{"x_min":65,"x_max":980,"ha":1045,"o":"m 980 1305 l 980 1132 l 963 1132 l 963 1288 l 81 1288 l 81 17 l 963 17 l 963 716 l 292 716 l 292 733 l 980 733 l 980 0 l 65 0 l 65 1305 l 980 1305 "},"`":{"x_min":435,"x_max":697,"ha":1045,"o":"m 451 1285 l 451 1005 l 588 1005 l 588 1105 l 680 1105 l 680 1285 l 451 1285 m 435 1305 l 697 1305 l 697 1088 l 604 1088 l 604 988 l 435 988 l 435 1305 "},"·":{"x_min":0,"x_max":0,"ha":1361},"r":{"x_min":65,"x_max":980,"ha":1045,"o":"m 963 733 l 963 1288 l 81 1288 l 81 733 l 963 733 m 980 716 l 86 716 l 980 0 l 955 0 l 81 697 l 81 0 l 65 0 l 65 1305 l 980 1305 l 980 716 "},"¿":{"x_min":0,"x_max":0,"ha":1361},"ý":{"x_min":0,"x_max":0,"ha":1361},"x":{"x_min":65.125,"x_max":980.296875,"ha":1045,"o":"m 958 0 l 519 696 l 87 0 l 65 0 q 152 139 93 44 l 455 625 q 511 716 509 710 l 65 1305 l 87 1305 l 519 735 l 958 1305 l 980 1305 l 528 716 l 980 0 l 958 0 "},"è":{"x_min":0,"x_max":0,"ha":1361},"º":{"x_min":0,"x_max":0,"ha":1361},"Ø":{"x_min":0,"x_max":0,"ha":1361},"μ":{"x_min":0,"x_max":0,"ha":1361},"÷":{"x_min":0,"x_max":0,"ha":1361},"h":{"x_min":65,"x_max":980,"ha":1045,"o":"m 980 1305 l 980 0 l 963 0 l 963 716 l 81 716 l 81 0 l 65 0 l 65 1305 l 81 1305 l 81 733 l 963 733 l 963 1305 l 980 1305 "},".":{"x_min":441,"x_max":697,"ha":1045,"o":"m 457 197 l 457 17 l 680 17 l 680 197 l 457 197 m 441 216 l 697 216 l 697 0 l 441 0 l 441 216 "},";":{"x_min":435,"x_max":697,"ha":1045,"o":"m 457 714 l 457 533 l 680 533 l 680 714 l 457 714 m 441 733 l 697 733 l 697 516 l 441 516 l 441 733 m 451 197 l 451 -83 l 588 -83 l 588 17 l 680 17 l 680 197 l 451 197 m 435 216 l 697 216 l 697 0 l 604 0 l 604 -100 l 435 -100 l 435 216 "},"f":{"x_min":65,"x_max":980.15625,"ha":1045,"o":"m 65 0 l 65 1305 l 980 1305 l 980 1288 l 81 1288 l 81 733 l 980 733 l 980 716 l 81 716 l 81 0 l 65 0 "},"“":{"x_min":0,"x_max":0,"ha":1361},"A":{"x_min":65,"x_max":980,"ha":1045,"o":"m 81 994 l 81 733 l 963 733 l 963 994 l 522 1288 l 81 994 m 980 0 l 963 0 l 963 716 l 81 716 l 81 0 l 65 0 l 65 1000 l 522 1305 l 980 1000 l 980 0 "},"6":{"x_min":65,"x_max":980,"ha":1045,"o":"m 81 716 l 81 17 l 963 17 l 963 716 l 81 716 m 81 733 l 980 733 l 980 0 l 65 0 l 65 1305 l 81 1305 l 81 733 "},"‘":{"x_min":0,"x_max":0,"ha":1361},"O":{"x_min":65,"x_max":980,"ha":1045,"o":"m 65 0 l 65 1305 l 980 1305 l 980 0 l 65 0 m 963 17 l 963 1288 l 81 1288 l 81 17 l 963 17 "},"n":{"x_min":65,"x_max":980,"ha":1045,"o":"m 980 1305 l 980 0 l 963 0 l 963 66 l 81 1221 l 81 0 l 65 0 l 65 1305 l 81 1305 l 81 1243 l 963 88 l 963 1305 l 980 1305 "},"3":{"x_min":65.453125,"x_max":980.609375,"ha":1046,"o":"m 964 733 l 964 1288 l 65 1288 l 65 1305 l 980 1305 l 980 0 l 65 0 l 65 17 l 964 17 l 964 716 l 65 716 l 65 733 l 964 733 "},"9":{"x_min":65,"x_max":980,"ha":1045,"o":"m 81 1288 l 81 733 l 963 733 l 963 1288 l 81 1288 m 65 1305 l 980 1305 l 980 0 l 963 0 l 963 716 l 65 716 l 65 1305 "},"l":{"x_min":65,"x_max":980.15625,"ha":1045,"o":"m 980 0 l 65 0 l 65 1305 l 81 1305 l 81 17 l 980 17 l 980 0 "},"¤":{"x_min":0,"x_max":0,"ha":1361},"4":{"x_min":65,"x_max":980,"ha":1045,"o":"m 980 1305 l 980 0 l 963 0 l 963 716 l 65 716 l 65 1305 l 81 1305 l 81 733 l 963 733 l 963 1305 l 980 1305 "},"p":{"x_min":65,"x_max":980,"ha":1045,"o":"m 963 733 l 963 1288 l 81 1288 l 81 733 l 963 733 m 81 0 l 65 0 l 65 1305 l 980 1305 l 980 716 l 81 716 l 81 0 "},"‡":{"x_min":0,"x_max":0,"ha":1361},"à":{"x_min":0,"x_max":0,"ha":1361},"Ü":{"x_min":65,"x_max":980,"ha":1045,"o":"m 963 1305 l 980 1305 l 980 0 l 65 0 l 65 1305 l 81 1305 l 81 17 l 963 17 l 963 1305 m 731 1525 l 980 1525 l 980 1508 l 731 1508 l 731 1525 m 65 1525 l 314 1525 l 314 1508 l 65 1508 l 65 1525 "},"ó":{"x_min":0,"x_max":0,"ha":1361}},"cssFontWeight":"normal","ascender":1526,"underlinePosition":-100,"cssFontStyle":"normal","boundingBox":{"yMin":-100,"xMin":0,"yMax":1525,"xMax":1038.234375},"resolution":1000,"original_font_information":{"postscript_name":"VectorBattle","version_string":"1.03","vendor_url":"","full_font_name":"Vector Battle","font_family_name":"Vector Battle","copyright":"© 1999 by ck! -- http://come.to/freakyfonts","description":"","trademark":"ck!, mail: ckrule@geocities.com","designer":"","designer_url":"","unique_font_identifier":"Vector Battle","license_url":"","license_description":"","manufacturer_name":"","font_sub_family_name":"Regular"},"descender":-114,"familyName":"Vector Battle","lineHeight":1638,"underlineThickness":50};
================================================
FILE: main/gams/gfiles/html5/astray/README.md
================================================
# Astray
A WebGL maze game built with Three.js and Box2dWeb.
### License
I don't believe in them. You can order your bits however you please.
================================================
FILE: main/gams/gfiles/html5/astray/Three.js
================================================
// Three.js - http://github.com/mrdoob/three.js
'use strict';var THREE=THREE||{REVISION:"49"};self.Int32Array||(self.Int32Array=Array,self.Float32Array=Array);
(function(){for(var a=0,b=["ms","moz","webkit","o"],c=0;c
>16&255)/255;this.g=(a>>8&255)/255;this.b=(a&255)/255;return this},lerpSelf:function(a,b){this.r=this.r+(a.r-this.r)*b;this.g=this.g+(a.g-this.g)*b;this.b=this.b+(a.b-this.b)*b;return this},getHex:function(){return Math.floor(this.r*255)<<16^Math.floor(this.g*255)<<8^Math.floor(this.b*255)},getContextStyle:function(){return"rgb("+Math.floor(this.r*255)+","+Math.floor(this.g*255)+","+Math.floor(this.b*255)+")"},clone:function(){return(new THREE.Color).setRGB(this.r,this.g,this.b)}};
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},copy:function(a){this.x=a.x;this.y=a.y;return this},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;return this},addSelf:function(a){this.x=this.x+a.x;this.y=this.y+a.y;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;return this},subSelf:function(a){this.x=this.x-a.x;this.y=this.y-a.y;return this},multiplyScalar:function(a){this.x=this.x*a;this.y=this.y*a;return this},divideScalar:function(a){if(a){this.x=
this.x/a;this.y=this.y/a}else this.set(0,0);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.lengthSq())},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){return this.normalize().multiplyScalar(a)},
lerpSelf:function(a,b){this.x=this.x+(a.x-this.x)*b;this.y=this.y+(a.y-this.y)*b;return this},equals:function(a){return a.x===this.x&&a.y===this.y},isZero:function(){return this.lengthSq()<1.0E-4},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},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;return this},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;return this},addSelf:function(a){this.x=this.x+a.x;this.y=this.y+a.y;this.z=this.z+a.z;return this},addScalar:function(a){this.x=this.x+a;this.y=this.y+
a;this.z=this.z+a;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;return this},subSelf:function(a){this.x=this.x-a.x;this.y=this.y-a.y;this.z=this.z-a.z;return this},multiply:function(a,b){this.x=a.x*b.x;this.y=a.y*b.y;this.z=a.z*b.z;return this},multiplySelf:function(a){this.x=this.x*a.x;this.y=this.y*a.y;this.z=this.z*a.z;return this},multiplyScalar:function(a){this.x=this.x*a;this.y=this.y*a;this.z=this.z*a;return this},divideSelf:function(a){this.x=this.x/a.x;this.y=
this.y/a.y;this.z=this.z/a.z;return this},divideScalar:function(a){if(a){this.x=this.x/a;this.y=this.y/a;this.z=this.z/a}else this.z=this.y=this.x=0;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.lengthSq())},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){return this.normalize().multiplyScalar(a)},lerpSelf:function(a,b){this.x=this.x+(a.x-this.x)*b;this.y=this.y+(a.y-this.y)*b;this.z=this.z+(a.z-this.z)*b;return this},cross:function(a,b){this.x=a.y*b.z-a.z*b.y;this.y=a.z*b.x-a.x*b.z;this.z=a.x*b.y-a.y*b.x;return this},crossSelf:function(a){var b=this.x,c=this.y,d=this.z;this.x=c*a.z-d*a.y;this.y=d*a.x-b*a.z;this.z=b*a.y-c*a.x;return this},distanceTo:function(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(a){return(new THREE.Vector3).sub(this,
a).lengthSq()},getPositionFromMatrix:function(a){this.x=a.elements[12];this.y=a.elements[13];this.z=a.elements[14];return this},getRotationFromMatrix:function(a,b){var c=b?b.x:1,d=b?b.y:1,e=b?b.z:1,f=a.elements[0]/c,g=a.elements[4]/d,c=a.elements[1]/c,d=a.elements[5]/d,h=a.elements[9]/e,j=a.elements[10]/e;this.y=Math.asin(a.elements[8]/e);e=Math.cos(this.y);if(Math.abs(e)>1.0E-5){this.x=Math.atan2(-h/e,j/e);this.z=Math.atan2(-g/e,f/e)}else{this.x=0;this.z=Math.atan2(c,d)}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},equals:function(a){return a.x===this.x&&a.y===this.y&&a.z===this.z},isZero:function(){return this.lengthSq()<1.0E-4},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)}};THREE.Vector4=function(a,b,c,d){this.x=a||0;this.y=b||0;this.z=c||0;this.w=d!==void 0?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},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w!==void 0?a.w:1;return this},add: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},addSelf:function(a){this.x=this.x+a.x;this.y=this.y+a.y;this.z=this.z+a.z;this.w=this.w+a.w;return this},sub: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},subSelf:function(a){this.x=
this.x-a.x;this.y=this.y-a.y;this.z=this.z-a.z;this.w=this.w-a.w;return this},multiplyScalar:function(a){this.x=this.x*a;this.y=this.y*a;this.z=this.z*a;this.w=this.w*a;return this},divideScalar:function(a){if(a){this.x=this.x/a;this.y=this.y/a;this.z=this.z/a;this.w=this.w/a}else{this.z=this.y=this.x=0;this.w=1}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.dot(this)},length:function(){return Math.sqrt(this.lengthSq())},
normalize:function(){return this.divideScalar(this.length())},setLength:function(a){return this.normalize().multiplyScalar(a)},lerpSelf:function(a,b){this.x=this.x+(a.x-this.x)*b;this.y=this.y+(a.y-this.y)*b;this.z=this.z+(a.z-this.z)*b;this.w=this.w+(a.w-this.w)*b;return this},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)}};THREE.Frustum=function(){this.planes=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4]};
THREE.Frustum.prototype.setFromMatrix=function(a){var b,c=this.planes,d=a.elements,a=d[0];b=d[1];var e=d[2],f=d[3],g=d[4],h=d[5],j=d[6],l=d[7],k=d[8],p=d[9],m=d[10],o=d[11],q=d[12],n=d[13],r=d[14],d=d[15];c[0].set(f-a,l-g,o-k,d-q);c[1].set(f+a,l+g,o+k,d+q);c[2].set(f+b,l+h,o+p,d+n);c[3].set(f-b,l-h,o-p,d-n);c[4].set(f-e,l-j,o-m,d-r);c[5].set(f+e,l+j,o+m,d+r);for(a=0;a<6;a++){b=c[a];b.divideScalar(Math.sqrt(b.x*b.x+b.y*b.y+b.z*b.z))}};
THREE.Frustum.prototype.contains=function(a){for(var b=this.planes,c=a.matrixWorld,d=c.elements,c=-a.geometry.boundingSphere.radius*c.getMaxScaleOnAxis(),e=0;e<6;e++){a=b[e].x*d[12]+b[e].y*d[13]+b[e].z*d[14]+b[e].w;if(a<=c)return false}return true};THREE.Frustum.__v1=new THREE.Vector3;
THREE.Ray=function(a,b){function c(a,b,c){q.sub(c,a);u=q.dot(b);t=n.add(a,r.copy(b).multiplyScalar(u));return y=c.distanceTo(t)}function d(a,b,c,d){q.sub(d,b);n.sub(c,b);r.sub(a,b);s=q.dot(q);w=q.dot(n);H=q.dot(r);E=n.dot(n);z=n.dot(r);v=1/(s*E-w*w);A=(E*H-w*z)*v;J=(s*z-w*H)*v;return A>=0&&J>=0&&A+J<1}this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3;var e=1.0E-4;this.setPrecision=function(a){e=a};var f=new THREE.Vector3,g=new THREE.Vector3,h=new THREE.Vector3,j=new THREE.Vector3,
l=new THREE.Vector3,k=new THREE.Vector3,p=new THREE.Vector3,m=new THREE.Vector3,o=new THREE.Vector3;this.intersectObject=function(a){var b,n=[];if(a instanceof THREE.Particle){var q=c(this.origin,this.direction,a.matrixWorld.getPosition());if(q>a.scale.x)return[];b={distance:q,point:a.position,face:null,object:a};n.push(b)}else if(a instanceof THREE.Mesh){var q=c(this.origin,this.direction,a.matrixWorld.getPosition()),r=THREE.Frustum.__v1.set(a.matrixWorld.getColumnX().length(),a.matrixWorld.getColumnY().length(),
a.matrixWorld.getColumnZ().length());if(q>a.geometry.boundingSphere.radius*Math.max(r.x,Math.max(r.y,r.z)))return n;var s,i,t=a.geometry,u=t.vertices,C;a.matrixRotationWorld.extractRotation(a.matrixWorld);q=0;for(r=t.faces.length;q0:s<0))){o.add(l,k.multiplyScalar(i));if(b instanceof THREE.Face3){f=C.multiplyVector3(f.copy(u[b.a]));g=C.multiplyVector3(g.copy(u[b.b]));h=C.multiplyVector3(h.copy(u[b.c]));if(d(o,f,g,h)){b={distance:l.distanceTo(o),point:o.clone(),face:b,object:a};n.push(b)}}else if(b instanceof THREE.Face4){f=C.multiplyVector3(f.copy(u[b.a]));g=C.multiplyVector3(g.copy(u[b.b]));h=C.multiplyVector3(h.copy(u[b.c]));j=C.multiplyVector3(j.copy(u[b.d]));if(d(o,f,g,j)||d(o,g,h,j)){b={distance:l.distanceTo(o),point:o.clone(),
face:b,object:a};n.push(b)}}}}}}return n};this.intersectObjects=function(a){for(var b=[],c=0,d=a.length;cf?d:f;e=e>g?
e:g}a()};this.add3Points=function(f,g,k,p,m,o){if(h){h=false;b=fk?f>m?f:m:k>m?k:m;e=g>p?g>o?g:o:p>o?p:o}else{b=fk?f>m?f>d?f:d:m>d?m:d:k>m?k>d?k:d:m>d?m:d;e=g>p?g>o?g>e?g:e:o>e?o:e:p>o?p>e?p:e:o>e?o:e}a()};this.addRectangle=function(f){if(h){h=false;b=f.getLeft();c=f.getTop();d=f.getRight();e=f.getBottom()}else{b=bf.getRight()?d:f.getRight();e=e>f.getBottom()?e:f.getBottom()}a()};this.inflate=function(f){b=b-f;c=c-f;d=d+f;e=e+f;a()};this.minSelf=function(f){b=b>f.getLeft()?b:f.getLeft();c=c>f.getTop()?c:f.getTop();d=da.getRight()||ea.getBottom()?false:true};this.empty=function(){h=true;e=d=c=b=0;a()};this.isEmpty=function(){return h}};
THREE.Math={clamp:function(a,b,c){return ac?c:a},clampBottom:function(a,b){return a0?1:0}};THREE.Matrix3=function(){this.elements=new Float32Array(9)};
THREE.Matrix3.prototype={constructor:THREE.Matrix3,getInverse:function(a){var b=a.elements,a=b[10]*b[5]-b[6]*b[9],c=-b[10]*b[1]+b[2]*b[9],d=b[6]*b[1]-b[2]*b[5],e=-b[10]*b[4]+b[6]*b[8],f=b[10]*b[0]-b[2]*b[8],g=-b[6]*b[0]+b[2]*b[4],h=b[9]*b[4]-b[5]*b[8],j=-b[9]*b[0]+b[1]*b[8],l=b[5]*b[0]-b[1]*b[4],b=b[0]*a+b[1]*e+b[2]*h;b===0&&console.warn("Matrix3.getInverse(): determinant == 0");var b=1/b,k=this.elements;k[0]=b*a;k[1]=b*c;k[2]=b*d;k[3]=b*e;k[4]=b*f;k[5]=b*g;k[6]=b*h;k[7]=b*j;k[8]=b*l;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},transposeIntoArray:function(a){var b=this.m;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}};THREE.Matrix4=function(a,b,c,d,e,f,g,h,j,l,k,p,m,o,q,n){this.elements=new Float32Array(16);this.set(a!==void 0?a:1,b||0,c||0,d||0,e||0,f!==void 0?f:1,g||0,h||0,j||0,l||0,k!==void 0?k:1,p||0,m||0,o||0,q||0,n!==void 0?n:1)};
THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,d,e,f,g,h,j,l,k,p,m,o,q,n){var r=this.elements;r[0]=a;r[4]=b;r[8]=c;r[12]=d;r[1]=e;r[5]=f;r[9]=g;r[13]=h;r[2]=j;r[6]=l;r[10]=k;r[14]=p;r[3]=m;r[7]=o;r[11]=q;r[15]=n;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){a=a.elements;this.set(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]);return this},lookAt:function(a,b,c){var d=this.elements,
e=THREE.Matrix4.__v1,f=THREE.Matrix4.__v2,g=THREE.Matrix4.__v3;g.sub(a,b).normalize();if(g.length()===0)g.z=1;e.cross(c,g).normalize();if(e.length()===0){g.x=g.x+1.0E-4;e.cross(c,g).normalize()}f.cross(g,e);d[0]=e.x;d[4]=f.x;d[8]=g.x;d[1]=e.y;d[5]=f.y;d[9]=g.y;d[2]=e.z;d[6]=f.z;d[10]=g.z;return this},multiply:function(a,b){var c=a.elements,d=b.elements,e=this.elements,f=c[0],g=c[4],h=c[8],j=c[12],l=c[1],k=c[5],p=c[9],m=c[13],o=c[2],q=c[6],n=c[10],r=c[14],u=c[3],t=c[7],y=c[11],c=c[15],s=d[0],w=d[4],
H=d[8],E=d[12],z=d[1],v=d[5],A=d[9],J=d[13],K=d[2],R=d[6],P=d[10],D=d[14],M=d[3],G=d[7],i=d[11],d=d[15];e[0]=f*s+g*z+h*K+j*M;e[4]=f*w+g*v+h*R+j*G;e[8]=f*H+g*A+h*P+j*i;e[12]=f*E+g*J+h*D+j*d;e[1]=l*s+k*z+p*K+m*M;e[5]=l*w+k*v+p*R+m*G;e[9]=l*H+k*A+p*P+m*i;e[13]=l*E+k*J+p*D+m*d;e[2]=o*s+q*z+n*K+r*M;e[6]=o*w+q*v+n*R+r*G;e[10]=o*H+q*A+n*P+r*i;e[14]=o*E+q*J+n*D+r*d;e[3]=u*s+t*z+y*K+c*M;e[7]=u*w+t*v+y*R+c*G;e[11]=u*H+t*A+y*P+c*i;e[15]=u*E+t*J+y*D+c*d;return this},multiplySelf:function(a){return this.multiply(this,
a)},multiplyToArray:function(a,b,c){var d=this.elements;this.multiply(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]=b[0]*a;b[4]=b[4]*a;b[8]=b[8]*a;b[12]=b[12]*a;b[1]=b[1]*a;b[5]=b[5]*a;b[9]=b[9]*a;b[13]=b[13]*a;b[2]=b[2]*a;b[6]=b[6]*a;b[10]=b[10]*a;b[14]=b[14]*a;b[3]=b[3]*a;b[7]=b[7]*a;b[11]=b[11]*a;b[15]=
b[15]*a;return this},multiplyVector3:function(a){var b=this.elements,c=a.x,d=a.y,e=a.z,f=1/(b[3]*c+b[7]*d+b[11]*e+b[15]);a.x=(b[0]*c+b[4]*d+b[8]*e+b[12])*f;a.y=(b[1]*c+b[5]*d+b[9]*e+b[13])*f;a.z=(b[2]*c+b[6]*d+b[10]*e+b[14])*f;return a},multiplyVector4:function(a){var b=this.elements,c=a.x,d=a.y,e=a.z,f=a.w;a.x=b[0]*c+b[4]*d+b[8]*e+b[12]*f;a.y=b[1]*c+b[5]*d+b[9]*e+b[13]*f;a.z=b[2]*c+b[6]*d+b[10]*e+b[14]*f;a.w=b[3]*c+b[7]*d+b[11]*e+b[15]*f;return a},rotateAxis:function(a){var b=this.elements,c=a.x,
d=a.y,e=a.z;a.x=c*b[0]+d*b[4]+e*b[8];a.y=c*b[1]+d*b[5]+e*b[9];a.z=c*b[2]+d*b[6]+e*b[10];a.normalize();return a},crossVector:function(a){var b=this.elements,c=new THREE.Vector4;c.x=b[0]*a.x+b[4]*a.y+b[8]*a.z+b[12]*a.w;c.y=b[1]*a.x+b[5]*a.y+b[9]*a.z+b[13]*a.w;c.z=b[2]*a.x+b[6]*a.y+b[10]*a.z+b[14]*a.w;c.w=a.w?b[3]*a.x+b[7]*a.y+b[11]*a.z+b[15]*a.w:1;return c},determinant:function(){var a=this.elements,b=a[0],c=a[4],d=a[8],e=a[12],f=a[1],g=a[5],h=a[9],j=a[13],l=a[2],k=a[6],p=a[10],m=a[14],o=a[3],q=a[7],
n=a[11],a=a[15];return e*h*k*o-d*j*k*o-e*g*p*o+c*j*p*o+d*g*m*o-c*h*m*o-e*h*l*q+d*j*l*q+e*f*p*q-b*j*p*q-d*f*m*q+b*h*m*q+e*g*l*n-c*j*l*n-e*f*k*n+b*j*k*n+c*f*m*n-b*g*m*n-d*g*l*a+c*h*l*a+d*f*k*a-b*h*k*a-c*f*p*a+b*g*p*a},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=this.elements;return THREE.Matrix4.__v1.set(a[12],a[13],
a[14])},setPosition:function(a){var b=this.elements;b[12]=a.x;b[13]=a.y;b[14]=a.z;return this},getColumnX:function(){var a=this.elements;return THREE.Matrix4.__v1.set(a[0],a[1],a[2])},getColumnY:function(){var a=this.elements;return THREE.Matrix4.__v1.set(a[4],a[5],a[6])},getColumnZ:function(){var a=this.elements;return THREE.Matrix4.__v1.set(a[8],a[9],a[10])},getInverse:function(a){var b=this.elements,c=a.elements,d=c[0],e=c[4],f=c[8],g=c[12],h=c[1],j=c[5],l=c[9],k=c[13],p=c[2],m=c[6],o=c[10],q=
c[14],n=c[3],r=c[7],u=c[11],c=c[15];b[0]=l*q*r-k*o*r+k*m*u-j*q*u-l*m*c+j*o*c;b[4]=g*o*r-f*q*r-g*m*u+e*q*u+f*m*c-e*o*c;b[8]=f*k*r-g*l*r+g*j*u-e*k*u-f*j*c+e*l*c;b[12]=g*l*m-f*k*m-g*j*o+e*k*o+f*j*q-e*l*q;b[1]=k*o*n-l*q*n-k*p*u+h*q*u+l*p*c-h*o*c;b[5]=f*q*n-g*o*n+g*p*u-d*q*u-f*p*c+d*o*c;b[9]=g*l*n-f*k*n-g*h*u+d*k*u+f*h*c-d*l*c;b[13]=f*k*p-g*l*p+g*h*o-d*k*o-f*h*q+d*l*q;b[2]=j*q*n-k*m*n+k*p*r-h*q*r-j*p*c+h*m*c;b[6]=g*m*n-e*q*n-g*p*r+d*q*r+e*p*c-d*m*c;b[10]=e*k*n-g*j*n+g*h*r-d*k*r-e*h*c+d*j*c;b[14]=g*j*p-
e*k*p-g*h*m+d*k*m+e*h*q-d*j*q;b[3]=l*m*n-j*o*n-l*p*r+h*o*r+j*p*u-h*m*u;b[7]=e*o*n-f*m*n+f*p*r-d*o*r-e*p*u+d*m*u;b[11]=f*j*n-e*l*n-f*h*r+d*l*r+e*h*u-d*j*u;b[15]=e*l*p-f*j*p+f*h*m-d*l*m-e*h*o+d*j*o;this.multiplyScalar(1/a.determinant());return this},setRotationFromEuler:function(a,b){var c=this.elements,d=a.x,e=a.y,f=a.z,g=Math.cos(d),d=Math.sin(d),h=Math.cos(e),e=Math.sin(e),j=Math.cos(f),f=Math.sin(f);switch(b){case "YXZ":var l=h*j,k=h*f,p=e*j,m=e*f;c[0]=l+m*d;c[4]=p*d-k;c[8]=g*e;c[1]=g*f;c[5]=g*
j;c[9]=-d;c[2]=k*d-p;c[6]=m+l*d;c[10]=g*h;break;case "ZXY":l=h*j;k=h*f;p=e*j;m=e*f;c[0]=l-m*d;c[4]=-g*f;c[8]=p+k*d;c[1]=k+p*d;c[5]=g*j;c[9]=m-l*d;c[2]=-g*e;c[6]=d;c[10]=g*h;break;case "ZYX":l=g*j;k=g*f;p=d*j;m=d*f;c[0]=h*j;c[4]=p*e-k;c[8]=l*e+m;c[1]=h*f;c[5]=m*e+l;c[9]=k*e-p;c[2]=-e;c[6]=d*h;c[10]=g*h;break;case "YZX":l=g*h;k=g*e;p=d*h;m=d*e;c[0]=h*j;c[4]=m-l*f;c[8]=p*f+k;c[1]=f;c[5]=g*j;c[9]=-d*j;c[2]=-e*j;c[6]=k*f+p;c[10]=l-m*f;break;case "XZY":l=g*h;k=g*e;p=d*h;m=d*e;c[0]=h*j;c[4]=-f;c[8]=e*j;
c[1]=l*f+m;c[5]=g*j;c[9]=k*f-p;c[2]=p*f-k;c[6]=d*j;c[10]=m*f+l;break;default:l=g*j;k=g*f;p=d*j;m=d*f;c[0]=h*j;c[4]=-h*f;c[8]=e;c[1]=k+p*e;c[5]=l-m*e;c[9]=-d*h;c[2]=m-l*e;c[6]=p+k*e;c[10]=g*h}return this},setRotationFromQuaternion:function(a){var b=this.elements,c=a.x,d=a.y,e=a.z,f=a.w,g=c+c,h=d+d,j=e+e,a=c*g,l=c*h,c=c*j,k=d*h,d=d*j,e=e*j,g=f*g,h=f*h,f=f*j;b[0]=1-(k+e);b[4]=l-f;b[8]=c+h;b[1]=l+f;b[5]=1-(a+e);b[9]=d-g;b[2]=c-h;b[6]=d+g;b[10]=1-(a+k);return this},compose:function(a,b,c){var d=this.elements,
e=THREE.Matrix4.__m1,f=THREE.Matrix4.__m2;e.identity();e.setRotationFromQuaternion(b);f.makeScale(c.x,c.y,c.z);this.multiply(e,f);d[12]=a.x;d[13]=a.y;d[14]=a.z;return this},decompose:function(a,b,c){var d=this.elements,e=THREE.Matrix4.__v1,f=THREE.Matrix4.__v2,g=THREE.Matrix4.__v3;e.set(d[0],d[1],d[2]);f.set(d[4],d[5],d[6]);g.set(d[8],d[9],d[10]);a=a instanceof THREE.Vector3?a:new THREE.Vector3;b=b instanceof THREE.Quaternion?b:new THREE.Quaternion;c=c instanceof THREE.Vector3?c:new THREE.Vector3;
c.x=e.length();c.y=f.length();c.z=g.length();a.x=d[12];a.y=d[13];a.z=d[14];d=THREE.Matrix4.__m1;d.copy(this);d.elements[0]=d.elements[0]/c.x;d.elements[1]=d.elements[1]/c.x;d.elements[2]=d.elements[2]/c.x;d.elements[4]=d.elements[4]/c.y;d.elements[5]=d.elements[5]/c.y;d.elements[6]=d.elements[6]/c.y;d.elements[8]=d.elements[8]/c.z;d.elements[9]=d.elements[9]/c.z;d.elements[10]=d.elements[10]/c.z;b.setFromRotationMatrix(d);return[a,b,c]},extractPosition: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(a){var b=this.elements,a=a.elements,c=THREE.Matrix4.__v1,d=1/c.set(a[0],a[1],a[2]).length(),e=1/c.set(a[4],a[5],a[6]).length(),c=1/c.set(a[8],a[9],a[10]).length();b[0]=a[0]*d;b[1]=a[1]*d;b[2]=a[2]*d;b[4]=a[4]*e;b[5]=a[5]*e;b[6]=a[6]*e;b[8]=a[8]*c;b[9]=a[9]*c;b[10]=a[10]*c;return this},translate:function(a){var b=this.elements,c=a.x,d=a.y,a=a.z;b[12]=b[0]*c+b[4]*d+b[8]*a+b[12];b[13]=b[1]*c+b[5]*d+b[9]*a+b[13];b[14]=b[2]*c+b[6]*
d+b[10]*a+b[14];b[15]=b[3]*c+b[7]*d+b[11]*a+b[15];return this},rotateX:function(a){var b=this.elements,c=b[4],d=b[5],e=b[6],f=b[7],g=b[8],h=b[9],j=b[10],l=b[11],k=Math.cos(a),a=Math.sin(a);b[4]=k*c+a*g;b[5]=k*d+a*h;b[6]=k*e+a*j;b[7]=k*f+a*l;b[8]=k*g-a*c;b[9]=k*h-a*d;b[10]=k*j-a*e;b[11]=k*l-a*f;return this},rotateY:function(a){var b=this.elements,c=b[0],d=b[1],e=b[2],f=b[3],g=b[8],h=b[9],j=b[10],l=b[11],k=Math.cos(a),a=Math.sin(a);b[0]=k*c-a*g;b[1]=k*d-a*h;b[2]=k*e-a*j;b[3]=k*f-a*l;b[8]=k*g+a*c;b[9]=
k*h+a*d;b[10]=k*j+a*e;b[11]=k*l+a*f;return this},rotateZ:function(a){var b=this.elements,c=b[0],d=b[1],e=b[2],f=b[3],g=b[4],h=b[5],j=b[6],l=b[7],k=Math.cos(a),a=Math.sin(a);b[0]=k*c+a*g;b[1]=k*d+a*h;b[2]=k*e+a*j;b[3]=k*f+a*l;b[4]=k*g-a*c;b[5]=k*h-a*d;b[6]=k*j-a*e;b[7]=k*l-a*f;return this},rotateByAxis:function(a,b){var c=this.elements;if(a.x===1&&a.y===0&&a.z===0)return this.rotateX(b);if(a.x===0&&a.y===1&&a.z===0)return this.rotateY(b);if(a.x===0&&a.y===0&&a.z===1)return this.rotateZ(b);var d=a.x,
e=a.y,f=a.z,g=Math.sqrt(d*d+e*e+f*f),d=d/g,e=e/g,f=f/g,g=d*d,h=e*e,j=f*f,l=Math.cos(b),k=Math.sin(b),p=1-l,m=d*e*p,o=d*f*p,p=e*f*p,d=d*k,q=e*k,k=f*k,f=g+(1-g)*l,g=m+k,e=o-q,m=m-k,h=h+(1-h)*l,k=p+d,o=o+q,p=p-d,j=j+(1-j)*l,l=c[0],d=c[1],q=c[2],n=c[3],r=c[4],u=c[5],t=c[6],y=c[7],s=c[8],w=c[9],H=c[10],E=c[11];c[0]=f*l+g*r+e*s;c[1]=f*d+g*u+e*w;c[2]=f*q+g*t+e*H;c[3]=f*n+g*y+e*E;c[4]=m*l+h*r+k*s;c[5]=m*d+h*u+k*w;c[6]=m*q+h*t+k*H;c[7]=m*n+h*y+k*E;c[8]=o*l+p*r+j*s;c[9]=o*d+p*u+j*w;c[10]=o*q+p*t+j*H;c[11]=
o*n+p*y+j*E;return this},scale:function(a){var b=this.elements,c=a.x,d=a.y,a=a.z;b[0]=b[0]*c;b[4]=b[4]*d;b[8]=b[8]*a;b[1]=b[1]*c;b[5]=b[5]*d;b[9]=b[9]*a;b[2]=b[2]*c;b[6]=b[6]*d;b[10]=b[10]*a;b[3]=b[3]*c;b[7]=b[7]*d;b[11]=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,g=a.y,h=a.z,j=e*f,l=e*g;this.set(j*f+c,j*g-d*h,j*h+d*g,0,j*g+d*h,l*g+c,l*h-d*f,0,j*h-
d*g,l*h+d*f,e*h*h+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},makeFrustum:function(a,b,c,d,e,f){var g=this.elements;g[0]=2*e/(b-a);g[4]=0;g[8]=(b+a)/(b-a);g[12]=0;g[1]=0;g[5]=2*e/(d-c);g[9]=(d+c)/(d-c);g[13]=0;g[2]=0;g[6]=0;g[10]=-(f+e)/(f-e);g[14]=-2*f*e/(f-e);g[3]=0;g[7]=0;g[11]=-1;g[15]=0;return this},makePerspective:function(a,b,c,d){var a=c*Math.tan(a*Math.PI/360),e=-a;return this.makeFrustum(e*b,a*b,e,a,c,d)},makeOrthographic:function(a,
b,c,d,e,f){var g=this.elements,h=b-a,j=c-d,l=f-e;g[0]=2/h;g[4]=0;g[8]=0;g[12]=-((b+a)/h);g[1]=0;g[5]=2/j;g[9]=0;g[13]=-((c+d)/j);g[2]=0;g[6]=0;g[10]=-2/l;g[14]=-((f+e)/l);g[3]=0;g[7]=0;g[11]=0;g[15]=1;return this},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.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;THREE.Matrix4.__m1=new THREE.Matrix4;
THREE.Matrix4.__m2=new THREE.Matrix4;
THREE.Object3D=function(){this.id=THREE.Object3DCount++;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.Vector3;this.eulerOrder="XYZ";this.scale=new THREE.Vector3(1,1,1);this.flipSided=this.doubleSided=false;this.renderDepth=null;this.rotationAutoUpdate=true;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixWorldNeedsUpdate=this.matrixAutoUpdate=
true;this.quaternion=new THREE.Quaternion;this.useQuaternion=false;this.boundRadius=0;this.boundRadiusScale=1;this.visible=true;this.receiveShadow=this.castShadow=false;this.frustumCulled=true;this._vector=new THREE.Vector3};
THREE.Object3D.prototype={constructor:THREE.Object3D,applyMatrix:function(a){this.matrix.multiply(a,this.matrix);this.scale.getScaleFromMatrix(this.matrix);this.rotation.getRotationFromMatrix(this.matrix,this.scale);this.position.getPositionFromMatrix(this.matrix)},translate:function(a,b){this.matrix.rotateAxis(b);this.position.addSelf(b.multiplyScalar(a))},translateX:function(a){this.translate(a,this._vector.set(1,0,0))},translateY:function(a){this.translate(a,this._vector.set(0,1,0))},translateZ:function(a){this.translate(a,
this._vector.set(0,0,1))},lookAt:function(a){this.matrix.lookAt(a,this.position,this.up);this.rotationAutoUpdate&&this.rotation.getRotationFromMatrix(this.matrix)},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){a.parent!==void 0&&a.parent.remove(a);a.parent=this;this.children.push(a);for(var b=this;b.parent!==void 0;)b=b.parent;b!==void 0&&b instanceof THREE.Scene&&b.__addObject(a)}},remove:function(a){var b=
this.children.indexOf(a);if(b!==-1){a.parent=void 0;this.children.splice(b,1);for(b=this;b.parent!==void 0;)b=b.parent;b!==void 0&&b instanceof THREE.Scene&&b.__removeObject(a)}},getChildByName:function(a,b){var c,d,e;c=0;for(d=this.children.length;c=0&&f>=0&&g>=0&&h>=0)return true;if(e<0&&f<0||g<0&&h<0)return false;e<0?c=Math.max(c,e/(e-f)):f<0&&(d=Math.min(d,e/(e-f)));g<0?c=Math.max(c,g/(g-h)):h<0&&(d=Math.min(d,g/(g-h)));if(dg&&h.positionScreen.z0)){ea=l[j-2];J.copy(F.positionScreen);K.copy(ea.positionScreen);if(d(J,K)){J.multiplyScalar(1/J.w);K.multiplyScalar(1/K.w);$=u[r]=u[r]||new THREE.RenderableLine;r++;n=$;n.v1.positionScreen.copy(J);
n.v2.positionScreen.copy(K);n.z=Math.max(J.z,K.z);n.material=O.material;w.elements.push(n)}}}}}a=0;for(H=w.sprites.length;a0&&E.z<1){g=s[y]=s[y]||new THREE.RenderableParticle;y++;t=g;t.x=E.x/E.w;t.y=E.y/E.w;t.z=E.z;t.rotation=O.rotation.z;t.scale.x=O.scale.x*Math.abs(t.x-(E.x+e.projectionMatrix.elements[0])/(E.w+e.projectionMatrix.elements[12]));
t.scale.y=O.scale.y*Math.abs(t.y-(E.y+e.projectionMatrix.elements[5])/(E.w+e.projectionMatrix.elements[13]));t.material=O.material;w.elements.push(t)}}}f&&w.elements.sort(c);return w}};THREE.Quaternion=function(a,b,c,d){this.x=a||0;this.y=b||0;this.z=c||0;this.w=d!==void 0?d:1};
THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w;return this},setFromEuler:function(a){var b=Math.PI/360,c=a.x*b,d=a.y*b,e=a.z*b,a=Math.cos(d),d=Math.sin(d),b=Math.cos(-e),e=Math.sin(-e),f=Math.cos(c),c=Math.sin(c),g=a*b,h=d*e;this.w=g*f-h*c;this.x=g*c+h*f;this.y=d*b*f+a*e*c;this.z=a*e*f-d*b*c;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);return this},setFromRotationMatrix:function(a){var b=Math.pow(a.determinant(),1/3);this.w=Math.sqrt(Math.max(0,b+a.elements[0]+a.elements[5]+a.elements[10]))/2;this.x=Math.sqrt(Math.max(0,b+a.elements[0]-a.elements[5]-a.elements[10]))/2;this.y=Math.sqrt(Math.max(0,b-a.elements[0]+a.elements[5]-a.elements[10]))/2;this.z=Math.sqrt(Math.max(0,b-a.elements[0]-a.elements[5]+a.elements[10]))/2;this.x=a.elements[6]-a.elements[9]<0?-Math.abs(this.x):
Math.abs(this.x);this.y=a.elements[8]-a.elements[2]<0?-Math.abs(this.y):Math.abs(this.y);this.z=a.elements[1]-a.elements[4]<0?-Math.abs(this.z):Math.abs(this.z);this.normalize();return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x=this.x*-1;this.y=this.y*-1;this.z=this.z*-1;return this},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=
Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);if(a===0)this.w=this.z=this.y=this.x=0;else{a=1/a;this.x=this.x*a;this.y=this.y*a;this.z=this.z*a;this.w=this.w*a}return this},multiply:function(a,b){this.x=a.x*b.w+a.y*b.z-a.z*b.y+a.w*b.x;this.y=-a.x*b.z+a.y*b.w+a.z*b.x+a.w*b.y;this.z=a.x*b.y-a.y*b.x+a.z*b.w+a.w*b.z;this.w=-a.x*b.x-a.y*b.y-a.z*b.z+a.w*b.w;return this},multiplySelf:function(a){var b=this.x,c=this.y,d=this.z,e=this.w,f=a.x,g=a.y,h=a.z,a=a.w;this.x=b*a+e*f+c*h-d*g;this.y=
c*a+e*g+d*f-b*h;this.z=d*a+e*h+b*g-c*f;this.w=e*a-b*f-c*g-d*h;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,e=a.z,f=this.x,g=this.y,h=this.z,j=this.w,l=j*c+g*e-h*d,k=j*d+h*c-f*e,p=j*e+f*d-g*c,c=-f*c-g*d-h*e;b.x=l*j+c*-f+k*-h-p*-g;b.y=k*j+c*-g+p*-f-l*-h;b.z=p*j+c*-h+l*-g-k*-f;return b},clone:function(){return new THREE.Quaternion(this.x,this.y,this.z,this.w)}};
THREE.Quaternion.slerp=function(a,b,c,d){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(e<0){c.w=-b.w;c.x=-b.x;c.y=-b.y;c.z=-b.z;e=-e}else c.copy(b);if(Math.abs(e)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var f=Math.acos(e),e=Math.sqrt(1-e*e);if(Math.abs(e)<0.001){c.w=0.5*(a.w+b.w);c.x=0.5*(a.x+b.x);c.y=0.5*(a.y+b.y);c.z=0.5*(a.z+b.z);return c}b=Math.sin((1-d)*f)/e;d=Math.sin(d*f)/e;c.w=a.w*b+c.w*d;c.x=a.x*b+c.x*d;c.y=a.y*b+c.y*d;c.z=a.z*b+c.z*d;return c};THREE.Vertex=function(){console.warn("THREE.Vertex has been DEPRECATED. Use THREE.Vector3 instead.")};
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=f;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;b0){var a;a=this.vertices[0];this.boundingBox.min.copy(a);this.boundingBox.max.copy(a);for(var b=this.boundingBox.min,c=this.boundingBox.max,d=1,e=this.vertices.length;dc.x)c.x=
a.x;if(a.yc.y)c.y=a.y;if(a.zc.z)c.z=a.z}}else{this.boundingBox.min.set(0,0,0);this.boundingBox.max.set(0,0,0)}},computeBoundingSphere:function(){if(!this.boundingSphere)this.boundingSphere={radius:0};for(var a,b=0,c=0,d=this.vertices.length;cb&&(b=a)}this.boundingSphere.radius=b},mergeVertices:function(){var a={},b=[],c=[],d,e=Math.pow(10,4),f,g,h;f=0;for(g=this.vertices.length;f0;a--)if(d.indexOf(e["abcd"[a]])!=a){d.splice(a,1);this.faces[f]=new THREE.Face3(d[0],d[1],d[2]);e=0;for(d=this.faceVertexUvs.length;ethis.points.length-2?this.points.length-1:f+1;c[3]=f>this.points.length-3?this.points.length-1:
f+2;l=this.points[c[0]];k=this.points[c[1]];p=this.points[c[2]];m=this.points[c[3]];h=g*g;j=g*h;d.x=b(l.x,k.x,p.x,m.x,g,h,j);d.y=b(l.y,k.y,p.y,m.y,g,h,j);d.z=b(l.z,k.z,p.z,m.z,g,h,j);return d};this.getControlPointsArray=function(){var a,b,c=this.points.length,d=[];for(a=0;a1&&(K=new THREE.MeshFaceMaterial);
a=new THREE.Mesh(J,K);a.name=m;if(t){a.matrixAutoUpdate=false;a.matrix.set(t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8],t[9],t[10],t[11],t[12],t[13],t[14],t[15])}else{a.position.set(w[0],w[1],w[2]);if(E){a.quaternion.set(E[0],E[1],E[2],E[3]);a.useQuaternion=true}else a.rotation.set(H[0],H[1],H[2]);a.scale.set(z[0],z[1],z[2])}a.visible=u.visible;a.doubleSided=u.doubleSided;a.castShadow=u.castShadow;a.receiveShadow=u.receiveShadow;C.scene.add(a);C.objects[m]=a}}else{w=u.position;H=u.rotation;E=u.quaternion;
z=u.scale;E=0;a=new THREE.Object3D;a.name=m;a.position.set(w[0],w[1],w[2]);if(E){a.quaternion.set(E[0],E[1],E[2],E[3]);a.useQuaternion=true}else a.rotation.set(H[0],H[1],H[2]);a.scale.set(z[0],z[1],z[2]);a.visible=u.visible!==void 0?u.visible:false;C.scene.add(a);C.objects[m]=a;C.empties[m]=a}}}function f(a){return function(b){C.geometries[a]=b;e();G=G-1;j.onLoadComplete();h()}}function g(a){return function(b){C.geometries[a]=b}}function h(){j.callbackProgress({totalModels:T,totalTextures:U,loadedModels:T-
G,loadedTextures:U-i},C);j.onLoadProgress();G==0&&i==0&&b(C)}var j=this,l=THREE.Loader.prototype.extractUrlBase(c),k,p,m,o,q,n,r,u,t,y,s,w,H,E,z,v,A,J,K,R,P,D,M,G,i,T,U,C;D=a;c=new THREE.BinaryLoader;M=new THREE.JSONLoader;i=G=0;C={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},empties:{}};if(D.transform){a=D.transform.position;y=D.transform.rotation;v=D.transform.scale;a&&C.scene.position.set(a[0],a[1],a[2]);y&&C.scene.rotation.set(y[0],y[1],
y[2]);v&&C.scene.scale.set(v[0],v[1],v[2]);if(a||y||v){C.scene.updateMatrix();C.scene.updateMatrixWorld()}}a=function(){i=i-1;h();j.onLoadComplete()};for(q in D.cameras){v=D.cameras[q];v.type=="perspective"?R=new THREE.PerspectiveCamera(v.fov,v.aspect,v.near,v.far):v.type=="ortho"&&(R=new THREE.OrthographicCamera(v.left,v.right,v.top,v.bottom,v.near,v.far));w=v.position;y=v.target;v=v.up;R.position.set(w[0],w[1],w[2]);R.target=new THREE.Vector3(y[0],y[1],y[2]);v&&R.up.set(v[0],v[1],v[2]);C.cameras[q]=
R}for(o in D.lights){y=D.lights[o];q=y.color!==void 0?y.color:16777215;R=y.intensity!==void 0?y.intensity:1;if(y.type=="directional"){w=y.direction;s=new THREE.DirectionalLight(q,R);s.position.set(w[0],w[1],w[2]);s.position.normalize()}else if(y.type=="point"){w=y.position;s=y.distance;s=new THREE.PointLight(q,R,s);s.position.set(w[0],w[1],w[2])}else y.type=="ambient"&&(s=new THREE.AmbientLight(q));C.scene.add(s);C.lights[o]=s}for(n in D.fogs){o=D.fogs[n];o.type=="linear"?P=new THREE.Fog(0,o.near,
o.far):o.type=="exp2"&&(P=new THREE.FogExp2(0,o.density));v=o.color;P.color.setRGB(v[0],v[1],v[2]);C.fogs[n]=P}if(C.cameras&&D.defaults.camera)C.currentCamera=C.cameras[D.defaults.camera];if(C.fogs&&D.defaults.fog)C.scene.fog=C.fogs[D.defaults.fog];v=D.defaults.bgcolor;C.bgColor=new THREE.Color;C.bgColor.setRGB(v[0],v[1],v[2]);C.bgColorAlpha=D.defaults.bgalpha;for(k in D.geometries){n=D.geometries[k];if(n.type=="bin_mesh"||n.type=="ascii_mesh"){G=G+1;j.onLoadStart()}}T=G;for(k in D.geometries){n=
D.geometries[k];if(n.type=="cube"){J=new THREE.CubeGeometry(n.width,n.height,n.depth,n.segmentsWidth,n.segmentsHeight,n.segmentsDepth,null,n.flipped,n.sides);C.geometries[k]=J}else if(n.type=="plane"){J=new THREE.PlaneGeometry(n.width,n.height,n.segmentsWidth,n.segmentsHeight);C.geometries[k]=J}else if(n.type=="sphere"){J=new THREE.SphereGeometry(n.radius,n.segmentsWidth,n.segmentsHeight);C.geometries[k]=J}else if(n.type=="cylinder"){J=new THREE.CylinderGeometry(n.topRad,n.botRad,n.height,n.radSegs,
n.heightSegs);C.geometries[k]=J}else if(n.type=="torus"){J=new THREE.TorusGeometry(n.radius,n.tube,n.segmentsR,n.segmentsT);C.geometries[k]=J}else if(n.type=="icosahedron"){J=new THREE.IcosahedronGeometry(n.radius,n.subdivisions);C.geometries[k]=J}else if(n.type=="bin_mesh")c.load(d(n.url,D.urlBaseType),f(k));else if(n.type=="ascii_mesh")M.load(d(n.url,D.urlBaseType),f(k));else if(n.type=="embedded_mesh"){n=D.embeds[n.id];n.metadata=D.metadata;n&&M.createModel(n,g(k),"")}}for(r in D.textures){k=D.textures[r];
if(k.url instanceof Array){i=i+k.url.length;for(n=0;n1){g=g[1];c[g]||(c[g]={start:Infinity,end:-Infinity});var h=c[g];if(eh.end)h.end=e;b||(b=g)}}a.firstAnimation=b};
THREE.MorphAnimMesh.prototype.setAnimationLabel=function(a,b,c){if(!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];if(c){this.setFrameRange(c.start,c.end);this.duration=1E3*((c.end-c.start)/b);this.time=0}else console.warn("animation["+a+"] undefined")};
THREE.MorphAnimMesh.prototype.updateAnimation=function(a){var b=this.duration/this.length;this.time=this.time+this.direction*a;if(this.mirroredLoop){if(this.time>this.duration||this.time<0){this.direction=this.direction*-1;if(this.time>this.duration){this.time=this.duration;this.directionBackwards=true}if(this.time<0){this.time=0;this.directionBackwards=false}}}else{this.time=this.time%this.duration;if(this.time<0)this.time=this.time+this.duration}a=this.startKeyframe+THREE.Math.clamp(Math.floor(this.time/
b),0,this.length-1);if(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.Ribbon=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.material=b};
THREE.Ribbon.prototype=new THREE.Object3D;THREE.Ribbon.prototype.constructor=THREE.Ribbon;THREE.LOD=function(){THREE.Object3D.call(this);this.LODs=[]};THREE.LOD.prototype=new THREE.Object3D;THREE.LOD.prototype.constructor=THREE.LOD;THREE.LOD.prototype.supr=THREE.Object3D.prototype;THREE.LOD.prototype.addLevel=function(a,b){b===void 0&&(b=0);for(var b=Math.abs(b),c=0;c1){a.matrixWorldInverse.getInverse(a.matrixWorld);a=a.matrixWorldInverse;a=-(a.elements[2]*this.matrixWorld.elements[12]+a.elements[6]*this.matrixWorld.elements[13]+a.elements[10]*this.matrixWorld.elements[14]+a.elements[14]);this.LODs[0].object3D.visible=true;for(var b=1;b=this.LODs[b].visibleAtDistance){this.LODs[b-1].object3D.visible=false;this.LODs[b].object3D.visible=true}else break;for(;b>1);n=m.y*f+f-(o.offsetHeight>>1);o.style.left=q+"px";o.style.top=n+"px";o.style.zIndex=Math.abs(Math.floor((1-m.z)*d.far/d.near));g&&(o.style[g]="scale("+m.scale.x*e+","+m.scale.y*f+")")}}}};
THREE.CanvasRenderer=function(a){function b(a){if(t!=a)n.globalAlpha=t=a}function c(a){if(y!=a){switch(a){case THREE.NormalBlending:n.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:n.globalCompositeOperation="lighter"}y=a}}function d(a){if(s!=a)n.strokeStyle=s=a}function e(a){if(w!=a)n.fillStyle=w=a}console.log("THREE.CanvasRenderer",THREE.REVISION);var a=a||{},f=this,g,h,j,l=new THREE.Projector,k=a.canvas!==void 0?a.canvas:document.createElement("canvas"),p,m,o,q,n=k.getContext("2d"),
r=new THREE.Color(0),u=0,t=1,y=0,s=null,w=null,H=null,E=null,z=null,v,A,J,K,R=new THREE.RenderableVertex,P=new THREE.RenderableVertex,D,M,G,i,T,U,C,Y,F,ea,fa,ia,O=new THREE.Color,Q=new THREE.Color,Z=new THREE.Color,$=new THREE.Color,ha=new THREE.Color,Ma=[],Ka=[],Ra,La,Sa,Na,Kb,lb,gb,Lb,hb,Cb,Wa=new THREE.Rectangle,Ba=new THREE.Rectangle,xa=new THREE.Rectangle,$a=false,aa=new THREE.Color,Ta=new THREE.Color,Qa=new THREE.Color,oa=new THREE.Vector3,ib,Db,Sc,ab,pc,Bc,a=16;ib=document.createElement("canvas");
ib.width=ib.height=2;Db=ib.getContext("2d");Db.fillStyle="rgba(0,0,0,1)";Db.fillRect(0,0,2,2);Sc=Db.getImageData(0,0,2,2);ab=Sc.data;pc=document.createElement("canvas");pc.width=pc.height=a;Bc=pc.getContext("2d");Bc.translate(-a/2,-a/2);Bc.scale(a,a);a--;this.domElement=k;this.sortElements=this.sortObjects=this.autoClear=true;this.info={render:{vertices:0,faces:0}};this.setSize=function(a,b){p=a;m=b;o=Math.floor(p/2);q=Math.floor(m/2);k.width=p;k.height=m;Wa.set(-o,-q,o,q);Ba.set(-o,-q,o,q);t=1;y=
0;z=E=H=w=s=null};this.setClearColor=function(a,b){r.copy(a);u=b!==void 0?b:1;Ba.set(-o,-q,o,q)};this.setClearColorHex=function(a,b){r.setHex(a);u=b!==void 0?b:1;Ba.set(-o,-q,o,q)};this.clear=function(){n.setTransform(1,0,0,-1,o,q);if(!Ba.isEmpty()){Ba.minSelf(Wa);Ba.inflate(2);u<1&&n.clearRect(Math.floor(Ba.getX()),Math.floor(Ba.getY()),Math.floor(Ba.getWidth()),Math.floor(Ba.getHeight()));if(u>0){c(THREE.NormalBlending);b(1);e("rgba("+Math.floor(r.r*255)+","+Math.floor(r.g*255)+","+Math.floor(r.b*
255)+","+u+")");n.fillRect(Math.floor(Ba.getX()),Math.floor(Ba.getY()),Math.floor(Ba.getWidth()),Math.floor(Ba.getHeight()))}Ba.empty()}};this.render=function(a,k){function m(a){var b,c,d,e;aa.setRGB(0,0,0);Ta.setRGB(0,0,0);Qa.setRGB(0,0,0);b=0;for(c=a.length;b>1;m=k.height>>1;g=f.scale.x*o;j=f.scale.y*q;i=g*l;h=j*m;xa.set(a.x-i,a.y-h,a.x+i,a.y+h);if(Wa.intersects(xa)){n.save();n.translate(a.x,a.y);n.rotate(-f.rotation);n.scale(g,-j);n.translate(-l,-m);n.drawImage(k,0,0);n.restore()}}}else if(g instanceof THREE.ParticleCanvasMaterial){i=f.scale.x*o;h=f.scale.y*q;xa.set(a.x-i,a.y-h,a.x+i,a.y+h);if(Wa.intersects(xa)){d(g.color.getContextStyle());
e(g.color.getContextStyle());n.save();n.translate(a.x,a.y);n.rotate(-f.rotation);n.scale(i,h);g.program(n);n.restore()}}}function s(a,e,f,g){b(g.opacity);c(g.blending);n.beginPath();n.moveTo(a.positionScreen.x,a.positionScreen.y);n.lineTo(e.positionScreen.x,e.positionScreen.y);n.closePath();if(g instanceof THREE.LineBasicMaterial){a=g.linewidth;if(H!=a)n.lineWidth=H=a;a=g.linecap;if(E!=a)n.lineCap=E=a;a=g.linejoin;if(z!=a)n.lineJoin=z=a;d(g.color.getContextStyle());n.stroke();xa.inflate(g.linewidth*
2)}}function t(a,d,e,g,h,l,m,n){f.info.render.vertices=f.info.render.vertices+3;f.info.render.faces++;b(n.opacity);c(n.blending);D=a.positionScreen.x;M=a.positionScreen.y;G=d.positionScreen.x;i=d.positionScreen.y;T=e.positionScreen.x;U=e.positionScreen.y;w(D,M,G,i,T,U);if(n instanceof THREE.MeshBasicMaterial)if(n.map){if(n.map.mapping instanceof THREE.UVMapping){Na=m.uvs[0];ad(D,M,G,i,T,U,Na[g].u,Na[g].v,Na[h].u,Na[h].v,Na[l].u,Na[l].v,n.map)}}else if(n.envMap){if(n.envMap.mapping instanceof THREE.SphericalReflectionMapping){a=
k.matrixWorldInverse;oa.copy(m.vertexNormalsWorld[g]);Kb=(oa.x*a.elements[0]+oa.y*a.elements[4]+oa.z*a.elements[8])*0.5+0.5;lb=-(oa.x*a.elements[1]+oa.y*a.elements[5]+oa.z*a.elements[9])*0.5+0.5;oa.copy(m.vertexNormalsWorld[h]);gb=(oa.x*a.elements[0]+oa.y*a.elements[4]+oa.z*a.elements[8])*0.5+0.5;Lb=-(oa.x*a.elements[1]+oa.y*a.elements[5]+oa.z*a.elements[9])*0.5+0.5;oa.copy(m.vertexNormalsWorld[l]);hb=(oa.x*a.elements[0]+oa.y*a.elements[4]+oa.z*a.elements[8])*0.5+0.5;Cb=-(oa.x*a.elements[1]+oa.y*
a.elements[5]+oa.z*a.elements[9])*0.5+0.5;ad(D,M,G,i,T,U,Kb,lb,gb,Lb,hb,Cb,n.envMap)}}else n.wireframe?Mb(n.color,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):Eb(n.color);else if(n instanceof THREE.MeshLambertMaterial)if($a)if(!n.wireframe&&n.shading==THREE.SmoothShading&&m.vertexNormalsWorld.length==3){Q.r=Z.r=$.r=aa.r;Q.g=Z.g=$.g=aa.g;Q.b=Z.b=$.b=aa.b;p(j,m.v1.positionWorld,m.vertexNormalsWorld[0],Q);p(j,m.v2.positionWorld,m.vertexNormalsWorld[1],Z);p(j,m.v3.positionWorld,m.vertexNormalsWorld[2],
$);Q.r=Math.max(0,Math.min(n.color.r*Q.r,1));Q.g=Math.max(0,Math.min(n.color.g*Q.g,1));Q.b=Math.max(0,Math.min(n.color.b*Q.b,1));Z.r=Math.max(0,Math.min(n.color.r*Z.r,1));Z.g=Math.max(0,Math.min(n.color.g*Z.g,1));Z.b=Math.max(0,Math.min(n.color.b*Z.b,1));$.r=Math.max(0,Math.min(n.color.r*$.r,1));$.g=Math.max(0,Math.min(n.color.g*$.g,1));$.b=Math.max(0,Math.min(n.color.b*$.b,1));ha.r=(Z.r+$.r)*0.5;ha.g=(Z.g+$.g)*0.5;ha.b=(Z.b+$.b)*0.5;Sa=Cc(Q,Z,$,ha);gc(D,M,G,i,T,U,0,0,1,0,0,1,Sa)}else{O.r=aa.r;O.g=
aa.g;O.b=aa.b;p(j,m.centroidWorld,m.normalWorld,O);O.r=Math.max(0,Math.min(n.color.r*O.r,1));O.g=Math.max(0,Math.min(n.color.g*O.g,1));O.b=Math.max(0,Math.min(n.color.b*O.b,1));n.wireframe?Mb(O,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):Eb(O)}else n.wireframe?Mb(n.color,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):Eb(n.color);else if(n instanceof THREE.MeshDepthMaterial){Ra=k.near;La=k.far;Q.r=Q.g=Q.b=1-ac(a.positionScreen.z,Ra,La);Z.r=Z.g=Z.b=1-ac(d.positionScreen.z,
Ra,La);$.r=$.g=$.b=1-ac(e.positionScreen.z,Ra,La);ha.r=(Z.r+$.r)*0.5;ha.g=(Z.g+$.g)*0.5;ha.b=(Z.b+$.b)*0.5;Sa=Cc(Q,Z,$,ha);gc(D,M,G,i,T,U,0,0,1,0,0,1,Sa)}else if(n instanceof THREE.MeshNormalMaterial){O.r=hc(m.normalWorld.x);O.g=hc(m.normalWorld.y);O.b=hc(m.normalWorld.z);n.wireframe?Mb(O,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):Eb(O)}}function u(a,d,e,g,h,l,n,m,o){f.info.render.vertices=f.info.render.vertices+4;f.info.render.faces++;b(m.opacity);c(m.blending);if(m.map||m.envMap){t(a,
d,g,0,1,3,n,m,o);t(h,e,l,1,2,3,n,m,o)}else{D=a.positionScreen.x;M=a.positionScreen.y;G=d.positionScreen.x;i=d.positionScreen.y;T=e.positionScreen.x;U=e.positionScreen.y;C=g.positionScreen.x;Y=g.positionScreen.y;F=h.positionScreen.x;ea=h.positionScreen.y;fa=l.positionScreen.x;ia=l.positionScreen.y;if(m instanceof THREE.MeshBasicMaterial){y(D,M,G,i,T,U,C,Y);m.wireframe?Mb(m.color,m.wireframeLinewidth,m.wireframeLinecap,m.wireframeLinejoin):Eb(m.color)}else if(m instanceof THREE.MeshLambertMaterial)if($a)if(!m.wireframe&&
m.shading==THREE.SmoothShading&&n.vertexNormalsWorld.length==4){Q.r=Z.r=$.r=ha.r=aa.r;Q.g=Z.g=$.g=ha.g=aa.g;Q.b=Z.b=$.b=ha.b=aa.b;p(j,n.v1.positionWorld,n.vertexNormalsWorld[0],Q);p(j,n.v2.positionWorld,n.vertexNormalsWorld[1],Z);p(j,n.v4.positionWorld,n.vertexNormalsWorld[3],$);p(j,n.v3.positionWorld,n.vertexNormalsWorld[2],ha);Q.r=Math.max(0,Math.min(m.color.r*Q.r,1));Q.g=Math.max(0,Math.min(m.color.g*Q.g,1));Q.b=Math.max(0,Math.min(m.color.b*Q.b,1));Z.r=Math.max(0,Math.min(m.color.r*Z.r,1));Z.g=
Math.max(0,Math.min(m.color.g*Z.g,1));Z.b=Math.max(0,Math.min(m.color.b*Z.b,1));$.r=Math.max(0,Math.min(m.color.r*$.r,1));$.g=Math.max(0,Math.min(m.color.g*$.g,1));$.b=Math.max(0,Math.min(m.color.b*$.b,1));ha.r=Math.max(0,Math.min(m.color.r*ha.r,1));ha.g=Math.max(0,Math.min(m.color.g*ha.g,1));ha.b=Math.max(0,Math.min(m.color.b*ha.b,1));Sa=Cc(Q,Z,$,ha);w(D,M,G,i,C,Y);gc(D,M,G,i,C,Y,0,0,1,0,0,1,Sa);w(F,ea,T,U,fa,ia);gc(F,ea,T,U,fa,ia,1,0,1,1,0,1,Sa)}else{O.r=aa.r;O.g=aa.g;O.b=aa.b;p(j,n.centroidWorld,
n.normalWorld,O);O.r=Math.max(0,Math.min(m.color.r*O.r,1));O.g=Math.max(0,Math.min(m.color.g*O.g,1));O.b=Math.max(0,Math.min(m.color.b*O.b,1));y(D,M,G,i,T,U,C,Y);m.wireframe?Mb(O,m.wireframeLinewidth,m.wireframeLinecap,m.wireframeLinejoin):Eb(O)}else{y(D,M,G,i,T,U,C,Y);m.wireframe?Mb(m.color,m.wireframeLinewidth,m.wireframeLinecap,m.wireframeLinejoin):Eb(m.color)}else if(m instanceof THREE.MeshNormalMaterial){O.r=hc(n.normalWorld.x);O.g=hc(n.normalWorld.y);O.b=hc(n.normalWorld.z);y(D,M,G,i,T,U,C,
Y);m.wireframe?Mb(O,m.wireframeLinewidth,m.wireframeLinecap,m.wireframeLinejoin):Eb(O)}else if(m instanceof THREE.MeshDepthMaterial){Ra=k.near;La=k.far;Q.r=Q.g=Q.b=1-ac(a.positionScreen.z,Ra,La);Z.r=Z.g=Z.b=1-ac(d.positionScreen.z,Ra,La);$.r=$.g=$.b=1-ac(g.positionScreen.z,Ra,La);ha.r=ha.g=ha.b=1-ac(e.positionScreen.z,Ra,La);Sa=Cc(Q,Z,$,ha);w(D,M,G,i,C,Y);gc(D,M,G,i,C,Y,0,0,1,0,0,1,Sa);w(F,ea,T,U,fa,ia);gc(F,ea,T,U,fa,ia,1,0,1,1,0,1,Sa)}}}function w(a,b,c,d,e,f){n.beginPath();n.moveTo(a,b);n.lineTo(c,
d);n.lineTo(e,f);n.lineTo(a,b);n.closePath()}function y(a,b,c,d,e,f,g,i){n.beginPath();n.moveTo(a,b);n.lineTo(c,d);n.lineTo(e,f);n.lineTo(g,i);n.lineTo(a,b);n.closePath()}function Mb(a,b,c,e){if(H!=b)n.lineWidth=H=b;if(E!=c)n.lineCap=E=c;if(z!=e)n.lineJoin=z=e;d(a.getContextStyle());n.stroke();xa.inflate(b*2)}function Eb(a){e(a.getContextStyle());n.fill()}function ad(a,b,c,d,f,g,i,h,j,k,l,m,p){if(p.image.width!=0){if(p.needsUpdate==true||Ma[p.id]==void 0){var o=p.wrapS==THREE.RepeatWrapping,q=p.wrapT==
THREE.RepeatWrapping;Ma[p.id]=n.createPattern(p.image,o&&q?"repeat":o&&!q?"repeat-x":!o&&q?"repeat-y":"no-repeat");p.needsUpdate=false}e(Ma[p.id]);var o=p.offset.x/p.repeat.x,q=p.offset.y/p.repeat.y,Db=p.image.width*p.repeat.x,r=p.image.height*p.repeat.y,i=(i+o)*Db,h=(h+q)*r,c=c-a,d=d-b,f=f-a,g=g-b,j=(j+o)*Db-i,k=(k+q)*r-h,l=(l+o)*Db-i,m=(m+q)*r-h,o=j*m-l*k;if(o==0){if(Ka[p.id]===void 0){b=document.createElement("canvas");b.width=p.image.width;b.height=p.image.height;b=b.getContext("2d");b.drawImage(p.image,
0,0);Ka[p.id]=b.getImageData(0,0,p.image.width,p.image.height).data}b=Ka[p.id];i=(Math.floor(i)+Math.floor(h)*p.image.width)*4;O.setRGB(b[i]/255,b[i+1]/255,b[i+2]/255);Eb(O)}else{o=1/o;p=(m*c-k*f)*o;k=(m*d-k*g)*o;c=(j*f-l*c)*o;d=(j*g-l*d)*o;a=a-p*i-c*h;i=b-k*i-d*h;n.save();n.transform(p,k,c,d,a,i);n.fill();n.restore()}}}function gc(a,b,c,d,e,f,g,i,h,j,k,l,m){var p,o;p=m.width-1;o=m.height-1;g=g*p;i=i*o;c=c-a;d=d-b;e=e-a;f=f-b;h=h*p-g;j=j*o-i;k=k*p-g;l=l*o-i;o=1/(h*l-k*j);p=(l*c-j*e)*o;j=(l*d-j*f)*
o;c=(h*e-k*c)*o;d=(h*f-k*d)*o;a=a-p*g-c*i;b=b-j*g-d*i;n.save();n.transform(p,j,c,d,a,b);n.clip();n.drawImage(m,0,0);n.restore()}function Cc(a,b,c,d){var e=~~(a.r*255),f=~~(a.g*255),a=~~(a.b*255),g=~~(b.r*255),i=~~(b.g*255),b=~~(b.b*255),h=~~(c.r*255),j=~~(c.g*255),c=~~(c.b*255),k=~~(d.r*255),l=~~(d.g*255),d=~~(d.b*255);ab[0]=e<0?0:e>255?255:e;ab[1]=f<0?0:f>255?255:f;ab[2]=a<0?0:a>255?255:a;ab[4]=g<0?0:g>255?255:g;ab[5]=i<0?0:i>255?255:i;ab[6]=b<0?0:b>255?255:b;ab[8]=h<0?0:h>255?255:h;ab[9]=j<0?0:
j>255?255:j;ab[10]=c<0?0:c>255?255:c;ab[12]=k<0?0:k>255?255:k;ab[13]=l<0?0:l>255?255:l;ab[14]=d<0?0:d>255?255:d;Db.putImageData(Sc,0,0);Bc.drawImage(ib,0,0);return pc}function ac(a,b,c){a=(a-b)/(c-b);return a*a*(3-2*a)}function hc(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}function Nb(a,b){var c=b.x-a.x,d=b.y-a.y,e=c*c+d*d;if(e!=0){e=1/Math.sqrt(e);c=c*e;d=d*e;b.x=b.x+c;b.y=b.y+d;a.x=a.x-c;a.y=a.y-d}}var Dc,bd,Ha,eb;this.autoClear?this.clear():n.setTransform(1,0,0,-1,o,q);f.info.render.vertices=0;f.info.render.faces=
0;g=l.projectScene(a,k,this.sortElements);h=g.elements;j=g.lights;($a=j.length>0)&&m(j);Dc=0;for(bd=h.length;Dc1?1:a}console.log("THREE.SVGRenderer",THREE.REVISION);var d=this,e,f,g,h=new THREE.Projector,j=document.createElementNS("http://www.w3.org/2000/svg","svg"),l,k,p,m,o,q,n,r,u=new THREE.Rectangle,t=new THREE.Rectangle,y=false,s=new THREE.Color,w=new THREE.Color,H=new THREE.Color,E=new THREE.Color,
z,v=new THREE.Vector3,A=[],J=[],K,R,P,D=1;this.domElement=j;this.sortElements=this.sortObjects=this.autoClear=true;this.info={render:{vertices:0,faces:0}};this.setQuality=function(a){switch(a){case "high":D=1;break;case "low":D=0}};this.setSize=function(a,b){l=a;k=b;p=l/2;m=k/2;j.setAttribute("viewBox",-p+" "+-m+" "+l+" "+k);j.setAttribute("width",l);j.setAttribute("height",k);u.set(-p,-m,p,m)};this.clear=function(){for(;j.childNodes.length>0;)j.removeChild(j.childNodes[0])};this.render=function(k,
l){var i,v,A,C;this.autoClear&&this.clear();d.info.render.vertices=0;d.info.render.faces=0;e=h.projectScene(k,l,this.sortElements);f=e.elements;g=e.lights;P=R=0;if(y=g.length>0){w.setRGB(0,0,0);H.setRGB(0,0,0);E.setRGB(0,0,0);i=0;for(v=g.length;i