Section 1
//Blocker (away3d.core.block.Blocker)
package away3d.core.block {
import away3d.core.draw.*;
public class Blocker extends DrawPrimitive {
public function block(_arg1:DrawPrimitive):Boolean{
return (false);
}
}
}//package away3d.core.block
Section 2
//BlockerArray (away3d.core.block.BlockerArray)
package away3d.core.block {
import away3d.core.render.*;
public class BlockerArray implements IBlockerConsumer {
private var _clip:Clipping;
private var _blockers:Array;
var blockers:Array;
public function set clip(_arg1:Clipping):void{
_clip = _arg1;
_blockers = [];
}
public function list():Array{
blockers = _blockers;
_blockers = null;
blockers.sortOn("screenZ", Array.NUMERIC);
return (blockers);
}
public function blocker(_arg1:Blocker):void{
if (_clip.check(_arg1)){
_blockers.push(_arg1);
};
}
}
}//package away3d.core.block
Section 3
//IBlockerConsumer (away3d.core.block.IBlockerConsumer)
package away3d.core.block {
public interface IBlockerConsumer {
function blocker(_arg1:Blocker):void;
}
}//package away3d.core.block
Section 4
//IBlockerProvider (away3d.core.block.IBlockerProvider)
package away3d.core.block {
public interface IBlockerProvider {
function blockers(_arg1:IBlockerConsumer):void;
}
}//package away3d.core.block
Section 5
//DrawDisplayObject (away3d.core.draw.DrawDisplayObject)
package away3d.core.draw {
import flash.display.*;
import away3d.core.render.*;
import away3d.core.scene.*;
public class DrawDisplayObject extends DrawPrimitive {
public var v:ScreenVertex;
public var displayobject:DisplayObject;
public var session:RenderSession;
public function DrawDisplayObject(_arg1:Object3D, _arg2:DisplayObject, _arg3:ScreenVertex, _arg4:RenderSession){
this.source = _arg1;
this.displayobject = _arg2;
this.v = _arg3;
this.session = _arg4;
calc();
}
override public function clear():void{
displayobject = null;
}
public function calc():void{
screenZ = v.z;
minZ = screenZ;
maxZ = screenZ;
minX = (v.x - (displayobject.width / 2));
minY = (v.y - (displayobject.height / 2));
maxX = (v.x + (displayobject.width / 2));
maxY = (v.y + (displayobject.height / 2));
}
override public function render():void{
displayobject.x = v.x;
displayobject.y = v.y;
session.addDisplayObject(displayobject);
}
override public function contains(_arg1:Number, _arg2:Number):Boolean{
return (true);
}
}
}//package away3d.core.draw
Section 6
//DrawPrimitive (away3d.core.draw.DrawPrimitive)
package away3d.core.draw {
import away3d.core.render.*;
import away3d.core.scene.*;
public class DrawPrimitive {
public var create:Function;
public var minX:Number;
public var minZ:Number;
public var projection:Projection;
public var source:Object3D;
public var minY:Number;
public var screenZ:Number;
public var maxX:Number;
public var maxY:Number;
public var quadrant:PrimitiveQuadrantTreeNode;
public var maxZ:Number;
public function getZ(_arg1:Number, _arg2:Number):Number{
return (screenZ);
}
public function clear():void{
}
public function render():void{
throw (new Error("Not implemented"));
}
public function contains(_arg1:Number, _arg2:Number):Boolean{
return (false);
}
public function shade():void{
throw (new Error("Not implemented"));
}
public function quarter(_arg1:Number):Array{
return (null);
}
public function toString():String{
return ((((((("P{ screenZ = " + screenZ) + ", minZ = ") + minZ) + ", maxZ = ") + maxZ) + " }"));
}
protected static function assert(_arg1:Boolean, _arg2:String="Assert failure"):void{
if (!_arg1){
throw (new Error(_arg2));
};
}
}
}//package away3d.core.draw
Section 7
//DrawScaledBitmap (away3d.core.draw.DrawScaledBitmap)
package away3d.core.draw {
import flash.display.*;
import away3d.core.scene.*;
import flash.geom.*;
public class DrawScaledBitmap extends DrawPrimitive {
private var sinh:Number;
public var width:Number;
private var sinw:Number;
public var height:Number;
public var left:ScreenVertex;
public var smooth:Boolean;
public var bitmap:BitmapData;
public var bottomleft:ScreenVertex;
private var cos:Number;
private var bounds:ScreenVertex;
private var cosh:Number;
public var scale:Number;
private var cosw:Number;
public var bottomright:ScreenVertex;
public var top:ScreenVertex;
private var sin:Number;
public var topleft:ScreenVertex;
private var mapping:Matrix;
public var topright:ScreenVertex;
public var v:ScreenVertex;
public var rotation:Number;
public function DrawScaledBitmap(_arg1:Object3D, _arg2:BitmapData, _arg3:ScreenVertex, _arg4:Number, _arg5:Number, _arg6:Boolean){
topleft = new ScreenVertex();
topright = new ScreenVertex();
bottomleft = new ScreenVertex();
bottomright = new ScreenVertex();
left = new ScreenVertex();
top = new ScreenVertex();
super();
this.source = _arg1;
this.bitmap = _arg2;
this.v = _arg3;
this.scale = _arg4;
this.rotation = _arg5;
this.smooth = _arg6;
calc();
}
override public function render():void{
var _local1:Graphics;
mapping = new Matrix((scale * cos), (-(scale) * sin), (scale * sin), (scale * cos), topleft.x, topleft.y);
_local1 = source.session.graphics;
_local1.lineStyle();
if (rotation != 0){
_local1.beginBitmapFill(bitmap, mapping, false, smooth);
_local1.moveTo(topleft.x, topleft.y);
_local1.lineTo(topright.x, topright.y);
_local1.lineTo(bottomright.x, bottomright.y);
_local1.lineTo(bottomleft.x, bottomleft.y);
_local1.lineTo(topleft.x, topleft.y);
_local1.endFill();
} else {
_local1.beginBitmapFill(bitmap, mapping, false, smooth);
_local1.drawRect(minX, minY, (maxX - minX), (maxY - minY));
};
}
override public function contains(_arg1:Number, _arg2:Number):Boolean{
var _local3:Point;
var _local4:uint;
if (rotation != 0){
if ((((topleft.x * (_arg2 - topright.y)) + (topright.x * (topleft.y - _arg2))) + (_arg1 * (topright.y - topleft.y))) > 0.001){
return (false);
};
if ((((topright.x * (_arg2 - bottomright.y)) + (bottomright.x * (topright.y - _arg2))) + (_arg1 * (bottomright.y - topright.y))) > 0.001){
return (false);
};
if ((((bottomright.x * (_arg2 - bottomleft.y)) + (bottomleft.x * (bottomright.y - _arg2))) + (_arg1 * (bottomleft.y - bottomright.y))) > 0.001){
return (false);
};
if ((((bottomleft.x * (_arg2 - topleft.y)) + (topleft.x * (bottomleft.y - _arg2))) + (_arg1 * (topleft.y - bottomleft.y))) > 0.001){
return (false);
};
};
if (!bitmap.transparent){
return (true);
};
mapping = new Matrix((scale * cos), (-(scale) * sin), (scale * sin), (scale * cos), topleft.x, topleft.y);
mapping.invert();
_local3 = mapping.transformPoint(new Point(_arg1, _arg2));
if (_local3.x < 0){
_local3.x = 0;
};
if (_local3.y < 0){
_local3.y = 0;
};
if (_local3.x >= bitmap.width){
_local3.x = (bitmap.width - 1);
};
if (_local3.y >= bitmap.height){
_local3.y = (bitmap.height - 1);
};
_local4 = bitmap.getPixel32(int(_local3.x), int(_local3.y));
return ((uint((_local4 >> 24)) > 128));
}
override public function clear():void{
bitmap = null;
}
public function calc():void{
var _local1:Array;
screenZ = v.z;
minZ = screenZ;
maxZ = screenZ;
width = (bitmap.width * scale);
height = (bitmap.height * scale);
cos = Math.cos(((rotation * Math.PI) / 180));
sin = Math.sin(((rotation * Math.PI) / 180));
cosw = ((cos * width) / 2);
cosh = ((cos * height) / 2);
sinw = ((sin * width) / 2);
sinh = ((sin * height) / 2);
topleft.x = ((v.x - cosw) - sinh);
topleft.y = ((v.y + sinw) - cosh);
topright.x = ((v.x + cosw) - sinh);
topright.y = ((v.y - sinw) - cosh);
bottomleft.x = ((v.x - cosw) + sinh);
bottomleft.y = ((v.y + sinw) + cosh);
bottomright.x = ((v.x + cosw) + sinh);
bottomright.y = ((v.y - sinw) + cosh);
if (rotation != 0){
_local1 = new Array();
_local1.push(topleft);
_local1.push(topright);
_local1.push(bottomleft);
_local1.push(bottomright);
minX = 100000;
minY = 100000;
maxX = -100000;
maxY = -100000;
for each (bounds in _local1) {
if (minX > bounds.x){
minX = bounds.x;
};
if (maxX < bounds.x){
maxX = bounds.x;
};
if (minY > bounds.y){
minY = bounds.y;
};
if (maxY < bounds.y){
maxY = bounds.y;
};
};
} else {
minX = topleft.x;
minY = topleft.y;
maxX = bottomright.x;
maxY = bottomright.y;
};
}
}
}//package away3d.core.draw
Section 8
//DrawSegment (away3d.core.draw.DrawSegment)
package away3d.core.draw {
import away3d.core.material.*;
public class DrawSegment extends DrawPrimitive {
var db:Number;
var yfocus:Number;
var det:Number;
var dx:Number;
var dy:Number;
var bzf:Number;
var faz:Number;
public var material:ISegmentMaterial;
var axf:Number;
var ayf:Number;
var ax:Number;
var ay:Number;
var az:Number;
var da:Number;
var fbz:Number;
var bxf:Number;
var azf:Number;
var bx:Number;
var by:Number;
var focus:Number;
var bz:Number;
var xfocus:Number;
public var length:Number;
var byf:Number;
public var v0:ScreenVertex;
public var v1:ScreenVertex;
override public function render():void{
material.renderSegment(this);
}
public function onepointcut(_arg1:ScreenVertex):Array{
return ([create(material, projection, v0, _arg1), create(material, projection, _arg1, v1)]);
}
override public function contains(_arg1:Number, _arg2:Number):Boolean{
if (Math.abs((((v0.x * (_arg2 - v1.y)) + (v1.x * (v0.y - _arg2))) + (_arg1 * (v1.y - v0.y)))) > ((0.001 * 1000) * 1000)){
return (false);
};
if ((distanceToCenter(_arg1, _arg2) * 2) > length){
return (false);
};
return (true);
}
override public function quarter(_arg1:Number):Array{
var _local2:ScreenVertex;
if (length < 5){
return (null);
};
_local2 = ScreenVertex.median(v0, v1, _arg1);
return ([create(material, projection, v0, _local2), create(material, projection, _local2, v1)]);
}
override public function getZ(_arg1:Number, _arg2:Number):Number{
if (projection == null){
return (screenZ);
};
focus = projection.focus;
ax = v0.x;
ay = v0.y;
az = v0.z;
bx = v1.x;
by = v1.y;
bz = v1.z;
if ((((ax == _arg1)) && ((ay == _arg2)))){
return (az);
};
if ((((bx == _arg1)) && ((by == _arg2)))){
return (bz);
};
dx = (bx - ax);
dy = (by - ay);
azf = (az / focus);
bzf = (bz / focus);
faz = (1 + azf);
fbz = (1 + bzf);
xfocus = _arg1;
yfocus = _arg2;
axf = ((ax * faz) - (_arg1 * azf));
bxf = ((bx * fbz) - (_arg1 * bzf));
ayf = ((ay * faz) - (_arg2 * azf));
byf = ((by * fbz) - (_arg2 * bzf));
det = ((dx * (axf - bxf)) + (dy * (ayf - byf)));
db = ((dx * (axf - _arg1)) + (dy * (ayf - _arg2)));
da = ((dx * (_arg1 - bxf)) + (dy * (_arg2 - byf)));
return ((((da * az) + (db * bz)) / det));
}
override public function clear():void{
v0 = null;
v1 = null;
}
public function calc():void{
if (v0.z < v1.z){
minZ = v0.z;
maxZ = (v1.z + 1);
} else {
minZ = v1.z;
maxZ = (v0.z + 1);
};
screenZ = ((v0.z + v1.z) / 2);
if (v0.x < v1.x){
minX = v0.x;
maxX = (v1.x + 1);
} else {
minX = v1.x;
maxX = (v0.x + 1);
};
if (v0.y < v1.y){
minY = v0.y;
maxY = (v1.y + 1);
} else {
minY = v1.y;
maxY = (v0.y + 1);
};
length = Math.sqrt((((maxX - minX) * (maxX - minX)) + ((maxY - minY) * (maxY - minY))));
}
public function distanceToCenter(_arg1:Number, _arg2:Number):Number{
var _local3:Number;
var _local4:Number;
_local3 = ((v0.x + v1.x) / 2);
_local4 = ((v0.y + v1.y) / 2);
return (Math.sqrt((((_local3 - _arg1) * (_local3 - _arg1)) + ((_local4 - _arg2) * (_local4 - _arg2)))));
}
override public function toString():String{
return ((((((("S{ screenZ = " + screenZ) + ", minZ = ") + minZ) + ", maxZ = ") + maxZ) + " }"));
}
}
}//package away3d.core.draw
Section 9
//DrawTriangle (away3d.core.draw.DrawTriangle)
package away3d.core.draw {
import flash.display.*;
import away3d.core.mesh.*;
import flash.geom.*;
import away3d.core.material.*;
public class DrawTriangle extends DrawPrimitive {
var _u2:Number;
var det:Number;
var bzf:Number;
var axf:Number;
var v12:ScreenVertex;
var _v0:Number;
var _v1:Number;
var _v2:Number;
var faz:Number;
public var material:ITriangleMaterial;
var materialHeight:Number;
public var bitmapDisplacementY:BitmapData;
var ayf:Number;
var ax:Number;
var ay:Number;
public var bitmapDisplacementX:BitmapData;
var av:Number;
var az:Number;
var au:Number;
var fbz:Number;
var v20:ScreenVertex;
public var texturemapping:Matrix;
var azf:Number;
var bx:Number;
var by:Number;
var bz:Number;
var bu:Number;
var bv:Number;
public var face:Face;
var d01:Number;
var uv01:UV;
public var normalRect:Rectangle;
var cv:Number;
public var bitmapMaterial:BitmapData;
var cz:Number;
var cu:Number;
public var v0:ScreenVertex;
public var v2:ScreenVertex;
var db:Number;
var fcz:Number;
public var v1:ScreenVertex;
public var invtexturemapping:Matrix;
var d12:Number;
var uv12:UV;
public var area:Number;
var cxf:Number;
var da:Number;
var cx:Number;
var cy:Number;
public var bitmapPhong:BitmapData;
var uv20:UV;
var dd12:Number;
var d20:Number;
var dd01:Number;
var t:Matrix;
public var uv0:UV;
public var uv1:UV;
public var uv2:UV;
var dc:Number;
var dd20:Number;
public var bitmapReflection:BitmapData;
var cyf:Number;
public var backface:Boolean;// = false
var czf:Number;
var bxf:Number;
var focus:Number;
var materialWidth:Number;
public var bitmapNormal:BitmapData;
var v01:ScreenVertex;
var _u0:Number;
var _u1:Number;
var byf:Number;
public function DrawTriangle(){
backface = false;
super();
}
final public function transformUV(_arg1:IUVMaterial):Matrix{
materialWidth = _arg1.width;
materialHeight = _arg1.height;
if ((((((uv0 == null)) || ((uv1 == null)))) || ((uv2 == null)))){
return (null);
};
_u0 = (materialWidth * uv0._u);
_u1 = (materialWidth * uv1._u);
_u2 = (materialWidth * uv2._u);
_v0 = (materialHeight * (1 - uv0._v));
_v1 = (materialHeight * (1 - uv1._v));
_v2 = (materialHeight * (1 - uv2._v));
if ((((((_u0 == _u1)) && ((_v0 == _v1)))) || ((((_u0 == _u2)) && ((_v0 == _v2)))))){
if (_u0 > 0.05){
_u0 = (_u0 - 0.05);
} else {
_u0 = (_u0 + 0.05);
};
if (_v0 > 0.07){
_v0 = (_v0 - 0.07);
} else {
_v0 = (_v0 + 0.07);
};
};
if ((((_u2 == _u1)) && ((_v2 == _v1)))){
if (_u2 > 0.04){
_u2 = (_u2 - 0.04);
} else {
_u2 = (_u2 + 0.04);
};
if (_v2 > 0.06){
_v2 = (_v2 - 0.06);
} else {
_v2 = (_v2 + 0.06);
};
};
if ((_arg1 is BitmapMaterialContainer)){
invtexturemapping = new Matrix((_u1 - _u0), (_v1 - _v0), (_u2 - _u0), (_v2 - _v0), (_u0 - face._bitmapRect.x), (_v0 - face._bitmapRect.y));
texturemapping = invtexturemapping.clone();
texturemapping.invert();
return (texturemapping);
};
texturemapping = new Matrix((_u1 - _u0), (_v1 - _v0), (_u2 - _u0), (_v2 - _v0), _u0, _v0);
texturemapping.invert();
return (texturemapping);
}
final public function bisect(_arg1:Number):Array{
d01 = v0.distanceSqr(v1);
d12 = v1.distanceSqr(v2);
d20 = v2.distanceSqr(v0);
if ((((d12 >= d01)) && ((d12 >= d20)))){
return (bisect12(_arg1));
};
if (d01 >= d20){
return (bisect01(_arg1));
};
return (bisect20(_arg1));
}
final override public function contains(_arg1:Number, _arg2:Number):Boolean{
if ((((v0.x * (_arg2 - v1.y)) + (v1.x * (v0.y - _arg2))) + (_arg1 * (v1.y - v0.y))) < -0.001){
return (false);
};
if ((((v0.x * (v2.y - _arg2)) + (_arg1 * (v0.y - v2.y))) + (v2.x * (_arg2 - v0.y))) < -0.001){
return (false);
};
if ((((_arg1 * (v2.y - v1.y)) + (v1.x * (_arg2 - v2.y))) + (v2.x * (v1.y - _arg2))) < -0.001){
return (false);
};
return (true);
}
final public function minEdgeSqr():Number{
return (Math.min(Math.min(v0.distanceSqr(v1), v1.distanceSqr(v2)), v2.distanceSqr(v0)));
}
override public function shade():void{
material.shadeTriangle(this);
}
final public function minDistortSqr(_arg1:Number):Number{
return (Math.min(Math.min(v0.distortSqr(v1, _arg1), v1.distortSqr(v2, _arg1)), v2.distortSqr(v0, _arg1)));
}
override public function clear():void{
v0 = null;
v1 = null;
v2 = null;
uv0 = null;
uv1 = null;
uv2 = null;
texturemapping = null;
}
final public function acuteAngled():Boolean{
d01 = v0.distanceSqr(v1);
d12 = v1.distanceSqr(v2);
d20 = v2.distanceSqr(v0);
dd01 = (d01 * d01);
dd12 = (d12 * d12);
dd20 = (d20 * d20);
return ((((((dd01 <= (dd12 + dd20))) && ((dd12 <= (dd20 + dd01))))) && ((dd20 <= (dd01 + dd12)))));
}
override public function toString():String{
var _local1:String;
_local1 = "";
if ((material is WireColorMaterial)){
switch ((material as WireColorMaterial).color){
case 0xFF00:
_local1 = "green";
break;
case 0xFFFF00:
_local1 = "yellow";
break;
case 0xFF0000:
_local1 = "red";
break;
case 0xFF:
_local1 = "blue";
break;
};
};
return (((((((((("T{" + _local1) + int(area)) + " screenZ = ") + num(screenZ)) + ", minZ = ") + num(minZ)) + ", maxZ = ") + num(maxZ)) + " }"));
}
final public function distortbisect(_arg1:Number):Array{
d01 = v0.distortSqr(v1, _arg1);
d12 = v1.distortSqr(v2, _arg1);
d20 = v2.distortSqr(v0, _arg1);
if ((((d12 >= d01)) && ((d12 >= d20)))){
return (bisect12(_arg1));
};
if (d01 >= d20){
return (bisect01(_arg1));
};
return (bisect20(_arg1));
}
public function getUV(_arg1:Number, _arg2:Number):UV{
if (uv0 == null){
return (null);
};
if (uv1 == null){
return (null);
};
if (uv2 == null){
return (null);
};
au = uv0._u;
av = uv0._v;
bu = uv1._u;
bv = uv1._v;
cu = uv2._u;
cv = uv2._v;
focus = projection.focus;
ax = v0.x;
ay = v0.y;
az = v0.z;
bx = v1.x;
by = v1.y;
bz = v1.z;
cx = v2.x;
cy = v2.y;
cz = v2.z;
if ((((ax == _arg1)) && ((ay == _arg2)))){
return (uv0);
};
if ((((bx == _arg1)) && ((by == _arg2)))){
return (uv1);
};
if ((((cx == _arg1)) && ((cy == _arg2)))){
return (uv2);
};
azf = (az / focus);
bzf = (bz / focus);
czf = (cz / focus);
faz = (1 + azf);
fbz = (1 + bzf);
fcz = (1 + czf);
axf = ((ax * faz) - (_arg1 * azf));
bxf = ((bx * fbz) - (_arg1 * bzf));
cxf = ((cx * fcz) - (_arg1 * czf));
ayf = ((ay * faz) - (_arg2 * azf));
byf = ((by * fbz) - (_arg2 * bzf));
cyf = ((cy * fcz) - (_arg2 * czf));
det = (((axf * (byf - cyf)) + (bxf * (cyf - ayf))) + (cxf * (ayf - byf)));
da = (((_arg1 * (byf - cyf)) + (bxf * (cyf - _arg2))) + (cxf * (_arg2 - byf)));
db = (((axf * (_arg2 - cyf)) + (_arg1 * (cyf - ayf))) + (cxf * (ayf - _arg2)));
dc = (((axf * (byf - _arg2)) + (bxf * (_arg2 - ayf))) + (_arg1 * (ayf - byf)));
return (new UV(((((da * au) + (db * bu)) + (dc * cu)) / det), ((((da * av) + (db * bv)) + (dc * cv)) / det)));
}
final private function bisect01(_arg1:Number):Array{
var _local2:ScreenVertex;
var _local3:UV;
_local2 = ScreenVertex.median(v0, v1, _arg1);
_local3 = UV.median(uv0, uv1);
return ([create(face, material, projection, v2, v0, _local2, uv2, uv0, _local3), create(face, material, projection, _local2, v1, v2, _local3, uv1, uv2)]);
}
override public function render():void{
material.renderTriangle(this);
}
public function calc():void{
if (v0.x > v1.x){
if (v0.x > v2.x){
maxX = v0.x;
} else {
maxX = v2.x;
};
} else {
if (v1.x > v2.x){
maxX = v1.x;
} else {
maxX = v2.x;
};
};
if (v0.x < v1.x){
if (v0.x < v2.x){
minX = v0.x;
} else {
minX = v2.x;
};
} else {
if (v1.x < v2.x){
minX = v1.x;
} else {
minX = v2.x;
};
};
if (v0.y > v1.y){
if (v0.y > v2.y){
maxY = v0.y;
} else {
maxY = v2.y;
};
} else {
if (v1.y > v2.y){
maxY = v1.y;
} else {
maxY = v2.y;
};
};
if (v0.y < v1.y){
if (v0.y < v2.y){
minY = v0.y;
} else {
minY = v2.y;
};
} else {
if (v1.y < v2.y){
minY = v1.y;
} else {
minY = v2.y;
};
};
if (v0.z > v1.z){
if (v0.z > v2.z){
maxZ = v0.z;
} else {
maxZ = v2.z;
};
} else {
if (v1.z > v2.z){
maxZ = v1.z;
} else {
maxZ = v2.z;
};
};
if (v0.z < v1.z){
if (v0.z < v2.z){
minZ = v0.z;
} else {
minZ = v2.z;
};
} else {
if (v1.z < v2.z){
minZ = v1.z;
} else {
minZ = v2.z;
};
};
screenZ = (((v0.z + v1.z) + v2.z) / 3);
area = (0.5 * (((v0.x * (v2.y - v1.y)) + (v1.x * (v0.y - v2.y))) + (v2.x * (v1.y - v0.y))));
}
public function fivepointcut(_arg1:ScreenVertex, _arg2:ScreenVertex, _arg3:ScreenVertex, _arg4:ScreenVertex, _arg5:ScreenVertex, _arg6:UV, _arg7:UV, _arg8:UV, _arg9:UV, _arg10:UV):Array{
if (_arg1.distanceSqr(_arg4) < _arg2.distanceSqr(_arg5)){
return ([create(face, material, projection, _arg1, _arg2, _arg4, _arg6, _arg7, _arg9), create(face, material, projection, _arg2, _arg3, _arg4, _arg7, _arg8, _arg9), create(face, material, projection, _arg1, _arg4, _arg5, _arg6, _arg9, _arg10)]);
};
return ([create(face, material, projection, _arg1, _arg2, _arg5, _arg6, _arg7, _arg10), create(face, material, projection, _arg2, _arg3, _arg4, _arg7, _arg8, _arg9), create(face, material, projection, _arg2, _arg4, _arg5, _arg7, _arg9, _arg10)]);
}
final private function bisect12(_arg1:Number):Array{
var _local2:ScreenVertex;
var _local3:UV;
_local2 = ScreenVertex.median(v1, v2, _arg1);
_local3 = UV.median(uv1, uv2);
return ([create(face, material, projection, v0, v1, _local2, uv0, uv1, _local3), create(face, material, projection, _local2, v2, v0, _local3, uv2, uv0)]);
}
final override public function quarter(_arg1:Number):Array{
if (area < 20){
return (null);
};
v01 = ScreenVertex.median(v0, v1, _arg1);
v12 = ScreenVertex.median(v1, v2, _arg1);
v20 = ScreenVertex.median(v2, v0, _arg1);
uv01 = UV.median(uv0, uv1);
uv12 = UV.median(uv1, uv2);
uv20 = UV.median(uv2, uv0);
return ([create(face, material, projection, v0, v01, v20, uv0, uv01, uv20), create(face, material, projection, v1, v12, v01, uv1, uv12, uv01), create(face, material, projection, v2, v20, v12, uv2, uv20, uv12), create(face, material, projection, v01, v12, v20, uv01, uv12, uv20)]);
}
final override public function getZ(_arg1:Number, _arg2:Number):Number{
if (projection == null){
return (screenZ);
};
focus = projection.focus;
ax = v0.x;
ay = v0.y;
az = v0.z;
bx = v1.x;
by = v1.y;
bz = v1.z;
cx = v2.x;
cy = v2.y;
cz = v2.z;
if ((((ax == _arg1)) && ((ay == _arg2)))){
return (az);
};
if ((((bx == _arg1)) && ((by == _arg2)))){
return (bz);
};
if ((((cx == _arg1)) && ((cy == _arg2)))){
return (cz);
};
azf = (az / focus);
bzf = (bz / focus);
czf = (cz / focus);
faz = (1 + azf);
fbz = (1 + bzf);
fcz = (1 + czf);
axf = ((ax * faz) - (_arg1 * azf));
bxf = ((bx * fbz) - (_arg1 * bzf));
cxf = ((cx * fcz) - (_arg1 * czf));
ayf = ((ay * faz) - (_arg2 * azf));
byf = ((by * fbz) - (_arg2 * bzf));
cyf = ((cy * fcz) - (_arg2 * czf));
det = (((axf * (byf - cyf)) + (bxf * (cyf - ayf))) + (cxf * (ayf - byf)));
da = (((_arg1 * (byf - cyf)) + (bxf * (cyf - _arg2))) + (cxf * (_arg2 - byf)));
db = (((axf * (_arg2 - cyf)) + (_arg1 * (cyf - ayf))) + (cxf * (ayf - _arg2)));
dc = (((axf * (byf - _arg2)) + (bxf * (_arg2 - ayf))) + (_arg1 * (ayf - byf)));
return (((((da * az) + (db * bz)) + (dc * cz)) / det));
}
final public function distanceToCenter(_arg1:Number, _arg2:Number):Number{
var _local3:Number;
var _local4:Number;
_local3 = (((v0.x + v1.x) + v2.x) / 3);
_local4 = (((v0.y + v1.y) + v2.y) / 3);
return (Math.sqrt((((_local3 - _arg1) * (_local3 - _arg1)) + ((_local4 - _arg2) * (_local4 - _arg2)))));
}
final public function maxDistortSqr(_arg1:Number):Number{
return (Math.max(Math.max(v0.distortSqr(v1, _arg1), v1.distortSqr(v2, _arg1)), v2.distortSqr(v0, _arg1)));
}
final public function maxEdgeSqr():Number{
return (Math.max(Math.max(v0.distanceSqr(v1), v1.distanceSqr(v2)), v2.distanceSqr(v0)));
}
final private function bisect20(_arg1:Number):Array{
var _local2:ScreenVertex;
var _local3:UV;
_local2 = ScreenVertex.median(v2, v0, _arg1);
_local3 = UV.median(uv2, uv0);
return ([create(face, material, projection, v1, v2, _local2, uv1, uv2, _local3), create(face, material, projection, _local2, v0, v1, _local3, uv0, uv1)]);
}
private static function num(_arg1:Number):Number{
return ((int((_arg1 * 1000)) / 1000));
}
}
}//package away3d.core.draw
Section 10
//ScreenVertex (away3d.core.draw.ScreenVertex)
package away3d.core.draw {
import away3d.core.mesh.*;
public final class ScreenVertex {
public var y:Number;
public var vx:Number;
public var vy:Number;
var fbz:Number;
public var z:Number;
public var num:Number;
var dx:Number;
var my2:Number;
var dy:Number;
var faz:Number;
var mx2:Number;
var ifmz2:Number;
public var visible:Boolean;
public var x:Number;
var persp:Number;
public function ScreenVertex(_arg1:Number=0, _arg2:Number=0, _arg3:Number=0){
this.x = _arg1;
this.y = _arg2;
this.z = _arg3;
this.visible = false;
}
public function distortSqr(_arg1:ScreenVertex, _arg2:Number):Number{
faz = (_arg2 + z);
fbz = (_arg2 + z);
ifmz2 = (2 / (faz + fbz));
mx2 = (((x * faz) + (_arg1.x * fbz)) * ifmz2);
my2 = (((y * faz) + (_arg1.y * fbz)) * ifmz2);
dx = ((x + _arg1.x) - mx2);
dy = ((y + _arg1.y) - my2);
return ((50 * (((dx * dx) + dy) + dy)));
}
public function deperspective(_arg1:Number):Vertex{
persp = (1 + (z / _arg1));
return (new Vertex((x * persp), (y * persp), z));
}
public function distanceSqr(_arg1:ScreenVertex):Number{
return ((((x - _arg1.x) * (x - _arg1.x)) + ((y - _arg1.y) * (y - _arg1.y))));
}
public function toString():String{
return ((((((("new ScreenVertex(" + x) + ", ") + y) + ", ") + z) + ")"));
}
public function distance(_arg1:ScreenVertex):Number{
return (Math.sqrt((((x - _arg1.x) * (x - _arg1.x)) + ((y - _arg1.y) * (y - _arg1.y)))));
}
public static function median(_arg1:ScreenVertex, _arg2:ScreenVertex, _arg3:Number):ScreenVertex{
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
_local4 = ((_arg1.z + _arg2.z) / 2);
_local5 = (_arg3 + _arg1.z);
_local6 = (_arg3 + _arg2.z);
_local7 = ((1 / (_arg3 + _local4)) / 2);
return (new ScreenVertex((((_arg1.x * _local5) + (_arg2.x * _local6)) * _local7), (((_arg1.y * _local5) + (_arg2.y * _local6)) * _local7), _local4));
}
public static function weighted(_arg1:ScreenVertex, _arg2:ScreenVertex, _arg3:Number, _arg4:Number, _arg5:Number):ScreenVertex{
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;
var _local16:Number;
var _local17:Number;
var _local18:Number;
var _local19:Number;
var _local20:Number;
var _local21:Number;
if ((((_arg4 == 0)) && ((_arg3 == 0)))){
throw (new Error("Zero weights"));
};
if (_arg4 == 0){
return (new ScreenVertex(_arg1.x, _arg1.y, _arg1.z));
};
if (_arg3 == 0){
return (new ScreenVertex(_arg2.x, _arg2.y, _arg2.z));
};
_local6 = (_arg3 + _arg4);
_local7 = (_arg3 / _local6);
_local8 = (_arg4 / _local6);
_local9 = ((_arg1.x * _local7) + (_arg2.x * _local8));
_local10 = ((_arg1.y * _local7) + (_arg2.y * _local8));
_local11 = (_arg1.z / _arg5);
_local12 = (_arg2.z / _arg5);
_local13 = (1 + _local11);
_local14 = (1 + _local12);
_local15 = ((_arg1.x * _local13) - (_local9 * _local11));
_local16 = ((_arg2.x * _local14) - (_local9 * _local12));
_local17 = ((_arg1.y * _local13) - (_local10 * _local11));
_local18 = ((_arg2.y * _local14) - (_local10 * _local12));
_local19 = ((_local15 * _local18) - (_local16 * _local17));
_local20 = ((_local9 * _local18) - (_local16 * _local10));
_local21 = ((_local15 * _local10) - (_local9 * _local17));
return (new ScreenVertex(_local9, _local10, (((_local20 * _arg1.z) + (_local21 * _arg2.z)) / _local19)));
}
}
}//package away3d.core.draw
Section 11
//AlphaBitmapMaterial (away3d.core.material.AlphaBitmapMaterial)
package away3d.core.material {
import flash.display.*;
import away3d.core.draw.*;
import away3d.core.math.*;
import away3d.core.render.*;
import away3d.core.scene.*;
import flash.geom.*;
import away3d.core.utils.*;
import flash.utils.*;
import away3d.core.*;
public class AlphaBitmapMaterial extends TransformBitmapMaterial implements ITriangleMaterial, IUVMaterial {
private var _alpha:Number;
private var _cache:Dictionary;
private var _grades:int;
public function AlphaBitmapMaterial(_arg1:BitmapData, _arg2:Object=null){
super(_arg1, _arg2);
if (!_arg1.transparent){
_bitmap = new BitmapData(_arg1.width, _arg1.height, true);
_bitmap.draw(_arg1);
};
_renderBitmap = _bitmap;
_cache = new Dictionary();
_arg2 = Init.parse(_arg2);
_grades = _arg2.getInt("grades", 32, {min:2, max:0x0100});
alpha = _arg2.getNumber("alpha", 1, {min:0, max:1});
}
public function set bitmap(_arg1:BitmapData):void{
_bitmap = _arg1;
_cache = new Dictionary();
updateCurrent();
}
private function updateCurrent():void{
if (_alpha == 1){
_renderBitmap = _bitmap;
return;
};
if (_alpha == 0){
_renderBitmap = null;
return;
};
_renderBitmap = _cache[_alpha];
if (_renderBitmap == null){
_renderBitmap = _bitmap.clone();
_renderBitmap.colorTransform(_renderBitmap.rect, new ColorTransform(1, 1, 1, _alpha));
_cache[_alpha] = _renderBitmap;
};
}
override public function get visible():Boolean{
return ((_alpha > 0));
}
public function set alpha(_arg1:Number):void{
if (_arg1 > 1){
_arg1 = 1;
};
if (_arg1 < 0){
_arg1 = 0;
};
if (_arg1 == _alpha){
return;
};
_arg1 = (Math.round((_arg1 * (_grades - 1))) / (_grades - 1));
_alpha = _arg1;
updateCurrent();
}
public function get alpha():Number{
return (_alpha);
}
}
}//package away3d.core.material
Section 12
//BitmapMaterial (away3d.core.material.BitmapMaterial)
package away3d.core.material {
import flash.display.*;
import away3d.core.draw.*;
import away3d.core.mesh.*;
import away3d.core.math.*;
import away3d.core.render.*;
import away3d.core.scene.*;
import flash.geom.*;
import away3d.core.utils.*;
import flash.utils.*;
import away3d.core.*;
public class BitmapMaterial implements ITriangleMaterial, IUVMaterial {
var triangle:DrawTriangle;
var dsbc:Number;
var faz:Number;
var dsca:Number;
var ax:Number;
var ay:Number;
var az:Number;
var _renderBitmap:BitmapData;
var fbz:Number;
var _zeroPoint:Point;
var mcax:Number;
var _bitmap:BitmapData;
var mcaz:Number;
public var debug:Boolean;
var mcay:Number;
var bx:Number;
var by:Number;
var bz:Number;
var fcz:Number;
var map:Matrix;
var dbcx:Number;
var dbcy:Number;
var cx:Number;
var cy:Number;
var cz:Number;
public var precision:Number;// = 0
var graphics:Graphics;
var dmax:Number;
var dabx:Number;
var session:RenderSession;
public var repeat:Boolean;
var shape:Shape;
var daby:Number;
public var smooth:Boolean;
var svArray:Array;
var mbcx:Number;
var mbcy:Number;
var faceDictionaryVO:FaceDictionaryVO;
var mapping:Matrix;
var focus:Number;
var mbcz:Number;
var mabx:Number;
var maby:Number;
var dsab:Number;
var _faceDictionary:Dictionary;
var mabz:Number;
var dcax:Number;
var dcay:Number;
public function BitmapMaterial(_arg1:BitmapData, _arg2:Object=null){
_faceDictionary = new Dictionary(true);
_zeroPoint = new Point(0, 0);
precision = 0;
shape = new Shape();
map = new Matrix();
triangle = new DrawTriangle();
svArray = new Array();
super();
_renderBitmap = (_bitmap = _arg1);
_arg2 = Init.parse(_arg2);
smooth = _arg2.getBoolean("smooth", false);
debug = _arg2.getBoolean("debug", false);
repeat = _arg2.getBoolean("repeat", false);
precision = _arg2.getNumber("precision", 0);
precision = ((precision * precision) * 1.4);
createVertexArray();
}
public function renderFace(_arg1:Face, _arg2:Rectangle):void{
faceDictionaryVO = _faceDictionary[_arg1];
if (!faceDictionaryVO){
faceDictionaryVO = (_faceDictionary[_arg1.parent] = new FaceDictionaryVO(_arg2.width, _arg2.height));
};
mapping = new Matrix();
mapping.scale((_arg2.width / width), (_arg2.height / height));
faceDictionaryVO.dirty = false;
if ((((mapping.a == 1)) && ((mapping.d == 1)))){
faceDictionaryVO.bitmap.copyPixels(_bitmap, _arg2, _zeroPoint);
} else {
graphics = shape.graphics;
graphics.clear();
graphics.beginBitmapFill(_bitmap, mapping, repeat, smooth);
graphics.drawRect(0, 0, _arg2.width, _arg2.height);
graphics.endFill();
faceDictionaryVO.bitmap.draw(shape);
};
}
protected function renderRec(_arg1:ScreenVertex, _arg2:ScreenVertex, _arg3:ScreenVertex, _arg4:Number):void{
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:ScreenVertex;
var _local12:ScreenVertex;
var _local13:ScreenVertex;
ax = _arg1.x;
ay = _arg1.y;
az = _arg1.z;
bx = _arg2.x;
by = _arg2.y;
bz = _arg2.z;
cx = _arg3.x;
cy = _arg3.y;
cz = _arg3.z;
if (!session.clip.rect(Math.min(ax, Math.min(bx, cx)), Math.min(ay, Math.min(by, cy)), Math.max(ax, Math.max(bx, cx)), Math.max(ay, Math.max(by, cy)))){
return;
};
if ((((((az <= 0)) && ((bz <= 0)))) && ((cz <= 0)))){
return;
};
if ((((((((_arg4 >= 100)) || ((focus == Infinity)))) || (((Math.max(Math.max(ax, bx), cx) - Math.min(Math.min(ax, bx), cx)) < 10)))) || (((Math.max(Math.max(ay, by), cy) - Math.min(Math.min(ay, by), cy)) < 10)))){
session.renderTriangleBitmap(_renderBitmap, map, _arg1, _arg2, _arg3, smooth, repeat);
if (debug){
session.renderTriangleLine(1, 0xFF00, 1, _arg1, _arg2, _arg3);
};
return;
};
faz = (focus + az);
fbz = (focus + bz);
fcz = (focus + cz);
mabz = (2 / (faz + fbz));
mbcz = (2 / (fbz + fcz));
mcaz = (2 / (fcz + faz));
dabx = ((ax + bx) - (mabx = (((ax * faz) + (bx * fbz)) * mabz)));
daby = ((ay + by) - (maby = (((ay * faz) + (by * fbz)) * mabz)));
dbcx = ((bx + cx) - (mbcx = (((bx * fbz) + (cx * fcz)) * mbcz)));
dbcy = ((by + cy) - (mbcy = (((by * fbz) + (cy * fcz)) * mbcz)));
dcax = ((cx + ax) - (mcax = (((cx * fcz) + (ax * faz)) * mcaz)));
dcay = ((cy + ay) - (mcay = (((cy * fcz) + (ay * faz)) * mcaz)));
dsab = ((dabx * dabx) + (daby * daby));
dsbc = ((dbcx * dbcx) + (dbcy * dbcy));
dsca = ((dcax * dcax) + (dcay * dcay));
if ((((((dsab <= precision)) && ((dsca <= precision)))) && ((dsbc <= precision)))){
session.renderTriangleBitmap(_renderBitmap, map, _arg1, _arg2, _arg3, smooth, repeat);
if (debug){
session.renderTriangleLine(1, 0xFF00, 1, _arg1, _arg2, _arg3);
};
return;
};
_local5 = map.a;
_local6 = map.b;
_local7 = map.c;
_local8 = map.d;
_local9 = map.tx;
_local10 = map.ty;
var _temp1 = _arg4;
_arg4 = (_arg4 + 1);
_local13 = svArray[_temp1];
_local13.x = (mbcx / 2);
_local13.y = (mbcy / 2);
_local13.z = ((bz + cz) / 2);
if ((((((dsab > precision)) && ((dsca > precision)))) && ((dsbc > precision)))){
var _temp2 = _arg4;
_arg4 = (_arg4 + 1);
_local11 = svArray[_temp2];
_local11.x = (mabx / 2);
_local11.y = (maby / 2);
_local11.z = ((az + bz) / 2);
var _temp3 = _arg4;
_arg4 = (_arg4 + 1);
_local12 = svArray[_temp3];
_local12.x = (mcax / 2);
_local12.y = (mcay / 2);
_local12.z = ((cz + az) / 2);
_local5 = (_local5 * 2);
map.a = _local5;
_local6 = (_local6 * 2);
map.b = _local6;
_local7 = (_local7 * 2);
map.c = _local7;
_local8 = (_local8 * 2);
map.d = _local8;
_local9 = (_local9 * 2);
map.tx = _local9;
_local10 = (_local10 * 2);
map.ty = _local10;
renderRec(_arg1, _local11, _local12, _arg4);
map.a = _local5;
map.b = _local6;
map.c = _local7;
map.d = _local8;
map.tx = (_local9 - 1);
map.ty = _local10;
renderRec(_local11, _arg2, _local13, _arg4);
map.a = _local5;
map.b = _local6;
map.c = _local7;
map.d = _local8;
map.tx = _local9;
map.ty = (_local10 - 1);
renderRec(_local12, _local13, _arg3, _arg4);
map.a = -(_local5);
map.b = -(_local6);
map.c = -(_local7);
map.d = -(_local8);
map.tx = (1 - _local9);
map.ty = (1 - _local10);
renderRec(_local13, _local12, _local11, _arg4);
return;
};
dmax = Math.max(dsab, Math.max(dsca, dsbc));
if (dsab == dmax){
var _temp4 = _arg4;
_arg4 = (_arg4 + 1);
_local11 = svArray[_temp4];
_local11.x = (mabx / 2);
_local11.y = (maby / 2);
_local11.z = ((az + bz) / 2);
_local5 = (_local5 * 2);
map.a = _local5;
_local7 = (_local7 * 2);
map.c = _local7;
_local9 = (_local9 * 2);
map.tx = _local9;
renderRec(_arg1, _local11, _arg3, _arg4);
map.a = (_local5 + _local6);
map.b = _local6;
map.c = (_local7 + _local8);
map.d = _local8;
map.tx = ((_local9 + _local10) - 1);
map.ty = _local10;
renderRec(_local11, _arg2, _arg3, _arg4);
return;
};
if (dsca == dmax){
var _temp5 = _arg4;
_arg4 = (_arg4 + 1);
_local12 = svArray[_temp5];
_local12.x = (mcax / 2);
_local12.y = (mcay / 2);
_local12.z = ((cz + az) / 2);
_local6 = (_local6 * 2);
map.b = _local6;
_local8 = (_local8 * 2);
map.d = _local8;
_local10 = (_local10 * 2);
map.ty = _local10;
renderRec(_arg1, _arg2, _local12, _arg4);
map.a = _local5;
map.b = (_local6 + _local5);
map.c = _local7;
map.d = (_local8 + _local7);
map.tx = _local9;
map.ty = ((_local10 + _local9) - 1);
renderRec(_local12, _arg2, _arg3, _arg4);
return;
};
map.a = (_local5 - _local6);
map.b = (_local6 * 2);
map.c = (_local7 - _local8);
map.d = (_local8 * 2);
map.tx = (_local9 - _local10);
map.ty = (_local10 * 2);
renderRec(_arg1, _arg2, _local13, _arg4);
map.a = (_local5 * 2);
map.b = (_local6 - _local5);
map.c = (_local7 * 2);
map.d = (_local8 - _local7);
map.tx = (_local9 * 2);
map.ty = (_local10 - _local9);
renderRec(_arg1, _local13, _arg3, _arg4);
}
public function get height():Number{
return (_bitmap.height);
}
public function get bitmap():BitmapData{
return (_bitmap);
}
public function shadeTriangle(_arg1:DrawTriangle):void{
}
public function createVertexArray():void{
var _local1:Number;
_local1 = 100;
while (_local1--) {
svArray.push(new ScreenVertex());
};
}
public function clearFaceDictionary():void{
for each (faceDictionaryVO in _faceDictionary) {
if (!faceDictionaryVO.dirty){
faceDictionaryVO.clear();
};
};
}
public function get visible():Boolean{
return (true);
}
public function getMapping(_arg1:DrawTriangle):Matrix{
return (((_arg1.texturemapping) || (_arg1.transformUV(this))));
}
public function renderTriangle(_arg1:DrawTriangle):void{
mapping = getMapping(_arg1);
if (precision){
session = _arg1.source.session;
focus = _arg1.projection.focus;
map.a = mapping.a;
map.b = mapping.b;
map.c = mapping.c;
map.d = mapping.d;
map.tx = mapping.tx;
map.ty = mapping.ty;
renderRec(_arg1.v0, _arg1.v1, _arg1.v2, 0);
} else {
_arg1.source.session.renderTriangleBitmap(_renderBitmap, mapping, _arg1.v0, _arg1.v1, _arg1.v2, smooth, repeat);
};
if (debug){
_arg1.source.session.renderTriangleLine(2, 0xFF, 1, _arg1.v0, _arg1.v1, _arg1.v2);
};
}
public function get width():Number{
return (_bitmap.width);
}
public function get faceDictionary():Dictionary{
return (_faceDictionary);
}
public function renderMaterial(_arg1:Mesh):void{
}
}
}//package away3d.core.material
Section 13
//BitmapMaterialContainer (away3d.core.material.BitmapMaterialContainer)
package away3d.core.material {
import flash.display.*;
import away3d.core.draw.*;
import away3d.core.mesh.*;
import flash.geom.*;
import away3d.core.utils.*;
import away3d.core.*;
public class BitmapMaterialContainer extends BitmapMaterial implements ITriangleMaterial {
var _zeroRect:Rectangle;
var bitmapDictionaryFace:FaceDictionaryVO;
public var materials:Array;
var material:IUVMaterial;
var _height:Number;
var _bitmapRect:Rectangle;
var face:Face;
var dt:DrawTriangle;
var bitmapDictionarySource:FaceDictionaryVO;
var _width:Number;
var _transformDirty:Boolean;
public function BitmapMaterialContainer(_arg1:int, _arg2:int, _arg3:Object=null){
super(new BitmapData(_arg1, _arg2, true, 0xFFFFFF), _arg3);
_width = _arg1;
_height = _arg2;
_bitmapRect = new Rectangle(0, 0, _width, _height);
_arg3 = Init.parse(_arg3);
materials = _arg3.getArray("materials");
}
override public function getMapping(_arg1:DrawTriangle):Matrix{
face = _arg1.face;
dt = face._dt;
if (!dt.texturemapping){
_transformDirty = true;
face._bitmapRect = new Rectangle(int((_width * face.minU)), int((_height * (1 - face.maxV))), int(((_width * (face.maxU - face.minU)) + 2)), int(((_height * (face.maxV - face.minV)) + 2)));
dt.transformUV(this);
faceDictionaryVO = _faceDictionary[face];
if (faceDictionaryVO != null){
faceDictionaryVO.reset(face._bitmapRect.width, face._bitmapRect.height);
} else {
_faceDictionary[face] = new FaceDictionaryVO(face._bitmapRect.width, face._bitmapRect.height);
};
for each (material in materials) {
faceDictionaryVO = material.faceDictionary[face];
if (faceDictionaryVO != null){
faceDictionaryVO.reset(face._bitmapRect.width, face._bitmapRect.height);
};
};
} else {
for each (material in materials) {
if (((!(material.faceDictionary[face])) || (material.faceDictionary[face].dirty))){
_transformDirty = true;
};
};
};
if (!_arg1.texturemapping){
_arg1.transformUV(this);
};
faceDictionaryVO = _faceDictionary[face];
if (_transformDirty){
_transformDirty = false;
_zeroRect = new Rectangle(0, 0, face._bitmapRect.width, face._bitmapRect.height);
faceDictionaryVO.bitmap.lock();
faceDictionaryVO.clear();
for each (material in materials) {
bitmapDictionaryFace = material.faceDictionary[face];
bitmapDictionarySource = material.faceDictionary[_arg1.source];
if (((bitmapDictionarySource) && (!(bitmapDictionarySource.dirty)))){
bitmapDictionaryFace = bitmapDictionarySource;
} else {
if (((((!(bitmapDictionaryFace)) || (((bitmapDictionaryFace) && (bitmapDictionaryFace.dirty))))) || (((bitmapDictionarySource) && (bitmapDictionarySource.dirty))))){
material.renderFace(face, _bitmapRect);
};
};
bitmapDictionaryFace = material.faceDictionary[face];
bitmapDictionarySource = material.faceDictionary[_arg1.source];
if (((bitmapDictionarySource) && (bitmapDictionarySource.bitmap))){
faceDictionaryVO.bitmap.copyPixels(bitmapDictionarySource.bitmap, face._bitmapRect, _zeroPoint, null, null, true);
} else {
if (bitmapDictionaryFace.bitmap){
faceDictionaryVO.bitmap.copyPixels(bitmapDictionaryFace.bitmap, _zeroRect, _zeroPoint, null, null, true);
};
};
};
faceDictionaryVO.bitmap.unlock();
};
_renderBitmap = faceDictionaryVO.bitmap;
return (_arg1.texturemapping);
}
override public function renderMaterial(_arg1:Mesh):void{
}
}
}//package away3d.core.material
Section 14
//CenterLightingMaterial (away3d.core.material.CenterLightingMaterial)
package away3d.core.material {
import flash.display.*;
import away3d.core.draw.*;
import away3d.core.mesh.*;
import away3d.core.math.*;
import away3d.core.render.*;
import away3d.core.scene.*;
import away3d.core.utils.*;
import away3d.core.*;
public class CenterLightingMaterial implements ITriangleMaterial {
var ksb:Number;
public var draw_fall_k:Number;// = 1
var diff:Number;
var ksr:Number;
var green:Number;
var source:PointLightSource;
var kdb:Number;
public var ak:Number;// = 20
public var draw_reflect_k:Number;// = 1
var kdg:Number;
var v0p:Number;
var dfy:Number;
var dfz:Number;
var kdr:Number;
var v0x:Number;
var v0y:Number;
var v0z:Number;
public var draw_normal:Boolean;// = false
var dfx:Number;
var rx:Number;
var ry:Number;
var rz:Number;
var sum:Number;
public var diffuse_brightness:Number;// = 1
var projection:Projection;
var v1p:Number;
public var ambient_brightness:Number;// = 1
var blue:Number;
var v1x:Number;
var v1y:Number;
var v1z:Number;
var ncy:Number;
var ncz:Number;
var ncx:Number;
var v2p:Number;
var cx:Number;
var v0:ScreenVertex;
var v1:ScreenVertex;
var v2:ScreenVertex;
var v2y:Number;
var v2z:Number;
var df:Number;
var v2x:Number;
var cz:Number;
var red:Number;
var graphics:Graphics;
public var draw_fall:Boolean;// = false
var cy:Number;
var fade:Number;
var session:RenderSession;
var amb:Number;
var ffy:Number;
var spec:Number;
var nf:Number;
var ffz:Number;
public var draw_reflect:Boolean;// = false
var rfx:Number;
var rfy:Number;
var rfz:Number;
var ffx:Number;
var d1x:Number;
var d1y:Number;
public var specular_brightness:Number;// = 1
var kag:Number;
var fx:Number;
var zoom:Number;
var kab:Number;
var kar:Number;
var focus:Number;
var fz:Number;
var d1z:Number;
var d2x:Number;
var c0x:Number;
var c0y:Number;
var c0z:Number;
var pdd:Number;
var pa:Number;
var d2y:Number;
var pc:Number;
var fy:Number;
var pb:Number;
var d2z:Number;
var ksg:Number;
public function CenterLightingMaterial(_arg1:Object=null){
ambient_brightness = 1;
diffuse_brightness = 1;
specular_brightness = 1;
ak = 20;
draw_normal = false;
draw_fall = false;
draw_fall_k = 1;
draw_reflect = false;
draw_reflect_k = 1;
super();
_arg1 = Init.parse(_arg1);
ak = _arg1.getNumber("ak", 20);
}
public function renderTri(_arg1:DrawTriangle, _arg2:RenderSession, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number, _arg7:Number, _arg8:Number, _arg9:Number, _arg10:Number, _arg11:Number):void{
throw (new Error("Not implemented"));
}
public function shadeTriangle(_arg1:DrawTriangle):void{
}
public function get visible():Boolean{
throw (new Error("Not implemented"));
}
public function renderTriangle(_arg1:DrawTriangle):void{
session = _arg1.source.session;
v0 = _arg1.v0;
v1 = _arg1.v1;
v2 = _arg1.v2;
projection = _arg1.projection;
focus = projection.focus;
zoom = projection.zoom;
v0z = v0.z;
v0p = ((1 + (v0z / focus)) / zoom);
v0x = (v0.x * v0p);
v0y = (v0.y * v0p);
v1z = v1.z;
v1p = ((1 + (v1z / focus)) / zoom);
v1x = (v1.x * v1p);
v1y = (v1.y * v1p);
v2z = v2.z;
v2p = ((1 + (v2z / focus)) / zoom);
v2x = (v2.x * v2p);
v2y = (v2.y * v2p);
d1x = (v1x - v0x);
d1y = (v1y - v0y);
d1z = (v1z - v0z);
d2x = (v2x - v0x);
d2y = (v2y - v0y);
d2z = (v2z - v0z);
pa = ((d1y * d2z) - (d1z * d2y));
pb = ((d1z * d2x) - (d1x * d2z));
pc = ((d1x * d2y) - (d1y * d2x));
pdd = Math.sqrt((((pa * pa) + (pb * pb)) + (pc * pc)));
pa = (pa / pdd);
pb = (pb / pdd);
pc = (pc / pdd);
c0x = (((v0x + v1x) + v2x) / 3);
c0y = (((v0y + v1y) + v2y) / 3);
c0z = (((v0z + v1z) + v2z) / 3);
kar = (kag = (kab = (kdr = (kdg = (kdb = (ksr = (ksg = (ksb = 0))))))));
for each (source in session.lightarray.points) {
red = source.red;
green = source.green;
blue = source.blue;
dfx = (source.x - c0x);
dfy = (source.y - c0y);
dfz = (source.z - c0z);
df = Math.sqrt((((dfx * dfx) + (dfy * dfy)) + (dfz * dfz)));
dfx = (dfx / df);
dfy = (dfy / df);
dfz = (dfz / df);
fade = ((1 / df) / df);
amb = ((source.ambient * fade) * ambient_brightness);
nf = (((dfx * pa) + (dfy * pb)) + (dfz * pc));
kar = (kar + (red * amb));
kag = (kag + (green * amb));
kab = (kab + (blue * amb));
if (nf < 0){
} else {
diff = (((source.diffuse * fade) * nf) * diffuse_brightness);
rfx = (dfx - ((2 * nf) * pa));
rfy = (dfy - ((2 * nf) * pb));
rfz = (dfz - ((2 * nf) * pc));
kdr = (kdr + (red * diff));
kdg = (kdg + (green * diff));
kdb = (kdb + (blue * diff));
if (rfz < 0){
} else {
spec = (((source.specular * fade) * Math.pow(rfz, ak)) * specular_brightness);
ksr = (ksr + (red * spec));
ksg = (ksg + (green * spec));
ksb = (ksb + (blue * spec));
};
};
};
renderTri(_arg1, session, kar, kag, kab, kdr, kdg, kdb, ksr, ksg, ksb);
if (((((draw_fall) || (draw_reflect))) || (draw_normal))){
graphics = session.graphics;
cz = c0z;
cx = ((c0x * zoom) / (1 + (cz / focus)));
cy = ((c0y * zoom) / (1 + (cz / focus)));
if (draw_normal){
ncz = (c0z + (30 * pc));
ncx = ((((c0x + (30 * pa)) * zoom) * focus) / (focus + ncz));
ncy = ((((c0y + (30 * pb)) * zoom) * focus) / (focus + ncz));
graphics.lineStyle(1, 0, 1);
graphics.moveTo(cx, cy);
graphics.lineTo(ncx, ncy);
graphics.moveTo(cx, cy);
graphics.drawCircle(cx, cy, 2);
};
if (((draw_fall) || (draw_reflect))){
for each (source in session.lightarray.points) {
red = source.red;
green = source.green;
blue = source.blue;
sum = (((red + green) + blue) / 0xFF);
red = (red / sum);
green = (green / sum);
blue = (blue / sum);
dfx = (source.x - c0x);
dfy = (source.y - c0y);
dfz = (source.z - c0z);
df = Math.sqrt((((dfx * dfx) + (dfy * dfy)) + (dfz * dfz)));
dfx = (dfx / df);
dfy = (dfy / df);
dfz = (dfz / df);
nf = (((dfx * pa) + (dfy * pb)) + (dfz * pc));
if (nf < 0){
} else {
if (draw_fall){
ffz = (c0z + ((30 * dfz) * (1 - draw_fall_k)));
ffx = ((((c0x + ((30 * dfx) * (1 - draw_fall_k))) * zoom) * focus) / (focus + ffz));
ffy = ((((c0y + ((30 * dfy) * (1 - draw_fall_k))) * zoom) * focus) / (focus + ffz));
fz = (c0z + (30 * dfz));
fx = ((((c0x + (30 * dfx)) * zoom) * focus) / (focus + fz));
fy = ((((c0y + (30 * dfy)) * zoom) * focus) / (focus + fz));
graphics.lineStyle(1, (((int(red) * 65536) + (int(green) * 0x0100)) + int(blue)), 1);
graphics.moveTo(ffx, ffy);
graphics.lineTo(fx, fy);
graphics.moveTo(ffx, ffy);
};
if (draw_reflect){
rfx = (dfx - ((2 * nf) * pa));
rfy = (dfy - ((2 * nf) * pb));
rfz = (dfz - ((2 * nf) * pc));
rz = (c0z - ((30 * rfz) * draw_reflect_k));
rx = ((((c0x - ((30 * rfx) * draw_reflect_k)) * zoom) * focus) / (focus + rz));
ry = ((((c0y - ((30 * rfy) * draw_reflect_k)) * zoom) * focus) / (focus + rz));
graphics.lineStyle(1, (((int((red * 0.5)) * 65536) + (int((green * 0.5)) * 0x0100)) + int((blue * 0.5))), 1);
graphics.moveTo(cx, cy);
graphics.lineTo(rx, ry);
graphics.moveTo(cx, cy);
};
};
};
};
};
}
}
}//package away3d.core.material
Section 15
//ColorMaterial (away3d.core.material.ColorMaterial)
package away3d.core.material {
import flash.display.*;
import away3d.core.draw.*;
import away3d.core.math.*;
import away3d.core.render.*;
import away3d.core.scene.*;
import away3d.core.utils.*;
import away3d.core.*;
public class ColorMaterial implements ITriangleMaterial {
public var color:uint;
public var alpha:Number;
public function ColorMaterial(_arg1=null, _arg2:Object=null){
if (_arg1 == null){
_arg1 = "random";
};
this.color = Cast.trycolor(_arg1);
_arg2 = Init.parse(_arg2);
alpha = _arg2.getNumber("alpha", 1, {min:0, max:1});
}
public function get visible():Boolean{
return ((alpha > 0));
}
public function shadeTriangle(_arg1:DrawTriangle):void{
}
public function renderTriangle(_arg1:DrawTriangle):void{
_arg1.source.session.renderTriangleColor(color, alpha, _arg1.v0, _arg1.v1, _arg1.v2);
}
}
}//package away3d.core.material
Section 16
//IMaterial (away3d.core.material.IMaterial)
package away3d.core.material {
public interface IMaterial {
function get visible():Boolean;
}
}//package away3d.core.material
Section 17
//ISegmentMaterial (away3d.core.material.ISegmentMaterial)
package away3d.core.material {
import away3d.core.draw.*;
public interface ISegmentMaterial extends IMaterial {
function renderSegment(_arg1:DrawSegment):void;
}
}//package away3d.core.material
Section 18
//ITriangleMaterial (away3d.core.material.ITriangleMaterial)
package away3d.core.material {
import away3d.core.draw.*;
public interface ITriangleMaterial extends IMaterial {
function shadeTriangle(_arg1:DrawTriangle):void;
function renderTriangle(_arg1:DrawTriangle):void;
}
}//package away3d.core.material
Section 19
//IUVMaterial (away3d.core.material.IUVMaterial)
package away3d.core.material {
import flash.display.*;
import away3d.core.mesh.*;
import flash.geom.*;
import flash.utils.*;
public interface IUVMaterial extends IMaterial {
function clearFaceDictionary():void;
function get width():Number;
function get height():Number;
function get bitmap():BitmapData;
function get faceDictionary():Dictionary;
function renderFace(_arg1:Face, _arg2:Rectangle):void;
function renderMaterial(_arg1:Mesh):void;
}
}//package away3d.core.material
Section 20
//MovieMaterial (away3d.core.material.MovieMaterial)
package away3d.core.material {
import flash.display.*;
import away3d.core.draw.*;
import away3d.core.math.*;
import away3d.core.render.*;
import away3d.core.scene.*;
import flash.geom.*;
import away3d.core.utils.*;
import away3d.core.*;
public class MovieMaterial extends TransformBitmapMaterial implements ITriangleMaterial, IUVMaterial {
public var interactive:Boolean;
public var movie:Sprite;
private var lastsession:int;
public var transparent:Boolean;
public var auto:Boolean;
public function MovieMaterial(_arg1:Sprite, _arg2:Object=null){
super(_bitmap, _arg2);
this.movie = _arg1;
_arg2 = Init.parse(_arg2);
transparent = _arg2.getBoolean("transparent", true);
auto = _arg2.getBoolean("auto", true);
interactive = _arg2.getBoolean("interactive", false);
_bitmap = (_renderBitmap = new BitmapData(_arg1.width, _arg1.height, transparent, (transparent) ? 0xFFFFFF : 4278190080));
}
public function update():void{
if (transparent){
_renderBitmap.fillRect(_renderBitmap.rect, 0xFFFFFF);
};
_renderBitmap.draw(movie, new Matrix(movie.scaleX, 0, 0, movie.scaleY), movie.transform.colorTransform);
}
public function resetInteractiveLayer():void{
movie.x = -10000;
movie.y = -10000;
}
public function onMouseMove(_arg1:MouseEvent3D):void{
movie.x = (_arg1.screenX - (_arg1.uv.u * movie.width));
movie.y = (_arg1.screenY - ((1 - _arg1.uv.v) * movie.height));
}
override public function get height():Number{
return (movie.height);
}
public function get normal():Number3D{
return (new Number3D(0, 0, 0));
}
public function get scale():Number2D{
return (new Number2D(0, 0));
}
public function onMouseOut(_arg1:MouseEvent3D):void{
if (_arg1.material == this){
_arg1.object.removeOnMouseMove(onMouseMove);
resetInteractiveLayer();
};
}
override public function renderTriangle(_arg1:DrawTriangle):void{
session = _arg1.source.session;
if (lastsession != session.time){
lastsession = session.time;
if (auto){
update();
};
if (interactive){
if (!session.view.interactiveLayer.contains(movie)){
session.view.interactiveLayer.addChild(movie);
resetInteractiveLayer();
_arg1.source.addOnMouseOver(onMouseOver);
_arg1.source.addOnMouseOut(onMouseOut);
};
};
};
super.renderTriangle(_arg1);
}
override public function get width():Number{
return (movie.width);
}
public function onMouseOver(_arg1:MouseEvent3D):void{
if (_arg1.material == this){
_arg1.object.addOnMouseMove(onMouseMove);
onMouseMove(_arg1);
};
}
}
}//package away3d.core.material
Section 21
//ShadingColorMaterial (away3d.core.material.ShadingColorMaterial)
package away3d.core.material {
import away3d.core.draw.*;
import away3d.core.mesh.*;
import away3d.core.math.*;
import away3d.core.render.*;
import away3d.core.scene.*;
import away3d.core.utils.*;
import away3d.core.*;
public class ShadingColorMaterial extends CenterLightingMaterial {
var fr:int;
public var static:Boolean;
public var specular:int;
public var diffuse:int;
var sfb:int;
public var alpha:Number;
var sfr:int;
var fg:int;
var sfg:int;
public var ambient:int;
var fb:int;
public function ShadingColorMaterial(_arg1:Object=null){
var _local2:int;
super(_arg1);
_arg1 = Init.parse(_arg1);
_local2 = _arg1.getColor("color", 0xFFFFFF);
ambient = _arg1.getColor("ambient", _local2);
diffuse = _arg1.getColor("diffuse", _local2);
specular = _arg1.getColor("specular", _local2);
alpha = _arg1.getNumber("alpha", 1);
static = _arg1.getBoolean("static", false);
}
override public function renderTri(_arg1:DrawTriangle, _arg2:RenderSession, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number, _arg7:Number, _arg8:Number, _arg9:Number, _arg10:Number, _arg11:Number):void{
fr = int((((((ambient & 0xFF0000) * _arg3) + ((diffuse & 0xFF0000) * _arg6)) + ((specular & 0xFF0000) * _arg9)) >> 16));
fg = int((((((ambient & 0xFF00) * _arg4) + ((diffuse & 0xFF00) * _arg7)) + ((specular & 0xFF00) * _arg10)) >> 8));
fb = int(((((ambient & 0xFF) * _arg5) + ((diffuse & 0xFF) * _arg8)) + ((specular & 0xFF) * _arg11)));
if (fr > 0xFF){
fr = 0xFF;
};
if (fg > 0xFF){
fg = 0xFF;
};
if (fb > 0xFF){
fb = 0xFF;
};
_arg2.renderTriangleColor((((fr << 16) | (fg << 8)) | fb), alpha, _arg1.v0, _arg1.v1, _arg1.v2);
if (static){
if (_arg1.face != null){
sfr = int(((((ambient & 0xFF0000) * _arg3) + ((diffuse & 0xFF0000) * _arg6)) >> 16));
sfg = int(((((ambient & 0xFF00) * _arg4) + ((diffuse & 0xFF00) * _arg7)) >> 8));
sfb = int((((ambient & 0xFF) * _arg5) + ((diffuse & 0xFF) * _arg8)));
if (sfr > 0xFF){
sfr = 0xFF;
};
if (sfg > 0xFF){
sfg = 0xFF;
};
if (sfb > 0xFF){
sfb = 0xFF;
};
_arg1.face.material = new ColorMaterial((((sfr << 16) | (sfg << 8)) | sfb));
};
};
}
override public function get visible():Boolean{
return (true);
}
}
}//package away3d.core.material
Section 22
//TransformBitmapMaterial (away3d.core.material.TransformBitmapMaterial)
package away3d.core.material {
import flash.display.*;
import away3d.core.draw.*;
import away3d.core.mesh.*;
import away3d.core.math.*;
import away3d.core.render.*;
import away3d.core.scene.*;
import flash.geom.*;
import away3d.core.utils.*;
import away3d.core.*;
public class TransformBitmapMaterial extends BitmapMaterial implements ITriangleMaterial, IUVMaterial {
var overlap:Boolean;
var face:Face;
var h:Number;
var i:String;
var t:Matrix;
var w:Number;
var mapa:Number;
var mapb:Number;
var mapd:Number;
var mapc:Number;
var point1:Point;
var DOWN:Number3D;
var fPoint1:Point;
var fPoint2:Point;
var fPoint3:Point;
var zero:Number;
var fPoint4:Point;
var point3:Point;
var point2:Point;
var _projectionVector:Number3D;
var _rotation:Number;// = 0
var maptx:Number;
var _offsetY:Number;// = 0
var _offsetX:Number;// = 0
public var throughProjection:Boolean;
var mapty:Number;
var _u0:Number;
var _u1:Number;
var _u2:Number;
var _v0:Number;
var _v2:Number;
var _v1:Number;
var v0y:Number;
var v0z:Number;
var v0x:Number;
var dot:Number;
var _bitmapRect:Rectangle;
var v1y:Number;
var v1z:Number;
var _scaleX:Number;// = 1
var _scaleY:Number;// = 1
var mPoint2:Point;
var mPoint3:Point;
var mPoint4:Point;
var v1x:Number;
var v2x:Number;
var v2y:Number;
var flag:Boolean;
var v2z:Number;
var mPoint1:Point;
var point:Point;
var sign:Number;
var _M:Number3D;
var _N:Number3D;
var transformDirty:Boolean;
var _transform:Matrix;
var line:Point;
var RIGHT:Number3D;
public function TransformBitmapMaterial(_arg1:BitmapData, _arg2:Object=null){
_transform = new Matrix();
_scaleX = 1;
_scaleY = 1;
_offsetX = 0;
_offsetY = 0;
_rotation = 0;
_N = new Number3D();
_M = new Number3D();
DOWN = new Number3D(0, -1, 0);
RIGHT = new Number3D(1, 0, 0);
fPoint1 = new Point();
fPoint2 = new Point();
fPoint3 = new Point();
fPoint4 = new Point();
mPoint1 = new Point();
mPoint2 = new Point();
mPoint3 = new Point();
mPoint4 = new Point();
line = new Point();
super(_arg1, _arg2);
_arg2 = Init.parse(_arg2);
transform = _arg2.getObject("transform", Matrix);
scaleX = _arg2.getNumber("scaleX", _scaleX);
scaleY = _arg2.getNumber("scaleY", _scaleY);
offsetX = _arg2.getNumber("offsetX", _offsetX);
offsetY = _arg2.getNumber("offsetY", _offsetY);
rotation = _arg2.getNumber("rotation", _rotation);
projectionVector = _arg2.getObject("projectionVector", Number3D);
throughProjection = _arg2.getBoolean("throughProjection", false);
}
public function get offsetX():Number{
return (_offsetX);
}
public function get offsetY():Number{
return (_offsetY);
}
public function set offsetX(_arg1:Number):void{
if (isNaN(_arg1)){
throw (new Error("isNaN(offsetX)"));
};
if (_arg1 == Infinity){
Debug.warning("offsetX == Infinity");
};
if (_arg1 == -(Infinity)){
Debug.warning("offsetX == -Infinity");
};
_offsetX = _arg1;
clearFaceDictionary();
transformDirty = true;
}
public function set offsetY(_arg1:Number):void{
if (isNaN(_arg1)){
throw (new Error("isNaN(offsetY)"));
};
if (_arg1 == Infinity){
Debug.warning("offsetY == Infinity");
};
if (_arg1 == -(Infinity)){
Debug.warning("offsetY == -Infinity");
};
_offsetY = _arg1;
clearFaceDictionary();
transformDirty = true;
}
public function get scaleX():Number{
return (_scaleX);
}
public function get scaleY():Number{
return (_scaleY);
}
override public function clearFaceDictionary():void{
if (!transformDirty){
super.clearFaceDictionary();
};
}
public function getContainerPoints(_arg1:Rectangle):Array{
return ([_arg1.topLeft, new Point(_arg1.top, _arg1.right), _arg1.bottomRight, new Point(_arg1.bottom, _arg1.left)]);
}
public function get projectionVector():Number3D{
return (_projectionVector);
}
override public function getMapping(_arg1:DrawTriangle):Matrix{
face = _arg1.face;
faceDictionaryVO = _faceDictionary[face];
if (((((!(faceDictionaryVO)) || (faceDictionaryVO.dirty))) || (!(_arg1.texturemapping)))){
if (!faceDictionaryVO){
_faceDictionary[face] = new FaceDictionaryVO();
} else {
faceDictionaryVO.dirty = false;
};
if (projectionVector){
_arg1.texturemapping = projectUV(_arg1);
} else {
_arg1.transformUV(this);
};
if (_transform){
mapping = _transform.clone();
mapping.concat(_arg1.texturemapping);
return ((_arg1.texturemapping = mapping));
};
};
return (_arg1.texturemapping);
}
public function set scaleY(_arg1:Number):void{
if (isNaN(_arg1)){
throw (new Error("isNaN(scaleY)"));
};
if (_arg1 == Infinity){
Debug.warning("scaleY == Infinity");
};
if (_arg1 == -(Infinity)){
Debug.warning("scaleY == -Infinity");
};
if (_arg1 == 0){
Debug.warning("scaleY == 0");
};
_scaleY = _arg1;
clearFaceDictionary();
transformDirty = true;
}
public function updateTransform():void{
if ((((((((((_scaleX == 1)) && ((_scaleY == 1)))) && ((_offsetX == 0)))) && ((_offsetY == 0)))) && ((_rotation == 0)))){
_transform = null;
} else {
_transform = new Matrix();
_transform.scale(_scaleX, _scaleY);
_transform.rotate(_rotation);
_transform.translate(_offsetX, _offsetY);
};
transformDirty = false;
}
public function set scaleX(_arg1:Number):void{
if (isNaN(_arg1)){
throw (new Error("isNaN(scaleX)"));
};
if (_arg1 == Infinity){
Debug.warning("scaleX == Infinity");
};
if (_arg1 == -(Infinity)){
Debug.warning("scaleX == -Infinity");
};
if (_arg1 == 0){
Debug.warning("scaleX == 0");
};
_scaleX = _arg1;
clearFaceDictionary();
transformDirty = true;
}
public function set transform(_arg1:Matrix):void{
_transform = _arg1;
if (_transform){
_rotation = Math.atan2(_transform.b, _transform.a);
_scaleX = (_transform.a / Math.cos(_rotation));
_scaleY = (_transform.d / Math.cos(_rotation));
_offsetX = _transform.tx;
_offsetY = _transform.ty;
} else {
_scaleX = (_scaleY = 1);
_offsetX = (_offsetY = (_rotation = 0));
};
clearFaceDictionary();
}
public function set projectionVector(_arg1:Number3D):void{
_projectionVector = _arg1;
if (_projectionVector){
_N.cross(_projectionVector, DOWN);
if (!_N.modulo){
_N = RIGHT;
};
_M.cross(_N, _projectionVector);
_N.cross(_M, _projectionVector);
_N.normalize();
_M.normalize();
};
clearFaceDictionary();
}
public function checkEdge(_arg1:Array, _arg2:Array):Boolean{
for (i in _arg1) {
point2 = _arg1[i];
if (int(i) == 0){
point1 = _arg1[(_arg1.length - 1)];
point3 = _arg1[(_arg1.length - 2)];
} else {
point1 = _arg1[(int(i) - 1)];
if (int(i) == 1){
point3 = _arg1[(_arg1.length - 1)];
} else {
point3 = _arg1[(int(i) - 2)];
};
};
line.x = (point2.y - point1.y);
line.y = (point1.x - point2.x);
zero = ((point1.x * line.x) + (point1.y * line.y));
sign = ((zero - (point3.x * line.x)) - (point3.y * line.y));
flag = true;
for each (point in _arg2) {
dot = ((point.x * line.x) + (point.y * line.y));
if ((zero * sign) > (dot * sign)){
flag = false;
break;
};
};
if (flag){
return (true);
};
};
return (false);
}
override public function renderMaterial(_arg1:Mesh):void{
}
public function set rotation(_arg1:Number):void{
if (isNaN(_arg1)){
throw (new Error("isNaN(rotation)"));
};
if (_arg1 == Infinity){
Debug.warning("rotation == Infinity");
};
if (_arg1 == -(Infinity)){
Debug.warning("rotation == -Infinity");
};
_rotation = _arg1;
clearFaceDictionary();
transformDirty = true;
}
public function findSeparatingAxis(_arg1:Array, _arg2:Array):Boolean{
if (checkEdge(_arg1, _arg2)){
return (true);
};
if (checkEdge(_arg2, _arg1)){
return (true);
};
return (false);
}
override public function renderFace(_arg1:Face, _arg2:Rectangle):void{
if (transformDirty){
updateTransform();
};
if (_transform){
mapping = _transform.clone();
} else {
mapping = new Matrix();
};
faceDictionaryVO = _faceDictionary[_arg1];
if (_projectionVector){
mapping.concat(projectUV(_arg1._dt));
mapping.concat(_arg1._dt.invtexturemapping);
_bitmapRect = _arg1._bitmapRect;
if (!faceDictionaryVO){
faceDictionaryVO = (_faceDictionary[_arg1] = new FaceDictionaryVO());
} else {
faceDictionaryVO.dirty = false;
};
if (((!(repeat)) && (findSeparatingAxis(getFacePoints(_arg1._dt.invtexturemapping), getMappingPoints(mapping))))){
return;
};
} else {
_bitmapRect = _arg2;
mapping.scale((_bitmapRect.width / width), (_bitmapRect.height / height));
if (!faceDictionaryVO){
faceDictionaryVO = (_faceDictionary[_arg1.parent] = new FaceDictionaryVO());
} else {
faceDictionaryVO.dirty = false;
};
};
if (((((_projectionVector) && (!(throughProjection)))) && ((_arg1.normal.dot(_projectionVector) < 0)))){
return;
};
if (!faceDictionaryVO.bitmap){
faceDictionaryVO.bitmap = new BitmapData(_bitmapRect.width, _bitmapRect.height, true, 0);
};
if ((((((((((((mapping.a == 1)) && ((mapping.d == 1)))) && ((mapping.b == 0)))) && ((mapping.c == 0)))) && ((mapping.tx == 0)))) && ((mapping.ty == 0)))){
faceDictionaryVO.bitmap.copyPixels(_bitmap, _bitmapRect, _zeroPoint);
} else {
graphics = shape.graphics;
graphics.clear();
graphics.beginBitmapFill(_bitmap, mapping, repeat, smooth);
graphics.drawRect(0, 0, _bitmapRect.width, _bitmapRect.height);
graphics.endFill();
faceDictionaryVO.bitmap.draw(shape);
};
}
final public function projectUV(_arg1:DrawTriangle):Matrix{
face = _arg1.face;
if (_arg1.backface){
v0x = face.v0.x;
v0y = face.v0.y;
v0z = face.v0.z;
v2x = face.v1.x;
v2y = face.v1.y;
v2z = face.v1.z;
v1x = face.v2.x;
v1y = face.v2.y;
v1z = face.v2.z;
} else {
v0x = face.v0.x;
v0y = face.v0.y;
v0z = face.v0.z;
v1x = face.v1.x;
v1y = face.v1.y;
v1z = face.v1.z;
v2x = face.v2.x;
v2y = face.v2.y;
v2z = face.v2.z;
};
_u0 = (((v0x * _N.x) + (v0y * _N.y)) + (v0z * _N.z));
_u1 = (((v1x * _N.x) + (v1y * _N.y)) + (v1z * _N.z));
_u2 = (((v2x * _N.x) + (v2y * _N.y)) + (v2z * _N.z));
_v0 = (((v0x * _M.x) + (v0y * _M.y)) + (v0z * _M.z));
_v1 = (((v1x * _M.x) + (v1y * _M.y)) + (v1z * _M.z));
_v2 = (((v2x * _M.x) + (v2y * _M.y)) + (v2z * _M.z));
if ((((((_u0 == _u1)) && ((_v0 == _v1)))) || ((((_u0 == _u2)) && ((_v0 == _v2)))))){
if (_u0 > 0.05){
_u0 = (_u0 - 0.05);
} else {
_u0 = (_u0 + 0.05);
};
if (_v0 > 0.07){
_v0 = (_v0 - 0.07);
} else {
_v0 = (_v0 + 0.07);
};
};
if ((((_u2 == _u1)) && ((_v2 == _v1)))){
if (_u2 > 0.04){
_u2 = (_u2 - 0.04);
} else {
_u2 = (_u2 + 0.04);
};
if (_v2 > 0.06){
_v2 = (_v2 - 0.06);
} else {
_v2 = (_v2 + 0.06);
};
};
t = new Matrix((_u1 - _u0), (_v1 - _v0), (_u2 - _u0), (_v2 - _v0), _u0, _v0);
t.invert();
return (t);
}
public function get transform():Matrix{
return (_transform);
}
public function get rotation():Number{
return (_rotation);
}
public function getFacePoints(_arg1:Matrix):Array{
fPoint1.x = (_u0 = _arg1.tx);
fPoint2.x = (_arg1.a + _u0);
fPoint3.x = (_arg1.c + _u0);
fPoint1.y = (_v0 = _arg1.ty);
fPoint2.y = (_arg1.b + _v0);
fPoint3.y = (_arg1.d + _v0);
return ([fPoint1, fPoint2, fPoint3]);
}
public function getMappingPoints(_arg1:Matrix):Array{
mapa = (_arg1.a * width);
mapb = (_arg1.b * height);
mapc = (_arg1.c * width);
mapd = (_arg1.d * height);
maptx = _arg1.tx;
mapty = _arg1.ty;
mPoint1.x = maptx;
mPoint1.y = mapty;
mPoint2.x = (maptx + mapc);
mPoint2.y = (mapty + mapd);
mPoint3.x = ((maptx + mapa) + mapc);
mPoint3.y = ((mapty + mapb) + mapd);
mPoint4.x = (maptx + mapa);
mPoint4.y = (mapty + mapb);
return ([mPoint1, mPoint2, mPoint3, mPoint4]);
}
override public function renderTriangle(_arg1:DrawTriangle):void{
if (transformDirty){
updateTransform();
};
super.renderTriangle(_arg1);
}
}
}//package away3d.core.material
Section 23
//TransparentMaterial (away3d.core.material.TransparentMaterial)
package away3d.core.material {
import away3d.core.draw.*;
public final class TransparentMaterial implements ITriangleMaterial, ISegmentMaterial {
public static var INSTANCE:TransparentMaterial = new (TransparentMaterial);
;
public function renderTriangle(_arg1:DrawTriangle):void{
}
public function get visible():Boolean{
return (false);
}
public function shadeTriangle(_arg1:DrawTriangle):void{
}
public function renderSegment(_arg1:DrawSegment):void{
}
}
}//package away3d.core.material
Section 24
//WhiteShadingBitmapMaterial (away3d.core.material.WhiteShadingBitmapMaterial)
package away3d.core.material {
import flash.display.*;
import away3d.core.draw.*;
import away3d.core.mesh.*;
import away3d.core.math.*;
import away3d.core.render.*;
import away3d.core.scene.*;
import flash.geom.*;
import away3d.core.utils.*;
import flash.utils.*;
import flash.filters.*;
import away3d.core.*;
public class WhiteShadingBitmapMaterial extends CenterLightingMaterial implements IUVMaterial {
var br:Number;
public var blackrender:Boolean;
var faceDictionaryVO:FaceDictionaryVO;
var mapping:Matrix;
private var step:int;// = 1
var _faceDictionary:Dictionary;
public var whiterender:Boolean;
private var colorTransform:ColorMatrixFilter;
public var diffuse:BitmapData;
public var whitek:Number;// = 0.2
private var cache:Dictionary;
public var repeat:Boolean;
public var smooth:Boolean;
private var bitmapPoint:Point;
public function WhiteShadingBitmapMaterial(_arg1:BitmapData, _arg2:Object=null){
_faceDictionary = new Dictionary(true);
whitek = 0.2;
bitmapPoint = new Point(0, 0);
colorTransform = new ColorMatrixFilter();
cache = new Dictionary();
step = 1;
super(_arg2);
this.diffuse = _arg1;
_arg2 = Init.parse(_arg2);
smooth = _arg2.getBoolean("smooth", false);
repeat = _arg2.getBoolean("repeat", false);
}
public function doubleStepTo(_arg1:int):void{
if (step < _arg1){
step = (step * 2);
};
}
protected function ladder(_arg1:Number):Number{
if (_arg1 < (1 / 0xFF)){
return (0);
};
if (_arg1 > 0xFF){
_arg1 = 0xFF;
};
return (Math.exp((Math.round((Math.log(_arg1) * step)) / step)));
}
override public function renderTri(_arg1:DrawTriangle, _arg2:RenderSession, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number, _arg7:Number, _arg8:Number, _arg9:Number, _arg10:Number, _arg11:Number):void{
var _local12:Number;
var _local13:BitmapData;
br = (((((((((_arg3 + _arg4) + _arg5) + _arg6) + _arg7) + _arg8) + _arg9) + _arg10) + _arg11) / 3);
if (!(mapping = _arg1.texturemapping)){
mapping = (_arg1.texturemapping = _arg1.transformUV(this));
};
v0 = _arg1.v0;
v1 = _arg1.v1;
v2 = _arg1.v2;
if ((((br < 1)) && (((blackrender) || ((((step < 16)) && (!(diffuse.transparent)))))))){
_arg2.renderTriangleBitmap(diffuse, mapping, v0, v1, v2, smooth, repeat);
_arg2.renderTriangleColor(0, (1 - br), v0, v1, v2);
} else {
if ((((br > 1)) && (whiterender))){
_arg2.renderTriangleBitmap(diffuse, mapping, v0, v1, v2, smooth, repeat);
_arg2.renderTriangleColor(0xFFFFFF, ((br - 1) * whitek), v0, v1, v2);
} else {
if (step < 64){
if (Math.random() < 0.01){
doubleStepTo(64);
};
};
_local12 = ladder(br);
_local13 = cache[_local12];
if (_local13 == null){
_local13 = new BitmapData(diffuse.width, diffuse.height, true, 0);
colorTransform.matrix = [_local12, 0, 0, 0, 0, 0, _local12, 0, 0, 0, 0, 0, _local12, 0, 0, 0, 0, 0, 1, 0];
_local13.applyFilter(diffuse, _local13.rect, bitmapPoint, colorTransform);
cache[_local12] = _local13;
};
_arg2.renderTriangleBitmap(_local13, ((_arg1.texturemapping) || (_arg1.transformUV(this))), v0, v1, v2, smooth, repeat);
};
};
}
public function clearFaceDictionary():void{
for each (faceDictionaryVO in _faceDictionary) {
if (!faceDictionaryVO.dirty){
faceDictionaryVO.clear();
};
};
}
override public function get visible():Boolean{
return (true);
}
public function get faceDictionary():Dictionary{
return (_faceDictionary);
}
public function renderMaterial(_arg1:Mesh):void{
}
public function renderFace(_arg1:Face, _arg2:Rectangle):void{
}
public function get height():Number{
return (diffuse.height);
}
public function get bitmap():BitmapData{
return (diffuse);
}
public function get width():Number{
return (diffuse.width);
}
}
}//package away3d.core.material
Section 25
//WireColorMaterial (away3d.core.material.WireColorMaterial)
package away3d.core.material {
import flash.display.*;
import away3d.core.draw.*;
import away3d.core.math.*;
import away3d.core.render.*;
import away3d.core.scene.*;
import away3d.core.utils.*;
import away3d.core.*;
public class WireColorMaterial implements ITriangleMaterial {
public var color:int;
public var alpha:Number;
public var width:Number;
public var wirealpha:Number;
var graphics:Graphics;
public var wirecolor:int;
public function WireColorMaterial(_arg1=null, _arg2:Object=null){
if (_arg1 == null){
_arg1 = "random";
};
this.color = Cast.trycolor(_arg1);
_arg2 = Init.parse(_arg2);
alpha = _arg2.getNumber("alpha", 1, {min:0, max:1});
wirecolor = _arg2.getColor("wirecolor", 0);
width = _arg2.getNumber("width", 1, {min:0});
wirealpha = _arg2.getNumber("wirealpha", 1, {min:0, max:1});
}
public function renderTriangle(_arg1:DrawTriangle):void{
_arg1.source.session.renderTriangleLineFill(color, alpha, wirecolor, wirealpha, width, _arg1.v0, _arg1.v1, _arg1.v2);
}
public function get visible():Boolean{
return ((((alpha > 0)) || ((wirealpha > 0))));
}
public function shadeTriangle(_arg1:DrawTriangle):void{
}
}
}//package away3d.core.material
Section 26
//WireframeMaterial (away3d.core.material.WireframeMaterial)
package away3d.core.material {
import flash.display.*;
import away3d.core.draw.*;
import away3d.core.math.*;
import away3d.core.render.*;
import away3d.core.scene.*;
import away3d.core.utils.*;
import away3d.core.*;
public class WireframeMaterial implements ITriangleMaterial, ISegmentMaterial {
public var color:int;
public var width:Number;
public var alpha:Number;
public function WireframeMaterial(_arg1=null, _arg2:Object=null){
if (_arg1 == null){
_arg1 = "random";
};
this.color = Cast.trycolor(_arg1);
_arg2 = Init.parse(_arg2);
alpha = _arg2.getNumber("alpha", 1, {min:0, max:1});
width = _arg2.getNumber("width", 1, {min:0});
}
public function renderTriangle(_arg1:DrawTriangle):void{
if (alpha <= 0){
return;
};
_arg1.source.session.renderTriangleLine(color, alpha, width, _arg1.v0, _arg1.v1, _arg1.v2);
}
public function get visible():Boolean{
return ((alpha > 0));
}
public function shadeTriangle(_arg1:DrawTriangle):void{
}
public function renderSegment(_arg1:DrawSegment):void{
var _local2:Graphics;
if (alpha <= 0){
return;
};
_local2 = _arg1.source.session.graphics;
_local2.lineStyle(width, color, alpha);
_local2.moveTo(_arg1.v0.x, _arg1.v0.y);
_local2.lineTo(_arg1.v1.x, _arg1.v1.y);
_local2.moveTo(_arg1.v0.x, _arg1.v0.y);
}
}
}//package away3d.core.material
Section 27
//Matrix3D (away3d.core.math.Matrix3D)
package away3d.core.math {
public final class Matrix3D {
private var xx:Number;
private var xy:Number;
private var xz:Number;
private var yw:Number;
private var yz:Number;
private var yy:Number;
private var scos:Number;
private var nCos:Number;
private var zw:Number;
private var m211:Number;
private var m213:Number;
private var m212:Number;
private var m214:Number;
private var suv:Number;
private var suw:Number;
private var zz:Number;
private var su:Number;
private var sv:Number;
private var m221:Number;
private var m222:Number;
private var m224:Number;
private var sw:Number;
private var m:Matrix3D;
private var d:Number;
private var svw:Number;
private var m223:Number;
private var m231:Number;
public var tx:Number;
public var ty:Number;
public var tz:Number;
private var m114:Number;
var _position:Number3D;
private var m111:Number;
private var m112:Number;
private var m113:Number;
private var m232:Number;
private var m233:Number;
private var m234:Number;
private var nSin:Number;
private var m121:Number;
private var m123:Number;
private var m122:Number;
private var m124:Number;
public var sxx:Number;
public var sxy:Number;
public var sxz:Number;
private var m131:Number;
private var m132:Number;
private var m133:Number;
private var m134:Number;
public var syx:Number;
public var syy:Number;
public var syz:Number;
public var szx:Number;
public var szy:Number;
public var szz:Number;
private var xw:Number;
private static const toDEGREES:Number = 57.2957795130823;
private static const toRADIANS:Number = 0.0174532925199433;
public function Matrix3D(){
_position = new Number3D();
super();
sxx = (syy = (szz = 1));
sxy = (sxz = (tx = (syx = (syz = (ty = (szx = (szy = (tz = 0))))))));
}
public function get det():Number{
return ((((((sxx * syy) - (syx * sxy)) * szz) - (((sxx * szy) - (szx * sxy)) * syz)) + (((syx * szy) - (szx * syy)) * sxz)));
}
public function multiply(_arg1:Matrix3D, _arg2:Matrix3D):void{
m111 = _arg1.sxx;
m211 = _arg2.sxx;
m121 = _arg1.syx;
m221 = _arg2.syx;
m131 = _arg1.szx;
m231 = _arg2.szx;
m112 = _arg1.sxy;
m212 = _arg2.sxy;
m122 = _arg1.syy;
m222 = _arg2.syy;
m132 = _arg1.szy;
m232 = _arg2.szy;
m113 = _arg1.sxz;
m213 = _arg2.sxz;
m123 = _arg1.syz;
m223 = _arg2.syz;
m133 = _arg1.szz;
m233 = _arg2.szz;
m114 = _arg1.tx;
m214 = _arg2.tx;
m124 = _arg1.ty;
m224 = _arg2.ty;
m134 = _arg1.tz;
m234 = _arg2.tz;
sxx = (((m111 * m211) + (m112 * m221)) + (m113 * m231));
sxy = (((m111 * m212) + (m112 * m222)) + (m113 * m232));
sxz = (((m111 * m213) + (m112 * m223)) + (m113 * m233));
tx = ((((m111 * m214) + (m112 * m224)) + (m113 * m234)) + m114);
syx = (((m121 * m211) + (m122 * m221)) + (m123 * m231));
syy = (((m121 * m212) + (m122 * m222)) + (m123 * m232));
syz = (((m121 * m213) + (m122 * m223)) + (m123 * m233));
ty = ((((m121 * m214) + (m122 * m224)) + (m123 * m234)) + m124);
szx = (((m131 * m211) + (m132 * m221)) + (m133 * m231));
szy = (((m131 * m212) + (m132 * m222)) + (m133 * m232));
szz = (((m131 * m213) + (m132 * m223)) + (m133 * m233));
tz = ((((m131 * m214) + (m132 * m224)) + (m133 * m234)) + m134);
}
public function get position():Number3D{
_position.x = tx;
_position.y = ty;
_position.z = tz;
return (_position);
}
public function inverse(_arg1:Matrix3D):void{
d = _arg1.det;
if (Math.abs(d) < 0.001){
return;
};
d = (1 / d);
m111 = _arg1.sxx;
m121 = _arg1.syx;
m131 = _arg1.szx;
m112 = _arg1.sxy;
m122 = _arg1.syy;
m132 = _arg1.szy;
m113 = _arg1.sxz;
m123 = _arg1.syz;
m133 = _arg1.szz;
m114 = _arg1.tx;
m124 = _arg1.ty;
m134 = _arg1.tz;
sxx = (d * ((m122 * m133) - (m132 * m123)));
sxy = (-(d) * ((m112 * m133) - (m132 * m113)));
sxz = (d * ((m112 * m123) - (m122 * m113)));
tx = (-(d) * (((m112 * ((m123 * m134) - (m133 * m124))) - (m122 * ((m113 * m134) - (m133 * m114)))) + (m132 * ((m113 * m124) - (m123 * m114)))));
syx = (-(d) * ((m121 * m133) - (m131 * m123)));
syy = (d * ((m111 * m133) - (m131 * m113)));
syz = (-(d) * ((m111 * m123) - (m121 * m113)));
ty = (d * (((m111 * ((m123 * m134) - (m133 * m124))) - (m121 * ((m113 * m134) - (m133 * m114)))) + (m131 * ((m113 * m124) - (m123 * m114)))));
szx = (d * ((m121 * m132) - (m131 * m122)));
szy = (-(d) * ((m111 * m132) - (m131 * m112)));
szz = (d * ((m111 * m122) - (m121 * m112)));
tz = (-(d) * (((m111 * ((m122 * m134) - (m132 * m124))) - (m121 * ((m112 * m134) - (m132 * m114)))) + (m131 * ((m112 * m124) - (m122 * m114)))));
}
public function scale(_arg1:Number, _arg2:Number, _arg3:Number):void{
sxx = (sxx * _arg1);
syx = (syx * _arg1);
szx = (szx * _arg1);
sxy = (sxy * _arg2);
syy = (syy * _arg2);
szy = (szy * _arg2);
sxz = (sxz * _arg3);
syz = (syz * _arg3);
szz = (szz * _arg3);
}
public function clone():Matrix3D{
m = new Matrix3D();
m.sxx = sxx;
m.sxy = sxy;
m.sxz = sxz;
m.tx = tx;
m.syx = syx;
m.syy = syy;
m.syz = syz;
m.ty = ty;
m.szx = szx;
m.szy = szy;
m.szz = szz;
m.tz = tz;
return (m);
}
public function toString():String{
var _local1:String;
_local1 = "";
_local1 = (_local1 + ((((((((int((sxx * 1000)) / 1000) + "\t\t") + (int((sxy * 1000)) / 1000)) + "\t\t") + (int((sxz * 1000)) / 1000)) + "\t\t") + (int((tx * 1000)) / 1000)) + "\n"));
_local1 = (_local1 + ((((((((int((syx * 1000)) / 1000) + "\t\t") + (int((syy * 1000)) / 1000)) + "\t\t") + (int((syz * 1000)) / 1000)) + "\t\t") + (int((ty * 1000)) / 1000)) + "\n"));
_local1 = (_local1 + ((((((((int((szx * 1000)) / 1000) + "\t\t") + (int((szy * 1000)) / 1000)) + "\t\t") + (int((szz * 1000)) / 1000)) + "\t\t") + (int((tz * 1000)) / 1000)) + "\n"));
return (_local1);
}
public function matrix2euler():Number3D{
var _local1:Number3D;
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
_local1 = new Number3D();
_local2 = -(Math.asin(Math.max(-1, Math.min(1, sxz))));
_local3 = Math.cos(_local2);
_local1.y = (_local2 * toDEGREES);
if (Math.abs(_local3) > 0.005){
_local4 = (szz / _local3);
_local5 = (-(syz) / _local3);
_local1.x = (Math.atan2(_local5, _local4) * toDEGREES);
_local4 = (sxx / _local3);
_local5 = (-(sxy) / _local3);
_local1.z = (Math.atan2(_local5, _local4) * toDEGREES);
} else {
_local1.x = 0;
_local4 = syy;
_local5 = syx;
_local1.z = (Math.atan2(_local5, _local4) * toDEGREES);
};
return (_local1);
}
public function multiply3x3(_arg1:Matrix3D, _arg2:Matrix3D):void{
m111 = _arg1.sxx;
m211 = _arg2.sxx;
m121 = _arg1.syx;
m221 = _arg2.syx;
m131 = _arg1.szx;
m231 = _arg2.szx;
m112 = _arg1.sxy;
m212 = _arg2.sxy;
m122 = _arg1.syy;
m222 = _arg2.syy;
m132 = _arg1.szy;
m232 = _arg2.szy;
m113 = _arg1.sxz;
m213 = _arg2.sxz;
m123 = _arg1.syz;
m223 = _arg2.syz;
m133 = _arg1.szz;
m233 = _arg2.szz;
sxx = (((m111 * m211) + (m112 * m221)) + (m113 * m231));
sxy = (((m111 * m212) + (m112 * m222)) + (m113 * m232));
sxz = (((m111 * m213) + (m112 * m223)) + (m113 * m233));
syx = (((m121 * m211) + (m122 * m221)) + (m123 * m231));
syy = (((m121 * m212) + (m122 * m222)) + (m123 * m232));
syz = (((m121 * m213) + (m122 * m223)) + (m123 * m233));
szx = (((m131 * m211) + (m132 * m221)) + (m133 * m231));
szy = (((m131 * m212) + (m132 * m222)) + (m133 * m232));
szz = (((m131 * m213) + (m132 * m223)) + (m133 * m233));
tx = _arg1.tx;
ty = _arg1.ty;
tz = _arg1.tz;
}
public function copy3x3(_arg1:Matrix3D):Matrix3D{
sxx = _arg1.sxx;
sxy = _arg1.sxy;
sxz = _arg1.sxz;
syx = _arg1.syx;
syy = _arg1.syy;
syz = _arg1.syz;
szx = _arg1.szx;
szy = _arg1.szy;
szz = _arg1.szz;
return (this);
}
public function scaleMatrix(_arg1:Number, _arg2:Number, _arg3:Number):void{
tx = (sxy = (sxz = 0));
syz = (ty = (syz = 0));
szx = (szy = (tz = 0));
sxx = _arg1;
syy = _arg2;
szz = _arg3;
}
public function quaternion2matrix(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):void{
xx = (_arg1 * _arg1);
xy = (_arg1 * _arg2);
xz = (_arg1 * _arg3);
xw = (_arg1 * _arg4);
yy = (_arg2 * _arg2);
yz = (_arg2 * _arg3);
yw = (_arg2 * _arg4);
zz = (_arg3 * _arg3);
zw = (_arg3 * _arg4);
sxx = (1 - (2 * (yy + zz)));
sxy = (2 * (xy - zw));
sxz = (2 * (xz + yw));
syx = (2 * (xy + zw));
syy = (1 - (2 * (xx + zz)));
syz = (2 * (yz - xw));
szx = (2 * (xz - yw));
szy = (2 * (yz + xw));
szz = (1 - (2 * (xx + yy)));
}
public function translationMatrix(_arg1:Number, _arg2:Number, _arg3:Number):void{
sxx = (syy = (szz = 1));
sxy = (sxz = (syz = (syz = (szx = (szy = 0)))));
tx = _arg1;
ty = _arg2;
tz = _arg3;
}
public function rotationMatrix(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):void{
nCos = Math.cos(_arg4);
nSin = Math.sin(_arg4);
scos = (1 - nCos);
suv = ((_arg1 * _arg2) * scos);
svw = ((_arg2 * _arg3) * scos);
suw = ((_arg1 * _arg3) * scos);
sw = (nSin * _arg3);
sv = (nSin * _arg2);
su = (nSin * _arg1);
sxx = (nCos + ((_arg1 * _arg1) * scos));
sxy = (-(sw) + suv);
sxz = (sv + suw);
syx = (sw + suv);
syy = (nCos + ((_arg2 * _arg2) * scos));
syz = (-(su) + svw);
szx = (-(sv) + suw);
szy = (su + svw);
szz = (nCos + ((_arg3 * _arg3) * scos));
}
public function array2matrix(_arg1:Array):void{
if (_arg1.length >= 12){
sxx = _arg1[0];
sxy = _arg1[1];
sxz = _arg1[2];
tx = _arg1[3];
syx = _arg1[4];
syy = _arg1[5];
syz = _arg1[6];
ty = _arg1[7];
szx = _arg1[8];
szy = _arg1[9];
szz = _arg1[10];
tz = _arg1[11];
};
}
}
}//package away3d.core.math
Section 28
//Number2D (away3d.core.math.Number2D)
package away3d.core.math {
public final class Number2D {
public var x:Number;
public var y:Number;
public static var LEFT:Number2D = new Number2D(-1, 0);
;
public static var DOWN:Number2D = new Number2D(0, -1);
;
public static var UP:Number2D = new Number2D(0, 1);
;
public static var RIGHT:Number2D = new Number2D(1, 0);
;
public function Number2D(_arg1:Number=0, _arg2:Number=0){
this.x = _arg1;
this.y = _arg2;
}
public function normalize():void{
var _local1:Number;
_local1 = modulo;
if (((!((_local1 == 0))) && (!((_local1 == 1))))){
this.x = (this.x / _local1);
this.y = (this.y / _local1);
};
}
public function get modulo():Number{
return (Math.sqrt(((x * x) + (y * y))));
}
public function toString():String{
return (((("x:" + x) + " y:") + y));
}
public function clone():Number2D{
return (new Number2D(x, y));
}
public static function sub(_arg1:Number2D, _arg2:Number2D):Number2D{
return (new Number2D((_arg1.x - _arg2.x), (_arg1.y - _arg2.y)));
}
public static function add(_arg1:Number3D, _arg2:Number3D):Number2D{
return (new Number2D((_arg1.x + _arg2.x), (_arg1.y + _arg2.y)));
}
public static function scale(_arg1:Number2D, _arg2:Number):Number2D{
return (new Number2D((_arg1.x * _arg2), (_arg1.y * _arg2)));
}
public static function dot(_arg1:Number2D, _arg2:Number2D):Number{
return (((_arg1.x * _arg2.x) + (_arg1.y * _arg2.y)));
}
}
}//package away3d.core.math
Section 29
//Number3D (away3d.core.math.Number3D)
package away3d.core.math {
public final class Number3D {
private var mod:Number;
private var num:Number3D;
private var dist:Number;
public var x:Number;
public var y:Number;
public var z:Number;
public static var BACKWARD:Number3D = new Number3D(0, 0, -1);
;
public static var FORWARD:Number3D = new Number3D(0, 0, 1);
;
public static var LEFT:Number3D = new Number3D(-1, 0, 0);
;
public static var DOWN:Number3D = new Number3D(0, -1, 0);
;
public static var UP:Number3D = new Number3D(0, 1, 0);
;
public static var RIGHT:Number3D = new Number3D(1, 0, 0);
;
public function Number3D(_arg1:Number=0, _arg2:Number=0, _arg3:Number=0){
this.x = _arg1;
this.y = _arg2;
this.z = _arg3;
}
public function sub(_arg1:Number3D, _arg2:Number3D):void{
x = (_arg1.x - _arg2.x);
y = (_arg1.y - _arg2.y);
z = (_arg1.z - _arg2.z);
}
public function cross(_arg1:Number3D, _arg2:Number3D):void{
if ((((this == _arg1)) || ((this == _arg2)))){
throw (new Error("resultant cross product cannot be the same instance as an input"));
};
x = ((_arg2.y * _arg1.z) - (_arg2.z * _arg1.y));
y = ((_arg2.z * _arg1.x) - (_arg2.x * _arg1.z));
z = ((_arg2.x * _arg1.y) - (_arg2.y * _arg1.x));
}
public function dot(_arg1:Number3D):Number{
return ((((x * _arg1.x) + (y * _arg1.y)) + (z * _arg1.z)));
}
public function scale(_arg1:Number3D, _arg2:Number):void{
x = (_arg1.x * _arg2);
y = (_arg1.y * _arg2);
z = (_arg1.z * _arg2);
}
public function normalize(_arg1:Number=1):void{
mod = (modulo / _arg1);
if (((!((mod == 0))) && (!((mod == 1))))){
x = (x / mod);
y = (y / mod);
z = (z / mod);
};
}
public function closestPointOnPlane(_arg1:Number3D, _arg2:Number3D, _arg3:Number3D):Number3D{
if (!num){
num = new Number3D();
};
num.sub(_arg1, _arg2);
dist = _arg3.dot(num);
num.scale(_arg3, dist);
num.sub(_arg1, num);
return (num);
}
public function rotate(_arg1:Number3D, _arg2:Matrix3D):void{
x = (((_arg1.x * _arg2.sxx) + (_arg1.y * _arg2.sxy)) + (_arg1.z * _arg2.sxz));
y = (((_arg1.x * _arg2.syx) + (_arg1.y * _arg2.syy)) + (_arg1.z * _arg2.syz));
z = (((_arg1.x * _arg2.szx) + (_arg1.y * _arg2.szy)) + (_arg1.z * _arg2.szz));
}
public function getAngle(_arg1:Number3D=null):Number{
if (_arg1 == null){
_arg1 = new Number3D();
};
return (Math.acos((dot(_arg1) / (modulo * _arg1.modulo))));
}
public function add(_arg1:Number3D, _arg2:Number3D):void{
x = (_arg1.x + _arg2.x);
y = (_arg1.y + _arg2.y);
z = (_arg1.z + _arg2.z);
}
public function clone():Number3D{
return (new Number3D(x, y, z));
}
public function toString():String{
return (((((("x:" + x) + " y:") + y) + " z:") + z));
}
public function distance(_arg1:Number3D):Number{
return (Math.sqrt(((((x - _arg1.x) * (x - _arg1.x)) + ((y - _arg1.y) * (y - _arg1.y))) + ((z - _arg1.z) * (z - _arg1.z)))));
}
public function get modulo():Number{
return (Math.sqrt((((x * x) + (y * y)) + (z * z))));
}
public function get modulo2():Number{
return ((((x * x) + (y * y)) + (z * z)));
}
}
}//package away3d.core.math
Section 30
//Quaternion (away3d.core.math.Quaternion)
package away3d.core.math {
public final class Quaternion {
private var fCosPitchCosYaw:Number;
public var z:Number;
private var fSinPitch:Number;
private var fCosRoll:Number;
private var fSinPitchSinYaw:Number;
private var fCosYaw:Number;
private var fSinRoll:Number;
private var q:Quaternion;
public var w:Number;
public var x:Number;
public var y:Number;
private var fSinYaw:Number;
private var fCosPitch:Number;
public function normalize(_arg1:Number=1):void{
var _local2:Number;
_local2 = (magnitude * _arg1);
x = (x / _local2);
y = (y / _local2);
z = (z / _local2);
w = (w / _local2);
}
public function get magnitude():Number{
return (Math.sqrt(((((w * w) + (x * x)) + (y * y)) + (z * z))));
}
public function euler2quaternion(_arg1:Number, _arg2:Number, _arg3:Number):void{
fSinPitch = Math.sin((_arg1 * 0.5));
fCosPitch = Math.cos((_arg1 * 0.5));
fSinYaw = Math.sin((_arg2 * 0.5));
fCosYaw = Math.cos((_arg2 * 0.5));
fSinRoll = Math.sin((_arg3 * 0.5));
fCosRoll = Math.cos((_arg3 * 0.5));
fCosPitchCosYaw = (fCosPitch * fCosYaw);
fSinPitchSinYaw = (fSinPitch * fSinYaw);
x = ((fSinRoll * fCosPitchCosYaw) - (fCosRoll * fSinPitchSinYaw));
y = (((fCosRoll * fSinPitch) * fCosYaw) + ((fSinRoll * fCosPitch) * fSinYaw));
z = (((fCosRoll * fCosPitch) * fSinYaw) - ((fSinRoll * fSinPitch) * fCosYaw));
w = ((fCosRoll * fCosPitchCosYaw) + (fSinRoll * fSinPitchSinYaw));
}
public static function multiply(_arg1:Quaternion, _arg2:Quaternion):Quaternion{
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:Quaternion;
_local3 = _arg1.w;
_local4 = _arg1.x;
_local5 = _arg1.y;
_local6 = _arg1.z;
_local7 = _arg2.w;
_local8 = _arg2.x;
_local9 = _arg2.y;
_local10 = _arg2.z;
_local11 = new (Quaternion);
_local11.w = ((((_local3 * _local7) - (_local4 * _local8)) - (_local5 * _local9)) - (_local6 * _local10));
_local11.x = ((((_local3 * _local8) + (_local4 * _local7)) + (_local5 * _local10)) - (_local6 * _local9));
_local11.y = ((((_local3 * _local9) + (_local5 * _local7)) + (_local6 * _local8)) - (_local4 * _local10));
_local11.z = ((((_local3 * _local10) + (_local6 * _local7)) + (_local4 * _local9)) - (_local5 * _local8));
return (_local11);
}
public static function axis2quaternion(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Quaternion{
var _local5:Number;
var _local6:Number;
var _local7:Quaternion;
_local5 = Math.sin((_arg4 / 2));
_local6 = Math.cos((_arg4 / 2));
_local7 = new (Quaternion);
_local7.x = (_arg1 * _local5);
_local7.y = (_arg2 * _local5);
_local7.z = (_arg3 * _local5);
_local7.w = _local6;
_local7.normalize();
return (_local7);
}
}
}//package away3d.core.math
Section 31
//Animation (away3d.core.mesh.Animation)
package away3d.core.mesh {
import away3d.core.math.*;
import flash.events.*;
import away3d.core.material.*;
import flash.utils.*;
import away3d.core.*;
public class Animation extends EventDispatcher implements IAnimation {
private var _loop:Boolean;// = false
private var _delay:Number;// = 0
private var _time:uint;
private var _sequence:Array;
private var _running:Boolean;
private var _smooth:Boolean;// = false
private var _latest:Number;// = 0
private var _fps:Number;// = 24
private var _frame:Number;// = 0
public function Animation(){
_frame = 0;
_fps = 24;
_loop = false;
_smooth = false;
_delay = 0;
_sequence = [];
_latest = 0;
super();
}
public function set sequence(_arg1:Array):void{
_sequence = _arg1;
}
public function update(_arg1:BaseMesh):void{
var _local2:uint;
var _local3:Number;
var _local4:Number;
var _local5:Number;
if (!_running){
return;
};
_local2 = getTimer();
_frame = (_frame + (((_local2 - _time) * fps) / 1000));
_time = _local2;
if (_sequence.length == 1){
_frame = 0;
_running = false;
} else {
if (_loop){
while (_frame > ((_sequence.length - 1) + _delay)) {
_frame = (_frame - ((_sequence.length - 1) + _delay));
};
} else {
if (_frame > ((_sequence.length - 1) + _delay)){
_frame = ((_sequence.length - 1) + _delay);
_running = false;
};
};
};
_local3 = _frame;
if (!_smooth){
_local3 = Math.round(_local3);
};
if (_local3 < 0){
_local3 = 0;
};
if (_local3 > (_sequence.length - 1)){
_local3 = (_sequence.length - 1);
};
if (_local3 == Math.round(_local3)){
_arg1.frames[_sequence[int(_local3)].frame].adjust(1);
} else {
_local4 = Math.floor(_local3);
_local5 = Math.ceil(_local3);
_arg1.frames[_sequence[int(_local4)].frame].adjust(1);
_arg1.frames[_sequence[int(_local5)].frame].adjust((_local3 - _local4));
if (_loop){
if ((((((_latest == 0)) || (((_latest + 1) == _sequence[int(_local4)].frame)))) || ((_latest == _sequence[int(_local4)].frame)))){
_latest = _sequence[int(_local4)].frame;
} else {
dispatchEvent(new Event("CYCLE"));
_latest = 0;
};
};
};
}
public function get run():Boolean{
return (_running);
}
public function get sequence():Array{
return (_sequence);
}
public function set fps(_arg1:Number):void{
_fps = _arg1;
}
public function stop():void{
_running = false;
_latest = 0;
}
public function set loop(_arg1:Boolean):void{
_loop = _arg1;
}
public function set smooth(_arg1:Boolean):void{
_smooth = _arg1;
}
public function get loop():Boolean{
return (_loop);
}
public function set delay(_arg1:int):void{
_delay = _arg1;
}
public function get fps():Number{
return (_fps);
}
public function start():void{
_time = getTimer();
_running = true;
_latest = 0;
_frame = 0;
}
public function get smooth():Boolean{
return (_smooth);
}
}
}//package away3d.core.mesh
Section 32
//AnimationFrame (away3d.core.mesh.AnimationFrame)
package away3d.core.mesh {
public class AnimationFrame {
public var frame:Number;
public var time:uint;
public var sort:String;
public function AnimationFrame(_arg1:Number, _arg2:String=null){
this.frame = _arg1;
this.sort = _arg2;
}
}
}//package away3d.core.mesh
Section 33
//BaseMesh (away3d.core.mesh.BaseMesh)
package away3d.core.mesh {
import away3d.core.draw.*;
import away3d.core.math.*;
import away3d.core.render.*;
import flash.events.*;
import away3d.core.scene.*;
import away3d.core.utils.*;
import away3d.core.material.*;
import flash.utils.*;
import away3d.objects.*;
import away3d.core.*;
public class BaseMesh extends Object3D {
private var _maxYElement:IMeshElement;// = null
public var framenames:Dictionary;
private var _radiusElement:IMeshElement;// = null
private var _minXElement:IMeshElement;// = null
private var _maxY:Number;
private var _maxZ:Number;
private var _maxX:Number;
private var _minYDirty:Boolean;// = false
protected var _dsStore:Array;
private var _frame:int;
var seg:DrawSegment;
private var _maxZDirty:Boolean;// = false
private var _radiusDirty:Boolean;// = false
public var frames:Dictionary;
private var sequencedone:Event;
private var _playsequence:Object;
private var cycle:Event;
private var _maxZElement:IMeshElement;// = null
private var _minZDirty:Boolean;// = false
private var _minYElement:IMeshElement;// = null
public var pushback:Boolean;
private var _needNotifyDimensionsChange:Boolean;// = false
private var _minY:Number;// = INF
private var _minZ:Number;// = INF
private var _needNotifyRadiusChange:Boolean;// = false
private var _maxXElement:IMeshElement;// = null
public var type:String;
private var _minX:Number;// = INF
private var _maxXDirty:Boolean;// = false
public var pushfront:Boolean;
private var _verticesDirty:Boolean;// = true
private var _vertices:Array;
public var url:String;
public var animation:Animation;
private var _minXDirty:Boolean;// = false
private var _radius:Number;// = 0
protected var _dsActive:Array;
private var _minZElement:IMeshElement;// = null
private var _maxYDirty:Boolean;// = false
public function BaseMesh(_arg1:Object=null){
_verticesDirty = true;
_radiusElement = null;
_radiusDirty = false;
_radius = 0;
_maxXElement = null;
_maxXDirty = false;
_maxX = -(Infinity);
_minXElement = null;
_minXDirty = false;
_minX = Infinity;
_maxYElement = null;
_maxYDirty = false;
_maxY = -(Infinity);
_minYElement = null;
_minYDirty = false;
_minY = Infinity;
_maxZElement = null;
_maxZDirty = false;
_maxZ = -(Infinity);
_minZElement = null;
_minZDirty = false;
_minZ = Infinity;
_needNotifyRadiusChange = false;
_needNotifyDimensionsChange = false;
_dsStore = new Array();
_dsActive = new Array();
super(_arg1);
_arg1 = Init.parse(_arg1);
pushback = _arg1.getBoolean("pushback", false);
pushfront = _arg1.getBoolean("pushfront", false);
}
public function removeOnSequenceDone(_arg1:Function):void{
removeEventListener("SEQUENCE_DONE", _arg1, false);
}
override public function get minX():Number{
var _local1:Number;
var _local2:IMeshElement;
var _local3:Number;
if (_minXDirty){
_minXElement = null;
_local1 = Infinity;
for each (_local2 in elements) {
_local3 = _local2.minX;
if (_local3 < _local1){
_local1 = _local3;
_minXElement = _local2;
};
};
_minX = _local1;
_minXDirty = false;
};
return (_minX);
}
override public function get minZ():Number{
var _local1:Number;
var _local2:IMeshElement;
var _local3:Number;
if (_minZDirty){
_local1 = Infinity;
_minZElement = null;
for each (_local2 in elements) {
_local3 = _local2.minZ;
if (_local3 < _local1){
_local1 = _local3;
_minZElement = _local2;
};
};
_minZ = _local1;
_minZDirty = false;
};
return (_minZ);
}
override public function get minY():Number{
var _local1:Number;
var _local2:IMeshElement;
var _local3:Number;
if (_minYDirty){
_local1 = Infinity;
_minYElement = null;
for each (_local2 in elements) {
_local3 = _local2.minY;
if (_local3 < _local1){
_local1 = _local3;
_minYElement = _local2;
};
};
_minY = _local1;
_minYDirty = false;
};
return (_minY);
}
public function scaleZ(_arg1:Number):void{
if (_arg1 != 1){
scaleXYZ(1, 1, _arg1);
};
}
private function clear():void{
throw (new Error("Not implemented"));
}
public function scaleY(_arg1:Number):void{
if (_arg1 != 1){
scaleXYZ(1, _arg1, 1);
};
}
public function onSequenseDone(_arg1:Function):void{
addEventListener("SEQUENCE_DONE", _arg1, false, 0, false);
}
public function scaleX(_arg1:Number):void{
if (_arg1 != 1){
scaleXYZ(_arg1, 1, 1);
};
}
public function onCycleDone(_arg1:Function):void{
cycle = new Event("CYCLE_DONE");
addEventListener("CYCLE_DONE", _arg1, false, 0, false);
}
override public function primitives(_arg1:IPrimitiveConsumer, _arg2:RenderSession):void{
super.primitives(_arg1, _arg2);
_dsStore = _dsStore.concat(_dsActive);
_dsActive = new Array();
}
private function launchNotifies():void{
if (_needNotifyRadiusChange){
_needNotifyRadiusChange = false;
notifyRadiusChange();
};
if (_needNotifyDimensionsChange){
_needNotifyDimensionsChange = false;
notifyDimensionsChange();
};
}
override public function get radius():Number{
var _local1:Number;
var _local2:IMeshElement;
var _local3:Number;
if (_radiusDirty){
_radiusElement = null;
_local1 = 0;
for each (_local2 in elements) {
_local3 = _local2.radius2;
if (_local3 > _local1){
_local1 = _local3;
_radiusElement = _local2;
};
};
_radius = Math.sqrt(_local1);
_radiusDirty = false;
};
return (_radius);
}
private function updatePlaySequence(_arg1:Event):void{
if (_playsequence.playlist.length == 0){
animation.removeEventListener("CYCLE", updatePlaySequence);
if (sequencedone == null){
sequencedone = new Event("SEQUENCE_DONE");
};
dispatchEvent(sequencedone);
};
play(_playsequence.playlist.shift());
if (cycle != null){
dispatchEvent(cycle);
};
}
public function createDrawSegment(_arg1:ISegmentMaterial, _arg2:Projection, _arg3:ScreenVertex, _arg4:ScreenVertex):DrawSegment{
if (_dsStore.length){
_dsActive.push((seg = _dsStore.pop()));
seg.create = createDrawSegment;
} else {
_dsActive.push((seg = new DrawSegment()));
seg.source = this;
seg.create = createDrawSegment;
};
seg.material = _arg1;
seg.projection = _arg2;
seg.v0 = _arg3;
seg.v1 = _arg4;
seg.calc();
return (seg);
}
public function setPlaySequences(_arg1:Array, _arg2:Boolean=false):void{
if (_arg1.length == 0){
return;
};
play(_arg1.shift());
if (!animation.hasEventListener("CYCLE")){
_playsequence = new Object();
_playsequence.playlist = _arg1;
_playsequence.loopLast = _arg2;
loop = true;
animation.addEventListener("CYCLE", updatePlaySequence);
};
}
public function gotoAndPlay(_arg1:int):void{
frame = _arg1;
if (!animation.run){
animation.start();
};
}
public function set frame(_arg1:int):void{
if (_frame == _arg1){
return;
};
_frame = _arg1;
frames[_frame].adjust(1);
}
public function get elements():Array{
throw (new Error("Not implemented"));
}
protected function addElement(_arg1:IMeshElement):void{
_verticesDirty = true;
_arg1.addOnVertexChange(onElementVertexChange);
_arg1.addOnVertexValueChange(onElementVertexValueChange);
rememberElementRadius(_arg1);
launchNotifies();
}
private function rememberElementRadius(_arg1:IMeshElement):void{
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
_local2 = _arg1.radius2;
if (_local2 > (_radius * _radius)){
_radius = Math.sqrt(_local2);
_radiusElement = _arg1;
_radiusDirty = false;
_needNotifyRadiusChange = true;
};
_local3 = _arg1.maxX;
if (_local3 > _maxX){
_maxX = _local3;
_maxXElement = _arg1;
_maxXDirty = false;
_needNotifyDimensionsChange = true;
};
_local4 = _arg1.minX;
if (_local4 < _minX){
_minX = _local4;
_minXElement = _arg1;
_minXDirty = false;
_needNotifyDimensionsChange = true;
};
_local5 = _arg1.maxY;
if (_local5 > _maxY){
_maxY = _local5;
_maxYElement = _arg1;
_maxYDirty = false;
_needNotifyDimensionsChange = true;
};
_local6 = _arg1.minY;
if (_local6 < _minY){
_minY = _local6;
_minYElement = _arg1;
_minYDirty = false;
_needNotifyDimensionsChange = true;
};
_local7 = _arg1.maxZ;
if (_local7 > _maxZ){
_maxZ = _local7;
_maxZElement = _arg1;
_maxZDirty = false;
_needNotifyDimensionsChange = true;
};
_local8 = _arg1.minZ;
if (_local8 < _minZ){
_minZ = _local8;
_minZElement = _arg1;
_minZDirty = false;
_needNotifyDimensionsChange = true;
};
}
private function onElementVertexChange(_arg1:MeshElementEvent):void{
var _local2:IMeshElement;
_local2 = _arg1.element;
forgetElementRadius(_local2);
rememberElementRadius(_local2);
_verticesDirty = true;
launchNotifies();
}
public function removeOnCycleDone(_arg1:Function):void{
cycle = null;
removeEventListener("CYCLE_DONE", _arg1, false);
}
public function set loop(_arg1:Boolean):void{
animation.loop = _arg1;
}
override public function scale(_arg1:Number):void{
scaleXYZ(_arg1, _arg1, _arg1);
}
public function play(_arg1:Object=null):void{
var _local2:Number;
var _local3:String;
var _local4:Boolean;
var _local5:Boolean;
var _local6:String;
_arg1 = Init.parse(_arg1);
_local2 = _arg1.getNumber("fps", 24);
_local3 = _arg1.getString("prefix", null);
_local4 = _arg1.getBoolean("smooth", false);
_local5 = _arg1.getBoolean("loop", false);
if (!animation){
animation = new Animation();
} else {
animation.sequence = new Array();
};
animation.fps = _local2;
animation.smooth = _local4;
animation.loop = _local5;
if (_local3 != null){
for (_local6 in framenames) {
if (_local6.indexOf(_local3) == 0){
animation.sequence.push(new AnimationFrame(framenames[_local6], ("" + parseInt(_local6.substring(_local3.length)))));
};
};
animation.sequence.sortOn("sort", Array.NUMERIC);
};
frames[_frame].adjust(1);
animation.start();
}
public function set smooth(_arg1:Boolean):void{
animation.smooth = _arg1;
}
public function get frame():int{
return (_frame);
}
override public function get maxY():Number{
var _local1:Number;
var _local2:IMeshElement;
var _local3:Number;
if (_maxYDirty){
_local1 = -(Infinity);
_maxYElement = null;
for each (_local2 in elements) {
_local3 = _local2.maxY;
if (_local3 > _local1){
_local1 = _local3;
_maxYElement = _local2;
};
};
_maxY = _local1;
_maxYDirty = false;
};
return (_maxY);
}
override public function get maxZ():Number{
var _local1:Number;
var _local2:IMeshElement;
var _local3:Number;
if (_maxZDirty){
_local1 = -(Infinity);
_maxZElement = null;
for each (_local2 in elements) {
_local3 = _local2.maxZ;
if (_local3 > _local1){
_local1 = _local3;
_maxZElement = _local2;
};
};
_maxZ = _local1;
_maxZDirty = false;
};
return (_maxZ);
}
override public function get maxX():Number{
var _local1:Number;
var _local2:IMeshElement;
var _local3:Number;
if (_maxXDirty){
_maxXElement = null;
_local1 = -(Infinity);
for each (_local2 in elements) {
_local3 = _local2.maxX;
if (_local3 > _local1){
_local1 = _local3;
_maxXElement = _local2;
};
};
_maxX = _local1;
_maxXDirty = false;
};
return (_maxX);
}
public function scaleAnimation(_arg1:Number):void{
var _local2:Array;
var _local3:int;
var _local4:int;
var _local5:String;
var _local6:Frame;
_local2 = new Array();
_local3 = 0;
_local4 = 0;
for (_local5 in framenames) {
_local2.push(_local5);
};
_local3 = 0;
while (_local3 < _local2.length) {
_local6 = frames[framenames[_local2[_local3]]];
_local4 = 0;
while (_local4 < _local6.vertexpositions.length) {
_local6.vertexpositions[_local4].x = (_local6.vertexpositions[_local4].x * _arg1);
_local6.vertexpositions[_local4].y = (_local6.vertexpositions[_local4].y * _arg1);
_local6.vertexpositions[_local4].z = (_local6.vertexpositions[_local4].z * _arg1);
_local4++;
};
_local3++;
};
}
override public function tick(_arg1:int):void{
if (((!((animation == null))) && (!((frames == null))))){
animation.update(this);
};
}
public function gotoAndStop(_arg1:int):void{
frame = _arg1;
if (animation.run){
animation.stop();
};
}
private function onElementVertexValueChange(_arg1:MeshElementEvent):void{
var _local2:IMeshElement;
_local2 = _arg1.element;
forgetElementRadius(_local2);
rememberElementRadius(_local2);
launchNotifies();
}
public function get running():Boolean{
return (animation.run);
}
private function forgetElementRadius(_arg1:IMeshElement):void{
if (_arg1 == _radiusElement){
_radiusElement = null;
_radiusDirty = true;
_needNotifyRadiusChange = true;
};
if (_arg1 == _maxXElement){
_maxXElement = null;
_maxXDirty = true;
_needNotifyDimensionsChange = true;
};
if (_arg1 == _minXElement){
_minXElement = null;
_minXDirty = true;
_needNotifyDimensionsChange = true;
};
if (_arg1 == _maxYElement){
_maxYElement = null;
_maxYDirty = true;
_needNotifyDimensionsChange = true;
};
if (_arg1 == _minYElement){
_minYElement = null;
_minYDirty = true;
_needNotifyDimensionsChange = true;
};
if (_arg1 == _maxZElement){
_maxZElement = null;
_maxZDirty = true;
_needNotifyDimensionsChange = true;
};
if (_arg1 == _minZElement){
_minZElement = null;
_minZDirty = true;
_needNotifyDimensionsChange = true;
};
}
public function set fps(_arg1:int):void{
animation.fps = ((_arg1)>=1) ? _arg1 : 1;
}
protected function removeElement(_arg1:IMeshElement):void{
forgetElementRadius(_arg1);
_arg1.removeOnVertexValueChange(onElementVertexValueChange);
_arg1.removeOnVertexChange(onElementVertexChange);
_verticesDirty = true;
launchNotifies();
}
protected function scaleXYZ(_arg1:Number, _arg2:Number, _arg3:Number):void{
var _local4:Vertex;
for each (_local4 in vertices) {
_local4.x = (_local4.x * _arg1);
_local4.y = (_local4.y * _arg2);
_local4.z = (_local4.z * _arg3);
};
}
public function get vertices():Array{
var _local1:Dictionary;
var _local2:IMeshElement;
var _local3:Vertex;
if (_verticesDirty){
_vertices = [];
_local1 = new Dictionary();
for each (_local2 in elements) {
for each (_local3 in _local2.vertices) {
if (!_local1[_local3]){
_vertices.push(_local3);
_local1[_local3] = true;
};
};
};
_verticesDirty = false;
};
return (_vertices);
}
}
}//package away3d.core.mesh
Section 34
//BaseMeshElement (away3d.core.mesh.BaseMeshElement)
package away3d.core.mesh {
import away3d.core.utils.*;
import away3d.core.*;
public class BaseMeshElement extends LazyEventDispatcher implements IMeshElement {
private var visiblechanged:MeshElementEvent;
private var vertexchanged:MeshElementEvent;
arcane var _visible:Boolean;// = true
private var vertexvaluechanged:MeshElementEvent;
public function BaseMeshElement(){
_visible = true;
super();
}
protected function notifyVisibleChange():void{
if (!hasEventListener("visiblechanged")){
return;
};
if (visiblechanged == null){
visiblechanged = new MeshElementEvent("visiblechanged", this);
};
dispatchEvent(visiblechanged);
}
public function removeOnVertexValueChange(_arg1:Function):void{
removeEventListener("vertexvaluechanged", _arg1, false);
}
public function get visible():Boolean{
return (_visible);
}
protected function notifyVertexValueChange():void{
if (!hasEventListener("vertexvaluechanged")){
return;
};
if (vertexvaluechanged == null){
vertexvaluechanged = new MeshElementEvent("vertexvaluechanged", this);
};
dispatchEvent(vertexvaluechanged);
}
public function removeOnVertexChange(_arg1:Function):void{
removeEventListener("vertexchanged", _arg1, false);
}
public function removeOnVisibleChange(_arg1:Function):void{
removeEventListener("visiblechanged", _arg1, false);
}
public function addOnVertexValueChange(_arg1:Function):void{
addEventListener("vertexvaluechanged", _arg1, false, 0, true);
}
public function addOnVisibleChange(_arg1:Function):void{
addEventListener("visiblechanged", _arg1, false, 0, true);
}
public function get minX():Number{
return (-(Math.sqrt(radius2)));
}
public function get minY():Number{
return (-(Math.sqrt(radius2)));
}
public function get minZ():Number{
return (-(Math.sqrt(radius2)));
}
protected function notifyVertexChange():void{
if (!hasEventListener("vertexchanged")){
return;
};
if (vertexchanged == null){
vertexchanged = new MeshElementEvent("vertexchanged", this);
};
dispatchEvent(vertexchanged);
}
public function set visible(_arg1:Boolean):void{
if (_arg1 == _visible){
return;
};
_visible = _arg1;
notifyVisibleChange();
}
public function get radius2():Number{
var _local1:Number;
var _local2:Vertex;
var _local3:Number;
_local1 = 0;
for each (_local2 in vertices) {
_local3 = (((_local2._x * _local2._x) + (_local2._y * _local2._y)) + (_local2._z * _local2._z));
if (_local3 > _local1){
_local1 = _local3;
};
};
return (_local1);
}
public function get maxX():Number{
return (Math.sqrt(radius2));
}
public function get maxZ():Number{
return (Math.sqrt(radius2));
}
public function get vertices():Array{
throw (new Error("Not implemented"));
}
public function addOnVertexChange(_arg1:Function):void{
addEventListener("vertexchanged", _arg1, false, 0, true);
}
public function get maxY():Number{
return (Math.sqrt(radius2));
}
}
}//package away3d.core.mesh
Section 35
//Face (away3d.core.mesh.Face)
package away3d.core.mesh {
import away3d.core.draw.*;
import away3d.core.math.*;
import away3d.core.render.*;
import flash.events.*;
import flash.geom.*;
import away3d.core.material.*;
import away3d.core.*;
public class Face extends BaseMeshElement {
private var _normal:Number3D;
public var extra:Object;
arcane var _v0:Vertex;
arcane var _v1:Vertex;
arcane var _v2:Vertex;
private var mappingchanged:FaceEvent;
arcane var _dt:DrawTriangle;
arcane var _bitmapRect:Rectangle;
var a:Number;
var b:Number;
var c:Number;
var s:Number;
arcane var _material:ITriangleMaterial;
public var parent:Mesh;
private var materialchanged:FaceEvent;
arcane var _mappingmaterial:IUVMaterial;
arcane var _back:ITriangleMaterial;
arcane var _uv0:UV;
arcane var _uv1:UV;
arcane var _uv2:UV;
public function Face(_arg1:Vertex, _arg2:Vertex, _arg3:Vertex, _arg4:ITriangleMaterial=null, _arg5:UV=null, _arg6:UV=null, _arg7:UV=null){
_dt = new DrawTriangle();
super();
this.v0 = _arg1;
this.v1 = _arg2;
this.v2 = _arg3;
this.material = _arg4;
this.uv0 = _arg5;
this.uv1 = _arg6;
this.uv2 = _arg7;
_dt.face = this;
}
public function get uvs():Array{
return ([_uv0, _uv1, _uv2]);
}
public function set v0(_arg1:Vertex):void{
if (_arg1 == _v0){
return;
};
if (_v0 != null){
if (((!((_v0 == _v1))) && (!((_v0 == _v2))))){
_v0.removeOnChange(onVertexValueChange);
};
};
_v0 = _arg1;
if (_v0 != null){
if (((!((_v0 == _v1))) && (!((_v0 == _v2))))){
_v0.addOnChange(onVertexValueChange);
};
};
notifyVertexChange();
}
private function onVertexValueChange(_arg1:Event):void{
_normal = null;
notifyVertexValueChange();
}
public function set v2(_arg1:Vertex):void{
if (_arg1 == _v2){
return;
};
if (_v2 != null){
if (((!((_v2 == _v1))) && (!((_v2 == _v0))))){
_v2.removeOnChange(onVertexValueChange);
};
};
_v2 = _arg1;
if (_v2 != null){
if (((!((_v2 == _v1))) && (!((_v2 == _v0))))){
_v2.addOnChange(onVertexValueChange);
};
};
notifyVertexChange();
}
public function get material():ITriangleMaterial{
return (_material);
}
arcane function front(_arg1:Projection):Number{
var _local2:ScreenVertex;
var _local3:ScreenVertex;
var _local4:ScreenVertex;
_local2 = _v0.project(_arg1);
_local3 = _v1.project(_arg1);
_local4 = _v2.project(_arg1);
return ((((_local2.x * (_local4.y - _local3.y)) + (_local3.x * (_local2.y - _local4.y))) + (_local4.x * (_local3.y - _local2.y))));
}
public function addOnMaterialChange(_arg1:Function):void{
addEventListener("materialchanged", _arg1, false, 0, true);
}
public function removeOnMaterialChange(_arg1:Function):void{
removeEventListener("materialchanged", _arg1, false);
}
public function get minU():Number{
if (_uv0._u < _uv1._u){
if (_uv0._u < _uv2._u){
return (_uv0._u);
};
return (_uv2._u);
//unresolved jump
};
if (_uv1._u < _uv2._u){
return (_uv1._u);
};
return (_uv2._u);
}
public function get minV():Number{
if (_uv0._v < _uv1._v){
if (_uv0._v < _uv2._v){
return (_uv0._v);
};
return (_uv2._v);
//unresolved jump
};
if (_uv1._v < _uv2._v){
return (_uv1._v);
};
return (_uv2._v);
}
override public function get minX():Number{
if (_v0._x < _v1._x){
if (_v0._x < _v2._x){
return (_v0._x);
};
return (_v2._x);
//unresolved jump
};
if (_v1._x < _v2._x){
return (_v1._x);
};
return (_v2._x);
}
override public function get minY():Number{
if (_v0._y < _v1._y){
if (_v0._y < _v2._y){
return (_v0._y);
};
return (_v2._y);
//unresolved jump
};
if (_v1._y < _v2._y){
return (_v1._y);
};
return (_v2._y);
}
override public function get minZ():Number{
if (_v0._z < _v1._z){
if (_v0._z < _v2._z){
return (_v0._z);
};
return (_v2._z);
//unresolved jump
};
if (_v1._z < _v2._z){
return (_v1._z);
};
return (_v2._z);
}
public function set material(_arg1:ITriangleMaterial):void{
if (_arg1 == _material){
return;
};
_material = _arg1;
notifyMaterialChange();
}
public function removeOnMappingChange(_arg1:Function):void{
removeEventListener("mappingchanged", _arg1, false);
}
protected function notifyMappingChange():void{
_dt.texturemapping = null;
if (!hasEventListener("mappingchanged")){
return;
};
if (mappingchanged == null){
mappingchanged = new FaceEvent("mappingchanged", this);
};
dispatchEvent(mappingchanged);
}
public function set uv1(_arg1:UV):void{
if (_arg1 == _uv1){
return;
};
if (_uv1 != null){
if (((!((_uv1 == _uv0))) && (!((_uv1 == _uv2))))){
_uv1.removeOnChange(onUVChange);
};
};
_uv1 = _arg1;
if (_uv1 != null){
if (((!((_uv1 == _uv0))) && (!((_uv1 == _uv2))))){
_uv1.addOnChange(onUVChange);
};
};
notifyMappingChange();
}
public function set uv0(_arg1:UV):void{
if (_arg1 == _uv0){
return;
};
if (_uv0 != null){
if (((!((_uv0 == _uv1))) && (!((_uv0 == _uv2))))){
_uv0.removeOnChange(onUVChange);
};
};
_uv0 = _arg1;
if (_uv0 != null){
if (((!((_uv0 == _uv1))) && (!((_uv0 == _uv2))))){
_uv0.addOnChange(onUVChange);
};
};
notifyMappingChange();
}
protected function notifyMaterialChange():void{
_dt.texturemapping = null;
if (!hasEventListener("materialchanged")){
return;
};
if (materialchanged == null){
materialchanged = new FaceEvent("materialchanged", this);
};
dispatchEvent(materialchanged);
}
public function set uv2(_arg1:UV):void{
if (_arg1 == _uv2){
return;
};
if (_uv2 != null){
if (((!((_uv2 == _uv1))) && (!((_uv2 == _uv0))))){
_uv2.removeOnChange(onUVChange);
};
};
_uv2 = _arg1;
if (_uv2 != null){
if (((!((_uv2 == _uv1))) && (!((_uv2 == _uv0))))){
_uv2.addOnChange(onUVChange);
};
};
notifyMappingChange();
}
public function get maxU():Number{
if (_uv0._u > _uv1._u){
if (_uv0.u > _uv2._u){
return (_uv0._u);
};
return (_uv2._u);
//unresolved jump
};
if (_uv1._u > _uv2._u){
return (_uv1._u);
};
return (_uv2._u);
}
override public function get maxX():Number{
if (_v0._x > _v1._x){
if (_v0._x > _v2._x){
return (_v0._x);
};
return (_v2._x);
//unresolved jump
};
if (_v1._x > _v2._x){
return (_v1._x);
};
return (_v2._x);
}
public function get maxV():Number{
if (_uv0._v > _uv1._v){
if (_uv0._v > _uv2._v){
return (_uv0._v);
};
return (_uv2._v);
//unresolved jump
};
if (_uv1._v > _uv2._v){
return (_uv1._v);
};
return (_uv2._v);
}
public function get v0():Vertex{
return (_v0);
}
public function get v1():Vertex{
return (_v1);
}
public function get v2():Vertex{
return (_v2);
}
override public function get maxZ():Number{
if (_v0._z > _v1._z){
if (_v0._z > _v2._z){
return (_v0._z);
};
return (_v2._z);
//unresolved jump
};
if (_v1._z > _v2._z){
return (_v1._z);
};
return (_v2._z);
}
override public function get maxY():Number{
if (_v0._y > _v1._y){
if (_v0._y > _v2._y){
return (_v0._y);
};
return (_v2._y);
//unresolved jump
};
if (_v1._y > _v2._y){
return (_v1._y);
};
return (_v2._y);
}
private function onUVChange(_arg1:Event):void{
notifyMappingChange();
}
public function get area():Number{
a = v0.position.distance(v1.position);
b = v1.position.distance(v2.position);
c = v2.position.distance(v0.position);
s = (((a + b) + c) / 2);
return (Math.sqrt((((s * (s - a)) * (s - b)) * (s - c))));
}
public function addOnMappingChange(_arg1:Function):void{
addEventListener("mappingchanged", _arg1, false, 0, true);
}
public function get uv0():UV{
return (_uv0);
}
public function get uv1():UV{
return (_uv1);
}
public function get uv2():UV{
return (_uv2);
}
public function set back(_arg1:ITriangleMaterial):void{
if (_arg1 == _back){
return;
};
_back = _arg1;
}
public function invert():void{
var _local1:Vertex;
var _local2:Vertex;
var _local3:UV;
var _local4:UV;
_local1 = this._v1;
_local2 = this._v2;
_local3 = this._uv1;
_local4 = this._uv2;
this._v1 = _local2;
this._v2 = _local1;
this._uv1 = _local4;
this._uv2 = _local3;
notifyVertexChange();
notifyMappingChange();
}
public function get normal():Number3D{
var _local1:Number;
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
if (!_normal){
_normal = new Number3D();
_local1 = (_v1.x - _v0.x);
_local2 = (_v1.y - _v0.y);
_local3 = (_v1.z - _v0.z);
_local4 = (_v2.x - _v0.x);
_local5 = (_v2.y - _v0.y);
_local6 = (_v2.z - _v0.z);
_local7 = ((_local2 * _local6) - (_local3 * _local5));
_local8 = ((_local3 * _local4) - (_local1 * _local6));
_local9 = ((_local1 * _local5) - (_local2 * _local4));
_local10 = Math.sqrt((((_local7 * _local7) + (_local8 * _local8)) + (_local9 * _local9)));
_normal.x = (_local7 / _local10);
_normal.y = (_local8 / _local10);
_normal.z = (_local9 / _local10);
};
return (_normal);
}
public function get back():ITriangleMaterial{
return (_back);
}
override public function get radius2():Number{
var _local1:Number;
var _local2:Number;
var _local3:Number;
_local1 = (((_v0._x * _v0._x) + (_v0._y * _v0._y)) + (_v0._z * _v0._z));
_local2 = (((_v1._x * _v1._x) + (_v1._y * _v1._y)) + (_v1._z * _v1._z));
_local3 = (((_v2._x * _v2._x) + (_v2._y * _v2._y)) + (_v2._z * _v2._z));
if (_local1 > _local2){
if (_local1 > _local3){
return (_local1);
};
return (_local3);
//unresolved jump
};
if (_local2 > _local3){
return (_local2);
};
return (_local3);
}
private function onVertexChange(_arg1:Event):void{
_normal = null;
notifyVertexChange();
}
public function set v1(_arg1:Vertex):void{
if (_arg1 == _v1){
return;
};
if (_v1 != null){
if (((!((_v1 == _v0))) && (!((_v1 == _v2))))){
_v1.removeOnChange(onVertexValueChange);
};
};
_v1 = _arg1;
if (_v1 != null){
if (((!((_v1 == _v0))) && (!((_v1 == _v2))))){
_v1.addOnChange(onVertexValueChange);
};
};
notifyVertexChange();
}
override public function get vertices():Array{
return ([_v0, _v1, _v2]);
}
}
}//package away3d.core.mesh
Section 36
//FaceEvent (away3d.core.mesh.FaceEvent)
package away3d.core.mesh {
import flash.events.*;
public class FaceEvent extends Event {
public var face:Face;
public function FaceEvent(_arg1:String, _arg2:Face){
super(_arg1);
this.face = _arg2;
}
override public function clone():Event{
return (new FaceEvent(type, face));
}
}
}//package away3d.core.mesh
Section 37
//Frame (away3d.core.mesh.Frame)
package away3d.core.mesh {
public class Frame {
public var vertexpositions:Array;
public function Frame(){
vertexpositions = [];
super();
}
public function adjust(_arg1:Number=1):void{
var _local2:VertexPosition;
for each (_local2 in vertexpositions) {
_local2.adjust(_arg1);
};
}
}
}//package away3d.core.mesh
Section 38
//IAnimation (away3d.core.mesh.IAnimation)
package away3d.core.mesh {
public interface IAnimation {
function update(_arg1:BaseMesh):void;
}
}//package away3d.core.mesh
Section 39
//IMeshElement (away3d.core.mesh.IMeshElement)
package away3d.core.mesh {
public interface IMeshElement {
function get radius2():Number;
function addOnVisibleChange(_arg1:Function):void;
function get minX():Number;
function get minZ():Number;
function get minY():Number;
function get visible():Boolean;
function get maxX():Number;
function get maxY():Number;
function get maxZ():Number;
function removeOnVertexChange(_arg1:Function):void;
function get vertices():Array;
function removeOnVertexValueChange(_arg1:Function):void;
function addOnVertexChange(_arg1:Function):void;
function addOnVertexValueChange(_arg1:Function):void;
function removeOnVisibleChange(_arg1:Function):void;
}
}//package away3d.core.mesh
Section 40
//Mesh (away3d.core.mesh.Mesh)
package away3d.core.mesh {
import flash.display.*;
import away3d.core.draw.*;
import away3d.core.math.*;
import away3d.core.render.*;
import away3d.core.scene.*;
import away3d.core.utils.*;
import away3d.core.material.*;
import flash.utils.*;
import away3d.objects.*;
import away3d.core.*;
public class Mesh extends BaseMesh implements IPrimitiveProvider {
public var outline:ISegmentMaterial;
private var _vertnormals:Dictionary;
private var _material:ITriangleMaterial;
private var _faces:Array;
var vt:ScreenVertex;
var uvmaterial:Boolean;
private var _vertnormalsDirty:Boolean;// = true
public var back:ITriangleMaterial;
var n01:Face;
public var _dtStore:Array;
public var indexes:Array;
public var _dtActive:Array;
private var _neighbour01:Dictionary;
public var bothsides:Boolean;
var n12:Face;
var n20:Face;
private var _neighboursDirty:Boolean;// = true
private var _neighbour12:Dictionary;
var transparent:ITriangleMaterial;
var backmat:ITriangleMaterial;
private var _neighbour20:Dictionary;
private var _vertfaces:Dictionary;
var tri:DrawTriangle;
var backface:Boolean;
private var _vertfacesDirty:Boolean;// = true
public var debugbb:Boolean;
var _debugboundingbox:WireCube;
var uvt:UV;
public function Mesh(_arg1:Object=null){
_faces = [];
_neighboursDirty = true;
_vertfacesDirty = true;
_vertnormalsDirty = true;
_dtStore = new Array();
_dtActive = new Array();
super(_arg1);
_arg1 = Init.parse(_arg1);
material = _arg1.getMaterial("material");
outline = _arg1.getSegmentMaterial("outline");
back = _arg1.getMaterial("back");
bothsides = _arg1.getBoolean("bothsides", false);
debugbb = _arg1.getBoolean("debugbb", false);
if ((((material == null)) && ((outline == null)))){
material = new WireColorMaterial();
};
}
arcane function getVertexNormal(_arg1:Vertex):Number3D{
if (_vertfacesDirty){
findVertFaces();
};
if (_vertnormalsDirty){
findVertNormals();
};
return (_vertnormals[_arg1]);
}
private function rememberFaceNeighbours(_arg1:Face):void{
var _local2:Face;
if (_neighboursDirty){
return;
};
for each (_local2 in _faces) {
if (_arg1 == _local2){
} else {
if ((((_arg1._v0 == _local2._v2)) && ((_arg1._v1 == _local2._v1)))){
_neighbour01[_arg1] = _local2;
_neighbour12[_local2] = _arg1;
};
if ((((_arg1._v0 == _local2._v0)) && ((_arg1._v1 == _local2._v2)))){
_neighbour01[_arg1] = _local2;
_neighbour20[_local2] = _arg1;
};
if ((((_arg1._v0 == _local2._v1)) && ((_arg1._v1 == _local2._v0)))){
_neighbour01[_arg1] = _local2;
_neighbour01[_local2] = _arg1;
};
if ((((_arg1._v1 == _local2._v2)) && ((_arg1._v2 == _local2._v1)))){
_neighbour12[_arg1] = _local2;
_neighbour12[_local2] = _arg1;
};
if ((((_arg1._v1 == _local2._v0)) && ((_arg1._v2 == _local2._v2)))){
_neighbour12[_arg1] = _local2;
_neighbour20[_local2] = _arg1;
};
if ((((_arg1._v1 == _local2._v1)) && ((_arg1._v2 == _local2._v0)))){
_neighbour12[_arg1] = _local2;
_neighbour01[_local2] = _arg1;
};
if ((((_arg1._v2 == _local2._v2)) && ((_arg1._v0 == _local2._v1)))){
_neighbour20[_arg1] = _local2;
_neighbour12[_local2] = _arg1;
};
if ((((_arg1._v2 == _local2._v0)) && ((_arg1._v0 == _local2._v2)))){
_neighbour20[_arg1] = _local2;
_neighbour20[_local2] = _arg1;
};
if ((((_arg1._v2 == _local2._v1)) && ((_arg1._v0 == _local2._v0)))){
_neighbour20[_arg1] = _local2;
_neighbour01[_local2] = _arg1;
};
};
};
}
public function set material(_arg1:ITriangleMaterial):void{
var _local2:Face;
if (_material == _arg1){
return;
};
_material = _arg1;
if ((_material is IUVMaterial)){
for each (_local2 in _faces) {
_local2._dt.texturemapping = null;
};
};
}
private function clear():void{
var _local1:Face;
for each (_local1 in _faces.concat([])) {
removeFace(_local1);
};
}
public function quarterFaces():void{
var _local1:Dictionary;
var _local2:Face;
var _local3:Vertex;
var _local4:Vertex;
var _local5:Vertex;
var _local6:Vertex;
var _local7:Vertex;
var _local8:Vertex;
var _local9:UV;
var _local10:UV;
var _local11:UV;
var _local12:UV;
var _local13:UV;
var _local14:UV;
var _local15:ITriangleMaterial;
_local1 = new Dictionary();
for each (_local2 in _faces.concat([])) {
_local3 = _local2.v0;
_local4 = _local2.v1;
_local5 = _local2.v2;
if (_local1[_local3] == null){
_local1[_local3] = new Dictionary();
};
if (_local1[_local4] == null){
_local1[_local4] = new Dictionary();
};
if (_local1[_local5] == null){
_local1[_local5] = new Dictionary();
};
_local6 = _local1[_local3][_local4];
if (_local6 == null){
_local6 = Vertex.median(_local3, _local4);
_local1[_local3][_local4] = _local6;
_local1[_local4][_local3] = _local6;
};
_local7 = _local1[_local4][_local5];
if (_local7 == null){
_local7 = Vertex.median(_local4, _local5);
_local1[_local4][_local5] = _local7;
_local1[_local5][_local4] = _local7;
};
_local8 = _local1[_local5][_local3];
if (_local8 == null){
_local8 = Vertex.median(_local5, _local3);
_local1[_local5][_local3] = _local8;
_local1[_local3][_local5] = _local8;
};
_local9 = _local2.uv0;
_local10 = _local2.uv1;
_local11 = _local2.uv2;
_local12 = UV.median(_local9, _local10);
_local13 = UV.median(_local10, _local11);
_local14 = UV.median(_local11, _local9);
_local15 = _local2.material;
removeFace(_local2);
addFace(new Face(_local3, _local6, _local8, _local15, _local9, _local12, _local14));
addFace(new Face(_local6, _local4, _local7, _local15, _local12, _local10, _local13));
addFace(new Face(_local8, _local7, _local5, _local15, _local14, _local13, _local11));
addFace(new Face(_local7, _local8, _local6, _local15, _local13, _local14, _local12));
};
}
override public function primitives(_arg1:IPrimitiveConsumer, _arg2:RenderSession):void{
var _local3:Face;
super.primitives(_arg1, _arg2);
_dtStore = _dtStore.concat(_dtActive);
_dtActive = new Array();
if (outline != null){
if (_neighboursDirty){
findNeighbours();
};
};
if (debugbb){
if (_debugboundingbox == null){
_debugboundingbox = new WireCube({material:"#white"});
};
_debugboundingbox.v000.x = minX;
_debugboundingbox.v001.x = minX;
_debugboundingbox.v010.x = minX;
_debugboundingbox.v011.x = minX;
_debugboundingbox.v100.x = maxX;
_debugboundingbox.v101.x = maxX;
_debugboundingbox.v110.x = maxX;
_debugboundingbox.v111.x = maxX;
_debugboundingbox.v000.y = minY;
_debugboundingbox.v001.y = minY;
_debugboundingbox.v010.y = maxY;
_debugboundingbox.v011.y = maxY;
_debugboundingbox.v100.y = minY;
_debugboundingbox.v101.y = minY;
_debugboundingbox.v110.y = maxY;
_debugboundingbox.v111.y = maxY;
_debugboundingbox.v000.z = minZ;
_debugboundingbox.v001.z = maxZ;
_debugboundingbox.v010.z = minZ;
_debugboundingbox.v011.z = maxZ;
_debugboundingbox.v100.z = minZ;
_debugboundingbox.v101.z = maxZ;
_debugboundingbox.v110.z = minZ;
_debugboundingbox.v111.z = maxZ;
if (_faces.length > 0){
_debugboundingbox.primitives(_arg1, _arg2);
};
};
transparent = TransparentMaterial.INSTANCE;
backmat = ((back) || (material));
for each (_local3 in _faces) {
if (!_local3._visible){
} else {
tri = _local3._dt;
tri.v0 = _local3._v0.project(projection);
tri.v1 = _local3._v1.project(projection);
tri.v2 = _local3._v2.project(projection);
if (!tri.v0.visible){
} else {
if (!tri.v1.visible){
} else {
if (!tri.v2.visible){
} else {
tri.calc();
if (tri.maxZ < 0){
} else {
backface = (tri.area < 0);
if (backface){
if (!bothsides){
continue;
};
tri.material = _local3._back;
} else {
tri.material = _local3._material;
};
if (tri.material == null){
if (backface){
tri.material = backmat;
} else {
tri.material = material;
};
};
if (tri.material != null){
if (!tri.material.visible){
tri.material = null;
};
};
if (outline == null){
//unresolved if
} else {
if (pushback){
tri.screenZ = tri.maxZ;
};
if (pushfront){
tri.screenZ = tri.minZ;
};
uvmaterial = (tri.material is IUVMaterial);
if (backface){
vt = tri.v1;
tri.v1 = tri.v2;
tri.v2 = vt;
tri.area = -(tri.area);
if (uvmaterial){
tri.uv0 = _local3._uv0;
tri.uv1 = _local3._uv2;
tri.uv2 = _local3._uv1;
};
} else {
if (uvmaterial){
tri.uv0 = _local3._uv0;
tri.uv1 = _local3._uv1;
tri.uv2 = _local3._uv2;
};
};
if (tri.backface != backface){
tri.backface = backface;
tri.texturemapping = null;
};
if (((!((outline == null))) && (!(backface)))){
n01 = _neighbour01[_local3];
if ((((n01 == null)) || ((n01.front(projection) <= 0)))){
_arg1.primitive(createDrawSegment(outline, projection, tri.v0, tri.v1));
};
n12 = _neighbour12[_local3];
if ((((n12 == null)) || ((n12.front(projection) <= 0)))){
_arg1.primitive(createDrawSegment(outline, projection, tri.v1, tri.v2));
};
n20 = _neighbour20[_local3];
if ((((n20 == null)) || ((n20.front(projection) <= 0)))){
_arg1.primitive(createDrawSegment(outline, projection, tri.v2, tri.v0));
};
//unresolved if
} else {
tri.projection = projection;
_arg1.primitive(tri);
};
};
};
};
};
};
};
};
}
private function findVertNormals():void{
var _local1:Vertex;
var _local2:Array;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Face;
var _local7:Number3D;
var _local8:Number3D;
if (!_vertnormalsDirty){
return;
};
_vertnormals = new Dictionary();
for each (_local1 in vertices) {
_local2 = _vertfaces[_local1];
_local3 = 0;
_local4 = 0;
_local5 = 0;
for each (_local6 in _local2) {
_local8 = _local6.normal;
_local3 = (_local3 + _local8.x);
_local4 = (_local4 + _local8.y);
_local5 = (_local5 + _local8.z);
};
_local7 = new Number3D(_local3, _local4, _local5);
_local7.normalize();
_vertnormals[_local1] = _local7;
};
_vertnormalsDirty = false;
}
private function findNeighbours():void{
var _local1:Face;
var _local2:Boolean;
var _local3:Face;
if (!_neighboursDirty){
return;
};
_neighbour01 = new Dictionary();
_neighbour12 = new Dictionary();
_neighbour20 = new Dictionary();
for each (_local1 in _faces) {
_local2 = true;
for each (_local3 in _faces) {
if (_local2){
if (_local1 == _local3){
_local2 = false;
};
} else {
if ((((_local1._v0 == _local3._v2)) && ((_local1._v1 == _local3._v1)))){
_neighbour01[_local1] = _local3;
_neighbour12[_local3] = _local1;
};
if ((((_local1._v0 == _local3._v0)) && ((_local1._v1 == _local3._v2)))){
_neighbour01[_local1] = _local3;
_neighbour20[_local3] = _local1;
};
if ((((_local1._v0 == _local3._v1)) && ((_local1._v1 == _local3._v0)))){
_neighbour01[_local1] = _local3;
_neighbour01[_local3] = _local1;
};
if ((((_local1._v1 == _local3._v2)) && ((_local1._v2 == _local3._v1)))){
_neighbour12[_local1] = _local3;
_neighbour12[_local3] = _local1;
};
if ((((_local1._v1 == _local3._v0)) && ((_local1._v2 == _local3._v2)))){
_neighbour12[_local1] = _local3;
_neighbour20[_local3] = _local1;
};
if ((((_local1._v1 == _local3._v1)) && ((_local1._v2 == _local3._v0)))){
_neighbour12[_local1] = _local3;
_neighbour01[_local3] = _local1;
};
if ((((_local1._v2 == _local3._v2)) && ((_local1._v0 == _local3._v1)))){
_neighbour20[_local1] = _local3;
_neighbour12[_local3] = _local1;
};
if ((((_local1._v2 == _local3._v0)) && ((_local1._v0 == _local3._v2)))){
_neighbour20[_local1] = _local3;
_neighbour20[_local3] = _local1;
};
if ((((_local1._v2 == _local3._v1)) && ((_local1._v0 == _local3._v0)))){
_neighbour20[_local1] = _local3;
_neighbour01[_local3] = _local1;
};
};
};
};
_neighboursDirty = false;
}
public function asXML():XML{
var result:XML;
var refvertices:Dictionary;
var verticeslist:Array;
var remembervertex:Function;
var refuvs:Dictionary;
var uvslist:Array;
var rememberuv:Function;
var face:Face;
var vn:int;
var v:Vertex;
var uvn:int;
var uv:UV;
var f:Face;
result = <mesh></mesh>
;
refvertices = new Dictionary();
verticeslist = [];
remembervertex = function (_arg1:Vertex):void{
if (refvertices[_arg1] == null){
refvertices[_arg1] = verticeslist.length;
verticeslist.push(_arg1);
};
};
refuvs = new Dictionary();
uvslist = [];
rememberuv = function (_arg1:UV):void{
if (_arg1 == null){
return;
};
if (refuvs[_arg1] == null){
refuvs[_arg1] = uvslist.length;
uvslist.push(_arg1);
};
};
for each (face in _faces) {
remembervertex(face._v0);
remembervertex(face._v1);
remembervertex(face._v2);
rememberuv(face._uv0);
rememberuv(face._uv1);
rememberuv(face._uv2);
};
vn = 0;
for each (v in verticeslist) {
result.appendChild(new XML((((((((("<vertex id=\"" + ??esc_xattr
) + "\" x=\"") + ??esc_xattr
) + "\" y=\"") + ??esc_xattr
) + "\" z=\"") + ??esc_xattr
) + "\"/>")));
vn = (vn + 1);
};
uvn = 0;
for each (uv in uvslist) {
result.appendChild(new XML((((((("<uv id=\"" + ??esc_xattr
) + "\" u=\"") + ??esc_xattr
) + "\" v=\"") + ??esc_xattr
) + "\"/>")));
uvn = (uvn + 1);
};
for each (f in _faces) {
result.appendChild(new XML((((((((((((("<face v0=\"" + ??esc_xattr
) + "\" v1=\"") + ??esc_xattr
) + "\" v2=\"") + ??esc_xattr
) + "\" uv0=\"") + ??esc_xattr
) + "\" uv1=\"") + ??esc_xattr
) + "\" uv2=\"") + ??esc_xattr
) + "\"/>")));
};
return (result);
}
public function createDrawTriangle(_arg1:Face, _arg2:ITriangleMaterial, _arg3:Projection, _arg4:ScreenVertex, _arg5:ScreenVertex, _arg6:ScreenVertex, _arg7:UV, _arg8:UV, _arg9:UV):DrawTriangle{
if (_dtStore.length){
_dtActive.push((tri = _dtStore.pop()));
tri.texturemapping = null;
tri.create = createDrawTriangle;
} else {
_dtActive.push((tri = new DrawTriangle()));
tri.source = this;
tri.create = createDrawTriangle;
};
tri.face = _arg1;
tri.material = _arg2;
tri.projection = _arg3;
tri.v0 = _arg4;
tri.v1 = _arg5;
tri.v2 = _arg6;
tri.uv0 = _arg7;
tri.uv1 = _arg8;
tri.uv2 = _arg9;
tri.calc();
return (tri);
}
public function addFace(_arg1:Face):void{
addElement(_arg1);
_faces.push(_arg1);
_arg1._dt.source = (_arg1.parent = this);
_arg1._dt.create = createDrawTriangle;
_arg1.addOnVertexChange(onFaceVertexChange);
rememberFaceNeighbours(_arg1);
_vertfacesDirty = true;
}
arcane function neighbour01(_arg1:Face):Face{
if (_neighboursDirty){
findNeighbours();
};
return (_neighbour01[_arg1]);
}
public function movePivot(_arg1:Number, _arg2:Number, _arg3:Number):void{
var _local4:Boolean;
var _local5:Number3D;
var _local6:Vertex;
_local4 = _neighboursDirty;
_neighboursDirty = true;
_local5 = new Number3D(_arg1, _arg2, _arg3);
new Number3D(_arg1, _arg2, _arg3).rotate(_local5.clone(), _transform);
for each (_local6 in vertices) {
_local6.position.add(_local6.position, _local5);
};
x = (x - _arg1);
y = (y - _arg2);
z = (z - _arg3);
_neighboursDirty = _local4;
}
override public function get elements():Array{
return (_faces);
}
arcane function neighbour12(_arg1:Face):Face{
if (_neighboursDirty){
findNeighbours();
};
return (_neighbour12[_arg1]);
}
arcane function getFacesByVertex(_arg1:Vertex):Array{
if (_vertfacesDirty){
findVertFaces();
};
return (_vertfaces[_arg1]);
}
public function removeFace(_arg1:Face):void{
var _local2:int;
_local2 = _faces.indexOf(_arg1);
if (_local2 == -1){
return;
};
removeElement(_arg1);
_vertfacesDirty = true;
forgetFaceNeighbours(_arg1);
_arg1.removeOnVertexChange(onFaceVertexChange);
_faces.splice(_local2, 1);
}
arcane function neighbour20(_arg1:Face):Face{
if (_neighboursDirty){
findNeighbours();
};
return (_neighbour20[_arg1]);
}
arcane function recalcNeighbours():void{
var _local1:Dictionary;
var _local2:Dictionary;
var _local3:Dictionary;
if (!_neighboursDirty){
_neighboursDirty = true;
_local1 = _neighbour01;
_local2 = _neighbour12;
_local3 = _neighbour20;
findNeighbours();
};
}
public function get material():ITriangleMaterial{
return (_material);
}
override public function clone(_arg1=null){
var mesh:Mesh;
var clonedvertices:Dictionary;
var clonevertex:Function;
var cloneduvs:Dictionary;
var cloneuv:Function;
var face:Face;
var object = _arg1;
mesh = ((object) || (new Mesh()));
super.clone(mesh);
mesh.material = material;
mesh.outline = outline;
mesh.back = back;
mesh.bothsides = bothsides;
mesh.debugbb = debugbb;
clonedvertices = new Dictionary();
clonevertex = function (_arg1:Vertex):Vertex{
var _local2:Vertex;
_local2 = clonedvertices[_arg1];
if (_local2 == null){
_local2 = new Vertex(_arg1._x, _arg1._y, _arg1._z);
_local2.extra = ((_arg1.extra is IClonable)) ? (_arg1.extra as IClonable).clone() : _arg1.extra;
clonedvertices[_arg1] = _local2;
};
return (_local2);
};
cloneduvs = new Dictionary();
cloneuv = function (_arg1:UV):UV{
var _local2:UV;
if (_arg1 == null){
return (null);
};
_local2 = cloneduvs[_arg1];
if (_local2 == null){
_local2 = new UV(_arg1._u, _arg1._v);
cloneduvs[_arg1] = _local2;
};
return (_local2);
};
for each (face in _faces) {
mesh.addFace(new Face(clonevertex(face._v0), clonevertex(face._v1), clonevertex(face._v2), face.material, cloneuv(face._uv0), cloneuv(face._uv1), cloneuv(face._uv2)));
};
return (mesh);
}
private function onFaceVertexChange(_arg1:MeshElementEvent):void{
var _local2:Face;
if (!_neighboursDirty){
_local2 = (_arg1.element as Face);
forgetFaceNeighbours(_local2);
rememberFaceNeighbours(_local2);
};
_vertfacesDirty = true;
}
private function findVertFaces():void{
var _local1:Face;
var _local2:Vertex;
var _local3:Vertex;
var _local4:Vertex;
if (!_vertfacesDirty){
return;
};
_vertfaces = new Dictionary();
for each (_local1 in faces) {
_local2 = _local1.v0;
if (_vertfaces[_local1.v0] == null){
_vertfaces[_local1.v0] = [_local1];
} else {
_vertfaces[_local1.v0].push(_local1);
};
_local3 = _local1.v1;
if (_vertfaces[_local1.v1] == null){
_vertfaces[_local1.v1] = [_local1];
} else {
_vertfaces[_local1.v1].push(_local1);
};
_local4 = _local1.v2;
if (_vertfaces[_local1.v2] == null){
_vertfaces[_local1.v2] = [_local1];
} else {
_vertfaces[_local1.v2].push(_local1);
};
};
_vertfacesDirty = false;
}
private function forgetFaceNeighbours(_arg1:Face):void{
if (_neighboursDirty){
return;
};
n01 = _neighbour01[_arg1];
if (n01 != null){
delete _neighbour01[_arg1];
if (_neighbour01[n01] == _arg1){
delete _neighbour01[n01];
};
if (_neighbour12[n01] == _arg1){
delete _neighbour12[n01];
};
if (_neighbour20[n01] == _arg1){
delete _neighbour20[n01];
};
};
n12 = _neighbour12[_arg1];
if (n12 != null){
delete _neighbour12[_arg1];
if (_neighbour01[n12] == _arg1){
delete _neighbour01[n12];
};
if (_neighbour12[n12] == _arg1){
delete _neighbour12[n12];
};
if (_neighbour20[n12] == _arg1){
delete _neighbour20[n12];
};
};
n20 = _neighbour20[_arg1];
if (n20 != null){
delete _neighbour20[_arg1];
if (_neighbour01[n20] == _arg1){
delete _neighbour01[n20];
};
if (_neighbour12[n20] == _arg1){
delete _neighbour12[n20];
};
if (_neighbour20[n20] == _arg1){
delete _neighbour20[n20];
};
};
}
public function invertFaces():void{
var _local1:Face;
for each (_local1 in _faces) {
_local1.invert();
};
}
public function get faces():Array{
return (_faces);
}
public function asAS3Class(_arg1:String=null, _arg2:String="", _arg3:Boolean=false, _arg4:Boolean=false):String{
var importextra:String;
var source:String;
var refvertices:Dictionary;
var verticeslist:Array;
var remembervertex:Function;
var refuvs:Dictionary;
var uvslist:Array;
var rememberuv:Function;
var face:Face;
var uv:UV;
var v:Vertex;
var myPattern:RegExp;
var myPattern2:RegExp;
var f:Face;
var tmp:String;
var ind:Array;
var auv:Array;
var i:int;
var afn:Array;
var avp:Array;
var tmpnames:Array;
var y:int;
var framename:String;
var fr:Frame;
var classname = _arg1;
var packagename = _arg2;
var round = _arg3;
var animated = _arg4;
classname = ((((classname) || (name))) || ("Away3DObject"));
importextra = (animated) ? "\timport flash.utils.Dictionary;\n" : "";
source = (((((("package " + packagename) + "\n{\n\timport away3d.core.mesh.*;\n\timport away3d.core.utils.*;\n") + importextra) + "\n\tpublic class ") + classname) + " extends Mesh\n\t{\n");
source = (source + "\t\tprivate var varr:Array = [];\n\t\tprivate var uvarr:Array = [];\n\t\tprivate var scaling:Number;\n");
if (animated){
source = (source + "\t\tprivate var fnarr:Array = [];\n\n");
source = (source + "\n\t\tprivate function v():void\n\t\t{\n");
source = (source + "\t\t\tfor(var i:int = 0;i<vcount;i++){\n\t\t\t\tvarr.push(new Vertex(0,0,0));\n\t\t\t}\n\t\t}\n\n");
} else {
source = (source + "\n\t\tprivate function v(x:Number,y:Number,z:Number):void\n\t\t{\n");
source = (source + "\t\t\tvarr.push(new Vertex(x*scaling, y*scaling, z*scaling));\n\t\t}\n\n");
};
source = (source + "\t\tprivate function uv(u:Number,v:Number):void\n\t\t{\n");
source = (source + "\t\t\tuvarr.push(new UV(u,v));\n\t\t}\n\n");
source = (source + "\t\tprivate function f(vn0:int, vn1:int, vn2:int, uvn0:int, uvn1:int, uvn2:int):void\n\t\t{\n");
source = (source + "\t\t\taddFace(new Face(varr[vn0],varr[vn1],varr[vn2], null, uvarr[uvn0],uvarr[uvn1],uvarr[uvn2]));\n\t\t}\n\n");
source = (source + (("\t\tpublic function " + classname) + "(init:Object = null)\n\t\t{\n\t\t\tsuper(init);\n\t\t\tinit = Init.parse(init);\n\t\t\tscaling = init.getNumber(\"scaling\", 1);\n\t\t\tbuild();\n\t\t\ttype = \".as\";\n\t\t}\n\n"));
source = (source + "\t\tprivate function build():void\n\t\t{\n");
refvertices = new Dictionary();
verticeslist = [];
remembervertex = function (_arg1:Vertex):void{
if (refvertices[_arg1] == null){
refvertices[_arg1] = verticeslist.length;
verticeslist.push(_arg1);
};
};
refuvs = new Dictionary();
uvslist = [];
rememberuv = function (_arg1:UV):void{
if (_arg1 == null){
return;
};
if (refuvs[_arg1] == null){
refuvs[_arg1] = uvslist.length;
uvslist.push(_arg1);
};
};
for each (face in _faces) {
remembervertex(face._v0);
remembervertex(face._v1);
remembervertex(face._v2);
rememberuv(face._uv0);
rememberuv(face._uv1);
rememberuv(face._uv2);
};
if (animated){
myPattern = new RegExp("vcount", "g");
source = source.replace(myPattern, verticeslist.length);
source = (source + "\n\t\t\tv();\n\n");
} else {
for each (v in verticeslist) {
source = (source + (round) ? (((((("\t\t\tv(" + v._x.toFixed(4)) + ",") + v._y.toFixed(4)) + ",") + v._z.toFixed(4)) + ");\n") : (((((("\t\t\tv(" + v._x) + ",") + v._y) + ",") + v._z) + ");\n"));
};
};
for each (uv in uvslist) {
source = (source + (round) ? (((("\t\t\tuv(" + uv._u.toFixed(4)) + ",") + uv._v.toFixed(4)) + ");\n") : (((("\t\t\tuv(" + uv._u) + ",") + uv._v) + ");\n"));
};
if (round){
myPattern2 = new RegExp(".0000", "g");
};
if (animated){
auv = [];
for each (f in _faces) {
auv.push((round) ? ((((refuvs[f._uv0].toFixed(4) + ",") + refuvs[f._uv1].toFixed(4)) + ",") + refuvs[f._uv2].toFixed(4)) : ((((refuvs[f._uv0] + ",") + refuvs[f._uv1]) + ",") + refuvs[f._uv2]));
};
i = 0;
while (i < indexes.length) {
ind = indexes[i];
source = (source + (((((((("\t\t\tf(" + ind[0]) + ",") + ind[1]) + ",") + ind[2]) + ",") + auv[i]) + ");\n"));
i = (i + 1);
};
} else {
for each (f in _faces) {
source = (source + (((((((((((("\t\t\tf(" + refvertices[f._v0]) + ",") + refvertices[f._v1]) + ",") + refvertices[f._v2]) + ",") + refuvs[f._uv0]) + ",") + refuvs[f._uv1]) + ",") + refuvs[f._uv2]) + ");\n"));
};
};
if (round){
source = source.replace(myPattern2, "");
};
if (animated){
afn = new Array();
tmpnames = new Array();
i = 0;
y = 0;
source = (source + "\n\t\t\tframes = new Dictionary();\n");
source = (source + "\t\t\tframenames = new Dictionary();\n");
source = (source + "\t\t\tvar oFrames:Object = new Object();\n");
myPattern = new RegExp(" ", "g");
for (framename in framenames) {
tmpnames.push(framename);
};
tmpnames.sort();
i = 0;
while (i < tmpnames.length) {
avp = new Array();
fr = frames[framenames[tmpnames[i]]];
if (tmpnames[i].indexOf(" ") != -1){
tmpnames[i] = tmpnames[i].replace(myPattern, "");
};
afn.push((("\"" + tmpnames[i]) + "\""));
source = (source + (("\n\t\t\toFrames." + tmpnames[i]) + "=["));
y = 0;
while (y < verticeslist.length) {
if (round){
avp.push(fr.vertexpositions[y].x.toFixed(4));
avp.push(fr.vertexpositions[y].y.toFixed(4));
avp.push(fr.vertexpositions[y].z.toFixed(4));
} else {
avp.push(fr.vertexpositions[y].x);
avp.push(fr.vertexpositions[y].y);
avp.push(fr.vertexpositions[y].z);
};
y = (y + 1);
};
if (round){
tmp = avp.toString();
tmp = tmp.replace(myPattern2, "");
source = (source + (tmp + "];\n"));
} else {
source = (source + (avp.toString() + "];\n"));
};
i = (i + 1);
};
source = (source + (("\n\t\t\tfnarr = [" + afn.toString()) + "];\n"));
source = (source + "\n\t\t\tvar y:int;\n");
source = (source + "\t\t\tvar z:int;\n");
source = (source + "\t\t\tvar frame:Frame;\n");
source = (source + "\t\t\tfor(var i:int = 0;i<fnarr.length; i++){\n");
source = (source + "\t\t\t\ttrace(\"[ \"+fnarr[i]+\" ]\");\n");
source = (source + "\t\t\t\tframe = new Frame();\n");
source = (source + "\t\t\t\tframenames[fnarr[i]] = i;\n");
source = (source + "\t\t\t\tframes[i] = frame;\n");
source = (source + "\t\t\t\tz=0;\n");
source = (source + "\t\t\t\tfor (y = 0; y < oFrames[fnarr[i]].length; y+=3){\n");
source = (source + "\t\t\t\t\tvar vp:VertexPosition = new VertexPosition(varr[z]);\n");
source = (source + "\t\t\t\t\tz++;\n");
source = (source + "\t\t\t\t\tvp.x = oFrames[fnarr[i]][y]*scaling;\n");
source = (source + "\t\t\t\t\tvp.y = oFrames[fnarr[i]][y+1]*scaling;\n");
source = (source + "\t\t\t\t\tvp.z = oFrames[fnarr[i]][y+2]*scaling;\n");
source = (source + "\t\t\t\t\tframe.vertexpositions.push(vp);\n");
source = (source + "\t\t\t\t}\n");
source = (source + "\t\t\t\tif (i == 0)\n");
source = (source + "\t\t\t\t\tframe.adjust();\n");
source = (source + "\t\t\t}\n");
};
source = (source + "\n\t\t}\n\t}\n}");
return (source);
}
}
}//package away3d.core.mesh
Section 41
//MeshElementEvent (away3d.core.mesh.MeshElementEvent)
package away3d.core.mesh {
import flash.events.*;
public class MeshElementEvent extends Event {
public var element:IMeshElement;
public function MeshElementEvent(_arg1:String, _arg2:IMeshElement){
super(_arg1);
this.element = _arg2;
}
override public function clone():Event{
return (new MeshElementEvent(type, element));
}
}
}//package away3d.core.mesh
Section 42
//Segment (away3d.core.mesh.Segment)
package away3d.core.mesh {
import away3d.core.draw.*;
import flash.events.*;
import away3d.core.material.*;
import away3d.core.*;
public class Segment extends BaseMeshElement {
arcane var _material:ISegmentMaterial;
public var extra:Object;
arcane var _v0:Vertex;
arcane var _v1:Vertex;
public var parent:BaseMesh;
arcane var _ds:DrawSegment;
private var materialchanged:SegmentEvent;
public function Segment(_arg1:Vertex, _arg2:Vertex, _arg3:ISegmentMaterial=null){
_ds = new DrawSegment();
super();
this.v0 = _arg1;
this.v1 = _arg2;
this.material = _arg3;
}
override public function get vertices():Array{
return ([_v0, _v1]);
}
public function get v1():Vertex{
return (_v1);
}
override public function get maxX():Number{
if (_v0._x > _v1._x){
return (_v0._x);
};
return (_v1._x);
}
public function set v1(_arg1:Vertex):void{
if (_arg1 == _v1){
return;
};
if (_v1 != null){
if (_v1 != _v0){
_v1.removeOnChange(onVertexValueChange);
};
};
_v1 = _arg1;
if (_v1 != null){
if (_v1 != _v0){
_v1.addOnChange(onVertexValueChange);
};
};
notifyVertexChange();
}
public function get v0():Vertex{
return (_v0);
}
private function onVertexValueChange(_arg1:Event):void{
notifyVertexValueChange();
}
public function removeOnMaterialChange(_arg1:Function):void{
removeEventListener("materialchanged", _arg1, false);
}
public function set v0(_arg1:Vertex):void{
if (_arg1 == _v0){
return;
};
if (_v0 != null){
if (_v0 != _v1){
_v0.removeOnChange(onVertexValueChange);
};
};
_v0 = _arg1;
if (_v0 != null){
if (_v0 != _v1){
_v0.addOnChange(onVertexValueChange);
};
};
notifyVertexChange();
}
public function get material():ISegmentMaterial{
return (_material);
}
public function addOnMaterialChange(_arg1:Function):void{
addEventListener("materialchanged", _arg1, false, 0, true);
}
override public function get minX():Number{
if (_v0._x < _v1._x){
return (_v0._x);
};
return (_v1._x);
}
override public function get minY():Number{
if (_v0._y < _v1._y){
return (_v0._y);
};
return (_v1._y);
}
override public function get minZ():Number{
if (_v0._z < _v1._z){
return (_v0._z);
};
return (_v1._z);
}
override public function get radius2():Number{
var _local1:Number;
var _local2:Number;
_local1 = (((_v0._x * _v0._x) + (_v0._y * _v0._y)) + (_v0._z * _v0._z));
_local2 = (((_v1._x * _v1._x) + (_v1._y * _v1._y)) + (_v1._z * _v1._z));
if (_local1 > _local2){
return (_local1);
};
return (_local2);
}
protected function notifyMaterialChange():void{
if (!hasEventListener("materialchanged")){
return;
};
if (materialchanged == null){
materialchanged = new SegmentEvent("materialchanged", this);
};
dispatchEvent(materialchanged);
}
public function set material(_arg1:ISegmentMaterial):void{
if (_arg1 == _material){
return;
};
_material = _arg1;
notifyMaterialChange();
}
private function onVertexChange(_arg1:Event):void{
notifyVertexChange();
}
override public function get maxY():Number{
if (_v0._y > _v1._y){
return (_v0._y);
};
return (_v1._y);
}
override public function get maxZ():Number{
if (_v0._z > _v1._z){
return (_v0._z);
};
return (_v1._z);
}
}
}//package away3d.core.mesh
Section 43
//SegmentEvent (away3d.core.mesh.SegmentEvent)
package away3d.core.mesh {
import flash.events.*;
public class SegmentEvent extends Event {
public var segment:Segment;
public function SegmentEvent(_arg1:String, _arg2:Segment){
super(_arg1);
this.segment = _arg2;
}
override public function clone():Event{
return (new SegmentEvent(type, segment));
}
}
}//package away3d.core.mesh
Section 44
//UV (away3d.core.mesh.UV)
package away3d.core.mesh {
import away3d.core.utils.*;
import away3d.core.*;
public class UV extends ValueObject {
arcane var _u:Number;
arcane var _v:Number;
public var extra:Object;
public function UV(_arg1:Number=0, _arg2:Number=0){
_u = _arg1;
_v = _arg2;
}
public function clone():UV{
return (new UV(_u, _v));
}
public function toString():String{
return ((((("new UV(" + _u) + ", ") + _v) + ")"));
}
public function set u(_arg1:Number):void{
if (_arg1 == _u){
return;
};
_u = _arg1;
notifyChange();
}
public function set v(_arg1:Number):void{
if (_arg1 == _v){
return;
};
_v = _arg1;
notifyChange();
}
public function get u():Number{
return (_u);
}
public function get v():Number{
return (_v);
}
arcane static function median(_arg1:UV, _arg2:UV):UV{
if (_arg1 == null){
return (null);
};
if (_arg2 == null){
return (null);
};
return (new UV(((_arg1._u + _arg2._u) / 2), ((_arg1._v + _arg2._v) / 2)));
}
arcane static function weighted(_arg1:UV, _arg2:UV, _arg3:Number, _arg4:Number):UV{
var _local5:Number;
var _local6:Number;
var _local7:Number;
if (_arg1 == null){
return (null);
};
if (_arg2 == null){
return (null);
};
_local5 = (_arg3 + _arg4);
_local6 = (_arg3 / _local5);
_local7 = (_arg4 / _local5);
return (new UV(((_arg1._u * _local6) + (_arg2._u * _local7)), ((_arg1._v * _local6) + (_arg2._v * _local7))));
}
}
}//package away3d.core.mesh
Section 45
//Vertex (away3d.core.mesh.Vertex)
package away3d.core.mesh {
import away3d.core.draw.*;
import away3d.core.math.*;
import away3d.core.render.*;
import away3d.core.utils.*;
import away3d.core.*;
public class Vertex extends ValueObject {
arcane var _y:Number;
private var _position:Number3D;
private var persp:Number;
public var extra:Object;
private var view:Matrix3D;
private var sz:Number;
arcane var _x:Number;
arcane var _z:Number;
private var projectionTime:int;
private var projected:ScreenVertex;
public function Vertex(_arg1:Number=0, _arg2:Number=0, _arg3:Number=0){
_position = new Number3D();
projected = new ScreenVertex();
super();
_x = (_position.x = _arg1);
_y = (_position.y = _arg2);
_z = (_position.z = _arg3);
}
public function toString():String{
return ((((((("new Vertex(" + _x) + ", ") + _y) + ", ") + z) + ")"));
}
public function get y():Number{
return (_y);
}
arcane function perspective(_arg1:Number):ScreenVertex{
persp = (1 / (1 + (_z / _arg1)));
return (new ScreenVertex((_x * persp), (_y * persp), z));
}
public function set position(_arg1:Number3D):void{
_x = (_position.x = _arg1.x);
_y = (_position.y = _arg1.y);
_z = (_position.z = _arg1.z);
notifyChange();
}
public function set y(_arg1:Number):void{
if (_arg1 == _y){
return;
};
if (isNaN(_arg1)){
Debug.warning("isNaN(y)");
};
if (_arg1 == Infinity){
Debug.warning("y == Infinity");
};
if (_arg1 == -(Infinity)){
Debug.warning("y == -Infinity");
};
_y = _arg1;
notifyChange();
}
public function clone():Vertex{
return (new Vertex(_x, _y, _z));
}
public function project(_arg1:Projection):ScreenVertex{
if (projectionTime == _arg1.time){
return (projected);
};
projectionTime = _arg1.time;
view = _arg1.view;
sz = ((((_x * view.szx) + (_y * view.szy)) + (_z * view.szz)) + view.tz);
if (isNaN(sz)){
throw (new Error("isNaN(sz)"));
};
if ((sz * 2) <= -(_arg1.focus)){
projected.visible = false;
return (projected);
};
projected.visible = true;
persp = (_arg1.zoom / (1 + (sz / _arg1.focus)));
projected.x = (((((_x * view.sxx) + (_y * view.sxy)) + (_z * view.sxz)) + view.tx) * persp);
projected.y = (((((_x * view.syx) + (_y * view.syy)) + (_z * view.syz)) + view.ty) * persp);
projected.z = sz;
return (projected);
}
public function get position():Number3D{
_position.x = _x;
_position.y = _y;
_position.z = _z;
return (_position);
}
arcane function transform(_arg1:Matrix3D):void{
setValue(((((_x * _arg1.sxx) + (_y * _arg1.sxy)) + (_z * _arg1.sxz)) + _arg1.tx), ((((_x * _arg1.syx) + (_y * _arg1.syy)) + (_z * _arg1.syz)) + _arg1.ty), ((((_x * _arg1.szx) + (_y * _arg1.szy)) + (_z * _arg1.szz)) + _arg1.tz));
}
arcane function setValue(_arg1:Number, _arg2:Number, _arg3:Number):void{
_x = (_position.x = _arg1);
_y = (_position.y = _arg2);
_z = (_position.z = _arg3);
notifyChange();
}
public function set z(_arg1:Number):void{
if (_arg1 == _z){
return;
};
if (isNaN(_arg1)){
throw (new Error("isNaN(z)"));
};
if (_arg1 == Infinity){
Debug.warning("z == Infinity");
};
if (_arg1 == -(Infinity)){
Debug.warning("z == -Infinity");
};
_z = _arg1;
notifyChange();
}
public function set x(_arg1:Number):void{
if (_arg1 == _x){
return;
};
if (isNaN(_arg1)){
Debug.warning("isNaN(x)");
};
if (_arg1 == Infinity){
Debug.warning("x == Infinity");
};
if (_arg1 == -(Infinity)){
Debug.warning("x == -Infinity");
};
_x = _arg1;
notifyChange();
}
public function get x():Number{
return (_x);
}
public function get z():Number{
return (_z);
}
arcane static function median(_arg1:Vertex, _arg2:Vertex):Vertex{
return (new Vertex(((_arg1._x + _arg2._x) / 2), ((_arg1._y + _arg2._y) / 2), ((_arg1._z + _arg2._z) / 2)));
}
arcane static function weighted(_arg1:Vertex, _arg2:Vertex, _arg3:Number, _arg4:Number):Vertex{
var _local5:Number;
var _local6:Number;
var _local7:Number;
_local5 = (_arg3 + _arg4);
_local6 = (_arg3 / _local5);
_local7 = (_arg4 / _local5);
return (new Vertex(((_arg1._x * _local6) + (_arg2._x * _local7)), ((_arg1._y * _local6) + (_arg2._y * _local7)), ((_arg1._z * _local6) + (_arg2._z * _local7))));
}
arcane static function distanceSqr(_arg1:Vertex, _arg2:Vertex):Number{
return (((((_arg1._x + _arg2._x) * (_arg1._x + _arg2._x)) + ((_arg1._y + _arg2._y) * (_arg1._y + _arg2._y))) + ((_arg1._z + _arg2._z) * (_arg1._z + _arg2._z))));
}
}
}//package away3d.core.mesh
Section 46
//VertexPosition (away3d.core.mesh.VertexPosition)
package away3d.core.mesh {
public class VertexPosition {
public var vertex:Vertex;
public var x:Number;
public var y:Number;
public var z:Number;
public function VertexPosition(_arg1:Vertex){
this.vertex = _arg1;
this.x = 0;
this.y = 0;
this.z = 0;
}
public function adjust(_arg1:Number=1):void{
vertex._x = ((vertex._x * (1 - _arg1)) + (x * _arg1));
vertex._y = ((vertex._y * (1 - _arg1)) + (y * _arg1));
vertex._z = ((vertex._z * (1 - _arg1)) + (z * _arg1));
}
}
}//package away3d.core.mesh
Section 47
//WireMesh (away3d.core.mesh.WireMesh)
package away3d.core.mesh {
import away3d.core.draw.*;
import away3d.core.math.*;
import away3d.core.render.*;
import away3d.core.scene.*;
import away3d.core.utils.*;
import away3d.core.material.*;
import away3d.core.*;
public class WireMesh extends BaseMesh implements IPrimitiveProvider {
private var _segments:Array;
public var material:ISegmentMaterial;
public function WireMesh(_arg1:Object=null){
_segments = [];
super(_arg1);
_arg1 = Init.parse(_arg1);
material = _arg1.getSegmentMaterial("material");
if (material == null){
material = new WireframeMaterial();
};
}
public function removeSegment(_arg1:Segment):void{
var _local2:int;
_local2 = _segments.indexOf(_arg1);
if (_local2 == -1){
return;
};
removeElement(_arg1);
_segments.splice(_local2, 1);
}
override public function primitives(_arg1:IPrimitiveConsumer, _arg2:RenderSession):void{
var _local3:DrawSegment;
var _local4:Segment;
super.primitives(_arg1, _arg2);
for each (_local4 in _segments) {
_local3 = _local4._ds;
_local3.v0 = _local4._v0.project(projection);
_local3.v1 = _local4._v1.project(projection);
if (!_local3.v0.visible){
} else {
if (!_local3.v1.visible){
} else {
_local3.calc();
if (_local3.maxZ < 0){
} else {
_local3.material = ((_local4.material) || (material));
if (_local3.material == null){
} else {
if (!_local3.material.visible){
} else {
_local3.projection = projection;
_arg1.primitive(_local3);
};
};
};
};
};
};
}
public function get segments():Array{
return (_segments);
}
private function clear():void{
var _local1:Segment;
for each (_local1 in _segments.concat([])) {
removeSegment(_local1);
};
}
public function addSegment(_arg1:Segment):void{
addElement(_arg1);
_segments.push(_arg1);
_arg1._ds.source = (_arg1.parent = this);
_arg1._ds.create = createDrawSegment;
}
override public function get elements():Array{
return (_segments);
}
}
}//package away3d.core.mesh
Section 48
//BasicRenderer (away3d.core.render.BasicRenderer)
package away3d.core.render {
import flash.display.*;
import away3d.core.draw.*;
import away3d.core.scene.*;
import flash.utils.*;
import away3d.core.block.*;
public class BasicRenderer implements IRenderer {
protected var pritraverser:PrimitiveTraverser;
protected var container:Sprite;
protected var projtraverser:ProjectionTraverser;
protected var materials:Dictionary;
protected var scene:Scene3D;
protected var clip:Clipping;
protected var priarray:PrimitiveArray;
protected var blocktraverser:BlockerTraverser;
protected var session:RenderSession;
protected var triangle:DrawTriangle;
protected var lightarray:LightArray;
protected var blockerarray:BlockerArray;
protected var camera:Camera3D;
protected var primitives:Array;
protected var primitive:DrawPrimitive;
protected var filter:IPrimitiveFilter;
protected var blockers:Array;
protected var filters:Array;
protected var object:Object;
public function BasicRenderer(... _args){
projtraverser = new ProjectionTraverser();
blockerarray = new BlockerArray();
blocktraverser = new BlockerTraverser();
priarray = new PrimitiveArray();
lightarray = new LightArray();
pritraverser = new PrimitiveTraverser();
session = new RenderSession();
super();
this.filters = _args;
this.filters.push(new ZSortFilter());
}
public function desc():String{
return ((("Basic [" + filters.join("+")) + "]"));
}
public function render(_arg1:View3D):Array{
scene = _arg1.scene;
camera = _arg1.camera;
container = _arg1.canvas;
clip = _arg1.clip;
projtraverser.view = _arg1;
scene.traverse(projtraverser);
blockerarray.clip = clip;
blocktraverser.consumer = blockerarray;
blocktraverser.view = _arg1;
scene.traverse(blocktraverser);
blockers = blockerarray.list();
lightarray.clear();
session.view = _arg1;
session.container = container;
session.lightarray = lightarray;
priarray.clip = clip;
priarray.blockers = blockers;
pritraverser.consumer = priarray;
pritraverser.session = session;
scene.traverse(pritraverser);
primitives = priarray.list();
for each (filter in filters) {
primitives = filter.filter(primitives, scene, camera, container, clip);
};
for each (primitive in primitives) {
primitive.render();
};
if (_arg1.statsOpen){
_arg1.statsPanel.updateStats(primitives.length, camera);
};
return (primitives);
}
public function stats():String{
return ("");
}
}
}//package away3d.core.render
Section 49
//BlockerTraverser (away3d.core.render.BlockerTraverser)
package away3d.core.render {
import away3d.core.scene.*;
import away3d.core.block.*;
public class BlockerTraverser extends Traverser {
private var _view:View3D;
private var _consumer:IBlockerConsumer;
override public function match(_arg1:Object3D):Boolean{
if (!_arg1.visible){
return (false);
};
if ((_arg1 is ILODObject)){
return ((_arg1 as ILODObject).matchLOD(_view));
};
return (true);
}
public function set view(_arg1:View3D):void{
_view = _arg1;
}
public function set consumer(_arg1:IBlockerConsumer):void{
_consumer = _arg1;
}
override public function apply(_arg1:Object3D):void{
if ((_arg1 is IBlockerProvider)){
(_arg1 as IBlockerProvider).blockers(_consumer);
};
}
}
}//package away3d.core.render
Section 50
//Clipping (away3d.core.render.Clipping)
package away3d.core.render {
import flash.display.*;
import away3d.core.draw.*;
import flash.geom.*;
public class Clipping {
var globalPoint:Point;
var zeroPoint:Point;
var rectangleClipping:RectangleClipping;
public function Clipping(){
zeroPoint = new Point(0, 0);
super();
}
public function rect(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Boolean{
return (true);
}
public function check(_arg1:DrawPrimitive):Boolean{
return (true);
}
public function screen(_arg1:Sprite):Clipping{
if (_arg1.stage.align == StageAlign.TOP_LEFT){
if (!rectangleClipping){
rectangleClipping = new RectangleClipping();
};
globalPoint = _arg1.globalToLocal(zeroPoint);
rectangleClipping.maxX = ((rectangleClipping.minX = globalPoint.x) + _arg1.stage.stageWidth);
rectangleClipping.maxY = ((rectangleClipping.minY = globalPoint.y) + _arg1.stage.stageHeight);
return (rectangleClipping);
//unresolved jump
};
return (this);
}
public function asRectangleClipping():RectangleClipping{
if (!rectangleClipping){
rectangleClipping = new RectangleClipping();
};
rectangleClipping.minX = -1000000;
rectangleClipping.minY = -1000000;
rectangleClipping.maxX = 1000000;
rectangleClipping.maxY = 1000000;
return (rectangleClipping);
}
}
}//package away3d.core.render
Section 51
//FindHit (away3d.core.render.FindHit)
package away3d.core.render {
import away3d.core.draw.*;
import away3d.core.mesh.*;
import away3d.core.math.*;
import away3d.core.scene.*;
import away3d.core.material.*;
public class FindHit {
public var sceneX:Number;
public var sceneY:Number;
public var sceneZ:Number;
public var uv:UV;
public var drawpri:DrawPrimitive;
protected var view:View3D;
public var material:IUVMaterial;
public var screenX:Number;
public var screenY:Number;
public var screenZ:Number;// = INF
var inv:Matrix3D;
private var primitive:DrawPrimitive;
var persp:Number;
public var element:Object;
public var object:Object3D;
public function FindHit(_arg1:View3D, _arg2:Array, _arg3:Number, _arg4:Number){
screenZ = Infinity;
inv = new Matrix3D();
super();
this.view = _arg1;
screenX = _arg3;
screenY = _arg4;
for each (primitive in _arg2) {
checkPrimitive(primitive);
};
}
public function checkPrimitive(_arg1:DrawPrimitive):void{
var _local2:Number;
var _local3:DrawTriangle;
var _local4:UV;
var _local5:IUVMaterial;
if (!_arg1.source.mouseEnabled){
return;
};
if (_arg1.minX > screenX){
return;
};
if (_arg1.maxX < screenX){
return;
};
if (_arg1.minY > screenY){
return;
};
if (_arg1.maxY < screenY){
return;
};
if (_arg1.contains(screenX, screenY)){
_local2 = _arg1.getZ(screenX, screenY);
if (_local2 < screenZ){
if ((_arg1 is DrawTriangle)){
_local3 = (_arg1 as DrawTriangle);
_local4 = _local3.getUV(screenX, screenY);
if ((_local3.material is IUVMaterial)){
_local5 = (_local3.material as IUVMaterial);
if (!(_local5.bitmap.getPixel32((_local4.u * _local5.width), ((1 - _local4.v) * _local5.height)) >> 24)){
return;
};
uv = _local4;
};
material = _local5;
} else {
uv = null;
};
screenZ = _local2;
persp = (view.camera.zoom / (1 + (screenZ / view.camera.focus)));
inv.inverse(view.camera.view);
sceneX = (((((screenX / persp) * inv.sxx) + ((screenY / persp) * inv.sxy)) + (screenZ * inv.sxz)) + inv.tx);
sceneY = (((((screenX / persp) * inv.syx) + ((screenY / persp) * inv.syy)) + (screenZ * inv.syz)) + inv.ty);
sceneZ = (((((screenX / persp) * inv.szx) + ((screenY / persp) * inv.szy)) + (screenZ * inv.szz)) + inv.tz);
drawpri = _arg1;
object = _arg1.source;
element = null;
};
};
}
public function getMouseEvent(_arg1:String):MouseEvent3D{
var _local2:MouseEvent3D;
_local2 = new MouseEvent3D(_arg1);
_local2.screenX = screenX;
_local2.screenY = screenY;
_local2.screenZ = screenZ;
_local2.sceneX = sceneX;
_local2.sceneY = sceneY;
_local2.sceneZ = sceneZ;
_local2.view = view;
_local2.drawpri = drawpri;
_local2.material = material;
_local2.element = element;
_local2.object = object;
_local2.uv = uv;
return (_local2);
}
}
}//package away3d.core.render
Section 52
//IPrimitiveConsumer (away3d.core.render.IPrimitiveConsumer)
package away3d.core.render {
import away3d.core.draw.*;
public interface IPrimitiveConsumer {
function primitive(_arg1:DrawPrimitive):void;
}
}//package away3d.core.render
Section 53
//IPrimitiveFilter (away3d.core.render.IPrimitiveFilter)
package away3d.core.render {
import flash.display.*;
import away3d.core.scene.*;
public interface IPrimitiveFilter {
function filter(_arg1:Array, _arg2:Scene3D, _arg3:Camera3D, _arg4:Sprite, _arg5:Clipping):Array;
}
}//package away3d.core.render
Section 54
//IPrimitiveProvider (away3d.core.render.IPrimitiveProvider)
package away3d.core.render {
public interface IPrimitiveProvider {
function primitives(_arg1:IPrimitiveConsumer, _arg2:RenderSession):void;
}
}//package away3d.core.render
Section 55
//IRenderer (away3d.core.render.IRenderer)
package away3d.core.render {
import away3d.core.scene.*;
public interface IRenderer {
function desc():String;
function render(_arg1:View3D):Array;
function stats():String;
}
}//package away3d.core.render
Section 56
//LightArray (away3d.core.render.LightArray)
package away3d.core.render {
import away3d.core.math.*;
import away3d.core.scene.*;
public class LightArray implements ILightConsumer {
public var points:Array;
public var directed:Array;
var point:PointLightSource;
public var ambients:Array;
public function ambientLight(_arg1:int, _arg2:Number):void{
throw (new Error("Not implemented"));
}
public function pointLight(_arg1:Matrix3D, _arg2:Light3D, _arg3:int, _arg4:Number, _arg5:Number, _arg6:Number):void{
point = _arg2._ls;
point.x = _arg1.tx;
point.y = _arg1.ty;
point.z = _arg1.tz;
point.light = _arg2;
point.red = ((_arg3 & 0xFF0000) >> 16);
point.green = ((_arg3 & 0xFF00) >> 8);
point.blue = (_arg3 & 0xFF);
point.ambient = _arg4;
point.diffuse = _arg5;
point.specular = _arg6;
points.push(point);
}
public function directedLight(_arg1:Number3D, _arg2:int, _arg3:Number):void{
throw (new Error("Not implemented"));
}
public function clear():void{
ambients = [];
directed = [];
points = [];
}
}
}//package away3d.core.render
Section 57
//PointLightSource (away3d.core.render.PointLightSource)
package away3d.core.render {
import away3d.core.scene.*;
public class PointLightSource {
public var green:Number;
public var diffuse:Number;
public var blue:Number;
public var specular:Number;
public var red:Number;
public var light:Light3D;
public var x:Number;
public var y:Number;
public var z:Number;
public var ambient:Number;
}
}//package away3d.core.render
Section 58
//PrimitiveArray (away3d.core.render.PrimitiveArray)
package away3d.core.render {
import away3d.core.draw.*;
import away3d.core.block.*;
public class PrimitiveArray implements IPrimitiveConsumer {
private var primitives:Array;
private var _clip:Clipping;
private var _blockers:Array;
private var containers:Array;
private var materials:Array;
public function PrimitiveArray(){
primitives = [];
materials = [];
containers = [];
super();
}
public function set clip(_arg1:Clipping):void{
_clip = _arg1;
primitives = [];
}
public function list():Array{
var _local1:Array;
_local1 = this.primitives;
this.primitives = null;
return (_local1);
}
public function primitive(_arg1:DrawPrimitive):void{
var _local2:int;
var _local3:int;
var _local4:Blocker;
if (_clip.check(_arg1)){
_local2 = _blockers.length;
_local3 = 0;
while (_local3 < _local2) {
_local4 = _blockers[_local3];
if (_local4.screenZ > _arg1.minZ){
break;
};
if (_local4.block(_arg1)){
return;
};
_local3++;
};
primitives.push(_arg1);
};
}
public function set blockers(_arg1:Array):void{
_blockers = _arg1;
}
}
}//package away3d.core.render
Section 59
//PrimitiveQuadrantTreeNode (away3d.core.render.PrimitiveQuadrantTreeNode)
package away3d.core.render {
import away3d.core.draw.*;
import away3d.core.scene.*;
public final class PrimitiveQuadrantTreeNode {
public var level:int;
public var xdiv:Number;
public var halfheight:Number;
public var maxlevel:int;// = 4
public var render_center_length:int;// = -1
public var parent:PrimitiveQuadrantTreeNode;
public var righttop:PrimitiveQuadrantTreeNode;
public var righttopFlag:Boolean;
public var rightbottom:PrimitiveQuadrantTreeNode;
public var onlysourceFlag:Boolean;// = true
public var center:Array;
public var onlysource:Object3D;
public var rightbottomFlag:Boolean;
private var i:int;
public var lefttop:PrimitiveQuadrantTreeNode;
public var render_center_index:int;// = -1
public var leftbottom:PrimitiveQuadrantTreeNode;
public var halfwidth:Number;
public var ydiv:Number;
public var lefttopFlag:Boolean;
public var create:Function;
public var leftbottomFlag:Boolean;
public function PrimitiveQuadrantTreeNode(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:int, _arg6:PrimitiveQuadrantTreeNode=null){
onlysourceFlag = true;
maxlevel = 4;
render_center_length = -1;
render_center_index = -1;
super();
this.level = _arg5;
this.xdiv = _arg1;
this.ydiv = _arg2;
halfwidth = (_arg3 / 2);
halfheight = (_arg4 / 2);
this.parent = _arg6;
}
public function render(_arg1:Number):void{
var _local2:DrawPrimitive;
if (render_center_length == -1){
if (center != null){
render_center_length = center.length;
if (render_center_length > 1){
center.sortOn("screenZ", (Array.DESCENDING | Array.NUMERIC));
};
} else {
render_center_length = 0;
};
render_center_index = 0;
};
while (render_center_index < render_center_length) {
_local2 = center[render_center_index];
if (_local2.screenZ < _arg1){
break;
};
render_other(_local2.screenZ);
_local2.render();
render_center_index++;
};
if (render_center_index == render_center_length){
center = null;
};
render_other(_arg1);
}
public function push(_arg1:DrawPrimitive):void{
if (onlysourceFlag){
if (((!((onlysource == null))) && (!((onlysource == _arg1.source))))){
onlysourceFlag = false;
};
onlysource = _arg1.source;
};
if (level < maxlevel){
if (_arg1.maxX <= xdiv){
if (_arg1.maxY <= ydiv){
if (lefttop == null){
lefttopFlag = true;
lefttop = new PrimitiveQuadrantTreeNode((xdiv - (halfwidth / 2)), (ydiv - (halfheight / 2)), halfwidth, halfheight, (level + 1), this);
} else {
if (!lefttopFlag){
lefttopFlag = true;
lefttop.reset((xdiv - (halfwidth / 2)), (ydiv - (halfheight / 2)), halfwidth, halfheight);
};
};
lefttop.push(_arg1);
return;
} else {
if (_arg1.minY >= ydiv){
if (leftbottom == null){
leftbottomFlag = true;
leftbottom = new PrimitiveQuadrantTreeNode((xdiv - (halfwidth / 2)), (ydiv - (halfheight / 2)), halfwidth, halfheight, (level + 1), this);
} else {
if (!leftbottomFlag){
leftbottomFlag = true;
leftbottom.reset((xdiv - (halfwidth / 2)), (ydiv - (halfheight / 2)), halfwidth, halfheight);
};
};
leftbottom.push(_arg1);
return;
};
};
} else {
if (_arg1.minX >= xdiv){
if (_arg1.maxY <= ydiv){
if (righttop == null){
righttopFlag = true;
righttop = new PrimitiveQuadrantTreeNode((xdiv - (halfwidth / 2)), (ydiv - (halfheight / 2)), halfwidth, halfheight, (level + 1), this);
} else {
if (!righttopFlag){
righttopFlag = true;
righttop.reset((xdiv - (halfwidth / 2)), (ydiv - (halfheight / 2)), halfwidth, halfheight);
};
};
righttop.push(_arg1);
return;
} else {
if (_arg1.minY >= ydiv){
if (rightbottom == null){
rightbottomFlag = true;
rightbottom = new PrimitiveQuadrantTreeNode((xdiv - (halfwidth / 2)), (ydiv - (halfheight / 2)), halfwidth, halfheight, (level + 1), this);
} else {
if (!rightbottomFlag){
rightbottomFlag = true;
rightbottom.reset((xdiv - (halfwidth / 2)), (ydiv - (halfheight / 2)), halfwidth, halfheight);
};
};
rightbottom.push(_arg1);
return;
};
};
};
};
};
if (center == null){
center = new Array();
};
center.push(_arg1);
_arg1.quadrant = this;
}
private function render_other(_arg1:Number):void{
if (lefttopFlag){
lefttop.render(_arg1);
};
if (leftbottomFlag){
leftbottom.render(_arg1);
};
if (righttopFlag){
righttop.render(_arg1);
};
if (rightbottomFlag){
rightbottom.render(_arg1);
};
}
public function reset(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):void{
this.xdiv = _arg1;
this.ydiv = _arg2;
halfwidth = (_arg3 / 2);
halfheight = (_arg4 / 2);
lefttopFlag = false;
leftbottomFlag = false;
righttopFlag = false;
rightbottomFlag = false;
onlysourceFlag = true;
onlysource = null;
render_center_length = -1;
render_center_index = -1;
}
}
}//package away3d.core.render
Section 60
//PrimitiveTraverser (away3d.core.render.PrimitiveTraverser)
package away3d.core.render {
import away3d.core.scene.*;
public class PrimitiveTraverser extends Traverser {
private var _lights:ILightConsumer;
private var _view:View3D;
private var _zoom:Number;
private var _consumer:IPrimitiveConsumer;
private var _focus:Number;
private var _sessions:Array;
private var _session:RenderSession;
override public function match(_arg1:Object3D):Boolean{
if (!_arg1.visible){
return (false);
};
if ((_arg1 is ILODObject)){
return ((_arg1 as ILODObject).matchLOD(_view));
};
return (true);
}
public function set consumer(_arg1:IPrimitiveConsumer):void{
_consumer = _arg1;
}
public function set session(_arg1:RenderSession):void{
_session = _arg1;
_sessions = [];
_lights = _session.lightarray;
_view = _session.view;
_focus = _view.camera.focus;
_zoom = _view.camera.zoom;
}
override public function leave(_arg1:Object3D):void{
_session = _sessions.pop();
}
override public function enter(_arg1:Object3D):void{
_sessions.push(_session);
}
override public function apply(_arg1:Object3D):void{
if ((_arg1 is IPrimitiveProvider)){
(_arg1 as IPrimitiveProvider).primitives(_consumer, _session);
_session = _arg1.session;
};
if ((_arg1 is ILightProvider)){
(_arg1 as ILightProvider).light(_arg1.viewTransform, _lights);
};
}
}
}//package away3d.core.render
Section 61
//Projection (away3d.core.render.Projection)
package away3d.core.render {
import away3d.core.math.*;
public class Projection {
public var view:Matrix3D;
public var time:int;
public var focus:Number;
public var zoom:Number;
}
}//package away3d.core.render
Section 62
//ProjectionTraverser (away3d.core.render.ProjectionTraverser)
package away3d.core.render {
import away3d.core.mesh.*;
import away3d.core.math.*;
import away3d.core.scene.*;
import flash.utils.*;
public class ProjectionTraverser extends Traverser {
private var _view:View3D;
private var _cameraview:Matrix3D;
var _projection:Projection;
override public function match(_arg1:Object3D):Boolean{
if (!_arg1.visible){
return (false);
};
_arg1.viewTransform.multiply(_cameraview, _arg1.sceneTransform);
_projection = _arg1.projection;
_projection.view = _arg1.viewTransform;
_projection.focus = _view.camera.focus;
_projection.zoom = _view.camera.zoom;
_projection.time = getTimer();
if ((_arg1 is ILODObject)){
return ((_arg1 as ILODObject).matchLOD(_view));
};
return (true);
}
public function set view(_arg1:View3D):void{
_view = _arg1;
_cameraview = _view.camera.view;
if (_view.statsOpen){
_view.statsPanel.clearObjects();
};
}
override public function enter(_arg1:Object3D):void{
if (((_view.statsOpen) && ((_arg1 is BaseMesh)))){
_view.statsPanel.addObject((_arg1 as BaseMesh));
};
}
}
}//package away3d.core.render
Section 63
//RectangleClipping (away3d.core.render.RectangleClipping)
package away3d.core.render {
import away3d.core.draw.*;
public class RectangleClipping extends Clipping {
public var minX:Number;// = -1000000
public var minY:Number;// = -1000000
public var maxX:Number;// = 1000000
public var maxY:Number;// = 1000000
public function RectangleClipping(){
minX = -1000000;
minY = -1000000;
maxX = 1000000;
maxY = 1000000;
super();
this.minX = minX;
this.maxX = maxX;
this.minY = minY;
this.maxY = maxY;
}
override public function rect(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Boolean{
if (this.maxX < _arg1){
return (false);
};
if (this.minX > _arg3){
return (false);
};
if (this.maxY < _arg2){
return (false);
};
if (this.minY > _arg4){
return (false);
};
return (true);
}
override public function check(_arg1:DrawPrimitive):Boolean{
if (_arg1.maxX < minX){
return (false);
};
if (_arg1.minX > maxX){
return (false);
};
if (_arg1.maxY < minY){
return (false);
};
if (_arg1.minY > maxY){
return (false);
};
return (true);
}
public function toString():String{
return ((((((((("{minX:" + minX) + " maxX:") + maxX) + " minY:") + minY) + " maxY:") + maxY) + "}"));
}
override public function asRectangleClipping():RectangleClipping{
return (this);
}
}
}//package away3d.core.render
Section 64
//RenderSession (away3d.core.render.RenderSession)
package away3d.core.render {
import flash.display.*;
import away3d.core.draw.*;
import away3d.core.scene.*;
import flash.geom.*;
import flash.utils.*;
public class RenderSession {
protected var _container:Sprite;
protected var _view:View3D;
var ty:Number;
public var graphics:Graphics;
var b2:Number;
var newCanvas:Sprite;
var tx:Number;
protected var _lightarray:LightArray;
var canvasActive:Array;
var c2:Number;
var v0x:Number;
var v0y:Number;
public var time:int;
var d2:Number;
public var clip:Clipping;
var map:Matrix;
var v1x:Number;
var v1y:Number;
var a:Number;
var c:Number;
var d:Number;
var b:Number;
var m:Matrix;
var canvasStore:Array;
var a2:Number;
var v2x:Number;
var v2y:Number;
public function RenderSession(){
m = new Matrix();
super();
}
public function addDisplayObject(_arg1:DisplayObject):void{
_container.addChild(_arg1);
_arg1.visible = true;
canvasStore = _view.canvasStore;
if (canvasStore.length){
newCanvas = canvasStore.pop();
} else {
newCanvas = new Sprite();
};
graphics = newCanvas.graphics;
_view.canvasActive.push(newCanvas);
_container.addChild(newCanvas);
}
public function get lightarray():LightArray{
return (_lightarray);
}
public function set lightarray(_arg1:LightArray):void{
_lightarray = _arg1;
}
public function set container(_arg1:Sprite):void{
_container = _arg1;
graphics = _container.graphics;
}
public function renderTriangleBitmap(_arg1:BitmapData, _arg2:Matrix, _arg3:ScreenVertex, _arg4:ScreenVertex, _arg5:ScreenVertex, _arg6:Boolean, _arg7:Boolean):void{
a2 = ((v1x = _arg4.x) - (v0x = _arg3.x));
b2 = ((v1y = _arg4.y) - (v0y = _arg3.y));
c2 = ((v2x = _arg5.x) - v0x);
d2 = ((v2y = _arg5.y) - v0y);
m.a = (((a = _arg2.a) * a2) + ((b = _arg2.b) * c2));
m.b = ((a * b2) + (b * d2));
m.c = (((c = _arg2.c) * a2) + ((d = _arg2.d) * c2));
m.d = ((c * b2) + (d * d2));
m.tx = ((((tx = _arg2.tx) * a2) + ((ty = _arg2.ty) * c2)) + v0x);
m.ty = (((tx * b2) + (ty * d2)) + v0y);
graphics.lineStyle();
graphics.beginBitmapFill(_arg1, m, _arg7, ((_arg6) && (((((v0x * (d2 - b2)) - (v1x * d2)) + (v2x * b2)) > 400))));
graphics.moveTo(v0x, v0y);
graphics.lineTo(v1x, v1y);
graphics.lineTo(v2x, v2y);
graphics.endFill();
}
public function get view():View3D{
return (_view);
}
public function renderTriangleColor(_arg1:int, _arg2:Number, _arg3:ScreenVertex, _arg4:ScreenVertex, _arg5:ScreenVertex):void{
graphics.lineStyle();
graphics.beginFill(_arg1, _arg2);
graphics.moveTo(_arg3.x, _arg3.y);
graphics.lineTo(_arg4.x, _arg4.y);
graphics.lineTo(_arg5.x, _arg5.y);
graphics.endFill();
}
public function set view(_arg1:View3D):void{
_view = _arg1;
clip = _view.clip;
time = getTimer();
}
public function renderTriangleLine(_arg1:int, _arg2:Number, _arg3:Number, _arg4:ScreenVertex, _arg5:ScreenVertex, _arg6:ScreenVertex):void{
graphics.lineStyle(_arg3, _arg1, _arg2);
graphics.moveTo((v0x = _arg4.x), (v0y = _arg4.y));
graphics.lineTo(_arg5.x, _arg5.y);
graphics.lineTo(_arg6.x, _arg6.y);
graphics.lineTo(v0x, v0y);
}
public function renderTriangleLineFill(_arg1:int, _arg2:Number, _arg3:int, _arg4:Number, _arg5:Number, _arg6:ScreenVertex, _arg7:ScreenVertex, _arg8:ScreenVertex):void{
if (_arg4 > 0){
graphics.lineStyle(_arg5, _arg3, _arg4);
} else {
graphics.lineStyle();
};
if (_arg2 > 0){
graphics.beginFill(_arg1, _arg2);
};
graphics.moveTo(_arg6.x, _arg6.y);
graphics.lineTo(_arg7.x, _arg7.y);
graphics.lineTo(_arg8.x, _arg8.y);
if (_arg4 > 0){
graphics.lineTo(_arg6.x, _arg6.y);
};
if (_arg2 > 0){
graphics.endFill();
};
}
}
}//package away3d.core.render
Section 65
//ZSortFilter (away3d.core.render.ZSortFilter)
package away3d.core.render {
import flash.display.*;
import away3d.core.scene.*;
public class ZSortFilter implements IPrimitiveFilter {
public function filter(_arg1:Array, _arg2:Scene3D, _arg3:Camera3D, _arg4:Sprite, _arg5:Clipping):Array{
_arg1.sortOn("screenZ", (Array.DESCENDING | Array.NUMERIC));
return (_arg1);
}
public function toString():String{
return ("ZSort");
}
}
}//package away3d.core.render
Section 66
//Camera3D (away3d.core.scene.Camera3D)
package away3d.core.scene {
import away3d.core.draw.*;
import away3d.core.mesh.*;
import away3d.core.math.*;
import away3d.core.render.*;
import away3d.core.utils.*;
import away3d.core.*;
public class Camera3D extends Object3D {
private var _flipY:Matrix3D;
private var _view:Matrix3D;
var screenProjection:Projection;
public var focus:Number;
public var zoom:Number;
public function Camera3D(_arg1:Object=null){
var _local2:Number3D;
_view = new Matrix3D();
screenProjection = new Projection();
_flipY = new Matrix3D();
super(_arg1);
_arg1 = Init.parse(_arg1);
zoom = _arg1.getNumber("zoom", 10);
focus = _arg1.getNumber("focus", 100);
_local2 = _arg1.getPosition("lookat");
_flipY.syy = -1;
if (_local2 != null){
lookAt(_local2);
};
}
override public function clone(_arg1=null){
var _local2:Camera3D;
_local2 = ((_local2) || (new Camera3D()));
super.clone(_local2);
_local2.zoom = zoom;
_local2.focus = focus;
return (_local2);
}
public function get view():Matrix3D{
_view.multiply(sceneTransform, _flipY);
_view.inverse(_view);
return (_view);
}
public function screen(_arg1:Object3D, _arg2:Vertex=null):ScreenVertex{
if (_arg2 == null){
_arg2 = new Vertex(0, 0, 0);
};
_arg1.viewTransform.multiply(view, _arg1.sceneTransform);
screenProjection.view = _arg1.viewTransform;
screenProjection.focus = focus;
screenProjection.zoom = zoom;
return (_arg2.project(screenProjection));
}
public function pan(_arg1:Number):void{
super.yaw(_arg1);
}
public function tilt(_arg1:Number):void{
super.pitch(_arg1);
}
}
}//package away3d.core.scene
Section 67
//ILightConsumer (away3d.core.scene.ILightConsumer)
package away3d.core.scene {
import away3d.core.math.*;
public interface ILightConsumer {
function ambientLight(_arg1:int, _arg2:Number):void;
function pointLight(_arg1:Matrix3D, _arg2:Light3D, _arg3:int, _arg4:Number, _arg5:Number, _arg6:Number):void;
function directedLight(_arg1:Number3D, _arg2:int, _arg3:Number):void;
}
}//package away3d.core.scene
Section 68
//ILightProvider (away3d.core.scene.ILightProvider)
package away3d.core.scene {
import away3d.core.math.*;
public interface ILightProvider {
function light(_arg1:Matrix3D, _arg2:ILightConsumer):void;
}
}//package away3d.core.scene
Section 69
//ILODObject (away3d.core.scene.ILODObject)
package away3d.core.scene {
public interface ILODObject {
function matchLOD(_arg1:View3D):Boolean;
}
}//package away3d.core.scene
Section 70
//IPhysicsScene (away3d.core.scene.IPhysicsScene)
package away3d.core.scene {
public interface IPhysicsScene {
function updateTime(_arg1:int):void;
}
}//package away3d.core.scene
Section 71
//Light3D (away3d.core.scene.Light3D)
package away3d.core.scene {
import flash.display.*;
import away3d.core.draw.*;
import away3d.core.mesh.*;
import away3d.core.math.*;
import away3d.core.render.*;
import flash.geom.*;
import away3d.core.utils.*;
import away3d.core.material.*;
import away3d.core.*;
public class Light3D extends Object3D implements ILightProvider, IPrimitiveProvider, IClonable {
public var _ls:PointLightSource;
public var debug:Boolean;
public var specular:Number;
public var diffuse:Number;
public var color:int;
var _bitmap:BitmapData;
public var ambient:Number;
public function Light3D(_arg1:Object=null){
var _local2:Number;
var _local3:Number;
_ls = new PointLightSource();
super(_arg1);
_arg1 = Init.parse(_arg1);
_bitmap = _arg1.getBitmap("bitmap");
_local2 = _arg1.getNumber("brightness", 1);
_local3 = _arg1.getNumber("distance", Math.sqrt(1000));
color = _arg1.getColor("color", 0xFFFFFF);
ambient = (((_arg1.getNumber("ambient", 1) * _local3) * _local3) * _local2);
diffuse = (((_arg1.getNumber("diffuse", 1) * _local3) * _local3) * _local2);
specular = (((_arg1.getNumber("specular", 1) * _local3) * _local3) * _local2);
debug = _arg1.getBoolean("debug", false);
}
public function get height():Number{
return (_bitmap.height);
}
public function get bitmap():BitmapData{
var _local1:Shape;
var _local2:Matrix;
if (_bitmap == null){
_bitmap = new BitmapData(0x0100, 0x0100, false, 0);
_local1 = new Shape();
_local2 = new Matrix();
_local2.createGradientBox(0x0100, 0x0100, 0, 0, 0);
_local1.graphics.beginGradientFill(GradientType.RADIAL, [0xFFFFFF, 0], [1, 1], [0, 0xFF], _local2);
_local1.graphics.drawCircle(127, 127, 127);
_bitmap.draw(_local1);
};
return (_bitmap);
}
public function light(_arg1:Matrix3D, _arg2:ILightConsumer):void{
_arg2.pointLight(_arg1, this, color, ambient, diffuse, specular);
}
override public function clone(_arg1=null){
var _local2:Light3D;
_local2 = ((_arg1) || (new Light3D()));
super.clone(_local2);
_local2.color = color;
_local2.ambient = ambient;
_local2.diffuse = diffuse;
_local2.specular = specular;
_local2.debug = debug;
return (_local2);
}
override public function primitives(_arg1:IPrimitiveConsumer, _arg2:RenderSession):void{
var _local3:Vertex;
var _local4:ScreenVertex;
var _local5:DrawTriangle;
super.primitives(_arg1, _arg2);
if (!debug){
return;
};
_local3 = new Vertex(0, 0, 0);
_local4 = _local3.project(projection);
if (!_local4.visible){
return;
};
_local5 = new DrawTriangle();
_local5.v0 = new ScreenVertex((_local4.x + 3), (_local4.y + 2), _local4.z);
_local5.v1 = new ScreenVertex((_local4.x - 3), (_local4.y + 2), _local4.z);
_local5.v2 = new ScreenVertex(_local4.x, (_local4.y - 3), _local4.z);
_local5.calc();
_local5.source = this;
_local5.projection = projection;
_local5.material = new ColorMaterial(color);
_arg1.primitive(_local5);
}
public function get width():Number{
return (_bitmap.width);
}
}
}//package away3d.core.scene
Section 72
//MouseEvent3D (away3d.core.scene.MouseEvent3D)
package away3d.core.scene {
import away3d.core.draw.*;
import away3d.core.mesh.*;
import flash.events.*;
import away3d.core.material.*;
public class MouseEvent3D extends Event {
public var shiftKey:Boolean;
public var sceneX:Number;
public var sceneY:Number;
public var sceneZ:Number;
public var view:View3D;
public var uv:UV;
public var screenY:Number;
public var screenZ:Number;
public var drawpri:DrawPrimitive;
public var screenX:Number;
public var ctrlKey:Boolean;
public var material:IUVMaterial;
public var element:Object;
public var object:Object3D;
public static var MOUSE_DOWN:String = "mouseDown3D";
public static var MOUSE_OUT:String = "mouseOut3D";
public static var MOUSE_UP:String = "mouseUp3D";
public static var MOUSE_MOVE:String = "mouseMove3D";
public static var MOUSE_OVER:String = "mouseOver3D";
public function MouseEvent3D(_arg1:String){
super(_arg1);
}
override public function clone():Event{
var _local1:MouseEvent3D;
_local1 = new MouseEvent3D(type);
_local1.screenX = screenX;
_local1.screenY = screenY;
_local1.screenZ = screenZ;
_local1.sceneX = sceneX;
_local1.sceneY = sceneY;
_local1.sceneZ = sceneZ;
_local1.view = view;
_local1.object = object;
_local1.element = element;
_local1.drawpri = drawpri;
_local1.material = material;
_local1.uv = uv;
_local1.ctrlKey = ctrlKey;
_local1.shiftKey = shiftKey;
return (_local1);
}
}
}//package away3d.core.scene
Section 73
//Object3D (away3d.core.scene.Object3D)
package away3d.core.scene {
import flash.display.*;
import away3d.core.draw.*;
import away3d.core.math.*;
import away3d.core.render.*;
import away3d.core.utils.*;
import flash.utils.*;
import away3d.core.*;
public class Object3D extends LazyEventDispatcher implements IClonable {
public var filters:Array;
public var extra:Object;
private var _rotationX:Number;
private var _rotationY:Number;
private var _rotationZ:Number;
public var ownSession:RenderSession;
var xAxis:Number3D;
var vector:Number3D;
public var viewTransform:Matrix3D;
public var projection:Projection;
var zAxis:Number3D;
public var canvas:Dictionary;
private var _sceneTransform:Matrix3D;
var c:Sprite;
var m:Matrix3D;
var q:Quaternion;
public var visible:Boolean;// = true
var v:View3D;
public var ownCanvas:Boolean;// = false
var _position:Number3D;
public var name:String;
public var useHandCursor:Boolean;// = false
private var _scene:Scene3D;
public var inverseSceneTransform:Matrix3D;
public var blendMode:String;
public var session:RenderSession;
private var scenechanged:Object3DEvent;
private var _sceneTransformDirty:Boolean;
var yAxis:Number3D;
private var transformchanged:Object3DEvent;
private var _parent:ObjectContainer3D;
var rot:Number3D;
public var mouseEnabled:Boolean;// = true
private var dimensionschanged:Object3DEvent;
arcane var _transformDirty:Boolean;
private var radiuschanged:Object3DEvent;
arcane var _transform:Matrix3D;
private var _rotationDirty:Boolean;
private static var toDEGREES:Number = 57.2957795130823;
private static var toRADIANS:Number = 0.0174532925199433;
public function Object3D(_arg1:Object=null):void{
_transform = new Matrix3D();
_sceneTransform = new Matrix3D();
projection = new Projection();
inverseSceneTransform = new Matrix3D();
viewTransform = new Matrix3D();
visible = true;
canvas = new Dictionary();
mouseEnabled = true;
useHandCursor = false;
ownCanvas = false;
_position = new Number3D();
q = new Quaternion();
vector = new Number3D();
m = new Matrix3D();
xAxis = new Number3D();
yAxis = new Number3D();
zAxis = new Number3D();
super();
_arg1 = Init.parse(_arg1);
name = _arg1.getString("name", name);
ownCanvas = _arg1.getBoolean("ownCanvas", ownCanvas);
visible = _arg1.getBoolean("visible", visible);
mouseEnabled = _arg1.getBoolean("mouseEnabled", mouseEnabled);
useHandCursor = _arg1.getBoolean("useHandCursor", useHandCursor);
filters = _arg1.getArray("filters");
x = _arg1.getNumber("x", 0);
y = _arg1.getNumber("y", 0);
z = _arg1.getNumber("z", 0);
rotationX = _arg1.getNumber("rotationX", 0);
rotationY = _arg1.getNumber("rotationY", 0);
rotationZ = _arg1.getNumber("rotationZ", 0);
extra = _arg1.getObject("extra");
parent = (_arg1.getObject3D("parent") as ObjectContainer3D);
if ((this is Scene3D)){
_scene = (this as Scene3D);
};
}
public function removeOnRadiusChange(_arg1:Function):void{
removeEventListener("radiuschanged", _arg1, false);
}
public function removeOnMouseOut(_arg1:Function):void{
removeEventListener(MouseEvent3D.MOUSE_OUT, _arg1, false);
}
public function moveDown(_arg1:Number):void{
translate(Number3D.DOWN, _arg1);
}
arcane function get parentmaxX():Number{
return ((radius + _transform.tx));
}
arcane function get parentmaxY():Number{
return ((radius + _transform.ty));
}
public function removeOnMouseUp(_arg1:Function):void{
removeEventListener(MouseEvent3D.MOUSE_UP, _arg1, false);
}
public function get position():Number3D{
if (_transformDirty){
updateTransform();
};
_position.x = _transform.tx;
_position.y = _transform.ty;
_position.z = _transform.tz;
return (_position);
}
arcane function get parentmaxZ():Number{
return ((radius + _transform.tz));
}
arcane function dispatchMouseEvent(_arg1:MouseEvent3D):Boolean{
if (!hasEventListener(_arg1.type)){
return (false);
};
dispatchEvent(_arg1);
return (true);
}
public function lookAt(_arg1:Number3D, _arg2:Number3D=null):void{
zAxis.sub(_arg1, position);
zAxis.normalize();
if (zAxis.modulo > 0.1){
xAxis.cross(zAxis, ((_arg2) || (Number3D.UP)));
xAxis.normalize();
yAxis.cross(zAxis, xAxis);
yAxis.normalize();
_transform.sxx = xAxis.x;
_transform.syx = xAxis.y;
_transform.szx = xAxis.z;
_transform.sxy = -(yAxis.x);
_transform.syy = -(yAxis.y);
_transform.szy = -(yAxis.z);
_transform.sxz = zAxis.x;
_transform.syz = zAxis.y;
_transform.szz = zAxis.z;
_transformDirty = false;
_rotationDirty = true;
_sceneTransformDirty = true;
notifyTransformChange();
};
}
public function set rotationX(_arg1:Number):void{
_rotationX = (-(_arg1) * toRADIANS);
_transformDirty = true;
notifyTransformChange();
}
public function moveTo(_arg1:Number3D):void{
_transform.tx = _arg1.x;
_transform.ty = _arg1.y;
_transform.tz = _arg1.z;
notifyTransformChange();
}
public function set rotationY(_arg1:Number):void{
_rotationY = (-(_arg1) * toRADIANS);
_transformDirty = true;
notifyTransformChange();
}
public function set rotationZ(_arg1:Number):void{
_rotationZ = (-(_arg1) * toRADIANS);
_transformDirty = true;
notifyTransformChange();
}
private function onParentSceneChange(_arg1:Object3DEvent):void{
if (_scene == _parent.scene){
return;
};
_scene = _parent.scene;
notifySceneChange();
}
public function get minX():Number{
return (-(radius));
}
public function get sceneTransform():Matrix3D{
if (_scene == null){
return (transform);
};
if (_transformDirty){
updateTransform();
};
if (_sceneTransformDirty){
updateSceneTransform();
};
return (_sceneTransform);
}
public function get minZ():Number{
return (-(radius));
}
public function moveUp(_arg1:Number):void{
translate(Number3D.UP, _arg1);
}
public function distanceTo(_arg1:Object3D):Number{
var _local2:Matrix3D;
var _local3:Matrix3D;
var _local4:Number;
var _local5:Number;
var _local6:Number;
_local2 = ((scene == null)) ? transform : sceneTransform;
_local3 = ((_arg1.scene == null)) ? _arg1.transform : _arg1.sceneTransform;
_local4 = (_local2.tx - _local3.tx);
_local5 = (_local2.ty - _local3.ty);
_local6 = (_local2.tz - _local3.tz);
return (Math.sqrt((((_local4 * _local4) + (_local5 * _local5)) + (_local6 * _local6))));
}
public function scale(_arg1:Number):void{
}
public function set position(_arg1:Number3D):void{
_transform.tx = _arg1.x;
_transform.ty = _arg1.y;
_transform.tz = _arg1.z;
_sceneTransformDirty = true;
notifyTransformChange();
}
public function set parent(_arg1:ObjectContainer3D):void{
var _local2:Scene3D;
if (_arg1 == _parent){
return;
};
_local2 = scene;
if (_parent != null){
_parent.removeOnSceneChange(onParentSceneChange);
_parent.internalRemoveChild(this);
};
_parent = _arg1;
if (_parent != null){
_parent.internalAddChild(this);
_parent.addOnSceneChange(onParentSceneChange);
_parent.addOnTransformChange(onParentTransformChange);
};
_scene = (_parent) ? _parent.scene : null;
if (_scene != _local2){
notifySceneChange();
};
_sceneTransformDirty = true;
notifyTransformChange();
}
public function translate(_arg1:Number3D, _arg2:Number):void{
vector.rotate(_arg1, transform);
x = (x + (_arg2 * vector.x));
y = (y + (_arg2 * vector.y));
z = (z + (_arg2 * vector.z));
}
public function get minY():Number{
return (-(radius));
}
protected function notifySceneChange():void{
if (!hasEventListener("scenechanged")){
return;
};
if (scenechanged == null){
scenechanged = new Object3DEvent("scenechanged", this);
};
dispatchEvent(scenechanged);
}
public function rotate(_arg1:Number3D, _arg2:Number):void{
vector.rotate(_arg1, transform);
m.rotationMatrix(vector.x, vector.y, vector.z, (_arg2 * toRADIANS));
m.tx = _transform.tx;
m.ty = _transform.ty;
m.tz = _transform.tz;
_transform.multiply3x3(m, transform);
_rotationDirty = true;
_sceneTransformDirty = true;
notifyTransformChange();
}
public function clone(_arg1=null){
_arg1 = ((_arg1) || (new Object3D()));
_arg1.transform = transform;
_arg1.name = name;
_arg1.visible = visible;
_arg1.mouseEnabled = mouseEnabled;
_arg1.useHandCursor = useHandCursor;
_arg1.extra = ((extra is IClonable)) ? (extra as IClonable).clone() : extra;
return (_arg1);
}
protected function notifyDimensionsChange():void{
if (!hasEventListener("dimensionschanged")){
return;
};
if (dimensionschanged == null){
dimensionschanged = new Object3DEvent("dimensionschanged", this);
};
dispatchEvent(dimensionschanged);
}
public function pitch(_arg1:Number):void{
rotate(Number3D.RIGHT, _arg1);
}
private function updateRotation():void{
rot = _transform.matrix2euler();
_rotationX = (rot.x * toRADIANS);
_rotationY = (rot.y * toRADIANS);
_rotationZ = (rot.z * toRADIANS);
_rotationDirty = false;
}
private function updateSceneTransform():void{
if (!_sceneTransformDirty){
return;
};
_sceneTransform.multiply(_parent.sceneTransform, transform);
inverseSceneTransform.inverse(_sceneTransform);
_sceneTransformDirty = false;
}
public function get transform():Matrix3D{
if (_transformDirty){
updateTransform();
};
return (_transform);
}
public function addOnMouseDown(_arg1:Function):void{
addEventListener(MouseEvent3D.MOUSE_DOWN, _arg1, false, 0, false);
}
public function yaw(_arg1:Number):void{
rotate(Number3D.UP, _arg1);
}
public function primitives(_arg1:IPrimitiveConsumer, _arg2:RenderSession):void{
v = _arg2.view;
if (ownCanvas){
if (canvas[v] == null){
canvas[v] = new Sprite();
};
c = canvas[v];
c.graphics.clear();
c.filters = filters;
if (blendMode != null){
c.blendMode = blendMode;
} else {
c.blendMode = BlendMode.NORMAL;
};
_arg1.primitive(new DrawDisplayObject(this, c, new ScreenVertex(0, 0, Math.sqrt(((((viewTransform.tz * viewTransform.tz) + viewTransform.tx) + viewTransform.tx) + (viewTransform.ty * viewTransform.ty)))), _arg2));
if (!ownSession){
ownSession = new RenderSession();
};
ownSession.view = v;
ownSession.container = c;
ownSession.lightarray = _arg2.lightarray;
this.session = ownSession;
} else {
if (canvas[v] != null){
delete canvas[v];
};
this.session = _arg2;
};
}
public function get maxX():Number{
return (radius);
}
public function get maxY():Number{
return (radius);
}
public function get maxZ():Number{
return (radius);
}
public function get x():Number{
return (_transform.tx);
}
public function get y():Number{
return (_transform.ty);
}
public function get z():Number{
return (_transform.tz);
}
public function moveLeft(_arg1:Number):void{
translate(Number3D.LEFT, _arg1);
}
public function removeOnDimensionsChange(_arg1:Function):void{
removeEventListener("dimensionschanged", _arg1, false);
}
public function roll(_arg1:Number):void{
rotate(Number3D.FORWARD, _arg1);
}
public function traverse(_arg1:Traverser):void{
if (_arg1.match(this)){
_arg1.enter(this);
_arg1.apply(this);
_arg1.leave(this);
};
}
public function addOnRadiusChange(_arg1:Function):void{
addEventListener("radiuschanged", _arg1, false, 0, true);
}
private function onParentTransformChange(_arg1:Object3DEvent):void{
_sceneTransformDirty = true;
notifyTransformChange();
}
public function get radius():Number{
return (0);
}
public function get rotationX():Number{
if (_rotationDirty){
updateRotation();
};
return ((-(_rotationX) * toDEGREES));
}
public function get rotationY():Number{
if (_rotationDirty){
updateRotation();
};
return ((-(_rotationY) * toDEGREES));
}
public function get rotationZ():Number{
if (_rotationDirty){
updateRotation();
};
return ((-(_rotationZ) * toDEGREES));
}
public function tick(_arg1:int):void{
}
public function addOnMouseUp(_arg1:Function):void{
addEventListener(MouseEvent3D.MOUSE_UP, _arg1, false, 0, false);
}
private function updateTransform():void{
if (!_transformDirty){
return;
};
q.euler2quaternion(-(_rotationY), -(_rotationZ), _rotationX);
_transform.quaternion2matrix(q.x, q.y, q.z, q.w);
_transformDirty = false;
_sceneTransformDirty = true;
}
public function get scene():Scene3D{
return (_scene);
}
public function toString():String{
return ((((((((name) ? name : "$" + ": x:") + Math.round(x)) + " y:") + Math.round(y)) + " z:") + Math.round(z)));
}
public function get parent():ObjectContainer3D{
return (_parent);
}
public function removeOnMouseDown(_arg1:Function):void{
removeEventListener(MouseEvent3D.MOUSE_DOWN, _arg1, false);
}
public function removeOnTransformChange(_arg1:Function):void{
removeEventListener("transformchanged", _arg1, false);
}
public function addOnDimensionsChange(_arg1:Function):void{
addEventListener("dimensionschanged", _arg1, false, 0, true);
}
public function moveForward(_arg1:Number):void{
translate(Number3D.FORWARD, _arg1);
}
public function addOnMouseOver(_arg1:Function):void{
addEventListener(MouseEvent3D.MOUSE_OVER, _arg1, false, 0, false);
}
arcane function get parentradius():Number{
var _local1:Number;
var _local2:Number;
var _local3:Number;
_local1 = _transform.tx;
_local2 = _transform.ty;
_local3 = _transform.tz;
return ((Math.sqrt((((_local1 * _local1) + (_local2 * _local2)) + (_local3 * _local3))) + radius));
}
protected function notifyTransformChange():void{
if (!hasEventListener("transformchanged")){
return;
};
if (transformchanged == null){
transformchanged = new Object3DEvent("transformchanged", this);
};
dispatchEvent(transformchanged);
}
public function addOnTransformChange(_arg1:Function):void{
addEventListener("transformchanged", _arg1, false, 0, true);
}
public function moveRight(_arg1:Number):void{
translate(Number3D.RIGHT, _arg1);
}
public function addOnMouseMove(_arg1:Function):void{
addEventListener(MouseEvent3D.MOUSE_MOVE, _arg1, false, 0, false);
}
protected function notifyRadiusChange():void{
if (!hasEventListener("radiuschanged")){
return;
};
if (radiuschanged == null){
radiuschanged = new Object3DEvent("radiuschanged", this);
};
dispatchEvent(radiuschanged);
}
public function removeOnMouseMove(_arg1:Function):void{
removeEventListener(MouseEvent3D.MOUSE_MOVE, _arg1, false);
}
public function moveBackward(_arg1:Number):void{
translate(Number3D.BACKWARD, _arg1);
}
public function get scenePosition():Number3D{
return (new Number3D(sceneTransform.tx, sceneTransform.ty, sceneTransform.tz));
}
public function removeOnMouseOver(_arg1:Function):void{
removeEventListener(MouseEvent3D.MOUSE_OVER, _arg1, false);
}
public function set transform(_arg1:Matrix3D):void{
if (_arg1 == _transform){
return;
};
_transform = _arg1.clone();
_transformDirty = false;
_rotationDirty = true;
_sceneTransformDirty = true;
notifyTransformChange();
}
public function removeOnSceneChange(_arg1:Function):void{
removeEventListener("scenechanged", _arg1, false);
}
public function addOnSceneChange(_arg1:Function):void{
addEventListener("scenechanged", _arg1, false, 0, true);
}
arcane function get parentminX():Number{
return ((-(radius) + _transform.tx));
}
arcane function get parentminY():Number{
return ((-(radius) + _transform.ty));
}
public function set y(_arg1:Number):void{
if (isNaN(_arg1)){
throw (new Error("isNaN(y)"));
};
if (_arg1 == Infinity){
Debug.warning("y == Infinity");
};
if (_arg1 == -(Infinity)){
Debug.warning("y == -Infinity");
};
_transform.ty = _arg1;
_sceneTransformDirty = true;
notifyTransformChange();
}
public function set z(_arg1:Number):void{
if (isNaN(_arg1)){
throw (new Error("isNaN(z)"));
};
if (_arg1 == Infinity){
Debug.warning("z == Infinity");
};
if (_arg1 == -(Infinity)){
Debug.warning("z == -Infinity");
};
_transform.tz = _arg1;
_sceneTransformDirty = true;
notifyTransformChange();
}
public function set x(_arg1:Number):void{
if (isNaN(_arg1)){
throw (new Error("isNaN(x)"));
};
if (_arg1 == Infinity){
Debug.warning("x == Infinity");
};
if (_arg1 == -(Infinity)){
Debug.warning("x == -Infinity");
};
_transform.tx = _arg1;
_sceneTransformDirty = true;
notifyTransformChange();
}
public function addOnMouseOut(_arg1:Function):void{
addEventListener(MouseEvent3D.MOUSE_OUT, _arg1, false, 0, false);
}
arcane function get parentminZ():Number{
return ((-(radius) + _transform.tz));
}
}
}//package away3d.core.scene
Section 74
//Object3DEvent (away3d.core.scene.Object3DEvent)
package away3d.core.scene {
import flash.events.*;
public class Object3DEvent extends Event {
public var object:Object3D;
public function Object3DEvent(_arg1:String, _arg2:Object3D){
super(_arg1);
this.object = _arg2;
}
override public function clone():Event{
return (new Object3DEvent(type, object));
}
}
}//package away3d.core.scene
Section 75
//ObjectContainer3D (away3d.core.scene.ObjectContainer3D)
package away3d.core.scene {
import away3d.core.render.*;
import away3d.core.*;
public class ObjectContainer3D extends Object3D implements IPrimitiveProvider {
private var _minZChild:Object3D;// = null
private var _maxY:Number;
private var _maxZ:Number;
private var _maxX:Number;
private var _minYDirty:Boolean;// = false
private var _maxZDirty:Boolean;// = false
private var _maxXChild:Object3D;// = null
private var _radiusDirty:Boolean;// = false
private var _minZDirty:Boolean;// = false
private var _minXChild:Object3D;// = null
private var _needNotifyDimensionsChange:Boolean;// = false
private var child:Object3D;
private var _minY:Number;// = INF
private var _minZ:Number;// = INF
private var _maxYChild:Object3D;// = null
private var _minX:Number;// = INF
private var _maxXDirty:Boolean;// = false
private var _needNotifyRadiusChange:Boolean;// = false
private var _children:Array;
private var _minYChild:Object3D;// = null
private var _minXDirty:Boolean;// = false
private var _radius:Number;// = 0
private var _maxZChild:Object3D;// = null
private var _maxYDirty:Boolean;// = false
private var _radiusChild:Object3D;// = null
public function ObjectContainer3D(_arg1:Object=null, ... _args){
_children = new Array();
_radiusChild = null;
_radiusDirty = false;
_radius = 0;
_maxXChild = null;
_maxXDirty = false;
_maxX = -(Infinity);
_minXChild = null;
_minXDirty = false;
_minX = Infinity;
_maxYChild = null;
_maxYDirty = false;
_maxY = -(Infinity);
_minYChild = null;
_minYDirty = false;
_minY = Infinity;
_maxZChild = null;
_maxZDirty = false;
_maxZ = -(Infinity);
_minZChild = null;
_minZDirty = false;
_minZ = Infinity;
_needNotifyRadiusChange = false;
_needNotifyDimensionsChange = false;
if (_arg1 != null){
if ((_arg1 is Object3D)){
addChild((_arg1 as Object3D));
_arg1 = null;
};
};
super(_arg1);
for each (child in _args) {
addChild(child);
};
}
override public function get minX():Number{
var _local1:Number;
var _local2:Number;
if (_minXDirty){
_minXChild = null;
_local1 = Infinity;
for each (child in _children) {
_local2 = child.parentminX;
if (_local2 < _local1){
_local1 = _local2;
_minXChild = child;
};
};
_minX = _local1;
_minXDirty = false;
};
return (_minX);
}
override public function get minZ():Number{
var _local1:Number;
var _local2:Number;
if (_minZDirty){
_local1 = Infinity;
_minZChild = null;
for each (child in _children) {
_local2 = child.parentminZ;
if (_local2 < _local1){
_local1 = _local2;
_minZChild = child;
};
};
_minZ = _local1;
_minZDirty = false;
};
return (_minZ);
}
override public function get minY():Number{
var _local1:Number;
var _local2:Number;
if (_minYDirty){
_local1 = Infinity;
_minYChild = null;
for each (child in _children) {
_local2 = child.parentminY;
if (_local2 < _local1){
_local1 = _local2;
_minYChild = child;
};
};
_minY = _local1;
_minYDirty = false;
};
return (_minY);
}
private function onChildChange(_arg1:Object3DEvent):void{
child = _arg1.object;
forgetChild(child);
rememberChild(child);
launchNotifies();
}
private function rememberChild(_arg1:Object3D):void{
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
_local2 = _arg1.parentradius;
if (_local2 > _radius){
_radius = _local2;
_radiusChild = _arg1;
_radiusDirty = false;
_needNotifyRadiusChange = true;
};
_local3 = _arg1.parentmaxX;
if (_local3 > _maxX){
_maxX = _local3;
_maxXChild = _arg1;
_maxXDirty = false;
_needNotifyDimensionsChange = true;
};
_local4 = _arg1.parentminX;
if (_local4 < _minX){
_minX = _local4;
_minXChild = _arg1;
_minXDirty = false;
_needNotifyDimensionsChange = true;
};
_local5 = _arg1.parentmaxY;
if (_local5 > _maxY){
_maxY = _local5;
_maxYChild = _arg1;
_maxYDirty = false;
_needNotifyDimensionsChange = true;
};
_local6 = _arg1.parentminY;
if (_local6 < _minY){
_minY = _local6;
_minYChild = _arg1;
_minYDirty = false;
_needNotifyDimensionsChange = true;
};
_local7 = _arg1.parentmaxZ;
if (_local7 > _maxZ){
_maxZ = _local7;
_maxZChild = _arg1;
_maxZDirty = false;
_needNotifyDimensionsChange = true;
};
_local8 = _arg1.parentminZ;
if (_local8 < _minZ){
_minZ = _local8;
_minZChild = _arg1;
_minZDirty = false;
_needNotifyDimensionsChange = true;
};
}
override public function get radius():Number{
var _local1:Number;
var _local2:Number;
if (_radiusDirty){
_radiusChild = null;
_local1 = 0;
for each (child in _children) {
_local2 = child.parentradius;
if (_local2 > _local1){
_local1 = _local2;
_radiusChild = child;
};
};
_radius = _local1;
_radiusDirty = false;
};
return (_radius);
}
public function getChildByName(_arg1:String):Object3D{
for each (child in children) {
if (child.name == _arg1){
return (child);
};
};
return (null);
}
public function removeChildByName(_arg1:String):void{
removeChild(getChildByName(_arg1));
}
private function launchNotifies():void{
if (_needNotifyRadiusChange){
_needNotifyRadiusChange = false;
notifyRadiusChange();
};
if (_needNotifyDimensionsChange){
_needNotifyDimensionsChange = false;
notifyDimensionsChange();
};
}
arcane function internalAddChild(_arg1:Object3D):void{
_children.push(_arg1);
_arg1.addOnTransformChange(onChildChange);
_arg1.addOnRadiusChange(onChildChange);
rememberChild(_arg1);
launchNotifies();
}
public function movePivot(_arg1:Number, _arg2:Number, _arg3:Number):void{
for each (child in _children) {
child.x = (child.x - _arg1);
child.y = (child.y - _arg2);
child.z = (child.z - _arg3);
};
x = (x + _arg1);
y = (y + _arg2);
z = (z + _arg3);
}
public function removeChild(_arg1:Object3D):void{
if (_arg1 == null){
throw (new Error("ObjectContainer3D.removeChild(null)"));
};
if (_arg1.parent != this){
return;
};
_arg1.parent = null;
}
public function addChild(_arg1:Object3D):void{
if (_arg1 == null){
throw (new Error("ObjectContainer3D.addChild(null)"));
};
if (_arg1.parent == this){
return;
};
_arg1.parent = this;
}
private function forgetChild(_arg1:Object3D):void{
if (_arg1 == _radiusChild){
_radiusChild = null;
_radiusDirty = true;
_needNotifyRadiusChange = true;
};
if (_arg1 == _maxXChild){
_maxXChild = null;
_maxXDirty = true;
_needNotifyDimensionsChange = true;
};
if (_arg1 == _minXChild){
_minXChild = null;
_minXDirty = true;
_needNotifyDimensionsChange = true;
};
if (_arg1 == _maxYChild){
_maxYChild = null;
_maxYDirty = true;
_needNotifyDimensionsChange = true;
};
if (_arg1 == _minYChild){
_minYChild = null;
_minYDirty = true;
_needNotifyDimensionsChange = true;
};
if (_arg1 == _maxZChild){
_maxZChild = null;
_maxZDirty = true;
_needNotifyDimensionsChange = true;
};
if (_arg1 == _minZChild){
_minZChild = null;
_minZDirty = true;
_needNotifyDimensionsChange = true;
};
}
override public function scale(_arg1:Number):void{
for each (child in children) {
child.x = (child.x * _arg1);
child.y = (child.y * _arg1);
child.z = (child.z * _arg1);
child.scale(_arg1);
};
}
override public function clone(_arg1=null){
var _local2:ObjectContainer3D;
_local2 = ((_arg1) || (new ObjectContainer3D()));
super.clone(_local2);
for each (child in children) {
_local2.addChild(child.clone());
};
return (_local2);
}
override public function traverse(_arg1:Traverser):void{
if (_arg1.match(this)){
_arg1.enter(this);
_arg1.apply(this);
for each (child in children) {
child.traverse(_arg1);
};
_arg1.leave(this);
};
}
override public function get maxY():Number{
var _local1:Number;
var _local2:Number;
if (_maxYDirty){
_local1 = -(Infinity);
_maxYChild = null;
for each (child in _children) {
_local2 = child.parentmaxY;
if (_local2 > _local1){
_local1 = _local2;
_maxYChild = child;
};
};
_maxY = _local1;
_maxYDirty = false;
};
return (_maxY);
}
override public function get maxZ():Number{
var _local1:Number;
var _local2:Number;
if (_maxZDirty){
_local1 = -(Infinity);
_maxZChild = null;
for each (child in _children) {
_local2 = child.parentmaxZ;
if (_local2 > _local1){
_local1 = _local2;
_maxZChild = child;
};
};
_maxZ = _local1;
_maxZDirty = false;
};
return (_maxZ);
}
override public function get maxX():Number{
var _local1:Number;
var _local2:Number;
if (_maxXDirty){
_maxXChild = null;
_local1 = -(Infinity);
for each (child in _children) {
_local2 = child.parentmaxX;
if (_local2 > _local1){
_local1 = _local2;
_maxXChild = child;
};
};
_maxX = _local1;
_maxXDirty = false;
};
return (_maxX);
}
public function addChildren(... _args):void{
for each (child in _args) {
addChild(child);
};
}
arcane function internalRemoveChild(_arg1:Object3D):void{
var _local2:int;
_local2 = children.indexOf(_arg1);
if (_local2 == -1){
return;
};
forgetChild(_arg1);
_arg1.removeOnTransformChange(onChildChange);
_arg1.removeOnRadiusChange(onChildChange);
_children.splice(_local2, 1);
launchNotifies();
}
public function get children():Array{
return (_children);
}
}
}//package away3d.core.scene
Section 76
//Scene3D (away3d.core.scene.Scene3D)
package away3d.core.scene {
import away3d.core.draw.*;
import away3d.core.mesh.*;
import away3d.core.math.*;
import away3d.core.render.*;
import away3d.core.utils.*;
import away3d.core.material.*;
import flash.utils.*;
import away3d.core.*;
public class Scene3D extends ObjectContainer3D {
public var tickTraverser:TickTraverser;
public var physics:IPhysicsScene;
public function Scene3D(_arg1:Object=null, ... _args){
var _local3:Object;
var _local4:Object3D;
tickTraverser = new TickTraverser();
super();
if (_arg1 != null){
if ((_arg1 is Object3D)){
addChild((_arg1 as Object3D));
_arg1 = null;
};
};
_arg1 = Init.parse(_arg1);
_local3 = _arg1.getObject("physics");
if ((_local3 is IPhysicsScene)){
physics = (_local3 as IPhysicsScene);
};
if ((_local3 is Boolean)){
if (_local3 == true){
physics = null;
};
};
if ((_local3 is Object)){
physics = null;
};
for each (_local4 in _args) {
addChild(_local4);
};
}
public function updateTime(_arg1:int=-1):void{
if (_arg1 == -1){
_arg1 = getTimer();
};
tickTraverser.now = _arg1;
traverse(tickTraverser);
if (physics != null){
physics.updateTime(_arg1);
};
}
override public function get sceneTransform():Matrix3D{
return (transform);
}
override public function set parent(_arg1:ObjectContainer3D):void{
if (_arg1 != null){
throw (new Error("Scene can't be parented"));
};
}
}
}//package away3d.core.scene
Section 77
//TickTraverser (away3d.core.scene.TickTraverser)
package away3d.core.scene {
public class TickTraverser extends Traverser {
public var now:int;
override public function enter(_arg1:Object3D):void{
_arg1.tick(now);
}
}
}//package away3d.core.scene
Section 78
//Traverser (away3d.core.scene.Traverser)
package away3d.core.scene {
public class Traverser {
public function match(_arg1:Object3D):Boolean{
return (true);
}
public function leave(_arg1:Object3D):void{
}
public function enter(_arg1:Object3D):void{
}
public function apply(_arg1:Object3D):void{
}
}
}//package away3d.core.scene
Section 79
//View3D (away3d.core.scene.View3D)
package away3d.core.scene {
import flash.display.*;
import away3d.core.draw.*;
import away3d.core.mesh.*;
import away3d.core.render.*;
import flash.events.*;
import away3d.core.utils.*;
import away3d.core.material.*;
import flash.utils.*;
import away3d.core.stats.*;
import away3d.core.*;
public class View3D extends Sprite {
public var bitmapTexture:Bitmap;
public var mouseMaterial:IUVMaterial;
private var defaultclip:Clipping;
public var camera:Camera3D;
public var bitmapShader:Bitmap;
public var background:Sprite;
private var _lastmove_mouseX:Number;
public var findhit:FindHit;
public var mouseObject:Object3D;
public var clip:Clipping;
public var canvas:Sprite;
public var canvasStore:Array;
var c:Sprite;
var i:int;
public var mouseZeroMove:Boolean;
public var primitives:Array;
public var statsOpen:Boolean;
public var interactiveLayer:Sprite;
public var bmp:Bitmap;
public var stats:Boolean;
public var scene:Scene3D;
public var statsPanel:Stats;
public var canvasActive:Array;
public var renderer:IRenderer;
protected var mousedown:Boolean;
private var _lastmove_mouseY:Number;
public var hud:Sprite;
public function View3D(_arg1:Object=null){
background = new Sprite();
canvas = new Sprite();
bitmapTexture = new Bitmap();
bitmapShader = new Bitmap();
interactiveLayer = new Sprite();
hud = new Sprite();
defaultclip = new Clipping();
canvasStore = new Array();
canvasActive = new Array();
super();
_arg1 = Init.parse(_arg1);
stats = _arg1.getBoolean("stats", true);
clip = _arg1.getObject("clip", Clipping);
scene = ((_arg1.getObjectOrInit("scene", Scene3D)) || (new Scene3D()));
camera = ((_arg1.getObjectOrInit("camera", Camera3D)) || (new Camera3D({x:0, y:0, z:1000, lookat:"center"})));
renderer = ((_arg1.getObject("renderer")) || (new BasicRenderer()));
mouseZeroMove = _arg1.getBoolean("mouseZeroMove", false);
x = _arg1.getNumber("x", 0);
y = _arg1.getNumber("y", 0);
addChild(background);
addChild(canvas);
addChild(bitmapTexture);
addChild(bitmapShader);
addChild(interactiveLayer);
addChild(hud);
interactiveLayer.blendMode = BlendMode.ALPHA;
addEventListener(MouseEvent.MOUSE_DOWN, onMouseDown);
addEventListener(MouseEvent.MOUSE_UP, onMouseUp);
addEventListener(MouseEvent.MOUSE_OUT, onMouseOut);
addEventListener(MouseEvent.MOUSE_OVER, onMouseOver);
if (!clip){
clip = defaultclip;
};
if (stats){
addEventListener(Event.ADDED_TO_STAGE, createStatsMenu);
};
}
private function onMouseOver(_arg1:MouseEvent):void{
if (_arg1.eventPhase != EventPhase.AT_TARGET){
return;
};
fireMouseEvent(MouseEvent3D.MOUSE_OVER, _arg1.localX, _arg1.localY, _arg1.ctrlKey, _arg1.shiftKey);
}
public function createStatsMenu(_arg1:Event):void{
statsPanel = new Stats(this, stage.frameRate);
statsOpen = false;
}
public function removeOnMouseOut(_arg1:Function):void{
removeEventListener(MouseEvent3D.MOUSE_OUT, _arg1, false);
}
public function fireMouseMoveEvent(_arg1:Boolean=false):void{
if (!((mouseZeroMove) || (_arg1))){
if ((((mouseX == _lastmove_mouseX)) && ((mouseY == _lastmove_mouseY)))){
return;
};
};
fireMouseEvent(MouseEvent3D.MOUSE_MOVE, mouseX, mouseY);
_lastmove_mouseX = mouseX;
_lastmove_mouseY = mouseY;
}
arcane function dispatchMouseEvent(_arg1:MouseEvent3D):void{
if (!hasEventListener(_arg1.type)){
return;
};
dispatchEvent(_arg1);
}
public function removeOnMouseUp(_arg1:Function):void{
removeEventListener(MouseEvent3D.MOUSE_UP, _arg1, false);
}
private function onMouseUp(_arg1:MouseEvent):void{
mousedown = false;
fireMouseEvent(MouseEvent3D.MOUSE_UP, _arg1.localX, _arg1.localY, _arg1.ctrlKey, _arg1.shiftKey);
}
public function addOnMouseDown(_arg1:Function):void{
addEventListener(MouseEvent3D.MOUSE_DOWN, _arg1, false, 0, false);
}
public function clear():void{
canvas.graphics.clear();
i = canvasActive.length;
while (i--) {
c = canvasActive[i];
c.graphics.clear();
canvasStore.push(canvasActive.pop());
};
i = canvas.numChildren;
while (i--) {
canvas.removeChild(canvas.getChildAt(i));
};
}
private function onMouseOut(_arg1:MouseEvent):void{
if (_arg1.eventPhase != EventPhase.AT_TARGET){
return;
};
fireMouseEvent(MouseEvent3D.MOUSE_OUT, _arg1.localX, _arg1.localY, _arg1.ctrlKey, _arg1.shiftKey);
}
public function addOnMouseOver(_arg1:Function):void{
addEventListener(MouseEvent3D.MOUSE_OVER, _arg1, false, 0, false);
}
public function bubbleMouseEvent(_arg1:MouseEvent3D):void{
var _local2:Object3D;
_local2 = _arg1.object;
while (_local2 != null) {
if (_local2.dispatchMouseEvent(_arg1)){
break;
};
_local2 = _local2.parent;
};
}
public function addOnMouseUp(_arg1:Function):void{
addEventListener(MouseEvent3D.MOUSE_UP, _arg1, false, 0, false);
}
public function fireMouseEvent(_arg1:String, _arg2:Number, _arg3:Number, _arg4:Boolean=false, _arg5:Boolean=false):void{
var _local6:MouseEvent3D;
var _local7:Object3D;
var _local8:IUVMaterial;
findhit = new FindHit(this, primitives, _arg2, _arg3);
_local6 = findhit.getMouseEvent(_arg1);
_local7 = _local6.object;
_local8 = _local6.material;
_local6.ctrlKey = _arg4;
_local6.shiftKey = _arg5;
if (((!((_arg1 == MouseEvent3D.MOUSE_OUT))) && (!((_arg1 == MouseEvent3D.MOUSE_OVER))))){
dispatchMouseEvent(_local6);
bubbleMouseEvent(_local6);
};
if (((!((mouseObject == _local7))) || (!((mouseMaterial == _local8))))){
if (mouseObject != null){
_local6 = findhit.getMouseEvent(MouseEvent3D.MOUSE_OUT);
_local6.object = mouseObject;
_local6.material = mouseMaterial;
dispatchMouseEvent(_local6);
bubbleMouseEvent(_local6);
mouseObject = null;
buttonMode = false;
};
if (((!((_local7 == null))) && ((mouseObject == null)))){
_local6 = findhit.getMouseEvent(MouseEvent3D.MOUSE_OVER);
_local6.object = (mouseObject = _local7);
_local6.material = (mouseMaterial = _local8);
dispatchMouseEvent(_local6);
bubbleMouseEvent(_local6);
buttonMode = mouseObject.useHandCursor;
};
};
}
protected function onMouseDown(_arg1:MouseEvent):void{
mousedown = true;
fireMouseEvent(MouseEvent3D.MOUSE_DOWN, _arg1.localX, _arg1.localY, _arg1.ctrlKey, _arg1.shiftKey);
}
public function render():void{
var _local1:Clipping;
clear();
_local1 = clip;
if (clip == defaultclip){
clip = defaultclip.screen(this);
};
primitives = renderer.render(this);
clip = _local1;
Init.checkUnusedArguments();
fireMouseMoveEvent();
}
public function removeOnMouseDown(_arg1:Function):void{
removeEventListener(MouseEvent3D.MOUSE_DOWN, _arg1, false);
}
public function removeOnMouseMove(_arg1:Function):void{
removeEventListener(MouseEvent3D.MOUSE_MOVE, _arg1, false);
}
public function removeOnMouseOver(_arg1:Function):void{
removeEventListener(MouseEvent3D.MOUSE_OVER, _arg1, false);
}
public function addOnMouseOut(_arg1:Function):void{
addEventListener(MouseEvent3D.MOUSE_OUT, _arg1, false, 0, false);
}
public function addOnMouseMove(_arg1:Function):void{
addEventListener(MouseEvent3D.MOUSE_MOVE, _arg1, false, 0, false);
}
}
}//package away3d.core.scene
Section 80
//MovieClipSprite (away3d.core.sprite.MovieClipSprite)
package away3d.core.sprite {
import flash.display.*;
import away3d.core.draw.*;
import away3d.core.mesh.*;
import away3d.core.math.*;
import away3d.core.render.*;
import away3d.core.scene.*;
import away3d.core.utils.*;
import away3d.core.material.*;
import away3d.core.*;
public class MovieClipSprite extends Object3D implements IPrimitiveProvider {
private var center:Vertex;
public var movieclip:DisplayObject;
public var deltaZ:Number;
public var scaling:Number;
public function MovieClipSprite(_arg1:DisplayObject, _arg2:Object=null){
center = new Vertex();
super(_arg2);
this.movieclip = _arg1;
_arg2 = Init.parse(_arg2);
scaling = _arg2.getNumber("scaling", NaN);
deltaZ = _arg2.getNumber("deltaZ", 0);
}
override public function primitives(_arg1:IPrimitiveConsumer, _arg2:RenderSession):void{
var _local3:ScreenVertex;
var _local4:Number;
super.primitives(_arg1, _arg2);
_local3 = center.project(projection);
_local4 = (projection.zoom / (1 + (_local3.z / projection.focus)));
_local3.z = (_local3.z + deltaZ);
_local3.x = (_local3.x - (movieclip.width / 2));
_local3.y = (_local3.y - (movieclip.height / 2));
_arg1.primitive(new DrawDisplayObject(this, movieclip, _local3, _arg2));
}
}
}//package away3d.core.sprite
Section 81
//Sprite2D (away3d.core.sprite.Sprite2D)
package away3d.core.sprite {
import flash.display.*;
import away3d.core.draw.*;
import away3d.core.mesh.*;
import away3d.core.math.*;
import away3d.core.render.*;
import away3d.core.scene.*;
import away3d.core.utils.*;
import away3d.core.material.*;
import away3d.core.*;
public class Sprite2D extends Object3D implements IPrimitiveProvider {
public var bitmap:BitmapData;
private var center:Vertex;
public var scaling:Number;
public var deltaZ:Number;
public var rotation:Number;
public var smooth:Boolean;
public function Sprite2D(_arg1:Object=null){
center = new Vertex();
super(_arg1);
_arg1 = Init.parse(_arg1);
scaling = _arg1.getNumber("scaling", 1, {min:0});
rotation = _arg1.getNumber("rotation", 0);
bitmap = _arg1.getBitmap("bitmap");
smooth = _arg1.getBoolean("smooth", false);
deltaZ = _arg1.getNumber("deltaZ", 0);
}
override public function primitives(_arg1:IPrimitiveConsumer, _arg2:RenderSession):void{
var _local3:ScreenVertex;
var _local4:Number;
super.primitives(_arg1, _arg2);
_local3 = center.project(projection);
if (!_local3.visible){
return;
};
_local4 = (projection.zoom / (1 + (_local3.z / projection.focus)));
_local3.z = (_local3.z + deltaZ);
_arg1.primitive(new DrawScaledBitmap(this, bitmap, _local3, (_local4 * scaling), rotation, smooth));
}
}
}//package away3d.core.sprite
Section 82
//Stats (away3d.core.stats.Stats)
package away3d.core.stats {
import flash.display.*;
import away3d.core.mesh.*;
import flash.events.*;
import away3d.core.scene.*;
import flash.geom.*;
import flash.utils.*;
import flash.text.*;
import flash.ui.*;
import flash.system.*;
import flash.net.*;
public class Stats extends Sprite {
private const APPLICATION_NAME:String = "Away3D.com";
private const VERSION:String = "1";
private const REVISION:String = "9.3";
private var bar:Sprite;
private var swfframerateLabel:TextField;
private var cambtn:Sprite;
private var geomLastAdded:String;
private var faceRenderLabel:TextField;
private var defautTF:TextFormat;
private var camLabel:TextField;
private var bestfps:int;// = 0
private var stageframerate:Number;
private var rectclose:Rectangle;
private var faceLabel:TextField;
private var aTypes:Array;
public var stats:String;
public var geomMenu:Sprite;// = null
private var avfpsLabel:TextField;
private var refreshes:int;// = 0
private var totalFaces:int;// = 0
var facecount:int;
private var rectclear:Rectangle;
private var displayState:int;
private var clearbtn:Sprite;
private var meshLabel:TextField;
private var barscale:int;// = 0
var type:String;
private var geomDetailsLabel:TextField;
public var displayMenu:Sprite;// = null
private var maxminbtn:Sprite;
private var peakLabel:TextField;
private var meshes:int;// = 0
private var closebtn:Sprite;
private var rectcam:Rectangle;
var url:String;
private var oStats:Object;
private var ramLabel:TextField;
private var titleField:TextField;
private var fpsLabel:TextField;
private var contextmenu:ContextMenu;
private var perfLabel:TextField;
private var geombtn:Sprite;
private var barwidth:int;// = 0
private var lastrender:int;
private var camMenu:Sprite;
private var camProp:Array;
public var scopeMenu:View3D;// = null
private var rectdetails:Rectangle;
private var lowestfps:int;// = 999
private var fpstotal:int;// = 0
public function Stats(_arg1:View3D, _arg2:Number=0){
var _local3:ContextMenuItem;
var _local4:ContextMenuItem;
var _local5:ContextMenuItem;
oStats = new Object();
totalFaces = 0;
meshes = 0;
aTypes = new Array();
scopeMenu = null;
displayMenu = null;
geomMenu = null;
fpstotal = 0;
refreshes = 0;
bestfps = 0;
lowestfps = 999;
barwidth = 0;
barscale = 0;
rectclose = new Rectangle(228, 4, 18, 17);
rectcam = new Rectangle(207, 4, 18, 17);
rectclear = new Rectangle(186, 4, 18, 17);
rectdetails = new Rectangle(165, 4, 18, 17);
defautTF = new TextFormat("Verdana", 10, 0);
super();
scopeMenu = _arg1;
contextmenu = new ContextMenu();
stageframerate = (_arg2) ? _arg2 : 30;
displayState = 0;
_local3 = new ContextMenuItem(((((APPLICATION_NAME + "\tv") + VERSION) + ".") + REVISION), true, true, true);
_local4 = new ContextMenuItem("Away3D Project stats", true, true, true);
_local5 = new ContextMenuItem(" ");
contextmenu.customItems = [_local4, _local3, _local5];
_local3.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, visitWebsite);
_local4.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, displayStats);
scopeMenu.contextMenu = contextmenu;
scopeMenu.contextMenu.hideBuiltInItems();
}
public function clearObjects():void{
stats = "";
totalFaces = 0;
meshes = 0;
geomLastAdded = "";
}
private function showGeomInfo():void{
if (geomMenu == null){
createGeometrieMenu();
} else {
displayMenu.addChild(geomMenu);
geomMenu.y = 26;
};
}
private function clearStats():void{
fpstotal = 0;
refreshes = 0;
bestfps = 0;
lowestfps = 999;
}
private function closeOtherScreen(_arg1:int):void{
switch (_arg1){
case 1:
hideCamInfo();
break;
case 2:
hideGeomInfo();
};
}
private function generateSprite():void{
var _local1:Matrix;
var _local2:Sprite;
var _local3:Graphics;
var _local4:Graphics;
var _local5:Graphics;
var _local6:TextField;
var _local7:TextField;
var _local8:TextField;
var _local9:TextField;
var _local10:TextField;
var _local11:TextField;
var _local12:TextField;
var _local13:TextField;
var _local14:TextField;
displayMenu = new Sprite();
_local1 = new Matrix();
_local1.rotate(((90 * Math.PI) / 180));
displayMenu.graphics.beginGradientFill("linear", [3355494, 0xCCCCCC], [1, 1], [0, 0xFF], _local1, "pad", "rgb", 0);
displayMenu.graphics.drawRect(0, 0, 250, 86);
displayMenu.graphics.beginFill(3355494);
displayMenu.graphics.drawRect(3, 3, 244, 20);
scopeMenu.addChild(displayMenu);
displayMenu.x = (displayMenu.x - (displayMenu.width * 0.5));
displayMenu.y = (displayMenu.y - (displayMenu.height * 0.5));
closebtn = new Sprite();
closebtn.graphics.beginFill(0x666666);
closebtn.graphics.drawRect(0, 0, 18, 17);
_local2 = new Sprite();
_local2.graphics.beginFill(13029592);
_local2.graphics.drawRect(2, 7, 14, 4);
_local2.graphics.endFill();
_local2.graphics.beginFill(13029592);
_local2.graphics.drawRect(7, 2, 4, 14);
_local2.graphics.endFill();
_local2.rotation = 45;
_local2.x = (_local2.x + 9);
_local2.y = (_local2.y - 4);
closebtn.addChild(_local2);
displayMenu.addChild(closebtn);
closebtn.x = 228;
closebtn.y = 4;
cambtn = new Sprite();
_local3 = cambtn.graphics;
_local3.beginFill(0x666666);
_local3.drawRect(0, 0, 18, 17);
_local3.endFill();
_local3.beginFill(13029592);
_local3.moveTo(10, 8);
_local3.lineTo(16, 4);
_local3.lineTo(16, 14);
_local3.lineTo(10, 10);
_local3.lineTo(10, 8);
_local3.drawRect(2, 6, 8, 6);
_local3.endFill();
displayMenu.addChild(cambtn);
cambtn.x = 207;
cambtn.y = 4;
clearbtn = new Sprite();
_local4 = clearbtn.graphics;
_local4.beginFill(0x666666);
_local4.drawRect(0, 0, 18, 17);
_local4.endFill();
_local4.beginFill(13029592);
_local4.drawRect(6, 6, 6, 6);
_local4.endFill();
displayMenu.addChild(clearbtn);
clearbtn.x = 186;
clearbtn.y = 4;
geombtn = new Sprite();
_local5 = geombtn.graphics;
_local5.beginFill(0x666666);
_local5.drawRect(0, 0, 18, 17);
_local5.endFill();
_local5.beginFill(13029592, 0.7);
_local5.moveTo(3, 4);
_local5.lineTo(11, 2);
_local5.lineTo(16, 5);
_local5.lineTo(7, 7);
_local5.lineTo(3, 4);
_local5.beginFill(8225929, 0.8);
_local5.moveTo(3, 4);
_local5.lineTo(7, 7);
_local5.lineTo(7, 16);
_local5.lineTo(3, 12);
_local5.lineTo(3, 4);
_local5.beginFill(13029592, 1);
_local5.moveTo(7, 7);
_local5.lineTo(16, 5);
_local5.lineTo(15, 13);
_local5.lineTo(7, 16);
_local5.lineTo(7, 7);
_local5.endFill();
_local5.endFill();
displayMenu.addChild(geombtn);
geombtn.x = 165;
geombtn.y = 4;
displayMenu.graphics.beginGradientFill("linear", [0, 0xFFFFFF], [1, 1], [0, 0xFF], new Matrix(), "pad", "rgb", 0);
displayMenu.graphics.drawRect(3, 22, 244, 4);
displayMenu.graphics.endFill();
bar = new Sprite();
bar.graphics.beginFill(0xFFFFFF);
bar.graphics.drawRect(0, 0, 244, 4);
displayMenu.addChild(bar);
bar.x = 3;
bar.y = 22;
barwidth = 244;
barscale = int((barwidth / stageframerate));
displayPicto();
titleField = new TextField();
titleField.defaultTextFormat = new TextFormat("Verdana", 10, 0xFFFFFF, true, null, null, null, null, "left");
titleField.text = "AWAY3D PROJECT";
titleField.selectable = false;
titleField.height = 20;
titleField.width = 140;
titleField.x = 22;
titleField.y = 4;
displayMenu.addChild(titleField);
_local6 = new TextField();
_local6.defaultTextFormat = new TextFormat("Verdana", 10, 0, true);
_local6.text = "FPS:";
fpsLabel = new TextField();
fpsLabel.defaultTextFormat = defautTF;
displayMenu.addChild(_local6);
displayMenu.addChild(fpsLabel);
_local6.x = 3;
_local6.y = (fpsLabel.y = 30);
_local6.autoSize = "left";
fpsLabel.x = ((_local6.x + _local6.width) - 2);
_local7 = new TextField();
_local7.defaultTextFormat = new TextFormat("Verdana", 10, 0, true);
_local7.text = "AFPS:";
avfpsLabel = new TextField();
avfpsLabel.defaultTextFormat = defautTF;
displayMenu.addChild(_local7);
displayMenu.addChild(avfpsLabel);
_local7.x = 52;
_local7.y = (avfpsLabel.y = fpsLabel.y);
_local7.autoSize = "left";
avfpsLabel.x = ((_local7.x + _local7.width) - 2);
_local8 = new TextField();
_local8.defaultTextFormat = new TextFormat("Verdana", 10, 0, true);
_local8.text = "Max:";
peakLabel = new TextField();
peakLabel.defaultTextFormat = defautTF;
displayMenu.addChild(_local8);
displayMenu.addChild(peakLabel);
_local8.x = 107;
_local8.y = (peakLabel.y = avfpsLabel.y);
_local8.autoSize = "left";
peakLabel.x = ((_local8.x + _local8.width) - 2);
_local9 = new TextField();
_local9.defaultTextFormat = new TextFormat("Verdana", 10, 0, true);
_local9.text = "MS:";
perfLabel = new TextField();
perfLabel.defaultTextFormat = defautTF;
displayMenu.addChild(_local9);
displayMenu.addChild(perfLabel);
_local9.x = 177;
_local9.y = (perfLabel.y = fpsLabel.y);
_local9.autoSize = "left";
perfLabel.x = ((_local9.x + _local9.width) - 2);
_local10 = new TextField();
_local10.defaultTextFormat = new TextFormat("Verdana", 10, 0, true);
_local10.text = "RAM:";
ramLabel = new TextField();
ramLabel.defaultTextFormat = defautTF;
displayMenu.addChild(_local10);
displayMenu.addChild(ramLabel);
_local10.x = 3;
_local10.y = (ramLabel.y = 46);
_local10.autoSize = "left";
ramLabel.x = ((_local10.x + _local10.width) - 2);
_local11 = new TextField();
_local11.defaultTextFormat = new TextFormat("Verdana", 10, 0, true);
_local11.text = "MESHES:";
meshLabel = new TextField();
meshLabel.defaultTextFormat = defautTF;
displayMenu.addChild(_local11);
displayMenu.addChild(meshLabel);
_local11.x = 90;
_local11.y = (meshLabel.y = ramLabel.y);
_local11.autoSize = "left";
meshLabel.x = ((_local11.x + _local11.width) - 2);
_local12 = new TextField();
_local12.defaultTextFormat = new TextFormat("Verdana", 10, 0, true);
_local12.text = "SWF FR:";
swfframerateLabel = new TextField();
swfframerateLabel.defaultTextFormat = defautTF;
displayMenu.addChild(_local12);
displayMenu.addChild(swfframerateLabel);
_local12.x = 170;
_local12.y = (swfframerateLabel.y = ramLabel.y);
_local12.autoSize = "left";
swfframerateLabel.x = ((_local12.x + _local12.width) - 2);
_local13 = new TextField();
_local13.defaultTextFormat = new TextFormat("Verdana", 10, 0, true);
_local13.text = "T FACES:";
faceLabel = new TextField();
faceLabel.defaultTextFormat = defautTF;
displayMenu.addChild(_local13);
displayMenu.addChild(faceLabel);
_local13.x = 3;
_local13.y = (faceLabel.y = 62);
_local13.autoSize = "left";
faceLabel.x = ((_local13.x + _local13.width) - 2);
_local14 = new TextField();
_local14.defaultTextFormat = new TextFormat("Verdana", 10, 0, true);
_local14.text = "R FACES:";
faceRenderLabel = new TextField();
faceRenderLabel.defaultTextFormat = defautTF;
displayMenu.addChild(_local14);
displayMenu.addChild(faceRenderLabel);
_local14.x = 105;
_local14.y = (faceRenderLabel.y = faceLabel.y);
_local14.autoSize = "left";
faceRenderLabel.x = ((_local14.x + _local14.width) - 2);
}
private function createGeometrieMenu():void{
var _local1:Matrix;
geomMenu = new Sprite();
_local1 = new Matrix();
_local1.rotate(((90 * Math.PI) / 180));
geomMenu.graphics.beginGradientFill("linear", [3355494, 0xCCCCCC], [1, 1], [0, 0xFF], _local1, "pad", "rgb", 0);
geomMenu.graphics.drawRect(0, 0, 250, 200);
displayMenu.addChild(geomMenu);
geomMenu.y = 26;
geomDetailsLabel = new TextField();
geomDetailsLabel.x = 3;
geomDetailsLabel.y = 3;
geomDetailsLabel.defaultTextFormat = defautTF;
geomDetailsLabel.text = stats;
geomDetailsLabel.height = 200;
geomDetailsLabel.width = 235;
geomDetailsLabel.multiline = true;
geomDetailsLabel.selectable = true;
geomDetailsLabel.wordWrap = true;
geomMenu.addChild(geomDetailsLabel);
}
public function visitWebsite(_arg1:ContextMenuEvent):void{
var url:String;
var request:URLRequest;
var e = _arg1;
url = "http://www.away3d.com";
request = new URLRequest(url);
try {
navigateToURL(request);
} catch(e:Error) {
};
}
public function displayStats(_arg1:ContextMenuEvent):void{
if (!displayMenu){
scopeMenu.statsOpen = true;
generateSprite();
addEventMouse();
};
}
private function mouseReleased(_arg1:MouseEvent):void{
displayMenu.stopDrag();
scopeMenu.removeEventListener(MouseEvent.MOUSE_UP, mouseReleased);
}
private function createCamMenu():void{
var _local1:Matrix;
var _local2:TextFormat;
var _local3:TextField;
var _local4:int;
camMenu = new Sprite();
_local1 = new Matrix();
_local1.rotate(((90 * Math.PI) / 180));
camMenu.graphics.beginGradientFill("linear", [3355494, 0xCCCCCC], [1, 1], [0, 0xFF], _local1, "pad", "rgb", 0);
camMenu.graphics.drawRect(0, 0, 250, 220);
displayMenu.addChild(camMenu);
camMenu.y = 26;
camLabel = new TextField();
camLabel.height = 210;
camLabel.width = 170;
camLabel.x = 100;
camLabel.multiline = true;
_local2 = defautTF;
_local2.leading = 1.5;
camLabel.defaultTextFormat = _local2;
camLabel.wordWrap = true;
camMenu.addChild(camLabel);
camLabel.x = 100;
camLabel.y = 3;
camProp = ["x", "y", "z", "zoom", "focus", "distance", "panangle", "tiltangle", "targetpanangle", "targettiltangle", "mintiltangle", "maxtiltangle", "steps", "target"];
_local3 = new TextField();
_local2 = new TextFormat("Verdana", 10, 0, true);
_local2.leading = 1.5;
_local2.align = "right";
_local3.defaultTextFormat = _local2;
_local3.x = (_local3.y = 3);
_local3.multiline = true;
_local3.selectable = false;
_local3.autoSize = "left";
_local3.height = 210;
_local4 = 0;
while (_local4 < camProp.length) {
_local3.appendText((camProp[_local4] + ":\n"));
_local4++;
};
camMenu.addChild(_local3);
}
public function addObject(_arg1:BaseMesh):void{
type = _arg1.type;
if ((_arg1 is Mesh)){
facecount = (_arg1 as Mesh).faces.length;
} else {
facecount = 0;
};
url = _arg1.url;
if (((!((type == null))) && (!((facecount == 0))))){
stats = (stats + ((((((" - " + type) + " , faces: ") + facecount) + ", url: ") + url) + "\n"));
geomLastAdded = ((((((" - " + type) + " , faces: ") + facecount) + ", url: ") + url) + "\n");
totalFaces = (totalFaces + facecount);
meshes = (meshes + 1);
} else {
stats = (stats + ((((" - " + type) + " , url: ") + url) + "\n"));
geomLastAdded = ((((" - " + type) + " , url: ") + url) + "\n");
};
}
public function updateStats(_arg1:int, _arg2:Camera3D):void{
var now:int;
var perf:int;
var procent:int;
var colorTransform:ColorTransform;
var fps:int;
var average:int;
var w:int;
var caminfo:String;
var i:int;
var info:String;
var renderedfaces = _arg1;
var camera = _arg2;
now = getTimer();
perf = (now - lastrender);
lastrender = now;
if (perf < 1000){
fps = int((1000 / (perf + 0.001)));
fpstotal = (fpstotal + fps);
refreshes++;
average = (fpstotal / refreshes);
bestfps = ((fps)>bestfps) ? fps : bestfps;
lowestfps = ((fps)<lowestfps) ? fps : lowestfps;
w = (barscale * fps);
bar.width = ((w)<=barwidth) ? w : barwidth;
};
procent = ((bar.width / barwidth) * 100);
colorTransform = bar.transform.colorTransform;
colorTransform.color = ((((0xFF - (2.55 * procent)) << 16) | ((2.55 * procent) << 8)) | 40);
bar.transform.colorTransform = colorTransform;
if (displayState == 0){
avfpsLabel.text = ("" + average);
ramLabel.text = (("" + (int(((System.totalMemory / 0x0400) / 102.4)) / 10)) + "MB");
peakLabel.text = ((lowestfps + "/") + bestfps);
fpsLabel.text = ("" + fps);
perfLabel.text = ("" + perf);
faceLabel.text = ("" + totalFaces);
faceRenderLabel.text = ("" + renderedfaces);
meshLabel.text = ("" + meshes);
swfframerateLabel.text = ("" + stageframerate);
} else {
if (displayState == 1){
caminfo = "";
i = 0;
while (i < camProp.length) {
try {
if (i > 12){
caminfo = (caminfo + (String(camera[camProp[i]]) + "\n"));
} else {
info = String(camera[camProp[i]]);
caminfo = (caminfo + (info.substring(0, 19) + "\n"));
};
} catch(e:Error) {
caminfo = (caminfo + "\n");
};
i = (i + 1);
};
camLabel.text = caminfo;
} else {
if (displayState == 2){
geomDetailsLabel.text = stats;
geomDetailsLabel.scrollV = geomDetailsLabel.maxScrollV;
};
};
};
}
private function get image():Array{
return ([[7, 1, 262151], [8, 1, 3215136], [9, 1, 2033436], [10, 1, 1], [7, 2, 2098723], [8, 2, 5908501], [9, 2, 4922400], [10, 2, 720913], [6, 3, 327691], [7, 3, 6957102], [8, 3, 5975556], [9, 3, 6368779], [10, 3, 4789809], [11, 3, 2], [6, 4, 2361127], [7, 4, 10833686], [8, 4, 4926728], [9, 4, 6239495], [10, 4, 9190690], [11, 4, 1114647], [5, 5, 786453], [6, 5, 7088423], [7, 5, 14055707], [8, 5, 2103310], [9, 5, 3877139], [10, 5, 13134098], [11, 5, 5577773], [12, 5, 131077], [4, 6, 1], [5, 6, 3608110], [6, 6, 11227664], [7, 6, 12748351], [8, 6, 65793], [9, 6, 986379], [10, 6, 14980667], [11, 6, 10044437], [12, 6, 2230306], [4, 7, 0x12001C], [5, 7, 8007967], [6, 7, 14911011], [7, 7, 6509633], [10, 7, 9138771], [11, 7, 13989655], [12, 7, 7350824], [13, 7, 327689], [3, 8, 262153], [4, 8, 4592689], [5, 8, 12016138], [6, 8, 15774570], [7, 8, 855309], [10, 8, 2434083], [11, 8, 16233056], [12, 8, 11489803], [13, 8, 3345958], [3, 9, 1966887], [4, 9, 8665113], [5, 9, 15636021], [6, 9, 6773581], [11, 9, 9140836], [12, 9, 15240489], [13, 9, 8467743], [14, 9, 852240], [2, 10, 458767], [3, 10, 5774639], [4, 10, 13265683], [5, 10, 10845518], [6, 10, 0x0101], [11, 10, 657931], [12, 10, 14396016], [13, 10, 12739344], [14, 10, 5184297], [15, 10, 2], [2, 11, 2557230], [3, 11, 10307863], [4, 11, 12548133], [5, 11, 723464], [12, 11, 1512721], [13, 11, 14651446], [14, 11, 10307352], [15, 11, 1508630], [1, 12, 983068], [2, 12, 7154221], [3, 12, 9522185], [4, 12, 1314568], [6, 12, 131586], [7, 12, 921102], [8, 12, 0x1A1A1A], [9, 12, 0x171717], [10, 12, 657930], [13, 12, 2892051], [14, 12, 12610067], [15, 12, 7220009], [16, 12, 196614], [1, 13, 3936052], [2, 13, 5908749], [3, 13, 1773570], [4, 13, 4402968], [5, 13, 10714191], [6, 13, 12884326], [7, 13, 14396274], [8, 13, 15053429], [9, 13, 14790257], [10, 13, 13935206], [11, 13, 12159571], [12, 13, 9265971], [13, 13, 2759432], [14, 13, 2561537], [15, 13, 8601360], [16, 13, 3346464], [1, 14, 3938326], [2, 14, 5712395], [3, 14, 10900499], [4, 14, 11951126], [5, 14, 11490833], [6, 14, 11358991], [7, 14, 11227662], [8, 14, 11161870], [9, 14, 11030286], [10, 14, 10964497], [11, 14, 10898963], [12, 14, 10833429], [13, 14, 11096344], [14, 14, 8797973], [15, 14, 4595726], [16, 14, 4594459], [17, 14, 327941], [1, 15, 2296596], [2, 15, 3280925], [3, 15, 2821148], [4, 15, 2624284], [5, 15, 2558749], [6, 15, 2624031], [7, 15, 2558496], [8, 15, 2558498], [9, 15, 2492705], [10, 15, 2361630], [11, 15, 2361374], [12, 15, 2295839], [13, 15, 2295840], [14, 15, 2427171], [15, 15, 2624036], [16, 15, 1377300]]);
}
private function showCamInfo():void{
if (camMenu == null){
createCamMenu();
} else {
displayMenu.addChild(camMenu);
camMenu.y = 26;
};
}
private function hideGeomInfo():void{
if (geomMenu != null){
displayMenu.removeChild(geomMenu);
};
}
private function hideCamInfo():void{
if (camMenu != null){
displayMenu.removeChild(camMenu);
};
}
private function closeStats():void{
scopeMenu.statsOpen = false;
displayState = 0;
scopeMenu.removeEventListener(MouseEvent.MOUSE_DOWN, onCheckMouse);
scopeMenu.removeEventListener(MouseEvent.MOUSE_MOVE, updateTips);
scopeMenu.removeChild(displayMenu);
displayMenu = null;
}
private function updateTips(_arg1:MouseEvent):void{
var x:Number;
var y:Number;
var pt:Point;
var me = _arg1;
if (scopeMenu != null){
x = displayMenu.mouseX;
y = displayMenu.mouseY;
pt = new Point(x, y);
try {
if (rectcam.containsPoint(pt)){
titleField.text = "CAMERA INFO";
} else {
if (rectclose.containsPoint(pt)){
titleField.text = "CLOSE STATS";
} else {
if (rectclear.containsPoint(pt)){
titleField.text = "CLEAR AVERAGES";
} else {
if (rectdetails.containsPoint(pt)){
titleField.text = "MESH INFO";
} else {
titleField.text = "AWAY3D PROJECT";
};
};
};
};
} catch(e:Error) {
};
};
}
private function addEventMouse():void{
scopeMenu.addEventListener(MouseEvent.MOUSE_DOWN, onCheckMouse);
scopeMenu.addEventListener(MouseEvent.MOUSE_MOVE, updateTips);
}
private function onCheckMouse(_arg1:MouseEvent):void{
var _local2:Number;
var _local3:Number;
var _local4:Point;
_local2 = displayMenu.mouseX;
_local3 = displayMenu.mouseY;
_local4 = new Point(_local2, _local3);
if (rectcam.containsPoint(_local4)){
if (displayState != 1){
closeOtherScreen(displayState);
displayState = 1;
showCamInfo();
} else {
displayState = 0;
hideCamInfo();
};
} else {
if (rectdetails.containsPoint(_local4)){
if (displayState != 2){
closeOtherScreen(displayState);
displayState = 2;
showGeomInfo();
} else {
displayState = 0;
hideGeomInfo();
};
} else {
if (rectclose.containsPoint(_local4)){
closeStats();
} else {
if (rectclear.containsPoint(_local4)){
clearStats();
} else {
displayMenu.startDrag();
scopeMenu.addEventListener(MouseEvent.MOUSE_UP, mouseReleased);
};
};
};
};
}
private function generateClipBoardInfo():void{
var _local1:String;
var _local2:Camera3D;
_local1 = "-- AWAY3D STATS REPORT --\n\n";
_local1 = (_local1 + "GEOMETRY:\n");
_local1 = (_local1 + stats);
_local1 = (_local1 + "\nCAMERA:\n");
_local2 = scopeMenu.camera;
}
private function displayPicto():void{
var _local1:Sprite;
var _local2:Graphics;
var _local3:Array;
var _local4:int;
_local1 = new Sprite();
_local2 = _local1.graphics;
_local2.beginFill(0);
_local2.drawRect(0, 0, 18, 17);
_local3 = image;
_local4 = 0;
while (_local4 < _local3.length) {
_local2.beginFill(Number(_local3[_local4][2]));
_local2.drawRect(_local3[_local4][0], _local3[_local4][1], 1, 1);
_local4++;
};
_local2.endFill();
displayMenu.addChild(_local1);
_local1.x = (_local1.y = 4);
}
}
}//package away3d.core.stats
Section 83
//Cast (away3d.core.utils.Cast)
package away3d.core.utils {
import flash.display.*;
import away3d.core.mesh.*;
import away3d.core.scene.*;
import away3d.core.material.*;
import flash.utils.*;
import away3d.loaders.*;
public class Cast {
private static var colornames:Dictionary;
private static var hexchars:String = "0123456789abcdefABCDEF";
private static var classes:Dictionary = new Dictionary();
private static var notclasses:Dictionary = new Dictionary();
public static function color(_arg1):uint{
var _local2:uint;
_local2 = trycolor(_arg1);
if (_local2 == 4294967295){
throw (new CastError(("Can't cast to color: " + _arg1)));
};
return (_local2);
}
public static function material(_arg1):ITriangleMaterial{
var hash:Array;
var line:Array;
var bmd:BitmapData;
var bitmap:BitmapData;
var color:uint;
var alpha:Number;
var lighting:Boolean;
var static:Boolean;
var wire:WireframeMaterial;
var smooth:Number;
var precision:Number;
var data = _arg1;
if (data == null){
return (null);
};
if ((data is String)){
data = tryclass(data);
};
if ((data is Class)){
try {
data = new (data);
} catch(error:ArgumentError) {
data = new data(0, 0);
};
};
if ((data is IMaterial)){
return (data);
};
if ((data is int)){
return (new ColorMaterial(data));
};
if ((data is MovieClip)){
return (new MovieMaterial(data));
};
if ((data is String)){
if (data == ""){
return (null);
};
if (data == "transparent"){
return (new TransparentMaterial());
};
if (data.indexOf("#") != -1){
hash = data.split("#");
if (hash[1] == ""){
return (new WireColorMaterial(color(hash[0])));
};
if (hash[1].indexOf("|") == -1){
if (hash[0] == ""){
return (new WireframeMaterial(color(hash[1])));
};
return (new WireColorMaterial(color(hash[0]), {wirecolor:color(hash[1])}));
} else {
line = hash[1].split("|");
if (hash[0] == ""){
return (new WireframeMaterial(color(line[0]), {width:parseFloat(line[1])}));
};
return (new WireColorMaterial(color(hash[0]), {wirecolor:color(line[0]), width:parseFloat(line[1])}));
};
} else {
if (data.indexOf("@") != -1){
hash = data.split("@");
if (hash[1] == ""){
return (new ShadingColorMaterial({color:color(hash[0])}));
};
} else {
return (new ColorMaterial(color(data)));
};
};
};
try {
bmd = Cast.bitmap(data);
return (new BitmapMaterial(bmd));
} catch(error:CastError) {
};
if ((data is Object)){
data = Init.parse(data);
bitmap = data.getBitmap("bitmap");
color = data.getColor("color", 4294967295);
alpha = data.getNumber("alpha", 1, {min:0, max:1});
lighting = data.getBoolean("lighting", false);
static = data.getBoolean("static", false);
wire = (wirematerial(data.getObject("wire")) as WireframeMaterial);
if (((!((bitmap == null))) && (!((color == 4294967295))))){
throw (new CastError(("Can't create material with color and bitmap: " + data)));
};
if (bitmap != null){
if (wire != null){
Debug.warning("Bitmap materials do not support wire");
};
smooth = data.getNumber("smooth", false);
precision = data.getNumber("precision", Infinity);
if (precision < Infinity){
if (lighting){
Debug.warning("Can't create precise bitmap material with lighting (yet)");
};
if (alpha < 1){
Debug.warning("Can't create precise bitmap material with alpha (yet)");
};
return (new BitmapMaterial(bitmap, {smooth:smooth}));
};
if (lighting){
if (alpha < 1){
Debug.warning("Can't create bitmap material with lighting and alpha (yet)");
};
return (new WhiteShadingBitmapMaterial(bitmap, {smooth:smooth}));
};
if (alpha < 1){
return (new AlphaBitmapMaterial(bitmap, {smooth:smooth, alpha:alpha}));
};
return (new BitmapMaterial(bitmap, {smooth:smooth}));
};
if (color != 4294967295){
if (lighting){
if (wire != null){
Debug.warning("Can't create shading material with wire");
};
return (new ShadingColorMaterial({color:color, alpha:alpha, static:static}));
};
if (wire == null){
return (new ColorMaterial(color, {alpha:alpha}));
};
return (new WireColorMaterial(color, {alpha:alpha, wirecolor:wire.color, wirealpha:wire.alpha, width:wire.width}));
};
if (wire != null){
return (wire);
};
};
throw (new CastError(("Can't cast to material: " + data)));
}
public static function trycolor(_arg1):uint{
if ((_arg1 is uint)){
return ((_arg1 as uint));
};
if ((_arg1 is int)){
return ((_arg1 as uint));
};
if ((_arg1 is String)){
if (_arg1 == "random"){
return (uint((Math.random() * 16777216)));
};
if (colornames == null){
colornames = new Dictionary();
colornames["steelblue"] = 4620980;
colornames["royalblue"] = 267920;
colornames["cornflowerblue"] = 6591981;
colornames["lightsteelblue"] = 11584734;
colornames["mediumslateblue"] = 8087790;
colornames["slateblue"] = 6970061;
colornames["darkslateblue"] = 4734347;
colornames["midnightblue"] = 1644912;
colornames["navy"] = 128;
colornames["darkblue"] = 139;
colornames["mediumblue"] = 205;
colornames["blue"] = 0xFF;
colornames["dodgerblue"] = 2003199;
colornames["deepskyblue"] = 49151;
colornames["lightskyblue"] = 8900346;
colornames["skyblue"] = 8900331;
colornames["lightblue"] = 11393254;
colornames["powderblue"] = 11591910;
colornames["azure"] = 15794175;
colornames["lightcyan"] = 14745599;
colornames["paleturquoise"] = 11529966;
colornames["mediumturquoise"] = 4772300;
colornames["lightseagreen"] = 2142890;
colornames["darkcyan"] = 0x8B8B;
colornames["teal"] = 0x8080;
colornames["cadetblue"] = 6266528;
colornames["darkturquoise"] = 52945;
colornames["aqua"] = 0xFFFF;
colornames["cyan"] = 0xFFFF;
colornames["turquoise"] = 4251856;
colornames["aquamarine"] = 8388564;
colornames["mediumaquamarine"] = 6737322;
colornames["darkseagreen"] = 9419919;
colornames["mediumseagreen"] = 3978097;
colornames["seagreen"] = 3050327;
colornames["darkgreen"] = 0x6400;
colornames["green"] = 0x8000;
colornames["forestgreen"] = 2263842;
colornames["limegreen"] = 3329330;
colornames["lime"] = 0xFF00;
colornames["chartreuse"] = 0x7FFF00;
colornames["lawngreen"] = 0x7CFC00;
colornames["greenyellow"] = 11403055;
colornames["yellowgreen"] = 10145074;
colornames["palegreen"] = 10025880;
colornames["lightgreen"] = 9498256;
colornames["springgreen"] = 65407;
colornames["mediumspringgreen"] = 64154;
colornames["darkolivegreen"] = 5597999;
colornames["olivedrab"] = 7048739;
colornames["olive"] = 0x808000;
colornames["darkkhaki"] = 12433259;
colornames["darkgoldenrod"] = 12092939;
colornames["goldenrod"] = 14329120;
colornames["gold"] = 0xFFD700;
colornames["yellow"] = 0xFFFF00;
colornames["khaki"] = 15787660;
colornames["palegoldenrod"] = 15657130;
colornames["blanchedalmond"] = 16772045;
colornames["moccasin"] = 16770229;
colornames["wheat"] = 16113331;
colornames["navajowhite"] = 16768685;
colornames["burlywood"] = 14596231;
colornames["tan"] = 13808780;
colornames["rosybrown"] = 12357519;
colornames["sienna"] = 10506797;
colornames["saddlebrown"] = 9127187;
colornames["chocolate"] = 13789470;
colornames["peru"] = 13468991;
colornames["sandybrown"] = 16032864;
colornames["darkred"] = 0x8B0000;
colornames["maroon"] = 0x800000;
colornames["brown"] = 10824234;
colornames["firebrick"] = 11674146;
colornames["indianred"] = 13458524;
colornames["lightcoral"] = 15761536;
colornames["salmon"] = 16416882;
colornames["darksalmon"] = 15308410;
colornames["lightsalmon"] = 16752762;
colornames["coral"] = 16744272;
colornames["tomato"] = 16737095;
colornames["darkorange"] = 0xFF8C00;
colornames["orange"] = 0xFFA500;
colornames["orangered"] = 0xFF4500;
colornames["crimson"] = 14423100;
colornames["red"] = 0xFF0000;
colornames["deeppink"] = 16716947;
colornames["fuchsia"] = 0xFF00FF;
colornames["magenta"] = 0xFF00FF;
colornames["hotpink"] = 16738740;
colornames["lightpink"] = 16758465;
colornames["pink"] = 16761035;
colornames["palevioletred"] = 14381203;
colornames["mediumvioletred"] = 13047173;
colornames["purple"] = 0x800080;
colornames["darkmagenta"] = 0x8B008B;
colornames["mediumpurple"] = 9662683;
colornames["blueviolet"] = 9055202;
colornames["indigo"] = 0x4B0082;
colornames["darkviolet"] = 0x9400D3;
colornames["darkorchid"] = 10040012;
colornames["mediumorchid"] = 12211667;
colornames["orchid"] = 14315734;
colornames["violet"] = 15631086;
colornames["plum"] = 14524637;
colornames["thistle"] = 14204888;
colornames["lavender"] = 15132410;
colornames["ghostwhite"] = 16316671;
colornames["aliceblue"] = 15792383;
colornames["mintcream"] = 16121850;
colornames["honeydew"] = 15794160;
colornames["lightgoldenrodyellow"] = 16448210;
colornames["lemonchiffon"] = 16775885;
colornames["cornsilk"] = 16775388;
colornames["lightyellow"] = 16777184;
colornames["ivory"] = 16777200;
colornames["floralwhite"] = 16775920;
colornames["linen"] = 16445670;
colornames["oldlace"] = 16643558;
colornames["antiquewhite"] = 16444375;
colornames["bisque"] = 16770244;
colornames["peachpuff"] = 16767673;
colornames["papayawhip"] = 16773077;
colornames["beige"] = 16119260;
colornames["seashell"] = 16774638;
colornames["lavenderblush"] = 16773365;
colornames["mistyrose"] = 16770273;
colornames["snow"] = 16775930;
colornames["white"] = 0xFFFFFF;
colornames["whitesmoke"] = 0xF5F5F5;
colornames["gainsboro"] = 0xDCDCDC;
colornames["lightgrey"] = 0xD3D3D3;
colornames["silver"] = 0xC0C0C0;
colornames["darkgrey"] = 0xA9A9A9;
colornames["grey"] = 0x808080;
colornames["lightslategrey"] = 7833753;
colornames["slategrey"] = 7372944;
colornames["dimgrey"] = 0x696969;
colornames["darkslategrey"] = 3100495;
colornames["black"] = 0;
colornames["transparent"] = 4278190080;
};
if (colornames[_arg1] != null){
return (colornames[_arg1]);
};
if ((((_arg1.length == 6)) && (hexstring(_arg1)))){
return (parseInt(("0x" + _arg1)));
};
};
return (4294967295);
}
private static function hexstring(_arg1:String):Boolean{
var _local2:int;
_local2 = 0;
while (_local2 < _arg1.length) {
if (hexchars.indexOf(_arg1.charAt(_local2)) == -1){
return (false);
};
_local2++;
};
return (true);
}
public static function wirematerial(_arg1):ISegmentMaterial{
var _local2:Array;
var _local3:uint;
var _local4:Number;
var _local5:Number;
if (_arg1 == null){
return (null);
};
if ((_arg1 is ISegmentMaterial)){
return (_arg1);
};
if ((_arg1 is int)){
return (new WireframeMaterial(_arg1));
};
if ((_arg1 is String)){
if (_arg1 == ""){
return (null);
};
if (_arg1 == "transparent"){
return (new TransparentMaterial());
};
if (_arg1.indexOf("#") == 0){
_arg1 = _arg1.substring(1);
};
if (_arg1.indexOf("|") == -1){
return (new WireframeMaterial(color(_arg1)));
};
_local2 = _arg1.split("|");
return (new WireframeMaterial(color(_local2[0]), {width:parseFloat(_local2[1])}));
};
if ((_arg1 is Object)){
_arg1 = Init.parse(_arg1);
_local3 = _arg1.getColor("color", 0);
_local4 = _arg1.getNumber("alpha", 1, {min:0, max:1});
_local5 = _arg1.getNumber("width", 1, {min:0});
return (new WireframeMaterial(_local3, {alpha:_local4, width:_local5}));
};
throw (new CastError(("Can't cast to wirematerial: " + _arg1)));
}
public static function bitmap(_arg1):BitmapData{
var sprite:Sprite;
var bmd:BitmapData;
var data = _arg1;
if (data == null){
return (null);
};
if ((data is String)){
data = tryclass(data);
};
if ((data is Class)){
try {
data = new (data);
} catch(error:ArgumentError) {
data = new data(0, 0);
};
};
if ((data is BitmapData)){
return (data);
};
if (data.hasOwnProperty("bitmapData")){
return (data.bitmapData);
};
if ((data is Sprite)){
sprite = (data as Sprite);
bmd = new BitmapData(sprite.width, sprite.height, true, 0xFFFFFF);
bmd.draw(sprite, null, null, null, bmd.rect, true);
return (bmd);
};
throw (new CastError(("Can't cast to bitmap: " + data)));
}
public static function bytearray(_arg1):ByteArray{
if ((_arg1 is Class)){
_arg1 = new (_arg1);
};
if ((_arg1 is ByteArray)){
return (_arg1);
};
return (ByteArray(_arg1));
}
public static function xml(_arg1):XML{
if ((_arg1 is Class)){
_arg1 = new (_arg1);
};
if ((_arg1 is XML)){
return (_arg1);
};
return (XML(_arg1));
}
public static function string(_arg1):String{
if ((_arg1 is Class)){
_arg1 = new (_arg1);
};
if ((_arg1 is String)){
return (_arg1);
};
return (String(_arg1));
}
public static function tryclass(_arg1:String):Object{
var result:Class;
var name = _arg1;
if (notclasses[name]){
return (name);
};
result = classes[name];
if (result != null){
return (result);
};
try {
result = (getDefinitionByName(name) as Class);
classes[name] = result;
return (result);
} catch(error:ReferenceError) {
};
notclasses[name] = true;
return (name);
}
}
}//package away3d.core.utils
Section 84
//CastError (away3d.core.utils.CastError)
package away3d.core.utils {
public class CastError extends Error {
public function CastError(_arg1:String){
super(_arg1);
}
}
}//package away3d.core.utils
Section 85
//Debug (away3d.core.utils.Debug)
package away3d.core.utils {
public class Debug {
public static var warningsAsErrors:Boolean = false;
public static var active:Boolean = false;
public static function warning(_arg1:Object):void{
if (warningsAsErrors){
error(_arg1);
return;
};
trace(("WARNING: " + _arg1));
}
public static function trace(_arg1:Object):void{
dotrace(_arg1);
}
public static function delimiter():void{
}
public static function clear():void{
}
public static function error(_arg1:Object):void{
trace(("ERROR: " + _arg1));
throw (new Error(_arg1));
}
}
}//package away3d.core.utils
private const dotrace:Function = function (_arg1:Object):void{
trace(_arg1);
};
Section 86
//FaceDictionaryVO (away3d.core.utils.FaceDictionaryVO)
package away3d.core.utils {
import flash.display.*;
public class FaceDictionaryVO {
public var dirty:Boolean;
public var bitmap:BitmapData;
public function FaceDictionaryVO(_arg1:Number=0, _arg2:Number=0){
if (((_arg1) && (_arg2))){
bitmap = new BitmapData(_arg1, _arg2, true, 0);
};
}
public function reset(_arg1:Number, _arg2:Number):void{
if (bitmap){
bitmap.dispose();
};
bitmap = new BitmapData(_arg1, _arg2, true, 0);
dirty = true;
}
public function clear():void{
if (bitmap){
bitmap.fillRect(bitmap.rect, 0);
};
dirty = true;
}
}
}//package away3d.core.utils
Section 87
//IClonable (away3d.core.utils.IClonable)
package away3d.core.utils {
public interface IClonable {
function clone(_arg1=null);
}
}//package away3d.core.utils
Section 88
//Init (away3d.core.utils.Init)
package away3d.core.utils {
import flash.display.*;
import away3d.core.math.*;
import away3d.core.scene.*;
import away3d.core.material.*;
import away3d.core.*;
public class Init {
private var init:Object;
private static var inits:Array = [];
public function Init(_arg1:Object){
this.init = _arg1;
}
public function getArray(_arg1:String):Array{
var _local2:Array;
if (init == null){
return ([]);
};
if (!init.hasOwnProperty(_arg1)){
return ([]);
};
_local2 = init[_arg1];
delete init[_arg1];
return (_local2);
}
public function getSegmentMaterial(_arg1:String):ISegmentMaterial{
var _local2:ISegmentMaterial;
if (init == null){
return (null);
};
if (!init.hasOwnProperty(_arg1)){
return (null);
};
_local2 = Cast.wirematerial(init[_arg1]);
delete init[_arg1];
return (_local2);
}
public function getBitmap(_arg1:String):BitmapData{
var _local2:BitmapData;
if (init == null){
return (null);
};
if (!init.hasOwnProperty(_arg1)){
return (null);
};
_local2 = Cast.bitmap(init[_arg1]);
delete init[_arg1];
return (_local2);
}
public function getObject3D(_arg1:String):Object3D{
return ((getObject(_arg1, Object3D) as Object3D));
}
public function getString(_arg1:String, _arg2:String):String{
var _local3:String;
if (init == null){
return (_arg2);
};
if (!init.hasOwnProperty(_arg1)){
return (_arg2);
};
_local3 = init[_arg1];
delete init[_arg1];
return (_local3);
}
public function getObjectOrInit(_arg1:String, _arg2:Class=null):Object{
var _local3:Object;
if (init == null){
return (null);
};
if (!init.hasOwnProperty(_arg1)){
return (null);
};
_local3 = init[_arg1];
delete init[_arg1];
if (_local3 == null){
return (null);
};
if (_arg2 != null){
if (!(_local3 is _arg2)){
return (new _arg2(_local3));
};
};
return (_local3);
}
public function getPosition(_arg1:String):Number3D{
var _local2:Object;
var _local3:Object;
_local2 = getObject(_arg1);
if (_local2 == null){
return (null);
};
if ((_local2 is Number3D)){
return ((_local2 as Number3D));
};
if ((_local2 is Object3D)){
_local3 = (_local2 as Object3D);
return ((_local3.scene) ? _local3.scenePosition : _local3.position);
};
if ((_local2 is String)){
if (_local2 == "center"){
return (new Number3D());
};
};
throw (new CastError(("Cast get position of " + _local2)));
}
public function getInit(_arg1:String):Init{
var _local2:Init;
if (init == null){
return (new Init(null));
};
if (!init.hasOwnProperty(_arg1)){
return (new Init(null));
};
_local2 = Init.parse(init[_arg1]);
delete init[_arg1];
return (_local2);
}
public function getNumber2D(_arg1:String):Number2D{
return ((getObject(_arg1, Number2D) as Number2D));
}
public function getBoolean(_arg1:String, _arg2:Boolean):Boolean{
var _local3:Boolean;
if (init == null){
return (_arg2);
};
if (!init.hasOwnProperty(_arg1)){
return (_arg2);
};
_local3 = init[_arg1];
delete init[_arg1];
return (_local3);
}
public function getColor(_arg1:String, _arg2:uint):uint{
var _local3:uint;
if (init == null){
return (_arg2);
};
if (!init.hasOwnProperty(_arg1)){
return (_arg2);
};
_local3 = Cast.color(init[_arg1]);
delete init[_arg1];
return (_local3);
}
public function getObject(_arg1:String, _arg2:Class=null):Object{
var _local3:Object;
if (init == null){
return (null);
};
if (!init.hasOwnProperty(_arg1)){
return (null);
};
_local3 = init[_arg1];
delete init[_arg1];
if (_local3 == null){
return (null);
};
if (_arg2 != null){
if (!(_local3 is _arg2)){
throw (new CastError(((((("Parameter \"" + _arg1) + "\" is not of class ") + _arg2) + ": ") + _local3)));
};
};
return (_local3);
}
public function getNumber3D(_arg1:String):Number3D{
return ((getObject(_arg1, Number3D) as Number3D));
}
arcane function addForCheck():void{
if (init == null){
return;
};
init.dontCheckUnused = false;
inits.push(init);
}
public function getInt(_arg1:String, _arg2:int, _arg3:Object=null):int{
var _local4:int;
var _local5:int;
var _local6:int;
if (init == null){
return (_arg2);
};
if (!init.hasOwnProperty(_arg1)){
return (_arg2);
};
_local4 = init[_arg1];
if (_arg3 != null){
if (_arg3.hasOwnProperty("min")){
_local5 = _arg3["min"];
if (_local4 < _local5){
_local4 = _local5;
};
};
if (_arg3.hasOwnProperty("max")){
_local6 = _arg3["max"];
if (_local4 > _local6){
_local4 = _local6;
};
};
};
delete init[_arg1];
return (_local4);
}
arcane function removeFromCheck():void{
if (init == null){
return;
};
init.dontCheckUnused = true;
}
public function getMaterial(_arg1:String):ITriangleMaterial{
var _local2:ITriangleMaterial;
if (init == null){
return (null);
};
if (!init.hasOwnProperty(_arg1)){
return (null);
};
_local2 = Cast.material(init[_arg1]);
delete init[_arg1];
return (_local2);
}
public function getNumber(_arg1:String, _arg2:Number, _arg3:Object=null):Number{
var _local4:Number;
var _local5:Number;
var _local6:Number;
if (init == null){
return (_arg2);
};
if (!init.hasOwnProperty(_arg1)){
return (_arg2);
};
_local4 = init[_arg1];
if (_arg3 != null){
if (_arg3.hasOwnProperty("min")){
_local5 = _arg3["min"];
if (_local4 < _local5){
_local4 = _local5;
};
};
if (_arg3.hasOwnProperty("max")){
_local6 = _arg3["max"];
if (_local4 > _local6){
_local4 = _local6;
};
};
};
delete init[_arg1];
return (_local4);
}
arcane static function checkUnusedArguments():void{
var _local1:Array;
var _local2:Object;
var _local3:String;
var _local4:String;
if (inits.length == 0){
return;
};
_local1 = inits;
inits = [];
for each (_local2 in _local1) {
if (_local2.hasOwnProperty("dontCheckUnused")){
//unresolved if
} else {
_local3 = null;
for (_local4 in _local2) {
if (_local4 == "dontCheckUnused"){
} else {
if (_local3 == null){
_local3 = "";
} else {
_local3 = (_local3 + ", ");
};
_local3 = (_local3 + ((_local4 + ":") + _local2[_local4]));
};
};
if (_local3 != null){
Debug.warning((("Unused arguments: {" + _local3) + "}"));
};
};
};
}
public static function parse(_arg1:Object):Init{
if (_arg1 == null){
return (new Init(null));
};
if ((_arg1 is Init)){
return ((_arg1 as Init));
};
inits.push(_arg1);
return (new Init(_arg1));
}
}
}//package away3d.core.utils
Section 89
//LazyEventDispatcher (away3d.core.utils.LazyEventDispatcher)
package away3d.core.utils {
import flash.events.*;
import away3d.core.*;
public class LazyEventDispatcher {
private var _dispatcher:EventDispatcher;
protected function dispatchEvent(_arg1:Event):Boolean{
if (_dispatcher == null){
return (false);
};
return (_dispatcher.dispatchEvent(_arg1));
}
protected function willTrigger(_arg1:String):Boolean{
if (_dispatcher == null){
return (false);
};
return (_dispatcher.willTrigger(_arg1));
}
arcane function get dispatcher():EventDispatcher{
return (_dispatcher);
}
protected function removeEventListener(_arg1:String, _arg2:Function, _arg3:Boolean=false):void{
if (_dispatcher == null){
return;
};
_dispatcher.removeEventListener(_arg1, _arg2, _arg3);
}
protected function hasEventListener(_arg1:String):Boolean{
if (_dispatcher == null){
return (false);
};
return (_dispatcher.hasEventListener(_arg1));
}
protected function addEventListener(_arg1:String, _arg2:Function, _arg3:Boolean=false, _arg4:int=0, _arg5:Boolean=false):void{
if (_dispatcher == null){
_dispatcher = new EventDispatcher();
};
_dispatcher.addEventListener(_arg1, _arg2, _arg3, _arg4);
}
}
}//package away3d.core.utils
Section 90
//ValueObject (away3d.core.utils.ValueObject)
package away3d.core.utils {
import flash.events.*;
public class ValueObject extends LazyEventDispatcher {
private static var changed:Event;
public function addOnChange(_arg1:Function):void{
addEventListener("changed", _arg1, false, 0, true);
}
public function removeOnChange(_arg1:Function):void{
removeEventListener("changed", _arg1, false);
}
protected function notifyChange():void{
if (!hasEventListener("changed")){
return;
};
if (changed == null){
changed = new Event("changed");
};
dispatchEvent(changed);
}
}
}//package away3d.core.utils
Section 91
//arcane (away3d.core.arcane)
package away3d.core {
public namespace arcane;
}//package away3d.core
Section 92
//LineSegment (away3d.objects.LineSegment)
package away3d.objects {
import away3d.core.mesh.*;
import away3d.core.scene.*;
import away3d.core.utils.*;
import away3d.core.material.*;
import away3d.core.stats.*;
import away3d.core.*;
public class LineSegment extends WireMesh {
private var _segment:Segment;
public function LineSegment(_arg1:Object=null){
var _local2:Number;
super(_arg1);
_arg1 = Init.parse(_arg1);
_local2 = (_arg1.getNumber("edge", 100, {min:0}) / 2);
_segment = new Segment(new Vertex(-(_local2), 0, 0), new Vertex(_local2, 0, 0));
addSegment(_segment);
type = "LineSegment";
url = "primitive";
}
public function get start():Vertex{
return (_segment.v0);
}
public function set start(_arg1:Vertex):void{
_segment.v0 = _arg1;
}
public function set end(_arg1:Vertex):void{
_segment.v1 = _arg1;
}
public function get end():Vertex{
return (_segment.v1);
}
}
}//package away3d.objects
Section 93
//Plane (away3d.objects.Plane)
package away3d.objects {
import away3d.core.mesh.*;
import away3d.core.math.*;
import away3d.core.scene.*;
import away3d.core.utils.*;
import away3d.core.material.*;
import away3d.core.stats.*;
import away3d.core.*;
public class Plane extends Mesh {
private var grid:Array;
public function Plane(_arg1:Object=null){
var _local2:Number;
var _local3:Number;
var _local4:int;
var _local5:int;
var _local6:int;
var _local7:IUVMaterial;
super(_arg1);
_arg1 = Init.parse(_arg1);
_local2 = _arg1.getNumber("width", 0, {min:0});
_local3 = _arg1.getNumber("height", 0, {min:0});
_local4 = _arg1.getInt("segments", 1, {min:1});
_local5 = _arg1.getInt("segmentsW", _local4, {min:1});
_local6 = _arg1.getInt("segmentsH", _local4, {min:1});
if ((_local2 * _local3) == 0){
if ((material is IUVMaterial)){
_local7 = (material as IUVMaterial);
if (_local2 == 0){
_local2 = _local7.width;
};
if (_local3 == 0){
_local3 = _local7.height;
};
} else {
_local2 = 100;
_local3 = 100;
};
};
buildPlane(_local2, _local3, _local5, _local6);
}
private function buildPlane(_arg1:Number, _arg2:Number, _arg3:int, _arg4:int):void{
var _local5:int;
var _local6:int;
var _local7:Vertex;
var _local8:Vertex;
var _local9:Vertex;
var _local10:Vertex;
var _local11:UV;
var _local12:UV;
var _local13:UV;
var _local14:UV;
grid = new Array((_arg3 + 1));
_local5 = 0;
while (_local5 <= _arg3) {
grid[_local5] = new Array((_arg4 + 1));
_local6 = 0;
while (_local6 <= _arg4) {
grid[_local5][_local6] = new Vertex((((_local5 / _arg3) - 0.5) * _arg1), 0, (((_local6 / _arg4) - 0.5) * _arg2));
_local6++;
};
_local5++;
};
_local5 = 0;
while (_local5 < _arg3) {
_local6 = 0;
while (_local6 < _arg4) {
_local7 = grid[_local5][_local6];
_local8 = grid[(_local5 + 1)][_local6];
_local9 = grid[_local5][(_local6 + 1)];
_local10 = grid[(_local5 + 1)][(_local6 + 1)];
_local11 = new UV((_local5 / _arg3), (_local6 / _arg4));
_local12 = new UV(((_local5 + 1) / _arg3), (_local6 / _arg4));
_local13 = new UV((_local5 / _arg3), ((_local6 + 1) / _arg4));
_local14 = new UV(((_local5 + 1) / _arg3), ((_local6 + 1) / _arg4));
addFace(new Face(_local7, _local8, _local9, null, _local11, _local12, _local13));
addFace(new Face(_local10, _local9, _local8, null, _local14, _local13, _local12));
_local6++;
};
_local5++;
};
type = "Plane";
url = "primitive";
}
public function vertex(_arg1:int, _arg2:int):Vertex{
return (grid[_arg1][_arg2]);
}
}
}//package away3d.objects
Section 94
//WireCube (away3d.objects.WireCube)
package away3d.objects {
import away3d.core.mesh.*;
import away3d.core.scene.*;
import away3d.core.utils.*;
import away3d.core.material.*;
import away3d.core.*;
public class WireCube extends WireMesh {
public var v001:Vertex;
public var v010:Vertex;
public var v011:Vertex;
public var v100:Vertex;
public var v101:Vertex;
public var v110:Vertex;
public var v111:Vertex;
public var v000:Vertex;
public function WireCube(_arg1:Object=null){
var _local2:Number;
var _local3:Number;
var _local4:Number;
super(_arg1);
_arg1 = Init.parse(_arg1);
_local2 = _arg1.getNumber("width", 100, {min:0});
_local3 = _arg1.getNumber("height", 100, {min:0});
_local4 = _arg1.getNumber("depth", 100, {min:0});
v000 = new Vertex((-(_local2) / 2), (-(_local3) / 2), (-(_local4) / 2));
v001 = new Vertex((-(_local2) / 2), (-(_local3) / 2), (_local4 / 2));
v010 = new Vertex((-(_local2) / 2), (_local3 / 2), (-(_local4) / 2));
v011 = new Vertex((-(_local2) / 2), (_local3 / 2), (_local4 / 2));
v100 = new Vertex((_local2 / 2), (-(_local3) / 2), (-(_local4) / 2));
v101 = new Vertex((_local2 / 2), (-(_local3) / 2), (_local4 / 2));
v110 = new Vertex((_local2 / 2), (_local3 / 2), (-(_local4) / 2));
v111 = new Vertex((_local2 / 2), (_local3 / 2), (_local4 / 2));
addSegment(new Segment(v000, v001));
addSegment(new Segment(v011, v001));
addSegment(new Segment(v011, v010));
addSegment(new Segment(v000, v010));
addSegment(new Segment(v100, v000));
addSegment(new Segment(v101, v001));
addSegment(new Segment(v111, v011));
addSegment(new Segment(v110, v010));
addSegment(new Segment(v100, v101));
addSegment(new Segment(v111, v101));
addSegment(new Segment(v111, v110));
addSegment(new Segment(v100, v110));
type = "WireCube";
url = "primitive";
}
}
}//package away3d.objects
Section 95
//3D_11 (CannonAlone_fla.3D_11)
package CannonAlone_fla {
import flash.display.*;
import away3d.core.draw.*;
import away3d.core.mesh.*;
import away3d.core.math.*;
import away3d.core.render.*;
import flash.events.*;
import away3d.core.scene.*;
import flash.geom.*;
import away3d.core.material.*;
import flash.utils.*;
import away3d.core.sprite.*;
import flash.media.*;
import away3d.objects.*;
import flash.filters.*;
import flash.text.*;
import flash.ui.*;
import flash.system.*;
import flash.net.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.printing.*;
import flash.xml.*;
public dynamic class 3D_11 extends MovieClip {
public var oggettob;
public var oggettoo;
public var result:ScreenVertex;
public var alfa:Number;
public var laserhit2;
public var scpx:Number;
public var scpy:Number;
public var scpz:Number;
public var viewp:View3D;
public var n;
public var cs:Number;
public var Esplo1;
public var cy:Number;
public var cz:Number;
public var prima;
public var view:View3D;
public var numen:Number;
public var distanza:Number;
public var lasersnd;
public var laser;
public var base;
public var lasvy:Number;
public var Cannone:ObjectContainer3D;
public var esp1;
public var cannon;
public var clx:Number;
public var cly:Number;
public var clz:Number;
public var findhit;
public var Canna:ObjectContainer3D;
public var Nemici:ObjectContainer3D;
public var lb:Boolean;
public var oggetto;
public var lp:Number;
public var ground;
public var vel:Number;
public var numenv:Number;
public var cpy:Number;
public var cpz:Number;
public var cpx:Number;
public var result2:ScreenVertex;
public var contaupgrade:Number;
public var inlaserarr:Array;
public var sclx:Number;
public var scly:Number;
public var sclz:Number;
public var contatore:Number;
public var bomba;
public function 3D_11(){
addFrameScript(0, frame1);
}
public function settan():void{
alfa = (Math.random() * 6.28);
distanza = ((Math.random() * 2000) + 600);
oggetto = ("en" + n);
oggettoo = (("en" + n) + "o");
oggettob = (("en" + n) + "b");
this[oggetto].z = (distanza * Math.cos(alfa));
if (this[oggetto].y != 26){
this[oggetto].y = ((Math.random() * 150) + 100);
};
this[oggetto].x = (distanza * Math.sin(alfa));
this[oggetto].rotationY = ((alfa / 0.01744) + 90);
this[oggetto].visible = false;
this[oggettoo].visible = true;
this[oggettoo].x = this[oggetto].x;
this[oggettoo].z = this[oggetto].z;
this[oggettoo].rotationY = this[oggetto].rotationY;
this[oggetto].extra = alfa;
this[oggettob].visible = false;
this[oggettob].x = this[oggetto].x;
this[oggettob].y = this[oggetto].y;
this[oggettob].z = this[oggetto].z;
}
public function bombarda():void{
bomba.scaleX(5);
bomba.scaleZ(5);
if (Number(root["bombs"].text) > 0){
lb = true;
root["bomsnd"].play();
root["bombs"].text = String((Number(root["bombs"].text) - 1));
};
}
public function mm3D(_arg1:MouseEvent3D):void{
if (_arg1.object.name != "box"){
if (_arg1.object.z <= 0){
cy = (((Math.atan((_arg1.object.x / _arg1.object.z)) * 180) / 3.14) + 90);
};
if (_arg1.object.z > 0){
cy = (((Math.atan((_arg1.object.x / _arg1.object.z)) * 180) / 3.14) - 90);
};
cz = -(((Math.atan((Math.sqrt(((_arg1.object.x * _arg1.object.x) + (_arg1.object.z * _arg1.object.z))) / (_arg1.object.y - 26))) * 180) / 3.14));
};
}
public function setta():void{
contaupgrade = 0;
contatore = 0;
inlaserarr = new Array();
lb = true;
bomba.visible = false;
root["gameover"].visible = false;
lp = 1;
cs = 1;
root["bombs"].text = "2";
root["endis"].text = 0;
root["vita"].vita.scaleX = 1;
n = 1;
while (n <= numenv) {
settan();
if (n == numenv){
numenv = 8;
};
n++;
};
}
function frame1(){
cy = 0;
cz = 0;
lasvy = 0;
vel = 19;
prima = true;
alfa = 0;
distanza = 200;
numen = 8;
numenv = 8;
lasersnd = new LaserSND();
laserhit2 = new Laserhit2();
contatore = 0;
lp = 1;
cs = 1;
lb = false;
contaupgrade = 0;
viewp = new View3D();
addChild(viewp);
view = new View3D();
addChild(view);
cpx = 700;
cpy = 100;
cpz = 700;
clx = 0;
cly = 0;
clz = 0;
scpx = 700;
scpy = 1000;
scpz = 700;
sclx = 0;
scly = 0;
clz = 0;
esp1 = new Esplosione();
Esplo1 = new MovieClipSprite(esp1, {visible:true, name:"box"});
bomba = new Plane({material:"BombaM", name:"box", width:10, height:10, segments:2, visible:false});
ground = new Plane({material:"Terreno", name:"box", width:1500, height:1500, segments:4});
laser = new LineSegment({material:"#red", name:"box"});
laser.start = new Vertex(0, 0, 0);
laser.end = new Vertex(0, 0, 0);
laser.material.width = 1;
base = new basetta({material:"BaseCM", name:"box", rotationX:90});
cannon = new cannone({material:"CannoneM", name:"box", rotationX:90, outline:true});
Nemici = new ObjectContainer3D();
n = 1;
while (n <= numen) {
crea();
n++;
};
setta();
Cannone = new ObjectContainer3D();
Canna = new ObjectContainer3D();
Canna.y = 26;
Canna.addChildren(cannon, laser);
Cannone.addChildren(base, Canna);
viewp.scene.addChildren(ground);
view.scene.addChildren(Cannone, Nemici, Esplo1, bomba);
addEventListener(MouseEvent.MOUSE_DOWN, md);
view.scene.addOnMouseDown(mm3D);
addEventListener(Event.ENTER_FRAME, onEnterFrame);
addEventListener(MouseEvent.MOUSE_WHEEL, roll);
}
public function distruggi():void{
Esplo1.x = this[oggetto].x;
Esplo1.y = this[oggetto].y;
Esplo1.z = this[oggetto].z;
this[oggetto].name = ((((this[oggetto].name.split("_")[0] + "_") + this[oggetto].name.split("_")[1]) + "_") + String((Number(this[oggetto].name.split("_")[2]) - lp)));
if (Number(this[oggetto].name.split("_")[2]) > 0){
esp1.esp.gotoAndPlay("laser");
};
if (Number(this[oggetto].name.split("_")[2]) <= 0){
esp1.esp.gotoAndPlay(2);
root["endis"].text = (Number(root["endis"].text) + 1);
this[oggetto].visible = false;
this[oggetto].name = ((((this[oggetto].name.split("_")[0] + "_") + this[oggetto].name.split("_")[1]) + "_") + this[oggetto].name.split("_")[1]);
distanza = ((Math.random() * 2000) + 600);
alfa = (Math.random() * 6.28);
oggettoo = (("en" + n) + "o");
this[oggetto].extra = alfa;
this[oggetto].z = (distanza * Math.cos(alfa));
if (this[oggetto].y != 26){
this[oggetto].y = ((Math.random() * 150) + 100);
};
this[oggetto].x = (distanza * Math.sin(alfa));
this[oggetto].rotationY = ((alfa / 0.01744) + 90);
this[oggettoo].x = this[oggetto].x;
this[oggettoo].z = this[oggetto].z;
this[oggettoo].rotationY = this[oggetto].rotationY;
contatore++;
contaupgrade++;
if (contatore == 10){
contatore = 0;
numenv++;
n = numenv;
oggetto = ("en" + n);
if (this[oggetto] == null){
crea();
settan();
};
};
};
}
public function roll(_arg1:MouseEvent):void{
scpy = (scpy - (_arg1.delta * 20));
prima = true;
if (scpy < 220){
scpy = 220;
};
if (scpy > 1600){
scpy = 1600;
};
}
public function onEnterFrame(_arg1:Event):void{
var _local2:*;
view.mouseZeroMove = true;
view.scene.addOnMouseMove(mm3D);
view.scene.addOnMouseOver(mm3D);
view.scene.addOnMouseUp(mm3D);
if ((((contaupgrade >= 25)) && ((bomba.maxX < 10)))){
root["upgradewin"].visible = true;
contaupgrade = 0;
};
if ((((root["upgradewin"].visible == false)) && ((root["gameover"].visible == false)))){
if (lb){
bomba.visible = true;
bomba.scaleX(1.05);
bomba.scaleZ(1.05);
if (bomba.maxX > 500){
lb = false;
bomba.scaleX(0.01);
bomba.scaleZ(0.01);
bomba.visible = false;
};
};
cpy = (cpy - ((-(scpy) + cpy) / 30));
Cannone.rotationY = (Cannone.rotationY - ((-(cy) + Cannone.rotationY) / (8 / cs)));
Canna.rotationZ = (Canna.rotationZ - ((-(cz) + Canna.rotationZ) / (8 / cs)));
_local2 = 0;
while (_local2 < 3) {
if (laser.extra == "vai"){
laser.y = (laser.y + vel);
lasvy = (lasvy - vel);
laser.material.width = (laser.material.width - 0.1);
laser.start = new Vertex(0, (lasvy + 70), 0);
laser.end = new Vertex(0, -(lasvy), 0);
if (laser.y > 1000){
laser.y = 0;
laser.extra = "";
laser.start = new Vertex(0, 70, 0);
lasvy = 0;
laser.end = new Vertex(0, 70, 0);
};
n = 1;
while (n <= numenv) {
oggetto = ("en" + n);
if ((((this[oggetto].distanceTo(laser) < 25)) && ((inlaserarr.indexOf(this[oggetto]) == -1)))){
inlaserarr.push(this[oggetto]);
distruggi();
};
n++;
};
};
_local2++;
};
n = 1;
while (n <= numenv) {
oggetto = ("en" + n);
if (bomba.maxX > Math.sqrt(((this[oggetto].x * this[oggetto].x) + (this[oggetto].z * this[oggetto].z)))){
distruggi();
};
oggettoo = (("en" + n) + "o");
oggettob = (("en" + n) + "b");
this[oggettob].visible = false;
if (Math.sqrt(((this[oggetto].x * this[oggetto].x) + (this[oggetto].z * this[oggetto].z))) < 160){
this[oggettob].visible = true;
this[oggettob].x = ((Math.sqrt(((this[oggettob].x * this[oggettob].x) + (this[oggettob].z * this[oggettob].z))) - 3) * Math.sin(this[oggetto].extra));
this[oggettob].z = ((Math.sqrt(((this[oggettob].x * this[oggettob].x) + (this[oggettob].z * this[oggettob].z))) - 3) * Math.cos(this[oggetto].extra));
if (this[oggettob].y > 30){
this[oggettob].y = (this[oggettob].y - (this[oggetto].y / 40));
};
if ((((((this[oggettob].x < 10)) && ((this[oggettob].x > -10)))) && ((this[oggettob].y < 30)))){
if ((((this[oggettob].z < 10)) && ((this[oggettob].z > -10)))){
if (root["vita"].vita.scaleX > 0){
root["vita"].vita.scaleX = (root["vita"].vita.scaleX - 0.01);
laserhit2.play();
};
if (root["vita"].vita.scaleX <= 0){
root["gameover"].visible = true;
root["gameover"].subsco.visible = true;
root["bomsnd"].play();
};
this[oggettob].x = this[oggetto].x;
this[oggettob].y = this[oggetto].y;
this[oggettob].z = this[oggetto].z;
};
};
};
if ((((this[oggetto].y == 26)) && ((Math.sqrt(((this[oggetto].x * this[oggetto].x) + (this[oggetto].z * this[oggetto].z))) > 150)))){
this[oggetto].x = ((Math.sqrt(((this[oggetto].x * this[oggetto].x) + (this[oggetto].z * this[oggetto].z))) - 1) * Math.sin(this[oggetto].extra));
this[oggetto].z = ((Math.sqrt(((this[oggetto].x * this[oggetto].x) + (this[oggetto].z * this[oggetto].z))) - 1) * Math.cos(this[oggetto].extra));
};
if ((((this[oggetto].y > 100)) && ((Math.sqrt(((this[oggetto].x * this[oggetto].x) + (this[oggetto].z * this[oggetto].z))) > 30)))){
if (((!((this[oggetto].name.split("_")[0] == "en1"))) && (!((this[oggetto].name.split("_")[0] == "en2"))))){
this[oggetto].x = (this[oggetto].x - (this[oggetto].x / 200));
this[oggetto].z = (this[oggetto].z - (this[oggetto].z / 200));
};
if ((((this[oggetto].name.split("_")[0] == "en1")) || ((this[oggetto].name.split("_")[0] == "en2")))){
this[oggetto].x = (this[oggetto].x - (this[oggetto].x / 400));
this[oggetto].z = (this[oggetto].z - (this[oggetto].z / 400));
};
};
this[oggettoo].x = this[oggetto].x;
this[oggettoo].z = this[oggetto].z;
this[oggetto].visible = false;
result = view.camera.screen(this[oggettoo], this[oggettoo].vertices[1]);
if ((((result.x < 300)) && ((result.x > -300)))){
if ((((result.y < 250)) && ((result.y > -250)))){
this[oggetto].visible = true;
};
};
result2 = view.camera.screen(this[oggetto], this[oggetto].vertices[1]);
if ((((result2.x < ((stage.mouseX - 275) + 10))) && ((result2.x > ((stage.mouseX - 275) - 10))))){
if ((((result2.y < ((stage.mouseY - 200) + 10))) && ((result2.y > ((stage.mouseY - 200) - 10))))){
if (this[oggetto].name != "box"){
if (this[oggetto].z <= 0){
cy = (((Math.atan((this[oggetto].x / this[oggetto].z)) * 180) / 3.14) + 90);
};
if (this[oggetto].z > 0){
cy = (((Math.atan((this[oggetto].x / this[oggetto].z)) * 180) / 3.14) - 90);
};
cz = -(((Math.atan((Math.sqrt(((this[oggetto].x * this[oggetto].x) + (this[oggetto].z * this[oggetto].z))) / (this[oggetto].y - 26))) * 180) / 3.14));
};
root["test"].x = stage.mouseX;
root["test"].y = stage.mouseY;
};
};
if ((((this[oggetto].visible == true)) && ((Math.sqrt(((this[oggetto].x * this[oggetto].x) + (this[oggetto].z * this[oggetto].z))) >= 160)))){
this[oggettob].x = this[oggetto].x;
this[oggettob].y = this[oggetto].y;
this[oggettob].z = this[oggetto].z;
};
n++;
};
view.camera.position = new Number3D(cpx, cpy, cpz);
view.camera.lookAt(new Number3D(clx, cly, clz));
viewp.camera.position = new Number3D(cpx, cpy, cpz);
viewp.camera.lookAt(new Number3D(clx, cly, clz));
if (prima){
viewp.render();
if (Math.round(scpy) == Math.round(cpy)){
prima = false;
};
};
view.render();
};
}
public function ih():void{
root["vita"].vita.scaleX = (root["vita"].vita.scaleX + 0.3);
if (root["vita"].vita.scaleX > 1){
root["vita"].vita.scaleX = 1;
};
}
public function crea():void{
oggetto = ("en" + n);
oggettoo = (("en" + n) + "o");
oggettob = (("en" + n) + "b");
if (n < 2){
this[oggetto] = new Orca({material:"OrcaM2", rotationX:90, y:150, visible:false, name:(oggetto + "_1_1")});
};
if ((((n >= 2)) && ((n <= 9)))){
this[oggetto] = new Carro({material:"CarroM", rotationX:90, y:26, visible:false, name:(oggetto + "_2_2")});
};
if ((((n > 9)) && ((n < 14)))){
this[oggetto] = new Orca({material:"OrcaM", rotationX:90, y:150, visible:false, name:(oggetto + "_1_1")});
};
if ((((n >= 14)) && ((n <= 18)))){
this[oggetto] = new Carro({scaling:1.2, material:"CarroM2", rotationX:90, y:26, visible:false, name:(oggetto + "_4_4")});
this[oggetto].scaleX(1.5);
};
if ((((n > 18)) && ((n <= 21)))){
this[oggetto] = new UFO({material:"UFOM", rotationX:90, y:150, visible:false, name:(oggetto + "_6_6")});
};
if (n > 21){
this[oggetto] = new Carro({material:"CarroM", rotationX:90, y:26, visible:false, name:(oggetto + "_2_2")});
};
this[oggettoo] = new Plane({material:"Ombra", width:40, height:20, name:"box", visible:false});
this[oggettob] = new Sprite2D({bitmap:"Proiettile", visible:false, name:"box"});
view.scene.addChildren(this[oggettob]);
Nemici.addChildren(this[oggetto]);
view.scene.addChildren(this[oggettoo]);
}
public function md(_arg1:MouseEvent):void{
inlaserarr = new Array();
laser.material.width = 5;
laser.extra = "vai";
lasersnd.play();
}
}
}//package CannonAlone_fla
Section 96
//Controller_13 (CannonAlone_fla.Controller_13)
package CannonAlone_fla {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
import flash.text.*;
public dynamic class Controller_13 extends MovieClip {
public var conw:MovieClip;
public var timer:Timer;
public var mouseov:Boolean;
public var insw:MovieClip;
public var volume1:MovieClip;
public var dettagli:MovieClip;
public var frame:Number;
public var conbtn:SimpleButton;
public var insbtn:SimpleButton;
public var fps:TextField;
public function Controller_13(){
addFrameScript(0, frame1);
}
public function rou(_arg1:MouseEvent):void{
mouseov = false;
conw.visible = false;
insw.visible = false;
}
public function comd(_arg1:MouseEvent):void{
conw.visible = true;
}
public function inmd(_arg1:MouseEvent):void{
insw.visible = true;
}
function frame1(){
conw.visible = false;
insw.visible = false;
frame = 0;
addEventListener(Event.ENTER_FRAME, onEnterFrame);
timer = new Timer(1000);
timer.start();
timer.addEventListener(TimerEvent.TIMER, notifier);
mouseov = false;
this.addEventListener(MouseEvent.ROLL_OVER, rov);
this.addEventListener(MouseEvent.ROLL_OUT, rou);
insbtn.addEventListener(MouseEvent.MOUSE_DOWN, inmd);
conbtn.addEventListener(MouseEvent.MOUSE_DOWN, comd);
}
public function notifier(_arg1:TimerEvent):void{
fps.text = ("FPS: " + String(Math.round(((frame / 60) * 60))));
if (Math.round(((frame / 60) * 60)) < 32){
stage.quality = StageQuality.LOW;
};
if (Math.round(((frame / 60) * 60)) > 50){
stage.quality = StageQuality.HIGH;
};
frame = 0;
}
public function onEnterFrame(_arg1:Event):void{
frame++;
}
public function rov(_arg1:MouseEvent):void{
mouseov = true;
}
}
}//package CannonAlone_fla
Section 97
//Dettagli_14 (CannonAlone_fla.Dettagli_14)
package CannonAlone_fla {
import fl.controls.*;
import flash.display.*;
import flash.events.*;
import flash.geom.*;
import flash.utils.*;
import fl.events.*;
import flash.media.*;
import flash.filters.*;
import flash.text.*;
import flash.ui.*;
import flash.system.*;
import flash.net.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.printing.*;
import flash.xml.*;
public dynamic class Dettagli_14 extends MovieClip {
public var dettagli:Slider;
public function Dettagli_14(){
addFrameScript(0, frame1);
__setProp_dettagli_Dettagli_Livello1_1();
}
function frame1(){
dettagli.addEventListener(SliderEvent.CHANGE, announceChange);
}
public function announceChange(_arg1:SliderEvent):void{
if (_arg1.target.value == 1){
stage.quality = StageQuality.LOW;
};
if (_arg1.target.value == 2){
stage.quality = StageQuality.MEDIUM;
};
if (_arg1.target.value == 3){
stage.quality = StageQuality.HIGH;
};
}
function __setProp_dettagli_Dettagli_Livello1_1(){
try {
dettagli["componentInspectorSetting"] = true;
} catch(e:Error) {
};
dettagli.direction = "horizontal";
dettagli.enabled = true;
dettagli.liveDragging = true;
dettagli.maximum = 3;
dettagli.minimum = 1;
dettagli.snapInterval = 1;
dettagli.tickInterval = 1;
dettagli.value = 3;
dettagli.visible = true;
try {
dettagli["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
}
}//package CannonAlone_fla
Section 98
//Exploin_50 (CannonAlone_fla.Exploin_50)
package CannonAlone_fla {
import flash.display.*;
public dynamic class Exploin_50 extends MovieClip {
public function Exploin_50(){
addFrameScript(0, frame1, 31, frame32);
}
function frame1(){
stop();
}
function frame32(){
gotoAndStop(1);
}
}
}//package CannonAlone_fla
Section 99
//GameOver_39 (CannonAlone_fla.GameOver_39)
package CannonAlone_fla {
import flash.display.*;
import flash.events.*;
import flash.geom.*;
import flash.utils.*;
import flash.media.*;
import flash.filters.*;
import flash.text.*;
import flash.ui.*;
import flash.system.*;
import flash.net.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.printing.*;
import flash.xml.*;
public dynamic class GameOver_39 extends MovieClip {
public var vhs:SimpleButton;
public var sending:MovieClip;
public var pmog:SimpleButton;
public var subsco:MovieClip;
public var pa:SimpleButton;
public function GameOver_39(){
addFrameScript(0, frame1);
}
public function pamd(_arg1:MouseEvent):void{
root["tredi"].setta();
}
function frame1(){
subsco.visible = true;
pmog.addEventListener(MouseEvent.CLICK, clickHandler2);
vhs.addEventListener(MouseEvent.CLICK, vhsb);
pa.addEventListener(MouseEvent.MOUSE_DOWN, pamd);
}
public function vhsb(_arg1:MouseEvent):void{
var _local2:URLRequest;
_local2 = new URLRequest("http://www.freeworldgroup.com/score/index.asp?game=cannon_alone");
navigateToURL(_local2, "_blank");
}
public function clickHandler2(_arg1:MouseEvent):void{
var _local2:URLRequest;
_local2 = new URLRequest("http://www.freeworldgroup.com/");
navigateToURL(_local2, "_blank");
}
}
}//package CannonAlone_fla
Section 100
//Instruction_7 (CannonAlone_fla.Instruction_7)
package CannonAlone_fla {
import flash.display.*;
import flash.events.*;
import flash.geom.*;
import flash.utils.*;
import flash.media.*;
import flash.filters.*;
import flash.text.*;
import flash.ui.*;
import flash.system.*;
import flash.net.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.printing.*;
import flash.xml.*;
public dynamic class Instruction_7 extends MovieClip {
public var okBTN:SimpleButton;
public function Instruction_7(){
addFrameScript(0, frame1);
}
function frame1(){
okBTN.addEventListener(MouseEvent.MOUSE_DOWN, md);
}
public function md(_arg1:MouseEvent):void{
root["instructions"].visible = false;
}
}
}//package CannonAlone_fla
Section 101
//LOGO_9 (CannonAlone_fla.LOGO_9)
package CannonAlone_fla {
import flash.display.*;
public dynamic class LOGO_9 extends MovieClip {
public function LOGO_9(){
addFrameScript(219, frame220);
}
function frame220(){
this.visible = false;
}
}
}//package CannonAlone_fla
Section 102
//MainTimeline (CannonAlone_fla.MainTimeline)
package CannonAlone_fla {
import flash.display.*;
import flash.events.*;
import flash.geom.*;
import flash.utils.*;
import flash.media.*;
import flash.filters.*;
import flash.text.*;
import flash.ui.*;
import flash.system.*;
import flash.net.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.printing.*;
import flash.xml.*;
public dynamic class MainTimeline extends MovieClip {
public var vhs:SimpleButton;
public var urlEnd:Number;
public var CLT:SimpleButton;
public var bombs:TextField;
public var lbbtn:SimpleButton;
public var urlStart:Number;
public var restabtn:SimpleButton;
public var nome:String;
public var stabtn:SimpleButton;
public var punti:Number;
public var endis:TextField;
public var domEnd:Number;
public var cursor:cursore;
public var url:String;
public var tredi:MovieClip;
public var pmog:SimpleButton;
public var vita:MovieClip;
public var test:MovieClip;
public var dominio:TextField;
public var upgradewin:MovieClip;
public var insbtn:SimpleButton;
public var LastDot:Number;
public var instructions:MovieClip;
public var controller:MovieClip;
public var bomsnd;
public var gameover:MovieClip;
public var domain:String;
public function MainTimeline(){
addFrameScript(0, frame1, 1, frame2, 2, frame3);
}
public function restamd(_arg1:MouseEvent):void{
tredi.setta();
}
public function inmd(_arg1:MouseEvent):void{
instructions.visible = true;
}
public function vhsb(_arg1:MouseEvent):void{
var _local2:URLRequest;
_local2 = new URLRequest("http://www.freeworldgroup.com/score/index.asp?game=cannon_alone");
navigateToURL(_local2, "_blank");
}
function frame1(){
CLT.addEventListener(MouseEvent.CLICK, clickHandler);
stage.showDefaultContextMenu = false;
url = stage.loaderInfo.url;
urlStart = (url.indexOf("://") + 3);
urlEnd = url.indexOf("/", urlStart);
domain = url.substring(urlStart, urlEnd);
LastDot = (domain.lastIndexOf(".") - 1);
domEnd = (domain.lastIndexOf(".", LastDot) + 1);
domain = domain.substring(domEnd, domain.length);
dominio.text = domain;
}
public function keyUpHandler(_arg1:KeyboardEvent):void{
if (_arg1.keyCode == 32){
if (bombs.text != "0"){
tredi.bombarda();
};
};
}
public function clickHandler(_arg1:MouseEvent):void{
var _local2:URLRequest;
_local2 = new URLRequest("http://www.freeworldgroup.com/");
navigateToURL(_local2, "_blank");
}
public function lbmd(_arg1:MouseEvent):void{
if (bombs.text != "0"){
tredi.bombarda();
};
}
public function redrawCursor(_arg1:MouseEvent):void{
cursor.x = _arg1.stageX;
cursor.y = _arg1.stageY;
}
public function stamd(_arg1:MouseEvent):void{
gotoAndStop(3);
}
function frame3(){
addEventListener(MouseEvent.MOUSE_DOWN, tredi.md);
punti = 0;
nome = "";
bomsnd = new BombaSND();
upgradewin.visible = false;
tredi.scrollRect = new Rectangle(-275, -200, 550, 400);
tredi.x = 0;
tredi.y = 0;
restabtn.addEventListener(MouseEvent.MOUSE_DOWN, restamd);
lbbtn.addEventListener(MouseEvent.MOUSE_DOWN, lbmd);
stage.addEventListener(KeyboardEvent.KEY_UP, keyUpHandler);
stage.addEventListener(MouseEvent.MOUSE_MOVE, redrawCursor);
stop();
}
public function showleader():void{
var variables:URLVariables;
var request:URLRequest;
var loader:URLLoader;
if (nome != "Anonymous"){
variables = new URLVariables();
variables.game = "cannon_alone";
variables.score = endis.text;
variables.name = nome;
request = new URLRequest();
request.url = "http://www.freeworldgroup.com/score/score.asp";
request.method = URLRequestMethod.POST;
request.data = variables;
request.contentType = "application/x-www-form-urlencoded";
loader = new URLLoader();
try {
loader.load(request);
} catch(error:Error) {
trace("Unable to load URL");
};
};
}
public function clickHandler2(_arg1:MouseEvent):void{
var _local2:URLRequest;
_local2 = new URLRequest("http://www.freeworldgroup.com/");
navigateToURL(_local2, "_blank");
}
function frame2(){
instructions.visible = false;
stabtn.addEventListener(MouseEvent.MOUSE_DOWN, stamd);
insbtn.addEventListener(MouseEvent.MOUSE_DOWN, inmd);
pmog.addEventListener(MouseEvent.CLICK, clickHandler2);
vhs.addEventListener(MouseEvent.CLICK, vhsb);
stop();
}
}
}//package CannonAlone_fla
Section 103
//Sending_40 (CannonAlone_fla.Sending_40)
package CannonAlone_fla {
import flash.display.*;
public dynamic class Sending_40 extends MovieClip {
public function Sending_40(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package CannonAlone_fla
Section 104
//SubmitScores_42 (CannonAlone_fla.SubmitScores_42)
package CannonAlone_fla {
import flash.display.*;
import flash.events.*;
import flash.geom.*;
import flash.utils.*;
import flash.media.*;
import flash.filters.*;
import flash.text.*;
import flash.ui.*;
import flash.system.*;
import flash.net.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.printing.*;
import flash.xml.*;
public dynamic class SubmitScores_42 extends MovieClip {
public var nome:TextField;
public var user;
public var subsco:SimpleButton;
public function SubmitScores_42(){
addFrameScript(0, frame1);
}
function frame1(){
user = SharedObject.getLocal("user_profile");
if (user.data.username != undefined){
nome.text = user.data.username;
};
subsco.addEventListener(MouseEvent.MOUSE_DOWN, submd);
}
public function submd(_arg1:MouseEvent):void{
var _local2:URLRequest;
if (nome.text != ""){
root["nome"] = nome.text;
user.data.username = nome.text;
var _local3 = root;
_local3["showleader"]();
root["gameover"].subsco.visible = false;
root["gameover"].sending.gotoAndPlay(2);
_local2 = new URLRequest("http://www.freeworldgroup.com/score/index.asp?game=cannon_alone");
navigateToURL(_local2, "_blank");
};
}
}
}//package CannonAlone_fla
Section 105
//UpGradeWIN_34 (CannonAlone_fla.UpGradeWIN_34)
package CannonAlone_fla {
import flash.display.*;
import flash.events.*;
import flash.geom.*;
import flash.utils.*;
import flash.media.*;
import flash.filters.*;
import flash.text.*;
import flash.ui.*;
import flash.system.*;
import flash.net.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.printing.*;
import flash.xml.*;
public dynamic class UpGradeWIN_34 extends MovieClip {
public var icbtn:SimpleButton;
public var ilbtn:SimpleButton;
public var abbtn:SimpleButton;
public var ihbtn:SimpleButton;
public function UpGradeWIN_34(){
addFrameScript(0, frame1);
}
public function ilmd(_arg1:MouseEvent):void{
root["tredi"].lp = (root["tredi"].lp + 1);
root["upgradewin"].visible = false;
}
public function icmd(_arg1:MouseEvent):void{
root["tredi"].cs = (root["tredi"].cs + 0.4);
root["upgradewin"].visible = false;
}
function frame1(){
abbtn.addEventListener(MouseEvent.MOUSE_DOWN, abmd);
ihbtn.addEventListener(MouseEvent.MOUSE_DOWN, ihmd);
ilbtn.addEventListener(MouseEvent.MOUSE_DOWN, ilmd);
icbtn.addEventListener(MouseEvent.MOUSE_DOWN, icmd);
}
public function abmd(_arg1:MouseEvent):void{
root["bombs"].text = String((Number(root["bombs"].text) + 1));
root["upgradewin"].visible = false;
}
public function ihmd(_arg1:MouseEvent):void{
root["tredi"].ih();
root["upgradewin"].visible = false;
}
}
}//package CannonAlone_fla
Section 106
//Vita_30 (CannonAlone_fla.Vita_30)
package CannonAlone_fla {
import flash.display.*;
public dynamic class Vita_30 extends MovieClip {
public var vita:MovieClip;
}
}//package CannonAlone_fla
Section 107
//Volume_25 (CannonAlone_fla.Volume_25)
package CannonAlone_fla {
import fl.controls.*;
import flash.display.*;
import flash.events.*;
import flash.geom.*;
import flash.utils.*;
import fl.events.*;
import flash.media.*;
import flash.filters.*;
import flash.text.*;
import flash.ui.*;
import flash.system.*;
import flash.net.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.printing.*;
import flash.xml.*;
public dynamic class Volume_25 extends MovieClip {
public var volume1:Slider;
public function Volume_25(){
addFrameScript(0, frame1);
__setProp_volume1_Volume_Livello1_1();
}
function __setProp_volume1_Volume_Livello1_1(){
try {
volume1["componentInspectorSetting"] = true;
} catch(e:Error) {
};
volume1.direction = "horizontal";
volume1.enabled = true;
volume1.liveDragging = true;
volume1.maximum = 1;
volume1.minimum = 0;
volume1.snapInterval = 0.1;
volume1.tickInterval = 0.1;
volume1.value = 1;
volume1.visible = true;
try {
volume1["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function frame1(){
volume1.addEventListener(SliderEvent.CHANGE, announceChange);
}
public function announceChange(_arg1:SliderEvent):void{
SoundMixer.soundTransform = new SoundTransform(_arg1.target.value);
}
}
}//package CannonAlone_fla
Section 108
//BaseButton (fl.controls.BaseButton)
package fl.controls {
import flash.display.*;
import fl.core.*;
import flash.events.*;
import flash.utils.*;
import fl.events.*;
public class BaseButton extends UIComponent {
protected var _selected:Boolean;// = false
private var unlockedMouseState:String;
protected var pressTimer:Timer;
protected var mouseState:String;
protected var background:DisplayObject;
private var _mouseStateLocked:Boolean;// = false
protected var _autoRepeat:Boolean;// = false
private static var defaultStyles:Object = {upSkin:"Button_upSkin", downSkin:"Button_downSkin", overSkin:"Button_overSkin", disabledSkin:"Button_disabledSkin", selectedDisabledSkin:"Button_selectedDisabledSkin", selectedUpSkin:"Button_selectedUpSkin", selectedDownSkin:"Button_selectedDownSkin", selectedOverSkin:"Button_selectedOverSkin", focusRectSkin:null, focusRectPadding:null, repeatDelay:500, repeatInterval:35};
public function BaseButton(){
_selected = false;
_autoRepeat = false;
_mouseStateLocked = false;
super();
buttonMode = true;
mouseChildren = false;
useHandCursor = false;
setupMouseEvents();
setMouseState("up");
pressTimer = new Timer(1, 0);
pressTimer.addEventListener(TimerEvent.TIMER, buttonDown, false, 0, true);
}
protected function endPress():void{
pressTimer.reset();
}
public function set mouseStateLocked(_arg1:Boolean):void{
_mouseStateLocked = _arg1;
if (_arg1 == false){
setMouseState(unlockedMouseState);
} else {
unlockedMouseState = mouseState;
};
}
public function get autoRepeat():Boolean{
return (_autoRepeat);
}
public function set autoRepeat(_arg1:Boolean):void{
_autoRepeat = _arg1;
}
override public function set enabled(_arg1:Boolean):void{
super.enabled = _arg1;
mouseEnabled = _arg1;
}
public function get selected():Boolean{
return (_selected);
}
protected function mouseEventHandler(_arg1:MouseEvent):void{
if (_arg1.type == MouseEvent.MOUSE_DOWN){
setMouseState("down");
startPress();
} else {
if ((((_arg1.type == MouseEvent.ROLL_OVER)) || ((_arg1.type == MouseEvent.MOUSE_UP)))){
setMouseState("over");
endPress();
} else {
if (_arg1.type == MouseEvent.ROLL_OUT){
setMouseState("up");
endPress();
};
};
};
}
public function setMouseState(_arg1:String):void{
if (_mouseStateLocked){
unlockedMouseState = _arg1;
return;
};
if (mouseState == _arg1){
return;
};
mouseState = _arg1;
invalidate(InvalidationType.STATE);
}
protected function startPress():void{
if (_autoRepeat){
pressTimer.delay = Number(getStyleValue("repeatDelay"));
pressTimer.start();
};
dispatchEvent(new ComponentEvent(ComponentEvent.BUTTON_DOWN, true));
}
protected function buttonDown(_arg1:TimerEvent):void{
if (!_autoRepeat){
endPress();
return;
};
if (pressTimer.currentCount == 1){
pressTimer.delay = Number(getStyleValue("repeatInterval"));
};
dispatchEvent(new ComponentEvent(ComponentEvent.BUTTON_DOWN, true));
}
public function set selected(_arg1:Boolean):void{
if (_selected == _arg1){
return;
};
_selected = _arg1;
invalidate(InvalidationType.STATE);
}
override public function get enabled():Boolean{
return (super.enabled);
}
override protected function draw():void{
if (isInvalid(InvalidationType.STYLES, InvalidationType.STATE)){
drawBackground();
invalidate(InvalidationType.SIZE, false);
};
if (isInvalid(InvalidationType.SIZE)){
drawLayout();
};
super.draw();
}
protected function setupMouseEvents():void{
addEventListener(MouseEvent.ROLL_OVER, mouseEventHandler, false, 0, true);
addEventListener(MouseEvent.MOUSE_DOWN, mouseEventHandler, false, 0, true);
addEventListener(MouseEvent.MOUSE_UP, mouseEventHandler, false, 0, true);
addEventListener(MouseEvent.ROLL_OUT, mouseEventHandler, false, 0, true);
}
protected function drawLayout():void{
background.width = width;
background.height = height;
}
protected function drawBackground():void{
var _local1:String;
var _local2:DisplayObject;
_local1 = (enabled) ? mouseState : "disabled";
if (selected){
_local1 = (("selected" + _local1.substr(0, 1).toUpperCase()) + _local1.substr(1));
};
_local1 = (_local1 + "Skin");
_local2 = background;
background = getDisplayObjectInstance(getStyleValue(_local1));
addChildAt(background, 0);
if (((!((_local2 == null))) && (!((_local2 == background))))){
removeChild(_local2);
};
}
public static function getStyleDefinition():Object{
return (defaultStyles);
}
}
}//package fl.controls
Section 109
//Button (fl.controls.Button)
package fl.controls {
import flash.display.*;
import fl.core.*;
import fl.managers.*;
public class Button extends LabelButton implements IFocusManagerComponent {
protected var emphasizedBorder:DisplayObject;
protected var _emphasized:Boolean;// = false
private static var defaultStyles:Object = {emphasizedSkin:"Button_emphasizedSkin", emphasizedPadding:2};
public static var createAccessibilityImplementation:Function;
public function Button(){
_emphasized = false;
super();
}
override public function drawFocus(_arg1:Boolean):void{
var _local2:Number;
var _local3:*;
super.drawFocus(_arg1);
if (_arg1){
_local2 = Number(getStyleValue("emphasizedPadding"));
if ((((_local2 < 0)) || (!(_emphasized)))){
_local2 = 0;
};
_local3 = getStyleValue("focusRectPadding");
_local3 = ((_local3)==null) ? 2 : _local3;
_local3 = (_local3 + _local2);
uiFocusRect.x = -(_local3);
uiFocusRect.y = -(_local3);
uiFocusRect.width = (width + (_local3 * 2));
uiFocusRect.height = (height + (_local3 * 2));
};
}
public function set emphasized(_arg1:Boolean):void{
_emphasized = _arg1;
invalidate(InvalidationType.STYLES);
}
override protected function draw():void{
if (((isInvalid(InvalidationType.STYLES)) || (isInvalid(InvalidationType.SIZE)))){
drawEmphasized();
};
super.draw();
if (emphasizedBorder != null){
setChildIndex(emphasizedBorder, (numChildren - 1));
};
}
public function get emphasized():Boolean{
return (_emphasized);
}
override protected function initializeAccessibility():void{
if (Button.createAccessibilityImplementation != null){
Button.createAccessibilityImplementation(this);
};
}
protected function drawEmphasized():void{
var _local1:Object;
var _local2:Number;
if (emphasizedBorder != null){
removeChild(emphasizedBorder);
};
emphasizedBorder = null;
if (!_emphasized){
return;
};
_local1 = getStyleValue("emphasizedSkin");
if (_local1 != null){
emphasizedBorder = getDisplayObjectInstance(_local1);
};
if (emphasizedBorder != null){
addChildAt(emphasizedBorder, 0);
_local2 = Number(getStyleValue("emphasizedPadding"));
emphasizedBorder.x = (emphasizedBorder.y = -(_local2));
emphasizedBorder.width = (width + (_local2 * 2));
emphasizedBorder.height = (height + (_local2 * 2));
};
}
public static function getStyleDefinition():Object{
return (UIComponent.mergeStyles(LabelButton.getStyleDefinition(), defaultStyles));
}
}
}//package fl.controls
Section 110
//ButtonLabelPlacement (fl.controls.ButtonLabelPlacement)
package fl.controls {
public class ButtonLabelPlacement {
public static const TOP:String = "top";
public static const LEFT:String = "left";
public static const BOTTOM:String = "bottom";
public static const RIGHT:String = "right";
}
}//package fl.controls
Section 111
//LabelButton (fl.controls.LabelButton)
package fl.controls {
import flash.display.*;
import fl.core.*;
import flash.events.*;
import fl.managers.*;
import fl.events.*;
import flash.text.*;
import flash.ui.*;
public class LabelButton extends BaseButton implements IFocusManagerComponent {
protected var _labelPlacement:String;// = "right"
protected var _toggle:Boolean;// = false
protected var icon:DisplayObject;
protected var oldMouseState:String;
protected var mode:String;// = "center"
public var textField:TextField;
protected var _label:String;// = "Label"
private static var defaultStyles:Object = {icon:null, upIcon:null, downIcon:null, overIcon:null, disabledIcon:null, selectedDisabledIcon:null, selectedUpIcon:null, selectedDownIcon:null, selectedOverIcon:null, textFormat:null, disabledTextFormat:null, textPadding:5, embedFonts:false};
public static var createAccessibilityImplementation:Function;
public function LabelButton(){
_labelPlacement = ButtonLabelPlacement.RIGHT;
_toggle = false;
_label = "Label";
mode = "center";
super();
}
protected function toggleSelected(_arg1:MouseEvent):void{
selected = !(selected);
dispatchEvent(new Event(Event.CHANGE, true));
}
public function get labelPlacement():String{
return (_labelPlacement);
}
override protected function keyDownHandler(_arg1:KeyboardEvent):void{
if (!enabled){
return;
};
if (_arg1.keyCode == Keyboard.SPACE){
if (oldMouseState == null){
oldMouseState = mouseState;
};
setMouseState("down");
startPress();
};
}
protected function setEmbedFont(){
var _local1:Object;
_local1 = getStyleValue("embedFonts");
if (_local1 != null){
textField.embedFonts = _local1;
};
}
override protected function keyUpHandler(_arg1:KeyboardEvent):void{
if (!enabled){
return;
};
if (_arg1.keyCode == Keyboard.SPACE){
setMouseState(oldMouseState);
oldMouseState = null;
endPress();
dispatchEvent(new MouseEvent(MouseEvent.CLICK));
};
}
override public function get selected():Boolean{
return ((_toggle) ? _selected : false);
}
public function set labelPlacement(_arg1:String):void{
_labelPlacement = _arg1;
invalidate(InvalidationType.SIZE);
}
public function set toggle(_arg1:Boolean):void{
if (((!(_arg1)) && (super.selected))){
selected = false;
};
_toggle = _arg1;
if (_toggle){
addEventListener(MouseEvent.CLICK, toggleSelected, false, 0, true);
} else {
removeEventListener(MouseEvent.CLICK, toggleSelected);
};
invalidate(InvalidationType.STATE);
}
public function get label():String{
return (_label);
}
override public function set selected(_arg1:Boolean):void{
_selected = _arg1;
if (_toggle){
invalidate(InvalidationType.STATE);
};
}
override protected function draw():void{
if (textField.text != _label){
label = _label;
};
if (isInvalid(InvalidationType.STYLES, InvalidationType.STATE)){
drawBackground();
drawIcon();
drawTextFormat();
invalidate(InvalidationType.SIZE, false);
};
if (isInvalid(InvalidationType.SIZE)){
drawLayout();
};
if (isInvalid(InvalidationType.SIZE, InvalidationType.STYLES)){
if (((isFocused) && (focusManager.showFocusIndicator))){
drawFocus(true);
};
};
validate();
}
public function get toggle():Boolean{
return (_toggle);
}
override protected function configUI():void{
super.configUI();
textField = new TextField();
textField.type = TextFieldType.DYNAMIC;
textField.selectable = false;
addChild(textField);
}
override protected function drawLayout():void{
var _local1:Number;
var _local2:String;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
_local1 = Number(getStyleValue("textPadding"));
_local2 = ((((icon == null)) && ((mode == "center")))) ? ButtonLabelPlacement.TOP : _labelPlacement;
textField.height = (textField.textHeight + 4);
_local3 = (textField.textWidth + 4);
_local4 = (textField.textHeight + 4);
_local5 = ((icon)==null) ? 0 : (icon.width + _local1);
_local6 = ((icon)==null) ? 0 : (icon.height + _local1);
textField.visible = (label.length > 0);
if (icon != null){
icon.x = Math.round(((width - icon.width) / 2));
icon.y = Math.round(((height - icon.height) / 2));
};
if (textField.visible == false){
textField.width = 0;
textField.height = 0;
} else {
if ((((_local2 == ButtonLabelPlacement.BOTTOM)) || ((_local2 == ButtonLabelPlacement.TOP)))){
_local7 = Math.max(0, Math.min(_local3, (width - (2 * _local1))));
if ((height - 2) > _local4){
_local8 = _local4;
} else {
_local8 = (height - 2);
};
_local3 = _local7;
textField.width = _local3;
_local4 = _local8;
textField.height = _local4;
textField.x = Math.round(((width - _local3) / 2));
textField.y = Math.round(((((height - textField.height) - _local6) / 2) + ((_local2)==ButtonLabelPlacement.BOTTOM) ? _local6 : 0));
if (icon != null){
icon.y = Math.round(((_local2)==ButtonLabelPlacement.BOTTOM) ? (textField.y - _local6) : ((textField.y + textField.height) + _local1));
};
} else {
_local7 = Math.max(0, Math.min(_local3, ((width - _local5) - (2 * _local1))));
_local3 = _local7;
textField.width = _local3;
textField.x = Math.round(((((width - _local3) - _local5) / 2) + ((_local2)!=ButtonLabelPlacement.LEFT) ? _local5 : 0));
textField.y = Math.round(((height - textField.height) / 2));
if (icon != null){
icon.x = Math.round(((_local2)!=ButtonLabelPlacement.LEFT) ? (textField.x - _local5) : ((textField.x + _local3) + _local1));
};
};
};
super.drawLayout();
}
override protected function initializeAccessibility():void{
if (LabelButton.createAccessibilityImplementation != null){
LabelButton.createAccessibilityImplementation(this);
};
}
protected function drawIcon():void{
var _local1:DisplayObject;
var _local2:String;
var _local3:Object;
_local1 = icon;
_local2 = (enabled) ? mouseState : "disabled";
if (selected){
_local2 = (("selected" + _local2.substr(0, 1).toUpperCase()) + _local2.substr(1));
};
_local2 = (_local2 + "Icon");
_local3 = getStyleValue(_local2);
if (_local3 == null){
_local3 = getStyleValue("icon");
};
if (_local3 != null){
icon = getDisplayObjectInstance(_local3);
};
if (icon != null){
addChildAt(icon, 1);
};
if (((!((_local1 == null))) && (!((_local1 == icon))))){
removeChild(_local1);
};
}
public function set label(_arg1:String):void{
_label = _arg1;
if (textField.text != _label){
textField.text = _label;
dispatchEvent(new ComponentEvent(ComponentEvent.LABEL_CHANGE));
};
invalidate(InvalidationType.SIZE);
invalidate(InvalidationType.STYLES);
}
protected function drawTextFormat():void{
var _local1:Object;
var _local2:TextFormat;
var _local3:TextFormat;
_local1 = UIComponent.getStyleDefinition();
_local2 = (enabled) ? (_local1.defaultTextFormat as TextFormat) : (_local1.defaultDisabledTextFormat as TextFormat);
textField.setTextFormat(_local2);
_local3 = (getStyleValue((enabled) ? "textFormat" : "disabledTextFormat") as TextFormat);
if (_local3 != null){
textField.setTextFormat(_local3);
} else {
_local3 = _local2;
};
textField.defaultTextFormat = _local3;
setEmbedFont();
}
public static function getStyleDefinition():Object{
return (mergeStyles(defaultStyles, BaseButton.getStyleDefinition()));
}
}
}//package fl.controls
Section 112
//Slider (fl.controls.Slider)
package fl.controls {
import flash.display.*;
import fl.core.*;
import flash.events.*;
import fl.managers.*;
import fl.events.*;
import flash.ui.*;
public class Slider extends UIComponent implements IFocusManagerComponent {
protected var _direction:String;
protected var _liveDragging:Boolean;// = false
protected var _value:Number;// = 0
protected var _snapInterval:Number;// = 0
protected var _minimum:Number;// = 0
protected var _maximum:Number;// = 10
protected var track:BaseButton;
protected var _tickInterval:Number;// = 0
protected var tickContainer:Sprite;
protected var thumb:BaseButton;
protected static const TICK_STYLES:Object = {upSkin:"tickSkin"};
protected static const TRACK_STYLES:Object = {upSkin:"sliderTrackSkin", overSkin:"sliderTrackSkin", downSkin:"sliderTrackSkin", disabledSkin:"sliderTrackDisabledSkin"};
protected static const THUMB_STYLES:Object = {upSkin:"thumbUpSkin", overSkin:"thumbOverSkin", downSkin:"thumbDownSkin", disabledSkin:"thumbDisabledSkin"};
protected static var defaultStyles:Object = {thumbUpSkin:"SliderThumb_upSkin", thumbOverSkin:"SliderThumb_overSkin", thumbDownSkin:"SliderThumb_downSkin", thumbDisabledSkin:"SliderThumb_disabledSkin", sliderTrackSkin:"SliderTrack_skin", sliderTrackDisabledSkin:"SliderTrack_disabledSkin", tickSkin:"SliderTick_skin", focusRectSkin:null, focusRectPadding:null};
public function Slider(){
_direction = SliderDirection.HORIZONTAL;
_minimum = 0;
_maximum = 10;
_value = 0;
_tickInterval = 0;
_snapInterval = 0;
_liveDragging = false;
super();
setStyles();
}
public function get minimum():Number{
return (_minimum);
}
public function set minimum(_arg1:Number):void{
_minimum = _arg1;
this.value = Math.max(_arg1, this.value);
invalidate(InvalidationType.DATA);
}
public function get maximum():Number{
return (_maximum);
}
protected function positionThumb():void{
thumb.x = ((((_direction)==SliderDirection.VERTICAL) ? ((maximum - minimum) - value) : (value - minimum) / (maximum - minimum)) * _width);
}
protected function clearTicks():void{
if (((!(tickContainer)) || (!(tickContainer.parent)))){
return;
};
removeChild(tickContainer);
}
protected function onTrackClick(_arg1:MouseEvent):void{
calculateValue(track.mouseX, InteractionInputType.MOUSE, SliderEventClickTarget.TRACK);
if (!liveDragging){
dispatchEvent(new SliderEvent(SliderEvent.CHANGE, value, SliderEventClickTarget.TRACK, InteractionInputType.MOUSE));
};
}
public function set maximum(_arg1:Number):void{
_maximum = _arg1;
this.value = Math.min(_arg1, this.value);
invalidate(InvalidationType.DATA);
}
public function get liveDragging():Boolean{
return (_liveDragging);
}
protected function doDrag(_arg1:MouseEvent):void{
var _local2:Number;
var _local3:Number;
_local2 = (_width / snapInterval);
_local3 = track.mouseX;
calculateValue(_local3, InteractionInputType.MOUSE, SliderEventClickTarget.THUMB);
dispatchEvent(new SliderEvent(SliderEvent.THUMB_DRAG, value, SliderEventClickTarget.THUMB, InteractionInputType.MOUSE));
}
override protected function keyDownHandler(_arg1:KeyboardEvent):void{
var _local2:uint;
var _local3:Number;
var _local4:Boolean;
if (!enabled){
return;
};
_local2 = ((snapInterval)>0) ? snapInterval : 1;
_local4 = (direction == SliderDirection.HORIZONTAL);
if ((((((_arg1.keyCode == Keyboard.DOWN)) && (!(_local4)))) || ((((_arg1.keyCode == Keyboard.LEFT)) && (_local4))))){
_local3 = (value - _local2);
} else {
if ((((((_arg1.keyCode == Keyboard.UP)) && (!(_local4)))) || ((((_arg1.keyCode == Keyboard.RIGHT)) && (_local4))))){
_local3 = (value + _local2);
} else {
if ((((((_arg1.keyCode == Keyboard.PAGE_DOWN)) && (!(_local4)))) || ((((_arg1.keyCode == Keyboard.HOME)) && (_local4))))){
_local3 = minimum;
} else {
if ((((((_arg1.keyCode == Keyboard.PAGE_UP)) && (!(_local4)))) || ((((_arg1.keyCode == Keyboard.END)) && (_local4))))){
_local3 = maximum;
};
};
};
};
if (!isNaN(_local3)){
_arg1.stopPropagation();
doSetValue(_local3, InteractionInputType.KEYBOARD, null, _arg1.keyCode);
};
}
override public function set enabled(_arg1:Boolean):void{
if (enabled == _arg1){
return;
};
super.enabled = _arg1;
track.enabled = (thumb.enabled = _arg1);
}
protected function thumbPressHandler(_arg1:MouseEvent):void{
stage.addEventListener(MouseEvent.MOUSE_MOVE, doDrag, false, 0, true);
stage.addEventListener(MouseEvent.MOUSE_UP, thumbReleaseHandler, false, 0, true);
dispatchEvent(new SliderEvent(SliderEvent.THUMB_PRESS, value, InteractionInputType.MOUSE, SliderEventClickTarget.THUMB));
}
public function get snapInterval():Number{
return (_snapInterval);
}
protected function thumbReleaseHandler(_arg1:MouseEvent):void{
stage.removeEventListener(MouseEvent.MOUSE_MOVE, doDrag);
stage.removeEventListener(MouseEvent.MOUSE_UP, thumbReleaseHandler);
dispatchEvent(new SliderEvent(SliderEvent.THUMB_RELEASE, value, InteractionInputType.MOUSE, SliderEventClickTarget.THUMB));
dispatchEvent(new SliderEvent(SliderEvent.CHANGE, value, SliderEventClickTarget.THUMB, InteractionInputType.MOUSE));
}
public function set liveDragging(_arg1:Boolean):void{
_liveDragging = _arg1;
}
public function set value(_arg1:Number):void{
doSetValue(_arg1);
}
public function set direction(_arg1:String):void{
var _local2:Boolean;
_direction = _arg1;
_local2 = (_direction == SliderDirection.VERTICAL);
if (isLivePreview){
if (_local2){
setScaleY(-1);
y = track.height;
} else {
setScaleY(1);
y = 0;
};
positionThumb();
return;
};
if (((_local2) && (componentInspectorSetting))){
if ((rotation % 90) == 0){
setScaleY(-1);
};
};
if (!componentInspectorSetting){
rotation = (_local2) ? 90 : 0;
};
}
public function set tickInterval(_arg1:Number):void{
_tickInterval = _arg1;
invalidate(InvalidationType.SIZE);
}
override public function get enabled():Boolean{
return (super.enabled);
}
override protected function draw():void{
if (isInvalid(InvalidationType.STYLES)){
setStyles();
invalidate(InvalidationType.SIZE, false);
};
if (isInvalid(InvalidationType.SIZE)){
track.setSize(_width, track.height);
track.drawNow();
thumb.drawNow();
};
if (tickInterval > 0){
drawTicks();
} else {
clearTicks();
};
positionThumb();
super.draw();
}
override protected function configUI():void{
super.configUI();
thumb = new BaseButton();
thumb.setSize(13, 13);
thumb.autoRepeat = false;
addChild(thumb);
thumb.addEventListener(MouseEvent.MOUSE_DOWN, thumbPressHandler, false, 0, true);
track = new BaseButton();
track.move(0, 0);
track.setSize(80, 4);
track.autoRepeat = false;
track.useHandCursor = false;
track.addEventListener(MouseEvent.CLICK, onTrackClick, false, 0, true);
addChildAt(track, 0);
}
public function set snapInterval(_arg1:Number):void{
_snapInterval = _arg1;
}
public function get value():Number{
return (_value);
}
public function get direction():String{
return (_direction);
}
public function get tickInterval():Number{
return (_tickInterval);
}
override public function setSize(_arg1:Number, _arg2:Number):void{
if ((((_direction == SliderDirection.VERTICAL)) && (!(isLivePreview)))){
super.setSize(_arg2, _arg1);
} else {
super.setSize(_arg1, _arg2);
};
invalidate(InvalidationType.SIZE);
}
protected function drawTicks():void{
var _local1:Number;
var _local2:Number;
var _local3:Number;
var _local4:uint;
var _local5:DisplayObject;
clearTicks();
tickContainer = new Sprite();
_local1 = ((maximum)<1) ? (tickInterval / 100) : tickInterval;
_local2 = ((maximum - minimum) / _local1);
_local3 = (_width / _local2);
_local4 = 0;
while (_local4 <= _local2) {
_local5 = getDisplayObjectInstance(getStyleValue("tickSkin"));
_local5.x = (_local3 * _local4);
_local5.y = ((track.y - _local5.height) - 2);
tickContainer.addChild(_local5);
_local4++;
};
addChild(tickContainer);
}
protected function calculateValue(_arg1:Number, _arg2:String, _arg3:String, _arg4:int=undefined):void{
var _local5:Number;
_local5 = ((_arg1 / _width) * (maximum - minimum));
if (_direction == SliderDirection.VERTICAL){
_local5 = (maximum - _local5);
} else {
_local5 = (minimum + _local5);
};
doSetValue(_local5, _arg2, _arg3, _arg4);
}
protected function getPrecision(_arg1:Number):Number{
var _local2:String;
_local2 = _arg1.toString();
if (_local2.indexOf(".") == -1){
return (0);
};
return (_local2.split(".").pop().length);
}
protected function doSetValue(_arg1:Number, _arg2:String=null, _arg3:String=null, _arg4:int=undefined):void{
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
_local5 = _value;
if (((!((_snapInterval == 0))) && (!((_snapInterval == 1))))){
_local6 = Math.pow(10, getPrecision(snapInterval));
_local7 = (_snapInterval * _local6);
_local8 = Math.round((_arg1 * _local6));
_local9 = (Math.round((_local8 / _local7)) * _local7);
_arg1 = (_local9 / _local6);
_value = Math.max(minimum, Math.min(maximum, _arg1));
} else {
_value = Math.max(minimum, Math.min(maximum, Math.round(_arg1)));
};
if (((!((_local5 == _value))) && (((((liveDragging) && (!((_arg3 == null))))) || ((_arg2 == InteractionInputType.KEYBOARD)))))){
dispatchEvent(new SliderEvent(SliderEvent.CHANGE, value, _arg3, _arg2, _arg4));
};
positionThumb();
}
protected function setStyles():void{
copyStylesToChild(thumb, THUMB_STYLES);
copyStylesToChild(track, TRACK_STYLES);
}
public static function getStyleDefinition():Object{
return (defaultStyles);
}
}
}//package fl.controls
Section 113
//SliderDirection (fl.controls.SliderDirection)
package fl.controls {
public class SliderDirection {
public static var HORIZONTAL:String = "horizontal";
public static var VERTICAL:String = "vertical";
}
}//package fl.controls
Section 114
//ComponentShim (fl.core.ComponentShim)
package fl.core {
import flash.display.*;
public dynamic class ComponentShim extends MovieClip {
}
}//package fl.core
Section 115
//InvalidationType (fl.core.InvalidationType)
package fl.core {
public class InvalidationType {
public static const SIZE:String = "size";
public static const ALL:String = "all";
public static const DATA:String = "data";
public static const SCROLL:String = "scroll";
public static const STATE:String = "state";
public static const STYLES:String = "styles";
public static const SELECTED:String = "selected";
public static const RENDERER_STYLES:String = "rendererStyles";
}
}//package fl.core
Section 116
//UIComponent (fl.core.UIComponent)
package fl.core {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
import fl.managers.*;
import fl.events.*;
import flash.text.*;
import flash.system.*;
public class UIComponent extends Sprite {
protected var _enabled:Boolean;// = true
private var _mouseFocusEnabled:Boolean;// = true
protected var startHeight:Number;
protected var _height:Number;
protected var _oldIMEMode:String;// = null
protected var startWidth:Number;
public var focusTarget:IFocusManagerComponent;
protected var errorCaught:Boolean;// = false
protected var uiFocusRect:DisplayObject;
protected var _width:Number;
public var version:String;// = "3.0.0.15"
protected var isFocused:Boolean;// = false
protected var callLaterMethods:Dictionary;
private var _focusEnabled:Boolean;// = true
private var tempText:TextField;
protected var invalidateFlag:Boolean;// = false
protected var _inspector:Boolean;// = false
protected var sharedStyles:Object;
protected var invalidHash:Object;
protected var isLivePreview:Boolean;// = false
protected var _imeMode:String;// = null
protected var instanceStyles:Object;
protected var _x:Number;
protected var _y:Number;
public static var inCallLaterPhase:Boolean = false;
private static var defaultStyles:Object = {focusRectSkin:"focusRectSkin", focusRectPadding:2, textFormat:new TextFormat("_sans", 11, 0, false, false, false, "", "", TextFormatAlign.LEFT, 0, 0, 0, 0), disabledTextFormat:new TextFormat("_sans", 11, 0x999999, false, false, false, "", "", TextFormatAlign.LEFT, 0, 0, 0, 0), defaultTextFormat:new TextFormat("_sans", 11, 0, false, false, false, "", "", TextFormatAlign.LEFT, 0, 0, 0, 0), defaultDisabledTextFormat:new TextFormat("_sans", 11, 0x999999, false, false, false, "", "", TextFormatAlign.LEFT, 0, 0, 0, 0)};
public static var createAccessibilityImplementation:Function;
private static var focusManagers:Dictionary = new Dictionary(false);
public function UIComponent(){
version = "3.0.0.15";
isLivePreview = false;
invalidateFlag = false;
_enabled = true;
isFocused = false;
_focusEnabled = true;
_mouseFocusEnabled = true;
_imeMode = null;
_oldIMEMode = null;
errorCaught = false;
_inspector = false;
super();
instanceStyles = {};
sharedStyles = {};
invalidHash = {};
callLaterMethods = new Dictionary();
StyleManager.registerInstance(this);
configUI();
invalidate(InvalidationType.ALL);
tabEnabled = (this is IFocusManagerComponent);
focusRect = false;
if (tabEnabled){
addEventListener(FocusEvent.FOCUS_IN, focusInHandler);
addEventListener(FocusEvent.FOCUS_OUT, focusOutHandler);
addEventListener(KeyboardEvent.KEY_DOWN, keyDownHandler);
addEventListener(KeyboardEvent.KEY_UP, keyUpHandler);
};
initializeFocusManager();
addEventListener(Event.ENTER_FRAME, hookAccessibility, false, 0, true);
}
public function drawFocus(_arg1:Boolean):void{
var _local2:Number;
isFocused = _arg1;
if (((!((uiFocusRect == null))) && (contains(uiFocusRect)))){
removeChild(uiFocusRect);
uiFocusRect = null;
};
if (_arg1){
uiFocusRect = (getDisplayObjectInstance(getStyleValue("focusRectSkin")) as Sprite);
if (uiFocusRect == null){
return;
};
_local2 = Number(getStyleValue("focusRectPadding"));
uiFocusRect.x = -(_local2);
uiFocusRect.y = -(_local2);
uiFocusRect.width = (width + (_local2 * 2));
uiFocusRect.height = (height + (_local2 * 2));
addChildAt(uiFocusRect, 0);
};
}
private function callLaterDispatcher(_arg1:Event):void{
var _local2:Dictionary;
var _local3:Object;
if (_arg1.type == Event.ADDED_TO_STAGE){
removeEventListener(Event.ADDED_TO_STAGE, callLaterDispatcher);
stage.addEventListener(Event.RENDER, callLaterDispatcher, false, 0, true);
stage.invalidate();
return;
};
_arg1.target.removeEventListener(Event.RENDER, callLaterDispatcher);
if (stage == null){
addEventListener(Event.ADDED_TO_STAGE, callLaterDispatcher, false, 0, true);
return;
};
inCallLaterPhase = true;
_local2 = callLaterMethods;
for (_local3 in _local2) {
_local3();
delete _local2[_local3];
};
inCallLaterPhase = false;
}
private function addedHandler(_arg1:Event):void{
removeEventListener("addedToStage", addedHandler);
initializeFocusManager();
}
protected function getStyleValue(_arg1:String):Object{
return (((instanceStyles[_arg1])==null) ? sharedStyles[_arg1] : instanceStyles[_arg1]);
}
protected function isOurFocus(_arg1:DisplayObject):Boolean{
return ((_arg1 == this));
}
override public function get scaleX():Number{
return ((width / startWidth));
}
override public function get scaleY():Number{
return ((height / startHeight));
}
override public function set height(_arg1:Number):void{
if (_height == _arg1){
return;
};
setSize(width, _arg1);
}
protected function keyDownHandler(_arg1:KeyboardEvent):void{
}
protected function focusInHandler(_arg1:FocusEvent):void{
var _local2:IFocusManager;
if (isOurFocus((_arg1.target as DisplayObject))){
_local2 = focusManager;
if (((_local2) && (_local2.showFocusIndicator))){
drawFocus(true);
isFocused = true;
};
};
}
public function setStyle(_arg1:String, _arg2:Object):void{
if ((((instanceStyles[_arg1] === _arg2)) && (!((_arg2 is TextFormat))))){
return;
};
instanceStyles[_arg1] = _arg2;
invalidate(InvalidationType.STYLES);
}
override public function get visible():Boolean{
return (super.visible);
}
public function get componentInspectorSetting():Boolean{
return (_inspector);
}
override public function get x():Number{
return ((isNaN(_x)) ? super.x : _x);
}
override public function get y():Number{
return ((isNaN(_y)) ? super.y : _y);
}
protected function setIMEMode(_arg1:Boolean){
var enabled = _arg1;
if (_imeMode != null){
if (enabled){
IME.enabled = true;
_oldIMEMode = IME.conversionMode;
try {
if (((!(errorCaught)) && (!((IME.conversionMode == IMEConversionMode.UNKNOWN))))){
IME.conversionMode = _imeMode;
};
errorCaught = false;
} catch(e:Error) {
errorCaught = true;
throw (new Error(("IME mode not supported: " + _imeMode)));
};
} else {
if (((!((IME.conversionMode == IMEConversionMode.UNKNOWN))) && (!((_oldIMEMode == IMEConversionMode.UNKNOWN))))){
IME.conversionMode = _oldIMEMode;
};
IME.enabled = false;
};
};
}
public function set enabled(_arg1:Boolean):void{
if (_arg1 == _enabled){
return;
};
_enabled = _arg1;
invalidate(InvalidationType.STATE);
}
public function setSharedStyle(_arg1:String, _arg2:Object):void{
if ((((sharedStyles[_arg1] === _arg2)) && (!((_arg2 is TextFormat))))){
return;
};
sharedStyles[_arg1] = _arg2;
if (instanceStyles[_arg1] == null){
invalidate(InvalidationType.STYLES);
};
}
protected function keyUpHandler(_arg1:KeyboardEvent):void{
}
public function set focusEnabled(_arg1:Boolean):void{
_focusEnabled = _arg1;
}
override public function set scaleX(_arg1:Number):void{
setSize((startWidth * _arg1), height);
}
public function get mouseFocusEnabled():Boolean{
return (_mouseFocusEnabled);
}
override public function set scaleY(_arg1:Number):void{
setSize(width, (startHeight * _arg1));
}
protected function getDisplayObjectInstance(_arg1:Object):DisplayObject{
var classDef:Object;
var skin = _arg1;
classDef = null;
if ((skin is Class)){
return ((new (skin) as DisplayObject));
};
if ((skin is DisplayObject)){
(skin as DisplayObject).x = 0;
(skin as DisplayObject).y = 0;
return ((skin as DisplayObject));
};
try {
classDef = getDefinitionByName(skin.toString());
} catch(e:Error) {
try {
classDef = (loaderInfo.applicationDomain.getDefinition(skin.toString()) as Object);
} catch(e:Error) {
};
};
if (classDef == null){
return (null);
};
return ((new (classDef) as DisplayObject));
}
protected function copyStylesToChild(_arg1:UIComponent, _arg2:Object):void{
var _local3:String;
for (_local3 in _arg2) {
_arg1.setStyle(_local3, getStyleValue(_arg2[_local3]));
};
}
protected function beforeComponentParameters():void{
}
protected function callLater(_arg1:Function):void{
if (inCallLaterPhase){
return;
};
callLaterMethods[_arg1] = true;
if (stage != null){
stage.addEventListener(Event.RENDER, callLaterDispatcher, false, 0, true);
stage.invalidate();
} else {
addEventListener(Event.ADDED_TO_STAGE, callLaterDispatcher, false, 0, true);
};
}
protected function createFocusManager():void{
if (focusManagers[stage] == null){
focusManagers[stage] = new FocusManager(stage);
};
}
override public function set visible(_arg1:Boolean):void{
var _local2:String;
if (super.visible == _arg1){
return;
};
super.visible = _arg1;
_local2 = (_arg1) ? ComponentEvent.SHOW : ComponentEvent.HIDE;
dispatchEvent(new ComponentEvent(_local2, true));
}
protected function hookAccessibility(_arg1:Event):void{
removeEventListener(Event.ENTER_FRAME, hookAccessibility);
initializeAccessibility();
}
public function set componentInspectorSetting(_arg1:Boolean):void{
_inspector = _arg1;
if (_inspector){
beforeComponentParameters();
} else {
afterComponentParameters();
};
}
override public function set x(_arg1:Number):void{
move(_arg1, _y);
}
public function drawNow():void{
draw();
}
override public function set y(_arg1:Number):void{
move(_x, _arg1);
}
protected function checkLivePreview():Boolean{
var className:String;
if (parent == null){
return (false);
};
try {
className = getQualifiedClassName(parent);
} catch(e:Error) {
};
return ((className == "fl.livepreview::LivePreviewParent"));
}
protected function focusOutHandler(_arg1:FocusEvent):void{
if (isOurFocus((_arg1.target as DisplayObject))){
drawFocus(false);
isFocused = false;
};
}
public function set mouseFocusEnabled(_arg1:Boolean):void{
_mouseFocusEnabled = _arg1;
}
public function getFocus():InteractiveObject{
if (stage){
return (stage.focus);
};
return (null);
}
protected function validate():void{
invalidHash = {};
}
override public function get height():Number{
return (_height);
}
public function invalidate(_arg1:String="all", _arg2:Boolean=true):void{
invalidHash[_arg1] = true;
if (_arg2){
this.callLater(draw);
};
}
public function get enabled():Boolean{
return (_enabled);
}
protected function getScaleX():Number{
return (super.scaleX);
}
protected function getScaleY():Number{
return (super.scaleY);
}
public function get focusEnabled():Boolean{
return (_focusEnabled);
}
protected function afterComponentParameters():void{
}
protected function draw():void{
if (isInvalid(InvalidationType.SIZE, InvalidationType.STYLES)){
if (((isFocused) && (focusManager.showFocusIndicator))){
drawFocus(true);
};
};
validate();
}
protected function configUI():void{
var _local1:Number;
var _local2:Number;
var _local3:Number;
isLivePreview = checkLivePreview();
_local1 = rotation;
rotation = 0;
_local2 = super.width;
_local3 = super.height;
var _local4 = 1;
super.scaleY = _local4;
super.scaleX = _local4;
setSize(_local2, _local3);
move(super.x, super.y);
rotation = _local1;
startWidth = _local2;
startHeight = _local3;
if (numChildren > 0){
removeChildAt(0);
};
}
protected function setScaleX(_arg1:Number):void{
super.scaleX = _arg1;
}
protected function setScaleY(_arg1:Number):void{
super.scaleY = _arg1;
}
private function initializeFocusManager():void{
if (stage == null){
addEventListener(Event.ADDED_TO_STAGE, addedHandler, false, 0, true);
} else {
createFocusManager();
};
}
public function set focusManager(_arg1:IFocusManager):void{
UIComponent.focusManagers[this] = _arg1;
}
public function clearStyle(_arg1:String):void{
setStyle(_arg1, null);
}
protected function isInvalid(_arg1:String, ... _args):Boolean{
if (((invalidHash[_arg1]) || (invalidHash[InvalidationType.ALL]))){
return (true);
};
while (_args.length > 0) {
if (invalidHash[_args.pop()]){
return (true);
};
};
return (false);
}
public function setSize(_arg1:Number, _arg2:Number):void{
_width = _arg1;
_height = _arg2;
invalidate(InvalidationType.SIZE);
dispatchEvent(new ComponentEvent(ComponentEvent.RESIZE, false));
}
override public function set width(_arg1:Number):void{
if (_width == _arg1){
return;
};
setSize(_arg1, height);
}
public function setFocus():void{
if (stage){
stage.focus = this;
};
}
protected function initializeAccessibility():void{
if (UIComponent.createAccessibilityImplementation != null){
UIComponent.createAccessibilityImplementation(this);
};
}
public function get focusManager():IFocusManager{
var _local1:DisplayObject;
_local1 = this;
while (_local1) {
if (UIComponent.focusManagers[_local1] != null){
return (IFocusManager(UIComponent.focusManagers[_local1]));
};
_local1 = _local1.parent;
};
return (null);
}
override public function get width():Number{
return (_width);
}
public function move(_arg1:Number, _arg2:Number):void{
_x = _arg1;
_y = _arg2;
super.x = Math.round(_arg1);
super.y = Math.round(_arg2);
dispatchEvent(new ComponentEvent(ComponentEvent.MOVE));
}
public function validateNow():void{
invalidate(InvalidationType.ALL, false);
draw();
}
public function getStyle(_arg1:String):Object{
return (instanceStyles[_arg1]);
}
public static function getStyleDefinition():Object{
return (defaultStyles);
}
public static function mergeStyles(... _args):Object{
var _local2:Object;
var _local3:uint;
var _local4:uint;
var _local5:Object;
var _local6:String;
_local2 = {};
_local3 = _args.length;
_local4 = 0;
while (_local4 < _local3) {
_local5 = _args[_local4];
for (_local6 in _local5) {
if (_local2[_local6] != null){
} else {
_local2[_local6] = _args[_local4][_local6];
};
};
_local4++;
};
return (_local2);
}
}
}//package fl.core
Section 117
//ComponentEvent (fl.events.ComponentEvent)
package fl.events {
import flash.events.*;
public class ComponentEvent extends Event {
public static const HIDE:String = "hide";
public static const BUTTON_DOWN:String = "buttonDown";
public static const MOVE:String = "move";
public static const RESIZE:String = "resize";
public static const ENTER:String = "enter";
public static const LABEL_CHANGE:String = "labelChange";
public static const SHOW:String = "show";
public function ComponentEvent(_arg1:String, _arg2:Boolean=false, _arg3:Boolean=false){
super(_arg1, _arg2, _arg3);
}
override public function toString():String{
return (formatToString("ComponentEvent", "type", "bubbles", "cancelable"));
}
override public function clone():Event{
return (new ComponentEvent(type, bubbles, cancelable));
}
}
}//package fl.events
Section 118
//InteractionInputType (fl.events.InteractionInputType)
package fl.events {
public class InteractionInputType {
public static const MOUSE:String = "mouse";
public static const KEYBOARD:String = "keyboard";
}
}//package fl.events
Section 119
//SliderEvent (fl.events.SliderEvent)
package fl.events {
import flash.events.*;
public class SliderEvent extends Event {
protected var _triggerEvent:String;
protected var _keyCode:Number;
protected var _value:Number;
protected var _clickTarget:String;
public static const CHANGE:String = "change";
public static const THUMB_PRESS:String = "thumbPress";
public static const THUMB_DRAG:String = "thumbDrag";
public static const THUMB_RELEASE:String = "thumbRelease";
public function SliderEvent(_arg1:String, _arg2:Number, _arg3:String, _arg4:String, _arg5:int=0){
_value = _arg2;
_keyCode = _arg5;
_triggerEvent = _arg4;
_clickTarget = _arg3;
super(_arg1);
}
public function get clickTarget():String{
return (_clickTarget);
}
override public function clone():Event{
return (new SliderEvent(type, _value, _clickTarget, _triggerEvent, _keyCode));
}
override public function toString():String{
return (formatToString("SliderEvent", "type", "value", "bubbles", "cancelable", "keyCode", "triggerEvent", "clickTarget"));
}
public function get triggerEvent():String{
return (_triggerEvent);
}
public function get value():Number{
return (_value);
}
public function get keyCode():Number{
return (_keyCode);
}
}
}//package fl.events
Section 120
//SliderEventClickTarget (fl.events.SliderEventClickTarget)
package fl.events {
public class SliderEventClickTarget {
public static const TRACK:String = "track";
public static const THUMB:String = "thumb";
}
}//package fl.events
Section 121
//FocusManager (fl.managers.FocusManager)
package fl.managers {
import fl.controls.*;
import flash.display.*;
import fl.core.*;
import flash.events.*;
import flash.utils.*;
import flash.text.*;
import flash.ui.*;
public class FocusManager implements IFocusManager {
private var focusableObjects:Dictionary;
private var _showFocusIndicator:Boolean;// = true
private var defButton:Button;
private var focusableCandidates:Array;
private var _form:DisplayObjectContainer;
private var _defaultButtonEnabled:Boolean;// = true
private var activated:Boolean;// = false
private var _defaultButton:Button;
private var calculateCandidates:Boolean;// = true
private var lastFocus:InteractiveObject;
private var lastAction:String;
public function FocusManager(_arg1:DisplayObjectContainer){
activated = false;
calculateCandidates = true;
_showFocusIndicator = true;
_defaultButtonEnabled = true;
super();
focusableObjects = new Dictionary(true);
if (_arg1 != null){
_form = _arg1;
addFocusables(DisplayObject(_arg1));
_arg1.addEventListener(Event.ADDED, addedHandler);
_arg1.addEventListener(Event.REMOVED, removedHandler);
activate();
};
}
public function get showFocusIndicator():Boolean{
return (_showFocusIndicator);
}
private function getIndexOfNextObject(_arg1:int, _arg2:Boolean, _arg3:Boolean, _arg4:String):int{
var _local5:int;
var _local6:int;
var _local7:DisplayObject;
var _local8:IFocusManagerGroup;
var _local9:int;
var _local10:DisplayObject;
var _local11:IFocusManagerGroup;
_local5 = focusableCandidates.length;
_local6 = _arg1;
while (true) {
if (_arg2){
_arg1--;
} else {
_arg1++;
};
if (_arg3){
if (((_arg2) && ((_arg1 < 0)))){
break;
};
if (((!(_arg2)) && ((_arg1 == _local5)))){
break;
};
} else {
_arg1 = ((_arg1 + _local5) % _local5);
if (_local6 == _arg1){
break;
};
};
if (isValidFocusCandidate(focusableCandidates[_arg1], _arg4)){
_local7 = DisplayObject(findFocusManagerComponent(focusableCandidates[_arg1]));
if ((_local7 is IFocusManagerGroup)){
_local8 = IFocusManagerGroup(_local7);
_local9 = 0;
while (_local9 < focusableCandidates.length) {
_local10 = focusableCandidates[_local9];
if ((_local10 is IFocusManagerGroup)){
_local11 = IFocusManagerGroup(_local10);
if ((((_local11.groupName == _local8.groupName)) && (_local11.selected))){
_arg1 = _local9;
break;
};
};
_local9++;
};
};
return (_arg1);
};
};
return (_arg1);
}
public function set form(_arg1:DisplayObjectContainer):void{
_form = _arg1;
}
private function addFocusables(_arg1:DisplayObject, _arg2:Boolean=false):void{
var focusable:IFocusManagerComponent;
var io:InteractiveObject;
var doc:DisplayObjectContainer;
var i:int;
var child:DisplayObject;
var o = _arg1;
var skipTopLevel = _arg2;
if (!skipTopLevel){
if ((o is IFocusManagerComponent)){
focusable = IFocusManagerComponent(o);
if (focusable.focusEnabled){
if (((focusable.tabEnabled) && (isTabVisible(o)))){
focusableObjects[o] = true;
calculateCandidates = true;
};
o.addEventListener(Event.TAB_ENABLED_CHANGE, tabEnabledChangeHandler);
o.addEventListener(Event.TAB_INDEX_CHANGE, tabIndexChangeHandler);
};
} else {
if ((o is InteractiveObject)){
io = (o as InteractiveObject);
if (((((io) && (io.tabEnabled))) && ((findFocusManagerComponent(io) == io)))){
focusableObjects[io] = true;
calculateCandidates = true;
};
io.addEventListener(Event.TAB_ENABLED_CHANGE, tabEnabledChangeHandler);
io.addEventListener(Event.TAB_INDEX_CHANGE, tabIndexChangeHandler);
};
};
};
if ((o is DisplayObjectContainer)){
doc = DisplayObjectContainer(o);
o.addEventListener(Event.TAB_CHILDREN_CHANGE, tabChildrenChangeHandler);
if ((((((doc is Stage)) || ((doc.parent is Stage)))) || (doc.tabChildren))){
i = 0;
while (i < doc.numChildren) {
try {
child = doc.getChildAt(i);
if (child != null){
addFocusables(doc.getChildAt(i));
};
} catch(error:SecurityError) {
};
i = (i + 1);
};
};
};
}
private function getChildIndex(_arg1:DisplayObjectContainer, _arg2:DisplayObject):int{
return (_arg1.getChildIndex(_arg2));
}
private function mouseFocusChangeHandler(_arg1:FocusEvent):void{
if ((_arg1.relatedObject is TextField)){
return;
};
_arg1.preventDefault();
}
private function focusOutHandler(_arg1:FocusEvent):void{
var _local2:InteractiveObject;
_local2 = (_arg1.target as InteractiveObject);
}
private function isValidFocusCandidate(_arg1:DisplayObject, _arg2:String):Boolean{
var _local3:IFocusManagerGroup;
if (!isEnabledAndVisible(_arg1)){
return (false);
};
if ((_arg1 is IFocusManagerGroup)){
_local3 = IFocusManagerGroup(_arg1);
if (_arg2 == _local3.groupName){
return (false);
};
};
return (true);
}
public function findFocusManagerComponent(_arg1:InteractiveObject):InteractiveObject{
var _local2:InteractiveObject;
_local2 = _arg1;
while (_arg1) {
if ((((_arg1 is IFocusManagerComponent)) && (IFocusManagerComponent(_arg1).focusEnabled))){
return (_arg1);
};
_arg1 = _arg1.parent;
};
return (_local2);
}
private function sortFocusableObjectsTabIndex():void{
var _local1:Object;
var _local2:InteractiveObject;
focusableCandidates = [];
for (_local1 in focusableObjects) {
_local2 = InteractiveObject(_local1);
if (((_local2.tabIndex) && (!(isNaN(Number(_local2.tabIndex)))))){
focusableCandidates.push(_local2);
};
};
focusableCandidates.sort(sortByTabIndex);
}
private function removeFocusables(_arg1:DisplayObject):void{
var _local2:Object;
var _local3:DisplayObject;
if ((_arg1 is DisplayObjectContainer)){
_arg1.removeEventListener(Event.TAB_CHILDREN_CHANGE, tabChildrenChangeHandler);
_arg1.removeEventListener(Event.TAB_INDEX_CHANGE, tabIndexChangeHandler);
for (_local2 in focusableObjects) {
_local3 = DisplayObject(_local2);
if (DisplayObjectContainer(_arg1).contains(_local3)){
if (_local3 == lastFocus){
lastFocus = null;
};
_local3.removeEventListener(Event.TAB_ENABLED_CHANGE, tabEnabledChangeHandler);
delete focusableObjects[_local2];
calculateCandidates = true;
};
};
};
}
private function addedHandler(_arg1:Event):void{
var _local2:DisplayObject;
_local2 = DisplayObject(_arg1.target);
if (_local2.stage){
addFocusables(DisplayObject(_arg1.target));
};
}
private function getTopLevelFocusTarget(_arg1:InteractiveObject):InteractiveObject{
while (_arg1 != InteractiveObject(form)) {
if ((((((((_arg1 is IFocusManagerComponent)) && (IFocusManagerComponent(_arg1).focusEnabled))) && (IFocusManagerComponent(_arg1).mouseFocusEnabled))) && (UIComponent(_arg1).enabled))){
return (_arg1);
};
_arg1 = _arg1.parent;
if (_arg1 == null){
break;
};
};
return (null);
}
private function tabChildrenChangeHandler(_arg1:Event):void{
var _local2:DisplayObjectContainer;
if (_arg1.target != _arg1.currentTarget){
return;
};
calculateCandidates = true;
_local2 = DisplayObjectContainer(_arg1.target);
if (_local2.tabChildren){
addFocusables(_local2, true);
} else {
removeFocusables(_local2);
};
}
public function sendDefaultButtonEvent():void{
defButton.dispatchEvent(new MouseEvent(MouseEvent.CLICK));
}
public function getFocus():InteractiveObject{
var _local1:InteractiveObject;
_local1 = form.stage.focus;
return (findFocusManagerComponent(_local1));
}
private function isEnabledAndVisible(_arg1:DisplayObject):Boolean{
var _local2:DisplayObjectContainer;
var _local3:TextField;
var _local4:SimpleButton;
_local2 = DisplayObject(form).parent;
while (_arg1 != _local2) {
if ((_arg1 is UIComponent)){
if (!UIComponent(_arg1).enabled){
return (false);
};
} else {
if ((_arg1 is TextField)){
_local3 = TextField(_arg1);
if ((((_local3.type == TextFieldType.DYNAMIC)) || (!(_local3.selectable)))){
return (false);
};
} else {
if ((_arg1 is SimpleButton)){
_local4 = SimpleButton(_arg1);
if (!_local4.enabled){
return (false);
};
};
};
};
if (!_arg1.visible){
return (false);
};
_arg1 = _arg1.parent;
};
return (true);
}
public function set defaultButton(_arg1:Button):void{
var _local2:Button;
_local2 = (_arg1) ? Button(_arg1) : null;
if (_local2 != _defaultButton){
if (_defaultButton){
_defaultButton.emphasized = false;
};
if (defButton){
defButton.emphasized = false;
};
_defaultButton = _local2;
defButton = _local2;
if (_local2){
_local2.emphasized = true;
};
};
}
private function deactivateHandler(_arg1:Event):void{
var _local2:InteractiveObject;
_local2 = InteractiveObject(_arg1.target);
}
public function setFocus(_arg1:InteractiveObject):void{
if ((_arg1 is IFocusManagerComponent)){
IFocusManagerComponent(_arg1).setFocus();
} else {
form.stage.focus = _arg1;
};
}
private function setFocusToNextObject(_arg1:FocusEvent):void{
var _local2:InteractiveObject;
if (!hasFocusableObjects()){
return;
};
_local2 = getNextFocusManagerComponent(_arg1.shiftKey);
if (_local2){
setFocus(_local2);
};
}
private function hasFocusableObjects():Boolean{
var _local1:Object;
for (_local1 in focusableObjects) {
return (true);
};
return (false);
}
private function tabIndexChangeHandler(_arg1:Event):void{
calculateCandidates = true;
}
private function sortFocusableObjects():void{
var _local1:Object;
var _local2:InteractiveObject;
focusableCandidates = [];
for (_local1 in focusableObjects) {
_local2 = InteractiveObject(_local1);
if (((((_local2.tabIndex) && (!(isNaN(Number(_local2.tabIndex)))))) && ((_local2.tabIndex > 0)))){
sortFocusableObjectsTabIndex();
return;
};
focusableCandidates.push(_local2);
};
focusableCandidates.sort(sortByDepth);
}
private function keyFocusChangeHandler(_arg1:FocusEvent):void{
showFocusIndicator = true;
if ((((((_arg1.keyCode == Keyboard.TAB)) || ((_arg1.keyCode == 0)))) && (!(_arg1.isDefaultPrevented())))){
setFocusToNextObject(_arg1);
_arg1.preventDefault();
};
}
private function getIndexOfFocusedObject(_arg1:DisplayObject):int{
var _local2:int;
var _local3:int;
_local2 = focusableCandidates.length;
_local3 = 0;
_local3 = 0;
while (_local3 < _local2) {
if (focusableCandidates[_local3] == _arg1){
return (_local3);
};
_local3++;
};
return (-1);
}
public function hideFocus():void{
}
private function removedHandler(_arg1:Event):void{
var _local2:int;
var _local3:DisplayObject;
var _local4:InteractiveObject;
_local3 = DisplayObject(_arg1.target);
if ((((_local3 is IFocusManagerComponent)) && ((focusableObjects[_local3] == true)))){
if (_local3 == lastFocus){
IFocusManagerComponent(lastFocus).drawFocus(false);
lastFocus = null;
};
_local3.removeEventListener(Event.TAB_ENABLED_CHANGE, tabEnabledChangeHandler);
delete focusableObjects[_local3];
calculateCandidates = true;
} else {
if ((((_local3 is InteractiveObject)) && ((focusableObjects[_local3] == true)))){
_local4 = (_local3 as InteractiveObject);
if (_local4){
if (_local4 == lastFocus){
lastFocus = null;
};
delete focusableObjects[_local4];
calculateCandidates = true;
};
_local3.addEventListener(Event.TAB_ENABLED_CHANGE, tabEnabledChangeHandler);
};
};
removeFocusables(_local3);
}
private function sortByDepth(_arg1:InteractiveObject, _arg2:InteractiveObject):Number{
var _local3:String;
var _local4:String;
var _local5:int;
var _local6:String;
var _local7:String;
var _local8:String;
var _local9:DisplayObject;
var _local10:DisplayObject;
_local3 = "";
_local4 = "";
_local8 = "0000";
_local9 = DisplayObject(_arg1);
_local10 = DisplayObject(_arg2);
while (((!((_local9 == DisplayObject(form)))) && (_local9.parent))) {
_local5 = getChildIndex(_local9.parent, _local9);
_local6 = _local5.toString(16);
if (_local6.length < 4){
_local7 = (_local8.substring(0, (4 - _local6.length)) + _local6);
};
_local3 = (_local7 + _local3);
_local9 = _local9.parent;
};
while (((!((_local10 == DisplayObject(form)))) && (_local10.parent))) {
_local5 = getChildIndex(_local10.parent, _local10);
_local6 = _local5.toString(16);
if (_local6.length < 4){
_local7 = (_local8.substring(0, (4 - _local6.length)) + _local6);
};
_local4 = (_local7 + _local4);
_local10 = _local10.parent;
};
return (((_local3 > _local4)) ? 1 : ((_local3 < _local4)) ? -1 : 0);
}
public function get defaultButton():Button{
return (_defaultButton);
}
private function activateHandler(_arg1:Event):void{
var _local2:InteractiveObject;
_local2 = InteractiveObject(_arg1.target);
if (lastFocus){
if ((lastFocus is IFocusManagerComponent)){
IFocusManagerComponent(lastFocus).setFocus();
} else {
form.stage.focus = lastFocus;
};
};
lastAction = "ACTIVATE";
}
public function showFocus():void{
}
public function set defaultButtonEnabled(_arg1:Boolean):void{
_defaultButtonEnabled = _arg1;
}
public function getNextFocusManagerComponent(_arg1:Boolean=false):InteractiveObject{
var _local2:DisplayObject;
var _local3:String;
var _local4:int;
var _local5:Boolean;
var _local6:int;
var _local7:int;
var _local8:IFocusManagerGroup;
if (!hasFocusableObjects()){
return (null);
};
if (calculateCandidates){
sortFocusableObjects();
calculateCandidates = false;
};
_local2 = form.stage.focus;
_local2 = DisplayObject(findFocusManagerComponent(InteractiveObject(_local2)));
_local3 = "";
if ((_local2 is IFocusManagerGroup)){
_local8 = IFocusManagerGroup(_local2);
_local3 = _local8.groupName;
};
_local4 = getIndexOfFocusedObject(_local2);
_local5 = false;
_local6 = _local4;
if (_local4 == -1){
if (_arg1){
_local4 = focusableCandidates.length;
};
_local5 = true;
};
_local7 = getIndexOfNextObject(_local4, _arg1, _local5, _local3);
return (findFocusManagerComponent(focusableCandidates[_local7]));
}
private function mouseDownHandler(_arg1:MouseEvent):void{
var _local2:InteractiveObject;
if (_arg1.isDefaultPrevented()){
return;
};
_local2 = getTopLevelFocusTarget(InteractiveObject(_arg1.target));
if (!_local2){
return;
};
showFocusIndicator = false;
if (((((!((_local2 == lastFocus))) || ((lastAction == "ACTIVATE")))) && (!((_local2 is TextField))))){
setFocus(_local2);
};
lastAction = "MOUSEDOWN";
}
private function isTabVisible(_arg1:DisplayObject):Boolean{
var _local2:DisplayObjectContainer;
_local2 = _arg1.parent;
while (((((_local2) && (!((_local2 is Stage))))) && (!(((_local2.parent) && ((_local2.parent is Stage))))))) {
if (!_local2.tabChildren){
return (false);
};
_local2 = _local2.parent;
};
return (true);
}
public function get nextTabIndex():int{
return (0);
}
private function keyDownHandler(_arg1:KeyboardEvent):void{
if (_arg1.keyCode == Keyboard.TAB){
lastAction = "KEY";
if (calculateCandidates){
sortFocusableObjects();
calculateCandidates = false;
};
};
if (((((((defaultButtonEnabled) && ((_arg1.keyCode == Keyboard.ENTER)))) && (defaultButton))) && (defButton.enabled))){
sendDefaultButtonEvent();
};
}
private function focusInHandler(_arg1:FocusEvent):void{
var _local2:InteractiveObject;
var _local3:Button;
_local2 = InteractiveObject(_arg1.target);
if (form.contains(_local2)){
lastFocus = findFocusManagerComponent(InteractiveObject(_local2));
if ((lastFocus is Button)){
_local3 = Button(lastFocus);
if (defButton){
defButton.emphasized = false;
defButton = _local3;
_local3.emphasized = true;
};
} else {
if (((defButton) && (!((defButton == _defaultButton))))){
defButton.emphasized = false;
defButton = _defaultButton;
_defaultButton.emphasized = true;
};
};
};
}
private function tabEnabledChangeHandler(_arg1:Event):void{
var _local2:InteractiveObject;
var _local3:Boolean;
calculateCandidates = true;
_local2 = InteractiveObject(_arg1.target);
_local3 = (focusableObjects[_local2] == true);
if (_local2.tabEnabled){
if (((!(_local3)) && (isTabVisible(_local2)))){
if (!(_local2 is IFocusManagerComponent)){
_local2.focusRect = false;
};
focusableObjects[_local2] = true;
};
} else {
if (_local3){
delete focusableObjects[_local2];
};
};
}
public function set showFocusIndicator(_arg1:Boolean):void{
_showFocusIndicator = _arg1;
}
public function get form():DisplayObjectContainer{
return (_form);
}
private function sortByTabIndex(_arg1:InteractiveObject, _arg2:InteractiveObject):int{
return (((_arg1.tabIndex > _arg2.tabIndex)) ? 1 : ((_arg1.tabIndex < _arg2.tabIndex)) ? -1 : sortByDepth(_arg1, _arg2));
}
public function activate():void{
if (activated){
return;
};
form.stage.addEventListener(FocusEvent.MOUSE_FOCUS_CHANGE, mouseFocusChangeHandler, false, 0, true);
form.stage.addEventListener(FocusEvent.KEY_FOCUS_CHANGE, keyFocusChangeHandler, false, 0, true);
form.addEventListener(FocusEvent.FOCUS_IN, focusInHandler, true);
form.addEventListener(FocusEvent.FOCUS_OUT, focusOutHandler, true);
form.stage.addEventListener(Event.ACTIVATE, activateHandler, false, 0, true);
form.stage.addEventListener(Event.DEACTIVATE, deactivateHandler, false, 0, true);
form.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
form.addEventListener(KeyboardEvent.KEY_DOWN, keyDownHandler, true);
activated = true;
if (lastFocus){
setFocus(lastFocus);
};
}
public function deactivate():void{
form.stage.removeEventListener(FocusEvent.MOUSE_FOCUS_CHANGE, mouseFocusChangeHandler);
form.stage.removeEventListener(FocusEvent.KEY_FOCUS_CHANGE, keyFocusChangeHandler);
form.removeEventListener(FocusEvent.FOCUS_IN, focusInHandler, true);
form.removeEventListener(FocusEvent.FOCUS_OUT, focusOutHandler, true);
form.stage.removeEventListener(Event.ACTIVATE, activateHandler);
form.stage.removeEventListener(Event.DEACTIVATE, deactivateHandler);
form.removeEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
form.removeEventListener(KeyboardEvent.KEY_DOWN, keyDownHandler, true);
activated = false;
}
public function get defaultButtonEnabled():Boolean{
return (_defaultButtonEnabled);
}
}
}//package fl.managers
Section 122
//IFocusManager (fl.managers.IFocusManager)
package fl.managers {
import fl.controls.*;
import flash.display.*;
public interface IFocusManager {
function getFocus():InteractiveObject;
function deactivate():void;
function set defaultButton(_arg1:Button):void;
function set showFocusIndicator(_arg1:Boolean):void;
function get defaultButtonEnabled():Boolean;
function get nextTabIndex():int;
function get defaultButton():Button;
function get showFocusIndicator():Boolean;
function setFocus(_arg1:InteractiveObject):void;
function activate():void;
function showFocus():void;
function set defaultButtonEnabled(_arg1:Boolean):void;
function hideFocus():void;
function findFocusManagerComponent(_arg1:InteractiveObject):InteractiveObject;
function getNextFocusManagerComponent(_arg1:Boolean=false):InteractiveObject;
}
}//package fl.managers
Section 123
//IFocusManagerComponent (fl.managers.IFocusManagerComponent)
package fl.managers {
public interface IFocusManagerComponent {
function set focusEnabled(_arg1:Boolean):void;
function drawFocus(_arg1:Boolean):void;
function setFocus():void;
function get focusEnabled():Boolean;
function get tabEnabled():Boolean;
function get tabIndex():int;
function get mouseFocusEnabled():Boolean;
}
}//package fl.managers
Section 124
//IFocusManagerGroup (fl.managers.IFocusManagerGroup)
package fl.managers {
public interface IFocusManagerGroup {
function set groupName(_arg1:String):void;
function set selected(_arg1:Boolean):void;
function get groupName():String;
function get selected():Boolean;
}
}//package fl.managers
Section 125
//StyleManager (fl.managers.StyleManager)
package fl.managers {
import fl.core.*;
import flash.utils.*;
import flash.text.*;
public class StyleManager {
private var globalStyles:Object;
private var classToDefaultStylesDict:Dictionary;
private var styleToClassesHash:Object;
private var classToStylesDict:Dictionary;
private var classToInstancesDict:Dictionary;
private static var _instance:StyleManager;
public function StyleManager(){
styleToClassesHash = {};
classToInstancesDict = new Dictionary(true);
classToStylesDict = new Dictionary(true);
classToDefaultStylesDict = new Dictionary(true);
globalStyles = UIComponent.getStyleDefinition();
}
public static function clearComponentStyle(_arg1:Object, _arg2:String):void{
var _local3:Class;
var _local4:Object;
_local3 = getClassDef(_arg1);
_local4 = getInstance().classToStylesDict[_local3];
if (((!((_local4 == null))) && (!((_local4[_arg2] == null))))){
delete _local4[_arg2];
invalidateComponentStyle(_local3, _arg2);
};
}
private static function getClassDef(_arg1:Object):Class{
var component = _arg1;
if ((component is Class)){
return ((component as Class));
};
try {
return ((getDefinitionByName(getQualifiedClassName(component)) as Class));
} catch(e:Error) {
if ((component is UIComponent)){
try {
return ((component.loaderInfo.applicationDomain.getDefinition(getQualifiedClassName(component)) as Class));
} catch(e:Error) {
};
};
};
return (null);
}
public static function clearStyle(_arg1:String):void{
setStyle(_arg1, null);
}
public static function setComponentStyle(_arg1:Object, _arg2:String, _arg3:Object):void{
var _local4:Class;
var _local5:Object;
_local4 = getClassDef(_arg1);
_local5 = getInstance().classToStylesDict[_local4];
if (_local5 == null){
_local5 = (getInstance().classToStylesDict[_local4] = {});
};
if (_local5 == _arg3){
return;
};
_local5[_arg2] = _arg3;
invalidateComponentStyle(_local4, _arg2);
}
private static function setSharedStyles(_arg1:UIComponent):void{
var _local2:StyleManager;
var _local3:Class;
var _local4:Object;
var _local5:String;
_local2 = getInstance();
_local3 = getClassDef(_arg1);
_local4 = _local2.classToDefaultStylesDict[_local3];
for (_local5 in _local4) {
_arg1.setSharedStyle(_local5, getSharedStyle(_arg1, _local5));
};
}
public static function getComponentStyle(_arg1:Object, _arg2:String):Object{
var _local3:Class;
var _local4:Object;
_local3 = getClassDef(_arg1);
_local4 = getInstance().classToStylesDict[_local3];
return (((_local4)==null) ? null : _local4[_arg2]);
}
private static function getInstance(){
if (_instance == null){
_instance = new (StyleManager);
};
return (_instance);
}
private static function invalidateComponentStyle(_arg1:Class, _arg2:String):void{
var _local3:Dictionary;
var _local4:Object;
var _local5:UIComponent;
_local3 = getInstance().classToInstancesDict[_arg1];
if (_local3 == null){
return;
};
for (_local4 in _local3) {
_local5 = (_local4 as UIComponent);
if (_local5 == null){
} else {
_local5.setSharedStyle(_arg2, getSharedStyle(_local5, _arg2));
};
};
}
private static function invalidateStyle(_arg1:String):void{
var _local2:Dictionary;
var _local3:Object;
_local2 = getInstance().styleToClassesHash[_arg1];
if (_local2 == null){
return;
};
for (_local3 in _local2) {
invalidateComponentStyle(Class(_local3), _arg1);
};
}
public static function registerInstance(_arg1:UIComponent):void{
var inst:StyleManager;
var classDef:Class;
var target:Class;
var defaultStyles:Object;
var styleToClasses:Object;
var n:String;
var instance = _arg1;
inst = getInstance();
classDef = getClassDef(instance);
if (classDef == null){
return;
};
if (inst.classToInstancesDict[classDef] == null){
inst.classToInstancesDict[classDef] = new Dictionary(true);
target = classDef;
while (defaultStyles == null) {
if (target["getStyleDefinition"] != null){
defaultStyles = target["getStyleDefinition"]();
break;
};
try {
target = (instance.loaderInfo.applicationDomain.getDefinition(getQualifiedSuperclassName(target)) as Class);
} catch(err:Error) {
try {
target = (getDefinitionByName(getQualifiedSuperclassName(target)) as Class);
} catch(e:Error) {
defaultStyles = UIComponent.getStyleDefinition();
break;
};
};
};
styleToClasses = inst.styleToClassesHash;
for (n in defaultStyles) {
if (styleToClasses[n] == null){
styleToClasses[n] = new Dictionary(true);
};
styleToClasses[n][classDef] = true;
};
inst.classToDefaultStylesDict[classDef] = defaultStyles;
inst.classToStylesDict[classDef] = {};
};
inst.classToInstancesDict[classDef][instance] = true;
setSharedStyles(instance);
}
public static function getStyle(_arg1:String):Object{
return (getInstance().globalStyles[_arg1]);
}
private static function getSharedStyle(_arg1:UIComponent, _arg2:String):Object{
var _local3:Class;
var _local4:StyleManager;
var _local5:Object;
_local3 = getClassDef(_arg1);
_local4 = getInstance();
_local5 = _local4.classToStylesDict[_local3][_arg2];
if (_local5 != null){
return (_local5);
};
_local5 = _local4.globalStyles[_arg2];
if (_local5 != null){
return (_local5);
};
return (_local4.classToDefaultStylesDict[_local3][_arg2]);
}
public static function setStyle(_arg1:String, _arg2:Object):void{
var _local3:Object;
_local3 = getInstance().globalStyles;
if ((((_local3[_arg1] === _arg2)) && (!((_arg2 is TextFormat))))){
return;
};
_local3[_arg1] = _arg2;
invalidateStyle(_arg1);
}
}
}//package fl.managers
Section 126
//BaseCM (BaseCM)
package {
import flash.display.*;
public dynamic class BaseCM extends MovieClip {
}
}//package
Section 127
//basetta (basetta)
package {
import away3d.core.mesh.*;
import away3d.core.utils.*;
public class basetta extends Mesh {
private var uvarr:Array;
private var varr:Array;
private var scaling:Number;
public function basetta(_arg1:Object=null){
varr = [];
uvarr = [];
super(_arg1);
_arg1 = Init.parse(_arg1);
scaling = _arg1.getNumber("scaling", 1);
build();
type = ".as";
}
private function f(_arg1:int, _arg2:int, _arg3:int, _arg4:int, _arg5:int, _arg6:int):void{
addFace(new Face(varr[_arg1], varr[_arg2], varr[_arg3], null, uvarr[_arg4], uvarr[_arg5], uvarr[_arg6]));
}
private function build():void{
v(17.67767, 17.677668, 7.025973);
v(-1E-6, 20.118446, 0);
v(20.273087, 0, 0);
v(25, 0, 7.025974);
v(-1E-6, 24.999998, 7.025974);
v(-17.67767, 17.677668, 7.025973);
v(-25, -2E-6, 7.025974);
v(-20.273087, -2E-6, 0);
v(-17.677666, -17.677675, 7.025974);
v(1E-6, -20.11845, 0);
v(0, -25.000002, 7.025973);
v(17.677668, -17.677673, 7.025974);
v(-9E-6, 9.922903, 26.049885);
v(1E-5, -9.934444, 26.049881);
uv(-0.170103, 0.337895);
uv(0.8831, 0.09713);
uv(-0.324733, 0.09713);
uv(-0.606354, 0.337895);
uv(0.8831, 0.337895);
uv(0.902764, 0.337246);
uv(-0.102997, 0.337246);
uv(0.902764, 0.094228);
uv(-0.519598, 0.337246);
uv(-0.250663, 0.094228);
uv(-0.102998, 0.337246);
uv(0.902764, 0.094228);
uv(0.902763, 0.337246);
uv(0.8831, 0.337895);
uv(-0.170103, 0.337895);
uv(0.8831, 0.09713);
uv(1.936302, 0.337895);
uv(1.936302, 0.337895);
uv(0.8831, 0.989804);
uv(0.902763, 0.995258);
uv(0.902764, 0.995258);
uv(0.883099, 0.989804);
f(0, 1, 2, 0, 1, 2);
f(2, 3, 0, 2, 3, 0);
f(0, 4, 1, 0, 4, 1);
f(4, 5, 1, 5, 6, 7);
f(6, 7, 1, 8, 9, 7);
f(1, 5, 6, 7, 6, 8);
f(8, 9, 7, 10, 11, 9);
f(7, 6, 8, 9, 8, 10);
f(8, 10, 9, 10, 12, 11);
f(10, 11, 9, 13, 14, 15);
f(3, 2, 9, 3, 2, 15);
f(9, 11, 3, 15, 14, 3);
f(8, 6, 5, 10, 8, 6);
f(11, 8, 5, 14, 16, 17);
f(11, 5, 0, 14, 17, 0);
f(11, 0, 3, 14, 0, 3);
f(4, 0, 12, 4, 0, 18);
f(5, 4, 12, 6, 5, 19);
f(0, 5, 12, 0, 17, 18);
f(10, 8, 13, 12, 10, 20);
f(11, 10, 13, 14, 13, 21);
f(8, 11, 13, 16, 14, 21);
}
private function uv(_arg1:Number, _arg2:Number):void{
uvarr.push(new UV(_arg1, _arg2));
}
private function v(_arg1:Number, _arg2:Number, _arg3:Number):void{
varr.push(new Vertex((_arg1 * scaling), (_arg2 * scaling), (_arg3 * scaling)));
}
}
}//package
Section 128
//BombaM (BombaM)
package {
import flash.display.*;
public dynamic class BombaM extends MovieClip {
}
}//package
Section 129
//BombaSND (BombaSND)
package {
import flash.media.*;
public dynamic class BombaSND extends Sound {
}
}//package
Section 130
//cannone (cannone)
package {
import away3d.core.mesh.*;
import away3d.core.utils.*;
public class cannone extends Mesh {
private var uvarr:Array;
private var varr:Array;
private var scaling:Number;
public function cannone(_arg1:Object=null){
varr = [];
uvarr = [];
super(_arg1);
_arg1 = Init.parse(_arg1);
scaling = _arg1.getNumber("scaling", 1);
build();
type = ".as";
}
private function f(_arg1:int, _arg2:int, _arg3:int, _arg4:int, _arg5:int, _arg6:int):void{
addFace(new Face(varr[_arg1], varr[_arg2], varr[_arg3], null, uvarr[_arg4], uvarr[_arg5], uvarr[_arg6]));
}
private function build():void{
v(-9.524016, -9.658616, -6.125313);
v(10.313067, -9.658616, -6.125313);
v(0.394527, 0.019523, -15.590538);
v(10.313067, 9.697667, -6.125313);
v(-9.524016, 9.697667, -6.125313);
v(-9.524016, -9.658616, 6.908768);
v(10.313067, -9.658616, 6.908772);
v(10.313067, 9.697663, 6.908768);
v(10.313067, 9.697667, 6.908768);
v(-9.524016, 9.697667, 6.908768);
v(-9.524016, 9.697667, 6.908768);
v(0.574844, -19.709126, 26.338264);
v(14.869161, -14.106729, 26.338264);
v(20.635056, -0.202323, 26.338264);
v(14.869161, 14.136554, 26.338264);
v(0.427862, 19.828817, 26.338264);
v(-14.075671, 14.136554, 26.338264);
v(-19.884979, -0.202323, 26.338264);
v(-14.075671, -14.106729, 26.338264);
v(2.770221, -5.463128, 74.277267);
v(-5.161201, -2.331507, 74.277267);
v(5.990687, 2.202669, 74.277267);
v(-1.900178, 5.418467, 74.277267);
v(0.447388, -0.051145, 55.738049);
uv(0.255944, 0.105718);
uv(0.745017, 0.105718);
uv(0.50048, 0.000499);
uv(0.254445, 0.105718);
uv(0.743518, 0.105718);
uv(0.498981, 0.000499);
uv(0.254983, 0.105718);
uv(0.744056, 0.105718);
uv(0.499519, 0.000499);
uv(0.256482, 0.105718);
uv(0.745555, 0.105718);
uv(0.501019, 0.000499);
uv(0.255944, 0.250609);
uv(0.745017, 0.250609);
uv(0.254445, 0.105718);
uv(0.254445, 0.250609);
uv(0.743518, 0.250609);
uv(0.743518, 0.250609);
uv(0.254983, 0.105718);
uv(0.254983, 0.250609);
uv(0.744056, 0.250609);
uv(0.744056, 0.250609);
uv(0.256482, 0.105718);
uv(0.256482, 0.250609);
uv(0.745555, 0.250609);
uv(0.745555, 0.105718);
uv(0.504926, 0.466594);
uv(0.857345, 0.466594);
uv(0.493376, 0.466594);
uv(0.855675, 0.466594);
uv(0.498698, 0.466594);
uv(0.856275, 0.466594);
uv(0.506624, 0.466594);
uv(0.857945, 0.466594);
uv(0.745555, 0.250609);
uv(0.143725, 0.466594);
uv(0.256482, 0.250609);
uv(0.144325, 0.466594);
uv(0.254445, 0.250609);
uv(0.142055, 0.466594);
uv(0.254983, 0.250609);
uv(0.142655, 0.466594);
uv(0.254445, 0.250609);
uv(0.745555, 0.250609);
uv(0.256482, 0.250609);
uv(0.254983, 0.250609);
uv(0.559052, 0.9995);
uv(0.143725, 0.466594);
uv(0.363507, 0.9995);
uv(0.554142, 0.9995);
uv(0.142055, 0.466594);
uv(0.360452, 0.9995);
uv(0.556094, 0.9995);
uv(0.142655, 0.466594);
uv(0.361549, 0.9995);
uv(0.560422, 0.9995);
uv(0.144325, 0.466594);
uv(0.364604, 0.9995);
uv(0.560422, 0.9995);
uv(0.440948, 0.9995);
uv(0.636493, 0.9995);
uv(0.498216, 0.992361);
uv(0.497196, 0.992361);
uv(0.439578, 0.9995);
uv(0.635396, 0.9995);
uv(0.502804, 0.992361);
uv(0.445858, 0.9995);
uv(0.639548, 0.9995);
uv(0.443906, 0.9995);
uv(0.638451, 0.9995);
uv(0.501784, 0.992361);
f(0, 1, 2, 0, 1, 2);
f(1, 3, 2, 3, 4, 5);
f(3, 4, 2, 6, 7, 8);
f(4, 0, 2, 9, 10, 11);
f(0, 5, 6, 0, 12, 13);
f(6, 1, 0, 13, 1, 0);
f(1, 6, 7, 14, 15, 16);
f(1, 7, 8, 14, 16, 17);
f(1, 8, 3, 14, 17, 4);
f(3, 8, 9, 18, 19, 20);
f(3, 9, 10, 18, 20, 21);
f(3, 10, 4, 18, 21, 7);
f(4, 10, 5, 22, 23, 24);
f(5, 0, 4, 24, 25, 22);
f(11, 12, 6, 26, 27, 13);
f(7, 13, 14, 16, 28, 29);
f(14, 8, 7, 29, 17, 16);
f(10, 9, 15, 21, 20, 30);
f(15, 16, 10, 30, 31, 21);
f(17, 18, 5, 32, 33, 34);
f(5, 18, 11, 12, 35, 26);
f(10, 16, 17, 36, 37, 32);
f(6, 12, 13, 38, 39, 28);
f(8, 14, 15, 40, 41, 30);
f(7, 6, 13, 16, 42, 28);
f(6, 5, 11, 13, 12, 26);
f(5, 10, 17, 43, 44, 32);
f(9, 8, 15, 20, 45, 30);
f(19, 11, 18, 46, 26, 47);
f(18, 20, 19, 47, 48, 46);
f(19, 12, 11, 46, 27, 26);
f(21, 13, 12, 49, 28, 50);
f(12, 19, 21, 50, 51, 49);
f(21, 14, 13, 49, 29, 28);
f(22, 15, 14, 52, 30, 53);
f(14, 21, 22, 53, 54, 52);
f(22, 16, 15, 52, 31, 30);
f(20, 17, 16, 55, 32, 56);
f(16, 22, 20, 56, 57, 55);
f(20, 18, 17, 58, 33, 32);
f(19, 20, 23, 59, 60, 61);
f(23, 20, 22, 62, 63, 64);
f(23, 21, 19, 65, 66, 67);
f(22, 21, 23, 68, 69, 70);
}
private function uv(_arg1:Number, _arg2:Number):void{
uvarr.push(new UV(_arg1, _arg2));
}
private function v(_arg1:Number, _arg2:Number, _arg3:Number):void{
varr.push(new Vertex((_arg1 * scaling), (_arg2 * scaling), (_arg3 * scaling)));
}
}
}//package
Section 131
//CannoneM (CannoneM)
package {
import flash.display.*;
public dynamic class CannoneM extends MovieClip {
}
}//package
Section 132
//Carro (Carro)
package {
import away3d.core.mesh.*;
import away3d.core.utils.*;
public class Carro extends Mesh {
private var uvarr:Array;
private var varr:Array;
private var scaling:Number;
public function Carro(_arg1:Object=null){
varr = [];
uvarr = [];
super(_arg1);
_arg1 = Init.parse(_arg1);
scaling = _arg1.getNumber("scaling", 1);
build();
type = ".as";
}
private function f(_arg1:int, _arg2:int, _arg3:int, _arg4:int, _arg5:int, _arg6:int):void{
addFace(new Face(varr[_arg1], varr[_arg2], varr[_arg3], null, uvarr[_arg4], uvarr[_arg5], uvarr[_arg6]));
}
private function build():void{
v(-10.569008, 4.701636, -7.946726);
v(-10.569008, -4.701636, -7.946728);
v(-20.003168, -4.701636, -7.946728);
v(-20.003168, 4.701636, -7.946726);
v(-31.332539, -10.000001, -18.134729);
v(-21.570679, -8.467807, -14.661046);
v(-9.001495, -8.467807, -14.661046);
v(8.667462, -10.000001, -18.134729);
v(8.667462, -10.000002, -22.50284);
v(8.667462, 9.999998, -22.502842);
v(2.246115, 9.254188, -26);
v(2.246115, -9.254188, -26);
v(8.667462, 9.999999, -18.134726);
v(-31.332539, 9.999999, -18.134726);
v(-31.332539, 9.999998, -22.502842);
v(-31.332539, -10.000002, -22.50284);
v(-24.728165, -9.254188, -26);
v(-24.728165, 9.254188, -26);
v(-9.001495, 8.467808, -14.661044);
v(-21.570679, 8.467808, -14.661044);
v(-10.299836, 0.625239, -10.444788);
v(14.646411, 0.826039, -10.096987);
v(14.646411, -1.677251, -11.542261);
v(-10.299836, -1.275642, -11.542262);
v(-10.299836, 0.625239, -12.639736);
v(14.646411, 0.826039, -12.987535);
uv(0.518636, 0.84803);
uv(0.518636, 0.588873);
uv(0.283214, 0.588873);
uv(0.283215, 0.848031);
uv(0.000499, 0.435734);
uv(0.244302, 0.627955);
uv(0.558218, 0.627955);
uv(0.9995, 0.435734);
uv(0.998666, 0.442847);
uv(0.998666, 0.994055);
uv(0.838427, 0.9735);
uv(0.838427, 0.463402);
uv(0.999501, 0.194019);
uv(0.999501, 0.435734);
uv(0.0005, 0.435734);
uv(0.0005, 0.194019);
uv(0.0005, 0.994056);
uv(0.0005, 0.442848);
uv(0.165306, 0.463403);
uv(0.165306, 0.973501);
uv(0.998666, 0.442847);
uv(0.998666, 0.994055);
uv(0.0005, 0.994056);
uv(0.0005, 0.442848);
uv(0.557752, 0.485075);
uv(0.557752, 0.951828);
uv(0.244099, 0.951828);
uv(0.244098, 0.485075);
uv(0.519069, 0.9995);
uv(0.283451, 0.9995);
uv(0.283451, 0.9995);
uv(0.244302, 0.627955);
uv(0.558218, 0.627955);
uv(0.519069, 0.9995);
uv(0.165444, 0.0005);
uv(0.839127, 0.0005);
uv(0.9995, 0.194019);
uv(0.839127, 0.0005);
uv(0.165444, 0.0005);
uv(0.000499, 0.194019);
uv(0.930758, 0.099422);
uv(0.965717, 0.099422);
uv(0.965717, 0.045156);
uv(0.930758, 0.045156);
uv(0.930758, 0.099422);
uv(0.965717, 0.099422);
f(0, 1, 2, 0, 1, 2);
f(2, 3, 0, 2, 3, 0);
f(4, 5, 6, 4, 5, 6);
f(6, 7, 4, 6, 7, 4);
f(8, 9, 10, 8, 9, 10);
f(10, 11, 8, 10, 11, 8);
f(9, 12, 13, 12, 13, 14);
f(13, 14, 9, 14, 15, 12);
f(14, 15, 16, 16, 17, 18);
f(16, 17, 14, 18, 19, 16);
f(8, 7, 12, 8, 20, 21);
f(12, 9, 8, 21, 9, 8);
f(14, 13, 4, 16, 22, 23);
f(4, 15, 14, 23, 17, 16);
f(7, 6, 18, 20, 24, 25);
f(18, 12, 7, 25, 21, 20);
f(13, 19, 5, 22, 26, 27);
f(5, 4, 13, 27, 23, 22);
f(1, 6, 5, 28, 6, 5);
f(5, 2, 1, 5, 29, 28);
f(0, 18, 6, 0, 25, 24);
f(6, 1, 0, 24, 1, 0);
f(3, 19, 18, 30, 31, 32);
f(18, 0, 3, 32, 33, 30);
f(2, 5, 19, 2, 27, 26);
f(19, 3, 2, 26, 3, 2);
f(17, 10, 9, 34, 35, 12);
f(9, 14, 17, 12, 15, 34);
f(18, 19, 13, 32, 31, 14);
f(13, 12, 18, 14, 13, 32);
f(8, 11, 16, 36, 37, 38);
f(16, 15, 8, 38, 39, 36);
f(15, 4, 7, 39, 4, 7);
f(7, 8, 15, 7, 36, 39);
f(20, 21, 22, 40, 41, 42);
f(22, 23, 20, 42, 43, 40);
f(24, 25, 21, 44, 45, 41);
f(21, 20, 24, 41, 40, 44);
f(23, 22, 25, 43, 42, 45);
f(25, 24, 23, 45, 44, 43);
}
private function uv(_arg1:Number, _arg2:Number):void{
uvarr.push(new UV(_arg1, _arg2));
}
private function v(_arg1:Number, _arg2:Number, _arg3:Number):void{
varr.push(new Vertex((_arg1 * scaling), (_arg2 * scaling), (_arg3 * scaling)));
}
}
}//package
Section 133
//CarroM (CarroM)
package {
import flash.display.*;
public dynamic class CarroM extends MovieClip {
}
}//package
Section 134
//CarroM2 (CarroM2)
package {
import flash.display.*;
public dynamic class CarroM2 extends MovieClip {
}
}//package
Section 135
//cursore (cursore)
package {
import flash.display.*;
public dynamic class cursore extends MovieClip {
}
}//package
Section 136
//Esplosione (Esplosione)
package {
import flash.display.*;
public dynamic class Esplosione extends MovieClip {
public var esp:MovieClip;
}
}//package
Section 137
//focusRectSkin (focusRectSkin)
package {
import flash.display.*;
public dynamic class focusRectSkin extends MovieClip {
}
}//package
Section 138
//Laserhit2 (Laserhit2)
package {
import flash.media.*;
public dynamic class Laserhit2 extends Sound {
}
}//package
Section 139
//LaserSND (LaserSND)
package {
import flash.media.*;
public dynamic class LaserSND extends Sound {
}
}//package
Section 140
//Ombra (Ombra)
package {
import flash.display.*;
public dynamic class Ombra extends MovieClip {
}
}//package
Section 141
//Orca (Orca)
package {
import away3d.core.mesh.*;
import away3d.core.utils.*;
public class Orca extends Mesh {
private var uvarr:Array;
private var varr:Array;
private var scaling:Number;
public function Orca(_arg1:Object=null){
varr = [];
uvarr = [];
super(_arg1);
_arg1 = Init.parse(_arg1);
scaling = _arg1.getNumber("scaling", 1);
build();
type = ".as";
}
private function f(_arg1:int, _arg2:int, _arg3:int, _arg4:int, _arg5:int, _arg6:int):void{
addFace(new Face(varr[_arg1], varr[_arg2], varr[_arg3], null, uvarr[_arg4], uvarr[_arg5], uvarr[_arg6]));
}
private function build():void{
v(10.623873, -2.937019, -2.023293);
v(10.623873, -2.937018, 2.023293);
v(13.540533, 0, -2.016551);
v(3.459759, -4.500249, 4.214995);
v(3.459757, -4.500249, 0.160003);
v(-16.939747, -15.663319, 1.014288);
v(-16.939747, -15.663319, -1.014288);
v(-20.703941, -15.801134, 0);
v(-7.104272, -3.673355, -0.477708);
v(-7.104271, -3.673355, 4.214995);
v(-25.803818, -1.468303, 1.221285);
v(-25.803818, -1.468304, -1.221284);
v(-30.660841, -5.189327, 1.221285);
v(-30.660841, -5.189327, -1.221284);
v(-34.303612, -5.051512, 0);
v(-34.303612, 5.05151, 1E-6);
v(-30.660841, 5.189327, -1.221284);
v(-30.660841, 5.189327, 1.221285);
v(-25.803818, 1.468303, 1.221285);
v(-25.803818, 1.468303, -1.221284);
v(-7.104271, 3.673354, 4.214995);
v(-7.104272, 3.673354, -0.477708);
v(-20.703941, 15.801134, 0);
v(-16.939747, 15.663321, -1.014287);
v(-16.939747, 15.663321, 1.014289);
v(3.459759, 4.500248, 4.214995);
v(3.459757, 4.500248, 0.160003);
v(10.623873, 2.937018, 2.023294);
v(10.623873, 2.937018, -2.023293);
v(-32.11795, 0, 0);
uv(0.9386, 0.592844);
uv(0.9386, 0.592844);
uv(0.9995, 0.5);
uv(0.789011, 0.64226);
uv(0.789011, 0.64226);
uv(0.363063, 0.995144);
uv(0.363063, 0.995144);
uv(0.284465, 0.999501);
uv(0.56843, 0.616121);
uv(0.56843, 0.616121);
uv(0.177978, 0.546416);
uv(0.177978, 0.546416);
uv(0.076562, 0.664043);
uv(0.076562, 0.664043);
uv(0.0005, 0.659687);
uv(0.0005, 0.340313);
uv(0.076562, 0.335957);
uv(0.076562, 0.335957);
uv(0.177978, 0.453584);
uv(0.177978, 0.453585);
uv(0.56843, 0.383879);
uv(0.56843, 0.383879);
uv(0.284465, 0.0005);
uv(0.363063, 0.004856);
uv(0.363063, 0.004856);
uv(0.789011, 0.357739);
uv(0.789011, 0.357739);
uv(0.9386, 0.407156);
uv(0.9386, 0.407156);
uv(0.046137, 0.5);
f(0, 1, 2, 0, 1, 2);
f(3, 1, 0, 3, 1, 0);
f(0, 4, 3, 0, 4, 3);
f(5, 3, 4, 5, 3, 4);
f(4, 6, 5, 4, 6, 5);
f(6, 7, 5, 6, 7, 5);
f(7, 8, 9, 7, 8, 9);
f(10, 9, 8, 10, 9, 8);
f(8, 11, 10, 8, 11, 10);
f(12, 10, 11, 12, 10, 11);
f(11, 13, 12, 11, 13, 12);
f(13, 14, 12, 13, 14, 12);
f(15, 16, 17, 15, 16, 17);
f(18, 17, 16, 18, 17, 16);
f(16, 19, 18, 16, 19, 18);
f(20, 18, 19, 20, 18, 19);
f(19, 21, 20, 19, 21, 20);
f(21, 22, 20, 21, 22, 20);
f(22, 23, 24, 22, 23, 24);
f(25, 24, 23, 25, 24, 23);
f(23, 26, 25, 23, 26, 25);
f(27, 25, 26, 27, 25, 26);
f(26, 28, 27, 26, 28, 27);
f(28, 2, 27, 28, 2, 27);
f(27, 2, 1, 27, 2, 1);
f(5, 7, 9, 5, 7, 9);
f(3, 5, 9, 3, 5, 9);
f(12, 14, 29, 12, 14, 29);
f(10, 12, 29, 10, 12, 29);
f(29, 15, 17, 29, 15, 17);
f(29, 17, 18, 29, 17, 18);
f(10, 29, 18, 10, 29, 18);
f(9, 10, 18, 9, 10, 18);
f(9, 18, 20, 9, 18, 20);
f(3, 9, 20, 3, 9, 20);
f(20, 22, 24, 20, 22, 24);
f(20, 24, 25, 20, 24, 25);
f(3, 20, 25, 3, 20, 25);
f(1, 3, 25, 1, 3, 25);
f(27, 1, 25, 27, 1, 25);
}
private function uv(_arg1:Number, _arg2:Number):void{
uvarr.push(new UV(_arg1, _arg2));
}
private function v(_arg1:Number, _arg2:Number, _arg3:Number):void{
varr.push(new Vertex((_arg1 * scaling), (_arg2 * scaling), (_arg3 * scaling)));
}
}
}//package
Section 142
//OrcaM (OrcaM)
package {
import flash.display.*;
public dynamic class OrcaM extends MovieClip {
}
}//package
Section 143
//OrcaM2 (OrcaM2)
package {
import flash.display.*;
public dynamic class OrcaM2 extends MovieClip {
}
}//package
Section 144
//Proiettile (Proiettile)
package {
import flash.display.*;
public dynamic class Proiettile extends MovieClip {
}
}//package
Section 145
//SliderThumb_disabledSkin (SliderThumb_disabledSkin)
package {
import flash.display.*;
public dynamic class SliderThumb_disabledSkin extends MovieClip {
}
}//package
Section 146
//SliderThumb_downSkin (SliderThumb_downSkin)
package {
import flash.display.*;
public dynamic class SliderThumb_downSkin extends MovieClip {
}
}//package
Section 147
//SliderThumb_overSkin (SliderThumb_overSkin)
package {
import flash.display.*;
public dynamic class SliderThumb_overSkin extends MovieClip {
}
}//package
Section 148
//SliderThumb_upSkin (SliderThumb_upSkin)
package {
import flash.display.*;
public dynamic class SliderThumb_upSkin extends MovieClip {
}
}//package
Section 149
//SliderTick_skin (SliderTick_skin)
package {
import flash.display.*;
public dynamic class SliderTick_skin extends MovieClip {
}
}//package
Section 150
//SliderTrack_disabledSkin (SliderTrack_disabledSkin)
package {
import flash.display.*;
public dynamic class SliderTrack_disabledSkin extends MovieClip {
}
}//package
Section 151
//SliderTrack_skin (SliderTrack_skin)
package {
import flash.display.*;
public dynamic class SliderTrack_skin extends MovieClip {
}
}//package
Section 152
//Terreno (Terreno)
package {
import flash.display.*;
public dynamic class Terreno extends MovieClip {
}
}//package
Section 153
//UFO (UFO)
package {
import away3d.core.mesh.*;
import away3d.core.utils.*;
public class UFO extends Mesh {
private var uvarr:Array;
private var varr:Array;
private var scaling:Number;
public function UFO(_arg1:Object=null){
varr = [];
uvarr = [];
super(_arg1);
_arg1 = Init.parse(_arg1);
scaling = _arg1.getNumber("scaling", 1);
build();
type = ".as";
}
private function f(_arg1:int, _arg2:int, _arg3:int, _arg4:int, _arg5:int, _arg6:int):void{
addFace(new Face(varr[_arg1], varr[_arg2], varr[_arg3], null, uvarr[_arg4], uvarr[_arg5], uvarr[_arg6]));
}
private function build():void{
v(-15.294402, 19.695013, 2.500898);
v(1.00767, 19.637836, 2.500898);
v(-8.266949, 0.037998, 10.28839);
v(-26.862141, 5.588341, 2.500898);
v(-15.432444, -19.661674, 2.500898);
v(-26.919319, -5.474141, 2.500898);
v(0.869628, -19.718853, 2.500898);
v(4.461284, -0.096935, 1.752796);
v(-18.642082, 27.857893, -2.709533);
v(4.41253, 27.777029, -2.709533);
v(-35.744808, 0.118965, 1.043307);
v(-18.837303, -27.800867, -2.709533);
v(4.217307, -27.881733, -2.709533);
v(12.571881, -3.050985, -1.659751);
v(18.979336, -0.109117, 2.325415);
v(20.106953, 2.826514, -1.087133);
v(20.026077, -3.059351, -1.087132);
v(12.652759, 2.834881, -1.659751);
v(-15.294402, 19.695013, -7.919964);
v(1.00767, 19.637835, -7.919964);
v(-26.890728, 0.057098, -7.919964);
v(-15.432444, -19.661673, -7.919964);
v(0.869628, -19.718853, -7.919964);
v(7.844237, -0.096934, -7.919963);
v(-36.510345, 0.156934, 15.024684);
uv(0.212739, 0.417263);
uv(0.427152, 0.417263);
uv(0.378698, 0.767796);
uv(0.113581, 0.417263);
uv(0.358331, 0.417263);
uv(0.154263, 0.417263);
uv(0.572744, 0.417263);
uv(0.985958, 0.806191);
uv(0.896272, 0.642391);
uv(0.813187, 0.804158);
uv(0.901204, 0.978855);
uv(0.138179, 0.182729);
uv(0.441405, 0.182729);
uv(0.017353, 0.351653);
uv(0.344078, 0.182729);
uv(0.647304, 0.182729);
uv(0.546445, 0.383589);
uv(0.664077, 0.229982);
uv(0.988239, 0.358466);
uv(0.815965, 0.353855);
uv(0.814089, 0.352402);
uv(0.643095, 0.229982);
uv(0.212739, -0.051805);
uv(0.427152, -0.051805);
uv(0.133922, -0.051805);
uv(0.358331, -0.051805);
uv(0.572744, -0.051805);
uv(0.590894, -0.051805);
uv(0.818818, 0.020525);
uv(0.987338, 0.013638);
uv(0.820695, 0.020101);
uv(0.007153, 0.980987);
f(0, 1, 2, 0, 1, 2);
f(3, 0, 2, 3, 0, 2);
f(4, 5, 2, 4, 5, 2);
f(6, 4, 2, 6, 4, 2);
f(7, 6, 2, 7, 8, 9);
f(1, 7, 2, 10, 7, 9);
f(1, 0, 8, 1, 0, 11);
f(8, 9, 1, 11, 12, 1);
f(0, 3, 10, 0, 3, 13);
f(10, 8, 0, 13, 11, 0);
f(5, 4, 11, 5, 4, 14);
f(11, 10, 5, 14, 13, 5);
f(4, 6, 12, 4, 6, 15);
f(12, 11, 4, 15, 14, 4);
f(6, 7, 13, 6, 16, 17);
f(13, 12, 6, 17, 15, 6);
f(14, 15, 16, 18, 19, 20);
f(7, 1, 9, 16, 1, 12);
f(9, 17, 7, 12, 21, 16);
f(9, 8, 18, 12, 11, 22);
f(18, 19, 9, 22, 23, 12);
f(8, 10, 20, 11, 13, 24);
f(20, 18, 8, 24, 22, 11);
f(10, 11, 21, 13, 14, 25);
f(21, 20, 10, 25, 24, 13);
f(11, 12, 22, 14, 15, 26);
f(22, 21, 11, 26, 25, 14);
f(12, 13, 23, 15, 17, 27);
f(23, 22, 12, 27, 26, 15);
f(17, 23, 13, 21, 27, 17);
f(17, 9, 19, 21, 12, 23);
f(19, 23, 17, 23, 27, 21);
f(16, 13, 7, 20, 28, 29);
f(7, 14, 16, 29, 18, 20);
f(14, 7, 17, 18, 29, 30);
f(17, 15, 14, 30, 19, 18);
f(24, 3, 2, 31, 3, 2);
f(24, 10, 3, 31, 13, 3);
f(24, 5, 10, 31, 5, 13);
f(24, 2, 5, 31, 2, 5);
}
private function uv(_arg1:Number, _arg2:Number):void{
uvarr.push(new UV(_arg1, _arg2));
}
private function v(_arg1:Number, _arg2:Number, _arg3:Number):void{
varr.push(new Vertex((_arg1 * scaling), (_arg2 * scaling), (_arg3 * scaling)));
}
}
}//package
Section 154
//UFOM (UFOM)
package {
import flash.display.*;
public dynamic class UFOM extends MovieClip {
}
}//package