Section 1
//Camera3D (away3d.cameras.Camera3D)
package away3d.cameras {
import away3d.core.draw.*;
import away3d.core.base.*;
import away3d.core.utils.*;
import away3d.core.render.*;
import away3d.core.math.*;
import flash.utils.*;
public class Camera3D extends Object3D {
private var _view:Matrix3D;
public var maxblur:Number;// = 150
private var _flipY:Matrix3D;
public var zoom:Number;
private var _focus:Number;
public var doflevels:Number;// = 16
private var _aperture:Number;// = 22
private var _screenProjection:Projection;
private var _dof:Boolean;// = false
public function Camera3D(_arg1:Object=null){
_flipY = new Matrix3D();
_view = new Matrix3D();
_screenProjection = new Projection();
super(_arg1);
zoom = ini.getNumber("zoom", 10);
focus = ini.getNumber("focus", 100);
aperture = ini.getNumber("aperture", 22);
maxblur = ini.getNumber("maxblur", 150);
doflevels = ini.getNumber("doflevels", 16);
dof = ini.getBoolean("dof", false);
var _local2:Number3D = ini.getPosition("lookat");
_flipY.syy = -1;
if (_local2 != null){
lookAt(_local2);
};
}
public function disableDof():void{
DofCache.resetDof(false);
}
public function get aperture():Number{
return (_aperture);
}
public function get focus():Number{
return (_focus);
}
public function pan(_arg1:Number):void{
super.yaw(_arg1);
}
public function set aperture(_arg1:Number):void{
_aperture = _arg1;
DofCache.aperture = _aperture;
}
override public function clone(_arg1=null){
var _local2:Camera3D = ((_arg1) || (new Camera3D()));
super.clone(_local2);
_local2.zoom = zoom;
_local2.focus = focus;
return (_local2);
}
public function get view():Matrix3D{
viewTransform.multiply(sceneTransform, _flipY);
_view.inverse(viewTransform);
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;
_screenProjection.time = getTimer();
return (_arg2.project(_screenProjection));
}
public function set focus(_arg1:Number):void{
_focus = _arg1;
DofCache.focus = _focus;
}
public function set dof(_arg1:Boolean):void{
_dof = _arg1;
if (_dof){
enableDof();
} else {
disableDof();
};
}
public function get dof():Boolean{
return (_dof);
}
public function tilt(_arg1:Number):void{
super.pitch(_arg1);
}
public function enableDof():void{
DofCache.doflevels = doflevels;
DofCache.aperture = aperture;
DofCache.maxblur = maxblur;
DofCache.focus = focus;
DofCache.resetDof(true);
}
}
}//package away3d.cameras
Section 2
//ILODObject (away3d.containers.ILODObject)
package away3d.containers {
public interface ILODObject {
function matchLOD(_arg1:View3D):Boolean;
}
}//package away3d.containers
Section 3
//IPhysicsScene (away3d.containers.IPhysicsScene)
package away3d.containers {
public interface IPhysicsScene {
function updateTime(_arg1:int):void;
}
}//package away3d.containers
Section 4
//ObjectContainer3D (away3d.containers.ObjectContainer3D)
package away3d.containers {
import away3d.core.draw.*;
import away3d.core.base.*;
import away3d.events.*;
import away3d.core.math.*;
import away3d.core.traverse.*;
public class ObjectContainer3D extends Object3D implements IPrimitiveProvider {
private var _maxXChild:Object3D;// = null
private var _minYChild:Object3D;// = null
private var _needNotifyDimensionsChange:Boolean;// = false
private var _needNotifyRadiusChange:Boolean;// = false
private var _radiusDirty:Boolean;// = false
private var _minX:Number;// = INF
private var _minZ:Number;// = INF
private var _maxYChild:Object3D;// = null
private var _minXDirty:Boolean;// = false
private var _radius:Number;// = 0
private var _minZChild:Object3D;// = null
private var _minY:Number;// = INF
private var _maxXDirty:Boolean;// = false
private var _maxZChild:Object3D;// = null
private var _minYDirty:Boolean;// = false
private var _maxX:Number;
private var _maxY:Number;
private var _maxZ:Number;
private var _children:Array;
private var _maxYDirty:Boolean;// = false
private var _radiusChild:Object3D;// = null
private var _minZDirty:Boolean;// = false
private var _minXChild:Object3D;// = null
private var _maxZDirty:Boolean;// = false
public function ObjectContainer3D(_arg1:Object=null, ... _args){
var _local3:Object3D;
_children = new Array();
_maxX = -(Infinity);
_maxY = -(Infinity);
_maxZ = -(Infinity);
if (((!((_arg1 == null))) && ((_arg1 is Object3D)))){
addChild((_arg1 as Object3D));
_arg1 = null;
};
super(_arg1);
for each (_local3 in _args) {
addChild(_local3);
};
}
private function launchNotifies():void{
if (_needNotifyRadiusChange){
_needNotifyRadiusChange = false;
notifyRadiusChange();
};
if (_needNotifyDimensionsChange){
_needNotifyDimensionsChange = false;
notifyDimensionsChange();
};
}
public function addChild(_arg1:Object3D):void{
if (_arg1 == null){
throw (new Error("ObjectContainer3D.addChild(null)"));
};
if (_arg1.parent == this){
return;
};
_arg1.parent = this;
}
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 getChildByName(_arg1:String):Object3D{
var _local2:Object3D;
for each (_local2 in children) {
if (_local2.name == _arg1){
return (_local2);
};
};
return (null);
}
private function onChildChange(_arg1:Object3DEvent):void{
var _local2:Object3D = _arg1.object;
forgetChild(_local2);
rememberChild(_local2);
launchNotifies();
}
private function rememberChild(_arg1:Object3D):void{
var _local2:Number = _arg1.parentradius;
if (_local2 > _radius){
_radius = _local2;
_radiusChild = _arg1;
_radiusDirty = false;
_needNotifyRadiusChange = true;
};
var _local3:Number = _arg1.parentmaxX;
if (_local3 > _maxX){
_maxX = _local3;
_maxXChild = _arg1;
_maxXDirty = false;
_needNotifyDimensionsChange = true;
};
var _local4:Number = _arg1.parentminX;
if (_local4 < _minX){
_minX = _local4;
_minXChild = _arg1;
_minXDirty = false;
_needNotifyDimensionsChange = true;
};
var _local5:Number = _arg1.parentmaxY;
if (_local5 > _maxY){
_maxY = _local5;
_maxYChild = _arg1;
_maxYDirty = false;
_needNotifyDimensionsChange = true;
};
var _local6:Number = _arg1.parentminY;
if (_local6 < _minY){
_minY = _local6;
_minYChild = _arg1;
_minYDirty = false;
_needNotifyDimensionsChange = true;
};
var _local7:Number = _arg1.parentmaxZ;
if (_local7 > _maxZ){
_maxZ = _local7;
_maxZChild = _arg1;
_maxZDirty = false;
_needNotifyDimensionsChange = true;
};
var _local8:Number = _arg1.parentminZ;
if (_local8 < _minZ){
_minZ = _local8;
_minZChild = _arg1;
_minZDirty = false;
_needNotifyDimensionsChange = true;
};
}
public function removeChildByName(_arg1:String):void{
removeChild(getChildByName(_arg1));
}
override public function get minX():Number{
var _local1:Number;
var _local2:Object3D;
var _local3:Number;
if (_minXDirty){
_minXChild = null;
_local1 = Infinity;
for each (_local2 in _children) {
_local3 = _local2.parentminX;
if (_local3 < _local1){
_local1 = _local3;
_minXChild = _local2;
};
};
_minX = _local1;
_minXDirty = false;
};
return (_minX);
}
override public function get minZ():Number{
var _local1:Number;
var _local2:Object3D;
var _local3:Number;
if (_minZDirty){
_local1 = Infinity;
_minZChild = null;
for each (_local2 in _children) {
_local3 = _local2.parentminZ;
if (_local3 < _local1){
_local1 = _local3;
_minZChild = _local2;
};
};
_minZ = _local1;
_minZDirty = false;
};
return (_minZ);
}
public function addChildren(... _args):void{
var _local2:Object3D;
for each (_local2 in _args) {
addChild(_local2);
};
}
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;
};
}
function internalAddChild(_arg1:Object3D):void{
_children.push(_arg1);
_arg1.addOnTransformChange(onChildChange);
_arg1.addOnRadiusChange(onChildChange);
rememberChild(_arg1);
launchNotifies();
}
override public function scale(_arg1:Number):void{
var _local2:Object3D;
for each (_local2 in children) {
_local2.x = (_local2.x * _arg1);
_local2.y = (_local2.y * _arg1);
_local2.z = (_local2.z * _arg1);
_local2.scale(_arg1);
};
}
override public function get minY():Number{
var _local1:Number;
var _local2:Object3D;
var _local3:Number;
if (_minYDirty){
_local1 = Infinity;
_minYChild = null;
for each (_local2 in _children) {
_local3 = _local2.parentminY;
if (_local3 < _local1){
_local1 = _local3;
_minYChild = _local2;
};
};
_minY = _local1;
_minYDirty = false;
};
return (_minY);
}
override public function clone(_arg1=null){
var _local3:Object3D;
var _local2:ObjectContainer3D = ((_arg1) || (new ObjectContainer3D()));
super.clone(_local2);
for each (_local3 in children) {
_local2.addChild(_local3.clone());
};
return (_local2);
}
public function movePivot(_arg1:Number, _arg2:Number, _arg3:Number):void{
var _local4:Object3D;
var _local5:Number3D;
for each (_local4 in _children) {
_local4.x = (_local4.x - _arg1);
_local4.y = (_local4.y - _arg2);
_local4.z = (_local4.z - _arg3);
};
_local5 = new Number3D(_arg1, _arg2, _arg3);
new Number3D(_arg1, _arg2, _arg3).rotate(_local5.clone(), _transform);
_local5.add(_local5, position);
moveTo(_local5);
}
override public function get maxX():Number{
var _local1:Number;
var _local2:Object3D;
var _local3:Number;
if (_maxXDirty){
_maxXChild = null;
_local1 = -(Infinity);
for each (_local2 in _children) {
_local3 = _local2.parentmaxX;
if (_local3 > _local1){
_local1 = _local3;
_maxXChild = _local2;
};
};
_maxX = _local1;
_maxXDirty = false;
};
return (_maxX);
}
override public function get maxY():Number{
var _local1:Number;
var _local2:Object3D;
var _local3:Number;
if (_maxYDirty){
_local1 = -(Infinity);
_maxYChild = null;
for each (_local2 in _children) {
_local3 = _local2.parentmaxY;
if (_local3 > _local1){
_local1 = _local3;
_maxYChild = _local2;
};
};
_maxY = _local1;
_maxYDirty = false;
};
return (_maxY);
}
override public function get maxZ():Number{
var _local1:Number;
var _local2:Object3D;
var _local3:Number;
if (_maxZDirty){
_local1 = -(Infinity);
_maxZChild = null;
for each (_local2 in _children) {
_local3 = _local2.parentmaxZ;
if (_local3 > _local1){
_local1 = _local3;
_maxZChild = _local2;
};
};
_maxZ = _local1;
_maxZDirty = false;
};
return (_maxZ);
}
override public function get boundingRadius():Number{
var _local1:Number;
var _local2:Object3D;
var _local3:Number;
if (_radiusDirty){
_radiusChild = null;
_local1 = 0;
for each (_local2 in _children) {
_local3 = _local2.parentradius;
if (_local3 > _local1){
_local1 = _local3;
_radiusChild = _local2;
};
};
_radius = _local1;
_radiusDirty = false;
};
return (_radius);
}
override public function traverse(_arg1:Traverser):void{
var _local2:Object3D;
if (_arg1.match(this)){
_arg1.enter(this);
_arg1.apply(this);
for each (_local2 in children) {
_local2.traverse(_arg1);
};
_arg1.leave(this);
};
}
function internalRemoveChild(_arg1:Object3D):void{
var _local2:int = 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.containers
Section 5
//Scene3D (away3d.containers.Scene3D)
package away3d.containers {
import away3d.core.base.*;
import away3d.core.utils.*;
import away3d.core.math.*;
import away3d.core.traverse.*;
import flash.utils.*;
public class Scene3D extends ObjectContainer3D {
public var physics:IPhysicsScene;
public var tickTraverser:TickTraverser;
public function Scene3D(_arg1:Object=null, ... _args){
var _local4:Object3D;
tickTraverser = new TickTraverser();
super();
if (((!((_arg1 == null))) && ((_arg1 is Object3D)))){
addChild((_arg1 as Object3D));
_arg1 = null;
};
ini = Init.parse(_arg1);
var _local3:Object = ini.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);
};
}
override public function get sceneTransform():Matrix3D{
if (_transformDirty){
_sceneTransformDirty = true;
};
if (_sceneTransformDirty){
_sceneTransformDirty = false;
notifySceneTransformChange();
};
return (transform);
}
override public function get parent():ObjectContainer3D{
return (super.parent);
}
override public function set parent(_arg1:ObjectContainer3D):void{
if (_arg1 != null){
throw (new Error("Scene can't be parented"));
};
}
public function updateTime(_arg1:int=-1):void{
if (_arg1 == -1){
_arg1 = getTimer();
};
tickTraverser.now = _arg1;
traverse(tickTraverser);
if (physics != null){
physics.updateTime(_arg1);
};
}
}
}//package away3d.containers
Section 6
//View3D (away3d.containers.View3D)
package away3d.containers {
import flash.events.*;
import flash.display.*;
import away3d.core.clip.*;
import away3d.core.base.*;
import away3d.core.utils.*;
import away3d.core.render.*;
import away3d.events.*;
import away3d.materials.*;
import away3d.cameras.*;
import away3d.core.stats.*;
public class View3D extends Sprite {
public var statsOpen:Boolean;
public var scene:Scene3D;
public var stats:Boolean;
private var _renderer:IRenderer;
public var camera:Camera3D;
private var _ini:Init;
public var statsPanel:Stats;
public var background:Sprite;
private var _oldclip:Clipping;
public var findhit:FindHit;
private var _mousedown:Boolean;
public var clip:Clipping;
private var _defaultclip:Clipping;
public var mouseObject:Object3D;
public var sourceURL:String;
private var _session:AbstractRenderSession;
public var mouseZeroMove:Boolean;
private var _lastmove_mouseX:Number;
private var _lastmove_mouseY:Number;
public var primitives:Array;
var _interactiveLayer:Sprite;
public var hud:Sprite;
public var mouseMaterial:IUVMaterial;
public function View3D(_arg1:Object=null){
_interactiveLayer = new Sprite();
_defaultclip = new Clipping();
background = new Sprite();
hud = new Sprite();
super();
_ini = (Init.parse(_arg1) as Init);
var _local2:Boolean = _ini.getBoolean("stats", true);
scene = (((_ini.getObjectOrInit("scene", Scene3D) as Scene3D)) || (new Scene3D()));
camera = (((_ini.getObjectOrInit("camera", Camera3D) as Camera3D)) || (new Camera3D({x:0, y:0, z:1000, lookat:"center"})));
_renderer = (((_ini.getObject("renderer") as IRenderer)) || (new BasicRenderer()));
session = (((_ini.getObject("session") as AbstractRenderSession)) || (new SpriteRenderSession()));
clip = (_ini.getObject("clip", Clipping) as Clipping);
x = _ini.getNumber("x", 0);
y = _ini.getNumber("y", 0);
_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 (_local2){
addEventListener(Event.ADDED_TO_STAGE, createStatsMenu);
};
}
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;
}
private function createStatsMenu(_arg1:Event):void{
statsPanel = new Stats(this, stage.frameRate);
statsOpen = false;
}
public function flush():void{
_session.flush();
clip = _oldclip;
}
public function set renderer(_arg1:IRenderer):void{
_renderer = _arg1;
_renderer.session = _session;
}
function dispatchMouseEvent(_arg1:MouseEvent3D):void{
if (!hasEventListener(_arg1.type)){
return;
};
dispatchEvent(_arg1);
}
public function removeOnMouseOut(_arg1:Function):void{
removeEventListener(MouseEvent3D.MOUSE_OUT, _arg1, false);
}
public function get session():AbstractRenderSession{
return (_session);
}
public function addOnMouseOver(_arg1:Function):void{
addEventListener(MouseEvent3D.MOUSE_OVER, _arg1, false, 0, false);
}
public function render():void{
clear();
primitives = _renderer.render(this);
flush();
Init.checkUnusedArguments();
fireMouseMoveEvent();
}
private function bubbleMouseEvent(_arg1:MouseEvent3D):void{
var _local2:Object3D = _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 removeOnMouseDown(_arg1:Function):void{
removeEventListener(MouseEvent3D.MOUSE_DOWN, _arg1, false);
}
public function set session(_arg1:AbstractRenderSession):void{
_session = _arg1;
_renderer.session = _session;
while (numChildren) {
removeChildAt(0);
};
addChild(background);
addChild(_session.getContainer(this));
addChild(_interactiveLayer);
addChild(hud);
}
public function removeOnMouseUp(_arg1:Function):void{
removeEventListener(MouseEvent3D.MOUSE_UP, _arg1, false);
}
private function onMouseUp(_arg1:MouseEvent):void{
_mousedown = false;
fireMouseEvent(MouseEvent3D.MOUSE_UP, mouseX, mouseY, _arg1.ctrlKey, _arg1.shiftKey);
}
public function get renderer():IRenderer{
return (_renderer);
}
private function onMouseDown(_arg1:MouseEvent):void{
_mousedown = true;
fireMouseEvent(MouseEvent3D.MOUSE_DOWN, mouseX, mouseY, _arg1.ctrlKey, _arg1.shiftKey);
}
private function fireMouseEvent(_arg1:String, _arg2:Number, _arg3:Number, _arg4:Boolean=false, _arg5:Boolean=false):void{
findhit = new FindHit(this, primitives, _arg2, _arg3);
var _local6:MouseEvent3D = findhit.getMouseEvent(_arg1);
var _local7:Object3D = _local6.object;
var _local8:IUVMaterial = _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 = _local7;
_local6.material = (mouseMaterial = _local8);
dispatchMouseEvent(_local6);
bubbleMouseEvent(_local6);
buttonMode = _local7.useHandCursor;
};
mouseObject = _local7;
};
}
public function clear():void{
_oldclip = clip;
if (clip == _defaultclip){
clip = _defaultclip.screen(this);
};
_session.view = this;
_session.clear();
}
public function addSourceURL(_arg1:String):void{
sourceURL = _arg1;
if (statsPanel){
statsPanel.addSourceURL(_arg1);
};
}
public function removeOnMouseOver(_arg1:Function):void{
removeEventListener(MouseEvent3D.MOUSE_OVER, _arg1, false);
}
public function removeOnMouseMove(_arg1:Function):void{
removeEventListener(MouseEvent3D.MOUSE_MOVE, _arg1, false);
}
private function onMouseOut(_arg1:MouseEvent):void{
if (_arg1.eventPhase != EventPhase.AT_TARGET){
return;
};
fireMouseEvent(MouseEvent3D.MOUSE_OUT, mouseX, mouseY, _arg1.ctrlKey, _arg1.shiftKey);
}
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);
}
public function getBitmapData():BitmapData{
if ((_session is BitmapRenderSession)){
return ((_session as BitmapRenderSession).getBitmapData(this));
};
throw (new Error("incorrect session object - require BitmapRenderSession"));
}
public function addOnMouseDown(_arg1:Function):void{
addEventListener(MouseEvent3D.MOUSE_DOWN, _arg1, false, 0, false);
}
public function getContainer():DisplayObject{
return (_session.getContainer(this));
}
private function onMouseOver(_arg1:MouseEvent):void{
if (_arg1.eventPhase != EventPhase.AT_TARGET){
return;
};
fireMouseEvent(MouseEvent3D.MOUSE_OVER, mouseX, mouseY, _arg1.ctrlKey, _arg1.shiftKey);
}
}
}//package away3d.containers
Section 7
//Animation (away3d.core.base.Animation)
package away3d.core.base {
import flash.events.*;
import away3d.events.*;
import flash.utils.*;
public class Animation extends EventDispatcher implements IAnimation {
public var sequence:Array;
public var delay:Number;// = 0
public var cycleEvent:Boolean;// = false
public var sequenceEvent:Boolean;// = false
public var loop:Boolean;// = false
private var _latest:uint;// = 0
private var _cycle:AnimationEvent;
private var _sequenceupdate:AnimationEvent;
public var frame:Number;// = 0
public var smooth:Boolean;// = false
public var fps:Number;// = 24
private var _time:uint;
private var _isRunning:Boolean;// = false
public var object:BaseMesh;
public function Animation(_arg1:BaseMesh){
sequence = [];
super();
object = _arg1;
_cycle = new AnimationEvent(AnimationEvent.CYCLE, this);
_sequenceupdate = new AnimationEvent(AnimationEvent.SQUENCE_UPDATE, this);
}
public function get latest():uint{
return (_latest);
}
public function update(_arg1:BaseMesh):void{
var _local4:Number;
var _local5:Number;
if (((!(_isRunning)) && (!(sequenceEvent)))){
return;
};
var _local2:uint = getTimer();
frame = (frame + (((_local2 - _time) * fps) / 1000));
_time = _local2;
if (sequence.length == 1){
if (cycleEvent){
dispatchEvent(_cycle);
};
if (sequenceEvent){
dispatchEvent(_sequenceupdate);
};
_isRunning = false;
_latest = 0;
frame = 0;
} else {
if (((loop) && (!(sequenceEvent)))){
while (frame > ((sequence.length - 1) + delay)) {
frame = (frame - ((sequence.length - 1) + delay));
};
} else {
if (frame > ((sequence.length - 1) + delay)){
frame = ((sequence.length - 1) + delay);
if (cycleEvent){
dispatchEvent(_cycle);
};
if (sequenceEvent){
dispatchEvent(_sequenceupdate);
};
_isRunning = false;
};
};
};
var _local3:Number = 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) || (sequenceEvent))){
if ((((((_latest == 0)) || (((_latest + 1) == sequence[int(_local4)].frame)))) || ((_latest == sequence[int(_local4)].frame)))){
_latest = sequence[int(_local4)].frame;
} else {
_latest = 0;
if (cycleEvent){
dispatchEvent(_cycle);
};
if (sequenceEvent){
dispatchEvent(_sequenceupdate);
};
};
} else {
if (((((cycleEvent) || (sequenceEvent))) || ((sequence.length == 2)))){
if (cycleEvent){
dispatchEvent(_cycle);
};
if (sequenceEvent){
dispatchEvent(_sequenceupdate);
};
};
};
};
}
public function stop():void{
_isRunning = false;
_latest = 0;
}
public function start():void{
_time = getTimer();
_isRunning = true;
_latest = 0;
frame = 0;
}
public function get isRunning():Boolean{
return (_isRunning);
}
}
}//package away3d.core.base
Section 8
//AnimationFrame (away3d.core.base.AnimationFrame)
package away3d.core.base {
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.base
Section 9
//AnimationGroup (away3d.core.base.AnimationGroup)
package away3d.core.base {
public class AnimationGroup {
public var playlist:Array;
public var loop:Boolean;
public var fps:uint;
public var loopLast:Boolean;
public function AnimationGroup(_arg1:Array=null, _arg2:Boolean=false){
this.playlist = _arg1;
this.loopLast = _arg2;
}
}
}//package away3d.core.base
Section 10
//AnimationSequence (away3d.core.base.AnimationSequence)
package away3d.core.base {
public class AnimationSequence {
public var prefix:String;
public var loop:Boolean;
public var fps:Number;
public var smooth:Boolean;
public function AnimationSequence(_arg1:String, _arg2:Boolean=false, _arg3:Boolean=false, _arg4:Number=24){
this.prefix = _arg1;
this.smooth = _arg2;
this.loop = _arg3;
this.fps = _arg4;
}
}
}//package away3d.core.base
Section 11
//BaseMesh (away3d.core.base.BaseMesh)
package away3d.core.base {
import flash.events.*;
import away3d.core.draw.*;
import away3d.core.utils.*;
import away3d.core.render.*;
import away3d.events.*;
import away3d.materials.*;
import flash.utils.*;
import away3d.core.*;
public class BaseMesh extends Object3D {
public var pushback:Boolean;
private var _animation:Animation;
private var _maxYElement:IMeshElement;// = null
private var _minXElement:IMeshElement;// = null
private var _needNotifyDimensionsChange:Boolean;// = false
private var _needNotifyRadiusChange:Boolean;// = false
private var _minX:Number;// = INF
private var _minY:Number;// = INF
private var _minZ:Number;// = INF
private var _maxXElement:IMeshElement;// = null
public var type:String;
private var _maxXDirty:Boolean;// = false
private var _minYDirty:Boolean;// = false
public var pushfront:Boolean;
private var _maxX:Number;
private var _maxY:Number;
private var _maxZ:Number;
private var _vertices:Array;
private var _verticesDirty:Boolean;// = true
private var _boundingRadiusDirty:Boolean;// = false
private var _dsStore:Array;
private var _frame:int;
public var url:String;
private var _boundingRadius:Number;// = 0
private var _maxZDirty:Boolean;// = false
private var _seg:DrawSegment;
private var _animationgroup:AnimationGroup;
private var _sequencedone:Event;
private var _minXDirty:Boolean;// = false
public var frames:Dictionary;
private var _boundingRadiusElement:IMeshElement;// = null
private var _dsActive:Array;
private var _minZElement:IMeshElement;// = null
private var _maxYDirty:Boolean;// = false
private var _maxZElement:IMeshElement;// = null
private var _minZDirty:Boolean;// = false
public var framenames:Dictionary;
private var _minYElement:IMeshElement;// = null
private var _activeprefix:String;
private var _cycle:Event;
public function BaseMesh(_arg1:Object=null){
_maxX = -(Infinity);
_maxY = -(Infinity);
_maxZ = -(Infinity);
_dsStore = new Array();
_dsActive = new Array();
super(_arg1);
pushback = ini.getBoolean("pushback", false);
pushfront = ini.getBoolean("pushfront", false);
}
public function removeOnSequenceDone(_arg1:Function):void{
removeEventListener(AnimationEvent.SQUENCE_DONE, _arg1, false);
}
private function rememberElementRadius(_arg1:IMeshElement):void{
var _local2:Number = _arg1.radius2;
if (_local2 > (_boundingRadius * _boundingRadius)){
_boundingRadius = Math.sqrt(_local2);
_boundingRadiusElement = _arg1;
_boundingRadiusDirty = false;
_needNotifyRadiusChange = true;
};
var _local3:Number = _arg1.maxX;
if (_local3 > _maxX){
_maxX = _local3;
_maxXElement = _arg1;
_maxXDirty = false;
_needNotifyDimensionsChange = true;
};
var _local4:Number = _arg1.minX;
if (_local4 < _minX){
_minX = _local4;
_minXElement = _arg1;
_minXDirty = false;
_needNotifyDimensionsChange = true;
};
var _local5:Number = _arg1.maxY;
if (_local5 > _maxY){
_maxY = _local5;
_maxYElement = _arg1;
_maxYDirty = false;
_needNotifyDimensionsChange = true;
};
var _local6:Number = _arg1.minY;
if (_local6 < _minY){
_minY = _local6;
_minYElement = _arg1;
_minYDirty = false;
_needNotifyDimensionsChange = true;
};
var _local7:Number = _arg1.maxZ;
if (_local7 > _maxZ){
_maxZ = _local7;
_maxZElement = _arg1;
_maxZDirty = false;
_needNotifyDimensionsChange = true;
};
var _local8:Number = _arg1.minZ;
if (_local8 < _minZ){
_minZ = _local8;
_minZElement = _arg1;
_minZDirty = false;
_needNotifyDimensionsChange = true;
};
}
protected function addElement(_arg1:IMeshElement):void{
_verticesDirty = true;
_arg1.addOnVertexChange(onElementVertexChange);
_arg1.addOnVertexValueChange(onElementVertexValueChange);
rememberElementRadius(_arg1);
launchNotifies();
}
public function removeOnCycle(_arg1:Function):void{
_animation.cycleEvent = false;
_animation.removeEventListener(AnimationEvent.CYCLE, _arg1, false);
}
private function onElementVertexChange(_arg1:MeshElementEvent):void{
var _local2:IMeshElement = _arg1.element;
forgetElementRadius(_local2);
rememberElementRadius(_local2);
_verticesDirty = true;
launchNotifies();
}
public function get isRunning():Boolean{
return (_animation.isRunning);
}
public function play(_arg1:AnimationSequence):void{
var _local2:Boolean;
var _local3:String;
if (!_animation){
_animation = new Animation(this);
} else {
_animation.sequence = new Array();
};
_animation.fps = _arg1.fps;
_animation.smooth = _arg1.smooth;
_animation.loop = _arg1.loop;
if (_arg1.prefix != null){
for (_local3 in framenames) {
if (_local3.indexOf(_arg1.prefix) == 0){
_local2 = true;
_activeprefix = ((_activeprefix)!=_arg1.prefix) ? _arg1.prefix : _activeprefix;
_animation.sequence.push(new AnimationFrame(framenames[_local3], ("" + parseInt(_local3.substring(_arg1.prefix.length)))));
};
};
if (_local2){
_animation.sequence.sortOn("sort", Array.NUMERIC);
frames[_frame].adjust(1);
_animation.start();
} else {
trace((("--------- \n--> unable to play animation: unvalid prefix [" + _arg1.prefix) + "]\n--------- "));
};
};
}
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 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);
}
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);
}
public function scaleZ(_arg1:Number):void{
if (_arg1 != 1){
scaleXYZ(1, 1, _arg1);
};
}
override public function scale(_arg1:Number):void{
scaleXYZ(_arg1, _arg1, _arg1);
}
override public function get boundingRadius():Number{
var _local1:Number;
var _local2:IMeshElement;
var _local3:Number;
if (_boundingRadiusDirty){
_boundingRadiusElement = null;
_local1 = 0;
for each (_local2 in elements) {
_local3 = _local2.radius2;
if (_local3 > _local1){
_local1 = _local3;
_boundingRadiusElement = _local2;
};
};
_boundingRadius = Math.sqrt(_local1);
_boundingRadiusDirty = false;
};
return (_boundingRadius);
}
public function set loop(_arg1:Boolean):void{
_animation.loop = _arg1;
}
public function set smooth(_arg1:Boolean):void{
_animation.smooth = _arg1;
}
public function scaleY(_arg1:Number):void{
if (_arg1 != 1){
scaleXYZ(1, _arg1, 1);
};
}
public function addOnSequenceDone(_arg1:Function):void{
addEventListener(AnimationEvent.SQUENCE_DONE, _arg1, false, 0, false);
}
public function scaleX(_arg1:Number):void{
if (_arg1 != 1){
scaleXYZ(_arg1, 1, 1);
};
}
public function scaleAnimation(_arg1:Number):void{
var _local5:String;
var _local6:Frame;
var _local2:Array = new Array();
var _local3:int;
var _local4:int;
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 primitives(_arg1:IPrimitiveConsumer, _arg2:AbstractRenderSession):void{
super.primitives(_arg1, _arg2);
_dsStore = _dsStore.concat(_dsActive);
_dsActive = new Array();
}
public function get frame():int{
return (_animation.frame);
}
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);
}
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);
}
private function launchNotifies():void{
if (_needNotifyRadiusChange){
_needNotifyRadiusChange = false;
notifyRadiusChange();
};
if (_needNotifyDimensionsChange){
_needNotifyDimensionsChange = false;
notifyDimensionsChange();
};
}
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);
}
private function updatePlaySequence(_arg1:Event):void{
if (_animationgroup.playlist.length == 0){
_animation.removeEventListener(AnimationEvent.SQUENCE_UPDATE, updatePlaySequence);
_animation.sequenceEvent = false;
if (hasSequenceEvent){
if (_sequencedone == null){
_sequencedone = new Event(AnimationEvent.SQUENCE_DONE);
};
dispatchEvent(_sequencedone);
};
} else {
if (_animationgroup.playlist.length == 1){
loop = _animationgroup.loopLast;
};
play(_animationgroup.playlist.shift());
};
}
public function addOnCycle(_arg1:Function):void{
_animation.cycleEvent = true;
_cycle = new Event(AnimationEvent.CYCLE);
_animation.addEventListener(AnimationEvent.CYCLE, _arg1, false, 0, false);
}
public function get hasCycleEvent():Boolean{
return (_animation.hasEventListener(AnimationEvent.CYCLE));
}
public function gotoAndStop(_arg1:int):void{
_frame = (_animation.frame = _arg1);
if (_animation.isRunning){
_animation.stop();
};
}
private function onElementVertexValueChange(_arg1:MeshElementEvent):void{
var _local2:IMeshElement = _arg1.element;
forgetElementRadius(_local2);
rememberElementRadius(_local2);
launchNotifies();
}
override public function tick(_arg1:int):void{
if (((!((_animation == null))) && (!((frames == null))))){
_animation.update(this);
};
}
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);
}
private function forgetElementRadius(_arg1:IMeshElement):void{
if (_arg1 == _boundingRadiusElement){
_boundingRadiusElement = null;
_boundingRadiusDirty = 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 setPlaySequences(_arg1:Array, _arg2:Boolean=false):void{
if (_arg1.length == 0){
return;
};
if (!_animation){
_animation = new Animation(this);
};
_animationgroup = new AnimationGroup();
_animationgroup.loopLast = _arg2;
_animationgroup.playlist = [];
var _local3:int;
while (_local3 < _arg1.length) {
_animationgroup.playlist[_local3] = new AnimationSequence(_arg1[_local3].prefix, _arg1[_local3].smooth, true, _arg1[_local3].fps);
_local3++;
};
if (!_animation.hasEventListener(AnimationEvent.SQUENCE_UPDATE)){
_animation.addEventListener(AnimationEvent.SQUENCE_UPDATE, updatePlaySequence);
};
_animation.sequenceEvent = true;
loop = true;
play(_animationgroup.playlist.shift());
}
public function gotoAndPlay(_arg1:int):void{
_frame = (_animation.frame = _arg1);
if (!_animation.isRunning){
_animation.start();
};
}
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();
}
public function set frame(_arg1:int):void{
if (_animation.frame == _arg1){
return;
};
_frame = _arg1;
_animation.frame = _arg1;
frames[_arg1].adjust(1);
}
public function get hasSequenceEvent():Boolean{
return (hasEventListener(AnimationEvent.SQUENCE_DONE));
}
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 elements():Array{
throw (new Error("Not implemented"));
}
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.base
Section 12
//BaseMeshElement (away3d.core.base.BaseMeshElement)
package away3d.core.base {
import flash.events.*;
import away3d.events.*;
public class BaseMeshElement extends EventDispatcher implements IMeshElement {
private var _vertexchanged:MeshElementEvent;
private var _visiblechanged:MeshElementEvent;
private var _vertexvaluechanged:MeshElementEvent;
var _visible:Boolean;// = true
public function get visible():Boolean{
return (_visible);
}
public function get maxX():Number{
return (Math.sqrt(radius2));
}
public function addOnVertexValueChange(_arg1:Function):void{
addEventListener(MeshElementEvent.VERTEXVALUE_CHANGED, _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 vertices():Array{
throw (new Error("Not implemented"));
}
public function removeOnVertexValueChange(_arg1:Function):void{
removeEventListener(MeshElementEvent.VERTEXVALUE_CHANGED, _arg1, false);
}
public function get minZ():Number{
return (-(Math.sqrt(radius2)));
}
public function addOnVertexChange(_arg1:Function):void{
addEventListener(MeshElementEvent.VERTEX_CHANGED, _arg1, false, 0, true);
}
public function addOnVisibleChange(_arg1:Function):void{
addEventListener(MeshElementEvent.VISIBLE_CHANGED, _arg1, false, 0, true);
}
function notifyVertexChange():void{
if (!hasEventListener(MeshElementEvent.VERTEX_CHANGED)){
return;
};
if (_vertexchanged == null){
_vertexchanged = new MeshElementEvent(MeshElementEvent.VERTEX_CHANGED, this);
};
dispatchEvent(_vertexchanged);
}
public function removeOnVertexChange(_arg1:Function):void{
removeEventListener(MeshElementEvent.VERTEX_CHANGED, _arg1, false);
}
public function get radius2():Number{
var _local2:Vertex;
var _local3:Number;
var _local1:Number = 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 set visible(_arg1:Boolean):void{
if (_arg1 == _visible){
return;
};
_visible = _arg1;
notifyVisibleChange();
}
public function get maxZ():Number{
return (Math.sqrt(radius2));
}
function notifyVisibleChange():void{
if (!hasEventListener(MeshElementEvent.VISIBLE_CHANGED)){
return;
};
if (_visiblechanged == null){
_visiblechanged = new MeshElementEvent(MeshElementEvent.VISIBLE_CHANGED, this);
};
dispatchEvent(_visiblechanged);
}
function notifyVertexValueChange():void{
if (!hasEventListener(MeshElementEvent.VERTEXVALUE_CHANGED)){
return;
};
if (_vertexvaluechanged == null){
_vertexvaluechanged = new MeshElementEvent(MeshElementEvent.VERTEXVALUE_CHANGED, this);
};
dispatchEvent(_vertexvaluechanged);
}
public function get maxY():Number{
return (Math.sqrt(radius2));
}
public function removeOnVisibleChange(_arg1:Function):void{
removeEventListener(MeshElementEvent.VISIBLE_CHANGED, _arg1, false);
}
}
}//package away3d.core.base
Section 13
//Face (away3d.core.base.Face)
package away3d.core.base {
import flash.events.*;
import flash.geom.*;
import away3d.core.draw.*;
import away3d.core.render.*;
import away3d.events.*;
import away3d.core.math.*;
import away3d.materials.*;
public class Face extends BaseMeshElement {
var _material:ITriangleMaterial;
private var _normal:Number3D;
var _uv2:UV;
public var extra:Object;
var _v0:Vertex;
var _v1:Vertex;
var _v2:Vertex;
public var parent:Mesh;
var _dt:DrawTriangle;
var bitmapRect:Rectangle;
private var _mappingchanged:FaceEvent;
var _back:ITriangleMaterial;
private var _b:Number;
private var _a:Number;
private var _c:Number;
private var _normalDirty:Boolean;// = true
private var _materialchanged:FaceEvent;
var _uv0:UV;
var _uv1:UV;
private var _s:Number;
public function Face(_arg1:Vertex, _arg2:Vertex, _arg3:Vertex, _arg4:ITriangleMaterial=null, _arg5:UV=null, _arg6:UV=null, _arg7:UV=null){
_dt = new DrawTriangle();
_normal = new Number3D();
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 v0():Vertex{
return (_v0);
}
public function get v1():Vertex{
return (_v1);
}
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 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 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 (_normalDirty){
_normalDirty = false;
_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 invert():void{
var _local1:Vertex = this._v1;
var _local2:Vertex = this._v2;
var _local3:UV = this._uv1;
var _local4:UV = this._uv2;
this._v1 = _local2;
this._v2 = _local1;
this._uv1 = _local4;
this._uv2 = _local3;
notifyVertexChange();
notifyMappingChange();
}
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))));
}
private function onVertexValueChange(_arg1:Event):void{
_normalDirty = true;
notifyVertexValueChange();
}
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 removeOnMaterialChange(_arg1:Function):void{
removeEventListener(FaceEvent.MATERIAL_CHANGED, _arg1, false);
}
public function addOnMappingChange(_arg1:Function):void{
addEventListener(FaceEvent.MAPPING_CHANGED, _arg1, false, 0, true);
}
override public function get radius2():Number{
var _local1:Number = (((_v0._x * _v0._x) + (_v0._y * _v0._y)) + (_v0._z * _v0._z));
var _local2:Number = (((_v1._x * _v1._x) + (_v1._y * _v1._y)) + (_v1._z * _v1._z));
var _local3:Number = (((_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);
}
public function get material():ITriangleMaterial{
return (_material);
}
function front(_arg1:Projection):Number{
var _local2:ScreenVertex = _v0.project(_arg1);
var _local3:ScreenVertex = _v1.project(_arg1);
var _local4:ScreenVertex = _v2.project(_arg1);
return ((((_local2.x * (_local4.y - _local3.y)) + (_local3.x * (_local2.y - _local4.y))) + (_local4.x * (_local3.y - _local2.y))));
}
public function get uv1():UV{
return (_uv1);
}
public function get uv2():UV{
return (_uv2);
}
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);
}
public function get uv0():UV{
return (_uv0);
}
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);
}
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);
}
public function set material(_arg1:ITriangleMaterial):void{
if (_arg1 == _material){
return;
};
if (((!((_material == null))) && ((_material is IUVMaterial)))){
(_material as IUVMaterial).removeOnResize(onMaterialResize);
};
_material = _arg1;
if (((!((_material == null))) && ((_material is IUVMaterial)))){
(_material as IUVMaterial).addOnResize(onMaterialResize);
};
notifyMaterialChange();
}
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);
}
function notifyMappingChange():void{
_dt.texturemapping = null;
if (!hasEventListener(FaceEvent.MAPPING_CHANGED)){
return;
};
if (_mappingchanged == null){
_mappingchanged = new FaceEvent(FaceEvent.MAPPING_CHANGED, this);
};
dispatchEvent(_mappingchanged);
}
public function addOnMaterialChange(_arg1:Function):void{
addEventListener(FaceEvent.MATERIAL_CHANGED, _arg1, false, 0, true);
}
public function removeOnMappingChange(_arg1:Function):void{
removeEventListener(FaceEvent.MAPPING_CHANGED, _arg1, false);
}
public function set back(_arg1:ITriangleMaterial):void{
if (_arg1 == _back){
return;
};
_back = _arg1;
}
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();
}
function notifyMaterialChange():void{
_dt.texturemapping = null;
if (!hasEventListener(FaceEvent.MATERIAL_CHANGED)){
return;
};
if (_materialchanged == null){
_materialchanged = new FaceEvent(FaceEvent.MATERIAL_CHANGED, this);
};
dispatchEvent(_materialchanged);
}
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 get uvs():Array{
return ([_uv0, _uv1, _uv2]);
}
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);
}
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();
}
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);
}
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();
}
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();
}
override public function get vertices():Array{
return ([_v0, _v1, _v2]);
}
private function onMaterialResize(_arg1:MaterialEvent):void{
_dt.texturemapping = null;
}
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);
}
public function get back():ITriangleMaterial{
return (_back);
}
}
}//package away3d.core.base
Section 14
//Frame (away3d.core.base.Frame)
package away3d.core.base {
public class Frame implements IFrame {
public var vertexpositions:Array;
private var _vertexposition:VertexPosition;
public function Frame(){
vertexpositions = [];
super();
}
public function adjust(_arg1:Number=1):void{
for each (_vertexposition in vertexpositions) {
_vertexposition.adjust(_arg1);
};
}
}
}//package away3d.core.base
Section 15
//IAnimation (away3d.core.base.IAnimation)
package away3d.core.base {
public interface IAnimation {
function update(_arg1:BaseMesh):void;
}
}//package away3d.core.base
Section 16
//IFrame (away3d.core.base.IFrame)
package away3d.core.base {
public interface IFrame {
function adjust(_arg1:Number=1):void;
}
}//package away3d.core.base
Section 17
//IMeshElement (away3d.core.base.IMeshElement)
package away3d.core.base {
public interface IMeshElement {
function get radius2():Number;
function addOnVisibleChange(_arg1:Function):void;
function set visible(_arg1:Boolean):void;
function get minX():Number;
function get minY():Number;
function get minZ():Number;
function get visible():Boolean;
function addOnVertexChange(_arg1:Function):void;
function get maxY():Number;
function get maxZ():Number;
function removeOnVertexChange(_arg1:Function):void;
function get vertices():Array;
function removeOnVertexValueChange(_arg1:Function):void;
function get maxX():Number;
function addOnVertexValueChange(_arg1:Function):void;
function removeOnVisibleChange(_arg1:Function):void;
}
}//package away3d.core.base
Section 18
//Mesh (away3d.core.base.Mesh)
package away3d.core.base {
import away3d.core.draw.*;
import away3d.core.utils.*;
import away3d.core.render.*;
import away3d.events.*;
import away3d.core.math.*;
import away3d.materials.*;
import flash.utils.*;
import away3d.primitives.*;
import away3d.core.*;
public class Mesh extends BaseMesh implements IPrimitiveProvider {
private var _scenevertnormalsDirty:Boolean;// = true
private var _material:ITriangleMaterial;
private var _dtActive:Array;
private var _neighbour01:Dictionary;
public var bothsides:Boolean;
private var _backface:Boolean;
private var _fVectors:Array;
private var _fAngle:Number;
private var _vertfaces:Dictionary;
private var _fNormal:Number3D;
private var _n01:Face;
private var _faces:Array;
public var indexes:Array;
private var _neighboursDirty:Boolean;// = true
public var outline:ISegmentMaterial;
private var _neighbour12:Dictionary;
private var _vertfacesDirty:Boolean;// = true
private var _n12:Face;
private var _debugboundingbox:WireCube;
private var _vertnormalsDirty:Boolean;// = true
private var _neighbour20:Dictionary;
private var _vt:ScreenVertex;
private var _backmat:ITriangleMaterial;
public var debugbb:Boolean;
private var _vertnormals:Dictionary;
private var _uvmaterial:Boolean;
private var _tri:DrawTriangle;
private var _n20:Face;
private var _dtStore:Array;
private var _scenevertnormals:Dictionary;
public var back:ITriangleMaterial;
public function Mesh(_arg1:Object=null){
_faces = [];
_dtStore = new Array();
_dtActive = new Array();
super(_arg1);
material = ini.getMaterial("material");
outline = ini.getSegmentMaterial("outline");
back = ini.getMaterial("back");
bothsides = ini.getBoolean("bothsides", false);
debugbb = ini.getBoolean("debugbb", false);
if ((((material == null)) && ((outline == null)))){
material = new WireColorMaterial();
};
}
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];
};
};
}
private function onMaterialResize(_arg1:MaterialEvent):void{
var _local2:Face;
for each (_local2 in _faces) {
if (_local2._material == null){
_local2._dt.texturemapping = null;
};
};
}
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:Vertex;
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) {
_fNormal = _local6.normal;
_fVectors = new Array();
for each (_local8 in _local6.vertices) {
if (_local8 != _local1){
_fVectors.push(new Number3D((_local8.x - _local1.x), (_local8.y - _local1.y), (_local8.z - _local1.z), true));
};
};
_fAngle = Math.acos((_fVectors[0] as Number3D).dot((_fVectors[1] as Number3D)));
_local3 = (_local3 + (_fNormal.x * _fAngle));
_local4 = (_local4 + (_fNormal.y * _fAngle));
_local5 = (_local5 + (_fNormal.z * _fAngle));
};
_local7 = new Number3D(_local3, _local4, _local5);
_local7.normalize();
_vertnormals[_local1] = _local7;
};
_vertnormalsDirty = false;
}
public function invertFaces():void{
var _local1:Face;
for each (_local1 in _faces) {
_local1.invert();
};
}
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);
}
override public function primitives(_arg1:IPrimitiveConsumer, _arg2:AbstractRenderSession):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);
};
};
_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)) || ((_tri.material is ILayerMaterial)));
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);
};
};
};
};
};
};
};
};
}
public function removeFace(_arg1:Face):void{
var _local2:int = _faces.indexOf(_arg1);
if (_local2 == -1){
return;
};
removeElement(_arg1);
_vertfacesDirty = true;
forgetFaceNeighbours(_arg1);
_arg1.removeOnVertexChange(onFaceVertexChange);
_faces.splice(_local2, 1);
}
public function asXML():XML{
var refvertices:Dictionary;
var verticeslist:Array;
var refuvs:Dictionary;
var uvslist:Array;
var face:Face;
var vn:int;
var v:Vertex;
var uvn:int;
var uv:UV;
var f:Face;
var result:XML = <mesh></mesh>
;
refvertices = new Dictionary();
verticeslist = [];
var remembervertex:Function = function (_arg1:Vertex):void{
if (refvertices[_arg1] == null){
refvertices[_arg1] = verticeslist.length;
verticeslist.push(_arg1);
};
};
refuvs = new Dictionary();
uvslist = [];
var rememberuv:Function = 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);
}
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;
}
function neighbour20(_arg1:Face):Face{
if (_neighboursDirty){
findNeighbours();
};
return (_neighbour20[_arg1]);
}
function recalcNeighbours():void{
if (!_neighboursDirty){
_neighboursDirty = true;
findNeighbours();
};
}
function getSceneVertexNormal(_arg1:Vertex):Number3D{
if (_vertfacesDirty){
findVertFaces();
};
if (_vertnormalsDirty){
findVertNormals();
};
if (_scenevertnormalsDirty){
findSceneVertNormals();
};
return (_scenevertnormals[_arg1]);
}
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;
}
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;
};
};
};
}
function getVertexNormal(_arg1:Vertex):Number3D{
if (_vertfacesDirty){
findVertFaces();
};
if (_vertnormalsDirty){
findVertNormals();
};
return (_vertnormals[_arg1]);
}
private function findSceneVertNormals():void{
if (!_scenevertnormalsDirty){
return;
};
_scenevertnormals = new Dictionary();
_scenevertnormalsDirty = false;
}
public function get faces():Array{
return (_faces);
}
public function get material():ITriangleMaterial{
return (_material);
}
function neighbour01(_arg1:Face):Face{
if (_neighboursDirty){
findNeighbours();
};
return (_neighbour01[_arg1]);
}
public function set material(_arg1:ITriangleMaterial):void{
var _local2:Face;
if (_material == _arg1){
return;
};
if (((!((_material == null))) && ((_material is IUVMaterial)))){
(_material as IUVMaterial).removeOnResize(onMaterialResize);
};
_material = _arg1;
if (((!((_material == null))) && ((_material is IUVMaterial)))){
(_material as IUVMaterial).addOnResize(onMaterialResize);
};
if ((((_material is IUVMaterial)) || ((_material is ILayerMaterial)))){
for each (_local2 in _faces) {
if (_local2._material == null){
_local2._dt.texturemapping = null;
};
};
};
}
public function asAS3Class(_arg1:String=null, _arg2:String="", _arg3:Boolean=false, _arg4:Boolean=false):String{
var refvertices:Dictionary;
var verticeslist:Array;
var refuvs:Dictionary;
var uvslist:Array;
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"));
var importextra:String = (animated) ? "\timport flash.utils.Dictionary;\n" : "";
var source = (((((("package " + packagename) + "\n{\n\timport away3d.core.base.*;\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 = [];
var remembervertex:Function = function (_arg1:Vertex):void{
if (refvertices[_arg1] == null){
refvertices[_arg1] = verticeslist.length;
verticeslist.push(_arg1);
};
};
refuvs = new Dictionary();
uvslist = [];
var rememberuv:Function = 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);
}
public function quarterFaces():void{
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;
var _local1:Dictionary = 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));
};
}
private function onFaceVertexChange(_arg1:MeshElementEvent):void{
var _local2:Face;
if (!_neighboursDirty){
_local2 = (_arg1.element as Face);
forgetFaceNeighbours(_local2);
rememberFaceNeighbours(_local2);
};
_vertfacesDirty = true;
}
public function movePivot(_arg1:Number, _arg2:Number, _arg3:Number):void{
var _local5:Vertex;
var _local6:Number3D;
var _local4:Boolean = _neighboursDirty;
_neighboursDirty = true;
for each (_local5 in vertices) {
_local5.x = (_local5.x - _arg1);
_local5.y = (_local5.y - _arg2);
_local5.z = (_local5.z - _arg3);
};
_local6 = new Number3D(_arg1, _arg2, _arg3);
new Number3D(_arg1, _arg2, _arg3).rotate(_local6.clone(), _transform);
_local6.add(_local6, position);
moveTo(_local6);
_neighboursDirty = _local4;
}
override public function get elements():Array{
return (_faces);
}
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[_local2] == null){
_vertfaces[_local2] = [_local1];
} else {
_vertfaces[_local2].push(_local1);
};
_local3 = _local1.v1;
if (_vertfaces[_local3] == null){
_vertfaces[_local3] = [_local1];
} else {
_vertfaces[_local3].push(_local1);
};
_local4 = _local1.v2;
if (_vertfaces[_local4] == null){
_vertfaces[_local4] = [_local1];
} else {
_vertfaces[_local4].push(_local1);
};
};
_vertfacesDirty = false;
}
function getFacesByVertex(_arg1:Vertex):Array{
if (_vertfacesDirty){
findVertFaces();
};
return (_vertfaces[_arg1]);
}
function neighbour12(_arg1:Face):Face{
if (_neighboursDirty){
findNeighbours();
};
return (_neighbour12[_arg1]);
}
override public function clone(_arg1=null){
var clonedvertices:Dictionary;
var cloneduvs:Dictionary;
var face:Face;
var object = _arg1;
var mesh: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();
var clonevertex:Function = function (_arg1:Vertex):Vertex{
var _local2:Vertex = 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();
var cloneuv:Function = function (_arg1:UV):UV{
if (_arg1 == null){
return (null);
};
var _local2:UV = 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);
}
}
}//package away3d.core.base
Section 19
//Object3D (away3d.core.base.Object3D)
package away3d.core.base {
import flash.events.*;
import flash.display.*;
import away3d.core.draw.*;
import away3d.containers.*;
import away3d.core.utils.*;
import away3d.core.render.*;
import away3d.events.*;
import away3d.core.math.*;
import away3d.core.traverse.*;
public class Object3D extends EventDispatcher implements IClonable {
public var extra:Object;
private var _rot:Number3D;
private var _rotationX:Number;
private var _rotationY:Number;
private var _rotationZ:Number;
private var _transformchanged:Object3DEvent;
private var _ddo:DrawDisplayObject;
private var _zAxis:Number3D;
public var ownSession:AbstractRenderSession;
private var _xAxis:Number3D;
public var viewTransform:Matrix3D;
public var projection:Projection;
private var _localTransformDirty:Boolean;
private var _scenetransformchanged:Object3DEvent;
public var alpha:Number;
var _sceneTransform:Matrix3D;
private var _vector:Number3D;
public var visible:Boolean;// = true
public var ownCanvas:Boolean;// = false
private var _scenechanged:Object3DEvent;
private var _position:Number3D;
public var name:String;
public var useHandCursor:Boolean;// = false
private var _scene:Scene3D;
public var blendMode:String;
public var session:AbstractRenderSession;
public var inverseSceneTransform:Matrix3D;
var _sceneTransformDirty:Boolean;
private var _yAxis:Number3D;
private var _quaternion:Quaternion;
private var _parent:ObjectContainer3D;
private var _dimensionschanged:Object3DEvent;
private var _scenePosition:Number3D;
public var sceneTransformed:Boolean;
private var _radiuschanged:Object3DEvent;
private var _c:DisplayObject;
var _transformDirty:Boolean;
protected var ini:Init;
var _transform:Matrix3D;
private var _sc:ScreenVertex;
public var mouseEnabled:Boolean;// = true
private var _rotationDirty:Boolean;
private var _v:View3D;
public var filters:Array;
private var _m:Matrix3D;
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();
_quaternion = new Quaternion();
_position = new Number3D();
_scenePosition = new Number3D();
_ddo = new DrawDisplayObject();
_sc = new ScreenVertex();
_vector = new Number3D();
_m = new Matrix3D();
_xAxis = new Number3D();
_yAxis = new Number3D();
_zAxis = new Number3D();
projection = new Projection();
inverseSceneTransform = new Matrix3D();
viewTransform = new Matrix3D();
super();
ini = Init.parse(_arg1);
name = ini.getString("name", name);
ownCanvas = ini.getBoolean("ownCanvas", ownCanvas);
ownSession = (ini.getObject("ownSession", AbstractRenderSession) as AbstractRenderSession);
visible = ini.getBoolean("visible", visible);
mouseEnabled = ini.getBoolean("mouseEnabled", mouseEnabled);
useHandCursor = ini.getBoolean("useHandCursor", useHandCursor);
filters = ini.getArray("filters");
alpha = ini.getNumber("alpha", 1);
x = ini.getNumber("x", 0);
y = ini.getNumber("y", 0);
z = ini.getNumber("z", 0);
rotationX = ini.getNumber("rotationX", 0);
rotationY = ini.getNumber("rotationY", 0);
rotationZ = ini.getNumber("rotationZ", 0);
extra = ini.getObject("extra");
parent = (ini.getObject3D("parent") as ObjectContainer3D);
if (ownSession){
ownCanvas = true;
};
if ((this is Scene3D)){
_scene = (this as Scene3D);
};
}
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;
_localTransformDirty = true;
}
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;
_localTransformDirty = true;
}
public function removeOnRadiusChange(_arg1:Function):void{
removeEventListener(Object3DEvent.RADIUS_CHANGED, _arg1, false);
}
public function addOnMouseMove(_arg1:Function):void{
addEventListener(MouseEvent3D.MOUSE_MOVE, _arg1, false, 0, false);
}
public function removeOnMouseOut(_arg1:Function):void{
removeEventListener(MouseEvent3D.MOUSE_OUT, _arg1, false);
}
function dispatchMouseEvent(_arg1:MouseEvent3D):Boolean{
if (!hasEventListener(_arg1.type)){
return (false);
};
dispatchEvent(_arg1);
return (true);
}
public function moveDown(_arg1:Number):void{
translate(Number3D.DOWN, _arg1);
}
function get parentmaxX():Number{
return ((boundingRadius + _transform.tx));
}
function get parentmaxY():Number{
return ((boundingRadius + _transform.ty));
}
public function removeOnMouseUp(_arg1:Function):void{
removeEventListener(MouseEvent3D.MOUSE_UP, _arg1, false);
}
function get parentmaxZ():Number{
return ((boundingRadius + _transform.tz));
}
public function get position():Number3D{
if (_transformDirty){
updateTransform();
};
_position.x = _transform.tx;
_position.y = _transform.ty;
_position.z = _transform.tz;
return (_position);
}
public function lookAt(_arg1:Number3D, _arg2:Number3D=null):void{
_zAxis.sub(_arg1, position);
_zAxis.normalize();
if ((((_zAxis.modulo > 0.1)) && (((((!((_zAxis.x == _transform.sxz))) || (!((_zAxis.y == _transform.syz))))) || (!((_zAxis.z == _transform.szz))))))){
_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;
_localTransformDirty = true;
};
}
private function onParentSceneChange(_arg1:Object3DEvent):void{
if (_scene == _parent.scene){
return;
};
_scene = _parent.scene;
notifySceneChange();
}
public function set rotationX(_arg1:Number):void{
_rotationX = (-(_arg1) * toRADIANS);
_transformDirty = true;
}
public function removeOnTransformChange(_arg1:Function):void{
removeEventListener(Object3DEvent.TRANSFORM_CHANGED, _arg1, false);
}
public function moveTo(_arg1:Number3D):void{
_transform.tx = _arg1.x;
_transform.ty = _arg1.y;
_transform.tz = _arg1.z;
_localTransformDirty = true;
}
public function set rotationY(_arg1:Number):void{
_rotationY = (-(_arg1) * toRADIANS);
_transformDirty = true;
}
public function get sceneTransform():Matrix3D{
sceneTransformed = false;
if (_scene == null){
if (_transformDirty){
_sceneTransformDirty = true;
};
if (_sceneTransformDirty){
_sceneTransformDirty = false;
notifySceneTransformChange();
};
return (transform);
};
if (_transformDirty){
updateTransform();
};
if (_sceneTransformDirty){
updateSceneTransform();
};
if (_localTransformDirty){
notifyTransformChange();
};
return (_sceneTransform);
}
function notifyDimensionsChange():void{
if (!hasEventListener(Object3DEvent.DIMENSIONS_CHANGED)){
return;
};
if (!_dimensionschanged){
_dimensionschanged = new Object3DEvent(Object3DEvent.DIMENSIONS_CHANGED, this);
};
dispatchEvent(_dimensionschanged);
}
public function get minZ():Number{
return (-(boundingRadius));
}
public function scale(_arg1:Number):void{
}
public function removeOnSceneTransformChange(_arg1:Function):void{
removeEventListener(Object3DEvent.SCENETRANSFORM_CHANGED, _arg1, false);
}
public function moveUp(_arg1:Number):void{
translate(Number3D.UP, _arg1);
}
public function get minX():Number{
return (-(boundingRadius));
}
public function set rotationZ(_arg1:Number):void{
_rotationZ = (-(_arg1) * toRADIANS);
_transformDirty = true;
}
function notifySceneChange():void{
if (!hasEventListener(Object3DEvent.SCENE_CHANGED)){
return;
};
if (!_scenechanged){
_scenechanged = new Object3DEvent(Object3DEvent.SCENE_CHANGED, this);
};
dispatchEvent(_scenechanged);
}
public function set parent(_arg1:ObjectContainer3D):void{
if (_arg1 == _parent){
return;
};
var _local2:Scene3D = scene;
if (_parent != null){
_parent.removeOnSceneChange(onParentSceneChange);
_parent.internalRemoveChild(this);
};
_parent = _arg1;
if (_parent != null){
_parent.internalAddChild(this);
_parent.addOnSceneChange(onParentSceneChange);
_parent.addOnSceneTransformChange(onParentTransformChange);
};
_scene = (_parent) ? _parent.scene : null;
if (_scene != _local2){
notifySceneChange();
};
_sceneTransformDirty = true;
_localTransformDirty = true;
}
public function get boundingRadius():Number{
return (0);
}
public function distanceTo(_arg1:Object3D):Number{
var _local2:Matrix3D = ((scene == null)) ? transform : sceneTransform;
var _local3:Matrix3D = ((_arg1.scene == null)) ? _arg1.transform : _arg1.sceneTransform;
var _local4:Number = (_local2.tx - _local3.tx);
var _local5:Number = (_local2.ty - _local3.ty);
var _local6:Number = (_local2.tz - _local3.tz);
return (Math.sqrt((((_local4 * _local4) + (_local5 * _local5)) + (_local6 * _local6))));
}
public function pitch(_arg1:Number):void{
rotate(Number3D.RIGHT, _arg1);
}
public function set position(_arg1:Number3D):void{
_transform.tx = _arg1.x;
_transform.ty = _arg1.y;
_transform.tz = _arg1.z;
_sceneTransformDirty = true;
_localTransformDirty = true;
}
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;
_localTransformDirty = true;
}
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 clone(_arg1=null){
var _local2:Object3D = ((_arg1) || (new Object3D()));
_local2.transform = transform;
_local2.name = name;
_local2.visible = visible;
_local2.mouseEnabled = mouseEnabled;
_local2.useHandCursor = useHandCursor;
_local2.extra = ((extra is IClonable)) ? (extra as IClonable).clone() : extra;
return (_local2);
}
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;
notifySceneTransformChange();
}
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 addOnRadiusChange(_arg1:Function):void{
addEventListener(Object3DEvent.RADIUS_CHANGED, _arg1, false, 0, true);
}
public function primitives(_arg1:IPrimitiveConsumer, _arg2:AbstractRenderSession):void{
_v = _arg2.view;
if (ownCanvas){
if (!ownSession){
ownSession = new SpriteRenderSession();
};
_arg2.registerChildSession(ownSession);
ownSession.view = _v;
_c = ownSession.getContainer(_v);
_c.filters = filters;
_c.alpha = alpha;
if (blendMode != null){
_c.blendMode = blendMode;
} else {
_c.blendMode = BlendMode.NORMAL;
};
ownSession.lightarray = _arg2.lightarray;
this.session = ownSession;
_sc.x = _c.x;
_sc.y = _c.y;
_sc.z = Math.sqrt(((((viewTransform.tz * viewTransform.tz) + viewTransform.tx) + viewTransform.tx) + (viewTransform.ty * viewTransform.ty)));
_ddo.source = this;
_ddo.screenvertex = _sc;
_ddo.displayobject = _c;
_ddo.session = _arg2;
_ddo.calc();
_arg1.primitive(_ddo);
} else {
this.session = _arg2;
};
}
public function get maxY():Number{
return (boundingRadius);
}
public function get y():Number{
return (_transform.ty);
}
public function get maxX():Number{
return (boundingRadius);
}
public function get maxZ():Number{
return (boundingRadius);
}
public function get x():Number{
return (_transform.tx);
}
public function get minY():Number{
return (-(boundingRadius));
}
public function get z():Number{
return (_transform.tz);
}
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 removeOnDimensionsChange(_arg1:Function):void{
removeEventListener(Object3DEvent.DIMENSIONS_CHANGED, _arg1, false);
}
public function yaw(_arg1:Number):void{
rotate(Number3D.UP, _arg1);
}
private function onParentTransformChange(_arg1:Object3DEvent):void{
_sceneTransformDirty = true;
}
override public function toString():String{
return ((((((((name) ? name : "$" + ": x:") + Math.round(x)) + " y:") + Math.round(y)) + " z:") + Math.round(z)));
}
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 addOnSceneTransformChange(_arg1:Function):void{
addEventListener(Object3DEvent.SCENETRANSFORM_CHANGED, _arg1, false, 0, true);
}
public function addOnMouseUp(_arg1:Function):void{
addEventListener(MouseEvent3D.MOUSE_UP, _arg1, false, 0, false);
}
private function updateTransform():void{
if (!_transformDirty){
return;
};
_quaternion.euler2quaternion(-(_rotationY), -(_rotationZ), _rotationX);
_transform.quaternion2matrix(_quaternion);
_transformDirty = false;
_sceneTransformDirty = true;
_localTransformDirty = true;
}
public function moveLeft(_arg1:Number):void{
translate(Number3D.LEFT, _arg1);
}
public function addOnMouseOver(_arg1:Function):void{
addEventListener(MouseEvent3D.MOUSE_OVER, _arg1, false, 0, false);
}
public function removeOnMouseDown(_arg1:Function):void{
removeEventListener(MouseEvent3D.MOUSE_DOWN, _arg1, false);
}
public function get scene():Scene3D{
return (_scene);
}
public function get parent():ObjectContainer3D{
return (_parent);
}
function notifyTransformChange():void{
_localTransformDirty = false;
if (!hasEventListener(Object3DEvent.TRANSFORM_CHANGED)){
return;
};
if (!_transformchanged){
_transformchanged = new Object3DEvent(Object3DEvent.TRANSFORM_CHANGED, this);
};
dispatchEvent(_transformchanged);
}
public function moveForward(_arg1:Number):void{
translate(Number3D.FORWARD, _arg1);
}
function get parentradius():Number{
var _local1:Number = _transform.tx;
var _local2:Number = _transform.ty;
var _local3:Number = _transform.tz;
return ((Math.sqrt((((_local1 * _local1) + (_local2 * _local2)) + (_local3 * _local3))) + boundingRadius));
}
function notifyRadiusChange():void{
if (!hasEventListener(Object3DEvent.RADIUS_CHANGED)){
return;
};
if (!_radiuschanged){
_radiuschanged = new Object3DEvent(Object3DEvent.RADIUS_CHANGED, this);
};
dispatchEvent(_radiuschanged);
}
public function addOnDimensionsChange(_arg1:Function):void{
addEventListener(Object3DEvent.DIMENSIONS_CHANGED, _arg1, false, 0, true);
}
public function moveRight(_arg1:Number):void{
translate(Number3D.RIGHT, _arg1);
}
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{
_scenePosition.x = sceneTransform.tx;
_scenePosition.y = sceneTransform.ty;
_scenePosition.z = sceneTransform.tz;
return (_scenePosition);
}
public function set transform(_arg1:Matrix3D):void{
if (_arg1 == _transform){
return;
};
_transform.clone(_arg1);
_transformDirty = false;
_rotationDirty = true;
_sceneTransformDirty = true;
_localTransformDirty = true;
}
public function removeOnSceneChange(_arg1:Function):void{
removeEventListener(Object3DEvent.SCENE_CHANGED, _arg1, false);
}
public function removeOnMouseOver(_arg1:Function):void{
removeEventListener(MouseEvent3D.MOUSE_OVER, _arg1, false);
}
public function addOnTransformChange(_arg1:Function):void{
addEventListener(Object3DEvent.TRANSFORM_CHANGED, _arg1, false, 0, true);
}
function get parentminX():Number{
return ((-(boundingRadius) + _transform.tx));
}
function get parentminY():Number{
return ((-(boundingRadius) + _transform.ty));
}
function get parentminZ():Number{
return ((-(boundingRadius) + _transform.tz));
}
public function addOnMouseOut(_arg1:Function):void{
addEventListener(MouseEvent3D.MOUSE_OUT, _arg1, false, 0, false);
}
function notifySceneTransformChange():void{
_sceneTransformDirty = false;
sceneTransformed = true;
if (!hasEventListener(Object3DEvent.SCENETRANSFORM_CHANGED)){
return;
};
if (!_scenetransformchanged){
_scenetransformchanged = new Object3DEvent(Object3DEvent.SCENETRANSFORM_CHANGED, this);
};
dispatchEvent(_scenetransformchanged);
}
public function addOnSceneChange(_arg1:Function):void{
addEventListener(Object3DEvent.SCENE_CHANGED, _arg1, false, 0, true);
}
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;
_localTransformDirty = true;
}
}
}//package away3d.core.base
Section 20
//Segment (away3d.core.base.Segment)
package away3d.core.base {
import flash.events.*;
import away3d.core.draw.*;
import away3d.events.*;
import away3d.materials.*;
public class Segment extends BaseMeshElement {
var _material:ISegmentMaterial;
public var extra:Object;
var _v0:Vertex;
var _v1:Vertex;
public var parent:BaseMesh;
private var _materialchanged:SegmentEvent;
var _ds:DrawSegment;
public function Segment(_arg1:Vertex, _arg2:Vertex, _arg3:ISegmentMaterial=null){
_ds = new DrawSegment();
super();
this.v0 = _arg1;
this.v1 = _arg2;
this.material = _arg3;
}
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();
}
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 minX():Number{
if (_v0._x < _v1._x){
return (_v0._x);
};
return (_v1._x);
}
public function set material(_arg1:ISegmentMaterial):void{
if (_arg1 == _material){
return;
};
_material = _arg1;
notifyMaterialChange();
}
override public function get maxX():Number{
if (_v0._x > _v1._x){
return (_v0._x);
};
return (_v1._x);
}
private function onVertexValueChange(_arg1:Event):void{
notifyVertexValueChange();
}
function notifyMaterialChange():void{
if (!hasEventListener(SegmentEvent.MATERIAL_CHANGED)){
return;
};
if (_materialchanged == null){
_materialchanged = new SegmentEvent(SegmentEvent.MATERIAL_CHANGED, this);
};
dispatchEvent(_materialchanged);
}
public function removeOnMaterialChange(_arg1:Function):void{
removeEventListener(SegmentEvent.MATERIAL_CHANGED, _arg1, false);
}
override public function get radius2():Number{
var _local1:Number = (((_v0._x * _v0._x) + (_v0._y * _v0._y)) + (_v0._z * _v0._z));
var _local2:Number = (((_v1._x * _v1._x) + (_v1._y * _v1._y)) + (_v1._z * _v1._z));
if (_local1 > _local2){
return (_local1);
};
return (_local2);
}
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 addOnMaterialChange(_arg1:Function):void{
addEventListener(SegmentEvent.MATERIAL_CHANGED, _arg1, false, 0, true);
}
override public function get vertices():Array{
return ([_v0, _v1]);
}
public function get v0():Vertex{
return (_v0);
}
public function get v1():Vertex{
return (_v1);
}
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);
}
public function get material():ISegmentMaterial{
return (_material);
}
}
}//package away3d.core.base
Section 21
//UV (away3d.core.base.UV)
package away3d.core.base {
import away3d.core.utils.*;
public class UV extends ValueObject {
public var extra:Object;
var _u:Number;
var _v:Number;
public function UV(_arg1:Number=0, _arg2:Number=0){
_u = _arg1;
_v = _arg2;
}
override public function toString():String{
return ((((("new UV(" + _u) + ", ") + _v) + ")"));
}
public function get v():Number{
return (_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 clone():UV{
return (new UV(_u, _v));
}
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)));
}
static function weighted(_arg1:UV, _arg2:UV, _arg3:Number, _arg4:Number):UV{
if (_arg1 == null){
return (null);
};
if (_arg2 == null){
return (null);
};
var _local5:Number = (_arg3 + _arg4);
var _local6:Number = (_arg3 / _local5);
var _local7:Number = (_arg4 / _local5);
return (new UV(((_arg1._u * _local6) + (_arg2._u * _local7)), ((_arg1._v * _local6) + (_arg2._v * _local7))));
}
}
}//package away3d.core.base
Section 22
//Vertex (away3d.core.base.Vertex)
package away3d.core.base {
import away3d.core.draw.*;
import away3d.core.utils.*;
import away3d.core.render.*;
import away3d.core.math.*;
public class Vertex extends ValueObject {
var _x:Number;
var _z:Number;
private var _position:Number3D;
var _y:Number;
public var extra:Object;
private var view:Matrix3D;
private var sz:Number;
private var persp:Number;
private var projectionTime:int;
private var projected:ScreenVertex;
public function Vertex(_arg1:Number=0, _arg2:Number=0, _arg3:Number=0){
projected = new ScreenVertex();
_position = new Number3D();
super();
_x = (_position.x = _arg1);
_y = (_position.y = _arg2);
_z = (_position.z = _arg3);
}
function perspective(_arg1:Number):ScreenVertex{
persp = (1 / (1 + (_z / _arg1)));
return (new ScreenVertex((_x * persp), (_y * persp), z));
}
override public function toString():String{
return ((((((("new Vertex(" + _x) + ", ") + _y) + ", ") + z) + ")"));
}
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 get z():Number{
return (_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 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);
}
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));
}
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 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 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 y():Number{
return (_y);
}
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)));
}
static function weighted(_arg1:Vertex, _arg2:Vertex, _arg3:Number, _arg4:Number):Vertex{
var _local5:Number = (_arg3 + _arg4);
var _local6:Number = (_arg3 / _local5);
var _local7:Number = (_arg4 / _local5);
return (new Vertex(((_arg1._x * _local6) + (_arg2._x * _local7)), ((_arg1._y * _local6) + (_arg2._y * _local7)), ((_arg1._z * _local6) + (_arg2._z * _local7))));
}
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.base
Section 23
//VertexPosition (away3d.core.base.VertexPosition)
package away3d.core.base {
public class VertexPosition {
public var x:Number;
public var y:Number;
public var z:Number;
public var vertex:Vertex;
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.base
Section 24
//WireMesh (away3d.core.base.WireMesh)
package away3d.core.base {
import away3d.core.draw.*;
import away3d.core.render.*;
import away3d.materials.*;
public class WireMesh extends BaseMesh implements IPrimitiveProvider {
public var material:ISegmentMaterial;
private var _segments:Array;
public function WireMesh(_arg1:Object=null){
_segments = [];
super(_arg1);
material = ini.getSegmentMaterial("material");
if (material == null){
material = new WireframeMaterial();
};
}
public function get segments():Array{
return (_segments);
}
public function addSegment(_arg1:Segment):void{
addElement(_arg1);
_segments.push(_arg1);
_arg1._ds.source = (_arg1.parent = this);
_arg1._ds.create = createDrawSegment;
}
public function removeSegment(_arg1:Segment):void{
var _local2:int = _segments.indexOf(_arg1);
if (_local2 == -1){
return;
};
removeElement(_arg1);
_segments.splice(_local2, 1);
}
override public function get elements():Array{
return (_segments);
}
override public function primitives(_arg1:IPrimitiveConsumer, _arg2:AbstractRenderSession):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);
};
};
};
};
};
};
}
}
}//package away3d.core.base
Section 25
//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 26
//BlockerArray (away3d.core.block.BlockerArray)
package away3d.core.block {
import away3d.core.clip.*;
public class BlockerArray implements IBlockerConsumer {
private var _clip:Clipping;
private var _blockers:Array;
private var blockers:Array;
public function set clip(_arg1:Clipping):void{
_clip = _arg1;
_blockers = [];
}
public function blocker(_arg1:Blocker):void{
if (_clip.check(_arg1)){
_blockers.push(_arg1);
};
}
public function get clip():Clipping{
return (_clip);
}
public function list():Array{
_blockers.sortOn("screenZ", Array.NUMERIC);
return (_blockers);
}
}
}//package away3d.core.block
Section 27
//IBlockerConsumer (away3d.core.block.IBlockerConsumer)
package away3d.core.block {
public interface IBlockerConsumer {
function blocker(_arg1:Blocker):void;
}
}//package away3d.core.block
Section 28
//IBlockerProvider (away3d.core.block.IBlockerProvider)
package away3d.core.block {
public interface IBlockerProvider {
function blockers(_arg1:IBlockerConsumer):void;
}
}//package away3d.core.block
Section 29
//Clipping (away3d.core.clip.Clipping)
package away3d.core.clip {
import flash.display.*;
import flash.geom.*;
import away3d.core.draw.*;
public class Clipping {
public var minX:Number;// = -1000000
public var minY:Number;// = -1000000
private var zeroPoint:Point;
private var globalPoint:Point;
private var rectangleClipping:RectangleClipping;
public var maxX:Number;// = 1000000
public var maxY:Number;// = 1000000
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 screen(_arg1:Sprite):Clipping{
if (!rectangleClipping){
rectangleClipping = new RectangleClipping();
};
switch (_arg1.stage.align){
case StageAlign.TOP_LEFT:
zeroPoint.x = 0;
zeroPoint.y = 0;
globalPoint = _arg1.globalToLocal(zeroPoint);
rectangleClipping.maxX = ((rectangleClipping.minX = globalPoint.x) + _arg1.stage.stageWidth);
rectangleClipping.maxY = ((rectangleClipping.minY = globalPoint.y) + _arg1.stage.stageHeight);
break;
case StageAlign.TOP_RIGHT:
zeroPoint.x = _arg1.stage.stageWidth;
zeroPoint.y = 0;
globalPoint = _arg1.globalToLocal(zeroPoint);
rectangleClipping.minX = ((rectangleClipping.maxX = globalPoint.x) - _arg1.stage.stageWidth);
rectangleClipping.maxY = ((rectangleClipping.minY = globalPoint.y) + _arg1.stage.stageHeight);
break;
case StageAlign.BOTTOM_LEFT:
zeroPoint.x = 0;
zeroPoint.y = _arg1.stage.stageHeight;
globalPoint = _arg1.globalToLocal(zeroPoint);
rectangleClipping.maxX = ((rectangleClipping.minX = globalPoint.x) + _arg1.stage.stageWidth);
rectangleClipping.minY = ((rectangleClipping.maxY = globalPoint.y) - _arg1.stage.stageHeight);
break;
case StageAlign.BOTTOM_RIGHT:
zeroPoint.x = _arg1.stage.stageWidth;
zeroPoint.y = _arg1.stage.stageHeight;
globalPoint = _arg1.globalToLocal(zeroPoint);
rectangleClipping.minX = ((rectangleClipping.maxX = globalPoint.x) - _arg1.stage.stageWidth);
rectangleClipping.minY = ((rectangleClipping.maxY = globalPoint.y) - _arg1.stage.stageHeight);
break;
case StageAlign.TOP:
zeroPoint.x = (_arg1.stage.stageWidth / 2);
zeroPoint.y = 0;
globalPoint = _arg1.globalToLocal(zeroPoint);
rectangleClipping.minX = (globalPoint.x - (_arg1.stage.stageWidth / 2));
rectangleClipping.maxX = (globalPoint.x + (_arg1.stage.stageWidth / 2));
rectangleClipping.maxY = ((rectangleClipping.minY = globalPoint.y) + _arg1.stage.stageHeight);
break;
case StageAlign.BOTTOM:
zeroPoint.x = (_arg1.stage.stageWidth / 2);
zeroPoint.y = _arg1.stage.stageHeight;
globalPoint = _arg1.globalToLocal(zeroPoint);
rectangleClipping.minX = (globalPoint.x - (_arg1.stage.stageWidth / 2));
rectangleClipping.maxX = (globalPoint.x + (_arg1.stage.stageWidth / 2));
rectangleClipping.minY = ((rectangleClipping.maxY = globalPoint.y) - _arg1.stage.stageHeight);
break;
case StageAlign.LEFT:
zeroPoint.x = 0;
zeroPoint.y = (_arg1.stage.stageHeight / 2);
globalPoint = _arg1.globalToLocal(zeroPoint);
rectangleClipping.maxX = ((rectangleClipping.minX = globalPoint.x) + _arg1.stage.stageWidth);
rectangleClipping.minY = (globalPoint.y - (_arg1.stage.stageHeight / 2));
rectangleClipping.maxY = (globalPoint.y + (_arg1.stage.stageHeight / 2));
break;
case StageAlign.RIGHT:
zeroPoint.x = _arg1.stage.stageWidth;
zeroPoint.y = (_arg1.stage.stageHeight / 2);
globalPoint = _arg1.globalToLocal(zeroPoint);
rectangleClipping.minX = ((rectangleClipping.maxX = globalPoint.x) - _arg1.stage.stageWidth);
rectangleClipping.minY = (globalPoint.y - (_arg1.stage.stageHeight / 2));
rectangleClipping.maxY = (globalPoint.y + (_arg1.stage.stageHeight / 2));
break;
default:
zeroPoint.x = (_arg1.stage.stageWidth / 2);
zeroPoint.y = (_arg1.stage.stageHeight / 2);
globalPoint = _arg1.globalToLocal(zeroPoint);
rectangleClipping.minX = (globalPoint.x - (_arg1.stage.stageWidth / 2));
rectangleClipping.maxX = (globalPoint.x + (_arg1.stage.stageWidth / 2));
rectangleClipping.minY = (globalPoint.y - (_arg1.stage.stageHeight / 2));
rectangleClipping.maxY = (globalPoint.y + (_arg1.stage.stageHeight / 2));
};
return (rectangleClipping);
}
public function check(_arg1:DrawPrimitive):Boolean{
return (true);
}
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.clip
Section 30
//RectangleClipping (away3d.core.clip.RectangleClipping)
package away3d.core.clip {
import away3d.core.draw.*;
public class RectangleClipping extends Clipping {
public function RectangleClipping(_arg1:Number=-1000000, _arg2:Number=-1000000, _arg3:Number=1000000, _arg4:Number=1000000){
this.minX = _arg1;
this.maxX = _arg3;
this.minY = _arg2;
this.maxY = _arg4;
}
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);
}
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);
}
public function toString():String{
return ((((((((("{minX:" + minX) + " maxX:") + maxX) + " minY:") + minY) + " maxY:") + maxY) + "}"));
}
override public function asRectangleClipping():RectangleClipping{
return (this);
}
}
}//package away3d.core.clip
Section 31
//DrawDisplayObject (away3d.core.draw.DrawDisplayObject)
package away3d.core.draw {
import flash.display.*;
import away3d.core.render.*;
public class DrawDisplayObject extends DrawPrimitive {
public var screenvertex:ScreenVertex;
public var displayobject:DisplayObject;
public var session:AbstractRenderSession;
override public function calc():void{
screenZ = screenvertex.z;
minZ = screenZ;
maxZ = screenZ;
minX = (screenvertex.x - (displayobject.width / 2));
minY = (screenvertex.y - (displayobject.height / 2));
maxX = (screenvertex.x + (displayobject.width / 2));
maxY = (screenvertex.y + (displayobject.height / 2));
}
override public function clear():void{
displayobject = null;
}
override public function render():void{
displayobject.x = screenvertex.x;
displayobject.y = screenvertex.y;
session.addDisplayObject(displayobject);
}
override public function contains(_arg1:Number, _arg2:Number):Boolean{
return (true);
}
}
}//package away3d.core.draw
Section 32
//DrawFog (away3d.core.draw.DrawFog)
package away3d.core.draw {
import away3d.materials.*;
public class DrawFog extends DrawPrimitive {
public var material:IFogMaterial;
override public function render():void{
material.renderFog(this);
}
}
}//package away3d.core.draw
Section 33
//DrawPrimitive (away3d.core.draw.DrawPrimitive)
package away3d.core.draw {
import away3d.core.base.*;
import away3d.core.render.*;
public class DrawPrimitive {
public var quadrant:PrimitiveQuadrantTreeNode;
public var minX:Number;
public var minY:Number;
public var minZ:Number;
public var projection:Projection;
public var source:Object3D;
public var screenZ:Number;
public var maxX:Number;
public var maxY:Number;
public var create:Function;
public var maxZ:Number;
public function getZ(_arg1:Number, _arg2:Number):Number{
return (screenZ);
}
public function clear():void{
throw (new Error("Not implemented"));
}
public function calc():void{
throw (new Error("Not implemented"));
}
public function render():void{
throw (new Error("Not implemented"));
}
public function contains(_arg1:Number, _arg2:Number):Boolean{
throw (new Error("Not implemented"));
}
public function quarter(_arg1:Number):Array{
throw (new Error("Not implemented"));
}
public function toString():String{
return ((((((("P{ screenZ = " + screenZ) + ", minZ = ") + minZ) + ", maxZ = ") + maxZ) + " }"));
}
}
}//package away3d.core.draw
Section 34
//DrawScaledBitmap (away3d.core.draw.DrawScaledBitmap)
package away3d.core.draw {
import flash.display.*;
import flash.geom.*;
public class DrawScaledBitmap extends DrawPrimitive {
private var cosh:Number;
public var rotation:Number;
private var width:Number;
var left:ScreenVertex;
public var scale:Number;
private var cosw:Number;
var bottomright:ScreenVertex;
private var cos:Number;
private var sinh:Number;
private var sin:Number;
var top:ScreenVertex;
private var sinw:Number;
var topleft:ScreenVertex;
private var mapping:Matrix;
public var screenvertex:ScreenVertex;
var topright:ScreenVertex;
public var bitmap:BitmapData;
var bottomleft:ScreenVertex;
private var bounds:ScreenVertex;
private var height:Number;
public var smooth:Boolean;
public function DrawScaledBitmap(){
topleft = new ScreenVertex();
topright = new ScreenVertex();
bottomleft = new ScreenVertex();
bottomright = new ScreenVertex();
left = new ScreenVertex();
top = new ScreenVertex();
mapping = new Matrix();
super();
}
override public function render():void{
source.session.renderScaledBitmap(this, bitmap, mapping, smooth);
}
override public function clear():void{
bitmap = null;
}
override public function calc():void{
var _local1:Array;
screenZ = screenvertex.z;
minZ = screenZ;
maxZ = screenZ;
width = (bitmap.width * scale);
height = (bitmap.height * scale);
if (rotation != 0){
cos = Math.cos(((rotation * Math.PI) / 180));
sin = Math.sin(((rotation * Math.PI) / 180));
cosw = ((cos * width) / 2);
cosh = ((cos * height) / 2);
sinw = ((sin * width) / 2);
sinh = ((sin * height) / 2);
topleft.x = ((screenvertex.x - cosw) - sinh);
topleft.y = ((screenvertex.y + sinw) - cosh);
topright.x = ((screenvertex.x + cosw) - sinh);
topright.y = ((screenvertex.y - sinw) - cosh);
bottomleft.x = ((screenvertex.x - cosw) + sinh);
bottomleft.y = ((screenvertex.y + sinw) + cosh);
bottomright.x = ((screenvertex.x + cosw) + sinh);
bottomright.y = ((screenvertex.y - sinw) + cosh);
_local1 = new Array();
_local1.push(topleft);
_local1.push(topright);
_local1.push(bottomleft);
_local1.push(bottomright);
minX = 100000;
minY = 100000;
maxX = -100000;
maxY = -100000;
for each (bounds in _local1) {
if (minX > bounds.x){
minX = bounds.x;
};
if (maxX < bounds.x){
maxX = bounds.x;
};
if (minY > bounds.y){
minY = bounds.y;
};
if (maxY < bounds.y){
maxY = bounds.y;
};
};
mapping.a = (scale * cos);
mapping.b = (-(scale) * sin);
mapping.c = (scale * sin);
mapping.d = (scale * cos);
mapping.tx = topleft.x;
mapping.ty = topleft.y;
} else {
topleft.x = (screenvertex.x - (width / 2));
topleft.y = (screenvertex.y - (height / 2));
topright.x = (topleft.x + width);
topright.y = topleft.y;
bottomleft.x = topleft.x;
bottomleft.y = (topleft.y + height);
bottomright.x = topright.x;
bottomright.y = bottomleft.y;
minX = topleft.x;
minY = topleft.y;
maxX = bottomright.x;
maxY = bottomright.y;
mapping.a = (mapping.d = scale);
mapping.c = (mapping.b = 0);
mapping.tx = topleft.x;
mapping.ty = topleft.y;
};
}
override public function contains(_arg1:Number, _arg2:Number):Boolean{
if (rotation != 0){
if ((((topleft.x * (_arg2 - topright.y)) + (topright.x * (topleft.y - _arg2))) + (_arg1 * (topright.y - topleft.y))) > 0.001){
return (false);
};
if ((((topright.x * (_arg2 - bottomright.y)) + (bottomright.x * (topright.y - _arg2))) + (_arg1 * (bottomright.y - topright.y))) > 0.001){
return (false);
};
if ((((bottomright.x * (_arg2 - bottomleft.y)) + (bottomleft.x * (bottomright.y - _arg2))) + (_arg1 * (bottomleft.y - bottomright.y))) > 0.001){
return (false);
};
if ((((bottomleft.x * (_arg2 - topleft.y)) + (topleft.x * (bottomleft.y - _arg2))) + (_arg1 * (topleft.y - bottomleft.y))) > 0.001){
return (false);
};
};
if (!bitmap.transparent){
return (true);
};
mapping = new Matrix((scale * cos), (-(scale) * sin), (scale * sin), (scale * cos), topleft.x, topleft.y);
mapping.invert();
var _local3:Point = mapping.transformPoint(new Point(_arg1, _arg2));
if (_local3.x < 0){
_local3.x = 0;
};
if (_local3.y < 0){
_local3.y = 0;
};
if (_local3.x >= bitmap.width){
_local3.x = (bitmap.width - 1);
};
if (_local3.y >= bitmap.height){
_local3.y = (bitmap.height - 1);
};
var _local4:uint = bitmap.getPixel32(int(_local3.x), int(_local3.y));
return ((uint((_local4 >> 24)) > 128));
}
}
}//package away3d.core.draw
Section 35
//DrawSegment (away3d.core.draw.DrawSegment)
package away3d.core.draw {
import away3d.materials.*;
public class DrawSegment extends DrawPrimitive {
public var v0:ScreenVertex;
private var bzf:Number;
private var axf:Number;
private var det:Number;
private var dx:Number;
private var dy:Number;
private var faz:Number;
public var material:ISegmentMaterial;
private var ayf:Number;
private var ax:Number;
private var ay:Number;
private var az:Number;
private var fbz:Number;
private var azf:Number;
private var bxf:Number;
private var bx:Number;
private var by:Number;
private var bz:Number;
private var focus:Number;
private var xfocus:Number;
public var length:Number;
private var byf:Number;
public var v1:ScreenVertex;
private var da:Number;
private var db:Number;
private var yfocus:Number;
override public function render():void{
material.renderSegment(this);
}
function onepointcut(_arg1:ScreenVertex):Array{
return ([create(material, projection, v0, _arg1), create(material, projection, _arg1, v1)]);
}
override public function quarter(_arg1:Number):Array{
if (length < 5){
return (null);
};
var _local2:ScreenVertex = ScreenVertex.median(v0, v1, _arg1);
return ([create(material, projection, v0, _local2), create(material, projection, _local2, 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 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));
}
private function distanceToCenter(_arg1:Number, _arg2:Number):Number{
var _local3:Number = ((v0.x + v1.x) / 2);
var _local4:Number = ((v0.y + v1.y) / 2);
return (Math.sqrt((((_local3 - _arg1) * (_local3 - _arg1)) + ((_local4 - _arg2) * (_local4 - _arg2)))));
}
override public function clear():void{
v0 = null;
v1 = null;
}
override 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))));
}
override public function toString():String{
return ((((((("S{ screenZ = " + screenZ) + ", minZ = ") + minZ) + ", maxZ = ") + maxZ) + " }"));
}
}
}//package away3d.core.draw
Section 36
//DrawTriangle (away3d.core.draw.DrawTriangle)
package away3d.core.draw {
import flash.geom.*;
import away3d.core.base.*;
import away3d.materials.*;
public class DrawTriangle extends DrawPrimitive {
private var _u0:Number;
private var _u2:Number;
private var bzf:Number;
private var axf:Number;
private var det:Number;
private var v12:ScreenVertex;
private var _v0:Number;
private var _v1:Number;
private var _v2:Number;
private var faz:Number;
public var material:ITriangleMaterial;
private var materialHeight:Number;
private var av:Number;
private var ax:Number;
private var ay:Number;
private var az:Number;
private var ayf:Number;
private var au:Number;
private var fbz:Number;
private var v20:ScreenVertex;
private var azf:Number;
private var bu:Number;
private var bv:Number;
private var bx:Number;
private var by:Number;
private var bz:Number;
public var texturemapping:Matrix;
private var fcz:Number;
private var uv01:UV;
private var d01:Number;
public var face:Face;
private var cv:Number;
private var cx:Number;
private var cy:Number;
private var cz:Number;
private var cu:Number;
public var v0:ScreenVertex;
public var v1:ScreenVertex;
private var da:Number;
private var db:Number;
private var dc:Number;
private var dd01:Number;
private var uv12:UV;
public var invtexturemapping:Matrix;
private var d12:Number;
public var area:Number;
private var cxf:Number;
public var v2:ScreenVertex;
private var uv20:UV;
private var dd12:Number;
private var d20:Number;
public var uv0:UV;
public var uv2:UV;
private var dd20:Number;
private var cyf:Number;
public var backface:Boolean;// = false
private var czf:Number;
private var bxf:Number;
public var uv1:UV;
private var focus:Number;
private var materialWidth:Number;
private var byf:Number;
private var v01:ScreenVertex;
private var _u1:Number;
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 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 function minEdgeSqr():Number{
return (Math.min(Math.min(v0.distanceSqr(v1), v1.distanceSqr(v2)), v2.distanceSqr(v0)));
}
final function minDistortSqr(_arg1:Number):Number{
return (Math.min(Math.min(v0.distortSqr(v1, _arg1), v1.distortSqr(v2, _arg1)), v2.distortSqr(v0, _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 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));
}
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 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)))));
}
private function num(_arg1:Number):Number{
return ((int((_arg1 * 1000)) / 1000));
}
final private function bisect01(_arg1:Number):Array{
var _local2:ScreenVertex = ScreenVertex.median(v0, v1, _arg1);
var _local3:UV = 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 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 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)));
}
override public function clear():void{
v0 = null;
v1 = null;
v2 = null;
uv0 = null;
uv1 = null;
uv2 = null;
texturemapping = null;
}
override public function render():void{
material.renderTriangle(this);
}
override public function toString():String{
var _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 private function bisect12(_arg1:Number):Array{
var _local2:ScreenVertex = ScreenVertex.median(v1, v2, _arg1);
var _local3:UV = 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 private function bisect20(_arg1:Number):Array{
var _local2:ScreenVertex = ScreenVertex.median(v2, v0, _arg1);
var _local3:UV = 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)]);
}
final public function distanceToCenter(_arg1:Number, _arg2:Number):Number{
var _local3:Number = (((v0.x + v1.x) + v2.x) / 3);
var _local4:Number = (((v0.y + v1.y) + v2.y) / 3);
return (Math.sqrt((((_local3 - _arg1) * (_local3 - _arg1)) + ((_local4 - _arg2) * (_local4 - _arg2)))));
}
final function maxDistortSqr(_arg1:Number):Number{
return (Math.max(Math.max(v0.distortSqr(v1, _arg1), v1.distortSqr(v2, _arg1)), v2.distortSqr(v0, _arg1)));
}
final function maxEdgeSqr():Number{
return (Math.max(Math.max(v0.distanceSqr(v1), v1.distanceSqr(v2)), v2.distanceSqr(v0)));
}
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));
}
}
}//package away3d.core.draw
Section 37
//IPrimitiveConsumer (away3d.core.draw.IPrimitiveConsumer)
package away3d.core.draw {
public interface IPrimitiveConsumer {
function primitive(_arg1:DrawPrimitive):void;
}
}//package away3d.core.draw
Section 38
//IPrimitiveProvider (away3d.core.draw.IPrimitiveProvider)
package away3d.core.draw {
import away3d.core.render.*;
public interface IPrimitiveProvider {
function primitives(_arg1:IPrimitiveConsumer, _arg2:AbstractRenderSession):void;
}
}//package away3d.core.draw
Section 39
//PrimitiveArray (away3d.core.draw.PrimitiveArray)
package away3d.core.draw {
import away3d.core.clip.*;
import away3d.core.block.*;
public class PrimitiveArray implements IPrimitiveConsumer {
private var _primitives:Array;
private var _clip:Clipping;
private var _blockers:Array;
public function set clip(_arg1:Clipping):void{
_clip = _arg1;
_primitives = [];
}
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;
}
public function list():Array{
return (_primitives);
}
}
}//package away3d.core.draw
Section 40
//PrimitiveQuadrantTreeNode (away3d.core.draw.PrimitiveQuadrantTreeNode)
package away3d.core.draw {
import away3d.core.base.*;
public final class PrimitiveQuadrantTreeNode {
public var parent:PrimitiveQuadrantTreeNode;
public var create:Function;
private var level:int;
public var righttopFlag:Boolean;
public var rightbottom:PrimitiveQuadrantTreeNode;
public var righttop:PrimitiveQuadrantTreeNode;
public var rightbottomFlag:Boolean;
public var onlysource:Object3D;
public var xdiv:Number;
private var halfheight:Number;
public var center:Array;
private var maxlevel:int;// = 4
private var render_center_length:int;// = -1
public var onlysourceFlag:Boolean;// = true
private var render_center_index:int;// = -1
private var halfwidth:Number;
public var lefttop:PrimitiveQuadrantTreeNode;
public var ydiv:Number;
public var leftbottom:PrimitiveQuadrantTreeNode;
public var lefttopFlag:Boolean;
public var leftbottomFlag:Boolean;
public function PrimitiveQuadrantTreeNode(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:int, _arg6:PrimitiveQuadrantTreeNode=null){
this.level = _arg5;
this.xdiv = _arg1;
this.ydiv = _arg2;
halfwidth = (_arg3 / 2);
halfheight = (_arg4 / 2);
this.parent = _arg6;
}
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;
}
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;
}
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);
}
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);
};
}
}
}//package away3d.core.draw
Section 41
//ScreenVertex (away3d.core.draw.ScreenVertex)
package away3d.core.draw {
import away3d.core.base.*;
public final class ScreenVertex {
public var y:Number;
private var persp:Number;
private var my2:Number;
public var num:Number;
private var dx:Number;
private var dy:Number;
private var faz:Number;
private var mx2:Number;
private var ifmz2:Number;
public var visible:Boolean;
public var x:Number;
public var z:Number;
private var fbz: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 = ((_arg1.z + _arg2.z) / 2);
var _local5:Number = (_arg3 + _arg1.z);
var _local6:Number = (_arg3 + _arg2.z);
var _local7:Number = ((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{
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));
};
var _local6:Number = (_arg3 + _arg4);
var _local7:Number = (_arg3 / _local6);
var _local8:Number = (_arg4 / _local6);
var _local9:Number = ((_arg1.x * _local7) + (_arg2.x * _local8));
var _local10:Number = ((_arg1.y * _local7) + (_arg2.y * _local8));
var _local11:Number = (_arg1.z / _arg5);
var _local12:Number = (_arg2.z / _arg5);
var _local13:Number = (1 + _local11);
var _local14:Number = (1 + _local12);
var _local15:Number = ((_arg1.x * _local13) - (_local9 * _local11));
var _local16:Number = ((_arg2.x * _local14) - (_local9 * _local12));
var _local17:Number = ((_arg1.y * _local13) - (_local10 * _local11));
var _local18:Number = ((_arg2.y * _local14) - (_local10 * _local12));
var _local19:Number = ((_local15 * _local18) - (_local16 * _local17));
var _local20:Number = ((_local9 * _local18) - (_local16 * _local10));
var _local21:Number = ((_local15 * _local10) - (_local9 * _local17));
return (new ScreenVertex(_local9, _local10, (((_local20 * _arg1.z) + (_local21 * _arg2.z)) / _local19)));
}
}
}//package away3d.core.draw
Section 42
//IPrimitiveFilter (away3d.core.filter.IPrimitiveFilter)
package away3d.core.filter {
import away3d.core.clip.*;
import away3d.containers.*;
import away3d.cameras.*;
public interface IPrimitiveFilter {
function filter(_arg1:Array, _arg2:Scene3D, _arg3:Camera3D, _arg4:Clipping):Array;
}
}//package away3d.core.filter
Section 43
//ZSortFilter (away3d.core.filter.ZSortFilter)
package away3d.core.filter {
import away3d.core.clip.*;
import away3d.containers.*;
import away3d.cameras.*;
public class ZSortFilter implements IPrimitiveFilter {
public function filter(_arg1:Array, _arg2:Scene3D, _arg3:Camera3D, _arg4:Clipping):Array{
_arg1.sortOn("screenZ", (Array.DESCENDING | Array.NUMERIC));
return (_arg1);
}
public function toString():String{
return ("ZSort");
}
}
}//package away3d.core.filter
Section 44
//AmbientLight (away3d.core.light.AmbientLight)
package away3d.core.light {
import flash.display.*;
import away3d.lights.*;
public class AmbientLight extends LightPrimitive {
public var light:AmbientLight3D;
public function updateAmbientBitmap(_arg1:Number):void{
this.ambient = _arg1;
ambientBitmap = new BitmapData(0x0100, 0x0100, false, ((int(((_arg1 * red) << 16)) | int(((_arg1 * green) << 8))) | int((_arg1 * blue))));
ambientBitmap.lock();
}
}
}//package away3d.core.light
Section 45
//DirectionalLight (away3d.core.light.DirectionalLight)
package away3d.core.light {
import flash.display.*;
import flash.geom.*;
import away3d.core.base.*;
import away3d.containers.*;
import away3d.events.*;
import away3d.core.math.*;
import flash.utils.*;
import flash.filters.*;
import away3d.lights.*;
import away3d.core.*;
public class DirectionalLight extends LightPrimitive {
private var halfTransform:Matrix3D;
private var mod:Number;
private var _green:Number;
public var ambientDiffuseColorTransform:ColorTransform;
private var quaternion:Quaternion;
private var _shape:Shape;
public var light:DirectionalLight3D;
public var diffuseTransform:Dictionary;
private var halfQuaternion:Quaternion;
private var _szx:Number;
private var _szy:Number;
private var _szz:Number;
private var _blue:Number;
private var _colorMatrix:ColorMatrixFilter;
private var cameraTransform:Matrix3D;
public var colorMatrixTransform:Dictionary;
private var nx:Number;
private var ny:Number;
private var _red:Number;
public var normalMatrixTransform:Dictionary;
private var halfVector:Number3D;
private var cameraDirection:Number3D;
private var _matrix:Matrix;
public var diffuseColorTransform:ColorTransform;
private var _normalMatrix:ColorMatrixFilter;
public var specularTransform:Dictionary;
private var transform:Matrix3D;
private var invTransform:Matrix3D;
private var direction:Number3D;
public function DirectionalLight(){
_colorMatrix = new ColorMatrixFilter();
_normalMatrix = new ColorMatrixFilter();
_matrix = new Matrix();
_shape = new Shape();
quaternion = new Quaternion();
invTransform = new Matrix3D();
transform = new Matrix3D();
cameraDirection = new Number3D();
halfVector = new Number3D();
halfQuaternion = new Quaternion();
halfTransform = new Matrix3D();
direction = new Number3D();
colorMatrixTransform = new Dictionary(true);
normalMatrixTransform = new Dictionary(true);
super();
}
public function setNormalMatrixTransform(_arg1:Object3D):void{
_szx = diffuseTransform[_arg1].szx;
_szy = diffuseTransform[_arg1].szy;
_szz = diffuseTransform[_arg1].szz;
_normalMatrix.matrix = [_szx, 0, 0, 0, (127 - (_szx * 127)), 0, -(_szy), 0, 0, (127 + (_szy * 127)), 0, 0, _szz, 0, (127 - (_szz * 127)), 0, 0, 0, 1, 0];
normalMatrixTransform[_arg1] = _normalMatrix.clone();
}
public function clearTransform():void{
diffuseTransform = new Dictionary(true);
specularTransform = new Dictionary(true);
colorMatrixTransform = new Dictionary(true);
normalMatrixTransform = new Dictionary(true);
}
public function setSpecularTransform(_arg1:Object3D, _arg2:View3D):void{
cameraTransform = _arg2.camera.transform;
cameraDirection.x = -(cameraTransform.sxz);
cameraDirection.y = -(cameraTransform.syz);
cameraDirection.z = -(cameraTransform.szz);
halfVector.add(cameraDirection, direction);
halfVector.normalize();
nx = halfVector.x;
ny = halfVector.y;
mod = Math.sqrt(((nx * nx) + (ny * ny)));
halfTransform.rotationMatrix((-(ny) / mod), (nx / mod), 0, Math.acos(-(halfVector.z)));
if (!specularTransform[_arg1][_arg2]){
specularTransform[_arg1][_arg2] = new Matrix3D();
};
specularTransform[_arg1][_arg2].multiply3x3(halfTransform, _arg1._sceneTransform);
}
public function updateSpecularBitmap(_arg1:Number):void{
this.specular = _arg1;
specularBitmap = new BitmapData(0x0200, 0x0200, false, 0);
specularBitmap.lock();
_matrix.createGradientBox(0x0200, 0x0200, 0, 0, 0);
var _local2:Array = new Array();
var _local3:Array = new Array();
var _local4:Array = new Array();
var _local5 = 15;
while (_local5--) {
_local2.push(((((((_local5 * _arg1) * red) / 14) << 16) + ((((_local5 * _arg1) * green) / 14) << 8)) + (((_local5 * _arg1) * blue) / 14)));
_local3.push(1);
_local4.push(int((30 + (((225 * 2) * Math.acos(Math.pow((_local5 / 14), (1 / 20)))) / Math.PI))));
};
_shape.graphics.clear();
_shape.graphics.beginGradientFill(GradientType.RADIAL, _local2, _local3, _local4, _matrix);
_shape.graphics.drawCircle(0xFF, 0xFF, 0xFF);
specularBitmap.draw(_shape);
}
public function updateAmbientBitmap(_arg1:Number):void{
this.ambient = _arg1;
ambientBitmap = new BitmapData(0x0100, 0x0100, false, ((int(((_arg1 * red) << 16)) | int(((_arg1 * green) << 8))) | int((_arg1 * blue))));
ambientBitmap.lock();
}
public function setDiffuseTransform(_arg1:Object3D):void{
if (!diffuseTransform[_arg1]){
diffuseTransform[_arg1] = new Matrix3D();
};
diffuseTransform[_arg1].multiply3x3(transform, _arg1._sceneTransform);
}
public function updateDirection(_arg1:Object3DEvent):void{
direction.x = light.x;
direction.y = light.y;
direction.z = light.z;
direction.normalize();
nx = direction.x;
ny = direction.y;
mod = Math.sqrt(((nx * nx) + (ny * ny)));
transform.rotationMatrix((ny / mod), (-(nx) / mod), 0, -(Math.acos(-(direction.z))));
clearTransform();
}
public function setColorMatrixTransform(_arg1:Object3D):void{
_red = (red / 127);
_green = (green / 127);
_blue = (blue / 127);
_colorMatrix.matrix = [_red, _red, _red, 0, (-381 * _red), _green, _green, _green, 0, (-381 * _green), _blue, _blue, _blue, 0, (-381 * _blue), 0, 0, 0, 1, 0];
colorMatrixTransform[_arg1] = _colorMatrix.clone();
}
public function updateDiffuseBitmap(_arg1:Number):void{
var _local6:Number;
var _local7:Number;
var _local8:Number;
this.diffuse = _arg1;
diffuseBitmap = new BitmapData(0x0100, 0x0100, false, 0);
diffuseBitmap.lock();
_matrix.createGradientBox(0x0100, 0x0100, 0, 0, 0);
var _local2:Array = new Array();
var _local3:Array = new Array();
var _local4:Array = new Array();
var _local5 = 15;
while (_local5--) {
_local6 = ((_local5 * _arg1) / 14);
if (_local6 > 1){
_local6 = 1;
};
_local7 = ((_local5 * _arg1) / 14);
if (_local7 > 1){
_local7 = 1;
};
_local8 = ((_local5 * _arg1) / 14);
if (_local8 > 1){
_local8 = 1;
};
_local2.push(((((_local6 * red) << 16) | ((_local7 * green) << 8)) | (_local8 * blue)));
_local3.push(1);
_local4.push(int((30 + (((225 * 2) * Math.acos((_local5 / 14))) / Math.PI))));
};
_shape.graphics.clear();
_shape.graphics.beginGradientFill(GradientType.LINEAR, _local2, _local3, _local4, _matrix);
_shape.graphics.drawRect(0, 0, 0x0100, 0x0100);
diffuseBitmap.draw(_shape);
diffuseColorTransform = new ColorTransform(((_arg1 * red) / 0xFF), ((_arg1 * green) / 0xFF), ((_arg1 * blue) / 0xFF), 1, 0, 0, 0, 0);
}
public function updateAmbientDiffuseBitmap(_arg1:Number, _arg2:Number):void{
var _local7:Number;
var _local8:Number;
var _local9:Number;
this.diffuse = _arg2;
ambientDiffuseBitmap = new BitmapData(0x0100, 0x0100, false, 0);
ambientDiffuseBitmap.lock();
_matrix.createGradientBox(0x0100, 0x0100, 0, 0, 0);
var _local3:Array = new Array();
var _local4:Array = new Array();
var _local5:Array = new Array();
var _local6 = 15;
while (_local6--) {
_local7 = (((_local6 * _arg2) / 14) + _arg1);
if (_local7 > 1){
_local7 = 1;
};
_local8 = (((_local6 * _arg2) / 14) + _arg1);
if (_local8 > 1){
_local8 = 1;
};
_local9 = (((_local6 * _arg2) / 14) + _arg1);
if (_local9 > 1){
_local9 = 1;
};
_local3.push(((((_local7 * red) << 16) | ((_local8 * green) << 8)) | (_local9 * blue)));
_local4.push(1);
_local5.push(int((30 + (((225 * 2) * Math.acos((_local6 / 14))) / Math.PI))));
};
_shape.graphics.clear();
_shape.graphics.beginGradientFill(GradientType.LINEAR, _local3, _local4, _local5, _matrix);
_shape.graphics.drawRect(0, 0, 0x0100, 0x0100);
ambientDiffuseBitmap.draw(_shape);
ambientDiffuseColorTransform = new ColorTransform(((_arg2 * red) / 0xFF), ((_arg2 * green) / 0xFF), ((_arg2 * blue) / 0xFF), 1, (_arg1 * red), (_arg1 * green), (_arg1 * blue), 0);
}
}
}//package away3d.core.light
Section 46
//ILightConsumer (away3d.core.light.ILightConsumer)
package away3d.core.light {
public interface ILightConsumer {
function directionalLight(_arg1:DirectionalLight):void;
function pointLight(_arg1:PointLight):void;
function ambientLight(_arg1:AmbientLight):void;
}
}//package away3d.core.light
Section 47
//ILightProvider (away3d.core.light.ILightProvider)
package away3d.core.light {
public interface ILightProvider {
function light(_arg1:ILightConsumer):void;
}
}//package away3d.core.light
Section 48
//LightArray (away3d.core.light.LightArray)
package away3d.core.light {
public class LightArray implements ILightConsumer {
public var points:Array;
public var directionals:Array;
public var numLights:int;
public var ambients:Array;
public function ambientLight(_arg1:AmbientLight):void{
ambients.push(_arg1);
numLights++;
}
public function directionalLight(_arg1:DirectionalLight):void{
directionals.push(_arg1);
numLights++;
}
public function clear():void{
ambients = [];
directionals = [];
points = [];
numLights = 0;
}
public function pointLight(_arg1:PointLight):void{
points.push(_arg1);
numLights++;
}
}
}//package away3d.core.light
Section 49
//LightPrimitive (away3d.core.light.LightPrimitive)
package away3d.core.light {
import flash.display.*;
public class LightPrimitive {
public var diffuseBitmap:BitmapData;
public var specularBitmap:BitmapData;
public var green:Number;
public var ambientBitmap:BitmapData;
public var diffuse:Number;
public var specular:Number;
public var red:Number;
public var ambient:Number;
public var ambientDiffuseBitmap:BitmapData;
public var blue:Number;
}
}//package away3d.core.light
Section 50
//PointLight (away3d.core.light.PointLight)
package away3d.core.light {
import away3d.lights.*;
public class PointLight extends LightPrimitive {
public var light:PointLight3D;
public var x:Number;
public var y:Number;
public var z:Number;
}
}//package away3d.core.light
Section 51
//Matrix3D (away3d.core.math.Matrix3D)
package away3d.core.math {
public final class Matrix3D {
private const toDEGREES:Number;
private var xx:Number;
private var xy:Number;
private var xz:Number;
private var yw:Number;
private var yy:Number;
private var yz:Number;
private var scos:Number;
private var nCos:Number;
private var zw:Number;
private var m211:Number;
private var m213:Number;
private var m214:Number;
private var m212:Number;
private var suv:Number;
private var suw:Number;
private var su:Number;
private var sv:Number;
private var m221:Number;
private var m222:Number;
private var m223:Number;
private var m224:Number;
private var sw:Number;
private var zz:Number;
private var d:Number;
private var svw:Number;
private var w:Number;
private var x:Number;
private var y:Number;
private var z:Number;
private var m231:Number;
private var m111:Number;
private var m112:Number;
private var m114:Number;
private var _position:Number3D;
private var m113:Number;
private var m232:Number;
private var m233:Number;
private var m234:Number;
private var nSin:Number;
public var tx:Number;
public var ty:Number;
public var tz:Number;
private var m121:Number;
private var m122:Number;
private var m123: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 szz:Number;
public var szy:Number;
private var xw:Number;
public function Matrix3D(){
toDEGREES = (180 / Math.PI);
_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(_arg1:Matrix3D):Matrix3D{
sxx = _arg1.sxx;
sxy = _arg1.sxy;
sxz = _arg1.sxz;
tx = _arg1.tx;
syx = _arg1.syx;
syy = _arg1.syy;
syz = _arg1.syz;
ty = _arg1.ty;
szx = _arg1.szx;
szy = _arg1.szy;
szz = _arg1.szz;
tz = _arg1.tz;
return (_arg1);
}
public function toString():String{
var _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 _local4:Number;
var _local5:Number;
var _local1:Number3D = new Number3D();
var _local2:Number = -(Math.asin(Math.max(-1, Math.min(1, sxz))));
var _local3:Number = 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 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 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 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:Quaternion):void{
x = _arg1.x;
y = _arg1.y;
z = _arg1.z;
w = _arg1.w;
xx = (x * x);
xy = (x * y);
xz = (x * z);
xw = (x * w);
yy = (y * y);
yz = (y * z);
yw = (y * w);
zz = (z * z);
zw = (z * w);
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 52
//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, _arg4:Boolean=false){
this.x = _arg1;
this.y = _arg2;
this.z = _arg3;
if (_arg4){
normalize();
};
}
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 clone():Number3D{
return (new Number3D(x, y, z));
}
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 getAngle(_arg1:Number3D=null):Number{
if (_arg1 == null){
_arg1 = new Number3D();
};
return (Math.acos((dot(_arg1) / (modulo * _arg1.modulo))));
}
public function transform(_arg1:Number3D, _arg2:Matrix3D):void{
x = ((((_arg1.x * _arg2.sxx) + (_arg1.y * _arg2.sxy)) + (_arg1.z * _arg2.sxz)) + _arg2.tx);
y = ((((_arg1.x * _arg2.syx) + (_arg1.y * _arg2.syy)) + (_arg1.z * _arg2.syz)) + _arg2.ty);
z = ((((_arg1.x * _arg2.szx) + (_arg1.y * _arg2.szy)) + (_arg1.z * _arg2.szz)) + _arg2.tz);
}
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 toString():String{
return (((((("x:" + x) + " y:") + y) + " z:") + z));
}
public function get modulo2():Number{
return ((((x * x) + (y * y)) + (z * z)));
}
}
}//package away3d.core.math
Section 53
//Quaternion (away3d.core.math.Quaternion)
package away3d.core.math {
public final class Quaternion {
private var fSinYaw:Number;
private var fCosYaw:Number;
private var z2:Number;
public var z:Number;
private var fCosPitch:Number;
private var w1:Number;
private var w2:Number;
private var cos_a:Number;
private var fSinRoll:Number;
private var x1:Number;
private var x2:Number;
private var sin_a:Number;
private var fCosPitchCosYaw:Number;
private var fSinPitch:Number;
private var y1:Number;
private var y2:Number;
private var fCosRoll:Number;
public var w:Number;
public var x:Number;
public var y:Number;
private var fSinPitchSinYaw:Number;
private var z1:Number;
public function normalize(_arg1:Number=1):void{
var _local2:Number = (magnitude * _arg1);
x = (x / _local2);
y = (y / _local2);
z = (z / _local2);
w = (w / _local2);
}
public function axis2quaternion(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):void{
sin_a = Math.sin((_arg4 / 2));
cos_a = Math.cos((_arg4 / 2));
this.x = (_arg1 * sin_a);
this.y = (_arg2 * sin_a);
this.z = (_arg3 * sin_a);
w = cos_a;
normalize();
}
public function get magnitude():Number{
return (Math.sqrt(((((w * w) + (x * x)) + (y * y)) + (z * z))));
}
public function multiply(_arg1:Quaternion, _arg2:Quaternion):void{
w1 = _arg1.w;
x1 = _arg1.x;
y1 = _arg1.y;
z1 = _arg1.z;
w2 = _arg2.w;
x2 = _arg2.x;
y2 = _arg2.y;
z2 = _arg2.z;
w = ((((w1 * w2) - (x1 * x2)) - (y1 * y2)) - (z1 * z2));
x = ((((w1 * x2) + (x1 * w2)) + (y1 * z2)) - (z1 * y2));
y = ((((w1 * y2) + (y1 * w2)) + (z1 * x2)) - (x1 * z2));
z = ((((w1 * z2) + (z1 * w2)) + (x1 * y2)) - (y1 * x2));
}
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 function toString():String{
return ((((((((("{x:" + x) + " y:") + y) + " z:") + z) + " w:") + w) + "}"));
}
}
}//package away3d.core.math
Section 54
//AbstractRenderSession (away3d.core.render.AbstractRenderSession)
package away3d.core.render {
import flash.display.*;
import flash.geom.*;
import away3d.core.draw.*;
import away3d.core.base.*;
import away3d.containers.*;
import away3d.core.light.*;
import flash.utils.*;
public class AbstractRenderSession {
private var a2:Number;
var _view:View3D;
private var ty:Number;
var doActive:Array;
private var tx:Number;
private var b2:Number;
public var newLayer:Sprite;
public var graphics:Graphics;
var doStore:Array;
private var b:Number;
private var session:AbstractRenderSession;
private var ds:DisplayObject;
var _layerDirty:Boolean;
var _lightarray:LightArray;
public var sessions:Dictionary;
var _shape:Shape;
private var c2:Number;
var _renderSource:Object3D;
var _containers:Dictionary;
private var cont:Shape;
private var v0x:Number;
private var v0y:Number;
private var time:int;
private var d2:Number;
private var v1x:Number;
private var v1y:Number;
private var a:Number;
private var c:Number;
private var d:Number;
public var spriteLayers:Array;
private var m:Matrix;
protected var i:int;
private var v2x:Number;
private var v2y:Number;
public var children:Dictionary;
public function AbstractRenderSession(){
_containers = new Dictionary(true);
doStore = new Array();
doActive = new Array();
m = new Matrix();
sessions = new Dictionary(true);
spriteLayers = new Array();
children = new Dictionary(true);
super();
}
public function set lightarray(_arg1:LightArray):void{
_lightarray = _arg1;
}
public function addDisplayObject(_arg1:DisplayObject):void{
throw (new Error("Not implemented"));
}
public function flush():void{
for each (session in sessions) {
session.flush();
};
}
public function renderTriangleBitmap(_arg1:BitmapData, _arg2:Matrix, _arg3:ScreenVertex, _arg4:ScreenVertex, _arg5:ScreenVertex, _arg6:Boolean, _arg7:Boolean, _arg8:Graphics=null):void{
if (_layerDirty){
createLayer();
};
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);
if (_arg8){
_arg8.lineStyle();
_arg8.moveTo(v0x, v0y);
_arg8.beginBitmapFill(_arg1, m, _arg7, ((_arg6) && (((((v0x * (d2 - b2)) - (v1x * d2)) + (v2x * b2)) > 400))));
_arg8.lineTo(v1x, v1y);
_arg8.lineTo(v2x, v2y);
_arg8.endFill();
} else {
graphics.lineStyle();
graphics.moveTo(v0x, v0y);
graphics.beginBitmapFill(_arg1, m, _arg7, ((_arg6) && (((((v0x * (d2 - b2)) - (v1x * d2)) + (v2x * b2)) > 400))));
graphics.lineTo(v1x, v1y);
graphics.lineTo(v2x, v2y);
graphics.endFill();
};
}
public function getContainer(_arg1:View3D):DisplayObject{
throw (new Error("Not implemented"));
}
public function clone():AbstractRenderSession{
throw (new Error("Not implemented"));
}
public function renderLine(_arg1:ScreenVertex, _arg2:ScreenVertex, _arg3:Number, _arg4:uint, _arg5:Number):void{
if (_layerDirty){
createLayer();
};
graphics.lineStyle(_arg3, _arg4, _arg5);
graphics.moveTo(_arg1.x, _arg1.y);
graphics.lineTo(_arg2.x, _arg2.y);
}
public function get view():View3D{
return (_view);
}
public function registerChildSession(_arg1:AbstractRenderSession):void{
if (!sessions[_arg1]){
sessions[_arg1] = _arg1;
};
}
public function renderTriangleColor(_arg1:int, _arg2:Number, _arg3:ScreenVertex, _arg4:ScreenVertex, _arg5:ScreenVertex):void{
if (_layerDirty){
createLayer();
};
graphics.lineStyle();
graphics.moveTo(_arg3.x, _arg3.y);
graphics.beginFill(_arg1, _arg2);
graphics.lineTo(_arg4.x, _arg4.y);
graphics.lineTo(_arg5.x, _arg5.y);
graphics.endFill();
}
public function get lightarray():LightArray{
return (_lightarray);
}
public function set view(_arg1:View3D):void{
_view = _arg1;
time = getTimer();
}
public function clear():void{
var _local1:Sprite;
var _local2:int;
for each (_local1 in spriteLayers) {
_local1.graphics.clear();
if (_local1.numChildren){
_local2 = _local1.numChildren;
while (_local2--) {
ds = _local1.getChildAt(_local2);
if ((ds is Shape)){
(ds as Shape).graphics.clear();
};
};
};
};
_local2 = doActive.length;
while (_local2--) {
cont = doActive.pop();
cont.graphics.clear();
doStore.push(cont);
};
for each (session in sessions) {
session.clear();
};
}
protected function createLayer():void{
throw (new Error("Not implemented"));
}
public function renderTriangleLine(_arg1:Number, _arg2:int, _arg3:Number, _arg4:ScreenVertex, _arg5:ScreenVertex, _arg6:ScreenVertex):void{
if (_layerDirty){
createLayer();
};
graphics.lineStyle(_arg1, _arg2, _arg3);
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 renderScaledBitmap(_arg1:DrawScaledBitmap, _arg2:BitmapData, _arg3:Matrix, _arg4:Boolean=false):void{
if (_layerDirty){
createLayer();
};
graphics.lineStyle();
if (_arg1.rotation != 0){
graphics.moveTo(_arg1.topleft.x, _arg1.topleft.y);
graphics.beginBitmapFill(_arg2, _arg3, false, _arg4);
graphics.lineTo(_arg1.topright.x, _arg1.topright.y);
graphics.lineTo(_arg1.bottomright.x, _arg1.bottomright.y);
graphics.lineTo(_arg1.bottomleft.x, _arg1.bottomleft.y);
graphics.lineTo(_arg1.topleft.x, _arg1.topleft.y);
graphics.endFill();
} else {
graphics.beginBitmapFill(_arg2, _arg3, false, _arg4);
graphics.drawRect(_arg1.minX, _arg1.minY, (_arg1.maxX - _arg1.minX), (_arg1.maxY - _arg1.minY));
graphics.endFill();
};
}
public function renderBitmap(_arg1:BitmapData, _arg2:ScreenVertex, _arg3:Boolean=false):void{
if (_layerDirty){
createLayer();
};
m.identity();
m.tx = (_arg2.x - (_arg1.width / 2));
m.ty = (_arg2.y - (_arg1.height / 2));
graphics.lineStyle();
graphics.beginBitmapFill(_arg1, m, false, _arg3);
graphics.drawRect((_arg2.x - (_arg1.width / 2)), (_arg2.y - (_arg1.height / 2)), _arg1.width, _arg1.height);
graphics.endFill();
}
public function addLayerObject(_arg1:Sprite):void{
throw (new Error("Not implemented"));
}
public function renderTriangleLineFill(_arg1:Number, _arg2:int, _arg3:Number, _arg4:int, _arg5:Number, _arg6:ScreenVertex, _arg7:ScreenVertex, _arg8:ScreenVertex):void{
if (_layerDirty){
createLayer();
};
if (_arg5 > 0){
graphics.lineStyle(_arg1, _arg4, _arg5);
} else {
graphics.lineStyle();
};
graphics.moveTo(_arg6.x, _arg6.y);
if (_arg3 > 0){
graphics.beginFill(_arg2, _arg3);
};
graphics.lineTo(_arg7.x, _arg7.y);
graphics.lineTo(_arg8.x, _arg8.y);
if (_arg5 > 0){
graphics.lineTo(_arg6.x, _arg6.y);
};
if (_arg3 > 0){
graphics.endFill();
};
}
public function renderFogColor(_arg1:int, _arg2:Number):void{
if (_layerDirty){
createLayer();
};
graphics.lineStyle();
graphics.beginFill(_arg1, _arg2);
graphics.drawRect(_view.clip.minX, _view.clip.minY, (_view.clip.maxX - _view.clip.minX), (_view.clip.maxY - _view.clip.minY));
graphics.endFill();
}
}
}//package away3d.core.render
Section 55
//BasicRenderer (away3d.core.render.BasicRenderer)
package away3d.core.render {
import away3d.core.draw.*;
import away3d.core.clip.*;
import away3d.containers.*;
import away3d.core.traverse.*;
import away3d.core.light.*;
import away3d.materials.*;
import flash.utils.*;
import away3d.cameras.*;
import away3d.core.block.*;
import away3d.core.stats.*;
import away3d.core.filter.*;
public class BasicRenderer implements IRenderer {
private var blockers:Array;
private var projtraverser:ProjectionTraverser;
private var triangle:DrawTriangle;
private var scene:Scene3D;
private var priarray:PrimitiveArray;
private var blocktraverser:BlockerTraverser;
private var object:Object;
private var lightarray:LightArray;
private var _session:AbstractRenderSession;
private var camera:Camera3D;
private var clip:Clipping;
private var primitives:Array;
private var blockerarray:BlockerArray;
private var materials:Dictionary;
private var filter:IPrimitiveFilter;
private var pritraverser:PrimitiveTraverser;
private var filters:Array;
private var primitive:DrawPrimitive;
public function BasicRenderer(... _args){
projtraverser = new ProjectionTraverser();
blockerarray = new BlockerArray();
blocktraverser = new BlockerTraverser();
priarray = new PrimitiveArray();
lightarray = new LightArray();
pritraverser = new PrimitiveTraverser();
super();
this.filters = _args;
this.filters.push(new ZSortFilter());
}
public function toString():String{
return ((("Basic [" + filters.join("+")) + "]"));
}
public function set session(_arg1:AbstractRenderSession):void{
_session = _arg1;
}
public function render(_arg1:View3D):Array{
scene = _arg1.scene;
camera = _arg1.camera;
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.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, clip);
};
materials = new Dictionary(true);
for each (primitive in primitives) {
if ((primitive is DrawTriangle)){
triangle = (primitive as DrawTriangle);
if (!materials[triangle.source]){
materials[triangle.source] = new Dictionary(true);
};
if ((((triangle.material is IUpdatingMaterial)) && (!(materials[triangle.source][triangle.material])))){
(materials[triangle.source][triangle.material] = (triangle.material as IUpdatingMaterial)).updateMaterial(triangle.source, _arg1);
};
};
};
for each (primitive in primitives) {
primitive.render();
};
if (_arg1.statsOpen){
_arg1.statsPanel.updateStats(primitives.length, camera);
};
return (primitives);
}
public function get session():AbstractRenderSession{
return (_session);
}
}
}//package away3d.core.render
Section 56
//BitmapRenderSession (away3d.core.render.BitmapRenderSession)
package away3d.core.render {
import flash.display.*;
import flash.geom.*;
import away3d.core.draw.*;
import away3d.containers.*;
import flash.utils.*;
public class BitmapRenderSession extends AbstractRenderSession {
private var _container:Bitmap;
private var _height:int;
private var _width:int;
private var _cm:Matrix;
private var _scale:Number;
private var layers:Array;
private var mActive:Array;
private var _cx:Number;
private var _cy:Number;
private var layer:DisplayObject;
private var mStore:Array;
private var _bitmapheight:int;
private var _base:BitmapData;
private var _bitmapwidth:int;
public function BitmapRenderSession(_arg1:Number=2){
mStore = new Array();
mActive = new Array();
layers = [];
super();
if (_scale <= 0){
throw (new Error("scale cannot be negative or zero"));
};
_scale = _arg1;
}
override public function addDisplayObject(_arg1:DisplayObject):void{
layers.push(_arg1);
_arg1.visible = true;
children[_arg1] = _arg1;
_layerDirty = true;
}
override public function set view(_arg1:View3D):void{
super.view = _arg1;
_container = (getContainer(_view) as Bitmap);
_base = getBitmapData(_view);
_cx = (_container.x = (-(_width) / 2));
_cy = (_container.y = (-(_height) / 2));
_container.scaleX = _scale;
_container.scaleY = _scale;
_cm = new Matrix();
_cm.scale((1 / _scale), (1 / _scale));
_cm.translate((_bitmapwidth / 2), (_bitmapheight / 2));
}
override public function clear():void{
super.clear();
_base.lock();
_base.fillRect(_base.rect, 0);
children = new Dictionary(true);
newLayer = null;
layers = [];
_layerDirty = true;
}
override public function addLayerObject(_arg1:Sprite):void{
layers.push(_arg1);
_arg1.visible = true;
children[_arg1] = _arg1;
newLayer = _arg1;
}
override public function getContainer(_arg1:View3D):DisplayObject{
if (!_containers[_arg1]){
return ((_containers[_arg1] = new Bitmap()));
};
return (_containers[_arg1]);
}
override public function clone():AbstractRenderSession{
return (new BitmapRenderSession(_scale));
}
override public function renderScaledBitmap(_arg1:DrawScaledBitmap, _arg2:BitmapData, _arg3:Matrix, _arg4:Boolean=false):void{
flush();
_arg3.concat(_cm);
_base.draw(_arg2, _arg3);
}
override public function get view():View3D{
return (_view);
}
public function getBitmapData(_arg1:View3D):BitmapData{
_container = (getContainer(_arg1) as Bitmap);
if (!_container.bitmapData){
_bitmapwidth = int(((_width = (_arg1.clip.maxX - _arg1.clip.minX)) / _scale));
_bitmapheight = int(((_height = (_arg1.clip.maxY - _arg1.clip.minY)) / _scale));
return ((_container.bitmapData = new BitmapData(_bitmapwidth, _bitmapheight, true, 0)));
};
return (_container.bitmapData);
}
override protected function createLayer():void{
if (doStore.length){
_shape = doStore.pop();
} else {
_shape = new Shape();
};
graphics = _shape.graphics;
doActive.push(_shape);
layers.push(_shape);
_layerDirty = false;
}
override public function flush():void{
super.flush();
i = 0;
for each (layer in layers) {
_base.draw(layer, _cm, layer.transform.colorTransform, layer.blendMode, _base.rect);
};
_base.unlock();
layers = [];
_layerDirty = true;
}
}
}//package away3d.core.render
Section 57
//FindHit (away3d.core.render.FindHit)
package away3d.core.render {
import away3d.core.draw.*;
import away3d.core.base.*;
import away3d.containers.*;
import away3d.events.*;
import away3d.core.math.*;
import away3d.materials.*;
public class FindHit {
private var sceneX:Number;
private var sceneY:Number;
private var sceneZ:Number;
private var uv:UV;
private var drawpri:DrawPrimitive;
private var view:View3D;
private var material:IUVMaterial;
private var screenX:Number;
private var screenY:Number;
private var screenZ:Number;// = INF
private var inv:Matrix3D;
private var primitive:DrawPrimitive;
private var persp:Number;
private var element:Object;
private var object:Object3D;
public function FindHit(_arg1:View3D, _arg2:Array, _arg3:Number, _arg4:Number){
inv = new Matrix3D();
super();
this.view = _arg1;
screenX = _arg3;
screenY = _arg4;
for each (primitive in _arg2) {
checkPrimitive(primitive);
};
}
private 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 (((!((_local3.material is BitmapMaterialContainer))) && (!((_local5.getPixel32(_local4.u, _local4.v) >> 24))))){
return;
};
uv = _local4;
};
material = _local5;
} else {
uv = null;
};
screenZ = _local2;
persp = (view.camera.zoom / (1 + (screenZ / view.camera.focus)));
inv = view.camera.viewTransform;
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 = 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 58
//IRenderer (away3d.core.render.IRenderer)
package away3d.core.render {
import away3d.containers.*;
public interface IRenderer {
function toString():String;
function set session(_arg1:AbstractRenderSession):void;
function render(_arg1:View3D):Array;
function get session():AbstractRenderSession;
}
}//package away3d.core.render
Section 59
//Projection (away3d.core.render.Projection)
package away3d.core.render {
import away3d.core.math.*;
public class Projection {
public var zoom:Number;
public var view:Matrix3D;
public var focus:Number;
public var time:int;
}
}//package away3d.core.render
Section 60
//SpriteRenderSession (away3d.core.render.SpriteRenderSession)
package away3d.core.render {
import flash.display.*;
import flash.geom.*;
import away3d.core.clip.*;
import away3d.containers.*;
import flash.utils.*;
public class SpriteRenderSession extends AbstractRenderSession {
private var _container:Sprite;
private var _clip:Clipping;
public function SpriteRenderSession():void{
}
override public function addDisplayObject(_arg1:DisplayObject):void{
_container.addChild(_arg1);
_arg1.visible = true;
children[_arg1] = _arg1;
_layerDirty = true;
}
override public function get view():View3D{
return (_view);
}
override public function set view(_arg1:View3D):void{
super.view = _arg1;
_container = (getContainer(_view) as Sprite);
graphics = _container.graphics;
if (this == view.session){
_clip = _view.clip;
_container.scrollRect = new Rectangle((_clip.minX - 1), (_clip.minY - 1), ((_clip.maxX - _clip.minX) + 2), ((_clip.maxY - _clip.minY) + 2));
_container.x = (_clip.minX - 1);
_container.y = (_clip.minY - 1);
};
}
override public function getContainer(_arg1:View3D):DisplayObject{
if (!_containers[_arg1]){
return ((_containers[_arg1] = new Sprite()));
};
return (_containers[_arg1]);
}
override public function clear():void{
super.clear();
_container.graphics.clear();
i = _container.numChildren;
while (i--) {
_container.removeChild(_container.getChildAt(i));
};
children = new Dictionary(true);
newLayer = null;
graphics = _container.graphics;
}
override public function addLayerObject(_arg1:Sprite):void{
_container.addChild(_arg1);
_arg1.visible = true;
children[_arg1] = _arg1;
newLayer = _arg1;
}
override protected function createLayer():void{
if (doStore.length){
_shape = doStore.pop();
} else {
_shape = new Shape();
};
graphics = _shape.graphics;
doActive.push(_shape);
_container.addChild(_shape);
_layerDirty = false;
}
override public function flush():void{
super.flush();
}
override public function clone():AbstractRenderSession{
return (new SpriteRenderSession());
}
}
}//package away3d.core.render
Section 61
//Stats (away3d.core.stats.Stats)
package away3d.core.stats {
import flash.events.*;
import flash.display.*;
import flash.geom.*;
import away3d.core.base.*;
import away3d.containers.*;
import flash.utils.*;
import flash.text.*;
import away3d.cameras.*;
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 = "2";
private const REVISION:String = "1.0";
private var meshLabel:TextField;
private var bar:Sprite;
private var barscale:int;// = 0
private var swfframerateLabel:TextField;
private var cambtn:Sprite;
private var geomDetailsLabel:TextField;
public var displayMenu:Sprite;// = null
private var geomLastAdded:String;
var type:String;
private var defautTF:TextFormat;
public var sourceURL:String;
private var peakLabel:TextField;
private var meshes:int;// = 0
private var faceRenderLabel:TextField;
private var closebtn:Sprite;
private var camLabel:TextField;
private var rectcam:Rectangle;
var url:String;
private var ramLabel:TextField;
private var bestfps:int;// = 0
private var titleField:TextField;
private var fpsLabel:TextField;
private var stageframerate:Number;
private var perfLabel:TextField;
private var barwidth:int;// = 0
private var rectclose:Rectangle;
private var faceLabel:TextField;
public var stats:String;// = ""
private var geombtn:Sprite;
private var lastrender:int;
private var menu0:ContextMenuItem;
private var menu1:ContextMenuItem;
private var menu2:ContextMenuItem;
public var geomMenu:Sprite;// = null
private var avfpsLabel:TextField;
private var refreshes:int;// = 0
private var camMenu:Sprite;
private var totalFaces:int;// = 0
public var scopeMenu:View3D;// = null
private var camProp:Array;
private var rectclear:Rectangle;
var facecount:int;
private var rectdetails:Rectangle;
private var clearbtn:Sprite;
private var lowestfps:int;// = 999
private var fpstotal:int;// = 0
private var displayState:int;
public function Stats(_arg1:View3D, _arg2:Number=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;
stageframerate = (_arg2) ? _arg2 : 30;
displayState = 0;
sourceURL = _arg1.sourceURL;
menu0 = new ContextMenuItem("Away3D Project stats", true, true, true);
menu1 = new ContextMenuItem("View Source", true, true, true);
menu2 = new ContextMenuItem(((((APPLICATION_NAME + "\tv") + VERSION) + ".") + REVISION), true, true, true);
scopeMenu.contextMenu = new ContextMenu();
scopeMenu.contextMenu.customItems = (sourceURL) ? [menu0, menu1, menu2] : [menu0, menu2];
menu0.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, displayStats);
menu1.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, viewSource);
menu2.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, visitWebsite);
scopeMenu.contextMenu.hideBuiltInItems();
}
private function mouseReleased(_arg1:MouseEvent):void{
displayMenu.stopDrag();
scopeMenu.removeEventListener(MouseEvent.MOUSE_UP, mouseReleased);
}
private function createGeometryMenu():void{
geomMenu = new Sprite();
var _local1:Matrix = 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 clearObjects():void{
stats = "";
totalFaces = 0;
meshes = 0;
geomLastAdded = "";
}
public function viewSource(_arg1:ContextMenuEvent):void{
var e = _arg1;
var request:URLRequest = new URLRequest(sourceURL);
try {
navigateToURL(request, "_blank");
} catch(error:Error) {
};
}
private function showGeomInfo():void{
if (geomMenu == null){
createGeometryMenu();
} else {
displayMenu.addChild(geomMenu);
geomMenu.y = 26;
};
}
private function createCamMenu():void{
camMenu = new Sprite();
var _local1:Matrix = 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;
var _local2:TextFormat = 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"];
var _local3:TextField = 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;
var _local4:int;
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 fps:int;
var average:int;
var w:int;
var caminfo:String;
var i:int;
var info:String;
var renderedfaces = _arg1;
var camera = _arg2;
var now:int = getTimer();
var perf:int = (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;
};
var procent:int = ((bar.width / barwidth) * 100);
var colorTransform: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 clearStats():void{
fpstotal = 0;
refreshes = 0;
bestfps = 0;
lowestfps = 999;
}
private function showCamInfo():void{
if (camMenu == null){
createCamMenu();
} else {
displayMenu.addChild(camMenu);
camMenu.y = 26;
};
}
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 hideGeomInfo():void{
if (geomMenu != null){
displayMenu.removeChild(geomMenu);
};
}
private function hideCamInfo():void{
if (camMenu != null){
displayMenu.removeChild(camMenu);
};
}
private function closeOtherScreen(_arg1:int):void{
switch (_arg1){
case 1:
hideCamInfo();
break;
case 2:
hideGeomInfo();
};
}
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 generateSprite():void{
displayMenu = new Sprite();
var _local1:Matrix = 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);
var _local2:Sprite = 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();
var _local3:Graphics = 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();
var _local4:Graphics = 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();
var _local5:Graphics = 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);
var _local6:TextField = 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);
var _local7:TextField = 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);
var _local8:TextField = 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);
var _local9:TextField = 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);
var _local10:TextField = 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);
var _local11:TextField = 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);
var _local12:TextField = 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);
var _local13:TextField = 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);
var _local14:TextField = 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);
}
public function addSourceURL(_arg1:String):void{
sourceURL = _arg1;
scopeMenu.contextMenu.customItems = (sourceURL) ? [menu0, menu1, menu2] : [menu0, menu2];
}
private function onCheckMouse(_arg1:MouseEvent):void{
var _local2:Number = displayMenu.mouseX;
var _local3:Number = displayMenu.mouseY;
var _local4:Point = 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 addEventMouse():void{
scopeMenu.addEventListener(MouseEvent.MOUSE_DOWN, onCheckMouse);
scopeMenu.addEventListener(MouseEvent.MOUSE_MOVE, updateTips);
}
public function visitWebsite(_arg1:ContextMenuEvent):void{
var e = _arg1;
var url = "http://www.away3d.com";
var request:URLRequest = new URLRequest(url);
try {
navigateToURL(request);
} catch(error:Error) {
};
}
private function displayPicto():void{
var _local1:Sprite = new Sprite();
var _local2:Graphics = _local1.graphics;
_local2.beginFill(0);
_local2.drawRect(0, 0, 18, 17);
var _local3:Array = image;
var _local4:int;
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);
}
public function displayStats(_arg1:ContextMenuEvent):void{
if (!displayMenu){
scopeMenu.statsOpen = true;
generateSprite();
addEventMouse();
};
}
}
}//package away3d.core.stats
Section 62
//BlockerTraverser (away3d.core.traverse.BlockerTraverser)
package away3d.core.traverse {
import away3d.core.base.*;
import away3d.containers.*;
import away3d.core.block.*;
public class BlockerTraverser extends Traverser {
public var view:View3D;
public 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);
}
override public function apply(_arg1:Object3D):void{
if ((_arg1 is IBlockerProvider)){
(_arg1 as IBlockerProvider).blockers(consumer);
};
}
}
}//package away3d.core.traverse
Section 63
//PrimitiveTraverser (away3d.core.traverse.PrimitiveTraverser)
package away3d.core.traverse {
import away3d.core.draw.*;
import away3d.core.base.*;
import away3d.containers.*;
import away3d.core.render.*;
import away3d.core.light.*;
public class PrimitiveTraverser extends Traverser {
private var _focus:Number;
private var _sessions:Array;
private var _view:View3D;
private var _zoom:Number;
public var consumer:IPrimitiveConsumer;
private var _session:AbstractRenderSession;
private var _lights:ILightConsumer;
override public function match(_arg1:Object3D):Boolean{
if (!_arg1.visible){
return (false);
};
if ((_arg1 is ILODObject)){
return ((_arg1 as ILODObject).matchLOD(_view));
};
return (true);
}
override public function enter(_arg1:Object3D):void{
_sessions.push(_session);
}
public function set session(_arg1:AbstractRenderSession):void{
_session = _arg1;
_sessions = [];
_lights = _session.lightarray;
_view = _session.view;
_focus = _view.camera.focus;
_zoom = _view.camera.zoom;
}
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(_lights);
};
}
public function get session():AbstractRenderSession{
return (_session);
}
override public function leave(_arg1:Object3D):void{
_session = _sessions.pop();
}
}
}//package away3d.core.traverse
Section 64
//ProjectionTraverser (away3d.core.traverse.ProjectionTraverser)
package away3d.core.traverse {
import away3d.core.base.*;
import away3d.containers.*;
import away3d.core.render.*;
import away3d.core.math.*;
import flash.utils.*;
public class ProjectionTraverser extends Traverser {
private var _view:View3D;
private var _cameraview:Matrix3D;
private var _projection:Projection;
public function get view():View3D{
return (_view);
}
public function set view(_arg1:View3D):void{
_view = _arg1;
_cameraview = _view.camera.view;
if (_view.statsOpen){
_view.statsPanel.clearObjects();
};
}
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);
}
override public function enter(_arg1:Object3D):void{
if (((_view.statsOpen) && ((_arg1 is BaseMesh)))){
_view.statsPanel.addObject((_arg1 as BaseMesh));
};
}
}
}//package away3d.core.traverse
Section 65
//TickTraverser (away3d.core.traverse.TickTraverser)
package away3d.core.traverse {
import away3d.core.base.*;
public class TickTraverser extends Traverser {
public var now:int;
override public function enter(_arg1:Object3D):void{
_arg1.tick(now);
}
}
}//package away3d.core.traverse
Section 66
//Traverser (away3d.core.traverse.Traverser)
package away3d.core.traverse {
import away3d.core.base.*;
public class Traverser {
public function enter(_arg1:Object3D):void{
}
public function match(_arg1:Object3D):Boolean{
return (true);
}
public function apply(_arg1:Object3D):void{
}
public function leave(_arg1:Object3D):void{
}
}
}//package away3d.core.traverse
Section 67
//CacheStore (away3d.core.utils.CacheStore)
package away3d.core.utils {
import flash.utils.*;
public class CacheStore {
public static var whiteShadingCache:Dictionary = new Dictionary(true);
}
}//package away3d.core.utils
Section 68
//Cast (away3d.core.utils.Cast)
package away3d.core.utils {
import flash.display.*;
import flash.geom.*;
import away3d.materials.*;
import flash.utils.*;
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 = 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 ini:Init;
var bitmap:BitmapData;
var color:uint;
var alpha:Number;
var lighting:Boolean;
var wire:WireframeMaterial;
var smooth:Boolean;
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(materialerror: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 as String).indexOf("#") != -1){
hash = (data as String).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 as String).indexOf("@") != -1){
hash = (data as String).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)){
ini = Init.parse(data);
bitmap = ini.getBitmap("bitmap");
color = ini.getColor("color", 4294967295);
alpha = ini.getNumber("alpha", 1, {min:0, max:1});
lighting = ini.getBoolean("lighting", false);
wire = (wirematerial(ini.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 = ini.getBoolean("smooth", false);
precision = ini.getNumber("precision", 0);
if (precision){
if (lighting){
return (new WhiteShadingBitmapMaterial(bitmap, {smooth:smooth, precision:precision}));
};
if (alpha < 1){
Debug.warning("Can't create precise bitmap material with alpha (yet)");
};
return (new BitmapMaterial(bitmap, {smooth:smooth, precision:precision}));
};
if (lighting){
if (alpha < 1){
Debug.warning("Can't create bitmap material with lighting and alpha (yet)");
};
return (new WhiteShadingBitmapMaterial(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}));
};
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 as String).length == 6)) && (hexstring(_arg1)))){
return (parseInt(("0x" + _arg1)));
};
};
return (4294967295);
}
private static function hexstring(_arg1:String):Boolean{
var _local2:int;
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:Init;
var _local4:uint;
var _local5:Number;
var _local6: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 as String).indexOf("#") == 0){
_arg1 = (_arg1 as String).substring(1);
};
if ((_arg1 as String).indexOf("|") == -1){
return (new WireframeMaterial(color(_arg1)));
};
_local2 = (_arg1 as String).split("|");
return (new WireframeMaterial(color(_local2[0]), {width:parseFloat(_local2[1])}));
};
if ((_arg1 is Object)){
_local3 = Init.parse(_arg1);
_local4 = _local3.getColor("color", 0);
_local5 = _local3.getNumber("alpha", 1, {min:0, max:1});
_local6 = _local3.getNumber("width", 1, {min:0});
return (new WireframeMaterial(_local4, {alpha:_local5, width:_local6}));
};
throw (new CastError(("Can't cast to wirematerial: " + _arg1)));
}
public static function bitmap(_arg1):BitmapData{
var ds:DisplayObject;
var bmd:BitmapData;
var mat:Matrix;
var data = _arg1;
if (data == null){
return (null);
};
if ((data is String)){
data = tryclass(data);
};
if ((data is Class)){
try {
data = new (data);
} catch(bitmaperror:ArgumentError) {
data = new data(0, 0);
};
};
if ((data is BitmapData)){
return (data);
};
if ((data is Bitmap)){
if ((data as Bitmap).hasOwnProperty("bitmapData")){
return ((data as Bitmap).bitmapData);
};
};
if ((data is DisplayObject)){
ds = (data as DisplayObject);
bmd = new BitmapData(ds.width, ds.height, true, 0xFFFFFF);
mat = ds.transform.matrix.clone();
mat.tx = 0;
mat.ty = 0;
bmd.draw(ds, mat, ds.transform.colorTransform, ds.blendMode, 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 name = _arg1;
if (notclasses[name]){
return (name);
};
var result:Class = 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 69
//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 70
//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 71
//DofCache (away3d.core.utils.DofCache)
package away3d.core.utils {
import flash.display.*;
import flash.geom.*;
import flash.utils.*;
import flash.filters.*;
public class DofCache {
private var minBitmap:BitmapData;
private var maxBitmap:BitmapData;
private var bitmaps:Array;
private var levels:Number;
public static var doflevels:Number = 16;
public static var maxblur:Number = 150;
public static var aperture:Number = 22;
private static var caches:Dictionary = new Dictionary();
public static var usedof:Boolean = false;
public static var focus:Number;
public function DofCache(_arg1:Number, _arg2:BitmapData){
var _local6:BlurFilter;
var _local7:int;
var _local8:BitmapData;
super();
this.levels = _arg1;
var _local3:Matrix = new Matrix();
var _local4:Point = new Point(0, 0);
bitmaps = new Array(_arg1);
var _local5:Number = 0;
while (_local5 < _arg1) {
_local6 = new BlurFilter((2 + ((maxblur * _local5) / _arg1)), (2 + ((maxblur * _local5) / _arg1)), 4);
_local3.identity();
_local7 = (_arg2.width * (1 + (_local5 / (_arg1 / 2))));
_local3.translate((-(_arg2.width) / 2), (-(_arg2.height) / 2));
_local3.translate((_local7 / 2), (_local7 / 2));
_local8 = new BitmapData(_local7, _local7, true, 0);
_local8.draw(_arg2, _local3);
_local8.applyFilter(_local8, _local8.rect, _local4, _local6);
bitmaps[_local5] = _local8;
_local5++;
};
minBitmap = bitmaps[0];
maxBitmap = bitmaps[(bitmaps.length - 1)];
}
public function getBitmap(_arg1:Number):BitmapData{
var _local2:Number = (focus - _arg1);
if ((focus - _arg1) < 0){
_local2 = -(_local2);
};
_local2 = (_local2 / aperture);
_local2 = Math.floor(_local2);
if (_local2 > (levels - 1)){
return (maxBitmap);
};
if (_local2 < 0){
return (minBitmap);
};
return (bitmaps[_local2]);
}
public static function resetDof(_arg1:Boolean):void{
var _local2:DofCache;
usedof = _arg1;
for each (_local2 in caches) {
if (!_arg1){
_local2 = new DofCache(1, _local2.bitmaps[0]);
} else {
_local2 = new DofCache(doflevels, _local2.bitmaps[0]);
};
};
}
public static function getDofCache(_arg1:BitmapData):DofCache{
if (caches[_arg1] == null){
if (!usedof){
caches[_arg1] = new DofCache(1, _arg1);
} else {
caches[_arg1] = new DofCache(doflevels, _arg1);
};
};
return (caches[_arg1]);
}
}
}//package away3d.core.utils
Section 72
//FaceVO (away3d.core.utils.FaceVO)
package away3d.core.utils {
import flash.display.*;
import flash.geom.*;
import away3d.core.base.*;
import away3d.containers.*;
public class FaceVO {
public var backface:Boolean;// = false
public var invalidated:Boolean;// = true
public var width:int;
public var mapping:Matrix;
public var source:Object3D;
public var color:uint;
public var view:View3D;
public var height:int;
public var cleared:Boolean;// = true
public var bitmap:BitmapData;
public var resized:Boolean;
public var updated:Boolean;// = false
public function FaceVO(_arg1:Object3D=null, _arg2:View3D=null){
this.source = _arg1;
this.view = _arg2;
}
public function clear():void{
cleared = true;
updated = true;
}
public function resize(_arg1:Number, _arg2:Number, _arg3:Boolean=true):void{
if ((((this.width == _arg1)) && ((this.height == _arg2)))){
return;
};
resized = true;
updated = true;
this.width = _arg1;
this.height = _arg2;
this.color = color;
if (bitmap){
bitmap.dispose();
};
bitmap = new BitmapData(_arg1, _arg2, _arg3, 0);
bitmap.lock();
}
}
}//package away3d.core.utils
Section 73
//IClonable (away3d.core.utils.IClonable)
package away3d.core.utils {
public interface IClonable {
function clone(_arg1=null);
}
}//package away3d.core.utils
Section 74
//Init (away3d.core.utils.Init)
package away3d.core.utils {
import flash.display.*;
import away3d.core.base.*;
import away3d.core.math.*;
import away3d.materials.*;
import away3d.primitives.data.*;
public class Init {
private var init:Object;
private static var inits:Array = [];
public function Init(_arg1:Object){
this.init = _arg1;
}
public function getCubeMaterials(_arg1:String):CubeMaterialsData{
var _local2:CubeMaterialsData;
if (init == null){
return (null);
};
if (!init.hasOwnProperty(_arg1)){
return (null);
};
if ((init[_arg1] is CubeMaterialsData)){
_local2 = (init[_arg1] as CubeMaterialsData);
} else {
if ((init[_arg1] is Object)){
_local2 = new CubeMaterialsData(init[_arg1]);
};
};
delete init[_arg1];
return (_local2);
}
public function getArray(_arg1:String):Array{
if (init == null){
return ([]);
};
if (!init.hasOwnProperty(_arg1)){
return ([]);
};
var _local2:Array = init[_arg1];
delete init[_arg1];
return (_local2);
}
public function getSegmentMaterial(_arg1:String):ISegmentMaterial{
if (init == null){
return (null);
};
if (!init.hasOwnProperty(_arg1)){
return (null);
};
var _local2:ISegmentMaterial = Cast.wirematerial(init[_arg1]);
delete init[_arg1];
return (_local2);
}
public function getBitmap(_arg1:String):BitmapData{
if (init == null){
return (null);
};
if (!init.hasOwnProperty(_arg1)){
return (null);
};
var _local2:BitmapData = 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{
if (init == null){
return (_arg2);
};
if (!init.hasOwnProperty(_arg1)){
return (_arg2);
};
var _local3:String = init[_arg1];
delete init[_arg1];
return (_local3);
}
public function getObjectOrInit(_arg1:String, _arg2:Class=null):Object{
if (init == null){
return (null);
};
if (!init.hasOwnProperty(_arg1)){
return (null);
};
var _local3:Object = 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 getInit(_arg1:String):Init{
if (init == null){
return (new Init(null));
};
if (!init.hasOwnProperty(_arg1)){
return (new Init(null));
};
var _local2:Init = Init.parse(init[_arg1]);
delete init[_arg1];
return (_local2);
}
public function getNumber(_arg1:String, _arg2:Number, _arg3:Object=null):Number{
var _local5:Number;
var _local6:Number;
if (init == null){
return (_arg2);
};
if (!init.hasOwnProperty(_arg1)){
return (_arg2);
};
var _local4:Number = 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);
}
function addForCheck():void{
if (init == null){
return;
};
init["dontCheckUnused"] = false;
inits.push(init);
}
public function getBoolean(_arg1:String, _arg2:Boolean):Boolean{
if (init == null){
return (_arg2);
};
if (!init.hasOwnProperty(_arg1)){
return (_arg2);
};
var _local3:Boolean = init[_arg1];
delete init[_arg1];
return (_local3);
}
public function getColor(_arg1:String, _arg2:uint):uint{
if (init == null){
return (_arg2);
};
if (!init.hasOwnProperty(_arg1)){
return (_arg2);
};
var _local3:uint = Cast.color(init[_arg1]);
delete init[_arg1];
return (_local3);
}
public function getObject(_arg1:String, _arg2:Class=null):Object{
if (init == null){
return (null);
};
if (!init.hasOwnProperty(_arg1)){
return (null);
};
var _local3:Object = 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));
}
public function getInt(_arg1:String, _arg2:int, _arg3:Object=null):int{
var _local5:int;
var _local6:int;
if (init == null){
return (_arg2);
};
if (!init.hasOwnProperty(_arg1)){
return (_arg2);
};
var _local4:int = 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);
}
function removeFromCheck():void{
if (init == null){
return;
};
init["dontCheckUnused"] = true;
}
public function getMaterial(_arg1:String):ITriangleMaterial{
if (init == null){
return (null);
};
if (!init.hasOwnProperty(_arg1)){
return (null);
};
var _local2:ITriangleMaterial = Cast.material(init[_arg1]);
delete init[_arg1];
return (_local2);
}
public function getPosition(_arg1:String):Number3D{
var _local3:Object3D;
var _local2:Object = 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)));
}
static function checkUnusedArguments():void{
var _local2:Object;
var _local3:String;
var _local4:String;
if (inits.length == 0){
return;
};
var _local1:Array = 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 75
//ValueObject (away3d.core.utils.ValueObject)
package away3d.core.utils {
import flash.events.*;
public class ValueObject extends EventDispatcher {
private static var changed:Event;
public function addOnChange(_arg1:Function):void{
addEventListener("changed", _arg1, false, 0, true);
}
protected function notifyChange():void{
if (!hasEventListener("changed")){
return;
};
if (changed == null){
changed = new Event("changed");
};
dispatchEvent(changed);
}
public function removeOnChange(_arg1:Function):void{
removeEventListener("changed", _arg1, false);
}
}
}//package away3d.core.utils
Section 76
//arcane (away3d.core.arcane)
package away3d.core {
public namespace arcane;
}//package away3d.core
Section 77
//AnimationEvent (away3d.events.AnimationEvent)
package away3d.events {
import flash.events.*;
import away3d.core.base.*;
public class AnimationEvent extends Event {
public var animation:Animation;
public static const SQUENCE_UPDATE:String = "squenceupdate";
public static const CYCLE:String = "cycle";
public static const SQUENCE_DONE:String = "squencedone";
public function AnimationEvent(_arg1:String, _arg2:Animation){
super(_arg1);
this.animation = _arg2;
}
override public function clone():Event{
return (new AnimationEvent(type, animation));
}
}
}//package away3d.events
Section 78
//FaceEvent (away3d.events.FaceEvent)
package away3d.events {
import flash.events.*;
import away3d.core.base.*;
public class FaceEvent extends Event {
public var face:Face;
public static const MAPPING_CHANGED:String = "mappingchanged";
public static const MATERIAL_CHANGED:String = "materialchanged";
public function FaceEvent(_arg1:String, _arg2:Face){
super(_arg1);
this.face = _arg2;
}
override public function clone():Event{
return (new FaceEvent(type, face));
}
}
}//package away3d.events
Section 79
//MaterialEvent (away3d.events.MaterialEvent)
package away3d.events {
import flash.events.*;
import away3d.materials.*;
public class MaterialEvent extends Event {
public var extra:Object;
public var material:IMaterial;
public static const RESIZED:String = "materialresize";
public static const CHANGED:String = "materialchanged";
public function MaterialEvent(_arg1:String, _arg2:IMaterial){
super(_arg1);
this.material = _arg2;
}
override public function clone():Event{
return (new MaterialEvent(type, material));
}
}
}//package away3d.events
Section 80
//MeshElementEvent (away3d.events.MeshElementEvent)
package away3d.events {
import flash.events.*;
import away3d.core.base.*;
public class MeshElementEvent extends Event {
public var element:IMeshElement;
public static const VISIBLE_CHANGED:String = "visiblechanged";
public static const VERTEX_CHANGED:String = "vertexchanged";
public static const VERTEXVALUE_CHANGED:String = "vertexvaluechanged";
public function MeshElementEvent(_arg1:String, _arg2:IMeshElement){
super(_arg1);
this.element = _arg2;
}
override public function clone():Event{
return (new MeshElementEvent(type, element));
}
}
}//package away3d.events
Section 81
//MouseEvent3D (away3d.events.MouseEvent3D)
package away3d.events {
import flash.events.*;
import away3d.core.draw.*;
import away3d.core.base.*;
import away3d.containers.*;
import away3d.materials.*;
public class MouseEvent3D extends Event {
public var sceneX:Number;
public var sceneY:Number;
public var sceneZ:Number;
public var uv:UV;
public var drawpri:DrawPrimitive;
public var view:View3D;
public var material:IUVMaterial;
public var screenX:Number;
public var screenY:Number;
public var screenZ:Number;
public var ctrlKey:Boolean;
public var element:Object;
public var shiftKey:Boolean;
public var object:Object3D;
public static const MOUSE_DOWN:String = "mouseDown3D";
public static const MOUSE_OUT:String = "mouseOut3D";
public static const MOUSE_UP:String = "mouseUp3D";
public static const MOUSE_MOVE:String = "mouseMove3D";
public static const MOUSE_OVER:String = "mouseOver3D";
public function MouseEvent3D(_arg1:String){
super(_arg1);
}
override public function clone():Event{
var _local1:MouseEvent3D = 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.events
Section 82
//Object3DEvent (away3d.events.Object3DEvent)
package away3d.events {
import flash.events.*;
import away3d.core.base.*;
public class Object3DEvent extends Event {
public var object:Object3D;
public static const SCENE_CHANGED:String = "scenechanged";
public static const SCENETRANSFORM_CHANGED:String = "scenetransformchanged";
public static const RADIUS_CHANGED:String = "radiuschanged";
public static const TRANSFORM_CHANGED:String = "transformchanged";
public static const DIMENSIONS_CHANGED:String = "dimensionschanged";
public function Object3DEvent(_arg1:String, _arg2:Object3D){
super(_arg1);
this.object = _arg2;
}
override public function clone():Event{
return (new Object3DEvent(type, object));
}
}
}//package away3d.events
Section 83
//SegmentEvent (away3d.events.SegmentEvent)
package away3d.events {
import flash.events.*;
import away3d.core.base.*;
public class SegmentEvent extends Event {
public var segment:Segment;
public static const MATERIAL_CHANGED:String = "materialchanged";
public function SegmentEvent(_arg1:String, _arg2:Segment){
super(_arg1);
this.segment = _arg2;
}
override public function clone():Event{
return (new SegmentEvent(type, segment));
}
}
}//package away3d.events
Section 84
//AmbientLight3D (away3d.lights.AmbientLight3D)
package away3d.lights {
import away3d.core.draw.*;
import away3d.core.base.*;
import away3d.core.utils.*;
import away3d.core.render.*;
import away3d.core.light.*;
public class AmbientLight3D extends Object3D implements ILightProvider, IPrimitiveProvider, IClonable {
private var _ambientDirty:Boolean;
private var _green:int;
private var _colorDirty:Boolean;
private var _red:int;
public var debug:Boolean;
private var _ambient:Number;
private var _ls:AmbientLight;
private var _color:int;
private var _blue:int;
public function AmbientLight3D(_arg1:Object=null){
_ls = new AmbientLight();
super(_arg1);
color = ini.getColor("color", 0xFFFFFF);
ambient = ini.getNumber("ambient", 0.5, {min:0, max:1});
debug = ini.getBoolean("debug", false);
_ls.light = this;
}
public function set color(_arg1:int):void{
_color = _arg1;
_red = ((_color & 0xFF0000) >> 16);
_green = ((_color & 0xFF00) >> 8);
_blue = (_color & 0xFF);
_colorDirty = true;
}
public function light(_arg1:ILightConsumer):void{
if (_colorDirty){
_ls.red = _red;
_ls.green = _green;
_ls.blue = _blue;
_colorDirty = false;
};
if (_ambientDirty){
_ambientDirty = false;
_ls.updateAmbientBitmap(_ambient);
};
_arg1.ambientLight(_ls);
}
public function get ambient():Number{
return (_ambient);
}
public function get color():int{
return (_color);
}
public function set ambient(_arg1:Number):void{
_ambient = _arg1;
_ambientDirty = true;
}
override public function clone(_arg1=null){
var _local2:AmbientLight3D = ((_arg1) || (new AmbientLight3D()));
super.clone(_local2);
_local2.color = color;
_local2.ambient = ambient;
_local2.debug = debug;
return (_local2);
}
override public function primitives(_arg1:IPrimitiveConsumer, _arg2:AbstractRenderSession):void{
super.primitives(_arg1, _arg2);
}
}
}//package away3d.lights
Section 85
//DirectionalLight3D (away3d.lights.DirectionalLight3D)
package away3d.lights {
import away3d.core.draw.*;
import away3d.core.base.*;
import away3d.core.utils.*;
import away3d.core.render.*;
import away3d.core.light.*;
public class DirectionalLight3D extends Object3D implements ILightProvider, IPrimitiveProvider, IClonable {
private var _ambientDirty:Boolean;
private var _brightnessDirty:Boolean;
private var _green:int;
private var _colorDirty:Boolean;
private var _specularDirty:Boolean;
private var _red:int;
private var _ambient:Number;
public var debug:Boolean;
private var _specular:Number;
private var _diffuse:Number;
private var _ls:DirectionalLight;
private var _color:int;
private var _diffuseDirty:Boolean;
private var _brightness:Number;
private var _blue:int;
public function DirectionalLight3D(_arg1:Object=null){
_ls = new DirectionalLight();
super(_arg1);
color = ini.getColor("color", 0xFFFFFF);
ambient = ini.getNumber("ambient", 0.5, {min:0, max:1});
diffuse = ini.getNumber("diffuse", 0.5, {min:0, max:10});
specular = ini.getNumber("specular", 1, {min:0, max:1});
brightness = ini.getNumber("brightness", 1);
debug = ini.getBoolean("debug", false);
_ls.light = this;
addOnTransformChange(_ls.updateDirection);
}
public function get specular():Number{
return (_specular);
}
public function set color(_arg1:int):void{
_color = _arg1;
_red = ((_color & 0xFF0000) >> 16);
_green = ((_color & 0xFF00) >> 8);
_blue = (_color & 0xFF);
_colorDirty = true;
_ambientDirty = true;
_diffuseDirty = true;
_specularDirty = true;
}
public function get brightness():Number{
return (_brightness);
}
public function set specular(_arg1:Number):void{
if (_arg1 < 0){
_arg1 = 0;
};
_specular = _arg1;
_specularDirty = true;
}
public function light(_arg1:ILightConsumer):void{
if (_colorDirty){
_ls.red = _red;
_ls.green = _green;
_ls.blue = _blue;
};
if (((((_ambientDirty) || (_diffuseDirty))) || (_brightnessDirty))){
_ls.updateAmbientDiffuseBitmap(ambient, diffuse);
};
if (((_ambientDirty) || (_brightnessDirty))){
_ambientDirty = false;
_ls.updateAmbientBitmap(ambient);
};
if (((_diffuseDirty) || (_brightnessDirty))){
_diffuseDirty = false;
_ls.updateDiffuseBitmap(diffuse);
};
if (((_specularDirty) || (_brightnessDirty))){
_specularDirty = false;
_ls.updateSpecularBitmap(specular);
};
_arg1.directionalLight(_ls);
_colorDirty = false;
_brightnessDirty = false;
}
public function get ambient():Number{
return (_ambient);
}
public function get diffuse():Number{
return (_diffuse);
}
public function get color():int{
return (_color);
}
public function set diffuse(_arg1:Number):void{
if (_arg1 < 0){
_arg1 = 0;
};
_diffuse = _arg1;
_diffuseDirty = true;
}
override public function clone(_arg1=null){
var _local2:DirectionalLight3D = ((_arg1) || (new DirectionalLight3D()));
super.clone(_local2);
_local2.color = color;
_local2.brightness = brightness;
_local2.ambient = ambient;
_local2.diffuse = diffuse;
_local2.specular = specular;
_local2.debug = debug;
return (_local2);
}
public function set ambient(_arg1:Number):void{
if (_arg1 < 0){
_arg1 = 0;
};
_ambient = _arg1;
_ambientDirty = true;
}
public function set brightness(_arg1:Number):void{
_brightness = _arg1;
_brightnessDirty = true;
}
override public function primitives(_arg1:IPrimitiveConsumer, _arg2:AbstractRenderSession):void{
super.primitives(_arg1, _arg2);
}
}
}//package away3d.lights
Section 86
//PointLight3D (away3d.lights.PointLight3D)
package away3d.lights {
import away3d.core.draw.*;
import away3d.core.base.*;
import away3d.core.utils.*;
import away3d.core.render.*;
import away3d.core.light.*;
import away3d.materials.*;
public class PointLight3D extends Object3D implements ILightProvider, IPrimitiveProvider, IClonable {
public var diffuse:Number;
public var color:int;
public var specular:Number;
public var brightness:Number;
public var debug:Boolean;
private var _ls:PointLight;
public var ambient:Number;
public function PointLight3D(_arg1:Object=null){
_ls = new PointLight();
super(_arg1);
color = ini.getColor("color", 0xFFFFFF);
ambient = ini.getNumber("ambient", 1);
diffuse = ini.getNumber("diffuse", 1);
specular = ini.getNumber("specular", 1);
brightness = ini.getNumber("brightness", 1);
debug = ini.getBoolean("debug", false);
}
override public function primitives(_arg1:IPrimitiveConsumer, _arg2:AbstractRenderSession):void{
var _local5:DrawTriangle;
super.primitives(_arg1, _arg2);
if (!debug){
return;
};
var _local3:Vertex = new Vertex(0, 0, 0);
var _local4:ScreenVertex = _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 light(_arg1:ILightConsumer):void{
_ls.x = viewTransform.tx;
_ls.y = viewTransform.ty;
_ls.z = viewTransform.tz;
_ls.light = this;
_ls.red = ((color & 0xFF0000) >> 16);
_ls.green = ((color & 0xFF00) >> 8);
_ls.blue = (color & 0xFF);
_ls.ambient = (ambient * brightness);
_ls.diffuse = (diffuse * brightness);
_ls.specular = (specular * brightness);
_arg1.pointLight(_ls);
}
override public function clone(_arg1=null){
var _local2:PointLight3D = ((_arg1) || (new PointLight3D()));
super.clone(_local2);
_local2.color = color;
_local2.ambient = ambient;
_local2.diffuse = diffuse;
_local2.specular = specular;
_local2.debug = debug;
return (_local2);
}
}
}//package away3d.lights
Section 87
//AbstractShader (away3d.materials.shaders.AbstractShader)
package away3d.materials.shaders {
import flash.events.*;
import flash.display.*;
import flash.geom.*;
import away3d.core.draw.*;
import away3d.core.base.*;
import away3d.containers.*;
import away3d.core.utils.*;
import away3d.core.render.*;
import away3d.core.math.*;
import away3d.core.light.*;
import away3d.materials.*;
import flash.utils.*;
public class AbstractShader extends EventDispatcher implements IUpdatingMaterial, ILayerMaterial {
var _normal0:Number3D;
var _view:View3D;
var eTri2x:Number;
var eTri2y:Number;
var _mapping:Matrix;
public var blendMode:String;
var _dict:Dictionary;
var ambient:AmbientLight;
var _spriteDictionary:Dictionary;
var _shape:Shape;
var _n2:Number3D;
var _n0:Number3D;
var _n1:Number3D;
public var smooth:Boolean;
var _source:Mesh;
var _lights:LightArray;
var _face:Face;
var eTri0x:Number;
var eTri0y:Number;
var _bitmapRect:Rectangle;
public var debug:Boolean;
var _session:AbstractRenderSession;
var _shapeDictionary:Dictionary;
var _sprite:Sprite;
var directional:DirectionalLight;
var _normal2:Number3D;
var eTri1x:Number;
var eTri1y:Number;
var _graphics:Graphics;
var _faceDictionary:Dictionary;
protected var ini:Init;
var _faceVO:FaceVO;
var _normal1:Number3D;
var _s:Shape;
var _parentFaceVO:FaceVO;
public function AbstractShader(_arg1:Object=null){
_faceDictionary = new Dictionary(true);
_spriteDictionary = new Dictionary(true);
_shapeDictionary = new Dictionary(true);
_s = new Shape();
_normal0 = new Number3D();
_normal1 = new Number3D();
_normal2 = new Number3D();
_mapping = new Matrix();
super();
ini = Init.parse(_arg1);
smooth = ini.getBoolean("smooth", false);
debug = ini.getBoolean("debug", false);
blendMode = ini.getString("blendMode", BlendMode.NORMAL);
}
protected function clearFaceDictionary(_arg1:Object3D, _arg2:View3D):void{
throw (new Error("Not implemented"));
}
public function get visible():Boolean{
return (true);
}
protected function getShape(_arg1:Sprite):Shape{
_session = _source.session;
if (_session != _session.view.session){
if (!(_shape = _shapeDictionary[_session])){
_arg1.addChild((_shape = (_shapeDictionary[_session] = new Shape())));
};
} else {
if (!(_shape = _shapeDictionary[_face])){
_arg1.addChild((_shape = (_shapeDictionary[_face] = new Shape())));
};
};
return (_shape);
}
function clearShapeDictionary():void{
for each (_shape in _shapeDictionary) {
_shape.graphics.clear();
};
}
public function updateMaterial(_arg1:Object3D, _arg2:View3D):void{
throw (new Error("Not implemented"));
}
public function renderFace(_arg1:Face, _arg2:Rectangle, _arg3:FaceVO):FaceVO{
_source = _arg1.parent;
_view = _source.session.view;
_parentFaceVO = _arg3;
_faceVO = _faceDictionary[_arg1];
if (!_faceVO){
_faceVO = (_faceDictionary[_arg1] = new FaceVO(_source, _view));
};
if (_arg3.resized){
_arg3.resized = false;
_faceVO.resized = true;
};
if (((_arg3.updated) || (_faceVO.invalidated))){
_arg3.updated = false;
_bitmapRect = _arg1.bitmapRect;
if (_faceVO.invalidated){
_faceVO.invalidated = false;
} else {
_faceVO.updated = true;
};
_faceVO.bitmap = _arg3.bitmap;
renderShader(_arg1);
};
return (_faceVO);
}
protected function renderShader(_arg1:Face):void{
throw (new Error("Not implemented"));
}
final function contains(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number, _arg7:Number, _arg8:Number):Boolean{
if ((((_arg1 * (_arg8 - _arg4)) + (_arg3 * (_arg2 - _arg8))) + (_arg7 * (_arg4 - _arg2))) < -0.001){
return (false);
};
if ((((_arg1 * (_arg6 - _arg8)) + (_arg7 * (_arg2 - _arg6))) + (_arg5 * (_arg8 - _arg2))) < -0.001){
return (false);
};
if ((((_arg7 * (_arg6 - _arg4)) + (_arg3 * (_arg8 - _arg6))) + (_arg5 * (_arg4 - _arg8))) < -0.001){
return (false);
};
return (true);
}
protected function getLightingShape(_arg1:Sprite, _arg2:LightPrimitive):Shape{
_session = _source.session;
if (_session != _session.view.session){
if (!_shapeDictionary[_session]){
_shapeDictionary[_session] = new Dictionary(true);
};
if (!(_shape = _shapeDictionary[_session][_arg2])){
_arg1.addChild((_shape = (_shapeDictionary[_session][_arg2] = new Shape())));
};
} else {
if (!_shapeDictionary[_face]){
_shapeDictionary[_face] = new Dictionary(true);
};
if (!(_shape = _shapeDictionary[_face][_arg2])){
_arg1.addChild((_shape = (_shapeDictionary[_face][_arg2] = new Shape())));
};
};
return (_shape);
}
function clearLightingShapeDictionary():void{
for each (_dict in _shapeDictionary) {
for each (_shape in _dict) {
_shape.graphics.clear();
};
};
}
public function renderLayer(_arg1:DrawTriangle, _arg2:Sprite, _arg3:int):void{
_source = (_arg1.source as Mesh);
_view = _source.session.view;
_face = _arg1.face;
_lights = _arg1.source.session.lightarray;
}
}
}//package away3d.materials.shaders
Section 88
//AmbientShader (away3d.materials.shaders.AmbientShader)
package away3d.materials.shaders {
import flash.display.*;
import away3d.core.draw.*;
import away3d.core.base.*;
import away3d.containers.*;
public class AmbientShader extends AbstractShader {
public var color:uint;
public function AmbientShader(_arg1:Object=null){
super(_arg1);
}
override public function updateMaterial(_arg1:Object3D, _arg2:View3D):void{
clearLightingShapeDictionary();
}
override protected function clearFaceDictionary(_arg1:Object3D, _arg2:View3D):void{
for each (_faceVO in _faceDictionary) {
if (_arg1 == _faceVO.source){
if (!_faceVO.cleared){
_faceVO.clear();
};
_faceVO.invalidated = true;
};
};
}
override public function renderLayer(_arg1:DrawTriangle, _arg2:Sprite, _arg3:int):void{
super.renderLayer(_arg1, _arg2, _arg3);
for each (ambient in _arg1.source.session.lightarray.ambients) {
if (_lights.numLights > 1){
_shape = getLightingShape(_arg2, ambient);
_shape.blendMode = blendMode;
_graphics = _shape.graphics;
} else {
_graphics = _arg2.graphics;
};
_source.session.renderTriangleBitmap(ambient.ambientBitmap, _mapping, _arg1.v0, _arg1.v1, _arg1.v2, smooth, false, _graphics);
};
if (debug){
_arg1.source.session.renderTriangleLine(0, 0xFF, 1, _arg1.v0, _arg1.v1, _arg1.v2);
};
}
override protected function renderShader(_arg1:Face):void{
for each (ambient in _source.session.lightarray.ambients) {
_faceVO.bitmap.draw(ambient.ambientBitmap, null, null, blendMode);
};
for each (directional in _source.session.lightarray.directionals) {
_faceVO.bitmap.draw(directional.ambientBitmap, null, null, blendMode);
};
}
}
}//package away3d.materials.shaders
Section 89
//DiffusePhongShader (away3d.materials.shaders.DiffusePhongShader)
package away3d.materials.shaders {
import flash.display.*;
import away3d.core.draw.*;
import away3d.core.base.*;
import away3d.containers.*;
import away3d.core.math.*;
public class DiffusePhongShader extends AbstractShader {
private var _diffuseTransform:Matrix3D;
private var _normal2z:Number;
private var _normal1z:Number;
private var _normal0z:Number;
private var _szx:Number;
private var _szy:Number;
private var _szz:Number;
private var eTriVal:Number;// = 162.974661726101
private var eTriConst:Number;// = 162.974661726101
public function DiffusePhongShader(_arg1:Object=null){
super(_arg1);
}
override protected function clearFaceDictionary(_arg1:Object3D, _arg2:View3D):void{
for each (_faceVO in _faceDictionary) {
if (_arg1 == _faceVO.source){
if (!_faceVO.cleared){
_faceVO.clear();
};
_faceVO.invalidated = true;
};
};
}
override public function renderLayer(_arg1:DrawTriangle, _arg2:Sprite, _arg3:int):void{
super.renderLayer(_arg1, _arg2, _arg3);
for each (directional in _lights.directionals) {
if (_lights.numLights > 1){
_shape = getLightingShape(_arg2, directional);
_shape.blendMode = blendMode;
_graphics = _shape.graphics;
} else {
_graphics = _arg2.graphics;
};
_diffuseTransform = directional.diffuseTransform[_source];
_n0 = _source.getVertexNormal(_arg1.face.v0);
_n1 = _source.getVertexNormal(_arg1.face.v1);
_n2 = _source.getVertexNormal(_arg1.face.v2);
_szx = _diffuseTransform.szx;
_szy = _diffuseTransform.szy;
_szz = _diffuseTransform.szz;
_normal0z = (((_n0.x * _szx) + (_n0.y * _szy)) + (_n0.z * _szz));
_normal1z = (((_n1.x * _szx) + (_n1.y * _szy)) + (_n1.z * _szz));
_normal2z = (((_n2.x * _szx) + (_n2.y * _szy)) + (_n2.z * _szz));
eTri0x = (eTriConst * Math.acos(_normal0z));
_mapping.a = ((eTriConst * Math.acos(_normal1z)) - eTri0x);
_mapping.b = 127;
_mapping.c = ((eTriConst * Math.acos(_normal2z)) - eTri0x);
_mapping.d = 0xFF;
_mapping.tx = eTri0x;
_mapping.ty = 0;
_mapping.invert();
_source.session.renderTriangleBitmap(directional.ambientDiffuseBitmap, _mapping, _arg1.v0, _arg1.v1, _arg1.v2, smooth, false, _graphics);
};
if (debug){
_source.session.renderTriangleLine(0, 0xFF, 1, _arg1.v0, _arg1.v1, _arg1.v2);
};
}
override protected function renderShader(_arg1:Face):void{
for each (directional in _source.session.lightarray.directionals) {
_diffuseTransform = directional.diffuseTransform[_source];
_n0 = _source.getVertexNormal(_arg1.v0);
_n1 = _source.getVertexNormal(_arg1.v1);
_n2 = _source.getVertexNormal(_arg1.v2);
_szx = _diffuseTransform.szx;
_szy = _diffuseTransform.szy;
_szz = _diffuseTransform.szz;
_normal0z = (((_n0.x * _szx) + (_n0.y * _szy)) + (_n0.z * _szz));
_normal1z = (((_n1.x * _szx) + (_n1.y * _szy)) + (_n1.z * _szz));
_normal2z = (((_n2.x * _szx) + (_n2.y * _szy)) + (_n2.z * _szz));
if ((((((_normal0z > 0)) || ((_normal1z > 0)))) || ((_normal2z > 0)))){
eTri0x = (eTriConst * Math.acos(_normal0z));
if (((_faceVO.cleared) && (!(_parentFaceVO.updated)))){
_faceVO.bitmap = _parentFaceVO.bitmap.clone();
_faceVO.bitmap.lock();
};
_faceVO.cleared = false;
_faceVO.updated = true;
_mapping.a = ((eTriConst * Math.acos(_normal1z)) - eTri0x);
_mapping.b = 127;
_mapping.c = ((eTriConst * Math.acos(_normal2z)) - eTri0x);
_mapping.d = 0xFF;
_mapping.tx = eTri0x;
_mapping.ty = 0;
_mapping.invert();
_mapping.concat(_arg1._dt.invtexturemapping);
_graphics = _s.graphics;
_graphics.clear();
_graphics.beginBitmapFill(directional.diffuseBitmap, _mapping, false, smooth);
_graphics.drawRect(0, 0, _bitmapRect.width, _bitmapRect.height);
_graphics.endFill();
_faceVO.bitmap.draw(_s, null, null, blendMode);
};
};
}
override public function updateMaterial(_arg1:Object3D, _arg2:View3D):void{
clearLightingShapeDictionary();
for each (directional in _arg1.session.lightarray.directionals) {
if (((!(directional.diffuseTransform[_arg1])) || (_arg1.sceneTransformed))){
directional.setDiffuseTransform(_arg1);
clearFaceDictionary(_arg1, _arg2);
};
};
}
}
}//package away3d.materials.shaders
Section 90
//SpecularPhongShader (away3d.materials.shaders.SpecularPhongShader)
package away3d.materials.shaders {
import flash.display.*;
import flash.geom.*;
import away3d.core.draw.*;
import away3d.core.base.*;
import away3d.containers.*;
import away3d.core.math.*;
import flash.utils.*;
public class SpecularPhongShader extends AbstractShader {
private var specVal1:Number;
private var specVal2:Number;
private var specVal3:Number;
private var _syx:Number;
private var _syy:Number;
private var _syz:Number;
private var _specular:Number;
private var _szx:Number;
private var _szy:Number;
private var _szz:Number;
private var _nFaceTransZ:Number;
private var _shininess:Number;
private var coeff1:Number;
private var coeff2:Number;
private var coeff3:Number;
private var _specMin:Number;
private var specValFace:Number;
private var _specColor:ColorTransform;
private var _specularTransform:Matrix3D;
private var _nFace:Number3D;
private var _sxx:Number;
private var _sxy:Number;
private var _sxz:Number;
public function SpecularPhongShader(_arg1:Object=null){
super(_arg1);
shininess = ini.getNumber("shininess", 20);
specular = ini.getNumber("specular", 1);
}
override protected function clearFaceDictionary(_arg1:Object3D, _arg2:View3D):void{
for each (_faceVO in _faceDictionary) {
if ((((_arg1 == _faceVO.source)) && ((_arg2 == _faceVO.view)))){
if (!_faceVO.cleared){
_faceVO.clear();
};
_faceVO.invalidated = true;
};
};
}
public function set specular(_arg1:Number):void{
_specular = _arg1;
_specColor = new ColorTransform(1, 1, 1, _specular, 0, 0, 0, 0);
}
override public function updateMaterial(_arg1:Object3D, _arg2:View3D):void{
clearLightingShapeDictionary();
for each (directional in _arg1.session.lightarray.directionals) {
if (!directional.specularTransform[_arg1]){
directional.specularTransform[_arg1] = new Dictionary(true);
};
if (((((!(directional.specularTransform[_arg1][_arg2])) || (_arg1.sceneTransformed))) || (_arg1.session.view.camera.sceneTransformed))){
directional.setSpecularTransform(_arg1, _arg2);
clearFaceDictionary(_arg1, _arg2);
};
};
}
public function set shininess(_arg1:Number):void{
_shininess = _arg1;
_specMin = Math.pow(0.8, (_shininess / 20));
}
override protected function renderShader(_arg1:Face):void{
for each (directional in _source.session.lightarray.directionals) {
_specularTransform = directional.specularTransform[_source][_view];
_n0 = _source.getVertexNormal(_arg1.v0);
_n1 = _source.getVertexNormal(_arg1.v1);
_n2 = _source.getVertexNormal(_arg1.v2);
_nFace = _arg1.normal;
_szx = _specularTransform.szx;
_szy = _specularTransform.szy;
_szz = _specularTransform.szz;
specVal1 = Math.pow((((_n0.x * _szx) + (_n0.y * _szy)) + (_n0.z * _szz)), (_shininess / 20));
specVal2 = Math.pow((((_n1.x * _szx) + (_n1.y * _szy)) + (_n1.z * _szz)), (_shininess / 20));
specVal3 = Math.pow((((_n2.x * _szx) + (_n2.y * _szy)) + (_n2.z * _szz)), (_shininess / 20));
specValFace = Math.pow((_nFaceTransZ = (((_nFace.x * _szx) + (_nFace.y * _szy)) + (_nFace.z * _szz))), (_shininess / 20));
if ((((_nFaceTransZ > 0)) && ((((((((((((((specValFace > _specMin)) || ((specVal1 > _specMin)))) || ((specVal2 > _specMin)))) || ((specVal3 > _specMin)))) || ((_nFace.dot(_n0) < 0.8)))) || ((_nFace.dot(_n1) < 0.8)))) || ((_nFace.dot(_n2) < 0.8)))))){
if (((_faceVO.cleared) && (!(_parentFaceVO.updated)))){
_faceVO.bitmap = _parentFaceVO.bitmap.clone();
_faceVO.bitmap.lock();
};
_faceVO.cleared = false;
_faceVO.updated = true;
_sxx = _specularTransform.sxx;
_sxy = _specularTransform.sxy;
_sxz = _specularTransform.sxz;
_syx = _specularTransform.syx;
_syy = _specularTransform.syy;
_syz = _specularTransform.syz;
eTri0x = (((_n0.x * _sxx) + (_n0.y * _sxy)) + (_n0.z * _sxz));
eTri0y = (((_n0.x * _syx) + (_n0.y * _syy)) + (_n0.z * _syz));
eTri1x = (((_n1.x * _sxx) + (_n1.y * _sxy)) + (_n1.z * _sxz));
eTri1y = (((_n1.x * _syx) + (_n1.y * _syy)) + (_n1.z * _syz));
eTri2x = (((_n2.x * _sxx) + (_n2.y * _sxy)) + (_n2.z * _sxz));
eTri2y = (((_n2.x * _syx) + (_n2.y * _syy)) + (_n2.z * _syz));
coeff1 = ((0xFF * Math.acos(specVal1)) / Math.sqrt(((eTri0x * eTri0x) + (eTri0y * eTri0y))));
coeff2 = ((0xFF * Math.acos(specVal2)) / Math.sqrt(((eTri1x * eTri1x) + (eTri1y * eTri1y))));
coeff3 = ((0xFF * Math.acos(specVal3)) / Math.sqrt(((eTri2x * eTri2x) + (eTri2y * eTri2y))));
eTri0x = (eTri0x * coeff1);
eTri0y = (eTri0y * coeff1);
eTri1x = (eTri1x * coeff2);
eTri1y = (eTri1y * coeff2);
eTri2x = (eTri2x * coeff3);
eTri2y = (eTri2y * coeff3);
_mapping.a = (eTri1x - eTri0x);
_mapping.b = (eTri1y - eTri0y);
_mapping.c = (eTri2x - eTri0x);
_mapping.d = (eTri2y - eTri0y);
_mapping.tx = (eTri0x + 0xFF);
_mapping.ty = (eTri0y + 0xFF);
_mapping.invert();
_mapping.concat(_arg1._dt.invtexturemapping);
_graphics = _s.graphics;
_graphics.clear();
_graphics.beginBitmapFill(directional.specularBitmap, _mapping, false, smooth);
_graphics.drawRect(0, 0, _bitmapRect.width, _bitmapRect.height);
_graphics.endFill();
_faceVO.bitmap.draw(_s, null, _specColor, blendMode);
};
};
}
public function get specular():Number{
return (_specular);
}
public function get shininess():Number{
return (_shininess);
}
override public function renderLayer(_arg1:DrawTriangle, _arg2:Sprite, _arg3:int):void{
super.renderLayer(_arg1, _arg2, _arg3);
for each (directional in _lights.directionals) {
_specularTransform = directional.specularTransform[_source][_view];
_n0 = _source.getVertexNormal(_arg1.face.v0);
_n1 = _source.getVertexNormal(_arg1.face.v1);
_n2 = _source.getVertexNormal(_arg1.face.v2);
_nFace = _arg1.face.normal;
_szx = _specularTransform.szx;
_szy = _specularTransform.szy;
_szz = _specularTransform.szz;
specVal1 = Math.pow((((_n0.x * _szx) + (_n0.y * _szy)) + (_n0.z * _szz)), (_shininess / 20));
specVal2 = Math.pow((((_n1.x * _szx) + (_n1.y * _szy)) + (_n1.z * _szz)), (_shininess / 20));
specVal3 = Math.pow((((_n2.x * _szx) + (_n2.y * _szy)) + (_n2.z * _szz)), (_shininess / 20));
specValFace = Math.pow((_nFaceTransZ = (((_nFace.x * _szx) + (_nFace.y * _szy)) + (_nFace.z * _szz))), (_shininess / 20));
if ((((_nFaceTransZ > 0)) && ((((((((((((((specValFace > _specMin)) || ((specVal1 > _specMin)))) || ((specVal2 > _specMin)))) || ((specVal3 > _specMin)))) || ((_nFace.dot(_n0) < 0.8)))) || ((_nFace.dot(_n1) < 0.8)))) || ((_nFace.dot(_n2) < 0.8)))))){
_shape = getLightingShape(_arg2, directional);
_shape.blendMode = blendMode;
_shape.alpha = _specular;
_graphics = _shape.graphics;
_sxx = _specularTransform.sxx;
_sxy = _specularTransform.sxy;
_sxz = _specularTransform.sxz;
_syx = _specularTransform.syx;
_syy = _specularTransform.syy;
_syz = _specularTransform.syz;
eTri0x = (((_n0.x * _sxx) + (_n0.y * _sxy)) + (_n0.z * _sxz));
eTri0y = (((_n0.x * _syx) + (_n0.y * _syy)) + (_n0.z * _syz));
eTri1x = (((_n1.x * _sxx) + (_n1.y * _sxy)) + (_n1.z * _sxz));
eTri1y = (((_n1.x * _syx) + (_n1.y * _syy)) + (_n1.z * _syz));
eTri2x = (((_n2.x * _sxx) + (_n2.y * _sxy)) + (_n2.z * _sxz));
eTri2y = (((_n2.x * _syx) + (_n2.y * _syy)) + (_n2.z * _syz));
coeff1 = ((0xFF * Math.acos(specVal1)) / Math.sqrt(((eTri0x * eTri0x) + (eTri0y * eTri0y))));
coeff2 = ((0xFF * Math.acos(specVal2)) / Math.sqrt(((eTri1x * eTri1x) + (eTri1y * eTri1y))));
coeff3 = ((0xFF * Math.acos(specVal3)) / Math.sqrt(((eTri2x * eTri2x) + (eTri2y * eTri2y))));
eTri0x = (eTri0x * coeff1);
eTri0y = (eTri0y * coeff1);
eTri1x = (eTri1x * coeff2);
eTri1y = (eTri1y * coeff2);
eTri2x = (eTri2x * coeff3);
eTri2y = (eTri2y * coeff3);
if ((((eTri1x == eTri0x)) && ((eTri1y == eTri0y)))){
eTri1x = (eTri1x + 0.1);
eTri1y = (eTri1y + 0.1);
};
if ((((eTri2x == eTri1x)) && ((eTri2y == eTri1y)))){
eTri2x = (eTri2x + 0.1);
eTri2y = (eTri2y + 0.1);
};
if ((((eTri0x == eTri2x)) && ((eTri0y == eTri2y)))){
eTri0x = (eTri0x + 0.1);
eTri0y = (eTri0y + 0.1);
};
_mapping.a = (eTri1x - eTri0x);
_mapping.b = (eTri1y - eTri0y);
_mapping.c = (eTri2x - eTri0x);
_mapping.d = (eTri2y - eTri0y);
_mapping.tx = (eTri0x + 0xFF);
_mapping.ty = (eTri0y + 0xFF);
_mapping.invert();
_source.session.renderTriangleBitmap(directional.specularBitmap, _mapping, _arg1.v0, _arg1.v1, _arg1.v2, smooth, false, _graphics);
};
};
if (debug){
_source.session.renderTriangleLine(0, 0xFF, 1, _arg1.v0, _arg1.v1, _arg1.v2);
};
}
}
}//package away3d.materials.shaders
Section 91
//BitmapMaterial (away3d.materials.BitmapMaterial)
package away3d.materials {
import flash.events.*;
import flash.display.*;
import flash.geom.*;
import away3d.core.draw.*;
import away3d.core.base.*;
import away3d.containers.*;
import away3d.core.utils.*;
import away3d.core.render.*;
import away3d.events.*;
import flash.utils.*;
public class BitmapMaterial extends EventDispatcher implements ITriangleMaterial, IUVMaterial, ILayerMaterial, IUpdatingMaterial {
var _green:Number;// = 1
private var triangle:DrawTriangle;
var _blendMode:String;
private var dsbc:Number;
private var faz:Number;
private var dsca:Number;
private var ax:Number;
private var ay:Number;
var _blue:Number;// = 1
private var az:Number;
var _renderBitmap:BitmapData;
private var fbz:Number;
var _zeroPoint:Point;
var _colorTransformDirty:Boolean;
private var mcax:Number;
var _bitmap:BitmapData;
private var mcaz:Number;
var _bitmapRect:Rectangle;
public var debug:Boolean;// = false
private var mcay:Number;
private var bx:Number;
var _session:AbstractRenderSession;
private var bz:Number;
private var map:Matrix;
private var fcz:Number;
private var by:Number;
var _alpha:Number;// = 1
var _color:uint;// = 0xFFFFFF
var _colorTransform:ColorTransform;
private var dbcx:Number;
private var dbcy:Number;
private var cx:Number;
private var cy:Number;
private var cz:Number;
var _sourceVO:FaceVO;
private var dmax:Number;
var _mapping:Matrix;
private var dabx:Number;
private var _shape:Shape;
public var repeat:Boolean;// = false
private var daby:Number;
private var svArray:Array;
var _blendModeDirty:Boolean;
public var smooth:Boolean;// = false
private var mbcx:Number;
private var mbcy:Number;
private var mbcz:Number;
var _red:Number;// = 1
private var _shapeDictionary:Dictionary;
private var focus:Number;
private var mabx:Number;
private var maby:Number;
private var dsab:Number;
var _graphics:Graphics;
var _faceDictionary:Dictionary;
private var mabz:Number;
var _s:Shape;
var _faceVO:FaceVO;
private var dcax:Number;
private var dcay:Number;
protected var ini:Init;
private var _precision:Number;
public function BitmapMaterial(_arg1:BitmapData, _arg2:Object=null){
_faceDictionary = new Dictionary(true);
_zeroPoint = new Point(0, 0);
_s = new Shape();
_shapeDictionary = new Dictionary(true);
map = new Matrix();
triangle = new DrawTriangle();
svArray = new Array();
super();
_bitmap = _arg1;
ini = Init.parse(_arg2);
smooth = ini.getBoolean("smooth", smooth);
debug = ini.getBoolean("debug", debug);
repeat = ini.getBoolean("repeat", repeat);
precision = ini.getNumber("precision", 0);
_blendMode = ini.getString("blendMode", BlendMode.NORMAL);
alpha = ini.getNumber("alpha", _alpha, {min:0, max:1});
color = ini.getColor("color", _color);
_colorTransformDirty = true;
createVertexArray();
}
public function set precision(_arg1:Number):void{
_precision = ((_arg1 * _arg1) * 1.4);
}
function clearShapeDictionary():void{
for each (_shape in _shapeDictionary) {
_shape.graphics.clear();
};
}
public function renderTriangle(_arg1:DrawTriangle):void{
_mapping = getMapping(_arg1);
_session = _arg1.source.session;
if (((((!(_graphics)) && (!((_session == _session.view.session))))) && (_session.newLayer))){
_graphics = _session.newLayer.graphics;
};
if (precision){
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 {
_session.renderTriangleBitmap(_renderBitmap, _mapping, _arg1.v0, _arg1.v1, _arg1.v2, smooth, repeat, _graphics);
};
if (debug){
_session.renderTriangleLine(0, 0xFF, 1, _arg1.v0, _arg1.v1, _arg1.v2);
};
}
public function renderFace(_arg1:Face, _arg2:Rectangle, _arg3:FaceVO):FaceVO{
renderSource(_arg1.parent, _arg2, new Matrix());
_faceVO = _faceDictionary[_arg1];
if (!_faceVO){
_faceVO = (_faceDictionary[_arg1] = new FaceVO());
};
if (_arg3.resized){
_arg3.resized = false;
_faceVO.resized = true;
};
if (((_arg3.updated) || (_faceVO.invalidated))){
_arg3.updated = false;
_faceVO.invalidated = false;
_faceVO.cleared = false;
_faceVO.updated = true;
_faceVO.bitmap = _arg3.bitmap.clone();
_faceVO.bitmap.copyPixels(_sourceVO.bitmap, _arg1.bitmapRect, _zeroPoint, null, null, true);
};
return (_faceVO);
}
private function renderRec(_arg1:ScreenVertex, _arg2:ScreenVertex, _arg3:ScreenVertex, _arg4:Number):void{
var _local11:ScreenVertex;
var _local12: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.view.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, _graphics);
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, _graphics);
if (debug){
_session.renderTriangleLine(1, 0xFF00, 1, _arg1, _arg2, _arg3);
};
return;
};
var _local5:Number = map.a;
var _local6:Number = map.b;
var _local7:Number = map.c;
var _local8:Number = map.d;
var _local9:Number = map.tx;
var _local10:Number = map.ty;
var _temp1 = _arg4;
_arg4 = (_arg4 + 1);
var _local13:ScreenVertex = 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 updateMaterial(_arg1:Object3D, _arg2:View3D):void{
_graphics = null;
clearShapeDictionary();
if (((_colorTransformDirty) || (_blendModeDirty))){
clearFaceDictionary();
};
if (_colorTransformDirty){
setColorTransform();
};
_blendModeDirty = false;
}
public function addOnResize(_arg1:Function):void{
addEventListener(MaterialEvent.RESIZED, _arg1, false, 0, true);
}
public function removeOnResize(_arg1:Function):void{
removeEventListener(MaterialEvent.RESIZED, _arg1, false);
}
function renderSource(_arg1:Object3D, _arg2:Rectangle, _arg3:Matrix):void{
_sourceVO = _faceDictionary[_arg1];
if (!_sourceVO){
_sourceVO = (_faceDictionary[_arg1] = new FaceVO());
};
_sourceVO.resize(_arg2.width, _arg2.height);
if (_sourceVO.invalidated){
_arg3.scale((_arg2.width / width), (_arg2.height / height));
_sourceVO.invalidated = false;
_sourceVO.cleared = false;
_sourceVO.updated = true;
if ((((((((((((_arg3.a == 1)) && ((_arg3.d == 1)))) && ((_arg3.b == 0)))) && ((_arg3.c == 0)))) && ((_arg3.tx == 0)))) && ((_arg3.ty == 0)))){
_sourceVO.bitmap.copyPixels(_bitmap, _arg2, _zeroPoint);
} else {
_graphics = _s.graphics;
_graphics.clear();
_graphics.beginBitmapFill(_bitmap, _arg3, repeat, smooth);
_graphics.drawRect(0, 0, _arg2.width, _arg2.height);
_graphics.endFill();
_sourceVO.bitmap.draw(_s, null, _colorTransform, _blendMode, _sourceVO.bitmap.rect);
};
};
}
public function renderLayer(_arg1:DrawTriangle, _arg2:Sprite, _arg3:int):void{
if (blendMode == BlendMode.NORMAL){
_graphics = _arg2.graphics;
} else {
_session = _arg1.source.session;
if (_session != _session.view.session){
if (!(_shape = _shapeDictionary[_session])){
_arg2.addChild((_shape = (_shapeDictionary[_session] = new Shape())));
};
} else {
if (!(_shape = _shapeDictionary[_arg1.face])){
_arg2.addChild((_shape = (_shapeDictionary[_arg1.face] = new Shape())));
};
};
_shape.blendMode = _blendMode;
_graphics = _shape.graphics;
};
renderTriangle(_arg1);
}
public function set blendMode(_arg1:String):void{
if (_blendMode == _arg1){
return;
};
_blendMode = _arg1;
_blendModeDirty = true;
}
protected function setColorTransform():void{
_colorTransformDirty = false;
if ((((_alpha == 1)) && ((_color == 0xFFFFFF)))){
_renderBitmap = _bitmap;
_colorTransform = null;
return;
};
if (!_colorTransform){
_colorTransform = new ColorTransform();
};
_colorTransform.redMultiplier = _red;
_colorTransform.greenMultiplier = _green;
_colorTransform.blueMultiplier = _blue;
_colorTransform.alphaMultiplier = _alpha;
if (_alpha == 0){
_renderBitmap = null;
return;
};
updateRenderBitmap();
}
public function get alpha():Number{
return (_alpha);
}
public function get color():uint{
return (_color);
}
public function get precision():Number{
return (_precision);
}
function clearFaceDictionary():void{
for each (_faceVO in _faceDictionary) {
if (!_faceVO.cleared){
_faceVO.clear();
};
_faceVO.invalidated = true;
};
}
public function getPixel32(_arg1:Number, _arg2:Number):uint{
return (_bitmap.getPixel32((_arg1 * _bitmap.width), ((1 - _arg2) * _bitmap.height)));
}
public function get visible():Boolean{
return ((_alpha > 0));
}
private function createVertexArray():void{
var _local1:Number = 100;
while (_local1--) {
svArray.push(new ScreenVertex());
};
}
protected function getMapping(_arg1:DrawTriangle):Matrix{
return (((_arg1.texturemapping) || (_arg1.transformUV(this))));
}
public function set alpha(_arg1:Number):void{
if (_arg1 > 1){
_arg1 = 1;
};
if (_arg1 < 0){
_arg1 = 0;
};
if (_alpha == _arg1){
return;
};
_alpha = _arg1;
_colorTransformDirty = true;
}
public function get blendMode():String{
return (_blendMode);
}
public function get width():Number{
return (_bitmap.width);
}
protected function updateRenderBitmap():void{
if (_colorTransform){
if (((!(_bitmap.transparent)) && (!((_alpha == 1))))){
_renderBitmap = new BitmapData(_bitmap.width, _bitmap.height, true);
_renderBitmap.draw(_bitmap);
} else {
_renderBitmap = _bitmap.clone();
};
_renderBitmap.colorTransform(_renderBitmap.rect, _colorTransform);
} else {
_renderBitmap = _bitmap;
};
}
public function set color(_arg1:uint):void{
if (_color == _arg1){
return;
};
_color = _arg1;
_red = (((_color & 0xFF0000) >> 16) / 0xFF);
_green = (((_color & 0xFF00) >> 8) / 0xFF);
_blue = ((_color & 0xFF) / 0xFF);
_colorTransformDirty = true;
}
}
}//package away3d.materials
Section 92
//BitmapMaterialContainer (away3d.materials.BitmapMaterialContainer)
package away3d.materials {
import flash.display.*;
import flash.geom.*;
import away3d.core.draw.*;
import away3d.core.base.*;
import away3d.containers.*;
import away3d.core.utils.*;
import flash.utils.*;
import away3d.core.*;
public class BitmapMaterialContainer extends BitmapMaterial implements ITriangleMaterial, IUpdatingMaterial, ILayerMaterial {
private var _cache:Boolean;
private var _height:Number;
private var _width:Number;
private var _faceHeight:int;
private var _material:ILayerMaterial;
public var transparent:Boolean;
private var _forceRender:Boolean;
private var _faceWidth:int;
public var materials:Array;
private var _dt:DrawTriangle;
private var _containerDictionary:Dictionary;
private var _cacheDictionary:Dictionary;
private var _containerVO:FaceVO;
private var _face:Face;
public function BitmapMaterialContainer(_arg1:int, _arg2:int, _arg3:Object=null){
_containerDictionary = new Dictionary(true);
super(new BitmapData(_arg1, _arg2, true, 0xFFFFFF), _arg3);
_width = _arg1;
_height = _arg2;
_bitmapRect = new Rectangle(0, 0, _width, _height);
if (!materials){
materials = ini.getArray("materials");
};
transparent = ini.getBoolean("transparent", true);
cache = ini.getBoolean("cache", true);
}
public function get cache():Boolean{
return (_cache);
}
public function update():void{
if (_cache){
_cacheDictionary = new Dictionary(true);
};
}
public function set cache(_arg1:Boolean):void{
_cache = _arg1;
if (_arg1){
_cacheDictionary = new Dictionary(true);
} else {
_cacheDictionary = null;
};
}
override public function updateMaterial(_arg1:Object3D, _arg2:View3D):void{
if (_colorTransformDirty){
setColorTransform();
};
_blendModeDirty = false;
for each (_material in materials) {
if ((_material is IUpdatingMaterial)){
(_material as IUpdatingMaterial).updateMaterial(_arg1, _arg2);
};
};
}
override protected function getMapping(_arg1:DrawTriangle):Matrix{
_face = _arg1.face;
_dt = _face._dt;
if (((!(_cacheDictionary)) || (!(_cacheDictionary[_face])))){
_faceVO = _faceDictionary[_face];
if (!_faceVO){
_faceVO = (_faceDictionary[_face] = new FaceVO());
};
if (!_dt.texturemapping){
_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)));
_faceWidth = _face.bitmapRect.width;
_faceHeight = _face.bitmapRect.height;
_dt.transformUV(this);
_faceVO.resize(_faceWidth, _faceHeight, transparent);
};
for each (_material in materials) {
_faceVO = _material.renderFace(_face, _bitmapRect, _faceVO);
};
_faceVO.updated = false;
if (_cacheDictionary){
_cacheDictionary[_face] = _faceVO;
};
};
if (!_arg1.texturemapping){
_arg1.transformUV(this);
};
if (_cacheDictionary){
_renderBitmap = _cacheDictionary[_face].bitmap;
} else {
_renderBitmap = _faceVO.bitmap;
};
return (_arg1.texturemapping);
}
override public function renderFace(_arg1:Face, _arg2:Rectangle, _arg3:FaceVO):FaceVO{
_faceVO = _faceDictionary[_arg1];
if (!_faceVO){
_faceVO = (_faceDictionary[_arg1] = new FaceVO());
};
_faceWidth = _arg1.bitmapRect.width;
_faceHeight = _arg1.bitmapRect.height;
_containerVO = _containerDictionary[_arg1];
if (!_containerVO){
_containerVO = (_containerDictionary[_arg1] = new FaceVO());
};
if (_arg3.resized){
_arg3.resized = false;
_containerVO.resize(_faceWidth, _faceHeight, transparent);
};
for each (_material in materials) {
_containerVO = _material.renderFace(_face, _arg2, _containerVO);
};
if (((_arg3.updated) || (_containerVO.updated))){
_arg3.updated = false;
_containerVO.updated = false;
_faceVO.invalidated = false;
_faceVO.cleared = false;
_faceVO.updated = true;
_faceVO.bitmap = _arg3.bitmap.clone();
_faceVO.bitmap.lock();
_sourceVO = _faceVO;
if ((((_blendMode == BlendMode.NORMAL)) && (!(_colorTransform)))){
_faceVO.bitmap.copyPixels(_containerVO.bitmap, _containerVO.bitmap.rect, _zeroPoint, null, null, true);
} else {
_faceVO.bitmap.draw(_containerVO.bitmap, null, _colorTransform, _blendMode);
};
};
_containerVO.updated = false;
return (_faceVO);
}
override public function renderLayer(_arg1:DrawTriangle, _arg2:Sprite, _arg3:int):void{
throw (new Error("Not implemented"));
}
override protected function updateRenderBitmap():void{
update();
}
}
}//package away3d.materials
Section 93
//CenterLightingMaterial (away3d.materials.CenterLightingMaterial)
package away3d.materials {
import flash.events.*;
import flash.display.*;
import away3d.core.draw.*;
import away3d.core.base.*;
import away3d.containers.*;
import away3d.core.utils.*;
import away3d.core.render.*;
import away3d.core.math.*;
import away3d.core.light.*;
public class CenterLightingMaterial extends EventDispatcher implements ITriangleMaterial, IUpdatingMaterial {
private var fy:Number;
private var pb:Number;
private var green:Number;
private var nz:Number;
private var ksr:Number;
private var draw_fall_k:Number;// = 1
private var diff:Number;
private var kdb:Number;
protected var ini:Init;
private var kdg:Number;
public var ak:Number;// = 20
private var draw_reflect_k:Number;// = 1
private var v0p:Number;
private var dfy:Number;
private var dfz:Number;
private var kdr:Number;
private var _source:Mesh;
private var dfx:Number;
private var v0x:Number;
private var v0y:Number;
private var v0z:Number;
private var draw_normal:Boolean;// = false
private var ry:Number;
private var rz:Number;
private var sum:Number;
private var rx:Number;
public var diffuse_brightness:Number;// = 1
private var projection:Projection;
private var v1p:Number;
public var ambient_brightness:Number;// = 1
private var blue:Number;
private var v1x:Number;
private var v1y:Number;
private var v1z:Number;
private var ncx:Number;
private var ncy:Number;
private var ncz:Number;
private var v2p:Number;
private var cx:Number;
var v0:ScreenVertex;
var v1:ScreenVertex;
private var v2x:Number;
private var v2y:Number;
private var v2z:Number;
private var df:Number;
var v2:ScreenVertex;
private var cz:Number;
private var _diffuseTransform:Matrix3D;
private var cy:Number;
private var point:PointLight;
private var red:Number;
private var graphics:Graphics;
var session:AbstractRenderSession;
private var global:AmbientLight;
private var fade:Number;
private var amb:Number;
private var ffy:Number;
private var spec:Number;
private var nf:Number;
private var ffz:Number;
private var draw_reflect:Boolean;// = false
private var draw_fall:Boolean;// = false
private var rfx:Number;
private var rfy:Number;
private var rfz:Number;
private var ffx:Number;
private var nx:Number;
private var d1x:Number;
private var d1y:Number;
private var d1z:Number;
private var kag:Number;
private var ny:Number;
private var zoom:Number;
private var kar:Number;
private var focus:Number;
private var fx:Number;
private var fz:Number;
public var specular_brightness:Number;// = 1
private var directional:DirectionalLight;
private var c0x:Number;
private var c0y:Number;
private var c0z:Number;
private var kab:Number;
private var pdd:Number;
private var pa:Number;
private var d2y:Number;
private var pc:Number;
private var d2x:Number;
private var ksb:Number;
private var d2z:Number;
private var ksg:Number;
public function CenterLightingMaterial(_arg1:Object=null){
ini = Init.parse(_arg1);
ak = ini.getNumber("ak", 20);
}
public function updateMaterial(_arg1:Object3D, _arg2:View3D):void{
for each (directional in _arg1.session.lightarray.directionals) {
if (((!(directional.diffuseTransform[_arg1])) || (_arg1.sceneTransformed))){
directional.setDiffuseTransform(_arg1);
};
};
}
protected function renderTri(_arg1:DrawTriangle, _arg2:AbstractRenderSession, _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 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))))))));
_source = (_arg1.source as Mesh);
for each (directional in session.lightarray.directionals) {
_diffuseTransform = directional.diffuseTransform[_source];
red = directional.red;
green = directional.green;
blue = directional.blue;
dfx = _diffuseTransform.szx;
dfy = _diffuseTransform.szy;
dfz = _diffuseTransform.szz;
nx = _arg1.face.normal.x;
ny = _arg1.face.normal.y;
nz = _arg1.face.normal.z;
amb = (directional.ambient * ambient_brightness);
kar = (kar + (red * amb));
kag = (kag + (green * amb));
kab = (kab + (blue * amb));
nf = (((dfx * nx) + (dfy * ny)) + (dfz * nz));
if (nf < 0){
} else {
diff = ((directional.diffuse * nf) * diffuse_brightness);
kdr = (kdr + (red * diff));
kdg = (kdg + (green * diff));
kdb = (kdb + (blue * diff));
rfz = (dfz - ((2 * nf) * nz));
if (rfz < 0){
} else {
rfx = (dfx - ((2 * nf) * nx));
rfy = (dfy - ((2 * nf) * ny));
spec = ((directional.specular * Math.pow(rfz, ak)) * specular_brightness);
ksr = (ksr + (red * spec));
ksg = (ksg + (green * spec));
ksb = (ksb + (blue * spec));
};
};
};
for each (point in session.lightarray.points) {
red = point.red;
green = point.green;
blue = point.blue;
dfx = (point.x - c0x);
dfy = (point.y - c0y);
dfz = (point.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 = ((point.ambient * fade) * ambient_brightness);
kar = (kar + (red * amb));
kag = (kag + (green * amb));
kab = (kab + (blue * amb));
nf = (((dfx * pa) + (dfy * pb)) + (dfz * pc));
if (nf < 0){
} else {
diff = (((point.diffuse * fade) * nf) * diffuse_brightness);
kdr = (kdr + (red * diff));
kdg = (kdg + (green * diff));
kdb = (kdb + (blue * diff));
rfz = (dfz - ((2 * nf) * pc));
if (rfz < 0){
} else {
rfx = (dfx - ((2 * nf) * pa));
rfy = (dfy - ((2 * nf) * pb));
spec = (((point.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 (point in session.lightarray.points) {
red = point.red;
green = point.green;
blue = point.blue;
sum = (((red + green) + blue) / 0xFF);
red = (red / sum);
green = (green / sum);
blue = (blue / sum);
dfx = (point.x - c0x);
dfy = (point.y - c0y);
dfz = (point.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.materials
Section 94
//ColorMaterial (away3d.materials.ColorMaterial)
package away3d.materials {
import away3d.core.draw.*;
import away3d.core.utils.*;
public class ColorMaterial implements ITriangleMaterial, IFogMaterial {
public var color:uint;
protected var ini:Init;
private var _alpha:Number;
public function ColorMaterial(_arg1=null, _arg2:Object=null){
if (_arg1 == null){
_arg1 = "random";
};
this.color = Cast.trycolor(_arg1);
ini = Init.parse(_arg2);
_alpha = ini.getNumber("alpha", 1, {min:0, max:1});
}
public function set alpha(_arg1:Number):void{
_alpha = _arg1;
}
public function renderFog(_arg1:DrawFog):void{
_arg1.source.session.renderFogColor(color, _alpha);
}
public function get visible():Boolean{
return ((alpha > 0));
}
public function renderTriangle(_arg1:DrawTriangle):void{
_arg1.source.session.renderTriangleColor(color, _alpha, _arg1.v0, _arg1.v1, _arg1.v2);
}
public function clone():IFogMaterial{
return (new ColorMaterial(color, {alpha:alpha}));
}
public function get alpha():Number{
return (_alpha);
}
}
}//package away3d.materials
Section 95
//CompositeMaterial (away3d.materials.CompositeMaterial)
package away3d.materials {
import flash.display.*;
import flash.geom.*;
import away3d.core.draw.*;
import away3d.core.base.*;
import away3d.containers.*;
import away3d.core.utils.*;
import away3d.core.render.*;
import flash.utils.*;
public class CompositeMaterial implements ITriangleMaterial, IUpdatingMaterial, ILayerMaterial {
private var _green:Number;
var _colorTransformDirty:Boolean;
private var _red:Number;
var _session:AbstractRenderSession;
var _spriteDictionary:Dictionary;
public var blendMode:String;
var _alpha:Number;
var _color:uint;
private var material:ILayerMaterial;
var _colorTransform:ColorTransform;
var _sprite:Sprite;
public var materials:Array;
private var _defaultColorTransform:ColorTransform;
private var _blue:Number;
var _source:Object3D;
protected var ini:Init;
public function CompositeMaterial(_arg1:Object=null){
_colorTransform = new ColorTransform();
_spriteDictionary = new Dictionary(true);
_defaultColorTransform = new ColorTransform();
super();
ini = Init.parse(_arg1);
materials = ini.getArray("materials");
blendMode = ini.getString("blendMode", BlendMode.NORMAL);
alpha = ini.getNumber("alpha", 1, {min:0, max:1});
color = ini.getColor("color", 0xFFFFFF);
_colorTransformDirty = true;
}
public function set alpha(_arg1:Number):void{
if (_arg1 > 1){
_arg1 = 1;
};
if (_arg1 < 0){
_arg1 = 0;
};
if (_alpha == _arg1){
return;
};
_alpha = _arg1;
_colorTransformDirty = true;
}
public function renderTriangle(_arg1:DrawTriangle):void{
_source = _arg1.source;
_session = _source.session;
var _local2:int;
if (_session != _session.view.session){
if (!(_sprite = _session.spriteLayers[_local2])){
_sprite = (_session.spriteLayers[_local2] = new Sprite());
};
} else {
if (!(_sprite = _spriteDictionary[_arg1.face])){
_sprite = (_spriteDictionary[_arg1.face] = new Sprite());
};
};
if (!_session.children[_sprite]){
if (_session != _session.view.session){
_session.addLayerObject(_sprite);
} else {
_session.addDisplayObject(_sprite);
};
_sprite.filters = [];
_sprite.blendMode = blendMode;
if (_colorTransform){
_sprite.transform.colorTransform = _colorTransform;
} else {
_sprite.transform.colorTransform = _defaultColorTransform;
};
};
for each (material in materials) {
++_local2;
material.renderLayer(_arg1, _sprite, _local2);
};
}
public function set color(_arg1:uint):void{
if (_color == _arg1){
return;
};
_color = _arg1;
_red = (((_color & 0xFF0000) >> 16) / 0xFF);
_green = (((_color & 0xFF00) >> 8) / 0xFF);
_blue = ((_color & 0xFF) / 0xFF);
_colorTransformDirty = true;
}
protected function setColorTransform():void{
_colorTransformDirty = false;
if ((((_alpha == 1)) && ((_color == 0xFFFFFF)))){
_colorTransform = null;
return;
};
if (!_colorTransform){
_colorTransform = new ColorTransform();
};
_colorTransform.redMultiplier = _red;
_colorTransform.greenMultiplier = _green;
_colorTransform.blueMultiplier = _blue;
_colorTransform.alphaMultiplier = _alpha;
}
public function renderFace(_arg1:Face, _arg2:Rectangle, _arg3:FaceVO):FaceVO{
throw (new Error("Not implemented"));
}
public function get alpha():Number{
return (_alpha);
}
public function renderLayer(_arg1:DrawTriangle, _arg2:Sprite, _arg3:int):void{
if (((!(_colorTransform)) && ((blendMode == BlendMode.NORMAL)))){
_sprite = _arg2;
} else {
_source = _arg1.source;
_session = _source.session;
if (_session != _session.view.session){
if (!(_sprite = _session.spriteLayers[_arg3])){
_arg2.addChild((_sprite = (_session.spriteLayers[_arg3] = new Sprite())));
};
} else {
if (!(_sprite = _spriteDictionary[_arg1.face])){
_arg2.addChild((_sprite = (_spriteDictionary[_arg1.face] = new Sprite())));
};
};
_sprite.filters = [];
_sprite.blendMode = blendMode;
if (_colorTransform){
_sprite.transform.colorTransform = _colorTransform;
} else {
_sprite.transform.colorTransform = _defaultColorTransform;
};
};
for each (material in materials) {
var _temp1 = _arg3;
_arg3 = (_arg3 + 1);
material.renderLayer(_arg1, _sprite, _temp1);
};
}
public function get color():uint{
return (_color);
}
private function clearSpriteDictionary():void{
for each (_sprite in _spriteDictionary) {
_sprite.graphics.clear();
};
}
public function get visible():Boolean{
return (true);
}
public function updateMaterial(_arg1:Object3D, _arg2:View3D):void{
clearSpriteDictionary();
if (_colorTransformDirty){
setColorTransform();
};
for each (material in materials) {
if ((material is IUpdatingMaterial)){
(material as IUpdatingMaterial).updateMaterial(_arg1, _arg2);
};
};
}
}
}//package away3d.materials
Section 96
//IFogMaterial (away3d.materials.IFogMaterial)
package away3d.materials {
import away3d.core.draw.*;
public interface IFogMaterial extends ITriangleMaterial {
function renderFog(_arg1:DrawFog):void;
function set alpha(_arg1:Number):void;
function clone():IFogMaterial;
function get alpha():Number;
}
}//package away3d.materials
Section 97
//ILayerMaterial (away3d.materials.ILayerMaterial)
package away3d.materials {
import flash.display.*;
import flash.geom.*;
import away3d.core.draw.*;
import away3d.core.base.*;
import away3d.core.utils.*;
public interface ILayerMaterial extends IMaterial {
function renderLayer(_arg1:DrawTriangle, _arg2:Sprite, _arg3:int):void;
function renderFace(_arg1:Face, _arg2:Rectangle, _arg3:FaceVO):FaceVO;
}
}//package away3d.materials
Section 98
//IMaterial (away3d.materials.IMaterial)
package away3d.materials {
public interface IMaterial {
function get visible():Boolean;
}
}//package away3d.materials
Section 99
//ISegmentMaterial (away3d.materials.ISegmentMaterial)
package away3d.materials {
import away3d.core.draw.*;
public interface ISegmentMaterial extends IMaterial {
function renderSegment(_arg1:DrawSegment):void;
}
}//package away3d.materials
Section 100
//ITriangleMaterial (away3d.materials.ITriangleMaterial)
package away3d.materials {
import away3d.core.draw.*;
public interface ITriangleMaterial extends IMaterial {
function renderTriangle(_arg1:DrawTriangle):void;
}
}//package away3d.materials
Section 101
//IUpdatingMaterial (away3d.materials.IUpdatingMaterial)
package away3d.materials {
import away3d.core.base.*;
import away3d.containers.*;
public interface IUpdatingMaterial {
function updateMaterial(_arg1:Object3D, _arg2:View3D):void;
}
}//package away3d.materials
Section 102
//IUVMaterial (away3d.materials.IUVMaterial)
package away3d.materials {
import flash.display.*;
public interface IUVMaterial extends IMaterial {
function addOnResize(_arg1:Function):void;
function getPixel32(_arg1:Number, _arg2:Number):uint;
function removeOnResize(_arg1:Function):void;
function get width():Number;
function get height():Number;
function get bitmap():BitmapData;
}
}//package away3d.materials
Section 103
//MovieMaterial (away3d.materials.MovieMaterial)
package away3d.materials {
import flash.display.*;
import flash.geom.*;
import away3d.core.base.*;
import away3d.containers.*;
import away3d.core.utils.*;
import away3d.events.*;
public class MovieMaterial extends TransformBitmapMaterial implements ITriangleMaterial, IUVMaterial {
private var _lastsession:int;
public var movie:Sprite;
public var transparent:Boolean;
public var autoUpdate:Boolean;
public var interactive:Boolean;
private var _bMode:String;
private var _colTransform:ColorTransform;
private var t:Matrix;
private var x:Number;
private var y:Number;
public function MovieMaterial(_arg1:Sprite, _arg2:Object=null){
this.movie = _arg1;
ini = Init.parse(_arg2);
transparent = ini.getBoolean("transparent", true);
autoUpdate = ini.getBoolean("autoUpdate", true);
interactive = ini.getBoolean("interactive", false);
_bitmap = new BitmapData(_arg1.width, _arg1.height, transparent, 0);
super(_bitmap, ini);
}
override public function get width():Number{
return (_renderBitmap.width);
}
public function update():void{
if (transparent){
_renderBitmap.fillRect(_renderBitmap.rect, 0);
};
if (((!((_alpha == 1))) || (!((_color == 0xFFFFFF))))){
_colTransform = _colorTransform;
} else {
_colTransform = movie.transform.colorTransform;
};
if (_blendMode != BlendMode.NORMAL){
_bMode = _blendMode;
} else {
_bMode = movie.blendMode;
};
_renderBitmap.draw(movie, new Matrix(movie.scaleX, 0, 0, movie.scaleY), _colTransform, _bMode, _renderBitmap.rect);
}
override protected function updateRenderBitmap():void{
}
override public function updateMaterial(_arg1:Object3D, _arg2:View3D):void{
super.updateMaterial(_arg1, _arg2);
if (autoUpdate){
update();
};
_session = _arg1.session;
if (interactive){
if (!_session.view._interactiveLayer.contains(movie)){
_session.view._interactiveLayer.addChild(movie);
resetInteractiveLayer();
_arg1.addOnMouseOver(onMouseOver);
_arg1.addOnMouseOut(onMouseOut);
};
} else {
if (_session.view._interactiveLayer.contains(movie)){
_session.view._interactiveLayer.removeChild(movie);
_arg1.removeOnMouseOver(onMouseOver);
_arg1.removeOnMouseOut(onMouseOut);
};
};
}
override public function get height():Number{
return (_renderBitmap.height);
}
private function onMouseOut(_arg1:MouseEvent3D):void{
if (_arg1.material == this){
_arg1.object.removeOnMouseMove(onMouseMove);
resetInteractiveLayer();
};
}
private function onMouseMove(_arg1:MouseEvent3D):void{
x = (_arg1.uv.u * _renderBitmap.width);
y = ((1 - _arg1.uv.v) * _renderBitmap.height);
if (_transform){
t = _transform.clone();
t.invert();
movie.x = (((_arg1.screenX - (x * t.a)) - (y * t.c)) - t.tx);
movie.y = (((_arg1.screenY - (x * t.b)) - (y * t.d)) - t.ty);
} else {
movie.x = (_arg1.screenX - x);
movie.y = (_arg1.screenY - y);
};
}
private function onMouseOver(_arg1:MouseEvent3D):void{
if (_arg1.material == this){
_arg1.object.addOnMouseMove(onMouseMove);
onMouseMove(_arg1);
};
}
private function resetInteractiveLayer():void{
movie.x = -10000;
movie.y = -10000;
}
}
}//package away3d.materials
Section 104
//ShadingColorMaterial (away3d.materials.ShadingColorMaterial)
package away3d.materials {
import away3d.core.draw.*;
import away3d.core.utils.*;
import away3d.core.render.*;
public class ShadingColorMaterial extends CenterLightingMaterial {
private var fg:int;
public var specular:int;
public var cache:Boolean;
private var fr:int;
private var fb:int;
public var ambient:int;
public var alpha:Number;
public var diffuse:int;
private var sfb:int;
private var sfg:int;
private var sfr:int;
public function ShadingColorMaterial(_arg1=null, _arg2:Object=null){
if (_arg1 == null){
_arg1 = "random";
};
_arg1 = Cast.trycolor(_arg1);
super(_arg2);
ambient = ini.getColor("ambient", _arg1);
diffuse = ini.getColor("diffuse", _arg1);
specular = ini.getColor("specular", _arg1);
alpha = ini.getNumber("alpha", 1);
cache = ini.getBoolean("cache", false);
}
override public function get visible():Boolean{
return (true);
}
override protected function renderTri(_arg1:DrawTriangle, _arg2:AbstractRenderSession, _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 (cache){
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));
};
};
}
}
}//package away3d.materials
Section 105
//TransformBitmapMaterial (away3d.materials.TransformBitmapMaterial)
package away3d.materials {
import flash.display.*;
import flash.geom.*;
import away3d.core.draw.*;
import away3d.core.base.*;
import away3d.containers.*;
import away3d.core.utils.*;
import away3d.core.math.*;
public class TransformBitmapMaterial extends BitmapMaterial implements ITriangleMaterial, IUVMaterial {
private var _u0:Number;
private var _u1:Number;
private var _invtexturemapping:Matrix;
private var _u2:Number;
private var line:Point;
private var _v0:Number;
private var _v1:Number;
private var _v2:Number;
private var v0x:Number;
private var v0y:Number;
private var v0z:Number;
private var overlap:Boolean;
private var dot:Number;
private var normalR:Number3D;
private var face:Face;
private var v1y:Number;
private var v1z:Number;
private var v1x:Number;
private var h:Number;
private var i:String;
private var flag:Boolean;
private var _scaleX:Number;// = 1
private var _scaleY:Number;// = 1
private var mPoint2:Point;
private var mPoint3:Point;
private var mPoint4:Point;
private var t:Matrix;
private var _throughProjection:Boolean;
private var w:Number;
private var x:Number;
private var y:Number;
private var v0:Number3D;
private var v1:Number3D;
private var v2y:Number;
private var v2z:Number;
private var v2x:Number;
private var _projectionDirty:Boolean;
private var mapa:Number;
private var mapb:Number;
private var mapc:Number;
private var mapd:Number;
private var v2:Number3D;
private var mPoint1:Point;
private var point:Point;
private var point1:Point;
private var point3:Point;
private var fPoint1:Point;
private var fPoint2:Point;
private var DOWN:Number3D;
private var fPoint4:Point;
private var zero:Number;
private var fPoint3:Point;
private var _globalProjection:Boolean;
private var sign:Number;
private var point2:Point;
private var _N:Number3D;
private var _projectionVector:Number3D;
private var _M:Number3D;
private var _rotation:Number;// = 0
private var maptx:Number;
private var mapty:Number;
private var _transformDirty:Boolean;
private var _offsetX:Number;// = 0
private var _offsetY:Number;// = 0
var _transform:Matrix;
private var RIGHT:Number3D;
public function TransformBitmapMaterial(_arg1:BitmapData, _arg2:Object=null){
_transform = new Matrix();
_N = new Number3D();
_M = new Number3D();
DOWN = new Number3D(0, -1, 0);
RIGHT = new Number3D(1, 0, 0);
normalR = new Number3D();
v0 = new Number3D();
v1 = new Number3D();
v2 = new Number3D();
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);
transform = (ini.getObject("transform", Matrix) as Matrix);
scaleX = ini.getNumber("scaleX", _scaleX);
scaleY = ini.getNumber("scaleY", _scaleY);
offsetX = ini.getNumber("offsetX", _offsetX);
offsetY = ini.getNumber("offsetY", _offsetY);
rotation = ini.getNumber("rotation", _rotation);
projectionVector = (ini.getObject("projectionVector", Number3D) as Number3D);
throughProjection = ini.getBoolean("throughProjection", true);
globalProjection = ini.getBoolean("globalProjection", false);
}
public function set throughProjection(_arg1:Boolean):void{
_throughProjection = _arg1;
_projectionDirty = true;
}
private 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, _arg3:FaceVO):FaceVO{
if (_transform){
_mapping = _transform.clone();
} else {
_mapping = new Matrix();
};
if (!_projectionVector){
renderSource(_arg1.parent, _arg2, _mapping);
};
_faceVO = _faceDictionary[_arg1];
if (!_faceVO){
_faceVO = (_faceDictionary[_arg1] = new FaceVO());
};
if (_arg3.resized){
_arg3.resized = false;
_faceVO.resized = true;
};
if (((_arg3.updated) || (_faceVO.invalidated))){
_arg3.updated = false;
_bitmapRect = _arg1.bitmapRect;
if (_faceVO.invalidated){
_faceVO.invalidated = false;
} else {
_faceVO.updated = true;
};
_faceVO.bitmap = _arg3.bitmap;
if (_projectionVector){
_invtexturemapping = _arg1._dt.invtexturemapping;
_mapping.concat(projectUV(_arg1._dt));
_mapping.concat(_invtexturemapping);
if (((((throughProjection) || ((_arg1.normal.dot(_projectionVector) >= 0)))) && (((repeat) || (!(findSeparatingAxis(getFacePoints(_invtexturemapping), getMappingPoints(_mapping)))))))){
if (_faceVO.cleared){
_faceVO.bitmap = _arg3.bitmap.clone();
};
_faceVO.cleared = false;
_faceVO.updated = true;
_graphics = _s.graphics;
_graphics.clear();
_graphics.beginBitmapFill(_bitmap, _mapping, repeat, smooth);
_graphics.drawRect(0, 0, _bitmapRect.width, _bitmapRect.height);
_graphics.endFill();
_faceVO.bitmap.draw(_s, null, _colorTransform, _blendMode, _faceVO.bitmap.rect);
};
} else {
if (((repeat) && (!(findSeparatingAxis(getContainerPoints(_arg2), getMappingPoints(_mapping)))))){
_faceVO.cleared = false;
_faceVO.updated = true;
_faceVO.bitmap.copyPixels(_sourceVO.bitmap, _bitmapRect, _zeroPoint, null, null, true);
};
};
};
return (_faceVO);
}
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;
_transformDirty = true;
}
override public function updateMaterial(_arg1:Object3D, _arg2:View3D):void{
_graphics = null;
clearShapeDictionary();
if (((((((_transformDirty) || (_projectionDirty))) || (_colorTransformDirty))) || (_blendModeDirty))){
clearFaceDictionary();
};
if (_colorTransformDirty){
setColorTransform();
};
if (_transformDirty){
updateTransform();
};
_projectionDirty = false;
_blendModeDirty = false;
}
public function get throughProjection():Boolean{
return (_throughProjection);
}
public function get offsetY():Number{
return (_offsetY);
}
public function get offsetX():Number{
return (_offsetX);
}
override public function getPixel32(_arg1:Number, _arg2:Number):uint{
x = (_arg1 * _bitmap.width);
y = ((1 - _arg2) * _bitmap.height);
if (_transform){
t = _transform.clone();
t.invert();
return (_bitmap.getPixel32((((x * t.a) + (y * t.c)) + t.tx), (((x * t.b) + (y * t.d)) + t.ty)));
};
return (_bitmap.getPixel32(x, y));
}
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;
_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;
_transformDirty = true;
}
public function get scaleY():Number{
return (_scaleY);
}
public function get scaleX():Number{
return (_scaleX);
}
public function get globalProjection():Boolean{
return (_globalProjection);
}
public function get projectionVector():Number3D{
return (_projectionVector);
}
public function get transform():Matrix{
return (_transform);
}
private function projectUV(_arg1:DrawTriangle):Matrix{
face = _arg1.face;
if (globalProjection){
if (_arg1.backface){
v0.transform(face.v0.position, _arg1.source.sceneTransform);
v2.transform(face.v1.position, _arg1.source.sceneTransform);
v1.transform(face.v2.position, _arg1.source.sceneTransform);
} else {
v0.transform(face.v0.position, _arg1.source.sceneTransform);
v1.transform(face.v1.position, _arg1.source.sceneTransform);
v2.transform(face.v2.position, _arg1.source.sceneTransform);
};
} else {
if (_arg1.backface){
v0 = face.v0.position;
v2 = face.v1.position;
v1 = face.v2.position;
} else {
v0 = face.v0.position;
v1 = face.v1.position;
v2 = face.v2.position;
};
};
v0x = v0.x;
v0y = v0.y;
v0z = v0.z;
v1x = v1.x;
v1y = v1.y;
v1z = v1.z;
v2x = v2.x;
v2y = v2.y;
v2z = 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);
}
private function getContainerPoints(_arg1:Rectangle):Array{
return ([_arg1.topLeft, new Point(_arg1.top, _arg1.right), _arg1.bottomRight, new Point(_arg1.bottom, _arg1.left)]);
}
override protected function getMapping(_arg1:DrawTriangle):Matrix{
_faceVO = _faceDictionary[(face = _arg1.face)];
if (!_faceVO){
_faceVO = (_faceDictionary[face] = new FaceVO());
};
if (((((_faceVO.invalidated) || (!(_arg1.texturemapping)))) || (!((_faceVO.backface == _arg1.backface))))){
_faceVO.invalidated = false;
_faceVO.backface = _arg1.backface;
if (projectionVector){
_faceVO.mapping = projectUV(_arg1);
} else {
if (!_arg1.texturemapping){
_faceVO.mapping = _arg1.transformUV(this);
} else {
_faceVO.mapping = _arg1.texturemapping;
};
};
if (_transform){
_mapping = _transform.clone();
_mapping.concat(_faceVO.mapping);
return ((_faceVO.mapping = _mapping));
};
};
return (_faceVO.mapping);
}
private 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]);
}
private 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 get rotation():Number{
return (_rotation);
}
public function set globalProjection(_arg1:Boolean):void{
_globalProjection = _arg1;
_projectionDirty = true;
}
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;
_transformDirty = true;
}
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;
_transformDirty = true;
}
private 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;
}
override public function renderTriangle(_arg1:DrawTriangle):void{
if (((_projectionVector) && (!(throughProjection)))){
if (globalProjection){
normalR.rotate(_arg1.face.normal, _arg1.source.sceneTransform);
if (normalR.dot(_projectionVector) < 0){
return;
};
} else {
if (_arg1.face.normal.dot(_projectionVector) < 0){
return;
};
};
};
super.renderTriangle(_arg1);
}
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();
};
_projectionDirty = true;
}
private 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);
}
}
}//package away3d.materials
Section 106
//WhiteShadingBitmapMaterial (away3d.materials.WhiteShadingBitmapMaterial)
package away3d.materials {
import flash.display.*;
import flash.geom.*;
import away3d.core.draw.*;
import away3d.core.utils.*;
import away3d.core.render.*;
import away3d.events.*;
import flash.utils.*;
import flash.filters.*;
public class WhiteShadingBitmapMaterial extends CenterLightingMaterial implements IUVMaterial {
private var colorTransform:ColorMatrixFilter;
private var step:int;// = 1
private var _bitmap:BitmapData;
private var br:Number;
private var cache:Dictionary;
private var blackrender:Boolean;
public var repeat:Boolean;
private var mapping:Matrix;
private var bitmapPoint:Point;
private var whitek:Number;// = 0.2
public var smooth:Boolean;
private var whiterender:Boolean;
public function WhiteShadingBitmapMaterial(_arg1:BitmapData, _arg2:Object=null){
bitmapPoint = new Point(0, 0);
colorTransform = new ColorMatrixFilter();
_bitmap = _arg1;
super(_arg2);
smooth = ini.getBoolean("smooth", false);
repeat = ini.getBoolean("repeat", false);
if (!CacheStore.whiteShadingCache[_bitmap]){
CacheStore.whiteShadingCache[_bitmap] = new Dictionary(true);
};
cache = CacheStore.whiteShadingCache[_bitmap];
}
public function get width():Number{
return (_bitmap.width);
}
public function removeOnResize(_arg1:Function):void{
removeEventListener(MaterialEvent.RESIZED, _arg1, false);
}
public function doubleStepTo(_arg1:int):void{
if (step < _arg1){
step = (step * 2);
};
}
public function get height():Number{
return (_bitmap.height);
}
public function getPixel32(_arg1:Number, _arg2:Number):uint{
return (_bitmap.getPixel32((_arg1 * _bitmap.width), ((1 - _arg2) * _bitmap.height)));
}
private 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)));
}
public function get bitmap():BitmapData{
return (_bitmap);
}
override public function get visible():Boolean{
return (true);
}
public function addOnResize(_arg1:Function):void{
addEventListener(MaterialEvent.RESIZED, _arg1, false, 0, true);
}
override protected function renderTri(_arg1:DrawTriangle, _arg2:AbstractRenderSession, _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) / (0xFF * 3));
if (!(mapping = _arg1.texturemapping)){
mapping = _arg1.transformUV(this);
};
v0 = _arg1.v0;
v1 = _arg1.v1;
v2 = _arg1.v2;
if ((((br < 1)) && (((blackrender) || ((((step < 16)) && (!(_bitmap.transparent)))))))){
_arg2.renderTriangleBitmap(_bitmap, mapping, v0, v1, v2, smooth, repeat);
_arg2.renderTriangleColor(0, (1 - br), v0, v1, v2);
} else {
if ((((br > 1)) && (whiterender))){
_arg2.renderTriangleBitmap(_bitmap, 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(_bitmap.width, _bitmap.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(_bitmap, _local13.rect, bitmapPoint, colorTransform);
cache[_local12] = _local13;
};
_arg2.renderTriangleBitmap(_local13, mapping, v0, v1, v2, smooth, repeat);
};
};
}
}
}//package away3d.materials
Section 107
//WireColorMaterial (away3d.materials.WireColorMaterial)
package away3d.materials {
import away3d.core.draw.*;
import away3d.core.utils.*;
public class WireColorMaterial implements ITriangleMaterial {
public var color:int;
protected var ini:Init;
public var alpha:Number;
public var width:Number;
public var wirealpha:Number;
public var wirecolor:int;
public function WireColorMaterial(_arg1=null, _arg2:Object=null){
if (_arg1 == null){
_arg1 = "random";
};
this.color = Cast.trycolor(_arg1);
ini = Init.parse(_arg2);
alpha = ini.getNumber("alpha", 1, {min:0, max:1});
wirecolor = ini.getColor("wirecolor", 0);
width = ini.getNumber("width", 1, {min:0});
wirealpha = ini.getNumber("wirealpha", 1, {min:0, max:1});
}
public function get visible():Boolean{
return ((((alpha > 0)) || ((wirealpha > 0))));
}
public function renderTriangle(_arg1:DrawTriangle):void{
_arg1.source.session.renderTriangleLineFill(width, color, alpha, wirecolor, wirealpha, _arg1.v0, _arg1.v1, _arg1.v2);
}
}
}//package away3d.materials
Section 108
//WireframeMaterial (away3d.materials.WireframeMaterial)
package away3d.materials {
import away3d.core.draw.*;
import away3d.core.utils.*;
public class WireframeMaterial implements ITriangleMaterial, ISegmentMaterial {
public var color:int;
protected var ini:Init;
public var alpha:Number;
public var width:Number;
public function WireframeMaterial(_arg1=null, _arg2:Object=null){
if (_arg1 == null){
_arg1 = "random";
};
this.color = Cast.trycolor(_arg1);
ini = Init.parse(_arg2);
alpha = ini.getNumber("alpha", 1, {min:0, max:1});
width = ini.getNumber("width", 1, {min:0});
}
public function get visible():Boolean{
return ((alpha > 0));
}
public function renderSegment(_arg1:DrawSegment):void{
if (alpha <= 0){
return;
};
_arg1.source.session.renderLine(_arg1.v0, _arg1.v1, width, color, alpha);
}
public function renderTriangle(_arg1:DrawTriangle):void{
if (alpha <= 0){
return;
};
_arg1.source.session.renderTriangleLine(width, color, alpha, _arg1.v0, _arg1.v1, _arg1.v2);
}
}
}//package away3d.materials
Section 109
//CubeMaterialsData (away3d.primitives.data.CubeMaterialsData)
package away3d.primitives.data {
import flash.events.*;
import away3d.core.utils.*;
import away3d.events.*;
import away3d.materials.*;
public class CubeMaterialsData extends EventDispatcher {
private var _back:ITriangleMaterial;
private var _bottom:ITriangleMaterial;
private var _top:ITriangleMaterial;
protected var ini:Init;
private var _left:ITriangleMaterial;
private var _front:ITriangleMaterial;
private var _materialchanged:MaterialEvent;
private var _right:ITriangleMaterial;
public function CubeMaterialsData(_arg1:Object=null){
ini = Init.parse(_arg1);
_left = ini.getMaterial("left");
_right = ini.getMaterial("right");
_bottom = ini.getMaterial("bottom");
_top = ini.getMaterial("top");
_front = ini.getMaterial("front");
_back = ini.getMaterial("back");
}
public function get left():ITriangleMaterial{
return (_left);
}
public function set left(_arg1:ITriangleMaterial):void{
if (_left == _arg1){
return;
};
_left = _arg1;
notifyMaterialChange(_left, "left");
}
public function set front(_arg1:ITriangleMaterial):void{
if (_front == _arg1){
return;
};
_front = _arg1;
notifyMaterialChange(_front, "front");
}
public function get top():ITriangleMaterial{
return (_top);
}
public function set bottom(_arg1:ITriangleMaterial):void{
if (_bottom == _arg1){
return;
};
_bottom = _arg1;
notifyMaterialChange(_bottom, "bottom");
}
public function removeOnMaterialChange(_arg1:Function):void{
removeEventListener(MaterialEvent.CHANGED, _arg1, false);
}
public function get right():ITriangleMaterial{
return (_right);
}
private function notifyMaterialChange(_arg1:ITriangleMaterial, _arg2:String):void{
if (!hasEventListener(MaterialEvent.CHANGED)){
return;
};
_materialchanged = new MaterialEvent(MaterialEvent.CHANGED, _arg1);
_materialchanged.extra = _arg2;
dispatchEvent(_materialchanged);
}
public function get back():ITriangleMaterial{
return (_back);
}
public function get front():ITriangleMaterial{
return (_front);
}
public function get bottom():ITriangleMaterial{
return (_bottom);
}
public function set back(_arg1:ITriangleMaterial):void{
if (_back == _arg1){
return;
};
_back = _arg1;
notifyMaterialChange(_back, "back");
}
public function set top(_arg1:ITriangleMaterial):void{
if (_top == _arg1){
return;
};
_top = _arg1;
notifyMaterialChange(_top, "top");
}
public function addOnMaterialChange(_arg1:Function):void{
addEventListener(MaterialEvent.CHANGED, _arg1, false, 0, false);
}
public function set right(_arg1:ITriangleMaterial):void{
if (_right == _arg1){
return;
};
_right = _arg1;
notifyMaterialChange(_right, "right");
}
}
}//package away3d.primitives.data
Section 110
//AbstractPrimitive (away3d.primitives.AbstractPrimitive)
package away3d.primitives {
import away3d.core.base.*;
import away3d.core.math.*;
import away3d.materials.*;
public class AbstractPrimitive extends Mesh {
var _uv:UV;
var _uvStore:Array;
var _faceStore:Array;
var _primitiveDirty:Boolean;
var _faceActive:Array;
var _vActive:Array;
var _uvActive:Array;
var _vStore:Array;
var _v:Vertex;
var _face:Face;
public function AbstractPrimitive(_arg1:Object=null){
_vStore = new Array();
_vActive = new Array();
_uvStore = new Array();
_uvActive = new Array();
_faceStore = new Array();
_faceActive = new Array();
super(_arg1);
}
override public function get sceneTransform():Matrix3D{
if (_primitiveDirty){
buildPrimitive();
};
return (super.sceneTransform);
}
function createVertex(_arg1:Number=0, _arg2:Number=0, _arg3:Number=0):Vertex{
if (_vStore.length){
_vActive.push((_v = _vStore.pop()));
_v.x = _arg1;
_v.y = _arg2;
_v.z = _arg3;
} else {
_vActive.push((_v = new Vertex(_arg1, _arg2, _arg3)));
};
return (_v);
}
public function buildPrimitive():void{
_primitiveDirty = false;
for each (_face in faces) {
removeFace(_face);
};
_vStore = _vStore.concat(_vActive);
_vActive = new Array();
_uvStore = _uvStore.concat(_uvActive);
_uvActive = new Array();
_faceStore = _faceStore.concat(_faceActive);
_faceActive = new Array();
}
function createUV(_arg1:Number=0, _arg2:Number=0):UV{
if (_uvStore.length){
_uvActive.push((_uv = _uvStore.pop()));
_uv.u = _arg1;
_uv.v = _arg2;
} else {
_uvActive.push((_uv = new UV(_arg1, _arg2)));
};
return (_uv);
}
function createFace(_arg1:Vertex, _arg2:Vertex, _arg3:Vertex, _arg4:ITriangleMaterial=null, _arg5:UV=null, _arg6:UV=null, _arg7:UV=null):Face{
if (_faceStore.length){
_faceActive.push((_face = _faceStore.pop()));
_face.v0 = _arg1;
_face.v1 = _arg2;
_face.v2 = _arg3;
_face.material = _arg4;
_face.uv0 = _arg5;
_face.uv1 = _arg6;
_face.uv2 = _arg7;
} else {
_faceActive.push((_face = new Face(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7)));
};
return (_face);
}
}
}//package away3d.primitives
Section 111
//AbstractWirePrimitive (away3d.primitives.AbstractWirePrimitive)
package away3d.primitives {
import away3d.core.base.*;
import away3d.core.math.*;
import away3d.materials.*;
public class AbstractWirePrimitive extends WireMesh {
var _segment:Segment;
var _vStore:Array;
var _segmentStore:Array;
var _primitiveDirty:Boolean;
var _v:Vertex;
var _segmentActive:Array;
var _vActive:Array;
public function AbstractWirePrimitive(_arg1:Object=null){
_vStore = new Array();
_vActive = new Array();
_segmentStore = new Array();
_segmentActive = new Array();
super(_arg1);
}
function createVertex(_arg1:Number=0, _arg2:Number=0, _arg3:Number=0):Vertex{
if (_vStore.length){
_vActive.push((_v = _vStore.pop()));
_v.x = _arg1;
_v.y = _arg2;
_v.z = _arg3;
} else {
_vActive.push((_v = new Vertex(_arg1, _arg2, _arg3)));
};
return (_v);
}
override public function get sceneTransform():Matrix3D{
if (_primitiveDirty){
buildPrimitive();
};
return (super.sceneTransform);
}
public function buildPrimitive():void{
_primitiveDirty = false;
for each (_segment in segments) {
removeSegment(_segment);
};
_vStore = _vStore.concat(_vActive);
_vActive = new Array();
_segmentStore = _segmentStore.concat(_segmentActive);
_segmentActive = new Array();
}
function createSegment(_arg1:Vertex, _arg2:Vertex, _arg3:ISegmentMaterial=null):Segment{
if (_segmentStore.length){
_segmentActive.push((_segment = _segmentStore.pop()));
_segment.v0 = _arg1;
_segment.v1 = _arg2;
_segment.material = _arg3;
} else {
_segmentActive.push((_segment = new Segment(_arg1, _arg2, _arg3)));
};
return (_segment);
}
}
}//package away3d.primitives
Section 112
//Cube (away3d.primitives.Cube)
package away3d.primitives {
import away3d.core.base.*;
import away3d.events.*;
import away3d.materials.*;
import away3d.primitives.data.*;
public class Cube extends AbstractPrimitive {
private var _depth:Number;
private var _height:Number;
private var _width:Number;
private var _vmax:Number;
private var _cubeFaceArray:Array;
private var _cubeFace:Face;
private var _bottomFaces:Array;
private var _backFaces:Array;
private var _topFaces:Array;
private var _rightFaces:Array;
private var _umin:Number;
private var _frontFaces:Array;
private var _umax:Number;
private var _leftFaces:Array;
private var _cubeMaterials:CubeMaterialsData;
private var _vmin:Number;
public function Cube(_arg1:Object=null){
_leftFaces = [];
_rightFaces = [];
_bottomFaces = [];
_topFaces = [];
_frontFaces = [];
_backFaces = [];
super(_arg1);
_width = ini.getNumber("width", 100, {min:0});
_height = ini.getNumber("height", 100, {min:0});
_depth = ini.getNumber("depth", 100, {min:0});
_umin = ini.getNumber("umin", 0, {min:0, max:1});
_umax = ini.getNumber("umax", 1, {min:0, max:1});
_vmin = ini.getNumber("vmin", 0, {min:0, max:1});
_vmax = ini.getNumber("vmax", 1, {min:0, max:1});
_cubeMaterials = ini.getCubeMaterials("faces");
if (!_cubeMaterials){
_cubeMaterials = ini.getCubeMaterials("cubeMaterials");
};
if (!_cubeMaterials){
_cubeMaterials = new CubeMaterialsData();
};
_cubeMaterials.addOnMaterialChange(onCubeMaterialChange);
buildCube(_width, _height, _depth);
type = "Cube";
url = "primitive";
}
private function buildCube(_arg1:Number, _arg2:Number, _arg3:Number):void{
var _local4:Vertex = createVertex((-(_arg1) / 2), (-(_arg2) / 2), (-(_arg3) / 2));
var _local5:Vertex = createVertex((-(_arg1) / 2), (-(_arg2) / 2), (_arg3 / 2));
var _local6:Vertex = createVertex((-(_arg1) / 2), (_arg2 / 2), (-(_arg3) / 2));
var _local7:Vertex = createVertex((-(_arg1) / 2), (_arg2 / 2), (_arg3 / 2));
var _local8:Vertex = createVertex((_arg1 / 2), (-(_arg2) / 2), (-(_arg3) / 2));
var _local9:Vertex = createVertex((_arg1 / 2), (-(_arg2) / 2), (_arg3 / 2));
var _local10:Vertex = createVertex((_arg1 / 2), (_arg2 / 2), (-(_arg3) / 2));
var _local11:Vertex = createVertex((_arg1 / 2), (_arg2 / 2), (_arg3 / 2));
var _local12:UV = createUV(_umax, _vmax);
var _local13:UV = createUV(_umin, _vmax);
var _local14:UV = createUV(_umin, _vmin);
var _local15:UV = createUV(_umax, _vmin);
addFace((_leftFaces[0] = createFace(_local4, _local6, _local5, _cubeMaterials.left, _local15, _local12, _local14)));
addFace((_leftFaces[1] = createFace(_local6, _local7, _local5, _cubeMaterials.left, _local12, _local13, _local14)));
addFace((_rightFaces[0] = createFace(_local8, _local9, _local10, _cubeMaterials.right, _local14, _local15, _local13)));
addFace((_rightFaces[1] = createFace(_local10, _local9, _local11, _cubeMaterials.right, _local13, _local15, _local12)));
addFace((_bottomFaces[0] = createFace(_local4, _local5, _local8, _cubeMaterials.bottom, _local13, _local14, _local12)));
addFace((_bottomFaces[1] = createFace(_local5, _local9, _local8, _cubeMaterials.bottom, _local14, _local15, _local12)));
addFace((_topFaces[0] = createFace(_local6, _local10, _local7, _cubeMaterials.top, _local14, _local15, _local13)));
addFace((_topFaces[1] = createFace(_local7, _local10, _local11, _cubeMaterials.top, _local13, _local15, _local12)));
addFace((_frontFaces[0] = createFace(_local4, _local8, _local6, _cubeMaterials.front, _local14, _local15, _local13)));
addFace((_frontFaces[1] = createFace(_local8, _local10, _local6, _cubeMaterials.front, _local15, _local12, _local13)));
addFace((_backFaces[0] = createFace(_local5, _local7, _local9, _cubeMaterials.back, _local15, _local12, _local14)));
addFace((_backFaces[1] = createFace(_local9, _local7, _local11, _cubeMaterials.back, _local14, _local12, _local13)));
}
public function get height():Number{
return (_height);
}
public function get depth():Number{
return (_depth);
}
private function onCubeMaterialChange(_arg1:MaterialEvent):void{
switch (_arg1.extra){
case "left":
_cubeFaceArray = _leftFaces;
break;
case "right":
_cubeFaceArray = _rightFaces;
break;
case "bottom":
_cubeFaceArray = _bottomFaces;
break;
case "top":
_cubeFaceArray = _topFaces;
break;
case "front":
_cubeFaceArray = _frontFaces;
break;
case "back":
_cubeFaceArray = _backFaces;
break;
default:
trace(("ERROR:" + _arg1.extra));
break;
};
for each (_cubeFace in _cubeFaceArray) {
_cubeFace.material = (_arg1.material as ITriangleMaterial);
};
}
public function get width():Number{
return (_width);
}
public function set width(_arg1:Number):void{
if (_width == _arg1){
return;
};
_width = _arg1;
_primitiveDirty = true;
}
public function set height(_arg1:Number):void{
if (_height == _arg1){
return;
};
_height = _arg1;
_primitiveDirty = true;
}
public function set depth(_arg1:Number):void{
if (_depth == _arg1){
return;
};
_depth = _arg1;
_primitiveDirty = true;
}
override public function buildPrimitive():void{
super.buildPrimitive();
buildCube(_width, _height, _depth);
}
public function set cubeMaterials(_arg1:CubeMaterialsData):void{
if (_cubeMaterials == _arg1){
return;
};
if (_cubeMaterials){
_cubeMaterials.addOnMaterialChange(onCubeMaterialChange);
};
_cubeMaterials = _arg1;
_cubeMaterials.addOnMaterialChange(onCubeMaterialChange);
}
public function get cubeMaterials():CubeMaterialsData{
return (_cubeMaterials);
}
}
}//package away3d.primitives
Section 113
//Cylinder (away3d.primitives.Cylinder)
package away3d.primitives {
import away3d.core.base.*;
public class Cylinder extends AbstractPrimitive {
private var grid:Array;
private var jMin:int;
private var _height:Number;
private var _openEnded:Boolean;
private var jMax:int;
private var _segmentsH:int;
private var _radius:Number;
private var _yUp:Boolean;
private var _segmentsW:int;
public function Cylinder(_arg1:Object=null){
super(_arg1);
_radius = ini.getNumber("radius", 100, {min:0});
_height = ini.getNumber("height", 200, {min:0});
_segmentsW = ini.getInt("segmentsW", 8, {min:3});
_segmentsH = ini.getInt("segmentsH", 1, {min:1});
_openEnded = ini.getBoolean("openEnded", false);
_yUp = ini.getBoolean("yUp", true);
buildCylinder(_radius, _height, _segmentsW, _segmentsH, _openEnded, _yUp);
type = "Cylinder";
url = "primitive";
}
public function set height(_arg1:Number):void{
if (_height == _arg1){
return;
};
_height = _arg1;
_primitiveDirty = true;
}
public function set segmentsH(_arg1:Number):void{
if (_segmentsH == _arg1){
return;
};
_segmentsH = _arg1;
_primitiveDirty = true;
}
public function get radius():Number{
return (_radius);
}
public function get openEnded():Boolean{
return (_openEnded);
}
public function set openEnded(_arg1:Boolean):void{
if (_openEnded == _arg1){
return;
};
_openEnded = _arg1;
_primitiveDirty = true;
}
private function buildCylinder(_arg1:Number, _arg2:Number, _arg3:int, _arg4:int, _arg5:Boolean, _arg6:Boolean):void{
var _local7:int;
var _local8:int;
var _local9:Vertex;
var _local10:Vertex;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Vertex;
var _local16:Vertex;
var _local17:Vertex;
var _local18:Vertex;
var _local19:int;
var _local20:Number;
var _local21:Number;
var _local22:Number;
var _local23:Number;
var _local24:UV;
var _local25:UV;
var _local26:UV;
var _local27:UV;
_arg2 = (_arg2 / 2);
grid = new Array();
if (!_arg5){
_arg4 = (_arg4 + 2);
jMin = 1;
jMax = (_arg4 - 1);
_local9 = (_arg6) ? createVertex(0, -(_arg2), 0) : createVertex(0, 0, -(_arg2));
grid[0] = new Array(_arg3);
_local7 = 0;
while (_local7 < _arg3) {
grid[0][_local7] = _local9;
_local7++;
};
_local10 = (_arg6) ? createVertex(0, _arg2, 0) : createVertex(0, 0, _arg2);
grid[_arg4] = new Array(_arg3);
_local7 = 0;
while (_local7 < _arg3) {
grid[_arg4][_local7] = _local10;
_local7++;
};
} else {
jMin = 0;
jMax = _arg4;
};
_local8 = jMin;
while (_local8 <= jMax) {
_local11 = (-(_arg2) + (((2 * _arg2) * (_local8 - 1)) / (_arg4 - 2)));
grid[_local8] = new Array(_arg3);
_local7 = 0;
while (_local7 < _arg3) {
_local12 = (((2 * _local7) / _arg3) * Math.PI);
_local13 = (_arg1 * Math.sin(_local12));
_local14 = (_arg1 * Math.cos(_local12));
if (_arg6){
grid[_local8][_local7] = createVertex(_local14, _local11, _local13);
} else {
grid[_local8][_local7] = createVertex(_local14, -(_local13), _local11);
};
_local7++;
};
_local8++;
};
_local8 = 1;
while (_local8 <= _arg4) {
_local7 = 0;
while (_local7 < _arg3) {
_local15 = grid[_local8][_local7];
_local16 = grid[_local8][(((_local7 - 1) + _arg3) % _arg3)];
_local17 = grid[(_local8 - 1)][(((_local7 - 1) + _arg3) % _arg3)];
_local18 = grid[(_local8 - 1)][_local7];
_local19 = _local7;
if (_local7 == 0){
_local19 = _arg3;
};
_local20 = (_local8 / _arg4);
_local21 = ((_local8 - 1) / _arg4);
_local22 = (_local19 / _arg3);
_local23 = ((_local19 - 1) / _arg3);
_local24 = createUV(_local22, _local20);
_local25 = createUV(_local23, _local20);
_local26 = createUV(_local23, _local21);
_local27 = createUV(_local22, _local21);
if (_local8 <= jMax){
addFace(createFace(_local15, _local16, _local17, null, _local24, _local25, _local26));
};
if (_local8 > jMin){
addFace(createFace(_local15, _local17, _local18, null, _local24, _local26, _local27));
};
_local7++;
};
_local8++;
};
}
public function get height():Number{
return (_height);
}
public function get segmentsH():Number{
return (_segmentsH);
}
public function set radius(_arg1:Number):void{
if (_radius == _arg1){
return;
};
_radius = _arg1;
_primitiveDirty = true;
}
override public function buildPrimitive():void{
super.buildPrimitive();
buildCylinder(_radius, _height, _segmentsW, _segmentsH, _openEnded, _yUp);
}
public function set segmentsW(_arg1:Number):void{
if (_segmentsW == _arg1){
return;
};
_segmentsW = _arg1;
_primitiveDirty = true;
}
public function set yUp(_arg1:Boolean):void{
if (_yUp == _arg1){
return;
};
_yUp = _arg1;
_primitiveDirty = true;
}
public function get yUp():Boolean{
return (_yUp);
}
public function vertex(_arg1:int, _arg2:int):Vertex{
return (grid[_arg2][_arg1]);
}
public function get segmentsW():Number{
return (_segmentsW);
}
}
}//package away3d.primitives
Section 114
//GridPlane (away3d.primitives.GridPlane)
package away3d.primitives {
public class GridPlane extends AbstractWirePrimitive {
private var _width:Number;
private var _segmentsH:int;
private var _height:Number;
private var _yUp:Boolean;
private var _segmentsW:int;
public function GridPlane(_arg1:Object=null){
super(_arg1);
_width = ini.getNumber("width", 100, {min:0});
_height = ini.getNumber("height", 100, {min:0});
var _local2:int = ini.getInt("segments", 1, {min:1});
_segmentsW = ini.getInt("segmentsW", _local2, {min:1});
_segmentsH = ini.getInt("segmentsH", _local2, {min:1});
_yUp = ini.getBoolean("yUp", true);
buildPlane(_width, _height, _segmentsW, _segmentsH, _yUp);
type = "GridPlane";
url = "primitive";
}
public function get yUp():Boolean{
return (_yUp);
}
public function get width():Number{
return (_width);
}
public function get segmentsH():Number{
return (_segmentsH);
}
private function buildPlane(_arg1:Number, _arg2:Number, _arg3:int, _arg4:int, _arg5:Boolean):void{
var _local6:int;
var _local7:int;
if (_arg5){
_local6 = 0;
while (_local6 <= _arg3) {
addSegment(createSegment(createVertex((((_local6 / _arg3) - 0.5) * _arg1), 0, (-0.5 * _arg2)), createVertex((((_local6 / _arg3) - 0.5) * _arg1), 0, (0.5 * _arg2))));
_local6++;
};
_local7 = 0;
while (_local7 <= _arg4) {
addSegment(createSegment(createVertex((-0.5 * _arg1), 0, (((_local7 / _arg4) - 0.5) * _arg2)), createVertex((0.5 * _arg1), 0, (((_local7 / _arg4) - 0.5) * _arg2))));
_local7++;
};
} else {
_local6 = 0;
while (_local6 <= _arg3) {
addSegment(createSegment(createVertex((((_local6 / _arg3) - 0.5) * _arg1), (-0.5 * _arg2), 0), createVertex((((_local6 / _arg3) - 0.5) * _arg1), (0.5 * _arg2), 0)));
_local6++;
};
_local7 = 0;
while (_local7 <= _arg4) {
addSegment(createSegment(createVertex((-0.5 * _arg1), (((_local7 / _arg4) - 0.5) * _arg2), 0), createVertex((0.5 * _arg1), (((_local7 / _arg4) - 0.5) * _arg2), 0)));
_local7++;
};
};
}
public function set yUp(_arg1:Boolean):void{
if (_yUp == _arg1){
return;
};
_yUp = _arg1;
_primitiveDirty = true;
}
public function set width(_arg1:Number):void{
if (_width == _arg1){
return;
};
_width = _arg1;
_primitiveDirty = true;
}
public function set segmentsW(_arg1:Number):void{
if (_segmentsW == _arg1){
return;
};
_segmentsW = _arg1;
_primitiveDirty = true;
}
public function get height():Number{
return (_height);
}
public function get segmentsW():Number{
return (_segmentsW);
}
override public function buildPrimitive():void{
super.buildPrimitive();
buildPlane(_width, _height, _segmentsW, _segmentsH, _yUp);
}
public function set height(_arg1:Number):void{
if (_height == _arg1){
return;
};
_height = _arg1;
_primitiveDirty = true;
}
public function set segmentsH(_arg1:Number):void{
if (_segmentsH == _arg1){
return;
};
_segmentsH = _arg1;
_primitiveDirty = true;
}
}
}//package away3d.primitives
Section 115
//Skybox (away3d.primitives.Skybox)
package away3d.primitives {
import away3d.core.base.*;
import away3d.materials.*;
public class Skybox extends Mesh {
public function Skybox(_arg1:ITriangleMaterial, _arg2:ITriangleMaterial, _arg3:ITriangleMaterial, _arg4:ITriangleMaterial, _arg5:ITriangleMaterial, _arg6:ITriangleMaterial){
var _local7:Number = 800000;
var _local8:Number = 800000;
var _local9:Number = 800000;
var _local10:Vertex = new Vertex((-(_local7) / 2), (-(_local8) / 2), (-(_local9) / 2));
var _local11:Vertex = new Vertex((-(_local7) / 2), (-(_local8) / 2), (_local9 / 2));
var _local12:Vertex = new Vertex((-(_local7) / 2), (_local8 / 2), (-(_local9) / 2));
var _local13:Vertex = new Vertex((-(_local7) / 2), (_local8 / 2), (_local9 / 2));
var _local14:Vertex = new Vertex((_local7 / 2), (-(_local8) / 2), (-(_local9) / 2));
var _local15:Vertex = new Vertex((_local7 / 2), (-(_local8) / 2), (_local9 / 2));
var _local16:Vertex = new Vertex((_local7 / 2), (_local8 / 2), (-(_local9) / 2));
var _local17:Vertex = new Vertex((_local7 / 2), (_local8 / 2), (_local9 / 2));
var _local18:UV = new UV(1, 0);
var _local19:UV = new UV(0, 0);
var _local20:UV = new UV(0, 1);
var _local21:UV = new UV(1, 1);
addFace(new Face(_local10, _local11, _local12, _arg3, _local18, _local19, _local21));
addFace(new Face(_local12, _local11, _local13, _arg3, _local21, _local19, _local20));
addFace(new Face(_local14, _local16, _local15, _arg1, _local19, _local20, _local18));
addFace(new Face(_local16, _local17, _local15, _arg1, _local20, _local21, _local18));
addFace(new Face(_local10, _local14, _local11, _arg6, _local19, _local20, _local18));
addFace(new Face(_local11, _local14, _local15, _arg6, _local18, _local20, _local21));
addFace(new Face(_local12, _local13, _local16, _arg5, _local20, _local21, _local19));
addFace(new Face(_local13, _local17, _local16, _arg5, _local21, _local18, _local19));
addFace(new Face(_local10, _local12, _local14, _arg2, _local19, _local20, _local18));
addFace(new Face(_local14, _local12, _local16, _arg2, _local18, _local20, _local21));
addFace(new Face(_local13, _local11, _local15, _arg4, _local21, _local18, _local19));
addFace(new Face(_local13, _local15, _local17, _arg4, _local21, _local19, _local20));
quarterFaces();
quarterFaces();
mouseEnabled = false;
type = "Skybox";
url = "primitive";
}
}
}//package away3d.primitives
Section 116
//Sphere (away3d.primitives.Sphere)
package away3d.primitives {
import away3d.core.base.*;
public class Sphere extends AbstractPrimitive {
private var grid:Array;
private var _segmentsH:int;
private var _radius:Number;
private var _yUp:Boolean;
private var _segmentsW:int;
public function Sphere(_arg1:Object=null){
super(_arg1);
_radius = ini.getNumber("radius", 100, {min:0});
_segmentsW = ini.getInt("segmentsW", 8, {min:3});
_segmentsH = ini.getInt("segmentsH", 6, {min:2});
_yUp = ini.getBoolean("yUp", true);
buildSphere(_radius, _segmentsW, _segmentsH, _yUp);
type = "Sphere";
url = "primitive";
}
override public function buildPrimitive():void{
super.buildPrimitive();
buildSphere(_radius, _segmentsW, _segmentsH, _yUp);
}
public function set radius(_arg1:Number):void{
if (_radius == _arg1){
return;
};
_radius = _arg1;
_primitiveDirty = true;
}
public function get segmentsH():Number{
return (_segmentsH);
}
public function vertex(_arg1:int, _arg2:int):Vertex{
return (grid[_arg2][_arg1]);
}
public function set segmentsW(_arg1:Number):void{
if (_segmentsW == _arg1){
return;
};
_segmentsW = _arg1;
_primitiveDirty = true;
}
public function set yUp(_arg1:Boolean):void{
if (_yUp == _arg1){
return;
};
_yUp = _arg1;
_primitiveDirty = true;
}
public function get radius():Number{
return (_radius);
}
public function get yUp():Boolean{
return (_yUp);
}
public function get segmentsW():Number{
return (_segmentsW);
}
private function buildSphere(_arg1:Number, _arg2:int, _arg3:int, _arg4:Boolean):void{
var _local5:int;
var _local6:int;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Vertex;
var _local16:Vertex;
var _local17:Vertex;
var _local18:Vertex;
var _local19:int;
var _local20:Number;
var _local21:Number;
var _local22:Number;
var _local23:Number;
var _local24:UV;
var _local25:UV;
var _local26:UV;
var _local27:UV;
grid = new Array((_arg3 + 1));
var _local7:Vertex = (_arg4) ? createVertex(0, -(_arg1), 0) : createVertex(0, 0, -(_arg1));
grid[0] = new Array(_arg2);
_local5 = 0;
while (_local5 < _arg2) {
grid[0][_local5] = _local7;
_local5++;
};
_local6 = 1;
while (_local6 < _arg3) {
_local9 = ((_local6 / _arg3) * Math.PI);
_local10 = (-(_arg1) * Math.cos(_local9));
_local11 = (_arg1 * Math.sin(_local9));
grid[_local6] = new Array(_arg2);
_local5 = 0;
while (_local5 < _arg2) {
_local12 = (((2 * _local5) / _arg2) * Math.PI);
_local13 = (_local11 * Math.sin(_local12));
_local14 = (_local11 * Math.cos(_local12));
if (_arg4){
grid[_local6][_local5] = createVertex(_local14, _local10, _local13);
} else {
grid[_local6][_local5] = createVertex(_local14, -(_local13), _local10);
};
_local5++;
};
_local6++;
};
var _local8:Vertex = (_arg4) ? createVertex(0, _arg1, 0) : createVertex(0, 0, _arg1);
grid[_arg3] = new Array(_arg2);
_local5 = 0;
while (_local5 < _arg2) {
grid[_arg3][_local5] = _local8;
_local5++;
};
_local6 = 1;
while (_local6 <= _arg3) {
_local5 = 0;
while (_local5 < _arg2) {
_local15 = grid[_local6][_local5];
_local16 = grid[_local6][(((_local5 - 1) + _arg2) % _arg2)];
_local17 = grid[(_local6 - 1)][(((_local5 - 1) + _arg2) % _arg2)];
_local18 = grid[(_local6 - 1)][_local5];
_local19 = _local5;
if (_local5 == 0){
_local19 = _arg2;
};
_local20 = (_local6 / _arg3);
_local21 = ((_local6 - 1) / _arg3);
_local22 = (_local19 / _arg2);
_local23 = ((_local19 - 1) / _arg2);
_local24 = createUV(_local22, _local20);
_local25 = createUV(_local23, _local20);
_local26 = createUV(_local23, _local21);
_local27 = createUV(_local22, _local21);
if (_local6 < _arg3){
addFace(createFace(_local15, _local16, _local17, null, _local24, _local25, _local26));
};
if (_local6 > 1){
addFace(createFace(_local15, _local17, _local18, null, _local24, _local26, _local27));
};
_local5++;
};
_local6++;
};
}
public function set segmentsH(_arg1:Number):void{
if (_segmentsH == _arg1){
return;
};
_segmentsH = _arg1;
_primitiveDirty = true;
}
}
}//package away3d.primitives
Section 117
//WireCube (away3d.primitives.WireCube)
package away3d.primitives {
import away3d.core.base.*;
public class WireCube extends AbstractWirePrimitive {
public var v001:Vertex;
private var _depth:Number;
private var _height:Number;
private var _width:Number;
public var v010:Vertex;
public var v011:Vertex;
public var v111:Vertex;
public var v110:Vertex;
public var v000:Vertex;
public var v100:Vertex;
public var v101:Vertex;
public function WireCube(_arg1:Object=null){
super(_arg1);
_width = ini.getNumber("width", 100, {min:0});
_height = ini.getNumber("height", 100, {min:0});
_depth = ini.getNumber("depth", 100, {min:0});
buildWireCube(_width, _height, _depth);
type = "WireCube";
url = "primitive";
}
public function get depth():Number{
return (_depth);
}
public function get width():Number{
return (_width);
}
public function set width(_arg1:Number):void{
if (_width == _arg1){
return;
};
_width = _arg1;
_primitiveDirty = true;
}
public function set height(_arg1:Number):void{
if (_height == _arg1){
return;
};
_height = _arg1;
_primitiveDirty = true;
}
public function set depth(_arg1:Number):void{
if (_depth == _arg1){
return;
};
_depth = _arg1;
_primitiveDirty = true;
}
override public function buildPrimitive():void{
super.buildPrimitive();
buildWireCube(_width, _height, _depth);
}
public function get height():Number{
return (_height);
}
private function buildWireCube(_arg1:Number, _arg2:Number, _arg3:Number):void{
v000 = createVertex((-(_arg1) / 2), (-(_arg2) / 2), (-(_arg3) / 2));
v001 = createVertex((-(_arg1) / 2), (-(_arg2) / 2), (_arg3 / 2));
v010 = createVertex((-(_arg1) / 2), (_arg2 / 2), (-(_arg3) / 2));
v011 = createVertex((-(_arg1) / 2), (_arg2 / 2), (_arg3 / 2));
v100 = createVertex((_arg1 / 2), (-(_arg2) / 2), (-(_arg3) / 2));
v101 = createVertex((_arg1 / 2), (-(_arg2) / 2), (_arg3 / 2));
v110 = createVertex((_arg1 / 2), (_arg2 / 2), (-(_arg3) / 2));
v111 = createVertex((_arg1 / 2), (_arg2 / 2), (_arg3 / 2));
addSegment(createSegment(v000, v001));
addSegment(createSegment(v011, v001));
addSegment(createSegment(v011, v010));
addSegment(createSegment(v000, v010));
addSegment(createSegment(v100, v000));
addSegment(createSegment(v101, v001));
addSegment(createSegment(v111, v011));
addSegment(createSegment(v110, v010));
addSegment(createSegment(v100, v101));
addSegment(createSegment(v111, v101));
addSegment(createSegment(v111, v110));
addSegment(createSegment(v100, v110));
}
}
}//package away3d.primitives
Section 118
//DofSprite2D (away3d.sprites.DofSprite2D)
package away3d.sprites {
import flash.display.*;
import away3d.core.draw.*;
import away3d.core.base.*;
import away3d.core.utils.*;
import away3d.core.render.*;
public class DofSprite2D extends Object3D implements IPrimitiveProvider {
public var deltaZ:Number;
private var _dofcache:DofCache;
private var _sc:ScreenVertex;
private var _primitive:DrawScaledBitmap;
public var rotation:Number;
public var scaling:Number;
public var bitmap:BitmapData;
private var _center:Vertex;
private var _persp:Number;
public var smooth:Boolean;
public function DofSprite2D(_arg1:BitmapData, _arg2:Object=null){
_center = new Vertex();
_primitive = new DrawScaledBitmap();
this.bitmap = _arg1;
super(_arg2);
scaling = ini.getNumber("scaling", 1, {min:0});
rotation = ini.getNumber("rotation", 0);
smooth = ini.getBoolean("smooth", false);
deltaZ = ini.getNumber("deltaZ", 0);
_dofcache = DofCache.getDofCache(_arg1);
_primitive.source = this;
}
override public function primitives(_arg1:IPrimitiveConsumer, _arg2:AbstractRenderSession):void{
super.primitives(_arg1, _arg2);
_sc = _center.project(projection);
if (!_sc.visible){
return;
};
_persp = (projection.zoom / (1 + (_sc.z / projection.focus)));
_sc.z = (_sc.z + deltaZ);
_primitive.screenvertex = _sc;
_primitive.smooth = smooth;
_primitive.bitmap = _dofcache.getBitmap(_sc.z);
_primitive.scale = (_persp * scaling);
_primitive.rotation = rotation;
_primitive.calc();
_arg1.primitive(_primitive);
}
}
}//package away3d.sprites
Section 119
//Sprite2D (away3d.sprites.Sprite2D)
package away3d.sprites {
import flash.display.*;
import away3d.core.draw.*;
import away3d.core.base.*;
import away3d.core.render.*;
public class Sprite2D extends Object3D implements IPrimitiveProvider {
public var deltaZ:Number;
private var rescale:Boolean;
public var scaling:Number;
private var _primitive:DrawScaledBitmap;
public var rotation:Number;
public var bitmap:BitmapData;
private var _sc:ScreenVertex;
private var _center:Vertex;
public var smooth:Boolean;
private var _persp:Number;
public function Sprite2D(_arg1:BitmapData, _arg2:Object=null){
_center = new Vertex();
_primitive = new DrawScaledBitmap();
this.bitmap = _arg1;
super(_arg2);
scaling = ini.getNumber("scaling", 1, {min:0});
rotation = ini.getNumber("rotation", 0);
smooth = ini.getBoolean("smooth", false);
deltaZ = ini.getNumber("deltaZ", 0);
rescale = ini.getBoolean("rescale", true);
_primitive.source = this;
}
override public function primitives(_arg1:IPrimitiveConsumer, _arg2:AbstractRenderSession):void{
super.primitives(_arg1, _arg2);
_sc = _center.project(projection);
if (!_sc.visible){
return;
};
_persp = (projection.zoom / (1 + (_sc.z / projection.focus)));
_sc.z = (_sc.z + deltaZ);
_primitive.screenvertex = _sc;
_primitive.smooth = smooth;
_primitive.bitmap = bitmap;
if (rescale){
_primitive.scale = (_persp * scaling);
} else {
_primitive.scale = scaling;
};
_primitive.rotation = rotation;
_primitive.calc();
_arg1.primitive(_primitive);
}
}
}//package away3d.sprites
Section 120
//GreetsPlayerEffect (effects.bitmap.GreetsPlayerEffect)
package effects.bitmap {
import evo.engine.*;
import flash.display.*;
import flash.geom.*;
import flash.text.*;
import effects.*;
import effects.meshParticles.*;
public class GreetsPlayerEffect extends AbstractDemoEffect {
private var out:BitmapData;
private var dtc:int;// = 0
private var pos:int;// = 0
private var offset:int;// = 0
private var mat:Matrix;
private var map:BitmapData;
private var texts:Array;
private var imageIndex:int;// = 0
private var part:BasicParticle;
private var rtexts:Array;
public static var D3Curve:Class = GreetsPlayerEffect_D3Curve;
public function GreetsPlayerEffect(){
part = new BasicParticle(16);
texts = ["", "", "", "", "", "Traction", "trilobit", "Byterapers", "foobug", "Kewlers", "pyrotech", "MFX", "Fairlight", "Farbrausch", "TBL", "ASD", "Conspiracy", "xplsv", "Dekadence", "aspekt", "Matt Current", "tvt", "Jumalauta", "tAAt", "#flash.fi"];
rtexts = new Array();
mat = new Matrix();
super();
}
override public function play(_arg1:Number):void{
var _local4:BitmapData;
var _local5:int;
var _local6:Number;
dtc = (dtc + _arg1);
map.lock();
map.fillRect(map.rect, 0);
mat.identity();
mat.translate(-(offset), 0);
var _local2:int = imageIndex;
while ((((mat.tx < map.width)) && ((_local2 < rtexts.length)))) {
_local4 = rtexts[_local2];
if (-(mat.tx) > (_local4.width / 2)){
imageIndex++;
};
map.draw(_local4, mat);
mat.translate(((_local4.width / 2) + 22), 0);
_local2++;
};
imageIndex = 0;
offset = (offset + ((_arg1 / 8) * 1.1));
map.unlock();
var _local3:int;
while (_local3 < 16) {
_local5 = 0;
while (_local5 < 50) {
mat.identity();
mat.translate(0, 0);
_local6 = (((map.getPixel((_local5 * 2), (_local3 * 2)) & 0xFF) / 0xFF) * 1);
mat.scale(_local6, _local6);
mat.translate((_local5 * 16), (((50 + ((_local3 * (Math.sin(((dtc * 0.003) + (_local5 * 0.03))) + 3)) * 4)) + 8) + (Math.sin(((dtc * 0.003) + (_local5 * 0.03))) * 50)));
if (_local6 < 1){
output.draw(part, mat, null, BlendMode.SUBTRACT);
} else {
output.draw(part, mat, null, BlendMode.ADD);
};
_local5++;
};
_local3++;
};
}
override public function init(_arg1:Object=null):void{
var _local2:TextFormat = new TextFormat("DDPetit08", (32 * 4), 0xFFFFFF, true);
var _local3:int;
while (_local3 < texts.length) {
rtexts.push(new TextRender(texts[_local3], _local2, 1).bitmapData);
_local3++;
};
map = new BitmapData(100, 32, false, 0);
}
}
}//package effects.bitmap
Section 121
//GreetsPlayerEffect_D3Curve (effects.bitmap.GreetsPlayerEffect_D3Curve)
package effects.bitmap {
import mx.core.*;
public class GreetsPlayerEffect_D3Curve extends FontAsset {
}
}//package effects.bitmap
Section 122
//MandelBrotEffect (effects.bitmap.MandelBrotEffect)
package effects.bitmap {
import evo.engine.*;
import flash.display.*;
import flash.geom.*;
import flash.utils.*;
public class MandelBrotEffect extends AbstractDemoEffect {
private var xAdd:int;// = 0
private var WTH:int;// = 100
private var smat:Matrix;
private var colorFact:Number;
private var htht:int;
private var pal:BitmapData;
private var invzoommat:Matrix;
private var nomore:Boolean;// = false
private var mtc:Number;
private var mtd:Number;
private var zrsq:Number;
private var rotmat:Matrix;
private var mtb:Number;
private var zoommat:Matrix;
private var pixelDone:Boolean;// = true
private var mbBMP:BitmapData;
private var mta:Number;
private var zr:Number;
private var HTH:int;// = 100
private var zi:Number;
private var wtht:int;
private var realTime:uint;
private var rx:int;
private var mbTest:BitmapData;
private var zisq:Number;
private var ry:int;
private var maxCycles:int;// = 128
private var mincycle:int;
private var mbPreBMP:BitmapData;
private var planeRot:Number;// = 0
private var precalcpos:Point;
private var fpsTime:uint;
public var zoomFact:Number;// = 1.076
private var ci:Number;
private var yAdd:int;// = 0
private var cnt:int;// = 0
private var mttx:Number;
private var mtty:Number;
private var cr:Number;
public var rotateAngle:Number;// = 0.055
private var tmat:Matrix;
private var wthto:int;
private var curIter:uint;// = 0
private var hthto:int;
public var palette:Array;
public function MandelBrotEffect(){
smat = new Matrix();
zoommat = new Matrix();
rotmat = new Matrix();
invzoommat = new Matrix();
precalcpos = new Point();
colorFact = (0x0100 / maxCycles);
wtht = ((WTH / 2) - 16);
htht = ((HTH / 2) - 16);
wthto = (WTH / 2);
hthto = (HTH / 2);
tmat = new Matrix();
super();
}
public function makeZoom():void{
zoommat.identity();
zoommat.scale((1 / zoomFact), (1 / zoomFact));
var _local1:Matrix = zoommat.clone();
_local1.invert();
invzoommat.identity();
invzoommat.translate(-((WTH / 2)), -((HTH / 2)));
invzoommat.rotate(rotateAngle);
invzoommat.translate((WTH / 2), (HTH / 2));
var _local2:Number = ((WTH / 2) + 1.1666666666666);
var _local3:Number = ((HTH / 2) + 1.1666666666666);
var _local4:Point = _local1.transformPoint(new Point(_local2, _local3));
invzoommat.scale(zoomFact, zoomFact);
invzoommat.translate((_local2 - _local4.x), (_local3 - _local4.y));
smat.identity();
smat.scale((1 / (WTH / 8)), (1 / (HTH / 8)));
}
public function toString():String{
return ("[Effect:Mandelbrot zoomer]");
}
override public function play(_arg1:Number):void{
var _local3:Matrix;
var _local5:int;
var _local2:uint = (getTimer() + (1000 / 30));
mbPreBMP.lock();
mbBMP.lock();
realTime = (realTime + _arg1);
while (fpsTime < realTime) {
mbPreBMP.draw(mbBMP, invzoommat, null, null, null, true);
rotmat.rotate(rotateAngle);
smat.concat(zoommat);
if ((realTime - fpsTime) > 33){
mbBMP.draw(mbPreBMP);
};
fpsTime = (fpsTime + 33);
};
_local3 = rotmat.clone();
_local3.concat(smat);
mta = _local3.a;
mtb = _local3.b;
mtc = _local3.c;
mtd = _local3.d;
mttx = _local3.tx;
mtty = _local3.ty;
var _local4:uint = maxCycles;
var _local6:uint;
var _local7:int;
while (true) {
cr = ((((rx * mta) + (ry * mtb)) + mttx) - 0.779643581309873);
ci = ((((rx * mtc) + (ry * mtd)) + mtty) - 0.149432992000352);
zrsq = (zisq = 0);
zr = (zi = 0);
_local5 = 0;
while (_local5 < _local4) {
zi = (((zr * zi) * 2) + ci);
zr = ((zrsq - zisq) + cr);
zrsq = (zr * zr);
zisq = (zi * zi);
if ((zrsq + zisq) > 900000){
break;
};
_local5++;
};
mbPreBMP.setPixel((rx + wthto), (ry + hthto), palette[(_local5 * 2)]);
if (rx > wtht){
xAdd = (xAdd ^ 1);
rx = (-(wtht) + xAdd);
if (ry > htht){
yAdd = (yAdd ^ 1);
ry = (-(htht) + yAdd);
} else {
ry = (ry + 2);
};
} else {
rx = (rx + 2);
};
if (((((_local7 % 32) == 0)) && ((getTimer() > _local2)))){
break;
};
_local7++;
};
mbPreBMP.unlock();
mbBMP.draw(mbPreBMP);
mbBMP.unlock();
output.draw(mbBMP);
output.draw(mbBMP, tmat);
}
override public function init(_arg1:Object=null):void{
var _local4:int;
mbBMP = new BitmapData(WTH, HTH, false, 0x110000);
mbPreBMP = new BitmapData(WTH, HTH, false, 0x110000);
mbTest = new BitmapData(WTH, HTH, false, 0x110000);
rotmat = new Matrix();
precalcpos = new Point(0, 0);
palette = new Array();
var _local2:BitmapData = new Assets.MandelTexture().bitmapData;
var _local3:int;
while (_local3 < 0x0100) {
_local4 = _local2.getPixel32((_local3 % 90), 16);
palette[_local3] = _local4;
_local3++;
};
tmat.translate(100, 0);
reset();
makeZoom();
}
public function precalc():void{
}
public function reset():void{
if (smat.a > 2E-12){
smat.d = (smat.a = (smat.a * 2));
} else {
smat.identity();
smat.scale((1 / (WTH / 8)), (1 / (HTH / 8)));
};
rx = -(wtht);
ry = -(htht);
xAdd = (yAdd = 0);
fpsTime = (realTime = 0);
}
}
}//package effects.bitmap
Section 123
//VoxelCamera (effects.bitmap.VoxelCamera)
package effects.bitmap {
public class VoxelCamera {
public var z:Number;
public var direction:Number;
public var fov:Number;// = 0.392699081698724
private var width:int;
public var y:Number;
public var xoffs:Array;
public var yoffs:Array;
public var x:Number;
public function VoxelCamera(_arg1:int, _arg2:Number=0, _arg3:Number=0, _arg4:Number=0){
this.x = _arg2;
this.y = _arg3;
this.z = _arg4;
this.width = _arg1;
xoffs = new Array(_arg1);
yoffs = new Array(_arg1);
setDirection(0);
}
public function getInRads():Number{
return (((direction / 180) * Math.PI));
}
public function setDirection(_arg1:Number):void{
var _local4:Number;
this.direction = _arg1;
var _local2:Number = getInRads();
var _local3:int;
while (_local3 < width) {
_local4 = ((_local2 - (fov / 2)) + ((_local3 / width) * fov));
xoffs[_local3] = Math.sin(_local4);
yoffs[_local3] = Math.cos(_local4);
_local3++;
};
}
}
}//package effects.bitmap
Section 124
//VoxelMapEffect (effects.bitmap.VoxelMapEffect)
package effects.bitmap {
import evo.engine.*;
import flash.display.*;
import flash.geom.*;
import flash.filters.*;
public class VoxelMapEffect extends AbstractDemoEffect {
private var mat:Matrix;
private var pt:Point;
private var offsets:Array;
private var WTH:int;// = 200
private var maph:int;// = 0x0800
private var mapUpdateCount:int;// = 0
private var MINDIST:int;// = 45
private var hMap:BitmapData;
private var hMap2:BitmapData;
public var lava:BitmapData;
private var mapw:int;// = 0x0800
private var camera:VoxelCamera;
private var imat:Matrix;
private var cnt:int;// = 0
private var MAXDIST:int;// = 350
private var blur:BlurFilter;
private var dRect:Rectangle;
private var mbBMP:BitmapData;
private var ct:ColorTransform;
private var palette:Array;
private var HTH:int;// = 100
public function VoxelMapEffect(){
lava = new Assets.VoxelLava().bitmapData;
pt = new Point();
dRect = new Rectangle(0, 0, 1, 0);
offsets = [new Point(), new Point()];
blur = new BlurFilter(2, 2, 1);
mat = new Matrix();
ct = new ColorTransform();
imat = new Matrix();
super();
}
override public function init(_arg1:Object=null):void{
var _local3:int;
mbBMP = new BitmapData(WTH, HTH, true, 0);
hMap = new BitmapData(mapw, maph, false, 0);
hMap2 = new BitmapData(mapw, maph, false, 0);
camera = new VoxelCamera(WTH, ((mapw / 2) - 0x0200), (maph / 2), 0);
palette = new Array();
var _local2:int;
while (_local2 < 0x0100) {
_local3 = (_local2 * 1.5);
palette[_local2] = (((_local3 << 16) + (_local3 << 8)) + _local3);
_local2++;
};
hMap.perlinNoise(64, 64, 2, 2034293, false, true, 7, true, offsets);
hMap2.perlinNoise(64, 64, 2, 134293, false, true, 7, true, offsets);
}
override public function play(_arg1:Number):void{
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:int;
var _local9:int;
var _local10:int;
var _local11:int;
var _local12:int;
var _local13:uint;
var _local14:int;
cnt = (cnt + _arg1);
var _local2:Number = camera.getInRads();
camera.setDirection((cnt * 0.006));
camera.y = (camera.y + ((camera.yoffs[int((WTH / 2))] * _arg1) / 32));
camera.x = (camera.x + ((camera.xoffs[int((WTH / 2))] * _arg1) / 32));
mbBMP.lock();
mbBMP.fillRect(mbBMP.rect, 0);
var _local3:int;
while (_local3 < WTH) {
_local4 = camera.xoffs[_local3];
_local5 = camera.yoffs[_local3];
_local6 = camera.x;
_local7 = camera.y;
_local8 = 0;
dRect.x = _local3;
_local9 = 1;
_local10 = MINDIST;
while (_local10 < MAXDIST) {
_local9 = (_local9 * 1.1);
_local11 = (hMap.getPixel(((_local4 * _local10) + _local6), ((_local5 * _local10) + _local7)) & 0xFF);
_local12 = ((((_local11 - camera.z) * -128) / _local10) + 100);
if (_local12 < _local8){
} else {
dRect.height = (_local12 - _local8);
dRect.y = (HTH - _local12);
_local13 = lava.getPixel(((((_local4 * _local10) + _local6) + (cnt * 0.01)) % 0x0100), ((((_local5 * _local10) + _local7) + (cnt * 0.01)) % 0x0100));
_local13 = ((((((_local13 >> 16) * (350 - (_local10 * 0.7))) / 350) << 16) | (((((_local13 >> 8) & 0xFF) * (350 - (_local10 * 0.7))) / 350) << 8)) | (((_local13 & 0xFF) * (350 - (_local10 * 0.7))) / 350));
_local13 = ((Math.min(0xFF, (350 - _local10)) << 24) | _local13);
_local14 = _local8;
while (_local14 < _local12) {
mbBMP.setPixel32(_local3, (HTH - _local14), _local13);
_local14++;
};
_local8 = _local12;
if (_local8 > HTH){
break;
};
};
_local10 = (_local10 + _local9);
};
_local3++;
};
mbBMP.unlock();
imat.identity();
output.draw(mbBMP, imat, null, BlendMode.NORMAL);
output.applyFilter(output, output.rect, pt, blur);
}
}
}//package effects.bitmap
Section 125
//DancerEffect (effects.clips.DancerEffect)
package effects.clips {
import evo.engine.*;
import flash.display.*;
import flash.geom.*;
import flash.filters.*;
public class DancerEffect extends AbstractDemoEffect {
private var pt:Point;
private var inb:BitmapData;
private var dancer:MovieClip;
private var mat:Matrix;
private var mode:String;// = "difference"
private var blur:BlurFilter;
private var ct:ColorTransform;
public var dancers:int;// = 0
public function DancerEffect(){
blur = new BlurFilter(16, 16, 2);
ct = new ColorTransform(0.2, 0.2, 0.2, 1);
pt = new Point();
super();
}
override public function set output(_arg1:BitmapData):void{
super.output = _arg1;
inb = new BitmapData(_arg1.width, _arg1.height, true, 0);
}
override public function init(_arg1:Object=null):void{
dancer = new clips.Dance();
mat = new Matrix();
}
public function sync(_arg1:int):void{
if (_arg1 == 0){
dancer.gotoAndPlay(15);
};
if (_arg1 == 1){
dancer.gotoAndPlay(1);
};
}
public function cleanup():void{
dancer.stop();
dancer = null;
}
override public function play(_arg1:Number):void{
if (dancers == 0){
return;
};
var _local2:Number = dancer.width;
inb.lock();
var _local3:Number = (10 + (output.width / 2));
var _local4:Number = ((output.height / 2) + 50);
inb.fillRect(inb.rect, 0);
if (dancers == 1){
mat.identity();
mat.translate(_local3, _local4);
inb.draw(dancer, mat, ct, mode);
};
if (dancers == 2){
mat.identity();
mat.translate((_local3 - (_local2 / 2)), _local4);
inb.draw(dancer, mat, ct, mode);
mat.translate(_local2, 0);
inb.draw(dancer, mat, ct, mode);
};
if (dancers == 3){
mat.identity();
mat.translate((_local3 - _local2), _local4);
inb.draw(dancer, mat, ct, mode);
mat.translate(_local2, 0);
inb.draw(dancer, mat, ct, mode);
mat.translate(_local2, 0);
inb.draw(dancer, mat, ct, mode);
};
if (dancers >= 4){
mat.identity();
mat.translate((_local3 - (_local2 * 1.5)), _local4);
inb.draw(dancer, mat, ct, mode);
mat.translate(_local2, 0);
inb.draw(dancer, mat, ct, mode);
mat.translate(_local2, 0);
inb.draw(dancer, mat, ct, mode);
mat.translate(_local2, 0);
inb.draw(dancer, mat, ct, mode);
};
inb.applyFilter(inb, inb.rect, pt, blur);
inb.unlock();
output.draw(inb);
}
}
}//package effects.clips
class clips {
public static var Dance:Class = clips_Dance;
private function clips(){
}
}
Section 126
//AirParticles (effects.meshParticles.AirParticles)
package effects.meshParticles {
import evo.engine.*;
import flash.display.*;
import flash.geom.*;
import away3d.core.clip.*;
import away3d.containers.*;
import away3d.core.render.*;
import away3d.core.math.*;
public class AirParticles extends AbstractDemoEffect {
public var xr:Number;// = 0
private var lastTime:int;// = 0
private var speed:Number;// = 0.04
public var offsetAmount:Number;// = 0
private var scale:Number;// = 1
private var amount:int;// = 200
private var texture:BitmapData;
private var trig:Boolean;// = false
private var theta:Number;
private var circles:Array;
private var cmat:Matrix;
private var view:View3D;
private var height:Number;
private var cnt:int;// = 0
private var scaleMatrix:Matrix;
private var particles:Array;
private var session:BitmapRenderSession;
private var phi:Number;// = 0
private var mesh:Airwriter;
public var zr:Number;// = 0
public function AirParticles(){
circles = new Array(10);
theta = (-(Math.PI) * 2);
cmat = new Matrix();
super();
}
override public function set output(_arg1:BitmapData):void{
super.output = _arg1;
view.clip = new RectangleClipping((-(_arg1.width) / 2), (-(_arg1.height) / 2), (_arg1.width / 2), (_arg1.height / 2));
cmat.identity();
}
override public function init(_arg1:Object=null):void{
super.init(_arg1);
if (_arg1.amount){
amount = _arg1.amount;
};
texture = _arg1.texture;
particles = new Array();
session = new BitmapRenderSession(1);
view = new View3D({session:session});
view.clip = new RectangleClipping();
view.camera.position = new Number3D(0, 0, 150);
view.camera.lookAt(new Number3D(0, 10, 0));
view.camera.focus = 35;
view.camera.zoom = 10;
view.x = 400;
view.y = 200;
var _local2:int;
mesh = new Airwriter();
view.scene.addChild(mesh);
mesh.source = texture;
}
override public function play(_arg1:Number):void{
lastTime = (lastTime + _arg1);
cnt++;
phi = (phi + speed);
var _local2 = 1;
mesh.rotationZ = (mesh.rotationZ + ((-(_arg1) * 0.04) * (Math.cos((_arg1 * 0.025)) + 1)));
mesh.rotationY = (mesh.rotationY - ((_arg1 * 0.07) * (Math.cos((_arg1 * 0.025)) + 1)));
mesh.rotationY = (mesh.rotationY + ((_arg1 * 0.08) * (Math.cos((_arg1 * 0.025)) + 1)));
mesh.move(_arg1);
mesh.update();
view.render();
output.draw(session.getBitmapData(view), cmat, null, BlendMode.LIGHTEN);
}
public function set source(_arg1:BitmapData):void{
mesh.source = _arg1;
}
}
}//package effects.meshParticles
Section 127
//Airwriter (effects.meshParticles.Airwriter)
package effects.meshParticles {
import flash.display.*;
import flash.geom.*;
import away3d.containers.*;
import away3d.sprites.*;
public class Airwriter extends ObjectContainer3D {
private var container:ObjectContainer3D;
private var blips:Array;
private var texture:BitmapData;
private var branches:int;// = 4
private var ct:ColorTransform;
public var source:BitmapData;
public function Airwriter(_arg1:Object=null){
var _local3:int;
var _local4:Sprite2D;
var _local5:Number;
var _local6:Number;
blips = new Array();
ct = new ColorTransform();
super(_arg1);
source = new BitmapData(90, 32, false, 0);
source.noise(3242342, 0, 0xFF, 7, true);
container = new ObjectContainer3D();
texture = new BasicParticle(32);
addChild(container);
var _local2:int;
while (_local2 < branches) {
_local3 = 0;
while (_local3 < 32) {
_local4 = new Sprite2D(texture.clone(), {scaling:(0.1 + (0.008 * _local3))});
_local5 = Math.sin(((_local2 * ((Math.PI * 2) / branches)) + Math.sin(((_local3 * Math.PI) / 16))));
_local6 = Math.cos(((_local2 * ((Math.PI * 2) / branches)) + Math.sin(((_local3 * Math.PI) / 16))));
_local4.y = ((_local6 * (3.1 + (_local3 * 0.04))) * _local3);
_local4.x = ((_local5 * (3.1 + (_local3 * 0.04))) * _local3);
container.addChild(_local4);
blips.push(_local4);
_local3++;
};
_local2++;
};
}
public function offset(_arg1:int):void{
container.roll((360 / _arg1));
}
public function update():void{
var _local2:int;
var _local3:Sprite2D;
var _local4:int;
var _local1:int;
while (_local1 < branches) {
_local2 = 0;
while (_local2 < 32) {
_local3 = blips[((_local1 * 32) + _local2)];
_local4 = (((720 + container.rotationZ) + ((_local1 * 360) / branches)) % 360);
ct.color = source.getPixel((_local4 / 4), _local2);
_local3.bitmap.fillRect(_local3.bitmap.rect, 0);
_local3.bitmap.draw(texture, null, ct);
_local2++;
};
_local1++;
};
}
public function move(_arg1:uint):void{
container.roll((_arg1 * 0.2));
}
}
}//package effects.meshParticles
Section 128
//AnalyzerEffect (effects.meshParticles.AnalyzerEffect)
package effects.meshParticles {
import evo.engine.*;
import flash.display.*;
import flash.geom.*;
import away3d.core.clip.*;
import away3d.containers.*;
import away3d.core.render.*;
import away3d.core.math.*;
import flash.filters.*;
import away3d.lights.*;
public class AnalyzerEffect extends AbstractDemoEffect {
public var xr:Number;// = 0
private var lastTime:int;// = 0
public var zr:Number;// = 0
public var yamount:Number;// = 30
private var session:BitmapRenderSession;
public var light1:PointLight3D;
public var light2:PointLight3D;
public var light3:PointLight3D;
private var theta:Number;
private var trig:Boolean;// = false
public var view:View3D;
private var origin:Point;
private var cnt:int;// = 0
private var mesh:AnalyzerMesh;
public var yrotation:Number;// = 35
public var shad:DropShadowFilter;
public static var Radial:Class = AnalyzerEffect_Radial;
public function AnalyzerEffect(){
shad = new DropShadowFilter(0, -45, 0, 1, 16, 16, 1);
theta = (-(Math.PI) * 2);
origin = new Point(0, 0);
super();
}
override public function set output(_arg1:BitmapData):void{
super.output = _arg1;
view.clip = new RectangleClipping((-(_arg1.width) / 2), (-(_arg1.height) / 2), (_arg1.width / 2), (_arg1.height / 2));
}
override public function init(_arg1:Object=null):void{
super.init(_arg1);
session = new BitmapRenderSession(1);
view = new View3D({session:session});
view.clip = new RectangleClipping();
view.camera.position = new Number3D(0, 50, 300);
view.camera.lookAt(new Number3D(-80, 0, 0));
view.camera.focus = 35;
view.camera.zoom = 10;
view.x = 400;
view.y = 200;
light1 = new PointLight3D({brightness:450});
light2 = new PointLight3D({brightness:450});
light3 = new PointLight3D({brightness:450});
light1.position = new Number3D(500, 500, 500);
light2.position = new Number3D(-500, 500, 500);
light3.position = new Number3D(300, -500, 500);
view.scene.addChild(light1);
view.scene.addChild(light2);
view.scene.addChild(light3);
var _local2:int;
mesh = new AnalyzerMesh();
view.scene.addChild(mesh);
mesh.source = new Radial().bitmapData;
}
override public function play(_arg1:Number):void{
lastTime = (lastTime + _arg1);
cnt++;
var _local2 = 1;
mesh.rotationY = ((Math.sin((lastTime * 0.002)) * yamount) + 25);
mesh.y = ((Math.sin((lastTime * 0.005)) * yamount) + 25);
mesh.update();
view.render();
var _local3:BitmapData = session.getBitmapData(view);
_local3.applyFilter(_local3, _local3.rect, origin, shad);
output.draw(_local3);
}
}
}//package effects.meshParticles
Section 129
//AnalyzerEffect_Radial (effects.meshParticles.AnalyzerEffect_Radial)
package effects.meshParticles {
import mx.core.*;
public class AnalyzerEffect_Radial extends BitmapAsset {
}
}//package effects.meshParticles
Section 130
//AnalyzerMesh (effects.meshParticles.AnalyzerMesh)
package effects.meshParticles {
import evo.engine.*;
import flash.display.*;
import away3d.containers.*;
import away3d.materials.*;
import away3d.primitives.*;
public class AnalyzerMesh extends ObjectContainer3D {
private var steps:int;// = 12
private var cnt:int;// = 0
public var source:BitmapData;
private var bands:int;// = 12
private var cubes:Array;
public function AnalyzerMesh(_arg1:Object=null, ... _args){
var _local5:int;
var _local6:Cube;
cubes = new Array();
super(_arg1);
var _local3:IMaterial = new ShadingColorMaterial(0x303030);
source = new BitmapData(90, 32, false, 0);
source.noise(3242342, 0, 0xFF, 7, true);
var _local4:int;
while (_local4 < bands) {
_local5 = 0;
while (_local5 < steps) {
_local6 = new Cube({width:15, height:5, depth:10, material:new ShadingColorMaterial(0x303030)});
_local6.x = ((_local4 * 18) - ((bands * 18) / 2));
_local6.y = ((_local5 * 7) - ((steps * 7) / 2));
addChild(_local6);
cubes.push(_local6);
_local5++;
};
_local4++;
};
}
public function update():void{
var _local3:Number;
var _local4:int;
var _local5:Cube;
cnt++;
var _local1:Array = Sequencer.spectrum;
var _local2:int;
while (_local2 < bands) {
_local3 = _local1[(128 - int(((_local2 * 128) / bands)))];
_local4 = 0;
while (_local4 < steps) {
_local5 = cubes[((_local2 * steps) + _local4)];
if (_local3 > ((_local4 * 0xFF) / steps)){
_local5.visible = true;
(_local5.material as ShadingColorMaterial).diffuse = source.getPixel((cnt % 90), _local4);
if (Math.random() < 0.02){
(_local5.material as ShadingColorMaterial).diffuse = 0xFF0000;
(_local5.material as ShadingColorMaterial).ambient_brightness = 0;
} else {
(_local5.material as ShadingColorMaterial).diffuse = source.getPixel((cnt % 90), _local4);
(_local5.material as ShadingColorMaterial).ambient_brightness = 1;
};
} else {
_local5.visible = false;
};
_local4++;
};
_local2++;
};
}
}
}//package effects.meshParticles
Section 131
//BasicParticle (effects.meshParticles.BasicParticle)
package effects.meshParticles {
import flash.display.*;
import flash.geom.*;
public class BasicParticle extends BitmapData {
public function BasicParticle(_arg1:int){
super(_arg1, _arg1, true, 0);
var _local2:Sprite = new Sprite();
var _local3:Matrix = new Matrix();
_local3.createGradientBox(_arg1, _arg1, 0, 0, 0);
_local2.graphics.beginGradientFill(GradientType.RADIAL, [0xFFFFFF, 0xFFFFFF], [1, 0], [0, 0xFF], _local3, SpreadMethod.PAD, InterpolationMethod.RGB, 0);
_local2.graphics.drawCircle((_arg1 / 2), (_arg1 / 2), ((_arg1 / 2) - 1));
_local2.graphics.endFill();
this.draw(_local2, new Matrix(), new ColorTransform(), BlendMode.NORMAL);
}
}
}//package effects.meshParticles
Section 132
//CernEffect (effects.meshParticles.CernEffect)
package effects.meshParticles {
import evo.engine.*;
import flash.display.*;
import flash.geom.*;
import flash.utils.*;
import flash.filters.*;
import fi.simppa.display.color.*;
public class CernEffect extends AbstractDemoEffect {
private var sinX:Number;
private var sinY:Number;
private var fov0:Number;// = 300
private var fov1:Number;// = 600
private var s:Number;
private var l:int;
private var count:int;// = 8000
private var round:Number;
private var _x:Number;
private var dotgfx:BitmapData;
private var radian:Number;
private var size:Number;
private var horizontal:Number;// = 0
private var dotrect:Rectangle;
private var first:Dot3DParticle;
private var cosX:Number;
private var cosY:Number;
private var radius:Number;
private var px:Number;
private var py:Number;
private var x1:Number;
private var perspective:Number;
private var gti:int;
private var matrix:Matrix;
private var centerx:int;
private var centery:int;
private var sprite:Sprite;
private var colorwheelprovider:ColorWheelProvider;
private var hide_back:int;// = 10000
private var degree:Number;
private var wi:Number;
private var y1:Number;
private var a:Number;
private var rect:Rectangle;
private var dotpoint:Point;
private var h:int;// = 540
private var i:int;// = 0
private var hide_front:int;// = -6000
private var vertical:Number;// = 0
private var w:int;// = 900
private var z2:Number;
private var current:Dot3DParticle;
private var _y:Number;
private var _z:Number;
private var z1:Number;
private var blur:BlurFilter;
public function CernEffect(){
centerx = (w / 2);
centery = (h / 2);
dotrect = new Rectangle(0, 0, 0x0100, 0x0100);
dotpoint = new Point(0, 0);
matrix = new Matrix();
blur = new BlurFilter(4, 4, 3);
super();
}
override public function init(_arg1:Object=null):void{
super.init(_arg1);
createDots(count);
}
override public function set output(_arg1:BitmapData):void{
if (_arg1 == null){
return;
};
super.output = _arg1;
}
override public function play(_arg1:Number):void{
gti = getTimer();
horizontal = (Math.sin((gti / 11700)) * 5);
vertical = (Math.sin((gti / 24500)) * 6);
cosY = Math.cos(horizontal);
sinY = Math.sin(horizontal);
cosX = Math.cos(vertical);
sinX = Math.sin(vertical);
current = first;
i = 0;
s = (2500 + (1500 * Math.sin((gti / 1000))));
a = ((s * 2) / count);
round = (degree * (2 * Math.sin((gti / 10000))));
while (current) {
size = (s * Math.sin(((gti / 10000) + (i / 10))));
radius = (size * Math.sin(((degree / 2) * i)));
current.x = (radius * Math.sin(((round * i) + (gti / 1000))));
current.y = (radius * Math.cos(((round * i) + (gti / 1000))));
current.z = ((-(s) + (i * a)) - 500);
z1 = ((current.z * cosY) + (current.x * sinY));
z2 = ((z1 * cosX) + (current.y * sinX));
if ((((z2 > hide_front)) && ((z2 < hide_back)))){
perspective = (fov0 / (fov1 + z2));
px = (centerx + (((current.x * cosY) - (current.z * sinY)) * perspective));
py = (centery + (((current.y * cosX) - (z1 * sinX)) * perspective));
if ((((((((px > -30)) && ((px < w)))) && ((py > -30)))) && ((py < h)))){
wi = (((z2 - 100) * -1) / 5);
if (wi < 1){
wi = 1;
};
wi = (((wi * Sequencer.sndChannel.leftPeak) + wi) / 2);
dotrect.x = (10 - Math.round((wi / 2)));
dotrect.y = (10 - Math.round((wi / 2)));
dotrect.width = wi;
dotrect.height = wi;
dotpoint.x = px;
dotpoint.y = py;
output.copyPixels(current.bit, dotrect, dotpoint, null, null, true);
};
};
i++;
current = current.next;
};
}
private function createDots(_arg1:int):void{
var _local3:Dot3DParticle;
var _local4:Dot3DParticle;
var _local5:Dot3DParticle;
colorwheelprovider = new ColorWheelProvider();
colorwheelprovider.adjustBrightness(-0.45);
var _local2:Array = colorwheelprovider.getCurve(60, _arg1, 0.505, 0, 0.4);
sprite = new Sprite();
var _local6:Number = 0;
var _local7:Number = 0;
var _local8:Number = 0;
radian = (Math.PI / 180);
degree = ((radian * 360) / _arg1);
var _local9:int;
while (_local9 < _arg1) {
_local6 = (200 * Math.sin((degree * _local9)));
_local7 = (200 * Math.cos((degree * _local9)));
_local8 = (1000 + (_local9 / 1000));
_local5 = new Dot3DParticle(_local6, _local7, _local8);
_local5.c = _local2[_local9];
dotgfx = new BitmapData(20, 20, true, 0);
sprite = new Sprite();
sprite.graphics.beginFill(_local2[_local9], 1);
sprite.graphics.drawRect(0, (10 - 2), 20, 4);
sprite.graphics.drawRect((10 - 2), 0, 4, 20);
sprite.graphics.endFill();
sprite.graphics.beginFill(_local2[_local9], 1);
sprite.graphics.drawCircle(10, 10, 5);
sprite.graphics.endFill();
matrix.translate(-10, -10);
matrix.rotate((_local9 / 100));
matrix.translate(10, 10);
dotgfx.draw(sprite, matrix);
_local5.bit = dotgfx.clone();
if (!_local9){
first = _local5;
};
if (_local3){
_local3.next = _local5;
_local5.prev = _local3;
};
_local3 = _local5;
_local5.next = null;
_local9++;
};
sprite = null;
dotgfx.dispose();
dotgfx = null;
}
}
}//package effects.meshParticles
Section 133
//Dot3DParticle (effects.meshParticles.Dot3DParticle)
package effects.meshParticles {
import flash.display.*;
public class Dot3DParticle {
public var z:Number;// = 0
public var prev:Dot3DParticle;
public var c:uint;// = 0xFFFFFF
public var next:Dot3DParticle;
public var x:Number;// = 0
public var y:Number;// = 0
public var bit:BitmapData;
public function Dot3DParticle(_arg1:Number=0, _arg2:Number=0, _arg3:Number=0){
this.x = _arg1;
this.y = _arg2;
this.z = _arg3;
}
}
}//package effects.meshParticles
Section 134
//ImageCubes (effects.meshParticles.ImageCubes)
package effects.meshParticles {
import flash.display.*;
import away3d.containers.*;
import away3d.materials.*;
import away3d.primitives.*;
public class ImageCubes extends ObjectContainer3D {
private var green:ShadingColorMaterial;
private var yres:int;// = 8
private var maph:int;// = 128
private var red:ShadingColorMaterial;
public var randomRot:Boolean;// = false
private var cubeSize:int;// = 10
private var blue:ShadingColorMaterial;
private var source:BitmapData;
private var matMap:Array;
private var rotating:Boolean;// = false
public var needUpdate:Boolean;// = false
private var cyan:ShadingColorMaterial;
private var xres:int;// = 8
private var white:ShadingColorMaterial;
private var mapw:int;// = 128
private var posMap:Array;
private var yellow:ShadingColorMaterial;
private var purple:ShadingColorMaterial;
private var black:ShadingColorMaterial;
public static var EvoLogo:Class = ImageCubes_EvoLogo;
public function ImageCubes(_arg1:Object=null, ... _args){
var _local5:int;
var _local6:BitmapMaterial;
var _local7:Cube;
var _local8:ObjectContainer3D;
var _local9:ObjectContainer3D;
var _local10:ObjectContainer3D;
source = new EvoLogo().bitmapData;
posMap = new Array((mapw * maph));
purple = new ShadingColorMaterial(0x400040);
blue = new ShadingColorMaterial(64);
cyan = new ShadingColorMaterial(0x4040);
green = new ShadingColorMaterial(0x4000);
red = new ShadingColorMaterial(0x400000);
yellow = new ShadingColorMaterial(0x404000);
black = new ShadingColorMaterial(0x101010);
white = new ShadingColorMaterial(0x404040);
matMap = [purple, blue, cyan, green, red, yellow];
super(_arg1);
var _local3:GridPlane = new GridPlane({width:1000, height:1000, segments:50, material:new WireColorMaterial(0x804000)});
_local3.y = -(cubeSize);
addChild(_local3);
var _local4:int;
while (_local4 < yres) {
_local5 = 0;
while (_local5 < xres) {
_local6 = new BitmapMaterial(source, {alpha:0.15});
_local7 = new Cube({width:cubeSize, height:cubeSize, depth:cubeSize, umax:(_local5 / xres), umin:((_local5 + 1) / xres), vmax:(_local4 / yres), vmin:((_local4 + 1) / yres), material:_local6});
_local8 = new ObjectContainer3D();
_local9 = new ObjectContainer3D();
_local10 = new ObjectContainer3D();
_local8.addChild(_local7);
_local10.addChild(_local8);
_local9.addChild(_local10);
_local7.z = (-(cubeSize) / 2);
_local7.y = (cubeSize / 2);
_local8.z = (cubeSize / 2);
_local9.z = ((_local5 * cubeSize) - ((xres * cubeSize) / 2));
_local9.x = ((_local4 * cubeSize) - ((yres * cubeSize) / 2));
_local9.y = (Math.random() * cubeSize);
addChild(_local9);
posMap[((((((mapw / 2) - (yres / 2)) + _local4) * mapw) + ((maph / 2) - (xres / 2))) + _local5)] = _local9;
_local5++;
};
_local4++;
};
}
public function update(_arg1:uint):void{
var _local3:int;
var _local4:ObjectContainer3D;
var _local5:ObjectContainer3D;
var _local6:ObjectContainer3D;
var _local7:int;
if (!rotating){
return;
};
var _local2:int;
while (_local2 < maph) {
_local3 = 0;
while (_local3 < mapw) {
_local4 = posMap[((_local2 * mapw) + _local3)];
if (_local4 == null){
} else {
_local5 = _local4.children[0];
_local6 = _local5.children[0];
_local7 = int(_local5.rotationY);
_local6.rotationX = (_local6.rotationX - 15);
if (int(_local6.rotationX) < -90){
_local6.rotationX = 0;
needUpdate = true;
switch (_local5.rotationY){
case 0:
_local4.z = (_local4.z + cubeSize);
break;
case 90:
_local4.x = (_local4.x + cubeSize);
break;
case 180:
_local4.z = (_local4.z - cubeSize);
break;
case 270:
_local4.x = (_local4.x - cubeSize);
break;
};
if (randomRot){
_local5.rotationY = (_local5.rotationY + (int(((Math.random() * 4) + 1)) * 90));
} else {
_local5.rotationY = (_local5.rotationY + 90);
};
if (_local5.rotationY > 270){
_local5.rotationY = int((_local5.rotationY - 360));
};
rotating = false;
};
};
_local3++;
};
_local2++;
};
}
public function rotateCubes():void{
rotating = true;
}
}
}//package effects.meshParticles
Section 135
//ImageCubes_EvoLogo (effects.meshParticles.ImageCubes_EvoLogo)
package effects.meshParticles {
import mx.core.*;
public class ImageCubes_EvoLogo extends BitmapAsset {
}
}//package effects.meshParticles
Section 136
//ImageCubesEffect (effects.meshParticles.ImageCubesEffect)
package effects.meshParticles {
import evo.engine.*;
import flash.display.*;
import flash.geom.*;
import away3d.core.clip.*;
import away3d.containers.*;
import away3d.core.render.*;
import away3d.core.math.*;
import flash.filters.*;
import away3d.lights.*;
public class ImageCubesEffect extends AbstractDemoEffect {
private var lastTime:int;// = 0
public var zr:Number;// = 0
private var session:BitmapRenderSession;
public var light1:PointLight3D;
public var light2:PointLight3D;
public var light3:PointLight3D;
private var theta:Number;
private var trig:Boolean;// = false
private var cmat:Matrix;
private var view:View3D;
private var origin:Point;
public var xr:Number;// = 0
private var cnt:int;// = 0
private var mesh:ImageCubes;
public var shad:DropShadowFilter;
public static var Radial:Class = ImageCubesEffect_Radial;
public function ImageCubesEffect(){
shad = new DropShadowFilter(0, 45, 0, 1, 16, 16, 1);
theta = (-(Math.PI) * 2);
origin = new Point(0, 0);
cmat = new Matrix();
super();
}
override public function set output(_arg1:BitmapData):void{
super.output = _arg1;
view.clip = new RectangleClipping((-(_arg1.width) / 2), (-(_arg1.height) / 2), (_arg1.width / 2), (_arg1.height / 2));
cmat.identity();
cmat.translate((_arg1.width / 2), (_arg1.height / 2));
}
public function rotateNow():void{
mesh.rotateCubes();
}
public function randomRot():void{
mesh.randomRot = true;
}
override public function init(_arg1:Object=null):void{
super.init(_arg1);
view = new View3D();
view.clip = new RectangleClipping();
view.camera.position = new Number3D(0, 100, 100);
view.camera.lookAt(new Number3D(0, 0, 0));
view.camera.focus = 35;
view.camera.zoom = 10;
view.x = 400;
view.y = 200;
light1 = new PointLight3D({brightness:450});
light2 = new PointLight3D({brightness:450});
light3 = new PointLight3D({brightness:450});
light1.position = new Number3D(500, 500, 500);
light2.position = new Number3D(-500, 500, 500);
light3.position = new Number3D(300, -500, 500);
view.scene.addChild(light1);
view.scene.addChild(light2);
view.scene.addChild(light3);
var _local2:int;
mesh = new ImageCubes();
view.scene.addChild(mesh);
}
override public function play(_arg1:Number):void{
lastTime = (lastTime + _arg1);
cnt++;
var _local2 = 1;
mesh.rotationY = (lastTime * 0.04);
mesh.update(_arg1);
view.render();
output.draw(view, cmat);
}
}
}//package effects.meshParticles
Section 137
//ImageCubesEffect_Radial (effects.meshParticles.ImageCubesEffect_Radial)
package effects.meshParticles {
import mx.core.*;
public class ImageCubesEffect_Radial extends BitmapAsset {
}
}//package effects.meshParticles
Section 138
//LasersEffect (effects.meshParticles.LasersEffect)
package effects.meshParticles {
import evo.engine.*;
import flash.display.*;
import flash.geom.*;
import away3d.core.clip.*;
import away3d.containers.*;
import away3d.core.render.*;
import away3d.core.math.*;
import away3d.materials.*;
import effects.meta.*;
import flash.filters.*;
import away3d.lights.*;
import away3d.primitives.*;
public class LasersEffect extends AbstractDemoEffect {
private var lastTime:int;// = 0
private var panoramaMaterialD:BitmapMaterial;
private var panoramaMaterialF:BitmapMaterial;
private var panoramaMaterialB:BitmapMaterial;
private var panoramaMaterialL:BitmapMaterial;
private var panoramaMaterialR:BitmapMaterial;
private var panoramaMaterialU:BitmapMaterial;
private var trig:Boolean;// = false
private var session:BitmapRenderSession;
private var theta:Number;
private var cmat:Matrix;
private var view:View3D;
private var origin:Point;
private var point3d0:Number3D;
public var shad:DropShadowFilter;
public var zr:Number;// = 0
private var panoramaparser:PanoramaParser;
public var light1:PointLight3D;
public var light2:PointLight3D;
public var light3:PointLight3D;
private var cnt:int;// = 0
private var mesh:LasersMesh;
private var panorama:Skybox;
public var xr:Number;// = 0
public function LasersEffect(){
shad = new DropShadowFilter(0, 45, 0, 1, 16, 16, 1);
theta = (-(Math.PI) * 2);
point3d0 = new Number3D(0, 0, 0);
origin = new Point(0, 0);
cmat = new Matrix();
super();
}
override public function set output(_arg1:BitmapData):void{
if (_arg1 == null){
return;
};
super.output = _arg1;
view.clip = new RectangleClipping((-(_arg1.width) / 2), (-(_arg1.height) / 2), (_arg1.width / 2), (_arg1.height / 2));
cmat.identity();
cmat.translate((_arg1.width / 2), (_arg1.height / 2));
}
public function randomRot():void{
}
override public function init(_arg1:Object=null):void{
super.init(_arg1);
session = new BitmapRenderSession(1);
view = new View3D({session:session});
view.clip = new RectangleClipping();
view.camera.position = new Number3D(0, 2500, 5000);
view.camera.lookAt(new Number3D(0, 0, 0));
view.camera.focus = 35;
view.camera.zoom = 10;
view.x = 400;
view.y = 200;
this.initMaterials();
panorama = new Skybox(panoramaMaterialF, panoramaMaterialL, panoramaMaterialB, panoramaMaterialR, panoramaMaterialU, panoramaMaterialD);
panorama.scale(5);
panorama.quarterFaces();
view.scene.addChild(panorama);
var _local2:int;
mesh = new LasersMesh();
view.scene.addChild(mesh);
}
public function dispose():void{
panoramaparser.dispose();
}
override public function play(_arg1:Number):void{
lastTime = (lastTime + _arg1);
cnt++;
var _local2 = 1;
view.camera.position = new Number3D((4000 * Math.sin((lastTime / 1200))), (4000 * Math.sin((lastTime / 1600))), 1000);
view.camera.lookAt(point3d0);
mesh.rotationY = (lastTime * 0.2);
mesh.rotationZ = (lastTime * 0.1);
mesh.update(_arg1);
view.render();
var _local3:BitmapData = session.getBitmapData(view);
output.draw(_local3);
}
public function rotateNow():void{
mesh.reverse();
}
private function initMaterials():void{
panoramaparser = new PanoramaParser(new Assets.Panorama3());
panoramaMaterialF = new BitmapMaterial(panoramaparser.textureFront);
panoramaMaterialL = new BitmapMaterial(panoramaparser.textureLeft);
panoramaMaterialB = new BitmapMaterial(panoramaparser.textureBack);
panoramaMaterialR = new BitmapMaterial(panoramaparser.textureRight);
panoramaMaterialU = new BitmapMaterial(panoramaparser.textureUp);
panoramaMaterialD = new BitmapMaterial(panoramaparser.textureDown);
}
}
}//package effects.meshParticles
Section 139
//LasersMesh (effects.meshParticles.LasersMesh)
package effects.meshParticles {
import flash.display.*;
import away3d.core.base.*;
import away3d.containers.*;
import away3d.core.math.*;
import away3d.materials.*;
import away3d.sprites.*;
public class LasersMesh extends ObjectContainer3D {
private var triangleCnt:int;// = 15
private var lastTime:int;// = 0
private var reflect:WireframeMaterial;
private var speed:Number;// = 0.0001
private var lasers:Array;
private var lineCount:int;// = 120
private var wireMesh:WireMesh;
private var mirrors:Array;
private var reflects:Array;
private var point:BitmapData;
private var radius:int;// = 1000
private var blue:WireframeMaterial;
public var coloring:BitmapData;
private var iradius:Number;// = 500
public function LasersMesh(_arg1:Object=null, ... _args){
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Vertex;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Vertex;
var _local15:Segment;
var _local16:Sprite2D;
coloring = new Assets.Radial5().bitmapData;
blue = new WireframeMaterial(2146559, {alpha:0.4, blendMode:"add"});
reflect = new WireframeMaterial(0xFF9000, {alpha:1, blendMode:"add"});
lasers = new Array();
mirrors = new Array();
point = new BasicParticle(16);
reflects = new Array();
super(_arg1);
wireMesh = new WireMesh();
addChild(wireMesh);
var _local3:int;
while (_local3 < lineCount) {
_local4 = 0;
_local5 = 0;
_local6 = 0;
_local7 = new Vertex(_local4, _local5, _local6);
_local8 = ((Math.random() * Math.PI) * 2);
_local9 = ((Math.random() * Math.PI) * 2);
_local10 = Math.sin(_local8);
_local11 = Math.cos(_local8);
_local12 = Math.sin(_local9);
_local13 = Math.cos(_local9);
_local4 = (((radius * _local10) * _local13) + _local7.x);
_local5 = (((radius * _local10) * _local12) + _local7.y);
_local6 = ((radius * _local11) + _local7.z);
_local14 = new Vertex(_local4, _local5, _local6);
_local15 = new Segment(_local7, _local14, new WireframeMaterial(2146559, {width:2, alpha:0.4, blendMode:"add"}));
wireMesh.addSegment(_local15);
_local16 = new Sprite2D(point, {scaling:5, rescale:true});
_local16.position = new Number3D(_local4, _local5, _local6);
addChild(_local16);
lasers.push({seg:_local15, point:_local16, phi:_local8, rho:_local9, rs:(Math.random() * 0.03), ps:(Math.random() * 0.03)});
_local3++;
};
}
public function update(_arg1:uint):void{
var _local6:Object;
var _local7:Segment;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
lastTime = (lastTime + _arg1);
iradius = (iradius - (iradius / 4));
while (reflects.length != 0) {
wireMesh.removeSegment(reflects.pop());
};
var _local2:Number = 0;
var _local3:Number = 0;
var _local4:Number = 0;
var _local5:int;
while (_local5 < lasers.length) {
_local6 = lasers[_local5];
_local7 = _local6.seg;
_local8 = (_local6.phi + _local6.ps);
_local9 = (_local6.rho + _local6.rs);
_local10 = Math.sin(_local8);
_local11 = Math.cos(_local8);
_local12 = Math.sin(_local9);
_local13 = Math.cos(_local9);
_local2 = (_local10 * _local13);
_local3 = (_local10 * _local12);
_local4 = _local11;
_local6.phi = _local8;
_local6.rho = _local9;
_local14 = (((Math.sin(((lastTime * 0.004) + _local8)) * radius) * 0.3) + (radius * 0.7));
_local15 = ((_local14 / 2) + iradius);
_local7.v0.x = (_local15 * _local2);
_local7.v0.y = (_local15 * _local3);
_local7.v0.z = (_local15 * _local4);
_local7.v1.x = (_local14 * _local2);
_local7.v1.y = (_local14 * _local3);
_local7.v1.z = (_local14 * _local4);
_local6.point.position = _local7.v1.position.clone();
(_local7.material as WireframeMaterial).color = coloring.getPixel(((45 * Math.sin((_local8 + (lastTime * 0.04)))) + 45), ((16 * Math.sin((_local9 + (lastTime * 0.05)))) + 16));
_local5++;
};
}
private function check_same_clock_dir(_arg1:Number3D, _arg2:Number3D, _arg3:Number3D, _arg4:Number3D):int{
var _local5:Number = (((_arg2.y - _arg1.y) * (_arg3.z - _arg1.z)) - ((_arg3.y - _arg1.y) * (_arg2.z - _arg1.z)));
var _local6:Number = (((_arg2.z - _arg1.z) * (_arg3.x - _arg1.x)) - ((_arg3.z - _arg1.z) * (_arg2.x - _arg1.x)));
var _local7:Number = (((_arg2.x - _arg1.x) * (_arg3.y - _arg1.y)) - ((_arg3.x - _arg1.x) * (_arg2.y - _arg1.y)));
var _local8:Number = (((_local5 * _arg4.x) + (_local6 * _arg4.y)) + (_local7 * _arg4.z));
if (_local8 < 0){
return (0);
};
return (1);
}
public function reverse():void{
iradius = 2500;
}
}
}//package effects.meshParticles
Section 140
//LineMesh (effects.meshParticles.LineMesh)
package effects.meshParticles {
import away3d.core.base.*;
import away3d.containers.*;
import away3d.core.math.*;
import away3d.materials.*;
import away3d.primitives.*;
import away3d.sprites.*;
public class LineMesh extends ObjectContainer3D {
private var lineCount:int;// = 5
private var green:WireframeMaterial;
private var purple:WireframeMaterial;
private var lines:Array;
private var red:WireframeMaterial;
private var wireMesh:WireMesh;
private var blue:WireframeMaterial;
private var w2:GridPlane;
private var matMap:Array;
private var curSegs:int;// = 0
private var mat:WireframeMaterial;
private var w1:GridPlane;
private var cyan:WireframeMaterial;
private var gti:int;// = 0
private var colors:Array;
private var yellow:WireframeMaterial;
private var maxLines:int;// = 800
public function LineMesh(_arg1:Object=null, ... _args){
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:LineObject;
var _local12:Vertex;
var _local13:Vertex;
var _local14:Segment;
lines = new Array(lineCount);
blue = new WireframeMaterial(0xFF9000, {width:2});
cyan = new WireframeMaterial(0xFFFF, {width:2});
green = new WireframeMaterial(65328, {width:2});
red = new WireframeMaterial(267517952, {width:2});
yellow = new WireframeMaterial(0x90FF00, {width:2});
matMap = [purple, blue, cyan, green, red, yellow];
super(_arg1);
colors = Assets.colorwheelprovider.getAnalogous(160, 6, 48, 6, 0.6, 1);
purple = new WireframeMaterial(colors[0], {width:1.5, alpha:0.7});
blue = new WireframeMaterial(colors[1], {width:1.5, alpha:0.7});
cyan = new WireframeMaterial(colors[2], {width:1.5, alpha:0.7});
green = new WireframeMaterial(colors[3], {width:1.5, alpha:0.7});
red = new WireframeMaterial(colors[4], {width:1.5, alpha:0.7});
yellow = new WireframeMaterial(colors[5], {width:1.5, alpha:0.7});
matMap = [purple, blue, cyan, green, red, yellow];
wireMesh = new WireMesh();
addChild(wireMesh);
mat = new WireframeMaterial(13663911, {width:2});
w1 = new GridPlane({width:1000, height:1000, segments:10, pushback:true, material:mat});
w1.y = -500;
w2 = new GridPlane({width:1000, height:1000, segments:10, pushback:true, material:mat});
w2.y = 500;
var _local3:GridPlane = new GridPlane({width:1000, height:1000, segments:10, pushback:true, material:mat});
_local3.x = -500;
_local3.rotationZ = 90;
var _local4:GridPlane = new GridPlane({width:1000, height:1000, segments:10, pushback:true, material:mat});
_local4.x = 500;
_local4.rotationZ = 90;
var _local5:GridPlane = new GridPlane({width:1000, height:1000, segments:10, pushback:true, material:mat});
_local5.z = -500;
_local5.rotationX = 90;
var _local6:GridPlane = new GridPlane({width:1000, height:1000, segments:10, pushback:true, material:mat});
_local6.z = 500;
_local6.rotationX = 90;
addChild(w1);
addChild(w2);
addChild(_local3);
addChild(_local4);
addChild(_local5);
addChild(_local6);
var _local7:int;
while (_local7 < lineCount) {
_local8 = ((Math.random() * 100) - 50);
_local9 = ((Math.random() * 100) - 50);
_local10 = ((Math.random() * 100) - 50);
_local11 = new LineObject();
_local11.direction = int((Math.random() * 6));
_local11.nextBranch = ((Math.random() * 400) + 450);
_local11.point = new Sprite2D(new BasicParticle(32), {scaling:0.2, rescale:false});
_local11.point.position = new Number3D(_local8, _local9, _local10);
addChild(_local11.point);
_local11.branchPossiblity = 0.25;
_local12 = new Vertex(_local8, _local9, _local10);
_local13 = new Vertex(_local8, _local9, _local10);
_local14 = new Segment(_local12, _local13, matMap[(_local7 % matMap.length)]);
wireMesh.addSegment(_local14);
_local11.seg = _local14;
lines[_local7] = _local11;
_local7++;
};
}
public function update(_arg1:uint):void{
var _local3:LineObject;
var _local4:Vertex;
var _local5:Vertex;
var _local6:Segment;
var _local7:LineObject;
gti = (gti + _arg1);
mat.color = Assets.colorwheelprovider.getGradient((40 + (60 * Math.sin((gti / 400)))), 1, 0.3, 0.4)[0];
var _local2:int;
while (_local2 < lines.length) {
_local3 = lines[_local2];
if (_local3.nextBranch < (_local3.seg.v0.position.distance(_local3.seg.v1.position) * 50)){
if (curSegs > maxLines){
return;
};
_local3.nextBranch = ((Math.random() * 1000) + 1500);
_local3.direction = ((_local3.direction + int((Math.random() * 5))) % 6);
_local4 = new Vertex(_local3.seg.v1.x, _local3.seg.v1.y, _local3.seg.v1.z);
_local5 = new Vertex(_local3.seg.v1.x, _local3.seg.v1.y, _local3.seg.v1.z);
_local6 = new Segment(_local4, _local5, _local3.seg.material);
_local3.seg = _local6;
curSegs++;
wireMesh.addSegment(_local6);
if (Math.random() < _local3.branchPossiblity){
_local7 = new LineObject();
_local7.direction = ((_local3.direction + int((Math.random() * 5))) % 6);
_local7.nextBranch = ((Math.random() * 1000) + 1500);
_local4 = new Vertex(_local3.seg.v1.x, _local3.seg.v1.y, _local3.seg.v1.z);
_local5 = new Vertex(_local3.seg.v1.x, _local3.seg.v1.y, _local3.seg.v1.z);
_local6 = new Segment(_local4, _local5, _local3.seg.material);
_local7.seg = _local6;
_local7.point = new Sprite2D(new BasicParticle(32), {scaling:0.2, rescale:false});
addChild(_local7.point);
_local7.point.position = new Number3D(_local4.x, _local4.y, _local4.z);
wireMesh.addSegment(_local6);
lines.push(_local7);
curSegs++;
};
};
if (_local3.direction == 0){
_local3.seg.v1.x = (_local3.seg.v1.x + _local3.speed);
} else {
if (_local3.direction == 1){
_local3.seg.v1.x = (_local3.seg.v1.x - _local3.speed);
} else {
if (_local3.direction == 2){
_local3.seg.v1.y = (_local3.seg.v1.y + _local3.speed);
} else {
if (_local3.direction == 3){
_local3.seg.v1.y = (_local3.seg.v1.y - _local3.speed);
} else {
if (_local3.direction == 4){
_local3.seg.v1.z = (_local3.seg.v1.z + _local3.speed);
} else {
if (_local3.direction == 5){
_local3.seg.v1.z = (_local3.seg.v1.z - _local3.speed);
};
};
};
};
};
};
_local3.point.position = _local3.seg.v1.position.clone();
_local2++;
};
}
}
}//package effects.meshParticles
Section 141
//LineObject (effects.meshParticles.LineObject)
package effects.meshParticles {
import away3d.core.base.*;
import away3d.sprites.*;
public class LineObject {
public var seg:Segment;
public var speed:int;// = 2
public var point:Sprite2D;
public var nextBranch:int;// = 4000
public var branchPossiblity:Number;// = 0.2
public var direction:int;// = 0
}
}//package effects.meshParticles
Section 142
//LinesEffect (effects.meshParticles.LinesEffect)
package effects.meshParticles {
import evo.engine.*;
import flash.display.*;
import flash.geom.*;
import away3d.core.clip.*;
import away3d.containers.*;
import away3d.core.render.*;
import away3d.core.math.*;
import flash.filters.*;
public class LinesEffect extends AbstractDemoEffect {
public var xr:Number;// = 0
private var lastTime:int;// = 0
private var session:BitmapRenderSession;
private var trig:Boolean;// = false
private var cmat:Matrix;
private var theta:Number;
public var rotX:Number;// = 0
public var rotY:Number;// = 0
public var rotZ:Number;// = 75
private var view:View3D;
private var origin:Point;
private var cnt:int;// = 0
private var mesh:LineMesh;
public var shad:DropShadowFilter;
public var zr:Number;// = 0
public function LinesEffect(){
shad = new DropShadowFilter(0, 45, 0, 1, 16, 16, 1);
theta = (-(Math.PI) * 2);
origin = new Point(0, 0);
cmat = new Matrix();
super();
}
override public function init(_arg1:Object=null):void{
super.init(_arg1);
session = new BitmapRenderSession(1);
view = new View3D({session:session});
view.clip = new RectangleClipping();
view.camera.position = new Number3D(0, 100, 100);
view.camera.lookAt(new Number3D(0, 0, 0));
view.camera.focus = 35;
view.camera.zoom = 10;
view.x = 400;
view.y = 200;
var _local2:int;
mesh = new LineMesh();
view.scene.addChild(mesh);
}
override public function set output(_arg1:BitmapData):void{
super.output = _arg1;
view.clip = new RectangleClipping((-(_arg1.width) / 2), (-(_arg1.height) / 2), (_arg1.width / 2), (_arg1.height / 2));
cmat.identity();
}
public function randomRot():void{
rotX = ((mesh.rotationX + (Math.random() * 90)) - 45);
rotY = ((mesh.rotationY + (Math.random() * 90)) - 45);
rotZ = ((mesh.rotationZ + (Math.random() * 90)) - 45);
}
override public function play(_arg1:Number):void{
lastTime = (lastTime + _arg1);
cnt++;
var _local2 = 1;
view.camera.position = new Number3D((Math.sin((lastTime / 750)) * 300), (Math.sin((lastTime / 1000)) * 300), (Math.cos((lastTime / 750)) * 200));
view.camera.lookAt(new Number3D(0, 0, 0));
rotX = (rotX - 0.25);
rotY = (rotY + 0.25);
mesh.rotationZ = (mesh.rotationZ + ((((rotZ - mesh.rotationZ) / 30) * _arg1) / 10));
mesh.rotationX = (mesh.rotationX + ((((rotX - mesh.rotationX) / 30) * _arg1) / 10));
mesh.rotationY = (mesh.rotationY + ((((rotY - mesh.rotationY) / 30) * _arg1) / 10));
mesh.update(_arg1);
view.render();
var _local3:BitmapData = session.getBitmapData(view);
_local3.applyFilter(_local3, _local3.rect, origin, shad);
output.draw(_local3, cmat);
}
}
}//package effects.meshParticles
Section 143
//MedusaMesh (effects.meshParticles.MedusaMesh)
package effects.meshParticles {
import flash.display.*;
import away3d.core.base.*;
import away3d.containers.*;
import away3d.core.math.*;
import away3d.sprites.*;
public class MedusaMesh extends ObjectContainer3D {
private var mesh:ObjectContainer3D;
private var circles:Array;
private var circleCount:int;
public function MedusaMesh(_arg1:int, _arg2:BitmapData, _arg3:Object=null){
var _local6:ObjectContainer3D;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number3D;
var _local11:DofSprite2D;
var _local12:Vertex;
var _local13:int;
var _local14:Number3D;
var _local15:Vertex;
var _local16:Segment;
super(_arg3);
this.circleCount = _arg1;
circles = new Array((_arg1 * 2));
var _local4:int;
var _local5:Number = 0;
while (_local4 < _arg1) {
_local6 = new ObjectContainer3D();
circles[_local4] = _local6;
_local5 = 0;
_local7 = (3 * (_local4 + 1));
_local8 = (Math.cos(0) * _local7);
_local9 = (Math.sin(0) * _local7);
_local10 = new Number3D(_local8, _local9, (_local4 * 2));
_local11 = new DofSprite2D(_arg2, {scaling:0.02});
_local11.position = _local10;
_local6.addChild(_local11);
_local12 = new Vertex();
_local12.position = _local10;
_local13 = 1;
while (_local13 < (_local7 * 4)) {
_local5 = (((_local13 * 2) * Math.PI) / (_local7 * 4));
_local14 = new Number3D();
_local14.x = (Math.cos(_local5) * _local7);
_local14.y = (Math.sin(_local5) * _local7);
_local14.z = (_local4 * 2);
_local11 = new DofSprite2D(_arg2, {scaling:0.02});
_local11.position = _local14;
_local6.addChild(_local11);
_local15 = new Vertex();
_local15.position = _local14;
_local16 = new Segment(_local12, _local15);
_local12 = _local15;
_local13++;
};
_local4++;
addChild(_local6);
};
_local4 = 0;
while (_local4 < _arg1) {
_local6 = new ObjectContainer3D();
circles[(_local4 + _arg1)] = _local6;
_local5 = 0;
_local7 = ((3 * Math.sin((_local4 * 0.2))) + 0.5);
_local8 = (Math.cos(0) * _local7);
_local9 = (Math.sin(0) * _local7);
_local10 = new Number3D(_local8, _local9, ((_local4 * 3) + 5));
_local11 = new DofSprite2D(_arg2, {scaling:0.02});
_local11.position = _local10;
_local6.addChild(_local11);
_local12 = new Vertex();
_local12.position = _local10;
_local13 = 0;
while (_local13 < ((_local7 * 2) + 1)) {
_local14 = new Number3D();
_local14.x = (Math.cos(_local5) * _local7);
_local14.y = (Math.sin(_local5) * _local7);
_local14.z = ((_local4 * 3) + 5);
_local11 = new DofSprite2D(_arg2, {scaling:0.02});
_local11.position = _local14;
_local6.addChild(_local11);
_local5 = (((_local13 * 2) * Math.PI) / (_local7 * 2));
_local15 = new Vertex();
_local15.position = _local14;
_local12 = _local15;
_local13++;
};
_local4++;
addChild(_local6);
};
}
public function impulse():void{
mesh = circles[0];
mesh.z = -5;
mesh = circles[circleCount];
mesh.z = 20;
}
public function calc(_arg1:uint):void{
var _local2 = 1;
while (_local2 < circles.length) {
mesh = circles[_local2];
mesh.rotationX = (mesh.rotationX - ((mesh.rotationX - circles[(_local2 - 1)].rotationX) / 3));
mesh.rotationY = (mesh.rotationY - ((mesh.rotationY - circles[(_local2 - 1)].rotationY) / 3));
mesh.rotationZ = (mesh.rotationZ - ((mesh.rotationZ - circles[(_local2 - 1)].rotationZ) / 3));
mesh.z = (mesh.z - ((mesh.z - circles[(_local2 - 1)].z) / 2));
mesh.y = (mesh.y - ((mesh.y - circles[(_local2 - 1)].y) / 2));
mesh.x = (mesh.x - ((mesh.x - circles[(_local2 - 1)].x) / 2));
_local2++;
};
mesh = circles[0];
mesh.z = (mesh.z - (mesh.z / 10));
mesh = circles[circleCount];
mesh.z = (mesh.z - (mesh.z / 10));
}
public function impulse2():void{
mesh = circles[0];
mesh.rotationY = (mesh.rotationY - 20);
mesh.z = -5;
mesh = circles[circleCount];
mesh.z = -10;
}
}
}//package effects.meshParticles
Section 144
//MedusaParticles (effects.meshParticles.MedusaParticles)
package effects.meshParticles {
import evo.engine.*;
import flash.display.*;
import flash.geom.*;
import away3d.core.clip.*;
import away3d.containers.*;
import away3d.core.render.*;
import away3d.core.math.*;
import away3d.materials.*;
import flash.filters.*;
import away3d.primitives.*;
public class MedusaParticles extends AbstractDemoEffect {
public var xr:Number;// = 0
private var lastTime:int;// = 0
private var pt:Point;
private var texture:BitmapData;
private var trig:Boolean;// = false
private var session:BitmapRenderSession;
private var theta:Number;
private var circles:Array;
private var cmat:Matrix;
private var view:View3D;
private var height:Number;
private var scaleMatrix:Matrix;
private var particles:Array;
private var mtx:Matrix;
private var view2:View3D;
private var fire:BitmapData;
public var zr:Number;// = 0
private var speed:Number;// = 0.04
public var offsetAmount:Number;// = 0
private var scale:Number;// = 1
private var fire2:BitmapData;
private var amount:int;// = 200
private var session2:BitmapRenderSession;
private var mat:BitmapMaterial;
private var blur:BlurFilter;
private var cnt:int;// = 0
private var mesh:MedusaMesh;
private var phi:Number;// = 0
public function MedusaParticles(){
circles = new Array(10);
fire = new Assets.Fire().bitmapData;
fire2 = new Assets.Tube().bitmapData;
mat = new BitmapMaterial(new BitmapData(0x0100, 0x0100, false, 0));
theta = (-(Math.PI) * 2);
mtx = new Matrix();
blur = new BlurFilter(4, 4, 1);
cmat = new Matrix();
pt = new Point();
super();
}
override public function set output(_arg1:BitmapData):void{
super.output = _arg1;
trace("Our");
view.clip = new RectangleClipping((-(_arg1.width) / 2), (-(_arg1.height) / 2), (_arg1.width / 2), (_arg1.height / 2));
view2.clip = view.clip;
}
override public function init(_arg1:Object=null):void{
super.init(_arg1);
if (_arg1.amount){
amount = _arg1.amount;
};
texture = _arg1.texture;
particles = new Array();
session = new BitmapRenderSession(1);
session2 = new BitmapRenderSession(2);
view = new View3D({session:session});
view2 = new View3D({session:session2});
view.clip = new RectangleClipping();
view.camera.position = new Number3D(0, 0, 50);
view.camera.lookAt(new Number3D(0, -10, 0));
view.camera.focus = 35;
view.camera.zoom = 10;
view2.camera = view.camera;
view2.clip = view.clip;
var _local2:int;
mesh = new MedusaMesh(8, texture);
mesh.rotationX = -80;
mesh.y = 5;
view.scene.addChild(mesh);
var _local3:Cylinder = new Cylinder({radius:30, height:1000, segmentsH:32, segmentsW:16, bothsides:true, openEnded:true, yUp:false, material:mat});
view2.scene.addChild(_local3);
_local3.z = 0;
}
override public function play(_arg1:Number):void{
var _local3:Number;
lastTime = (lastTime + _arg1);
cnt++;
phi = (phi + speed);
var _local2:Number = ((Math.sin((lastTime * 0.002)) * 32) + 32);
_local3 = (-((lastTime * 0.08)) % fire.height);
mat.bitmap.fillRect(mat.bitmap.rect, 0);
mtx.identity();
mtx.translate(_local2, _local3);
mat.bitmap.draw(fire, mtx);
mtx.translate(0, fire.height);
mat.bitmap.draw(fire, mtx);
mtx.identity();
mtx.translate((_local2 - 0x0100), _local3);
mat.bitmap.draw(fire, mtx);
mtx.translate(0, fire.height);
mat.bitmap.draw(fire, mtx);
_local3 = (-((lastTime * 0.04)) % fire2.height);
mtx.identity();
mtx.translate(_local2, _local3);
mat.bitmap.draw(fire2, mtx, null, BlendMode.DIFFERENCE);
mtx.translate(0, fire.height);
mat.bitmap.draw(fire2, mtx, null, BlendMode.DIFFERENCE);
mtx.identity();
mtx.translate((_local2 - 0x0100), _local3);
mat.bitmap.draw(fire2, mtx, null, BlendMode.DIFFERENCE);
mtx.translate(0, fire.height);
mat.bitmap.draw(fire2, mtx, null, BlendMode.DIFFERENCE);
view.render();
view2.render();
var _local4 = 1;
mesh.calc(_arg1);
if (xr != 0){
mesh.y = -15;
};
if (xr != 0){
mesh.children[0].rotationX = (mesh.children[0].rotationX + ((_arg1 * xr) * (Math.cos((_arg1 * 0.025)) + 1)));
};
if (zr != 0){
mesh.children[0].rotationZ = (mesh.children[0].rotationZ + ((_arg1 * zr) * (Math.cos((_arg1 * 0.025)) + 1)));
};
mesh.rotationY = (mesh.rotationY + ((_arg1 * 0.08) * (Math.cos((_arg1 * 0.025)) + 1)));
cmat.identity();
cmat.scale(2, 2);
var _local5:BitmapData = session2.getBitmapData(view2);
session2.getBitmapData(view2).applyFilter(session2.getBitmapData(view2), _local5.rect, pt, blur);
output.draw(_local5, cmat);
cmat.identity();
output.draw(session.getBitmapData(view), cmat, null, BlendMode.ADD);
}
public function impulse2():void{
mesh.impulse2();
}
public function impulse():void{
mesh.impulse();
}
}
}//package effects.meshParticles
Section 145
//RubikCubeEffect (effects.meshParticles.RubikCubeEffect)
package effects.meshParticles {
import evo.engine.*;
import flash.display.*;
import flash.geom.*;
import away3d.core.clip.*;
import away3d.containers.*;
import away3d.core.render.*;
import away3d.core.math.*;
import away3d.materials.*;
import effects.meta.*;
import flash.filters.*;
import away3d.lights.*;
import away3d.primitives.*;
public class RubikCubeEffect extends AbstractDemoEffect {
private var lastTime:int;// = 0
private var panoramaMaterialD:BitmapMaterial;
private var panoramaMaterialF:BitmapMaterial;
private var panoramaMaterialB:BitmapMaterial;
private var panoramaMaterialL:BitmapMaterial;
private var session:BitmapRenderSession;
private var panoramaMaterialU:BitmapMaterial;
private var trig:Boolean;// = false
private var panoramaMaterialR:BitmapMaterial;
private var theta:Number;
private var cmat:Matrix;
private var view:View3D;
private var origin:Point;
private var rcnt:int;// = 0
public var shad:DropShadowFilter;
public var zr:Number;// = 0
private var panoramaparser:PanoramaParser;
public var light1:PointLight3D;
public var light2:PointLight3D;
public var light3:PointLight3D;
public var rotX:Number;// = 0
public var rotY:Number;// = 0
public var rotZ:Number;// = 75
private var cnt:int;// = 0
private var mesh:RubiksMesh;
private var solvecube:Boolean;// = false
private var panorama:Skybox;
public var xr:Number;// = 0
public function RubikCubeEffect(){
shad = new DropShadowFilter(0, 45, 0, 1, 16, 16, 1);
theta = (-(Math.PI) * 2);
origin = new Point(0, 0);
cmat = new Matrix();
super();
}
override public function set output(_arg1:BitmapData):void{
super.output = _arg1;
trace("Our");
view.clip = new RectangleClipping((-(_arg1.width) / 2), (-(_arg1.height) / 2), (_arg1.width / 2), (_arg1.height / 2));
cmat.identity();
}
override public function init(_arg1:Object=null):void{
super.init(_arg1);
session = new BitmapRenderSession(1);
view = new View3D({session:session});
view.clip = new RectangleClipping();
view.camera.position = new Number3D(0, 100, 50);
view.camera.lookAt(new Number3D(0, 0, 0));
view.camera.focus = 35;
view.camera.zoom = 10;
view.x = 400;
view.y = 200;
light1 = new PointLight3D({brightness:450});
light2 = new PointLight3D({brightness:450});
light3 = new PointLight3D({brightness:450});
light1.position = new Number3D(500, 500, 500);
light2.position = new Number3D(-500, 500, 500);
light3.position = new Number3D(300, -500, 500);
view.scene.addChild(light1);
view.scene.addChild(light2);
view.scene.addChild(light3);
this.initMaterials();
panorama = new Skybox(panoramaMaterialF, panoramaMaterialL, panoramaMaterialB, panoramaMaterialR, panoramaMaterialU, panoramaMaterialD);
panorama.scale(5);
panorama.quarterFaces();
view.scene.addChild(panorama);
var _local2:int;
mesh = new RubiksMesh();
view.scene.addChild(mesh);
}
public function dispose():void{
panoramaparser.dispose();
}
override public function play(_arg1:Number):void{
lastTime = (lastTime + _arg1);
cnt++;
var _local2 = 1;
view.camera.position = new Number3D((Math.sin((lastTime / 750)) * 100), (Math.sin((lastTime / 1000)) * 100), (Math.cos((lastTime / 750)) * 100));
view.camera.lookAt(new Number3D(0, 0, 0));
rotX = (rotX - 0.1);
rotY = (rotY + 0.1);
mesh.rotationZ = (mesh.rotationZ + ((((rotZ - mesh.rotationZ) / 30) * _arg1) / 10));
mesh.rotationX = (mesh.rotationX + ((((rotX - mesh.rotationX) / 30) * _arg1) / 10));
mesh.rotationY = (mesh.rotationY + ((((rotY - mesh.rotationY) / 30) * _arg1) / 10));
mesh.update();
view.render();
var _local3:BitmapData = session.getBitmapData(view);
_local3.applyFilter(_local3, _local3.rect, origin, shad);
output.draw(_local3, cmat);
}
public function randRotation():void{
rotX = (rotX + 90);
rotY = (rotY + 90);
}
public function solve():void{
solvecube = true;
}
public function rotateNow():void{
var _local3:Object;
var _local1:int = (Math.random() * 3);
var _local2:int = ((Math.random() * 2) + 1);
if (solvecube){
if (mesh.rotations.length == 0){
trace("SOLVED!");
return;
};
_local3 = mesh.rotations.pop();
if (!mesh.rotateCube(_local3.side, _local3.amount, true)){
mesh.rotations.push(_local3);
};
} else {
switch (_local1){
case 0:
mesh.rotateCube(3, _local2);
break;
case 1:
mesh.rotateCube(0, _local2);
break;
case 2:
mesh.rotateCube(1, _local2);
break;
};
};
}
private function initMaterials():void{
panoramaparser = new PanoramaParser(new Assets.Panorama2());
panoramaMaterialF = new BitmapMaterial(panoramaparser.textureFront);
panoramaMaterialL = new BitmapMaterial(panoramaparser.textureLeft);
panoramaMaterialB = new BitmapMaterial(panoramaparser.textureBack);
panoramaMaterialR = new BitmapMaterial(panoramaparser.textureRight);
panoramaMaterialU = new BitmapMaterial(panoramaparser.textureUp);
panoramaMaterialD = new BitmapMaterial(panoramaparser.textureDown);
}
}
}//package effects.meshParticles
Section 146
//RubiksMesh (effects.meshParticles.RubiksMesh)
package effects.meshParticles {
import away3d.containers.*;
import away3d.materials.*;
import away3d.primitives.data.*;
import away3d.primitives.*;
public class RubiksMesh extends ObjectContainer3D {
private var backMat:Array;
private var green:ShadingColorMaterial;
private var tempMats:Array;
private var topMats:Array;
private var red:ShadingColorMaterial;
private var amountLeft:int;
private var cyan:ShadingColorMaterial;
private var dummy:ObjectContainer3D;
private var white:ShadingColorMaterial;
private var rotator:ObjectContainer3D;
private var amountToRotate:int;
public var rotations:Array;
private var leftMats:Array;
private var purple:ShadingColorMaterial;
private var tempFaces:Array;
private var sideToRotate:int;// = 0
private var rightMats:Array;
private var solving:Boolean;// = false
private var rotating:Boolean;
private var matMap:Array;
private var cubes:Array;
private var blue:ShadingColorMaterial;
private var bottomMats:Array;
private var colors:Array;
private var frontMat:Array;
private var amountInTurns:int;
private var yellow:ShadingColorMaterial;
private var black:ShadingColorMaterial;
public function RubiksMesh(_arg1:Object=null, ... _args){
var _local5:int;
var _local6:int;
var _local7:CubeMaterialsData;
var _local8:Cube;
purple = new ShadingColorMaterial(0x400040, {alpha:1});
blue = new ShadingColorMaterial(64, {alpha:1});
cyan = new ShadingColorMaterial(0x4040, {alpha:1});
green = new ShadingColorMaterial(0x4000, {alpha:1});
red = new ShadingColorMaterial(0x400000, {alpha:1});
yellow = new ShadingColorMaterial(0x404000, {alpha:1});
black = new ShadingColorMaterial(0x404040, {alpha:1});
white = new ShadingColorMaterial(0xFFFFFF, {alpha:1});
matMap = [purple, blue, cyan, green, red, yellow];
cubes = new Array();
frontMat = new Array(3);
backMat = new Array(3);
leftMats = new Array(3);
rightMats = new Array(3);
topMats = new Array(3);
bottomMats = new Array(3);
tempMats = [new Array(3), new Array(3), new Array(3)];
dummy = new ObjectContainer3D();
rotations = new Array();
tempFaces = new Array(3);
super(_arg1);
colors = Assets.colorwheelprovider.getAnalogous(160, 6, 60, 6, 0.7, 1);
purple = new ShadingColorMaterial(colors[0], {alpha:1});
blue = new ShadingColorMaterial(colors[1], {alpha:1});
cyan = new ShadingColorMaterial(colors[2], {alpha:1});
green = new ShadingColorMaterial(colors[3], {alpha:1});
red = new ShadingColorMaterial(colors[4], {alpha:1});
yellow = new ShadingColorMaterial(colors[5], {alpha:1});
matMap = [purple, blue, cyan, green, red, yellow];
rotator = new ObjectContainer3D();
rotator.x = ((1 * 12) - ((2 * 12) / 2));
rotator.y = ((1 * 12) - ((2 * 12) / 2));
rotator.z = ((2 * 12) - ((2 * 12) / 2));
dummy.addChild(rotator);
addChild(dummy);
var _local3:int;
while (_local3 < 3) {
frontMat[_local3] = new Array(3);
backMat[_local3] = new Array(3);
bottomMats[_local3] = new Array(3);
topMats[_local3] = new Array(3);
leftMats[_local3] = new Array(3);
rightMats[_local3] = new Array(3);
_local3++;
};
var _local4:int;
while (_local4 < 3) {
cubes[_local4] = new Array();
_local5 = 0;
while (_local5 < 3) {
cubes[_local4][_local5] = new Array();
_local6 = 0;
while (_local6 < 3) {
_local7 = new CubeMaterialsData();
if (_local6 == 0){
_local7.front = matMap[0];
frontMat[_local4][_local5] = _local7.front;
} else {
_local7.front = black;
};
if (_local6 == 2){
_local7.back = matMap[1];
backMat[(2 - _local4)][_local5] = _local7.back;
} else {
_local7.back = black;
};
if (_local5 == 2){
_local7.top = matMap[2];
topMats[_local4][_local6] = _local7.top;
} else {
_local7.top = black;
};
if (_local5 == 0){
_local7.bottom = matMap[3];
bottomMats[(2 - _local4)][(2 - _local6)] = _local7.bottom;
} else {
_local7.bottom = black;
};
if (_local4 == 0){
_local7.left = matMap[4];
leftMats[(2 - _local6)][_local5] = _local7.left;
} else {
_local7.left = black;
};
if (_local4 == 2){
_local7.right = matMap[5];
rightMats[_local6][_local5] = _local7.right;
} else {
_local7.right = black;
};
if ((((((_local4 == 1)) && ((_local5 == 1)))) && ((_local6 == 1)))){
_local8 = null;
_local8 = new Cube({width:10, height:10, depth:10, material:black});
dummy.addChild(_local8);
} else {
if (_local6 == 2){
_local8 = new Cube({width:10, height:10, depth:10, material:new ShadingColorMaterial(0x303030), cubeMaterials:_local7});
_local8.x = ((_local4 * 12) - 12);
_local8.y = ((_local5 * 12) - 12);
rotator.addChild(_local8);
} else {
_local8 = new Cube({width:10, height:10, depth:10, material:new ShadingColorMaterial(0x303030), cubeMaterials:_local7});
_local8.z = ((_local6 * 12) - ((2 * 12) / 2));
_local8.x = ((_local4 * 12) - ((2 * 12) / 2));
_local8.y = ((_local5 * 12) - ((2 * 12) / 2));
dummy.addChild(_local8);
};
};
cubes[_local4][_local5][_local6] = _local8;
_local6++;
};
_local5++;
};
_local4++;
};
}
private function rotateCW(_arg1:Array):void{
var _local2:ShadingColorMaterial;
_local2 = _arg1[0][0];
_arg1[0][0] = _arg1[0][2];
_arg1[0][2] = _arg1[2][2];
_arg1[2][2] = _arg1[2][0];
_arg1[2][0] = _local2;
_local2 = _arg1[0][1];
_arg1[0][1] = _arg1[1][2];
_arg1[1][2] = _arg1[2][1];
_arg1[2][1] = _arg1[1][0];
_arg1[1][0] = _local2;
}
private function rotateFront():void{
tempMats[0][0] = backMat[0][0];
tempMats[1][0] = backMat[1][0];
tempMats[2][0] = backMat[2][0];
tempMats[0][1] = backMat[0][1];
tempMats[1][1] = backMat[1][1];
tempMats[2][1] = backMat[2][1];
tempMats[0][2] = backMat[0][2];
tempMats[1][2] = backMat[1][2];
tempMats[2][2] = backMat[2][2];
backMat[0][0] = bottomMats[0][2];
backMat[1][0] = bottomMats[1][2];
backMat[2][0] = bottomMats[2][2];
backMat[0][1] = bottomMats[0][1];
backMat[1][1] = bottomMats[1][1];
backMat[2][1] = bottomMats[2][1];
backMat[0][2] = bottomMats[0][0];
backMat[1][2] = bottomMats[1][0];
backMat[2][2] = bottomMats[2][0];
bottomMats[0][0] = frontMat[2][0];
bottomMats[1][0] = frontMat[1][0];
bottomMats[2][0] = frontMat[0][0];
bottomMats[0][1] = frontMat[2][1];
bottomMats[1][1] = frontMat[1][1];
bottomMats[2][1] = frontMat[0][1];
bottomMats[0][2] = frontMat[2][2];
bottomMats[1][2] = frontMat[1][2];
bottomMats[2][2] = frontMat[0][2];
frontMat[0][0] = topMats[0][0];
frontMat[1][0] = topMats[1][0];
frontMat[2][0] = topMats[2][0];
frontMat[0][1] = topMats[0][1];
frontMat[1][1] = topMats[1][1];
frontMat[2][1] = topMats[2][1];
frontMat[0][2] = topMats[0][2];
frontMat[1][2] = topMats[1][2];
frontMat[2][2] = topMats[2][2];
topMats[0][0] = tempMats[2][2];
topMats[1][0] = tempMats[1][2];
topMats[2][0] = tempMats[0][2];
topMats[0][1] = tempMats[2][1];
topMats[1][1] = tempMats[1][1];
topMats[2][1] = tempMats[0][1];
topMats[0][2] = tempMats[2][0];
topMats[1][2] = tempMats[1][0];
topMats[2][2] = tempMats[0][0];
rotateCCW(leftMats);
rotateCW(rightMats);
}
private function rotateMaterials(_arg1:int, _arg2:Boolean):void{
if (_arg1 != 0){
switch (_arg1){
case 3:
if (_arg2){
rotateFront();
rotateFront();
rotateFront();
dummy.rotationX = (dummy.rotationX - 270);
} else {
rotateFront();
dummy.rotationX = (dummy.rotationX - 90);
};
break;
case 1:
rotateFront();
rotateFront();
dummy.rotationX = (dummy.rotationX - 180);
break;
};
updateMaterials();
};
}
private function updateMaterials():void{
var _local8:int;
var _local9:int;
var _local10:CubeMaterialsData;
var _local1:int;
var _local2:int;
var _local3:int;
var _local4:int;
var _local5:int;
var _local6:int;
var _local7:int;
while (_local7 < 3) {
_local8 = 0;
while (_local8 < 3) {
_local9 = 0;
while (_local9 < 3) {
if ((((((_local7 == 1)) && ((_local8 == 1)))) && ((_local9 == 1)))){
} else {
_local10 = cubes[_local7][_local8][_local9].cubeMaterials;
if (_local9 == 0){
_local10.front = frontMat[_local7][_local8];
};
if (_local9 == 2){
_local10.back = backMat[(2 - _local7)][_local8];
};
if (_local8 == 2){
_local10.top = topMats[_local7][_local9];
};
if (_local8 == 0){
_local10.bottom = bottomMats[(2 - _local7)][(2 - _local9)];
};
if (_local7 == 0){
_local10.left = leftMats[(2 - _local9)][_local8];
};
if (_local7 == 2){
_local10.right = rightMats[_local9][_local8];
};
cubes[_local7][_local8][_local9].cubeMaterials = _local10;
};
_local9++;
};
_local8++;
};
_local7++;
};
}
private function rotateMats():void{
while (amountToRotate < 0) {
amountToRotate = (amountToRotate + 360);
};
while (amountToRotate > 0) {
tempFaces[0] = bottomMats[0][0];
tempFaces[1] = bottomMats[1][0];
tempFaces[2] = bottomMats[2][0];
bottomMats[0][0] = rightMats[2][2];
bottomMats[1][0] = rightMats[2][1];
bottomMats[2][0] = rightMats[2][0];
rightMats[2][0] = topMats[2][2];
rightMats[2][1] = topMats[1][2];
rightMats[2][2] = topMats[0][2];
topMats[2][2] = leftMats[0][2];
topMats[1][2] = leftMats[0][1];
topMats[0][2] = leftMats[0][0];
leftMats[0][2] = tempFaces[2];
leftMats[0][1] = tempFaces[1];
leftMats[0][0] = tempFaces[0];
amountToRotate = (amountToRotate - 90);
rotateCW(backMat);
};
}
public function rotateCube(_arg1:int, _arg2:int, _arg3:Boolean=false):Boolean{
if (rotating){
return (false);
};
this.solving = _arg3;
if (!_arg3){
rotations.push({side:_arg1, amount:-(_arg2)});
};
sideToRotate = _arg1;
amountLeft = (amountToRotate = (_arg2 * 90));
amountInTurns = _arg2;
rotating = true;
if (!_arg3){
rotateMaterials(_arg1, false);
};
return (true);
}
public function update():void{
if (!rotating){
return;
};
rotator.rotationZ = (rotator.rotationZ - (10 * amountInTurns));
amountLeft = (amountLeft - (10 * amountInTurns));
if (amountLeft == 0){
rotating = false;
rotateMats();
updateMaterials();
rotator.rotationZ = (rotator.rotationZ + (90 * amountInTurns));
if (solving){
rotateMaterials(sideToRotate, true);
};
};
}
private function rotateCCW(_arg1:Array):void{
var _local2:ShadingColorMaterial;
_local2 = _arg1[0][0];
_arg1[0][0] = _arg1[2][0];
_arg1[2][0] = _arg1[2][2];
_arg1[2][2] = _arg1[0][2];
_arg1[0][2] = _local2;
_local2 = _arg1[0][1];
_arg1[0][1] = _arg1[1][0];
_arg1[1][0] = _arg1[2][1];
_arg1[2][1] = _arg1[1][2];
_arg1[1][2] = _local2;
}
}
}//package effects.meshParticles
Section 147
//MetaballEffect (effects.meta.MetaballEffect)
package effects.meta {
import evo.engine.*;
import flash.display.*;
import flash.geom.*;
import away3d.core.clip.*;
import away3d.containers.*;
import away3d.core.utils.*;
import away3d.core.render.*;
import away3d.core.math.*;
import away3d.materials.*;
import away3d.cameras.*;
import flash.filters.*;
import away3d.lights.*;
import away3d.primitives.*;
public class MetaballEffect extends AbstractDemoEffect {
private var sphere0:Sphere;
private var sphere1:Sphere;
private var sphere2:Sphere;
private var lastMouseX:Number;
private var panoramaMaterialF:BitmapMaterial;
private var scene:Scene3D;
private var sphere3:Sphere;
private var destPoint:Point;
private var panoramaMaterialD:BitmapMaterial;
private var panoramaMaterialL:BitmapMaterial;
private var renderSession2:BitmapRenderSession;
private var sphere1PhongMaterial:PhongBitmapMaterialCustom;
private var panoramaMaterialB:BitmapMaterial;
private var light:DirectionalLight3D;
private var panoramaMaterialU:BitmapMaterial;
private var panoramaMaterialR:BitmapMaterial;
private var renderSession:BitmapRenderSession;
private var view:View3D;
private var scene2:Scene3D;
private var data:BitmapData;
private var gti:int;// = 9000
private var view2:View3D;
private var lastTiltAngle:Number;
private var camera:Camera3D;
private var point3d0:Number3D;
private var lastMouseY:Number;
private var sphere2PhongMaterial:PhongBitmapMaterialCustom;
private var cmat:Matrix;
private var matrix:Array;
private var sphere3PhongMaterial:PhongBitmapMaterialCustom;
private var panoramaparser:PanoramaParser;
private var move:Boolean;// = false
private var alphaAdjustFilter:ColorMatrixFilter;
private var blur:BlurFilter;
private var lastPanAngle:Number;
private var sphere0PhongMaterial:PhongBitmapMaterialCustom;
private var panorama:Skybox;
public function MetaballEffect(){
destPoint = new Point();
matrix = new Array(1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 64, -1920);
alphaAdjustFilter = new ColorMatrixFilter(matrix);
blur = new BlurFilter(32, 32, 2);
cmat = new Matrix();
point3d0 = new Number3D(0, 0, 0);
super();
}
override public function set output(_arg1:BitmapData):void{
super.output = _arg1;
view.clip = new RectangleClipping((-(_arg1.width) / 2), (-(_arg1.height) / 2), (_arg1.width / 2), (_arg1.height / 2));
view2.clip = new RectangleClipping((-(_arg1.width) / 2), (-(_arg1.height) / 2), (_arg1.width / 2), (_arg1.height / 2));
}
override public function init(_arg1:Object=null):void{
super.init(_arg1);
renderSession = new BitmapRenderSession(1);
renderSession2 = new BitmapRenderSession(2);
camera = new Camera3D({zoom:2.5, focus:175, distance:40000});
camera.lookAt(new Number3D(0, 0, 0));
camera.position = new Number3D(0, 5000, -40000);
scene2 = new Scene3D();
view2 = new View3D({scene:scene2, camera:camera, session:renderSession2});
scene = new Scene3D();
view = new View3D({scene:scene, camera:camera, session:renderSession});
view.clip = new RectangleClipping();
view2.clip = new RectangleClipping();
initMaterials();
initLights();
initObjects();
}
override public function play(_arg1:Number):void{
gti = (gti + _arg1);
light.color = Assets.colorwheelprovider.getGradient((60 + (40 * Math.sin((gti / 1000)))), 1, 0.9, 1)[0];
sphere0.rotationY = (gti / 20);
sphere0.rotationX = (gti / 40);
sphere1.rotationY = (gti / 10);
sphere1.rotationX = (gti / 15);
sphere2.rotationY = (gti / 25);
sphere2.rotationZ = (gti / 10);
sphere3.rotationY = (gti / 12);
sphere3.rotationZ = (gti / 32);
sphere0.position = new Number3D((4000 * Math.sin((gti / 500))), (4000 * Math.cos((gti / 800))), (4000 * Math.sin((gti / 1000))));
sphere1.position = new Number3D((4000 * Math.sin((gti / 350))), (4000 * Math.cos((gti / 620))), (4000 * Math.sin((gti / 950))));
sphere2.position = new Number3D((4000 * Math.sin((gti / 650))), (4000 * Math.cos((gti / 410))), (4000 * Math.sin((gti / 760))));
sphere3.position = new Number3D((4000 * Math.sin((gti / 480))), (4000 * Math.cos((gti / 365))), (4000 * Math.sin((gti / 620))));
camera.position = new Number3D((Math.sin((gti / 750)) * 40000), (30000 + (Math.sin((gti / 1000)) * 10000)), (Math.cos((gti / 750)) * 10000));
camera.lookAt(point3d0);
view.render();
view2.render();
cmat.identity();
cmat.scale(2, 2);
output.draw(renderSession2.getBitmapData(view2), cmat);
data = renderSession.getBitmapData(view);
data.lock();
data.applyFilter(data, data.rect, destPoint, blur);
data.applyFilter(data, data.rect, destPoint, alphaAdjustFilter);
data.unlock();
output.draw(data);
}
private function initLights():void{
light = new DirectionalLight3D({color:0xFFFFFF, ambient:0.15, diffuse:0.45, specular:0.7});
light.x = 40000;
light.z = 40000;
light.y = 40000;
scene.addChild(light);
}
private function initObjects():void{
sphere0 = new Sphere();
sphere0.segmentsH = 3;
sphere0.segmentsW = 3;
sphere0.material = sphere0PhongMaterial;
sphere0.movePivot(((sphere0.minX + sphere0.maxX) / 2), ((sphere0.minY + sphere0.maxY) / 2), ((sphere0.minZ + sphere0.maxZ) / 2));
sphere0.y = (sphere0.x = (sphere0.z = 0));
sphere0.radius = 3000;
scene.addChild(sphere0);
sphere1 = new Sphere();
sphere1.segmentsH = 3;
sphere1.segmentsW = 3;
sphere1.material = sphere1PhongMaterial;
sphere1.movePivot(((sphere1.minX + sphere1.maxX) / 2), ((sphere1.minY + sphere1.maxY) / 2), ((sphere1.minZ + sphere1.maxZ) / 2));
sphere1.y = (sphere1.x = (sphere1.z = 0));
sphere1.radius = 3000;
scene.addChild(sphere1);
sphere2 = new Sphere();
sphere2.segmentsH = 3;
sphere2.segmentsW = 3;
sphere2.material = sphere2PhongMaterial;
sphere2.movePivot(((sphere2.minX + sphere2.maxX) / 2), ((sphere2.minY + sphere2.maxY) / 2), ((sphere2.minZ + sphere2.maxZ) / 2));
sphere2.y = (sphere2.x = (sphere2.z = 0));
sphere2.radius = 3000;
scene.addChild(sphere2);
sphere3 = new Sphere();
sphere3.segmentsH = 3;
sphere3.segmentsW = 3;
sphere3.material = sphere3PhongMaterial;
sphere3.movePivot(((sphere3.minX + sphere3.maxX) / 2), ((sphere3.minY + sphere3.maxY) / 2), ((sphere3.minZ + sphere3.maxZ) / 2));
sphere3.y = (sphere3.x = (sphere3.z = 0));
sphere3.radius = 3000;
scene.addChild(sphere3);
panorama = new Skybox(panoramaMaterialF, panoramaMaterialL, panoramaMaterialB, panoramaMaterialR, panoramaMaterialU, panoramaMaterialD);
panorama.scale(5);
panorama.quarterFaces();
scene2.addChild(panorama);
}
public function dispose():void{
panoramaparser.dispose();
}
public function hit():void{
sphere0.radius = (3000 + (1500 * Math.sin((gti / 1000))));
sphere1.radius = (3000 + (1500 * Math.sin((gti / 940))));
sphere2.radius = (3000 + (1500 * Math.sin((gti / 1300))));
sphere3.radius = (3000 + (1500 * Math.sin((gti / 720))));
}
private function initMaterials():void{
sphere0PhongMaterial = new PhongBitmapMaterialCustom(Cast.bitmap(Assets.Texture1), {specular:0.5});
sphere1PhongMaterial = new PhongBitmapMaterialCustom(Cast.bitmap(Assets.Texture2), {specular:0.5});
sphere2PhongMaterial = new PhongBitmapMaterialCustom(Cast.bitmap(Assets.Texture3), {specular:0.5});
sphere3PhongMaterial = new PhongBitmapMaterialCustom(Cast.bitmap(Assets.Texture4), {specular:0.5});
panoramaparser = new PanoramaParser(new Assets.Panorama());
panoramaMaterialF = new BitmapMaterial(panoramaparser.textureFront);
panoramaMaterialL = new BitmapMaterial(panoramaparser.textureLeft);
panoramaMaterialB = new BitmapMaterial(panoramaparser.textureBack);
panoramaMaterialR = new BitmapMaterial(panoramaparser.textureRight);
panoramaMaterialU = new BitmapMaterial(panoramaparser.textureUp);
panoramaMaterialD = new BitmapMaterial(panoramaparser.textureDown);
}
}
}//package effects.meta
Section 148
//PanoramaParser (effects.meta.PanoramaParser)
package effects.meta {
import flash.display.*;
import flash.geom.*;
public class PanoramaParser {
private var tLeft:BitmapData;
private var rect:Rectangle;
private var tDown:BitmapData;
private var tRight:BitmapData;
private var tUp:BitmapData;
private var tFront:BitmapData;
private var tBack:BitmapData;
private var point:Point;
public function PanoramaParser(_arg1:Bitmap){
point = new Point(0, 0);
super();
var _local2:Number = (_arg1.width / 4);
tUp = new BitmapData(_local2, _local2, true, 0);
tDown = new BitmapData(_local2, _local2, true, 0);
tLeft = new BitmapData(_local2, _local2, true, 0);
tRight = new BitmapData(_local2, _local2, true, 0);
tBack = new BitmapData(_local2, _local2, true, 0);
tFront = new BitmapData(_local2, _local2, true, 0);
rect = new Rectangle((_local2 * 2), 0, _local2, _local2);
tUp.copyPixels(_arg1.bitmapData, rect, point);
rect = new Rectangle((_local2 * 2), (_local2 * 2), _local2, _local2);
tDown.copyPixels(_arg1.bitmapData, rect, point);
rect = new Rectangle(_local2, _local2, _local2, _local2);
tLeft.copyPixels(_arg1.bitmapData, rect, point);
rect = new Rectangle((_local2 * 3), _local2, _local2, _local2);
tRight.copyPixels(_arg1.bitmapData, rect, point);
rect = new Rectangle(0, _local2, _local2, _local2);
tBack.copyPixels(_arg1.bitmapData, rect, point);
rect = new Rectangle((_local2 * 2), _local2, _local2, _local2);
tFront.copyPixels(_arg1.bitmapData, rect, point);
_arg1.bitmapData.dispose();
}
public function get textureRight():BitmapData{
return (tRight);
}
public function get textureDown():BitmapData{
return (tDown);
}
public function get textureFront():BitmapData{
return (tFront);
}
public function get textureLeft():BitmapData{
return (tLeft);
}
public function get textureUp():BitmapData{
return (tUp);
}
public function get textureBack():BitmapData{
return (tBack);
}
public function dispose():void{
this.tUp.dispose();
this.tUp = null;
this.tDown.dispose();
this.tDown = null;
this.tLeft.dispose();
this.tLeft = null;
this.tRight.dispose();
this.tRight = null;
this.tBack.dispose();
this.tBack = null;
this.tFront.dispose();
this.tFront = null;
}
}
}//package effects.meta
Section 149
//PhongBitmapMaterialCustom (effects.meta.PhongBitmapMaterialCustom)
package effects.meta {
import flash.display.*;
import away3d.materials.*;
import away3d.materials.shaders.*;
public class PhongBitmapMaterialCustom extends CompositeMaterial {
private var _specular:Number;
private var _shininess:Number;
private var _diffusePhongShader:DiffusePhongShader;
private var _specularPhongShader:SpecularPhongShader;
private var _bitmapMaterial:BitmapMaterial;
private var _phongShader:CompositeMaterial;
private var _ambientShader:AmbientShader;
public function PhongBitmapMaterialCustom(_arg1:BitmapData, _arg2:Object=null){
super(_arg2);
_shininess = ini.getNumber("shininess", 20);
_specular = ini.getNumber("specular", 0.7, {min:0, max:1});
_bitmapMaterial = new BitmapMaterial(_arg1, ini);
_phongShader = new CompositeMaterial({blendMode:BlendMode.DIFFERENCE});
_phongShader.materials.push((_ambientShader = new AmbientShader({blendMode:BlendMode.ADD})));
_phongShader.materials.push((_diffusePhongShader = new DiffusePhongShader({blendMode:BlendMode.ADD})));
_specularPhongShader = new SpecularPhongShader({shininess:_shininess, specular:_specular, blendMode:BlendMode.ADD});
materials = new Array();
materials.push(_bitmapMaterial);
materials.push(_phongShader);
if (_specular){
materials.push(_specularPhongShader);
};
}
public function get specular():Number{
return (_specular);
}
public function set specular(_arg1:Number):void{
_specular = _arg1;
_specularPhongShader.specular = _arg1;
if (((_specular) && ((materials.length < 3)))){
materials.push(_specularPhongShader);
} else {
if (materials.length > 2){
materials.pop();
};
};
}
public function get shininess():Number{
return (_shininess);
}
public function set shininess(_arg1:Number):void{
_shininess = _arg1;
_specularPhongShader.shininess = _arg1;
}
}
}//package effects.meta
Section 150
//AnalyzerFeedback (effects.post.AnalyzerFeedback)
package effects.post {
import evo.engine.*;
import flash.display.*;
import flash.geom.*;
import flash.filters.*;
public class AnalyzerFeedback extends AbstractPostProcessor {
private var layers:int;// = 10
public var blurOffsetX:Number;// = 0
public var xoff:int;// = 6
private var scale:Number;// = 1
private var pt:Point;
private var outMode:String;// = "normal"
public var zoom:Number;// = 0
private var blendMode:String;// = "screen"
public var yoff:int;// = -2
private var mat:Matrix;
private var resetBlur:Boolean;// = false
private var blur:BlurFilter;
private var scaleMatrix:Matrix;
private var ct:ColorTransform;
private var lastFrame:BitmapData;
private var clipMatrix:Matrix;
public var alphaFade:Number;// = 1
public var blurOffsetY:Number;// = 0
public function AnalyzerFeedback(){
ct = new ColorTransform(1, 1, 1, 1);
pt = new Point();
blur = new BlurFilter(1, 1, 1);
mat = new Matrix();
super();
}
override public function set output(_arg1:BitmapData):void{
super.output = _arg1;
input = new BitmapData(_arg1.width, _arg1.height, false, 0);
lastFrame = new BitmapData(_input.width, _input.height, false, 0);
}
override public function init(_arg1:Object=null):void{
if (_arg1.outMode){
outMode = _arg1.outMode;
};
if (_arg1.blendMode){
blendMode = _arg1.blendMode;
};
if (_arg1.xoff != null){
xoff = _arg1.xoff;
};
if (_arg1.yoff != null){
yoff = _arg1.yoff;
};
scaleMatrix = new Matrix();
if (_arg1.layers){
layers = _arg1.layers;
};
if (_arg1.zoom){
zoom = _arg1.zoom;
};
}
override public function play(_arg1:Number):void{
_input.lock();
_input.fillRect(_input.rect, 0);
mat.identity();
mat.translate(xoff, yoff);
_input.draw(lastFrame, mat, ct, blendMode);
super.play(_arg1);
ct.alphaMultiplier = alphaFade;
lastFrame.lock();
lastFrame.draw(_input, null, null, BlendMode.NORMAL);
lastFrame.unlock();
buffer.draw(_input, null, null, BlendMode.NORMAL);
}
}
}//package effects.post
Section 151
//BloomEffect (effects.post.BloomEffect)
package effects.post {
import evo.engine.*;
import flash.display.*;
import flash.geom.*;
import flash.filters.*;
public class BloomEffect extends AbstractPostProcessor {
private var orig:Point;
private var bloomer:BlurFilter;
private var extraBloom:int;// = 2
private var t:BitmapData;
private var clearBloom:Boolean;// = false
private var ct:ColorTransform;
private var bloomAmount:int;// = 32
public function BloomEffect(){
ct = new ColorTransform(1, 1, 1, 0.4);
super();
}
override public function play(_arg1:Number):void{
_input.lock();
_input.fillRect(_input.rect, 0);
super.play(_arg1);
_input.unlock();
t.lock();
if (clearBloom){
t.fillRect(t.rect, 0);
} else {
t.colorTransform(t.rect, ct);
};
t.applyFilter(_input, buffer.rect, orig, bloomer);
t.unlock();
buffer.draw(t, null, null, BlendMode.ADD);
var _local2:int;
while (_local2 < extraBloom) {
t.lock();
t.applyFilter(t, buffer.rect, orig, bloomer);
t.unlock();
buffer.draw(t, null, null, BlendMode.ADD);
_local2++;
};
buffer.draw(_input, null, null, BlendMode.ADD);
}
override public function set output(_arg1:BitmapData):void{
if (_arg1 == null){
return;
};
super.output = _arg1;
t = new BitmapData(_arg1.width, _arg1.height, true, 0);
defaultInput();
}
override public function init(_arg1:Object=null):void{
if (((!((_arg1.bloom == null))) && (!((_arg1.bloom == undefined))))){
bloomAmount = _arg1.bloom;
};
if (_arg1.extraBloom != null){
extraBloom = _arg1.extraBloom;
};
clearBloom = _arg1.clearBloom;
bloomer = new BlurFilter(bloomAmount, bloomAmount, 1);
orig = new Point(0, 0);
super.init(_arg1);
}
}
}//package effects.post
Section 152
//DelayEffect (effects.post.DelayEffect)
package effects.post {
import evo.engine.*;
import flash.display.*;
import flash.geom.*;
import flash.filters.*;
public class DelayEffect extends AbstractPostProcessor {
private var layers:int;// = 10
public var blurOffsetX:Number;// = 0
private var scale:Number;// = 1
private var pt:Point;
private var outMode:String;// = "normal"
public var zoom:Number;// = 0
private var blendMode:String;// = null
private var resetBlur:Boolean;// = false
private var mat:Matrix;
private var blur:BlurFilter;
private var scaleMatrix:Matrix;
private var ct:ColorTransform;
private var lastFrame:BitmapData;
private var clipMatrix:Matrix;
public var alphaFade:Number;// = 0.93
public var blurOffsetY:Number;// = 0
public function DelayEffect(){
ct = new ColorTransform(1, 1, 1, 0.3);
pt = new Point();
blur = new BlurFilter(1, 1, 1);
mat = new Matrix();
super();
}
override public function set output(_arg1:BitmapData):void{
super.output = _arg1;
input = new BitmapData(_arg1.width, _arg1.height, false, 0);
lastFrame = new BitmapData(_input.width, _input.height, false, 0);
}
override public function init(_arg1:Object=null):void{
if (_arg1.outMode){
outMode = _arg1.outMode;
};
if (_arg1.blendMode){
blendMode = _arg1.blendMode;
};
scaleMatrix = new Matrix();
if (_arg1.layers){
layers = _arg1.layers;
};
if (_arg1.zoom){
zoom = _arg1.zoom;
};
}
override public function play(_arg1:Number):void{
_input.lock();
_input.fillRect(_input.rect, 0);
mat.identity();
mat.translate((-(_input.width) / 2), (-(_input.height) / 2));
mat.translate((_input.width / 2), (_input.height / 2));
_input.draw(lastFrame, mat, ct, blendMode);
super.play(_arg1);
ct.alphaMultiplier = alphaFade;
lastFrame.lock();
lastFrame.draw(_input, null, null, BlendMode.NORMAL);
lastFrame.applyFilter(lastFrame, lastFrame.rect, pt, blur);
lastFrame.unlock();
buffer.draw(_input, null, null, BlendMode.NORMAL);
}
}
}//package effects.post
Section 153
//DowngradeEffect (effects.post.DowngradeEffect)
package effects.post {
import evo.engine.*;
import flash.display.*;
import flash.geom.*;
public class DowngradeEffect extends AbstractPostProcessor {
private var forceTransparent:Boolean;
private var scale:Number;// = 1
private var scaleMatrix:Matrix;
private var div:Number;
private var blendMode:String;
private var smooth:Boolean;// = false
override public function play(_arg1:Number):void{
_input.lock();
_input.fillRect(_input.rect, 0);
super.play(_arg1);
_input.unlock();
buffer.draw(_input, scaleMatrix, null, blendMode, null, smooth);
}
override public function set output(_arg1:BitmapData):void{
if (_arg1 == null){
return;
};
super.output = _arg1;
var _local2:Boolean = ((output.transparent) || (forceTransparent));
input = new BitmapData((output.width / scale), (output.height / div), _local2, 0);
}
override public function init(_arg1:Object=null):void{
if (_arg1.scale){
div = (scale = _arg1.scale);
scaleMatrix = new Matrix();
if (_arg1.smooth){
smooth = _arg1.smooth;
};
if (_arg1.scaley){
div = _arg1.scaley;
};
if (_arg1.forceTransparent != null){
forceTransparent = true;
};
scaleMatrix.scale(scale, div);
};
if (_arg1.blendMode){
blendMode = _arg1.blendMode;
};
super.init(_arg1);
}
}
}//package effects.post
Section 154
//GrayscaleEffect (effects.post.GrayscaleEffect)
package effects.post {
import evo.engine.*;
import flash.display.*;
import flash.geom.*;
import flash.filters.*;
public class GrayscaleEffect extends AbstractPostProcessor {
private var mat:Matrix;
private var orig:Point;
private var noiseMap:BitmapData;
private var showCnt:int;// = 0
private var cuts:int;// = 1
private var blur:BlurFilter;
private var myElements_array:Array;
private var myColorMatrix_filter:ColorMatrixFilter;
public function GrayscaleEffect(){
mat = new Matrix();
blur = new BlurFilter(2, 2, 1);
myElements_array = [0.3, 0.59, 0.11, 0, 0, 0.3, 0.59, 0.11, 0, 0, 0.3, 0.59, 0.11, 0, 0, 0, 0, 0, 1, 0];
myColorMatrix_filter = new ColorMatrixFilter(myElements_array);
super();
}
override public function set output(_arg1:BitmapData):void{
super.output = _arg1;
defaultInput();
noiseMap = new BitmapData(_arg1.width, _arg1.height, true, 0);
}
override public function init(_arg1:Object=null):void{
orig = new Point(0, 0);
super.init(_arg1);
}
override public function play(_arg1:Number):void{
_input.lock();
_input.fillRect(_input.rect, 0);
super.play(_arg1);
noiseMap.lock();
noiseMap.noise(_arg1, (0xFF - (Sequencer.sndChannel.leftPeak * 128)), 0xFF, 7, false);
noiseMap.applyFilter(noiseMap, buffer.rect, orig, blur);
noiseMap.unlock();
_input.draw(noiseMap, mat, null, BlendMode.MULTIPLY);
_input.applyFilter(_input, _input.rect, orig, myColorMatrix_filter);
_input.unlock();
buffer.draw(_input, mat);
}
}
}//package effects.post
Section 155
//RadialBlurEffect (effects.post.RadialBlurEffect)
package effects.post {
import evo.engine.*;
import flash.display.*;
import flash.geom.*;
import flash.filters.*;
public class RadialBlurEffect extends AbstractPostProcessor {
private var layers:int;// = 10
public var blurOffsetX:Number;// = 0
private var scale:Number;// = 1
private var pt:Point;
private var useBlur:Boolean;// = false
private var outMode:String;
private var transparent:Boolean;// = false
public var zoom:Number;// = 0
private var blendMode:String;// = null
private var resetBlur:Boolean;// = false
private var blur:BlurFilter;
private var scaleMatrix:Matrix;
private var ct:ColorTransform;
private var clipMatrix:Matrix;
public var alphaFade:Number;// = 0
public var blurOffsetY:Number;// = 0
public function RadialBlurEffect(){
ct = new ColorTransform();
blur = new BlurFilter(2, 2, 1);
pt = new Point();
super();
}
override public function set output(_arg1:BitmapData):void{
super.output = _arg1;
input = new BitmapData(buffer.width, buffer.height, transparent, 0);
}
override public function init(_arg1:Object=null):void{
if (_arg1.transparent){
transparent = _arg1.transparent;
};
if (_arg1.outMode){
outMode = _arg1.outMode;
};
if (_arg1.blendMode){
blendMode = _arg1.blendMode;
};
if (((!((_arg1.blur == null))) && ((_arg1.blur == true)))){
useBlur = true;
};
super.init(_arg1);
scaleMatrix = new Matrix();
if (_arg1.layers){
layers = _arg1.layers;
};
if (_arg1.zoom){
zoom = _arg1.zoom;
};
}
override public function play(_arg1:Number):void{
var _local3:Number;
_input.lock();
_input.fillRect(_input.rect, 0);
super.play(_arg1);
if (alphaFade < 0.01){
_input.unlock();
buffer.draw(_input, null, null, blendMode);
return;
};
_input.draw(_input, clipMatrix, null, blendMode);
ct.alphaMultiplier = alphaFade;
var _local2:int;
while (_local2 < layers) {
_local3 = (zoom * _local2);
scaleMatrix.a = (1 + _local3);
scaleMatrix.d = (1 + _local3);
scaleMatrix.tx = -((((_input.width + blurOffsetX) * _local3) * 0.5));
scaleMatrix.ty = -((((_input.height + blurOffsetY) * _local3) * 0.5));
_input.draw(_input, scaleMatrix, ct, BlendMode.ADD, _input.rect, false);
_local2++;
};
if (useBlur){
_input.applyFilter(_input, _input.rect, pt, blur);
};
_input.unlock();
buffer.draw(_input, null, null, outMode);
}
}
}//package effects.post
Section 156
//SplitterEffect (effects.post.SplitterEffect)
package effects.post {
import evo.engine.*;
import flash.display.*;
import flash.geom.*;
public class SplitterEffect extends AbstractPostProcessor {
private var mat:Matrix;
private var orig:Point;
private var showCnt:int;// = 0
public var cuts:int;// = 1
public function SplitterEffect(){
mat = new Matrix();
super();
}
override public function set output(_arg1:BitmapData):void{
if (_arg1 == null){
return;
};
super.output = _arg1;
defaultInput();
}
override public function play(_arg1:Number):void{
var _local5:int;
_input.lock();
_input.fillRect(_input.rect, 0);
super.play(_arg1);
_input.unlock();
var _local2:int = (_input.width / cuts);
var _local3:int = (_input.height / cuts);
var _local4:int;
while (_local4 < _input.height) {
_local5 = 0;
while (_local5 < _input.width) {
mat.identity();
mat.scale((1 / cuts), (1 / cuts));
mat.translate(_local5, _local4);
buffer.draw(_input, mat);
_local5 = (_local5 + _local2);
};
_local4 = (_local4 + _local3);
};
}
override public function init(_arg1:Object=null):void{
orig = new Point(0, 0);
super.init(_arg1);
}
}
}//package effects.post
Section 157
//TimeSpliceEffect (effects.post.TimeSpliceEffect)
package effects.post {
import evo.engine.*;
import flash.display.*;
import flash.geom.*;
public class TimeSpliceEffect extends AbstractPostProcessor {
private var mat:Matrix;
private var orig:Point;
private var frames:Array;
private var showCnt:int;// = 0
public var vcuts:int;// = 4
public var hcuts:int;// = 4
private var inb:BitmapData;
public function TimeSpliceEffect(){
mat = new Matrix();
frames = new Array();
super();
}
override public function set output(_arg1:BitmapData):void{
super.output = _arg1;
defaultInput();
var _local2:int = (output.width / hcuts);
var _local3:int = (output.height / vcuts);
}
public function reset(_arg1:Number, _arg2:Number):void{
this.hcuts = _arg1;
this.vcuts = _arg2;
if (frames.length <= 1){
frames = new Array((_arg1 * _arg2));
return;
};
while (frames.length < (_arg1 * _arg2)) {
frames.unshift(frames[(frames.length - 1)].clone());
};
while (frames.length > (_arg1 * _arg2)) {
frames.shift().dispose();
};
var _local3:int = (output.width / _arg1);
var _local4:int = (output.height / _arg2);
inb = new BitmapData(_local3, _local4, false, 0);
var _local5:int;
while (_local5 < frames.length) {
frames[_local5] = inb.clone();
_local5++;
};
}
override public function play(_arg1:Number):void{
var _local6:int;
_input.lock();
_input.fillRect(_input.rect, 0);
super.play(_arg1);
_input.unlock();
if ((((hcuts == 1)) && ((vcuts == 1)))){
buffer.draw(_input);
return;
};
var _local2:int = (_input.width / hcuts);
var _local3:int = (_input.height / vcuts);
mat.identity();
mat.translate((-(_input.width) / 2), (-(_input.height) / 2));
mat.scale((_local2 / buffer.width), (_local2 / buffer.width));
mat.translate((_local2 / 2), (_local3 / 2));
if (frames[0] != null){
inb = frames.shift();
} else {
inb = new BitmapData(_local2, _local3, false, 0);
};
inb.lock();
inb.fillRect(inb.rect, 0);
inb.draw(_input, mat);
inb.unlock();
frames.push(inb);
if (frames[0] == null){
_local6 = 0;
while (_local6 < frames.length) {
frames[_local6] = new BitmapData(_local2, _local3, false, 0);
_local6++;
};
};
var _local4:int;
var _local5:int;
_local6 = 0;
while (_local6 < frames.length) {
mat.identity();
mat.translate((_local4 * _local2), (_local5 * _local3));
_local4++;
if (_local4 == hcuts){
_local4 = 0;
_local5++;
};
buffer.draw(frames[_local6], mat);
_local6++;
};
showCnt++;
}
override public function init(_arg1:Object=null):void{
orig = new Point(0, 0);
if (_arg1.hcuts != null){
hcuts = _arg1.hcuts;
};
if (_arg1.vcuts != null){
vcuts = _arg1.vcuts;
};
super.init(_arg1);
frames = new Array((hcuts * vcuts));
}
}
}//package effects.post
Section 158
//PerlinZoom (effects.zoom.PerlinZoom)
package effects.zoom {
import evo.engine.*;
import flash.display.*;
import flash.geom.*;
import flash.filters.*;
import fi.simppa.display.color.*;
public class PerlinZoom extends AbstractDemoEffect {
private var size:Number;
private var pt:Point;
private var glow:GlowFilter;
private var zoomEnd:int;// = 150
private var dx:Number;// = 0
private var dy:Number;// = 0
private var gti:int;// = 0
private var dis:Number;// = 0
private var startspeed:Number;// = 0
private var data:BitmapData;
private var posx:Number;// = 0
private var adjustColorFilter:ColorMatrixFilter;
private var maxZoomLevelSplit:int;// = 75
private var change:int;// = 0
private var zoom0:Number;// = 19
private var zoom1:Number;// = 2
private var matrix:ColorMatrix;
private var colortransfrom1:ColorTransform;
private var speed:Number;// = 1.01
private var colortransfrom0:ColorTransform;
private var zoomStart:int;// = 2
private var posy:Number;// = 0
private var maskColor:uint;// = 0xFF0000
private var perlin:BitmapData;
private var offset_change:int;// = 0
private var perlin_offset:Array;
private var color:uint;// = 0xFFFF
private var threshold_offset:int;// = 0xFFFFFF
private var h:int;
private var threshold:int;
private var colors:Array;
private var w:int;
private var speedadd:Number;// = 0
public function PerlinZoom(){
matrix = new ColorMatrix();
adjustColorFilter = new ColorMatrixFilter(matrix);
colors = new Array(300);
colortransfrom0 = new ColorTransform(1, 1, 1, 1, 0, 0, 0, 0);
colortransfrom1 = new ColorTransform(1, 0.3, 0.5, 1, 0, 0, 0, 0);
perlin_offset = [new Point(0, 0), new Point(0, 0)];
pt = new Point(0, 0);
glow = new GlowFilter(0xFFFFFF, 1, 12, 12, 3, 1);
super();
}
override public function init(_arg1:Object=null):void{
super.init(_arg1);
colors = Assets.colorwheelprovider.getGradient(50, 150, 0, 1).concat(Assets.colorwheelprovider.getGradient(50, 150, 1, 0));
}
public function hit():void{
speedadd = 0.1;
}
private function drawPerlinFractal(_arg1:Number):void{
posx = (((w * _arg1) - w) / 2);
posy = (((h * _arg1) - h) / 2);
perlin_offset[0].x = (posx + dx);
perlin_offset[0].y = (posy + dy);
perlin_offset[1].x = (posx + (dx / 1.25));
perlin_offset[1].y = (posy + (dy / 1.25));
perlin.perlinNoise(_arg1, _arg1, 2, 1, false, true, 1, false, perlin_offset);
threshold = (threshold_offset / (1 + (_arg1 / (zoomEnd / 4))));
perlin.threshold(perlin, perlin.rect, pt, ">", threshold, color, maskColor, true);
perlin.threshold(perlin, perlin.rect, pt, "<", (threshold / 2), color, maskColor, true);
dis = (1 - (_arg1 / zoomEnd));
matrix.reset();
matrix.adjustColor(0, 0, (-0.5 + (Math.sin((gti / 300)) / 4)), 0.3);
adjustColorFilter.matrix = matrix;
perlin.applyFilter(perlin, perlin.rect, pt, adjustColorFilter);
glow.color = colors[int((150 + (150 * Math.sin((gti / 1000)))))];
glow.blurX = (16 * dis);
glow.blurY = (16 * dis);
glow.strength = (4 * dis);
perlin.applyFilter(perlin, perlin.rect, pt, glow);
}
override public function set output(_arg1:BitmapData):void{
super.output = _arg1;
if (!this.perlin){
perlin = new BitmapData(_arg1.width, _arg1.height, true, 0);
data = new BitmapData(_arg1.width, _arg1.height, false, 0);
w = _arg1.width;
h = _arg1.height;
};
}
override public function play(_arg1:Number):void{
gti = (gti + _arg1);
dx = (120 * Math.sin((gti / 1800)));
dy = (120 * Math.cos((gti / 1650)));
if (startspeed < 1.05){
startspeed = (0.85 + (gti / 6000));
};
speed = ((startspeed + (Math.sin((gti / 4000)) / 50)) + speedadd);
speedadd = (speedadd * 0.9);
zoom0 = (zoom0 * speed);
zoom1 = (zoom1 * speed);
if (zoom0 > zoomEnd){
zoom0 = zoomStart;
} else {
if (zoom1 > zoomEnd){
zoom1 = zoomStart;
};
};
data.lock();
data.fillRect(data.rect, 0);
if (zoom0 > zoom1){
change = 0;
drawPerlinFractal(zoom1);
data.draw(perlin, null, colortransfrom0);
drawPerlinFractal(zoom0);
data.draw(perlin, null, colortransfrom1);
} else {
change = 1;
drawPerlinFractal(zoom0);
data.draw(perlin, null, colortransfrom0);
drawPerlinFractal(zoom1);
data.draw(perlin, null, colortransfrom1);
};
data.unlock();
if (change != offset_change){
offset_change = change;
if (zoom0 > zoom1){
colortransfrom0 = new ColorTransform((0.5 + Math.random()), (0.5 + Math.random()), (0.5 + Math.random()), 1, 0, 0, 0, 0);
} else {
colortransfrom1 = new ColorTransform((0.5 + Math.random()), (0.5 + Math.random()), (0.5 + Math.random()), 1, 0, 0, 0, 0);
};
};
output.draw(data);
}
}
}//package effects.zoom
Section 159
//FlashEffect (effects.FlashEffect)
package effects {
import evo.engine.*;
import flash.display.*;
import flash.geom.*;
public class FlashEffect extends AbstractDemoEffect {
public var done:Boolean;// = true
public var color:uint;// = 4294967295
public var speed:Number;// = 1
private var colorTransform:ColorTransform;
private var flashMap:BitmapData;
private var graph:Graphics;
public function reset():void{
colorTransform.alphaMultiplier = 1;
done = false;
}
override public function init(_arg1:Object=null):void{
super.init(_arg1);
colorTransform = new ColorTransform(1, 1, 1, 0);
}
override public function set output(_arg1:BitmapData):void{
super.output = _arg1;
flashMap = new BitmapData(_arg1.width, _arg1.height, true, 0);
}
public function resetColor(_arg1:Number, _arg2:Number, _arg3:Number):void{
color = (((int((_arg1 * 0xFF)) << 16) | (int((_arg2 * 0xFF)) << 8)) | int((_arg3 * 0xFF)));
}
override public function play(_arg1:Number):void{
if (done){
return;
};
colorTransform.alphaMultiplier = (colorTransform.alphaMultiplier - (_arg1 / (1000 * speed)));
if (colorTransform.alphaMultiplier < 0){
colorTransform.alphaMultiplier = 0;
done = true;
};
flashMap.fillRect(flashMap.rect, color);
flashMap.colorTransform(flashMap.rect, colorTransform);
if (output != null){
output.draw(flashMap);
};
}
}
}//package effects
Section 160
//TextRender (effects.TextRender)
package effects {
import flash.display.*;
import flash.geom.*;
import flash.text.*;
import flash.filters.*;
public class TextRender extends Bitmap {
public static var mat:Matrix = new Matrix();
public static var blur:BlurFilter = new BlurFilter(4, 4, 1);
public function TextRender(_arg1:String, _arg2:TextFormat, _arg3:Number=1){
var _local4:TextField = new TextField();
_local4.embedFonts = true;
_local4.defaultTextFormat = _arg2;
_local4.text = _arg1;
_local4.width = _local4.textWidth;
_local4.height = _local4.textHeight;
_local4.autoSize = TextFieldAutoSize.LEFT;
var _local5:BitmapData = new BitmapData(_local4.width, _local4.height, true, 0);
_local5.draw(_local4);
_local5.applyFilter(_local5, _local5.rect, new Point(0, 0), _slot1.blur);
_slot1.mat.identity();
_slot1.mat.scale((0.25 * _arg3), 0.25);
var _local6:BitmapData = new BitmapData((_local5.width / 2), (_local5.height / 4), true, 0);
_local6.draw(_local5, _slot1.mat, new ColorTransform(), "normal", null, true);
super(_local6);
}
}
}//package effects
Section 161
//AbstractDemo (evo.engine.AbstractDemo)
package evo.engine {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
import flash.text.*;
import flash.net.*;
public class AbstractDemo extends Sprite {
private var started:Boolean;// = false
protected var engine:DemoEngine;
private var lastTime:int;
private var fps:TextField;
private var showFps:Boolean;
private var _lasttime:int;// = 0
private var demoSync:Sequencer;
public function AbstractDemo(_arg1:String, _arg2:Sequencer, _arg3:Boolean=false){
this.showFps = _arg3;
if (_arg3){
fps = new TextField();
};
this.demoSync = _arg2;
this.demoSync.addEventListener("complete", songLoaded);
this.demoSync.addEventListener(ProgressEvent.PROGRESS, progress);
this.demoSync.addEventListener("ioError", songLoaded);
this.demoSync.load(new URLRequest(_arg1));
}
public function startDemo():void{
started = true;
engine = new DemoEngine(800, 400);
engine.setSynch(demoSync);
generateParts();
addChild(engine);
engine.startDemo();
if (showFps){
this.addChild(fps);
this.addEventListener(Event.ENTER_FRAME, onEnterFrame);
fps.textColor = 0xFFFFFF;
fps.width = 200;
fps.x = 700;
};
}
protected function songLoaded(_arg1:Event):void{
if (_arg1.type == "ioError"){
demoSync.isTruePlay = false;
startDemo();
};
}
protected function progress(_arg1:ProgressEvent):void{
this.graphics.clear();
if ((((_arg1.bytesLoaded == _arg1.bytesTotal)) && (!(started)))){
started = true;
startDemo();
return;
};
var _local2:Number = (_arg1.bytesLoaded / _arg1.bytesTotal);
graphics.beginFill(0xFFFFFF);
graphics.drawRect((800 * _local2), ((400 / 2) - 10), (800 * (1 - _local2)), 20);
graphics.endFill();
}
protected function onEnterFrame(_arg1:Event):void{
var _local2:uint;
if (showFps){
_local2 = getTimer();
fps.text = int((1000 / (_local2 - _lasttime))).toString();
_lasttime = _local2;
};
}
protected function generateParts():void{
}
}
}//package evo.engine
Section 162
//AbstractDemoEffect (evo.engine.AbstractDemoEffect)
package evo.engine {
import flash.display.*;
public class AbstractDemoEffect implements IDemoEffect {
private var buffer:BitmapData;
public function get output():BitmapData{
return (buffer);
}
public function play(_arg1:Number):void{
}
public function set output(_arg1:BitmapData):void{
trace("Set buffeR");
this.buffer = _arg1;
}
public function init(_arg1:Object=null):void{
}
}
}//package evo.engine
Section 163
//AbstractPart (evo.engine.AbstractPart)
package evo.engine {
public class AbstractPart implements IDemoPart {
protected var output:IEffectContainer;
protected var sync:Sequencer;
public function AbstractPart(_arg1:Sequencer){
this.sync = _arg1;
}
protected function cleanup():void{
}
protected function on_phase(_arg1:uint):void{
trace("Phase");
sync.phase.removeListener(on_phase);
cleanup();
}
public function preInit(_arg1:IEffectContainer):void{
this.output = _arg1;
}
public function init(_arg1:IEffectContainer):void{
sync.phase.addListener(on_phase);
}
public function postPlay(_arg1:Number):void{
}
public function prePlay(_arg1:Number):void{
}
}
}//package evo.engine
Section 164
//AbstractPostProcessor (evo.engine.AbstractPostProcessor)
package evo.engine {
import flash.display.*;
import flash.geom.*;
public class AbstractPostProcessor implements IEffectContainer, IDemoEffect {
protected var buffer:BitmapData;
private var childEffects:Array;
protected var scaler:Matrix;
protected var _input:BitmapData;
public function AbstractPostProcessor(){
childEffects = new Array();
}
public function get output():BitmapData{
return (buffer);
}
public function set output(_arg1:BitmapData):void{
this.buffer = _arg1;
}
protected function copyInput():void{
buffer.lock();
buffer.fillRect(buffer.rect, 0);
buffer.draw(_input, scaler);
buffer.unlock();
}
protected function defaultInput():void{
var _local1:BitmapData = new BitmapData(buffer.width, buffer.height, true, 0);
input = _local1;
}
public function get input():BitmapData{
return (_input);
}
public function addEffect(_arg1:IDemoEffect):void{
_arg1.output = _input;
childEffects.push(_arg1);
}
public function set input(_arg1:BitmapData):void{
var _local2:IDemoEffect;
this._input = _arg1;
if (childEffects.length != 0){
for each (_local2 in childEffects) {
_local2.output = _input;
};
};
}
public function removeEffect(_arg1:IDemoEffect):void{
var efx = _arg1;
var tmp:Function = function (_arg1, _arg2:int, _arg3:Array):Boolean{
return (!((_arg1 == efx)));
};
childEffects = childEffects.filter(tmp);
}
public function init(_arg1:Object=null):void{
}
public function play(_arg1:Number):void{
var _local2:IDemoEffect;
for each (_local2 in childEffects) {
_local2.play(_arg1);
};
}
}
}//package evo.engine
Section 165
//DefaultPreloader (evo.engine.DefaultPreloader)
package evo.engine {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
public class DefaultPreloader extends MovieClip {
public static var demo:DefaultPreloader;
public function DefaultPreloader(){
stop();
stage.scaleMode = StageScaleMode.NO_SCALE;
addEventListener(Event.ENTER_FRAME, onEnterFrame);
stage.quality = "medium";
stage.frameRate = 31;
demo = this;
}
private function init():void{
var _local2:Object;
var _local1:Class = Class(getDefinitionByName("DemoMain"));
if (_local1){
_local2 = new (_local1);
addChild((_local2 as DisplayObject));
};
}
public function onEnterFrame(_arg1:Event):void{
var _local2:Number;
graphics.clear();
if (framesLoaded == totalFrames){
removeEventListener(Event.ENTER_FRAME, onEnterFrame);
nextFrame();
init();
} else {
_local2 = (root.loaderInfo.bytesLoaded / root.loaderInfo.bytesTotal);
graphics.beginFill(0xFFFFFF);
graphics.drawRect(0, ((400 / 2) - 10), (800 * _local2), 20);
graphics.endFill();
};
}
}
}//package evo.engine
Section 166
//DemoEngine (evo.engine.DemoEngine)
package evo.engine {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
public class DemoEngine extends Bitmap implements IEffectContainer {
public var buffer:BitmapData;
private var lastTime:uint;
private var currentEffects:Array;
private var curPart:IDemoPart;
private var frameListeners:Array;
public var sync:Sequencer;
private var postProcessors:Dictionary;
private var currentEffect:IDemoEffect;
private var curTrigId:uint;
private var demoParts:Array;
public function DemoEngine(_arg1:int, _arg2:int){
buffer = new BitmapData(_arg1, _arg2, false, 0);
super(buffer);
demoParts = new Array();
currentEffects = new Array();
frameListeners = new Array();
buffer.lock();
buffer.fillRect(buffer.rect, 0);
buffer.unlock();
}
public function get input():BitmapData{
return (buffer);
}
private function onFrame(_arg1:Event):void{
var _local4:IDemoEffect;
buffer.lock();
buffer.fillRect(buffer.rect, 0);
this.sync.tick();
if (curPart == null){
buffer.unlock();
return;
};
var _local2:uint = getTimer();
var _local3:uint = (_local2 - lastTime);
curPart.prePlay(_local3);
for each (_local4 in currentEffects) {
_local4.play(_local3);
};
curPart.postPlay(_local3);
lastTime = _local2;
buffer.unlock();
}
private function onPhase(_arg1:uint):void{
curPart = demoParts.shift();
if (curPart == null){
return;
};
curPart.init(this);
}
public function startDemo():void{
this.sync.play((0 * 1000));
lastTime = getTimer();
addEventListener("enterFrame", onFrame);
curPart = demoParts.shift();
curPart.init(this);
}
public function setSynch(_arg1:Sequencer):void{
this.sync = _arg1;
this.sync.phase.addListener(onPhase);
}
public function addPart(_arg1:IDemoPart, _arg2:IEffectContainer):void{
demoParts.push(_arg1);
_arg1.preInit(_arg2);
}
public function removeEffect(_arg1:IDemoEffect):void{
var efx = _arg1;
var tmp:Function = function (_arg1, _arg2:int, _arg3:Array):Boolean{
return (!((_arg1 == efx)));
};
currentEffects = currentEffects.filter(tmp);
}
public function addEffect(_arg1:IDemoEffect):void{
_arg1.output = buffer;
currentEffects.push(_arg1);
}
}
}//package evo.engine
Section 167
//IDemoEffect (evo.engine.IDemoEffect)
package evo.engine {
import flash.display.*;
public interface IDemoEffect {
function init(_arg1:Object=null):void;
function set output(_arg1:BitmapData):void;
function play(_arg1:Number):void;
}
}//package evo.engine
Section 168
//IDemoPart (evo.engine.IDemoPart)
package evo.engine {
public interface IDemoPart {
function init(_arg1:IEffectContainer):void;
function preInit(_arg1:IEffectContainer):void;
function postPlay(_arg1:Number):void;
function prePlay(_arg1:Number):void;
}
}//package evo.engine
Section 169
//IEffectContainer (evo.engine.IEffectContainer)
package evo.engine {
import flash.display.*;
public interface IEffectContainer {
function get input():BitmapData;
function addEffect(_arg1:IDemoEffect):void;
function removeEffect(_arg1:IDemoEffect):void;
}
}//package evo.engine
Section 170
//Sequencer (evo.engine.Sequencer)
package evo.engine {
import flash.events.*;
import flash.media.*;
import flash.utils.*;
public class Sequencer extends Sound {
private var intervalId:Number;
private var missTime:Number;
private var isPlay:Boolean;// = false
private var tickTime:Number;
private var lastRealTickTime:Number;// = 0
private var startTime:Number;// = 0
private var tickOffset:Number;// = 0
private var offset:Number;// = 0
private var bpm:Number;// = 125
private var tickListeners:Array;
public var loop:Boolean;// = false
private var tickers:Array;
private var bytes:ByteArray;
private var tickListenerId:uint;// = 0
private var lastTickTime:Number;// = 0
private var tickListenerList:Array;
private var tickAddPos:Number;// = 0
private var truePlay:Boolean;// = true
private var tickPos:Number;// = 0
public var phase:Tick;
private static var calcSpec:Boolean = false;
public static var spectrum:Array = new Array(128);
public static var sndChannel:SoundChannel;
public function Sequencer(){
tickListeners = new Array();
tickListenerList = new Array();
tickers = new Array();
phase = new Tick();
bytes = new ByteArray();
super();
}
public function stop():void{
isPlay = false;
this.stop();
clearInterval(intervalId);
}
public function setOffset(_arg1:Number):void{
this.offset = _arg1;
}
public function addTickers(... _args):void{
var _local2:TickPattern;
var _local3:int;
var _local4:Array;
for each (_local2 in _args) {
_local3 = 0;
while (_local3 < _local2.ticks.length) {
_local4 = tickers[(_local2.ticks[_local3] + tickAddPos)];
if (_local4 == null){
_local4 = new Array();
};
_local4.push(_local2.ticker);
tickers[(_local2.ticks[_local3] + tickAddPos)] = _local4;
_local3++;
};
};
tickAddPos = (tickAddPos + (4 * 4));
}
public function setBPM(_arg1:Number):void{
this.bpm = _arg1;
this.tickTime = (60000 / (_arg1 * 4));
missTime = tickTime;
}
private function onSndComplete(_arg1:Event):void{
if (loop){
sndChannel.removeEventListener(Event.SOUND_COMPLETE, onSndComplete);
sndChannel = super.play(0, 0, null);
sndChannel.addEventListener(Event.SOUND_COMPLETE, onSndComplete);
} else {
sndChannel.removeEventListener(Event.SOUND_COMPLETE, onSndComplete);
};
}
public function set isTruePlay(_arg1:Boolean):void{
this.truePlay = _arg1;
}
public function fireTick():void{
var _local1:Tick;
if (tickers[tickPos] != undefined){
for each (_local1 in tickers[tickPos]) {
_local1.run(tickPos);
};
};
tickPos = (tickPos + 1);
}
override public function play(_arg1:Number=0, _arg2:int=0, _arg3:SoundTransform=null):SoundChannel{
isPlay = true;
if (truePlay){
sndChannel = super.play(_arg1, _arg2, _arg3);
sndChannel.addEventListener(Event.SOUND_COMPLETE, onSndComplete);
} else {
_arg1 = getTimer();
};
return (sndChannel);
}
public function tick():void{
var _local1:Number;
var _local2:Number;
var _local3:int;
var _local4:Number;
var _local5:Number;
if (!isPlay){
return;
};
if (calcSpec){
SoundMixer.computeSpectrum(bytes, true, 4);
_local3 = 0;
while (_local3 < 128) {
_local4 = bytes.readFloat();
if (_local3 == 0){
_local2 = _local4;
} else {
_local2 = (_local2 + ((_local4 - _local2) / 8));
};
_local3++;
spectrum[_local3] = (_local2 * 240);
};
};
if (truePlay){
_local1 = ((sndChannel.position - offset) - lastTickTime);
lastTickTime = (sndChannel.position - offset);
} else {
_local5 = (getTimer() - startTime);
_local1 = ((_local5 - offset) - lastTickTime);
lastTickTime = (_local5 - offset);
};
missTime = (missTime - _local1);
while (missTime < -(tickOffset)) {
tickOffset = (missTime + tickOffset);
missTime = tickTime;
fireTick();
};
}
public static function endSpecCalc():void{
calcSpec = false;
}
public static function startSpecCalc():void{
calcSpec = true;
}
}
}//package evo.engine
Section 171
//Tick (evo.engine.Tick)
package evo.engine {
public class Tick {
private var onetimers:Array;
private var listeners:Array;
public function Tick(){
listeners = new Array();
onetimers = new Array();
super();
}
public function addOneTimer(_arg1:Function):void{
onetimers.push(_arg1);
}
public function addListener(_arg1:Function):void{
listeners.push(_arg1);
}
public function run(_arg1:uint):void{
var _local2:int;
_local2 = listeners.length;
while (_local2 > 0) {
_local2--;
var _local4 = listeners;
_local4[_local2](_arg1);
};
_local2 = onetimers.length;
var _local3:int = onetimers.length;
while (_local2 > 0) {
_local2--;
_local4 = onetimers;
_local4[_local2](_arg1);
};
onetimers.splice(0, _local3);
}
public function removeListener(_arg1:Function):void{
var func = _arg1;
var tmp:Function = function (_arg1, _arg2:int, _arg3:Array):Boolean{
return (!((_arg1 == func)));
};
listeners = listeners.filter(tmp);
}
}
}//package evo.engine
Section 172
//TickPattern (evo.engine.TickPattern)
package evo.engine {
public class TickPattern {
public var ticker:Tick;
public var ticks:Array;
public function TickPattern(_arg1:Tick, ... _args){
ticks = new Array();
super();
this.ticker = _arg1;
var _local3:int;
while (_local3 < _args.length) {
this.ticks.push(int(Math.floor((_args[_local3] * 4))));
_local3++;
};
}
}
}//package evo.engine
Section 173
//ColorMatrix (fi.simppa.display.color.ColorMatrix)
package fi.simppa.display.color {
public dynamic class ColorMatrix extends Array {
private static const IDENTITY_MATRIX:Array = [1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1];
private static const LENGTH:Number = IDENTITY_MATRIX.length;
private static const DELTA_INDEX:Array = [0, 0.01, 0.02, 0.04, 0.05, 0.06, 0.07, 0.08, 0.1, 0.11, 0.12, 0.14, 0.15, 0.16, 0.17, 0.18, 0.2, 0.21, 0.22, 0.24, 0.25, 0.27, 0.28, 0.3, 0.32, 0.34, 0.36, 0.38, 0.4, 0.42, 0.44, 0.46, 0.48, 0.5, 0.53, 0.56, 0.59, 0.62, 0.65, 0.68, 0.71, 0.74, 0.77, 0.8, 0.83, 0.86, 0.89, 0.92, 0.95, 0.98, 1, 1.06, 1.12, 1.18, 1.24, 1.3, 1.36, 1.42, 1.48, 1.54, 1.6, 1.66, 1.72, 1.78, 1.84, 1.9, 1.96, 2, 2.12, 2.25, 2.37, 2.5, 2.62, 2.75, 2.87, 3, 3.2, 3.4, 3.6, 3.8, 4, 4.3, 4.7, 4.9, 5, 5.5, 6, 6.5, 6.8, 7, 7.3, 7.5, 7.8, 8, 8.4, 8.7, 9, 9.4, 9.6, 9.8, 10];
public function ColorMatrix(){
reset();
}
public function adjustBrightness(_arg1:Number=0):void{
if (_arg1 == 0){
return;
};
if (_arg1 > 1){
_arg1 = 1;
} else {
if (_arg1 < -1){
_arg1 = -1;
};
};
_arg1 = (_arg1 * 0xFF);
multiplyMatrix([1, 0, 0, 0, _arg1, 0, 1, 0, 0, _arg1, 0, 0, 1, 0, _arg1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1]);
}
public function adjustContrast(_arg1:Number=0):void{
var _local2:Number;
if (_arg1 == 0){
return;
};
if (_arg1 > 1){
_arg1 = 1;
} else {
if (_arg1 < -1){
_arg1 = -1;
};
};
_arg1 = (_arg1 * 100);
if (_arg1 < 0){
_local2 = (127 + ((_arg1 / 100) * 127));
} else {
_local2 = (_arg1 % 1);
if (_local2 == 0){
_local2 = DELTA_INDEX[_arg1];
} else {
_local2 = ((DELTA_INDEX[(_arg1 << 0)] * (1 - _local2)) + (DELTA_INDEX[((_arg1 << 0) + 1)] * _local2));
};
_local2 = ((_local2 * 127) + 127);
};
multiplyMatrix([(_local2 / 127), 0, 0, 0, (0.5 * (127 - _local2)), 0, (_local2 / 127), 0, 0, (0.5 * (127 - _local2)), 0, 0, (_local2 / 127), 0, (0.5 * (127 - _local2)), 0, 0, 0, 1, 0, 0, 0, 0, 0, 1]);
}
public function adjustColor(_arg1:Number=0, _arg2:Number=0, _arg3:Number=0, _arg4:Number=0):void{
adjustHue(_arg4);
adjustContrast(_arg2);
adjustBrightness(_arg1);
adjustSaturation(_arg3);
}
protected function multiplyMatrix(_arg1:Array):void{
var _local4:int;
var _local5:Number;
var _local6:int;
var _local2:Array = new Array(_arg1.length);
var _local3:int;
while (_local3 < 5) {
_local4 = 0;
while (_local4 < 5) {
_local2[_local4] = this[(_local4 + (_local3 * 5))];
_local4++;
};
_local4 = 0;
while (_local4 < 5) {
_local5 = 0;
_local6 = 0;
while (_local6 < 5) {
_local5 = (_local5 + (_arg1[(_local4 + (_local6 * 5))] * _local2[_local6]));
_local6++;
};
this[(_local4 + (_local3 * 5))] = _local5;
_local4++;
};
_local3++;
};
}
public function adjustSaturation(_arg1:Number=0):void{
if (_arg1 == 0){
return;
};
if (_arg1 > 1){
_arg1 = 1;
} else {
if (_arg1 < -1){
_arg1 = -1;
};
};
_arg1 = (_arg1 * 100);
var _local2:Number = (1 + ((_arg1)>0) ? ((3 * _arg1) / 100) : (_arg1 / 100));
var _local3:Number = 0.3086;
var _local4:Number = 0.6094;
var _local5:Number = 0.082;
multiplyMatrix([((_local3 * (1 - _local2)) + _local2), (_local4 * (1 - _local2)), (_local5 * (1 - _local2)), 0, 0, (_local3 * (1 - _local2)), ((_local4 * (1 - _local2)) + _local2), (_local5 * (1 - _local2)), 0, 0, (_local3 * (1 - _local2)), (_local4 * (1 - _local2)), ((_local5 * (1 - _local2)) + _local2), 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1]);
}
public function adjustHue(_arg1:Number=0):void{
if (_arg1 == 0){
return;
};
if (_arg1 > 1){
_arg1 = 1;
} else {
if (_arg1 < -1){
_arg1 = -1;
};
};
_arg1 = (_arg1 * Math.PI);
var _local2:Number = Math.cos(_arg1);
var _local3:Number = Math.sin(_arg1);
var _local4:Number = 0.213;
var _local5:Number = 0.715;
var _local6:Number = 0.072;
multiplyMatrix([((_local4 + (_local2 * (1 - _local4))) + (_local3 * -(_local4))), ((_local5 + (_local2 * -(_local5))) + (_local3 * -(_local5))), ((_local6 + (_local2 * -(_local6))) + (_local3 * (1 - _local6))), 0, 0, ((_local4 + (_local2 * -(_local4))) + (_local3 * 0.143)), ((_local5 + (_local2 * (1 - _local5))) + (_local3 * 0.14)), ((_local6 + (_local2 * -(_local6))) + (_local3 * -0.283)), 0, 0, ((_local4 + (_local2 * -(_local4))) + (_local3 * -((1 - _local4)))), ((_local5 + (_local2 * -(_local5))) + (_local3 * _local5)), ((_local6 + (_local2 * (1 - _local6))) + (_local3 * _local6)), 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1]);
}
public function reset():void{
var _local1:int;
while (_local1 < LENGTH) {
this[_local1] = IDENTITY_MATRIX[_local1];
_local1++;
};
}
}
}//package fi.simppa.display.color
Section 174
//ColorWheel (fi.simppa.display.color.ColorWheel)
package fi.simppa.display.color {
import flash.display.*;
import flash.geom.*;
public class ColorWheel extends ColorWheelMath {
private var bitmapdata:BitmapData;
public var marginal:int;// = 8
public var brightness:Number;// = 1
public var radius:int;// = 100
public var initialized:Boolean;// = false
private var wheel:Sprite;
public function ColorWheel(_arg1:int=100, _arg2:Number=1, _arg3:Boolean=true){
wheel = new Sprite();
this.radius = _arg1;
this.brightness = _arg2;
if (_arg3){
create(_arg1, _arg2);
};
}
public function get bitmapwheel():BitmapData{
return (bitmapdata);
}
public function get vectorWheel():Sprite{
return (wheel);
}
public function create(_arg1:int=0, _arg2:Number=0):void{
var _local3:Number;
var _local4:int;
var _local5:Matrix;
var _local6:Number;
var _local7:Number;
if (_arg1){
this.radius = _arg1;
} else {
_arg1 = this.radius;
};
if (_arg2){
this.brightness = _arg2;
} else {
_arg2 = this.brightness;
};
var _local8:Number = (1 + (_arg1 / 50));
this.wheel.graphics.clear();
var _local9:int;
while (_local9 < 360) {
_local3 = (_local9 * (Math.PI / 180));
_local4 = angle_to_colour(_local3, _arg2);
_local6 = ((_arg1 + marginal) * Math.cos(_local3));
_local7 = ((_arg1 + marginal) * Math.sin(_local3));
_local5 = new Matrix();
_local5.createGradientBox((_arg1 * 2), (_arg1 * 2), _local3, -(_arg1), -(_arg1));
this.wheel.graphics.lineStyle(_local8, 0, 1, false, LineScaleMode.NONE, CapsStyle.NONE);
this.wheel.graphics.lineGradientStyle(GradientType.LINEAR, [0xFFFFFF, _local4], [1, 1], [127, 0xFF], _local5);
this.wheel.graphics.moveTo(0, 0);
this.wheel.graphics.lineTo(_local6, _local7);
_local9++;
};
_local5 = new Matrix();
_local5.tx = (_arg1 + marginal);
_local5.ty = (_arg1 + marginal);
bitmapdata = new BitmapData((this.wheel.width + marginal), (this.wheel.height + marginal), false, 0);
bitmapdata.draw(this.wheel, _local5);
initialized = true;
}
}
}//package fi.simppa.display.color
Section 175
//ColorWheelMath (fi.simppa.display.color.ColorWheelMath)
package fi.simppa.display.color {
public class ColorWheelMath {
private static const HEX_RANGE:Number = 1.0471975511966;
public static function angle_to_colour(_arg1:Number, _arg2:Number=1):uint{
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:uint = Math.floor((_arg1 / HEX_RANGE));
switch (_local6){
case 0:
_local3 = 1;
_local5 = 0;
break;
case 1:
_local4 = 1;
_local5 = 0;
break;
case 2:
_local3 = 0;
_local4 = 1;
break;
case 3:
_local3 = 0;
_local5 = 1;
break;
case 4:
_local4 = 0;
_local5 = 1;
break;
case 5:
_local3 = 1;
_local4 = 0;
break;
};
if (isNaN(_local3)){
_local3 = magnitude_from_hex_area(_arg1, _local6);
} else {
if (isNaN(_local4)){
_local4 = magnitude_from_hex_area(_arg1, _local6);
} else {
if (isNaN(_local5)){
_local5 = magnitude_from_hex_area(_arg1, _local6);
};
};
};
return ((((((_local3 * _arg2) * 0xFF) << 16) | (((_local4 * _arg2) * 0xFF) << 8)) | ((_local5 * _arg2) * 0xFF)));
}
private static function magnitude_from_hex_area(_arg1:Number, _arg2:uint):Number{
_arg1 = (_arg1 - (_arg2 * HEX_RANGE));
if ((_arg2 % 2) != 0){
_arg1 = (HEX_RANGE - _arg1);
};
return ((_arg1 / HEX_RANGE));
}
}
}//package fi.simppa.display.color
Section 176
//ColorWheelProvider (fi.simppa.display.color.ColorWheelProvider)
package fi.simppa.display.color {
import flash.display.*;
import flash.geom.*;
import flash.filters.*;
public class ColorWheelProvider {
private var center:int;
private var colorwheel:ColorWheel;
private var radian:Number;// = 0.0174532925199433
private var bitmapdatawheel:BitmapData;
private var colormatrix:ColorMatrix;
private var orginal:BitmapData;
public var coordinates:Array;
private var quality:int;
public function ColorWheelProvider(_arg1:int=0x0100, _arg2:Number=1){
this.quality = _arg1;
colorwheel = new ColorWheel(_arg1, _arg2);
this.center = (_arg1 + colorwheel.marginal);
bitmapwheel = colorwheel.bitmapwheel;
colormatrix = new ColorMatrix();
}
public function adjustBrightness(_arg1:Number=0):void{
colormatrix.reset();
colormatrix.adjustBrightness(_arg1);
execute();
}
public function adjustSaturation(_arg1:Number=0):void{
colormatrix.reset();
colormatrix.adjustSaturation(_arg1);
execute();
}
public function get bitmapwheel():BitmapData{
return (bitmapdatawheel);
}
public function reset():void{
bitmapwheel.draw(orginal);
}
private function circle(_arg1:Number, _arg2:Number):Array{
var _local3:Number = (Math.sin((_arg1 * this.radian)) * _arg2);
var _local4:Number = (Math.cos((_arg1 * this.radian)) * _arg2);
return (new Array(_local3, _local4));
}
public function getCurve(_arg1:Number=0, _arg2:int=5, _arg3:Number=1, _arg4:Number=0, _arg5:Number=1):Array{
var _local10:Array;
coordinates = new Array();
_arg4 = (_arg4 * quality);
_arg5 = (_arg5 * quality);
var _local6:int = (_arg5 - _arg4);
var _local7:Array = new Array();
var _local8:Number = (_local6 / _arg2);
var _local9:Number = quality;
var _local11:int;
while (_local11 < _arg2) {
_local10 = circle((_arg1 + (_local11 * _arg3)), (_arg4 + (_local8 * _local11)));
_local7[_local11] = bitmapwheel.getPixel((center + _local10[0]), (center + _local10[1]));
coordinates[_local11] = [(center + _local10[0]), (center + _local10[1])];
_local11++;
};
return (_local7);
}
public function adjustColor(_arg1:Number=0, _arg2:Number=0, _arg3:Number=0, _arg4:Number=0):void{
colormatrix.reset();
colormatrix.adjustColor(_arg1, _arg2, _arg3, _arg4);
execute();
}
public function set bitmapwheel(_arg1:BitmapData):void{
bitmapdatawheel = _arg1;
orginal = bitmapdatawheel.clone();
}
public function getContrary(_arg1:Number=0, _arg2:int=5, _arg3:Number=0, _arg4:Number=1, _arg5:Number=0, _arg6:Number=1):Array{
var _local10:Array;
coordinates = new Array();
_arg3 = (_arg3 * quality);
_arg4 = (_arg4 * quality);
var _local7:int = (_arg4 - _arg3);
_arg5 = (_arg5 * quality);
_arg6 = (_arg6 * quality);
var _local8:int = (_arg6 - _arg5);
var _local9:Array = new Array();
var _local11:Number = (_local7 / (_arg2 / 2));
var _local12:Number = (_local8 / (_arg2 / 2));
var _local13:int = (_arg2 / 2);
var _local14:int;
while (_local14 < _arg2) {
if (_local14 < _local13){
_local10 = circle(_arg1, (_arg3 + (_local11 * _local14)));
} else {
_local10 = circle((_arg1 + 180), (_arg5 + (_local12 * (_local14 - _local13))));
};
_local9[_local14] = bitmapwheel.getPixel((center + _local10[0]), (center + _local10[1]));
coordinates[_local14] = [(center + _local10[0]), (center + _local10[1])];
_local14++;
};
return (_local9);
}
public function getGradient(_arg1:Number=0, _arg2:int=5, _arg3:Number=0, _arg4:Number=1):Array{
var _local8:Array;
coordinates = new Array();
_arg3 = (_arg3 * quality);
_arg4 = (_arg4 * quality);
var _local5:int = (_arg4 - _arg3);
var _local6:Array = new Array();
var _local7:Number = (_local5 / _arg2);
var _local9:int;
while (_local9 < _arg2) {
_local8 = circle(_arg1, (_arg3 + (_local7 * _local9)));
_local6[_local9] = bitmapwheel.getPixel((center + _local8[0]), (center + _local8[1]));
coordinates[_local9] = [(center + _local8[0]), (center + _local8[1])];
_local9++;
};
return (_local6);
}
public function getAnalogous(_arg1:Number=0, _arg2:int=5, _arg3:Number=12, _arg4:int=10, _arg5:Number=0, _arg6:Number=1):Array{
var _local9:Array;
if (_arg4 > 10){
_arg4 = 10;
};
coordinates = new Array();
var _local7:Number = (_arg6 - _arg5);
_arg5 = (_arg5 * quality);
_arg6 = (_arg6 * quality);
var _local8:Array = new Array();
var _local10:Number = (((quality / _arg2) * _arg4) * _local7);
var _local11:int = (_arg2 / _arg4);
var _local12:int;
var _local13:int;
while (_local13 < _arg2) {
if (_local13 >= ((_arg2 / _arg4) * (_local12 + 1))){
_local12++;
};
_local9 = circle((_arg1 + (_arg3 * (_local12 - Math.floor((_arg4 / 2))))), (_arg5 + (_local10 * (_local13 - (_local11 * _local12)))));
_local8[_local13] = bitmapwheel.getPixel((center + _local9[0]), (center + _local9[1]));
coordinates[_local13] = [(center + _local9[0]), (center + _local9[1])];
_local13++;
};
return (_local8);
}
public function adjustHue(_arg1:Number=0):void{
colormatrix.reset();
colormatrix.adjustHue(_arg1);
execute();
}
public function adjustContrast(_arg1:Number=0):void{
colormatrix.reset();
colormatrix.adjustContrast(_arg1);
execute();
}
private function execute():void{
bitmapwheel.draw(orginal);
bitmapwheel.applyFilter(bitmapwheel, bitmapwheel.rect, new Point(0, 0), new ColorMatrixFilter(colormatrix));
}
public function getRandom(_arg1:int):Array{
var _local4:Array;
coordinates = new Array();
var _local2:Array = new Array();
var _local3:Number = quality;
var _local5:int;
while (_local5 < _arg1) {
_local4 = circle((Math.random() * 360), (Math.random() * _local3));
_local2[_local5] = bitmapwheel.getPixel((center + _local4[0]), (center + _local4[1]));
coordinates[_local5] = [(center + _local4[0]), (center + _local4[1])];
_local5++;
};
return (_local2);
}
public function getTriad(_arg1:Number=0, _arg2:int=5, _arg3:Number=0, _arg4:Number=1, _arg5:Number=0, _arg6:Number=1, _arg7:Number=0, _arg8:Number=1):Array{
var _local13:Array;
coordinates = new Array();
_arg3 = (_arg3 * quality);
_arg4 = (_arg4 * quality);
var _local9:int = (_arg4 - _arg3);
_arg5 = (_arg5 * quality);
_arg6 = (_arg6 * quality);
var _local10:int = (_arg6 - _arg5);
_arg7 = (_arg7 * quality);
_arg8 = (_arg8 * quality);
var _local11:int = (_arg8 - _arg7);
var _local12:Array = new Array();
var _local14:Array = new Array(_arg3, _arg5, _arg7);
var _local15:Array = new Array((_local9 / (_arg2 / 3)), (_local10 / (_arg2 / 3)), (_local10 / (_arg2 / 3)));
var _local16:Array = new Array(0, 120, -120);
var _local17:int = (_arg2 / 3);
var _local18:int;
var _local19:int;
while (_local19 < _arg2) {
if (_local19 >= ((_arg2 / 3) * (_local18 + 1))){
_local18++;
};
_local13 = circle((_arg1 + _local16[_local18]), (_local14[_local18] + (_local15[_local18] * (_local19 - (_local17 * _local18)))));
_local12[_local19] = bitmapwheel.getPixel((center + _local13[0]), (center + _local13[1]));
coordinates[_local19] = [(center + _local13[0]), (center + _local13[1])];
_local19++;
};
return (_local12);
}
}
}//package fi.simppa.display.color
Section 177
//BitmapAsset (mx.core.BitmapAsset)
package mx.core {
import flash.display.*;
public class BitmapAsset extends FlexBitmap implements IFlexAsset, IFlexDisplayObject {
mx_internal static const VERSION:String = "3.0.0.0";
public function BitmapAsset(_arg1:BitmapData=null, _arg2:String="auto", _arg3:Boolean=false){
super(_arg1, _arg2, _arg3);
}
public function get measuredWidth():Number{
if (bitmapData){
return (bitmapData.width);
};
return (0);
}
public function get measuredHeight():Number{
if (bitmapData){
return (bitmapData.height);
};
return (0);
}
public function setActualSize(_arg1:Number, _arg2:Number):void{
width = _arg1;
height = _arg2;
}
public function move(_arg1:Number, _arg2:Number):void{
this.x = _arg1;
this.y = _arg2;
}
}
}//package mx.core
Section 178
//EdgeMetrics (mx.core.EdgeMetrics)
package mx.core {
public class EdgeMetrics {
public var top:Number;
public var left:Number;
public var bottom:Number;
public var right:Number;
mx_internal static const VERSION:String = "3.0.0.0";
public static const EMPTY:EdgeMetrics = new EdgeMetrics(0, 0, 0, 0);
;
public function EdgeMetrics(_arg1:Number=0, _arg2:Number=0, _arg3:Number=0, _arg4:Number=0){
this.left = _arg1;
this.top = _arg2;
this.right = _arg3;
this.bottom = _arg4;
}
public function clone():EdgeMetrics{
return (new EdgeMetrics(left, top, right, bottom));
}
}
}//package mx.core
Section 179
//FlexBitmap (mx.core.FlexBitmap)
package mx.core {
import flash.display.*;
import mx.utils.*;
public class FlexBitmap extends Bitmap {
mx_internal static const VERSION:String = "3.0.0.0";
public function FlexBitmap(_arg1:BitmapData=null, _arg2:String="auto", _arg3:Boolean=false){
var bitmapData = _arg1;
var pixelSnapping = _arg2;
var smoothing = _arg3;
super(bitmapData, pixelSnapping, smoothing);
try {
name = NameUtil.createUniqueName(this);
} catch(e:Error) {
};
}
override public function toString():String{
return (NameUtil.displayObjectToString(this));
}
}
}//package mx.core
Section 180
//FlexMovieClip (mx.core.FlexMovieClip)
package mx.core {
import flash.display.*;
import mx.utils.*;
public class FlexMovieClip extends MovieClip {
mx_internal static const VERSION:String = "3.0.0.0";
public function FlexMovieClip(){
super();
try {
name = NameUtil.createUniqueName(this);
} catch(e:Error) {
};
}
override public function toString():String{
return (NameUtil.displayObjectToString(this));
}
}
}//package mx.core
Section 181
//FontAsset (mx.core.FontAsset)
package mx.core {
import flash.text.*;
public class FontAsset extends Font implements IFlexAsset {
mx_internal static const VERSION:String = "3.0.0.0";
}
}//package mx.core
Section 182
//IBorder (mx.core.IBorder)
package mx.core {
public interface IBorder {
function get borderMetrics():EdgeMetrics;
}
}//package mx.core
Section 183
//IFlexAsset (mx.core.IFlexAsset)
package mx.core {
public interface IFlexAsset {
}
}//package mx.core
Section 184
//IFlexDisplayObject (mx.core.IFlexDisplayObject)
package mx.core {
import flash.events.*;
import flash.display.*;
import flash.geom.*;
import flash.accessibility.*;
public interface IFlexDisplayObject extends IBitmapDrawable, IEventDispatcher {
function get visible():Boolean;
function get rotation():Number;
function localToGlobal(_arg1:Point):Point;
function get name():String;
function set width(_arg1:Number):void;
function get measuredHeight():Number;
function get blendMode():String;
function get scale9Grid():Rectangle;
function set name(_arg1:String):void;
function set scaleX(_arg1:Number):void;
function set scaleY(_arg1:Number):void;
function get measuredWidth():Number;
function get accessibilityProperties():AccessibilityProperties;
function set scrollRect(_arg1:Rectangle):void;
function get cacheAsBitmap():Boolean;
function globalToLocal(_arg1:Point):Point;
function get height():Number;
function set blendMode(_arg1:String):void;
function get parent():DisplayObjectContainer;
function getBounds(_arg1:DisplayObject):Rectangle;
function get opaqueBackground():Object;
function set scale9Grid(_arg1:Rectangle):void;
function setActualSize(_arg1:Number, _arg2:Number):void;
function set alpha(_arg1:Number):void;
function set accessibilityProperties(_arg1:AccessibilityProperties):void;
function get width():Number;
function hitTestPoint(_arg1:Number, _arg2:Number, _arg3:Boolean=false):Boolean;
function set cacheAsBitmap(_arg1:Boolean):void;
function get scaleX():Number;
function get scaleY():Number;
function get scrollRect():Rectangle;
function get mouseX():Number;
function get mouseY():Number;
function set height(_arg1:Number):void;
function set mask(_arg1:DisplayObject):void;
function getRect(_arg1:DisplayObject):Rectangle;
function get alpha():Number;
function set transform(_arg1:Transform):void;
function move(_arg1:Number, _arg2:Number):void;
function get loaderInfo():LoaderInfo;
function get root():DisplayObject;
function hitTestObject(_arg1:DisplayObject):Boolean;
function set opaqueBackground(_arg1:Object):void;
function set visible(_arg1:Boolean):void;
function get mask():DisplayObject;
function set x(_arg1:Number):void;
function set y(_arg1:Number):void;
function get transform():Transform;
function set filters(_arg1:Array):void;
function get x():Number;
function get y():Number;
function get filters():Array;
function set rotation(_arg1:Number):void;
function get stage():Stage;
}
}//package mx.core
Section 185
//IRepeaterClient (mx.core.IRepeaterClient)
package mx.core {
public interface IRepeaterClient {
function get instanceIndices():Array;
function set instanceIndices(_arg1:Array):void;
function get isDocument():Boolean;
function set repeaters(_arg1:Array):void;
function initializeRepeaterArrays(_arg1:IRepeaterClient):void;
function get repeaters():Array;
function set repeaterIndices(_arg1:Array):void;
function get repeaterIndices():Array;
}
}//package mx.core
Section 186
//MovieClipAsset (mx.core.MovieClipAsset)
package mx.core {
public class MovieClipAsset extends FlexMovieClip implements IFlexAsset, IFlexDisplayObject, IBorder {
private var _measuredHeight:Number;
private var _measuredWidth:Number;
mx_internal static const VERSION:String = "3.0.0.0";
public function MovieClipAsset(){
_measuredWidth = width;
_measuredHeight = height;
}
public function get measuredWidth():Number{
return (_measuredWidth);
}
public function get measuredHeight():Number{
return (_measuredHeight);
}
public function setActualSize(_arg1:Number, _arg2:Number):void{
width = _arg1;
height = _arg2;
}
public function move(_arg1:Number, _arg2:Number):void{
this.x = _arg1;
this.y = _arg2;
}
public function get borderMetrics():EdgeMetrics{
if (scale9Grid == null){
return (EdgeMetrics.EMPTY);
};
return (new EdgeMetrics(scale9Grid.left, scale9Grid.top, Math.ceil((measuredWidth - scale9Grid.right)), Math.ceil((measuredHeight - scale9Grid.bottom))));
}
}
}//package mx.core
Section 187
//mx_internal (mx.core.mx_internal)
package mx.core {
public namespace mx_internal = "http://www.adobe.com/2006/flex/mx/internal";
}//package mx.core
Section 188
//NameUtil (mx.utils.NameUtil)
package mx.utils {
import flash.display.*;
import flash.utils.*;
import mx.core.*;
public class NameUtil {
mx_internal static const VERSION:String = "3.0.0.0";
private static var counter:int = 0;
public static function displayObjectToString(_arg1:DisplayObject):String{
var _local2:String;
var _local4:String;
var _local5:Array;
var _local3:DisplayObject = _arg1;
while (_local3 != null) {
if (((((_local3.parent) && (_local3.stage))) && ((_local3.parent == _local3.stage)))){
break;
};
_local4 = _local3.name;
if ((_local3 is IRepeaterClient)){
_local5 = IRepeaterClient(_local3).instanceIndices;
if (_local5){
_local4 = (_local4 + (("[" + _local5.join("][")) + "]"));
};
};
_local2 = ((_local2 == null)) ? _local4 : ((_local4 + ".") + _local2);
_local3 = _local3.parent;
};
return (_local2);
}
public static function createUniqueName(_arg1:Object):String{
if (!_arg1){
return (null);
};
var _local2:String = getQualifiedClassName(_arg1);
var _local3:int = _local2.indexOf("::");
if (_local3 != -1){
_local2 = _local2.substr((_local3 + 2));
};
var _local4:int = _local2.charCodeAt((_local2.length - 1));
if ((((_local4 >= 48)) && ((_local4 <= 57)))){
_local2 = (_local2 + "_");
};
return ((_local2 + counter++));
}
}
}//package mx.utils
Section 189
//AnalyzerPart (parts.AnalyzerPart)
package parts {
import evo.engine.*;
import flash.display.*;
import flash.geom.*;
import effects.post.*;
import effects.meshParticles.*;
public class AnalyzerPart extends AbstractPart {
private var delay:AnalyzerFeedback;
private var meta:AnalyzerEffect;
private var bloom:BloomEffect;
private var mat:Matrix;
private var zoom:Number;// = 0
private var music:DemoSynch;
private var radial:RadialBlurEffect;
private var downscale:DowngradeEffect;
private var snareCnt:int;// = 0
private var endCredits:BitmapData;
public function AnalyzerPart(_arg1:Sequencer){
endCredits = new Assets.EndCredits().bitmapData;
mat = new Matrix();
this.music = (_arg1 as DemoSynch);
super(_arg1);
}
override public function prePlay(_arg1:Number):void{
zoom = (zoom - (zoom / 10));
radial.alphaFade = (zoom / 2);
radial.zoom = zoom;
}
override public function preInit(_arg1:IEffectContainer):void{
super.preInit(_arg1);
downscale = new DowngradeEffect();
downscale.init({scale:2});
bloom = new BloomEffect();
bloom.init({bloomAmount:4});
delay = new AnalyzerFeedback();
delay.init({xoff:10, yoff:-2});
radial = new RadialBlurEffect();
radial.init({transparent:true});
radial.zoom = 0;
radial.alphaFade = 0;
meta = new AnalyzerEffect();
meta.init({});
}
override public function init(_arg1:IEffectContainer):void{
super.init(_arg1);
Sequencer.startSpecCalc();
_arg1.addEffect(downscale);
downscale.addEffect(bloom);
bloom.addEffect(radial);
radial.addEffect(delay);
delay.addEffect(meta);
music.bassDrum.addListener(on_bd);
music.snare.addListener(on_snare);
}
override protected function cleanup():void{
music.bassDrum.removeListener(on_bd);
music.snare.removeListener(on_snare);
output.removeEffect(downscale);
Sequencer.endSpecCalc();
}
public function on_bd(_arg1:uint):void{
zoom = 0.2;
}
override public function postPlay(_arg1:Number):void{
}
public function on_snare(_arg1:uint):void{
trace("snare!");
snareCnt++;
snareCnt = (snareCnt % 2);
}
}
}//package parts
class textures {
public static var GlowParticle:Class = textures_GlowParticle;
public static var Radial:Class = textures_Radial;
private function textures(){
}
}
Section 190
//AnalyzerPart2 (parts.AnalyzerPart2)
package parts {
import evo.engine.*;
import flash.display.*;
import flash.geom.*;
import effects.post.*;
import effects.meshParticles.*;
public class AnalyzerPart2 extends AbstractPart {
private var delay:AnalyzerFeedback;
private var meta:AnalyzerEffect;
private var bloom:BloomEffect;
public var trig:Boolean;// = false
private var radial:RadialBlurEffect;
private var mat:Matrix;
private var zoom:Number;// = 0
private var gray:GrayscaleEffect;
private var powered:BitmapData;
private var music:DemoSynch;
private var downscale:DowngradeEffect;
private var snareCnt:int;// = 0
public function AnalyzerPart2(_arg1:Sequencer){
mat = new Matrix();
this.music = (_arg1 as DemoSynch);
super(_arg1);
}
override public function init(_arg1:IEffectContainer):void{
super.init(_arg1);
Sequencer.startSpecCalc();
_arg1.addEffect(downscale);
downscale.addEffect(bloom);
bloom.addEffect(radial);
radial.addEffect(delay);
delay.addEffect(meta);
music.bassDrum.addListener(on_bd);
music.snare.addListener(on_snare);
music.trig.addListener(trig1);
}
override public function preInit(_arg1:IEffectContainer):void{
super.preInit(_arg1);
downscale = new DowngradeEffect();
downscale.init({scale:2});
bloom = new BloomEffect();
bloom.init({bloomAmount:4});
delay = new AnalyzerFeedback();
delay.init({xoff:10, yoff:-2});
gray = new GrayscaleEffect();
gray.init({});
radial = new RadialBlurEffect();
radial.init({transparent:true});
radial.zoom = 0;
radial.alphaFade = 0;
meta = new AnalyzerEffect();
meta.init({});
powered = new Assets.PoweredByWhite().bitmapData;
}
public function on_bd(_arg1:uint):void{
zoom = 0.2;
}
override protected function cleanup():void{
music.bassDrum.removeListener(on_bd);
music.snare.removeListener(on_snare);
music.trig.removeListener(trig1);
output.removeEffect(gray);
Sequencer.endSpecCalc();
}
public function trig1(_arg1:uint):void{
trace("Trig");
if (!trig){
trig = true;
output.removeEffect(downscale);
output.addEffect(gray);
gray.addEffect(downscale);
radial.removeEffect(delay);
radial.addEffect(meta);
} else {
trig = false;
};
}
override public function postPlay(_arg1:Number):void{
mat.identity();
mat.translate((output.input.width - powered.width), (output.input.height - powered.height));
output.input.draw(powered, mat, null, BlendMode.MULTIPLY);
}
override public function prePlay(_arg1:Number):void{
zoom = (zoom - (zoom / 10));
radial.alphaFade = (zoom / 2);
radial.zoom = zoom;
if (trig){
delay.xoff = (delay.xoff - (delay.xoff / 20));
delay.yoff = (delay.yoff - (delay.yoff / 20));
meta.view.camera.x = (5 + (meta.view.camera.x - ((meta.view.camera.x + 5) / 20)));
meta.yamount = (meta.yamount - (meta.yamount / 10));
meta.yrotation = (meta.yamount - (meta.yamount / 8));
};
}
public function on_snare(_arg1:uint):void{
trace("snare!");
snareCnt++;
snareCnt = (snareCnt % 2);
}
}
}//package parts
Section 191
//FlyPart (parts.FlyPart)
package parts {
import evo.engine.*;
import flash.geom.*;
import effects.post.*;
import effects.zoom.*;
public class FlyPart extends AbstractPart {
private var zoom:Number;// = 0
private var snareCnt:int;// = 0
private var mat:Matrix;
private var music:DemoSynch;
private var perlinzoom:PerlinZoom;
private var downscale:DowngradeEffect;
private var radial:RadialBlurEffect;
public function FlyPart(_arg1:Sequencer){
mat = new Matrix();
this.music = (_arg1 as DemoSynch);
super(_arg1);
}
override public function init(_arg1:IEffectContainer):void{
super.init(_arg1);
_arg1.addEffect(downscale);
downscale.addEffect(radial);
radial.addEffect(perlinzoom);
music.bassDrum.addListener(on_bd);
music.snare.addListener(on_snare);
}
public function on_bd(_arg1:uint):void{
zoom = 0.1;
}
override protected function cleanup():void{
music.bassDrum.removeListener(on_bd);
music.snare.removeListener(on_snare);
output.removeEffect(downscale);
}
override public function preInit(_arg1:IEffectContainer):void{
super.preInit(_arg1);
downscale = new DowngradeEffect();
downscale.init({scale:2});
radial = new RadialBlurEffect();
radial.init({transparent:true});
radial.zoom = 0;
radial.alphaFade = 0;
perlinzoom = new PerlinZoom();
perlinzoom.init({});
}
override public function postPlay(_arg1:Number):void{
}
override public function prePlay(_arg1:Number):void{
zoom = (zoom - (zoom / 10));
radial.alphaFade = zoom;
radial.zoom = zoom;
}
public function on_snare(_arg1:uint):void{
trace("snare!");
snareCnt++;
snareCnt = (snareCnt % 2);
perlinzoom.hit();
}
}
}//package parts
Section 192
//ImageCubesPart (parts.ImageCubesPart)
package parts {
import evo.engine.*;
import flash.geom.*;
import effects.post.*;
import effects.meshParticles.*;
public class ImageCubesPart extends AbstractPart {
private var bloom:BloomEffect;
private var zoom:Number;// = 0
public var trig:Boolean;// = false
private var cubes:ImageCubesEffect;
private var mat:Matrix;
private var music:DemoSynch;
private var downscale:DowngradeEffect;
private var radial:RadialBlurEffect;
private var snareCnt:int;// = 0
public function ImageCubesPart(_arg1:Sequencer){
mat = new Matrix();
this.music = (_arg1 as DemoSynch);
super(_arg1);
}
override public function prePlay(_arg1:Number):void{
zoom = (zoom - (zoom / 10));
radial.alphaFade = (zoom / 4);
radial.zoom = zoom;
}
public function trig1(_arg1:uint):void{
cubes.randomRot();
}
override public function init(_arg1:IEffectContainer):void{
super.init(_arg1);
_arg1.addEffect(downscale);
downscale.addEffect(bloom);
bloom.addEffect(radial);
radial.addEffect(cubes);
music.bassDrum.addListener(on_bd);
music.snare.addListener(on_snare);
music.trig.addOneTimer(trig1);
}
public function on_bd(_arg1:uint):void{
zoom = 0.2;
cubes.rotateNow();
}
override protected function cleanup():void{
music.bassDrum.removeListener(on_bd);
music.snare.removeListener(on_snare);
output.removeEffect(downscale);
}
override public function preInit(_arg1:IEffectContainer):void{
super.preInit(_arg1);
downscale = new DowngradeEffect();
downscale.init({scale:2});
bloom = new BloomEffect();
bloom.init({bloomAmount:4});
radial = new RadialBlurEffect();
radial.init({transparent:true});
radial.zoom = 0;
radial.alphaFade = 0;
cubes = new ImageCubesEffect();
cubes.init({});
}
override public function postPlay(_arg1:Number):void{
}
public function on_snare(_arg1:uint):void{
snareCnt++;
snareCnt = (snareCnt % 2);
}
}
}//package parts
class textures {
public static var GlowParticle:Class = textures_GlowParticle;
public static var Radial:Class = textures_Radial;
private function textures(){
}
}
Section 193
//IntroPart (parts.IntroPart)
package parts {
import evo.engine.*;
import flash.display.*;
import flash.geom.*;
import effects.post.*;
import effects.meshParticles.*;
import effects.clips.*;
public class IntroPart extends AbstractPart {
private var delay:DelayEffect;
private var bloom:BloomEffect;
private var snareCnt:int;// = 0
private var split:SplitterEffect;
private var dancer:DancerEffect;
private var music:DemoSynch;
private var logo:BitmapData;
private var radial:RadialBlurEffect;
public var fadeOut:Boolean;// = false
private var bdCnt:int;// = 0
private var air:AirParticles;
private var title:BitmapData;
private var dtcnt:int;// = 0
private var zoom:Number;// = 0
private var colorswitch:Boolean;// = false
private var mat:Matrix;
private var downscale:DowngradeEffect;
private var titleMat:Matrix;
private var ct:ColorTransform;
private var logoAlpha:Number;// = 1
private var black:BitmapData;
public function IntroPart(_arg1:Sequencer){
title = new Assets.Title().bitmapData;
logo = new Assets.Evologo().bitmapData;
mat = new Matrix();
ct = new ColorTransform();
black = new BitmapData(800, 400, true, 4278190080);
titleMat = new Matrix();
this.music = (_arg1 as DemoSynch);
super(_arg1);
}
override public function prePlay(_arg1:Number):void{
zoom = (zoom - (zoom / 10));
radial.alphaFade = zoom;
radial.zoom = zoom;
if (fadeOut){
logoAlpha = (logoAlpha - 0.02);
};
}
public function trig1(_arg1:uint):void{
trace("Trig1");
air.source = new Assets.Radial2().bitmapData;
}
public function on_bd(_arg1:uint):void{
bdCnt++;
zoom = 0.1;
}
override protected function cleanup():void{
music.bassDrum.removeListener(on_bd);
music.snare.removeListener(on_snare);
music.pad.removeListener(on_pad);
output.removeEffect(split);
output.removeEffect(dancer);
dancer.cleanup();
split = null;
bloom = null;
air = null;
delay = null;
radial = null;
dancer = null;
logo.dispose();
title.dispose();
}
override public function init(_arg1:IEffectContainer):void{
super.init(_arg1);
_arg1.addEffect(split);
_arg1.addEffect(dancer);
split.addEffect(downscale);
downscale.addEffect(bloom);
bloom.addEffect(radial);
radial.addEffect(delay);
delay.addEffect(air);
music.bassDrum.addListener(on_bd);
music.snare.addListener(on_snare);
music.pad.addListener(on_pad);
music.trig.addOneTimer(trig1);
}
public function on_pad(_arg1:uint):void{
split.cuts = 1;
trace("Pad");
fadeOut = true;
}
public function on_snare(_arg1:uint):void{
dancer.sync(snareCnt);
dancer.dancers++;
titleMat.ty = -30;
trace("snare!");
snareCnt++;
snareCnt = (snareCnt % 2);
if (!colorswitch){
air.source = new Assets.Radial3().bitmapData;
colorswitch = true;
};
}
override public function preInit(_arg1:IEffectContainer):void{
super.preInit(_arg1);
dancer = new DancerEffect();
dancer.init({});
downscale = new DowngradeEffect();
downscale.init({scale:2});
bloom = new BloomEffect();
bloom.init({});
delay = new DelayEffect();
delay.init({});
split = new SplitterEffect();
split.init({});
split.cuts = 4;
radial = new RadialBlurEffect();
radial.init({});
radial.zoom = 0;
radial.alphaFade = 0;
air = new AirParticles();
air.init({texture:new Assets.Radial().bitmapData});
}
override public function postPlay(_arg1:Number):void{
dtcnt = (dtcnt + _arg1);
ct.alphaMultiplier = logoAlpha;
output.input.draw(logo, null, ct, BlendMode.NORMAL);
if (dtcnt < 4000){
ct.alphaMultiplier = (1 - (dtcnt / 2000));
output.input.draw(black, null, ct, BlendMode.MULTIPLY);
};
titleMat.ty = (titleMat.ty - (titleMat.ty / 5));
if (bdCnt >= 25){
output.input.draw(title, titleMat, null, BlendMode.NORMAL);
};
}
}
}//package parts
Section 194
//LasersPart (parts.LasersPart)
package parts {
import evo.engine.*;
import flash.geom.*;
import effects.post.*;
import effects.meshParticles.*;
public class LasersPart extends AbstractPart {
private var bloom:BloomEffect;
private var snareCnt:int;// = 0
private var zoom:Number;// = 0
public var trig:Boolean;// = false
private var radial:RadialBlurEffect;
private var mat:Matrix;
private var music:DemoSynch;
private var downscale:DowngradeEffect;
private var lines:LasersEffect;
public function LasersPart(_arg1:Sequencer){
mat = new Matrix();
this.music = (_arg1 as DemoSynch);
super(_arg1);
}
override public function prePlay(_arg1:Number):void{
zoom = (zoom - (zoom / 10));
radial.alphaFade = (zoom / 4);
radial.zoom = zoom;
}
override public function preInit(_arg1:IEffectContainer):void{
super.preInit(_arg1);
downscale = new DowngradeEffect();
downscale.init({scale:2, forceTransparent:true});
bloom = new BloomEffect();
bloom.init({bloomAmount:32, extraBloom:2});
radial = new RadialBlurEffect();
radial.init({transparent:true, blur:true, layers:8});
radial.zoom = 0;
radial.alphaFade = 0;
lines = new LasersEffect();
lines.init({});
}
override protected function cleanup():void{
lines.dispose();
music.snare.removeListener(on_snare);
output.removeEffect(downscale);
}
override public function init(_arg1:IEffectContainer):void{
super.init(_arg1);
_arg1.addEffect(downscale);
downscale.addEffect(bloom);
bloom.addEffect(radial);
radial.addEffect(lines);
music.snare.addListener(on_snare);
}
override public function postPlay(_arg1:Number):void{
}
public function on_snare(_arg1:uint):void{
snareCnt++;
snareCnt = (snareCnt % 2);
zoom = 0.2;
lines.rotateNow();
}
}
}//package parts
Section 195
//LinesPart (parts.LinesPart)
package parts {
import evo.engine.*;
import effects.post.*;
import effects.meshParticles.*;
public class LinesPart extends AbstractPart {
private var bloom:BloomEffect;
private var music:DemoSynch;
private var downscale:DowngradeEffect;
private var snareCnt:int;// = 0
private var lines:LinesEffect;
public function LinesPart(_arg1:Sequencer){
this.music = (_arg1 as DemoSynch);
super(_arg1);
}
override protected function cleanup():void{
music.snare.removeListener(on_snare);
output.removeEffect(downscale);
}
override public function init(_arg1:IEffectContainer):void{
super.init(_arg1);
_arg1.addEffect(downscale);
downscale.addEffect(bloom);
bloom.addEffect(lines);
music.snare.addListener(on_snare);
}
override public function postPlay(_arg1:Number):void{
}
override public function prePlay(_arg1:Number):void{
}
public function on_snare(_arg1:uint):void{
snareCnt++;
snareCnt = (snareCnt % 2);
lines.randomRot();
}
override public function preInit(_arg1:IEffectContainer):void{
super.preInit(_arg1);
downscale = new DowngradeEffect();
downscale.init({scale:2});
bloom = new BloomEffect();
bloom.init({bloomAmount:12, extraBloom:1});
lines = new LinesEffect();
lines.init({});
}
}
}//package parts
Section 196
//MandelBrotPart (parts.MandelBrotPart)
package parts {
import evo.engine.*;
import effects.post.*;
import effects.bitmap.*;
public class MandelBrotPart extends AbstractPart {
private var bloom:BloomEffect;
private var splitter:TimeSpliceEffect;
private var alphaSpeed:Number;// = 1.5
private var zoom:Number;// = 0
private var music:DemoSynch;
private var downscale:DowngradeEffect;
private var radial:RadialBlurEffect;
private var mandel:MandelBrotEffect;
private var radialx:Number;// = 800
private var radialy:Number;// = 400
public function MandelBrotPart(_arg1:Sequencer){
this.music = (_arg1 as DemoSynch);
super(_arg1);
}
public function on_snare(_arg1:uint):void{
zoom = 0.2;
radialx = (radialx - 200);
radialy = (radialy - 100);
alphaSpeed = (alphaSpeed + 0.2);
}
override public function init(_arg1:IEffectContainer):void{
super.init(_arg1);
_arg1.addEffect(radial);
radial.addEffect(splitter);
splitter.addEffect(downscale);
downscale.addEffect(mandel);
music.snare.addListener(on_snare);
trace("MBInit");
}
override protected function cleanup():void{
music.snare.removeListener(on_snare);
output.removeEffect(radial);
}
override public function preInit(_arg1:IEffectContainer):void{
super.preInit(_arg1);
downscale = new DowngradeEffect();
downscale.init({scale:4});
splitter = new TimeSpliceEffect();
splitter.init({hcuts:8, vcuts:8});
mandel = new MandelBrotEffect();
mandel.init({});
radial = new RadialBlurEffect();
radial.init({layers:16, transparent:true});
radial.zoom = 0;
radial.alphaFade = 0;
}
override public function postPlay(_arg1:Number):void{
}
override public function prePlay(_arg1:Number):void{
zoom = (zoom - (zoom / 5));
radial.alphaFade = (zoom / alphaSpeed);
radial.zoom = zoom;
radial.blurOffsetX = radialx;
radial.blurOffsetY = radialy;
}
}
}//package parts
Section 197
//MedusaPart (parts.MedusaPart)
package parts {
import evo.engine.*;
import flash.geom.*;
import effects.post.*;
import effects.meshParticles.*;
public class MedusaPart extends AbstractPart {
private var bloom:BloomEffect;
private var meta:MedusaParticles;
private var zoom:Number;// = 0
public var trig:Boolean;// = false
private var mat:Matrix;
private var music:DemoSynch;
private var downscale:DowngradeEffect;
private var radial:RadialBlurEffect;
private var snareCnt:int;// = 0
private var splice:TimeSpliceEffect;
public function MedusaPart(_arg1:Sequencer){
mat = new Matrix();
this.music = (_arg1 as DemoSynch);
super(_arg1);
}
public function trig1(_arg1:uint):void{
trace("Trig");
meta.zr = 0.04;
meta.xr = 0.08;
trig = true;
splice.reset(4, 4);
}
override public function init(_arg1:IEffectContainer):void{
super.init(_arg1);
_arg1.addEffect(splice);
splice.addEffect(downscale);
downscale.addEffect(radial);
radial.addEffect(meta);
music.bassDrum.addListener(on_bd);
music.snare.addListener(on_snare);
music.trig.addOneTimer(trig1);
}
override public function preInit(_arg1:IEffectContainer):void{
super.preInit(_arg1);
downscale = new DowngradeEffect();
downscale.init({scale:2});
bloom = new BloomEffect();
bloom.init({bloomAmount:32, extraBloom:1, clearBloom:true});
splice = new TimeSpliceEffect();
splice.init({hcuts:1, vcuts:1});
radial = new RadialBlurEffect();
radial.init({transparent:true});
radial.zoom = 0;
radial.alphaFade = 0;
meta = new MedusaParticles();
meta.init({texture:new Assets.MedusaParticle().bitmapData});
}
override protected function cleanup():void{
music.bassDrum.removeListener(on_bd);
music.snare.removeListener(on_snare);
output.removeEffect(splice);
bloom = null;
downscale = null;
splice = null;
radial = null;
meta = null;
}
public function on_bd(_arg1:uint):void{
meta.impulse();
zoom = 0.1;
}
override public function postPlay(_arg1:Number):void{
}
public function on_snare(_arg1:uint):void{
trace("snare!");
snareCnt++;
snareCnt = (snareCnt % 2);
}
override public function prePlay(_arg1:Number):void{
zoom = (zoom - (zoom / 10));
radial.alphaFade = zoom;
radial.zoom = zoom;
}
}
}//package parts
Section 198
//Part2 (parts.Part2)
package parts {
import evo.engine.*;
import flash.geom.*;
import effects.post.*;
import effects.meta.*;
public class Part2 extends AbstractPart {
private var bloom:BloomEffect;
private var meta:MetaballEffect;
private var zoom:Number;// = 0
private var snareCnt:int;// = 0
private var mat:Matrix;
private var music:DemoSynch;
private var downscale:DowngradeEffect;
private var radial:RadialBlurEffect;
public function Part2(_arg1:Sequencer){
mat = new Matrix();
this.music = (_arg1 as DemoSynch);
super(_arg1);
}
override public function init(_arg1:IEffectContainer):void{
super.init(_arg1);
_arg1.addEffect(downscale);
downscale.addEffect(radial);
radial.addEffect(bloom);
bloom.addEffect(meta);
music.bassDrum.addListener(on_bd);
music.snare.addListener(on_snare);
}
public function on_bd(_arg1:uint):void{
zoom = 0.1;
}
override protected function cleanup():void{
meta.dispose();
music.bassDrum.removeListener(on_bd);
music.snare.removeListener(on_snare);
output.removeEffect(downscale);
}
override public function preInit(_arg1:IEffectContainer):void{
super.preInit(_arg1);
downscale = new DowngradeEffect();
downscale.init({scale:2});
bloom = new BloomEffect();
bloom.init({bloomAmount:64, extraBloom:0});
radial = new RadialBlurEffect();
radial.init({transparent:true});
radial.zoom = 0;
radial.alphaFade = 0;
meta = new MetaballEffect();
meta.init({});
}
override public function postPlay(_arg1:Number):void{
}
public function on_snare(_arg1:uint):void{
snareCnt++;
snareCnt = (snareCnt % 2);
meta.hit();
}
override public function prePlay(_arg1:Number):void{
zoom = (zoom - (zoom / 10));
radial.alphaFade = zoom;
radial.zoom = zoom;
}
}
}//package parts
Section 199
//Part3 (parts.Part3)
package parts {
import evo.engine.*;
import flash.display.*;
import flash.geom.*;
import effects.post.*;
import effects.meshParticles.*;
public class Part3 extends AbstractPart {
private var bloom:BloomEffect;
public var trig:Boolean;// = false
private var mat:Matrix;
private var mag:CernEffect;
private var gray:GrayscaleEffect;
private var music:DemoSynch;
private var downscale:DowngradeEffect;
private var zoom:Number;// = 0
private var radial:RadialBlurEffect;
private var snareCnt:int;// = 0
private var endCredits:BitmapData;
public function Part3(_arg1:Sequencer){
endCredits = new Assets.EndCredits().bitmapData;
mat = new Matrix();
this.music = (_arg1 as DemoSynch);
super(_arg1);
}
override public function prePlay(_arg1:Number):void{
zoom = (zoom - (zoom / 10));
radial.alphaFade = zoom;
radial.zoom = (zoom * 2);
}
override public function preInit(_arg1:IEffectContainer):void{
super.preInit(_arg1);
downscale = new DowngradeEffect();
downscale.init({scale:2, forceTransparent:true});
bloom = new BloomEffect();
bloom.init({bloomAmount:64, extraBloom:0});
radial = new RadialBlurEffect();
radial.init({transparent:true});
radial.zoom = 0;
radial.alphaFade = 0;
gray = new GrayscaleEffect();
gray.init({});
mag = new CernEffect();
mag.init({});
}
override public function init(_arg1:IEffectContainer):void{
super.init(_arg1);
_arg1.addEffect(downscale);
downscale.addEffect(gray);
gray.addEffect(radial);
radial.addEffect(bloom);
bloom.addEffect(mag);
music.bassDrum.addListener(on_bd);
music.snare.addListener(on_snare);
}
override protected function cleanup():void{
music.bassDrum.removeListener(on_bd);
music.snare.removeListener(on_snare);
output.removeEffect(downscale);
}
public function on_bd(_arg1:uint):void{
zoom = 0.1;
}
override public function postPlay(_arg1:Number):void{
output.input.draw(endCredits, null, null, BlendMode.DIFFERENCE);
}
public function on_snare(_arg1:uint):void{
snareCnt++;
snareCnt = (snareCnt % 2);
}
}
}//package parts
Section 200
//RubikPart (parts.RubikPart)
package parts {
import evo.engine.*;
import flash.geom.*;
import effects.post.*;
import effects.meshParticles.*;
public class RubikPart extends AbstractPart {
private var bloom:BloomEffect;
private var bdCnt:int;// = 0
private var zoom:Number;// = 0
public var trig:Boolean;// = false
private var mat:Matrix;
private var rubik:RubikCubeEffect;
private var music:DemoSynch;
private var downscale:DowngradeEffect;
private var radial:RadialBlurEffect;
private var snareCnt:int;// = 0
public function RubikPart(_arg1:Sequencer){
mat = new Matrix();
this.music = (_arg1 as DemoSynch);
super(_arg1);
}
public function trig1(_arg1:uint):void{
rubik.solve();
}
override public function init(_arg1:IEffectContainer):void{
super.init(_arg1);
_arg1.addEffect(downscale);
downscale.addEffect(bloom);
bloom.addEffect(radial);
radial.addEffect(rubik);
music.bassDrum.addListener(on_bd);
music.trig.addOneTimer(trig1);
}
override public function preInit(_arg1:IEffectContainer):void{
super.preInit(_arg1);
downscale = new DowngradeEffect();
downscale.init({scale:2, forceTransparent:true});
bloom = new BloomEffect();
bloom.init({bloomAmount:32, extraBloom:1});
radial = new RadialBlurEffect();
radial.init({transparent:true});
radial.zoom = 0;
radial.alphaFade = 0;
rubik = new RubikCubeEffect();
rubik.init({});
}
override protected function cleanup():void{
rubik.dispose();
music.bassDrum.removeListener(on_bd);
output.removeEffect(downscale);
}
public function on_bd(_arg1:uint):void{
zoom = 0.2;
bdCnt++;
bdCnt = (bdCnt % 4);
if (bdCnt == 0){
rubik.randRotation();
};
rubik.rotateNow();
}
override public function postPlay(_arg1:Number):void{
}
override public function prePlay(_arg1:Number):void{
zoom = (zoom - (zoom / 10));
radial.alphaFade = (zoom / 4);
radial.zoom = zoom;
}
}
}//package parts
Section 201
//VoxelPart (parts.VoxelPart)
package parts {
import evo.engine.*;
import flash.display.*;
import effects.post.*;
import effects.bitmap.*;
public class VoxelPart extends AbstractPart {
private var bloom:BloomEffect;
private var music:DemoSynch;
private var voxel:VoxelMapEffect;
private var downscale:DowngradeEffect;
public var trig:Boolean;// = false
private var greets:GreetsPlayerEffect;
private var sunset2:BitmapData;
public function VoxelPart(_arg1:Sequencer){
sunset2 = new Assets.VoxelBGSun().bitmapData;
this.music = (_arg1 as DemoSynch);
super(_arg1);
}
override protected function cleanup():void{
output.removeEffect(downscale);
output.removeEffect(greets);
}
override public function prePlay(_arg1:Number):void{
output.input.draw(sunset2);
}
override public function preInit(_arg1:IEffectContainer):void{
super.preInit(_arg1);
downscale = new DowngradeEffect();
downscale.init({smooth:true, scale:4, forceTransparent:true});
bloom = new BloomEffect();
bloom.init({bloomAmount:32, clearBlur:false});
voxel = new VoxelMapEffect();
voxel.init({});
greets = new GreetsPlayerEffect();
greets.init({});
}
override public function postPlay(_arg1:Number):void{
}
override public function init(_arg1:IEffectContainer):void{
super.init(_arg1);
_arg1.addEffect(downscale);
_arg1.addEffect(greets);
downscale.addEffect(bloom);
bloom.addEffect(voxel);
}
}
}//package parts
Section 202
//PlayAsset (play.PlayAsset)
package play {
import flash.display.*;
public dynamic class PlayAsset extends MovieClip {
public var adhdtv:MovieClip;
public var windowed:MovieClip;
public var fullscreen:MovieClip;
}
}//package play
Section 203
//Assets (Assets)
package {
import fi.simppa.display.color.*;
public class Assets {
public static var MedusaParticle:Class = Assets_MedusaParticle;
public static var Panorama3:Class = Assets_Panorama3;
public static var colorwheelprovider:ColorWheelProvider = new ColorWheelProvider(0x0100, 1);
public static var MandelTexture:Class = Assets_MandelTexture;
public static var Radial2:Class = Assets_Radial2;
public static var Radial4:Class = Assets_Radial4;
public static var Radial5:Class = Assets_Radial5;
public static var Texture2:Class = Assets_Texture2;
public static var Texture3:Class = Assets_Texture3;
public static var Radial3:Class = Assets_Radial3;
public static var Panorama:Class = Assets_Panorama;
public static var Texture1:Class = Assets_Texture1;
public static var EndCredits:Class = Assets_EndCredits;
public static var Texture4:Class = Assets_Texture4;
public static var VoxelBGSun:Class = Assets_VoxelBGSun;
public static var Tube:Class = Assets_Tube;
public static var Fire:Class = Assets_Fire;
public static var Evologo:Class = Assets_Evologo;
public static var VoxelLava:Class = Assets_VoxelLava;
public static var PoweredByWhite:Class = Assets_PoweredByWhite;
public static var Title:Class = Assets_Title;
public static var Panorama2:Class = Assets_Panorama2;
public static var Radial:Class = Assets_Radial;
}
}//package
Section 204
//Assets_EndCredits (Assets_EndCredits)
package {
import mx.core.*;
public class Assets_EndCredits extends BitmapAsset {
}
}//package
Section 205
//Assets_Evologo (Assets_Evologo)
package {
import mx.core.*;
public class Assets_Evologo extends BitmapAsset {
}
}//package
Section 206
//Assets_Fire (Assets_Fire)
package {
import mx.core.*;
public class Assets_Fire extends BitmapAsset {
}
}//package
Section 207
//Assets_MandelTexture (Assets_MandelTexture)
package {
import mx.core.*;
public class Assets_MandelTexture extends BitmapAsset {
}
}//package
Section 208
//Assets_MedusaParticle (Assets_MedusaParticle)
package {
import mx.core.*;
public class Assets_MedusaParticle extends BitmapAsset {
}
}//package
Section 209
//Assets_Panorama (Assets_Panorama)
package {
import mx.core.*;
public class Assets_Panorama extends BitmapAsset {
}
}//package
Section 210
//Assets_Panorama2 (Assets_Panorama2)
package {
import mx.core.*;
public class Assets_Panorama2 extends BitmapAsset {
}
}//package
Section 211
//Assets_Panorama3 (Assets_Panorama3)
package {
import mx.core.*;
public class Assets_Panorama3 extends BitmapAsset {
}
}//package
Section 212
//Assets_PoweredByWhite (Assets_PoweredByWhite)
package {
import mx.core.*;
public class Assets_PoweredByWhite extends BitmapAsset {
}
}//package
Section 213
//Assets_Radial (Assets_Radial)
package {
import mx.core.*;
public class Assets_Radial extends BitmapAsset {
}
}//package
Section 214
//Assets_Radial2 (Assets_Radial2)
package {
import mx.core.*;
public class Assets_Radial2 extends BitmapAsset {
}
}//package
Section 215
//Assets_Radial3 (Assets_Radial3)
package {
import mx.core.*;
public class Assets_Radial3 extends BitmapAsset {
}
}//package
Section 216
//Assets_Radial4 (Assets_Radial4)
package {
import mx.core.*;
public class Assets_Radial4 extends BitmapAsset {
}
}//package
Section 217
//Assets_Radial5 (Assets_Radial5)
package {
import mx.core.*;
public class Assets_Radial5 extends BitmapAsset {
}
}//package
Section 218
//Assets_Texture1 (Assets_Texture1)
package {
import mx.core.*;
public class Assets_Texture1 extends BitmapAsset {
}
}//package
Section 219
//Assets_Texture2 (Assets_Texture2)
package {
import mx.core.*;
public class Assets_Texture2 extends BitmapAsset {
}
}//package
Section 220
//Assets_Texture3 (Assets_Texture3)
package {
import mx.core.*;
public class Assets_Texture3 extends BitmapAsset {
}
}//package
Section 221
//Assets_Texture4 (Assets_Texture4)
package {
import mx.core.*;
public class Assets_Texture4 extends BitmapAsset {
}
}//package
Section 222
//Assets_Title (Assets_Title)
package {
import mx.core.*;
public class Assets_Title extends BitmapAsset {
}
}//package
Section 223
//Assets_Tube (Assets_Tube)
package {
import mx.core.*;
public class Assets_Tube extends BitmapAsset {
}
}//package
Section 224
//Assets_VoxelBGSun (Assets_VoxelBGSun)
package {
import mx.core.*;
public class Assets_VoxelBGSun extends BitmapAsset {
}
}//package
Section 225
//Assets_VoxelLava (Assets_VoxelLava)
package {
import mx.core.*;
public class Assets_VoxelLava extends BitmapAsset {
}
}//package
Section 226
//clips_Dance (clips_Dance)
package {
import mx.core.*;
public class clips_Dance extends MovieClipAsset {
}
}//package
Section 227
//DemoMain (DemoMain)
package {
import evo.engine.*;
import flash.events.*;
import effects.*;
import parts.*;
public class DemoMain extends AbstractDemo {
private var started:Boolean;// = false
private var flashEffect:FlashEffect;
private var playbuttons:PlayDemo;
private var demoSync:DemoSynch;
public function DemoMain(){
playbuttons = new PlayDemo();
demoSync = new DemoSynch();
super("99er.mp3", demoSync, false);
demoSync.loop = false;
playbuttons.addEventListener("startDemo", onStartDemo);
}
private function onFlashFrame(_arg1:Event):void{
if (flashEffect == null){
engine.removeEventListener(Event.ENTER_FRAME, onFlashFrame);
};
if (flashEffect.done){
trace("Removink");
engine.removeEffect(flashEffect);
engine.removeEventListener(Event.ENTER_FRAME, onFlashFrame);
};
}
private function onStartDemo(_arg1:Event):void{
removeChild(playbuttons);
startDemo();
}
override protected function generateParts():void{
super.generateParts();
flashEffect = new FlashEffect();
flashEffect.init(engine.buffer);
engine.addPart(new IntroPart(demoSync), engine);
engine.addPart(new MedusaPart(demoSync), engine);
engine.addPart(new LinesPart(demoSync), engine);
engine.addPart(new RubikPart(demoSync), engine);
engine.addPart(new MandelBrotPart(demoSync), engine);
engine.addPart(new VoxelPart(demoSync), engine);
engine.addPart(new Part2(demoSync), engine);
engine.addPart(new LasersPart(demoSync), engine);
engine.addPart(new FlyPart(demoSync), engine);
engine.addPart(new ImageCubesPart(demoSync), engine);
engine.addPart(new AnalyzerPart(demoSync), engine);
engine.addPart(new Part3(demoSync), engine);
engine.addPart(new AnalyzerPart2(demoSync), engine);
demoSync.flash.addListener(onFlash);
demoSync.longflash.addListener(onLongFlash);
}
override protected function progress(_arg1:ProgressEvent):void{
this.graphics.clear();
if ((((_arg1.bytesLoaded == _arg1.bytesTotal)) && (!(started)))){
started = true;
showPlayButtons();
return;
};
var _local2:Number = (_arg1.bytesLoaded / _arg1.bytesTotal);
graphics.beginFill(0xFFFFFF);
graphics.drawRect((800 * _local2), ((400 / 2) - 10), (800 * (1 - _local2)), 20);
graphics.endFill();
}
private function showPlayButtons():void{
addChild(playbuttons);
}
public function onLongFlash(_arg1:int):void{
if (flashEffect.done){
engine.addEffect(flashEffect);
engine.addEventListener(Event.ENTER_FRAME, onFlashFrame);
};
flashEffect.speed = 4;
flashEffect.reset();
}
public function onFlash(_arg1:int):void{
if (flashEffect.done){
engine.addEffect(flashEffect);
engine.addEventListener(Event.ENTER_FRAME, onFlashFrame);
};
flashEffect.speed = 1;
flashEffect.reset();
}
override protected function songLoaded(_arg1:Event):void{
super.songLoaded(_arg1);
demoSync.flash.addListener(onFlash);
demoSync.longflash.addListener(onLongFlash);
}
}
}//package
Section 228
//DemoSynch (DemoSynch)
package {
import evo.engine.*;
public class DemoSynch extends Sequencer {
public var bassDrum:Tick;
public var flash:Tick;
public var pad:Tick;
public var longflash:Tick;
public var snare:Tick;
public var trig:Tick;
public function DemoSynch(){
bassDrum = new Tick();
flash = new Tick();
longflash = new Tick();
trig = new Tick();
snare = new Tick();
pad = new Tick();
super();
setBPM(138);
setOffset(-150);
makeTriggers();
}
public function makeTriggers():void{
var _local1:TickPattern = new TickPattern(bassDrum, 0, 1, 2, 3);
var _local2:TickPattern = new TickPattern(bassDrum, 1, 3);
var _local3:TickPattern = new TickPattern(trig, 0);
var _local4:TickPattern = new TickPattern(trig, 3);
var _local5:TickPattern = new TickPattern(pad, 0);
var _local6:TickPattern = new TickPattern(bassDrum, 0, 1);
var _local7:TickPattern = new TickPattern(snare, 1, 3);
var _local8:TickPattern = new TickPattern(phase, 0);
var _local9:TickPattern = new TickPattern(flash, 0);
var _local10:TickPattern = new TickPattern(longflash, 0);
addTickers();
addTickers(_local1);
addTickers(_local1);
addTickers(_local1);
addTickers(_local1);
addTickers(_local1);
addTickers(_local1, _local5);
addTickers(_local3);
addTickers();
addTickers(_local1, _local7);
addTickers(_local1, _local7);
addTickers(_local1, _local7);
addTickers(_local1, _local7);
addTickers(_local1, _local7);
addTickers(_local1, _local7);
addTickers(_local1, _local7);
addTickers(_local1, _local7);
addTickers(_local8, _local1, _local7);
addTickers(_local1, _local7);
addTickers(_local1, _local7);
addTickers(_local1, _local7);
addTickers(_local1, _local7, _local3);
addTickers(_local1, _local7);
addTickers(_local1, _local7);
addTickers(_local1, _local7);
addTickers(_local8, _local1, _local7);
addTickers(_local1, _local7);
addTickers(_local1, _local7);
addTickers(_local1, _local7);
addTickers(_local3, _local7);
addTickers(_local7);
addTickers();
addTickers();
addTickers(_local8, _local1);
addTickers(_local1);
addTickers(_local1);
addTickers(_local1, _local4);
addTickers(_local1);
addTickers(_local1);
addTickers(_local1);
addTickers(_local1);
addTickers(_local8, _local1, _local7);
addTickers(_local1, _local7);
addTickers(_local1, _local7);
addTickers(_local1, _local7);
addTickers(_local7, _local3);
addTickers();
addTickers();
addTickers();
addTickers(_local8);
addTickers();
addTickers();
addTickers();
addTickers();
addTickers();
addTickers();
addTickers();
addTickers();
addTickers();
addTickers();
addTickers();
addTickers();
addTickers();
addTickers();
addTickers();
addTickers();
addTickers();
addTickers();
addTickers();
addTickers();
addTickers();
addTickers();
addTickers();
addTickers(_local8, _local2);
addTickers(_local2);
addTickers(_local2);
addTickers(_local2);
addTickers(_local2);
addTickers(_local2);
addTickers(_local6);
addTickers(_local1);
addTickers(_local8, _local1, _local7);
addTickers(_local1, _local7);
addTickers(_local1, _local7);
addTickers(_local1, _local7);
addTickers(_local1, _local7);
addTickers(_local1, _local7);
addTickers(_local1, _local7);
addTickers(_local1, _local7);
addTickers(_local1, _local8);
addTickers(_local1, _local7);
addTickers(_local1);
addTickers(_local1, _local7);
addTickers(_local1, _local3);
addTickers(_local1, _local7);
addTickers(_local1);
addTickers(_local1, _local7);
addTickers(_local8, _local1);
addTickers(_local1);
addTickers(_local1, _local3);
addTickers(_local1);
addTickers(_local1);
addTickers(_local1);
addTickers(_local1);
addTickers(_local1);
addTickers(_local8, _local1);
addTickers(_local1);
addTickers(_local1);
addTickers(_local1);
addTickers(_local1);
addTickers(_local1);
addTickers(_local1);
addTickers(_local1);
addTickers(_local8, _local1, _local3);
addTickers(_local1);
addTickers(_local1);
addTickers(_local1);
addTickers(_local1);
addTickers(_local1);
addTickers(_local1);
addTickers();
addTickers(_local8, _local10, _local3);
}
}
}//package
Section 229
//PlayDemo (PlayDemo)
package {
import evo.engine.*;
import flash.events.*;
import flash.display.*;
import flash.geom.*;
import flash.utils.*;
import flash.text.*;
import play.*;
import flash.filters.*;
public class PlayDemo extends PlayAsset {
private var fullover:Boolean;// = false
private var winfilt:GlowFilter;
private var cnt:int;// = 0
private var fullScreenTimer:Timer;
private var winover:Boolean;// = false
private var fullfilt:GlowFilter;
private var timerField:TextField;
public function PlayDemo():void{
winfilt = new GlowFilter(0xFFFFFF, 1, 0, 0, 2, 1);
fullfilt = new GlowFilter(0xFFFFFF, 1, 0, 0, 2, 1);
super();
windowed.buttonMode = true;
windowed.useHandCursor = true;
windowed.addEventListener(MouseEvent.CLICK, onWindowed);
windowed.addEventListener(MouseEvent.MOUSE_OVER, onWindowedOver);
windowed.addEventListener(MouseEvent.MOUSE_OUT, onWindowedOut);
fullscreen.buttonMode = true;
fullscreen.useHandCursor = true;
fullscreen.addEventListener(MouseEvent.CLICK, onFullscreen);
fullscreen.addEventListener(MouseEvent.MOUSE_OVER, onFullscreenOver);
fullscreen.addEventListener(MouseEvent.MOUSE_OUT, onFullscreenOut);
addEventListener(Event.ENTER_FRAME, onFrame);
var _local1:Sprite = new Sprite();
_local1.graphics.beginFill(0, 1);
_local1.graphics.drawRect(0, 0, 800, 100);
_local1.graphics.endFill();
addChild(_local1);
}
private function onFullscreen(_arg1:Event):void{
removeEventListener(Event.ENTER_FRAME, onFrame);
DefaultPreloader.demo.stage["fullScreenSourceRect"] = new Rectangle(0, 0, 800, 400);
DefaultPreloader.demo.stage.scaleMode = StageScaleMode.SHOW_ALL;
DefaultPreloader.demo.stage.displayState = StageDisplayState.FULL_SCREEN;
fullScreenTimer = new Timer(1000, 5);
fullScreenTimer.addEventListener(TimerEvent.TIMER_COMPLETE, onFullScreenReady);
fullScreenTimer.addEventListener(TimerEvent.TIMER, timerTick);
fullScreenTimer.start();
windowed.visible = false;
fullscreen.visible = false;
timerField = new TextField();
var _local2:TextFormat = new TextFormat("Arial", 32, 0xF0F0F0, true);
timerField.autoSize = TextFieldAutoSize.LEFT;
timerField.defaultTextFormat = _local2;
timerField.text = "Starting in 5 seconds";
addChild(timerField);
timerField.x = 200;
timerField.y = 200;
}
private function onWindowedOver(_arg1:Event):void{
winover = true;
}
private function timerTick(_arg1:TimerEvent):void{
cnt++;
timerField.text = (("Starting in " + (5 - cnt)) + " seconds");
if (cnt == 3){
timerField.text = "";
fullScreenTimer.removeEventListener(TimerEvent.TIMER, timerTick);
};
}
private function onFullscreenOut(_arg1:Event):void{
fullover = false;
}
private function onFrame(_arg1:Event):void{
var _local3:Number;
var _local2:Number = winfilt.blurX;
if (winover){
_local3 = 8;
} else {
_local3 = 0;
};
_local2 = (_local2 + ((_local3 - _local2) / 10));
winfilt.blurX = (winfilt.blurY = _local2);
_local2 = fullfilt.blurX;
if (fullover){
_local3 = 8;
} else {
_local3 = 0;
};
_local2 = (_local2 + ((_local3 - _local2) / 10));
fullfilt.blurX = (fullfilt.blurY = _local2);
windowed.filters = [winfilt];
fullscreen.filters = [fullfilt];
}
private function onWindowedOut(_arg1:Event):void{
winover = false;
}
private function onWindowed(_arg1:Event):void{
removeEventListener(Event.ENTER_FRAME, onFrame);
dispatchEvent(new Event("startDemo"));
}
private function onFullscreenOver(_arg1:Event):void{
fullover = true;
}
private function onFullScreenReady(_arg1:TimerEvent):void{
fullScreenTimer.removeEventListener(TimerEvent.TIMER_COMPLETE, onFullScreenReady);
fullScreenTimer.stop();
fullScreenTimer = null;
dispatchEvent(new Event("startDemo"));
}
}
}//package
Section 230
//textures_GlowParticle (textures_GlowParticle)
package {
import mx.core.*;
public class textures_GlowParticle extends BitmapAsset {
}
}//package
Section 231
//textures_Radial (textures_Radial)
package {
import mx.core.*;
public class textures_Radial extends BitmapAsset {
}
}//package