Section 1
//FPS (com.alternativagame.admin.FPS)
package com.alternativagame.admin {
import flash.events.*;
import flash.geom.*;
import flash.display.*;
import flash.text.*;
import flash.utils.*;
import flash.system.*;
public final class FPS extends Sprite {
private var currentY:int;
private var diagramTimer:int;
private var tfTimer:int;
private var downloadedBytes:uint;// = 0
private var socketOutBytes:uint;// = 0
private var socketOutLast:uint;// = 0
private var socketInBytes:uint;// = 0
private var mem:TextField;
private var skn:TextField;
private var diagram:BitmapData;
private var socketOut:TextField;
private var skins:int;// = -1
private var fps:TextField;
private var socketInLast:uint;// = 0
private var tfDelay:int;// = 0
private var socketIn:TextField;
private var dwl:TextField;
private var skinsChanged:int;// = 0
private static const maxMemory:uint = 41943040;
private static const diagramWidth:uint = 60;
private static const tfDelayMax:int = 10;
private static const maxSocket:uint = 4200;
private static const diagramHeight:uint = 40;
private static var instance:FPS;
public function FPS(_arg1:DisplayObjectContainer){
var _local2:Bitmap;
fps = new TextField();
mem = new TextField();
skn = new TextField();
dwl = new TextField();
socketIn = new TextField();
socketOut = new TextField();
super();
if (instance == null){
mouseEnabled = false;
mouseChildren = false;
_arg1.addChild(this);
fps.defaultTextFormat = new TextFormat("Tahoma", 10, 0xCCCCCC);
fps.autoSize = TextFieldAutoSize.LEFT;
fps.text = ("FPS: " + Number(stage.frameRate).toFixed(2));
fps.selectable = false;
fps.x = (-(diagramWidth) - 2);
addChild(fps);
mem.defaultTextFormat = new TextFormat("Tahoma", 10, 0xCCCC00);
mem.autoSize = TextFieldAutoSize.LEFT;
mem.text = ("MEM: " + bytesToString(System.totalMemory));
mem.selectable = false;
mem.x = (-(diagramWidth) - 2);
mem.y = 10;
addChild(mem);
currentY = 20;
skn.defaultTextFormat = new TextFormat("Tahoma", 10, 0xFF6600);
skn.autoSize = TextFieldAutoSize.LEFT;
skn.text = ("MEM: " + bytesToString(System.totalMemory));
skn.selectable = false;
skn.x = (-(diagramWidth) - 2);
dwl.defaultTextFormat = new TextFormat("Tahoma", 10, 0xCC00CC);
dwl.autoSize = TextFieldAutoSize.LEFT;
dwl.selectable = false;
dwl.x = (-(diagramWidth) - 2);
socketIn.defaultTextFormat = new TextFormat("Tahoma", 10, 0xFF00);
socketIn.autoSize = TextFieldAutoSize.LEFT;
socketIn.selectable = false;
socketIn.x = (-(diagramWidth) - 2);
socketOut.defaultTextFormat = new TextFormat("Tahoma", 10, 26367);
socketOut.autoSize = TextFieldAutoSize.LEFT;
socketOut.selectable = false;
socketOut.x = (-(diagramWidth) - 2);
diagram = new BitmapData(diagramWidth, diagramHeight, true, 553648127);
_local2 = new Bitmap(diagram);
_local2.y = (currentY + 4);
_local2.x = -(diagramWidth);
addChildAt(_local2, 0);
addEventListener(Event.ENTER_FRAME, onEnterFrame);
stage.addEventListener(Event.RESIZE, onResize);
onResize();
diagramTimer = getTimer();
tfTimer = getTimer();
} else {
throw (new Error("FPS is a Singleton. Use FPS.init to create FPS instance"));
};
}
private function bytesToString(_arg1:uint):String{
var _local2:String;
if (_arg1 < 0x0400){
_local2 = (String(_arg1) + "b");
} else {
if (_arg1 < 0x2800){
_local2 = (Number((_arg1 / 0x0400)).toFixed(2) + "kb");
} else {
if (_arg1 < 102400){
_local2 = (Number((_arg1 / 0x0400)).toFixed(1) + "kb");
} else {
if (_arg1 < 0x100000){
_local2 = ((_arg1 >> 10) + "kb");
} else {
if (_arg1 < 0xA00000){
_local2 = (Number((_arg1 / 0x100000)).toFixed(2) + "mb");
} else {
if (_arg1 < 104857600){
_local2 = (Number((_arg1 / 0x100000)).toFixed(1) + "mb");
} else {
_local2 = ((_arg1 >> 20) + "mb");
};
};
};
};
};
};
return (_local2);
}
private function onEnterFrame(_arg1:Event):void{
tfDelay++;
if (tfDelay >= tfDelayMax){
tfDelay = 0;
fps.text = ("FPS: " + Number(((1000 * tfDelayMax) / (getTimer() - tfTimer))).toFixed(2));
tfTimer = getTimer();
};
var _local2:Number = (1000 / (getTimer() - diagramTimer));
var _local3:Number = ((_local2)>stage.frameRate) ? 1 : (_local2 / stage.frameRate);
diagramTimer = getTimer();
diagram.scroll(1, 0);
diagram.fillRect(new Rectangle(0, 0, 1, diagram.height), 553648127);
diagram.setPixel32(0, (diagramHeight * (1 - _local3)), 4291611852);
mem.text = ("MEM: " + bytesToString(System.totalMemory));
var _local4:Number = ((skins)==0) ? 0 : (skinsChanged / skins);
diagram.setPixel32(0, (diagramHeight * (1 - _local4)), 4294927872);
var _local5:Number = (System.totalMemory / maxMemory);
diagram.setPixel32(0, (diagramHeight * (1 - _local5)), 4291611648);
var _local6:Number = ((socketInBytes - socketInLast) / maxSocket);
socketInLast = socketInBytes;
diagram.setPixel32(0, (diagramHeight * (1 - _local6)), 4278255360);
var _local7:Number = ((socketOutBytes - socketOutLast) / maxSocket);
socketOutLast = socketOutBytes;
diagram.setPixel32(0, (diagramHeight * (1 - _local7)), 4278216447);
}
private function onResize(_arg1:Event=null):void{
var _local2:Point = parent.globalToLocal(new Point((stage.stageWidth - 2), -3));
x = _local2.x;
y = _local2.y;
}
public static function addDownloadBytes(_arg1:uint):void{
if (instance.downloadedBytes == 0){
instance.dwl.y = instance.currentY;
instance.currentY = (instance.currentY + 10);
instance.addChild(instance.dwl);
instance.getChildAt(0).y = (instance.currentY + 4);
};
instance.downloadedBytes = (instance.downloadedBytes + _arg1);
instance.dwl.text = ("DWL: " + instance.bytesToString(instance.downloadedBytes));
}
public static function init(_arg1:DisplayObjectContainer):void{
instance = new FPS(_arg1);
}
public static function addSocketInBytes(_arg1:uint):void{
if (instance.socketInBytes == 0){
instance.socketIn.y = instance.currentY;
instance.currentY = (instance.currentY + 10);
instance.addChild(instance.socketIn);
instance.getChildAt(0).y = (instance.currentY + 4);
};
instance.socketInBytes = (instance.socketInBytes + _arg1);
instance.socketIn.text = ("IN: " + instance.bytesToString(instance.socketInBytes));
}
public static function addSocketOutBytes(_arg1:uint):void{
if (instance.socketOutBytes == 0){
instance.socketOut.y = instance.currentY;
instance.currentY = (instance.currentY + 10);
instance.addChild(instance.socketOut);
instance.getChildAt(0).y = (instance.currentY + 4);
};
instance.socketOutBytes = (instance.socketOutBytes + _arg1);
instance.socketOut.text = ("OUT: " + instance.bytesToString(instance.socketOutBytes));
}
public static function addSkins(_arg1:uint, _arg2:uint):void{
if (instance.skins < 0){
instance.skn.y = instance.currentY;
instance.currentY = (instance.currentY + 10);
instance.addChild(instance.skn);
instance.getChildAt(0).y = (instance.currentY + 4);
};
instance.skins = _arg1;
instance.skinsChanged = _arg2;
instance.skn.text = ("SKN: " + ((_arg2)>0) ? ((_arg1.toString() + "-") + _arg2.toString()) : _arg1.toString());
}
}
}//package com.alternativagame.admin
Section 2
//Collision (com.alternativagame.engine3d.collision.Collision)
package com.alternativagame.engine3d.collision {
import com.alternativagame.engine3d.*;
import com.alternativagame.type.*;
public class Collision {
public var point:Point3D;
public var offset:Number;
public var normal:Point3D;
public var face:Face;
}
}//package com.alternativagame.engine3d.collision
Section 3
//CollisionPlane (com.alternativagame.engine3d.collision.CollisionPlane)
package com.alternativagame.engine3d.collision {
import com.alternativagame.engine3d.*;
public class CollisionPlane {
public var destinationOffset:Number;
public var infront:Boolean;
public var node:BSPNode;
public var sourceOffset:Number;
}
}//package com.alternativagame.engine3d.collision
Section 4
//Box (com.alternativagame.engine3d.primitive.Box)
package com.alternativagame.engine3d.primitive {
import com.alternativagame.engine3d.*;
import flash.geom.*;
public class Box extends Mesh {
public function Box(_arg1:Number=100, _arg2:Number=100, _arg3:Number=100, _arg4:uint=1, _arg5:uint=1, _arg6:uint=1, _arg7:Boolean=false){
var _local14:int;
var _local15:int;
var _local16:int;
var _local26:String;
super();
var _local8:Number = (_arg1 / 2);
var _local9:Number = (_arg3 / 2);
var _local10:Number = (_arg2 / 2);
var _local11:Number = (_arg1 / _arg4);
var _local12:Number = (_arg3 / _arg6);
var _local13:Number = (_arg2 / _arg5);
_local14 = 0;
while (_local14 <= _arg4) {
_local15 = 0;
while (_local15 <= _arg6) {
_local16 = 0;
while (_local16 <= _arg5) {
if ((((((((((((_local14 == 0)) || ((_local14 == _arg4)))) || ((_local15 == 0)))) || ((_local15 == _arg6)))) || ((_local16 == 0)))) || ((_local16 == _arg5)))){
addVertex(((_local14 * _local11) - _local8), ((_local15 * _local12) - _local9), ((_local16 * _local13) - _local10), ((((_local14 + "_") + _local15) + "_") + _local16));
};
_local16++;
};
_local15++;
};
_local14++;
};
var _local17:Surface = addSurface(null, "front");
var _local18:Surface = addSurface(null, "back");
var _local19:Surface = addSurface(null, "left");
var _local20:Surface = addSurface(null, "right");
var _local21:Surface = addSurface(null, "top");
var _local22:Surface = addSurface(null, "bottom");
var _local23:Number = (1 / _arg4);
var _local24:Number = (1 / _arg6);
var _local25:Number = (1 / _arg5);
_local15 = 0;
while (_local15 < _arg6) {
_local14 = 0;
while (_local14 < _arg4) {
_local26 = ((("top_" + _local14) + "_") + _local15);
if (_arg7){
addFace([((((_local14 + "_") + _local15) + "_") + _arg5), ((((_local14 + "_") + (_local15 + 1)) + "_") + _arg5), (((((_local14 + 1) + "_") + (_local15 + 1)) + "_") + _arg5), (((((_local14 + 1) + "_") + _local15) + "_") + _arg5)], _local26);
setUVsToFace(new Point((_local14 * _local23), ((_arg6 - _local15) * _local24)), new Point((_local14 * _local23), (((_arg6 - _local15) - 1) * _local24)), new Point(((_local14 + 1) * _local23), (((_arg6 - _local15) - 1) * _local24)), _local26);
} else {
addFace([((((_local14 + "_") + _local15) + "_") + _arg5), (((((_local14 + 1) + "_") + _local15) + "_") + _arg5), (((((_local14 + 1) + "_") + (_local15 + 1)) + "_") + _arg5), ((((_local14 + "_") + (_local15 + 1)) + "_") + _arg5)], _local26);
setUVsToFace(new Point((_local14 * _local23), (_local15 * _local24)), new Point(((_local14 + 1) * _local23), (_local15 * _local24)), new Point(((_local14 + 1) * _local23), ((_local15 + 1) * _local24)), _local26);
};
_local21.addFace(_local26);
_local14++;
};
_local15++;
};
_local15 = 0;
while (_local15 < _arg6) {
_local14 = 0;
while (_local14 < _arg4) {
_local26 = ((("bottom_" + _local14) + "_") + _local15);
if (_arg7){
addFace([((((_local14 + "_") + _local15) + "_") + 0), (((((_local14 + 1) + "_") + _local15) + "_") + 0), (((((_local14 + 1) + "_") + (_local15 + 1)) + "_") + 0), ((((_local14 + "_") + (_local15 + 1)) + "_") + 0)], _local26);
setUVsToFace(new Point((_local14 * _local23), (_local15 * _local24)), new Point(((_local14 + 1) * _local23), (_local15 * _local24)), new Point(((_local14 + 1) * _local23), ((_local15 + 1) * _local24)), _local26);
} else {
addFace([((((_local14 + "_") + _local15) + "_") + 0), ((((_local14 + "_") + (_local15 + 1)) + "_") + 0), (((((_local14 + 1) + "_") + (_local15 + 1)) + "_") + 0), (((((_local14 + 1) + "_") + _local15) + "_") + 0)], _local26);
setUVsToFace(new Point((_local14 * _local23), ((_arg6 - _local15) * _local24)), new Point((_local14 * _local23), (((_arg6 - _local15) - 1) * _local24)), new Point(((_local14 + 1) * _local23), (((_arg6 - _local15) - 1) * _local24)), _local26);
};
_local22.addFace(_local26);
_local14++;
};
_local15++;
};
_local16 = 0;
while (_local16 < _arg5) {
_local14 = 0;
while (_local14 < _arg4) {
_local26 = ((("front_" + _local14) + "_") + _local16);
if (_arg7){
addFace([((((_local14 + "_") + 0) + "_") + _local16), ((((_local14 + "_") + 0) + "_") + (_local16 + 1)), (((((_local14 + 1) + "_") + 0) + "_") + (_local16 + 1)), (((((_local14 + 1) + "_") + 0) + "_") + _local16)], _local26);
setUVsToFace(new Point(((_arg4 - _local14) * _local23), (_local16 * _local25)), new Point(((_arg4 - _local14) * _local23), ((_local16 + 1) * _local25)), new Point((((_arg4 - _local14) - 1) * _local23), ((_local16 + 1) * _local25)), _local26);
} else {
addFace([((((_local14 + "_") + 0) + "_") + _local16), (((((_local14 + 1) + "_") + 0) + "_") + _local16), (((((_local14 + 1) + "_") + 0) + "_") + (_local16 + 1)), ((((_local14 + "_") + 0) + "_") + (_local16 + 1))], _local26);
setUVsToFace(new Point((_local14 * _local23), (_local16 * _local25)), new Point(((_local14 + 1) * _local23), (_local16 * _local25)), new Point(((_local14 + 1) * _local23), ((_local16 + 1) * _local25)), _local26);
};
_local17.addFace(_local26);
_local14++;
};
_local16++;
};
_local16 = 0;
while (_local16 < _arg5) {
_local14 = 0;
while (_local14 < _arg4) {
_local26 = ((("back_" + _local14) + "_") + _local16);
if (_arg7){
addFace([((((_local14 + "_") + _arg6) + "_") + _local16), (((((_local14 + 1) + "_") + _arg6) + "_") + _local16), (((((_local14 + 1) + "_") + _arg6) + "_") + (_local16 + 1)), ((((_local14 + "_") + _arg6) + "_") + (_local16 + 1))], _local26);
setUVsToFace(new Point((_local14 * _local23), (_local16 * _local25)), new Point(((_local14 + 1) * _local23), (_local16 * _local25)), new Point(((_local14 + 1) * _local23), ((_local16 + 1) * _local25)), _local26);
} else {
addFace([((((_local14 + "_") + _arg6) + "_") + _local16), ((((_local14 + "_") + _arg6) + "_") + (_local16 + 1)), (((((_local14 + 1) + "_") + _arg6) + "_") + (_local16 + 1)), (((((_local14 + 1) + "_") + _arg6) + "_") + _local16)], _local26);
setUVsToFace(new Point(((_arg4 - _local14) * _local23), (_local16 * _local25)), new Point(((_arg4 - _local14) * _local23), ((_local16 + 1) * _local25)), new Point((((_arg4 - _local14) - 1) * _local23), ((_local16 + 1) * _local25)), _local26);
};
_local18.addFace(_local26);
_local14++;
};
_local16++;
};
_local15 = 0;
while (_local15 < _arg6) {
_local16 = 0;
while (_local16 < _arg5) {
_local26 = ((("left_" + _local15) + "_") + _local16);
if (_arg7){
addFace([((((0 + "_") + _local15) + "_") + _local16), ((((0 + "_") + (_local15 + 1)) + "_") + _local16), ((((0 + "_") + (_local15 + 1)) + "_") + (_local16 + 1)), ((((0 + "_") + _local15) + "_") + (_local16 + 1))], _local26);
setUVsToFace(new Point((_local15 * _local24), (_local16 * _local25)), new Point(((_local15 + 1) * _local24), (_local16 * _local25)), new Point(((_local15 + 1) * _local24), ((_local16 + 1) * _local25)), _local26);
} else {
addFace([((((0 + "_") + _local15) + "_") + _local16), ((((0 + "_") + _local15) + "_") + (_local16 + 1)), ((((0 + "_") + (_local15 + 1)) + "_") + (_local16 + 1)), ((((0 + "_") + (_local15 + 1)) + "_") + _local16)], _local26);
setUVsToFace(new Point(((_arg6 - _local15) * _local24), (_local16 * _local25)), new Point(((_arg6 - _local15) * _local24), ((_local16 + 1) * _local25)), new Point((((_arg6 - _local15) - 1) * _local24), ((_local16 + 1) * _local25)), _local26);
};
_local19.addFace(_local26);
_local16++;
};
_local15++;
};
_local15 = 0;
while (_local15 < _arg6) {
_local16 = 0;
while (_local16 < _arg5) {
_local26 = ((("right_" + _local15) + "_") + _local16);
if (_arg7){
addFace([((((_arg4 + "_") + _local15) + "_") + _local16), ((((_arg4 + "_") + _local15) + "_") + (_local16 + 1)), ((((_arg4 + "_") + (_local15 + 1)) + "_") + (_local16 + 1)), ((((_arg4 + "_") + (_local15 + 1)) + "_") + _local16)], _local26);
setUVsToFace(new Point(((_arg6 - _local15) * _local24), (_local16 * _local25)), new Point(((_arg6 - _local15) * _local24), ((_local16 + 1) * _local25)), new Point((((_arg6 - _local15) - 1) * _local24), ((_local16 + 1) * _local25)), _local26);
} else {
addFace([((((_arg4 + "_") + _local15) + "_") + _local16), ((((_arg4 + "_") + (_local15 + 1)) + "_") + _local16), ((((_arg4 + "_") + (_local15 + 1)) + "_") + (_local16 + 1)), ((((_arg4 + "_") + _local15) + "_") + (_local16 + 1))], _local26);
setUVsToFace(new Point((_local15 * _local24), (_local16 * _local25)), new Point(((_local15 + 1) * _local24), (_local16 * _local25)), new Point(((_local15 + 1) * _local24), ((_local16 + 1) * _local25)), _local26);
};
_local20.addFace(_local26);
_local16++;
};
_local15++;
};
}
}
}//package com.alternativagame.engine3d.primitive
Section 5
//BSPNode (com.alternativagame.engine3d.BSPNode)
package com.alternativagame.engine3d {
import com.alternativagame.type.*;
public final class BSPNode {
var mobile:uint;// = 4294967295
var normal:Point3D;
var front:BSPNode;
var parent:BSPNode;
var offset:Number;
var back:BSPNode;
var backPrimitives:Set;
var frontPrimitives:Set;
var primitive:PolyPrimitive;
private static var collector:Array = new Array();
public function BSPNode(){
normal = new Point3D();
super();
}
static function createBSPNode(_arg1:PolyPrimitive):BSPNode{
var _local2:BSPNode = collector.pop();
if (_local2 == null){
_local2 = new (BSPNode);
};
_local2.primitive = _arg1;
_arg1.node = _local2;
_local2.normal.copy(_arg1.face.globalNormal);
_local2.offset = _arg1.face.globalOffset;
_local2.mobile = _arg1.mobile;
return (_local2);
}
static function destroyBSPNode(_arg1:BSPNode):void{
collector.push(_arg1);
}
}
}//package com.alternativagame.engine3d
Section 6
//Camera3D (com.alternativagame.engine3d.Camera3D)
package com.alternativagame.engine3d {
import com.alternativagame.type.*;
import flash.geom.*;
import flash.utils.*;
public class Camera3D extends Object3D {
var _view:View;
var _fov:Number;// = 1.5707963267949
var focusDistortion:Number;
private var currentSkin:Skin;
var textureMatrices:Dictionary;
var cameraCoords:Dictionary;
var viewAngle:Number;
var redrawOperation:Operation;
private var textureMatricesCalculated:Set;
var clearCalculatedOperation:Operation;
private var cameraCoordsCalculated:Set;
var cameraMatrix:Matrix3D;
private var prevSkin:Skin;
var _focusHalfSize:Number;// = 500
private var firstSkin:Skin;
var calculateMatrixOperation:Operation;
var focusDistance:Number;
var calculateSkinsOperation:Operation;
var direction:Point3D;
private static var counter:uint = 0;
public function Camera3D(_arg1:String=null){
redrawOperation = new Operation("redraw", this);
calculateMatrixOperation = new Operation("calculateMatrix", this, calculateMatrix, Operation.CAMERA_MATRIX);
clearCalculatedOperation = new Operation("clearCalculated", this, clearCalculated, Operation.CAMERA_CLEAR_CALCULATED);
calculateSkinsOperation = new Operation("calculateSkins", this, calculateSkins, Operation.CAMERA_CALCULATE_SKINS);
focusDistance = (_focusHalfSize / Math.tan((0.5 * _fov)));
focusDistortion = (1 / (focusDistance * focusDistance));
viewAngle = Math.sin((Math.PI / 4));
direction = new Point3D(0, 0, 1);
cameraMatrix = new Matrix3D();
cameraCoords = new Dictionary(true);
cameraCoordsCalculated = new Set(true);
textureMatrices = new Dictionary(true);
textureMatricesCalculated = new Set(true);
_view = new View();
super(_arg1);
addOperation.addSequel(calculateMatrixOperation);
locationOperation.addSequel(calculateMatrixOperation);
transformOperation.addSequel(calculateMatrixOperation);
moveOperation.addSequel(calculateMatrixOperation);
calculateMatrixOperation.addSequel(clearCalculatedOperation);
redrawOperation.addSequel(clearCalculatedOperation);
clearCalculatedOperation.addSequel(calculateSkinsOperation);
}
function calculateCameraCoord(_arg1:Point3D):Point3D{
var _local2:Point3D = cameraCoords[_arg1];
if (_local2 == null){
_local2 = new Point3D();
cameraCoords[_arg1] = _local2;
};
if (!cameraCoordsCalculated[_arg1]){
_local2.copy(_arg1);
_local2.transform(cameraMatrix);
cameraCoordsCalculated[_arg1] = true;
};
return (_local2);
}
function removeTextureMatrix(_arg1:Face):void{
delete textureMatrices[_arg1];
delete textureMatricesCalculated[_arg1];
}
private function insertCurrentSkin():void{
var _local1:Skin = Skin.createSkin(this);
_view.canvas.addChildAt(_local1, _view.canvas.getChildIndex(currentSkin));
_local1.nextSkin = currentSkin;
if (prevSkin == null){
firstSkin = _local1;
} else {
prevSkin.nextSkin = _local1;
};
currentSkin = _local1;
}
public function get view():View{
return (_view);
}
public function set zoom(_arg1:Number):void{
_arg1 = (1 / _arg1);
if (((((!((_scaleX == _arg1))) || (!((_scaleY == _arg1))))) || (!((_scaleZ == _arg1))))){
_scaleX = _arg1;
_scaleY = _arg1;
_scaleZ = _arg1;
addOperationToScene(transformOperation);
};
}
public function set fov(_arg1:Number):void{
_arg1 = ((_arg1)<0) ? 0 : ((_arg1)>Math.PI) ? Math.PI : _arg1;
if (_fov != _arg1){
focusDistance = (_focusHalfSize / Math.tan((0.5 * _arg1)));
focusDistortion = (1 / (focusDistance * focusDistance));
viewAngle = Math.sin((0.5 * _arg1));
addOperationToScene(redrawOperation);
_fov = _arg1;
};
}
private function addCurrentSkin():void{
if (currentSkin == null){
currentSkin = Skin.createSkin(this);
_view.canvas.addChild(currentSkin);
if (prevSkin == null){
firstSkin = currentSkin;
} else {
prevSkin.nextSkin = currentSkin;
};
};
}
private function drawAddedSkin(_arg1:PolyPrimitive):void{
if (_scene.addPrimitives[_arg1]){
if ((((currentSkin == null)) || (((!(_scene.removePrimitives[currentSkin._primitive])) && (!(_scene.addPrimitives[currentSkin._primitive])))))){
if (currentSkin == null){
addCurrentSkin();
} else {
insertCurrentSkin();
};
};
currentSkin.draw(_arg1);
prevSkin = currentSkin;
currentSkin = currentSkin.nextSkin;
} else {
while (((!((currentSkin == null))) && (((_scene.removePrimitives[currentSkin._primitive]) || (_scene.addPrimitives[currentSkin._primitive]))))) {
removeCurrentSkin();
};
if (currentSkin != null){
prevSkin = currentSkin;
currentSkin = currentSkin.nextSkin;
};
};
}
public function set viewRadius(_arg1:Number):void{
focusDistance = (_arg1 / Math.tan((0.5 * _fov)));
focusDistortion = (1 / (focusDistance * focusDistance));
viewAngle = Math.sin((0.5 * _fov));
addOperationToScene(redrawOperation);
_focusHalfSize = _arg1;
}
private function calculateMatrix():void{
direction.x = transformMatrix.c;
direction.y = transformMatrix.g;
direction.z = transformMatrix.k;
direction.normalize();
cameraMatrix.copy(transformMatrix);
cameraMatrix.invert();
}
private function isometricRenderChanged(_arg1:BSPNode):void{
var _local2:*;
var _local3:Point3D;
var _local4:Number;
if (_arg1 != null){
_local3 = _arg1.normal;
_local4 = (((direction.x * _local3.x) + (direction.y * _local3.y)) + (direction.z * _local3.z));
if (_arg1.primitive != null){
if (_local4 <= 0){
isometricRenderChanged(_arg1.back);
drawAddedSkin(_arg1.primitive);
isometricRenderChanged(_arg1.front);
} else {
isometricRenderChanged(_arg1.front);
isometricRenderChanged(_arg1.back);
};
} else {
if (_local4 <= 0){
isometricRenderChanged(_arg1.back);
for (_local2 in _arg1.frontPrimitives) {
drawAddedSkin(_local2);
};
isometricRenderChanged(_arg1.front);
} else {
isometricRenderChanged(_arg1.front);
for (_local2 in _arg1.backPrimitives) {
drawAddedSkin(_local2);
};
isometricRenderChanged(_arg1.back);
};
};
};
}
public function get zoom():Number{
return ((3 / ((_scaleX + _scaleY) + _scaleZ)));
}
private function calculateSkins():void{
prevSkin = null;
currentSkin = firstSkin;
if (((((((((moveOperation.queued) || (transformOperation.queued))) || (redrawOperation.queued))) || (locationOperation.queued))) || (addOperation.queued))){
if (_fov == 0){
isometricRender(_scene.bsp);
} else {
perspectiveRender(_scene.bsp);
};
} else {
if (_fov == 0){
isometricRenderChanged(_scene.bsp);
} else {
perspectiveRenderChanged(_scene.bsp);
};
};
while (currentSkin != null) {
removeCurrentSkin();
};
}
override protected function removeFromScene(_arg1:Scene3D):void{
super.removeFromScene(_arg1);
_arg1.calculatePrimitivesOperation.removeSequel(clearCalculatedOperation);
}
private function drawSkin(_arg1:PolyPrimitive):void{
addCurrentSkin();
currentSkin.draw(_arg1);
prevSkin = currentSkin;
currentSkin = currentSkin.nextSkin;
}
private function perspectiveRenderChanged(_arg1:BSPNode):void{
var _local2:*;
var _local3:Point3D;
var _local4:Number;
var _local5:Number;
if (_arg1 != null){
_local3 = _arg1.normal;
_local4 = (((direction.x * _local3.x) + (direction.y * _local3.y)) + (direction.z * _local3.z));
_local5 = ((((globalCoords.x * _local3.x) + (globalCoords.y * _local3.y)) + (globalCoords.z * _local3.z)) - _arg1.offset);
if (_arg1.primitive != null){
if (_local5 > 0){
if (_local4 < viewAngle){
perspectiveRenderChanged(_arg1.back);
drawAddedSkin(_arg1.primitive);
};
perspectiveRenderChanged(_arg1.front);
} else {
if (_local4 > -(viewAngle)){
perspectiveRenderChanged(_arg1.front);
};
perspectiveRenderChanged(_arg1.back);
};
} else {
if (_local5 > 0){
if (_local4 < viewAngle){
perspectiveRenderChanged(_arg1.back);
for (_local2 in _arg1.frontPrimitives) {
drawAddedSkin(_local2);
};
};
perspectiveRenderChanged(_arg1.front);
} else {
if (_local4 > -(viewAngle)){
perspectiveRenderChanged(_arg1.front);
for (_local2 in _arg1.backPrimitives) {
drawAddedSkin(_local2);
};
};
perspectiveRenderChanged(_arg1.back);
};
};
};
}
private function isometricRender(_arg1:BSPNode):void{
var _local2:*;
var _local3:Point3D;
var _local4:Number;
if (_arg1 != null){
_local3 = _arg1.normal;
_local4 = (((direction.x * _local3.x) + (direction.y * _local3.y)) + (direction.z * _local3.z));
if (_arg1.primitive != null){
if (_local4 <= 0){
isometricRender(_arg1.back);
drawSkin(_arg1.primitive);
isometricRender(_arg1.front);
} else {
isometricRender(_arg1.front);
isometricRender(_arg1.back);
};
} else {
if (_local4 <= 0){
isometricRender(_arg1.back);
for (_local2 in _arg1.frontPrimitives) {
drawSkin(_local2);
};
isometricRender(_arg1.front);
} else {
isometricRender(_arg1.front);
for (_local2 in _arg1.backPrimitives) {
drawSkin(_local2);
};
isometricRender(_arg1.back);
};
};
};
}
override protected function defaultName():String{
return (("camera" + ++counter));
}
public function get fov():Number{
return (_fov);
}
override protected function addToScene(_arg1:Scene3D):void{
super.addToScene(_arg1);
_arg1.calculatePrimitivesOperation.addSequel(clearCalculatedOperation);
}
private function perspectiveRender(_arg1:BSPNode):void{
var _local2:*;
var _local3:Point3D;
var _local4:Number;
var _local5:Number;
if (_arg1 != null){
_local3 = _arg1.normal;
_local4 = (((direction.x * _local3.x) + (direction.y * _local3.y)) + (direction.z * _local3.z));
_local5 = ((((globalCoords.x * _local3.x) + (globalCoords.y * _local3.y)) + (globalCoords.z * _local3.z)) - _arg1.offset);
if (_arg1.primitive != null){
if (_local5 > 0){
if (_local4 < viewAngle){
perspectiveRender(_arg1.back);
drawSkin(_arg1.primitive);
};
perspectiveRender(_arg1.front);
} else {
if (_local4 > -(viewAngle)){
perspectiveRender(_arg1.front);
};
perspectiveRender(_arg1.back);
};
} else {
if (_local5 > 0){
if (_local4 < viewAngle){
perspectiveRender(_arg1.back);
for (_local2 in _arg1.frontPrimitives) {
drawSkin(_local2);
};
};
perspectiveRender(_arg1.front);
} else {
if (_local4 > -(viewAngle)){
perspectiveRender(_arg1.front);
for (_local2 in _arg1.backPrimitives) {
drawSkin(_local2);
};
};
perspectiveRender(_arg1.back);
};
};
};
}
function calculateTextureMatrix(_arg1:Face, _arg2:uint, _arg3:uint):Matrix{
var _local6:Point3D;
var _local7:Point3D;
var _local8:Point3D;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local4:Matrix = textureMatrices[_arg1];
var _local5:Matrix = _arg1.uvMatrix;
if (_local4 == null){
_local4 = new Matrix();
textureMatrices[_arg1] = _local4;
};
if (!textureMatricesCalculated[_arg1]){
_local6 = calculateCameraCoord(_arg1.primitive.points[0]);
_local7 = calculateCameraCoord(_arg1.primitive.points[1]);
_local8 = calculateCameraCoord(_arg1.primitive.points[2]);
_local9 = (_local7.x - _local6.x);
_local10 = (_local7.y - _local6.y);
_local11 = (_local8.x - _local6.x);
_local12 = (_local8.y - _local6.y);
_local4.a = (((_local5.a * _local9) + (_local5.b * _local11)) / _arg2);
_local4.b = (((_local5.a * _local10) + (_local5.b * _local12)) / _arg2);
_local4.c = (-(((_local5.c * _local9) + (_local5.d * _local11))) / _arg3);
_local4.d = (-(((_local5.c * _local10) + (_local5.d * _local12))) / _arg3);
_local4.tx = ((((_local5.tx + _local5.c) * _local9) + ((_local5.ty + _local5.d) * _local11)) + _local6.x);
_local4.ty = ((((_local5.tx + _local5.c) * _local10) + ((_local5.ty + _local5.d) * _local12)) + _local6.y);
textureMatricesCalculated[_arg1] = true;
};
return (_local4);
}
private function removeCurrentSkin():void{
var _local1:Skin = currentSkin.nextSkin;
_view.canvas.removeChild(currentSkin);
currentSkin.draw(null);
currentSkin.nextSkin = null;
currentSkin.camera = null;
Skin.destroySkin(currentSkin);
currentSkin = _local1;
if (prevSkin == null){
firstSkin = currentSkin;
} else {
prevSkin.nextSkin = currentSkin;
};
}
private function clearCalculated():void{
var _local1:*;
var _local2:PolyPrimitive;
var _local3:Array;
var _local4:uint;
if (((((((((transformOperation.queued) || (moveOperation.queued))) || (redrawOperation.queued))) || (locationOperation.queued))) || (addOperation.queued))){
cameraCoordsCalculated.clear();
textureMatricesCalculated.clear();
} else {
for (_local1 in _scene.addPrimitives) {
_local2 = _local1;
_local3 = _local2.points;
_local4 = 0;
while (_local4 < _local2.num) {
delete cameraCoordsCalculated[_local3[_local4]];
_local4++;
};
delete textureMatricesCalculated[_local2.face];
};
};
}
}
}//package com.alternativagame.engine3d
Section 7
//Face (com.alternativagame.engine3d.Face)
package com.alternativagame.engine3d {
import com.alternativagame.type.*;
import flash.geom.*;
public final class Face {
private const crossNormalTreshold:Number = 0.01;
var materialOperation:Operation;
private var _cUV:Point;
private var _aUV:Point;
var moveOperation:Operation;
var globalOffset:Number;
var calculateUVOperation:Operation;
var uvMatrix:Matrix;
var removeOperation:Operation;
private var _bUV:Point;
var addOperation:Operation;
var _num:uint;
var transformPrimitiveOperation:Operation;
var uvOperation:Operation;
var _mesh:Mesh;
var _vertices:Array;
var transformOperation:Operation;
var primitive:PolyPrimitive;
var globalNormal:Point3D;
var _surface:Surface;
var calculatePlaneOperation:Operation;
public function Face(_arg1:Array){
var _local3:Vertex;
addOperation = new Operation("add", this);
removeOperation = new Operation("remove", this);
transformOperation = new Operation("transform", this);
moveOperation = new Operation("move", this);
materialOperation = new Operation("material", this);
uvOperation = new Operation("uv", this, setUV, Operation.FACE_UV);
calculateUVOperation = new Operation("calculateUV", this, calculateUV, Operation.FACE_CALCULATE_UV);
calculatePlaneOperation = new Operation("calculatePlane", this, calculatePlane, Operation.FACE_PLANE);
transformPrimitiveOperation = new Operation("transformPrimitive", this, transformPrimitive, Operation.FACE_TRANSFORM);
globalNormal = new Point3D();
super();
_vertices = _arg1;
_num = _arg1.length;
primitive = PolyPrimitive.createPolyPrimitive();
primitive.face = this;
primitive.num = _num;
var _local2:uint;
while (_local2 < _num) {
_local3 = _arg1[_local2];
primitive.points.push(_local3.globalCoords);
primitive.uvs.push(null);
_local3.addToFace(this);
_local2++;
};
addOperation.addSequel(calculatePlaneOperation);
transformOperation.addSequel(calculatePlaneOperation);
transformOperation.addSequel(transformPrimitiveOperation);
moveOperation.addSequel(transformPrimitiveOperation);
addOperation.addSequel(uvOperation);
uvOperation.addSequel(calculateUVOperation);
}
private function setUV():void{
var _local1:uint;
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Point3D;
var _local8:Point3D;
var _local9:Point3D;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:Point;
var _local19:Point3D;
if (((((!((_aUV == null))) && (!((_bUV == null))))) && (!((_cUV == null))))){
_local2 = (_bUV.x - _aUV.x);
_local3 = (_bUV.y - _aUV.y);
_local4 = (_cUV.x - _aUV.x);
_local5 = (_cUV.y - _aUV.y);
_local6 = ((_local2 * _local5) - (_local3 * _local4));
if (uvMatrix == null){
uvMatrix = new Matrix();
};
uvMatrix.a = (_local5 / _local6);
uvMatrix.b = (-(_local3) / _local6);
uvMatrix.c = (-(_local4) / _local6);
uvMatrix.d = (_local2 / _local6);
uvMatrix.tx = -(((uvMatrix.a * _aUV.x) + (uvMatrix.c * _aUV.y)));
uvMatrix.ty = -(((uvMatrix.b * _aUV.x) + (uvMatrix.d * _aUV.y)));
primitive.uvs[0] = _aUV;
primitive.uvs[1] = _bUV;
primitive.uvs[2] = _cUV;
if (_num > 3){
_local7 = primitive.points[0];
_local8 = primitive.points[1];
_local9 = primitive.points[2];
if (((globalNormal.x)<0) ? -(globalNormal.x) : globalNormal.x > ((globalNormal.y)<0) ? -(globalNormal.y) : globalNormal.y){
if (((globalNormal.x)<0) ? -(globalNormal.x) : globalNormal.x > ((globalNormal.z)<0) ? -(globalNormal.z) : globalNormal.z){
_local10 = (_local8.y - _local7.y);
_local11 = (_local8.z - _local7.z);
_local12 = (_local9.y - _local7.y);
_local13 = (_local9.z - _local7.z);
_local6 = ((_local10 * _local13) - (_local12 * _local11));
_local1 = 3;
while (_local1 < _num) {
_local19 = primitive.points[_local1];
_local14 = (_local19.y - _local7.y);
_local15 = (_local19.z - _local7.z);
_local16 = (((_local14 * _local13) - (_local12 * _local15)) / _local6);
_local17 = (((_local10 * _local15) - (_local14 * _local11)) / _local6);
_local18 = primitive.uvs[_local1];
if (_local18 == null){
_local18 = new Point();
primitive.uvs[_local1] = _local18;
};
_local18.x = ((_aUV.x + (_local2 * _local16)) + (_local4 * _local17));
_local18.y = ((_aUV.y + (_local3 * _local16)) + (_local5 * _local17));
_local1++;
};
} else {
_local10 = (_local8.x - _local7.x);
_local11 = (_local8.y - _local7.y);
_local12 = (_local9.x - _local7.x);
_local13 = (_local9.y - _local7.y);
_local6 = ((_local10 * _local13) - (_local12 * _local11));
_local1 = 3;
while (_local1 < _num) {
_local19 = primitive.points[_local1];
_local14 = (_local19.x - _local7.x);
_local15 = (_local19.y - _local7.y);
_local16 = (((_local14 * _local13) - (_local12 * _local15)) / _local6);
_local17 = (((_local10 * _local15) - (_local14 * _local11)) / _local6);
_local18 = primitive.uvs[_local1];
if (_local18 == null){
_local18 = new Point();
primitive.uvs[_local1] = _local18;
};
_local18.x = ((_aUV.x + (_local2 * _local16)) + (_local4 * _local17));
_local18.y = ((_aUV.y + (_local3 * _local16)) + (_local5 * _local17));
_local1++;
};
};
} else {
if (((globalNormal.y)<0) ? -(globalNormal.y) : globalNormal.y > ((globalNormal.z)<0) ? -(globalNormal.z) : globalNormal.z){
_local10 = (_local8.x - _local7.x);
_local11 = (_local8.z - _local7.z);
_local12 = (_local9.x - _local7.x);
_local13 = (_local9.z - _local7.z);
_local6 = ((_local10 * _local13) - (_local12 * _local11));
_local1 = 3;
while (_local1 < _num) {
_local19 = primitive.points[_local1];
_local14 = (_local19.x - _local7.x);
_local15 = (_local19.z - _local7.z);
_local16 = (((_local14 * _local13) - (_local12 * _local15)) / _local6);
_local17 = (((_local10 * _local15) - (_local14 * _local11)) / _local6);
_local18 = primitive.uvs[_local1];
if (_local18 == null){
_local18 = new Point();
primitive.uvs[_local1] = _local18;
};
_local18.x = ((_aUV.x + (_local2 * _local16)) + (_local4 * _local17));
_local18.y = ((_aUV.y + (_local3 * _local16)) + (_local5 * _local17));
_local1++;
};
} else {
_local10 = (_local8.x - _local7.x);
_local11 = (_local8.y - _local7.y);
_local12 = (_local9.x - _local7.x);
_local13 = (_local9.y - _local7.y);
_local6 = ((_local10 * _local13) - (_local12 * _local11));
_local1 = 3;
while (_local1 < _num) {
_local19 = primitive.points[_local1];
_local14 = (_local19.x - _local7.x);
_local15 = (_local19.y - _local7.y);
_local16 = (((_local14 * _local13) - (_local12 * _local15)) / _local6);
_local17 = (((_local10 * _local15) - (_local14 * _local11)) / _local6);
_local18 = primitive.uvs[_local1];
if (_local18 == null){
_local18 = new Point();
primitive.uvs[_local1] = _local18;
};
_local18.x = ((_aUV.x + (_local2 * _local16)) + (_local4 * _local17));
_local18.y = ((_aUV.y + (_local3 * _local16)) + (_local5 * _local17));
_local1++;
};
};
};
};
} else {
uvMatrix = null;
_local1 = 0;
while (_local1 < _num) {
primitive.uvs[_local1] = null;
_local1++;
};
};
}
function addToMesh(_arg1:Mesh):void{
_arg1.moveOperation.addSequel(moveOperation);
_arg1.transformOperation.addSequel(transformOperation);
_arg1.mobileOperation.addSequel(transformPrimitiveOperation);
_mesh = _arg1;
primitive.mobile = _arg1._mobile;
}
public function set aUV(_arg1:Point):void{
if (_aUV != null){
if (_arg1 != null){
if (!_aUV.equals(_arg1)){
_aUV.x = _arg1.x;
_aUV.y = _arg1.y;
if (_mesh != null){
_mesh.addOperationToScene(uvOperation);
};
};
} else {
_aUV = null;
if (_mesh != null){
_mesh.addOperationToScene(uvOperation);
};
};
} else {
if (_arg1 != null){
_aUV = _arg1.clone();
if (_mesh != null){
_mesh.addOperationToScene(uvOperation);
};
};
};
}
public function set cUV(_arg1:Point):void{
if (_cUV != null){
if (_arg1 != null){
if (!_cUV.equals(_arg1)){
_cUV.x = _arg1.x;
_cUV.y = _arg1.y;
if (_mesh != null){
_mesh.addOperationToScene(uvOperation);
};
};
} else {
_cUV = null;
if (_mesh != null){
_mesh.addOperationToScene(uvOperation);
};
};
} else {
if (_arg1 != null){
_cUV = _arg1.clone();
if (_mesh != null){
_mesh.addOperationToScene(uvOperation);
};
};
};
}
public function get bUV():Point{
return (((_bUV)!=null) ? _bUV.clone() : null);
}
public function get num():uint{
return (_num);
}
function removeFromSurface(_arg1:Surface):void{
_arg1.materialOperation.removeSequel(materialOperation);
if (_arg1._material != null){
_mesh.addOperationToScene(materialOperation);
};
_surface = null;
}
public function get id():Object{
return (((_mesh)!=null) ? _mesh.getFaceId(this) : null);
}
public function set bUV(_arg1:Point):void{
if (_bUV != null){
if (_arg1 != null){
if (!_bUV.equals(_arg1)){
_bUV.x = _arg1.x;
_bUV.y = _arg1.y;
if (_mesh != null){
_mesh.addOperationToScene(uvOperation);
};
};
} else {
_bUV = null;
if (_mesh != null){
_mesh.addOperationToScene(uvOperation);
};
};
} else {
if (_arg1 != null){
_bUV = _arg1.clone();
if (_mesh != null){
_mesh.addOperationToScene(uvOperation);
};
};
};
}
private function calculatePlane():void{
var _local1:Vertex = _vertices[0];
var _local2:Point3D = _local1.globalCoords;
_local1 = _vertices[1];
var _local3:Point3D = _local1.globalCoords;
var _local4:Number = (_local3.x - _local2.x);
var _local5:Number = (_local3.y - _local2.y);
var _local6:Number = (_local3.z - _local2.z);
_local1 = _vertices[2];
var _local7:Point3D = _local1.globalCoords;
var _local8:Number = (_local7.x - _local2.x);
var _local9:Number = (_local7.y - _local2.y);
var _local10:Number = (_local7.z - _local2.z);
globalNormal.x = ((_local10 * _local5) - (_local9 * _local6));
globalNormal.y = ((_local8 * _local6) - (_local10 * _local4));
globalNormal.z = ((_local9 * _local4) - (_local8 * _local5));
globalNormal.normalize();
globalOffset = (((_local2.x * globalNormal.x) + (_local2.y * globalNormal.y)) + (_local2.z * globalNormal.z));
}
private function calculateUV():void{
if (((((!(transformOperation.queued)) && (!(addOperation.queued)))) && (!(removeOperation.queued)))){
if (uvMatrix != null){
calculatePrimitiveUVs(primitive);
} else {
removePrimitiveUVs(primitive);
};
};
}
public function get surface():Surface{
return (_surface);
}
private function calculatePrimitiveUVs(_arg1:PolyPrimitive):void{
var _local2:Array;
var _local3:Array;
var _local4:Array;
var _local5:Array;
var _local6:Array;
var _local7:Array;
var _local8:uint;
var _local9:uint;
var _local10:Point3D;
var _local11:Point;
var _local12:Point;
var _local13:Point;
var _local14:Number;
var _local15:Boolean;
var _local16:uint;
var _local17:Boolean;
if (_arg1.front != null){
_local2 = _arg1.points;
_local3 = _arg1.front.points;
_local4 = _arg1.back.points;
_local5 = _arg1.uvs;
_local6 = _arg1.front.uvs;
_local7 = _arg1.back.uvs;
_local8 = 0;
_local9 = 0;
_local15 = true;
_local16 = 0;
while (_local16 < _arg1.num) {
_local17 = true;
_local10 = _local2[_local16];
if (_local10 == _local3[_local8]){
if (_local6[_local8] == null){
_local6[_local8] = _local5[_local16];
};
_local17 = false;
_local8++;
};
if (_local10 == _local4[_local9]){
if (_local7[_local9] == null){
_local7[_local9] = _local5[_local16];
};
_local17 = false;
_local9++;
};
if (_local17){
_local12 = _local5[((_local16)==0) ? (_arg1.num - 1) : (_local16 - 1)];
_local13 = _local5[_local16];
_local14 = (_local15) ? _arg1.splitTime1 : _arg1.splitTime2;
_local11 = _local6[_local8];
if (_local11 == null){
_local11 = new Point((_local12.x + ((_local13.x - _local12.x) * _local14)), (_local12.y + ((_local13.y - _local12.y) * _local14)));
_local6[_local8] = _local11;
_local7[_local9] = _local11;
} else {
_local11.x = (_local12.x + ((_local13.x - _local12.x) * _local14));
_local11.y = (_local12.y + ((_local13.y - _local12.y) * _local14));
};
_local15 = false;
_local8++;
_local9++;
if (_local10 == _local3[_local8]){
if (_local6[_local8] == null){
_local6[_local8] = _local5[_local16];
};
_local8++;
};
if (_local10 == _local4[_local9]){
if (_local7[_local9] == null){
_local7[_local9] = _local5[_local16];
};
_local9++;
};
};
_local16++;
};
if (_local8 < _arg1.front.num){
_local12 = _local5[(_arg1.num - 1)];
_local13 = _local5[0];
_local14 = (_local15) ? _arg1.splitTime1 : _arg1.splitTime2;
_local11 = _local6[_local8];
if (_local11 == null){
_local11 = new Point((_local12.x + ((_local13.x - _local12.x) * _local14)), (_local12.y + ((_local13.y - _local12.y) * _local14)));
_local6[_local8] = _local11;
_local7[_local9] = _local11;
} else {
_local11.x = (_local12.x + ((_local13.x - _local12.x) * _local14));
_local11.y = (_local12.y + ((_local13.y - _local12.y) * _local14));
};
};
calculatePrimitiveUVs(_arg1.front);
calculatePrimitiveUVs(_arg1.back);
};
}
function removeVertices():void{
var _local2:Vertex;
var _local1:uint;
while (_local1 < _num) {
_local2 = _vertices.pop();
primitive.points.pop();
_local2.removeFromFace(this);
_local1++;
};
_num = 0;
}
function addToSurface(_arg1:Surface):void{
_arg1.materialOperation.addSequel(materialOperation);
if (((!((_mesh == null))) && (((((!((_surface == null))) && (!((_surface._material == _arg1._material))))) || ((((_surface == null)) && (!((_arg1._material == null))))))))){
_mesh.addOperationToScene(materialOperation);
};
_surface = _arg1;
}
public function get aUV():Point{
return (((_aUV)!=null) ? _aUV.clone() : null);
}
private function removePrimitive(_arg1:PolyPrimitive):void{
if (_arg1.back != null){
removePrimitive(_arg1.back);
removePrimitive(_arg1.front);
} else {
_mesh._scene.removePrimitives[_arg1] = true;
};
}
public function get cUV():Point{
return (((_cUV)!=null) ? _cUV.clone() : null);
}
private function removePrimitiveUVs(_arg1:PolyPrimitive):void{
var _local2:uint;
while (_local2 < _arg1.num) {
_arg1.uvs[_local2] = null;
_local2++;
};
if (_arg1.front != null){
removePrimitiveUVs(_arg1.front);
removePrimitiveUVs(_arg1.back);
};
}
function removeFromScene(_arg1:Scene3D):void{
_arg1.removeOperation(addOperation);
_arg1.removeOperation(transformOperation);
_arg1.removeOperation(moveOperation);
_arg1.removeOperation(materialOperation);
_arg1.addOperation(removeOperation);
_arg1.addOperation(_arg1.calculatePrimitivesOperation);
removePrimitive(primitive);
primitive.back = null;
primitive.front = null;
transformPrimitiveOperation.removeSequel(_arg1.calculatePrimitivesOperation);
}
public function toString():String{
var _local3:Vertex;
var _local1:String = (("[Face ID:" + id) + ((_num)>0) ? " vertices:" : "");
var _local2:uint;
while (_local2 < _num) {
_local3 = _vertices[_local2];
_local1 = (_local1 + (_local3.id + ((_local2)<(_num - 1)) ? ", " : ""));
_local2++;
};
_local1 = (_local1 + "]");
return (_local1);
}
public function get mesh():Mesh{
return (_mesh);
}
public function get edgeJoinedFaces():Set{
var _local3:Vertex;
var _local4:Vertex;
var _local5:*;
var _local6:Face;
var _local1:Set = new Set(true);
var _local2:uint;
while (_local2 < _num) {
_local3 = _vertices[_local2];
_local4 = _vertices[((_local2)<(_num - 1)) ? (_local2 + 1) : 0];
for (_local5 in _local3._faces) {
_local6 = _local5;
if (((!((_local6 == this))) && ((_local6._vertices.indexOf(_local4) >= 0)))){
_local1[_local6] = true;
};
};
_local2++;
};
return (_local1);
}
private function transformPrimitive():void{
removePrimitive(primitive);
primitive.back = null;
primitive.front = null;
primitive.mobile = _mesh._mobile;
_mesh._scene.addPrimitives[primitive] = true;
}
public function get normal():Point3D{
var _local12:Number;
var _local1:Point3D = new Point3D();
var _local2:Vertex = _vertices[0];
var _local3:Point3D = _local2.coords;
_local2 = _vertices[1];
var _local4:Point3D = _local2.coords;
var _local5:Number = (_local4.x - _local3.x);
var _local6:Number = (_local4.y - _local3.y);
var _local7:Number = (_local4.z - _local3.z);
_local2 = _vertices[2];
var _local8:Point3D = _local2.coords;
var _local9:Number = (_local8.x - _local3.x);
var _local10:Number = (_local8.y - _local3.y);
var _local11:Number = (_local8.z - _local3.z);
_local1.x = ((_local11 * _local6) - (_local10 * _local7));
_local1.y = ((_local9 * _local7) - (_local11 * _local5));
_local1.z = ((_local10 * _local5) - (_local9 * _local6));
if (((((!((_local1.x == 0))) || (!((_local1.y == 0))))) || (!((_local1.z == 0))))){
_local12 = Math.sqrt((((_local1.x * _local1.x) + (_local1.y * _local1.y)) + (_local1.z * _local1.z)));
_local1.x = (_local1.x / _local12);
_local1.y = (_local1.y / _local12);
_local1.z = (_local1.z / _local12);
};
return (_local1);
}
public function getUV(_arg1:Point3D):Point{
return (getUVFast(_arg1, normal));
}
public function get vertices():Array{
return (new Array().concat(_vertices));
}
public function getUVFast(_arg1:Point3D, _arg2:Point3D):Point{
var _local3:uint;
if ((((((_aUV == null)) || ((_bUV == null)))) || ((_cUV == null)))){
return (null);
};
if (((_arg2.x)<0) ? -(_arg2.x) : _arg2.x > ((_arg2.y)<0) ? -(_arg2.y) : _arg2.y){
if (((_arg2.x)<0) ? -(_arg2.x) : _arg2.x > ((_arg2.z)<0) ? -(_arg2.z) : _arg2.z){
_local3 = 0;
} else {
_local3 = 2;
};
} else {
if (((_arg2.y)<0) ? -(_arg2.y) : _arg2.y > ((_arg2.z)<0) ? -(_arg2.z) : _arg2.z){
_local3 = 1;
} else {
_local3 = 2;
};
};
var _local4:Vertex = _vertices[0];
var _local5:Point3D = _local4._coords;
_local4 = _vertices[1];
var _local6:Point3D = _local4._coords;
_local4 = _vertices[2];
var _local7:Point3D = _local4._coords;
var _local8:Number = ((_local3)==0) ? (_local6.y - _local5.y) : (_local6.x - _local5.x);
var _local9:Number = ((_local3)==2) ? (_local6.y - _local5.y) : (_local6.z - _local5.z);
var _local10:Number = ((_local3)==0) ? (_local7.y - _local5.y) : (_local7.x - _local5.x);
var _local11:Number = ((_local3)==2) ? (_local7.y - _local5.y) : (_local7.z - _local5.z);
var _local12:Number = ((_local8 * _local11) - (_local10 * _local9));
var _local13:Number = ((_local3)==0) ? (_arg1.y - _local5.y) : (_arg1.x - _local5.x);
var _local14:Number = ((_local3)==2) ? (_arg1.y - _local5.y) : (_arg1.z - _local5.z);
var _local15:Number = (((_local13 * _local11) - (_local10 * _local14)) / _local12);
var _local16:Number = (((_local8 * _local14) - (_local13 * _local9)) / _local12);
var _local17:Number = (_bUV.x - _aUV.x);
var _local18:Number = (_bUV.y - _aUV.y);
var _local19:Number = (_cUV.x - _aUV.x);
var _local20:Number = (_cUV.y - _aUV.y);
return (new Point(((_aUV.x + (_local17 * _local15)) + (_local19 * _local16)), ((_aUV.y + (_local18 * _local15)) + (_local20 * _local16))));
}
function removeFromMesh(_arg1:Mesh):void{
_arg1.moveOperation.removeSequel(moveOperation);
_arg1.transformOperation.removeSequel(transformOperation);
_arg1.mobileOperation.removeSequel(transformPrimitiveOperation);
_mesh = null;
}
function addToScene(_arg1:Scene3D):void{
_arg1.removeOperation(removeOperation);
_arg1.addOperation(addOperation);
_arg1.addOperation(_arg1.calculatePrimitivesOperation);
_arg1.addPrimitives.add(primitive);
if (_mesh != null){
primitive.mobile = _mesh._mobile;
};
transformPrimitiveOperation.addSequel(_arg1.calculatePrimitivesOperation);
}
}
}//package com.alternativagame.engine3d
Section 8
//FillMaterial (com.alternativagame.engine3d.FillMaterial)
package com.alternativagame.engine3d {
import com.alternativagame.type.*;
import flash.display.*;
public class FillMaterial extends SurfaceMaterial {
var _color:uint;
private static var gfx:Graphics;
private static var focusDistance:Number;
private static var points1:Array = new Array();
private static var points2:Array = new Array();
public function FillMaterial(_arg1:uint=0x7F7F7F, _arg2:Number=1, _arg3:String="normal"):void{
super(_arg2, _arg3);
_color = _arg1;
}
private function clip(_arg1:uint, _arg2:Array, _arg3:Array, _arg4:Number, _arg5:Number, _arg6:Number):uint{
var _local7:Number;
var _local9:Point3D;
var _local13:Point3D;
var _local14:Number;
var _local8:uint;
var _local10:Point3D = _arg2[(_arg1 - 1)];
var _local11:Number = (((_arg4 * _local10.x) + (_arg5 * _local10.y)) + (_arg6 * _local10.z));
var _local12:uint;
while (_local12 < _arg1) {
_local13 = _arg2[_local12];
_local14 = (((_arg4 * _local13.x) + (_arg5 * _local13.y)) + (_arg6 * _local13.z));
if (_local14 > 0){
if (_local11 <= 0){
_local7 = (_local14 / (_local14 - _local11));
_local9 = _arg3[_local8];
if (_local9 == null){
_local9 = new Point3D((_local13.x - ((_local13.x - _local10.x) * _local7)), (_local13.y - ((_local13.y - _local10.y) * _local7)), (_local13.z - ((_local13.z - _local10.z) * _local7)));
_arg3[_local8] = _local9;
} else {
_local9.x = (_local13.x - ((_local13.x - _local10.x) * _local7));
_local9.y = (_local13.y - ((_local13.y - _local10.y) * _local7));
_local9.z = (_local13.z - ((_local13.z - _local10.z) * _local7));
};
_local8++;
};
_local9 = _arg3[_local8];
if (_local9 == null){
_local9 = _local13.clone();
_arg3[_local8] = _local9;
} else {
_local9.copy(_local13);
};
_local8++;
} else {
if (_local11 > 0){
_local7 = (_local14 / (_local14 - _local11));
_local9 = _arg3[_local8];
if (_local9 == null){
_local9 = new Point3D((_local13.x - ((_local13.x - _local10.x) * _local7)), (_local13.y - ((_local13.y - _local10.y) * _local7)), (_local13.z - ((_local13.z - _local10.z) * _local7)));
_arg3[_local8] = _local9;
} else {
_local9.x = (_local13.x - ((_local13.x - _local10.x) * _local7));
_local9.y = (_local13.y - ((_local13.y - _local10.y) * _local7));
_local9.z = (_local13.z - ((_local13.z - _local10.z) * _local7));
};
_local8++;
};
};
_local11 = _local14;
_local10 = _local13;
_local12++;
};
return (_local8);
}
public function set color(_arg1:uint):void{
if (_color != _arg1){
_color = _arg1;
addDrawParamsOperationToScene();
};
}
public function get color():uint{
return (_color);
}
override function draw(_arg1:Skin):void{
var _local6:Point3D;
var _local7:uint;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Point3D;
gfx = _arg1.gfx;
var _local2:Face = _arg1.face;
var _local3:Camera3D = _arg1.camera;
var _local4:uint = _arg1._primitive.num;
var _local5:Array = _arg1._primitive.points;
if (_local3._fov == 0){
gfx.beginFill(_color);
_local6 = _local3.calculateCameraCoord(_local5[0]);
gfx.moveTo(_local6.x, _local6.y);
_local7 = 1;
while (_local7 < _local4) {
_local6 = _local3.calculateCameraCoord(_local5[_local7]);
gfx.lineTo(_local6.x, _local6.y);
_local7++;
};
} else {
focusDistance = _local3.focusDistance;
_local7 = 0;
while (_local7 < _local4) {
_local6 = _local3.calculateCameraCoord(_local5[_local7]);
_local13 = points1[_local7];
if (_local13 == null){
_local13 = _local6.clone();
points1[_local7] = _local13;
} else {
_local13.copy(_local6);
};
_local7++;
};
_local8 = -(focusDistance);
_local9 = _local3._view.halfWidth;
_local10 = Math.sqrt(((_local8 * _local8) + (_local9 * _local9)));
_local8 = (_local8 / _local10);
_local9 = (_local9 / _local10);
_local4 = clip(_local4, points1, points2, _local8, 0, _local9);
if (_local4 < 3){
return;
};
_local4 = clip(_local4, points2, points1, -(_local8), 0, _local9);
if (_local4 < 3){
return;
};
_local11 = -(focusDistance);
_local9 = _local3._view.halfHeight;
_local10 = Math.sqrt(((_local11 * _local11) + (_local9 * _local9)));
_local11 = (_local11 / _local10);
_local9 = (_local9 / _local10);
_local4 = clip(_local4, points1, points2, 0, _local11, _local9);
if (_local4 < 3){
return;
};
_local4 = clip(_local4, points2, points1, 0, -(_local11), _local9);
if (_local4 < 3){
return;
};
gfx.beginFill(_color);
_local6 = points1[0];
_local12 = (focusDistance / _local6.z);
gfx.moveTo((_local6.x * _local12), (_local6.y * _local12));
_local7 = 1;
while (_local7 < _local4) {
_local6 = points1[_local7];
_local12 = (focusDistance / _local6.z);
gfx.lineTo((_local6.x * _local12), (_local6.y * _local12));
_local7++;
};
};
}
override public function clone():Material{
return (new FillMaterial(_color, _alpha, _blendMode));
}
}
}//package com.alternativagame.engine3d
Section 9
//Material (com.alternativagame.engine3d.Material)
package com.alternativagame.engine3d {
public class Material {
public function clone():Material{
return (new Material());
}
}
}//package com.alternativagame.engine3d
Section 10
//Mesh (com.alternativagame.engine3d.Mesh)
package com.alternativagame.engine3d {
import flash.geom.*;
import com.alternativagame.utility.*;
public class Mesh extends Object3D {
var _surfaces:Object;
var _vertices:Object;
var _faces:Object;
private static var counter:uint = 0;
public function Mesh(_arg1:String=null){
_vertices = new Object();
_faces = new Object();
_surfaces = new Object();
super(_arg1);
}
public function removeFace(_arg1:Object):Face{
var _local2 = (_arg1 is Face);
if (_arg1 == null){
throw (new Error(("Невозможно удалить из меша " + (_local2) ? "null-грань" : "грань с null-идентификатором")));
};
if (_local2){
if (Face(_arg1)._mesh != this){
throw (new Error("Невозможно удалить грань из меша, т.к. она в нём не находится"));
};
} else {
if (_faces[_arg1] == undefined){
throw (new Error("Невозможно удалить грань из меша, т.к. грани с таким идентификатором в меше нет"));
};
};
var _local3:Face = (_local2) ? Face(_arg1) : _faces[_arg1];
var _local4:Object = (_local2) ? getFaceId(Face(_arg1)) : _arg1;
if (_scene != null){
_local3.removeFromScene(_scene);
};
_local3.removeVertices();
if (_local3._surface != null){
_local3._surface._faces.remove(_local3);
_local3.removeFromSurface(_local3._surface);
};
_local3.removeFromMesh(this);
delete _faces[_local4];
return (_local3);
}
public function setMaterialToAllSurfaces(_arg1:SurfaceMaterial):void{
var _local2:Surface;
for each (_local2 in _surfaces) {
_local2.material = ((_arg1)!=null) ? SurfaceMaterial(_arg1.clone()) : null;
};
}
public function removeVertex(_arg1:Object):Vertex{
var _local2 = (_arg1 is Vertex);
if (_arg1 == null){
throw (new Error(("Невозможно удалить из меша " + (_local2) ? "null-вершину" : "вершину с null-идентификатором")));
};
if (_local2){
if (Vertex(_arg1)._mesh != this){
throw (new Error("Невозможно удалить вершину из меша, т.к. она в нём не находится"));
};
} else {
if (_vertices[_arg1] == undefined){
throw (new Error("Невозможно удалить вершину из меша, т.к. вершины с таким идентификатором в меше нет"));
};
};
var _local3:Vertex = (_local2) ? Vertex(_arg1) : _vertices[_arg1];
var _local4:Object = (_local2) ? getVertexId(Vertex(_arg1)) : _arg1;
if (_scene != null){
_local3.removeFromScene(_scene);
};
_local3.removeFromMesh(this);
delete _vertices[_local4];
return (_local3);
}
public function removeSurface(_arg1:Object):Surface{
var _local2 = (_arg1 is Surface);
if (_arg1 == null){
throw (new Error(("Невозможно удалить из меша " + (_local2) ? "null-поверхность" : "поверхность с null-идентификатором")));
};
if (_local2){
if (Surface(_arg1)._mesh != this){
throw (new Error("Невозможно удалить поверхность из меша, т.к. она в нём не находится"));
};
} else {
if (_surfaces[_arg1] == undefined){
throw (new Error("Невозможно удалить поверхность из меша, т.к. поверхности с таким идентификатором в меше нет"));
};
};
var _local3:Surface = (_local2) ? Surface(_arg1) : _surfaces[_arg1];
var _local4:Object = (_local2) ? getSurfaceId(Surface(_arg1)) : _arg1;
if (_scene != null){
_local3.removeFromScene(_scene);
};
_local3.removeFaces();
_local3.removeFromMesh(this);
delete _surfaces[_local4];
return (_local3);
}
public function addSurface(_arg1:Array=null, _arg2:Object=null):Surface{
var _local4:uint;
var _local5:uint;
var _local6:uint;
if (_arg2 != null){
if (_surfaces[_arg2] != undefined){
throw (new Error("Невозможно создать поверхность, т.к. уже есть поверхность с таким идентификатором"));
};
} else {
_local4 = 0;
while (_surfaces[_local4] != undefined) {
_local4++;
};
_arg2 = _local4;
};
var _local3:Surface = new Surface();
if (_scene != null){
_local3.addToScene(_scene);
};
_local3.addToMesh(this);
_surfaces[_arg2] = _local3;
if (_arg1 != null){
_local5 = _arg1.length;
_local6 = 0;
while (_local6 < _local5) {
_local3.addFace(_arg1[_local6]);
_local6++;
};
};
return (_local3);
}
public function getFaceId(_arg1:Face):Object{
var _local2:Object;
if (_arg1._mesh != this){
throw (new Error("Невозможно получить ID грани, т.к. грань не находится в меше"));
};
for (_local2 in _faces) {
if (_faces[_local2] == _arg1){
return (_local2);
};
};
return (null);
}
public function setMaterialToSurface(_arg1:SurfaceMaterial, _arg2:Object):void{
var _local3 = (_arg2 is Surface);
if (_arg2 == null){
throw (new Error(("Невозможно назначить материал " + (_local3) ? "null-поверхности" : "поверхности с null-идентификатором")));
};
if (_local3){
if (Surface(_arg2)._mesh != this){
throw (new Error("Невозможно назначить материал поверхности, т.к. она не находится в меше"));
};
} else {
if (_surfaces[_arg2] == undefined){
throw (new Error("Невозможно назначить материал поверхности, т.к. поверхности с таким идентификатором в меше нет"));
};
};
var _local4:Surface = (_local3) ? Surface(_arg2) : _surfaces[_arg2];
_local4.material = _arg1;
}
override function setScene(_arg1:Scene3D):void{
var _local2:Vertex;
var _local3:Face;
var _local4:Surface;
if (_scene != _arg1){
if (_arg1 != null){
for each (_local2 in _vertices) {
_local2.addToScene(_arg1);
};
for each (_local3 in _faces) {
_local3.addToScene(_arg1);
};
for each (_local4 in _surfaces) {
_local4.addToScene(_arg1);
};
} else {
for each (_local2 in _vertices) {
_local2.removeFromScene(_scene);
};
for each (_local3 in _faces) {
_local3.removeFromScene(_scene);
};
for each (_local4 in _surfaces) {
_local4.removeFromScene(_scene);
};
};
};
super.setScene(_arg1);
}
public function getVertexById(_arg1:Object):Vertex{
if (_vertices[_arg1] == undefined){
throw (new Error("Невозможно получить вершину, т.к. вершины с таким идентификатором в меше нет"));
};
return (_vertices[_arg1]);
}
public function getFaceById(_arg1:Object):Face{
if (_faces[_arg1] == undefined){
throw (new Error("Невозможно получить грань, т.к. грани с таким идентификатором в меше нет"));
};
return (_faces[_arg1]);
}
public function getVertexId(_arg1:Vertex):Object{
var _local2:Object;
if (_arg1._mesh != this){
throw (new Error("Невозможно получить ID вершины, т.к. вершина не находится в меше"));
};
for (_local2 in _vertices) {
if (_vertices[_local2] == _arg1){
return (_local2);
};
};
return (null);
}
public function hasFace(_arg1:Object):Boolean{
if ((_arg1 is Face)){
return ((_arg1._mesh == this));
};
return (!((_faces[_arg1] == undefined)));
}
public function hasVertex(_arg1:Object):Boolean{
if ((_arg1 is Vertex)){
return ((_arg1._mesh == this));
};
return (!((_vertices[_arg1] == undefined)));
}
public function addVertex(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Object=null):Vertex{
var _local6:uint;
if (_arg4 != null){
if (_vertices[_arg4] != undefined){
throw (new Error("Невозможно создать вершину, т.к. уже есть вершина с таким идентификатором"));
};
} else {
_local6 = 0;
while (_vertices[_local6] != undefined) {
_local6++;
};
_arg4 = _local6;
};
var _local5:Vertex = new Vertex(_arg1, _arg2, _arg3);
if (_scene != null){
_local5.addToScene(_scene);
};
_local5.addToMesh(this);
_vertices[_arg4] = _local5;
return (_local5);
}
public function get surfaces():Object{
return (ObjectUtility.clone(_surfaces));
}
public function setUVsToFace(_arg1:Point, _arg2:Point, _arg3:Point, _arg4:Object):void{
var _local5 = (_arg4 is Face);
if (_arg4 == null){
throw (new Error(("Невозможно назначить UV-координаты " + (_local5) ? "null-грани" : "грани с null-идентификатором")));
};
if (_local5){
if (Face(_arg4)._mesh != this){
throw (new Error("Невозможно назначить UV-координаты грани, т.к. она не находится в меше"));
};
} else {
if (_faces[_arg4] == undefined){
throw (new Error("Невозможно назначить UV-координаты грани, т.к. грани с таким идентификатором в меше нет"));
};
};
var _local6:Face = (_local5) ? Face(_arg4) : _faces[_arg4];
_local6.aUV = _arg1;
_local6.bUV = _arg2;
_local6.cUV = _arg3;
}
public function getSurfaceById(_arg1:Object):Surface{
if (_surfaces[_arg1] == undefined){
throw (new Error("Невозможно получить поверхность, т.к. поверхности с таким идентификатором в меше нет"));
};
return (_surfaces[_arg1]);
}
override protected function defaultName():String{
return (("mesh" + ++counter));
}
public function addFace(_arg1:Array, _arg2:Object=null):Face{
var _local5:Vertex;
var _local8:uint;
if (_arg1 == null){
throw (new Error("Невозможно создать грань без точек"));
};
if (_arg2 != null){
if (_faces[_arg2] != undefined){
throw (new Error("Невозможно создать грань, т.к. уже есть грань с таким идентификатором"));
};
} else {
_local8 = 0;
while (_faces[_local8] != undefined) {
_local8++;
};
_arg2 = _local8;
};
var _local3:uint = _arg1.length;
if (_local3 < 3){
throw (new Error("Невозможно создать грань, т.к. необходимо не менее трёх вершин"));
};
var _local4:Array = new Array();
var _local6:uint;
while (_local6 < _local3) {
if ((_arg1[_local6] is Vertex)){
_local5 = _arg1[_local6];
if (_local5._mesh != this){
throw (new Error("Невозможно создать грань, т.к. необходимо, чтобы все вершины находились в этом меше"));
};
} else {
_local5 = _vertices[_arg1[_local6]];
if (_local5 == null){
throw (new Error("Невозможно создать грань, т.к. одна из вершин по указанному идентификатору не найдена"));
};
};
_local4.push(_local5);
_local6++;
};
var _local7:Face = new Face(_local4);
if (_scene != null){
_local7.addToScene(_scene);
};
_local7.addToMesh(this);
_faces[_arg2] = _local7;
return (_local7);
}
public function getSurfaceId(_arg1:Surface):Object{
var _local2:Object;
if (_arg1._mesh != this){
throw (new Error("Невозможно получить ID поверхности, т.к. поверхность не находится в меше"));
};
for (_local2 in _surfaces) {
if (_surfaces[_local2] == _arg1){
return (_local2);
};
};
return (null);
}
public function get faces():Object{
return (ObjectUtility.clone(_faces));
}
public function get vertices():Object{
return (ObjectUtility.clone(_vertices));
}
public function hasSurface(_arg1:Object):Boolean{
if ((_arg1 is Surface)){
return ((_arg1._mesh == this));
};
return (!((_surfaces[_arg1] == undefined)));
}
override public function toString():String{
return ((((((((("[" + ObjectUtility.getClassName(this)) + " ") + _name) + " vertices: ") + ObjectUtility.length(_vertices)) + " faces: ") + ObjectUtility.length(_faces)) + "]"));
}
}
}//package com.alternativagame.engine3d
Section 11
//Object3D (com.alternativagame.engine3d.Object3D)
package com.alternativagame.engine3d {
import com.alternativagame.type.*;
import flash.utils.*;
import com.alternativagame.utility.*;
public class Object3D {
var _scene:Scene3D;
var moveOperation:Operation;
var globalCoords:Point3D;
var locationOperation:Operation;
var _solid:Boolean;// = false
var _coords:Point3D;
var _rotX:Number;// = 0
var _mobile:uint;// = 0
var removeOperation:Operation;
var addOperation:Operation;
private var _solidObjects:Dictionary;
var _parent:Object3D;
var transformMatrix:Matrix3D;
var _rotY:Number;// = 0
var _objects:Set;
var transformOperation:Operation;
var calculateTransformOperation:Operation;
var mobileOperation:Operation;
var _name:String;
var _scaleX:Number;// = 1
var _scaleY:Number;// = 1
var _rotZ:Number;// = 0
var _solidParent:Object3D;
var _scaleZ:Number;// = 1
private static var counter:uint = 0;
public function Object3D(_arg1:String=null){
addOperation = new Operation("add", this);
removeOperation = new Operation("remove", this);
locationOperation = new Operation("location", this);
transformOperation = new Operation("transform", this);
moveOperation = new Operation("move", this);
mobileOperation = new Operation("mobile", this);
calculateTransformOperation = new Operation("calculateTransform", this, calculateTransform, Operation.OBJECT_TRANSFORMATION);
_objects = new Set();
_solidObjects = new Dictionary(true);
_coords = new Point3D();
transformMatrix = new Matrix3D();
globalCoords = new Point3D();
super();
_solidParent = this;
addSolidObject(this);
_name = ((_arg1)!=null) ? _arg1 : defaultName();
addOperation.addSequel(calculateTransformOperation);
locationOperation.addSequel(calculateTransformOperation);
transformOperation.addSequel(calculateTransformOperation);
moveOperation.addSequel(calculateTransformOperation);
}
public function get z():Number{
return (_coords.z);
}
public function get rotX():Number{
return (_rotX);
}
public function get rotZ():Number{
return (_rotZ);
}
public function set rotX(_arg1:Number):void{
if (_rotX != _arg1){
_rotX = _arg1;
addOperationToScene(transformOperation);
};
}
protected function removeFromScene(_arg1:Scene3D):void{
_arg1.removeOperation(addOperation);
_arg1.removeOperation(locationOperation);
_arg1.removeOperation(transformOperation);
_arg1.removeOperation(moveOperation);
_arg1.removeOperation(mobileOperation);
_arg1.addOperation(removeOperation);
mobileOperation.removeSequel(_arg1.calculatePrimitivesOperation);
}
protected function defaultName():String{
return (("object" + ++counter));
}
public function get scene():Scene3D{
return (_scene);
}
public function get objects():Set{
return (_objects.clone());
}
function setSolidParent(_arg1:Object3D):void{
var _local2:*;
var _local3:Object3D;
_solidParent.removeSolidObject(this);
_arg1.addSolidObject(this);
if (!_solid){
for (_local2 in _objects) {
_local3 = _local2;
_local3.setSolidParent(_arg1);
};
};
_solidParent = _arg1;
}
public function set scaleX(_arg1:Number):void{
if (_scaleX != _arg1){
_scaleX = _arg1;
addOperationToScene(transformOperation);
};
}
public function set name(_arg1:String):void{
_name = _arg1;
}
public function get coords():Point3D{
return (_coords.clone());
}
public function set scaleZ(_arg1:Number):void{
if (_scaleZ != _arg1){
_scaleZ = _arg1;
addOperationToScene(transformOperation);
};
}
public function get mobile():uint{
return (_mobile);
}
public function get name():String{
return (_name);
}
public function set scaleY(_arg1:Number):void{
if (_scaleY != _arg1){
_scaleY = _arg1;
addOperationToScene(transformOperation);
};
}
private function calculateTransform():void{
if (((((transformOperation.queued) || (locationOperation.queued))) || (addOperation.queued))){
transformMatrix.toTransform(_coords.x, _coords.y, _coords.z, _rotX, _rotY, _rotZ, _scaleX, _scaleY, _scaleZ);
if (_parent != null){
transformMatrix.combine(_parent.transformMatrix);
};
globalCoords.x = transformMatrix.d;
globalCoords.y = transformMatrix.h;
globalCoords.z = transformMatrix.l;
} else {
globalCoords.copy(coords);
if (_parent != null){
globalCoords.transform(_parent.transformMatrix);
};
transformMatrix.offset(globalCoords.x, globalCoords.y, globalCoords.z);
};
}
public function get solid():Boolean{
return (_solid);
}
function removeSolidObject(_arg1:Object3D):void{
var _local3:Class;
var _local2:Array = ObjectUtility.getClassTree(_arg1, Object3D);
var _local4:uint;
while (_local4 < _local2.length) {
_local3 = _local2[_local4];
Set(_solidObjects[_local3]).remove(_arg1);
if (Set(_solidObjects[_local3]).isEmpty()){
delete _solidObjects[_local3];
};
_local4++;
};
}
function addSolidObject(_arg1:Object3D):void{
var _local3:Class;
var _local2:Array = ObjectUtility.getClassTree(_arg1, Object3D);
var _local4:uint;
while (_local4 < _local2.length) {
_local3 = _local2[_local4];
if (_solidObjects[_local3] == undefined){
_solidObjects[_local3] = new Set();
};
_solidObjects[_local3].add(_arg1);
_local4++;
};
}
public function get parent():Object3D{
return (_parent);
}
public function get solidParent():Object3D{
return (_solidParent);
}
function addOperationToScene(_arg1:Operation):void{
if (_scene != null){
_scene.addOperation(_arg1);
};
}
public function set coords(_arg1:Point3D):void{
if (!_coords.equals(_arg1)){
_coords.copy(_arg1);
addOperationToScene(moveOperation);
};
}
function setParent(_arg1:Object3D):void{
if (_parent != null){
removeParentSequels();
};
_parent = _arg1;
if (_arg1 != null){
addParentSequels();
setSolidParent((_arg1._solid) ? _arg1 : _arg1._solidParent);
} else {
setSolidParent(this);
};
}
public function addObject(_arg1:Object3D):void{
var _local2:Object3D;
if (_arg1 != null){
if (_arg1._parent != this){
if (_arg1 != this){
if (_arg1._parent != null){
_arg1._parent._objects.remove(_arg1);
} else {
if (((!((_arg1._scene == null))) && ((_arg1._scene._root == _arg1)))){
_arg1._scene.root = null;
};
};
if (_arg1._scene == _scene){
_local2 = _parent;
while (_local2 != null) {
if (_arg1 == _local2){
throw (new Error(("Невозможно присоединить родительский объект " + _arg1)));
};
_local2 = _local2._parent;
};
};
_objects.add(_arg1);
_arg1.setParent(this);
_arg1.setLevel((calculateTransformOperation.level + 1));
_arg1.setScene(_scene);
} else {
throw (new Error("Невозможно присоединить себя к себе"));
};
} else {
throw (new Error("Невозможно присоединить уже присоединённый объект"));
};
} else {
throw (new Error("Невозможно присоединить null-объект"));
};
}
private function addParentSequels():void{
_parent.moveOperation.addSequel(moveOperation);
_parent.transformOperation.addSequel(transformOperation);
}
public function get scaleX():Number{
return (_scaleX);
}
private function removeParentSequels():void{
_parent.moveOperation.removeSequel(moveOperation);
_parent.transformOperation.removeSequel(transformOperation);
}
public function set mobile(_arg1:uint):void{
if (_mobile != _arg1){
_mobile = _arg1;
addOperationToScene(mobileOperation);
};
}
public function set solid(_arg1:Boolean):void{
var _local2:Object3D;
var _local3:*;
var _local4:Object3D;
if (_solid != _arg1){
_solid = _arg1;
if (_arg1){
_local2 = this;
} else {
_local2 = _solidParent;
};
for (_local3 in _objects) {
_local4 = _local3;
_local4.setSolidParent(_local2);
};
};
}
public function get scaleZ():Number{
return (_scaleZ);
}
function setScene(_arg1:Scene3D):void{
var _local2:*;
var _local3:Object3D;
if (_scene != _arg1){
if (_scene != null){
removeFromScene(_scene);
};
if (_arg1 != null){
addToScene(_arg1);
};
_scene = _arg1;
} else {
addOperationToScene(locationOperation);
};
for (_local2 in _objects) {
_local3 = _local2;
_local3.setScene(_scene);
};
}
function getSolidObjects(_arg1:Class=null):Set{
if (((_solid) || ((_parent == null)))){
_arg1 = ((_arg1)==null) ? Object3D : _arg1;
if (_solidObjects[_arg1] != undefined){
return (Set(_solidObjects[_arg1]));
};
return (new Set());
//unresolved jump
};
return (solidParent.getSolidObjects(_arg1));
}
public function get rotY():Number{
return (_rotY);
}
public function removeObject(_arg1:Object3D):void{
if (_arg1 != null){
if (_arg1._parent == this){
_objects.remove(_arg1);
_arg1.setParent(null);
_arg1.setScene(null);
} else {
throw (new Error("Невозможно удалить связь с объектом, т.к. он не является дочерним"));
};
} else {
throw (new Error("Невозможно удалить дочернюю связь с null-объектом"));
};
}
public function set rotY(_arg1:Number):void{
if (_rotY != _arg1){
_rotY = _arg1;
addOperationToScene(transformOperation);
};
}
public function get scaleY():Number{
return (_scaleY);
}
public function set rotZ(_arg1:Number):void{
if (_rotZ != _arg1){
_rotZ = _arg1;
addOperationToScene(transformOperation);
};
}
public function get solidObjects():Set{
return (getSolidObjects().clone());
}
protected function addToScene(_arg1:Scene3D):void{
_arg1.removeOperation(removeOperation);
_arg1.addOperation(addOperation);
mobileOperation.addSequel(_arg1.calculatePrimitivesOperation);
}
public function set y(_arg1:Number):void{
if (_coords.y != _arg1){
_coords.y = _arg1;
addOperationToScene(moveOperation);
};
}
public function toString():String{
return ((((("[" + ObjectUtility.getClassName(this)) + " ") + _name) + "]"));
}
public function set z(_arg1:Number):void{
if (_coords.z != _arg1){
_coords.z = _arg1;
addOperationToScene(moveOperation);
};
}
public function set x(_arg1:Number):void{
if (_coords.x != _arg1){
_coords.x = _arg1;
addOperationToScene(moveOperation);
};
}
public function get x():Number{
return (_coords.x);
}
public function get y():Number{
return (_coords.y);
}
function setLevel(_arg1:uint):void{
var _local2:*;
var _local3:Object3D;
calculateTransformOperation.level = _arg1;
for (_local2 in _objects) {
_local3 = _local2;
_local3.setLevel((_arg1 + 1));
};
}
function removeOperationFromScene(_arg1:Operation):void{
if (_scene != null){
_scene.removeOperation(_arg1);
};
}
}
}//package com.alternativagame.engine3d
Section 12
//Operation (com.alternativagame.engine3d.Operation)
package com.alternativagame.engine3d {
import com.alternativagame.type.*;
public class Operation {
public var queued:Boolean;// = false
var method:Function;
public var priority:uint;
var name:String;
public var level:uint;// = 0
private var sequel:Operation;
private var sequels:Set;
var object:Object;
public static const SCENE_CLEAR_PRIMITIVES:uint = 11;
public static const FACE_UV:uint = 3;
public static const VERTEX_TRANSFORMATION:uint = 1;
public static const CAMERA_CALCULATE_SKINS:uint = 10;
public static const OBJECT_TRANSFORMATION:uint = 0;
public static const FACE_TRANSFORM:uint = 4;
public static const SKIN_DRAW:uint = 9;
public static const CAMERA_CLEAR_CALCULATED:uint = 8;
public static const CAMERA_MATRIX:uint = 7;
public static const SCENE_CALCULATE_PRIMITIVES:uint = 5;
public static const FACE_PLANE:uint = 2;
public static const FACE_CALCULATE_UV:uint = 6;
public function Operation(_arg1:String, _arg2:Object=null, _arg3:Function=null, _arg4:uint=0, _arg5:uint=0){
this.object = _arg2;
this.method = _arg3;
this.name = _arg1;
this.priority = _arg4;
this.level = _arg5;
}
function addSequel(_arg1:Operation):void{
if (sequel == null){
if (sequels == null){
sequel = _arg1;
} else {
sequels[_arg1] = true;
};
} else {
if (sequel != _arg1){
sequels = new Set(true);
sequels[sequel] = true;
sequels[_arg1] = true;
sequel = null;
};
};
}
public function toString():String{
return ((((((((("[Operation " + priority) + "/") + level) + " ") + object) + ".") + name) + "]"));
}
function removeSequel(_arg1:Operation):void{
var _local2:*;
var _local3:Boolean;
if (sequel == null){
if (sequels != null){
delete sequels[_arg1];
_local3 = false;
for (_local2 in sequels) {
if (_local3){
_local3 = false;
break;
};
_local3 = true;
};
if (_local3){
sequel = _local2;
sequels = null;
};
};
} else {
if (sequel == _arg1){
sequel = null;
};
};
}
function collectSequels(_arg1:Array):void{
var _local2:*;
var _local3:Operation;
if (sequel == null){
for (_local2 in sequels) {
_local3 = _local2;
if (!_local3.queued){
_arg1.push(_local3);
_local3.queued = true;
_local3.collectSequels(_arg1);
};
};
} else {
if (!sequel.queued){
_arg1.push(sequel);
sequel.queued = true;
sequel.collectSequels(_arg1);
};
};
}
}
}//package com.alternativagame.engine3d
Section 13
//PolyPrimitive (com.alternativagame.engine3d.PolyPrimitive)
package com.alternativagame.engine3d {
public class PolyPrimitive {
var sibling:PolyPrimitive;
var node:BSPNode;
var splitTime1:Number;
var num:uint;
var splitTime2:Number;
public var splits:uint;
var face:Face;
public var mobile:uint;
var points:Array;
var back:PolyPrimitive;
var front:PolyPrimitive;
var parent:PolyPrimitive;
var uvs:Array;
private static var collector:Array = new Array();
public function PolyPrimitive(){
points = new Array();
uvs = new Array();
super();
}
public function toString():String{
return ((("[Primitive " + face._mesh._name) + "]"));
}
static function destroyPolyPrimitive(_arg1:PolyPrimitive):void{
_arg1.face = null;
var _local2:uint;
while (_local2 < _arg1.num) {
_arg1.points.pop();
_arg1.uvs.pop();
_local2++;
};
collector.push(_arg1);
}
static function createPolyPrimitive():PolyPrimitive{
var _local1:PolyPrimitive = collector.pop();
if (_local1 == null){
_local1 = new (PolyPrimitive);
};
return (_local1);
}
}
}//package com.alternativagame.engine3d
Section 14
//Scene3D (com.alternativagame.engine3d.Scene3D)
package com.alternativagame.engine3d {
import com.alternativagame.type.*;
import flash.geom.*;
import com.alternativagame.engine3d.collision.*;
import flash.display.*;
public class Scene3D {
const planeOffsetTreshold:Number = 0.1;
private var collisionPlanePoint:Point3D;
private var removeNodes:Set;
var removePrimitives:Set;
var calculatePrimitivesOperation:Operation;
private var collisionPoint:Point3D;
private var collisionVector:Point3D;
private var operationSort:Array;
var childPrimitives:Set;
private var operationSortOptions:Array;
private var collisionPrimitivePoint:Point3D;
var bsp:BSPNode;
private var collisionNormal:Point3D;
var _root:Object3D;
private var collisionPrimitiveNearestPoint:Point3D;
private var collisionPrimitiveNearest:PolyPrimitive;
var lowerPrimitives:Set;
var clearPrimitivesOperation:Operation;
private var dummyNode:BSPNode;
private var collisionPrimitiveNearestLengthSqr:Number;
private var collisionPrimitive:PolyPrimitive;
private var addSortOptions:Array;
private var addSort:Array;
private var collisionRadius:Number;
private var collisionOffset:Number;
private var addList:Array;
private var collisionPlanes:Array;
private var operations:Array;
private var collisionSource:Point3D;
var addPrimitives:Set;
private var collisionDestination:Point3D;
private static var pointOffsets:Array = new Array();
public function Scene3D(){
calculatePrimitivesOperation = new Operation("calculatePrimitives", this, calculatePrimitives, Operation.SCENE_CALCULATE_PRIMITIVES);
clearPrimitivesOperation = new Operation("clearPrimitives", this, clearPrimitives, Operation.SCENE_CLEAR_PRIMITIVES);
operations = new Array();
operationSort = ["priority", "level"];
operationSortOptions = [Array.NUMERIC, Array.NUMERIC];
addPrimitives = new Set();
removePrimitives = new Set();
childPrimitives = new Set();
lowerPrimitives = new Set();
addList = new Array();
addSort = ["mobile", "splits"];
addSortOptions = [(Array.NUMERIC | Array.DESCENDING), (Array.NUMERIC | Array.DESCENDING)];
removeNodes = new Set();
dummyNode = new BSPNode();
collisionDestination = new Point3D();
collisionPlanes = new Array();
collisionPlanePoint = new Point3D();
collisionPrimitivePoint = new Point3D();
collisionPrimitiveNearestPoint = new Point3D();
collisionPoint = new Point3D();
collisionNormal = new Point3D();
super();
calculatePrimitivesOperation.addSequel(clearPrimitivesOperation);
}
private function childBSP(_arg1:BSPNode):void{
var _local2:PolyPrimitive;
var _local3:*;
if (((!((_arg1 == null))) && (!((_arg1 == dummyNode))))){
_local2 = _arg1.primitive;
if (_local2 != null){
childPrimitives[_local2] = true;
removePrimitives[_local2] = true;
_arg1.primitive = null;
_local2.node = null;
} else {
for (_local3 in _arg1.backPrimitives) {
_local2 = _local3;
_local2.node = null;
childPrimitives[_local2] = true;
removePrimitives[_local2] = true;
};
for (_local3 in _arg1.frontPrimitives) {
_local2 = _local3;
_local2.node = null;
childPrimitives[_local2] = true;
removePrimitives[_local2] = true;
};
_arg1.backPrimitives = null;
_arg1.frontPrimitives = null;
};
childBSP(_arg1.back);
childBSP(_arg1.front);
_arg1.parent = null;
_arg1.back = null;
_arg1.front = null;
BSPNode.destroyBSPNode(_arg1);
};
}
public function drawBSPNode(_arg1:BSPNode, _arg2:Sprite, _arg3:Number, _arg4:Number, _arg5:Number):void{
var _local8:PolyPrimitive;
var _local6:Shape = new Shape();
_arg2.addChild(_local6);
_local6.x = _arg3;
_local6.y = _arg4;
var _local7:uint = 0xFF0000;
if (_arg1.primitive != null){
_local8 = _arg1.primitive;
} else {
if (_arg1.frontPrimitives != null){
_local8 = _arg1.frontPrimitives.first();
};
};
if (_local8 != null){
if (((!((_local8.face._surface == null))) && (!((_local8.face._surface._material == null))))){
if ((_local8.face._surface._material is FillMaterial)){
_local7 = FillMaterial(_local8.face._surface._material)._color;
};
if ((_local8.face._surface._material is WireMaterial)){
_local7 = WireMaterial(_local8.face._surface._material)._color;
};
if ((_local8.face._surface._material is TextureMaterial)){
_local7 = TextureMaterial(_local8.face._surface._material).texture.bitmapData.getPixel(0, 0);
};
};
};
if (_arg1 == dummyNode){
_local7 = 0xFF00FF;
};
_local6.graphics.beginFill(_local7);
_local6.graphics.drawCircle(0, 0, 3);
_local6.graphics.endFill();
var _local9:Number = 100;
var _local10:Number = 20;
if (_arg1.back != null){
_arg2.graphics.lineStyle(0, 0x660000);
_arg2.graphics.moveTo(_arg3, _arg4);
_arg2.graphics.lineTo((_arg3 - (_local9 * _arg5)), (_arg4 + _local10));
drawBSPNode(_arg1.back, _arg2, (_arg3 - (_local9 * _arg5)), (_arg4 + _local10), (_arg5 * 0.8));
};
if (_arg1.front != null){
_arg2.graphics.lineStyle(0, 0x6600);
_arg2.graphics.moveTo(_arg3, _arg4);
_arg2.graphics.lineTo((_arg3 + (_local9 * _arg5)), (_arg4 + _local10));
drawBSPNode(_arg1.front, _arg2, (_arg3 + (_local9 * _arg5)), (_arg4 + _local10), (_arg5 * 0.8));
};
}
private function removeBSPPrimitive(_arg1:PolyPrimitive):void{
var _local4:*;
var _local5:BSPNode;
var _local2:BSPNode = _arg1.node;
_arg1.node = null;
var _local3:Boolean;
if (_local2.primitive == _arg1){
removeNodes[_local2] = true;
_local2.primitive = null;
} else {
if (_local2.frontPrimitives[_arg1]){
delete _local2.frontPrimitives[_arg1];
for (_local4 in _local2.frontPrimitives) {
if (_local3){
_local3 = false;
break;
};
_local3 = true;
};
if (_local4 == null){
_local5 = _local2.back;
_local2.back = _local2.front;
_local2.front = _local5;
_local2.normal.invert();
_local2.offset = -(_local2.offset);
for (_local4 in _local2.backPrimitives) {
if (_local3){
_local3 = false;
break;
};
_local3 = true;
};
if (_local3){
_local2.primitive = _local4;
_local2.mobile = _local2.primitive.mobile;
_local2.frontPrimitives = null;
} else {
_local2.frontPrimitives = _local2.backPrimitives;
if (_arg1.mobile == _local2.mobile){
_local2.mobile = uint.MAX_VALUE;
for (_local4 in _local2.frontPrimitives) {
_arg1 = _local4;
_local2.mobile = ((_local2.mobile)>_arg1.mobile) ? _arg1.mobile : _local2.mobile;
};
};
};
_local2.backPrimitives = null;
} else {
if (((_local3) && ((_local2.backPrimitives == null)))){
_local2.primitive = _local4;
_local2.mobile = _local2.primitive.mobile;
_local2.frontPrimitives = null;
} else {
if (_arg1.mobile == _local2.mobile){
_local2.mobile = uint.MAX_VALUE;
for (_local4 in _local2.backPrimitives) {
_arg1 = _local4;
_local2.mobile = ((_local2.mobile)>_arg1.mobile) ? _arg1.mobile : _local2.mobile;
};
for (_local4 in _local2.frontPrimitives) {
_arg1 = _local4;
_local2.mobile = ((_local2.mobile)>_arg1.mobile) ? _arg1.mobile : _local2.mobile;
};
};
};
};
} else {
delete _local2.backPrimitives[_arg1];
for (_local4 in _local2.backPrimitives) {
break;
};
if (_local4 == null){
for (_local4 in _local2.frontPrimitives) {
if (_local3){
_local3 = false;
break;
};
_local3 = true;
};
if (_local3){
_local2.primitive = _local4;
_local2.mobile = _local2.primitive.mobile;
_local2.frontPrimitives = null;
} else {
if (_arg1.mobile == _local2.mobile){
_local2.mobile = uint.MAX_VALUE;
for (_local4 in _local2.frontPrimitives) {
_arg1 = _local4;
_local2.mobile = ((_local2.mobile)>_arg1.mobile) ? _arg1.mobile : _local2.mobile;
};
};
};
_local2.backPrimitives = null;
} else {
if (_arg1.mobile == _local2.mobile){
_local2.mobile = uint.MAX_VALUE;
for (_local4 in _local2.backPrimitives) {
_arg1 = _local4;
_local2.mobile = ((_local2.mobile)>_arg1.mobile) ? _arg1.mobile : _local2.mobile;
};
for (_local4 in _local2.frontPrimitives) {
_arg1 = _local4;
_local2.mobile = ((_local2.mobile)>_arg1.mobile) ? _arg1.mobile : _local2.mobile;
};
};
};
};
};
}
private function clearPrimitives():void{
addPrimitives.clear();
removePrimitives.clear();
}
private function calculateSplits():void{
var _local3:PolyPrimitive;
var _local4:Point3D;
var _local5:Number;
var _local6:uint;
var _local7:PolyPrimitive;
var _local8:Boolean;
var _local9:Boolean;
var _local10:uint;
var _local11:Point3D;
var _local12:Number;
var _local1:uint = addList.length;
var _local2:uint;
while (_local2 < _local1) {
_local3 = addList[_local2];
_local4 = _local3.face.globalNormal;
_local5 = _local3.face.globalOffset;
_local3.splits = 0;
_local6 = 0;
while (_local6 < _local1) {
if (_local2 != _local6){
_local7 = addList[_local6];
if (_local3.mobile <= _local7.mobile){
_local8 = false;
_local9 = false;
_local10 = 0;
while (_local10 < _local7.num) {
_local11 = _local7.points[_local10];
_local12 = ((((_local11.x * _local4.x) + (_local11.y * _local4.y)) + (_local11.z * _local4.z)) - _local5);
if (_local12 > planeOffsetTreshold){
if (_local9){
_local3.splits++;
break;
} else {
_local8 = true;
};
} else {
if (_local12 < -(planeOffsetTreshold)){
if (_local8){
_local3.splits++;
break;
} else {
_local9 = true;
};
};
};
_local10++;
};
};
};
_local6++;
};
_local2++;
};
}
private function assemblePrimitive(_arg1:PolyPrimitive, _arg2:Set):void{
if (((!((_arg1.sibling == null))) && (canAssemble(_arg1.sibling, _arg2)))){
assemblePrimitive(_arg1.parent, _arg2);
_arg1.sibling.sibling = null;
_arg1.sibling.parent = null;
PolyPrimitive.destroyPolyPrimitive(_arg1.sibling);
_arg1.sibling = null;
_arg1.parent.back = null;
_arg1.parent.front = null;
_arg1.parent = null;
PolyPrimitive.destroyPolyPrimitive(_arg1);
} else {
_arg2[_arg1] = true;
};
}
private function calculateCollisionWithPrimitive(_arg1:PolyPrimitive):void{
var _local7:Point3D;
var _local8:Point3D;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:Number;
var _local19:Number;
var _local20:Number;
var _local21:Number;
var _local22:Number;
var _local23:Number;
var _local24:Number;
var _local25:Number;
var _local2:uint = _arg1.num;
var _local3:Array = _arg1.points;
var _local4:Point3D = _arg1.face.globalNormal;
var _local5:Boolean;
var _local6:uint;
while (_local6 < _local2) {
_local7 = _local3[_local6];
_local8 = _local3[((_local6)<(_local2 - 1)) ? (_local6 + 1) : 0];
_local9 = (_local8.x - _local7.x);
_local10 = (_local8.y - _local7.y);
_local11 = (_local8.z - _local7.z);
_local12 = (collisionPlanePoint.x - _local7.x);
_local13 = (collisionPlanePoint.y - _local7.y);
_local14 = (collisionPlanePoint.z - _local7.z);
_local15 = ((_local13 * _local11) - (_local14 * _local10));
_local16 = ((_local14 * _local9) - (_local12 * _local11));
_local17 = ((_local12 * _local10) - (_local13 * _local9));
if ((((_local15 * _local4.x) + (_local16 * _local4.y)) + (_local17 * _local4.z)) > 0){
_local5 = false;
_local18 = (((_local9 * _local9) + (_local10 * _local10)) + (_local11 * _local11));
_local19 = ((((_local15 * _local15) + (_local16 * _local16)) + (_local17 * _local17)) / _local18);
if (_local19 < collisionPrimitiveNearestLengthSqr){
_local20 = Math.sqrt(_local18);
_local21 = (_local9 / _local20);
_local22 = (_local10 / _local20);
_local23 = (_local11 / _local20);
_local24 = (((_local21 * _local12) + (_local22 * _local13)) + (_local23 * _local14));
if (_local24 < 0){
_local25 = (((_local12 * _local12) + (_local13 * _local13)) + (_local14 * _local14));
if (_local25 < collisionPrimitiveNearestLengthSqr){
collisionPrimitiveNearestLengthSqr = _local25;
collisionPrimitiveNearestPoint.x = _local7.x;
collisionPrimitiveNearestPoint.y = _local7.y;
collisionPrimitiveNearestPoint.z = _local7.z;
collisionPrimitiveNearest = _arg1;
};
} else {
if (_local24 > _local20){
_local12 = (collisionPlanePoint.x - _local8.x);
_local13 = (collisionPlanePoint.y - _local8.y);
_local14 = (collisionPlanePoint.z - _local8.z);
_local25 = (((_local12 * _local12) + (_local13 * _local13)) + (_local14 * _local14));
if (_local25 < collisionPrimitiveNearestLengthSqr){
collisionPrimitiveNearestLengthSqr = _local25;
collisionPrimitiveNearestPoint.x = _local8.x;
collisionPrimitiveNearestPoint.y = _local8.y;
collisionPrimitiveNearestPoint.z = _local8.z;
collisionPrimitiveNearest = _arg1;
};
} else {
collisionPrimitiveNearestLengthSqr = _local19;
collisionPrimitiveNearestPoint.x = (_local7.x + (_local21 * _local24));
collisionPrimitiveNearestPoint.y = (_local7.y + (_local22 * _local24));
collisionPrimitiveNearestPoint.z = (_local7.z + (_local23 * _local24));
collisionPrimitiveNearest = _arg1;
};
};
};
};
_local6++;
};
if (_local5){
collisionPrimitive = _arg1;
};
}
private function removeBSPNode(_arg1:BSPNode):BSPNode{
var _local2:BSPNode;
if (_arg1 != null){
_arg1.back = removeBSPNode(_arg1.back);
_arg1.front = removeBSPNode(_arg1.front);
if (!removeNodes[_arg1]){
_local2 = _arg1;
if (_arg1.back != null){
if (_arg1.back != dummyNode){
_arg1.back.parent = _arg1;
} else {
_arg1.back = null;
};
};
if (_arg1.front != null){
if (_arg1.front != dummyNode){
_arg1.front.parent = _arg1;
} else {
_arg1.front = null;
};
};
} else {
if (_arg1.back == null){
if (_arg1.front != null){
_local2 = _arg1.front;
_arg1.front = null;
};
} else {
if (_arg1.front == null){
_local2 = _arg1.back;
_arg1.back = null;
} else {
childBSP(_arg1.back);
childBSP(_arg1.front);
_local2 = dummyNode;
_arg1.back = null;
_arg1.front = null;
};
};
delete removeNodes[_arg1];
_arg1.parent = null;
BSPNode.destroyBSPNode(_arg1);
};
};
return (_local2);
}
private function canAssemble(_arg1:PolyPrimitive, _arg2:Set):Boolean{
var _local3:PolyPrimitive;
var _local4:PolyPrimitive;
var _local5:Boolean;
var _local6:Boolean;
if (childPrimitives[_arg1]){
delete childPrimitives[_arg1];
return (true);
};
_local3 = _arg1.back;
_local4 = _arg1.front;
if (_local3 != null){
_local5 = canAssemble(_local3, _arg2);
_local6 = canAssemble(_local4, _arg2);
if (((_local5) && (_local6))){
_local3.parent = null;
_local4.parent = null;
_local3.sibling = null;
_local4.sibling = null;
_arg1.back = null;
_arg1.front = null;
PolyPrimitive.destroyPolyPrimitive(_local3);
PolyPrimitive.destroyPolyPrimitive(_local4);
return (true);
};
if (_local5){
_arg2[_local3] = true;
};
if (_local6){
_arg2[_local4] = true;
};
};
return (false);
}
function removeOperation(_arg1:Operation):void{
if (_arg1.queued){
operations.splice(operations.indexOf(_arg1), 1);
};
}
public function set root(_arg1:Object3D):void{
if (_root != _arg1){
if (_arg1 != null){
if (_arg1._parent != null){
_arg1._parent._objects.remove(_arg1);
} else {
if (((!((_arg1._scene == null))) && ((_arg1._scene._root == _arg1)))){
_arg1._scene.root = null;
};
};
_arg1.setParent(null);
_arg1.setScene(this);
_arg1.setLevel(0);
};
if (_root != null){
_root.setParent(null);
_root.setScene(null);
};
_root = _arg1;
} else {
if (_root != null){
throw (new Error("Невозможно указать корневым уже корневой объект"));
};
};
}
function addOperation(_arg1:Operation):void{
if (!_arg1.queued){
operations.push(_arg1);
_arg1.queued = true;
};
}
public function drawBSP(_arg1:Sprite):void{
_arg1.graphics.clear();
while (_arg1.numChildren > 0) {
_arg1.removeChildAt(0);
};
if (bsp != null){
drawBSPNode(bsp, _arg1, 0, 0, 1);
};
}
private function addBSP(_arg1:BSPNode, _arg2:PolyPrimitive):void{
var _local3:Point3D;
var _local4:Point3D;
var _local5:PolyPrimitive;
var _local6:*;
var _local7:Array;
var _local8:Array;
var _local9:Boolean;
var _local10:Boolean;
var _local11:uint;
var _local12:Number;
var _local13:PolyPrimitive;
var _local14:PolyPrimitive;
var _local15:Boolean;
var _local16:Number;
var _local17:Number;
var _local18:Number;
var _local19:Number;
var _local20:Point;
if (_arg2.mobile < _arg1.mobile){
if (_arg1.primitive != null){
childPrimitives[_arg1.primitive] = true;
removePrimitives[_arg1.primitive] = true;
} else {
for (_local6 in _arg1.backPrimitives) {
childPrimitives[_local6] = true;
removePrimitives[_local6] = true;
};
for (_local6 in _arg1.frontPrimitives) {
childPrimitives[_local6] = true;
removePrimitives[_local6] = true;
};
};
childBSP(_arg1.back);
childBSP(_arg1.front);
assembleChildPrimitives(lowerPrimitives);
if (!lowerPrimitives.isEmpty()){
for (_local6 in lowerPrimitives) {
addPrimitives[_local6] = true;
addList.push(_local6);
delete lowerPrimitives[_local6];
};
calculateSplits();
addList.sortOn(addSort, addSortOptions);
};
_arg1.primitive = _arg2;
_arg2.node = _arg1;
_arg1.normal.copy(_arg2.face.globalNormal);
_arg1.offset = _arg2.face.globalOffset;
_arg1.mobile = _arg2.mobile;
_arg1.backPrimitives = null;
_arg1.frontPrimitives = null;
_arg1.back = null;
_arg1.front = null;
} else {
_local4 = _arg1.normal;
_local7 = _arg2.points;
_local8 = _arg2.uvs;
_local9 = false;
_local10 = false;
_local11 = 0;
while (_local11 < _arg2.num) {
_local3 = _local7[_local11];
_local12 = ((((_local3.x * _local4.x) + (_local3.y * _local4.y)) + (_local3.z * _local4.z)) - _arg1.offset);
if (_local12 > planeOffsetTreshold){
_local9 = true;
} else {
if (_local12 < -(planeOffsetTreshold)){
_local10 = true;
};
};
pointOffsets[_local11] = _local12;
_local11++;
};
if (((!(_local9)) && (!(_local10)))){
_arg2.node = _arg1;
if (_arg1.primitive != null){
_arg1.frontPrimitives = new Set(true);
_arg1.frontPrimitives[_arg1.primitive] = true;
_arg1.primitive = null;
};
if (Point3D.dot(_arg2.face.globalNormal, _local4) > 0){
_arg1.frontPrimitives[_arg2] = true;
} else {
if (_arg1.backPrimitives == null){
_arg1.backPrimitives = new Set(true);
};
_arg1.backPrimitives[_arg2] = true;
};
} else {
if (!_local10){
if (_arg1.front == null){
_arg1.front = BSPNode.createBSPNode(_arg2);
_arg1.front.parent = _arg1;
} else {
addBSP(_arg1.front, _arg2);
};
} else {
if (!_local9){
if (_arg1.back == null){
_arg1.back = BSPNode.createBSPNode(_arg2);
_arg1.back.parent = _arg1;
} else {
addBSP(_arg1.back, _arg2);
};
} else {
_local13 = PolyPrimitive.createPolyPrimitive();
_local14 = PolyPrimitive.createPolyPrimitive();
_local15 = true;
_local16 = pointOffsets[0];
_local11 = 0;
while (_local11 < _arg2.num) {
_local17 = ((_local11)==(_arg2.num - 1)) ? 0 : (_local11 + 1);
_local18 = pointOffsets[_local17];
if (_local16 > planeOffsetTreshold){
_local13.points.push(_local7[_local11]);
_local13.uvs.push(_arg2.uvs[_local11]);
} else {
if (_local16 < -(planeOffsetTreshold)){
_local14.points.push(_local7[_local11]);
_local14.uvs.push(_arg2.uvs[_local11]);
} else {
_local13.points.push(_local7[_local11]);
_local14.points.push(_local7[_local11]);
_local13.uvs.push(_arg2.uvs[_local11]);
_local14.uvs.push(_arg2.uvs[_local11]);
};
};
if ((((((_local16 > planeOffsetTreshold)) && ((_local18 < -(planeOffsetTreshold))))) || ((((_local16 < -(planeOffsetTreshold))) && ((_local18 > planeOffsetTreshold)))))){
_local19 = (_local16 / (_local16 - _local18));
_local3 = Point3D.interpolate(_local7[_local11], _local7[_local17], _local19);
_local13.points.push(_local3);
_local14.points.push(_local3);
if (_arg2.face.uvMatrix != null){
_local20 = Point.interpolate(_local8[_local17], _local8[_local11], _local19);
} else {
_local20 = null;
};
_local13.uvs.push(_local20);
_local14.uvs.push(_local20);
if (_local15){
_arg2.splitTime1 = _local19;
_local15 = false;
} else {
_arg2.splitTime2 = _local19;
};
};
_local16 = _local18;
_local11++;
};
_local13.num = _local13.points.length;
_local14.num = _local14.points.length;
_local13.mobile = _arg2.mobile;
_local14.mobile = _arg2.mobile;
_local14.face = _arg2.face;
_local13.face = _arg2.face;
_local14.parent = _arg2;
_local13.parent = _arg2;
_local14.sibling = _local13;
_local13.sibling = _local14;
_arg2.back = _local14;
_arg2.front = _local13;
addPrimitives[_local13] = true;
addPrimitives[_local14] = true;
delete addPrimitives[_arg2];
if (_arg1.back == null){
_arg1.back = BSPNode.createBSPNode(_local14);
_arg1.back.parent = _arg1;
} else {
addBSP(_arg1.back, _local14);
};
if (_arg1.front == null){
_arg1.front = BSPNode.createBSPNode(_local13);
_arg1.front.parent = _arg1;
} else {
addBSP(_arg1.front, _local13);
};
};
};
};
};
}
public function get root():Object3D{
return (_root);
}
private function collectCollisionPlanes(_arg1:BSPNode):void{
var _local2:Number;
var _local3:Number;
var _local4:Point3D;
var _local5:Number;
var _local6:Face;
var _local7:*;
var _local8:CollisionPlane;
if (_arg1 != null){
_local2 = ((((collisionSource.x * _arg1.normal.x) + (collisionSource.y * _arg1.normal.y)) + (collisionSource.z * _arg1.normal.z)) - _arg1.offset);
_local3 = ((((collisionDestination.x * _arg1.normal.x) + (collisionDestination.y * _arg1.normal.y)) + (collisionDestination.z * _arg1.normal.z)) - _arg1.offset);
if (_local2 >= 0){
collectCollisionPlanes(_arg1.front);
if (_local3 < collisionRadius){
_local8 = new CollisionPlane();
_local8.node = _arg1;
_local8.infront = true;
_local8.sourceOffset = _local2;
_local8.destinationOffset = _local3;
collisionPlanes.push(_local8);
collectCollisionPlanes(_arg1.back);
};
} else {
collectCollisionPlanes(_arg1.back);
if (-(_local3) < collisionRadius){
if (_arg1.backPrimitives != null){
_local8 = new CollisionPlane();
_local8.node = _arg1;
_local8.infront = false;
_local8.sourceOffset = -(_local2);
_local8.destinationOffset = -(_local3);
collisionPlanes.push(_local8);
};
collectCollisionPlanes(_arg1.front);
};
};
};
}
private function calculateCollisionWithPlane(_arg1:CollisionPlane):void{
var _local2:*;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
collisionPlanePoint.copy(collisionSource);
if (_arg1.sourceOffset <= collisionRadius){
if (_arg1.infront){
collisionPlanePoint.x = (collisionPlanePoint.x - (_arg1.node.normal.x * _arg1.sourceOffset));
collisionPlanePoint.y = (collisionPlanePoint.y - (_arg1.node.normal.y * _arg1.sourceOffset));
collisionPlanePoint.z = (collisionPlanePoint.z - (_arg1.node.normal.z * _arg1.sourceOffset));
} else {
collisionPlanePoint.x = (collisionPlanePoint.x + (_arg1.node.normal.x * _arg1.sourceOffset));
collisionPlanePoint.y = (collisionPlanePoint.y + (_arg1.node.normal.y * _arg1.sourceOffset));
collisionPlanePoint.z = (collisionPlanePoint.z + (_arg1.node.normal.z * _arg1.sourceOffset));
};
} else {
_local3 = ((_arg1.sourceOffset - collisionRadius) / (_arg1.sourceOffset - _arg1.destinationOffset));
collisionPlanePoint.x = (collisionSource.x + (collisionVector.x * _local3));
collisionPlanePoint.y = (collisionSource.y + (collisionVector.y * _local3));
collisionPlanePoint.z = (collisionSource.z + (collisionVector.z * _local3));
if (_arg1.infront){
collisionPlanePoint.x = (collisionPlanePoint.x - (_arg1.node.normal.x * collisionRadius));
collisionPlanePoint.y = (collisionPlanePoint.y - (_arg1.node.normal.y * collisionRadius));
collisionPlanePoint.z = (collisionPlanePoint.z - (_arg1.node.normal.z * collisionRadius));
} else {
collisionPlanePoint.x = (collisionPlanePoint.x + (_arg1.node.normal.x * collisionRadius));
collisionPlanePoint.y = (collisionPlanePoint.y + (_arg1.node.normal.y * collisionRadius));
collisionPlanePoint.z = (collisionPlanePoint.z + (_arg1.node.normal.z * collisionRadius));
};
};
collisionPrimitiveNearestLengthSqr = Number.MAX_VALUE;
collisionPrimitiveNearest = null;
if (_arg1.infront){
if (_arg1.node.primitive != null){
calculateCollisionWithPrimitive(_arg1.node.primitive);
} else {
for (_local2 in _arg1.node.frontPrimitives) {
calculateCollisionWithPrimitive(_local2);
if (collisionPrimitive != null){
break;
};
};
};
} else {
for (_local2 in _arg1.node.backPrimitives) {
calculateCollisionWithPrimitive(_local2);
if (collisionPrimitive != null){
break;
};
};
};
if (collisionPrimitive != null){
if (_arg1.infront){
collisionNormal.x = _arg1.node.normal.x;
collisionNormal.y = _arg1.node.normal.y;
collisionNormal.z = _arg1.node.normal.z;
collisionOffset = _arg1.node.offset;
} else {
collisionNormal.x = -(_arg1.node.normal.x);
collisionNormal.y = -(_arg1.node.normal.y);
collisionNormal.z = -(_arg1.node.normal.z);
collisionOffset = -(_arg1.node.offset);
};
collisionPoint.x = collisionPlanePoint.x;
collisionPoint.y = collisionPlanePoint.y;
collisionPoint.z = collisionPlanePoint.z;
} else {
_local4 = (collisionSource.x - collisionPrimitiveNearestPoint.x);
_local5 = (collisionSource.y - collisionPrimitiveNearestPoint.y);
_local6 = (collisionSource.z - collisionPrimitiveNearestPoint.z);
if ((((_local4 * collisionVector.x) + (_local5 * collisionVector.y)) + (_local6 * collisionVector.z)) <= 0){
_local7 = Math.sqrt((((collisionVector.x * collisionVector.x) + (collisionVector.y * collisionVector.y)) + (collisionVector.z * collisionVector.z)));
_local8 = (-(collisionVector.x) / _local7);
_local9 = (-(collisionVector.y) / _local7);
_local10 = (-(collisionVector.z) / _local7);
_local11 = (((_local4 * _local4) + (_local5 * _local5)) + (_local6 * _local6));
_local12 = (((_local4 * _local8) + (_local5 * _local9)) + (_local6 * _local10));
_local13 = (((collisionRadius * collisionRadius) - _local11) + (_local12 * _local12));
if (_local13 > 0){
_local14 = (_local12 - Math.sqrt(_local13));
if (_local14 < _local7){
collisionPoint.x = collisionPrimitiveNearestPoint.x;
collisionPoint.y = collisionPrimitiveNearestPoint.y;
collisionPoint.z = collisionPrimitiveNearestPoint.z;
_local15 = Math.sqrt(_local11);
collisionNormal.x = (_local4 / _local15);
collisionNormal.y = (_local5 / _local15);
collisionNormal.z = (_local6 / _local15);
collisionOffset = (((collisionPoint.x * collisionNormal.x) + (collisionPoint.y * collisionNormal.y)) + (collisionPoint.z * collisionNormal.z));
collisionPrimitive = collisionPrimitiveNearest;
};
};
};
};
}
public function calculateCollision(_arg1:Point3D, _arg2:Point3D, _arg3:Number=0):Collision{
var _local4:CollisionPlane;
var _local5:Collision;
collisionSource = _arg1;
collisionVector = _arg2;
collisionDestination.x = (collisionSource.x + collisionVector.x);
collisionDestination.y = (collisionSource.y + collisionVector.y);
collisionDestination.z = (collisionSource.z + collisionVector.z);
collisionRadius = _arg3;
collectCollisionPlanes(bsp);
collisionPlanes.sortOn("sourceOffset", (Array.NUMERIC | Array.DESCENDING));
while (((!(((_local4 = collisionPlanes.pop()) == null))) && ((collisionPrimitive == null)))) {
calculateCollisionWithPlane(_local4);
};
if (collisionPrimitive != null){
_local5 = new Collision();
_local5.face = collisionPrimitive.face;
_local5.normal = collisionNormal.clone();
_local5.point = collisionPoint.clone();
_local5.offset = collisionOffset;
};
collisionSource = null;
collisionVector = null;
collisionPrimitive = null;
var _local6:uint = collisionPlanes.length;
var _local7:uint;
while (_local7 < _local6) {
collisionPlanes.pop();
_local7++;
};
return (_local5);
}
public function calculate():void{
var _local1:Operation;
var _local2:uint;
var _local3:uint;
if (operations[0] != undefined){
_local2 = operations.length;
_local3 = 0;
while (_local3 < _local2) {
_local1 = operations[_local3];
_local1.collectSequels(operations);
_local3++;
};
operations.sortOn(operationSort, operationSortOptions);
_local2 = operations.length;
_local3 = 0;
while (_local3 < _local2) {
_local1 = operations[_local3];
if (_local1.method != null){
_local1.method.call(_local1.object);
};
_local3++;
};
_local3 = 0;
while (_local3 < _local2) {
_local1 = operations.pop();
_local1.queued = false;
_local3++;
};
};
}
private function assembleChildPrimitives(_arg1:Set):void{
var _local2:PolyPrimitive;
while ((_local2 = childPrimitives.take()) != null) {
assemblePrimitive(_local2, _arg1);
};
}
private function calculatePrimitives():void{
var _local1:*;
var _local2:PolyPrimitive;
var _local3:BSPNode;
var _local4:BSPNode;
var _local5:BSPNode;
var _local6:BSPNode;
if (!removePrimitives.isEmpty()){
for (_local1 in removePrimitives) {
removeBSPPrimitive(_local1);
};
if (!removeNodes.isEmpty()){
while ((_local3 = removeNodes.first()) != null) {
_local4 = _local3;
while ((_local3 = _local3.parent) != null) {
if (removeNodes[_local3]){
_local4 = _local3;
};
};
_local5 = _local4.parent;
_local6 = removeBSPNode(_local4);
if (_local6 == dummyNode){
_local6 = null;
};
if (_local5 != null){
if (_local5.front == _local4){
_local5.front = _local6;
} else {
_local5.back = _local6;
};
} else {
bsp = _local6;
};
if (_local6 != null){
_local6.parent = _local5;
};
};
assembleChildPrimitives(addPrimitives);
};
};
if (!addPrimitives.isEmpty()){
addPrimitives.addToArray(addList);
calculateSplits();
addList.sortOn(addSort, addSortOptions);
if (bsp == null){
bsp = BSPNode.createBSPNode(addList.pop());
};
while ((_local2 = addList.pop()) != null) {
addBSP(bsp, _local2);
};
};
for (_local1 in addPrimitives) {
delete removePrimitives[_local1];
};
}
}
}//package com.alternativagame.engine3d
Section 15
//Skin (com.alternativagame.engine3d.Skin)
package com.alternativagame.engine3d {
import flash.display.*;
public class Skin extends Sprite {
var materialOperation:Operation;
var nextSkin:Skin;
var face:Face;
var camera:Camera3D;
private var material:SurfaceMaterial;
var _primitive:PolyPrimitive;
var alphaOperation:Operation;
var redrawOperation:Operation;
var blendModeOperation:Operation;
var gfx:Graphics;
private static var collector:Array = new Array();
public function Skin(){
materialOperation = new Operation("material", this, changeMaterial, Operation.SKIN_DRAW);
redrawOperation = new Operation("redraw", this, redraw, Operation.SKIN_DRAW);
alphaOperation = new Operation("alpha", this, changeAlpha, Operation.SKIN_DRAW);
blendModeOperation = new Operation("blendMode", this, changeBlendMode, Operation.SKIN_DRAW);
gfx = graphics;
super();
}
function draw(_arg1:PolyPrimitive):void{
if (((!((_primitive == _arg1))) || (!((face == _arg1.face))))){
if (_primitive != null){
face.materialOperation.removeSequel(materialOperation);
face.calculateUVOperation.removeSequel(redrawOperation);
if (material != null){
material.alphaOperation.removeSequel(alphaOperation);
material.drawParamsOperation.removeSequel(redrawOperation);
material.clear(this);
};
material = null;
face = null;
};
_primitive = _arg1;
if (_arg1 != null){
face = _arg1.face;
face.materialOperation.addSequel(materialOperation);
face.calculateUVOperation.addSequel(redrawOperation);
material = ((face._surface)!=null) ? face._surface._material : null;
if (material != null){
material.alphaOperation.addSequel(alphaOperation);
material.drawParamsOperation.addSequel(redrawOperation);
material.draw(this);
alpha = material._alpha;
blendMode = material._blendMode;
};
};
} else {
if (((((!((material == null))) && (!(redrawOperation.queued)))) && (!(materialOperation.queued)))){
material.clear(this);
material.draw(this);
};
};
}
private function changeBlendMode():void{
if (material != null){
blendMode = material._blendMode;
};
}
private function changeAlpha():void{
if (material != null){
alpha = material._alpha;
};
}
private function redraw():void{
if (material != null){
material.clear(this);
material.draw(this);
};
}
private function changeMaterial():void{
if (material != null){
material.alphaOperation.removeSequel(alphaOperation);
material.drawParamsOperation.removeSequel(redrawOperation);
material.clear(this);
};
material = (((!((face == null))) && (!((face._surface == null))))) ? face._surface._material : null;
if (material != null){
material.alphaOperation.addSequel(alphaOperation);
material.drawParamsOperation.addSequel(redrawOperation);
material.draw(this);
alpha = material._alpha;
blendMode = material._blendMode;
};
}
static function createSkin(_arg1:Camera3D):Skin{
var _local2:Skin = collector.pop();
if (_local2 == null){
_local2 = new (Skin);
};
_local2.camera = _arg1;
return (_local2);
}
static function destroySkin(_arg1:Skin):void{
collector.push(_arg1);
}
}
}//package com.alternativagame.engine3d
Section 16
//Surface (com.alternativagame.engine3d.Surface)
package com.alternativagame.engine3d {
import com.alternativagame.type.*;
public class Surface {
var materialOperation:Operation;
var removeOperation:Operation;
var _material:SurfaceMaterial;
var facesOperation:Operation;
var _mesh:Mesh;
var addOperation:Operation;
var _faces:Set;
public function Surface(){
addOperation = new Operation("add", this);
removeOperation = new Operation("remove", this);
facesOperation = new Operation("faces", this);
materialOperation = new Operation("material", this);
_faces = new Set();
super();
}
public function removeFace(_arg1:Object):void{
var _local2 = (_arg1 is Face);
if (_mesh == null){
throw (new Error("Невозможно удалить грань из поверхности, т.к. поверхность не находится в меше"));
};
if (_arg1 == null){
throw (new Error(("Невозможно удалить из поверхности " + (_local2) ? "null-грань" : "грань с null-идентификатором")));
};
if (_local2){
if (Face(_arg1)._mesh != _mesh){
throw (new Error("Невозможно удалить грань из поверхности, т.к. она не находится в меше"));
};
} else {
if (_mesh._faces[_arg1] == undefined){
throw (new Error("Невозможно удалить грань из поверхности, т.к. грани с таким идентификатором в меше нет"));
};
};
var _local3:Face = (_local2) ? Face(_arg1) : _mesh._faces[_arg1];
if (!_faces.has(_local3)){
throw (new Error("Невозможно удалить грань из поверхности, т.к. она не находится в поверхности"));
};
_faces.remove(_local3);
_local3.removeFromSurface(this);
_mesh.addOperationToScene(facesOperation);
}
function addToMesh(_arg1:Mesh):void{
if (_material != null){
_material.addToMesh(_arg1);
};
_mesh = _arg1;
}
public function set material(_arg1:SurfaceMaterial):void{
if (_material != _arg1){
if (_material != null){
_material.removeFromSurface(this);
if (_mesh != null){
_material.removeFromMesh(_mesh);
if (_mesh._scene != null){
_material.removeFromScene(_mesh._scene);
};
};
};
if (_arg1 != null){
if (_arg1._surface != null){
_arg1._surface.material = null;
};
_arg1.addToSurface(this);
if (_mesh != null){
_arg1.addToMesh(_mesh);
if (_mesh._scene != null){
_arg1.addToScene(_mesh._scene);
};
};
};
_material = _arg1;
if (_mesh != null){
_mesh.addOperationToScene(materialOperation);
};
};
}
function removeFaces():void{
var _local1:*;
var _local2:Face;
for (_local1 in _faces) {
_local2 = _local1;
_faces.remove(_local2);
_local2.removeFromSurface(this);
};
}
public function get id():Object{
return (((_mesh)!=null) ? _mesh.getSurfaceId(this) : null);
}
function removeFromScene(_arg1:Scene3D):void{
_arg1.removeOperation(addOperation);
_arg1.removeOperation(facesOperation);
_arg1.removeOperation(materialOperation);
_arg1.addOperation(removeOperation);
if (_material != null){
_material.removeFromScene(_arg1);
};
}
public function addFace(_arg1:Object):void{
var _local2 = (_arg1 is Face);
if (_mesh == null){
throw (new Error("Невозможно добавить грань в поверхность, т.к. поверхность не находится в меше"));
};
if (_arg1 == null){
throw (new Error(("Невозможно добавить в поверхность " + (_local2) ? "null-грань" : "грань с null-идентификатором")));
};
if (_local2){
if (Face(_arg1)._mesh != _mesh){
throw (new Error("Невозможно добавить грань в поверхность, т.к. она не находится в меше"));
};
} else {
if (_mesh._faces[_arg1] == undefined){
throw (new Error("Невозможно добавить грань в поверхность, т.к. грани с таким идентификатором в меше нет"));
};
};
var _local3:Face = (_local2) ? Face(_arg1) : _mesh._faces[_arg1];
if (_faces.has(_local3)){
throw (new Error("Невозможно добавить грань в поверхность, т.к. она уже в ней"));
};
if (_local3._surface != null){
_local3._surface._faces.remove(_local3);
_local3.removeFromSurface(_local3._surface);
};
_faces.add(_local3);
_local3.addToSurface(this);
_mesh.addOperationToScene(facesOperation);
}
public function get material():SurfaceMaterial{
return (_material);
}
function removeFromMesh(_arg1:Mesh):void{
if (_material != null){
_material.removeFromMesh(_arg1);
};
_mesh = null;
}
public function toString():String{
var _local4:*;
var _local5:Face;
var _local1:uint = _faces.length;
var _local2:String = (("[Surface ID:" + id) + ((_local1)>0) ? " faces:" : "");
var _local3:uint;
for (_local4 in _faces) {
_local5 = _local4;
_local2 = (_local2 + (_local5.id + ((_local3)<(_local1 - 1)) ? ", " : ""));
_local3++;
};
_local2 = (_local2 + "]");
return (_local2);
}
public function get mesh():Mesh{
return (_mesh);
}
function addToScene(_arg1:Scene3D):void{
_arg1.removeOperation(removeOperation);
_arg1.addOperation(addOperation);
if (_material != null){
_material.addToScene(_arg1);
};
}
public function get faces():Set{
return (_faces.clone());
}
}
}//package com.alternativagame.engine3d
Section 17
//SurfaceMaterial (com.alternativagame.engine3d.SurfaceMaterial)
package com.alternativagame.engine3d {
public class SurfaceMaterial extends Material {
var _blendMode:String;// = "normal"
var drawParamsOperation:Operation;
var _alpha:Number;
var alphaOperation:Operation;
var _surface:Surface;
var blendModeOperation:Operation;
public function SurfaceMaterial(_arg1:Number=1, _arg2:String="normal"){
drawParamsOperation = new Operation("drawParams", this);
alphaOperation = new Operation("alpha", this);
blendModeOperation = new Operation("blendMode", this);
super();
_alpha = _arg1;
_blendMode = _arg2;
}
function draw(_arg1:Skin):void{
}
function addToMesh(_arg1:Mesh):void{
}
function clear(_arg1:Skin):void{
_arg1.gfx.clear();
}
function addToSurface(_arg1:Surface):void{
_surface = _arg1;
}
public function get blendMode():String{
return (_blendMode);
}
function removeFromMesh(_arg1:Mesh):void{
}
function removeFromScene(_arg1:Scene3D):void{
_arg1.removeOperation(drawParamsOperation);
}
override public function clone():Material{
return (new SurfaceMaterial(_alpha, _blendMode));
}
public function get alpha():Number{
return (_alpha);
}
public function set blendMode(_arg1:String):void{
if (_blendMode != _arg1){
_blendMode = _arg1;
if (((!((_surface == null))) && (!((_surface._mesh == null))))){
_surface._mesh.addOperationToScene(blendModeOperation);
};
};
}
public function get surface():Surface{
return (_surface);
}
function addToScene(_arg1:Scene3D):void{
}
protected function addDrawParamsOperationToScene():void{
if (((!((_surface == null))) && (!((_surface._mesh == null))))){
_surface._mesh.addOperationToScene(drawParamsOperation);
};
}
public function set alpha(_arg1:Number):void{
if (_alpha != _arg1){
_alpha = _arg1;
if (((!((_surface == null))) && (!((_surface._mesh == null))))){
_surface._mesh.addOperationToScene(alphaOperation);
};
};
}
function removeFromSurface(_arg1:Surface):void{
_surface = null;
}
}
}//package com.alternativagame.engine3d
Section 18
//TextureMaterial (com.alternativagame.engine3d.TextureMaterial)
package com.alternativagame.engine3d {
import com.alternativagame.type.*;
import flash.geom.*;
import flash.display.*;
public class TextureMaterial extends SurfaceMaterial {
var _smooth:Boolean;
var _debug:Boolean;// = false
var _texture:TextureData;
var _repeat:Boolean;
var _precision:Number;
private static var textureMatrix:Matrix = new Matrix();
private static var focusDistance:Number;
private static var points1:Array = new Array();
private static var points2:Array = new Array();
private static var gfx:Graphics;
private static var distortion:Number;
public function TextureMaterial(_arg1:TextureData=null, _arg2:Number=1, _arg3:Boolean=true, _arg4:Boolean=false, _arg5:Number=10, _arg6:String="normal"):void{
super(_arg2, _arg6);
_texture = _arg1;
_repeat = _arg3;
_smooth = _arg4;
_precision = _arg5;
}
override function draw(_arg1:Skin):void{
var _local4:uint;
var _local5:Array;
var _local6:Point3D;
var _local7:uint;
var _local8:Matrix;
var _local9:Array;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:uint;
var _local15:uint;
var _local16:uint;
var _local17:uint;
var _local18:Boolean;
var _local19:TexturePoint;
var _local20:TexturePoint;
var _local21:TexturePoint;
var _local22:Number;
var _local23:Number;
var _local24:Number;
var _local25:Number;
var _local26:Number;
var _local27:Number;
var _local28:Number;
var _local29:Number;
var _local30:Number;
var _local31:Number;
var _local32:Number;
var _local33:Point;
var _local34:TexturePoint;
var _local2:Face = _arg1.face;
var _local3:Camera3D = _arg1.camera;
if (((!((_local2.uvMatrix == null))) && (!((_texture == null))))){
gfx = _arg1.gfx;
_local4 = _arg1._primitive.num;
_local5 = _arg1._primitive.points;
if (_local3._fov == 0){
_local8 = _local3.calculateTextureMatrix(_local2, texture.width, texture.height);
gfx.beginBitmapFill(_texture.bitmapData, _local8, true, true);
if (_debug){
gfx.lineStyle(1, 0xFFFFFF);
};
_local6 = _local3.calculateCameraCoord(_local5[0]);
gfx.moveTo(_local6.x, _local6.y);
_local7 = 1;
while (_local7 < _local4) {
_local6 = _local3.calculateCameraCoord(_local5[_local7]);
gfx.lineTo(_local6.x, _local6.y);
_local7++;
};
if (_debug){
_local6 = _local3.calculateCameraCoord(_local5[0]);
gfx.lineTo(_local6.x, _local6.y);
};
} else {
focusDistance = _local3.focusDistance;
distortion = (_local3.focusDistortion * _precision);
_local9 = _arg1._primitive.uvs;
_local7 = 0;
while (_local7 < _local4) {
_local6 = _local3.calculateCameraCoord(_local5[_local7]);
_local33 = _local9[_local7];
_local34 = points1[_local7];
if (_local34 == null){
_local34 = new TexturePoint(_local6.x, _local6.y, _local6.z, _local33.x, _local33.y);
points1[_local7] = _local34;
} else {
_local34.x = _local6.x;
_local34.y = _local6.y;
_local34.z = _local6.z;
_local34.u = _local33.x;
_local34.v = _local33.y;
};
_local7++;
};
_local10 = -(focusDistance);
_local11 = _local3._view.halfWidth;
_local12 = Math.sqrt(((_local10 * _local10) + (_local11 * _local11)));
_local10 = (_local10 / _local12);
_local11 = (_local11 / _local12);
_local4 = clip(_local4, points1, points2, _local10, 0, _local11);
if (_local4 < 3){
return;
};
_local4 = clip(_local4, points2, points1, -(_local10), 0, _local11);
if (_local4 < 3){
return;
};
_local13 = -(focusDistance);
_local11 = _local3._view.halfHeight;
_local12 = Math.sqrt(((_local13 * _local13) + (_local11 * _local11)));
_local13 = (_local13 / _local12);
_local11 = (_local11 / _local12);
_local4 = clip(_local4, points1, points2, 0, _local13, _local11);
if (_local4 < 3){
return;
};
_local4 = clip(_local4, points2, points1, 0, -(_local13), _local11);
if (_local4 < 3){
return;
};
_local14 = 0;
_local15 = (_local4 - 1);
_local16 = 1;
_local17 = ((_local15)>0) ? (_local15 - 1) : (_local4 - 1);
_local18 = true;
_local19 = points1[_local15];
_local21 = points1[_local14];
_local22 = (_local19.x / _local19.z);
_local23 = (_local19.y / _local19.z);
_local26 = (_local21.x / _local21.z);
_local27 = (_local21.y / _local21.z);
_local28 = (((_local21.x + _local19.x) / (_local21.z + _local19.z)) - (0.5 * (_local26 + _local22)));
_local29 = (((_local21.y + _local19.y) / (_local21.z + _local19.z)) - (0.5 * (_local27 + _local23)));
_local32 = ((_local28 * _local28) + (_local29 * _local29));
while (_local14 != _local15) {
if (_local18){
_local19 = points1[_local14];
_local20 = points1[_local16];
_local21 = points1[_local15];
_local24 = _local22;
_local25 = _local23;
_local22 = _local26;
_local23 = _local27;
_local26 = _local24;
_local27 = _local25;
_local24 = (_local20.x / _local20.z);
_local25 = (_local20.y / _local20.z);
_local28 = (((_local20.x + _local21.x) / (_local20.z + _local21.z)) - (0.5 * (_local24 + _local26)));
_local29 = (((_local20.y + _local21.y) / (_local20.z + _local21.z)) - (0.5 * (_local25 + _local27)));
_local31 = ((_local28 * _local28) + (_local29 * _local29));
if ((((_local24 - _local22) * (_local27 - _local23)) - ((_local25 - _local23) * (_local26 - _local22))) < -(_local3.focusDistortion)){
_local28 = (((_local19.x + _local20.x) / (_local19.z + _local20.z)) - (0.5 * (_local22 + _local24)));
_local29 = (((_local19.y + _local20.y) / (_local19.z + _local20.z)) - (0.5 * (_local23 + _local25)));
_local30 = ((_local28 * _local28) + (_local29 * _local29));
bisection(_local19.x, _local19.y, _local19.z, _local19.u, _local19.v, _local20.x, _local20.y, _local20.z, _local20.u, _local20.v, _local21.x, _local21.y, _local21.z, _local21.u, _local21.v, _local30, _local31, _local32);
};
_local14 = _local16;
_local16 = ((_local14)<(_local4 - 1)) ? (_local14 + 1) : 0;
} else {
_local19 = points1[_local17];
_local20 = points1[_local15];
_local21 = points1[_local14];
_local22 = _local24;
_local23 = _local25;
_local24 = _local26;
_local25 = _local27;
_local26 = _local22;
_local27 = _local23;
_local22 = (_local19.x / _local19.z);
_local23 = (_local19.y / _local19.z);
_local28 = (((_local21.x + _local19.x) / (_local21.z + _local19.z)) - (0.5 * (_local26 + _local22)));
_local29 = (((_local21.y + _local19.y) / (_local21.z + _local19.z)) - (0.5 * (_local27 + _local23)));
_local32 = ((_local28 * _local28) + (_local29 * _local29));
if ((((_local24 - _local22) * (_local27 - _local23)) - ((_local25 - _local23) * (_local26 - _local22))) < -(_local3.focusDistortion)){
_local28 = (((_local19.x + _local20.x) / (_local19.z + _local20.z)) - (0.5 * (_local22 + _local24)));
_local29 = (((_local19.y + _local20.y) / (_local19.z + _local20.z)) - (0.5 * (_local23 + _local25)));
_local30 = ((_local28 * _local28) + (_local29 * _local29));
bisection(_local19.x, _local19.y, _local19.z, _local19.u, _local19.v, _local20.x, _local20.y, _local20.z, _local20.u, _local20.v, _local21.x, _local21.y, _local21.z, _local21.u, _local21.v, _local30, _local31, _local32);
};
_local15 = _local17;
_local17 = ((_local15)>0) ? (_local15 - 1) : (_local4 - 1);
};
_local18 = !(_local18);
};
};
} else {
_local3.removeTextureMatrix(_local2);
};
}
private function bisection(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number, _arg7:Number, _arg8:Number, _arg9:Number, _arg10:Number, _arg11:Number, _arg12:Number, _arg13:Number, _arg14:Number, _arg15:Number, _arg16:Number, _arg17:Number, _arg18:Number):void{
var _local19:Number;
var _local20:Number;
var _local21:Number;
var _local22:Number;
var _local23:Number;
var _local24:Number;
var _local25:Number;
var _local26:Number;
var _local27:Number;
var _local28:Number;
if (_arg16 > _arg17){
if (_arg16 > _arg18){
if (_arg16 > distortion){
_local19 = (0.5 * (_arg1 + _arg6));
_local20 = (0.5 * (_arg2 + _arg7));
_local21 = (0.5 * (_arg3 + _arg8));
_local22 = (0.5 * (_arg4 + _arg9));
_local23 = (0.5 * (_arg5 + _arg10));
_local24 = (((_arg1 + _local19) / (_arg3 + _local21)) - (0.5 * ((_arg1 / _arg3) + (_local19 / _local21))));
_local25 = (((_arg2 + _local20) / (_arg3 + _local21)) - (0.5 * ((_arg2 / _arg3) + (_local20 / _local21))));
_local26 = ((_local24 * _local24) + (_local25 * _local25));
_local24 = (((_arg6 + _local19) / (_arg8 + _local21)) - (0.5 * ((_arg6 / _arg8) + (_local19 / _local21))));
_local25 = (((_arg7 + _local20) / (_arg8 + _local21)) - (0.5 * ((_arg7 / _arg8) + (_local20 / _local21))));
_local27 = ((_local24 * _local24) + (_local25 * _local25));
_local24 = (((_arg11 + _local19) / (_arg13 + _local21)) - (0.5 * ((_arg11 / _arg13) + (_local19 / _local21))));
_local25 = (((_arg12 + _local20) / (_arg13 + _local21)) - (0.5 * ((_arg12 / _arg13) + (_local20 / _local21))));
_local28 = ((_local24 * _local24) + (_local25 * _local25));
bisection(_local19, _local20, _local21, _local22, _local23, _arg11, _arg12, _arg13, _arg14, _arg15, _arg1, _arg2, _arg3, _arg4, _arg5, _local28, _arg18, _local26);
bisection(_local19, _local20, _local21, _local22, _local23, _arg6, _arg7, _arg8, _arg9, _arg10, _arg11, _arg12, _arg13, _arg14, _arg15, _local27, _arg17, _local28);
return;
};
} else {
if (_arg18 > distortion){
_local19 = (0.5 * (_arg11 + _arg1));
_local20 = (0.5 * (_arg12 + _arg2));
_local21 = (0.5 * (_arg13 + _arg3));
_local22 = (0.5 * (_arg14 + _arg4));
_local23 = (0.5 * (_arg15 + _arg5));
_local24 = (((_arg1 + _local19) / (_arg3 + _local21)) - (0.5 * ((_arg1 / _arg3) + (_local19 / _local21))));
_local25 = (((_arg2 + _local20) / (_arg3 + _local21)) - (0.5 * ((_arg2 / _arg3) + (_local20 / _local21))));
_local26 = ((_local24 * _local24) + (_local25 * _local25));
_local24 = (((_arg6 + _local19) / (_arg8 + _local21)) - (0.5 * ((_arg6 / _arg8) + (_local19 / _local21))));
_local25 = (((_arg7 + _local20) / (_arg8 + _local21)) - (0.5 * ((_arg7 / _arg8) + (_local20 / _local21))));
_local27 = ((_local24 * _local24) + (_local25 * _local25));
_local24 = (((_arg11 + _local19) / (_arg13 + _local21)) - (0.5 * ((_arg11 / _arg13) + (_local19 / _local21))));
_local25 = (((_arg12 + _local20) / (_arg13 + _local21)) - (0.5 * ((_arg12 / _arg13) + (_local20 / _local21))));
_local28 = ((_local24 * _local24) + (_local25 * _local25));
bisection(_local19, _local20, _local21, _local22, _local23, _arg6, _arg7, _arg8, _arg9, _arg10, _arg11, _arg12, _arg13, _arg14, _arg15, _local27, _arg17, _local28);
bisection(_local19, _local20, _local21, _local22, _local23, _arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8, _arg9, _arg10, _local26, _arg16, _local27);
return;
};
};
} else {
if (_arg17 > _arg18){
if (_arg17 > distortion){
_local19 = (0.5 * (_arg6 + _arg11));
_local20 = (0.5 * (_arg7 + _arg12));
_local21 = (0.5 * (_arg8 + _arg13));
_local22 = (0.5 * (_arg9 + _arg14));
_local23 = (0.5 * (_arg10 + _arg15));
_local24 = (((_arg1 + _local19) / (_arg3 + _local21)) - (0.5 * ((_arg1 / _arg3) + (_local19 / _local21))));
_local25 = (((_arg2 + _local20) / (_arg3 + _local21)) - (0.5 * ((_arg2 / _arg3) + (_local20 / _local21))));
_local26 = ((_local24 * _local24) + (_local25 * _local25));
_local24 = (((_arg6 + _local19) / (_arg8 + _local21)) - (0.5 * ((_arg6 / _arg8) + (_local19 / _local21))));
_local25 = (((_arg7 + _local20) / (_arg8 + _local21)) - (0.5 * ((_arg7 / _arg8) + (_local20 / _local21))));
_local27 = ((_local24 * _local24) + (_local25 * _local25));
_local24 = (((_arg11 + _local19) / (_arg13 + _local21)) - (0.5 * ((_arg11 / _arg13) + (_local19 / _local21))));
_local25 = (((_arg12 + _local20) / (_arg13 + _local21)) - (0.5 * ((_arg12 / _arg13) + (_local20 / _local21))));
_local28 = ((_local24 * _local24) + (_local25 * _local25));
bisection(_local19, _local20, _local21, _local22, _local23, _arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8, _arg9, _arg10, _local26, _arg16, _local27);
bisection(_local19, _local20, _local21, _local22, _local23, _arg11, _arg12, _arg13, _arg14, _arg15, _arg1, _arg2, _arg3, _arg4, _arg5, _local28, _arg18, _local26);
return;
};
} else {
if (_arg18 > distortion){
_local19 = (0.5 * (_arg11 + _arg1));
_local20 = (0.5 * (_arg12 + _arg2));
_local21 = (0.5 * (_arg13 + _arg3));
_local22 = (0.5 * (_arg14 + _arg4));
_local23 = (0.5 * (_arg15 + _arg5));
_local24 = (((_arg1 + _local19) / (_arg3 + _local21)) - (0.5 * ((_arg1 / _arg3) + (_local19 / _local21))));
_local25 = (((_arg2 + _local20) / (_arg3 + _local21)) - (0.5 * ((_arg2 / _arg3) + (_local20 / _local21))));
_local26 = ((_local24 * _local24) + (_local25 * _local25));
_local24 = (((_arg6 + _local19) / (_arg8 + _local21)) - (0.5 * ((_arg6 / _arg8) + (_local19 / _local21))));
_local25 = (((_arg7 + _local20) / (_arg8 + _local21)) - (0.5 * ((_arg7 / _arg8) + (_local20 / _local21))));
_local27 = ((_local24 * _local24) + (_local25 * _local25));
_local24 = (((_arg11 + _local19) / (_arg13 + _local21)) - (0.5 * ((_arg11 / _arg13) + (_local19 / _local21))));
_local25 = (((_arg12 + _local20) / (_arg13 + _local21)) - (0.5 * ((_arg12 / _arg13) + (_local20 / _local21))));
_local28 = ((_local24 * _local24) + (_local25 * _local25));
bisection(_local19, _local20, _local21, _local22, _local23, _arg6, _arg7, _arg8, _arg9, _arg10, _arg11, _arg12, _arg13, _arg14, _arg15, _local27, _arg17, _local28);
bisection(_local19, _local20, _local21, _local22, _local23, _arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8, _arg9, _arg10, _local26, _arg16, _local27);
return;
};
};
};
var _local29:Number = (focusDistance / _arg3);
var _local30:Number = (focusDistance / _arg8);
var _local31:Number = (focusDistance / _arg13);
drawTriangle((_arg1 * _local29), (_arg2 * _local29), _arg4, _arg5, (_arg6 * _local30), (_arg7 * _local30), _arg9, _arg10, (_arg11 * _local31), (_arg12 * _local31), _arg14, _arg15);
}
private function clip(_arg1:uint, _arg2:Array, _arg3:Array, _arg4:Number, _arg5:Number, _arg6:Number):uint{
var _local7:Number;
var _local9:TexturePoint;
var _local13:TexturePoint;
var _local14:Number;
var _local8:uint;
var _local10:TexturePoint = _arg2[(_arg1 - 1)];
var _local11:Number = (((_arg4 * _local10.x) + (_arg5 * _local10.y)) + (_arg6 * _local10.z));
var _local12:uint;
while (_local12 < _arg1) {
_local13 = _arg2[_local12];
_local14 = (((_arg4 * _local13.x) + (_arg5 * _local13.y)) + (_arg6 * _local13.z));
if (_local14 > 0){
if (_local11 <= 0){
_local7 = (_local14 / (_local14 - _local11));
_local9 = _arg3[_local8];
if (_local9 == null){
_local9 = new TexturePoint((_local13.x - ((_local13.x - _local10.x) * _local7)), (_local13.y - ((_local13.y - _local10.y) * _local7)), (_local13.z - ((_local13.z - _local10.z) * _local7)), (_local13.u - ((_local13.u - _local10.u) * _local7)), (_local13.v - ((_local13.v - _local10.v) * _local7)));
_arg3[_local8] = _local9;
} else {
_local9.x = (_local13.x - ((_local13.x - _local10.x) * _local7));
_local9.y = (_local13.y - ((_local13.y - _local10.y) * _local7));
_local9.z = (_local13.z - ((_local13.z - _local10.z) * _local7));
_local9.u = (_local13.u - ((_local13.u - _local10.u) * _local7));
_local9.v = (_local13.v - ((_local13.v - _local10.v) * _local7));
};
_local8++;
};
_local9 = _arg3[_local8];
if (_local9 == null){
_local9 = new TexturePoint(_local13.x, _local13.y, _local13.z, _local13.u, _local13.v);
_arg3[_local8] = _local9;
} else {
_local9.x = _local13.x;
_local9.y = _local13.y;
_local9.z = _local13.z;
_local9.u = _local13.u;
_local9.v = _local13.v;
};
_local8++;
} else {
if (_local11 > 0){
_local7 = (_local14 / (_local14 - _local11));
_local9 = _arg3[_local8];
if (_local9 == null){
_local9 = new TexturePoint((_local13.x - ((_local13.x - _local10.x) * _local7)), (_local13.y - ((_local13.y - _local10.y) * _local7)), (_local13.z - ((_local13.z - _local10.z) * _local7)), (_local13.u - ((_local13.u - _local10.u) * _local7)), (_local13.v - ((_local13.v - _local10.v) * _local7)));
_arg3[_local8] = _local9;
} else {
_local9.x = (_local13.x - ((_local13.x - _local10.x) * _local7));
_local9.y = (_local13.y - ((_local13.y - _local10.y) * _local7));
_local9.z = (_local13.z - ((_local13.z - _local10.z) * _local7));
_local9.u = (_local13.u - ((_local13.u - _local10.u) * _local7));
_local9.v = (_local13.v - ((_local13.v - _local10.v) * _local7));
};
_local8++;
};
};
_local11 = _local14;
_local10 = _local13;
_local12++;
};
return (_local8);
}
public function get debug():Boolean{
return (_debug);
}
public function get texture():TextureData{
return (_texture);
}
public function set smooth(_arg1:Boolean):void{
if (_smooth != _arg1){
_smooth = _arg1;
addDrawParamsOperationToScene();
};
}
override public function clone():Material{
return (new TextureMaterial(_texture, _alpha, _repeat, _smooth, _precision, _blendMode));
}
public function get repeat():Boolean{
return (_repeat);
}
public function set debug(_arg1:Boolean):void{
if (_debug != _arg1){
_debug = _arg1;
addDrawParamsOperationToScene();
};
}
private function drawTriangle(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number, _arg7:Number, _arg8:Number, _arg9:Number, _arg10:Number, _arg11:Number, _arg12:Number):void{
var _local13:Number = (_arg5 - _arg1);
var _local14:Number = (_arg6 - _arg2);
var _local15:Number = (_arg9 - _arg1);
var _local16:Number = (_arg10 - _arg2);
var _local17:Number = (_arg7 - _arg3);
var _local18:Number = (_arg8 - _arg4);
var _local19:Number = (_arg11 - _arg3);
var _local20:Number = (_arg12 - _arg4);
var _local21:Number = ((_local17 * _local20) - (_local18 * _local19));
var _local22:Number = _texture.width;
var _local23:Number = _texture.height;
textureMatrix.a = (((_local20 * _local13) - (_local18 * _local15)) / _local21);
textureMatrix.b = (((_local20 * _local14) - (_local18 * _local16)) / _local21);
textureMatrix.c = (((_local19 * _local13) - (_local17 * _local15)) / _local21);
textureMatrix.d = (((_local19 * _local14) - (_local17 * _local16)) / _local21);
textureMatrix.tx = ((((_arg4 - 1) * textureMatrix.c) - (_arg3 * textureMatrix.a)) + _arg1);
textureMatrix.ty = ((((_arg4 - 1) * textureMatrix.d) - (_arg3 * textureMatrix.b)) + _arg2);
textureMatrix.a = (textureMatrix.a / _local22);
textureMatrix.b = (textureMatrix.b / _local22);
textureMatrix.c = (textureMatrix.c / _local23);
textureMatrix.d = (textureMatrix.d / _local23);
gfx.beginBitmapFill(_texture.bitmapData, textureMatrix, _repeat, _smooth);
if (_debug){
gfx.lineStyle(1, 0xFFFFFF);
};
gfx.moveTo(_arg1, _arg2);
gfx.lineTo(_arg5, _arg6);
gfx.lineTo(_arg9, _arg10);
if (_debug){
gfx.lineTo(_arg1, _arg2);
};
}
public function get smooth():Boolean{
return (_smooth);
}
public function set texture(_arg1:TextureData):void{
if (_texture != _arg1){
_texture = _arg1;
addDrawParamsOperationToScene();
};
}
public function set precision(_arg1:Number):void{
_arg1 = ((_arg1)<1) ? 1 : _arg1;
if (_precision != _arg1){
_precision = _arg1;
addDrawParamsOperationToScene();
};
}
public function set repeat(_arg1:Boolean):void{
if (_repeat != _arg1){
_repeat = _arg1;
addDrawParamsOperationToScene();
};
}
public function get precision():Number{
return (_precision);
}
}
}//package com.alternativagame.engine3d
class TexturePoint {
public var u:Number;
public var v:Number;
public var x:Number;
public var y:Number;
public var z:Number;
private function TexturePoint(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number=0, _arg5:Number=0){
this.x = _arg1;
this.y = _arg2;
this.z = _arg3;
this.u = _arg4;
this.v = _arg5;
}
}
Section 19
//Vertex (com.alternativagame.engine3d.Vertex)
package com.alternativagame.engine3d {
import com.alternativagame.type.*;
public final class Vertex {
var calculateGlobalCoordsOperation:Operation;
var removeOperation:Operation;
var _mesh:Mesh;
var addOperation:Operation;
var globalCoords:Point3D;
var coordsOperation:Operation;
var _faces:Set;
var _coords:Point3D;
public function Vertex(_arg1:Number=0, _arg2:Number=0, _arg3:Number=0){
addOperation = new Operation("add", this);
removeOperation = new Operation("remove", this);
coordsOperation = new Operation("coords", this);
calculateGlobalCoordsOperation = new Operation("calculateGlobalCoords", this, calculateGlobalCoords, Operation.VERTEX_TRANSFORMATION);
_faces = new Set();
globalCoords = new Point3D();
super();
_coords = new Point3D(_arg1, _arg2, _arg3);
addOperation.addSequel(calculateGlobalCoordsOperation);
coordsOperation.addSequel(calculateGlobalCoordsOperation);
}
public function get z():Number{
return (_coords.z);
}
function addToFace(_arg1:Face):void{
coordsOperation.addSequel(_arg1.transformOperation);
coordsOperation.addSequel(_arg1.uvOperation);
_faces.add(_arg1);
}
function addToMesh(_arg1:Mesh):void{
_arg1.moveOperation.addSequel(calculateGlobalCoordsOperation);
_arg1.transformOperation.addSequel(calculateGlobalCoordsOperation);
_mesh = _arg1;
}
function removeFromFace(_arg1:Face):void{
coordsOperation.removeSequel(_arg1.transformOperation);
coordsOperation.removeSequel(_arg1.uvOperation);
_faces.remove(_arg1);
}
public function get id():Object{
return (((_mesh)!=null) ? _mesh.getVertexId(this) : null);
}
public function get coords():Point3D{
return (_coords.clone());
}
function removeFromMesh(_arg1:Mesh):void{
var _local2:*;
var _local3:Face;
_arg1.moveOperation.removeSequel(calculateGlobalCoordsOperation);
_arg1.transformOperation.removeSequel(calculateGlobalCoordsOperation);
for (_local2 in _faces) {
_local3 = _local2;
_arg1.removeFace(_local3);
};
_mesh = null;
}
function removeFromScene(_arg1:Scene3D):void{
_arg1.removeOperation(addOperation);
_arg1.removeOperation(coordsOperation);
_arg1.addOperation(removeOperation);
}
private function calculateGlobalCoords():void{
globalCoords.copy(_coords);
globalCoords.transform(_mesh.transformMatrix);
}
public function transform(_arg1:Matrix3D):void{
_coords.transform(_arg1);
if (_mesh != null){
_mesh.addOperationToScene(coordsOperation);
};
}
public function get mesh():Mesh{
return (_mesh);
}
public function set x(_arg1:Number):void{
if (_coords.x != _arg1){
_coords.x = _arg1;
if (_mesh != null){
_mesh.addOperationToScene(coordsOperation);
};
};
}
public function set y(_arg1:Number):void{
if (_coords.y != _arg1){
_coords.y = _arg1;
if (_mesh != null){
_mesh.addOperationToScene(coordsOperation);
};
};
}
public function set z(_arg1:Number):void{
if (_coords.z != _arg1){
_coords.z = _arg1;
if (_mesh != null){
_mesh.addOperationToScene(coordsOperation);
};
};
}
public function get faces():Set{
return (_faces.clone());
}
public function get x():Number{
return (_coords.x);
}
public function get y():Number{
return (_coords.y);
}
public function toString():String{
return ((((((((("[Vertex ID:" + id) + " ") + _coords.x.toFixed(2)) + ", ") + _coords.y.toFixed(2)) + ", ") + _coords.z.toFixed(2)) + "]"));
}
public function set coords(_arg1:Point3D):void{
if (!_coords.equals(_arg1)){
_coords.copy(_arg1);
if (_mesh != null){
_mesh.addOperationToScene(coordsOperation);
};
};
}
function addToScene(_arg1:Scene3D):void{
_arg1.removeOperation(removeOperation);
_arg1.addOperation(addOperation);
}
}
}//package com.alternativagame.engine3d
Section 20
//View (com.alternativagame.engine3d.View)
package com.alternativagame.engine3d {
import flash.geom.*;
import flash.display.*;
public class View extends Sprite {
var halfHeight:Number;
var _height:Number;
var _width:Number;
private var _background:uint;// = 0
private var _crop:Boolean;// = false
var halfWidth:Number;
var canvas:Sprite;
public function View(_arg1:Number=0, _arg2:Number=0){
canvas = new Sprite();
canvas.mouseEnabled = false;
canvas.mouseChildren = false;
canvas.tabEnabled = false;
canvas.tabChildren = false;
addChild(canvas);
this.width = _arg1;
this.height = _arg2;
}
public function set crop(_arg1:Boolean):void{
_crop = _arg1;
if (_arg1){
scrollRect = new Rectangle(0, 0, width, height);
} else {
scrollRect = null;
};
}
override public function get width():Number{
return (_width);
}
override public function get height():Number{
return (_height);
}
public function get crop():Boolean{
return (_crop);
}
override public function set width(_arg1:Number):void{
if (_width != _arg1){
_width = _arg1;
halfWidth = (_arg1 * 0.5);
canvas.x = halfWidth;
if (crop){
scrollRect = new Rectangle(0, 0, _width, height);
};
};
}
override public function set height(_arg1:Number):void{
if (_height != _arg1){
_height = _arg1;
halfHeight = (_arg1 * 0.5);
canvas.y = halfHeight;
if (crop){
scrollRect = new Rectangle(0, 0, width, _height);
};
};
}
}
}//package com.alternativagame.engine3d
Section 21
//WireMaterial (com.alternativagame.engine3d.WireMaterial)
package com.alternativagame.engine3d {
import com.alternativagame.type.*;
import flash.display.*;
public class WireMaterial extends SurfaceMaterial {
var _color:uint;
var _thickness:Number;
private var currentSkin:Skin;
private static var gfx:Graphics;
private static var focusDistance:Number;
private static var points1:Array = new Array();
private static var points2:Array = new Array();
public function WireMaterial(_arg1:Number=0, _arg2:uint=0x7F7F7F, _arg3:Number=1, _arg4:String="normal"):void{
super(_arg3, _arg4);
_color = _arg2;
_thickness = _arg1;
}
public function get color():uint{
return (_color);
}
public function set color(_arg1:uint):void{
if (_color != _arg1){
_color = _arg1;
addDrawParamsOperationToScene();
};
}
override function draw(_arg1:Skin):void{
var _local6:Point3D;
var _local7:uint;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Point3D;
gfx = _arg1.gfx;
var _local2:Face = _arg1.face;
var _local3:Camera3D = _arg1.camera;
var _local4:uint = _arg1._primitive.num;
var _local5:Array = _arg1._primitive.points;
if (_local3._fov == 0){
gfx.lineStyle(_thickness, _color);
_local6 = _local3.calculateCameraCoord(_local5[(_local4 - 1)]);
gfx.moveTo(_local6.x, _local6.y);
_local7 = 0;
while (_local7 < _local4) {
_local6 = _local3.calculateCameraCoord(_local5[_local7]);
gfx.lineTo(_local6.x, _local6.y);
_local7++;
};
} else {
focusDistance = _local3.focusDistance;
_local7 = 0;
while (_local7 < _local4) {
_local6 = _local3.calculateCameraCoord(_local5[_local7]);
_local13 = points1[_local7];
if (_local13 == null){
_local13 = _local6.clone();
points1[_local7] = _local13;
} else {
_local13.copy(_local6);
};
_local7++;
};
_local8 = -(focusDistance);
_local9 = _local3._view.halfWidth;
_local10 = Math.sqrt(((_local8 * _local8) + (_local9 * _local9)));
_local8 = (_local8 / _local10);
_local9 = (_local9 / _local10);
_local4 = clip(_local4, points1, points2, _local8, 0, _local9);
if (_local4 < 3){
return;
};
_local4 = clip(_local4, points2, points1, -(_local8), 0, _local9);
if (_local4 < 3){
return;
};
_local11 = -(focusDistance);
_local9 = _local3._view.halfHeight;
_local10 = Math.sqrt(((_local11 * _local11) + (_local9 * _local9)));
_local11 = (_local11 / _local10);
_local9 = (_local9 / _local10);
_local4 = clip(_local4, points1, points2, 0, _local11, _local9);
if (_local4 < 3){
return;
};
_local4 = clip(_local4, points2, points1, 0, -(_local11), _local9);
if (_local4 < 3){
return;
};
gfx.lineStyle(_thickness, _color);
_local6 = points1[(_local4 - 1)];
_local12 = (focusDistance / _local6.z);
gfx.moveTo((_local6.x * _local12), (_local6.y * _local12));
_local7 = 0;
while (_local7 < _local4) {
_local6 = points1[_local7];
_local12 = (focusDistance / _local6.z);
gfx.lineTo((_local6.x * _local12), (_local6.y * _local12));
_local7++;
};
};
}
public function set thickness(_arg1:Number):void{
if (_thickness != _arg1){
_thickness = _arg1;
addDrawParamsOperationToScene();
};
}
private function clip(_arg1:uint, _arg2:Array, _arg3:Array, _arg4:Number, _arg5:Number, _arg6:Number):uint{
var _local7:Number;
var _local9:Point3D;
var _local13:Point3D;
var _local14:Number;
var _local8:uint;
var _local10:Point3D = _arg2[(_arg1 - 1)];
var _local11:Number = (((_arg4 * _local10.x) + (_arg5 * _local10.y)) + (_arg6 * _local10.z));
var _local12:uint;
while (_local12 < _arg1) {
_local13 = _arg2[_local12];
_local14 = (((_arg4 * _local13.x) + (_arg5 * _local13.y)) + (_arg6 * _local13.z));
if (_local14 > 0){
if (_local11 <= 0){
_local7 = (_local14 / (_local14 - _local11));
_local9 = _arg3[_local8];
if (_local9 == null){
_local9 = new Point3D((_local13.x - ((_local13.x - _local10.x) * _local7)), (_local13.y - ((_local13.y - _local10.y) * _local7)), (_local13.z - ((_local13.z - _local10.z) * _local7)));
_arg3[_local8] = _local9;
} else {
_local9.x = (_local13.x - ((_local13.x - _local10.x) * _local7));
_local9.y = (_local13.y - ((_local13.y - _local10.y) * _local7));
_local9.z = (_local13.z - ((_local13.z - _local10.z) * _local7));
};
_local8++;
};
_local9 = _arg3[_local8];
if (_local9 == null){
_local9 = _local13.clone();
_arg3[_local8] = _local9;
} else {
_local9.copy(_local13);
};
_local8++;
} else {
if (_local11 > 0){
_local7 = (_local14 / (_local14 - _local11));
_local9 = _arg3[_local8];
if (_local9 == null){
_local9 = new Point3D((_local13.x - ((_local13.x - _local10.x) * _local7)), (_local13.y - ((_local13.y - _local10.y) * _local7)), (_local13.z - ((_local13.z - _local10.z) * _local7)));
_arg3[_local8] = _local9;
} else {
_local9.x = (_local13.x - ((_local13.x - _local10.x) * _local7));
_local9.y = (_local13.y - ((_local13.y - _local10.y) * _local7));
_local9.z = (_local13.z - ((_local13.z - _local10.z) * _local7));
};
_local8++;
};
};
_local11 = _local14;
_local10 = _local13;
_local12++;
};
return (_local8);
}
public function get thickness():Number{
return (_thickness);
}
override public function clone():Material{
return (new WireMaterial(_thickness, _color, _alpha, _blendMode));
}
}
}//package com.alternativagame.engine3d
Section 22
//Matrix3D (com.alternativagame.type.Matrix3D)
package com.alternativagame.type {
public final class Matrix3D {
public var a:Number;
public var b:Number;
public var c:Number;
public var d:Number;
public var e:Number;
public var f:Number;
public var g:Number;
public var h:Number;
public var i:Number;
public var j:Number;
public var k:Number;
public var l:Number;
public function Matrix3D(_arg1:Number=1, _arg2:Number=0, _arg3:Number=0, _arg4:Number=0, _arg5:Number=0, _arg6:Number=1, _arg7:Number=0, _arg8:Number=0, _arg9:Number=0, _arg10:Number=0, _arg11:Number=1, _arg12:Number=0){
this.a = _arg1;
this.b = _arg2;
this.c = _arg3;
this.d = _arg4;
this.e = _arg5;
this.f = _arg6;
this.g = _arg7;
this.h = _arg8;
this.i = _arg9;
this.j = _arg10;
this.k = _arg11;
this.l = _arg12;
}
public function clone():Matrix3D{
return (new Matrix3D(a, b, c, d, e, f, g, h, i, j, k, l));
}
public function toString():String{
return (((((((((((((((((((((((("Matrix:\r" + a.toFixed(3)) + "\t") + b.toFixed(3)) + "\t") + c.toFixed(3)) + "\t") + d.toFixed(3)) + "\r") + e.toFixed(3)) + "\t") + f.toFixed(3)) + "\t") + g.toFixed(3)) + "\t") + h.toFixed(3)) + "\r") + i.toFixed(3)) + "\t") + j.toFixed(3)) + "\t") + k.toFixed(3)) + "\t") + l.toFixed(3)));
}
public function scale(_arg1:Number, _arg2:Number, _arg3:Number):void{
a = (a * _arg1);
b = (b * _arg1);
c = (c * _arg1);
d = (d * _arg1);
e = (e * _arg2);
f = (f * _arg2);
g = (g * _arg2);
h = (h * _arg2);
i = (i * _arg3);
j = (j * _arg3);
k = (k * _arg3);
l = (l * _arg3);
}
public function offset(_arg1:Number=0, _arg2:Number=0, _arg3:Number=0):void{
d = _arg1;
h = _arg2;
l = _arg3;
}
public function translate(_arg1:Number, _arg2:Number, _arg3:Number):void{
d = (d + _arg1);
h = (h + _arg2);
l = (l + _arg3);
}
public function equals(_arg1:Matrix3D, _arg2:Number=0):Boolean{
var _local3:Number = (a - _arg1.a);
var _local4:Number = (b - _arg1.b);
var _local5:Number = (c - _arg1.c);
var _local6:Number = (d - _arg1.d);
var _local7:Number = (e - _arg1.e);
var _local8:Number = (f - _arg1.f);
var _local9:Number = (g - _arg1.g);
var _local10:Number = (h - _arg1.h);
var _local11:Number = (i - _arg1.i);
var _local12:Number = (j - _arg1.j);
var _local13:Number = (k - _arg1.k);
var _local14:Number = (l - _arg1.l);
_local3 = ((_local3)<0) ? -(_local3) : _local3;
_local4 = ((_local4)<0) ? -(_local4) : _local4;
_local5 = ((_local5)<0) ? -(_local5) : _local5;
_local6 = ((_local6)<0) ? -(_local6) : _local6;
_local7 = ((_local7)<0) ? -(_local7) : _local7;
_local8 = ((_local8)<0) ? -(_local8) : _local8;
_local9 = ((_local9)<0) ? -(_local9) : _local9;
_local10 = ((_local10)<0) ? -(_local10) : _local10;
_local11 = ((_local11)<0) ? -(_local11) : _local11;
_local12 = ((_local12)<0) ? -(_local12) : _local12;
_local13 = ((_local13)<0) ? -(_local13) : _local13;
_local14 = ((_local14)<0) ? -(_local14) : _local14;
return ((((((((((((((((((((((((_local3 <= _arg2)) && ((_local4 <= _arg2)))) && ((_local5 <= _arg2)))) && ((_local6 <= _arg2)))) && ((_local7 <= _arg2)))) && ((_local8 <= _arg2)))) && ((_local9 <= _arg2)))) && ((_local10 <= _arg2)))) && ((_local11 <= _arg2)))) && ((_local12 <= _arg2)))) && ((_local13 <= _arg2)))) && ((_local14 <= _arg2))));
}
public function toIdentity():void{
a = 1;
b = 0;
c = 0;
d = 0;
e = 0;
f = 1;
g = 0;
h = 0;
i = 0;
j = 0;
k = 1;
l = 0;
}
public function convertToScreen():void{
var _local1:Number = e;
var _local2:Number = f;
var _local3:Number = g;
var _local4:Number = h;
e = -(i);
f = -(j);
g = -(k);
h = -(l);
i = -(_local1);
j = -(_local2);
k = -(_local3);
l = -(_local4);
}
public function rotate(_arg1:Number, _arg2:Number, _arg3:Number):void{
var _local4:Number = Math.cos(_arg1);
var _local5:Number = Math.sin(_arg1);
var _local6:Number = Math.cos(_arg2);
var _local7:Number = Math.sin(_arg2);
var _local8:Number = Math.cos(_arg3);
var _local9:Number = Math.sin(_arg3);
var _local10:Number = (_local8 * _local7);
var _local11:Number = (_local9 * _local7);
var _local12:Number = (_local8 * _local6);
var _local13:Number = ((_local10 * _local5) - (_local9 * _local4));
var _local14:Number = ((_local10 * _local4) + (_local9 * _local5));
var _local15:Number = (_local9 * _local6);
var _local16:Number = ((_local11 * _local5) + (_local8 * _local4));
var _local17:Number = ((_local11 * _local4) - (_local8 * _local5));
var _local18:Number = -(_local7);
var _local19:Number = (_local6 * _local5);
var _local20:Number = (_local6 * _local4);
var _local21:Number = a;
var _local22:Number = b;
var _local23:Number = c;
var _local24:Number = d;
var _local25:Number = e;
var _local26:Number = f;
var _local27:Number = g;
var _local28:Number = h;
var _local29:Number = i;
var _local30:Number = j;
var _local31:Number = k;
var _local32:Number = l;
a = (((_local12 * _local21) + (_local13 * _local25)) + (_local14 * _local29));
b = (((_local12 * _local22) + (_local13 * _local26)) + (_local14 * _local30));
c = (((_local12 * _local23) + (_local13 * _local27)) + (_local14 * _local31));
d = (((_local12 * _local24) + (_local13 * _local28)) + (_local14 * _local32));
e = (((_local15 * _local21) + (_local16 * _local25)) + (_local17 * _local29));
f = (((_local15 * _local22) + (_local16 * _local26)) + (_local17 * _local30));
g = (((_local15 * _local23) + (_local16 * _local27)) + (_local17 * _local31));
h = (((_local15 * _local24) + (_local16 * _local28)) + (_local17 * _local32));
i = (((_local18 * _local21) + (_local19 * _local25)) + (_local20 * _local29));
j = (((_local18 * _local22) + (_local19 * _local26)) + (_local20 * _local30));
k = (((_local18 * _local23) + (_local19 * _local27)) + (_local20 * _local31));
l = (((_local18 * _local24) + (_local19 * _local28)) + (_local20 * _local32));
}
public function inverseTransform(_arg1:Number=0, _arg2:Number=0, _arg3:Number=0, _arg4:Number=0, _arg5:Number=0, _arg6:Number=0, _arg7:Number=1, _arg8:Number=1, _arg9:Number=1):void{
var _local10:Number = Math.cos(-(_arg4));
var _local11:Number = Math.sin(-(_arg4));
var _local12:Number = Math.cos(-(_arg5));
var _local13:Number = Math.sin(-(_arg5));
var _local14:Number = Math.cos(-(_arg6));
var _local15:Number = Math.sin(-(_arg6));
var _local16:Number = (_local11 * _local13);
var _local17:Number = (1 / _arg7);
var _local18:Number = (1 / _arg8);
var _local19:Number = (1 / _arg9);
var _local20:Number = (_local12 * _local17);
var _local21:Number = (_local10 * _local18);
var _local22:Number = (_local11 * _local19);
var _local23:Number = (_local10 * _local19);
var _local24:Number = (_local14 * _local20);
var _local25:Number = (-(_local15) * _local20);
var _local26:Number = (_local13 * _local17);
var _local27:Number = -((((_local24 * _arg1) + (_local25 * _arg2)) + (_local26 * _arg3)));
var _local28:Number = ((_local15 * _local21) + ((_local16 * _local14) * _local18));
var _local29:Number = ((_local14 * _local21) - ((_local16 * _local15) * _local18));
var _local30:Number = ((-(_local11) * _local12) * _local18);
var _local31:Number = -((((_local28 * _arg1) + (_local29 * _arg2)) + (_local30 * _arg3)));
var _local32:Number = ((_local15 * _local22) - ((_local14 * _local13) * _local23));
var _local33:Number = ((_local14 * _local22) + ((_local13 * _local15) * _local23));
var _local34:Number = (_local12 * _local23);
var _local35:Number = -((((_local32 * _arg1) + (_local33 * _arg2)) + (_local34 * _arg3)));
var _local36:Number = a;
var _local37:Number = b;
var _local38:Number = c;
var _local39:Number = d;
var _local40:Number = e;
var _local41:Number = f;
var _local42:Number = g;
var _local43:Number = h;
var _local44:Number = i;
var _local45:Number = j;
var _local46:Number = k;
var _local47:Number = l;
a = (((_local24 * _local36) + (_local25 * _local40)) + (_local26 * _local44));
b = (((_local24 * _local37) + (_local25 * _local41)) + (_local26 * _local45));
c = (((_local24 * _local38) + (_local25 * _local42)) + (_local26 * _local46));
d = ((((_local24 * _local39) + (_local25 * _local43)) + (_local26 * _local47)) + _local27);
e = (((_local28 * _local36) + (_local29 * _local40)) + (_local30 * _local44));
f = (((_local28 * _local37) + (_local29 * _local41)) + (_local30 * _local45));
g = (((_local28 * _local38) + (_local29 * _local42)) + (_local30 * _local46));
h = ((((_local28 * _local39) + (_local29 * _local43)) + (_local30 * _local47)) + _local31);
i = (((_local32 * _local36) + (_local33 * _local40)) + (_local34 * _local44));
j = (((_local32 * _local37) + (_local33 * _local41)) + (_local34 * _local45));
k = (((_local32 * _local38) + (_local33 * _local42)) + (_local34 * _local46));
l = ((((_local32 * _local39) + (_local33 * _local43)) + (_local34 * _local47)) + _local35);
}
public function invert():void{
var _local1:Number = a;
var _local2:Number = b;
var _local3:Number = c;
var _local4:Number = d;
var _local5:Number = e;
var _local6:Number = f;
var _local7:Number = g;
var _local8:Number = h;
var _local9:Number = i;
var _local10:Number = j;
var _local11:Number = k;
var _local12:Number = l;
var _local13:Number = (((((((-(_local3) * _local6) * _local9) + ((_local2 * _local7) * _local9)) + ((_local3 * _local5) * _local10)) - ((_local1 * _local7) * _local10)) - ((_local2 * _local5) * _local11)) + ((_local1 * _local6) * _local11));
a = (((-(_local7) * _local10) + (_local6 * _local11)) / _local13);
b = (((_local3 * _local10) - (_local2 * _local11)) / _local13);
c = (((-(_local3) * _local6) + (_local2 * _local7)) / _local13);
d = ((((((((_local4 * _local7) * _local10) - ((_local3 * _local8) * _local10)) - ((_local4 * _local6) * _local11)) + ((_local2 * _local8) * _local11)) + ((_local3 * _local6) * _local12)) - ((_local2 * _local7) * _local12)) / _local13);
e = (((_local7 * _local9) - (_local5 * _local11)) / _local13);
f = (((-(_local3) * _local9) + (_local1 * _local11)) / _local13);
g = (((_local3 * _local5) - (_local1 * _local7)) / _local13);
h = ((((((((_local3 * _local8) * _local9) - ((_local4 * _local7) * _local9)) + ((_local4 * _local5) * _local11)) - ((_local1 * _local8) * _local11)) - ((_local3 * _local5) * _local12)) + ((_local1 * _local7) * _local12)) / _local13);
i = (((-(_local6) * _local9) + (_local5 * _local10)) / _local13);
j = (((_local2 * _local9) - (_local1 * _local10)) / _local13);
k = (((-(_local2) * _local5) + (_local1 * _local6)) / _local13);
l = ((((((((_local4 * _local6) * _local9) - ((_local2 * _local8) * _local9)) - ((_local4 * _local5) * _local10)) + ((_local1 * _local8) * _local10)) + ((_local2 * _local5) * _local12)) - ((_local1 * _local6) * _local12)) / _local13);
}
public function inverseCombine(_arg1:Matrix3D):void{
var _local2:Number = a;
var _local3:Number = b;
var _local4:Number = c;
var _local5:Number = d;
var _local6:Number = e;
var _local7:Number = f;
var _local8:Number = g;
var _local9:Number = h;
var _local10:Number = i;
var _local11:Number = j;
var _local12:Number = k;
var _local13:Number = l;
a = (((_local2 * _arg1.a) + (_local3 * _arg1.e)) + (_local4 * _arg1.i));
b = (((_local2 * _arg1.b) + (_local3 * _arg1.f)) + (_local4 * _arg1.j));
c = (((_local2 * _arg1.c) + (_local3 * _arg1.g)) + (_local4 * _arg1.k));
d = ((((_local2 * _arg1.d) + (_local3 * _arg1.h)) + (_local4 * _arg1.l)) + _local5);
e = (((_local6 * _arg1.a) + (_local7 * _arg1.e)) + (_local8 * _arg1.i));
f = (((_local6 * _arg1.b) + (_local7 * _arg1.f)) + (_local8 * _arg1.j));
g = (((_local6 * _arg1.c) + (_local7 * _arg1.g)) + (_local8 * _arg1.k));
h = ((((_local6 * _arg1.d) + (_local7 * _arg1.h)) + (_local8 * _arg1.l)) + _local9);
i = (((_local10 * _arg1.a) + (_local11 * _arg1.e)) + (_local12 * _arg1.i));
j = (((_local10 * _arg1.b) + (_local11 * _arg1.f)) + (_local12 * _arg1.j));
k = (((_local10 * _arg1.c) + (_local11 * _arg1.g)) + (_local12 * _arg1.k));
l = ((((_local10 * _arg1.d) + (_local11 * _arg1.h)) + (_local12 * _arg1.l)) + _local13);
}
public function toTransform(_arg1:Number=0, _arg2:Number=0, _arg3:Number=0, _arg4:Number=0, _arg5:Number=0, _arg6:Number=0, _arg7:Number=1, _arg8:Number=1, _arg9:Number=1):void{
var _local10:Number = Math.cos(_arg4);
var _local11:Number = Math.sin(_arg4);
var _local12:Number = Math.cos(_arg5);
var _local13:Number = Math.sin(_arg5);
var _local14:Number = Math.cos(_arg6);
var _local15:Number = Math.sin(_arg6);
var _local16:Number = (_local14 * _local13);
var _local17:Number = (_local15 * _local13);
var _local18:Number = (_local12 * _arg7);
var _local19:Number = (_local11 * _arg8);
var _local20:Number = (_local10 * _arg8);
var _local21:Number = (_local10 * _arg9);
var _local22:Number = (_local11 * _arg9);
a = (_local14 * _local18);
b = ((_local16 * _local19) - (_local15 * _local20));
c = ((_local16 * _local21) + (_local15 * _local22));
d = _arg1;
e = (_local15 * _local18);
f = ((_local17 * _local19) + (_local14 * _local20));
g = ((_local17 * _local21) - (_local14 * _local22));
h = _arg2;
i = (-(_local13) * _arg7);
j = (_local12 * _local19);
k = (_local12 * _local21);
l = _arg3;
}
public function inverseRotate(_arg1:Number, _arg2:Number, _arg3:Number):void{
var _local4:Number = Math.cos(-(_arg1));
var _local5:Number = Math.sin(-(_arg1));
var _local6:Number = Math.cos(-(_arg2));
var _local7:Number = Math.sin(-(_arg2));
var _local8:Number = Math.cos(-(_arg3));
var _local9:Number = Math.sin(-(_arg3));
var _local10:Number = (_local5 * _local7);
var _local11:Number = (_local6 * _local8);
var _local12:Number = (-(_local6) * _local9);
var _local13:Number = _local7;
var _local14:Number = ((_local4 * _local9) + (_local10 * _local8));
var _local15:Number = ((_local4 * _local8) - (_local10 * _local9));
var _local16:Number = (-(_local5) * _local6);
var _local17:Number = ((_local5 * _local9) - ((_local4 * _local8) * _local7));
var _local18:Number = ((_local5 * _local8) + ((_local4 * _local7) * _local9));
var _local19:Number = (_local4 * _local6);
var _local20:Number = a;
var _local21:Number = b;
var _local22:Number = c;
var _local23:Number = d;
var _local24:Number = e;
var _local25:Number = f;
var _local26:Number = g;
var _local27:Number = h;
var _local28:Number = i;
var _local29:Number = j;
var _local30:Number = k;
var _local31:Number = l;
a = (((_local11 * _local20) + (_local12 * _local24)) + (_local13 * _local28));
b = (((_local11 * _local21) + (_local12 * _local25)) + (_local13 * _local29));
c = (((_local11 * _local22) + (_local12 * _local26)) + (_local13 * _local30));
d = (((_local11 * _local23) + (_local12 * _local27)) + (_local13 * _local31));
e = (((_local14 * _local20) + (_local15 * _local24)) + (_local16 * _local28));
f = (((_local14 * _local21) + (_local15 * _local25)) + (_local16 * _local29));
g = (((_local14 * _local22) + (_local15 * _local26)) + (_local16 * _local30));
h = (((_local14 * _local23) + (_local15 * _local27)) + (_local16 * _local31));
i = (((_local17 * _local20) + (_local18 * _local24)) + (_local19 * _local28));
j = (((_local17 * _local21) + (_local18 * _local25)) + (_local19 * _local29));
k = (((_local17 * _local22) + (_local18 * _local26)) + (_local19 * _local30));
l = (((_local17 * _local23) + (_local18 * _local27)) + (_local19 * _local31));
}
public function copy(_arg1:Matrix3D):void{
a = _arg1.a;
b = _arg1.b;
c = _arg1.c;
d = _arg1.d;
e = _arg1.e;
f = _arg1.f;
g = _arg1.g;
h = _arg1.h;
i = _arg1.i;
j = _arg1.j;
k = _arg1.k;
l = _arg1.l;
}
public function inverseConvertToScreen():void{
var _local1:Number = b;
var _local2:Number = f;
var _local3:Number = j;
b = -(c);
f = -(g);
j = -(k);
c = -(_local1);
g = -(_local2);
k = -(_local3);
}
public function inverseScale(_arg1:Number, _arg2:Number, _arg3:Number):void{
var _local4:Number = (1 / _arg1);
var _local5:Number = (1 / _arg2);
var _local6:Number = (1 / _arg3);
a = (a * _local4);
b = (b * _local4);
c = (c * _local4);
d = (d * _local4);
e = (e * _local5);
f = (f * _local5);
g = (g * _local5);
h = (h * _local5);
i = (i * _local6);
j = (j * _local6);
k = (k * _local6);
l = (l * _local6);
}
public function transform(_arg1:Number=0, _arg2:Number=0, _arg3:Number=0, _arg4:Number=0, _arg5:Number=0, _arg6:Number=0, _arg7:Number=1, _arg8:Number=1, _arg9:Number=1):void{
var _local10:Number = Math.cos(_arg4);
var _local11:Number = Math.sin(_arg4);
var _local12:Number = Math.cos(_arg5);
var _local13:Number = Math.sin(_arg5);
var _local14:Number = Math.cos(_arg6);
var _local15:Number = Math.sin(_arg6);
var _local16:Number = (_local14 * _local13);
var _local17:Number = (_local15 * _local13);
var _local18:Number = (_local12 * _arg7);
var _local19:Number = (_local11 * _arg8);
var _local20:Number = (_local10 * _arg8);
var _local21:Number = (_local10 * _arg9);
var _local22:Number = (_local11 * _arg9);
var _local23:Number = (_local14 * _local18);
var _local24:Number = ((_local16 * _local19) - (_local15 * _local20));
var _local25:Number = ((_local16 * _local21) + (_local15 * _local22));
var _local26:Number = _arg1;
var _local27:Number = (_local15 * _local18);
var _local28:Number = ((_local17 * _local19) + (_local14 * _local20));
var _local29:Number = ((_local17 * _local21) - (_local14 * _local22));
var _local30:Number = _arg2;
var _local31:Number = (-(_local13) * _arg7);
var _local32:Number = (_local12 * _local19);
var _local33:Number = (_local12 * _local21);
var _local34:Number = _arg3;
var _local35:Number = a;
var _local36:Number = b;
var _local37:Number = c;
var _local38:Number = d;
var _local39:Number = e;
var _local40:Number = f;
var _local41:Number = g;
var _local42:Number = h;
var _local43:Number = i;
var _local44:Number = j;
var _local45:Number = k;
var _local46:Number = l;
a = (((_local23 * _local35) + (_local24 * _local39)) + (_local25 * _local43));
b = (((_local23 * _local36) + (_local24 * _local40)) + (_local25 * _local44));
c = (((_local23 * _local37) + (_local24 * _local41)) + (_local25 * _local45));
d = ((((_local23 * _local38) + (_local24 * _local42)) + (_local25 * _local46)) + _local26);
e = (((_local27 * _local35) + (_local28 * _local39)) + (_local29 * _local43));
f = (((_local27 * _local36) + (_local28 * _local40)) + (_local29 * _local44));
g = (((_local27 * _local37) + (_local28 * _local41)) + (_local29 * _local45));
h = ((((_local27 * _local38) + (_local28 * _local42)) + (_local29 * _local46)) + _local30);
i = (((_local31 * _local35) + (_local32 * _local39)) + (_local33 * _local43));
j = (((_local31 * _local36) + (_local32 * _local40)) + (_local33 * _local44));
k = (((_local31 * _local37) + (_local32 * _local41)) + (_local33 * _local45));
l = ((((_local31 * _local38) + (_local32 * _local42)) + (_local33 * _local46)) + _local34);
}
public function translateLocal(_arg1:Number, _arg2:Number, _arg3:Number):void{
d = (d + (((a * _arg1) + (b * _arg2)) + (c * _arg3)));
h = (h + (((e * _arg1) + (f * _arg2)) + (g * _arg3)));
l = (l + (((i * _arg1) + (j * _arg2)) + (k * _arg3)));
}
public function inverseTranslate(_arg1:Number, _arg2:Number, _arg3:Number):void{
d = (d - _arg1);
h = (h - _arg2);
l = (l - _arg3);
}
public function combine(_arg1:Matrix3D):void{
var _local2:Number = a;
var _local3:Number = b;
var _local4:Number = c;
var _local5:Number = d;
var _local6:Number = e;
var _local7:Number = f;
var _local8:Number = g;
var _local9:Number = h;
var _local10:Number = i;
var _local11:Number = j;
var _local12:Number = k;
var _local13:Number = l;
a = (((_arg1.a * _local2) + (_arg1.b * _local6)) + (_arg1.c * _local10));
b = (((_arg1.a * _local3) + (_arg1.b * _local7)) + (_arg1.c * _local11));
c = (((_arg1.a * _local4) + (_arg1.b * _local8)) + (_arg1.c * _local12));
d = ((((_arg1.a * _local5) + (_arg1.b * _local9)) + (_arg1.c * _local13)) + _arg1.d);
e = (((_arg1.e * _local2) + (_arg1.f * _local6)) + (_arg1.g * _local10));
f = (((_arg1.e * _local3) + (_arg1.f * _local7)) + (_arg1.g * _local11));
g = (((_arg1.e * _local4) + (_arg1.f * _local8)) + (_arg1.g * _local12));
h = ((((_arg1.e * _local5) + (_arg1.f * _local9)) + (_arg1.g * _local13)) + _arg1.h);
i = (((_arg1.i * _local2) + (_arg1.j * _local6)) + (_arg1.k * _local10));
j = (((_arg1.i * _local3) + (_arg1.j * _local7)) + (_arg1.k * _local11));
k = (((_arg1.i * _local4) + (_arg1.j * _local8)) + (_arg1.k * _local12));
l = ((((_arg1.i * _local5) + (_arg1.j * _local9)) + (_arg1.k * _local13)) + _arg1.l);
}
public static function inverseTranslationMatrix(_arg1:Number, _arg2:Number, _arg3:Number):Matrix3D{
return (new Matrix3D(1, 0, 0, -(_arg1), 0, 1, 0, -(_arg2), 0, 0, 1, -(_arg3)));
}
public static function translationMatrix(_arg1:Number, _arg2:Number, _arg3:Number):Matrix3D{
return (new Matrix3D(1, 0, 0, _arg1, 0, 1, 0, _arg2, 0, 0, 1, _arg3));
}
public static function inverseRotationMatrix(_arg1:Number, _arg2:Number, _arg3:Number):Matrix3D{
var _local4:Number = Math.cos(-(_arg1));
var _local5:Number = Math.sin(-(_arg1));
var _local6:Number = Math.cos(-(_arg2));
var _local7:Number = Math.sin(-(_arg2));
var _local8:Number = Math.cos(-(_arg3));
var _local9:Number = Math.sin(-(_arg3));
var _local10:Number = (_local5 * _local7);
return (new Matrix3D((_local6 * _local8), (-(_local6) * _local9), _local7, 0, ((_local4 * _local9) + (_local10 * _local8)), ((_local4 * _local8) - (_local10 * _local9)), (-(_local5) * _local6), 0, ((_local5 * _local9) - ((_local4 * _local8) * _local7)), ((_local5 * _local8) + ((_local4 * _local7) * _local9)), (_local4 * _local6), 0));
}
public static function inverseTransformationMatrix(_arg1:Number=0, _arg2:Number=0, _arg3:Number=0, _arg4:Number=0, _arg5:Number=0, _arg6:Number=0, _arg7:Number=1, _arg8:Number=1, _arg9:Number=1):Matrix3D{
var _local10:Number = Math.cos(-(_arg4));
var _local11:Number = Math.sin(-(_arg4));
var _local12:Number = Math.cos(-(_arg5));
var _local13:Number = Math.sin(-(_arg5));
var _local14:Number = Math.cos(-(_arg6));
var _local15:Number = Math.sin(-(_arg6));
var _local16:Number = (_local11 * _local13);
var _local17:Number = (1 / _arg7);
var _local18:Number = (1 / _arg8);
var _local19:Number = (1 / _arg9);
var _local20:Number = (_local12 * _local17);
var _local21:Number = (_local10 * _local18);
var _local22:Number = (_local11 * _local19);
var _local23:Number = (_local10 * _local19);
var _local24:Number = (_local14 * _local20);
var _local25:Number = (-(_local15) * _local20);
var _local26:Number = (_local13 * _local17);
var _local27:Number = ((_local15 * _local21) + ((_local16 * _local14) * _local18));
var _local28:Number = ((_local14 * _local21) - ((_local16 * _local15) * _local18));
var _local29:Number = ((-(_local11) * _local12) * _local18);
var _local30:Number = ((_local15 * _local22) - ((_local14 * _local13) * _local23));
var _local31:Number = ((_local14 * _local22) + ((_local13 * _local15) * _local23));
var _local32:Number = (_local12 * _local23);
return (new Matrix3D(_local24, _local25, _local26, -((((_local24 * _arg1) + (_local25 * _arg2)) + (_local26 * _arg3))), _local27, _local28, _local29, -((((_local27 * _arg1) + (_local28 * _arg2)) + (_local29 * _arg3))), _local30, _local31, _local32, -((((_local30 * _arg1) + (_local31 * _arg2)) + (_local32 * _arg3)))));
}
public static function inverseMatrix(_arg1:Matrix3D):Matrix3D{
var _local2:Number = (((((((-(_arg1.c) * _arg1.f) * _arg1.i) + ((_arg1.b * _arg1.g) * _arg1.i)) + ((_arg1.c * _arg1.e) * _arg1.j)) - ((_arg1.a * _arg1.g) * _arg1.j)) - ((_arg1.b * _arg1.e) * _arg1.k)) + ((_arg1.a * _arg1.f) * _arg1.k));
var _local3:Number = (((-(_arg1.g) * _arg1.j) + (_arg1.f * _arg1.k)) / _local2);
var _local4:Number = (((_arg1.c * _arg1.j) - (_arg1.b * _arg1.k)) / _local2);
var _local5:Number = (((-(_arg1.c) * _arg1.f) + (_arg1.b * _arg1.g)) / _local2);
var _local6:Number = ((((((((_arg1.d * _arg1.g) * _arg1.j) - ((_arg1.c * _arg1.h) * _arg1.j)) - ((_arg1.d * _arg1.f) * _arg1.k)) + ((_arg1.b * _arg1.h) * _arg1.k)) + ((_arg1.c * _arg1.f) * _arg1.l)) - ((_arg1.b * _arg1.g) * _arg1.l)) / _local2);
var _local7:Number = (((_arg1.g * _arg1.i) - (_arg1.e * _arg1.k)) / _local2);
var _local8:Number = (((-(_arg1.c) * _arg1.i) + (_arg1.a * _arg1.k)) / _local2);
var _local9:Number = (((_arg1.c * _arg1.e) - (_arg1.a * _arg1.g)) / _local2);
var _local10:Number = ((((((((_arg1.c * _arg1.h) * _arg1.i) - ((_arg1.d * _arg1.g) * _arg1.i)) + ((_arg1.d * _arg1.e) * _arg1.k)) - ((_arg1.a * _arg1.h) * _arg1.k)) - ((_arg1.c * _arg1.e) * _arg1.l)) + ((_arg1.a * _arg1.g) * _arg1.l)) / _local2);
var _local11:Number = (((-(_arg1.f) * _arg1.i) + (_arg1.e * _arg1.j)) / _local2);
var _local12:Number = (((_arg1.b * _arg1.i) - (_arg1.a * _arg1.j)) / _local2);
var _local13:Number = (((-(_arg1.b) * _arg1.e) + (_arg1.a * _arg1.f)) / _local2);
var _local14:Number = ((((((((_arg1.d * _arg1.f) * _arg1.i) - ((_arg1.b * _arg1.h) * _arg1.i)) - ((_arg1.d * _arg1.e) * _arg1.j)) + ((_arg1.a * _arg1.h) * _arg1.j)) + ((_arg1.b * _arg1.e) * _arg1.l)) - ((_arg1.a * _arg1.f) * _arg1.l)) / _local2);
return (new Matrix3D(_local3, _local4, _local5, _local6, _local7, _local8, _local9, _local10, _local11, _local12, _local13, _local14));
}
public static function inverseScaleMatrix(_arg1:Number, _arg2:Number, _arg3:Number):Matrix3D{
return (new Matrix3D((1 / _arg1), 0, 0, 0, 0, (1 / _arg2), 0, 0, 0, 0, (1 / _arg3), 0));
}
public static function scaleMatrix(_arg1:Number, _arg2:Number, _arg3:Number):Matrix3D{
return (new Matrix3D(_arg1, 0, 0, 0, 0, _arg2, 0, 0, 0, 0, _arg3, 0));
}
public static function transformationMatrix(_arg1:Number=0, _arg2:Number=0, _arg3:Number=0, _arg4:Number=0, _arg5:Number=0, _arg6:Number=0, _arg7:Number=1, _arg8:Number=1, _arg9:Number=1):Matrix3D{
var _local10:Number = Math.cos(_arg4);
var _local11:Number = Math.sin(_arg4);
var _local12:Number = Math.cos(_arg5);
var _local13:Number = Math.sin(_arg5);
var _local14:Number = Math.cos(_arg6);
var _local15:Number = Math.sin(_arg6);
var _local16:Number = (_local14 * _local13);
var _local17:Number = (_local15 * _local13);
var _local18:Number = (_local12 * _arg7);
var _local19:Number = (_local11 * _arg8);
var _local20:Number = (_local10 * _arg8);
var _local21:Number = (_local10 * _arg9);
var _local22:Number = (_local11 * _arg9);
return (new Matrix3D((_local14 * _local18), ((_local16 * _local19) - (_local15 * _local20)), ((_local16 * _local21) + (_local15 * _local22)), _arg1, (_local15 * _local18), ((_local17 * _local19) + (_local14 * _local20)), ((_local17 * _local21) - (_local14 * _local22)), _arg2, (-(_local13) * _arg7), (_local12 * _local19), (_local12 * _local21), _arg3));
}
public static function product(_arg1:Matrix3D, _arg2:Matrix3D):Matrix3D{
return (new Matrix3D((((_arg1.a * _arg2.a) + (_arg1.b * _arg2.e)) + (_arg1.c * _arg2.i)), (((_arg1.a * _arg2.b) + (_arg1.b * _arg2.f)) + (_arg1.c * _arg2.j)), (((_arg1.a * _arg2.c) + (_arg1.b * _arg2.g)) + (_arg1.c * _arg2.k)), ((((_arg1.a * _arg2.d) + (_arg1.b * _arg2.h)) + (_arg1.c * _arg2.l)) + _arg1.d), (((_arg1.e * _arg2.a) + (_arg1.f * _arg2.e)) + (_arg1.g * _arg2.i)), (((_arg1.e * _arg2.b) + (_arg1.f * _arg2.f)) + (_arg1.g * _arg2.j)), (((_arg1.e * _arg2.c) + (_arg1.f * _arg2.g)) + (_arg1.g * _arg2.k)), ((((_arg1.e * _arg2.d) + (_arg1.f * _arg2.h)) + (_arg1.g * _arg2.l)) + _arg1.h), (((_arg1.i * _arg2.a) + (_arg1.j * _arg2.e)) + (_arg1.k * _arg2.i)), (((_arg1.i * _arg2.b) + (_arg1.j * _arg2.f)) + (_arg1.k * _arg2.j)), (((_arg1.i * _arg2.c) + (_arg1.j * _arg2.g)) + (_arg1.k * _arg2.k)), ((((_arg1.i * _arg2.d) + (_arg1.j * _arg2.h)) + (_arg1.k * _arg2.l)) + _arg1.l)));
}
public static function rotationMatrix(_arg1:Number, _arg2:Number, _arg3:Number):Matrix3D{
var _local4:Number = Math.cos(_arg1);
var _local5:Number = Math.sin(_arg1);
var _local6:Number = Math.cos(_arg2);
var _local7:Number = Math.sin(_arg2);
var _local8:Number = Math.cos(_arg3);
var _local9:Number = Math.sin(_arg3);
var _local10:Number = (_local8 * _local7);
var _local11:Number = (_local9 * _local7);
return (new Matrix3D((_local8 * _local6), ((_local10 * _local5) - (_local9 * _local4)), ((_local10 * _local4) + (_local9 * _local5)), 0, (_local9 * _local6), ((_local11 * _local5) + (_local8 * _local4)), ((_local11 * _local4) - (_local8 * _local5)), 0, -(_local7), (_local6 * _local5), (_local6 * _local4), 0));
}
}
}//package com.alternativagame.type
Section 23
//Point3D (com.alternativagame.type.Point3D)
package com.alternativagame.type {
import flash.geom.*;
import com.alternativagame.utility.*;
public final class Point3D {
public var x:Number;
public var y:Number;
public var z:Number;
public function Point3D(_arg1:Number=0, _arg2:Number=0, _arg3:Number=0){
this.x = _arg1;
this.y = _arg2;
this.z = _arg3;
}
public function floor():void{
x = Math.floor(x);
y = Math.floor(y);
z = Math.floor(z);
}
public function add(_arg1:Point3D):void{
x = (x + _arg1.x);
y = (y + _arg1.y);
z = (z + _arg1.z);
}
public function toString():String{
return (((((("X: " + x.toFixed(3)) + " Y:") + y.toFixed(3)) + " Z:") + z.toFixed(3)));
}
public function multiply(_arg1:Number):void{
x = (x * _arg1);
y = (y * _arg1);
z = (z * _arg1);
}
public function transform(_arg1:Matrix3D):void{
var _local2:Number = x;
var _local3:Number = y;
var _local4:Number = z;
x = ((((_arg1.a * _local2) + (_arg1.b * _local3)) + (_arg1.c * _local4)) + _arg1.d);
y = ((((_arg1.e * _local2) + (_arg1.f * _local3)) + (_arg1.g * _local4)) + _arg1.h);
z = ((((_arg1.i * _local2) + (_arg1.j * _local3)) + (_arg1.k * _local4)) + _arg1.l);
}
public function get length():Number{
return (Math.sqrt((((x * x) + (y * y)) + (z * z))));
}
public function clone():Point3D{
return (new Point3D(x, y, z));
}
public function set length(_arg1:Number):void{
var _local2:Number;
if (((((!((x == 0))) || (!((y == 0))))) || (!((z == 0))))){
_local2 = (_arg1 / length);
x = (x * _local2);
y = (y * _local2);
z = (z * _local2);
} else {
z = _arg1;
};
}
public function normalize():void{
var _local1:Number;
if (((((!((x == 0))) || (!((y == 0))))) || (!((z == 0))))){
_local1 = Math.sqrt((((x * x) + (y * y)) + (z * z)));
x = (x / _local1);
y = (y / _local1);
z = (z / _local1);
} else {
z = 1;
};
}
public function get lengthSqr():Number{
return ((((x * x) + (y * y)) + (z * z)));
}
public function reset():void{
x = 0;
y = 0;
z = 0;
}
public function copy(_arg1:Point3D):void{
x = _arg1.x;
y = _arg1.y;
z = _arg1.z;
}
public function invert():void{
x = -(x);
y = -(y);
z = -(z);
}
public function subtract(_arg1:Point3D):void{
x = (x - _arg1.x);
y = (y - _arg1.y);
z = (z - _arg1.z);
}
public function toPoint():Point{
return (new Point(x, y));
}
public function round():void{
x = Math.round(x);
y = Math.round(y);
z = Math.round(z);
}
public function equals(_arg1:Point3D, _arg2:Number=0):Boolean{
return (((((((((((((x - _arg1.x) <= _arg2)) && (((x - _arg1.x) >= -(_arg2))))) && (((y - _arg1.y) <= _arg2)))) && (((y - _arg1.y) >= -(_arg2))))) && (((z - _arg1.z) <= _arg2)))) && (((z - _arg1.z) >= -(_arg2)))));
}
public static function cross(_arg1:Point3D, _arg2:Point3D):Point3D{
return (new Point3D(((_arg1.y * _arg2.z) - (_arg1.z * _arg2.y)), ((_arg1.z * _arg2.x) - (_arg1.x * _arg2.z)), ((_arg1.x * _arg2.y) - (_arg1.y * _arg2.x))));
}
public static function cross2D(_arg1:Point3D, _arg2:Point3D):Number{
return (((_arg1.x * _arg2.y) - (_arg1.y * _arg2.x)));
}
public static function angle(_arg1:Point3D, _arg2:Point3D):Number{
var _local3:Number = (_arg1.length * _arg2.length);
var _local4:Number = ((_local3)!=0) ? (dot(_arg1, _arg2) / _local3) : 1;
return (Math.acos(_local4));
}
public static function average(_arg1:Point3D, _arg2:Point3D=null, _arg3:Point3D=null, _arg4:Point3D=null):Point3D{
if (_arg2 == null){
return (_arg1.clone());
};
if (_arg3 == null){
return (new Point3D(((_arg1.x + _arg2.x) * 0.5), ((_arg1.y + _arg2.y) * 0.5), ((_arg1.z + _arg2.z) * 0.5)));
};
if (_arg4 == null){
return (new Point3D((((_arg1.x + _arg2.x) + _arg3.x) / 3), (((_arg1.y + _arg2.y) + _arg3.y) / 3), (((_arg1.z + _arg2.z) + _arg3.z) / 3)));
};
return (new Point3D(((((_arg1.x + _arg2.x) + _arg3.x) + _arg4.x) * 0.25), ((((_arg1.y + _arg2.y) + _arg3.y) + _arg4.y) * 0.25), ((((_arg1.z + _arg2.z) + _arg3.z) + _arg4.z) / 0.25)));
}
public static function random(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number):Point3D{
return (new Point3D(MathUtility.random(_arg1, _arg2), MathUtility.random(_arg3, _arg4), MathUtility.random(_arg5, _arg6)));
}
public static function interpolate(_arg1:Point3D, _arg2:Point3D, _arg3:Number=0.5):Point3D{
return (new Point3D((_arg1.x + ((_arg2.x - _arg1.x) * _arg3)), (_arg1.y + ((_arg2.y - _arg1.y) * _arg3)), (_arg1.z + ((_arg2.z - _arg1.z) * _arg3))));
}
public static function dot(_arg1:Point3D, _arg2:Point3D):Number{
return ((((_arg1.x * _arg2.x) + (_arg1.y * _arg2.y)) + (_arg1.z * _arg2.z)));
}
public static function sum(_arg1:Point3D, _arg2:Point3D):Point3D{
return (new Point3D((_arg1.x + _arg2.x), (_arg1.y + _arg2.y), (_arg1.z + _arg2.z)));
}
public static function dot2D(_arg1:Point3D, _arg2:Point3D):Number{
return (((_arg1.x * _arg2.x) + (_arg1.y * _arg2.y)));
}
public static function difference(_arg1:Point3D, _arg2:Point3D):Point3D{
return (new Point3D((_arg1.x - _arg2.x), (_arg1.y - _arg2.y), (_arg1.z - _arg2.z)));
}
public static function angleFast(_arg1:Point3D, _arg2:Point3D):Number{
var _local3:Number = dot(_arg1, _arg2);
if (Math.abs(_local3) > 1){
_local3 = ((_local3)>0) ? 1 : -1;
};
return (Math.acos(_local3));
}
}
}//package com.alternativagame.type
Section 24
//Set (com.alternativagame.type.Set)
package com.alternativagame.type {
import flash.utils.*;
import com.alternativagame.utility.*;
public final class Set extends Dictionary {
private var weakKeys:Boolean;
public function Set(_arg1:Boolean=false){
this.weakKeys = _arg1;
super(_arg1);
}
public function add(_arg1):void{
this[_arg1] = true;
}
public function transferToArray(_arg1:Array):void{
var _local2:*;
for (_local2 in this) {
_arg1.push(_local2);
delete this[_local2];
};
}
public function concatExcluding(_arg1:Set, _arg2:Set):void{
var _local3:*;
for (_local3 in _arg1) {
if (!_arg2.has(_local3)){
this[_local3] = _local3;
};
};
}
public function remove(_arg1):void{
delete this[_arg1];
}
public function get length():uint{
var _local2:*;
var _local1:uint;
for (_local2 in this) {
_local1++;
};
return (_local1);
}
public function take(){
var _local1:*;
for (_local1 in this) {
delete this[_local1];
return (_local1);
};
return (null);
}
public function isEmpty():Boolean{
var _local1:*;
for (_local1 in this) {
return (false);
};
return (true);
}
public function transfer(_arg1:Set):void{
var _local2:*;
for (_local2 in _arg1) {
this[_local2] = true;
delete _arg1[_local2];
};
}
public function clear():void{
var _local1:*;
for (_local1 in this) {
delete this[_local1];
};
}
public function any(){
var _local3:*;
var _local1:uint;
var _local2:uint = MathUtility.random(0, length);
for (_local3 in this) {
if (_local1 == _local2){
return (_local3);
};
_local1++;
};
return (null);
}
public function first(){
var _local1:*;
for (_local1 in this) {
return (_local1);
};
return (null);
}
public function isSingle():Boolean{
var _local2:*;
var _local1:Boolean;
for (_local2 in this) {
if (_local1){
return (false);
};
_local1 = true;
};
return (_local1);
}
public function concat(_arg1:Set):void{
var _local2:*;
for (_local2 in _arg1) {
this[_local2] = true;
};
}
public function addToArray(_arg1:Array):void{
var _local2:*;
for (_local2 in this) {
_arg1.push(_local2);
};
}
public function toString():String{
var _local2:*;
var _local1 = "";
for (_local2 in this) {
_local1 = (_local1 + ("," + _local2.toString()));
};
return (_local1.substring(1));
}
public function has(_arg1):Boolean{
return (this[_arg1]);
}
public function subtract(_arg1:Set):void{
var _local2:*;
for (_local2 in _arg1) {
delete this[_local2];
};
}
public function clone():Set{
var _local2:*;
var _local1:Set = new Set(weakKeys);
for (_local2 in this) {
_local1[_local2] = true;
};
return (_local1);
}
public function toArray():Array{
var _local2:*;
var _local1:Array = new Array();
for (_local2 in this) {
_local1.push(_local2);
};
return (_local1);
}
}
}//package com.alternativagame.type
Section 25
//TextureData (com.alternativagame.type.TextureData)
package com.alternativagame.type {
import flash.display.*;
public class TextureData {
public var width:uint;
public var height:uint;
public var bitmapData:BitmapData;
public var name:String;
public function TextureData(_arg1:BitmapData, _arg2:String=null){
if (_arg1 == null){
throw (new Error("Невозможно создать данные текстуры, т.к. указана null-текстура"));
};
this.bitmapData = _arg1;
width = _arg1.width;
height = _arg1.height;
this.name = _arg2;
}
public function toString():String{
return (((((("[TextureData " + ((name)!=null) ? name : "") + width) + "x") + height) + "]"));
}
}
}//package com.alternativagame.type
Section 26
//BitmapUtility (com.alternativagame.utility.BitmapUtility)
package com.alternativagame.utility {
import flash.geom.*;
import flash.display.*;
public class BitmapUtility {
public static function getNonTransparentRect(_arg1:BitmapData):Rectangle{
return ((_arg1.transparent) ? _arg1.getColorBoundsRect(4278190080, 0, false) : _arg1.rect);
}
public static function getFragment(_arg1:BitmapData, _arg2:Rectangle):BitmapData{
var _local3:BitmapData = new BitmapData(_arg2.width, _arg2.height, _arg1.transparent, 0);
_local3.copyPixels(_arg1, _arg2, new Point());
return (_local3);
}
public static function mergeBitmapAlpha(_arg1:BitmapData, _arg2:BitmapData, _arg3:Boolean=false):BitmapData{
var _local4:BitmapData = new BitmapData(_arg1.width, _arg1.height);
_local4.copyPixels(_arg1, _arg1.rect, new Point());
_local4.copyChannel(_arg2, _arg2.rect, new Point(), BitmapDataChannel.RED, BitmapDataChannel.ALPHA);
if (_arg3){
_arg1.dispose();
_arg2.dispose();
};
return (_local4);
}
}
}//package com.alternativagame.utility
Section 27
//MathUtility (com.alternativagame.utility.MathUtility)
package com.alternativagame.utility {
import flash.geom.*;
public final class MathUtility {
public static const degree60:Number = (Math.PI / 3);
private static const toDeg:Number = (180 / Math.PI);
public static const degree45:Number = (Math.PI / 4);
private static const toRad:Number = (Math.PI / 180);
public static const degree180:Number = Math.PI;
public static const degree360:Number = (Math.PI + Math.PI);
public static const degree90:Number = (Math.PI / 2);
public static const degree1:Number = toRad;
public static const degree30:Number = (Math.PI / 6);
public static const degree10:Number = (Math.PI / 18);
public static const degree5:Number = (Math.PI / 36);
public static function random(_arg1:Number=0, _arg2:Number=0):Number{
if (arguments.length == 0){
return (Math.random());
};
if (arguments.length == 1){
return ((Math.random() * _arg1));
};
return (((Math.random() * (_arg2 - _arg1)) + _arg1));
}
public static function segmentDistance(_arg1:Point, _arg2:Point, _arg3:Point):Number{
var _local4:Number = (_arg2.x - _arg1.x);
var _local5:Number = (_arg2.y - _arg1.y);
var _local6:Number = (_arg3.x - _arg1.x);
var _local7:Number = (_arg3.y - _arg1.y);
return ((((_local4 * _local7) - (_local5 * _local6)) / Math.sqrt(((_local4 * _local4) + (_local5 * _local5)))));
}
public static function randomAngle():Number{
return ((Math.random() * degree360));
}
public static function vectorAngleFast(_arg1:Point, _arg2:Point):Number{
var _local3:Number = vectorDot(_arg1, _arg2);
if (Math.abs(_local3) > 1){
_local3 = ((_local3)>0) ? 1 : -1;
};
return (Math.acos(_local3));
}
public static function vectorAngle(_arg1:Point, _arg2:Point):Number{
var _local3:Number = (_arg1.length * _arg2.length);
var _local4:Number = ((_local3)!=0) ? (vectorDot(_arg1, _arg2) / _local3) : 1;
return (Math.acos(_local4));
}
public static function limitAngle(_arg1:Number):Number{
var _local2:Number = (_arg1 % degree360);
_local2 = ((_local2)>0) ? ((_local2)>degree180) ? (_local2 - degree360) : _local2 : ((_local2)<-(degree180)) ? (_local2 + degree360) : _local2;
return (_local2);
}
public static function vectorDot(_arg1:Point, _arg2:Point):Number{
return (((_arg1.x * _arg2.x) + (_arg1.y * _arg2.y)));
}
public static function toDegree(_arg1:Number):Number{
return ((_arg1 * toDeg));
}
public static function deltaAngle(_arg1:Number, _arg2:Number):Number{
var _local3:Number = (_arg2 - _arg1);
if (_local3 > degree180){
return ((_local3 - degree360));
};
if (_local3 < -(degree180)){
return ((_local3 + degree360));
};
return (_local3);
}
public static function toRadian(_arg1:Number):Number{
return ((_arg1 * toRad));
}
public static function vectorCross(_arg1:Point, _arg2:Point):Number{
return (((_arg1.x * _arg2.y) - (_arg1.y * _arg2.x)));
}
public static function triangleHasPoint(_arg1:Point, _arg2:Point, _arg3:Point, _arg4:Point):Boolean{
if (vectorCross(_arg3.subtract(_arg1), _arg4.subtract(_arg1)) <= 0){
if (vectorCross(_arg2.subtract(_arg3), _arg4.subtract(_arg3)) <= 0){
if (vectorCross(_arg1.subtract(_arg2), _arg4.subtract(_arg2)) <= 0){
return (true);
};
return (false);
} else {
return (false);
};
//unresolved jump
};
return (false);
}
public static function equals(_arg1:Number, _arg2:Number, _arg3:Number=0):Boolean{
return (((((_arg2 - _arg1) <= _arg3)) && (((_arg2 - _arg1) >= -(_arg3)))));
}
}
}//package com.alternativagame.utility
Section 28
//MouseUtility (com.alternativagame.utility.MouseUtility)
package com.alternativagame.utility {
import flash.geom.*;
import flash.display.*;
public class MouseUtility {
private static var _stage:Stage = null;
public static function init(_arg1:Stage):void{
_stage = _arg1;
}
public static function localCoords(_arg1:DisplayObject):Point{
return (_arg1.globalToLocal(globalCoords()));
}
public static function globalCoords(_arg1:Boolean=true):Point{
var _local3:int;
var _local4:int;
var _local2:Point;
if (_stage != null){
_local3 = _stage.mouseX;
_local4 = _stage.mouseY;
if (_arg1){
_local3 = ((_local3)<0) ? 0 : ((_local3)>_stage.stageWidth) ? _stage.stageWidth : _local3;
_local4 = ((_local4)<0) ? 0 : ((_local4)>_stage.stageHeight) ? _stage.stageHeight : _local4;
};
_local2 = new Point(_local3, _local4);
} else {
throw (new Error("MouseUtility don't have link to stage. Use MouseUtility.init(stage) before."));
};
return (_local2);
}
}
}//package com.alternativagame.utility
Section 29
//ObjectUtility (com.alternativagame.utility.ObjectUtility)
package com.alternativagame.utility {
import com.alternativagame.type.*;
import flash.utils.*;
public class ObjectUtility {
public static function getClassTree(_arg1, _arg2:Class=null):Array{
var _local3:Array = new Array();
var _local4:Class = Class(getDefinitionByName(getQualifiedClassName(_arg1)));
_arg2 = ((_arg2)==null) ? Object : _arg2;
while (_local4 != _arg2) {
_local3.push(_local4);
_local4 = Class(getDefinitionByName(getQualifiedSuperclassName(_local4)));
};
_local3.push(_local4);
return (_local3);
}
public static function getClass(_arg1):Class{
return (Class(getDefinitionByName(getQualifiedClassName(_arg1))));
}
public static function isEmpty(_arg1):Boolean{
var _local2:*;
for (_local2 in _arg1) {
return (false);
};
return (true);
}
public static function clone(_arg1):Object{
var _local3:String;
var _local2:Object = new Object();
for (_local3 in _arg1) {
_local2[_local3] = _arg1[_local3];
};
return (_local2);
}
public static function length(_arg1):uint{
var _local3:*;
var _local2:uint;
for (_local3 in _arg1) {
_local2++;
};
return (_local2);
}
public static function toSet(_arg1, _arg2:Boolean=false):Set{
var _local4:*;
var _local3:Set = new Set(_arg2);
for each (_local4 in _arg1) {
_local3[_local4] = true;
};
return (_local3);
}
public static function getClassName(_arg1):String{
var _local2:String = getQualifiedClassName(_arg1);
return (_local2.substring((_local2.indexOf("::") + 2)));
}
public static function toArray(_arg1, _arg2:Boolean=false):Array{
var _local4:*;
var _local3:Array = new Array();
if (_arg2){
for (_local4 in _arg1) {
_local3.push(_arg1[_local4]);
};
} else {
for (_local4 in _arg1) {
_local3[_local4] = _arg1[_local4];
};
};
return (_local3);
}
}
}//package com.alternativagame.utility
Section 30
//BitmapAsset (mx.core.BitmapAsset)
package mx.core {
import flash.display.*;
public class BitmapAsset extends FlexBitmap implements IFlexAsset, IFlexDisplayObject {
mx_internal static const VERSION:String = "3.0.0.0";
public function BitmapAsset(_arg1:BitmapData=null, _arg2:String="auto", _arg3:Boolean=false){
super(_arg1, _arg2, _arg3);
}
public function get measuredWidth():Number{
if (bitmapData){
return (bitmapData.width);
};
return (0);
}
public function get measuredHeight():Number{
if (bitmapData){
return (bitmapData.height);
};
return (0);
}
public function setActualSize(_arg1:Number, _arg2:Number):void{
width = _arg1;
height = _arg2;
}
public function move(_arg1:Number, _arg2:Number):void{
this.x = _arg1;
this.y = _arg2;
}
}
}//package mx.core
Section 31
//FlexBitmap (mx.core.FlexBitmap)
package mx.core {
import flash.display.*;
import mx.utils.*;
public class FlexBitmap extends Bitmap {
mx_internal static const VERSION:String = "3.0.0.0";
public function FlexBitmap(_arg1:BitmapData=null, _arg2:String="auto", _arg3:Boolean=false){
var bitmapData = _arg1;
var pixelSnapping = _arg2;
var smoothing = _arg3;
super(bitmapData, pixelSnapping, smoothing);
try {
name = NameUtil.createUniqueName(this);
} catch(e:Error) {
};
}
override public function toString():String{
return (NameUtil.displayObjectToString(this));
}
}
}//package mx.core
Section 32
//IFlexAsset (mx.core.IFlexAsset)
package mx.core {
public interface IFlexAsset {
}
}//package mx.core
Section 33
//IFlexDisplayObject (mx.core.IFlexDisplayObject)
package mx.core {
import flash.events.*;
import flash.geom.*;
import flash.display.*;
import flash.accessibility.*;
public interface IFlexDisplayObject extends IBitmapDrawable, IEventDispatcher {
function get visible():Boolean;
function get rotation():Number;
function localToGlobal(_arg1:Point):Point;
function get name():String;
function set width(_arg1:Number):void;
function get measuredHeight():Number;
function get blendMode():String;
function get scale9Grid():Rectangle;
function set name(_arg1:String):void;
function set scaleX(_arg1:Number):void;
function set scaleY(_arg1:Number):void;
function get measuredWidth():Number;
function get accessibilityProperties():AccessibilityProperties;
function set scrollRect(_arg1:Rectangle):void;
function get cacheAsBitmap():Boolean;
function globalToLocal(_arg1:Point):Point;
function get height():Number;
function set blendMode(_arg1:String):void;
function get parent():DisplayObjectContainer;
function getBounds(_arg1:DisplayObject):Rectangle;
function get opaqueBackground():Object;
function set scale9Grid(_arg1:Rectangle):void;
function setActualSize(_arg1:Number, _arg2:Number):void;
function set alpha(_arg1:Number):void;
function set accessibilityProperties(_arg1:AccessibilityProperties):void;
function get width():Number;
function hitTestPoint(_arg1:Number, _arg2:Number, _arg3:Boolean=false):Boolean;
function set cacheAsBitmap(_arg1:Boolean):void;
function get scaleX():Number;
function get scaleY():Number;
function get scrollRect():Rectangle;
function get mouseX():Number;
function get mouseY():Number;
function set height(_arg1:Number):void;
function set mask(_arg1:DisplayObject):void;
function getRect(_arg1:DisplayObject):Rectangle;
function get alpha():Number;
function set transform(_arg1:Transform):void;
function move(_arg1:Number, _arg2:Number):void;
function get loaderInfo():LoaderInfo;
function get root():DisplayObject;
function hitTestObject(_arg1:DisplayObject):Boolean;
function set opaqueBackground(_arg1:Object):void;
function set visible(_arg1:Boolean):void;
function get mask():DisplayObject;
function set x(_arg1:Number):void;
function set y(_arg1:Number):void;
function get transform():Transform;
function set filters(_arg1:Array):void;
function get x():Number;
function get y():Number;
function get filters():Array;
function set rotation(_arg1:Number):void;
function get stage():Stage;
}
}//package mx.core
Section 34
//IRepeaterClient (mx.core.IRepeaterClient)
package mx.core {
public interface IRepeaterClient {
function get instanceIndices():Array;
function set instanceIndices(_arg1:Array):void;
function get isDocument():Boolean;
function set repeaters(_arg1:Array):void;
function initializeRepeaterArrays(_arg1:IRepeaterClient):void;
function get repeaters():Array;
function set repeaterIndices(_arg1:Array):void;
function get repeaterIndices():Array;
}
}//package mx.core
Section 35
//mx_internal (mx.core.mx_internal)
package mx.core {
public namespace mx_internal = "http://www.adobe.com/2006/flex/mx/internal";
}//package mx.core
Section 36
//NameUtil (mx.utils.NameUtil)
package mx.utils {
import flash.display.*;
import mx.core.*;
import flash.utils.*;
public class NameUtil {
mx_internal static const VERSION:String = "3.0.0.0";
private static var counter:int = 0;
public static function displayObjectToString(_arg1:DisplayObject):String{
var _local2:String;
var _local4:String;
var _local5:Array;
var _local3:DisplayObject = _arg1;
while (_local3 != null) {
if (((((_local3.parent) && (_local3.stage))) && ((_local3.parent == _local3.stage)))){
break;
};
_local4 = _local3.name;
if ((_local3 is IRepeaterClient)){
_local5 = IRepeaterClient(_local3).instanceIndices;
if (_local5){
_local4 = (_local4 + (("[" + _local5.join("][")) + "]"));
};
};
_local2 = ((_local2 == null)) ? _local4 : ((_local4 + ".") + _local2);
_local3 = _local3.parent;
};
return (_local2);
}
public static function createUniqueName(_arg1:Object):String{
if (!_arg1){
return (null);
};
var _local2:String = getQualifiedClassName(_arg1);
var _local3:int = _local2.indexOf("::");
if (_local3 != -1){
_local2 = _local2.substr((_local3 + 2));
};
var _local4:int = _local2.charCodeAt((_local2.length - 1));
if ((((_local4 >= 48)) && ((_local4 <= 57)))){
_local2 = (_local2 + "_");
};
return ((_local2 + counter++));
}
}
}//package mx.utils
Section 37
//Columns (temple.Columns)
package temple {
import flash.events.*;
import com.alternativagame.engine3d.*;
import com.alternativagame.type.*;
import flash.geom.*;
import flash.display.*;
import flash.net.*;
import flash.system.*;
public class Columns extends Mesh {
private var loader:Loader;
private var onLoadMethod:Function;
public var material:TextureMaterial;
private static const texture:TextureData = new TextureData(new Bmp().bitmapData);
private static const Bmp:Class = Columns_Bmp;
public function Columns(){
material = new TextureMaterial(texture, 1, false, true, 1);
super("Columns");
x = 218.616180419922;
y = 200.534332275391;
addVertex(14.7983093261719, -5.38613891601563, 0, "0");
addVertex(14.2725677490234, 6.65541076660156, 0, "1");
addVertex(-6.65541076660156, 14.2725677490234, 0, "3");
addVertex(-14.2725677490234, -6.65541076660156, 0, "5");
addVertex(14.2725677490234, 6.65541076660156, 231.719818115234, "9");
addVertex(20.2745056152344, -117.581253051758, 235.863433837891, "522");
addVertex(9.17008972167969, -129.699600219727, 235.863433837891, "523");
addVertex(19.4633941650391, 9.075927734375, 235.863433837891, "17");
addVertex(7.34504699707031, 20.1803588867188, 235.863433837891, "18");
addVertex(-9.075927734375, 19.4633941650391, 235.863433837891, "19");
addVertex(-20.1803588867188, 7.34504699707031, 235.863433837891, "20");
addVertex(-7.34504699707031, -20.1803588867188, 235.863433837891, "22");
addVertex(-369.034881591797, -104.850028991699, 0, "536");
addVertex(-348.850402832031, -95.4378662109375, 231.719818115234, "529");
addVertex(-348.850402832031, -95.4378662109375, 0, "530");
addVertex(-360.891967773438, -95.963623046875, 0, "531");
addVertex(-19.3692321777344, -119.312133789063, 235.863433837891, "513");
addVertex(-359.622711181641, -125.034484863281, 231.719818115234, "541");
addVertex(-339.438232421875, -115.622329711914, 0, "544");
addVertex(-339.438232421875, -115.622329711914, 231.719818115234, "545");
addVertex(-368.509124755859, -116.891586303711, 0, "539");
addVertex(-369.034881591797, 5.38618469238281, 231.719818115234, "36");
addVertex(-359.622711181641, -14.7982788085938, 231.719818115234, "38");
addVertex(-334.773162841797, 9.07595825195313, 235.863433837891, "41");
addVertex(-346.891510009766, 20.1803894042969, 235.863433837891, "42");
addVertex(-363.3125, 19.4634246826172, 235.863433837891, "43");
addVertex(-374.416931152344, 7.34507751464844, 235.863433837891, "44");
addVertex(-373.699951171875, -9.07589721679688, 235.863433837891, "45");
addVertex(-345.16064453125, -19.4633636474609, 235.863433837891, "47");
addVertex(-221.853744506836, 6.65544128417969, 0, "49");
addVertex(-334.773162841797, -101.160247802734, 235.863433837891, "554");
addVertex(-339.964019775391, -103.580764770508, 231.719818115234, "555");
addVertex(-250.924621582031, 5.38616943359375, 0, "52");
addVertex(-250.398880004883, -6.65538024902344, 0, "53");
addVertex(-374.416931152344, -102.891128540039, 235.863433837891, "566");
addVertex(-359.622711181641, -125.034484863281, 0, "540");
addVertex(-369.034881591797, -104.850028991699, 231.719818115234, "561");
addVertex(-363.3125, -90.7727813720703, 235.863433837891, "562");
addVertex(-368.509124755859, -116.891586303711, 231.719818115234, "565");
addVertex(-241.512451171875, -14.7982788085938, 231.719818115234, "62");
addVertex(-229.470901489258, -14.2725372314453, 231.719818115234, "63");
addVertex(-216.66291809082, 9.07595825195313, 235.863433837891, "65");
addVertex(-228.781265258789, 20.1803894042969, 235.863433837891, "66");
addVertex(-345.16064453125, -129.699569702148, 235.863433837891, "580");
addVertex(-243.47135925293, -20.1803283691406, 235.863433837891, "70");
addVertex(-227.050384521484, -19.4633636474609, 235.863433837891, "71");
addVertex(14.3667449951172, -213.817031860352, 0, "584");
addVertex(-347.581176757813, -124.508735656738, 231.719818115234, "547");
addVertex(-334.056182861328, -117.581230163574, 235.863433837891, "578");
addVertex(-132.288650512695, -6.65541076660156, 0, "77");
addVertex(-111.360679626465, -14.2725677490234, 0, "79");
addVertex(-103.743530273438, 6.6553955078125, 231.719818115234, "81");
addVertex(-14.1783752441406, -227.127853393555, 0, "594");
addVertex(-360.891967773438, -95.963623046875, 231.719818115234, "557");
addVertex(-132.814407348633, 5.38613891601563, 231.719818115234, "84");
addVertex(-6.56121826171875, -206.19987487793, 231.719818115234, "589");
addVertex(-361.581604003906, -130.416534423828, 235.863433837891, "574");
addVertex(5.48033142089844, -205.674133300781, 0, "585");
addVertex(14.8925018310547, -225.858581542969, 231.719818115234, "603");
addVertex(-138.196441650391, 7.34504699707031, 235.863433837891, "92");
addVertex(-137.4794921875, -9.075927734375, 235.863433837891, "93");
addVertex(-125.361137390137, -20.1803588867188, 235.863433837891, "94");
addVertex(-108.940155029297, -19.4634094238281, 235.863433837891, "95");
addVertex(14.3667144775391, -103.58080291748, 0, "97");
addVertex(-6.56124877929688, -95.9636459350586, 0, "99");
addVertex(6.74958801269531, -234.745010375977, 231.719818115234, "604");
addVertex(-14.1784057617188, -116.891616821289, 0, "101");
addVertex(-5.29196166992188, -235.270751953125, 0, "597");
addVertex(7.43922424316406, -200.292098999023, 235.863433837891, "615");
addVertex(14.8924713134766, -115.622352600098, 231.719818115234, "104");
addVertex(14.3667449951172, -213.817031860352, 231.719818115234, "609");
addVertex(19.5575866699219, -211.396514892578, 235.863433837891, "611");
addVertex(5.48033142089844, -205.674133300781, 231.719818115234, "613");
addVertex(-14.1783752441406, -227.127853393555, 231.719818115234, "622");
addVertex(-20.0861663818359, -213.127395629883, 235.863433837891, "623");
addVertex(-14.7041168212891, -215.086303710938, 231.719818115234, "624");
addVertex(19.5575561523438, -101.160278320313, 235.863433837891, "113");
addVertex(7.439208984375, -90.0558624267578, 235.863433837891, "114");
addVertex(-20.0861968994141, -102.891159057617, 235.863433837891, "116");
addVertex(-5.29196166992188, -235.270751953125, 231.719818115234, "629");
addVertex(-7.25088500976563, -130.416564941406, 235.863433837891, "118");
addVertex(-7.2508544921875, -240.652786254883, 235.863433837891, "631");
addVertex(-339.964019775391, -103.580764770508, 0, "121");
addVertex(20.2745361328125, -227.817489624023, 235.863433837891, "636");
addVertex(9.17012023925781, -239.935836791992, 235.863433837891, "637");
addVertex(-347.581176757813, -124.508735656738, 0, "127");
addVertex(-339.963989257813, -213.817001342773, 0, "641");
addVertex(-369.034851074219, -215.086273193359, 231.719818115234, "649");
addVertex(-346.891510009766, -90.0558319091797, 235.863433837891, "138");
addVertex(-368.509094238281, -227.127838134766, 231.719818115234, "652");
addVertex(-373.699951171875, -119.312103271484, 235.863433837891, "141");
addVertex(-359.622680664063, -235.270721435547, 231.719818115234, "655");
addVertex(14.8925018310547, -225.858581542969, 0, "144");
addVertex(-369.034851074219, -215.086273193359, 0, "650");
addVertex(-6.56121826171875, -206.19987487793, 0, "147");
addVertex(-14.7041168212891, -215.086303710938, 0, "148");
addVertex(6.74958801269531, -234.745010375977, 0, "151");
addVertex(-359.622680664063, -235.270721435547, 0, "656");
addVertex(-339.438232421875, -225.85856628418, 231.719818115234, "665");
addVertex(-339.963989257813, -213.817001342773, 231.719818115234, "666");
addVertex(-348.850402832031, -205.674118041992, 231.719818115234, "670");
addVertex(-360.891937255859, -206.199859619141, 231.719818115234, "674");
addVertex(-8.98175048828125, -201.009048461914, 235.863433837891, "163");
addVertex(-363.312469482422, -201.009033203125, 235.863433837891, "676");
addVertex(-19.3692016601563, -229.548370361328, 235.863433837891, "165");
addVertex(-339.438232421875, -225.85856628418, 0, "168");
addVertex(-348.850402832031, -205.674118041992, 0, "170");
addVertex(-360.891937255859, -206.199859619141, 0, "171");
addVertex(-368.509094238281, -227.127838134766, 0, "173");
addVertex(-347.581146240234, -234.744979858398, 0, "175");
addVertex(-334.056182861328, -227.817474365234, 235.863433837891, "692");
addVertex(-347.581146240234, -234.744979858398, 231.719818115234, "687");
addVertex(-334.773162841797, -211.396484375, 235.863433837891, "185");
addVertex(-346.891479492188, -200.292068481445, 235.863433837891, "186");
addVertex(5.48030090332031, -315.910369873047, 0, "699");
addVertex(-374.416900634766, -213.127365112305, 235.863433837891, "188");
addVertex(-373.699920654297, -229.548355102539, 235.863433837891, "189");
addVertex(-361.581573486328, -240.652770996094, 235.863433837891, "190");
addVertex(-345.160614013672, -239.935806274414, 235.863433837891, "191");
addVertex(14.8924713134766, -336.094818115234, 0, "192");
addVertex(14.3667297363281, -324.053253173828, 0, "193");
addVertex(-14.7041320800781, -325.322509765625, 0, "707");
addVertex(5.48030090332031, -315.910369873047, 231.719818115234, "700");
addVertex(-14.1783905029297, -337.364044189453, 0, "197");
addVertex(-5.29196166992188, -345.506958007813, 0, "198");
addVertex(-5.29196166992188, -345.506958007813, 231.719818115234, "206");
addVertex(-6.56124877929688, -316.436096191406, 0, "702");
addVertex(19.5575561523438, -321.632720947266, 235.863433837891, "209");
addVertex(7.43922424316406, -310.528289794922, 235.863433837891, "210");
addVertex(-19.3692321777344, -339.784576416016, 235.863433837891, "213");
addVertex(-7.25088500976563, -350.889038085938, 235.863433837891, "214");
addVertex(9.17010498046875, -350.172058105469, 235.863433837891, "215");
addVertex(-6.56124877929688, -316.436096191406, 231.719818115234, "728");
addVertex(-348.850402832031, -315.910308837891, 0, "218");
addVertex(-369.034851074219, -325.322479248047, 0, "220");
addVertex(-368.509094238281, -337.364013671875, 0, "221");
addVertex(14.3667297363281, -324.053253173828, 231.719818115234, "726");
addVertex(-339.438232421875, -336.094757080078, 231.719818115234, "224");
addVertex(-339.963989257813, -324.05322265625, 231.719818115234, "225");
addVertex(-360.891937255859, -316.436065673828, 231.719818115234, "227");
addVertex(-369.034851074219, -325.322479248047, 231.719818115234, "228");
addVertex(-8.98176574707031, -311.245269775391, 235.863433837891, "733");
addVertex(-359.622680664063, -345.506896972656, 231.719818115234, "230");
addVertex(-334.056182861328, -338.053680419922, 235.863433837891, "232");
addVertex(-20.086181640625, -323.363616943359, 235.863433837891, "737");
addVertex(-346.891479492188, -310.528259277344, 235.863433837891, "234");
addVertex(-363.312469482422, -311.245239257813, 235.863433837891, "235");
addVertex(14.8924713134766, -336.094818115234, 231.719818115234, "748");
addVertex(-14.7041320800781, -325.322509765625, 231.719818115234, "732");
addVertex(20.2745208740234, -338.0537109375, 235.863433837891, "750");
addVertex(-345.160614013672, -350.171997070313, 235.863433837891, "239");
addVertex(6.74957275390625, -344.981201171875, 231.719818115234, "744");
addVertex(-14.1783905029297, -337.364044189453, 231.719818115234, "736");
addVertex(-339.963989257813, -324.05322265625, 0, "755");
addVertex(5.38613891601563, 14.7983093261719, 231.719818115234, "244");
addVertex(5.38613891601563, 14.7983093261719, 0, "245");
addVertex(-6.65541076660156, 14.2725677490234, 231.719818115234, "247");
addVertex(-360.891937255859, -316.436065673828, 0, "761");
addVertex(-14.7983093261719, 5.38613891601563, 0, "251");
addVertex(-348.850402832031, -315.910308837891, 231.719818115234, "757");
addVertex(-5.38613891601563, -14.7983093261719, 0, "257");
addVertex(6.65541076660156, -14.2725677490234, 0, "258");
addVertex(14.7983093261719, -5.38613891601563, 231.719818115234, "260");
addVertex(-347.581146240234, -344.981170654297, 0, "776");
addVertex(-359.622680664063, -345.506896972656, 0, "770");
addVertex(-339.438232421875, -336.094757080078, 0, "772");
addVertex(6.74957275390625, -344.981201171875, 0, "719");
addVertex(-14.7983093261719, 5.38613891601563, 231.719818115234, "276");
addVertex(-334.773162841797, -321.632690429688, 235.863433837891, "782");
addVertex(-368.509094238281, -337.364013671875, 231.719818115234, "793");
addVertex(-374.416900634766, -323.363555908203, 235.863433837891, "794");
addVertex(-19.4633941650391, -9.075927734375, 235.863433837891, "285");
addVertex(-14.2725677490234, -6.65541076660156, 231.719818115234, "286");
addVertex(-5.38613891601563, -14.7983093261719, 231.719818115234, "290");
addVertex(6.65541076660156, -14.2725677490234, 231.719818115234, "291");
addVertex(20.1803588867188, -7.34504699707031, 235.863433837891, "293");
addVertex(-373.699920654297, -339.784545898438, 235.863433837891, "798");
addVertex(9.075927734375, -19.4633941650391, 235.863433837891, "295");
addVertex(-347.581146240234, -344.981170654297, 231.719818115234, "809");
addVertex(-361.581604003906, -350.888977050781, 235.863433837891, "802");
addVertex(-339.964019775391, 6.65544128417969, 0, "299");
addVertex(-348.850402832031, 14.79833984375, 0, "300");
addVertex(-360.891967773438, 14.2725982666016, 0, "303");
addVertex(-360.891967773438, 14.2725982666016, 231.719818115234, "304");
addVertex(-369.034881591797, 5.38618469238281, 0, "306");
addVertex(-368.509124755859, -6.65538024902344, 0, "311");
addVertex(-359.622711181641, -14.7982788085938, 0, "314");
addVertex(-339.438232421875, -5.3861083984375, 0, "316");
addVertex(-347.581176757813, -14.2725219726563, 0, "320");
addVertex(-339.438232421875, -5.3861083984375, 231.719818115234, "323");
addVertex(-339.964019775391, 6.65544128417969, 231.719818115234, "327");
addVertex(-348.850402832031, 14.79833984375, 231.719818115234, "331");
addVertex(-368.509124755859, -6.65538024902344, 231.719818115234, "337");
addVertex(-361.581604003906, -20.1803131103516, 235.863433837891, "346");
addVertex(-347.581176757813, -14.2725219726563, 231.719818115234, "348");
addVertex(-334.056182861328, -7.34501647949219, 235.863433837891, "350");
addVertex(-230.740173339844, 14.79833984375, 231.719818115234, "358");
addVertex(-230.740173339844, 14.79833984375, 0, "359");
addVertex(-242.781723022461, 14.2725982666016, 231.719818115234, "361");
addVertex(-242.781723022461, 14.2725982666016, 0, "362");
addVertex(-241.512451171875, -14.7982788085938, 0, "371");
addVertex(-221.328002929688, -5.3861083984375, 0, "373");
addVertex(-229.470901489258, -14.2725372314453, 0, "377");
addVertex(-221.328002929688, -5.3861083984375, 231.719818115234, "378");
addVertex(-221.853744506836, 6.65544128417969, 231.719818115234, "384");
addVertex(-245.202239990234, 19.4634246826172, 235.863433837891, "391");
addVertex(-256.306671142578, 7.34507751464844, 235.863433837891, "395");
addVertex(-250.924621582031, 5.38616943359375, 231.719818115234, "396");
addVertex(-250.398880004883, -6.65538024902344, 231.719818115234, "397");
addVertex(-255.589706420898, -9.07589721679688, 235.863433837891, "399");
addVertex(-215.945953369141, -7.34501647949219, 235.863433837891, "408");
addVertex(-103.743530273438, 6.6553955078125, 0, "413");
addVertex(-112.629943847656, 14.7983093261719, 0, "414");
addVertex(-124.671493530273, 14.2725524902344, 0, "417");
addVertex(-132.814407348633, 5.38613891601563, 0, "422");
addVertex(-123.402236938477, -14.7983093261719, 0, "426");
addVertex(-103.217781066895, -5.38615417480469, 0, "430");
addVertex(-111.360679626465, -14.2725677490234, 231.719818115234, "433");
addVertex(-103.217781066895, -5.38615417480469, 231.719818115234, "435");
addVertex(-112.629943847656, 14.7983093261719, 231.719818115234, "439");
addVertex(-98.5526962280273, 9.075927734375, 235.863433837891, "440");
addVertex(-110.671043395996, 20.1803436279297, 235.863433837891, "444");
addVertex(-127.092025756836, 19.4633941650391, 235.863433837891, "448");
addVertex(-124.671493530273, 14.2725524902344, 231.719818115234, "449");
addVertex(-132.288650512695, -6.65541076660156, 231.719818115234, "454");
addVertex(-123.402236938477, -14.7983093261719, 231.719818115234, "458");
addVertex(-97.8357391357422, -7.34504699707031, 235.863433837891, "464");
addVertex(5.48030090332031, -95.4378967285156, 0, "471");
addVertex(-14.7041473388672, -104.850067138672, 0, "477");
addVertex(-14.1784057617188, -116.891616821289, 231.719818115234, "481");
addVertex(-5.2919921875, -125.034515380859, 0, "483");
addVertex(-5.2919921875, -125.034515380859, 231.719818115234, "484");
addVertex(6.74955749511719, -124.508773803711, 0, "486");
addVertex(14.8924713134766, -115.622352600098, 0, "487");
addVertex(6.74955749511719, -124.508773803711, 231.719818115234, "490");
addVertex(14.3667144775391, -103.58080291748, 231.719818115234, "493");
addVertex(5.48030090332031, -95.4378967285156, 231.719818115234, "499");
addVertex(-6.56124877929688, -95.9636459350586, 231.719818115234, "503");
addVertex(-8.98178100585938, -90.7728118896484, 235.863433837891, "505");
addVertex(-14.7041473388672, -104.850067138672, 231.719818115234, "507");
addFace(["276", "20", "19", "247"], "0");
setUVsToFace(new Point(0.873783819549208, 0.188293687482537), new Point(0.869858741760254, 0.176257967948914), new Point(0.899293482303619, 0.176257967948914), "0");
addFace(["43", "42", "331", "304"], "1");
setUVsToFace(new Point(0.83783483505249, 0.576847195625305), new Point(0.8672696352005, 0.576847195625305), new Point(0.863344550132751, 0.588882982730865), "1");
addFace(["486", "490", "484", "483"], "2");
setUVsToFace(new Point(0.419417381286621, 0.351515769958496), new Point(0.834382593631744, 0.351515769958496), new Point(0.834382593631744, 0.373100370168686), "2");
addFace(["481", "101", "483", "484"], "3");
setUVsToFace(new Point(0.41596519947052, 0.598431944847107), new Point(0.00100000004749745, 0.598431944847107), new Point(0.00100000004749745, 0.576847195625305), "3");
addFace(["565", "539", "540", "541"], "4");
setUVsToFace(new Point(0.41596519947052, 0.798726379871368), new Point(0.00100000004749745, 0.798726379871368), new Point(0.00100000004749745, 0.777141749858856), "4");
addFace(["700", "210", "209", "726"], "5");
setUVsToFace(new Point(0.8417599165287, 0.113183186994546), new Point(0.83783483505249, 0.101147435605526), new Point(0.867269575595856, 0.101147450506687), "5");
addFace(["63", "377", "373", "378"], "6");
setUVsToFace(new Point(0.834382593631744, 0.69857919216156), new Point(0.419417381286621, 0.69857919216156), new Point(0.419417381286621, 0.676994562149048), "6");
addFace(["62", "70", "399", "397"], "7");
setUVsToFace(new Point(0.841759920120239, 0.939398229122162), new Point(0.83783483505249, 0.927362561225891), new Point(0.867269646952249, 0.92736261132254), "7");
addFace(["584", "609", "603", "144"], "8");
setUVsToFace(new Point(0.419417381286621, 0.376552611589432), new Point(0.834382593631744, 0.376552611589432), new Point(0.834382593631744, 0.398137241601944), "8");
addFace(["206", "214", "213", "736"], "9");
setUVsToFace(new Point(0.841759937351778, 0.0130357256072328), new Point(0.83783483505249, 0.00100000004749745), new Point(0.8672696352005, 0.00100001716054976), "9");
addFace(["798", "794", "228", "793"], "10");
setUVsToFace(new Point(0.83783483505249, 0.476699888706207), new Point(0.8672696352005, 0.476699888706207), new Point(0.863344490528107, 0.488735526800156), "10");
addFace(["193", "726", "748", "192"], "11");
setUVsToFace(new Point(0.00100000004749745, 0.101147435605526), new Point(0.41596519947052, 0.101147435605526), new Point(0.41596519947052, 0.12273208796978), "11");
addFace(["503", "99", "477", "507"], "12");
setUVsToFace(new Point(0.834382593631744, 0.448210865259171), new Point(0.419417381286621, 0.448210865259171), new Point(0.419417381286621, 0.426626235246658), "12");
addFace(["244", "18", "17", "9"], "13");
setUVsToFace(new Point(0.873783767223358, 0.388588279485703), new Point(0.869858741760254, 0.376552611589432), new Point(0.899293553659764, 0.376552661686081), "13");
addFace(["52", "396", "361", "362"], "14");
setUVsToFace(new Point(0.00100000004749745, 0.651957809925079), new Point(0.41596519947052, 0.651957809925079), new Point(0.41596519947052, 0.673542380332947), "14");
addFace(["523", "118", "484", "490"], "15");
setUVsToFace(new Point(0.83783483505249, 0.802178561687469), new Point(0.867269559688264, 0.802178528254594), new Point(0.863344490528107, 0.814214289188385), "15");
addFace(["391", "66", "358", "361"], "16");
setUVsToFace(new Point(0.869858801364899, 0.526773631572723), new Point(0.899293601512909, 0.526773631572723), new Point(0.895368456840515, 0.538809299468994), "16");
addFace(["439", "414", "417", "449"], "17");
setUVsToFace(new Point(0.41596519947052, 0.473247706890106), new Point(0.00100000004749745, 0.473247706890106), new Point(0.00100000004749745, 0.451663047075272), "17");
addFace(["224", "772", "755", "225"], "18");
setUVsToFace(new Point(0.834382593631744, 0.973963260650635), new Point(0.419417381286621, 0.973963260650635), new Point(0.419417381286621, 0.952399253845215), "18");
addFace(["384", "49", "359", "358"], "19");
setUVsToFace(new Point(0.41596519947052, 0.197842627763748), new Point(0.00100000004749745, 0.197842627763748), new Point(0.00100000004749745, 0.176257967948914), "19");
addFace(["81", "413", "414", "439"], "20");
setUVsToFace(new Point(0.41596519947052, 0.748652815818787), new Point(0.00100000004749745, 0.748652815818787), new Point(0.00100000004749745, 0.727068185806274), "20");
addFace(["77", "454", "84", "422"], "21");
setUVsToFace(new Point(0.419417381286621, 0.927362561225891), new Point(0.834382593631744, 0.927362561225891), new Point(0.834382593631744, 0.948926508426666), "21");
addFace(["702", "728", "700", "699"], "22");
setUVsToFace(new Point(0.00100000004749745, 0.977436006069183), new Point(0.41596519947052, 0.977436006069183), new Point(0.41596519947052, 0.999000012874603), "22");
addFace(["175", "687", "655", "656"], "23");
setUVsToFace(new Point(0.00100000004749745, 0.827215373516083), new Point(0.41596519947052, 0.827215373516083), new Point(0.41596519947052, 0.848800003528595), "23");
addFace(["530", "529", "555", "121"], "24");
setUVsToFace(new Point(0.419417381286621, 0.902325749397278), new Point(0.834382593631744, 0.902325749397278), new Point(0.834382593631744, 0.923910319805145), "24");
addFace(["323", "316", "299", "327"], "25");
setUVsToFace(new Point(0.41596519947052, 0.147768929600716), new Point(0.00100000004749745, 0.147768929600716), new Point(0.00100000004749745, 0.126184299588203), "25");
addFace(["218", "757", "225", "755"], "26");
setUVsToFace(new Point(0.00100000004749745, 0.30144214630127), new Point(0.41596519947052, 0.30144214630127), new Point(0.41596519947052, 0.323026746511459), "26");
addFace(["350", "47", "348", "323"], "27");
setUVsToFace(new Point(0.83783483505249, 0.226331651210785), new Point(0.8672696352005, 0.226331636309624), new Point(0.863344609737396, 0.238367334008217), "27");
addFace(["458", "426", "79", "433"], "28");
setUVsToFace(new Point(0.834382593631744, 0.172805786132813), new Point(0.419417381286621, 0.172805786132813), new Point(0.419417381286621, 0.151221141219139), "28");
addFace(["371", "62", "397", "53"], "29");
setUVsToFace(new Point(0.00100000004749745, 0.201294809579849), new Point(0.41596519947052, 0.201294809579849), new Point(0.41596519947052, 0.222879439592361), "29");
addFace(["545", "544", "121", "555"], "30");
setUVsToFace(new Point(0.834382593631744, 0.0225846543908119), new Point(0.419417381286621, 0.0225846543908119), new Point(0.419417381286621, 0.00100000004749745), "30");
addFace(["71", "70", "62", "63"], "31");
setUVsToFace(new Point(0.869858801364899, 0.451663047075272), new Point(0.899293526000596, 0.451663013642475), new Point(0.895368456840515, 0.463698744773865), "31");
addFace(["168", "665", "687", "175"], "32");
setUVsToFace(new Point(0.00100000004749745, 0.326478958129883), new Point(0.41596519947052, 0.326478958129883), new Point(0.41596519947052, 0.348063588142395), "32");
addFace(["185", "692", "665", "666"], "33");
setUVsToFace(new Point(0.83783483505249, 0.426626265048981), new Point(0.8672696352005, 0.426626235246658), new Point(0.863344490528107, 0.438661932945251), "33");
addFace(["65", "408", "378", "384"], "34");
setUVsToFace(new Point(0.83783483505249, 0.852252244949341), new Point(0.867269575595856, 0.852252185344696), new Point(0.863344490528107, 0.864287853240967), "34");
addFace(["227", "761", "220", "228"], "35");
setUVsToFace(new Point(0.834382593631744, 0.297989934682846), new Point(0.419417381286621, 0.297989934682846), new Point(0.419417381286621, 0.276405304670334), "35");
addFace(["101", "481", "507", "477"], "36");
setUVsToFace(new Point(0.419417381286621, 0.476699888706207), new Point(0.834382593631744, 0.476699888706207), new Point(0.834382593631744, 0.498284548521042), "36");
addFace(["539", "565", "561", "536"], "37");
setUVsToFace(new Point(0.419417381286621, 0.101147435605526), new Point(0.834382593631744, 0.101147435605526), new Point(0.834382593631744, 0.122732080519199), "37");
addFace(["224", "232", "239", "809"], "38");
setUVsToFace(new Point(0.84175994458488, 0.764140643911145), new Point(0.83783483505249, 0.752104997634888), new Point(0.867269575595856, 0.752105057239532), "38");
addFace(["165", "623", "624", "622"], "39");
setUVsToFace(new Point(0.869858741760254, 0.626920938491821), new Point(0.899293466395951, 0.626920905059107), new Point(0.89536839723587, 0.638956606388092), "39");
addFace(["81", "440", "464", "435"], "40");
setUVsToFace(new Point(0.873783826828003, 0.0881462320685387), new Point(0.869858741760254, 0.0761105790734291), new Point(0.899293464987335, 0.0761105866197236), "40");
addFace(["493", "97", "471", "499"], "41");
setUVsToFace(new Point(0.834382593631744, 0.27295309305191), new Point(0.419417381286621, 0.27295309305191), new Point(0.419417381286621, 0.251368492841721), "41");
addFace(["649", "188", "676", "674"], "42");
setUVsToFace(new Point(0.873783826828003, 0.163256824016571), new Point(0.869858741760254, 0.151221141219139), new Point(0.899293454529835, 0.151221147893369), "42");
addFace(["547", "127", "544", "545"], "43");
setUVsToFace(new Point(0.41596519947052, 0.0726583749055862), new Point(0.00100000004749745, 0.0726583749055862), new Point(0.00100000004749745, 0.0510737150907516), "43");
addFace(["513", "116", "507", "481"], "44");
setUVsToFace(new Point(0.869858801364899, 0.576847195625305), new Point(0.899293541908264, 0.576847195625305), new Point(0.895368456840515, 0.588882982730865), "44");
addFace(["652", "173", "656", "655"], "45");
setUVsToFace(new Point(0.834382593631744, 0.898873507976532), new Point(0.419417381286621, 0.898873507976532), new Point(0.419417381286621, 0.877288937568665), "45");
addFace(["138", "554", "555", "529"], "46");
setUVsToFace(new Point(0.83783483505249, 0.601884186267853), new Point(0.867269575595856, 0.601884126663208), new Point(0.863344490528107, 0.613919794559479), "46");
addFace(["290", "22", "285", "286"], "47");
setUVsToFace(new Point(0.873783879153853, 0.438661969681488), new Point(0.869858801364899, 0.426626235246658), new Point(0.899293541908264, 0.426626235246658), "47");
addFace(["772", "224", "809", "776"], "48");
setUVsToFace(new Point(0.419417381286621, 0.226331666111946), new Point(0.834382593631744, 0.226331666111946), new Point(0.834382593631744, 0.247916281223297), "48");
addFace(["454", "93", "92", "84"], "49");
setUVsToFace(new Point(0.841759920120239, 0.689030289649963), new Point(0.83783483505249, 0.676994562149048), new Point(0.867269556870993, 0.67699461067447), "49");
addFace(["604", "151", "144", "603"], "50");
setUVsToFace(new Point(0.834382593631744, 0.147768929600716), new Point(0.419417381286621, 0.147768929600716), new Point(0.419417381286621, 0.126184299588203), "50");
addFace(["503", "505", "114", "499"], "51");
setUVsToFace(new Point(0.873783826828003, 0.0631093829870224), new Point(0.869858741760254, 0.0510737150907516), new Point(0.899293491690819, 0.0510737313274789), "51");
addFace(["422", "84", "449", "417"], "52");
setUVsToFace(new Point(0.00100000004749745, 0.226331651210785), new Point(0.41596519947052, 0.226331651210785), new Point(0.41596519947052, 0.247916281223297), "52");
addFace(["42", "41", "327", "331"], "53");
setUVsToFace(new Point(0.83783483505249, 0.301442176103592), new Point(0.867269648090844, 0.301442170916012), new Point(0.863344490528107, 0.31347781419754), "53");
addFace(["291", "258", "0", "260"], "54");
setUVsToFace(new Point(0.834382593631744, 0.222879439592361), new Point(0.419417381286621, 0.222879439592361), new Point(0.419417381286621, 0.201294809579849), "54");
addFace(["189", "188", "649", "652"], "55");
setUVsToFace(new Point(0.83783483505249, 0.401589423418045), new Point(0.867269630608626, 0.40158940204533), new Point(0.863344490528107, 0.413625091314316), "55");
addFace(["316", "323", "348", "320"], "56");
setUVsToFace(new Point(0.00100000004749745, 0.00100000004749745), new Point(0.41596519947052, 0.00100000004749745), new Point(0.41596519947052, 0.0225846581161022), "56");
addFace(["629", "597", "151", "604"], "57");
setUVsToFace(new Point(0.834382593631744, 0.62346875667572), new Point(0.419417381286621, 0.62346875667572), new Point(0.419417381286621, 0.601884126663208), "57");
addFace(["670", "186", "185", "666"], "58");
setUVsToFace(new Point(0.873783858780458, 0.0380725672973022), new Point(0.869858801364899, 0.0260368604212999), new Point(0.899293482303619, 0.0260368790477514), "58");
addFace(["257", "290", "286", "5"], "59");
setUVsToFace(new Point(0.419417381286621, 0.551810443401337), new Point(0.834382593631744, 0.551810443401337), new Point(0.834382593631744, 0.573395073413849), "59");
addFace(["300", "331", "327", "299"], "60");
setUVsToFace(new Point(0.00100000004749745, 0.927362561225891), new Point(0.41596519947052, 0.927362561225891), new Point(0.41596519947052, 0.948947072029114), "60");
addFace(["327", "41", "350", "323"], "61");
setUVsToFace(new Point(0.841759862044941, 0.163256856240823), new Point(0.83783483505249, 0.151221141219139), new Point(0.8672696352005, 0.151221171021461), "61");
addFace(["665", "168", "641", "666"], "62");
setUVsToFace(new Point(0.41596519947052, 0.0976952314376831), new Point(0.00100000004749745, 0.0976952314376831), new Point(0.00100000004749745, 0.0761105790734291), "62");
addFace(["228", "220", "221", "793"], "63");
setUVsToFace(new Point(0.41596519947052, 0.823763191699982), new Point(0.00100000004749745, 0.823763191699982), new Point(0.00100000004749745, 0.802178561687469), "63");
addFace(["490", "486", "487", "104"], "64");
setUVsToFace(new Point(0.41596519947052, 0.62346875667572), new Point(0.00100000004749745, 0.62346875667572), new Point(0.00100000004749745, 0.601884126663208), "64");
addFace(["230", "802", "798", "793"], "65");
setUVsToFace(new Point(0.841759965610286, 0.188293717058632), new Point(0.83783483505249, 0.176257967948914), new Point(0.867269515991211, 0.176257997751236), "65");
addFace(["5", "286", "276", "251"], "66");
setUVsToFace(new Point(0.00100000004749745, 0.351515769958496), new Point(0.41596519947052, 0.351515769958496), new Point(0.41596519947052, 0.373100370168686), "66");
addFace(["114", "113", "493", "499"], "67");
setUVsToFace(new Point(0.869858741760254, 0.727068185806274), new Point(0.899293482303619, 0.727068185806274), new Point(0.89536839723587, 0.7391037940979), "67");
addFace(["230", "770", "776", "809"], "68");
setUVsToFace(new Point(0.834382593631744, 0.998979687690735), new Point(0.419417381286621, 0.998979687690735), new Point(0.419417381286621, 0.977415680885315), "68");
addFace(["589", "163", "615", "613"], "69");
setUVsToFace(new Point(0.873783814288862, 0.8392510423224), new Point(0.869858741760254, 0.827215373516083), new Point(0.899293482303619, 0.827215373516083), "69");
addFace(["444", "440", "81", "439"], "70");
setUVsToFace(new Point(0.869858801364899, 0.476699888706207), new Point(0.899293515820062, 0.476699846344456), new Point(0.895368456840515, 0.488735526800156), "70");
addFace(["674", "171", "650", "649"], "71");
setUVsToFace(new Point(0.834382593631744, 0.323026746511459), new Point(0.419417381286621, 0.323026746511459), new Point(0.419417381286621, 0.30144214630127), "71");
addFace(["585", "613", "609", "584"], "320");
setUVsToFace(new Point(0.419417381286621, 0.626920938491821), new Point(0.834382593631744, 0.626920938491821), new Point(0.834382593631744, 0.648505568504333), "320");
addFace(["770", "230", "793", "221"], "73");
setUVsToFace(new Point(0.419417381286621, 0.852252185344696), new Point(0.834382593631744, 0.852252185344696), new Point(0.834382593631744, 0.873836696147919), "73");
addFace(["676", "186", "670", "674"], "74");
setUVsToFace(new Point(0.83783483505249, 0.351515769958496), new Point(0.867269542933105, 0.351515740104131), new Point(0.863344490528107, 0.363551437854767), "74");
addFace(["624", "623", "163", "589"], "75");
setUVsToFace(new Point(0.873783881512834, 0.0130356754229542), new Point(0.869858801364899, 0.00100000004749745), new Point(0.899293601512909, 0.00100000435486436), "75");
addFace(["732", "707", "197", "736"], "76");
setUVsToFace(new Point(0.41596519947052, 0.873836755752563), new Point(0.00100000004749745, 0.873836755752563), new Point(0.00100000004749745, 0.852252185344696), "76");
addFace(["750", "215", "744", "748"], "77");
setUVsToFace(new Point(0.83783483505249, 0.326478987932205), new Point(0.867269629630039, 0.326478957156094), new Point(0.863344490528107, 0.338514655828476), "77");
addFace(["464", "95", "433", "435"], "78");
setUVsToFace(new Point(0.869858801364899, 0.551810443401337), new Point(0.899293541908264, 0.551810443401337), new Point(0.895368456840515, 0.563846051692963), "78");
addFace(["141", "566", "561", "565"], "79");
setUVsToFace(new Point(0.869858801364899, 0.201294809579849), new Point(0.899293506953093, 0.201294808046102), new Point(0.895368456840515, 0.21333047747612), "79");
addFace(["493", "113", "522", "104"], "72");
setUVsToFace(new Point(0.873783826828003, 0.689030289649963), new Point(0.869858741760254, 0.676994562149048), new Point(0.899293463578702, 0.676994610674467), "72");
addFace(["449", "448", "444", "439"], "81");
setUVsToFace(new Point(0.841759920120239, 0.964434921741486), new Point(0.83783483505249, 0.952399253845215), new Point(0.86726957052061, 0.952399303127348), "81");
addFace(["99", "503", "499", "471"], "82");
setUVsToFace(new Point(0.00100000004749745, 0.276405304670334), new Point(0.41596519947052, 0.276405304670334), new Point(0.41596519947052, 0.297989964485168), "82");
addFace(["44", "43", "304", "36"], "83");
setUVsToFace(new Point(0.83783483505249, 0.376552611589432), new Point(0.8672696352005, 0.376552611589432), new Point(0.863344550132751, 0.388588279485703), "83");
addFace(["235", "234", "757", "227"], "84");
setUVsToFace(new Point(0.83783483505249, 0.551810443401337), new Point(0.867269623782376, 0.551810426157758), new Point(0.863344490528107, 0.563846051692963), "84");
addFace(["260", "293", "295", "291"], "85");
setUVsToFace(new Point(0.873783826828003, 0.363551437854767), new Point(0.869858801364899, 0.351515769958496), new Point(0.899293613264409, 0.351515820055145), "85");
addFace(["522", "523", "490", "104"], "86");
setUVsToFace(new Point(0.869858741760254, 0.752104997634888), new Point(0.899293482303619, 0.752104997634888), new Point(0.89536839723587, 0.764140605926514), "86");
addFace(["736", "197", "198", "206"], "87");
setUVsToFace(new Point(0.41596519947052, 0.172805786132813), new Point(0.00100000004749745, 0.172805786132813), new Point(0.00100000004749745, 0.151221141219139), "87");
addFace(["45", "44", "36", "337"], "80");
setUVsToFace(new Point(0.83783483505249, 0.902325749397278), new Point(0.867269522026678, 0.902325726510645), new Point(0.863344490528107, 0.914361417293549), "80");
addFace(["507", "116", "505", "503"], "89");
setUVsToFace(new Point(0.873783767223358, 0.288440972566605), new Point(0.869858741760254, 0.276405304670334), new Point(0.899293548935945, 0.276405313190969), "89");
addFace(["378", "373", "49", "384"], "90");
setUVsToFace(new Point(0.834382593631744, 0.548358261585236), new Point(0.419417381286621, 0.548358261585236), new Point(0.419417381286621, 0.526773631572723), "90");
addFace(["260", "0", "1", "9"], "91");
setUVsToFace(new Point(0.41596519947052, 0.548358261585236), new Point(0.00100000004749745, 0.548358261585236), new Point(0.00100000004749745, 0.526773631572723), "91");
addFace(["670", "170", "171", "674"], "92");
setUVsToFace(new Point(0.834382593631744, 0.823763191699982), new Point(0.419417381286621, 0.823763191699982), new Point(0.419417381286621, 0.802178561687469), "92");
addFace(["399", "395", "396", "397"], "93");
setUVsToFace(new Point(0.83783483505249, 0.626920998096466), new Point(0.867269559688188, 0.626920964663917), new Point(0.863344490528107, 0.638956606388092), "93");
addFace(["358", "359", "362", "361"], "94");
setUVsToFace(new Point(0.834382593631744, 0.473247706890106), new Point(0.419417381286621, 0.473247706890106), new Point(0.419417381286621, 0.451663047075272), "94");
addFace(["215", "214", "206", "744"], "95");
setUVsToFace(new Point(0.83783483505249, 0.0761105865240097), new Point(0.867269623782372, 0.0761105794407301), new Point(0.863344490528107, 0.0881462916731834), "95");
addFace(["580", "574", "541", "547"], "96");
setUVsToFace(new Point(0.869858741760254, 0.777141749858856), new Point(0.899293475511937, 0.777141740618917), new Point(0.89536839723587, 0.789177417755127), "96");
addFace(["557", "562", "138", "529"], "97");
setUVsToFace(new Point(0.841759979724884, 0.263404130935669), new Point(0.83783483505249, 0.251368492841721), new Point(0.86726954694254, 0.251368540816179), "97");
addFace(["782", "232", "224", "225"], "98");
setUVsToFace(new Point(0.83783483505249, 0.451663076877594), new Point(0.8672696352005, 0.451663047075272), new Point(0.863344490528107, 0.463698744773865), "98");
addFace(["396", "395", "391", "361"], "99");
setUVsToFace(new Point(0.841759920120239, 0.513772368431091), new Point(0.83783483505249, 0.501736760139465), new Point(0.867269646952249, 0.501736810235866), "99");
addFace(["578", "580", "547", "545"], "100");
setUVsToFace(new Point(0.83783483505249, 0.201294809579849), new Point(0.867269639486206, 0.201294769929975), new Point(0.863344609737396, 0.21333047747612), "100");
addFace(["622", "594", "597", "629"], "101");
setUVsToFace(new Point(0.41596519947052, 0.648505568504333), new Point(0.00100000004749745, 0.648505568504333), new Point(0.00100000004749745, 0.626920938491821), "101");
addFace(["589", "147", "148", "624"], "102");
setUVsToFace(new Point(0.834382593631744, 0.197842627763748), new Point(0.419417381286621, 0.197842627763748), new Point(0.419417381286621, 0.176257967948914), "102");
addFace(["358", "66", "65", "384"], "103");
setUVsToFace(new Point(0.873783835445624, 0.138219989319413), new Point(0.869858741760254, 0.126184299588203), new Point(0.899293541908264, 0.126184299588203), "103");
addFace(["285", "20", "276", "286"], "104");
setUVsToFace(new Point(0.869858801364899, 0.401589393615723), new Point(0.899293526000596, 0.401589360183008), new Point(0.895368456840515, 0.413625061511993), "104");
addFace(["665", "692", "191", "687"], "105");
setUVsToFace(new Point(0.873783806461387, 0.113183108396028), new Point(0.869858741760254, 0.101147435605526), new Point(0.899293482303619, 0.101147435605526), "105");
addFace(["594", "622", "624", "148"], "106");
setUVsToFace(new Point(0.00100000004749745, 0.476699888706207), new Point(0.41596519947052, 0.476699888706207), new Point(0.41596519947052, 0.498284488916397), "106");
addFace(["3", "247", "244", "245"], "107");
setUVsToFace(new Point(0.419417381286621, 0.326478958129883), new Point(0.834382593631744, 0.326478958129883), new Point(0.834382593631744, 0.348063558340073), "107");
addFace(["636", "637", "604", "603"], "108");
setUVsToFace(new Point(0.869858682155609, 0.326478958129883), new Point(0.899293450419606, 0.326478947743314), new Point(0.89536839723587, 0.338514626026154), "108");
addFace(["251", "276", "247", "3"], "109");
setUVsToFace(new Point(0.00100000004749745, 0.376552611589432), new Point(0.41596519947052, 0.376552611589432), new Point(0.41596519947052, 0.398137211799622), "109");
addFace(["604", "637", "631", "629"], "110");
setUVsToFace(new Point(0.873783826828003, 0.914361476898193), new Point(0.869858741760254, 0.902325749397278), new Point(0.899293465204085, 0.902325750638307), "110");
addFace(["228", "794", "235", "227"], "111");
setUVsToFace(new Point(0.84175994458488, 0.714067079858672), new Point(0.83783483505249, 0.702031373977661), new Point(0.867269575595856, 0.702031433582306), "111");
addFace(["655", "190", "189", "652"], "112");
setUVsToFace(new Point(0.873783886432648, 0.613919794559479), new Point(0.869858741760254, 0.601884126663208), new Point(0.899293425282855, 0.601884154091121), "112");
addFace(["728", "702", "707", "732"], "113");
setUVsToFace(new Point(0.834382593631744, 0.748652815818787), new Point(0.419417381286621, 0.748652815818787), new Point(0.419417381286621, 0.727068185806274), "113");
addFace(["413", "81", "435", "430"], "114");
setUVsToFace(new Point(0.00100000004749745, 0.251368463039398), new Point(0.41596519947052, 0.251368463039398), new Point(0.41596519947052, 0.27295309305191), "114");
addFace(["378", "408", "71", "63"], "115");
setUVsToFace(new Point(0.841759979724884, 0.889324605464935), new Point(0.83783483505249, 0.877288937568665), new Point(0.867269565670097, 0.877288987665313), "115");
addFace(["239", "802", "230", "809"], "116");
setUVsToFace(new Point(0.83783483505249, 0.0260368920862675), new Point(0.8672696352005, 0.0260368604212999), new Point(0.863344490528107, 0.0380725711584091), "116");
addFace(["433", "79", "430", "435"], "117");
setUVsToFace(new Point(0.41596519947052, 0.723616063594818), new Point(0.00100000004749745, 0.723616063594818), new Point(0.00100000004749745, 0.702031373977661), "117");
addFace(["484", "118", "513", "481"], "118");
setUVsToFace(new Point(0.841759920120239, 0.66399347782135), new Point(0.83783483505249, 0.651957809925079), new Point(0.867269593143387, 0.6519577467641), "118");
addFace(["454", "77", "426", "458"], "119");
setUVsToFace(new Point(0.41596519947052, 0.7736896276474), new Point(0.00100000004749745, 0.7736896276474), new Point(0.00100000004749745, 0.752104997634888), "119");
addFace(["17", "293", "260", "9"], "120");
setUVsToFace(new Point(0.869858741760254, 0.501736760139465), new Point(0.899293466395951, 0.501736726706751), new Point(0.89536839723587, 0.513772428035736), "120");
addFace(["529", "530", "531", "557"], "121");
setUVsToFace(new Point(0.41596519947052, 0.0476215109229088), new Point(0.00100000004749745, 0.0476215109229088), new Point(0.00100000004749745, 0.0260368604212999), "121");
addFace(["732", "737", "733", "728"], "122");
setUVsToFace(new Point(0.873783904223872, 0.889324685182662), new Point(0.869858741760254, 0.877288937568665), new Point(0.899293482303619, 0.877288937568665), "122");
addFace(["38", "314", "320", "348"], "123");
setUVsToFace(new Point(0.834382593631744, 0.848800003528595), new Point(0.419417381286621, 0.848800003528595), new Point(0.419417381286621, 0.827215373516083), "123");
addFace(["557", "531", "536", "561"], "124");
setUVsToFace(new Point(0.41596519947052, 0.69857919216156), new Point(0.00100000004749745, 0.69857919216156), new Point(0.00100000004749745, 0.676994562149048), "124");
addFace(["613", "585", "147", "589"], "125");
setUVsToFace(new Point(0.41596519947052, 0.523321390151978), new Point(0.00100000004749745, 0.523321390151978), new Point(0.00100000004749745, 0.501736760139465), "125");
addFace(["609", "611", "636", "603"], "126");
setUVsToFace(new Point(0.873783828993183, 0.663993513405137), new Point(0.869858801364899, 0.651957809925079), new Point(0.899293601512909, 0.651957809925079), "126");
addFace(["666", "641", "170", "670"], "127");
setUVsToFace(new Point(0.41596519947052, 0.923910319805145), new Point(0.00100000004749745, 0.923910319805145), new Point(0.00100000004749745, 0.902325749397278), "127");
addFace(["433", "95", "94", "458"], "130");
setUVsToFace(new Point(0.841759903940757, 0.989451230280467), new Point(0.83783483505249, 0.977415561676025), new Point(0.867269575595856, 0.977415561676025), "130");
addFace(["631", "165", "622", "629"], "131");
setUVsToFace(new Point(0.869858741760254, 0.927362561225891), new Point(0.899293482303619, 0.927362561225891), new Point(0.89536839723587, 0.939398229122162), "131");
addFace(["19", "18", "244", "247"], "132");
setUVsToFace(new Point(0.869858741760254, 0.30144214630127), new Point(0.899293482303619, 0.30144214630127), new Point(0.89536839723587, 0.313477784395218), "132");
addFace(["304", "303", "306", "36"], "133");
setUVsToFace(new Point(0.834382593631744, 0.423174053430557), new Point(0.419417381286621, 0.423174053430557), new Point(0.419417381286621, 0.401589393615723), "133");
addFace(["348", "47", "346", "38"], "134");
setUVsToFace(new Point(0.873783826828003, 0.989451229572296), new Point(0.869858741760254, 0.977415561676025), new Point(0.899293473507252, 0.977415610751801), "134");
addFace(["97", "493", "104", "487"], "135");
setUVsToFace(new Point(0.00100000004749745, 0.401589393615723), new Point(0.41596519947052, 0.401589393615723), new Point(0.41596519947052, 0.423174023628235), "135");
addFace(["757", "234", "782", "225"], "136");
setUVsToFace(new Point(0.84175992868853, 0.739103875790936), new Point(0.83783483505249, 0.727068185806274), new Point(0.867269515991211, 0.727068185806274), "136");
addFace(["127", "547", "541", "540"], "137");
setUVsToFace(new Point(0.00100000004749745, 0.877288937568665), new Point(0.41596519947052, 0.877288937568665), new Point(0.41596519947052, 0.898873567581177), "137");
addFace(["191", "190", "655", "687"], "138");
setUVsToFace(new Point(0.869858741760254, 0.702031433582306), new Point(0.899293482303619, 0.702031373977661), new Point(0.89536839723587, 0.714067101478577), "138");
addFace(["736", "213", "737", "732"], "139");
setUVsToFace(new Point(0.873783826828003, 0.964434921741486), new Point(0.869858741760254, 0.952399253845215), new Point(0.899293475132712, 0.95239925563682), "139");
addFace(["303", "304", "331", "300"], "140");
setUVsToFace(new Point(0.419417381286621, 0.0510737150907516), new Point(0.834382593631744, 0.0510737150907516), new Point(0.834382593631744, 0.0726583749055862), "140");
addFace(["761", "227", "757", "218"], "141");
setUVsToFace(new Point(0.419417381286621, 0.777141749858856), new Point(0.834382593631744, 0.777141749858856), new Point(0.834382593631744, 0.798726379871368), "141");
addFace(["346", "45", "337", "38"], "142");
setUVsToFace(new Point(0.869858741760254, 0.802178561687469), new Point(0.899293481390352, 0.80217855422049), new Point(0.89536839723587, 0.81421422958374), "142");
addFace(["209", "750", "748", "726"], "143");
setUVsToFace(new Point(0.83783483505249, 0.526773631572723), new Point(0.8672696352005, 0.526773631572723), new Point(0.863344550132751, 0.538809299468994), "143");
addFace(["615", "611", "609", "613"], "144");
setUVsToFace(new Point(0.869858741760254, 0.852252185344696), new Point(0.899293582819519, 0.852252154430288), new Point(0.89536839723587, 0.864287793636322), "144");
addFace(["192", "748", "744", "719"], "145");
setUVsToFace(new Point(0.00100000004749745, 0.952399253845215), new Point(0.41596519947052, 0.952399253845215), new Point(0.41596519947052, 0.973983764648438), "145");
addFace(["726", "193", "699", "700"], "148");
setUVsToFace(new Point(0.834382593631744, 0.77368950843811), new Point(0.419417381286621, 0.77368950843811), new Point(0.419417381286621, 0.752104997634888), "148");
addFace(["541", "574", "141", "565"], "149");
setUVsToFace(new Point(0.873783899300306, 0.263404114421851), new Point(0.869858801364899, 0.251368492841721), new Point(0.899293541908264, 0.251368492841721), "149");
addFace(["649", "650", "173", "652"], "88");
setUVsToFace(new Point(0.834382593631744, 0.0476215109229088), new Point(0.419417381286621, 0.0476215109229088), new Point(0.419417381286621, 0.0260368604212999), "88");
addFace(["9", "1", "245", "244"], "152");
setUVsToFace(new Point(0.41596519947052, 0.448210835456848), new Point(0.00100000004749745, 0.448210835456848), new Point(0.00100000004749745, 0.426626235246658), "152");
addFace(["396", "52", "53", "397"], "153");
setUVsToFace(new Point(0.41596519947052, 0.573395073413849), new Point(0.00100000004749745, 0.573395073413849), new Point(0.00100000004749745, 0.551810443401337), "153");
addFace(["314", "38", "337", "311"], "154");
setUVsToFace(new Point(0.419417381286621, 0.702031373977661), new Point(0.834382593631744, 0.702031373977661), new Point(0.834382593631744, 0.723616063594818), "154");
addFace(["555", "554", "578", "545"], "155");
setUVsToFace(new Point(0.841759888463302, 0.138220009676923), new Point(0.83783483505249, 0.126184299588203), new Point(0.867269575595856, 0.126184314489365), "155");
addFace(["36", "306", "311", "337"], "156");
setUVsToFace(new Point(0.834382593631744, 0.0976952165365219), new Point(0.419417381286621, 0.0976952165365219), new Point(0.419417381286621, 0.0761105790734291), "156");
addFace(["206", "198", "719", "744"], "157");
setUVsToFace(new Point(0.834382593631744, 0.598431944847107), new Point(0.419417381286621, 0.598431944847107), new Point(0.419417381286621, 0.576847195625305), "157");
addFace(["62", "371", "377", "63"], "158");
setUVsToFace(new Point(0.834382593631744, 0.523321330547333), new Point(0.419417381286621, 0.523321330547333), new Point(0.419417381286621, 0.501736760139465), "158");
addFace(["733", "210", "700", "728"], "159");
setUVsToFace(new Point(0.83783483505249, 0.051073744893074), new Point(0.867269589804851, 0.0510736716575111), new Point(0.863344490528107, 0.063109427690506), "159");
addFace(["458", "94", "93", "454"], "162");
setUVsToFace(new Point(0.841759940374621, 0.789177422446613), new Point(0.83783483505249, 0.777141749858856), new Point(0.867269575595856, 0.777141749858856), "162");
addFace(["92", "448", "449", "84"], "163");
setUVsToFace(new Point(0.83783483505249, 0.827215373516083), new Point(0.867269630790056, 0.827215331154268), new Point(0.863344550132751, 0.839251041412354), "163");
addFace(["290", "257", "258", "291"], "166");
setUVsToFace(new Point(0.834382593631744, 0.673542439937592), new Point(0.419417381286621, 0.673542439937592), new Point(0.419417381286621, 0.651957809925079), "166");
addFace(["295", "22", "290", "291"], "182");
setUVsToFace(new Point(0.869858801364899, 0.226331651210785), new Point(0.899293526000596, 0.226331617778112), new Point(0.895368456840515, 0.238367304205894), "182");
addFace(["566", "562", "557", "561"], "194");
setUVsToFace(new Point(0.83783483505249, 0.276405304670334), new Point(0.8672696352005, 0.276405304670334), new Point(0.863344550132751, 0.288440972566605), "194");
addSurface(["66", "40", "92", "182", "122", "28", "25", "27", "24", "8", "41", "93", "123", "145", "88", "163", "52", "50", "118", "53", "74", "44", "9", "75", "32", "57", "100", "68", "33", "62", "45", "105", "119", "89", "112", "101", "69", "51", "63", "152", "115", "102", "106", "3", "113", "103", "95", "133", "81", "2", "94", "38", "116", "138", "109", "34", "126", "121", "6", "67", "108", "82", "4", "139", "124", "35", "110", "39", "117", "134", "130", "36", "127", "135", "7", "54", "79", "83", "5", "60", "107", "61", "154", "142", "78", "136", "42", "37", "132", "140", "125", "48", "90", "58", "111", "49", "43", "14", "120", "131", "15", "64", "59", "20", "80", "65", "10", "16", "157", "11", "155", "137", "21", "56", "91", "55", "98", "158", "143", "166", "141", "17", "46", "12", "320", "99", "76", "194", "0", "70", "159", "149", "87", "148", "86", "77", "73", "13", "71", "162", "144", "104", "47", "30", "153", "84", "156", "18", "114", "1", "97", "19", "26", "31", "72", "85", "29", "23", "96", "22"], "Columns");
setMaterialToSurface(material, "Columns");
}
private function onLoadComplete(_arg1:Event):void{
material.texture = new TextureData(Bitmap(loader.content).bitmapData);
complete();
}
public function load(_arg1:Function):String{
this.onLoadMethod = _arg1;
loader = new Loader();
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onLoadComplete);
loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, onLoadError);
loader.contentLoaderInfo.addEventListener(IOErrorEvent.NETWORK_ERROR, onLoadError);
loader.contentLoaderInfo.addEventListener(IOErrorEvent.VERIFY_ERROR, onLoadError);
loader.load(new URLRequest("columns.jpg"), new LoaderContext(false, ApplicationDomain.currentDomain));
return ("Loading columns texture");
}
private function complete():void{
onLoadMethod.call();
loader.contentLoaderInfo.removeEventListener(Event.COMPLETE, onLoadComplete);
loader.contentLoaderInfo.removeEventListener(IOErrorEvent.IO_ERROR, onLoadError);
loader.contentLoaderInfo.removeEventListener(IOErrorEvent.NETWORK_ERROR, onLoadError);
loader.contentLoaderInfo.removeEventListener(IOErrorEvent.VERIFY_ERROR, onLoadError);
onLoadMethod = null;
loader = null;
}
private function onLoadError(_arg1:IOErrorEvent):void{
complete();
}
}
}//package temple
Section 38
//Columns_Bmp (temple.Columns_Bmp)
package temple {
import mx.core.*;
public class Columns_Bmp extends BitmapAsset {
}
}//package temple
Section 39
//Environment (temple.Environment)
package temple {
import flash.events.*;
import com.alternativagame.engine3d.*;
import com.alternativagame.type.*;
import flash.display.*;
import com.alternativagame.engine3d.primitive.*;
import flash.net.*;
import flash.system.*;
public class Environment extends Box {
private var loader:Loader;
private var onLoadMethod:Function;
private var counter:uint;// = 0
private static const bmpFront:Class = Environment_bmpFront;
private static const back:TextureData = new TextureData(new bmpBack().bitmapData);
private static const front:TextureData = new TextureData(new bmpFront().bitmapData);
private static const bmpLeft:Class = Environment_bmpLeft;
private static const top:TextureData = new TextureData(new bmpTop().bitmapData);
private static const bmpTop:Class = Environment_bmpTop;
private static const bmpBack:Class = Environment_bmpBack;
private static const left:TextureData = new TextureData(new bmpLeft().bitmapData);
private static const bmpRight:Class = Environment_bmpRight;
private static const right:TextureData = new TextureData(new bmpRight().bitmapData);
public function Environment(){
super(50000, 50000, 50000, 1, 1, 1, true);
setMaterialToSurface(new TextureMaterial(front, 1, false, true), "front");
setMaterialToSurface(new TextureMaterial(back, 1, false, true), "back");
setMaterialToSurface(new TextureMaterial(left, 1, false, true), "left");
setMaterialToSurface(new TextureMaterial(right, 1, false, true), "right");
setMaterialToSurface(new TextureMaterial(top, 1, false, true), "top");
}
public function load(_arg1:Function):String{
this.onLoadMethod = _arg1;
loader = new Loader();
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onLoadComplete);
loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, onLoadError);
loader.contentLoaderInfo.addEventListener(IOErrorEvent.NETWORK_ERROR, onLoadError);
loader.contentLoaderInfo.addEventListener(IOErrorEvent.VERIFY_ERROR, onLoadError);
loader.load(new URLRequest("environmentfront.jpg"), new LoaderContext(false, ApplicationDomain.currentDomain));
return ("Loading environment texture");
}
private function complete():void{
onLoadMethod.call();
loader.contentLoaderInfo.removeEventListener(Event.COMPLETE, onLoadComplete);
loader.contentLoaderInfo.removeEventListener(IOErrorEvent.IO_ERROR, onLoadError);
loader.contentLoaderInfo.removeEventListener(IOErrorEvent.NETWORK_ERROR, onLoadError);
loader.contentLoaderInfo.removeEventListener(IOErrorEvent.VERIFY_ERROR, onLoadError);
onLoadMethod = null;
loader = null;
}
private function onLoadError(_arg1:IOErrorEvent):void{
counter++;
if (counter < 5){
switch (counter){
case 1:
loader.load(new URLRequest("environmentback.jpg"), new LoaderContext(false, ApplicationDomain.currentDomain));
break;
case 2:
loader.load(new URLRequest("environmentleft.jpg"), new LoaderContext(false, ApplicationDomain.currentDomain));
break;
case 3:
loader.load(new URLRequest("environmentright.jpg"), new LoaderContext(false, ApplicationDomain.currentDomain));
break;
case 4:
loader.load(new URLRequest("environmenttop.jpg"), new LoaderContext(false, ApplicationDomain.currentDomain));
break;
};
} else {
complete();
};
}
private function onLoadComplete(_arg1:Event):void{
counter++;
if (counter < 5){
switch (counter){
case 1:
TextureMaterial(getSurfaceById("front").material).texture = new TextureData(Bitmap(loader.content).bitmapData);
loader.load(new URLRequest("environmentback.jpg"), new LoaderContext(false, ApplicationDomain.currentDomain));
break;
case 2:
TextureMaterial(getSurfaceById("back").material).texture = new TextureData(Bitmap(loader.content).bitmapData);
loader.load(new URLRequest("environmentleft.jpg"), new LoaderContext(false, ApplicationDomain.currentDomain));
break;
case 3:
TextureMaterial(getSurfaceById("left").material).texture = new TextureData(Bitmap(loader.content).bitmapData);
loader.load(new URLRequest("environmentright.jpg"), new LoaderContext(false, ApplicationDomain.currentDomain));
break;
case 4:
TextureMaterial(getSurfaceById("right").material).texture = new TextureData(Bitmap(loader.content).bitmapData);
loader.load(new URLRequest("environmenttop.jpg"), new LoaderContext(false, ApplicationDomain.currentDomain));
break;
};
} else {
TextureMaterial(getSurfaceById("top").material).texture = new TextureData(Bitmap(loader.content).bitmapData);
complete();
};
}
}
}//package temple
Section 40
//Environment_bmpBack (temple.Environment_bmpBack)
package temple {
import mx.core.*;
public class Environment_bmpBack extends BitmapAsset {
}
}//package temple
Section 41
//Environment_bmpFront (temple.Environment_bmpFront)
package temple {
import mx.core.*;
public class Environment_bmpFront extends BitmapAsset {
}
}//package temple
Section 42
//Environment_bmpLeft (temple.Environment_bmpLeft)
package temple {
import mx.core.*;
public class Environment_bmpLeft extends BitmapAsset {
}
}//package temple
Section 43
//Environment_bmpRight (temple.Environment_bmpRight)
package temple {
import mx.core.*;
public class Environment_bmpRight extends BitmapAsset {
}
}//package temple
Section 44
//Environment_bmpTop (temple.Environment_bmpTop)
package temple {
import mx.core.*;
public class Environment_bmpTop extends BitmapAsset {
}
}//package temple
Section 45
//Ground (temple.Ground)
package temple {
import flash.events.*;
import com.alternativagame.engine3d.*;
import com.alternativagame.type.*;
import flash.geom.*;
import flash.display.*;
import com.alternativagame.utility.*;
import flash.net.*;
import flash.system.*;
public class Ground extends Mesh {
private var alpha:BitmapData;
public var material:TextureMaterial;
private var onLoadMethod:Function;
private var loader:Loader;
private var counter:uint;// = 0
private static const texture:TextureData = new TextureData(new Bmp().bitmapData);
private static const Bmp:Class = Ground_Bmp;
public function Ground(){
material = new TextureMaterial(texture, 1, false, true, 1);
super("Ground");
coords = new Point3D(-1.25120162963867, -63.7402496337891, -39.4071769714355);
rotZ = -0.610865354537964;
addVertex(-521.756046344476, 309.526991686318, 0, "0");
addVertex(-491.215361885546, 83.5631519486694, 0, "1");
addVertex(-518.829594503281, -28.8633749766739, 0, "2");
addVertex(-593.11325242586, -152.481711683424, 0, "3");
addVertex(-592.066927319612, -245.243275765086, 0, "4");
addVertex(-576.155886483801, -307.060274966088, 0, "5");
addVertex(-506.723863064041, -414.06305660306, 0, "6");
addVertex(-433.614522816095, -478.869963924137, 0, "7");
addVertex(-267.532794795941, -546.840820832786, 0, "8");
addVertex(-146.12879716163, -545.452670925965, 0, "9");
addVertex(-17.2213280315047, -520.987476063225, 0, "10");
addVertex(274.193472211673, -489.436960364667, 0, "11");
addVertex(373.069888038379, -448.086877493968, 0, "12");
addVertex(437.367119224298, -360.369942455703, 0, "13");
addVertex(464.36131121964, -253.395590656186, 0, "14");
addVertex(473.681328585714, -152.191579218144, 0, "15");
addVertex(513.337840541163, -20.7403477477848, 0, "16");
addVertex(560.39495448259, 131.925791776099, 0, "17");
addVertex(573.46322681827, 264.011970273575, 0, "18");
addVertex(541.747509302649, 379.815195834929, 0, "19");
addVertex(426.401960182823, 483.814597130094, 0, "20");
addVertex(253.024105940574, 521.606473717042, 0, "21");
addVertex(95.9238968094764, 553.957044136642, 0, "22");
addVertex(-89.7616721824535, 533.400808016234, 0, "23");
addVertex(-327.642025719448, 532.371280155141, 0, "24");
addVertex(-438.380072027443, 496.547437469935, 0, "25");
addVertex(-520.388435878339, 416.79102232026, 0, "26");
addVertex(-635.624307071979, 232.80458117011, 85.3412933349609, "27");
addVertex(-635.525408694391, 114.298119287724, 132.658702850342, "28");
addVertex(-650.425822885211, -9.28134552443252, 147.425258636475, "29");
addVertex(-652.995235814803, -155.335532777916, 124.267742156982, "30");
addVertex(-652.714258041183, -264.009588620368, 74.5269317626953, "31");
addVertex(-625.445392900083, -382.806368032894, 81.4308776855469, "32");
addVertex(-587.232906314805, -481.259304597931, 103.24821472168, "33");
addVertex(-484.572801659092, -558.195786544589, 88.5091094970703, "34");
addVertex(-328.057210032707, -617.511769268579, 57.0054244995117, "35");
addVertex(-172.039885722147, -649.762804215229, 66.5040588378906, "36");
addVertex(-12.8302765216779, -636.629810696343, 61.4377670288086, "37");
addVertex(130.83923132848, -630.972255341346, 54.3545150756836, "38");
addVertex(268.314418841913, -603.471669481838, 49.1603012084961, "39");
addVertex(431.878860093237, -550.991237296864, 59.8544616699219, "40");
addVertex(508.222907234299, -473.887405808659, 83.4327087402344, "41");
addVertex(563.898325637384, -291.26986682907, 88.5091094970703, "42");
addVertex(609.028281828678, -150.030266154252, 88.5091094970703, "43");
addVertex(651.352978142299, -14.5273799659342, 122.302745819092, "44");
addVertex(698.176902983969, 127.626164888834, 108.946666717529, "45");
addVertex(719.42431153445, 296.166053784797, 123.374950408936, "46");
addVertex(653.047381311471, 475.38243030976, 146.142345428467, "47");
addVertex(527.681363739893, 576.541662017215, 156.199382781982, "48");
addVertex(298.04351693431, 634.265492709329, 177.414318084717, "49");
addVertex(113.275067980055, 676.987736589677, 208.377178192139, "50");
addVertex(-83.7298977301904, 678.483771170393, 217.073650360107, "51");
addVertex(-271.957773718093, 676.175279375209, 196.380565643311, "52");
addVertex(-420.764559387242, 632.580538148194, 152.877758026123, "53");
addVertex(-541.938375915762, 622.400047995773, 127.653392791748, "54");
addVertex(-615.269351512936, 492.178456723491, 129.75931930542, "55");
addVertex(-655.067507774023, 396.8311962261, 102.465858459473, "56");
addVertex(-501.682799674685, 508.034301028583, 90.6932983398438, "57");
addVertex(-564.186058302167, 410.58848467086, 81.5132446289063, "58");
addVertex(-550.792594196749, 282.913798175707, 50.255126953125, "59");
addVertex(-526.606818866516, 145.977534727022, 51.8577919006348, "60");
addVertex(-551.300415397835, 30.0813195954894, 41.7520637512207, "61");
addVertex(-588.753197596258, -78.5156116472459, 48.9697036743164, "62");
addVertex(-618.945587154616, -178.176435376895, 40.8857116699219, "63");
addVertex(-603.837911603205, -302.58353315027, 34.7706146240234, "64");
addVertex(-553.959843904807, -378.810995432127, 43.54443359375, "65");
addVertex(-481.637809706524, -479.584424074109, 56.3982772827148, "66");
addVertex(-376.218067798843, -529.456734266852, 41.2078552246094, "67");
addVertex(-216.004546518532, -592.588832877113, 39.8419952392578, "68");
addVertex(-88.7148451163193, -570.493950829596, 41.2078590393066, "69");
addVertex(60.0635341688864, -564.404720453168, 41.2078590393066, "70");
addVertex(207.350875484399, -539.999995361214, 41.2078590393066, "71");
addVertex(369.999971579021, -516.137127203239, 41.2078590393066, "72");
addVertex(429.581469772647, -467.552338047181, 47.3474884033203, "73");
addVertex(486.906931319942, -369.297060449314, 68.7656860351563, "74");
addVertex(510.377933230436, -201.164096291202, 68.7656860351563, "75");
addVertex(560.899536563657, -65.1774714679016, 68.7656860351563, "76");
addVertex(563.910424219324, 45.5442529110826, 68.7656860351563, "77");
addVertex(616.174006971375, 193.593308058352, 68.7656860351563, "78");
addVertex(601.223973372869, 328.695647090623, 68.7656860351563, "79");
addVertex(541.470131153871, 468.759243305976, 75.5934371948242, "80");
addVertex(375.966170197986, 574.164592041536, 33.212287902832, "81");
addVertex(211.489115969312, 612.041489816894, 31.2691802978516, "82");
addVertex(16.4415452808267, 625.853204610001, 42.4033660888672, "83");
addVertex(-173.410112176938, 617.575743922904, 49.3540191650391, "84");
addVertex(-306.252126517028, 599.49265821882, 52.1259536743164, "85");
addVertex(-421.123270137217, 561.91069667549, 72.4084320068359, "86");
addVertex(-489.368771782404, 196.740324764577, 0, "87");
addVertex(129.29763072226, -518.845113107749, 0, "88");
addVertex(57.1746885063115, 458.218118302794, -0.0032958984375, "89");
addVertex(338.605273642633, 56.293716809881, -0.00329971313476563, "90");
addVertex(-221.873268245135, 513.991522418285, 0, "91");
addVertex(-376.999767868863, 154.205760189439, -0.0032958984375, "92");
addVertex(-95.5692677379433, -247.718626314736, -0.00329971313476563, "93");
addVertex(-347.904650997806, 709.992758620445, 206.415096282959, "94");
addVertex(-181.957142049799, 716.310996783356, 238.643215179443, "95");
addVertex(17.2001798101488, 727.715259866312, 237.093334197998, "96");
addVertex(249.97170097066, 716.340622084231, 231.19567489624, "97");
addVertex(415.946128901144, 655.65981431395, 197.917751312256, "98");
addFace(["21", "89", "90", "16", "17", "18", "19", "20"], "0");
setUVsToFace(new Point(0.776008129119873, 0.619814872741699), new Point(0.663155674934387, 0.65445613861084), new Point(0.663155674934387, 0.373069316148758), "0");
addFace(["83", "84", "91", "23"], "1");
setUVsToFace(new Point(0.70936123889149, 0.755715351373807), new Point(0.620059013366699, 0.816600680351257), new Point(0.550412893295288, 0.772447109222412), "1");
addFace(["93", "92", "2", "3", "4", "5", "6", "7", "8", "9", "10"], "2");
setUVsToFace(new Point(0.359190553426743, 0.373069316148758), new Point(0.359180837719799, 0.654464445800727), new Point(0.23233301498063, 0.615118948542788), "2");
addFace(["87", "92", "91", "24", "25", "26", "0"], "3");
setUVsToFace(new Point(0.320453056542705, 0.711414628854602), new Point(0.35919064283371, 0.65445601940155), new Point(0.550247603513955, 0.772404082524329), "3");
addFace(["91", "92", "89", "23"], "4");
setUVsToFace(new Point(0.550412893295288, 0.772447109222412), new Point(0.35919064283371, 0.65445601940155), new Point(0.663149934909653, 0.654457471153384), "4");
addFace(["90", "93", "10", "88", "11", "12", "13", "14", "15"], "5");
setUVsToFace(new Point(0.663155674934387, 0.373069316148758), new Point(0.359154341831529, 0.373133439278024), new Point(0.306076473129552, 0.219000759739078), "5");
addFace(["69", "36", "37", "70"], "6");
setUVsToFace(new Point(0.249071642756462, 0.208565235137939), new Point(0.180457382323153, 0.195368327225957), new Point(0.262137800455093, 0.148933291435242), "6");
addFace(["15", "16", "90"], "7");
setUVsToFace(new Point(0.658041834831238, 0.230699852108955), new Point(0.719875812530518, 0.279397785663605), new Point(0.663155674934387, 0.373069316148758), "7");
addFace(["62", "2", "1", "61"], "8");
setUVsToFace(new Point(0.169987872242928, 0.624359130859375), new Point(0.232345446944237, 0.615109443664551), new Point(0.282604456392093, 0.65846714058745), "8");
addFace(["66", "34", "35", "67"], "16");
setUVsToFace(new Point(0.0824346542358398, 0.387721985578537), new Point(0.0495466887950897, 0.34898054599762), new Point(0.111940339180578, 0.26744622755082), "16");
addFace(["86", "54", "55", "57"], "18");
setUVsToFace(new Point(0.476608262273489, 0.88553316889628), new Point(0.441773563623428, 0.962473511695862), new Point(0.349538713693619, 0.924630761146545), "18");
addFace(["84", "52", "53", "85"], "19");
setUVsToFace(new Point(0.625563826321988, 0.818395731912015), new Point(0.621113657951355, 0.928619265556335), new Point(0.517435908317566, 0.93955659866333), "19");
addFace(["26", "58", "59", "0"], "20");
setUVsToFace(new Point(0.378238946199417, 0.824984908103943), new Point(0.346208602190018, 0.857921600341797), new Point(0.314893216866219, 0.784734311232618), "20");
addFace(["88", "10", "69", "70"], "21");
setUVsToFace(new Point(0.375655591487885, 0.171732068061829), new Point(0.306111752986908, 0.218920037150383), new Point(0.250852755920996, 0.207068660014076), "21");
addFace(["33", "65", "64", "32"], "22");
setUVsToFace(new Point(0.0176386342842436, 0.428196147730716), new Point(0.0843737497925758, 0.462465018033981), new Point(0.0924478396773338, 0.516420245170593), "22");
addFace(["68", "69", "10", "9"], "23");
setUVsToFace(new Point(0.181954676126322, 0.24000106324918), new Point(0.249071642756462, 0.208565235137939), new Point(0.306111752986908, 0.218920037150383), "23");
addFace(["1", "2", "92"], "24");
setUVsToFace(new Point(0.282297134399414, 0.658839106559753), new Point(0.232345446944237, 0.615109443664551), new Point(0.35919064283371, 0.65445601940155), "24");
addFace(["87", "1", "92"], "25");
setUVsToFace(new Point(0.320393860340118, 0.711399674415588), new Point(0.282297134399414, 0.658839106559753), new Point(0.35919064283371, 0.65445601940155), "25");
addFace(["50", "96", "95", "51"], "26");
setUVsToFace(new Point(0.830545034073851, 0.801815008232933), new Point(0.800552725791931, 0.861453652381897), new Point(0.692751288414001, 0.929564356803894), "26");
addFace(["81", "82", "22", "21"], "28");
setUVsToFace(new Point(0.856223539940682, 0.6038879109099), new Point(0.791775584220886, 0.675992727279663), new Point(0.712934136390686, 0.686888694763184), "28");
addFace(["25", "86", "57"], "34");
setUVsToFace(new Point(0.442934095859528, 0.835460066795349), new Point(0.477365374565125, 0.882530689239502), new Point(0.413260132074356, 0.889125108718872), "34");
addFace(["24", "85", "86"], "35");
setUVsToFace(new Point(0.506202161312103, 0.817004561424255), new Point(0.548203110694885, 0.852527499198914), new Point(0.477365374565125, 0.882530689239502), "35");
addFace(["91", "84", "85"], "36");
setUVsToFace(new Point(0.550412893295288, 0.772447109222412), new Point(0.620059013366699, 0.816600680351257), new Point(0.548203110694885, 0.852527499198914), "36");
addFace(["22", "82", "83"], "38");
setUVsToFace(new Point(0.712934136390686, 0.686888694763184), new Point(0.791775584220886, 0.675992727279663), new Point(0.711131691932678, 0.753029704093933), "38");
addFace(["20", "80", "81"], "40");
setUVsToFace(new Point(0.84505569934845, 0.545050859451294), new Point(0.913927316665649, 0.502624452114105), new Point(0.853009104728699, 0.603320956230164), "40");
addFace(["19", "79", "80"], "41");
setUVsToFace(new Point(0.865001320838928, 0.458239674568176), new Point(0.897727847099304, 0.411706924438477), new Point(0.913927316665649, 0.502624452114105), "41");
addFace(["18", "78", "79"], "42");
setUVsToFace(new Point(0.841813206672668, 0.393398106098175), new Point(0.860153317451477, 0.337554842233658), new Point(0.897727847099304, 0.411706924438477), "42");
addFace(["17", "77", "78"], "43");
setUVsToFace(new Point(0.792212963104248, 0.335635125637054), new Point(0.788064122200012, 0.276841670274734), new Point(0.860153317451477, 0.337554842233658), "43");
addFace(["16", "76", "77"], "44");
setUVsToFace(new Point(0.719875812530518, 0.279397785663605), new Point(0.746709227561951, 0.226838320493698), new Point(0.788064122200012, 0.276841670274734), "44");
addFace(["15", "75", "76"], "45");
setUVsToFace(new Point(0.658041834831238, 0.230699852108955), new Point(0.676394939422607, 0.178198620676994), new Point(0.746709227561951, 0.226838320493698), "45");
addFace(["14", "74", "75"], "46");
setUVsToFace(new Point(0.620372414588928, 0.186231210827827), new Point(0.603773593902588, 0.108945652842522), new Point(0.676394939422607, 0.178198620676994), "46");
addFace(["13", "73", "74"], "47");
setUVsToFace(new Point(0.572496891021729, 0.144847840070724), new Point(0.538016796112061, 0.0870758295059204), new Point(0.603773593902588, 0.108945652842522), "47");
addFace(["12", "72", "73"], "48");
setUVsToFace(new Point(0.513436675071716, 0.124788455665112), new Point(0.491562575101852, 0.0849757418036461), new Point(0.538016796112061, 0.0870758295059204), "48");
addFace(["11", "71", "72"], "49");
setUVsToFace(new Point(0.453370124101639, 0.137893736362457), new Point(0.402509480714798, 0.124896414577961), new Point(0.491562575101852, 0.0849757418036461), "49");
addFace(["88", "70", "71"], "50");
setUVsToFace(new Point(0.375655591487885, 0.171732068061829), new Point(0.323191285133362, 0.161969736218452), new Point(0.402509480714798, 0.124896414577961), "50");
addFace(["76", "75", "42", "43"], "52");
setUVsToFace(new Point(0.746709227561951, 0.226838320493698), new Point(0.676394939422607, 0.178198620676994), new Point(0.673776350217405, 0.114043312328303), "52");
addFace(["7", "66", "67"], "54");
setUVsToFace(new Point(0.124351903796196, 0.375676363706589), new Point(0.0824346542358398, 0.387721985578537), new Point(0.120512492954731, 0.327794134616852), "54");
addFace(["6", "65", "66"], "55");
setUVsToFace(new Point(0.11132425814867, 0.430169761180878), new Point(0.0843737497925758, 0.462465018033981), new Point(0.0824346542358398, 0.387721985578537), "55");
addFace(["5", "64", "65"], "56");
setUVsToFace(new Point(0.113904014229774, 0.503275871276855), new Point(0.0924478396773338, 0.516420245170593), new Point(0.0843737497925758, 0.462465018033981), "56");
addFace(["4", "63", "64"], "57");
setUVsToFace(new Point(0.126763686537743, 0.537549376487732), new Point(0.126092717051506, 0.582740426063538), new Point(0.0924478396773338, 0.516420245170593), "57");
addFace(["3", "62", "63"], "58");
setUVsToFace(new Point(0.156784787774086, 0.581470727920532), new Point(0.169987872242928, 0.624359130859375), new Point(0.126092717051506, 0.582740426063538), "58");
addFace(["1", "60", "61"], "60");
setUVsToFace(new Point(0.282297134399414, 0.658839106559753), new Point(0.273077040910721, 0.711027264595032), new Point(0.226033926010132, 0.660937309265137), "60");
addFace(["87", "59", "60"], "61");
setUVsToFace(new Point(0.320393860340118, 0.711399674415588), new Point(0.311740815639496, 0.783913969993591), new Point(0.273077040910721, 0.711027264595032), "61");
addFace(["23", "89", "21", "22"], "62");
setUVsToFace(new Point(0.618985057417137, 0.738404456444883), new Point(0.663155674934387, 0.65445613861084), new Point(0.776008129119873, 0.619814872741699), "62");
addFace(["26", "57", "58"], "63");
setUVsToFace(new Point(0.378238946199417, 0.824984908103943), new Point(0.413260132074356, 0.889125108718872), new Point(0.346208602190018, 0.857921600341797), "63");
addFace(["5", "4", "64"], "64");
setUVsToFace(new Point(0.113904014229774, 0.503275871276855), new Point(0.126763686537743, 0.537549376487732), new Point(0.0924478396773338, 0.516420245170593), "64");
addFace(["65", "6", "5"], "65");
setUVsToFace(new Point(0.0843737497925758, 0.462465018033981), new Point(0.11132425814867, 0.430169761180878), new Point(0.113904014229774, 0.503275871276855), "65");
addFace(["66", "7", "6"], "66");
setUVsToFace(new Point(0.0824346542358398, 0.387721985578537), new Point(0.124351903796196, 0.375676363706589), new Point(0.11132425814867, 0.430169761180878), "66");
addFace(["68", "9", "8"], "68");
setUVsToFace(new Point(0.180570170283318, 0.243550479412079), new Point(0.237504348158836, 0.249832332134247), new Point(0.180013805627823, 0.289115756750107), "68");
addFace(["71", "11", "88"], "71");
setUVsToFace(new Point(0.402509480714798, 0.124896414577961), new Point(0.453370124101639, 0.137893736362457), new Point(0.375655591487885, 0.171732068061829), "71");
addFace(["72", "12", "11"], "72");
setUVsToFace(new Point(0.491562575101852, 0.0849757418036461), new Point(0.513436675071716, 0.124788455665112), new Point(0.453370124101639, 0.137893736362457), "72");
addFace(["73", "13", "12"], "73");
setUVsToFace(new Point(0.538016796112061, 0.0870758295059204), new Point(0.572496891021729, 0.144847840070724), new Point(0.513436675071716, 0.124788455665112), "73");
addFace(["74", "14", "13"], "74");
setUVsToFace(new Point(0.603773593902588, 0.108945652842522), new Point(0.620372414588928, 0.186231210827827), new Point(0.572496891021729, 0.144847840070724), "74");
addFace(["75", "15", "14"], "75");
setUVsToFace(new Point(0.676394939422607, 0.178198620676994), new Point(0.658041834831238, 0.230699852108955), new Point(0.620372414588928, 0.186231210827827), "75");
addFace(["76", "16", "15"], "76");
setUVsToFace(new Point(0.746709227561951, 0.226838320493698), new Point(0.719875812530518, 0.279397785663605), new Point(0.658041834831238, 0.230699852108955), "76");
addFace(["77", "17", "16"], "77");
setUVsToFace(new Point(0.788064122200012, 0.276841670274734), new Point(0.792212963104248, 0.335635125637054), new Point(0.719875812530518, 0.279397785663605), "77");
addFace(["78", "18", "17"], "78");
setUVsToFace(new Point(0.860153317451477, 0.337554842233658), new Point(0.841813206672668, 0.393398106098175), new Point(0.792212963104248, 0.335635125637054), "78");
addFace(["79", "19", "18"], "79");
setUVsToFace(new Point(0.897727847099304, 0.411706924438477), new Point(0.865001320838928, 0.458239674568176), new Point(0.841813206672668, 0.393398106098175), "79");
addFace(["80", "20", "19"], "80");
setUVsToFace(new Point(0.913927316665649, 0.502624452114105), new Point(0.84505569934845, 0.545050859451294), new Point(0.865001320838928, 0.458239674568176), "80");
addFace(["20", "81", "21"], "81");
setUVsToFace(new Point(0.84505569934845, 0.545050859451294), new Point(0.853009104728699, 0.603320956230164), new Point(0.776008129119873, 0.619814872741699), "81");
addFace(["22", "83", "23"], "83");
setUVsToFace(new Point(0.712934136390686, 0.686888694763184), new Point(0.711131691932678, 0.753029704093933), new Point(0.618857383728027, 0.73810887336731), "83");
addFace(["85", "24", "91"], "85");
setUVsToFace(new Point(0.548203110694885, 0.852527499198914), new Point(0.506202161312103, 0.817004561424255), new Point(0.550412893295288, 0.772447109222412), "85");
addFace(["24", "86", "25"], "86");
setUVsToFace(new Point(0.506202161312103, 0.817004561424255), new Point(0.477365374565125, 0.882530689239502), new Point(0.442934095859528, 0.835460066795349), "86");
addFace(["25", "57", "26"], "87");
setUVsToFace(new Point(0.442934095859528, 0.835460066795349), new Point(0.413260132074356, 0.889125108718872), new Point(0.378238946199417, 0.824984908103943), "87");
addFace(["87", "0", "59"], "89");
setUVsToFace(new Point(0.320393860340118, 0.711399674415588), new Point(0.342280477285385, 0.775039315223694), new Point(0.311740815639496, 0.783913969993591), "89");
addFace(["60", "1", "87"], "90");
setUVsToFace(new Point(0.273077040910721, 0.711027264595032), new Point(0.282297134399414, 0.658839106559753), new Point(0.320393860340118, 0.711399674415588), "90");
addFace(["62", "3", "2"], "92");
setUVsToFace(new Point(0.169987872242928, 0.624359130859375), new Point(0.156784787774086, 0.581470727920532), new Point(0.232345446944237, 0.615109443664551), "92");
addFace(["63", "4", "3"], "93");
setUVsToFace(new Point(0.126092717051506, 0.582740426063538), new Point(0.126763686537743, 0.537549376487732), new Point(0.156784787774086, 0.581470727920532), "93");
addFace(["67", "35", "68"], "94");
setUVsToFace(new Point(0.120512492954731, 0.327794134616852), new Point(0.113896213471889, 0.267325937747955), new Point(0.180570170283318, 0.243550479412079), "94");
addFace(["68", "36", "69"], "95");
setUVsToFace(new Point(0.180570170283318, 0.243550479412079), new Point(0.179441958665848, 0.196931272745132), new Point(0.249071642756462, 0.208565235137939), "95");
addFace(["70", "38", "71"], "97");
setUVsToFace(new Point(0.323191285133362, 0.161969736218452), new Point(0.334696888923645, 0.104322850704193), new Point(0.402509480714798, 0.124896414577961), "97");
addFace(["71", "39", "72"], "98");
setUVsToFace(new Point(0.402509480714798, 0.124896414577961), new Point(0.41200989484787, 0.0732671394944191), new Point(0.491562575101852, 0.0849757418036461), "98");
addFace(["72", "40", "73"], "99");
setUVsToFace(new Point(0.491562575101852, 0.0849757418036461), new Point(0.510659515857697, 0.0447706840932369), new Point(0.538016796112061, 0.0870758295059204), "99");
addFace(["73", "41", "74"], "100");
setUVsToFace(new Point(0.538016796112061, 0.0870758295059204), new Point(0.57656466960907, 0.0514241941273212), new Point(0.603773593902588, 0.108945652842522), "100");
addFace(["74", "42", "75"], "101");
setUVsToFace(new Point(0.603773593902588, 0.108945652842522), new Point(0.670536279678345, 0.115986734628677), new Point(0.676394939422607, 0.178198620676994), "101");
addFace(["76", "44", "77"], "103");
setUVsToFace(new Point(0.746709227561951, 0.226838320493698), new Point(0.817364931106567, 0.213490933179855), new Point(0.788064122200012, 0.276841670274734), "103");
addFace(["77", "45", "78"], "104");
setUVsToFace(new Point(0.788064122200012, 0.276841670274734), new Point(0.886005282402039, 0.274774491786957), new Point(0.860153317451477, 0.337554842233658), "104");
addFace(["78", "46", "79"], "105");
setUVsToFace(new Point(0.860153317451477, 0.337554842233658), new Point(0.953715920448303, 0.354809790849686), new Point(0.897727847099304, 0.411706924438477), "105");
addFace(["79", "47", "80"], "106");
setUVsToFace(new Point(0.897727847099304, 0.411706924438477), new Point(0.985737204551697, 0.470214933156967), new Point(0.913927316665649, 0.502624452114105), "106");
addFace(["80", "48", "81"], "107");
setUVsToFace(new Point(0.913927316665649, 0.502624452114105), new Point(0.961911201477051, 0.570052862167358), new Point(0.853009104728699, 0.603320956230164), "107");
addFace(["81", "49", "82"], "108");
setUVsToFace(new Point(0.853009104728699, 0.603320956230164), new Point(0.890356302261353, 0.698651909828186), new Point(0.791775584220886, 0.675992727279663), "108");
addFace(["82", "50", "83"], "109");
setUVsToFace(new Point(0.791775584220886, 0.675992727279663), new Point(0.824265241622925, 0.797465562820435), new Point(0.711131691932678, 0.753029704093933), "109");
addFace(["83", "51", "84"], "110");
setUVsToFace(new Point(0.711131691932678, 0.753029704093933), new Point(0.728910446166992, 0.875275254249573), new Point(0.620059013366699, 0.816600680351257), "110");
addFace(["85", "53", "86"], "112");
setUVsToFace(new Point(0.548203110694885, 0.852527499198914), new Point(0.517435908317566, 0.93955659866333), new Point(0.477365374565125, 0.882530689239502), "112");
addFace(["57", "55", "58"], "114");
setUVsToFace(new Point(0.413260132074356, 0.889125108718872), new Point(0.349538713693619, 0.924630761146545), new Point(0.346208602190018, 0.857921600341797), "114");
addFace(["58", "56", "59"], "115");
setUVsToFace(new Point(0.346208602190018, 0.857921600341797), new Point(0.295179098844528, 0.881911873817444), new Point(0.311740815639496, 0.783913969993591), "115");
addFace(["59", "27", "60"], "116");
setUVsToFace(new Point(0.311740815639496, 0.783913969993591), new Point(0.250682502985001, 0.793625354766846), new Point(0.273077040910721, 0.711027264595032), "116");
addFace(["60", "28", "61"], "117");
setUVsToFace(new Point(0.273077040910721, 0.711027264595032), new Point(0.197571039199829, 0.74489951133728), new Point(0.226033926010132, 0.660937309265137), "117");
addFace(["61", "29", "62"], "118");
setUVsToFace(new Point(0.226033926010132, 0.660937309265137), new Point(0.143400087952614, 0.698905348777771), new Point(0.169987872242928, 0.624359130859375), "118");
addFace(["62", "30", "63"], "119");
setUVsToFace(new Point(0.169987872242928, 0.624359130859375), new Point(0.0942364782094955, 0.626548647880554), new Point(0.126092717051506, 0.582740426063538), "119");
addFace(["63", "31", "64"], "120");
setUVsToFace(new Point(0.126092717051506, 0.582740426063538), new Point(0.0732166171073914, 0.556638836860657), new Point(0.0924478396773338, 0.516420245170593), "120");
addFace(["65", "33", "66"], "122");
setUVsToFace(new Point(0.0843737497925758, 0.462465018033981), new Point(0.0217416975647211, 0.423976421356201), new Point(0.0824346542358398, 0.387721985578537), "122");
addFace(["33", "34", "66"], "124");
setUVsToFace(new Point(0.0217416975647211, 0.423976421356201), new Point(0.0495466887950897, 0.34898054599762), new Point(0.0824346542358398, 0.387721985578537), "124");
addFace(["35", "36", "68"], "126");
setUVsToFace(new Point(0.113896213471889, 0.267325937747955), new Point(0.179441958665848, 0.196931272745132), new Point(0.180570170283318, 0.243550479412079), "126");
addFace(["37", "38", "70"], "128");
setUVsToFace(new Point(0.262137800455093, 0.148933291435242), new Point(0.334696888923645, 0.104322850704193), new Point(0.323191285133362, 0.161969736218452), "128");
addFace(["38", "39", "71"], "129");
setUVsToFace(new Point(0.334696888923645, 0.104322850704193), new Point(0.41200989484787, 0.0732671394944191), new Point(0.402509480714798, 0.124896414577961), "129");
addFace(["39", "40", "72"], "130");
setUVsToFace(new Point(0.41200989484787, 0.0732671394944191), new Point(0.510659515857697, 0.0447706840932369), new Point(0.491562575101852, 0.0849757418036461), "130");
addFace(["40", "41", "73"], "131");
setUVsToFace(new Point(0.510659515857697, 0.0447706840932369), new Point(0.57656466960907, 0.0514241941273212), new Point(0.538016796112061, 0.0870758295059204), "131");
addFace(["41", "42", "74"], "132");
setUVsToFace(new Point(0.57656466960907, 0.0514241941273212), new Point(0.670536279678345, 0.115986734628677), new Point(0.603773593902588, 0.108945652842522), "132");
addFace(["43", "44", "76"], "134");
setUVsToFace(new Point(0.74309515953064, 0.167256742715836), new Point(0.817364931106567, 0.213490933179855), new Point(0.746709227561951, 0.226838320493698), "134");
addFace(["44", "45", "77"], "135");
setUVsToFace(new Point(0.817364931106567, 0.213490933179855), new Point(0.886005282402039, 0.274774491786957), new Point(0.788064122200012, 0.276841670274734), "135");
addFace(["45", "46", "78"], "136");
setUVsToFace(new Point(0.886005282402039, 0.274774491786957), new Point(0.953715920448303, 0.354809790849686), new Point(0.860153317451477, 0.337554842233658), "136");
addFace(["46", "47", "79"], "137");
setUVsToFace(new Point(0.953715920448303, 0.354809790849686), new Point(0.985737204551697, 0.470214933156967), new Point(0.897727847099304, 0.411706924438477), "137");
addFace(["47", "48", "80"], "138");
setUVsToFace(new Point(0.985737204551697, 0.470214933156967), new Point(0.961911201477051, 0.570052862167358), new Point(0.913927316665649, 0.502624452114105), "138");
addFace(["48", "49", "81"], "139");
setUVsToFace(new Point(0.961911201477051, 0.570052862167358), new Point(0.890356302261353, 0.698651909828186), new Point(0.853009104728699, 0.603320956230164), "139");
addFace(["49", "50", "82"], "140");
setUVsToFace(new Point(0.890356302261353, 0.698651909828186), new Point(0.824265241622925, 0.797465562820435), new Point(0.791775584220886, 0.675992727279663), "140");
addFace(["50", "51", "83"], "141");
setUVsToFace(new Point(0.824265241622925, 0.797465562820435), new Point(0.728910446166992, 0.875275254249573), new Point(0.711131691932678, 0.753029704093933), "141");
addFace(["51", "52", "84"], "142");
setUVsToFace(new Point(0.728910446166992, 0.875275254249573), new Point(0.621113657951355, 0.928619265556335), new Point(0.620059013366699, 0.816600680351257), "142");
addFace(["53", "54", "86"], "144");
setUVsToFace(new Point(0.517435908317566, 0.93955659866333), new Point(0.441773563623428, 0.962473511695862), new Point(0.477365374565125, 0.882530689239502), "144");
addFace(["55", "56", "58"], "146");
setUVsToFace(new Point(0.349538713693619, 0.924630761146545), new Point(0.295179098844528, 0.881911873817444), new Point(0.346208602190018, 0.857921600341797), "146");
addFace(["56", "27", "59"], "147");
setUVsToFace(new Point(0.295179098844528, 0.881911873817444), new Point(0.250682502985001, 0.793625354766846), new Point(0.311740815639496, 0.783913969993591), "147");
addFace(["27", "28", "60"], "148");
setUVsToFace(new Point(0.250682502985001, 0.793625354766846), new Point(0.197571039199829, 0.74489951133728), new Point(0.273077040910721, 0.711027264595032), "148");
addFace(["28", "29", "61"], "149");
setUVsToFace(new Point(0.197571039199829, 0.74489951133728), new Point(0.143400087952614, 0.698905348777771), new Point(0.226033926010132, 0.660937309265137), "149");
addFace(["29", "30", "62"], "150");
setUVsToFace(new Point(0.143400087952614, 0.698905348777771), new Point(0.0942364782094955, 0.626548647880554), new Point(0.169987872242928, 0.624359130859375), "150");
addFace(["30", "31", "63"], "151");
setUVsToFace(new Point(0.0942364782094955, 0.626548647880554), new Point(0.0732166171073914, 0.556638836860657), new Point(0.126092717051506, 0.582740426063538), "151");
addFace(["31", "32", "64"], "152");
setUVsToFace(new Point(0.0732166171073914, 0.556638836860657), new Point(0.0426680892705917, 0.487890124320984), new Point(0.0924478396773338, 0.516420245170593), "152");
addFace(["53", "52", "94"], "154");
setUVsToFace(new Point(0.517435908317566, 0.93955659866333), new Point(0.621113657951355, 0.928619265556335), new Point(0.588735818862915, 0.968436598777771), "154");
addFace(["52", "51", "95"], "155");
setUVsToFace(new Point(0.621113657951355, 0.928619265556335), new Point(0.728910446166992, 0.875275254249573), new Point(0.692751288414001, 0.929564356803894), "155");
addFace(["50", "49", "97"], "157");
setUVsToFace(new Point(0.824265241622925, 0.797465562820435), new Point(0.890356302261353, 0.698651909828186), new Point(0.906573534011841, 0.76189661026001), "157");
addFace(["49", "48", "98"], "158");
setUVsToFace(new Point(0.890356302261353, 0.698651909828186), new Point(0.961911201477051, 0.570052862167358), new Point(0.952999353408813, 0.660169720649719), "158");
addFace(["97", "49", "98"], "159");
setUVsToFace(new Point(0.906573534011841, 0.76189661026001), new Point(0.890356302261353, 0.698651909828186), new Point(0.952999353408813, 0.660169720649719), "159");
addFace(["96", "50", "97"], "160");
setUVsToFace(new Point(0.800552725791931, 0.861453652381897), new Point(0.824265241622925, 0.797465562820435), new Point(0.906573534011841, 0.76189661026001), "160");
addFace(["94", "52", "95"], "162");
setUVsToFace(new Point(0.588735818862915, 0.968436598777771), new Point(0.621113657951355, 0.928619265556335), new Point(0.692751288414001, 0.929564356803894), "162");
addFace(["54", "53", "94"], "163");
setUVsToFace(new Point(0.441773563623428, 0.962473511695862), new Point(0.517435908317566, 0.93955659866333), new Point(0.588735818862915, 0.968436598777771), "163");
addFace(["8", "7", "67", "68"], "164");
setUVsToFace(new Point(0.180013805627823, 0.289115756750107), new Point(0.124351903796196, 0.375676363706589), new Point(0.120512492954731, 0.327794134616852), "164");
addSurface(["106", "122", "20", "139", "89", "72", "41", "90", "40", "56", "74", "24", "73", "141", "124", "107", "57", "75", "25", "140", "8", "109", "92", "42", "58", "21", "23", "158", "22", "157", "110", "93", "43", "44", "126", "76", "62", "61", "77", "60", "108", "45", "94", "52", "159", "46", "95", "78", "160", "142", "79", "128", "144", "47", "162", "112", "146", "7", "81", "64", "1", "63", "48", "97", "80", "129", "26", "65", "114", "130", "49", "98", "147", "163", "50", "132", "148", "131", "83", "99", "115", "164", "28", "100", "116", "0", "117", "34", "149", "66", "85", "3", "150", "16", "118", "35", "86", "18", "151", "68", "119", "36", "101", "4", "19", "152", "5", "54", "136", "135", "154", "38", "87", "2", "134", "55", "71", "120", "103", "6", "105", "104", "155", "138", "137"], "Ground");
setMaterialToSurface(material, "Ground");
}
private function onLoadError(_arg1:IOErrorEvent):void{
complete();
}
public function load(_arg1:Function):String{
this.onLoadMethod = _arg1;
loader = new Loader();
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onLoadComplete);
loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, onLoadError);
loader.contentLoaderInfo.addEventListener(IOErrorEvent.NETWORK_ERROR, onLoadError);
loader.contentLoaderInfo.addEventListener(IOErrorEvent.VERIFY_ERROR, onLoadError);
loader.load(new URLRequest("groundalpha.gif"), new LoaderContext(false, ApplicationDomain.currentDomain));
return ("Loading ground texture");
}
private function complete():void{
onLoadMethod.call();
loader.contentLoaderInfo.removeEventListener(Event.COMPLETE, onLoadComplete);
loader.contentLoaderInfo.removeEventListener(IOErrorEvent.IO_ERROR, onLoadError);
loader.contentLoaderInfo.removeEventListener(IOErrorEvent.NETWORK_ERROR, onLoadError);
loader.contentLoaderInfo.removeEventListener(IOErrorEvent.VERIFY_ERROR, onLoadError);
onLoadMethod = null;
loader = null;
}
private function onLoadComplete(_arg1:Event):void{
counter++;
if (counter < 2){
switch (counter){
case 1:
alpha = Bitmap(loader.content).bitmapData;
loader.load(new URLRequest("ground.jpg"), new LoaderContext(false, ApplicationDomain.currentDomain));
break;
};
} else {
material.texture = new TextureData(BitmapUtility.mergeBitmapAlpha(Bitmap(loader.content).bitmapData, alpha, true));
complete();
};
}
}
}//package temple
Section 46
//Ground_Bmp (temple.Ground_Bmp)
package temple {
import mx.core.*;
public class Ground_Bmp extends BitmapAsset {
}
}//package temple
Section 47
//Limits (temple.Limits)
package temple {
import com.alternativagame.engine3d.*;
import com.alternativagame.type.*;
public class Limits extends Mesh {
public function Limits(){
super("Limits");
coords = new Point3D(-35.7909698486328, 7.15819311141968, -94.316047668457);
addVertex(66.1005630493164, 551.312143802643, 0, "0");
addVertex(-121.414672851563, 551.96485376358, 0, "1");
addVertex(-300.233932495117, 268.115854740143, 0, "2");
addVertex(-535.520919799805, 110.819689273834, 0, "3");
addVertex(-592.704696655273, -98.4427771568298, 0, "4");
addVertex(-482.757308959961, -356.268849849701, 0, "5");
addVertex(-4.0699462890625, -614.157887935638, 0, "6");
addVertex(162.509658813477, -614.157887935638, 0, "7");
addVertex(638.799697875977, -168.723332881927, 0, "8");
addVertex(660.941482543945, 70.8634819984436, 0, "9");
addVertex(472.579605102539, 332.85450220108, 0, "10");
addVertex(66.1005630493164, 551.312143802643, 393.700782775879, "11");
addVertex(-121.414672851563, 551.96485376358, 393.700782775879, "12");
addVertex(-300.233932495117, 268.115854740143, 393.700782775879, "13");
addVertex(-535.520919799805, 110.819689273834, 393.700782775879, "14");
addVertex(-592.704696655273, -98.4427771568298, 393.700782775879, "15");
addVertex(-482.757308959961, -356.268849849701, 393.700782775879, "16");
addVertex(-4.0699462890625, -614.157887935638, 393.700782775879, "17");
addVertex(162.509658813477, -614.157887935638, 393.700782775879, "18");
addVertex(638.799697875977, -168.723332881927, 393.700782775879, "19");
addVertex(660.941482543945, 70.8634819984436, 393.700782775879, "20");
addVertex(472.579605102539, 332.85450220108, 393.700782775879, "21");
addFace(["17", "18", "7", "6"], "2");
addFace(["21", "11", "0", "10"], "3");
addFace(["12", "13", "2", "1"], "4");
addFace(["14", "15", "4", "3"], "5");
addFace(["18", "19", "8", "7"], "22");
addFace(["11", "12", "1", "0"], "6");
addFace(["19", "20", "9", "8"], "8");
addFace(["3", "2", "13", "14"], "9");
addFace(["10", "9", "20", "21"], "10");
addFace(["15", "16", "5", "4"], "11");
addFace(["6", "5", "16", "17"], "14");
}
}
}//package temple
Section 48
//SoundManager (temple.SoundManager)
package temple {
import flash.events.*;
import flash.utils.*;
import flash.media.*;
import com.alternativagame.utility.*;
import flash.net.*;
public class SoundManager {
private var current:int;// = -1
private var sequence:Array;
private var counter:int;// = -1
private var stoneSounds:Array;
private var stepsLoaded:Boolean;// = false
private var stepsIntervalId:int;
private var sound:Sound;
private var environmentTransform:SoundTransform;
private var grassSounds:Array;
private var onLoadMethod:Function;
private var environmentChannel:SoundChannel;
private var volumeIntervalId:int;
private var environmentSound:Sound;
private var environmentLoaded:Boolean;// = false
public static const STONE_RUN:uint = 1;
public static const STONE_WALK:uint = 0;
public static const GRASS_WALK:uint = 2;
public static const GRASS_RUN:uint = 3;
public function SoundManager(){
sequence = ["stone1.mp3", "stone2.mp3", "stone3.mp3", "stone4.mp3", "grass1.mp3", "grass2.mp3", "grass3.mp3", "grass4.mp3", "environment.mp3"];
stoneSounds = new Array();
grassSounds = new Array();
super();
}
public function stopSteps():void{
clearInterval(stepsIntervalId);
current = -1;
}
private function addVolume():void{
environmentTransform.volume = (environmentTransform.volume + 0.01);
if (environmentTransform.volume >= 1){
environmentTransform.volume = 1;
clearInterval(volumeIntervalId);
};
environmentChannel.soundTransform = environmentTransform;
}
public function playSteps(_arg1:uint):void{
if (current != _arg1){
stopSteps();
current = _arg1;
nextSample();
stepsIntervalId = setInterval(nextSample, ((((_arg1 == STONE_WALK)) || ((_arg1 == GRASS_WALK)))) ? 500 : 300);
};
}
private function onLoadError(_arg1:IOErrorEvent):void{
loadNext();
}
public function load(_arg1:Function):String{
this.onLoadMethod = _arg1;
loadNext();
return ("Loading sound");
}
private function loadNext():void{
counter++;
if (sound != null){
sound.removeEventListener(Event.COMPLETE, onLoadComplete);
sound.removeEventListener(IOErrorEvent.IO_ERROR, onLoadError);
sound.removeEventListener(IOErrorEvent.NETWORK_ERROR, onLoadError);
sound.removeEventListener(IOErrorEvent.VERIFY_ERROR, onLoadError);
};
if (counter < sequence.length){
sound = new Sound();
sound.addEventListener(Event.COMPLETE, onLoadComplete);
sound.addEventListener(IOErrorEvent.IO_ERROR, onLoadError);
sound.addEventListener(IOErrorEvent.NETWORK_ERROR, onLoadError);
sound.addEventListener(IOErrorEvent.VERIFY_ERROR, onLoadError);
sound.load(new URLRequest(sequence[counter]), new SoundLoaderContext());
} else {
onLoadMethod.call();
onLoadMethod = null;
sound = null;
};
}
private function nextSample():void{
var _local1:Sound;
if (stepsLoaded){
if ((((current == STONE_WALK)) || ((current == STONE_RUN)))){
_local1 = stoneSounds[Math.round(MathUtility.random(0, (stoneSounds.length - 1)))];
} else {
_local1 = grassSounds[Math.round(MathUtility.random(0, (grassSounds.length - 1)))];
};
if (_local1 != null){
_local1.play();
};
};
}
private function onLoadComplete(_arg1:Event):void{
if (counter < 4){
stoneSounds.push(sound);
} else {
if (counter < 8){
grassSounds.push(sound);
if (counter == 7){
stepsLoaded = true;
};
} else {
environmentLoaded = true;
environmentSound = sound;
environmentTransform = new SoundTransform(0);
environmentChannel = environmentSound.play(0, 1000000, environmentTransform);
volumeIntervalId = setInterval(addVolume, 100);
};
};
loadNext();
}
}
}//package temple
Section 49
//Stairs (temple.Stairs)
package temple {
import flash.events.*;
import com.alternativagame.engine3d.*;
import com.alternativagame.type.*;
import flash.geom.*;
import flash.display.*;
import flash.net.*;
import flash.system.*;
public class Stairs extends Mesh {
private var loader:Loader;
private var onLoadMethod:Function;
public var material:TextureMaterial;
private static const texture:TextureData = new TextureData(new Bmp().bitmapData);
private static const Bmp:Class = Stairs_Bmp;
public function Stairs(){
material = new TextureMaterial(texture, 1, false, true, 1);
super("Stairs");
x = 43.3920822143555;
y = 33.4864082336426;
addVertex(220.472450256348, -200.787403106689, 0, "1");
addVertex(-265.014610290527, 245.329570770264, -39.410472869873, "194");
addVertex(220.472450256348, 200.787395477295, 0, "3");
addVertex(-265.014610290527, 245.329570770264, -31.4290885925293, "196");
addVertex(-242.743522644043, 223.058483123779, -23.6077156066895, "135");
addVertex(-220.472434997559, -200.787403106689, -7.8321647644043, "8");
addVertex(220.472450256348, -200.787403106689, -7.8321647644043, "9");
addVertex(-231.60799407959, -211.922946929932, -7.8321647644043, "75");
addVertex(-231.60799407959, 211.922939300537, -7.8321647644043, "76");
addVertex(-242.743522644043, 223.058483123779, -15.8264818191528, "14");
addVertex(242.743537902832, -223.058490753174, -23.6077175140381, "143");
addVertex(265.014625549316, 245.329570770264, -39.410472869873, "200");
addVertex(253.879066467285, 234.194042205811, -23.6077156066895, "145");
addVertex(253.879066467285, -234.194034576416, -23.6077175140381, "146");
addVertex(231.607978820801, 211.922939300537, -7.8321647644043, "83");
addVertex(231.607978820801, -211.922946929932, -7.8321647644043, "84");
addVertex(265.014625549316, -245.329578399658, -39.4104766845703, "206");
addVertex(-242.743522644043, -223.058490753174, -23.6077175140381, "24");
addVertex(-231.60799407959, 211.922939300537, -15.8264818191528, "81");
addVertex(-231.60799407959, -211.922946929932, -15.8264818191528, "90");
addVertex(-265.014610290527, -245.329578399658, -39.4104766845703, "204");
addVertex(-253.879081726074, 234.194042205811, -23.6077156066895, "154");
addVertex(231.607978820801, 211.922939300537, -15.8264818191528, "100");
addVertex(-253.879081726074, -234.194034576416, -31.4290904998779, "166");
addVertex(242.743537902832, 223.058483123779, -15.8264818191528, "103");
addVertex(231.607978820801, -211.922946929932, -15.8264818191528, "105");
addVertex(-220.472434997559, -200.787403106689, 0, "42");
addVertex(-253.879081726074, 234.194042205811, -31.4290885925293, "172");
addVertex(253.879066467285, -234.194034576416, -31.4290904998779, "167");
addVertex(253.879066467285, 234.194042205811, -31.4290885925293, "176");
addVertex(242.743537902832, -223.058490753174, -15.8264818191528, "113");
addVertex(-253.879081726074, -234.194034576416, -23.6077175140381, "170");
addVertex(220.472450256348, 200.787395477295, -7.8321647644043, "52");
addVertex(-220.472434997559, 200.787395477295, -7.8321647644043, "53");
addVertex(265.014625549316, 245.329570770264, -31.4290885925293, "183");
addVertex(-220.472434997559, 200.787395477295, 0, "49");
addVertex(242.743537902832, 223.058483123779, -23.6077156066895, "123");
addVertex(-265.014610290527, -245.329578399658, -31.4290904998779, "188");
addVertex(265.014625549316, -245.329578399658, -31.4290904998779, "189");
addVertex(-242.743522644043, -223.058490753174, -15.8264818191528, "127");
addFace(["103", "113", "143", "123"], "0");
setUVsToFace(new Point(0, 0.90618902683278), new Point(0.557688176631927, 0.906189024448395), new Point(0.557688176631927, 0.915916383266449), "0");
addFace(["135", "154", "170", "24"], "1");
setUVsToFace(new Point(0.0139205250889063, 0.64684009552002), new Point(0, 0.632919609546661), new Point(0.585529088973999, 0.632919609546661), "1");
addFace(["167", "176", "145", "146"], "2");
setUVsToFace(new Point(0.585529148578644, 0.9040167927742), new Point(0, 0.9040167927742), new Point(0, 0.894239366054535), "2");
addFace(["146", "170", "166", "167"], "3");
setUVsToFace(new Point(0, 0.797910153865814), new Point(0.634745419025421, 0.797910153865814), new Point(0.634745419025421, 0.807687640190125), "3");
addFace(["84", "83", "52", "9"], "4");
setUVsToFace(new Point(0.529847144726988, 0.743396162986755), new Point(0, 0.743396162986755), new Point(0.0139204645529389, 0.729475677013397), "4");
addFace(["113", "103", "100", "105"], "5");
setUVsToFace(new Point(0.557688243290996, 0.727303445339203), new Point(0, 0.727303445339203), new Point(0.0139204645529389, 0.713383138179779), "5");
addFace(["103", "14", "81", "100"], "6");
setUVsToFace(new Point(-1.9431282138882E-9, 0.600734412670135), new Point(0.606904447078705, 0.600734412670135), new Point(0.592983901500702, 0.614654839038849), "6");
addFace(["194", "204", "188", "196"], "7");
setUVsToFace(new Point(0.61337012052536, 0.819837388992107), new Point(0, 0.819837391376495), new Point(0, 0.809859812259674), "7");
addFace(["189", "188", "204", "206"], "8");
setUVsToFace(new Point(0, 0.773810803890228), new Point(0.662586331367493, 0.773810803890228), new Point(0.662586331367493, 0.783788323402405), "8");
addFace(["113", "127", "24", "143"], "9");
setUVsToFace(new Point(0, 0.834159195423126), new Point(0.60690450668335, 0.834159195423126), new Point(0.60690450668335, 0.843886435031891), "9");
addFace(["81", "90", "75", "76"], "74");
setUVsToFace(new Point(0.529847383499146, 0.976073741912842), new Point(0, 0.976073741912842), new Point(0, 0.966080069541931), "74");
addFace(["170", "154", "172", "166"], "11");
setUVsToFace(new Point(0, 0.882289588451385), new Point(0.585529088973999, 0.882289588451385), new Point(0.585529088973999, 0.892067193984985), "11");
addFace(["14", "103", "123", "135"], "12");
setUVsToFace(new Point(0, 0.84605860710144), new Point(0.606904447078705, 0.84605860710144), new Point(0.606904447078705, 0.855785846710205), "12");
addFace(["8", "75", "84", "9"], "13");
setUVsToFace(new Point(0.56514310836792, 0.681197643280029), new Point(0.579063534736633, 0.695118188858032), new Point(0, 0.695118188858032), "13");
addFace(["135", "24", "127", "14"], "14");
setUVsToFace(new Point(0.557688176631927, 0.927815792560407), new Point(0, 0.927815794944763), new Point(0, 0.918088555335999), "14");
addFace(["8", "42", "49", "53"], "15");
setUVsToFace(new Point(0, 1), new Point(0, 0.990209102630615), new Point(0.502006351947784, 0.990209102630615), "15");
addFace(["183", "189", "206", "200"], "16");
setUVsToFace(new Point(0, 0.82200956583039), new Point(0.613370060920715, 0.822009563446045), new Point(0.613370060920715, 0.831986963748932), "16");
addFace(["176", "172", "154", "145"], "17");
setUVsToFace(new Point(0.634745478630066, 0.795737981796265), new Point(0, 0.795737981796265), new Point(0, 0.785960555076599), "17");
addFace(["9", "1", "42", "8"], "18");
setUVsToFace(new Point(0, 0.951741993427277), new Point(0, 0.941951096057892), new Point(0.551222503185272, 0.941951096057892), "18");
addFace(["176", "183", "196", "172"], "19");
setUVsToFace(new Point(0.0139204645529389, 0.534191608428955), new Point(0, 0.520271182060242), new Point(0.662586271762848, 0.520271182060242), "19");
addFace(["167", "189", "183", "176"], "20");
setUVsToFace(new Point(0.599449574947357, 0.584641873836517), new Point(0.613370060920715, 0.598562240600586), new Point(0, 0.598562240600586), "20");
addFace(["1", "3", "49", "42"], "21");
setUVsToFace(new Point(0, 0.502006232738495), new Point(0, 0), new Point(0.551222503185272, 0), "21");
addFace(["14", "127", "90", "81"], "22");
setUVsToFace(new Point(-6.66590682651957E-8, 0.697290360927582), new Point(0.557688176631927, 0.697290360927582), new Point(0.543767750263214, 0.711210906505585), "22");
addFace(["84", "75", "90", "105"], "23");
setUVsToFace(new Point(0, 0.857958078384399), new Point(0.579063534736633, 0.857958078384399), new Point(0.579063534736633, 0.867951691150665), "23");
addFace(["127", "113", "105", "90"], "24");
setUVsToFace(new Point(0.606904449021833, 0.630747437477112), new Point(0, 0.630747437477112), new Point(0.0139204049482942, 0.616827011108398), "24");
addFace(["145", "154", "135", "123"], "25");
setUVsToFace(new Point(-6.79098394185118E-8, 0.552456557750702), new Point(0.634745478630066, 0.552456557750702), new Point(0.620825052261353, 0.566376984119415), "25");
addFace(["3", "52", "53", "49"], "26");
setUVsToFace(new Point(0.551222562789917, 0.929987967014313), new Point(0.551222562789917, 0.939778864383698), new Point(0, 0.939778864383698), "26");
addFace(["143", "146", "145", "123"], "10");
setUVsToFace(new Point(0.571608662605286, 0.649012267589569), new Point(0.585529088973999, 0.662932753562927), new Point(0, 0.662932753562927), "10");
addFace(["1", "9", "52", "3"], "28");
setUVsToFace(new Point(0.502006351947784, 0.978245913982391), new Point(0.502006351947784, 0.988036870956421), new Point(0, 0.988036870956421), "28");
addFace(["196", "183", "200", "194"], "29");
setUVsToFace(new Point(0, 0.761661052703857), new Point(0.662586450576782, 0.761661052703857), new Point(0.662586450576782, 0.771638572216034), "29");
addFace(["76", "83", "100", "81"], "34");
setUVsToFace(new Point(0, 0.870123863220215), new Point(0.579063475131989, 0.870123863220215), new Point(0.579063475131989, 0.880117416381836), "34");
addFace(["188", "189", "167", "166"], "35");
setUVsToFace(new Point(0.662586270185876, 0.518098950386047), new Point(0, 0.518098950386047), new Point(0.0139204645529389, 0.504178464412689), "35");
addFace(["24", "170", "146", "143"], "38");
setUVsToFace(new Point(0.620825052261353, 0.536363840103149), new Point(0.634745478630066, 0.550284326076508), new Point(0, 0.550284326076508), "38");
addFace(["172", "196", "188", "166"], "39");
setUVsToFace(new Point(0.0139205250889063, 0.582469701766968), new Point(0, 0.56854921579361), new Point(0.613370060920715, 0.56854921579361), "39");
addFace(["83", "84", "105", "100"], "40");
setUVsToFace(new Point(0, 0.953914165496826), new Point(0.529847383499146, 0.953914165496826), new Point(0.529847383499146, 0.963907897472382), "40");
addFace(["76", "75", "8", "53"], "27");
setUVsToFace(new Point(3.53578499812102E-10, 0.74556839466095), new Point(0.529847145080566, 0.74556839466095), new Point(0.515926659107208, 0.759488821029663), "27");
addFace(["52", "83", "76", "53"], "54");
setUVsToFace(new Point(0.0139205250889063, 0.67902547121048), new Point(0, 0.665104925632477), new Point(0.579063534736633, 0.665104925632477), "54");
addSurface(["29", "9", "74", "26", "17", "23", "0", "38", "3", "8", "21", "16", "5", "39", "35", "10", "14", "11", "27", "20", "18", "7", "22", "4", "25", "13", "54", "15", "1", "2", "34", "40", "6", "28", "24", "12", "19"], "Stairs");
setMaterialToSurface(material, "Stairs");
}
private function onLoadComplete(_arg1:Event):void{
material.texture = new TextureData(Bitmap(loader.content).bitmapData);
complete();
}
public function load(_arg1:Function):String{
this.onLoadMethod = _arg1;
loader = new Loader();
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onLoadComplete);
loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, onLoadError);
loader.contentLoaderInfo.addEventListener(IOErrorEvent.NETWORK_ERROR, onLoadError);
loader.contentLoaderInfo.addEventListener(IOErrorEvent.VERIFY_ERROR, onLoadError);
loader.load(new URLRequest("stairs.jpg"), new LoaderContext(false, ApplicationDomain.currentDomain));
return ("Loading stairs texture");
}
private function complete():void{
onLoadMethod.call();
loader.contentLoaderInfo.removeEventListener(Event.COMPLETE, onLoadComplete);
loader.contentLoaderInfo.removeEventListener(IOErrorEvent.IO_ERROR, onLoadError);
loader.contentLoaderInfo.removeEventListener(IOErrorEvent.NETWORK_ERROR, onLoadError);
loader.contentLoaderInfo.removeEventListener(IOErrorEvent.VERIFY_ERROR, onLoadError);
onLoadMethod = null;
loader = null;
}
private function onLoadError(_arg1:IOErrorEvent):void{
complete();
}
}
}//package temple
Section 50
//Stairs_Bmp (temple.Stairs_Bmp)
package temple {
import mx.core.*;
public class Stairs_Bmp extends BitmapAsset {
}
}//package temple
Section 51
//Stones (temple.Stones)
package temple {
import flash.events.*;
import com.alternativagame.engine3d.*;
import com.alternativagame.type.*;
import flash.geom.*;
import flash.display.*;
import flash.net.*;
import flash.system.*;
public class Stones extends Mesh {
private var loader:Loader;
private var onLoadMethod:Function;
public var material:TextureMaterial;
private static const texture:TextureData = new TextureData(new Bmp().bitmapData);
private static const Bmp:Class = Stones_Bmp;
public function Stones(){
material = new TextureMaterial(texture, 1, false, true, 1);
super("Stones");
coords = new Point3D(-135.620376586914, -130.174331665039, 235.888412475586);
addVertex(21.6535415649414, 88.5826644897461, 0, "128");
addVertex(21.6535415649414, -21.6535491943359, 0, "1");
addVertex(-21.6535491943359, 21.6535415649414, 0, "2");
addVertex(21.6535415649414, 21.6535415649414, 0, "3");
addVertex(-21.6535491943359, -21.6535491943359, 5.51181030273438, "4");
addVertex(21.6535415649414, 131.889755249023, 5.51181030273438, "133");
addVertex(-21.6535491943359, 21.6535415649414, 5.51181030273438, "6");
addVertex(20.1947021484375, -4.06436157226563, 5.55728149414063, "383");
addVertex(214.566909790039, 352.362182617188, 0, "256");
addVertex(-21.6535491943359, 131.889755249023, 0, "10");
addVertex(-21.6535491943359, 88.5826644897461, 5.51181030273438, "12");
addVertex(375.984222412109, 309.055114746094, 5.51181030273438, "271");
addVertex(-21.6535491943359, 198.818878173828, 0, "16");
addVertex(21.6535415649414, 198.818878173828, 0, "17");
addVertex(-21.6535491943359, 242.1259765625, 0, "18");
addVertex(21.6535415649414, 131.889755249023, 0, "130");
addVertex(21.6535415649414, 198.818878173828, 5.51181030273438, "21");
addVertex(375.984222412109, 352.362182617188, 0, "278");
addVertex(21.6535415649414, 242.1259765625, 5.51181030273438, "23");
addVertex(-21.6535491943359, 309.055114746094, 0, "24");
addVertex(375.984222412109, 309.055114746094, 0, "273");
addVertex(21.6535415649414, 242.1259765625, 0, "154");
addVertex(332.677154541016, 352.362182617188, 5.51181030273438, "283");
addVertex(-21.6535491943359, 309.055114746094, 5.51181030273438, "28");
addVertex(21.6535415649414, 309.055114746094, 5.51181030273438, "29");
addVertex(-21.6535491943359, 352.362182617188, 5.51181030273438, "30");
addVertex(21.6535415649414, 352.362182617188, 5.51181030273438, "31");
addVertex(342.129638671875, 311.401947021484, 5.55728149414063, "32");
addVertex(20.1947021484375, -4.06436157226563, 37.0533599853516, "379");
addVertex(342.129638671875, 311.401947021484, 37.0533599853516, "34");
addVertex(-21.6535491943359, 242.1259765625, 5.51181030273438, "163");
addVertex(332.677154541016, 352.362182617188, 0, "284");
addVertex(-19.5843811035156, 349.299560546875, 5.55728149414063, "37");
addVertex(-21.6535491943359, 198.818878173828, 5.51181030273438, "167");
addVertex(96.4566955566406, 309.055114746094, 0, "40");
addVertex(-21.6535491943359, 131.889755249023, 5.51181030273438, "132");
addVertex(139.763778686523, 352.362182617188, 0, "43");
addVertex(375.984222412109, 21.6535415649414, 0, "351");
addVertex(375.984222412109, 198.818878173828, 5.51181030273438, "293");
addVertex(139.763778686523, 352.362182617188, 5.51181030273438, "47");
addVertex(21.6535415649414, 309.055114746094, 0, "176");
addVertex(257.873992919922, 309.055114746094, 0, "49");
addVertex(332.677154541016, 198.818878173828, 5.51181030273438, "306");
addVertex(257.873992919922, 352.362182617188, 0, "51");
addVertex(214.566909790039, 309.055114746094, 5.51181030273438, "258");
addVertex(214.566909790039, 352.362182617188, 5.51181030273438, "54");
addVertex(21.6535415649414, 352.362182617188, 0, "183");
addVertex(332.677154541016, 309.055114746094, 0, "56");
addVertex(332.677154541016, 242.1259765625, 5.51181030273438, "307");
addVertex(332.677154541016, 309.055114746094, 5.51181030273438, "60");
addVertex(-21.6535491943359, 352.362182617188, 0, "189");
addVertex(332.677154541016, 198.818878173828, 0, "310");
addVertex(375.984222412109, 352.362182617188, 5.51181030273438, "63");
addVertex(375.984222412109, 242.1259765625, 0, "303");
addVertex(375.984222412109, 198.818878173828, 0, "65");
addVertex(332.677154541016, 242.1259765625, 0, "66");
addVertex(375.984222412109, 88.5826644897461, 0, "316");
addVertex(375.984222412109, 88.5826644897461, 5.51181030273438, "317");
addVertex(-19.5843811035156, 349.299560546875, 37.0533599853516, "198");
addVertex(-19.4427947998047, 310.096160888672, 5.55728149414063, "201");
addVertex(-19.4427947998047, 310.096160888672, 37.0533599853516, "202");
addVertex(332.677154541016, 131.889755249023, 5.51181030273438, "331");
addVertex(341.988037109375, 350.605346679688, 37.0533599853516, "204");
addVertex(332.677154541016, 131.889755249023, 0, "333");
addVertex(375.984222412109, 131.889755249023, 0, "326");
addVertex(375.984222412109, 131.889755249023, 5.51181030273438, "79");
addVertex(375.984222412109, -21.6535491943359, 0, "81");
addVertex(341.988037109375, 350.605346679688, 5.55728149414063, "210");
addVertex(332.677154541016, -21.6535491943359, 5.51181030273438, "84");
addVertex(332.677154541016, 88.5826644897461, 0, "334");
addVertex(332.677154541016, 88.5826644897461, 5.51181030273438, "335");
addVertex(139.763778686523, 309.055114746094, 5.51181030273438, "216");
addVertex(96.4566955566406, 309.055114746094, 5.51181030273438, "217");
addVertex(375.984222412109, 21.6535415649414, 5.51181030273438, "347");
addVertex(139.763778686523, 309.055114746094, 0, "220");
addVertex(18.9970550537109, 106.165351867676, 5.55728149414063, "93");
addVertex(18.9970626831055, 106.165351867676, 37.0533599853516, "95");
addVertex(-21.6535491943359, -21.6535491943359, 0, "99");
addVertex(332.677154541016, 21.6535415649414, 5.51181030273438, "348");
addVertex(332.677154541016, 21.6535415649414, 0, "357");
addVertex(332.677154541016, -21.6535491943359, 0, "358");
addVertex(21.6535415649414, -21.6535491943359, 5.51181030273438, "103");
addVertex(375.984222412109, -21.6535491943359, 5.51181030273438, "343");
addVertex(375.984222412109, 242.1259765625, 5.51181030273438, "299");
addVertex(96.4566955566406, 352.362182617188, 5.51181030273438, "235");
addVertex(21.6535415649414, 21.6535415649414, 5.51181030273438, "109");
addVertex(257.873992919922, 309.055114746094, 5.51181030273438, "240");
addVertex(-20.2042694091797, 105.73942565918, 5.55728149414063, "369");
addVertex(214.566909790039, 309.055114746094, 0, "242");
addVertex(96.4566955566406, 352.362182617188, 0, "237");
addVertex(-20.2042694091797, 105.73942565918, 37.0533599853516, "374");
addVertex(-19.0066375732422, -4.49028015136719, 37.0533599853516, "376");
addVertex(-21.6535491943359, 88.5826644897461, 0, "122");
addVertex(-19.0066375732422, -4.49028015136719, 5.55728149414063, "362");
addVertex(257.873992919922, 352.362182617188, 5.51181030273438, "253");
addVertex(21.6535415649414, 88.5826644897461, 5.51181030273438, "127");
addFace(["204", "34", "32", "210"], "0");
setUVsToFace(new Point(0.520313441753387, 0.415210008621216), new Point(0.520313441753387, 0.307044476270676), new Point(0.607213735580444, 0.307044476270676), "0");
addFace(["16", "167", "163", "18"], "1");
setUVsToFace(new Point(0.989486038684845, 0.120488002896309), new Point(0.974278390407562, 0.120488002896309), new Point(0.974278390407562, 0.00100000004749745), "1");
addFace(["343", "347", "348", "84"], "2");
setUVsToFace(new Point(0.731479823589325, 0.609907448291779), new Point(0.731479823589325, 0.490419447422028), new Point(0.850967764854431, 0.490419447422028), "2");
addFace(["362", "383", "379", "376"], "3");
setUVsToFace(new Point(0.817424654960632, 0.85461699962616), new Point(0.817424654960632, 0.962776899337769), new Point(0.730524241924286, 0.962776899337769), "3");
addFace(["220", "216", "217", "40"], "4");
setUVsToFace(new Point(0.586877465248108, 0.536609172821045), new Point(0.57166987657547, 0.536609172821045), new Point(0.57166987657547, 0.417121291160583), "4");
addFace(["18", "154", "17", "16"], "5");
setUVsToFace(new Point(0.728613078594208, 0.242842867970467), new Point(0.609125077724457, 0.242842867970467), new Point(0.609125077724457, 0.123354867100716), "5");
addFace(["2", "6", "109", "3"], "6");
setUVsToFace(new Point(0.510001540184021, 0.858237743377686), new Point(0.494793951511383, 0.858237743377686), new Point(0.494793951511383, 0.738749802112579), "6");
addFace(["357", "348", "347", "351"], "7");
setUVsToFace(new Point(0.552639842033386, 0.900806844234467), new Point(0.537432253360748, 0.900806844234467), new Point(0.537432253360748, 0.781318962574005), "7");
addFace(["271", "63", "283", "60"], "8");
setUVsToFace(new Point(0.850012123584747, 0.734173536300659), new Point(0.850012123584747, 0.853661358356476), new Point(0.730524241924286, 0.853661358356476), "8");
addFace(["316", "334", "333", "326"], "9");
setUVsToFace(new Point(0.609125077724457, 0.490419447422028), new Point(0.728612959384918, 0.490419447422028), new Point(0.728612959384918, 0.609907388687134), "9");
addFace(["204", "210", "37", "198"], "10");
setUVsToFace(new Point(0.317170739173889, 0.00100000004749745), new Point(0.404071062803268, 0.00100000004749745), new Point(0.404071062803268, 0.998609304428101), "10");
addFace(["65", "293", "306", "310"], "11");
setUVsToFace(new Point(0.951769530773163, 0.963732540607452), new Point(0.93656188249588, 0.963732540607452), new Point(0.93656188249588, 0.844244599342346), "11");
addFace(["316", "317", "335", "334"], "12");
setUVsToFace(new Point(0.986007213592529, 0.963732540607452), new Point(0.970799565315247, 0.963732540607452), new Point(0.970799565315247, 0.844244599342346), "12");
addFace(["383", "93", "95", "379"], "13");
setUVsToFace(new Point(0.607213735580444, 0.00100000004749745), new Point(0.607213735580444, 0.30513322353363), new Point(0.520313441753387, 0.30513322353363), "13");
addFace(["30", "28", "29", "31"], "14");
setUVsToFace(new Point(0.609125077724457, 0.612774312496185), new Point(0.728612959384918, 0.612774312496185), new Point(0.728612959384918, 0.732262313365936), "14");
addFace(["37", "201", "202", "198"], "15");
setUVsToFace(new Point(0.938823759555817, 0.612774312496185), new Point(0.938823759555817, 0.720939874649048), new Point(0.85192334651947, 0.720939874649048), "15");
addFace(["127", "128", "130", "133"], "16");
setUVsToFace(new Point(0.975233793258667, 0.490419447422028), new Point(0.99044144153595, 0.490419447422028), new Point(0.99044144153595, 0.609907388687134), "16");
addFace(["317", "79", "331", "335"], "17");
setUVsToFace(new Point(0.73147988319397, 0.365197718143463), new Point(0.73147988319397, 0.245709747076035), new Point(0.850967824459076, 0.245709747076035), "17");
addFace(["351", "347", "343", "81"], "18");
setUVsToFace(new Point(0.535521030426025, 0.658008575439453), new Point(0.520313441753387, 0.658008575439453), new Point(0.520313441753387, 0.538520514965057), "18");
addFace(["189", "30", "31", "183"], "19");
setUVsToFace(new Point(0.90041309595108, 0.963732540607452), new Point(0.885205388069153, 0.963732540607452), new Point(0.885205388069153, 0.844244599342346), "19");
addFace(["56", "60", "283", "284"], "20");
setUVsToFace(new Point(0.990180373191833, 0.732262253761292), new Point(0.974972724914551, 0.732262253761292), new Point(0.974972724914551, 0.612774312496185), "20");
addFace(["333", "331", "79", "326"], "21");
setUVsToFace(new Point(0.569758653640747, 0.779407680034637), new Point(0.554551124572754, 0.779407680034637), new Point(0.554551124572754, 0.659919738769531), "21");
addFace(["51", "253", "240", "49"], "22");
setUVsToFace(new Point(0.603996336460114, 0.900806844234467), new Point(0.588788747787476, 0.900806844234467), new Point(0.588788747787476, 0.781318962574005), "22");
addFace(["154", "23", "21", "17"], "23");
setUVsToFace(new Point(0.510001540184021, 0.736838579177856), new Point(0.494793951511383, 0.736838579177856), new Point(0.494793951511383, 0.617350578308105), "23");
addFace(["358", "84", "348", "357"], "24");
setUVsToFace(new Point(0.552639842033386, 0.536609292030334), new Point(0.537432253360748, 0.536609292030334), new Point(0.537432253360748, 0.417121291160583), "24");
addFace(["60", "56", "273", "271"], "25");
setUVsToFace(new Point(0.554551124572754, 0.781318962574005), new Point(0.569758653640747, 0.781318962574005), new Point(0.569758653640747, 0.900806844234467), "25");
addFace(["10", "130", "128", "122"], "26");
setUVsToFace(new Point(0.850967824459076, 0.120487980544567), new Point(0.73147988319397, 0.120487980544567), new Point(0.73147988319397, 0.00100000004749745), "26");
addFace(["240", "253", "54", "258"], "27");
setUVsToFace(new Point(0.973322510719299, 0.487552553415298), new Point(0.853834629058838, 0.487552553415298), new Point(0.853834629058838, 0.36806458234787), "27");
addFace(["293", "299", "307", "306"], "28");
setUVsToFace(new Point(0.609125077724457, 0.487552583217621), new Point(0.609125077724457, 0.36806458234787), new Point(0.728612959384918, 0.36806458234787), "28");
addFace(["1", "103", "4", "99"], "29");
setUVsToFace(new Point(0.883294224739075, 0.963732540607452), new Point(0.868086576461792, 0.963732540607452), new Point(0.868086576461792, 0.844244599342346), "29");
addFace(["10", "132", "133", "130"], "30");
setUVsToFace(new Point(0.510001540184021, 0.979636907577515), new Point(0.494793951511383, 0.979636907577515), new Point(0.494793951511383, 0.860148966312408), "30");
addFace(["81", "343", "84", "358"], "31");
setUVsToFace(new Point(0.586877465248108, 0.900806844234467), new Point(0.57166987657547, 0.900806844234467), new Point(0.57166987657547, 0.781318962574005), "31");
addFace(["24", "28", "30", "189"], "32");
setUVsToFace(new Point(0.586877465248108, 0.779407680034637), new Point(0.57166987657547, 0.779407680034637), new Point(0.57166987657547, 0.659919738769531), "32");
addFace(["12", "122", "128", "127"], "33");
setUVsToFace(new Point(0.520313441753387, 0.659919679164886), new Point(0.535521030426025, 0.659919679164886), new Point(0.535521030426025, 0.779407680034637), "33");
addFace(["357", "351", "81", "358"], "34");
setUVsToFace(new Point(0.850967764854431, 0.487552583217621), new Point(0.731479823589325, 0.487552583217621), new Point(0.731479823589325, 0.36806458234787), "34");
addFace(["216", "47", "235", "217"], "35");
setUVsToFace(new Point(0.728612959384918, 0.853661358356476), new Point(0.609125077724457, 0.853661358356476), new Point(0.609125077724457, 0.734173536300659), "35");
addFace(["369", "374", "95", "93"], "36");
setUVsToFace(new Point(0.937868058681488, 0.842333376407623), new Point(0.850967645645142, 0.842333376407623), new Point(0.850967645645142, 0.734173536300659), "36");
addFace(["65", "310", "66", "303"], "37");
setUVsToFace(new Point(0.851923525333405, 0.123354867100716), new Point(0.971411466598511, 0.123354867100716), new Point(0.971411466598511, 0.242842867970467), "37");
addFace(["307", "66", "310", "306"], "38");
setUVsToFace(new Point(0.975233912467957, 0.245709747076035), new Point(0.990441560745239, 0.245709747076035), new Point(0.990441560745239, 0.365197718143463), "38");
addFace(["1", "99", "2", "3"], "39");
setUVsToFace(new Point(0.973322689533234, 0.120487973093987), new Point(0.853834807872772, 0.120487973093987), new Point(0.853834807872772, 0.00100000004749745), "39");
addFace(["253", "51", "256", "54"], "40");
setUVsToFace(new Point(0.902324199676514, 0.844244599342346), new Point(0.917531847953796, 0.844244599342346), new Point(0.917531847953796, 0.963732540607452), "40");
addFace(["176", "24", "189", "183"], "41");
setUVsToFace(new Point(0.853834748268127, 0.365197718143463), new Point(0.853834748268127, 0.245709747076035), new Point(0.973322570323944, 0.245709747076035), "41");
addFace(["334", "335", "331", "333"], "42");
setUVsToFace(new Point(0.99044144153595, 0.487552583217621), new Point(0.975233793258667, 0.487552583217621), new Point(0.975233793258667, 0.36806458234787), "42");
addFace(["23", "154", "18", "163"], "144");
setUVsToFace(new Point(0.537432253360748, 0.538520514965057), new Point(0.552639842033386, 0.538520514965057), new Point(0.552639842033386, 0.658008575439453), "144");
addFace(["202", "34", "204", "198"], "44");
setUVsToFace(new Point(0.226447895169258, 0.00139064877294004), new Point(0.222845122218132, 0.998999995253851), new Point(0.114679574966431, 0.998609304428101), "44");
addFace(["63", "278", "284", "283"], "45");
setUVsToFace(new Point(0.953680753707886, 0.844244599342346), new Point(0.968888342380524, 0.844244599342346), new Point(0.968888342380524, 0.963732540607452), "45");
addFace(["201", "32", "34", "202"], "46");
setUVsToFace(new Point(0.315259456634521, 0.00100000004749745), new Point(0.315259456634521, 0.99860942363739), new Point(0.228359147906303, 0.99860942363739), "46");
addFace(["176", "29", "28", "24"], "47");
setUVsToFace(new Point(0.535521030426025, 0.900806844234467), new Point(0.520313441753387, 0.900806844234467), new Point(0.520313441753387, 0.781318962574005), "47");
addFace(["220", "40", "237", "43"], "48");
setUVsToFace(new Point(0.853834629058838, 0.609907388687134), new Point(0.853834629058838, 0.490419447422028), new Point(0.973322510719299, 0.490419447422028), "48");
addFace(["326", "79", "317", "316"], "49");
setUVsToFace(new Point(0.834543466567993, 0.974105000495911), new Point(0.819335877895355, 0.974105000495911), new Point(0.819335877895355, 0.85461699962616), "49");
addFace(["127", "133", "132", "12"], "50");
setUVsToFace(new Point(0.609125077724457, 0.365197718143463), new Point(0.609125077724457, 0.245709747076035), new Point(0.728613078594208, 0.245709747076035), "50");
addFace(["29", "176", "183", "31"], "51");
setUVsToFace(new Point(0.588788747787476, 0.538520514965057), new Point(0.603996336460114, 0.538520514965057), new Point(0.603996336460114, 0.658008456230164), "51");
addFace(["376", "379", "95", "374"], "52");
setUVsToFace(new Point(0.514142176697429, 0.614483633448902), new Point(0.405982345342636, 0.613308489322662), new Point(0.409286767244339, 0.309175282716751), "52");
addFace(["99", "4", "6", "2"], "53");
setUVsToFace(new Point(0.552639842033386, 0.779407680034637), new Point(0.537432253360748, 0.779407680034637), new Point(0.537432253360748, 0.659919679164886), "53");
addFace(["293", "65", "303", "299"], "56");
setUVsToFace(new Point(0.974278271198273, 0.123354867100716), new Point(0.989485919475555, 0.123354867100716), new Point(0.989485919475555, 0.242842867970467), "56");
addFace(["103", "109", "6", "4"], "57");
setUVsToFace(new Point(0.850967824459076, 0.123354889452457), new Point(0.850967824459076, 0.242842853069305), new Point(0.73147988319397, 0.242842853069305), "57");
addFace(["299", "303", "66", "307"], "60");
setUVsToFace(new Point(0.588788747787476, 0.659919738769531), new Point(0.603996336460114, 0.659919738769531), new Point(0.603996336460114, 0.779407680034637), "60");
addFace(["54", "256", "242", "258"], "61");
setUVsToFace(new Point(0.957853853702545, 0.612774312496185), new Point(0.973061501979828, 0.612774312496185), new Point(0.973061501979828, 0.732262253761292), "61");
addFace(["376", "374", "369", "362"], "64");
setUVsToFace(new Point(0.405982345342636, 0.921483814716339), new Point(0.405982345342636, 0.617350578308105), new Point(0.492882698774338, 0.617350578308105), "64");
addFace(["40", "217", "235", "237"], "65");
setUVsToFace(new Point(0.603996336460114, 0.536609172821045), new Point(0.588788747787476, 0.536609172821045), new Point(0.588788747787476, 0.417121291160583), "65");
addFace(["3", "109", "103", "1"], "66");
setUVsToFace(new Point(0.866175413131714, 0.963732540607452), new Point(0.850967764854431, 0.963732540607452), new Point(0.850967764854431, 0.844244599342346), "66");
addFace(["237", "235", "47", "43"], "67");
setUVsToFace(new Point(0.955942690372467, 0.732262253761292), new Point(0.940735042095184, 0.732262253761292), new Point(0.940735042095184, 0.612774312496185), "67");
addFace(["21", "23", "163", "167"], "68");
setUVsToFace(new Point(0.609125077724457, 0.120488002896309), new Point(0.609125077724457, 0.00100000004749745), new Point(0.728613078594208, 0.00100000004749745), "68");
addFace(["273", "56", "284", "278"], "69");
setUVsToFace(new Point(0.728612959384918, 0.97506058216095), new Point(0.609125077724457, 0.97506058216095), new Point(0.609125077724457, 0.855572700500488), "69");
addFace(["49", "242", "256", "51"], "70");
setUVsToFace(new Point(0.730524241924286, 0.732262313365936), new Point(0.730524241924286, 0.612774312496185), new Point(0.850012123584747, 0.612774312496185), "70");
addFace(["278", "63", "271", "273"], "71");
setUVsToFace(new Point(0.586877465248108, 0.658008456230164), new Point(0.57166987657547, 0.658008456230164), new Point(0.57166987657547, 0.538520514965057), "71");
addFace(["216", "220", "43", "47"], "72");
setUVsToFace(new Point(0.919443070888519, 0.844244599342346), new Point(0.934650719165802, 0.844244599342346), new Point(0.934650719165802, 0.963732540607452), "72");
addFace(["122", "12", "132", "10"], "73");
setUVsToFace(new Point(0.535521030426025, 0.536609292030334), new Point(0.520313441753387, 0.536609292030334), new Point(0.520313441753387, 0.417121291160583), "73");
addFace(["210", "32", "201", "37"], "74");
setUVsToFace(new Point(0.112768325139768, 0.998609322048853), new Point(0.0046027759090066, 0.999000012874603), new Point(0.00100000004749745, 0.00139064877294004), "74");
addFace(["93", "383", "362", "369"], "80");
setUVsToFace(new Point(0.409286767244339, 0.3063083589077), new Point(0.405982345342636, 0.00217514601536095), new Point(0.514142215251923, 0.00100000004749745), "80");
addFace(["17", "21", "167", "16"], "81");
setUVsToFace(new Point(0.569758653640747, 0.536609292030334), new Point(0.554551124572754, 0.536609292030334), new Point(0.554551124572754, 0.417121291160583), "81");
addFace(["258", "242", "49", "240"], "43");
setUVsToFace(new Point(0.554551124572754, 0.538520514965057), new Point(0.569758653640747, 0.538520514965057), new Point(0.569758653640747, 0.658008515834808), "43");
addSurface(["9", "64", "8", "22", "44", "48", "80", "49", "53", "56", "45", "81", "65", "68", "28", "67", "0", "30", "32", "10", "144", "57", "29", "46", "23", "70", "2", "26", "11", "34", "40", "4", "47", "71", "3", "51", "50", "33", "1", "13", "5", "12", "20", "72", "60", "41", "14", "16", "36", "42", "21", "66", "61", "43", "24", "17", "35", "37", "25", "27", "15", "31", "6", "52", "19", "38", "18", "73", "39", "69", "74", "7"], "Stones");
setMaterialToSurface(material, "Stones");
}
private function onLoadComplete(_arg1:Event):void{
material.texture = new TextureData(Bitmap(loader.content).bitmapData);
complete();
}
public function load(_arg1:Function):String{
this.onLoadMethod = _arg1;
loader = new Loader();
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onLoadComplete);
loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, onLoadError);
loader.contentLoaderInfo.addEventListener(IOErrorEvent.NETWORK_ERROR, onLoadError);
loader.contentLoaderInfo.addEventListener(IOErrorEvent.VERIFY_ERROR, onLoadError);
loader.load(new URLRequest("stones.jpg"), new LoaderContext(false, ApplicationDomain.currentDomain));
return ("Loading stones texture");
}
private function complete():void{
onLoadMethod.call();
loader.contentLoaderInfo.removeEventListener(Event.COMPLETE, onLoadComplete);
loader.contentLoaderInfo.removeEventListener(IOErrorEvent.IO_ERROR, onLoadError);
loader.contentLoaderInfo.removeEventListener(IOErrorEvent.NETWORK_ERROR, onLoadError);
loader.contentLoaderInfo.removeEventListener(IOErrorEvent.VERIFY_ERROR, onLoadError);
onLoadMethod = null;
loader = null;
}
private function onLoadError(_arg1:IOErrorEvent):void{
complete();
}
}
}//package temple
Section 52
//Stones_Bmp (temple.Stones_Bmp)
package temple {
import mx.core.*;
public class Stones_Bmp extends BitmapAsset {
}
}//package temple
Section 53
//Wrecks (temple.Wrecks)
package temple {
import flash.events.*;
import com.alternativagame.engine3d.*;
import com.alternativagame.type.*;
import flash.geom.*;
import flash.display.*;
import flash.net.*;
import flash.system.*;
public class Wrecks extends Mesh {
private var loader:Loader;
private var onLoadMethod:Function;
public var material:TextureMaterial;
private static const texture:TextureData = new TextureData(new Bmp().bitmapData);
private static const Bmp:Class = Wrecks_Bmp;
public function Wrecks(){
material = new TextureMaterial(texture, 1, false, true, 1);
super("Wrecks");
coords = new Point3D(103.823928833008, -131.348449707031, 13.0508308410645);
rotX = -1.5695738893527;
rotY = -0.00174567664453053;
rotZ = 0.959929971992082;
scaleX = 0.999999940395355;
scaleY = 0.99999988079071;
addVertex(30.9870354438522, -6.97446881868021, 232.749895679156, "0");
addVertex(-115.142091607374, 19.512000007837, 36.1684096047493, "513");
addVertex(31.0755017028127, -28.3374301628208, 53.968280444313, "514");
addVertex(31.0566121188095, -27.6894547095205, 41.9326977929853, "516");
addVertex(22.6564073617492, -62.0065627062191, 54.3638034283731, "501");
addVertex(25.1450713770116, -17.5112901065562, 233.099501018477, "263");
addVertex(13.7465438173521, -20.8740304708384, 235.109570851381, "264");
addVertex(19.0748151538194, 15.7095097145062, 241.11067629178, "10");
addVertex(3.53069206690347, 11.1237654715993, 243.851774272121, "11");
addVertex(-0.15834330222382, -18.9803045060293, 242.261665194865, "13");
addVertex(13.8191883693423, -24.7880757288684, 237.561453260909, "14");
addVertex(29.4018637248114, -22.2783294554172, 236.120822039929, "15");
addVertex(17.0037943060619, -2.44889091683077, 154.717028179165, "17");
addVertex(-9.0955595173244, 12.904032926956, 162.086927307749, "19");
addVertex(-16.1552380668166, 2.83944857703452, 156.32117042964, "20");
addVertex(-14.2361840220989, -8.22688953160129, 148.690101435939, "21");
addVertex(-4.46255524009408, -13.8124721992186, 143.664004359035, "22");
addVertex(16.1746966377303, -26.1805398411713, 238.453364845692, "24");
addVertex(11.7685391917183, -25.688942624668, 239.368684484537, "25");
addVertex(12.378348108361, 15.776452906615, 251.683659593851, "26");
addVertex(-5.02547981587867, 15.77916973833, 278.759460365304, "27");
addVertex(23.7342524522642, -47.9849100117898, 61.4571535792908, "523");
addVertex(-4.97048460382637, -15.7168264573417, 278.797971360015, "29");
addVertex(39.9339472526597, 15.8588974796884, 279.774577123609, "30");
addVertex(-106.585988169126, 14.6959033725838, 65.0363906696011, "526");
addVertex(27.615963374223, 15.8626960196891, 300.472463287724, "280");
addVertex(11.0057136865724, -14.3247020513529, 253.957131782418, "289");
addVertex(10.1846724352222, -15.7191685816244, 255.239883005585, "283");
addVertex(20.6745001426532, -55.4752005594544, 52.5235748292513, "532");
addVertex(39.9889174645662, -15.6370978273489, 279.81307061303, "294");
addVertex(112.569079482186, -15.5723731139804, 229.114099400234, "39");
addVertex(40.9814352626034, 15.8275679929543, 252.650247505751, "40");
addVertex(83.3214603632218, 15.8406746452783, 202.908670657084, "41");
addVertex(41.0364304729909, -15.6684272490452, 252.688758499296, "42");
addVertex(11.1355360257074, 11.1355394666243, 2.90725051854679E-6, "541");
addVertex(11.989726391601, -15.7163215142963, 254.991182989388, "295");
addVertex(1.85159772385646E-5, 15.748032412052, 155.898920404478, "543");
addVertex(83.3687767798303, -11.2663091794696, 202.941813806441, "49");
addVertex(27.996855419838, -35.1797376278065, 32.9991252832534, "512");
addVertex(42.4270079155091, -15.6729119883451, 247.034305795702, "51");
addVertex(104.185697370169, 16.2342397270016, 354.374478214018, "52");
addVertex(112.514113644657, 15.9236231467286, 229.075599660013, "303");
addVertex(60.4791132706868, -15.5912752993733, 288.038052151867, "313");
addVertex(-11.1355422753276, -11.1355394828838, -7.28328166132997E-6, "553");
addVertex(2.08472536868953E-5, -15.7480312397255, 138.211895925252, "554");
addVertex(27.6709498325267, -15.6332992223092, 300.510986780537, "278");
addVertex(58.0724043456487, 15.8751501682259, 126.479860772474, "61");
addVertex(79.3419241322315, 15.9251560772999, 137.012510117351, "63");
addVertex(84.0865184895024, -15.6533029516547, 203.583679125942, "320");
addVertex(60.4241305595398, 15.9047199751451, 287.999549910384, "321");
addVertex(39.5672796234593, 3.23001917015355, 250.054538330988, "322");
addVertex(-11.1355194400468, -11.1355395165708, 140.80209499097, "552");
addVertex(-5.46087630226566E-6, 15.7480319531462, -5.29051598618935E-6, "542");
addVertex(40.7916869805203, 10.3797377162341, 164.583655815576, "70");
addVertex(39.5911001614731, -10.4152074304571, 250.071218921809, "327");
addVertex(112.133658009075, 15.9924456497908, 145.229549144727, "74");
addVertex(105.486397359204, 16.0078714955845, 167.340910638949, "75");
addVertex(11.13554006586, -11.1355383340811, -1.50325092818093E-6, "561");
addVertex(41.4845344799965, -15.6720822310016, 249.058961676722, "335");
addVertex(41.5733432188367, 15.8227402023837, 247.855699783778, "339");
addVertex(96.4308068569753, 14.7460898872573, 172.154737978966, "85");
addVertex(82.7274474672267, -15.6555994396889, 203.645888655933, "342");
addVertex(36.0521113398992, 16.0184063200816, 247.764358357654, "87");
addVertex(36.1135836123341, 13.4478370985271, 247.686118012152, "88");
addVertex(38.0586991644641, 13.4528985814913, 249.048083925814, "89");
addVertex(37.0554052538465, 14.7356514971142, 248.4062211429, "91");
addVertex(44.6332687898653, 16.0544053556587, 261.228604812586, "92");
addVertex(87.6228401103349, 10.6445968960683, 314.370597230969, "351");
addVertex(41.2327691462475, -14.6523636091833, 248.316880609916, "345");
addVertex(104.195310592869, 10.7224403632276, 354.381228605779, "348");
addVertex(127.62386769683, 16.2059848468508, 297.791277249911, "358");
addVertex(7.44040276381109, -10.6453401086222, 144.187028756163, "105");
addVertex(15.7480231260256, 7.23296587068489E-7, 1.21342500278843E-5, "106");
addVertex(11.1355379026154, 11.1355375755399, 1.35352473193961E-5, "107");
addVertex(127.633480921195, 10.6941845294045, 297.798027642837, "356");
addVertex(-11.1355363170385, 11.1355374129289, 2.27557470395823E-5, "109");
addVertex(-15.7480343805729, -7.07034807589935E-7, 1.72403172769009E-5, "110");
addVertex(-11.1355385348302, -11.1355356356747, 1.39633853848409E-5, "111");
addVertex(1.07651030134548E-6, -15.7480271847843, 1.15343209188268E-5, "112");
addVertex(11.1355375567372, -11.1355345031314, 1.53673850320502E-5, "113");
addVertex(-57.5676592433779, -53.7051997334726, 89.5505453526329, "114");
addVertex(-68.6475183953372, -49.9558326636926, 84.7859580861235, "115");
addVertex(-53.0875947223364, -62.7961960986041, 100.757494279235, "116");
addVertex(-57.8317025176152, -71.9034449115596, 111.841925450242, "117");
addVertex(-69.0209249833, -75.6920449819399, 116.310724040945, "118");
addVertex(-80.1007815994992, -71.9426970018658, 111.546119922452, "119");
addVertex(-84.5808436447144, -62.8516853942387, 100.339154101898, "120");
addVertex(-79.8367402254775, -53.7444365812826, 89.2547291805249, "121");
addVertex(144.205938906153, 10.7720270103727, 337.808650266751, "361");
addVertex(-57.688712965333, 15.6374784287205, 89.4657668535588, "123");
addVertex(-53.2245605149673, 15.6589587779271, 100.661582493612, "124");
addVertex(-57.9845653775531, 15.6641857418957, 111.734872256, "125");
addVertex(79.610133904316, 15.9828348836036, 183.813298774493, "385");
addVertex(58.0820369477593, 10.3633498670373, 126.48659679253, "369");
addVertex(40.1745554833601, 15.8921129048158, 165.915507625457, "379");
addVertex(79.3515417326381, 10.4133557598531, 137.019254260643, "371");
addVertex(144.19631693137, 16.2838263741478, 337.801912374259, "362");
addVertex(87.6132056346459, 16.1563971809968, 314.363850585248, "353");
addVertex(87.6430570997316, 15.9752212397592, 166.113776208103, "392");
addVertex(86.7655561923034, 10.4580724343233, 163.010573847311, "393");
addVertex(41.5227524217809, 10.3833938858252, 166.529743755228, "386");
addVertex(23.6886250437609, -46.4205760539033, 32.4006986452962, "139");
addVertex(40.1815987778708, 11.8503106037847, 165.920439769709, "380");
addVertex(86.3161303754039, 10.4646886320249, 169.065403191666, "400");
addVertex(22.6306445293252, -61.1229446908149, 37.9509741989992, "146");
addVertex(79.6197558774348, 10.4710364735007, 183.82003666582, "387");
addVertex(87.6470209793339, 13.6974141179026, 166.116551958574, "389");
addVertex(32.7040776682968, -36.4630692430683, 67.3625093510253, "151");
addVertex(105.496019333987, 10.4960721318093, 167.347648531442, "410");
addVertex(112.143284359901, 10.480646286015, 145.236280787586, "404");
addVertex(91.0962255184932, 15.9486267228233, 139.427390215238, "413");
addVertex(91.1058371787277, 10.4368292338735, 139.43411622852, "414");
addVertex(98.9064581962241, 16.0407564740278, 172.558377940223, "415");
addVertex(-119.404707077518, 6.70682949867937, 64.6264291463928, "160");
addVertex(95.8827762903853, 16.0317116208242, 173.208741699499, "419");
addVertex(32.6418626122681, -34.3297834885047, 27.738434477903, "164");
addVertex(36.8144224830022, -24.1153407964229, 39.9210910092715, "165");
addVertex(97.3376603197716, 13.4616165052551, 171.527707676425, "424");
addVertex(-127.960809868567, 11.5229156110171, 35.7584205934007, "170");
addVertex(-134.518967217958, 4.46318146746275, 43.9237675780396, "171");
addVertex(95.8009855498185, 13.4609334296625, 173.16258277653, "420");
addVertex(-103.571868264622, 23.7505231422948, 44.9135482420735, "173");
addVertex(-100.027810202291, 21.7556404421934, 56.8710674352231, "174");
addVertex(-130.974930400292, 2.46829492015448, 55.8812905230585, "177");
addVertex(97.0606406600429, 16.0312482847154, 171.146901931133, "426");
addVertex(-11.1355400675249, 11.1355392877534, 1.5020850696601E-6, "181");
addVertex(37.9972268953588, 16.0234658957013, 249.126324273648, "439");
addVertex(11.1355569313642, 11.1355397189651, 153.308710714261, "186");
addVertex(43.0644540364657, 13.4752663080399, 260.197932045194, "444");
addVertex(41.6095743847861, 16.0453604699362, 261.878959819799, "445");
addVertex(34.7465331365583, 16.0254983010789, 251.698838984391, "429");
addVertex(11.135558525099, -11.1355383677676, 140.802107020635, "193");
addVertex(42.1576043191613, 14.7597406762344, 260.824983597899, "451");
addVertex(42.787425626318, 16.0448971338291, 259.817138800336, "452");
addVertex(41.5277830153341, 13.4745823112951, 261.832828397795, "446");
addVertex(11.1355506834088, 11.1355387490334, 153.308706339396, "203");
addVertex(15.7480449973268, 3.55787300065913E-7, 147.055417175464, "204");
addVertex(7.89197996198254E-6, 15.7480314421208, 155.898922279247, "205");
addVertex(-11.1355260387086, 11.135538602683, 153.308732435195, "206");
addVertex(-15.7480106356933, -1.05828405594366E-6, 147.055432907197, "207");
addVertex(-11.1355281921306, -11.1355395165697, 140.802107490238, "208");
addVertex(1.02215915802617E-5, -15.7480312559843, 138.211897798855, "209");
addVertex(11.1355522721491, -11.1355364766825, 140.802102642272, "210");
addVertex(-80.2536526076081, 15.624947924154, 111.439051709027, "467");
addVertex(33.0909078493521, 7.8257386148657, 237.710918620249, "212");
addVertex(17.5722233124975, 10.3453019213121, 236.758569672266, "214");
addVertex(-79.9577920771839, 15.598243504515, 89.1699613047844, "473");
addVertex(-69.1803701498444, 15.650098385132, 116.199033573229, "466");
addVertex(-4.43594938459903, -3.24522515811886, 244.328542466559, "221");
addVertex(-84.7177944356413, 15.6034694985508, 100.243234193039, "470");
addVertex(26.7667521897732, -49.6588418889518, 26.9223850959459, "480");
addVertex(-68.7619723015238, 15.6123299238647, 84.7057918654838, "474");
addVertex(37.3684964292246, -7.90934168671465, 235.644066348257, "233");
addVertex(28.0424834705451, -36.7440792475917, 62.0555527256101, "491");
addVertex(27.8502556700183, 4.56410899136661, 234.265538697937, "236");
addVertex(26.8289609895224, -51.7921238450858, 66.5464555883738, "495");
addVertex(36.8401872156418, -24.9989740543232, 56.3339308829636, "489");
addVertex(14.0100830746702, 9.532636016969, 162.390153260784, "242");
addVertex(2.8073984882456, 16.0711640638802, 162.609951706043, "245");
addVertex(6.17368325193265, 6.98256247818323, 238.768630751942, "247");
addVertex(0.331710434673184, -3.55425976336384, 239.118248591698, "248");
addVertex(20.6556043223484, -54.8272327517916, 40.4879878112191, "498");
addVertex(3.4684939556638, -15.0928375408906, 237.602626824247, "253");
addFace(["514", "516", "173", "174"], "0");
setUVsToFace(new Point(0.984497276406532, 0.138803396858903), new Point(0.985131978988647, 0.176889359951019), new Point(0.529630541801453, 0.184478536248207), "0");
addFace(["52", "348", "361", "362"], "1");
setUVsToFace(new Point(0.820484936237335, 0.786883890628815), new Point(0.820540547370911, 0.804302871227264), new Point(0.683677345378794, 0.804740309845241), "1");
addFace(["320", "39", "313", "42", "335", "51", "342"], "2");
setUVsToFace(new Point(0.245102316141129, 0.00395976379513742), new Point(0.249331846833229, 0.124767690896988), new Point(0.00100002096772524, 0.135172902466447), "2");
addFace(["206", "543", "542", "181"], "3");
setUVsToFace(new Point(0.989807486534119, 0.0969216078519821), new Point(0.997993350028992, 0.13501287996769), new Point(0.505304634571075, 0.135012820363045), "3");
addFace(["351", "353", "358", "356"], "4");
setUVsToFace(new Point(0.389881031537114, 0.10501071789436), new Point(0.389825373888016, 0.12242966145277), new Point(0.252962291240692, 0.121992126107216), "4");
addFace(["88", "87", "439", "91"], "5");
setUVsToFace(new Point(0.995973408222198, 0.146727606654167), new Point(0.987854957580566, 0.146297082304955), new Point(0.988252460956573, 0.138803347945213), "5");
addFace(["242", "245", "214", "236"], "6");
setUVsToFace(new Point(0.661093473154506, 0.739396622318071), new Point(0.669651508331299, 0.778978109359741), new Point(0.430090665817261, 0.784161031246185), "6");
addFace(["263", "15", "24", "14", "264"], "7");
setUVsToFace(new Point(0.651280625122334, 0.945930734459065), new Point(0.644906938076019, 0.924518465995789), new Point(0.689094071840932, 0.925665120349307), "7");
addFace(["207", "110", "553", "552"], "8");
setUVsToFace(new Point(0.982499480247498, 0.279193073511124), new Point(0.517758905887604, 0.279193103313446), new Point(0.51775879334189, 0.241101858697572), "8");
addFace(["280", "27", "29", "278"], "9");
setUVsToFace(new Point(0.268448412418365, 0.804005086421967), new Point(0.144553139805794, 0.803731560707092), new Point(0.144772965159853, 0.704194483129865), "9");
addFace(["207", "208", "209", "210", "204", "203", "205", "206"], "10");
setUVsToFace(new Point(0.605334937572479, 0.831060945987701), new Point(0.638373374938965, 0.858446419239044), new Point(0.64218407869339, 0.897220492362976), "10");
addFace(["52", "353", "351", "348"], "11");
setUVsToFace(new Point(0.781770586967468, 0.870101451873779), new Point(0.644906938076019, 0.869920313358307), new Point(0.644929945468903, 0.852501332759857), "11");
addFace(["414", "410", "75", "413"], "12");
setUVsToFace(new Point(0.288660615682602, 0.975479006767273), new Point(0.387908607721329, 0.975615501403809), new Point(0.387884706258774, 0.993034541606903), "12");
addFace(["233", "212", "10", "11", "221", "13", "25", "24", "15"], "13");
setUVsToFace(new Point(0.1275934278965, 0.669308066368103), new Point(0.091737374663353, 0.706892669200897), new Point(0.0398068644124589, 0.708114828776784), "13");
addFace(["29", "27", "26", "289", "283"], "14");
setUVsToFace(new Point(0.531142592430115, 0.831200063228607), new Point(0.531010653292938, 0.930737366627566), new Point(0.429266005754471, 0.930577397346497), "14");
addFace(["118", "466", "467", "119"], "15");
setUVsToFace(new Point(0.7043729539123, 0.334664576486451), new Point(0.993041515350342, 0.335558086633682), new Point(0.992923676967621, 0.373649209737778), "15");
addFace(["165", "164", "512", "516"], "16");
setUVsToFace(new Point(0.863516747951508, 0.895774602890015), new Point(0.811580240726471, 0.894844353199005), new Point(0.818886280059814, 0.873732030391693), "16");
addFace(["206", "181", "110", "207"], "17");
setUVsToFace(new Point(0.773139595985413, 0.476241946220398), new Point(0.288636714220047, 0.476241916418076), new Point(0.28863678224929, 0.438150644471662), "17");
addFace(["242", "236", "0"], "18");
setUVsToFace(new Point(0.449057459831238, 0.786883890628815), new Point(0.680898904800415, 0.788993895053864), new Point(0.680204451084137, 0.82706356048584), "18");
addFace(["0", "17", "242"], "19");
setUVsToFace(new Point(0.680204451084137, 0.82706356048584), new Point(0.429266005754471, 0.828338146209717), new Point(0.449057459831238, 0.786883890628815), "19");
addFace(["111", "110", "109", "542", "107", "106", "113", "112"], "20");
setUVsToFace(new Point(0.144926476046172, 0.933339760763415), new Point(0.172123818857644, 0.906670527660602), new Point(0.210213295595201, 0.90704400729948), "20");
addFace(["339", "41", "49", "342", "51", "345", "327", "322"], "21");
setUVsToFace(new Point(0.194866861737572, 0.434520169153861), new Point(0.000999701273964024, 0.434196739232082), new Point(0.00114288798320484, 0.348530177056179), "21");
addFace(["20", "21", "253", "248"], "22");
setUVsToFace(new Point(0.696811974048615, 0.608739674091339), new Point(0.717033505439758, 0.64658921957016), new Point(0.429726421833038, 0.650062561035156), "22");
addFace(["125", "117", "116", "124"], "23");
setUVsToFace(new Point(0.720664024353027, 0.609107911586761), new Point(0.997405167113014, 0.608739609789137), new Point(0.968657553195953, 0.64686918258667), "23");
addFace(["171", "498", "532", "177"], "24");
setUVsToFace(new Point(0.5259999115027, 0.186606073864685), new Point(0.00100000004749745, 0.17688812315464), new Point(0.00170496455393732, 0.138803362846375), "24");
addFace(["420", "419", "426", "85"], "25");
setUVsToFace(new Point(0.986130058765411, 0.241269737482071), new Point(0.994258165359497, 0.241101831197739), new Point(0.994412964094812, 0.248604504217828), "25");
addFace(["513", "170", "171", "177", "160", "526", "174", "173"], "26");
setUVsToFace(new Point(0.334475785493851, 0.864890217781067), new Point(0.295709055579827, 0.837007911761638), new Point(0.288636806722702, 0.797724131197278), "26");
addFace(["278", "29", "283", "295", "294"], "27");
setUVsToFace(new Point(0.00100000004749745, 0.818199098110199), new Point(0.124854572117329, 0.815021812915802), new Point(0.128480864976449, 0.903473468710884), "27");
addFace(["512", "164", "480", "139"], "28");
setUVsToFace(new Point(0.800539521597836, 0.873731877938388), new Point(0.807949721813202, 0.894807994365692), new Point(0.756018459796906, 0.89599484205246), "28");
addFace(["11", "10", "214", "247"], "29");
setUVsToFace(new Point(0.867147207260132, 0.873732030391693), new Point(0.919091701507568, 0.873914897441864), new Point(0.912090241909027, 0.895130097866058), "29");
addFace(["410", "404", "74", "75"], "30");
setUVsToFace(new Point(0.996767699718475, 0.756322085857391), new Point(0.923799514770508, 0.756415247917175), new Point(0.923777401447296, 0.738996267318726), "30");
addFace(["174", "526", "491", "514"], "31");
setUVsToFace(new Point(0.529777765274048, 0.231235653162003), new Point(0.517599500290247, 0.193223425811485), new Point(0.973154485225677, 0.190236583352089), "31");
addFace(["17", "0", "263"], "32");
setUVsToFace(new Point(0.680485188961029, 0.690816342830658), new Point(0.429591625928879, 0.694413542747498), new Point(0.429266005754471, 0.656486988067627), "32");
addFace(["263", "105", "17"], "33");
setUVsToFace(new Point(0.429266005754471, 0.656486988067627), new Point(0.716558814048767, 0.653693079948425), new Point(0.680485188961029, 0.690816342830658), "33");
addFace(["14", "24", "25"], "34");
setUVsToFace(new Point(0.278565138578415, 0.81331479549408), new Point(0.271460831165314, 0.807635486125946), new Point(0.285767048597336, 0.807759821414948), "34");
addFace(["70", "369", "371", "393", "400", "387", "386"], "35");
setUVsToFace(new Point(0.148971572518349, 0.570294916629791), new Point(0.144551858901406, 0.438149179979759), new Point(0.219560356486275, 0.438173584237531), "35");
addFace(["121", "120", "470", "473"], "36");
setUVsToFace(new Point(0.765992999076843, 0.518001973628998), new Point(0.737245448835755, 0.479872400171089), new Point(0.98518830537796, 0.480202347040176), "36");
addFace(["313", "321", "40", "322", "327", "42"], "37");
setUVsToFace(new Point(0.425635631052046, 0.563493981490221), new Point(0.42549666762352, 0.663031160831451), new Point(0.297998875379562, 0.662853240966797), "37");
addFace(["356", "358", "362", "361"], "38");
setUVsToFace(new Point(0.824194354855646, 0.80448407238152), new Point(0.82417106628418, 0.787065088748932), new Point(0.961034595966339, 0.786883890628815), "38");
addFace(["233", "15", "263", "0"], "39");
setUVsToFace(new Point(0.429266005754471, 0.956920444965363), new Point(0.481192331066231, 0.955538932751288), new Point(0.474833011627197, 0.976955413818359), "39");
addFace(["61", "63", "371", "369"], "40");
setUVsToFace(new Point(0.393511593341827, 0.104779899120331), new Point(0.468520098185103, 0.104573182675952), new Point(0.468568027019501, 0.121992148458958), "40");
addFace(["74", "404", "414", "413"], "41");
setUVsToFace(new Point(0.854418587191811, 0.831060999791752), new Point(0.854498624801636, 0.848479926586151), new Point(0.785532116889954, 0.848796606063843), "41");
addFace(["264", "22", "105", "263"], "43");
setUVsToFace(new Point(0.99161958694458, 0.42120948433876), new Point(0.696187070700422, 0.414275161372971), new Point(0.705264568328857, 0.376386344432831), "43");
addFace(["120", "119", "467", "470"], "44");
setUVsToFace(new Point(0.748029768466949, 0.691822230815887), new Point(0.719281613826752, 0.653693079948425), new Point(0.996022760868073, 0.654057204723358), "44");
addFace(["289", "26", "30"], "45");
setUVsToFace(new Point(0.123704560101032, 0.716122806072235), new Point(0.126066163182259, 0.811503469944), new Point(0.00178503198549151, 0.812298953533173), "45");
addFace(["289", "30", "294"], "46");
setUVsToFace(new Point(0.123704560101032, 0.716122806072235), new Point(0.00178503198549151, 0.812298953533173), new Point(0.00100000004749745, 0.71285742521286), "46");
addFace(["295", "289", "294"], "47");
setUVsToFace(new Point(0.119173616170883, 0.71174544095993), new Point(0.123704560101032, 0.716122806072235), new Point(0.00100000004749745, 0.71285742521286), "47");
addFace(["289", "295", "283"], "48");
setUVsToFace(new Point(0.420923173427582, 0.77532035112381), new Point(0.414623290300369, 0.775261521339417), new Point(0.417073905467987, 0.770050644874573), "48");
addFace(["123", "124", "116", "114"], "49");
setUVsToFace(new Point(0.737295559741048, 0.560011832162371), new Point(0.737245380878448, 0.521920561790466), new Point(0.985188186168671, 0.521594226360321), "49");
addFace(["526", "160", "523", "491"], "50");
setUVsToFace(new Point(0.960685789585114, 0.00100000004749745), new Point(0.990251150157092, 0.0384766352194594), new Point(0.506083250045776, 0.0478901825845242), "50");
addFace(["221", "11", "247", "248"], "51");
setUVsToFace(new Point(0.756018459796906, 0.925514459609985), new Point(0.807963296281238, 0.925540131826481), new Point(0.801026046276093, 0.946776509284973), "51");
addFace(["392", "385", "387", "400", "389"], "52");
setUVsToFace(new Point(0.82417111208461, 0.808196908848844), new Point(0.88559827932335, 0.808114400175599), new Point(0.885621607303619, 0.825533509254456), "52");
addFace(["387", "385", "379", "380", "386"], "53");
setUVsToFace(new Point(0.781821608543396, 0.831451952457428), new Point(0.78177011013031, 0.848870933055878), new Point(0.644906931665348, 0.848466188246432), "53");
addFace(["426", "424", "420", "85"], "55");
setUVsToFace(new Point(0.139849387315019, 0.711745348667325), new Point(0.133644133806229, 0.717191278934479), new Point(0.128789022564888, 0.712023377418518), "55");
addFace(["139", "498", "171", "170"], "56");
setUVsToFace(new Point(0.00100000004749745, 0.326720982789993), new Point(0.00132014916744083, 0.288631051778793), new Point(0.526391372075931, 0.293044426879208), "56");
addFace(["501", "495", "523", "532"], "58");
setUVsToFace(new Point(0.811580300331116, 0.899880051612854), new Point(0.863524359474019, 0.89962511764311), new Point(0.856702029705048, 0.920898795127869), "58");
addFace(["25", "13", "253", "264", "14"], "59");
setUVsToFace(new Point(0.705991387367249, 0.924185514450073), new Point(0.750178158283234, 0.925347864627838), new Point(0.742695212364197, 0.946398258209229), "59");
addFace(["41", "303", "39", "320", "49"], "60");
setUVsToFace(new Point(0.288636714220047, 0.666888535022736), new Point(0.412532150745392, 0.666661620140076), new Point(0.412714415803719, 0.766198738608965), "60");
addFace(["466", "118", "117", "125"], "61");
setUVsToFace(new Point(0.429266005754471, 0.698089122772217), new Point(0.717934548854828, 0.697136342525482), new Point(0.70613169670105, 0.735266804695129), "61");
addFace(["114", "116", "117", "118", "119", "120", "121", "115"], "62");
setUVsToFace(new Point(0.152571285092902, 0.834574380643916), new Point(0.191999521339049, 0.807635712073443), new Point(0.239741335523747, 0.808640354054062), "62");
addFace(["498", "146", "501", "532"], "63");
setUVsToFace(new Point(0.745203343222609, 0.899654979150284), new Point(0.752398192882538, 0.92080545425415), new Point(0.700457513332367, 0.921462595462799), "63");
addFace(["13", "221", "248", "253"], "64");
setUVsToFace(new Point(0.807949841022491, 0.921884059906006), new Point(0.756018459796906, 0.92070209980011), new Point(0.763426721096039, 0.899625360965729), "64");
addFace(["541", "186", "204", "106"], "66");
setUVsToFace(new Point(0.208053603768349, 0.376386344432831), new Point(0.692556471774093, 0.376386342259056), new Point(0.672794103622437, 0.414477616548538), "66");
addFace(["495", "151", "491", "523"], "68");
setUVsToFace(new Point(0.923777401447296, 0.761338472366333), new Point(0.975706160068512, 0.7600457072258), new Point(0.969310104846954, 0.781451284885406), "68");
addFace(["106", "204", "193", "561"], "69");
setUVsToFace(new Point(0.530022084712982, 0.288631081581116), new Point(0.994762611824063, 0.288631051592002), new Point(0.975000262260437, 0.326722323894501), "69");
addFace(["379", "61", "369", "70", "380"], "70");
setUVsToFace(new Point(0.820485415305924, 0.825973521826605), new Point(0.683621828776085, 0.825789785325523), new Point(0.683645188808441, 0.80837070941925), "70");
addFace(["40", "339", "322"], "71");
setUVsToFace(new Point(0.208053603768349, 0.433137804269791), new Point(0.210736498236656, 0.418108105659485), new Point(0.248944520950317, 0.432682782411575), "71");
addFace(["320", "342", "49"], "72");
setUVsToFace(new Point(0.964688181877136, 0.791147589683533), new Point(0.96524178981781, 0.786883890628815), new Point(0.978878736495972, 0.790822446346283), "72");
addFace(["335", "345", "51"], "73");
setUVsToFace(new Point(0.52387934923172, 0.233958527445793), new Point(0.523953199386597, 0.238022133708), new Point(0.517599642276764, 0.237180113792419), "73");
addFace(["245", "19", "247", "214"], "74");
setUVsToFace(new Point(0.912561893463135, 0.742676019668579), new Point(0.920146882534027, 0.780891418457031), new Point(0.672374486923218, 0.776989579200745), "74");
addFace(["20", "248", "247", "19"], "76");
setUVsToFace(new Point(0.728076270241635, 0.565379823623378), new Point(0.995633900165558, 0.563315987586975), new Point(0.995927751064301, 0.601406216621399), "76");
addFace(["139", "480", "146", "498"], "78");
setUVsToFace(new Point(0.856638133525848, 0.924787700176239), new Point(0.863525032997131, 0.946040570735931), new Point(0.811580402999369, 0.945943017620121), "78");
addFace(["39", "303", "321", "313"], "79");
setUVsToFace(new Point(0.253124713897705, 0.100942701101303), new Point(0.252962291240692, 0.00140553305391222), new Point(0.501511693000793, 0.00100000004749745), "79");
addFace(["371", "63", "392", "389", "393"], "80");
setUVsToFace(new Point(0.429288145770664, 0.95190835522007), new Point(0.429266005754471, 0.93448930978775), new Point(0.524903535842896, 0.934367716312408), "80");
addFace(["348", "351", "356", "361"], "81");
setUVsToFace(new Point(0.00100000004749745, 0.5749551653862), new Point(0.00502568795725383, 0.438150573090806), new Point(0.141830280423164, 0.44217637181282), "81");
addFace(["123", "114", "115", "474"], "82");
setUVsToFace(new Point(0.720657289028168, 0.697814643383026), new Point(0.939801087730411, 0.697136276178911), new Point(0.92799037694931, 0.735264360904694), "82");
addFace(["177", "532", "523", "160"], "83");
setUVsToFace(new Point(0.51412832736969, 0.285000562667847), new Point(0.00100000004749745, 0.27919065952301), new Point(0.00143128389467978, 0.2411017965308), "83");
addFace(["541", "542", "543", "186"], "84");
setUVsToFace(new Point(0.208053603768349, 0.372755795717239), new Point(0.208053603768349, 0.334664553403854), new Point(0.700742389466726, 0.334664623312937), "84");
addFace(["501", "146", "480", "164", "165", "489", "151", "495"], "87");
setUVsToFace(new Point(0.270334608760591, 0.665910790317015), new Point(0.233872988313946, 0.702908296442287), new Point(0.181929510648501, 0.703287092076655), "87");
addFace(["561", "193", "554", "112"], "92");
setUVsToFace(new Point(0.288636744022369, 0.479872465133667), new Point(0.733614967687088, 0.479872410165679), new Point(0.725429058074951, 0.517963707447052), "92");
addFace(["22", "264", "253", "21"], "93");
setUVsToFace(new Point(0.429266104087683, 0.568061967719566), new Point(0.724741756916046, 0.563315987586975), new Point(0.725353479385376, 0.601402401924133), "93");
addFace(["236", "212", "233", "0"], "95");
setUVsToFace(new Point(0.651175856590271, 0.895175218582153), new Point(0.644906938076019, 0.873732030391693), new Point(0.696827066027214, 0.875332783294812), "95");
addFace(["42", "327", "345", "335"], "100");
setUVsToFace(new Point(0.995228837600081, 0.201442085784306), new Point(0.976127207279205, 0.201601669192314), new Point(0.986510038375854, 0.190236568450928), "100");
addFace(["516", "512", "513", "173"], "101");
setUVsToFace(new Point(0.989285046741765, 0.0515206500913409), new Point(0.989645779132843, 0.0896102264523506), new Point(0.50530469417572, 0.0941986888647079), "101");
addFace(["380", "70", "386"], "103");
setUVsToFace(new Point(0.998938798904419, 0.0515516959130764), new Point(0.995626926422119, 0.0572258606553078), new Point(0.992368876934052, 0.0515206716954708), "103");
addFace(["400", "393", "389"], "104");
setUVsToFace(new Point(0.284219264984131, 0.591884076595306), new Point(0.271242022514343, 0.577750205993652), new Point(0.285693824291229, 0.577505528926849), "104");
addFace(["514", "489", "165", "516"], "105");
setUVsToFace(new Point(0.651560346300955, 0.92130642178877), new Point(0.644906938076019, 0.899979472160339), new Point(0.696847498416901, 0.900646507740021), "105");
addFace(["491", "151", "489", "514"], "107");
setUVsToFace(new Point(0.706882936843934, 0.895128732286008), new Point(0.700457513332367, 0.873732030391693), new Point(0.752388000488281, 0.874953389167786), "107");
addFace(["414", "404", "410"], "109");
setUVsToFace(new Point(0.537338376045227, 0.997399806976318), new Point(0.534773111343384, 0.928480327129364), new Point(0.60773378610611, 0.927438020706177), "109");
addFace(["552", "553", "112", "554"], "111");
setUVsToFace(new Point(0.733614802360535, 0.559685468673706), new Point(0.288636714220047, 0.559685528278351), new Point(0.288636798061403, 0.521594275822603), "111");
addFace(["415", "419", "420"], "112");
setUVsToFace(new Point(0.116263389587402, 0.910515427589417), new Point(0.108486376702785, 0.91643625497818), new Point(0.103368356823921, 0.910119593143463), "112");
addFace(["415", "420", "424"], "113");
setUVsToFace(new Point(0.265862286090851, 0.131683826446533), new Point(0.252962291240692, 0.131512582302094), new Point(0.257495582103729, 0.126060143113136), "113");
addFace(["415", "424", "426"], "114");
setUVsToFace(new Point(0.139073923230171, 0.822358250617981), new Point(0.131203755736351, 0.816058397293091), new Point(0.139394477009773, 0.815021812915802), "114");
addFace(["139", "170", "513", "512"], "116");
setUVsToFace(new Point(0.51396906375885, 0.228275448083878), new Point(0.000999886016805118, 0.237471385181663), new Point(0.0291446689516306, 0.198916435241699), "116");
addFace(["452", "444", "446", "451"], "117");
setUVsToFace(new Point(0.283359017174716, 0.704194491069847), new Point(0.277153789997101, 0.709640324115753), new Point(0.272298663854599, 0.704472362995148), "117");
addFace(["121", "473", "474", "115"], "118");
setUVsToFace(new Point(0.776770234107971, 0.438150614500046), new Point(0.995913803577423, 0.43887385725975), new Point(0.995788053522641, 0.476964951262113), "118");
addFace(["429", "87", "88"], "119");
setUVsToFace(new Point(0.237790197134018, 0.913293421268463), new Point(0.249093845486641, 0.90667051076889), new Point(0.253467977046967, 0.913523375988007), "119");
addFace(["429", "88", "89"], "120");
setUVsToFace(new Point(0.711422741413116, 0.427732288837433), new Point(0.696187078952789, 0.431436538696289), new Point(0.696210622787476, 0.423932313919067), "120");
addFace(["429", "89", "439"], "121");
setUVsToFace(new Point(0.411450773477554, 0.875059425830841), new Point(0.395780950784683, 0.875609040260315), new Point(0.400014489889145, 0.868668437004089), "121");
addFace(["88", "91", "89"], "123");
setUVsToFace(new Point(0.995973408222198, 0.146727606654167), new Point(0.992112934589386, 0.14276547729969), new Point(0.996370792388916, 0.139233887195587), "123");
addFace(["89", "91", "439"], "124");
setUVsToFace(new Point(0.996370792388916, 0.139233887195587), new Point(0.992112934589386, 0.14276547729969), new Point(0.988252341747284, 0.138803362846375), "124");
addFace(["92", "445", "446"], "126");
setUVsToFace(new Point(0.0138950413092971, 0.989499032497406), new Point(0.00611802702769637, 0.995419859886169), new Point(0.00100000004749745, 0.989103257656097), "126");
addFace(["92", "446", "444"], "127");
setUVsToFace(new Point(0.624264240264893, 0.93306165933609), new Point(0.611364245414734, 0.932890474796295), new Point(0.615897476673126, 0.927438020706177), "127");
addFace(["92", "444", "452"], "128");
setUVsToFace(new Point(0.424215078353882, 0.673998177051544), new Point(0.416344881057739, 0.667698264122009), new Point(0.424535602331161, 0.666661620140076), "128");
addFace(["445", "451", "446"], "129");
setUVsToFace(new Point(0.139352053403854, 0.581703722476959), new Point(0.135365471243858, 0.585539042949677), new Point(0.131223917007446, 0.581871628761292), "129");
addFace(["452", "451", "445"], "132");
setUVsToFace(new Point(0.139507055282593, 0.589206457138062), new Point(0.135365471243858, 0.585539042949677), new Point(0.139352053403854, 0.581703722476959), "132");
addFace(["245", "242", "17"], "133");
setUVsToFace(new Point(0.392150431871414, 0.94109708070755), new Point(0.367058038711548, 0.971848547458649), new Point(0.321142494678497, 0.970795929431915), "133");
addFace(["17", "105", "22"], "134");
setUVsToFace(new Point(0.321142494678497, 0.970795929431915), new Point(0.288964539766312, 0.931840360164642), new Point(0.288636714220047, 0.89324688911438), "134");
addFace(["22", "21", "20"], "135");
setUVsToFace(new Point(0.288636714220047, 0.89324688911438), new Point(0.318627297878265, 0.868668437004089), new Point(0.361368328332901, 0.872502684593201), "135");
addFace(["17", "22", "20"], "136");
setUVsToFace(new Point(0.321142494678497, 0.970795929431915), new Point(0.288636714220047, 0.89324688911438), new Point(0.361368328332901, 0.872502684593201), "136");
addFace(["245", "17", "20"], "137");
setUVsToFace(new Point(0.392150431871414, 0.94109708070755), new Point(0.321142494678497, 0.970795929431915), new Point(0.361368328332901, 0.872502684593201), "137");
addFace(["19", "245", "20"], "138");
setUVsToFace(new Point(0.39182260632515, 0.902503550052643), new Point(0.392150431871414, 0.94109708070755), new Point(0.361368328332901, 0.872502684593201), "138");
addFace(["214", "10", "212", "236"], "143");
setUVsToFace(new Point(0.948677775298035, 0.718612860001078), new Point(0.942523956298828, 0.697136342525482), new Point(0.994434773921967, 0.69901579618454), "143");
addFace(["278", "294", "30", "280"], "240");
setUVsToFace(new Point(0.100537203252316, 0.910119593143463), new Point(0.100645497441292, 0.986238777637482), new Point(0.00110829574987292, 0.986380457878113), "240");
addSurface(["9", "114", "56", "53", "1", "34", "40", "133", "12", "128", "70", "82", "116", "41", "137", "117", "118", "84", "92", "83", "46", "80", "59", "61", "93", "72", "87", "113", "33", "101", "28", "104", "120", "24", "48", "76", "105", "121", "58", "100", "25", "27", "19", "127", "62", "38", "29", "123", "5", "39", "4", "66", "37", "68", "43", "16", "132", "69", "240", "138", "136", "79", "17", "134", "143", "30", "60", "78", "52", "129", "111", "119", "49", "3", "135", "23", "51", "31", "112", "81", "50", "103", "124", "73", "47", "44", "35", "74", "107", "6", "18", "95", "109", "32", "26", "22", "45", "126", "21", "0", "55", "2", "15", "13", "7", "71", "63", "36", "8", "20", "64", "14", "11", "10"], "Wrecks");
setMaterialToSurface(material, "Wrecks");
}
private function onLoadComplete(_arg1:Event):void{
material.texture = new TextureData(Bitmap(loader.content).bitmapData);
complete();
}
public function load(_arg1:Function):String{
this.onLoadMethod = _arg1;
loader = new Loader();
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onLoadComplete);
loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, onLoadError);
loader.contentLoaderInfo.addEventListener(IOErrorEvent.NETWORK_ERROR, onLoadError);
loader.contentLoaderInfo.addEventListener(IOErrorEvent.VERIFY_ERROR, onLoadError);
loader.load(new URLRequest("wrecks.jpg"), new LoaderContext(false, ApplicationDomain.currentDomain));
return ("Loading wrecks texture");
}
private function complete():void{
onLoadMethod.call();
loader.contentLoaderInfo.removeEventListener(Event.COMPLETE, onLoadComplete);
loader.contentLoaderInfo.removeEventListener(IOErrorEvent.IO_ERROR, onLoadError);
loader.contentLoaderInfo.removeEventListener(IOErrorEvent.NETWORK_ERROR, onLoadError);
loader.contentLoaderInfo.removeEventListener(IOErrorEvent.VERIFY_ERROR, onLoadError);
onLoadMethod = null;
loader = null;
}
private function onLoadError(_arg1:IOErrorEvent):void{
complete();
}
}
}//package temple
Section 54
//Wrecks_Bmp (temple.Wrecks_Bmp)
package temple {
import mx.core.*;
public class Wrecks_Bmp extends BitmapAsset {
}
}//package temple
Section 55
//Temple (Temple)
package {
import flash.events.*;
import com.alternativagame.engine3d.*;
import com.alternativagame.type.*;
import flash.geom.*;
import com.alternativagame.engine3d.collision.*;
import flash.display.*;
import flash.text.*;
import temple.*;
import flash.utils.*;
import com.alternativagame.admin.*;
import com.alternativagame.utility.*;
import flash.ui.*;
public class Temple extends Sprite {
private const offsetTreshold:Number = 0.01;
private const gravity:Number = 1;
private const jumpSize:Number = 9;
private const maxVelocity:Number = 2;
private const acceleration:Number = 3;
private const radius:Number;
private const tick:Number = 20;
private const stature:Number = 62.992;
private const coordsTreshold:Number = 0.25;
private const runMultiplier:Number = 2.5;
private const maxAngle:Number;
private const friction:Number = 0.8;
private var prevDragCoords:Point;
private var left:Boolean;// = false
private var loadingInfo:TextField;
private var environment:Environment;
private var right:Boolean;// = false
private var loadingSequence:Array;
private var limits:Limits;
private var loadingCounter:int;// = -1
private var camera:Camera3D;
private var coords:Point3D;
private var jump:Boolean;// = false
private var timer:uint;
private var lastCollisionMesh:Mesh;
private var stairs:Stairs;
private var screenMultiplier:uint;// = 10
private var debug:Boolean;// = false
private var low:Boolean;// = false
private var fly:Boolean;// = false
private var startDragCoords:Point;
private var precision:Number;// = 20
private var qualityTimer:uint;// = 0
private var ground:Ground;
private var run:Boolean;// = false
private var scene:Scene3D;
private var up:Boolean;// = false
private var soundManager:SoundManager;
private var down:Boolean;// = false
private var stones:Stones;
private var currentDragCoords:Point;
private var columns:Columns;
private var wrecks:Wrecks;
private var startRotX:Number;
private var velocity:Point3D;
private var startRotZ:Number;
private var previousCollision:Collision;
private var qualityTimerMax:uint;// = 20
private static const bmpLogo:Class = Temple_bmpLogo;
private static const logoBmp:BitmapData = new bmpLogo().bitmapData;
public function Temple(){
environment = new Environment();
limits = new Limits();
stones = new Stones();
columns = new Columns();
stairs = new Stairs();
ground = new Ground();
wrecks = new Wrecks();
soundManager = new SoundManager();
currentDragCoords = new Point();
radius = ((15.748 + 5) + 5);
maxAngle = MathUtility.toRadian(40);
velocity = new Point3D();
coords = new Point3D(150, 60, 25);
lastCollisionMesh = wrecks;
loadingSequence = [stairs, columns, stones, ground, wrecks, environment, soundManager];
super();
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.align = StageAlign.TOP_LEFT;
stage.frameRate = 100;
MouseUtility.init(stage);
scene = new Scene3D();
scene.root = new Object3D("root");
environment.rotZ = -0.34;
environment.mobile = 0;
scene.root.addObject(environment);
limits.mobile = 5;
scene.root.addObject(limits);
ground.mobile = 2;
scene.root.addObject(ground);
stairs.mobile = 3;
scene.root.addObject(stairs);
columns.mobile = 4;
scene.root.addObject(columns);
stones.mobile = 4;
scene.root.addObject(stones);
wrecks.mobile = 4;
scene.root.addObject(wrecks);
scene.calculate();
camera = new Camera3D("camera");
camera.fov = MathUtility.toRadian(120);
camera.rotX = -1.5;
camera.rotZ = 2.1;
camera.x = coords.x;
camera.y = coords.y;
camera.z = ((coords.z + stature) - radius);
scene.root.addObject(camera);
addChild(camera.view);
FPS.init(this);
var _local1:Bitmap = new Bitmap(logoBmp);
_local1.x = 3;
_local1.y = 3;
addChild(_local1);
var _local2:TestInfo = new TestInfo();
_local2.x = 3;
_local2.y = 46;
_local2.write("Drag — look");
_local2.write("WSAD or arrows — move");
_local2.write("Shift — run");
_local2.write("Space — jump");
_local2.write("Wheel or [ ] — change FOV");
_local2.write("+/- — change screen size");
_local2.write("T — show triangulation");
addChild(_local2);
loadingInfo = new TextField();
loadingInfo.x = 3;
loadingInfo.text = " ";
loadingInfo.autoSize = TextFieldAutoSize.LEFT;
loadingInfo.selectable = false;
loadingInfo.setTextFormat(new TextFormat("Tahoma", 10, 0xFF0000));
loadingInfo.defaultTextFormat = new TextFormat("Tahoma", 10, 0xFF0000);
addChild(loadingInfo);
loadNext();
onResize(null);
addEventListener(Event.ENTER_FRAME, onEnterFrame);
stage.addEventListener(KeyboardEvent.KEY_DOWN, onKeyDown);
stage.addEventListener(KeyboardEvent.KEY_UP, onKeyUp);
stage.addEventListener(MouseEvent.MOUSE_DOWN, onMouseDown);
stage.addEventListener(MouseEvent.MOUSE_WHEEL, onMouseWheel);
stage.addEventListener(Event.RESIZE, onResize);
}
private function onMouseUp(_arg1:MouseEvent):void{
startDragCoords = null;
stage.removeEventListener(MouseEvent.MOUSE_UP, onMouseUp);
}
private function addFOV(_arg1:Number):void{
var _local2:Number = (camera.fov - _arg1);
camera.fov = ((_local2)<MathUtility.degree30) ? MathUtility.degree30 : ((_local2)>MathUtility.toRadian(170)) ? MathUtility.toRadian(170) : _local2;
}
private function onResize(_arg1:Event):void{
var _local2:Number = ((stage.stageWidth * screenMultiplier) / 10);
var _local3:Number = ((stage.stageHeight * screenMultiplier) / 10);
var _local4:Number = Math.sqrt(((_local2 * _local2) + (_local3 * _local3)));
camera.view.x = ((stage.stageWidth - _local2) >> 1);
camera.view.y = ((stage.stageHeight - _local3) >> 1);
camera.view.width = _local2;
camera.view.height = _local3;
camera.viewRadius = _local4;
loadingInfo.y = ((stage.stageHeight - loadingInfo.height) - 1);
}
private function changeDebug():void{
debug = !(debug);
TextureMaterial(environment.getSurfaceById("left").material).debug = debug;
TextureMaterial(environment.getSurfaceById("right").material).debug = debug;
TextureMaterial(environment.getSurfaceById("front").material).debug = debug;
TextureMaterial(environment.getSurfaceById("back").material).debug = debug;
TextureMaterial(environment.getSurfaceById("top").material).debug = debug;
stones.material.debug = debug;
columns.material.debug = debug;
stairs.material.debug = debug;
ground.material.debug = debug;
wrecks.material.debug = debug;
}
private function changeMove():void{
var _local1:Point3D;
var _local2:Point3D;
var _local3:*;
var _local4:*;
fly = !(fly);
if (fly){
coords.z = camera.z;
} else {
_local1 = new Point3D(0, 0, (-(stature) + radius));
_local2 = Point3D.sum(coords, _local1);
do {
_local3 = scene.calculateCollision(coords, _local1, radius);
} while (_local3 == null);
coords.x = _local2.x;
coords.y = _local2.y;
coords.z = _local2.z;
velocity.z = (-(gravity) - coordsTreshold);
};
}
private function onEnterFrame(_arg1:Event):void{
var _local3:Number;
var _local4:Number;
var _local5:Matrix3D;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Collision;
var _local10:Point3D;
var _local11:*;
var _local12:*;
var _local2:Number = ((getTimer() - timer) / tick);
if (_local2 > 10){
_local2 = 10;
};
timer = getTimer();
if (startDragCoords != null){
prevDragCoords = currentDragCoords;
currentDragCoords = MouseUtility.globalCoords(false);
if (!startDragCoords.equals(currentDragCoords)){
camera.rotZ = (startRotZ + (((startDragCoords.x - currentDragCoords.x) / screenMultiplier) / 10));
camera.rotX = (startRotX + (((startDragCoords.y - currentDragCoords.y) / screenMultiplier) / 10));
camera.rotX = ((camera.rotX)>0) ? 0 : ((camera.rotX)<-(MathUtility.degree180)) ? -(MathUtility.degree180) : camera.rotX;
};
};
if (((((((up) || (down))) || (left))) || (right))){
_local3 = (acceleration * _local2);
_local4 = (maxVelocity * _local2);
if (run){
_local3 = (_local3 * runMultiplier);
_local4 = (_local4 * runMultiplier);
};
if (fly){
_local5 = Matrix3D.rotationMatrix(camera.rotX, camera.rotY, camera.rotZ);
if (up){
velocity.x = (velocity.x + (_local5.c * _local3));
velocity.y = (velocity.y + (_local5.g * _local3));
velocity.z = (velocity.z + (_local5.k * _local3));
} else {
if (down){
velocity.x = (velocity.x - (_local5.c * _local3));
velocity.y = (velocity.y - (_local5.g * _local3));
velocity.z = (velocity.z - (_local5.k * _local3));
};
};
if (right){
velocity.x = (velocity.x + (_local5.a * _local3));
velocity.y = (velocity.y + (_local5.e * _local3));
velocity.z = (velocity.z + (_local5.i * _local3));
} else {
if (left){
velocity.x = (velocity.x - (_local5.a * _local3));
velocity.y = (velocity.y - (_local5.e * _local3));
velocity.z = (velocity.z - (_local5.i * _local3));
};
};
if (velocity.length > _local4){
velocity.length = _local4;
};
soundManager.stopSteps();
} else {
if (up){
velocity.x = (velocity.x - (Math.sin(camera.rotZ) * _local3));
velocity.y = (velocity.y + (Math.cos(camera.rotZ) * _local3));
} else {
if (down){
velocity.x = (velocity.x + (Math.sin(camera.rotZ) * _local3));
velocity.y = (velocity.y - (Math.cos(camera.rotZ) * _local3));
};
};
if (right){
velocity.x = (velocity.x + (Math.cos(camera.rotZ) * _local3));
velocity.y = (velocity.y + (Math.sin(camera.rotZ) * _local3));
} else {
if (left){
velocity.x = (velocity.x - (Math.cos(camera.rotZ) * _local3));
velocity.y = (velocity.y - (Math.sin(camera.rotZ) * _local3));
};
};
_local6 = Math.sqrt(((velocity.x * velocity.x) + (velocity.y * velocity.y)));
if (_local6 > _local4){
velocity.x = (velocity.x * (_local4 / _local6));
velocity.y = (velocity.y * (_local4 / _local6));
};
soundManager.playSteps(((lastCollisionMesh)==ground) ? (run) ? SoundManager.GRASS_RUN : SoundManager.GRASS_WALK : (run) ? SoundManager.STONE_RUN : SoundManager.STONE_WALK);
};
} else {
_local7 = Math.pow(friction, _local2);
velocity.x = (velocity.x * _local7);
velocity.y = (velocity.y * _local7);
velocity.z = (velocity.z * (fly) ? _local7 : 1);
soundManager.stopSteps();
};
if (!fly){
_local8 = (-(gravity) * _local2);
_local9 = scene.calculateCollision(coords, new Point3D(0, 0, _local8), radius);
if ((((((_local9 == null)) || ((_local9.normal.z <= 0)))) || ((Math.acos(_local9.normal.z) > maxAngle)))){
velocity.z = (velocity.z + _local8);
previousCollision = null;
} else {
lastCollisionMesh = _local9.face.mesh;
if (jump){
velocity.z = (velocity.z + jumpSize);
};
if (previousCollision == null){
soundManager.playSteps(((lastCollisionMesh)==ground) ? (run) ? SoundManager.GRASS_RUN : SoundManager.GRASS_WALK : (run) ? SoundManager.STONE_RUN : SoundManager.STONE_WALK);
};
previousCollision = _local9;
};
};
if ((((((((((((velocity.x > coordsTreshold)) || ((velocity.x < -(coordsTreshold))))) || ((velocity.y > coordsTreshold)))) || ((velocity.y < -(coordsTreshold))))) || ((velocity.z > coordsTreshold)))) || ((velocity.z < -(coordsTreshold))))){
_local10 = Point3D.sum(coords, velocity);
do {
_local11 = scene.calculateCollision(coords, velocity, radius);
} while (_local11 == null);
coords.x = _local10.x;
coords.y = _local10.y;
coords.z = _local10.z;
if (((((((((((camera.x - coords.x) > coordsTreshold)) || (((camera.x - coords.x) < -(coordsTreshold))))) || (((camera.y - coords.y) > coordsTreshold)))) || (((camera.y - coords.y) < -(coordsTreshold))))) || ((fly) ? ((((camera.z - coords.z) > coordsTreshold)) || (((camera.z - coords.z) < -(coordsTreshold)))) : ((((((camera.z - coords.z) - stature) + radius) > coordsTreshold)) || (((((camera.z - coords.z) - stature) + radius) < -(coordsTreshold))))))){
camera.x = coords.x;
camera.y = coords.y;
camera.z = (coords.z + (fly) ? 0 : (stature - radius));
};
} else {
velocity.x = 0;
velocity.y = 0;
velocity.z = 0;
};
checkQuality();
scene.calculate();
jump = false;
}
private function onKeyUp(_arg1:KeyboardEvent):void{
switch (_arg1.keyCode){
case Keyboard.SHIFT:
run = false;
break;
case 87:
case Keyboard.UP:
up = false;
break;
case 83:
case Keyboard.DOWN:
down = false;
break;
case 65:
case Keyboard.LEFT:
left = false;
break;
case 68:
case Keyboard.RIGHT:
right = false;
break;
};
}
private function onMouseDown(_arg1:MouseEvent):void{
startDragCoords = MouseUtility.globalCoords(false);
currentDragCoords = startDragCoords.clone();
prevDragCoords = startDragCoords.clone();
startRotX = camera.rotX;
startRotZ = camera.rotZ;
stage.addEventListener(MouseEvent.MOUSE_UP, onMouseUp);
}
private function onKeyDown(_arg1:KeyboardEvent):void{
var _local2:*;
switch (_arg1.keyCode){
case Keyboard.SPACE:
jump = true;
break;
case Keyboard.SHIFT:
run = true;
break;
case 84:
changeDebug();
break;
case 107:
case 187:
if (screenMultiplier < 10){
screenMultiplier++;
onResize(null);
};
break;
case 109:
case 189:
if (screenMultiplier > 1){
screenMultiplier--;
onResize(null);
};
break;
case 219:
addFOV((-3 / 20));
break;
case 221:
addFOV((3 / 20));
break;
case 87:
case Keyboard.UP:
up = true;
break;
case 83:
case Keyboard.DOWN:
down = true;
break;
case 65:
case Keyboard.LEFT:
left = true;
break;
case 68:
case Keyboard.RIGHT:
right = true;
break;
};
}
private function checkQuality():void{
if (((((!((startDragCoords == null))) && (!(prevDragCoords.equals(currentDragCoords))))) || ((velocity.length > coordsTreshold)))){
if (qualityTimer != qualityTimerMax){
qualityTimer = qualityTimerMax;
stage.quality = StageQuality.LOW;
TextureMaterial(environment.getSurfaceById("left").material).precision = precision;
TextureMaterial(environment.getSurfaceById("right").material).precision = precision;
TextureMaterial(environment.getSurfaceById("front").material).precision = precision;
TextureMaterial(environment.getSurfaceById("back").material).precision = precision;
TextureMaterial(environment.getSurfaceById("top").material).precision = precision;
stones.material.precision = precision;
columns.material.precision = precision;
stairs.material.precision = precision;
ground.material.precision = precision;
wrecks.material.precision = precision;
};
} else {
if (qualityTimer > 0){
qualityTimer--;
if (qualityTimer == 0){
stage.quality = StageQuality.HIGH;
TextureMaterial(environment.getSurfaceById("left").material).precision = 1;
TextureMaterial(environment.getSurfaceById("right").material).precision = 1;
TextureMaterial(environment.getSurfaceById("front").material).precision = 1;
TextureMaterial(environment.getSurfaceById("back").material).precision = 1;
TextureMaterial(environment.getSurfaceById("top").material).precision = 1;
stones.material.precision = 1;
columns.material.precision = 1;
stairs.material.precision = 1;
ground.material.precision = 1;
wrecks.material.precision = 1;
};
};
};
}
private function onMouseWheel(_arg1:MouseEvent):void{
addFOV((_arg1.delta / 20));
}
public function loadNext():void{
loadingInfo.text = " ";
loadingCounter++;
if (loadingCounter < loadingSequence.length){
loadingInfo.text = loadingSequence[loadingCounter].load(loadNext);
};
}
}
}//package
import flash.text.*;
class TestInfo extends TextField {
private function TestInfo(){
autoSize = TextFieldAutoSize.LEFT;
selectable = false;
text = ("Alternativa3D 5.0 M1\nDemo \"Temple\"" + "\n");
setTextFormat(new TextFormat("Tahoma", 10, 12281395));
defaultTextFormat = new TextFormat("Tahoma", 10, 0x333333);
}
public function write(_arg1:String):void{
appendText(("\n" + _arg1));
}
}
Section 56
//Temple_bmpLogo (Temple_bmpLogo)
package {
import mx.core.*;
public class Temple_bmpLogo extends BitmapAsset {
}
}//package