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
//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 8
//DrawTriangle (away3d.core.draw.DrawTriangle)
package away3d.core.draw {
import flash.display.*;
import flash.geom.*;
import away3d.core.mesh.*;
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 9
//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 10
//AlphaBitmapMaterial (away3d.core.material.AlphaBitmapMaterial)
package away3d.core.material {
import away3d.core.math.*;
import flash.display.*;
import away3d.core.render.*;
import away3d.core.scene.*;
import flash.geom.*;
import away3d.core.draw.*;
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 11
//BitmapMaterial (away3d.core.material.BitmapMaterial)
package away3d.core.material {
import away3d.core.math.*;
import flash.display.*;
import away3d.core.render.*;
import away3d.core.scene.*;
import flash.geom.*;
import away3d.core.draw.*;
import away3d.core.mesh.*;
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 12
//BitmapMaterialContainer (away3d.core.material.BitmapMaterialContainer)
package away3d.core.material {
import flash.display.*;
import flash.geom.*;
import away3d.core.draw.*;
import away3d.core.mesh.*;
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 13
//CenterLightingMaterial (away3d.core.material.CenterLightingMaterial)
package away3d.core.material {
import away3d.core.math.*;
import flash.display.*;
import away3d.core.render.*;
import away3d.core.scene.*;
import away3d.core.draw.*;
import away3d.core.mesh.*;
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 14
//ColorMaterial (away3d.core.material.ColorMaterial)
package away3d.core.material {
import away3d.core.math.*;
import flash.display.*;
import away3d.core.render.*;
import away3d.core.scene.*;
import away3d.core.draw.*;
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 15
//IMaterial (away3d.core.material.IMaterial)
package away3d.core.material {
public interface IMaterial {
function get visible():Boolean;
}
}//package away3d.core.material
Section 16
//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 17
//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 18
//IUVMaterial (away3d.core.material.IUVMaterial)
package away3d.core.material {
import flash.display.*;
import flash.geom.*;
import away3d.core.mesh.*;
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 19
//MovieMaterial (away3d.core.material.MovieMaterial)
package away3d.core.material {
import away3d.core.math.*;
import flash.display.*;
import away3d.core.render.*;
import away3d.core.scene.*;
import flash.geom.*;
import away3d.core.draw.*;
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 20
//ShadingColorMaterial (away3d.core.material.ShadingColorMaterial)
package away3d.core.material {
import away3d.core.math.*;
import away3d.core.render.*;
import away3d.core.scene.*;
import away3d.core.draw.*;
import away3d.core.mesh.*;
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 21
//TransformBitmapMaterial (away3d.core.material.TransformBitmapMaterial)
package away3d.core.material {
import away3d.core.math.*;
import flash.display.*;
import away3d.core.render.*;
import away3d.core.scene.*;
import flash.geom.*;
import away3d.core.draw.*;
import away3d.core.mesh.*;
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 22
//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 23
//WhiteShadingBitmapMaterial (away3d.core.material.WhiteShadingBitmapMaterial)
package away3d.core.material {
import away3d.core.math.*;
import flash.display.*;
import away3d.core.render.*;
import away3d.core.scene.*;
import flash.geom.*;
import away3d.core.draw.*;
import away3d.core.mesh.*;
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 24
//WireColorMaterial (away3d.core.material.WireColorMaterial)
package away3d.core.material {
import away3d.core.math.*;
import flash.display.*;
import away3d.core.render.*;
import away3d.core.scene.*;
import away3d.core.draw.*;
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 25
//WireframeMaterial (away3d.core.material.WireframeMaterial)
package away3d.core.material {
import away3d.core.math.*;
import flash.display.*;
import away3d.core.render.*;
import away3d.core.scene.*;
import away3d.core.draw.*;
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 26
//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 27
//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 28
//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 29
//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 30
//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 31
//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 32
//BaseMesh (away3d.core.mesh.BaseMesh)
package away3d.core.mesh {
import away3d.core.math.*;
import flash.events.*;
import away3d.core.render.*;
import away3d.core.scene.*;
import away3d.core.draw.*;
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 33
//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 34
//Face (away3d.core.mesh.Face)
package away3d.core.mesh {
import away3d.core.math.*;
import flash.events.*;
import away3d.core.render.*;
import flash.geom.*;
import away3d.core.draw.*;
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 35
//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 36
//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 37
//IAnimation (away3d.core.mesh.IAnimation)
package away3d.core.mesh {
public interface IAnimation {
function update(_arg1:BaseMesh):void;
}
}//package away3d.core.mesh
Section 38
//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 39
//Mesh (away3d.core.mesh.Mesh)
package away3d.core.mesh {
import away3d.core.math.*;
import flash.display.*;
import away3d.core.render.*;
import away3d.core.scene.*;
import away3d.core.draw.*;
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 40
//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 41
//Segment (away3d.core.mesh.Segment)
package away3d.core.mesh {
import flash.events.*;
import away3d.core.draw.*;
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 42
//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 43
//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 44
//Vertex (away3d.core.mesh.Vertex)
package away3d.core.mesh {
import away3d.core.math.*;
import away3d.core.render.*;
import away3d.core.draw.*;
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 45
//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 46
//WireMesh (away3d.core.mesh.WireMesh)
package away3d.core.mesh {
import away3d.core.math.*;
import away3d.core.render.*;
import away3d.core.scene.*;
import away3d.core.draw.*;
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 47
//BasicRenderer (away3d.core.render.BasicRenderer)
package away3d.core.render {
import flash.display.*;
import away3d.core.scene.*;
import away3d.core.draw.*;
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 48
//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 49
//Clipping (away3d.core.render.Clipping)
package away3d.core.render {
import flash.display.*;
import flash.geom.*;
import away3d.core.draw.*;
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 50
//FindHit (away3d.core.render.FindHit)
package away3d.core.render {
import away3d.core.math.*;
import away3d.core.scene.*;
import away3d.core.draw.*;
import away3d.core.mesh.*;
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 51
//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 52
//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 53
//IPrimitiveProvider (away3d.core.render.IPrimitiveProvider)
package away3d.core.render {
public interface IPrimitiveProvider {
function primitives(_arg1:IPrimitiveConsumer, _arg2:RenderSession):void;
}
}//package away3d.core.render
Section 54
//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 55
//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 56
//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 57
//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 58
//PrimitiveQuadrantTreeNode (away3d.core.render.PrimitiveQuadrantTreeNode)
package away3d.core.render {
import away3d.core.scene.*;
import away3d.core.draw.*;
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 59
//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 60
//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 61
//ProjectionTraverser (away3d.core.render.ProjectionTraverser)
package away3d.core.render {
import away3d.core.math.*;
import away3d.core.scene.*;
import away3d.core.mesh.*;
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 62
//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 63
//RenderSession (away3d.core.render.RenderSession)
package away3d.core.render {
import flash.display.*;
import away3d.core.scene.*;
import flash.geom.*;
import away3d.core.draw.*;
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 64
//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 65
//Camera3D (away3d.core.scene.Camera3D)
package away3d.core.scene {
import away3d.core.math.*;
import away3d.core.render.*;
import away3d.core.draw.*;
import away3d.core.mesh.*;
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 66
//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 67
//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 68
//ILODObject (away3d.core.scene.ILODObject)
package away3d.core.scene {
public interface ILODObject {
function matchLOD(_arg1:View3D):Boolean;
}
}//package away3d.core.scene
Section 69
//IPhysicsScene (away3d.core.scene.IPhysicsScene)
package away3d.core.scene {
public interface IPhysicsScene {
function updateTime(_arg1:int):void;
}
}//package away3d.core.scene
Section 70
//Light3D (away3d.core.scene.Light3D)
package away3d.core.scene {
import away3d.core.math.*;
import flash.display.*;
import away3d.core.render.*;
import flash.geom.*;
import away3d.core.draw.*;
import away3d.core.mesh.*;
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 71
//MouseEvent3D (away3d.core.scene.MouseEvent3D)
package away3d.core.scene {
import flash.events.*;
import away3d.core.draw.*;
import away3d.core.mesh.*;
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 72
//Object3D (away3d.core.scene.Object3D)
package away3d.core.scene {
import away3d.core.math.*;
import flash.display.*;
import away3d.core.render.*;
import away3d.core.draw.*;
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 73
//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 74
//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 75
//Scene3D (away3d.core.scene.Scene3D)
package away3d.core.scene {
import away3d.core.math.*;
import away3d.core.render.*;
import away3d.core.draw.*;
import away3d.core.mesh.*;
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 76
//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 77
//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 78
//View3D (away3d.core.scene.View3D)
package away3d.core.scene {
import flash.display.*;
import flash.events.*;
import away3d.core.render.*;
import away3d.core.draw.*;
import away3d.core.mesh.*;
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 79
//Stats (away3d.core.stats.Stats)
package away3d.core.stats {
import flash.display.*;
import flash.events.*;
import away3d.core.scene.*;
import flash.geom.*;
import away3d.core.mesh.*;
import flash.utils.*;
import flash.text.*;
import flash.ui.*;
import flash.net.*;
import flash.system.*;
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 80
//Cast (away3d.core.utils.Cast)
package away3d.core.utils {
import flash.display.*;
import away3d.core.scene.*;
import away3d.core.mesh.*;
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 81
//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 82
//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 83
//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 84
//IClonable (away3d.core.utils.IClonable)
package away3d.core.utils {
public interface IClonable {
function clone(_arg1=null);
}
}//package away3d.core.utils
Section 85
//Init (away3d.core.utils.Init)
package away3d.core.utils {
import away3d.core.math.*;
import flash.display.*;
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 86
//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 87
//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 88
//arcane (away3d.core.arcane)
package away3d.core {
public namespace arcane;
}//package away3d.core
Section 89
//Cube (away3d.objects.Cube)
package away3d.objects {
import away3d.core.mesh.*;
import away3d.core.utils.*;
import away3d.core.material.*;
import away3d.core.stats.*;
import away3d.core.*;
public class Cube extends Mesh {
public function Cube(_arg1:Object=null){
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Init;
super(_arg1);
_arg1 = Init.parse(_arg1);
_local2 = _arg1.getNumber("size", 100, {min:0});
_local3 = _arg1.getNumber("width", _local2, {min:0});
_local4 = _arg1.getNumber("height", _local2, {min:0});
_local5 = _arg1.getNumber("depth", _local2, {min:0});
_local6 = _arg1.getInit("faces");
buildCube(_local3, _local4, _local5, _local6);
}
public function buildCube(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Init):void{
var _local5:ITriangleMaterial;
var _local6:ITriangleMaterial;
var _local7:ITriangleMaterial;
var _local8:ITriangleMaterial;
var _local9:ITriangleMaterial;
var _local10:ITriangleMaterial;
var _local11:Vertex;
var _local12:Vertex;
var _local13:Vertex;
var _local14:Vertex;
var _local15:Vertex;
var _local16:Vertex;
var _local17:Vertex;
var _local18:Vertex;
var _local19:UV;
var _local20:UV;
var _local21:UV;
var _local22:UV;
_local5 = _arg4.getMaterial("left");
_local6 = _arg4.getMaterial("right");
_local7 = _arg4.getMaterial("bottom");
_local8 = _arg4.getMaterial("top");
_local9 = _arg4.getMaterial("front");
_local10 = _arg4.getMaterial("back");
_local11 = new Vertex((-(_arg1) / 2), (-(_arg2) / 2), (-(_arg3) / 2));
_local12 = new Vertex((-(_arg1) / 2), (-(_arg2) / 2), (_arg3 / 2));
_local13 = new Vertex((-(_arg1) / 2), (_arg2 / 2), (-(_arg3) / 2));
_local14 = new Vertex((-(_arg1) / 2), (_arg2 / 2), (_arg3 / 2));
_local15 = new Vertex((_arg1 / 2), (-(_arg2) / 2), (-(_arg3) / 2));
_local16 = new Vertex((_arg1 / 2), (-(_arg2) / 2), (_arg3 / 2));
_local17 = new Vertex((_arg1 / 2), (_arg2 / 2), (-(_arg3) / 2));
_local18 = new Vertex((_arg1 / 2), (_arg2 / 2), (_arg3 / 2));
_local19 = new UV(1, 1);
_local20 = new UV(0, 1);
_local21 = new UV(0, 0);
_local22 = new UV(1, 0);
addFace(new Face(_local11, _local13, _local12, _local5, _local22, _local19, _local21));
addFace(new Face(_local13, _local14, _local12, _local5, _local19, _local20, _local21));
addFace(new Face(_local15, _local16, _local17, _local6, _local21, _local22, _local20));
addFace(new Face(_local17, _local16, _local18, _local6, _local20, _local22, _local19));
addFace(new Face(_local11, _local12, _local15, _local7, _local20, _local21, _local19));
addFace(new Face(_local12, _local16, _local15, _local7, _local21, _local22, _local19));
addFace(new Face(_local13, _local17, _local14, _local8, _local21, _local22, _local20));
addFace(new Face(_local14, _local17, _local18, _local8, _local20, _local22, _local19));
addFace(new Face(_local11, _local15, _local13, _local9, _local21, _local22, _local20));
addFace(new Face(_local15, _local17, _local13, _local9, _local22, _local19, _local20));
addFace(new Face(_local12, _local14, _local16, _local10, _local22, _local19, _local21));
addFace(new Face(_local16, _local14, _local18, _local10, _local21, _local19, _local20));
type = "Cube";
url = "primitive";
}
}
}//package away3d.objects
Section 90
//WireCube (away3d.objects.WireCube)
package away3d.objects {
import away3d.core.scene.*;
import away3d.core.mesh.*;
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 91
//MochiScores (mochi.MochiScores)
package mochi {
import flash.display.*;
import flash.text.*;
public class MochiScores {
private static var boardID:String;
public static var onErrorHandler:Object;
public static var onCloseHandler:Object;
public static function showLeaderboard(_arg1:Object=null):void{
var options = _arg1;
if (options != null){
if (options.clip != null){
if ((options.clip is Sprite)){
MochiServices.setContainer(options.clip);
};
delete options.clip;
} else {
MochiServices.setContainer();
};
MochiServices.stayOnTop();
if (options.name != null){
if ((options.name is TextField)){
if (options.name.text.length > 0){
options.name = options.name.text;
};
};
};
if (options.score != null){
if ((options.score is TextField)){
if (options.score.text.length > 0){
options.score = options.score.text;
};
};
};
if (options.onDisplay != null){
options.onDisplay();
} else {
if (MochiServices.clip != null){
if ((MochiServices.clip is MovieClip)){
MochiServices.clip.stop();
} else {
trace("Warning: Container is not a MovieClip, cannot call default onDisplay.");
};
};
};
} else {
options = {};
if ((MochiServices.clip is MovieClip)){
MochiServices.clip.stop();
} else {
trace("Warning: Container is not a MovieClip, cannot call default onDisplay.");
};
};
if (options.onClose != null){
onCloseHandler = options.onClose;
} else {
onCloseHandler = function ():void{
if ((MochiServices.clip is MovieClip)){
MochiServices.clip.play();
} else {
trace("Warning: Container is not a MovieClip, cannot call default onClose.");
};
};
};
if (options.onError != null){
onErrorHandler = options.onError;
} else {
onErrorHandler = null;
};
if (options.boardID == null){
if (MochiScores.boardID != null){
options.boardID = MochiScores.boardID;
};
};
MochiServices.send("scores_showLeaderboard", {options:options}, null, onClose);
}
public static function closeLeaderboard():void{
MochiServices.send("scores_closeLeaderboard");
}
public static function getPlayerInfo(_arg1:Object, _arg2:Object=null):void{
MochiServices.send("scores_getPlayerInfo", null, _arg1, _arg2);
}
public static function requestList(_arg1:Object, _arg2:Object=null):void{
MochiServices.send("scores_requestList", null, _arg1, _arg2);
}
public static function scoresArrayToObjects(_arg1:Object):Object{
var _local2:Object;
var _local3:Number;
var _local4:Number;
var _local5:Object;
var _local6:Object;
var _local7:String;
var _local8:String;
_local2 = {};
for (_local7 in _arg1) {
if (typeof(_arg1[_local7]) == "object"){
if (((!((_arg1[_local7].cols == null))) && (!((_arg1[_local7].rows == null))))){
_local2[_local7] = [];
_local5 = _arg1[_local7];
_local4 = 0;
while (_local4 < _local5.rows.length) {
_local6 = {};
_local3 = 0;
while (_local3 < _local5.cols.length) {
_local6[_local5.cols[_local3]] = _local5.rows[_local4][_local3];
_local3++;
};
_local2[_local7].push(_local6);
_local4++;
};
} else {
_local2[_local7] = {};
for (_local8 in _arg1[_local7]) {
_local2[_local7][_local8] = _arg1[_local7][_local8];
};
};
} else {
_local2[_local7] = _arg1[_local7];
};
};
return (_local2);
}
public static function submit(_arg1:Number, _arg2:String, _arg3:Object=null, _arg4:Object=null):void{
MochiServices.send("scores_submit", {score:_arg1, name:_arg2}, _arg3, _arg4);
}
public static function onClose(_arg1:Object=null):void{
if (_arg1 != null){
if (_arg1.error != null){
if (_arg1.error == true){
if (onErrorHandler != null){
if (_arg1.errorCode == null){
_arg1.errorCode = "IOError";
};
onErrorHandler(_arg1.errorCode);
MochiServices.doClose();
return;
};
};
};
};
onCloseHandler();
MochiServices.doClose();
}
public static function setBoardID(_arg1:String):void{
MochiScores.boardID = _arg1;
MochiServices.send("scores_setBoardID", {boardID:_arg1});
}
}
}//package mochi
Section 92
//MochiServices (mochi.MochiServices)
package mochi {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
import flash.net.*;
import flash.system.*;
public class MochiServices {
private static var _container:Object;
private static var _connected:Boolean = false;
private static var _swfVersion:String;
private static var _sendChannel:LocalConnection;
private static var _rcvChannelName:String;
private static var _gatewayURL:String = "http://www.mochiads.com/static/lib/services/services.swf";
private static var _clip:MovieClip;
private static var _loader:Loader;
private static var _id:String;
private static var _listenChannel:LocalConnection;
private static var _timer:Timer;
private static var _sendChannelName:String;
private static var _startTime:Number;
private static var _connecting:Boolean = false;
public static var onError:Object;
private static var _listenChannelName:String = "__mochiservices";
private static var _rcvChannel:LocalConnection;
public static function isNetworkAvailable():Boolean{
return (!((Security.sandboxType == "localWithFile")));
}
public static function send(_arg1:String, _arg2:Object=null, _arg3:Object=null, _arg4:Object=null):void{
if (_connected){
_sendChannel.send(_sendChannelName, "onReceive", {methodName:_arg1, args:_arg2, callbackID:_clip._nextcallbackID});
} else {
if ((((_clip == null)) || (!(_connecting)))){
onError("NotConnected");
handleError(_arg2, _arg3, _arg4);
flush(true);
return;
};
_clip._queue.push({methodName:_arg1, args:_arg2, callbackID:_clip._nextcallbackID});
};
if (_clip != null){
if (((!((_clip._callbacks == null))) && (!((_clip._nextcallbackID == null))))){
_clip._callbacks[_clip._nextcallbackID] = {callbackObject:_arg3, callbackMethod:_arg4};
_clip._nextcallbackID++;
};
};
}
public static function get connected():Boolean{
return (_connected);
}
private static function flush(_arg1:Boolean):void{
var _local2:Object;
var _local3:Object;
if (_clip != null){
if (_clip._queue != null){
while (_clip._queue.length > 0) {
_local2 = _clip._queue.shift();
_local3 = null;
if (_local2 != null){
if (_local2.callbackID != null){
_local3 = _clip._callbacks[_local2.callbackID];
};
delete _clip._callbacks[_local2.callbackID];
if (((_arg1) && (!((_local3 == null))))){
handleError(_local2.args, _local3.callbackObject, _local3.callbackMethod);
};
};
};
};
};
}
private static function init(_arg1:String, _arg2:Object):void{
_id = _arg1;
if (_arg2 != null){
_container = _arg2;
loadCommunicator(_arg1, _container);
};
}
public static function get childClip():Object{
return (_clip);
}
public static function get id():String{
return (_id);
}
public static function stayOnTop():void{
_container.addEventListener(Event.ENTER_FRAME, MochiServices.bringToTop, false, 0, true);
if (_clip != null){
_clip.visible = true;
};
}
public static function getVersion():String{
return ("1.31");
}
public static function disconnect():void{
if (((_connected) || (_connecting))){
if (_clip != null){
if (_clip.parent != null){
if ((_clip.parent is Sprite)){
Sprite(_clip.parent).removeChild(_clip);
_clip = null;
};
};
};
_connecting = (_connected = false);
flush(true);
try {
_listenChannel.close();
_rcvChannel.close();
} catch(error:Error) {
};
};
if (_timer != null){
try {
_timer.stop();
} catch(error:Error) {
};
};
}
public static function allowDomains(_arg1:String):String{
var _local2:String;
Security.allowDomain("*");
Security.allowInsecureDomain("*");
if (_arg1.indexOf("http://") != -1){
_local2 = _arg1.split("/")[2].split(":")[0];
Security.allowDomain(_local2);
Security.allowInsecureDomain(_local2);
};
return (_local2);
}
public static function doClose():void{
_container.removeEventListener(Event.ENTER_FRAME, MochiServices.bringToTop);
if (_clip.parent != null){
Sprite(_clip.parent).removeChild(_clip);
};
}
public static function setContainer(_arg1:Object=null, _arg2:Boolean=true):void{
if (_arg1 != null){
if ((_arg1 is Sprite)){
_container = _arg1;
};
};
if (_arg2){
if ((_container is Sprite)){
Sprite(_container).addChild(_clip);
};
};
}
private static function onStatus(_arg1:StatusEvent):void{
switch (_arg1.level){
case "error":
_connected = false;
_listenChannel.connect(_listenChannelName);
break;
};
}
private static function initComChannels():void{
if (!_connected){
_sendChannel.addEventListener(StatusEvent.STATUS, MochiServices.onStatus);
_sendChannel.send(_sendChannelName, "onReceive", {methodName:"handshakeDone"});
_sendChannel.send(_sendChannelName, "onReceive", {methodName:"registerGame", id:_id, clip:_container, version:getVersion()});
_rcvChannel.addEventListener(StatusEvent.STATUS, MochiServices.onStatus);
_clip.onReceive = function (_arg1:Object):void{
var cb:String;
var cblst:Object;
var method:*;
var methodName:String;
var obj:Object;
var pkg = _arg1;
cb = pkg.callbackID;
cblst = this.client._callbacks[cb];
if (!cblst){
return;
};
method = cblst.callbackMethod;
methodName = "";
obj = cblst.callbackObject;
if (((obj) && ((typeof(method) == "string")))){
methodName = method;
if (obj[method] != null){
method = obj[method];
} else {
trace((("Error: Method " + method) + " does not exist."));
};
};
if (method != undefined){
try {
method.apply(obj, pkg.args);
} catch(error:Error) {
trace(((("Error invoking callback method '" + methodName) + "': ") + error.toString()));
};
} else {
if (obj != null){
try {
obj(pkg.args);
} catch(error:Error) {
trace(("Error invoking method on object: " + error.toString()));
};
};
};
delete this.client._callbacks[cb];
};
_clip.onError = function ():void{
MochiServices.onError("IOError");
};
_rcvChannel.connect(_rcvChannelName);
trace("connected!");
_connecting = false;
_connected = true;
_listenChannel.close();
while (_clip._queue.length > 0) {
_sendChannel.send(_sendChannelName, "onReceive", _clip._queue.shift());
};
};
}
private static function listen():void{
_listenChannel = new LocalConnection();
_listenChannel.client = _clip;
_clip.handshake = function (_arg1:Object):void{
MochiServices.comChannelName = _arg1.newChannel;
};
_listenChannel.allowDomain("*", "localhost");
_listenChannel.allowInsecureDomain("*", "localhost");
_listenChannel.connect(_listenChannelName);
trace("Waiting for MochiAds services to connect...");
}
private static function handleError(_arg1:Object, _arg2:Object, _arg3:Object):void{
var args = _arg1;
var callbackObject = _arg2;
var callbackMethod = _arg3;
if (args != null){
if (args.onError != null){
args.onError.apply(null, ["NotConnected"]);
};
};
if (callbackMethod != null){
args = {};
args.error = true;
args.errorCode = "NotConnected";
if (((!((callbackObject == null))) && ((callbackMethod is String)))){
try {
var _local5 = callbackObject;
_local5[callbackMethod](args);
} catch(error:Error) {
};
} else {
if (callbackMethod != null){
try {
callbackMethod.apply(args);
} catch(error:Error) {
};
};
};
};
}
public static function get clip():Object{
return (_container);
}
public static function set comChannelName(_arg1:String):void{
if (_arg1 != null){
if (_arg1.length > 3){
_sendChannelName = (_arg1 + "_fromgame");
_rcvChannelName = _arg1;
initComChannels();
};
};
}
private static function loadCommunicator(_arg1:String, _arg2:Object):MovieClip{
var clipname:String;
var f:Function;
var req:URLRequest;
var id = _arg1;
var clip = _arg2;
clipname = ("_mochiservices_com_" + id);
if (_clip != null){
return (_clip);
};
if (!MochiServices.isNetworkAvailable()){
return (null);
};
MochiServices.allowDomains(_gatewayURL);
_clip = createEmptyMovieClip(clip, clipname, 10336, false);
_loader = new Loader();
_timer = new Timer(1000, 0);
_startTime = getTimer();
_timer.addEventListener(TimerEvent.TIMER, connectWait);
_timer.start();
f = function (_arg1:Object):void{
_clip._mochiad_ctr_failed = true;
trace("MochiServices could not load.");
MochiServices.disconnect();
MochiServices.onError("IOError");
};
_loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, f);
req = new URLRequest(_gatewayURL);
_loader.load(req);
_clip.addChild(_loader);
_clip._mochiservices_com = _loader;
_sendChannel = new LocalConnection();
_clip._queue = [];
_rcvChannel = new LocalConnection();
_rcvChannel.allowDomain("*", "localhost");
_rcvChannel.allowInsecureDomain("*", "localhost");
_rcvChannel.client = _clip;
_clip._nextcallbackID = 0;
_clip._callbacks = {};
listen();
return (_clip);
}
public static function bringToTop(_arg1:Event):void{
var e = _arg1;
if (MochiServices.clip != null){
if (MochiServices.childClip != null){
try {
if (MochiServices.clip.numChildren > 1){
MochiServices.clip.setChildIndex(MochiServices.childClip, (MochiServices.clip.numChildren - 1));
};
} catch(errorObject:Error) {
trace("Warning: Depth sort error.");
_container.removeEventListener(Event.ENTER_FRAME, MochiServices.bringToTop);
};
};
};
}
public static function connect(_arg1:String, _arg2:Object, _arg3:Object=null):void{
var id = _arg1;
var clip = _arg2;
var onError = _arg3;
if ((clip is DisplayObject)){
if (((!(_connected)) && ((_clip == null)))){
trace("MochiServices Connecting...");
_connecting = true;
init(id, clip);
};
} else {
trace("Error, MochiServices requires a Sprite, Movieclip or instance of the stage.");
};
if (onError != null){
MochiServices.onError = onError;
} else {
if (MochiServices.onError == null){
MochiServices.onError = function (_arg1:String):void{
trace(_arg1);
};
};
};
}
public static function createEmptyMovieClip(_arg1:Object, _arg2:String, _arg3:Number, _arg4:Boolean=true):MovieClip{
var mc:MovieClip;
var parent = _arg1;
var name = _arg2;
var depth = _arg3;
var doAdd = _arg4;
mc = new MovieClip();
if (doAdd){
if (((false) && (depth))){
parent.addChildAt(mc, depth);
} else {
parent.addChild(mc);
};
};
try {
parent[name] = mc;
} catch(e:Error) {
throw (new Error("MochiServices requires a clip that is an instance of a dynamic class. If your class extends Sprite or MovieClip, you must make it dynamic."));
};
mc["_name"] = name;
return (mc);
}
public static function connectWait(_arg1:TimerEvent):void{
if ((getTimer() - _startTime) > 10000){
if (!_connected){
_clip._mochiad_ctr_failed = true;
trace("MochiServices could not load.");
MochiServices.disconnect();
MochiServices.onError("IOError");
};
_timer.stop();
};
}
}
}//package mochi
Section 93
//3d_5 (pistoleros_fla.3d_5)
package pistoleros_fla {
import away3d.core.math.*;
import flash.display.*;
import flash.events.*;
import away3d.core.scene.*;
import flash.geom.*;
import away3d.core.mesh.*;
import away3d.core.material.*;
import flash.utils.*;
import mochi.*;
import flash.media.*;
import away3d.objects.*;
import flash.filters.*;
import flash.text.*;
import flash.ui.*;
import flash.net.*;
import flash.system.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.printing.*;
import flash.xml.*;
public dynamic class 3d_5 extends MovieClip {
public var holder2n1;
public var srz;
public var alfa:Number;
public var at:Number;
public var maxlev:Number;
public var holder1n2;
public var holder1n1;
public var can1;
public var can2;
public var can3;
public var can5;
public var g;
public var can8;
public var can9;
public var can4;
public var can6;
public var can7;
public var t;
public var sy;
public var sz;
public var sx;
public var view:View3D;
public var v0;
public var ncan:Number;
public var x0;
public var y0;
public var z0;
public var tempofin;
public var timer:Timer;
public var rbeta:Number;
public var rota:Number;
public var sobject;
public var oggetto;
public var sname;
public var arrogg:Array;
public var hit;
public var ralfa:Number;
public var dist:Number;
public var arroggfin:Array;
public var box1;
public var tutto:ObjectContainer3D;
public var box2;
public var oggetto2;
public var beta:Number;
public var srx;
public var sry;
public function 3d_5(){
addFrameScript(0, frame1);
}
public function setta(_arg1:String, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number=0, _arg6:Number=0):void{
sobject = _arg1;
this[sobject].name = (_arg1 + "_");
this[sobject].x = _arg2;
this[sobject].y = _arg3;
this[sobject].z = _arg4;
this[sobject].rotationX = _arg5;
this[sobject].rotationY = (Math.random() * 360);
this[sobject].rotationZ = _arg6;
this[sobject].visible = true;
}
function frame1(){
view = new View3D();
addChild(view);
view.camera.position = new Number3D(1000, 0, 0);
view.camera.lookAt(new Number3D(0, 10, 0));
tutto = new ObjectContainer3D();
view.scene.addChildren(tutto);
tutto.addOnMouseDown(shot);
maxlev = 10;
ncan = 0;
oggetto = "";
oggetto2 = "";
arrogg = new Array();
arroggfin = new Array();
v0 = 125;
g = 9.8;
at = 0.44;
rota = 0;
hit = new Hit();
timer = new Timer(1000);
timer.addEventListener(TimerEvent.TIMER, notifier);
addEventListener(Event.ENTER_FRAME, onEnterFrame);
box1 = new Cube({material:"Cassa", name:"box", y:-170, width:200, height:600, depth:200, rotationX:-90, pushback:true});
box2 = new Cube({material:"Cassa", name:"box", y:-170, width:200, height:600, depth:200, rotationX:-90, pushback:true, visible:false});
holder1n1 = new Holder1({material:"CanMat1", name:"box", pushfront:true, visible:false});
can1 = new Can3DLow({material:"CanMat2", name:"can1_", pushfront:true, outline:true, visible:false});
can2 = new Can3DLow({material:"CanMat2", name:"can2_", pushfront:true, outline:true, visible:false});
can3 = new Can3DLow({material:"CanMat3", name:"can3_", pushfront:true, outline:true, visible:false});
can4 = new Can3DLow({material:"CanMat3", name:"can4_", pushfront:true, outline:true, visible:false});
can5 = new Can3DLow({material:"CanMat1", name:"can5_", pushfront:true, outline:true, visible:false});
holder1n2 = new Holder1({material:"CanMat1", name:"box", y:-70, z:30, pushfront:true, visible:false});
can6 = new Can3DLow({material:"CanMat2", name:"can6_", y:-70, z:30, pushfront:true, outline:true, visible:false});
can7 = new Can3DLow({material:"CanMat2", name:"can7_", y:20, z:30, pushfront:true, outline:true, visible:false});
can8 = new Can3DLow({material:"CanMat3", name:"can8_", y:110, z:30, pushfront:true, outline:true, visible:false});
can9 = new Can3DLow({material:"CanMat3", name:"can9_", y:200, z:30, pushfront:true, outline:true, visible:false});
holder2n1 = new Holder2({material:"CanMat1", name:"box", pushback:true, visible:false});
tutto.addChildren(box1, box2, holder1n1, holder1n2, holder2n1, can1, can2, can3, can4, can5, can6, can7, can8, can9);
liv1();
}
public function nascondi():void{
root["punti"].text = "0";
root["sta"].visible = true;
root["don"].visible = false;
arroggfin = new Array();
arrogg = new Array();
box1.visible = true;
box1.x = 0;
box1.y = -170;
box1.z = 0;
box2.x = 0;
box2.y = -170;
box2.z = 0;
box2.visible = false;
holder2n1.visible = false;
holder1n1.visible = false;
holder1n2.visible = false;
can1.visible = false;
can2.visible = false;
can3.visible = false;
can4.visible = false;
can5.visible = false;
can6.visible = false;
can7.visible = false;
can8.visible = false;
can9.visible = false;
}
public function liv10():void{
nascondi();
root["sta"].tempo.text = "6 Seconds";
root["sta"].scorel.text = "60";
root["sta"].livello.text = "10";
ncan = 4;
setta("can2", 0, -70, -150);
setta("can3", 0, -70, -240);
setta("can4", 0, -70, 0);
setta("can6", 0, -70, 240);
}
public function liv2():void{
nascondi();
root["sta"].tempo.text = "4 Seconds";
root["sta"].scorel.text = "4";
root["sta"].livello.text = "2";
ncan = 4;
holder1n1.visible = true;
holder1n1.y = -70;
holder1n1.z = -30;
setta("can1", 0, -70, 0);
setta("can2", 0, 20, 0);
setta("can3", 0, 110, 0);
setta("can4", 0, 200, 0);
}
public function liv3():void{
nascondi();
root["sta"].tempo.text = "6 Seconds";
root["sta"].scorel.text = "10";
root["sta"].livello.text = "3";
ncan = 4;
holder1n2.visible = true;
holder1n2.z = 30;
setta("can6", 0, -70, 70);
setta("can7", 0, 20, 30);
setta("can8", 0, 110, 30);
setta("can9", 0, 200, 30);
}
public function onEnterFrame(_arg1:Event):void{
var _local2:*;
if (maxlev == root["sta"].livello.text){
root["don"].nlbtn.visible = false;
if ((((root["don"].visible == true)) && ((Number(root["punti"].text) > Number(root["sta"].scorel.text))))){
root["totpoints"].text = String((Number(root["totpoints"].text) + Number(root["don"].totpoints.text)));
root["don"].visible = false;
MochiScores.showLeaderboard({clip:root, boardID:"4845705573fdc20e", score:root["totpoints"].text, name:root["nome"].nome2});
};
};
view.render();
if ((((((root["bul"] == -1)) && ((root["don"].visible == false)))) && ((root["sta"].visible == false)))){
root["bullet"].masc.scaleY = (root["bullet"].masc.scaleY - 0.0065);
at = 0.11;
};
if (root["bullet"].masc.scaleY <= 0){
root["bul"] = 1;
};
if ((((((((root["bul"] == 1)) && ((root["bullet"].masc.scaleY < 1)))) && ((root["don"].visible == false)))) && ((root["sta"].visible == false)))){
root["bullet"].masc.scaleY = (root["bullet"].masc.scaleY + 0.0002);
at = 0.44;
};
if (root["sta"].livello.text == "3"){
rota = (rota + (at / 6));
holder1n2.rotationY = ((rota * 57.5) + 182);
can9.rotationY = (rota * 57.5);
can9.x = ((-30 * Math.sin(rota)) + 0);
can9.z = ((-30 * Math.cos(rota)) + 30);
can8.rotationY = (rota * 58);
can8.x = ((-30 * Math.sin(rota)) + 0);
can8.z = ((-30 * Math.cos(rota)) + 30);
can7.rotationY = (rota * 58);
can7.x = ((-30 * Math.sin(rota)) + 0);
can7.z = ((-30 * Math.cos(rota)) + 30);
};
if (root["sta"].livello.text == "4"){
rota = (rota + (at / 6));
holder1n2.rotationY = ((rota * 57.5) + 182);
can9.rotationY = (rota * 57.5);
can9.x = ((-30 * Math.sin(rota)) + 0);
can9.z = ((-30 * Math.cos(rota)) + 100);
can8.rotationY = (rota * 58);
can8.x = ((-30 * Math.sin(rota)) + 0);
can8.z = ((-30 * Math.cos(rota)) + 100);
can7.rotationY = (rota * 58);
can7.x = ((-30 * Math.sin(rota)) + 0);
can7.z = ((-30 * Math.cos(rota)) + 100);
};
if (root["sta"].livello.text == "5"){
rota = (rota + (at / 3));
can1.y = ((-40 * Math.sin(rota)) - 120);
can2.y = ((-40 * Math.sin((rota + 1))) - 120);
can3.y = ((-40 * Math.sin((rota + 2))) - 120);
can4.y = ((-40 * Math.sin((rota + 3))) - 120);
can5.y = ((-40 * Math.sin((rota + 4))) - 120);
};
if (root["sta"].livello.text == "8"){
rota = (rota + (at / 3));
holder2n1.rotationY = ((rota * 57.5) + 182);
can1.rotationY = (rota * 57.5);
can1.x = (0 * Math.sin(rota));
can1.z = (0 * Math.cos(rota));
can2.rotationY = (rota * 57.5);
can2.x = (-50 * Math.sin(rota));
can2.z = (-50 * Math.cos(rota));
can3.rotationY = (rota * 57.5);
can3.x = (-100 * Math.sin(rota));
can3.z = (-100 * Math.cos(rota));
can4.rotationY = (rota * 57.5);
can4.x = (-150 * Math.sin(rota));
can4.z = (-150 * Math.cos(rota));
can5.rotationY = (rota * 57.5);
can5.x = (-200 * Math.sin(rota));
can5.z = (-200 * Math.cos(rota));
can6.rotationY = (rota * 57.5);
can6.x = (150 * Math.sin(rota));
can6.z = (150 * Math.cos(rota));
can7.rotationY = (rota * 57.5);
can7.x = (100 * Math.sin(rota));
can7.z = (100 * Math.cos(rota));
can8.rotationY = (rota * 57.5);
can8.x = (50 * Math.sin(rota));
can8.z = (50 * Math.cos(rota));
can9.rotationY = (rota * 57.5);
can9.x = (200 * Math.sin(rota));
can9.z = (200 * Math.cos(rota));
};
if (root["sta"].livello.text == "9"){
rota = (rota + (at / 3));
holder2n1.rotationY = ((rota * 57.5) + 182);
can1.rotationY = (rota * 57.5);
can1.x = ((-100 * Math.sin(rota)) - 2000);
can1.z = ((-100 * Math.cos(rota)) - 500);
can2.rotationY = (rota * 57.5);
can2.x = ((-150 * Math.sin(rota)) - 2000);
can2.z = ((-150 * Math.cos(rota)) - 500);
can3.rotationY = (rota * 57.5);
can3.x = ((-200 * Math.sin(rota)) - 2000);
can3.z = ((-200 * Math.cos(rota)) - 500);
};
if (arrogg.length > 0){
_local2 = 0;
while (_local2 < arrogg.length) {
oggetto = arrogg[_local2];
t = this[oggetto].name.split("_")[1];
x0 = Number(this[oggetto].name.split("_")[2]);
y0 = Number(this[oggetto].name.split("_")[3]);
z0 = Number(this[oggetto].name.split("_")[4]);
ralfa = Number(this[oggetto].name.split("_")[5]);
rbeta = Number(this[oggetto].name.split("_")[6]);
dist = ((v0 * Math.cos(ralfa)) * t);
this[oggetto].x = (x0 + (dist * Math.sin(rbeta)));
this[oggetto].z = (z0 + (dist * Math.cos(rbeta)));
this[oggetto].y = (y0 + (((v0 * Math.sin(ralfa)) * t) - ((g * (t * t)) / 2)));
this[oggetto].rotationX = (this[oggetto].rotationX + (at * 15));
this[oggetto].rotationY = (this[oggetto].rotationY + (at * 15));
this[oggetto].name = ((((((((((((((this[oggetto].name.split("_")[0] + "_") + String((Number(this[oggetto].name.split("_")[1]) + at))) + "_") + this[oggetto].name.split("_")[2]) + "_") + this[oggetto].name.split("_")[3]) + "_") + this[oggetto].name.split("_")[4]) + "_") + this[oggetto].name.split("_")[5]) + "_") + this[oggetto].name.split("_")[6]) + "_") + this[oggetto].name.split("_")[7]);
if ((((arroggfin.indexOf(oggetto) == -1)) && ((this[oggetto].y < (box1.y - 300))))){
arroggfin.push(oggetto);
this[oggetto].visible = false;
if (ncan == arroggfin.length){
donvis();
};
};
_local2++;
};
};
}
public function liv6():void{
nascondi();
root["sta"].tempo.text = "6 Seconds";
root["sta"].scorel.text = "40";
root["sta"].livello.text = "6";
ncan = 5;
box1.x = -2000;
box1.y = -230;
box1.z = -500;
setta("can2", -2000, -130, -650);
setta("can3", -2000, -130, -740);
setta("can1", -2000, -130, -440);
setta("can4", -2000, -130, -500);
setta("can6", -2000, -130, -340);
}
public function liv7():void{
nascondi();
root["sta"].tempo.text = "10 Seconds";
root["sta"].scorel.text = "30";
root["sta"].livello.text = "7";
ncan = 9;
box2.visible = true;
box1.x = -2500;
box1.y = -230;
box1.z = -800;
box2.x = -1500;
box2.y = -230;
box2.z = 500;
setta("can1", -2500, -130, -640);
setta("can2", -2500, -130, -850);
setta("can3", -2500, -130, -940);
setta("can4", -2500, -130, -700);
setta("can5", -1500, -130, 700);
setta("can6", -1500, -130, 600);
setta("can7", -1500, -130, 500);
setta("can8", -1500, -130, 400);
setta("can9", -1500, -130, 300);
}
public function liv1():void{
nascondi();
root["totpoints"].text = "0";
root["sta"].tempo.text = "6 Seconds";
root["sta"].scorel.text = "5";
root["sta"].livello.text = "1";
ncan = 5;
setta("can1", 0, -70, -240);
setta("can2", 0, -70, -120);
setta("can3", 0, -70, 0);
setta("can4", 0, -70, 120);
setta("can5", 0, -70, 240);
}
public function liv5():void{
nascondi();
root["sta"].tempo.text = "12 Seconds";
root["sta"].scorel.text = "42";
root["sta"].livello.text = "5";
ncan = 5;
setta("can1", -200, -70, -200);
setta("can2", -200, -70, -100);
setta("can3", -200, -70, 0);
setta("can4", -200, -70, 100);
setta("can5", -200, -70, 200);
}
public function liv9():void{
nascondi();
root["sta"].tempo.text = "8 Seconds";
root["sta"].scorel.text = "50";
root["sta"].livello.text = "9";
ncan = 6;
box1.visible = true;
box1.x = -2000;
box1.y = -300;
box1.z = 500;
holder2n1.visible = true;
holder2n1.x = -2000;
holder2n1.y = -200;
holder2n1.z = -500;
setta("can1", -2000, -200, -600);
setta("can2", -2000, -200, -550);
setta("can3", -2000, -200, -350);
setta("can4", -2000, -200, 450);
setta("can5", -2000, -200, 600);
setta("can6", -2000, -200, 300);
}
public function liv8():void{
nascondi();
root["sta"].tempo.text = "5 Seconds";
root["sta"].scorel.text = "47";
root["sta"].livello.text = "8";
ncan = 9;
box1.visible = false;
holder2n1.visible = true;
holder2n1.x = 0;
holder2n1.y = -80;
holder2n1.z = 0;
setta("can1", 0, -80, -100);
setta("can2", 0, -80, -50);
setta("can3", 0, -80, 0);
setta("can4", 0, -80, 50);
setta("can5", 0, -80, 100);
setta("can6", 0, -80, -200);
setta("can7", 0, -80, 0);
setta("can8", 0, -80, 200);
setta("can9", 0, -80, 220);
}
public function shot(_arg1:MouseEvent3D):void{
if (((((!(((_arg1.object as Mesh).name == "box"))) && ((root["sta"].visible == false)))) && ((root["don"].visible == false)))){
oggetto2 = (_arg1.object as Mesh).name.split("_")[0];
if (arrogg.indexOf(oggetto2) == -1){
arrogg.push(oggetto2);
};
alfa = 1;
beta = ((Math.random() * 0.5) - 1.8);
if ((_arg1.object as Mesh).name.length > 8){
_arg1.object.name = ((((((((((((this[oggetto2].name.split("_")[0] + "_0_") + this[oggetto2].x) + "_") + this[oggetto2].y) + "_") + this[oggetto2].z) + "_") + alfa) + "_") + beta) + "_") + String((Number(this[oggetto2].name.split("_")[7]) * 2)));
root["punti"].text = (Number(root["punti"].text) + Number(_arg1.object.name.split("_")[7]));
hit.play();
};
if ((_arg1.object as Mesh).name.length < 8){
hit.play();
_arg1.object.name = (((((((((((this[oggetto2].name.split("_")[0] + "_0_") + this[oggetto2].x) + "_") + this[oggetto2].y) + "_") + this[oggetto2].z) + "_") + alfa) + "_") + beta) + "_1");
root["punti"].text = (Number(root["punti"].text) + 1);
};
};
}
public function liv4():void{
nascondi();
root["sta"].tempo.text = "8 Seconds";
root["sta"].scorel.text = "32";
root["sta"].livello.text = "4";
ncan = 8;
holder1n2.visible = true;
holder1n2.z = 100;
setta("can6", 0, -70, 140);
setta("can7", 0, 20, 100);
setta("can8", 0, 110, 100);
setta("can9", 0, 200, 100);
setta("can1", 0, -70, -240);
setta("can2", 0, -70, -120);
setta("can3", 0, -70, 0);
setta("can4", 0, -70, 200);
}
public function notifier(_arg1:TimerEvent):void{
tempofin = (Number(tempofin) - (at / 0.44));
root["tempo"].text = tempofin;
if (Number(tempofin) <= 0){
tempofin = 0;
root["tempo"].text = "0";
donvis();
};
}
public function donvis():void{
root["bul"] = 1;
at = 0.44;
root["don"].totpoints.text = (Number(root["punti"].text) + (Number(root["tempo"].text) * 10));
root["don"].tempo.text = (root["tempo"].text + " seconds");
root["don"].scorel.text = ((root["punti"].text + " of ") + root["sta"].scorel.text);
root["don"].visible = true;
if (Number(root["punti"].text) < Number(root["sta"].scorel.text)){
root["vite"].gotoAndStop((root["vite"].currentFrame + 1));
root["don"].nlbtn.visible = false;
if (root["vite"].currentFrame == 6){
root["don"].tabtn.visible = false;
MochiScores.showLeaderboard({clip:root, boardID:"4845705573fdc20e", score:root["totpoints"].text, name:root["nome"].nome2});
};
};
root["tempo"].text = "0";
timer.reset();
}
}
}//package pistoleros_fla
Section 94
//BulADV_18 (pistoleros_fla.BulADV_18)
package pistoleros_fla {
import flash.display.*;
public dynamic class BulADV_18 extends MovieClip {
public function BulADV_18(){
addFrameScript(179, frame180);
}
function frame180(){
stop();
}
}
}//package pistoleros_fla
Section 95
//donelivello_6 (pistoleros_fla.donelivello_6)
package pistoleros_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.net.*;
import flash.system.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.printing.*;
import flash.xml.*;
public dynamic class donelivello_6 extends MovieClip {
public var scorel:TextField;
public var tempo:TextField;
public var totpoints:TextField;
public var livello:Number;
public var tabtn:SimpleButton;
public var nlbtn:SimpleButton;
public function donelivello_6(){
addFrameScript(0, frame1);
}
function frame1(){
tabtn.addEventListener(MouseEvent.CLICK, clickHandler);
nlbtn.addEventListener(MouseEvent.CLICK, clickHandler2);
}
public function clickHandler(_arg1:MouseEvent):void{
root["bullet"].masc.scaleY = 1;
root["bul"] = 1;
livello = Number(root["sta"].livello.text);
var _local2 = root["tredi"];
_local2[("liv" + livello)]();
}
public function clickHandler2(_arg1:MouseEvent):void{
root["bul"] = 1;
root["totpoints"].text = (Number(root["totpoints"].text) + Number(root["don"].totpoints.text));
livello = (Number(root["sta"].livello.text) + 1);
var _local2 = root["tredi"];
_local2[("liv" + livello)]();
}
}
}//package pistoleros_fla
Section 96
//HighRes_15 (pistoleros_fla.HighRes_15)
package pistoleros_fla {
import flash.display.*;
public dynamic class HighRes_15 extends MovieClip {
public var ix:MovieClip;
}
}//package pistoleros_fla
Section 97
//MainTimeline (pistoleros_fla.MainTimeline)
package pistoleros_fla {
import flash.display.*;
import flash.events.*;
import flash.geom.*;
import flash.utils.*;
import mochi.*;
import flash.media.*;
import flash.filters.*;
import flash.text.*;
import flash.ui.*;
import flash.net.*;
import flash.system.*;
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 shot;
public var bullet:MovieClip;
public var hr:MovieClip;
public var nome:MovieClip;
public var tempo:TextField;
public var sta:MovieClip;
public var punti:TextField;
public var don:MovieClip;
public var timer:Timer;
public var sn:MovieClip;
public var cursor:cursore;
public var vite:MovieClip;
public var tredi:MovieClip;
public var totpoints:TextField;
public var rsbtn:SimpleButton;
public var bul;
public var time:Number;
public var ora;
public function MainTimeline(){
addFrameScript(0, frame1, 1, frame2, 2, frame3);
}
public function redrawCursor(_arg1:MouseEvent):void{
cursor.x = _arg1.stageX;
cursor.y = _arg1.stageY;
}
public function cb(_arg1:MouseEvent):void{
bul = (bul * -1);
}
function frame3(){
MochiServices.connect("7d5e458d27e6aa4d", root);
shot = new Shot();
don.visible = false;
sta.visible = false;
bul = 1;
cursor.mouseEnabled = false;
cursor.mouseChildren = false;
stage.addEventListener(MouseEvent.MOUSE_DOWN, md1);
stage.addEventListener(MouseEvent.MOUSE_MOVE, redrawCursor);
rsbtn.addEventListener(MouseEvent.CLICK, clickHandler);
ora = 1;
hr.addEventListener(MouseEvent.CLICK, hrb);
sn.addEventListener(MouseEvent.CLICK, snb);
stage.addEventListener(KeyboardEvent.KEY_UP, keyUpHandler);
bullet.addEventListener(MouseEvent.CLICK, cb);
stop();
}
public function snb(_arg1:MouseEvent):void{
ora = 1;
if (((sn.ix.visible) && ((ora == 1)))){
sn.ix.visible = false;
ora = 0;
SoundMixer.soundTransform = new SoundTransform(0);
};
if (((!(sn.ix.visible)) && ((ora == 1)))){
sn.ix.visible = true;
ora = 0;
SoundMixer.soundTransform = new SoundTransform(1);
};
}
function frame2(){
nome.visible = true;
stop();
}
public function keyUpHandler(_arg1:KeyboardEvent):void{
if (_arg1.keyCode == 32){
bul = (bul * -1);
};
}
public function hrb(_arg1:MouseEvent):void{
ora = 1;
if (((hr.ix.visible) && ((ora == 1)))){
hr.ix.visible = false;
ora = 0;
stage.quality = StageQuality.LOW;
};
if (((!(hr.ix.visible)) && ((ora == 1)))){
hr.ix.visible = true;
ora = 0;
stage.quality = StageQuality.HIGH;
};
}
function frame1(){
stage.showDefaultContextMenu = false;
timer = new Timer(1000, 4);
time = 0;
timer.start();
timer.addEventListener(TimerEvent.TIMER, notifier);
stop();
}
public function notifier(_arg1:TimerEvent):void{
time++;
if (time == 4){
gotoAndStop(2);
};
}
public function md1(_arg1:MouseEvent):void{
if (((!(sta.visible)) && (!(don.visible)))){
shot.play();
};
}
public function clickHandler(_arg1:MouseEvent):void{
bullet.masc.scaleY = 1;
tredi.donvis();
tredi.liv1();
vite.gotoAndStop(1);
don.tabtn.visible = true;
}
}
}//package pistoleros_fla
Section 98
//pallottola_13 (pistoleros_fla.pallottola_13)
package pistoleros_fla {
import flash.display.*;
public dynamic class pallottola_13 extends MovieClip {
public var masc:MovieClip;
}
}//package pistoleros_fla
Section 99
//SoundC_17 (pistoleros_fla.SoundC_17)
package pistoleros_fla {
import flash.display.*;
public dynamic class SoundC_17 extends MovieClip {
public var ix:MovieClip;
}
}//package pistoleros_fla
Section 100
//startplay_9 (pistoleros_fla.startplay_9)
package pistoleros_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.net.*;
import flash.system.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.printing.*;
import flash.xml.*;
public dynamic class startplay_9 extends MovieClip {
public var scorel:TextField;
public var tempo:TextField;
public var livello:TextField;
public var startbtn:SimpleButton;
public function startplay_9(){
addFrameScript(0, frame1);
}
function frame1(){
startbtn.addEventListener(MouseEvent.CLICK, clickHandler);
}
public function clickHandler(_arg1:MouseEvent):void{
root["don"].nlbtn.visible = true;
root["sta"].visible = false;
tempo.text = tempo.text.split(" Seconds").join("");
root["tredi"].tempofin = tempo.text;
root["tempo"].text = tempo.text;
root["tredi"].timer.reset();
root["tredi"].timer.start();
}
}
}//package pistoleros_fla
Section 101
//UgoIntro_1 (pistoleros_fla.UgoIntro_1)
package pistoleros_fla {
import flash.display.*;
import flash.events.*;
import flash.net.*;
public dynamic class UgoIntro_1 extends MovieClip {
public var url:String;
public var tag:SimpleButton;
public var request:URLRequest;
public function UgoIntro_1(){
addFrameScript(0, frame1, 60, frame61, 164, frame165);
}
function frame165(){
stop();
}
function frame1(){
nielsen("game_intro");
}
public function nielsen(_arg1){
var _local2:String;
var _local3:String;
var _local4:String;
var _local5:URLRequest;
var _local6:Loader;
_local2 = "us-ugo";
_local3 = "ugoplayer_flashgames";
_local4 = escape(_arg1);
_local5 = new URLRequest(((((((("http://secure-us.imrworldwide.com/cgi-bin/m?ci=" + _local2) + "&cg=") + _local3) + "&si=") + _local4) + "&rnd=") + Math.ceil((Math.random() * 100000000))));
_local6 = new Loader();
_local6.load(_local5);
addChild(_local6);
}
function frame61(){
tag.addEventListener(MouseEvent.MOUSE_DOWN, mouseDown);
url = "http://secure-us.imrworldwide.com/cgi-bin/b?cg=ugoplayer_flash_games&ci=us-ugclicks&tu=http://www.ugoplayer.com";
request = new URLRequest(url);
}
public function mouseDown(_arg1:MouseEvent):void{
navigateToURL(request, "_blank");
}
}
}//package pistoleros_fla
Section 102
//Vite_11 (pistoleros_fla.Vite_11)
package pistoleros_fla {
import flash.display.*;
public dynamic class Vite_11 extends MovieClip {
public function Vite_11(){
addFrameScript(0, frame1, 1, frame2, 2, frame3, 3, frame4, 4, frame5, 5, frame6);
}
function frame3(){
stop();
}
function frame6(){
stop();
}
function frame1(){
stop();
}
function frame4(){
stop();
}
function frame5(){
stop();
}
function frame2(){
stop();
}
}
}//package pistoleros_fla
Section 103
//yourname_3 (pistoleros_fla.yourname_3)
package pistoleros_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.net.*;
import flash.system.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.printing.*;
import flash.xml.*;
public dynamic class yourname_3 extends MovieClip {
public var okbtn:SimpleButton;
public var nome:TextField;
public var nome2;
public var user;
public function yourname_3(){
addFrameScript(0, frame1);
}
function frame1(){
user = SharedObject.getLocal("user_profile");
if (user.data.username != undefined){
nome.text = user.data.username;
};
okbtn.addEventListener(MouseEvent.MOUSE_DOWN, md1);
}
public function md1(_arg1:MouseEvent):void{
user.data.username = nome.text;
root["nome"].visible = false;
nome2 = nome.text;
MovieClip(root).gotoAndPlay(3);
}
}
}//package pistoleros_fla
Section 104
//bkg (bkg)
package {
import flash.display.*;
public dynamic class bkg extends BitmapData {
public function bkg(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 105
//Can3DLow (Can3DLow)
package {
import away3d.core.mesh.*;
import away3d.core.utils.*;
public class Can3DLow extends Mesh {
private var uvarr:Array;
private var varr:Array;
private var scaling:Number;
public function Can3DLow(_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.49948, 25.40871, -15.03125);
v(7.49748, 1.14912, -18.10051);
v(21.20607, 0, 0);
v(19.19597, 26.12037, 1.02341);
v(-11.88964, 25.49505, -15.26472);
v(-14.99496, 1.14912, -14.99496);
v(-18.26224, 15.39547, -2.5881);
v(-18.219, -0.12893, 7.0867);
v(10.75263, 0.16705, 16.70019);
v(6.04704, 31.78037, 15.76971);
v(-21.20607, 55.09014, 0.00982);
v(-12.99302, 36.84528, 12.49289);
v(-9.80353, 0.02248, 17.58995);
v(14.99495, 55.23958, -15.17697);
v(21.20607, 55.14047, 0.01963);
v(0, 56.16714, -21.22672);
v(-14.99496, 55.23959, -15.17697);
v(-14.99495, 56.28123, 14.99496);
v(0, 56.28123, 21.20607);
v(14.99495, 56.28123, 14.99495);
v(-11.13667, 79.45585, 7.37863);
v(-21.47615, 65.00785, -0.4108);
v(19.3418, 63.13163, 3.47455);
v(12.0322, 79.18917, 9.93266);
uv(0.836834, 0.454007);
uv(0.856161, 0.02536);
uv(0.722427, 0.005056);
uv(0.716381, 0.466582);
uv(0.970278, 0.254983);
uv(0.989895, 0.02536);
uv(0.349823, 0.277081);
uv(0.408339, 0.002778);
uv(0.276648, 0.02536);
uv(0.262647, 0.455533);
uv(0.585271, 0.008007);
uv(0.585777, 0.56659);
uv(0.365856, 0.978455);
uv(0.452732, 0.656083);
uv(0.498847, 0.005453);
uv(0.811509, 0.979344);
uv(0.722322, 0.979344);
uv(0.900739, 0.9995);
uv(0.989969, 0.979344);
uv(0.981509, 0.656083);
uv(0.276722, 0.979344);
uv(0.45496, 0.9995);
uv(0.544115, 0.9995);
uv(0.633271, 0.9995);
uv(0.165765, 0.92545);
uv(0.036671, 0.852371);
uv(0.018167, 0.332752);
uv(0.244444, 0.499514);
uv(0.091808, 0.201415);
uv(0.162126, 0.076005);
uv(0.036131, 0.905605);
uv(0.119314, 1.014852);
uv(0.202497, 0.905604);
uv(0.036131, 0.114857);
uv(0.001676, 0.431211);
uv(0.219725, 0.272813);
uv(0.119314, -0.027279);
f(0, 1, 2, 0, 1, 2);
f(2, 3, 0, 2, 3, 0);
f(4, 5, 1, 4, 5, 1);
f(1, 0, 4, 1, 0, 4);
f(6, 7, 5, 6, 7, 8);
f(5, 4, 6, 8, 9, 6);
f(3, 2, 8, 3, 2, 10);
f(8, 9, 3, 10, 11, 3);
f(10, 6, 4, 12, 6, 9);
f(11, 7, 6, 13, 7, 6);
f(6, 10, 11, 6, 12, 13);
f(9, 8, 12, 11, 10, 14);
f(13, 0, 3, 15, 0, 3);
f(3, 14, 13, 3, 16, 15);
f(13, 15, 0, 15, 17, 0);
f(16, 4, 0, 18, 19, 0);
f(0, 15, 16, 0, 17, 18);
f(16, 10, 4, 20, 12, 9);
f(17, 11, 10, 21, 13, 12);
f(18, 9, 11, 22, 11, 13);
f(11, 17, 18, 13, 21, 22);
f(18, 19, 9, 22, 23, 11);
f(14, 3, 9, 16, 3, 11);
f(9, 19, 14, 11, 23, 16);
f(1, 5, 7, 24, 25, 26);
f(2, 1, 7, 27, 24, 26);
f(2, 7, 12, 27, 26, 28);
f(2, 12, 8, 27, 28, 29);
f(16, 15, 13, 30, 31, 32);
f(20, 21, 16, 33, 34, 30);
f(22, 23, 20, 35, 36, 33);
f(22, 20, 16, 35, 33, 30);
f(22, 16, 13, 35, 30, 32);
f(12, 11, 9, 14, 13, 11);
f(12, 7, 11, 14, 7, 13);
}
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 106
//CanMat1 (CanMat1)
package {
import flash.display.*;
public dynamic class CanMat1 extends MovieClip {
}
}//package
Section 107
//CanMat2 (CanMat2)
package {
import flash.display.*;
public dynamic class CanMat2 extends MovieClip {
}
}//package
Section 108
//CanMat3 (CanMat3)
package {
import flash.display.*;
public dynamic class CanMat3 extends MovieClip {
}
}//package
Section 109
//Cassa (Cassa)
package {
import flash.display.*;
public dynamic class Cassa extends MovieClip {
}
}//package
Section 110
//cursore (cursore)
package {
import flash.display.*;
public dynamic class cursore extends MovieClip {
}
}//package
Section 111
//Hit (Hit)
package {
import flash.media.*;
public dynamic class Hit extends Sound {
}
}//package
Section 112
//Holder1 (Holder1)
package {
import away3d.core.mesh.*;
import away3d.core.utils.*;
public class Holder1 extends Mesh {
private var uvarr:Array;
private var varr:Array;
private var scaling:Number;
public function Holder1(_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(4.95736, -0.97469, 5.92272);
v(4.9574, 272.26059, 5.92272);
v(4.9574, 272.26059, -4.07728);
v(4.95736, -0.97469, -4.07728);
v(-5.04264, -0.97469, 5.92272);
v(-5.04264, -0.97469, -4.07728);
v(-5.0426, 272.26059, -4.07728);
v(-5.0426, 272.26059, 5.92272);
v(-16.97479, 272.72827, 61.01215);
v(-33.4008, 272.72827, 32.56146);
v(-16.97479, 272.72827, 4.11078);
v(32.30323, 272.72827, 32.56147);
v(15.87723, 272.72827, 61.01215);
v(15.87722, 272.72827, 4.11078);
v(-33.4008, 271.69615, 32.56146);
v(-16.97479, 271.69613, 61.01215);
v(15.87723, 271.69613, 61.01215);
v(15.87722, 271.69613, 4.11078);
v(-16.97479, 271.69613, 4.11078);
v(32.30323, 271.69613, 32.56147);
v(-16.97479, 180.9392, 61.01214);
v(-33.4008, 180.9392, 32.56146);
v(-16.97479, 180.9392, 4.11078);
v(32.30323, 180.9392, 32.56147);
v(15.87722, 180.9392, 61.01214);
v(15.87722, 180.9392, 4.11078);
v(-33.4008, 179.90707, 32.56146);
v(-16.97479, 179.90705, 61.01214);
v(15.87722, 179.90705, 61.01214);
v(15.87722, 179.90705, 4.11078);
v(-16.97479, 179.90705, 4.11078);
v(32.30323, 179.90705, 32.56147);
v(-16.9748, 91.55514, 61.01214);
v(-33.40081, 91.55514, 32.56145);
v(-16.97479, 91.55514, 4.11077);
v(32.30323, 91.55514, 32.56146);
v(15.87722, 91.55513, 61.01214);
v(15.87722, 91.55513, 4.11077);
v(-33.4008, 90.52301, 32.56145);
v(-16.9748, 90.52299, 61.01214);
v(15.87722, 90.52299, 61.01214);
v(15.87721, 90.52299, 4.11077);
v(-16.97479, 90.52299, 4.11077);
v(32.30323, 90.52299, 32.56146);
uv(0.101655, 0.098874);
uv(0.101655, 0.098875);
uv(0.101655, -0.054606);
uv(0.101655, -0.054607);
uv(0.138155, 0.098874);
uv(0.138155, -0.054607);
uv(0.138155, -0.054606);
uv(0.138155, 0.098875);
uv(0.181706, 0.944394);
uv(0.24166, 0.507729);
uv(0.181706, 0.071065);
uv(0.001844, 0.507729);
uv(0.061798, 0.944394);
uv(0.061798, 0.071065);
uv(0.24166, 0.507729);
uv(0.181706, 0.944394);
uv(0.061798, 0.944394);
uv(0.061798, 0.071065);
uv(0.181706, 0.071065);
uv(0.001844, 0.507729);
uv(0.181706, 0.944394);
uv(0.24166, 0.507729);
uv(0.181706, 0.071065);
uv(0.001844, 0.507729);
uv(0.061798, 0.944394);
uv(0.061798, 0.071065);
uv(0.24166, 0.507729);
uv(0.181706, 0.944394);
uv(0.061798, 0.944394);
uv(0.061798, 0.071065);
uv(0.181706, 0.071065);
uv(0.001844, 0.507729);
uv(0.181706, 0.944394);
uv(0.24166, 0.507729);
uv(0.181706, 0.071065);
uv(0.001844, 0.507729);
uv(0.061798, 0.944394);
uv(0.061798, 0.071065);
uv(0.24166, 0.507729);
uv(0.181706, 0.944394);
uv(0.061798, 0.944394);
uv(0.061798, 0.071065);
uv(0.181706, 0.071065);
uv(0.001844, 0.507729);
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(5, 3, 2, 5, 3, 2);
f(2, 6, 5, 2, 6, 5);
f(7, 1, 0, 7, 1, 0);
f(0, 4, 7, 0, 4, 7);
f(8, 9, 10, 8, 9, 10);
f(11, 12, 8, 11, 12, 8);
f(11, 8, 10, 11, 8, 10);
f(11, 10, 13, 11, 10, 13);
f(14, 15, 16, 14, 15, 16);
f(17, 18, 14, 17, 18, 14);
f(17, 14, 16, 17, 14, 16);
f(17, 16, 19, 17, 16, 19);
f(20, 21, 22, 20, 21, 22);
f(23, 24, 20, 23, 24, 20);
f(23, 20, 22, 23, 20, 22);
f(23, 22, 25, 23, 22, 25);
f(26, 27, 28, 26, 27, 28);
f(29, 30, 26, 29, 30, 26);
f(29, 26, 28, 29, 26, 28);
f(29, 28, 31, 29, 28, 31);
f(32, 33, 34, 32, 33, 34);
f(35, 36, 32, 35, 36, 32);
f(35, 32, 34, 35, 32, 34);
f(35, 34, 37, 35, 34, 37);
f(38, 39, 40, 38, 39, 40);
f(41, 42, 38, 41, 42, 38);
f(41, 38, 40, 41, 38, 40);
f(41, 40, 43, 41, 40, 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 113
//Holder2 (Holder2)
package {
import away3d.core.mesh.*;
import away3d.core.utils.*;
public class Holder2 extends Mesh {
private var uvarr:Array;
private var varr:Array;
private var scaling:Number;
public function Holder2(_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(5.45489, -0.62467, 5.05174);
v(-4.54511, -0.62467, 0.05174);
v(-4.54511, -300.62466, 0.05174);
v(5.45489, -300.62466, 5.05174);
v(-4.54511, -300.62466, 10.05174);
v(-4.54511, -0.62467, 10.05174);
v(-253.79524, 0, -0.11977);
v(-179.50123, 1E-5, -179.4813);
v(-0.13972, 1E-5, -253.77525);
v(-0.13974, -1E-5, 253.53577);
v(-179.50127, -1E-5, 179.24179);
v(253.51578, 0, -0.11975);
v(179.22178, -1E-5, 179.24179);
v(179.22176, 1E-5, -179.4813);
uv(0.123333, 0.510184);
uv(0.11853, 0.500338);
uv(0.11853, 0.500338);
uv(0.123333, 0.510184);
uv(0.11853, 0.52003);
uv(0.11853, 0.52003);
uv(-0.001184, 0.5);
uv(0.034499, 0.1468);
uv(0.120646, 0.0005);
uv(0.120646, 0.9995);
uv(0.034499, 0.8532);
uv(0.242475, 0.5);
uv(0.206792, 0.8532);
uv(0.206792, 0.1468);
f(0, 1, 2, 0, 1, 2);
f(2, 3, 0, 2, 3, 0);
f(0, 3, 4, 0, 3, 4);
f(4, 5, 0, 4, 5, 0);
f(4, 2, 1, 4, 2, 1);
f(1, 5, 4, 1, 5, 4);
f(6, 7, 8, 6, 7, 8);
f(9, 10, 6, 9, 10, 6);
f(11, 12, 9, 11, 12, 9);
f(11, 9, 6, 11, 9, 6);
f(11, 6, 8, 11, 6, 8);
f(11, 8, 13, 11, 8, 13);
}
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 114
//Shot (Shot)
package {
import flash.media.*;
public dynamic class Shot extends Sound {
}
}//package