STORY   LOOP   FURRY   PORN   GAMES
• C •   SERVICES [?] [R] RND   POPULAR
Archived flashes:
229595
/disc/ · /res/     /show/ · /fap/ · /gg/ · /swf/P0001 · P2595 · P5190

<div style="position:absolute;top:-99px;left:-99px;"><img src="http://swfchan.com:57475/27883617?noj=FRM27883617-22DC" width="1" height="1"></div>

toast---eggs.swf

This is the info page for
Flash #113239

(Click the ID number above for more basic data on this flash file.)


ActionScript [AS3]
Section 1
//AnimationFrame (away3d.animators.data.AnimationFrame) package away3d.animators.data { 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.animators.data
Section 2
//AnimationGroup (away3d.animators.data.AnimationGroup) package away3d.animators.data { 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.animators.data
Section 3
//AnimationSequence (away3d.animators.data.AnimationSequence) package away3d.animators.data { 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=true, _arg3:Boolean=false, _arg4:Number=3){ this.prefix = ((_arg1)==null) ? "" : _arg1; this.smooth = _arg2; this.loop = _arg3; this.fps = _arg4; if (this.prefix == ""){ trace("Prefix is null, this might cause enter endless loop"); }; } } }//package away3d.animators.data
Section 4
//Bone (away3d.animators.skin.Bone) package away3d.animators.skin { import away3d.containers.*; import away3d.core.base.*; import away3d.core.math.*; public class Bone extends ObjectContainer3D { private var _jointTransform:Matrix3D; public var joint:ObjectContainer3D; private var _baseMatrix:Matrix3D; public var id:String; public function Bone(_arg1:Object=null, ... _args):void{ _baseMatrix = new Matrix3D(); _jointTransform = new Matrix3D(); super(_arg1); addChild((joint = new ObjectContainer3D())); } public function set jointRotationX(_arg1:Number):void{ joint.rotationX = _arg1; } public function set jointScaleZ(_arg1:Number):void{ joint.scaleZ = _arg1; } public function set jointRotationZ(_arg1:Number):void{ joint.rotationZ = _arg1; } override public function cloneAll(_arg1:Object3D=null):Object3D{ var _local2:Bone = (((_arg1 as Bone)) || (new Bone())); _local2.removeChild(joint); super.cloneAll(_local2); _local2.id = id; _local2.joint = _local2.children[0]; return (_local2); } public function set jointScaleY(_arg1:Number):void{ joint.scaleY = _arg1; } public function get jointRotationX():Number{ return (joint.rotationX); } public function get jointRotationZ():Number{ return (joint.rotationZ); } public function set jointScaleX(_arg1:Number):void{ joint.scaleX = _arg1; } public function get jointRotationY():Number{ return (joint.rotationY); } public function get jointScaleY():Number{ return (joint.scaleY); } public function set jointRotationY(_arg1:Number):void{ joint.rotationY = _arg1; } public function get jointScaleZ():Number{ return (joint.scaleZ); } override public function clone(_arg1:Object3D=null):Object3D{ var _local2:Bone = (((_arg1 as Bone)) || (new Bone())); super.clone(_local2); _local2.joint = _local2.children[0]; return (_local2); } public function get jointScaleX():Number{ return (joint.scaleX); } } }//package away3d.animators.skin
Section 5
//SkinController (away3d.animators.skin.SkinController) package away3d.animators.skin { import away3d.containers.*; import away3d.core.base.*; import away3d.core.math.*; public class SkinController { public var sceneTransform:Matrix3D; public var joint:ObjectContainer3D; public var name:String; public var updated:Boolean; public var inverseTransform:Matrix3D; public var bindMatrix:Matrix3D; public function SkinController(){ sceneTransform = new Matrix3D(); super(); } public function update():void{ if (!joint){ return; }; if (!joint.scene.updatedObjects[joint]){ updated = false; return; }; updated = true; sceneTransform.multiply(joint.sceneTransform, bindMatrix); sceneTransform.multiply(inverseTransform, sceneTransform); } } }//package away3d.animators.skin
Section 6
//SkinVertex (away3d.animators.skin.SkinVertex) package away3d.animators.skin { import away3d.core.base.*; import away3d.core.math.*; public class SkinVertex { public var weights:Array; public var controllers:Array; private var _position:Number3D; private var _i:int; public var baseVertex:Vertex; private var _skinController:SkinController; public var skinnedVertex:Vertex; private var _sceneTransform:Matrix3D; public function SkinVertex(_arg1:Vertex){ _position = new Number3D(); _sceneTransform = new Matrix3D(); weights = new Array(); controllers = new Array(); super(); skinnedVertex = _arg1; baseVertex = _arg1.clone(); } public function update():void{ var _local1:Boolean; for each (_skinController in controllers) { _local1 = ((_local1) || (_skinController.updated)); }; if (!_local1){ return; }; skinnedVertex.reset(); _i = weights.length; while (_i--) { _position.transform(baseVertex.position, (controllers[_i] as SkinController).sceneTransform); _position.scale(_position, weights[_i]); skinnedVertex.add(_position); }; } } }//package away3d.animators.skin
Section 7
//IMeshAnimation (away3d.animators.IMeshAnimation) package away3d.animators { import away3d.containers.*; public interface IMeshAnimation { function update(_arg1:Number, _arg2:Boolean=true):void; function clone(_arg1:ObjectContainer3D):IMeshAnimation; } }//package away3d.animators
Section 8
//ConvexBlock (away3d.blockers.ConvexBlock) package away3d.blockers { import away3d.core.base.*; import away3d.core.project.*; public class ConvexBlock extends Object3D { public var vertices:Array; public var debug:Boolean; public function ConvexBlock(_arg1:Array, _arg2:Object=null){ vertices = []; super(_arg2); this.vertices = _arg1; debug = ini.getBoolean("debug", false); projectorType = ProjectorType.CONVEX_BLOCK; } } }//package away3d.blockers
Section 9
//AbstractLens (away3d.cameras.lenses.AbstractLens) package away3d.cameras.lenses { import away3d.containers.*; import away3d.core.draw.*; import away3d.core.clip.*; import away3d.cameras.*; import away3d.core.utils.*; import away3d.core.math.*; import away3d.core.geom.*; public class AbstractLens { protected const toDEGREES:Number = 57.2957795130823; protected const toRADIANS:Number = 0.0174532925199433; protected var _sw:Number; protected var _view:View3D; protected var _sy:Number; protected var _sz:Number; protected var _sx:Number; protected var _near:Number; protected var _screenVertex:ScreenVertex; protected var _clipping:Clipping; protected var _frustum:Frustum; protected var view:Matrix3D; protected var _clipTop:Number; protected var _clipRight:Number; protected var _cameraVarsStore:CameraVarsStore; protected var _clipHeight:Number; protected var _drawPrimitiveStore:DrawPrimitiveStore; protected var _focusOverZoom:Number; protected var _clipBottom:Number; protected var _camera:Camera3D; protected var _zoom2:Number; protected var _persp:Number; protected var viewTransform:Matrix3D; protected var _clipLeft:Number; protected var _clipWidth:Number; protected var _plane:Plane3D; protected var _far:Number; protected var _vx:Number; protected var _vz:Number; protected var _len:Number; protected var classification:int; protected var _vy:Number; protected var _scz:Number; protected var _projected:ScreenVertex; public function AbstractLens(){ view = new Matrix3D(); super(); } public function setView(_arg1:View3D):void{ _view = _arg1; _drawPrimitiveStore = _arg1.drawPrimitiveStore; _cameraVarsStore = _arg1.cameraVarsStore; _camera = _arg1.camera; _clipping = _arg1.screenClipping; _clipTop = _clipping.maxY; _clipBottom = _clipping.minY; _clipLeft = _clipping.minX; _clipRight = _clipping.maxX; _clipHeight = (_clipBottom - _clipTop); _clipWidth = (_clipRight - _clipLeft); _far = _clipping.maxZ; } } }//package away3d.cameras.lenses
Section 10
//ILens (away3d.cameras.lenses.ILens) package away3d.cameras.lenses { import away3d.containers.*; import away3d.core.draw.*; import away3d.core.base.*; import away3d.core.math.*; import away3d.core.geom.*; public interface ILens { function getZoom():Number; function getFOV():Number; function project(_arg1:Matrix3D, _arg2:Vertex):ScreenVertex; function getFrustum(_arg1:Object3D, _arg2:Matrix3D):Frustum; function setView(_arg1:View3D):void; } }//package away3d.cameras.lenses
Section 11
//ZoomFocusLens (away3d.cameras.lenses.ZoomFocusLens) package away3d.cameras.lenses { import away3d.containers.*; import away3d.core.draw.*; import away3d.core.clip.*; import away3d.core.base.*; import away3d.core.math.*; import away3d.core.geom.*; public class ZoomFocusLens extends AbstractLens implements ILens { public function getFrustum(_arg1:Object3D, _arg2:Matrix3D):Frustum{ _frustum = _cameraVarsStore.createFrustum(_arg1); _focusOverZoom = (_camera.focus / _camera.zoom); _zoom2 = (_camera.zoom * _camera.zoom); _plane = _frustum.planes[Frustum.NEAR]; _plane.a = 0; _plane.b = 0; _plane.c = 1; _plane.d = -(_near); _plane.transform(_arg2); _plane = _frustum.planes[Frustum.FAR]; _plane.a = 0; _plane.b = 0; _plane.c = -1; _plane.d = _far; _plane.transform(_arg2); _plane = _frustum.planes[Frustum.LEFT]; _plane.a = (-(_clipHeight) * _focusOverZoom); _plane.b = 0; _plane.c = ((_clipHeight * _clipLeft) / _zoom2); _plane.d = (_plane.c * _camera.focus); _plane.transform(_arg2); _plane = _frustum.planes[Frustum.RIGHT]; _plane.a = (_clipHeight * _focusOverZoom); _plane.b = 0; _plane.c = ((-(_clipHeight) * _clipRight) / _zoom2); _plane.d = (_plane.c * _camera.focus); _plane.transform(_arg2); _plane = _frustum.planes[Frustum.TOP]; _plane.a = 0; _plane.b = (-(_clipWidth) * _focusOverZoom); _plane.c = ((_clipWidth * _clipTop) / _zoom2); _plane.d = (_plane.c * _camera.focus); _plane.transform(_arg2); _plane = _frustum.planes[Frustum.BOTTOM]; _plane.a = 0; _plane.b = (_clipWidth * _focusOverZoom); _plane.c = ((-(_clipWidth) * _clipBottom) / _zoom2); _plane.d = (_plane.c * _camera.focus); _plane.transform(_arg2); return (_frustum); } override public function setView(_arg1:View3D):void{ super.setView(_arg1); if (_clipping.minZ == -(Infinity)){ _near = (_clipping.minZ = (-(_camera.focus) / 2)); } else { _near = _clipping.minZ; }; } public function project(_arg1:Matrix3D, _arg2:Vertex):ScreenVertex{ _screenVertex = _drawPrimitiveStore.createScreenVertex(_arg2); if (_screenVertex.viewTimer == _camera.view.viewTimer){ return (_screenVertex); }; _screenVertex.viewTimer = _camera.view.viewTimer; _vx = _arg2.x; _vy = _arg2.y; _vz = _arg2.z; _sz = ((((_vx * _arg1.szx) + (_vy * _arg1.szy)) + (_vz * _arg1.szz)) + _arg1.tz); if (isNaN(_sz)){ throw (new Error("isNaN(sz)")); }; if ((((_sz < _near)) && ((_clipping is RectangleClipping)))){ _screenVertex.visible = false; return (_screenVertex); }; _persp = (_camera.zoom / (1 + (_sz / _camera.focus))); _screenVertex.x = ((_screenVertex.vx = ((((_vx * _arg1.sxx) + (_vy * _arg1.sxy)) + (_vz * _arg1.sxz)) + _arg1.tx)) * _persp); _screenVertex.y = ((_screenVertex.vy = ((((_vx * _arg1.syx) + (_vy * _arg1.syy)) + (_vz * _arg1.syz)) + _arg1.ty)) * _persp); _screenVertex.z = _sz; _screenVertex.visible = true; return (_screenVertex); } public function getZoom():Number{ return (((((_clipTop - _clipBottom) / Math.tan((_camera.fov * toRADIANS))) - (_clipTop * _clipBottom)) / _camera.focus)); } public function getFOV():Number{ return ((Math.atan2((_clipTop - _clipBottom), ((_camera.focus * _camera.zoom) + (_clipTop * _clipBottom))) * toDEGREES)); } } }//package away3d.cameras.lenses
Section 12
//Camera3D (away3d.cameras.Camera3D) package away3d.cameras { import away3d.containers.*; import away3d.events.*; import away3d.core.draw.*; import away3d.core.clip.*; import away3d.core.utils.*; import away3d.core.base.*; import away3d.core.math.*; import away3d.cameras.lenses.*; public class Camera3D extends Object3D { protected const toDEGREES:Number = 57.2957795130823; protected const toRADIANS:Number = 0.0174532925199433; private var _y:Number; private var _view:View3D; private var _sz:Number; private var _flipY:Matrix3D; private var _fov:Number;// = 0 public var invViewMatrix:Matrix3D; private var _clipping:Clipping; private var _clipTop:Number; private var _clipRight:Number; private var _cameraVarsStore:CameraVarsStore; private var _zoom:Number;// = 10 private var _clipBottom:Number; private var _persp:Number; private var _drawPrimitiveStore:DrawPrimitiveStore; private var _zoomDirty:Boolean; public var maxblur:Number;// = 150 private var _clipLeft:Number; private var _focus:Number; private var _lens:ILens; private var _fovDirty:Boolean; private var _viewMatrix:Matrix3D; public var fixedZoom:Boolean; public var doflevels:Number;// = 16 private var _vt:Matrix3D; private var _aperture:Number;// = 22 private var _cameraupdated:CameraEvent; private var _x:Number; private var _z:Number; private var _dof:Boolean;// = false public function Camera3D(_arg1:Object=null){ _flipY = new Matrix3D(); _viewMatrix = new Matrix3D(); invViewMatrix = new Matrix3D(); super(_arg1); fov = ini.getNumber("fov", _fov); focus = ini.getNumber("focus", 100); zoom = ini.getNumber("zoom", _zoom); fixedZoom = ini.getBoolean("fixedZoom", true); lens = (((ini.getObject("lens", AbstractLens) as ILens)) || (new ZoomFocusLens())); 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){ lookAt(_local2); }; } public function unproject(_arg1:Number, _arg2:Number):Number3D{ var _local3:Number = ((focus * zoom) / focus); var _local4:Number3D = new Number3D((_arg1 / _local3), (-(_arg2) / _local3), focus); transform.multiplyVector3x3(_local4); return (_local4); } public function set dof(_arg1:Boolean):void{ _dof = _arg1; if (_dof){ enableDof(); } else { disableDof(); }; } public function set lens(_arg1:ILens):void{ if (_lens == _arg1){ return; }; _lens = _arg1; notifyCameraUpdate(); } public function get aperture():Number{ return (_aperture); } public function get lens():ILens{ return (_lens); } public function get zoom():Number{ return (_zoom); } public function set aperture(_arg1:Number):void{ _aperture = _arg1; DofCache.aperture = _aperture; } public function pan(_arg1:Number):void{ super.yaw(_arg1); } public function get view():View3D{ return (_view); } public function set fov(_arg1:Number):void{ if (_fov == _arg1){ return; }; _fov = _arg1; _fovDirty = false; _zoomDirty = true; notifyCameraUpdate(); } public function set focus(_arg1:Number):void{ _focus = _arg1; DofCache.focus = _focus; notifyCameraUpdate(); } public function set zoom(_arg1:Number):void{ if (_zoom == _arg1){ return; }; _zoom = _arg1; _zoomDirty = false; _fovDirty = true; notifyCameraUpdate(); } private function notifyCameraUpdate():void{ if (!hasEventListener(CameraEvent.CAMERA_UPDATED)){ return; }; if (_cameraupdated == null){ _cameraupdated = new CameraEvent(CameraEvent.CAMERA_UPDATED, this); }; dispatchEvent(_cameraupdated); } public function enableDof():void{ DofCache.doflevels = doflevels; DofCache.aperture = aperture; DofCache.maxblur = maxblur; DofCache.focus = focus; DofCache.resetDof(true); } public function tilt(_arg1:Number):void{ super.pitch(_arg1); } public function get viewMatrix():Matrix3D{ invViewMatrix.multiply(sceneTransform, _flipY); _viewMatrix.inverse(invViewMatrix); return (_viewMatrix); } public function get fov():Number{ return (_fov); } public function update():void{ _view.updateScreenClipping(); _clipping = _view.screenClipping; if (((((((!((_clipTop == _clipping.maxY))) || (!((_clipBottom == _clipping.minY))))) || (!((_clipLeft == _clipping.minX))))) || (!((_clipRight == _clipping.maxX))))){ if (((!(_fovDirty)) && (!(_zoomDirty)))){ if (fixedZoom){ _fovDirty = true; } else { _zoomDirty = true; }; }; _clipTop = _clipping.maxY; _clipBottom = _clipping.minY; _clipLeft = _clipping.minX; _clipRight = _clipping.maxX; }; lens.setView(_view); if (_fovDirty){ _fovDirty = false; _fov = lens.getFOV(); }; if (_zoomDirty){ _zoomDirty = false; _zoom = lens.getZoom(); }; } public function set view(_arg1:View3D):void{ if (_view == _arg1){ return; }; _view = _arg1; _drawPrimitiveStore = _arg1.drawPrimitiveStore; _cameraVarsStore = _arg1.cameraVarsStore; } public function get dof():Boolean{ return (_dof); } public function get focus():Number{ return (_focus); } public function disableDof():void{ DofCache.resetDof(false); } public function addOnCameraUpdate(_arg1:Function):void{ addEventListener(CameraEvent.CAMERA_UPDATED, _arg1, false, 0, false); } public function removeOnCameraUpdate(_arg1:Function):void{ removeEventListener(CameraEvent.CAMERA_UPDATED, _arg1, false); } public function screen(_arg1:Object3D, _arg2:Vertex=null):ScreenVertex{ if (_arg2 == null){ _arg2 = _arg1.center; }; _cameraVarsStore.createViewTransform(_arg1).multiply(viewMatrix, _arg1.sceneTransform); _drawPrimitiveStore.createVertexDictionary(_arg1); return (lens.project(_cameraVarsStore.viewTransformDictionary[_arg1], _arg2)); } override public function clone(_arg1:Object3D=null):Object3D{ var _local2:Camera3D = (((_arg1 as Camera3D)) || (new Camera3D())); super.clone(_local2); _local2.zoom = zoom; _local2.focus = focus; _local2.lens = lens; return (_local2); } } }//package away3d.cameras
Section 13
//ILODObject (away3d.containers.ILODObject) package away3d.containers { import away3d.cameras.*; public interface ILODObject { function matchLOD(_arg1:Camera3D):Boolean; } }//package away3d.containers
Section 14
//IPhysicsScene (away3d.containers.IPhysicsScene) package away3d.containers { public interface IPhysicsScene { function updateTime(_arg1:int):void; } }//package away3d.containers
Section 15
//ObjectContainer3D (away3d.containers.ObjectContainer3D) package away3d.containers { import away3d.events.*; import away3d.core.utils.*; import away3d.core.base.*; import away3d.core.math.*; import away3d.core.traverse.*; import away3d.animators.skin.*; import away3d.loaders.data.*; import away3d.loaders.utils.*; import away3d.core.project.*; public class ObjectContainer3D extends Object3D { private var _radiusChild:Object3D;// = null private var _children:Array; public function ObjectContainer3D(... _args){ var _local2:Object; var _local4:Object; var _local5:Object3D; _children = new Array(); var _local3:Array = []; for each (_local4 in _args) { if ((_local4 is Object3D)){ _local3.push(_local4); } else { _local2 = _local4; }; }; super(_local2); projectorType = ProjectorType.OBJECT_CONTAINER; for each (_local5 in _local3) { addChild(_local5); }; } public function addChildren(... _args):void{ var _local2:Object3D; for each (_local2 in _args) { addChild(_local2); }; } public function addChild(_arg1:Object3D):void{ if (_arg1 == null){ throw (new Error("ObjectContainer3D.addChild(null)")); }; _arg1.parent = this; } public function getBoneByName(_arg1:String):Bone{ var _local2:Bone; var _local3:Object3D; for each (_local3 in children) { if ((_local3 is Bone)){ _local2 = (_local3 as Bone); if (_local2.name){ if (_local2.name == _arg1){ return (_local2); }; }; if (_local2.id){ if (_local2.id == _arg1){ return (_local2); }; }; }; if ((_local3 is ObjectContainer3D)){ _local2 = (_local3 as ObjectContainer3D).getBoneByName(_arg1); if (_local2){ return (_local2); }; }; }; return (null); } override public function clone(_arg1:Object3D=null):Object3D{ var _local3:Object3D; var _local2:ObjectContainer3D = (((_arg1 as ObjectContainer3D)) || (new ObjectContainer3D())); super.clone(_local2); for each (_local3 in children) { if (!(_local3 is Bone)){ _local2.addChild(_local3.clone()); }; }; return (_local2); } public function cloneAll(_arg1:Object3D=null):Object3D{ var _local3:ObjectContainer3D; var _local4:Object3D; var _local6:AnimationData; var _local7:MaterialData; var _local2:ObjectContainer3D = (((_arg1 as ObjectContainer3D)) || (new ObjectContainer3D())); super.clone(_local2); for each (_local4 in children) { if ((_local4 is Bone)){ _local3 = new Bone(); _local2.addChild(_local3); (_local4 as Bone).cloneAll(_local3); } else { if ((_local4 is ObjectContainer3D)){ _local3 = new ObjectContainer3D(); _local2.addChild(_local3); (_local4 as ObjectContainer3D).cloneAll(_local3); } else { if ((_local4 is Mesh)){ _local2.addChild((_local4 as Mesh).cloneAll()); } else { _local2.addChild(_local4.clone()); }; }; }; }; if (animationLibrary){ _local2.animationLibrary = new AnimationLibrary(); for each (_local6 in animationLibrary) { _local6.clone(_local2); }; }; if (materialLibrary){ _local2.materialLibrary = new MaterialLibrary(); for each (_local7 in materialLibrary) { _local7.clone(_local2); }; }; var _local5:ObjectContainer3D = _local2; while (_local5.parent) { _local5 = _local5.parent; }; if (_local2 == _local5){ cloneBones(_local2, _local5); }; return (_local2); } 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; var _local3:Object3D; for each (_local3 in children) { if (_local3.name){ if (_local3.name == _arg1){ return (_local3); }; }; if ((_local3 is ObjectContainer3D)){ _local2 = (_local3 as ObjectContainer3D).getChildByName(_arg1); if (_local2){ return (_local2); }; }; }; return (null); } private function onChildChange(_arg1:Object3DEvent):void{ notifyDimensionsChange(); } override public function applyRotations():void{ var _local1:Number; var _local2:Number; var _local3:Number; var _local4:Number; var _local5:Number; var _local6:Number; var _local17:Object3D; var _local7:Number = (Math.PI / 180); var _local8:Number = (rotationX * _local7); var _local9:Number = (rotationY * _local7); var _local10:Number = (rotationZ * _local7); var _local11:Number = Math.sin(_local8); var _local12:Number = Math.cos(_local8); var _local13:Number = Math.sin(_local9); var _local14:Number = Math.cos(_local9); var _local15:Number = Math.sin(_local10); var _local16:Number = Math.cos(_local10); for each (_local17 in children) { _local1 = _local17.x; _local2 = _local17.y; _local3 = _local17.z; _local5 = _local2; _local2 = ((_local5 * _local12) + (_local3 * -(_local11))); _local3 = ((_local5 * _local11) + (_local3 * _local12)); _local4 = _local1; _local1 = ((_local4 * _local14) + (_local3 * _local13)); _local3 = ((_local4 * -(_local13)) + (_local3 * _local14)); _local4 = _local1; _local1 = ((_local4 * _local16) + (_local2 * -(_local15))); _local2 = ((_local4 * _local15) + (_local2 * _local16)); _local17.moveTo(_local1, _local2, _local3); }; rotationX = 0; rotationY = 0; rotationZ = 0; } 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); }; } override protected function updateDimensions():void{ var _local2:Number; var _local3:Number; var _local4:Number3D; var _local5:Object3D; var _local1:Array = _children.concat(); if (_local1.length){ if (_scaleX < 0){ _boundingScale = -(_scaleX); } else { _boundingScale = _scaleX; }; if ((((_scaleY < 0)) && ((_boundingScale < -(_scaleY))))){ _boundingScale = -(_scaleY); } else { if (_boundingScale < _scaleY){ _boundingScale = _scaleY; }; }; if ((((_scaleZ < 0)) && ((_boundingScale < -(_scaleZ))))){ _boundingScale = -(_scaleZ); } else { if (_boundingScale < _scaleZ){ _boundingScale = _scaleZ; }; }; _local2 = 0; _local4 = new Number3D(); for each (_local5 in _local1) { _local4.sub(_local5.position, _pivotPoint); _local3 = (_local4.modulo + _local5.parentBoundingRadius); if (_local2 < _local3){ _local2 = _local3; }; }; _boundingRadius = _local2; _local1.sortOn("parentmaxX", (Array.DESCENDING | Array.NUMERIC)); _maxX = _local1[0].parentmaxX; _local1.sortOn("parentminX", Array.NUMERIC); _minX = _local1[0].parentminX; _local1.sortOn("parentmaxY", (Array.DESCENDING | Array.NUMERIC)); _maxY = _local1[0].parentmaxY; _local1.sortOn("parentminY", Array.NUMERIC); _minY = _local1[0].parentminY; _local1.sortOn("parentmaxZ", (Array.DESCENDING | Array.NUMERIC)); _maxZ = _local1[0].parentmaxZ; _local1.sortOn("parentminZ", Array.NUMERIC); _minZ = _local1[0].parentminZ; }; super.updateDimensions(); } override public function applyPosition(_arg1:Number, _arg2:Number, _arg3:Number):void{ var _local4:Number; var _local5:Number; var _local6:Number; var _local7:Object3D; var _local8:Number3D; for each (_local7 in children) { _local4 = _local7.x; _local5 = _local7.y; _local6 = _local7.z; _local7.moveTo((_local4 - _arg1), (_local5 - _arg2), (_local6 - _arg3)); }; _local8 = new Number3D(_arg1, _arg2, _arg3); new Number3D(_arg1, _arg2, _arg3).rotate(_local8, _transform); _local8.add(_local8, position); moveTo(_local8.x, _local8.y, _local8.z); } function internalAddChild(_arg1:Object3D):void{ _children.push(_arg1); _arg1.addOnTransformChange(onChildChange); _arg1.addOnDimensionsChange(onChildChange); notifyDimensionsChange(); if (((_session) && (!(_arg1.ownCanvas)))){ session.internalAddOwnSession(_arg1); }; _sessionDirty = true; } private function cloneBones(_arg1:ObjectContainer3D, _arg2:ObjectContainer3D):void{ var _local3:Object3D; var _local4:Geometry; var _local5:Array; var _local6:Bone; var _local7:SkinController; var _local8:Bone; for each (_local3 in _arg1.children) { if ((_local3 is ObjectContainer3D)){ (_local3 as ObjectContainer3D).cloneBones((_local3 as ObjectContainer3D), _arg2); } else { if ((_local3 is Mesh)){ _local4 = (_local3 as Mesh).geometry; _local5 = _local4.skinControllers; for each (_local7 in _local5) { _local8 = _arg2.getBoneByName(_local7.name); if (_local8){ _local7.joint = _local8.joint; if (!(_local8.parent.parent is Bone)){ _local6 = _local8; }; } else { Debug.warning(("no joint found for " + _local7.name)); }; }; for each (_local7 in _local5) { _local7.inverseTransform = _local3.parent.inverseSceneTransform; }; }; }; }; } public function removeChildByName(_arg1:String):void{ removeChild(getChildByName(_arg1)); } function internalRemoveChild(_arg1:Object3D):void{ var _local2:int = children.indexOf(_arg1); if (_local2 == -1){ return; }; _arg1.removeOnTransformChange(onChildChange); _arg1.removeOnDimensionsChange(onChildChange); _children.splice(_local2, 1); notifyDimensionsChange(); if (((session) && (!(_arg1.ownCanvas)))){ session.internalRemoveOwnSession(_arg1); }; _sessionDirty = true; } public function get children():Array{ return (_children); } } }//package away3d.containers
Section 16
//Scene3D (away3d.containers.Scene3D) package away3d.containers { import flash.events.*; import away3d.events.*; import flash.utils.*; import away3d.core.utils.*; import away3d.core.base.*; import away3d.core.math.*; import away3d.core.traverse.*; public class Scene3D extends ObjectContainer3D { private var _view:View3D; public var physics:IPhysicsScene; private var _lighttraverser:LightTraverser; private var _projtraverser:ProjectionTraverser; private var _mesh:Mesh; private var _sessiontraverser:SessionTraverser; private var _geometry:Geometry; public var viewDictionary:Dictionary; public var geometries:Dictionary; private var _key:Object; public var tickTraverser:TickTraverser; public var updatedObjects:Dictionary; public var meshes:Dictionary; private var _viewArray:Array; private var _autoUpdate:Boolean; public var updatedSessions:Dictionary; public var autoUpdate:Boolean; private var _currentView:View3D; public function Scene3D(... _args){ var _local2:Object; var _local4:Object; var _local6:Object3D; _projtraverser = new ProjectionTraverser(); _sessiontraverser = new SessionTraverser(); _lighttraverser = new LightTraverser(); viewDictionary = new Dictionary(true); tickTraverser = new TickTraverser(); var _local3:Array = []; for each (_local4 in _args) { if ((_local4 is Object3D)){ _local3.push(_local4); } else { _local2 = _local4; }; }; if (_local2){ _local2.ownCanvas = true; _local2.ownLights = true; } else { _local2 = {ownCanvas:true, ownLights:true}; }; super(_local2); autoUpdate = ini.getBoolean("autoUpdate", true); var _local5:Object = ini.getObject("physics"); if ((_local5 is IPhysicsScene)){ physics = (_local5 as IPhysicsScene); }; if ((_local5 is Boolean)){ if (_local5 == true){ physics = null; }; }; if ((_local5 is Object)){ physics = null; }; for each (_local6 in _local3) { addChild(_local6); }; } public function updateTime(_arg1:int=-1):void{ if (_arg1 == -1){ _arg1 = getTimer(); }; tickTraverser.now = _arg1; traverse(tickTraverser); if (physics != null){ physics.updateTime(_arg1); }; } private function onUpdate(_arg1:ViewEvent):void{ if (autoUpdate){ if (((_currentView) && (!((_currentView == _arg1.view))))){ Debug.warning("Multiple views detected! Should consider switching to manual update"); }; _currentView = _arg1.view; update(); }; } public function update():void{ updatedObjects = new Dictionary(true); updatedSessions = new Dictionary(true); meshes = new Dictionary(true); geometries = new Dictionary(true); traverse(_lighttraverser); for each (_view in viewDictionary) { _view.camera.update(); _view.blockers = new Dictionary(true); _view.drawPrimitiveStore.blockerDictionary = new Dictionary(true); _view.cameraVarsStore.reset(); _view.blockerarray.clip = _view.screenClipping; _projtraverser.view = _view; traverse(_projtraverser); }; for (_key in meshes) { _mesh = (_key as Mesh); _viewArray = meshes[_mesh]; for each (_view in _viewArray) { _mesh.updateMaterials(_mesh, _view); }; }; for each (_geometry in geometries) { _geometry.updateElements(); }; traverse(_sessiontraverser); } function internalRemoveView(_arg1:View3D):void{ _arg1.removeEventListener(ViewEvent.UPDATE_SCENE, onUpdate); } function internalAddView(_arg1:View3D):void{ _arg1.addEventListener(ViewEvent.UPDATE_SCENE, onUpdate); } override public function get sceneTransform():Matrix3D{ if (_transformDirty){ _sceneTransformDirty = true; }; if (_sceneTransformDirty){ notifySceneTransformChange(); }; return (transform); } } }//package away3d.containers
Section 17
//View3D (away3d.containers.View3D) package away3d.containers { import flash.events.*; import flash.display.*; import away3d.events.*; import flash.utils.*; import away3d.core.render.*; import away3d.core.draw.*; import away3d.core.clip.*; import away3d.cameras.*; import away3d.core.utils.*; import away3d.core.base.*; import away3d.core.math.*; import away3d.core.traverse.*; import away3d.materials.*; import flash.geom.*; import away3d.core.block.*; import away3d.core.project.*; import away3d.core.stats.*; import away3d.blockers.*; public class View3D extends Sprite { private var _x:Number; private var _internalsession:AbstractRenderSession; private var _container:DisplayObject; private var _stageHeight:Number; private var _stageWidth:Number; private var _renderComplete:ViewEvent; var _movieClipSpriteProjector:MovieClipSpriteProjector; private var _clipping:Clipping; private var _renderer:IRenderer; private var _ini:Init; private var material:IUVMaterial; private var _mouseIsOverView:Boolean; public var background:Sprite; private var _ddo:DrawDisplayObject; private var _cameraVarsStore:CameraVarsStore; var _spriteProjector:SpriteProjector; var _objectContainerProjector:ObjectContainerProjector; private var persp:Number; private var _drawPrimitiveStore:DrawPrimitiveStore; private var object:Object3D; private var _camera:Camera3D; private var _mousedown:Boolean; private var _viewZero:Point; private var sceneY:Number; var _meshProjector:MeshProjector; private var sceneX:Number; public var sourceURL:String; var _convexBlockProjector:ConvexBlockProjector; private var _session:AbstractRenderSession; private var _pritraverser:PrimitiveTraverser; var _dofSpriteProjector:DofSpriteProjector; private var _consumer:IPrimitiveConsumer; private var sceneZ:Number; public var mouseZeroMove:Boolean; private var _screenClippingDirty:Boolean; public var mouseObject:Object3D; private var screenX:Number; private var _cleared:Boolean; private var screenZ:Number;// = INF private var screenY:Number; private var _updated:Boolean; var _screenClipping:Clipping; public var statsOpen:Boolean; private var _scene:Scene3D; public var forceUpdate:Boolean; private var uv:UV; private var _updatescene:ViewEvent; public var statsPanel:Stats; public var stats:Boolean; public var viewTimer:int; private var _loaderWidth:Number; public var blockers:Dictionary; private var _blocker:ConvexBlock; private var _hitPointX:Number; private var _hitPointY:Number; private var _loaderDirty:Boolean; public var blockerarray:BlockerArray; var _dirSpriteProjector:DirSpriteProjector; private var drawpri:DrawPrimitive; private var primitive:DrawPrimitive; private var _lastmove_mouseX:Number; private var _lastmove_mouseY:Number; var _interactiveLayer:Sprite; private var _sc:ScreenVertex; private var inv:Matrix3D; public var mouseMaterial:IUVMaterial; public var hud:Sprite; private var _loaderHeight:Number; private var _y:Number; private var element:Object; public function View3D(_arg1:Object=null){ _interactiveLayer = new Sprite(); _convexBlockProjector = new ConvexBlockProjector(); _dirSpriteProjector = new DirSpriteProjector(); _dofSpriteProjector = new DofSpriteProjector(); _meshProjector = new MeshProjector(); _movieClipSpriteProjector = new MovieClipSpriteProjector(); _objectContainerProjector = new ObjectContainerProjector(); _spriteProjector = new SpriteProjector(); _viewZero = new Point(); _drawPrimitiveStore = new DrawPrimitiveStore(); _cameraVarsStore = new CameraVarsStore(); _pritraverser = new PrimitiveTraverser(); _ddo = new DrawDisplayObject(); _sc = new ScreenVertex(); inv = new Matrix3D(); background = new Sprite(); hud = new Sprite(); blockerarray = new BlockerArray(); super(); _ini = (Init.parse(_arg1) as Init); var _local2:Boolean = _ini.getBoolean("stats", true); session = (((_ini.getObject("session") as AbstractRenderSession)) || (new SpriteRenderSession())); 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())); clipping = (((_ini.getObject("clipping", Clipping) as Clipping)) || (new RectangleClipping())); x = _ini.getNumber("x", 0); y = _ini.getNumber("y", 0); forceUpdate = _ini.getBoolean("forceUpdate", false); mouseZeroMove = _ini.getBoolean("mouseZeroMove", false); _interactiveLayer.blendMode = BlendMode.ALPHA; _convexBlockProjector.view = this; _dirSpriteProjector.view = this; _dofSpriteProjector.view = this; _meshProjector.view = this; _movieClipSpriteProjector.view = this; _objectContainerProjector.view = this; _spriteProjector.view = this; _drawPrimitiveStore.view = this; _cameraVarsStore.view = this; _pritraverser.view = this; addEventListener(MouseEvent.MOUSE_DOWN, onMouseDown); addEventListener(MouseEvent.MOUSE_UP, onMouseUp); addEventListener(MouseEvent.ROLL_OUT, onRollOut); addEventListener(MouseEvent.ROLL_OVER, onRollOver); if (_local2){ addEventListener(Event.ADDED_TO_STAGE, createStatsMenu); }; } 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 = this; _local2.drawpri = drawpri; _local2.material = material; _local2.element = element; _local2.object = object; _local2.uv = uv; return (_local2); } private function createStatsMenu(_arg1:Event):void{ statsPanel = new Stats(this, stage.frameRate); statsOpen = false; stage.addEventListener(Event.RESIZE, onStageResized); } public function addOnMouseOut(_arg1:Function):void{ addEventListener(MouseEvent3D.MOUSE_OUT, _arg1, false, 0, false); } function dispatchMouseEvent(_arg1:MouseEvent3D):void{ if (!hasEventListener(_arg1.type)){ return; }; dispatchEvent(_arg1); } public function fireMouseEvent(_arg1:String, _arg2:Number, _arg3:Number, _arg4:Boolean=false, _arg5:Boolean=false):void{ var _local9:int; findHit(_internalsession, _arg2, _arg3); var _local6:MouseEvent3D = getMouseEvent(_arg1); var _local7:Array = []; var _local8:Array = []; _local6.ctrlKey = _arg4; _local6.shiftKey = _arg5; if (((!((_arg1 == MouseEvent3D.MOUSE_OUT))) && (!((_arg1 == MouseEvent3D.MOUSE_OVER))))){ dispatchMouseEvent(_local6); bubbleMouseEvent(_local6); }; if (((!((mouseObject == object))) || (!((mouseMaterial == material))))){ if (mouseObject != null){ _local6 = getMouseEvent(MouseEvent3D.MOUSE_OUT); _local6.object = mouseObject; _local6.material = mouseMaterial; _local6.ctrlKey = _arg4; _local6.shiftKey = _arg5; dispatchMouseEvent(_local6); _local7 = bubbleMouseEvent(_local6); buttonMode = false; }; if (object != null){ _local6 = getMouseEvent(MouseEvent3D.MOUSE_OVER); _local6.ctrlKey = _arg4; _local6.shiftKey = _arg5; dispatchMouseEvent(_local6); _local8 = bubbleMouseEvent(_local6); buttonMode = object.useHandCursor; }; if (mouseObject != object){ _local9 = 0; while (((_local7[_local9]) && ((_local7[_local9] == _local8[_local9])))) { _local9++; }; if (mouseObject != null){ _local6 = getMouseEvent(MouseEvent3D.ROLL_OUT); _local6.object = mouseObject; _local6.material = mouseMaterial; _local6.ctrlKey = _arg4; _local6.shiftKey = _arg5; traverseRollEvent(_local6, _local7.slice(_local9)); }; if (object != null){ _local6 = getMouseEvent(MouseEvent3D.ROLL_OVER); _local6.ctrlKey = _arg4; _local6.shiftKey = _arg5; traverseRollEvent(_local6, _local8.slice(_local9)); }; }; mouseObject = object; mouseMaterial = material; }; } public function set scene(_arg1:Scene3D):void{ if (_scene == _arg1){ return; }; if (_scene){ _scene.internalRemoveView(this); delete _scene.viewDictionary[this]; _scene.removeOnSessionChange(onSessionChange); if (_session){ _session.internalRemoveSceneSession(_scene.ownSession); }; }; _scene = _arg1; _updated = true; if (_scene){ _scene.internalAddView(this); _scene.addOnSessionChange(onSessionChange); _scene.viewDictionary[this] = this; if (_session){ _session.internalAddSceneSession(_scene.ownSession); }; } else { throw (new Error("View cannot have scene set to null")); }; } public function removeOnMouseUp(_arg1:Function):void{ removeEventListener(MouseEvent3D.MOUSE_UP, _arg1, false); } public function getContainer():DisplayObject{ return (_session.getContainer(this)); } public function removeOnMouseOut(_arg1:Function):void{ removeEventListener(MouseEvent3D.MOUSE_OUT, _arg1, false); } public function addOnMouseOver(_arg1:Function):void{ addEventListener(MouseEvent3D.MOUSE_OVER, _arg1, false, 0, false); } public function findHit(_arg1:AbstractRenderSession, _arg2:Number, _arg3:Number):void{ screenX = _arg2; screenY = _arg3; screenZ = Infinity; material = null; object = null; if (((!(_arg1)) || (!(_mouseIsOverView)))){ return; }; _hitPointX = stage.mouseX; _hitPointY = stage.mouseY; if ((this.session is BitmapRenderSession)){ _container = this.session.getContainer(this); _hitPointX = (_hitPointX + _container.x); _hitPointY = (_hitPointY + _container.y); }; checkSession(_arg1); } public function set session(_arg1:AbstractRenderSession):void{ if (_session == _arg1){ return; }; if (_session){ _session.removeOnSessionUpdate(onSessionUpdate); if (_scene){ _session.internalRemoveSceneSession(_scene.ownSession); }; }; _session = _arg1; _updated = true; if (_session){ _session.addOnSessionUpdate(onSessionUpdate); if (_scene){ _session.internalAddSceneSession(_scene.ownSession); }; } else { throw (new Error("View cannot have session set to null")); }; while (numChildren) { removeChildAt(0); }; addChild(background); addChild(_session.getContainer(this)); addChild(_interactiveLayer); addChild(hud); } public function get camera():Camera3D{ return (_camera); } private function onCameraUpdated(_arg1:CameraEvent):void{ _updated = true; } private function onMouseUp(_arg1:MouseEvent):void{ _mousedown = false; fireMouseEvent(MouseEvent3D.MOUSE_UP, mouseX, mouseY, _arg1.ctrlKey, _arg1.shiftKey); } private function onSessionChange(_arg1:Object3DEvent):void{ _session.sessions = [_arg1.object.session]; } public function set camera(_arg1:Camera3D):void{ if (_camera == _arg1){ return; }; if (_camera){ _camera.removeOnSceneTransformChange(onCameraTransformChange); _camera.removeOnCameraUpdate(onCameraUpdated); }; _camera = _arg1; _camera.view = this; _updated = true; if (_camera){ _camera.addOnSceneTransformChange(onCameraTransformChange); _camera.addOnCameraUpdate(onCameraUpdated); } else { throw (new Error("View cannot have camera set to null")); }; } private function onSessionUpdate(_arg1:SessionEvent):void{ if ((_arg1.target is BitmapRenderSession)){ _scene.updatedSessions[_arg1.target] = _arg1.target; }; } public function getBitmapData():BitmapData{ if ((_session is BitmapRenderSession)){ return ((_session as BitmapRenderSession).getBitmapData(this)); }; throw (new Error("incorrect session object - require BitmapRenderSession")); } private function notifySceneUpdate():void{ if (!_updatescene){ _updatescene = new ViewEvent(ViewEvent.UPDATE_SCENE, this); }; dispatchEvent(_updatescene); } private function checkSession(_arg1:AbstractRenderSession):void{ if ((_arg1 is BitmapRenderSession)){ _container = _arg1.getContainer(this); _hitPointX = (_hitPointX + _container.x); _hitPointY = (_hitPointY + _container.y); }; if (_arg1.getContainer(this).hitTestPoint(_hitPointX, _hitPointY)){ for each (primitive in _arg1.getConsumer(this).list()) { checkPrimitive(primitive); }; for each (_arg1 in _arg1.sessions) { checkSession(_arg1); }; }; if ((_arg1 is BitmapRenderSession)){ _container = _arg1.getContainer(this); _hitPointX = (_hitPointX - _container.x); _hitPointY = (_hitPointY - _container.y); }; } public function get cameraVarsStore():CameraVarsStore{ return (_cameraVarsStore); } public function addOnMouseDown(_arg1:Function):void{ addEventListener(MouseEvent3D.MOUSE_DOWN, _arg1, false, 0, false); } public function set clipping(_arg1:Clipping):void{ if (_clipping == _arg1){ return; }; if (_clipping){ _clipping.removeOnClippingUpdate(onClippingUpdated); }; _clipping = _arg1; _clipping.view = this; if (_clipping){ _clipping.addOnClippingUpdate(onClippingUpdated); } else { throw (new Error("View cannot have clip set to null")); }; _updated = true; _screenClippingDirty = true; } public function set renderer(_arg1:IRenderer):void{ if (_renderer == _arg1){ return; }; _renderer = _arg1; _updated = true; if (!_renderer){ throw (new Error("View cannot have renderer set to null")); }; } public function get screenClipping():Clipping{ if (_screenClippingDirty){ _screenClippingDirty = false; return ((_screenClipping = _clipping.screen(this, _loaderWidth, _loaderHeight))); }; return (_screenClipping); } public function get scene():Scene3D{ return (_scene); } public function clear():void{ _updated = true; if (_internalsession){ session.clear(this); }; } public function get session():AbstractRenderSession{ return (_session); } public function updateScreenClipping():void{ try { _loaderWidth = loaderInfo.width; _loaderHeight = loaderInfo.height; if (_loaderDirty){ _loaderDirty = false; _screenClippingDirty = true; }; } catch(error:Error) { _loaderDirty = true; _loaderWidth = stage.stageWidth; _loaderHeight = stage.stageHeight; }; _viewZero.x = 0; _viewZero.y = 0; _viewZero = localToGlobal(_viewZero); if (((((!((_x == _viewZero.x))) || (!((_y == _viewZero.y))))) || (((!((stage.scaleMode == StageScaleMode.NO_SCALE))) && (((!((_stageWidth == stage.stageWidth))) || (!((_stageHeight == stage.stageHeight))))))))){ _x = _viewZero.x; _y = _viewZero.y; _stageWidth = stage.stageWidth; _stageHeight = stage.stageHeight; _screenClippingDirty = true; }; } public function render():void{ viewTimer = getTimer(); notifySceneUpdate(); if (_internalsession != _session){ _internalsession = _session; }; if (_session.renderer != (_renderer as IPrimitiveConsumer)){ _session.renderer = (_renderer as IPrimitiveConsumer); }; _session.clear(this); _drawPrimitiveStore.reset(); if (_session.updated){ if ((_scene.ownSession is SpriteRenderSession)){ (_scene.ownSession as SpriteRenderSession).cacheAsBitmap = true; }; _ddo.view = this; _ddo.displayobject = _scene.session.getContainer(this); _ddo.session = _session; _ddo.screenvertex = _sc; _ddo.calc(); _consumer = _session.getConsumer(this); _consumer.primitive(_ddo); }; for each (_blocker in blockers) { _convexBlockProjector.blockers(_blocker, cameraVarsStore.viewTransformDictionary[_blocker], blockerarray); }; _scene.traverse(_pritraverser); _session.render(this); _updated = false; if (statsOpen){ statsPanel.updateStats(_session.getTotalFaces(this), camera); }; Init.checkUnusedArguments(); fireMouseMoveEvent(); notifyRenderComplete(); } public function get drawPrimitiveStore():DrawPrimitiveStore{ return (_drawPrimitiveStore); } public function fireMouseMoveEvent(_arg1:Boolean=false):void{ if (!_mouseIsOverView){ return; }; 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 notifyRenderComplete():void{ if (!_renderComplete){ _renderComplete = new ViewEvent(ViewEvent.RENDER_COMPLETE, this); }; dispatchEvent(_renderComplete); } private function bubbleMouseEvent(_arg1:MouseEvent3D):Array{ var _local2:Object3D = _arg1.object; var _local3:Array = []; while (_local2 != null) { _local3.unshift(_local2); _local2.dispatchMouseEvent(_arg1); _local2 = _local2.parent; }; return (_local3); } public function removeOnMouseDown(_arg1:Function):void{ removeEventListener(MouseEvent3D.MOUSE_DOWN, _arg1, false); } private function onRollOut(_arg1:MouseEvent):void{ _mouseIsOverView = false; fireMouseEvent(MouseEvent3D.MOUSE_OUT, mouseX, mouseY, _arg1.ctrlKey, _arg1.shiftKey); } public function addSourceURL(_arg1:String):void{ sourceURL = _arg1; if (statsPanel){ statsPanel.addSourceURL(_arg1); }; } private function onCameraTransformChange(_arg1:Object3DEvent):void{ _updated = true; } private function onClippingUpdated(_arg1:ClippingEvent):void{ _updated = true; } private function checkPrimitive(_arg1:DrawPrimitive):void{ var _local2:Number; var _local3:DrawTriangle; var _local4:UV; var _local5:IUVMaterial; if ((_arg1 is DrawFog)){ return; }; if (((!(_arg1.source)) || (!(_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 is DrawDisplayObject)) && (!((_arg1 as DrawDisplayObject).displayobject.hitTestPoint(_hitPointX, _hitPointY, true))))){ 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 = (camera.zoom / (1 + (screenZ / camera.focus))); inv = camera.invViewMatrix; 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 get updated():Boolean{ return (_updated); } private function onMouseDown(_arg1:MouseEvent):void{ _mousedown = true; fireMouseEvent(MouseEvent3D.MOUSE_DOWN, mouseX, mouseY, _arg1.ctrlKey, _arg1.shiftKey); } private function traverseRollEvent(_arg1:MouseEvent3D, _arg2:Array):void{ var _local3:Object3D; for each (_local3 in _arg2) { _local3.dispatchMouseEvent(_arg1); }; } public function addOnMouseUp(_arg1:Function):void{ addEventListener(MouseEvent3D.MOUSE_UP, _arg1, false, 0, false); } public function addOnMouseMove(_arg1:Function):void{ addEventListener(MouseEvent3D.MOUSE_MOVE, _arg1, false, 0, false); } private function onStageResized(_arg1:Event):void{ _screenClippingDirty = true; } public function get renderer():IRenderer{ return (_renderer); } public function removeOnMouseMove(_arg1:Function):void{ removeEventListener(MouseEvent3D.MOUSE_MOVE, _arg1, false); } public function removeOnMouseOver(_arg1:Function):void{ removeEventListener(MouseEvent3D.MOUSE_OVER, _arg1, false); } public function get clipping():Clipping{ return (_clipping); } private function onRollOver(_arg1:MouseEvent):void{ _mouseIsOverView = true; fireMouseEvent(MouseEvent3D.MOUSE_OVER, mouseX, mouseY, _arg1.ctrlKey, _arg1.shiftKey); } } }//package away3d.containers
Section 18
//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 _transition:AnimationTransition; private var _isRunning:Boolean;// = false public var geometry:Geometry; public var mesh:Mesh; public function Animation(_arg1:Geometry){ sequence = []; super(); geometry = _arg1; _cycle = new AnimationEvent(AnimationEvent.CYCLE, this); _sequenceupdate = new AnimationEvent(AnimationEvent.SEQUENCE_UPDATE, this); } public function get latest():uint{ return (_latest); } public function update():void{ var _local3:Number; var _local4:Number; if (((!(_isRunning)) && (!(sequenceEvent)))){ return; }; var _local1:uint = getTimer(); frame = (frame + (((_local1 - _time) * fps) / 1000)); _time = _local1; if (sequence.length == 1){ if (cycleEvent){ dispatchEvent(_cycle); }; if (sequenceEvent){ dispatchEvent(_sequenceupdate); }; if (!loop){ _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); }; if (!loop){ _isRunning = false; }; }; }; }; var _local2:Number = frame; if (!smooth){ _local2 = Math.round(_local2); }; if (_local2 < 0){ _local2 = 0; }; if (_local2 > (sequence.length - 1)){ _local2 = (sequence.length - 1); }; if (_local2 == Math.round(_local2)){ geometry.frames[sequence[int(_local2)].frame].adjust(1); } else { _local3 = Math.floor(_local2); _local4 = Math.ceil(_local2); geometry.frames[sequence[int(_local3)].frame].adjust(1); geometry.frames[sequence[int(_local4)].frame].adjust((_local2 - _local3)); if (((loop) || (sequenceEvent))){ if ((((((_latest == 0)) || (((_latest + 1) == sequence[int(_local3)].frame)))) || ((_latest == sequence[int(_local3)].frame)))){ _latest = sequence[int(_local3)].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); }; }; }; }; if (_transition.interpolate < 1){ _transition.update(); }; } public function interpolate():void{ var _local1 = (_transition == null); if (_local1){ createTransition(); } else { _transition.reset(); }; } public function stop():void{ _isRunning = false; _latest = 0; } public function start():void{ _time = getTimer(); _isRunning = true; _latest = 0; frame = 0; } public function get transitionValue():Number{ return (((_transition)==null) ? 10 : _transition.transitionValue); } public function createTransition():void{ if (_transition == null){ _transition = new AnimationTransition(geometry); }; } public function get isRunning():Boolean{ return (_isRunning); } public function set transitionValue(_arg1:Number):void{ createTransition(); _transition.transitionValue = _arg1; } } }//package away3d.core.base
Section 19
//AnimationTransition (away3d.core.base.AnimationTransition) package away3d.core.base { public class AnimationTransition { private var _interpolate:Number; private var _steps:Number;// = 0.1 private var _refFrame:Array; private var _geom:Geometry; private var _transitionvalue:Number;// = 10 public function AnimationTransition(_arg1:Geometry){ _interpolate = 1; _geom = _arg1; setRef(); } public function get interpolate():Number{ return (_interpolate); } public function update():void{ var _local1:Number; var _local2:int; if (_interpolate < 1){ _local1 = (1 - _interpolate); _local2 = 0; while (_local2 < _refFrame.length) { _geom.vertices[_local2].x = ((_refFrame[_local2].x * _local1) + (_geom.vertices[_local2].x * _interpolate)); _geom.vertices[_local2].y = ((_refFrame[_local2].y * _local1) + (_geom.vertices[_local2].y * _interpolate)); _geom.vertices[_local2].z = ((_refFrame[_local2].z * _local1) + (_geom.vertices[_local2].z * _interpolate)); _local2++; }; _interpolate = (_interpolate + _steps); }; } private function updateRef():void{ var _local1:int; while (_local1 < _refFrame.length) { _refFrame[_local1].x = _geom.vertices[_local1].x; _refFrame[_local1].y = _geom.vertices[_local1].y; _refFrame[_local1].z = _geom.vertices[_local1].z; _local1++; }; } public function reset():void{ updateRef(); _interpolate = _steps; } private function setRef():void{ _refFrame = []; var _local1:int; while (_local1 < _geom.vertices.length) { _refFrame.push(new Vertex(_geom.vertices[_local1].x, _geom.vertices[_local1].y, _geom.vertices[_local1].z)); _local1++; }; } public function set transitionValue(_arg1:Number):void{ _transitionvalue = ((_arg1)<1) ? 1 : _arg1; _steps = (1 / _arg1); } public function get transitionValue():Number{ return (_transitionvalue); } } }//package away3d.core.base
Section 20
//Billboard (away3d.core.base.Billboard) package away3d.core.base { import flash.events.*; import away3d.events.*; import away3d.core.utils.*; import away3d.materials.*; public class Billboard extends Element { var _vertex:Vertex; var _material:IBillboardMaterial; private var _width:Number; private var _scaling:Number;// = 1 private var _height:Number; private var _rotation:Number;// = 0 private var _materialchanged:BillboardEvent; public function Billboard(_arg1:Vertex, _arg2:IBillboardMaterial=null, _arg3:Number=10, _arg4:Number=10){ this.vertex = _arg1; this.material = _arg2; this.width = _arg3; this.height = _arg4; vertexDirty = true; } override public function get vertices():Array{ return ([_vertex]); } public function set vertex(_arg1:Vertex):void{ if (_arg1 == _vertex){ return; }; if (_vertex != null){ _vertex.removeOnChange(onVertexValueChange); }; _vertex = _arg1; if (_vertex != null){ _vertex.addOnChange(onVertexValueChange); }; notifyVertexChange(); } public function set scaling(_arg1:Number):void{ if (_scaling == _arg1){ return; }; _scaling = _arg1; notifyMaterialChange(); } public function get scaling():Number{ return (_scaling); } override public function get minZ():Number{ return (_vertex._z); } public function removeOnMaterialChange(_arg1:Function):void{ removeEventListener(SegmentEvent.MATERIAL_CHANGED, _arg1, false); } public function set width(_arg1:Number):void{ if (_width == _arg1){ return; }; _width = _arg1; notifyMaterialChange(); } private function onVertexValueChange(_arg1:Event):void{ notifyVertexValueChange(); } override public function get minY():Number{ return (_vertex._y); } function notifyMaterialChange():void{ if (!hasEventListener(BillboardEvent.MATERIAL_CHANGED)){ return; }; if (_materialchanged == null){ _materialchanged = new BillboardEvent(BillboardEvent.MATERIAL_CHANGED, this); }; dispatchEvent(_materialchanged); } override public function get maxX():Number{ return (_vertex._x); } public function get vertex():Vertex{ return (_vertex); } public function set material(_arg1:IBillboardMaterial):void{ if (_material == _arg1){ return; }; _material = _arg1; notifyMaterialChange(); } public function get material():IBillboardMaterial{ return (_material); } public function get width():Number{ return (_width); } override public function get radius2():Number{ return (0); } public function set x(_arg1:Number):void{ if (isNaN(_arg1)){ throw (new Error("isNaN(x)")); }; if (_vertex.x == _arg1){ return; }; if (_arg1 == Infinity){ Debug.warning("x == Infinity"); }; if (_arg1 == -(Infinity)){ Debug.warning("x == -Infinity"); }; _vertex.x = _arg1; } public function set y(_arg1:Number):void{ if (isNaN(_arg1)){ throw (new Error("isNaN(y)")); }; if (_vertex.y == _arg1){ return; }; if (_arg1 == Infinity){ Debug.warning("y == Infinity"); }; if (_arg1 == -(Infinity)){ Debug.warning("y == -Infinity"); }; _vertex.y = _arg1; } override public function get minX():Number{ return (_vertex._x); } public function set z(_arg1:Number):void{ if (isNaN(_arg1)){ throw (new Error("isNaN(z)")); }; if (_vertex.z == _arg1){ return; }; if (_arg1 == Infinity){ Debug.warning("z == Infinity"); }; if (_arg1 == -(Infinity)){ Debug.warning("z == -Infinity"); }; _vertex.z = _arg1; } override public function get maxY():Number{ return (_vertex._y); } public function get height():Number{ return (_width); } public function addOnMaterialChange(_arg1:Function):void{ addEventListener(SegmentEvent.MATERIAL_CHANGED, _arg1, false, 0, true); } public function get x():Number{ return (_vertex.x); } public function get y():Number{ return (_vertex.y); } public function get z():Number{ return (_vertex.z); } public function set height(_arg1:Number):void{ if (_height == _arg1){ return; }; _height = _arg1; notifyMaterialChange(); } public function set rotation(_arg1:Number):void{ if (_rotation == _arg1){ return; }; _rotation = _arg1; notifyMaterialChange(); } override public function get maxZ():Number{ return (_vertex._z); } public function get rotation():Number{ return (_rotation); } } }//package away3d.core.base
Section 21
//Element (away3d.core.base.Element) package away3d.core.base { import flash.events.*; import away3d.events.*; public class Element extends EventDispatcher { public var vertexDirty:Boolean; public var extra:Object; private var _vertexchanged:ElementEvent; private var _visiblechanged:ElementEvent; private var _vertexvaluechanged:ElementEvent; public var parent:Geometry; var _visible:Boolean;// = true function notifyVisibleChange():void{ if (!hasEventListener(ElementEvent.VISIBLE_CHANGED)){ return; }; if (_visiblechanged == null){ _visiblechanged = new ElementEvent(ElementEvent.VISIBLE_CHANGED, this); }; dispatchEvent(_visiblechanged); } public function addOnVertexChange(_arg1:Function):void{ addEventListener(ElementEvent.VERTEX_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 minZ():Number{ return (-(Math.sqrt(radius2))); } public function addOnVisibleChange(_arg1:Function):void{ addEventListener(ElementEvent.VISIBLE_CHANGED, _arg1, false, 0, true); } public function removeOnVertexChange(_arg1:Function):void{ removeEventListener(ElementEvent.VERTEX_CHANGED, _arg1, false); } function notifyVertexChange():void{ if (!hasEventListener(ElementEvent.VERTEX_CHANGED)){ return; }; if (_vertexchanged == null){ _vertexchanged = new ElementEvent(ElementEvent.VERTEX_CHANGED, this); }; dispatchEvent(_vertexchanged); } public function set visible(_arg1:Boolean):void{ if (_arg1 == _visible){ return; }; _visible = _arg1; notifyVisibleChange(); } 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 get visible():Boolean{ return (_visible); } public function get maxX():Number{ return (Math.sqrt(radius2)); } public function get maxY():Number{ return (Math.sqrt(radius2)); } public function get maxZ():Number{ return (Math.sqrt(radius2)); } public function get vertices():Array{ throw (new Error("Not implemented")); } public function removeOnVertexValueChange(_arg1:Function):void{ removeEventListener(ElementEvent.VERTEXVALUE_CHANGED, _arg1, false); } function notifyVertexValueChange():void{ if (!hasEventListener(ElementEvent.VERTEXVALUE_CHANGED)){ return; }; if (_vertexvaluechanged == null){ _vertexvaluechanged = new ElementEvent(ElementEvent.VERTEXVALUE_CHANGED, this); }; dispatchEvent(_vertexvaluechanged); } public function addOnVertexValueChange(_arg1:Function):void{ addEventListener(ElementEvent.VERTEXVALUE_CHANGED, _arg1, false, 0, true); } public function removeOnVisibleChange(_arg1:Function):void{ removeEventListener(ElementEvent.VISIBLE_CHANGED, _arg1, false); } } }//package away3d.core.base
Section 22
//Face (away3d.core.base.Face) package away3d.core.base { import flash.events.*; import away3d.events.*; import away3d.core.utils.*; import away3d.core.math.*; import away3d.materials.*; public class Face extends Element { var _uv2:UV; private var _s:Number; var _material:ITriangleMaterial; private var _normal:Number3D; var _v0:Vertex; var _v1:Vertex; var _v2:Vertex; private var _mappingchanged:FaceEvent; var _back:ITriangleMaterial; private var _index:int; public var faceVO:FaceVO; private var _a:Number; private var _b:Number; private var _c:Number; private var _materialchanged:FaceEvent; var _uv0:UV; var _uv1:UV; public function Face(_arg1:Vertex, _arg2:Vertex, _arg3:Vertex, _arg4:ITriangleMaterial=null, _arg5:UV=null, _arg6:UV=null, _arg7:UV=null){ _normal = new Number3D(); faceVO = new FaceVO(); super(); this.v0 = _arg1; this.v1 = _arg2; this.v2 = _arg3; this.material = _arg4; this.uv0 = _arg5; this.uv1 = _arg6; this.uv2 = _arg7; faceVO.face = this; vertexDirty = true; } public function set uv1(_arg1:UV):void{ if (_arg1 == _uv1){ return; }; if (_uv1 != null){ if (((!((_uv1 == _uv0))) && (!((_uv1 == _uv2))))){ _uv1.removeOnChange(onUVChange); }; }; _uv1 = (faceVO.uv1 = _arg1); if (_uv1 != null){ if (((!((_uv1 == _uv0))) && (!((_uv1 == _uv2))))){ _uv1.addOnChange(onUVChange); }; }; notifyMappingChange(); } public function set uv2(_arg1:UV):void{ if (_arg1 == _uv2){ return; }; if (_uv2 != null){ if (((!((_uv2 == _uv1))) && (!((_uv2 == _uv0))))){ _uv2.removeOnChange(onUVChange); }; }; _uv2 = (faceVO.uv2 = _arg1); if (_uv2 != null){ if (((!((_uv2 == _uv1))) && (!((_uv2 == _uv0))))){ _uv2.addOnChange(onUVChange); }; }; 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)))); } 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 addOnMappingChange(_arg1:Function):void{ addEventListener(FaceEvent.MAPPING_CHANGED, _arg1, false, 0, true); } public function get material():ITriangleMaterial{ return (_material); } public function get uv0():UV{ return (_uv0); } public function get uv1():UV{ return (_uv1); } public function get uv2():UV{ return (_uv2); } 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); } 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 set back(_arg1:ITriangleMaterial):void{ if (_arg1 == _back){ return; }; if (_back != null){ parent.removeMaterial(this, _back); }; _back = (faceVO.back = _arg1); if (_back != null){ parent.addMaterial(this, _back); }; notifyMappingChange(); } override public function get minZ():Number{ if (_v0._z < _v1._z){ if (_v0._z < _v2._z){ return (_v0._z); }; return (_v2._z); //unresolved jump }; if (_v1._z < _v2._z){ return (_v1._z); }; return (_v2._z); } public function set material(_arg1:ITriangleMaterial):void{ if (_arg1 == _material){ return; }; if (((!((_material == null))) && (parent))){ parent.removeMaterial(this, _material); }; _material = (faceVO.material = _arg1); if (((!((_material == null))) && (parent))){ parent.addMaterial(this, _material); }; notifyMappingChange(); } public function removeOnMappingChange(_arg1:Function):void{ removeEventListener(FaceEvent.MAPPING_CHANGED, _arg1, false); } function notifyMappingChange():void{ if (!hasEventListener(FaceEvent.MAPPING_CHANGED)){ return; }; if (_mappingchanged == null){ _mappingchanged = new FaceEvent(FaceEvent.MAPPING_CHANGED, this); }; dispatchEvent(_mappingchanged); } public function set normalDirty(_arg1:Boolean):void{ vertexDirty = true; } public function set uv0(_arg1:UV):void{ if (_arg1 == _uv0){ return; }; if (_uv0 != null){ if (((!((_uv0 == _uv1))) && (!((_uv0 == _uv2))))){ _uv0.removeOnChange(onUVChange); }; }; _uv0 = (faceVO.uv0 = _arg1); if (_uv0 != null){ if (((!((_uv0 == _uv1))) && (!((_uv0 == _uv2))))){ _uv0.addOnChange(onUVChange); }; }; notifyMappingChange(); } 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(); } public function get back():ITriangleMaterial{ return (_back); } private function updateVertexProperties():void{ var _local9:Number; var _local10:Number; vertexDirty = false; var _local1:Number = (_v1.x - _v0.x); var _local2:Number = (_v1.y - _v0.y); var _local3:Number = (_v1.z - _v0.z); var _local4:Number = (_v2.x - _v0.x); var _local5:Number = (_v2.y - _v0.y); var _local6:Number = (_v2.z - _v0.z); var _local7:Number = ((_local2 * _local6) - (_local3 * _local5)); var _local8:Number = ((_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); } 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 (_v0 == _arg1){ return; }; if (_v0){ _index = _v0.parents.indexOf(this); if (_index != -1){ _v0.parents.splice(_index, 1); }; }; _v0 = (faceVO.v0 = _arg1); if (_v0){ _v0.parents.push(this); }; vertexDirty = true; } 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 (_v1 == _arg1){ return; }; if (_v1){ _index = _v1.parents.indexOf(this); if (_index != -1){ _v1.parents.splice(_index, 1); }; }; _v1 = (faceVO.v1 = _arg1); if (_v1){ _v1.parents.push(this); }; vertexDirty = true; } public function set v2(_arg1:Vertex):void{ if (_v2 == _arg1){ return; }; if (_v2){ _index = _v2.parents.indexOf(this); if (_index != -1){ _v2.parents.splice(_index, 1); }; }; _v2 = (faceVO.v2 = _arg1); if (_v2){ _v2.parents.push(this); }; vertexDirty = true; } override public function get vertices():Array{ return ([_v0, _v1, _v2]); } public function get v0():Vertex{ return (_v0); } public function get v1():Vertex{ return (_v1); } public function get v2():Vertex{ return (_v2); } override public function get maxZ():Number{ if (_v0._z > _v1._z){ if (_v0._z > _v2._z){ return (_v0._z); }; return (_v2._z); //unresolved jump }; if (_v1._z > _v2._z){ return (_v1._z); }; return (_v2._z); } public function get normal():Number3D{ if (vertexDirty){ updateVertexProperties(); }; return (_normal); } } }//package away3d.core.base
Section 23
//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 getIndexes(_arg1:Array):Array{ var _local2:Array = []; for each (_vertexposition in vertexpositions) { _local2.push(_vertexposition.getIndex(_arg1)); }; return (_local2); } public function adjust(_arg1:Number=1):void{ for each (_vertexposition in vertexpositions) { _vertexposition.adjust(_arg1); }; } } }//package away3d.core.base
Section 24
//Geometry (away3d.core.base.Geometry) package away3d.core.base { import flash.events.*; import away3d.containers.*; import away3d.events.*; import flash.utils.*; import away3d.core.render.*; import away3d.core.draw.*; import away3d.core.utils.*; import away3d.core.math.*; import away3d.primitives.*; import away3d.materials.*; import away3d.animators.data.*; import away3d.animators.skin.*; import away3d.loaders.data.*; public class Geometry extends EventDispatcher { public var framenames:Dictionary; private var _animation:Animation; private var _skinController:SkinController; public var materialDictionary:Dictionary; private var _neighbour01:Dictionary; private var _skinVertex:SkinVertex; private var _fAngle:Number; private var _n01:Face; private var clonedskincontrollers:Dictionary; private var _dispatchedDimensionsChange:Boolean; private var _neighboursDirty:Boolean;// = true private var _neighbour12:Dictionary; private var _n12:Face; private var _materialData:MaterialData; private var _verticesDirty:Boolean;// = true private var _neighbour20:Dictionary; private var _vertices:Array; private var _vertnormals:Dictionary; private var _n20:Face; private var _frame:int; public var skinVertices:Array; private var _animationgroup:AnimationGroup; private var clonedskinvertices:Dictionary; public var skinControllers:Array; private var _sequencedone:AnimationEvent; private var _vertfaces:Dictionary; private var clonedvertices:Dictionary; private var _fVectors:Array; private var _fNormal:Number3D; private var _billboards:Array; public var frames:Dictionary; private var _faces:Array; private var _vertex:Vertex; public var rootBone:Bone; private var _vertfacesDirty:Boolean;// = true private var _dimensionschanged:GeometryEvent; private var _index:int; public var cloneElementDictionary:Dictionary; private var _vertnormalsDirty:Boolean;// = true protected var ini:Init; private var _cycle:AnimationEvent; private var cloneduvs:Dictionary; private var _activeprefix:String; private var _segments:Array; public function Geometry(){ _faces = []; _segments = []; _billboards = []; materialDictionary = new Dictionary(true); cloneElementDictionary = new Dictionary(); super(); } public function removeFace(_arg1:Face):void{ var _local2:int = _faces.indexOf(_arg1); if (_local2 == -1){ return; }; removeElement(_arg1); if (_arg1.material){ removeMaterial(_arg1, _arg1.material); }; _vertfacesDirty = true; _arg1.v0.geometry = null; _arg1.v1.geometry = null; _arg1.v2.geometry = null; _arg1.notifyMappingChange(); _arg1.removeOnMappingChange(onFaceMappingChange); _faces.splice(_local2, 1); } public function get elements():Array{ return (_billboards.concat(_faces, _segments)); } public function applyRotations(_arg1:Number, _arg2:Number, _arg3:Number):void{ var _local4:Number; var _local5:Number; var _local6:Number; var _local7:Number; var _local8:Number; var _local19:Vertex; var _local9:Number = (Math.PI / 180); var _local10:Number = (_arg1 * _local9); var _local11:Number = (_arg2 * _local9); var _local12:Number = (_arg3 * _local9); var _local13:Number = Math.sin(_local10); var _local14:Number = Math.cos(_local10); var _local15:Number = Math.sin(_local11); var _local16:Number = Math.cos(_local11); var _local17:Number = Math.sin(_local12); var _local18:Number = Math.cos(_local12); for each (_local19 in vertices) { _local4 = _local19.x; _local5 = _local19.y; _local6 = _local19.z; _local8 = _local5; _local5 = ((_local8 * _local14) + (_local6 * -(_local13))); _local6 = ((_local8 * _local13) + (_local6 * _local14)); _local7 = _local4; _local4 = ((_local7 * _local16) + (_local6 * _local15)); _local6 = ((_local7 * -(_local15)) + (_local6 * _local16)); _local7 = _local4; _local4 = ((_local7 * _local18) + (_local5 * -(_local17))); _local5 = ((_local7 * _local17) + (_local5 * _local18)); updateVertex(_local19, _local4, _local5, _local6, false); }; } public function removeSegment(_arg1:Segment):void{ var _local2:int = _segments.indexOf(_arg1); if (_local2 == -1){ return; }; removeElement(_arg1); if (_arg1.material){ removeMaterial(_arg1, _arg1.material); }; _arg1.v0.geometry = null; _arg1.v1.geometry = null; _segments.splice(_local2, 1); } private function cloneFrame(_arg1:Frame):Frame{ var _local3:VertexPosition; var _local2:Frame = new Frame(); for each (_local3 in _arg1.vertexpositions) { _local2.vertexpositions.push(cloneVertexPosition(_local3)); }; return (_local2); } public function get billboards():Array{ return (_billboards); } public function removeOnSequenceDone(_arg1:Function):void{ removeEventListener(AnimationEvent.SEQUENCE_DONE, _arg1, false); } public function neighbour20(_arg1:Face):Face{ if (_neighboursDirty){ findNeighbours(); }; return (_neighbour20[_arg1]); } public function get transitionValue():Number{ return (_animation.transitionValue); } function getVertexNormal(_arg1:Vertex):Number3D{ if (_vertfacesDirty){ findVertFaces(); }; if (_vertnormalsDirty){ findVertNormals(); }; return (_vertnormals[_arg1]); } private function addElement(_arg1:Element):void{ _verticesDirty = true; _arg1.addOnVertexChange(onElementVertexChange); _arg1.addOnVertexValueChange(onElementVertexValueChange); _arg1.parent = this; notifyDimensionsChange(); } public function removeOnCycle(_arg1:Function):void{ _animation.cycleEvent = false; _animation.removeEventListener(AnimationEvent.CYCLE, _arg1, false); } public function quarterFace(_arg1:Face, _arg2:Dictionary=null):void{ if (_arg2 == null){ _arg2 = new Dictionary(); }; var _local3:Vertex = _arg1.v0; var _local4:Vertex = _arg1.v1; var _local5:Vertex = _arg1.v2; if (_arg2[_local3] == null){ _arg2[_local3] = new Dictionary(); }; if (_arg2[_local4] == null){ _arg2[_local4] = new Dictionary(); }; if (_arg2[_local5] == null){ _arg2[_local5] = new Dictionary(); }; var _local6:Vertex = _arg2[_local3][_local4]; if (_local6 == null){ _local6 = Vertex.median(_local3, _local4); _arg2[_local3][_local4] = _local6; _arg2[_local4][_local3] = _local6; }; var _local7:Vertex = _arg2[_local4][_local5]; if (_local7 == null){ _local7 = Vertex.median(_local4, _local5); _arg2[_local4][_local5] = _local7; _arg2[_local5][_local4] = _local7; }; var _local8:Vertex = _arg2[_local5][_local3]; if (_local8 == null){ _local8 = Vertex.median(_local5, _local3); _arg2[_local5][_local3] = _local8; _arg2[_local3][_local5] = _local8; }; var _local9:UV = _arg1.uv0; var _local10:UV = _arg1.uv1; var _local11:UV = _arg1.uv2; var _local12:UV = UV.median(_local9, _local10); var _local13:UV = UV.median(_local10, _local11); var _local14:UV = UV.median(_local11, _local9); var _local15:ITriangleMaterial = _arg1.material; removeFace(_arg1); 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)); } public function removeBillboard(_arg1:Billboard):void{ var _local2:int = _billboards.indexOf(_arg1); if (_local2 == -1){ return; }; removeElement(_arg1); if (_arg1.material){ removeMaterial(_arg1, _arg1.material); }; _arg1.vertex.geometry = null; _billboards.splice(_local2, 1); } private function onElementVertexChange(_arg1:ElementEvent):void{ _verticesDirty = true; if ((_arg1.element is Face)){ (_arg1.element as Face).normalDirty = true; _vertfacesDirty = true; }; notifyDimensionsChange(); } public function set transitionValue(_arg1:Number):void{ _animation.transitionValue = _arg1; } public function get isRunning():Boolean{ return (((_animation)!=null) ? _animation.isRunning : false); } public function removeOnMaterialUpdate(_arg1:Function):void{ removeEventListener(MaterialEvent.MATERIAL_UPDATED, _arg1, false); } function notifyDimensionsChange():void{ if (((_dispatchedDimensionsChange) || (!(hasEventListener(GeometryEvent.DIMENSIONS_CHANGED))))){ return; }; if (!_dimensionschanged){ _dimensionschanged = new GeometryEvent(GeometryEvent.DIMENSIONS_CHANGED, this); }; dispatchEvent(_dimensionschanged); _dispatchedDimensionsChange = true; } public function set loop(_arg1:Boolean):void{ _animation.loop = _arg1; } private function findVertFaces():void{ var _local1:Face; var _local2:Vertex; var _local3:Vertex; var _local4:Vertex; _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; _vertnormalsDirty = true; } 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))) && (!((_arg1.prefix == ""))))){ if (_animation.smooth){ _animation.interpolate(); }; 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--------- ")); }; } else { trace("--------- \n--> unable to play animation: prefix is null \n--------- "); }; } public function addSegment(_arg1:Segment):void{ addElement(_arg1); if (_arg1.material){ addMaterial(_arg1, _arg1.material); }; _arg1.v0.geometry = this; _arg1.v1.geometry = this; _segments.push(_arg1); } public function clone():Geometry{ var _local2:Face; var _local3:Segment; var _local4:int; var _local5:Frame; var _local6:String; var _local7:SkinVertex; var _local8:SkinController; var _local9:Face; var _local10:Segment; var _local1:Geometry = new Geometry(); clonedvertices = new Dictionary(); cloneduvs = new Dictionary(); if (skinVertices){ clonedskinvertices = new Dictionary(true); clonedskincontrollers = new Dictionary(true); _local1.skinVertices = new Array(); _local1.skinControllers = new Array(); for each (_local7 in skinVertices) { _local1.skinVertices.push(cloneSkinVertex(_local7)); }; for each (_local8 in clonedskincontrollers) { _local1.skinControllers.push(_local8); }; }; for each (_local2 in _faces) { _local9 = new Face(cloneVertex(_local2._v0), cloneVertex(_local2._v1), cloneVertex(_local2._v2), _local2.material, cloneUV(_local2._uv0), cloneUV(_local2._uv1), cloneUV(_local2._uv2)); _local1.addFace(_local9); cloneElementDictionary[_local2] = _local9; }; for each (_local3 in _segments) { _local10 = new Segment(cloneVertex(_local3._v0), cloneVertex(_local3._v1), _local3.material); _local1.addSegment(_local10); cloneElementDictionary[_local3] = _local10; }; _local1.frames = new Dictionary(true); _local4 = 0; for each (_local5 in frames) { var _temp1 = _local4; _local4 = (_local4 + 1); var _local13 = _temp1; _local1.frames[_local13] = cloneFrame(_local5); }; _local1.framenames = new Dictionary(true); for (_local6 in framenames) { _local1.framenames[_local6] = framenames[_local6]; }; return (_local1); } private function cloneVertex(_arg1:Vertex):Vertex{ var _local2:Vertex = clonedvertices[_arg1]; if (_local2 == null){ _local2 = _arg1.clone(); _local2.extra = ((_arg1.extra is IClonable)) ? (_arg1.extra as IClonable).clone() : _arg1.extra; clonedvertices[_arg1] = _local2; }; return (_local2); } public function removeOnMappingChange(_arg1:Function):void{ removeEventListener(FaceEvent.MAPPING_CHANGED, _arg1, false); } public function addOnDimensionsChange(_arg1:Function):void{ addEventListener(GeometryEvent.DIMENSIONS_CHANGED, _arg1, false, 0, true); } public function get activePrefix():String{ return (_activeprefix); } public function addOnMaterialUpdate(_arg1:Function):void{ addEventListener(MaterialEvent.MATERIAL_UPDATED, _arg1, false, 0, true); } public function quarterFaces():void{ var _local2:Face; var _local1:Dictionary = new Dictionary(); for each (_local2 in _faces.concat([])) { quarterFace(_local2, _local1); }; } public function updateMaterials(_arg1:Object3D, _arg2:View3D):void{ for each (_materialData in materialDictionary) { _materialData.material.updateMaterial(_arg1, _arg2); }; } public function get frame():int{ return (_animation.frame); } public function addOnSequenceDone(_arg1:Function):void{ addEventListener(AnimationEvent.SEQUENCE_DONE, _arg1, false, 0, false); } public function invertFaces():void{ var _local1:Face; for each (_local1 in _faces) { _local1.invert(); }; } 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; _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; } private function updatePlaySequence(_arg1:AnimationEvent):void{ if (_animationgroup.playlist.length == 0){ _animation.removeEventListener(AnimationEvent.SEQUENCE_UPDATE, updatePlaySequence); _animation.sequenceEvent = false; if (hasSequenceEvent){ if (_sequencedone == null){ _sequencedone = new AnimationEvent(AnimationEvent.SEQUENCE_DONE, null); }; dispatchEvent(_sequencedone); }; if (_animationgroup.loopLast){ _animation.start(); }; } else { if (_animationgroup.playlist.length == 1){ loop = _animationgroup.loopLast; _animationgroup.playlist[0].loop = _animationgroup.loopLast; }; play(_animationgroup.playlist.shift()); }; } public function removeOnDimensionsChange(_arg1:Function):void{ removeEventListener(GeometryEvent.DIMENSIONS_CHANGED, _arg1, false); } public function addOnCycle(_arg1:Function):void{ _animation.cycleEvent = true; _cycle = new AnimationEvent(AnimationEvent.CYCLE, _animation); _animation.addEventListener(AnimationEvent.CYCLE, _arg1, false, 0, false); } public function set smooth(_arg1:Boolean):void{ _animation.smooth = _arg1; } public function get vertexDirty():Boolean{ for each (_vertex in vertices) { if (_vertex.positionDirty){ return (true); }; }; return (false); } private function onMaterialUpdate(_arg1:MaterialEvent):void{ dispatchEvent(_arg1); } public function get hasCycleEvent():Boolean{ return (_animation.hasEventListener(AnimationEvent.CYCLE)); } public function splitFace(_arg1:Face, _arg2:int=0):void{ var _local9:Vertex; var _local10:UV; var _local3:Vertex = _arg1.v0; var _local4:Vertex = _arg1.v1; var _local5:Vertex = _arg1.v2; var _local6:UV = _arg1.uv0; var _local7:UV = _arg1.uv1; var _local8:UV = _arg1.uv2; var _local11:ITriangleMaterial = _arg1.material; removeFace(_arg1); switch (_arg2){ case 0: _local9 = new Vertex(((_arg1.v0.x + _arg1.v1.x) * 0.5), ((_arg1.v0.y + _arg1.v1.y) * 0.5), ((_arg1.v0.z + _arg1.v1.z) * 0.5)); _local10 = new UV(((_local6.u + _local7.u) * 0.5), ((_local6.v + _local7.v) * 0.5)); addFace(new Face(_local9, _local4, _local5, _local11, _local10, _local7, _local8)); addFace(new Face(_local3, _local9, _local5, _local11, _local6, _local10, _local8)); break; case 1: _local9 = new Vertex(((_arg1.v1.x + _arg1.v2.x) * 0.5), ((_arg1.v1.y + _arg1.v2.y) * 0.5), ((_arg1.v1.z + _arg1.v2.z) * 0.5)); _local10 = new UV(((_local7.u + _local8.u) * 0.5), ((_local7.v + _local8.v) * 0.5)); addFace(new Face(_local3, _local4, _local9, _local11, _local6, _local7, _local8)); addFace(new Face(_local3, _local9, _local5, _local11, _local6, _local10, _local8)); break; default: _local9 = new Vertex(((_arg1.v2.x + _arg1.v0.x) * 0.5), ((_arg1.v2.y + _arg1.v0.y) * 0.5), ((_arg1.v2.z + _arg1.v0.z) * 0.5)); _local10 = new UV(((_local8.u + _local6.u) * 0.5), ((_local8.v + _local6.v) * 0.5)); addFace(new Face(_local3, _local4, _local9, _local11, _local6, _local7, _local10)); addFace(new Face(_local9, _local4, _local5, _local11, _local10, _local7, _local8)); }; } public function addFace(_arg1:Face):void{ addElement(_arg1); if (_arg1.material){ addMaterial(_arg1, _arg1.material); }; _vertfacesDirty = true; _arg1.v0.geometry = this; _arg1.v1.geometry = this; _arg1.v2.geometry = this; _arg1.addOnMappingChange(onFaceMappingChange); _faces.push(_arg1); } public function addBillboard(_arg1:Billboard):void{ addElement(_arg1); if (_arg1.material){ addMaterial(_arg1, _arg1.material); }; _arg1.vertex.geometry = this; _billboards.push(_arg1); } public function triFace(_arg1:Face):void{ var _local2:Vertex = _arg1.v0; var _local3:Vertex = _arg1.v1; var _local4:Vertex = _arg1.v2; var _local5:Vertex = new Vertex((((_arg1.v0.x + _arg1.v1.x) + _arg1.v2.x) / 3), (((_arg1.v0.y + _arg1.v1.y) + _arg1.v2.y) / 3), (((_arg1.v0.z + _arg1.v1.z) + _arg1.v2.z) / 3)); var _local6:UV = _arg1.uv0; var _local7:UV = _arg1.uv1; var _local8:UV = _arg1.uv2; var _local9:UV = new UV((((_local6.u + _local7.u) + _local8.u) / 3), (((_local6.v + _local7.v) + _local8.v) / 3)); var _local10:ITriangleMaterial = _arg1.material; removeFace(_arg1); addFace(new Face(_local2, _local3, _local5, _local10, _local6, _local7, _local9)); addFace(new Face(_local5, _local3, _local4, _local10, _local9, _local7, _local8)); addFace(new Face(_local2, _local5, _local4, _local10, _local6, _local9, _local8)); } private function cloneVertexPosition(_arg1:VertexPosition):VertexPosition{ var _local2:VertexPosition = new VertexPosition(cloneVertex(_arg1.vertex)); _local2.x = _arg1.x; _local2.y = _arg1.y; _local2.z = _arg1.z; return (_local2); } private function onFaceMappingChange(_arg1:FaceEvent):void{ dispatchEvent(_arg1); } private function cloneSkinController(_arg1:SkinController):SkinController{ var _local2:SkinController = clonedskincontrollers[_arg1]; if (_local2 == null){ _local2 = new SkinController(); _local2.name = _arg1.name; _local2.bindMatrix = _arg1.bindMatrix; clonedskincontrollers[_arg1] = _local2; }; return (_local2); } public function splitFaces(_arg1:int=0):void{ var _local2:Face; _arg1 = ((_arg1)<0) ? 0 : ((_arg1)>2) ? 2 : _arg1; for each (_local2 in _faces.concat([])) { splitFace(_local2, _arg1); }; } public function get faces():Array{ return (_faces); } private function cloneSkinVertex(_arg1:SkinVertex):SkinVertex{ var _local2:SkinVertex = clonedskinvertices[_arg1]; if (_local2 == null){ _local2 = new SkinVertex(cloneVertex(_arg1.skinnedVertex)); _local2.weights = _arg1.weights.concat(); for each (_skinController in _arg1.controllers) { _local2.controllers.push(cloneSkinController(_skinController)); }; clonedskinvertices[_arg1] = _local2; }; return (_local2); } public function addOnMappingChange(_arg1:Function):void{ addEventListener(FaceEvent.MAPPING_CHANGED, _arg1, false, 0, true); } private function onElementVertexValueChange(_arg1:ElementEvent):void{ if ((_arg1.element is Face)){ (_arg1.element as Face).normalDirty = true; }; notifyDimensionsChange(); } private function cloneUV(_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); } function removeMaterial(_arg1:Element, _arg2:IMaterial):void{ if ((_materialData = materialDictionary[_arg2])){ if ((_index = _materialData.elements.indexOf(_arg1)) != -1){ _materialData.elements.splice(_index, 1); }; if (!_materialData.elements.length){ delete materialDictionary[_arg2]; _arg2.removeOnMaterialUpdate(onMaterialUpdate); }; }; } public function get segments():Array{ return (_segments); } public function set fps(_arg1:int):void{ _animation.fps = ((_arg1)>=1) ? _arg1 : 1; } public function updateVertex(_arg1:Vertex, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Boolean=false):void{ _arg1.setValue(_arg2, _arg3, _arg4); if (_arg5){ _vertnormalsDirty = true; }; } public function gotoAndPlay(_arg1:int):void{ _frame = (_animation.frame = _arg1); frames[_frame].adjust(1); if (!_animation.isRunning){ _animation.start(); }; } private function removeElement(_arg1:Element):void{ _verticesDirty = true; _arg1.removeOnVertexChange(onElementVertexChange); _arg1.removeOnVertexValueChange(onElementVertexValueChange); notifyDimensionsChange(); } public function applyPosition(_arg1:Number, _arg2:Number, _arg3:Number):void{ var _local4:Number; var _local5:Number; var _local6:Number; var _local7:Vertex; for each (_local7 in vertices) { _local4 = _local7.x; _local5 = _local7.y; _local6 = _local7.z; _local7.setValue((_local4 - _arg1), (_local5 - _arg2), (_local6 - _arg3)); }; } public function neighbour01(_arg1:Face):Face{ if (_neighboursDirty){ findNeighbours(); }; return (_neighbour01[_arg1]); } public function get hasSequenceEvent():Boolean{ return (hasEventListener(AnimationEvent.SEQUENCE_DONE)); } public function updateElements():void{ _dispatchedDimensionsChange = false; for each (_skinController in skinControllers) { _skinController.update(); }; for each (_skinVertex in skinVertices) { _skinVertex.update(); }; if (((!((_animation == null))) && (!((frames == null))))){ _animation.update(); }; if (vertexDirty){ notifyDimensionsChange(); }; } public function set frame(_arg1:int):void{ if (_animation.frame == _arg1){ return; }; _frame = _arg1; _animation.frame = _arg1; frames[_arg1].adjust(1); } public function triFaces():void{ var _local1:Face; for each (_local1 in _faces.concat([])) { triFace(_local1); }; } function addMaterial(_arg1:Element, _arg2:IMaterial):void{ if (!(_materialData = materialDictionary[_arg2])){ _materialData = (materialDictionary[_arg2] = new MaterialData()); _materialData.material = _arg2; _arg2.addOnMaterialUpdate(onMaterialUpdate); }; if (_materialData.elements.indexOf(_arg1) == -1){ _materialData.elements.push(_arg1); }; } 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.SEQUENCE_UPDATE)){ _animation.addEventListener(AnimationEvent.SEQUENCE_UPDATE, updatePlaySequence); }; _animation.sequenceEvent = true; loop = true; play(_animationgroup.playlist.shift()); } public function gotoAndStop(_arg1:int):void{ _frame = (_animation.frame = _arg1); frames[_frame].adjust(1); if (_animation.isRunning){ _animation.stop(); }; } private function findNeighbours():void{ var _local1:Face; var _local2:Boolean; var _local3:Face; _neighbour01 = new Dictionary(); _neighbour12 = new Dictionary(); _neighbour20 = new Dictionary(); for each (_local1 in _faces) { _local2 = true; for each (_local3 in _faces) { if (_local2){ if (_local1 == _local3){ _local2 = false; }; } else { if ((((_local1._v0 == _local3._v2)) && ((_local1._v1 == _local3._v1)))){ _neighbour01[_local1] = _local3; _neighbour12[_local3] = _local1; }; if ((((_local1._v0 == _local3._v0)) && ((_local1._v1 == _local3._v2)))){ _neighbour01[_local1] = _local3; _neighbour20[_local3] = _local1; }; if ((((_local1._v0 == _local3._v1)) && ((_local1._v1 == _local3._v0)))){ _neighbour01[_local1] = _local3; _neighbour01[_local3] = _local1; }; if ((((_local1._v1 == _local3._v2)) && ((_local1._v2 == _local3._v1)))){ _neighbour12[_local1] = _local3; _neighbour12[_local3] = _local1; }; if ((((_local1._v1 == _local3._v0)) && ((_local1._v2 == _local3._v2)))){ _neighbour12[_local1] = _local3; _neighbour20[_local3] = _local1; }; if ((((_local1._v1 == _local3._v1)) && ((_local1._v2 == _local3._v0)))){ _neighbour12[_local1] = _local3; _neighbour01[_local3] = _local1; }; if ((((_local1._v2 == _local3._v2)) && ((_local1._v0 == _local3._v1)))){ _neighbour20[_local1] = _local3; _neighbour12[_local3] = _local1; }; if ((((_local1._v2 == _local3._v0)) && ((_local1._v0 == _local3._v2)))){ _neighbour20[_local1] = _local3; _neighbour20[_local3] = _local1; }; if ((((_local1._v2 == _local3._v1)) && ((_local1._v0 == _local3._v0)))){ _neighbour20[_local1] = _local3; _neighbour01[_local3] = _local1; }; }; }; }; _neighboursDirty = false; } public function get vertices():Array{ var _local1:Dictionary; var _local2:Element; 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); } public function playFrames(_arg1:Array, _arg2:uint, _arg3:Boolean=true, _arg4:Boolean=false):void{ var _local5:String; if (_animation){ _animation.sequence = []; } else { _animation = new Animation(this); }; _animation.fps = _arg2; _animation.smooth = _arg3; _animation.loop = _arg4; if (_arg3){ _animation.createTransition(); }; for each (_local5 in _arg1) { if (framenames[_local5] != null){ _animation.sequence.push(new AnimationFrame(framenames[_local5])); }; }; if (_animation.sequence.length){ _animation.start(); }; } function getFacesByVertex(_arg1:Vertex):Array{ if (_vertfacesDirty){ findVertFaces(); }; return (_vertfaces[_arg1]); } public function neighbour12(_arg1:Face):Face{ if (_neighboursDirty){ findNeighbours(); }; return (_neighbour12[_arg1]); } } }//package away3d.core.base
Section 25
//IAnimation (away3d.core.base.IAnimation) package away3d.core.base { public interface IAnimation { function update():void; } }//package away3d.core.base
Section 26
//IFrame (away3d.core.base.IFrame) package away3d.core.base { public interface IFrame { function adjust(_arg1:Number=1):void; } }//package away3d.core.base
Section 27
//Mesh (away3d.core.base.Mesh) package away3d.core.base { import away3d.containers.*; import away3d.events.*; import flash.utils.*; import away3d.core.utils.*; import away3d.core.math.*; import away3d.materials.*; import away3d.animators.data.*; import away3d.core.project.*; public class Mesh extends Object3D { public var indexes:Array; private var _faceMaterial:ITriangleMaterial; private var _scenevertnormalsDirty:Boolean;// = true private var _material:IMaterial; private var _uvMaterial:IUVMaterial; private var _billboardMaterial:IBillboardMaterial; public var bothsides:Boolean; public var type:String;// = "mesh" private var _segmentMaterial:ISegmentMaterial; private var _face:Face; public var outline:ISegmentMaterial; private var _back:ITriangleMaterial; private var _geometry:Geometry; private var _scenevertnormals:Dictionary; public var url:String; public function Mesh(_arg1:Object=null){ super(_arg1); geometry = new Geometry(); outline = ini.getSegmentMaterial("outline"); material = ini.getMaterial("material"); faceMaterial = (((ini.getMaterial("faceMaterial") as ITriangleMaterial)) || (_faceMaterial)); segmentMaterial = (((ini.getMaterial("segmentMaterial") as ISegmentMaterial)) || (_segmentMaterial)); billboardMaterial = (((ini.getMaterial("billboardMaterial") as IBillboardMaterial)) || (_billboardMaterial)); back = (ini.getMaterial("back") as ITriangleMaterial); bothsides = ini.getBoolean("bothsides", false); projectorType = ProjectorType.MESH; } public function removeFace(_arg1:Face):void{ _geometry.removeFace(_arg1); } public function updateMaterials(_arg1:Object3D, _arg2:View3D):void{ if (_material){ _material.updateMaterial(_arg1, _arg2); }; if (back){ back.updateMaterial(_arg1, _arg2); }; geometry.updateMaterials(_arg1, _arg2); } public function gotoAndStop(_arg1:int):void{ geometry.gotoAndStop(_arg1); } private function onMaterialUpdate(_arg1:MaterialEvent):void{ _sessionDirty = true; } public function addOnSequenceDone(_arg1:Function):void{ geometry.addOnSequenceDone(_arg1); } public function triFaces():void{ _geometry.triFaces(); } public function playFrames(_arg1:Array, _arg2:uint, _arg3:Boolean=true, _arg4:Boolean=false):void{ geometry.playFrames(_arg1, _arg2, _arg3, _arg4); } public function get billboards():Array{ return (_geometry.billboards); } public function splitFace(_arg1:Face, _arg2:int=0):void{ _geometry.splitFace(_arg1, _arg2); } public function get transitionValue():Number{ return (geometry.transitionValue); } public function get hasCycleEvent():Boolean{ return (geometry.hasCycleEvent); } public function get billboardMaterial():IBillboardMaterial{ return (_billboardMaterial); } public function get segments():Array{ return (_geometry.segments); } public function removeOnCycle(_arg1:Function):void{ geometry.removeOnCycle(_arg1); } public function get faceMaterial():ITriangleMaterial{ return (_faceMaterial); } public function addFace(_arg1:Face):void{ _geometry.addFace(_arg1); } public function cloneAll(_arg1:Object3D=null):Object3D{ var _local2:Mesh = (((_arg1 as Mesh)) || (new Mesh())); super.clone(_local2); _local2.type = type; _local2.material = material; _local2.outline = outline; _local2.back = back; _local2.bothsides = bothsides; _local2.debugbb = debugbb; _local2.geometry = geometry.clone(); return (_local2); } public function get material():IMaterial{ return (_material); } public function triFace(_arg1:Face):void{ _geometry.triFace(_arg1); } private function onFaceMappingChange(_arg1:FaceEvent):void{ _sessionDirty = true; if (_arg1.face.material){ _uvMaterial = (_arg1.face.material as IUVMaterial); } else { _uvMaterial = (_faceMaterial as IUVMaterial); }; if (_uvMaterial){ _uvMaterial.getFaceMaterialVO(_arg1.face.faceVO, this).invalidated = true; }; } public function removeBillboard(_arg1:Billboard):void{ _geometry.removeBillboard(_arg1); } public function addBillboard(_arg1:Billboard):void{ _geometry.addBillboard(_arg1); } public function set billboardMaterial(_arg1:IBillboardMaterial):void{ if (_billboardMaterial == _arg1){ return; }; removeMaterial(_billboardMaterial); addMaterial((_billboardMaterial = _arg1)); } public function quarterFace(_arg1:Face):void{ _geometry.quarterFace(_arg1); } public function removeSegment(_arg1:Segment):void{ _geometry.removeSegment(_arg1); } 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 _geometry.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 _geometry.faces) { result.appendChild(new XML((((((((((((("<face v0=\"" + ??esc_xattr ) + "\" v1=\"") + ??esc_xattr ) + "\" v2=\"") + ??esc_xattr ) + "\" uv0=\"") + ??esc_xattr ) + "\" uv1=\"") + ??esc_xattr ) + "\" uv2=\"") + ??esc_xattr ) + "\"/>"))); }; return (result); } public function play(_arg1:AnimationSequence):void{ geometry.play(_arg1); } public function get isRunning():Boolean{ return (geometry.isRunning); } override public function applyPosition(_arg1:Number, _arg2:Number, _arg3:Number):void{ _geometry.applyPosition(_arg1, _arg2, _arg3); var _local4:Number3D = new Number3D(_arg1, _arg2, _arg3); new Number3D(_arg1, _arg2, _arg3).rotate(_local4, _transform); _local4.add(_local4, position); moveTo(_local4.x, _local4.y, _local4.z); } public function get activePrefix():String{ return (geometry.activePrefix); } public function invertFaces():void{ _geometry.invertFaces(); } public function get faces():Array{ return (_geometry.faces); } public function set transitionValue(_arg1:Number):void{ geometry.transitionValue = _arg1; } public function splitFaces(_arg1:int=0):void{ _geometry.splitFaces(_arg1); } public function set faceMaterial(_arg1:ITriangleMaterial):void{ if (_faceMaterial == _arg1){ return; }; removeMaterial(_faceMaterial); addMaterial((_faceMaterial = _arg1)); } private function removeMaterial(_arg1:IMaterial):void{ if (!_arg1){ return; }; _arg1.removeOnMaterialUpdate(onMaterialUpdate); } public function removeOnSequenceDone(_arg1:Function):void{ geometry.removeOnSequenceDone(_arg1); } public function updateVertex(_arg1:Vertex, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Boolean=false):void{ _geometry.updateVertex(_arg1, _arg2, _arg3, _arg4, _arg5); } public function set material(_arg1:IMaterial):void{ if ((((_material == _arg1)) && (!((_material == null))))){ return; }; removeMaterial(_material); addMaterial((_material = _arg1)); if ((_material is ITriangleMaterial)){ _faceMaterial = (_material as ITriangleMaterial); } else { faceMaterial = new WireColorMaterial(); }; if ((_material is ISegmentMaterial)){ _segmentMaterial = (_material as ISegmentMaterial); } else { segmentMaterial = new WireframeMaterial(); }; if ((_material is IBillboardMaterial)){ _billboardMaterial = (_material as IBillboardMaterial); } else { billboardMaterial = new ColorMaterial(); }; _sessionDirty = true; } public function set loop(_arg1:Boolean):void{ geometry.loop = _arg1; } public function set fps(_arg1:int):void{ geometry.fps = _arg1; } public function setPlaySequences(_arg1:Array, _arg2:Boolean=false):void{ geometry.setPlaySequences(_arg1, _arg2); } public function set back(_arg1:ITriangleMaterial):void{ if (_back == _arg1){ return; }; removeMaterial(_back); addMaterial((_back = _arg1)); } public function gotoAndPlay(_arg1:int):void{ geometry.gotoAndPlay(_arg1); } public function addSegment(_arg1:Segment):void{ _geometry.addSegment(_arg1); } public function set frame(_arg1:int):void{ geometry.frame = _arg1; } private function onDimensionsChange(_arg1:GeometryEvent):void{ _sessionDirty = true; notifyDimensionsChange(); } override public function clone(_arg1:Object3D=null):Object3D{ var _local2:Mesh = (((_arg1 as Mesh)) || (new Mesh())); super.clone(_local2); _local2.type = type; _local2.material = material; _local2.outline = outline; _local2.back = back; _local2.bothsides = bothsides; _local2.debugbb = debugbb; _local2.geometry = geometry; return (_local2); } public function get hasSequenceEvent():Boolean{ return (geometry.hasSequenceEvent); } public function set geometry(_arg1:Geometry):void{ if (_geometry == _arg1){ return; }; if (_geometry != null){ _geometry.removeOnMaterialUpdate(onMaterialUpdate); _geometry.removeOnMappingChange(onFaceMappingChange); _geometry.removeOnDimensionsChange(onDimensionsChange); }; _geometry = _arg1; if (_geometry != null){ _geometry.addOnMaterialUpdate(onMaterialUpdate); _geometry.addOnMappingChange(onFaceMappingChange); _geometry.addOnDimensionsChange(onDimensionsChange); }; } public function addOnCycle(_arg1:Function):void{ geometry.addOnCycle(_arg1); } public function get back():ITriangleMaterial{ return (_back); } private function addMaterial(_arg1:IMaterial):void{ if (!_arg1){ return; }; _arg1.addOnMaterialUpdate(onMaterialUpdate); } 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 = \"") + classname) + "\";\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 _geometry.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 _geometry.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 _geometry.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\tgeometry.frames = new Dictionary();\n"); source = (source + "\t\t\tgeometry.framenames = new Dictionary();\n"); source = (source + "\t\t\tvar oFrames:Object = new Object();\n"); myPattern = new RegExp(" ", "g"); for (framename in geometry.framenames) { tmpnames.push(framename); }; tmpnames.sort(); i = 0; while (i < tmpnames.length) { avp = new Array(); fr = geometry.frames[geometry.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\tgeometry.framenames[fnarr[i]] = i;\n"); source = (source + "\t\t\t\tgeometry.frames[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{ _geometry.quarterFaces(); } public function set smooth(_arg1:Boolean):void{ geometry.smooth = _arg1; } public function get frame():int{ return (geometry.frame); } public function get geometry():Geometry{ return (_geometry); } public function set segmentMaterial(_arg1:ISegmentMaterial):void{ if (_segmentMaterial == _arg1){ return; }; removeMaterial(_segmentMaterial); addMaterial((_segmentMaterial = _arg1)); } public function get elements():Array{ return (_geometry.elements); } public function get vertices():Array{ return (_geometry.vertices); } public function get segmentMaterial():ISegmentMaterial{ return (_segmentMaterial); } override protected function updateDimensions():void{ var _local1:Array; var _local2:Number; var _local3:Number; var _local4:Number3D; var _local5:Vertex; _local1 = geometry.vertices.concat(); if (_local1.length){ if (_scaleX < 0){ _boundingScale = -(_scaleX); } else { _boundingScale = _scaleX; }; if ((((_scaleY < 0)) && ((_boundingScale < -(_scaleY))))){ _boundingScale = -(_scaleY); } else { if (_boundingScale < _scaleY){ _boundingScale = _scaleY; }; }; if ((((_scaleZ < 0)) && ((_boundingScale < -(_scaleZ))))){ _boundingScale = -(_scaleZ); } else { if (_boundingScale < _scaleZ){ _boundingScale = _scaleZ; }; }; _local2 = 0; _local4 = new Number3D(); for each (_local5 in _local1) { _local4.sub(_local5.position, _pivotPoint); _local3 = _local4.modulo2; if (_local2 < _local3){ _local2 = _local3; }; }; if (_local2){ _boundingRadius = Math.sqrt(_local2); } else { _boundingRadius = 0; }; _local1.sortOn("x", (Array.DESCENDING | Array.NUMERIC)); _maxX = _local1[0].x; _minX = _local1[(_local1.length - 1)].x; _local1.sortOn("y", (Array.DESCENDING | Array.NUMERIC)); _maxY = _local1[0].y; _minY = _local1[(_local1.length - 1)].y; _local1.sortOn("z", (Array.DESCENDING | Array.NUMERIC)); _maxZ = _local1[0].z; _minZ = _local1[(_local1.length - 1)].z; }; super.updateDimensions(); } override public function applyRotations():void{ _geometry.applyRotations(rotationX, rotationY, rotationZ); rotationX = 0; rotationY = 0; rotationZ = 0; } } }//package away3d.core.base
Section 28
//Object3D (away3d.core.base.Object3D) package away3d.core.base { import flash.events.*; import flash.display.*; import away3d.containers.*; import away3d.events.*; import away3d.core.render.*; import away3d.core.draw.*; import away3d.core.utils.*; import away3d.core.math.*; import away3d.primitives.*; import away3d.core.light.*; import away3d.core.traverse.*; import away3d.loaders.utils.*; public class Object3D extends EventDispatcher implements IClonable { var _boundingScale:Number;// = 1 protected var _pivotPoint:Number3D; public var extra:Object; var _objectDirty:Boolean; private var _blendMode:String; public var projectorType:String; private var _renderer:IPrimitiveConsumer; private var _oldscene:Scene3D; private var _transformchanged:Object3DEvent; private var _dispatchedDimensionsChange:Boolean; private var _zAxis:Number3D; var _maxX:Number;// = 0 var _maxY:Number;// = 0 var _maxZ:Number;// = 0 var _sceneTransform:Matrix3D; private var _vector:Number3D; public var center:Vertex; private var _alpha:Number; private var _scenechanged:Object3DEvent; private var _pivotZero:Boolean; public var animationLibrary:AnimationLibrary; public var name:String; private var _lightarray:ILightConsumer; var _sceneTransformDirty:Boolean; var _mouseEnabled:Boolean;// = true private var _filters:Array; private var _quaternion:Quaternion; var _sessionDirty:Boolean; private var _yAxis:Number3D; private var _parentupdated:Object3DEvent; public var mouseEnabled:Boolean;// = true private var _rotationDirty:Boolean; private var _ownCanvas:Boolean; public var pushback:Boolean; private var _debugBoundingSphere:WireSphere; private var _rot:Number3D; var _rotationX:Number;// = 0 var _rotationY:Number;// = 0 var _rotationZ:Number;// = 0 var _minX:Number;// = 0 var _minY:Number;// = 0 var _minZ:Number;// = 0 private var _visible:Boolean; private var _xAxis:Number3D; private var _eulers:Number3D; public var pushfront:Boolean; var _localTransformDirty:Boolean; private var _scenetransformchanged:Object3DEvent; var _session:AbstractRenderSession; private var _sca:Number3D; var _lookingAtTarget:Number3D; var _scaleX:Number;// = 1 var _scaleY:Number;// = 1 var _scaleZ:Number;// = 1 var _boundingRadius:Number;// = 0 private var _sessionchanged:Object3DEvent; private var _sessionupdated:Object3DEvent; var _scene:Scene3D; private var _debugBoundingBox:WireCube; public var materialLibrary:MaterialLibrary; public var inverseSceneTransform:Matrix3D; private var _parentradius:Number3D; public var screenZOffset:Number; public var useHandCursor:Boolean;// = false private var _ownLights:Boolean; var _dimensionsDirty:Boolean;// = false private var _dimensionschanged:Object3DEvent; private var _parent:ObjectContainer3D; private var _ownSession:AbstractRenderSession; public var debugbb:Boolean; private var _scenePivotPoint:Number3D; protected var ini:Init; var _transformDirty:Boolean; public var geometryLibrary:GeometryLibrary; public var debugbs:Boolean; var _transform:Matrix3D; private var _m:Matrix3D; private var _lightsDirty:Boolean; private static var toDEGREES:Number = 57.2957795130823; private static var toRADIANS:Number = 0.0174532925199433; public function Object3D(_arg1:Object=null):void{ _transform = new Matrix3D(); _sceneTransform = new Matrix3D(); _lookingAtTarget = new Number3D(); _eulers = new Number3D(); _pivotPoint = new Number3D(); _scenePivotPoint = new Number3D(); _parentradius = new Number3D(); _quaternion = new Quaternion(); _rot = new Number3D(); _sca = new Number3D(); _vector = new Number3D(); _m = new Matrix3D(); _xAxis = new Number3D(); _yAxis = new Number3D(); _zAxis = new Number3D(); inverseSceneTransform = new Matrix3D(); center = new Vertex(); super(); ini = Init.parse(_arg1); name = ini.getString("name", name); ownSession = (ini.getObject("ownSession", AbstractRenderSession) as AbstractRenderSession); ownCanvas = ini.getBoolean("ownCanvas", ownCanvas); ownLights = ini.getBoolean("ownLights", false); visible = ini.getBoolean("visible", true); mouseEnabled = ini.getBoolean("mouseEnabled", mouseEnabled); useHandCursor = ini.getBoolean("useHandCursor", useHandCursor); renderer = (ini.getObject("renderer", IPrimitiveConsumer) as IPrimitiveConsumer); filters = ini.getArray("filters"); alpha = ini.getNumber("alpha", 1); blendMode = ini.getString("blendMode", BlendMode.NORMAL); debugbb = ini.getBoolean("debugbb", false); debugbs = ini.getBoolean("debugbs", false); pushback = ini.getBoolean("pushback", false); pushfront = ini.getBoolean("pushfront", false); screenZOffset = ini.getNumber("screenZOffset", 0); 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); pivotPoint = ((ini.getNumber3D("pivotPoint")) || (new Number3D())); extra = ini.getObject("extra"); if ((this is Scene3D)){ _scene = (this as Scene3D); } else { parent = (ini.getObject3D("parent") as ObjectContainer3D); }; } public function get pivotZero():Boolean{ return (_pivotZero); } public function moveDown(_arg1:Number):void{ translate(Number3D.DOWN, _arg1); } public function get scenePivotPoint():Number3D{ if (_sceneTransformDirty){ updateSceneTransform(); }; return (_scenePivotPoint); } public function get eulers():Number3D{ if (_rotationDirty){ updateRotation(); }; _eulers.x = (_rotationX * toDEGREES); _eulers.y = (_rotationY * toDEGREES); _eulers.z = (_rotationZ * toDEGREES); return (_eulers); } private function onParentSceneChange(_arg1:Object3DEvent):void{ if (_scene == _parent.scene){ return; }; _scene = _parent.scene; notifySceneChange(); } function notifySessionUpdate():void{ if (_scene){ _scene.updatedSessions[_session] = _session; }; if (!hasEventListener(Object3DEvent.SESSION_UPDATED)){ return; }; if (!_sessionupdated){ _sessionupdated = new Object3DEvent(Object3DEvent.SESSION_UPDATED, this); }; dispatchEvent(_sessionupdated); } public function get ownSession():AbstractRenderSession{ return (_ownSession); } public function removeOnTransformChange(_arg1:Function):void{ removeEventListener(Object3DEvent.TRANSFORM_CHANGED, _arg1, false); } public function moveTo(_arg1:Number, _arg2:Number, _arg3:Number):void{ if ((((((_transform.tx == _arg1)) && ((_transform.ty == _arg2)))) && ((_transform.tz == _arg3)))){ return; }; _transform.tx = _arg1; _transform.ty = _arg2; _transform.tz = _arg3; _localTransformDirty = true; _sceneTransformDirty = true; } public function get sceneTransform():Matrix3D{ if ((((_scene == null)) || ((_scene == this)))){ if (_transformDirty){ _sceneTransformDirty = true; }; if (_sceneTransformDirty){ notifySceneTransformChange(); }; return (transform); }; if (_transformDirty){ updateTransform(); }; if (_sceneTransformDirty){ updateSceneTransform(); }; if (_localTransformDirty){ notifyTransformChange(); }; return (_sceneTransform); } private function updateLights():void{ if (!_ownLights){ _lightarray = parent.lightarray; } else { _lightarray = new LightArray(); }; _lightsDirty = false; } public function get minY():Number{ if (_dimensionsDirty){ updateDimensions(); }; return (_minY); } public function removeOnSceneTransformChange(_arg1:Function):void{ removeEventListener(Object3DEvent.SCENETRANSFORM_CHANGED, _arg1, false); } public function get minX():Number{ if (_dimensionsDirty){ updateDimensions(); }; return (_minX); } public function get minZ():Number{ if (_dimensionsDirty){ updateDimensions(); }; return (_minZ); } public function get scaleZ():Number{ return (_scaleZ); } 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 get scaleY():Number{ return (_scaleY); } function notifySceneChange():void{ _sceneTransformDirty = true; if (!hasEventListener(Object3DEvent.SCENE_CHANGED)){ return; }; if (!_scenechanged){ _scenechanged = new Object3DEvent(Object3DEvent.SCENE_CHANGED, this); }; dispatchEvent(_scenechanged); } public function set eulers(_arg1:Number3D):void{ _rotationX = (_arg1.x * toRADIANS); _rotationY = (_arg1.y * toRADIANS); _rotationZ = (_arg1.z * toRADIANS); _transformDirty = true; } public function get scaleX():Number{ return (_scaleX); } public function set ownSession(_arg1:AbstractRenderSession):void{ if (_ownSession == _arg1){ return; }; if (_ownSession){ if (((_parent) && (_parent.session))){ _parent.session.removeChildSession(_ownSession); }; _ownSession.clearChildSessions(); _ownSession.renderer = null; _ownSession.internalRemoveOwnSession(this); _ownSession.removeOnSessionUpdate(onSessionUpdate); } else { if (((_parent) && (_parent.session))){ _parent.session.internalRemoveOwnSession(this); }; }; _ownSession = _arg1; if (_ownSession){ if (((_parent) && (_parent.session))){ _parent.session.addChildSession(_ownSession); }; _ownSession.clearChildSessions(); _ownSession.renderer = _renderer; _ownSession.filters = _filters; _ownSession.alpha = _alpha; _ownSession.blendMode = _blendMode; _ownSession.internalAddOwnSession(this); _ownSession.addOnSessionUpdate(onSessionUpdate); } else { if ((this is Scene3D)){ throw (new Error("Scene cannot have ownSession set to null")); }; if (((_parent) && (_parent.session))){ _parent.session.internalAddOwnSession(this); }; }; if (_ownSession){ _ownCanvas = true; } else { _ownCanvas = false; }; notifySessionChange(); } public function addOnMouseDown(_arg1:Function):void{ addEventListener(MouseEvent3D.MOUSE_DOWN, _arg1, false, 0, false); } override public function toString():String{ return ((((((((name) ? name : "$" + ": x:") + Math.round(x)) + " y:") + Math.round(y)) + " z:") + Math.round(z))); } public function get pivotPoint():Number3D{ return (_pivotPoint); } public function yaw(_arg1:Number):void{ rotate(Number3D.UP, _arg1); } public function get visible():Boolean{ return (_visible); } public function addOnDimensionsChange(_arg1:Function):void{ addEventListener(Object3DEvent.DIMENSIONS_CHANGED, _arg1, false, 0, true); } public function get y():Number{ return (_transform.ty); } public function get z():Number{ return (_transform.tz); } public function roll(_arg1:Number):void{ rotate(Number3D.FORWARD, _arg1); } public function get ownCanvas():Boolean{ return (_ownCanvas); } public function get x():Number{ return (_transform.tx); } public function moveUp(_arg1:Number):void{ translate(Number3D.UP, _arg1); } public function set ownLights(_arg1:Boolean):void{ _ownLights = _arg1; _lightsDirty = true; } public function get scene():Scene3D{ return (_scene); } public function removeOnRollOut(_arg1:Function):void{ removeEventListener(MouseEvent3D.ROLL_OUT, _arg1, false); } public function addOnSceneTransformChange(_arg1:Function):void{ addEventListener(Object3DEvent.SCENETRANSFORM_CHANGED, _arg1, false, 0, true); } public function addOnParentUpdate(_arg1:Function):void{ addEventListener(Object3DEvent.PARENT_UPDATED, _arg1, false, 0, true); } public function get session():AbstractRenderSession{ return (_session); } public function addOnMouseOver(_arg1:Function):void{ addEventListener(MouseEvent3D.MOUSE_OVER, _arg1, false, 0, false); } public function get rotationY():Number{ if (_rotationDirty){ updateRotation(); }; return ((_rotationY * toDEGREES)); } public function get rotationZ():Number{ if (_rotationDirty){ updateRotation(); }; return ((_rotationZ * toDEGREES)); } public function get parentBoundingRadius():Number{ return ((boundingRadius * _boundingScale)); } public function get rotationX():Number{ if (_rotationDirty){ updateRotation(); }; return ((_rotationX * toDEGREES)); } protected function updateTransform():void{ if (_rotationDirty){ updateRotation(); }; _quaternion.euler2quaternion(_rotationY, _rotationZ, -(_rotationX)); _transform.quaternion2matrix(_quaternion); _transform.scale(_transform, _scaleX, _scaleY, _scaleZ); _transformDirty = false; _sceneTransformDirty = true; _localTransformDirty = true; } public function set scaleY(_arg1:Number):void{ if (_scaleY == _arg1){ return; }; _scaleY = _arg1; _transformDirty = true; _dimensionsDirty = true; } public function set scaleZ(_arg1:Number):void{ if (_scaleZ == _arg1){ return; }; _scaleZ = _arg1; _transformDirty = true; _dimensionsDirty = true; } public function set scaleX(_arg1:Number):void{ if (_scaleX == _arg1){ return; }; _scaleX = _arg1; _transformDirty = true; _dimensionsDirty = true; } public function applyPosition(_arg1:Number, _arg2:Number, _arg3:Number):void{ throw (new Error("Not implemented in Object3D - Use Mesh or ObjectContainer3D")); } public function get renderer():IPrimitiveConsumer{ return (_renderer); } public function get objectDepth():Number{ if (_dimensionsDirty){ updateDimensions(); }; return ((_maxZ - _minZ)); } private function changeSession():void{ if (_ownSession){ _session = _ownSession; } else { if (_parent){ _session = _parent.session; } else { _session = null; }; }; _sessionDirty = true; } public function get parent():ObjectContainer3D{ return (_parent); } public function removeOnMouseDown(_arg1:Function):void{ removeEventListener(MouseEvent3D.MOUSE_DOWN, _arg1, false); } public function set alpha(_arg1:Number):void{ if (_alpha == _arg1){ return; }; _alpha = _arg1; if (_ownSession){ _ownSession.alpha = _alpha; }; } public function removeOnMouseOver(_arg1:Function):void{ removeEventListener(MouseEvent3D.MOUSE_OVER, _arg1, false); } public function set transform(_arg1:Matrix3D):void{ if (_transform.compare(_arg1)){ return; }; _transform.clone(_arg1); _transformDirty = false; _rotationDirty = true; _sceneTransformDirty = true; _localTransformDirty = true; _sca.matrix2scale(_transform); if (((((!((_scaleX == _sca.x))) || (!((_scaleY == _sca.y))))) || (!((_scaleZ == _sca.z))))){ _scaleX = _sca.x; _scaleY = _sca.y; _scaleZ = _sca.z; _dimensionsDirty = true; }; } public function moveBackward(_arg1:Number):void{ translate(Number3D.BACKWARD, _arg1); } public function set visible(_arg1:Boolean):void{ if (_visible == _arg1){ return; }; _visible = _arg1; _sessionDirty = true; notifyParentUpdate(); } public function applyRotations():void{ throw (new Error("Not implemented in Object3D - Use Mesh or ObjectContainer3D")); } public function addOnMouseOut(_arg1:Function):void{ addEventListener(MouseEvent3D.MOUSE_OUT, _arg1, false, 0, false); } public function set pivotPoint(_arg1:Number3D):void{ _pivotPoint.clone(_arg1); _pivotZero = ((((!(_pivotPoint.x)) && (!(_pivotPoint.y)))) && (!(_pivotPoint.z))); _sceneTransformDirty = true; _dimensionsDirty = true; notifyParentUpdate(); } public function moveRight(_arg1:Number):void{ translate(Number3D.RIGHT, _arg1); } public function set x(_arg1:Number):void{ if (isNaN(_arg1)){ throw (new Error("isNaN(x)")); }; if (_transform.tx == _arg1){ return; }; if (_arg1 == Infinity){ Debug.warning("x == Infinity"); }; if (_arg1 == -(Infinity)){ Debug.warning("x == -Infinity"); }; _transform.tx = _arg1; _sceneTransformDirty = true; _localTransformDirty = true; } public function movePivot(_arg1:Number, _arg2:Number, _arg3:Number):void{ _pivotPoint.x = _arg1; _pivotPoint.y = _arg2; _pivotPoint.z = _arg3; _pivotZero = ((((!(_arg1)) && (!(_arg2)))) && (!(_arg3))); _sceneTransformDirty = true; _dimensionsDirty = true; notifyParentUpdate(); } public function set y(_arg1:Number):void{ if (isNaN(_arg1)){ throw (new Error("isNaN(y)")); }; if (_transform.ty == _arg1){ return; }; 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 (_transform.tz == _arg1){ return; }; if (_arg1 == Infinity){ Debug.warning("z == Infinity"); }; if (_arg1 == -(Infinity)){ Debug.warning("z == -Infinity"); }; _transform.tz = _arg1; _sceneTransformDirty = true; _localTransformDirty = true; } function notifySceneTransformChange():void{ _sceneTransformDirty = false; _objectDirty = true; if (!hasEventListener(Object3DEvent.SCENETRANSFORM_CHANGED)){ return; }; if (!_scenetransformchanged){ _scenetransformchanged = new Object3DEvent(Object3DEvent.SCENETRANSFORM_CHANGED, this); }; dispatchEvent(_scenetransformchanged); } public function set ownCanvas(_arg1:Boolean):void{ if (_ownCanvas == _arg1){ return; }; if (_arg1){ ownSession = new SpriteRenderSession(); } else { if ((this is Scene3D)){ throw (new Error("Scene cannot have ownCanvas set to false")); }; ownSession = null; }; } private function onParentSessionChange(_arg1:Object3DEvent):void{ if (((_ownSession) && (_arg1.object.parent))){ _arg1.object.parent.session.removeChildSession(_ownSession); }; if (((_ownSession) && (_parent.session))){ _parent.session.addChildSession(_ownSession); }; if (((!(_ownSession)) && (!((_session == _parent.session))))){ changeSession(); dispatchEvent(_arg1); }; } public function addOnSceneChange(_arg1:Function):void{ addEventListener(Object3DEvent.SCENE_CHANGED, _arg1, false, 0, true); } public function get lightarray():ILightConsumer{ if (_lightsDirty){ updateLights(); }; return (_lightarray); } 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 addOnRollOut(_arg1:Function):void{ addEventListener(MouseEvent3D.ROLL_OUT, _arg1, false, 0, false); } function notifySessionChange():void{ changeSession(); if (!hasEventListener(Object3DEvent.SESSION_CHANGED)){ return; }; if (!_sessionchanged){ _sessionchanged = new Object3DEvent(Object3DEvent.SESSION_CHANGED, this); }; dispatchEvent(_sessionchanged); } public function get parentmaxX():Number{ return (((boundingRadius * _boundingScale) + _transform.tx)); } public function get parentmaxY():Number{ return (((boundingRadius * _boundingScale) + _transform.ty)); } public function get parentmaxZ():Number{ return (((boundingRadius * _boundingScale) + _transform.tz)); } public function removeOnSessionChange(_arg1:Function):void{ removeEventListener(Object3DEvent.SESSION_CHANGED, _arg1, false); } public function get position():Number3D{ return (transform.position); } public function removeOnMouseUp(_arg1:Function):void{ removeEventListener(MouseEvent3D.MOUSE_UP, _arg1, false); } public function lookAt(_arg1:Number3D, _arg2:Number3D=null):void{ _lookingAtTarget = _arg1; _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))); if (!_xAxis.modulo2){ _xAxis.cross(_zAxis, Number3D.BACKWARD); }; _xAxis.normalize(); _yAxis.cross(_zAxis, _xAxis); _yAxis.normalize(); _transform.sxx = (_xAxis.x * _scaleX); _transform.syx = (_xAxis.y * _scaleX); _transform.szx = (_xAxis.z * _scaleX); _transform.sxy = (-(_yAxis.x) * _scaleY); _transform.syy = (-(_yAxis.y) * _scaleY); _transform.szy = (-(_yAxis.z) * _scaleY); _transform.sxz = (_zAxis.x * _scaleZ); _transform.syz = (_zAxis.y * _scaleZ); _transform.szz = (_zAxis.z * _scaleZ); _transformDirty = false; _rotationDirty = true; _sceneTransformDirty = true; _localTransformDirty = true; }; } public function get debugBoundingBox():WireCube{ if (((_dimensionsDirty) || (!(_debugBoundingBox)))){ updateDimensions(); }; return (_debugBoundingBox); } public function set blendMode(_arg1:String):void{ if (_blendMode == _arg1){ return; }; _blendMode = _arg1; if (_ownSession){ _ownSession.blendMode = _blendMode; }; } public function set rotationZ(_arg1:Number):void{ if (rotationZ == _arg1){ return; }; _rotationZ = (_arg1 * toRADIANS); _transformDirty = true; } public function set rotationX(_arg1:Number):void{ if (rotationX == _arg1){ return; }; _rotationX = (_arg1 * toRADIANS); _transformDirty = true; } public function set rotationY(_arg1:Number):void{ if (rotationY == _arg1){ return; }; _rotationY = (_arg1 * toRADIANS); _transformDirty = true; } public function pitch(_arg1:Number):void{ rotate(Number3D.RIGHT, _arg1); } public function centerPivot():void{ var _local1:Number3D = new Number3D(((maxX + minX) / 2), ((maxY + minY) / 2), ((maxZ + minZ) / 2)); movePivot(_local1.x, _local1.y, _local1.z); moveTo(_local1.x, _local1.y, _local1.z); } public function get ownLights():Boolean{ return (_ownLights); } public function rotateTo(_arg1:Number, _arg2:Number, _arg3:Number):void{ _rotationX = (-(_arg1) * toRADIANS); _rotationY = (-(_arg2) * toRADIANS); _rotationZ = (-(_arg3) * toRADIANS); _rotationDirty = false; _transformDirty = true; } function notifyDimensionsChange():void{ _dimensionsDirty = true; if (((_dispatchedDimensionsChange) || (!(hasEventListener(Object3DEvent.DIMENSIONS_CHANGED))))){ return; }; if (!_dimensionschanged){ _dimensionschanged = new Object3DEvent(Object3DEvent.DIMENSIONS_CHANGED, this); }; dispatchEvent(_dimensionschanged); _dispatchedDimensionsChange = true; } public function scale(_arg1:Number):void{ _scaleX = (_scaleY = (_scaleZ = _arg1)); _transformDirty = true; _dimensionsDirty = true; } public function get objectHeight():Number{ if (_dimensionsDirty){ updateDimensions(); }; return ((_maxY - _minY)); } public function translate(_arg1:Number3D, _arg2:Number):void{ _arg1.normalize(); _vector.rotate(_arg1, transform); x = (x + (_arg2 * _vector.x)); y = (y + (_arg2 * _vector.y)); z = (z + (_arg2 * _vector.z)); } public function distanceTo(_arg1:Object3D):Number{ var _local2:Matrix3D = ((_scene == this)) ? transform : sceneTransform; var _local3:Matrix3D = ((_arg1.scene == _arg1)) ? _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 set parent(_arg1:ObjectContainer3D):void{ if ((this is Scene3D)){ throw (new Error("Scene cannot be parented")); }; if (_arg1 == _parent){ return; }; _oldscene = _scene; if (_parent != null){ _parent.removeOnParentUpdate(onParentUpdate); _parent.removeOnSessionChange(onParentSessionChange); _parent.removeOnSceneChange(onParentSceneChange); _parent.removeOnSceneTransformChange(onParentTransformChange); _parent.internalRemoveChild(this); if (((_ownSession) && (_parent.session))){ _parent.session.removeChildSession(_ownSession); }; }; _parent = _arg1; _scene = (_parent) ? _parent.scene : null; if (_parent != null){ _parent.internalAddChild(this); _parent.addOnParentUpdate(onParentUpdate); _parent.addOnSessionChange(onParentSessionChange); _parent.addOnSceneChange(onParentSceneChange); _parent.addOnSceneTransformChange(onParentTransformChange); if (((_ownSession) && (_parent.session))){ _parent.session.addChildSession(_ownSession); }; }; if (_scene != _oldscene){ notifySceneChange(); }; if (((!(_ownSession)) && (((!(_parent)) || (!((_session == _parent.session))))))){ notifySessionChange(); }; _sceneTransformDirty = true; _localTransformDirty = true; } public function get boundingRadius():Number{ if (_dimensionsDirty){ updateDimensions(); }; return (_boundingRadius); } public function removeOnParentUpdate(_arg1:Function):void{ removeEventListener(Object3DEvent.PARENT_UPDATED, _arg1, false); } public function rotate(_arg1:Number3D, _arg2:Number):void{ _arg1.normalize(); _m.rotationMatrix(_arg1.x, _arg1.y, _arg1.z, (_arg2 * toRADIANS)); _transform.multiply3x3(transform, _m); _rotationDirty = true; _sceneTransformDirty = true; _localTransformDirty = true; } public function clone(_arg1:Object3D=null):Object3D{ var _local2:Object3D = ((_arg1) || (new Object3D())); _local2.transform = transform; _local2.name = name; _local2.ownCanvas = _ownCanvas; _local2.renderer = _renderer; _local2.filters = _filters.concat(); _local2.alpha = _alpha; _local2.visible = visible; _local2.mouseEnabled = mouseEnabled; _local2.useHandCursor = useHandCursor; _local2.pushback = pushback; _local2.pushfront = pushfront; _local2.screenZOffset = screenZOffset; _local2.pivotPoint = pivotPoint; _local2.projectorType = projectorType; _local2.extra = ((extra is IClonable)) ? (extra as IClonable).clone() : extra; return (_local2); } public function get alpha():Number{ return (_alpha); } private function onSessionUpdate(_arg1:SessionEvent):void{ if ((_arg1.target is BitmapRenderSession)){ _scene.updatedSessions[_arg1.target] = _arg1.target; }; } private function updateRotation():void{ _rot.matrix2euler(_transform, _scaleX, _scaleY, _scaleZ); _rotationX = _rot.x; _rotationY = _rot.y; _rotationZ = _rot.z; _rotationDirty = false; } private function updateSceneTransform():void{ _sceneTransform.multiply(_parent.sceneTransform, transform); if (!_pivotZero){ _scenePivotPoint.rotate(_pivotPoint, _sceneTransform); _sceneTransform.tx = (_sceneTransform.tx - _scenePivotPoint.x); _sceneTransform.ty = (_sceneTransform.ty - _scenePivotPoint.y); _sceneTransform.tz = (_sceneTransform.tz - _scenePivotPoint.z); }; inverseSceneTransform.inverse(_sceneTransform); notifySceneTransformChange(); } public function get transform():Matrix3D{ if (_transformDirty){ updateTransform(); }; return (_transform); } public function addOnRollOver(_arg1:Function):void{ addEventListener(MouseEvent3D.ROLL_OVER, _arg1, false, 0, false); } public function traverse(_arg1:Traverser):void{ if (_arg1.match(this)){ _arg1.enter(this); _arg1.apply(this); _arg1.leave(this); }; } public function get maxX():Number{ if (_dimensionsDirty){ updateDimensions(); }; return (_maxX); } public function updateObject():void{ if (_objectDirty){ _scene.updatedObjects[this] = this; _objectDirty = false; _sessionDirty = true; }; } public function get maxY():Number{ if (_dimensionsDirty){ updateDimensions(); }; return (_maxY); } public function addOnSessionChange(_arg1:Function):void{ addEventListener(Object3DEvent.SESSION_CHANGED, _arg1, false, 0, true); } public function moveLeft(_arg1:Number):void{ translate(Number3D.LEFT, _arg1); } public function removeOnDimensionsChange(_arg1:Function):void{ removeEventListener(Object3DEvent.DIMENSIONS_CHANGED, _arg1, false); } public function set renderer(_arg1:IPrimitiveConsumer):void{ if (_renderer == _arg1){ return; }; _renderer = _arg1; if (_ownSession){ _ownSession.renderer = _renderer; }; _sessionDirty = true; } protected function updateDimensions():void{ _dimensionsDirty = false; _dispatchedDimensionsChange = false; if (debugbb){ if (!_debugBoundingBox){ _debugBoundingBox = new WireCube({material:"#333333"}); }; if (_boundingRadius){ _debugBoundingBox.visible = true; _debugBoundingBox.v000.setValue(_minX, _minY, _minZ); _debugBoundingBox.v100.setValue(_maxX, _minY, _minZ); _debugBoundingBox.v010.setValue(_minX, _maxY, _minZ); _debugBoundingBox.v110.setValue(_maxX, _maxY, _minZ); _debugBoundingBox.v001.setValue(_minX, _minY, _maxZ); _debugBoundingBox.v101.setValue(_maxX, _minY, _maxZ); _debugBoundingBox.v011.setValue(_minX, _maxY, _maxZ); _debugBoundingBox.v111.setValue(_maxX, _maxY, _maxZ); } else { debugBoundingBox.visible = false; }; }; if (debugbs){ if (!_debugBoundingSphere){ _debugBoundingSphere = new WireSphere({material:"#cyan", segmentsW:16, segmentsH:12}); }; if (_boundingRadius){ _debugBoundingSphere.visible = true; _debugBoundingSphere.radius = _boundingRadius; _debugBoundingSphere.updateObject(); _debugBoundingSphere.applyPosition(-(_pivotPoint.x), -(_pivotPoint.y), -(_pivotPoint.z)); } else { debugBoundingSphere.visible = false; }; }; } public function addOnMouseMove(_arg1:Function):void{ addEventListener(MouseEvent3D.MOUSE_MOVE, _arg1, false, 0, false); } public function get maxZ():Number{ if (_dimensionsDirty){ updateDimensions(); }; return (_maxZ); } private function onParentUpdate(_arg1:Object3DEvent):void{ _sessionDirty = true; dispatchEvent(_arg1); } private function onParentTransformChange(_arg1:Object3DEvent):void{ _sceneTransformDirty = true; } public function updateSession():void{ if (_sessionDirty){ notifySessionUpdate(); _sessionDirty = false; }; } public function tick(_arg1:int):void{ } public function addOnMouseUp(_arg1:Function):void{ addEventListener(MouseEvent3D.MOUSE_UP, _arg1, false, 0, false); } public function get blendMode():String{ return (_blendMode); } public function get lookingAtTarget():Number3D{ return (_lookingAtTarget); } public function removeOnRollOver(_arg1:Function):void{ removeEventListener(MouseEvent3D.ROLL_OVER, _arg1, false); } 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); } public function addOnTransformChange(_arg1:Function):void{ addEventListener(Object3DEvent.TRANSFORM_CHANGED, _arg1, false, 0, true); } public function get objectWidth():Number{ if (_dimensionsDirty){ updateDimensions(); }; return ((_maxX - _minX)); } public function get debugBoundingSphere():WireSphere{ if (((_dimensionsDirty) || (!(_debugBoundingSphere)))){ updateDimensions(); }; return (_debugBoundingSphere); } public function get scenePosition():Number3D{ return (sceneTransform.position); } public function removeOnSceneChange(_arg1:Function):void{ removeEventListener(Object3DEvent.SCENE_CHANGED, _arg1, false); } public function removeOnMouseMove(_arg1:Function):void{ removeEventListener(MouseEvent3D.MOUSE_MOVE, _arg1, false); } public function get parentminX():Number{ return (((-(boundingRadius) * _boundingScale) + _transform.tx)); } public function get parentminY():Number{ return (((-(boundingRadius) * _boundingScale) + _transform.ty)); } public function get parentminZ():Number{ return (((-(boundingRadius) * _boundingScale) + _transform.tz)); } public function set filters(_arg1:Array):void{ if (_filters == _arg1){ return; }; _filters = _arg1; if (_ownSession){ _ownSession.filters = _filters; }; } public function get filters():Array{ return (_filters); } function notifyParentUpdate():void{ if (((_ownCanvas) && (_parent))){ _parent._sessionDirty = true; }; if (!hasEventListener(Object3DEvent.PARENT_UPDATED)){ return; }; if (!_parentupdated){ _parentupdated = new Object3DEvent(Object3DEvent.PARENT_UPDATED, this); }; dispatchEvent(_parentupdated); } } }//package away3d.core.base
Section 29
//Segment (away3d.core.base.Segment) package away3d.core.base { import flash.events.*; import away3d.events.*; import away3d.materials.*; public class Segment extends Element { var _material:ISegmentMaterial; var _v0:Vertex; var _v1:Vertex; private var _materialchanged:SegmentEvent; public function Segment(_arg1:Vertex, _arg2:Vertex, _arg3:ISegmentMaterial=null){ this.v0 = _arg1; this.v1 = _arg2; this.material = _arg3; vertexDirty = true; } 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(); } 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(); } 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); } public function get material():ISegmentMaterial{ return (_material); } 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); } override public function get maxX():Number{ if (_v0._x > _v1._x){ return (_v0._x); }; return (_v1._x); } override public function get maxY():Number{ if (_v0._y > _v1._y){ return (_v0._y); }; return (_v1._y); } 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 maxZ():Number{ if (_v0._z > _v1._z){ return (_v0._z); }; return (_v1._z); } } }//package away3d.core.base
Section 30
//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 31
//Vertex (away3d.core.base.Vertex) package away3d.core.base { import away3d.core.draw.*; import away3d.core.utils.*; import away3d.core.math.*; public class Vertex extends ValueObject { var _x:Number; private var _persp:Number; private var _element:Element; private var _position:Number3D; public var parents:Array; public var extra:Object; public var positionDirty:Boolean; public var geometry:Geometry; var _y:Number; var _z:Number; public function Vertex(_arg1:Number=0, _arg2:Number=0, _arg3:Number=0){ _position = new Number3D(); parents = new Array(); super(); _x = _arg1; _y = _arg2; _z = _arg3; positionDirty = true; } public function set z(_arg1:Number):void{ if (_z == _arg1){ return; }; _z = _arg1; positionDirty = true; } public function set y(_arg1:Number):void{ if (_y == _arg1){ return; }; _y = _arg1; positionDirty = true; } public function get position():Number3D{ if (positionDirty){ updatePosition(); }; return (_position); } override public function toString():String{ return ((((((("new Vertex(" + _x) + ", ") + _y) + ", ") + z) + ")")); } public function reset():void{ _x = 0; _y = 0; _z = 0; positionDirty = true; } private function updatePosition():void{ positionDirty = false; for each (_element in parents) { _element.vertexDirty = true; }; _position.x = _x; _position.y = _y; _position.z = _z; } public function adjust(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number=1):void{ setValue(((_x * (1 - _arg4)) + (_arg1 * _arg4)), ((_y * (1 - _arg4)) + (_arg2 * _arg4)), ((_z * (1 - _arg4)) + (_arg3 * _arg4))); } public function clone():Vertex{ return (new Vertex(_x, _y, _z)); } public function get z():Number{ if (positionDirty){ updatePosition(); }; return (_z); } public function add(_arg1:Number3D):void{ _x = (_x + _arg1.x); _y = (_y + _arg1.y); _z = (_z + _arg1.z); positionDirty = true; } public 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)); } public function setValue(_arg1:Number, _arg2:Number, _arg3:Number):void{ _x = _arg1; _y = _arg2; _z = _arg3; positionDirty = true; } public function set x(_arg1:Number):void{ if (_x == _arg1){ return; }; _x = _arg1; positionDirty = true; } public function get x():Number{ if (positionDirty){ updatePosition(); }; return (_x); } public function get y():Number{ if (positionDirty){ updatePosition(); }; return (_y); } public function perspective(_arg1:Number):ScreenVertex{ _persp = (1 / (1 + (_z / _arg1))); return (new ScreenVertex((_x * _persp), (_y * _persp), _z)); } public 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))); } public 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)))); } public 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 32
//VertexClassification (away3d.core.base.VertexClassification) package away3d.core.base { import away3d.core.geom.*; public class VertexClassification { public var vertex:Vertex; public var distance:Number; public var plane:Plane3D; public function getDistance(_arg1:Plane3D):Number{ var _local2:Number = _arg1.distance(vertex.position); if ((((_local2 < 0)) && (!(isNaN(_local2))))){ plane = _arg1; distance = _local2; }; return (_local2); } } }//package away3d.core.base
Section 33
//VertexPosition (away3d.core.base.VertexPosition) package away3d.core.base { import away3d.core.math.*; public class VertexPosition { public var vertex:Vertex; public var x:Number; public var y:Number; public var z:Number; public function VertexPosition(_arg1:Vertex){ this.vertex = _arg1; this.x = 0; this.y = 0; this.z = 0; } public function add(_arg1:Number3D):void{ vertex.add(_arg1); } public function transform(_arg1:Matrix3D):void{ vertex.transform(_arg1); } public function adjust(_arg1:Number=1):void{ vertex.adjust(x, y, z, _arg1); } public function reset():void{ vertex.reset(); } public function getIndex(_arg1:Array):int{ var _local2:Number = vertex.x; var _local3:Number = vertex.y; var _local4:Number = vertex.z; vertex.x = NaN; vertex.y = NaN; vertex.z = NaN; var _local5:int; var _local6:int; while (_local6 < _arg1.length) { if (((((isNaN(_arg1[_local6].x)) && (isNaN(_arg1[_local6].y)))) && (isNaN(_arg1[_local6].z)))){ _local5 = _local6; break; }; _local6++; }; vertex.x = _local2; vertex.y = _local3; vertex.z = _local4; return (_local5); } } }//package away3d.core.base
Section 34
//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 35
//BlockerArray (away3d.core.block.BlockerArray) package away3d.core.block { import away3d.core.clip.*; public class BlockerArray implements IBlockerConsumer { private var _blockers:Array; private var _clip:Clipping; public function BlockerArray(){ _blockers = []; super(); } public function set clip(_arg1:Clipping):void{ _clip = _arg1; _blockers = []; } public function list():Array{ _blockers.sortOn("screenZ", Array.NUMERIC); return (_blockers); } public function get clip():Clipping{ return (_clip); } public function blocker(_arg1:Blocker):void{ if (_clip.checkPrimitive(_arg1)){ _blockers.push(_arg1); }; } } }//package away3d.core.block
Section 36
//ConvexBlocker (away3d.core.block.ConvexBlocker) package away3d.core.block { import flash.display.*; import flash.utils.*; import away3d.core.render.*; import away3d.core.draw.*; import away3d.core.utils.*; import away3d.core.geom.*; public class ConvexBlocker extends Blocker { private var _boundlines:Array; public var vertices:Array; override public function calc():void{ var _local2:ScreenVertex; _boundlines = []; screenZ = 0; maxX = -(Infinity); maxY = -(Infinity); minX = Infinity; minY = Infinity; var _local1:int; while (_local1 < vertices.length) { _local2 = vertices[_local1]; _boundlines.push(Line2D.from2points(_local2, vertices[((_local1 + 1) % vertices.length)])); if (screenZ < _local2.z){ screenZ = _local2.z; }; if (minX > _local2.x){ minX = _local2.x; }; if (maxX < _local2.x){ maxX = _local2.x; }; if (minY > _local2.y){ minY = _local2.y; }; if (maxY < _local2.y){ maxY = _local2.y; }; _local1++; }; maxZ = screenZ; minZ = screenZ; } override public function render():void{ var _local5:Line2D; var _local6:Line2D; var _local7:Line2D; var _local8:ScreenVertex; var _local9:ScreenVertex; var _local10:Number; var _local11:Number; var _local1:Graphics = source.session.graphics; _local1.lineStyle(2, Color.fromHSV(0, 0, ((Math.sin((getTimer() / 1000)) + 1) / 2))); var _local2:int; while (_local2 < _boundlines.length) { _local5 = _boundlines[_local2]; _local6 = _boundlines[(((_local2 - 1) + _boundlines.length) % _boundlines.length)]; _local7 = _boundlines[(((_local2 + 1) + _boundlines.length) % _boundlines.length)]; _local8 = Line2D.cross(_local6, _local5); _local9 = Line2D.cross(_local5, _local7); _local1.moveTo(_local8.x, _local8.y); _local1.lineTo(_local9.x, _local9.y); _local1.moveTo(_local8.x, _local8.y); _local2++; }; var _local3:int = (((maxX - minX) * (maxY - minY)) / 2000); if (_local3 > 50){ _local3 = 50; }; var _local4:int; while (_local4 < _local3) { _local10 = (minX + ((maxX - minX) * Math.random())); _local11 = (minY + ((maxY - minY) * Math.random())); if (contains(_local10, _local11)){ _local1.lineStyle(1, Color.fromHSV(0, 0, Math.random())); _local1.drawCircle(_local10, _local11, 3); }; _local4++; }; } override public function block(_arg1:DrawPrimitive):Boolean{ var _local2:DrawTriangle; if ((_arg1 is DrawTriangle)){ _local2 = (_arg1 as DrawTriangle); return (((((contains(_local2.v0.x, _local2.v0.y)) && (contains(_local2.v1.x, _local2.v1.y)))) && (contains(_local2.v2.x, _local2.v2.y)))); }; return (((((((contains(_arg1.minX, _arg1.minY)) && (contains(_arg1.minX, _arg1.maxY)))) && (contains(_arg1.maxX, _arg1.maxY)))) && (contains(_arg1.maxX, _arg1.minY)))); } override public function contains(_arg1:Number, _arg2:Number):Boolean{ var _local3:Line2D; for each (_local3 in _boundlines) { if (_local3.side(_arg1, _arg2) < 0){ return (false); }; }; return (true); } } }//package away3d.core.block
Section 37
//IBlockerConsumer (away3d.core.block.IBlockerConsumer) package away3d.core.block { public interface IBlockerConsumer { function blocker(_arg1:Blocker):void; } }//package away3d.core.block
Section 38
//IBlockerProvider (away3d.core.block.IBlockerProvider) package away3d.core.block { import away3d.core.base.*; import away3d.core.math.*; public interface IBlockerProvider { function blockers(_arg1:Object3D, _arg2:Matrix3D, _arg3:IBlockerConsumer):void; } }//package away3d.core.block
Section 39
//Clipping (away3d.core.clip.Clipping) package away3d.core.clip { import flash.events.*; import flash.display.*; import away3d.containers.*; import away3d.events.*; import away3d.core.draw.*; import away3d.core.utils.*; import away3d.core.base.*; import flash.geom.*; public class Clipping extends EventDispatcher { private var _view:View3D; private var _maX:Number; private var _stageHeight:Number; private var _stageWidth:Number; private var _maY:Number; private var _minY:Number; private var _minZ:Number; private var _minX:Number; var _cameraVarsStore:CameraVarsStore; private var _clippingClone:Clipping; private var _zeroPoint:Point; private var _maxX:Number; private var _maxY:Number; private var _maxZ:Number; protected var ini:Init; private var _globalPoint:Point; var _objectCulling:Boolean; private var _clippingupdated:ClippingEvent; private var _miX:Number; private var _miY:Number; private var _stage:Stage; public function Clipping(_arg1:Object=null){ _zeroPoint = new Point(0, 0); super(); ini = (Init.parse(_arg1) as Init); minX = ini.getNumber("minX", -(Infinity)); minY = ini.getNumber("minY", -(Infinity)); minZ = ini.getNumber("minZ", -(Infinity)); maxX = ini.getNumber("maxX", Infinity); maxY = ini.getNumber("maxY", Infinity); maxZ = ini.getNumber("maxZ", Infinity); } public function set minZ(_arg1:Number):void{ if (_minZ == _arg1){ return; }; _minZ = _arg1; notifyClippingUpdate(); } public function checkFace(_arg1:FaceVO, _arg2:Object3D, _arg3:Array):void{ _arg3.push(_arg1); } public function set minY(_arg1:Number):void{ if (_minY == _arg1){ return; }; _minY = _arg1; notifyClippingUpdate(); } public function screen(_arg1:Sprite, _arg2:Number, _arg3:Number):Clipping{ if (!_clippingClone){ _clippingClone = clone(); _clippingClone.addOnClippingUpdate(onScreenUpdate); }; _stage = _arg1.stage; if (_stage.scaleMode == StageScaleMode.NO_SCALE){ _stageWidth = _stage.stageWidth; _stageHeight = _stage.stageHeight; } else { if (_stage.scaleMode == StageScaleMode.EXACT_FIT){ _stageWidth = _arg2; _stageHeight = _arg3; } else { if (_stage.scaleMode == StageScaleMode.SHOW_ALL){ if ((_stage.stageWidth / _arg2) < (_stage.stageHeight / _arg3)){ _stageWidth = _arg2; _stageHeight = ((_stage.stageHeight * _stageWidth) / _stage.stageWidth); } else { _stageHeight = _arg3; _stageWidth = ((_stage.stageWidth * _stageHeight) / _stage.stageHeight); }; } else { if (_stage.scaleMode == StageScaleMode.NO_BORDER){ if ((_stage.stageWidth / _arg2) > (_stage.stageHeight / _arg3)){ _stageWidth = _arg2; _stageHeight = ((_stage.stageHeight * _stageWidth) / _stage.stageWidth); } else { _stageHeight = _arg3; _stageWidth = ((_stage.stageWidth * _stageHeight) / _stage.stageHeight); }; }; }; }; }; switch (_stage.align){ case StageAlign.TOP_LEFT: _zeroPoint.x = 0; _zeroPoint.y = 0; _globalPoint = _arg1.globalToLocal(_zeroPoint); _maX = ((_miX = _globalPoint.x) + _stageWidth); _maY = ((_miY = _globalPoint.y) + _stageHeight); break; case StageAlign.TOP_RIGHT: _zeroPoint.x = _arg2; _zeroPoint.y = 0; _globalPoint = _arg1.globalToLocal(_zeroPoint); _miX = ((_maX = _globalPoint.x) - _stageWidth); _maY = ((_miY = _globalPoint.y) + _stageHeight); break; case StageAlign.BOTTOM_LEFT: _zeroPoint.x = 0; _zeroPoint.y = _arg3; _globalPoint = _arg1.globalToLocal(_zeroPoint); _maX = ((_miX = _globalPoint.x) + _stageWidth); _miY = ((_maY = _globalPoint.y) - _stageHeight); break; case StageAlign.BOTTOM_RIGHT: _zeroPoint.x = _arg2; _zeroPoint.y = _arg3; _globalPoint = _arg1.globalToLocal(_zeroPoint); _miX = ((_maX = _globalPoint.x) - _stageWidth); _miY = ((_maY = _globalPoint.y) - _stageHeight); break; case StageAlign.TOP: _zeroPoint.x = (_arg2 / 2); _zeroPoint.y = 0; _globalPoint = _arg1.globalToLocal(_zeroPoint); _miX = (_globalPoint.x - (_stageWidth / 2)); _maX = (_globalPoint.x + (_stageWidth / 2)); _maY = ((_miY = _globalPoint.y) + _stageHeight); break; case StageAlign.BOTTOM: _zeroPoint.x = (_arg2 / 2); _zeroPoint.y = _arg3; _globalPoint = _arg1.globalToLocal(_zeroPoint); _miX = (_globalPoint.x - (_stageWidth / 2)); _maX = (_globalPoint.x + (_stageWidth / 2)); _miY = ((_maY = _globalPoint.y) - _stageHeight); break; case StageAlign.LEFT: _zeroPoint.x = 0; _zeroPoint.y = (_arg3 / 2); _globalPoint = _arg1.globalToLocal(_zeroPoint); _maX = ((_miX = _globalPoint.x) + _stageWidth); _miY = (_globalPoint.y - (_stageHeight / 2)); _maY = (_globalPoint.y + (_stageHeight / 2)); break; case StageAlign.RIGHT: _zeroPoint.x = _arg2; _zeroPoint.y = (_arg3 / 2); _globalPoint = _arg1.globalToLocal(_zeroPoint); _miX = ((_maX = _globalPoint.x) - _stageWidth); _miY = (_globalPoint.y - (_stageHeight / 2)); _maY = (_globalPoint.y + (_stageHeight / 2)); break; default: _zeroPoint.x = (_arg2 / 2); _zeroPoint.y = (_arg3 / 2); _globalPoint = _arg1.globalToLocal(_zeroPoint); _miX = (_globalPoint.x - (_stageWidth / 2)); _maX = (_globalPoint.x + (_stageWidth / 2)); _miY = (_globalPoint.y - (_stageHeight / 2)); _maY = (_globalPoint.y + (_stageHeight / 2)); }; if (minX == -(Infinity)){ _clippingClone.minX = _miX; } else { _clippingClone.minX = _minX; }; if (maxX == Infinity){ _clippingClone.maxX = _maX; } else { _clippingClone.maxX = _maxX; }; if (minY == -(Infinity)){ _clippingClone.minY = _miY; } else { _clippingClone.minY = _minY; }; if (maxY == Infinity){ _clippingClone.maxY = _maY; } else { _clippingClone.maxY = _maxY; }; _clippingClone.minZ = _minZ; _clippingClone.maxZ = _maxZ; _clippingClone.objectCulling = _objectCulling; return (_clippingClone); } public function set minX(_arg1:Number):void{ if (_minX == _arg1){ return; }; _minX = _arg1; notifyClippingUpdate(); } public function removeOnClippingUpdate(_arg1:Function):void{ removeEventListener(ClippingEvent.CLIPPING_UPDATED, _arg1, false); } public function get view():View3D{ return (_view); } public function addOnClippingUpdate(_arg1:Function):void{ addEventListener(ClippingEvent.CLIPPING_UPDATED, _arg1, false, 0, false); } override public function toString():String{ return ((((((((((((("{minX:" + minX) + " maxX:") + maxX) + " minY:") + minY) + " maxY:") + maxY) + " minZ:") + minZ) + " maxZ:") + maxZ) + "}")); } public function checkPrimitive(_arg1:DrawPrimitive):Boolean{ return (true); } public function get minX():Number{ return (_minX); } public function get minY():Number{ return (_minY); } public function get minZ():Number{ return (_minZ); } public function set view(_arg1:View3D):void{ _view = _arg1; _cameraVarsStore = view.cameraVarsStore; } private function onScreenUpdate(_arg1:ClippingEvent):void{ dispatchEvent(_arg1); } public function clone(_arg1:Clipping=null):Clipping{ var _local2:Clipping = ((_arg1) || (new Clipping())); _local2.minX = minX; _local2.minY = minY; _local2.minZ = minZ; _local2.maxX = maxX; _local2.maxY = maxY; _local2.maxZ = maxZ; _local2.objectCulling = objectCulling; _local2._cameraVarsStore = _cameraVarsStore; return (_local2); } private function notifyClippingUpdate():void{ if (!hasEventListener(ClippingEvent.CLIPPING_UPDATED)){ return; }; if (_clippingupdated == null){ _clippingupdated = new ClippingEvent(ClippingEvent.CLIPPING_UPDATED, this); }; dispatchEvent(_clippingupdated); } public function set maxX(_arg1:Number):void{ if (_maxX == _arg1){ return; }; _maxX = _arg1; notifyClippingUpdate(); } public function set objectCulling(_arg1:Boolean):void{ _objectCulling = _arg1; } public function set maxY(_arg1:Number):void{ if (_maxY == _arg1){ return; }; _maxY = _arg1; notifyClippingUpdate(); } public function set maxZ(_arg1:Number):void{ if (_maxZ == _arg1){ return; }; _maxZ = _arg1; notifyClippingUpdate(); } public function get objectCulling():Boolean{ return (_objectCulling); } 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 get maxY():Number{ return (_maxY); } public function get maxZ():Number{ return (_maxZ); } public function get maxX():Number{ return (_maxX); } } }//package away3d.core.clip
Section 40
//FrustumClipping (away3d.core.clip.FrustumClipping) package away3d.core.clip { import away3d.core.render.*; import away3d.core.draw.*; import away3d.core.utils.*; import away3d.core.base.*; import away3d.core.geom.*; public class FrustumClipping extends Clipping { private var _uv1:UV; private var _uv20:UV; private var _v2C:VertexClassification; private var _v1d:Number; private var _v0:Vertex; private var _v1:Vertex; private var _v1w:Number; private var _v1Classification:Plane3D; private var _v2:Vertex; private var _frustum:Frustum; private var _v2d:Number; private var _f1:FaceVO; private var tri:DrawTriangle; private var _v01:Vertex; private var _v2w:Number; private var _uv01:UV; private var _f0:FaceVO; private var _v0C:VertexClassification; private var _session:AbstractRenderSession; private var _v12:Vertex; private var _plane:Plane3D; private var _v0Classification:Plane3D; private var _v2Classification:Plane3D; private var _d:Number; private var _uv12:UV; private var _v1C:VertexClassification; private var _v0d:Number; private var _uv0:UV; private var _p:Number; private var _uv2:UV; private var _v20:Vertex; private var _v0w:Number; private var _pass:Boolean; public function FrustumClipping(_arg1:Object=null){ super(_arg1); objectCulling = ini.getBoolean("objectCulling", true); } override public function set objectCulling(_arg1:Boolean):void{ if (!_arg1){ throw (new Error("objectCulling requires setting to true for FrustumClipping")); }; _objectCulling = _arg1; } override public function checkFace(_arg1:FaceVO, _arg2:Object3D, _arg3:Array):void{ var _local4:FaceVO; var _local5:FaceVO; _session = _arg2.session; _frustum = _cameraVarsStore.frustumDictionary[_arg2]; _pass = true; _v0C = _cameraVarsStore.createVertexClassification(_arg1.v0); _v1C = _cameraVarsStore.createVertexClassification(_arg1.v1); _v2C = _cameraVarsStore.createVertexClassification(_arg1.v2); if (((((_v0C.plane) || (_v1C.plane))) || (_v2C.plane))){ if ((_plane = _v0C.plane)){ _v0d = _v0C.distance; _v1d = _v1C.getDistance(_plane); _v2d = _v2C.getDistance(_plane); } else { if ((_plane = _v1C.plane)){ _v0d = _v0C.getDistance(_plane); _v1d = _v1C.distance; _v2d = _v2C.getDistance(_plane); } else { if ((_plane = _v2C.plane)){ _v0d = _v0C.getDistance(_plane); _v1d = _v1C.getDistance(_plane); _v2d = _v2C.distance; }; }; }; if ((((((_v0d < 0)) && ((_v1d < 0)))) && ((_v2d < 0)))){ return; }; if ((((((_v0d < 0)) || ((_v1d < 0)))) || ((_v2d < 0)))){ _pass = false; }; } else { for each (_plane in _frustum.planes) { _v0d = _v0C.getDistance(_plane); _v1d = _v1C.getDistance(_plane); _v2d = _v2C.getDistance(_plane); if ((((((_v0d < 0)) && ((_v1d < 0)))) && ((_v2d < 0)))){ return; }; if ((((((_v0d < 0)) || ((_v1d < 0)))) || ((_v2d < 0)))){ _pass = false; break; }; }; }; if (_pass){ _arg3.push(_arg1); return; }; if ((((_v0d >= 0)) && ((_v1d < 0)))){ _v0w = _v0d; _v1w = _v1d; _v2w = _v2d; _v0 = _arg1.v0; _v1 = _arg1.v1; _v2 = _arg1.v2; _uv0 = _arg1.uv0; _uv1 = _arg1.uv1; _uv2 = _arg1.uv2; } else { if ((((_v1d >= 0)) && ((_v2d < 0)))){ _v0w = _v1d; _v1w = _v2d; _v2w = _v0d; _v0 = _arg1.v1; _v1 = _arg1.v2; _v2 = _arg1.v0; _uv0 = _arg1.uv1; _uv1 = _arg1.uv2; _uv2 = _arg1.uv0; } else { if ((((_v2d >= 0)) && ((_v0d < 0)))){ _v0w = _v2d; _v1w = _v0d; _v2w = _v1d; _v0 = _arg1.v2; _v1 = _arg1.v0; _v2 = _arg1.v1; _uv0 = _arg1.uv2; _uv1 = _arg1.uv0; _uv2 = _arg1.uv1; }; }; }; _d = (_v0w - _v1w); _v01 = _cameraVarsStore.createVertex((((_v1.x * _v0w) - (_v0.x * _v1w)) / _d), (((_v1.y * _v0w) - (_v0.y * _v1w)) / _d), (((_v1.z * _v0w) - (_v0.z * _v1w)) / _d)); _uv01 = (_uv0) ? _cameraVarsStore.createUV((((_uv1.u * _v0w) - (_uv0.u * _v1w)) / _d), (((_uv1.v * _v0w) - (_uv0.v * _v1w)) / _d), _session) : null; if (_v2w < 0){ _d = (_v0w - _v2w); _v20 = _cameraVarsStore.createVertex((((_v2.x * _v0w) - (_v0.x * _v2w)) / _d), (((_v2.y * _v0w) - (_v0.y * _v2w)) / _d), (((_v2.z * _v0w) - (_v0.z * _v2w)) / _d)); _uv20 = (_uv0) ? _cameraVarsStore.createUV((((_uv2.u * _v0w) - (_uv0.u * _v2w)) / _d), (((_uv2.v * _v0w) - (_uv0.v * _v2w)) / _d), _session) : null; checkFace(_cameraVarsStore.createFaceVO(_arg1.face, _v0, _v01, _v20, _arg1.material, _arg1.back, _uv0, _uv01, _uv20), _arg2, _arg3); } else { _d = (_v2w - _v1w); _v12 = _cameraVarsStore.createVertex((((_v1.x * _v2w) - (_v2.x * _v1w)) / _d), (((_v1.y * _v2w) - (_v2.y * _v1w)) / _d), (((_v1.z * _v2w) - (_v2.z * _v1w)) / _d)); _uv12 = (_uv0) ? _cameraVarsStore.createUV((((_uv1.u * _v2w) - (_uv2.u * _v1w)) / _d), (((_uv1.v * _v2w) - (_uv2.v * _v1w)) / _d), _session) : null; _local4 = _cameraVarsStore.createFaceVO(_arg1.face, _v0, _v01, _v2, _arg1.material, _arg1.back, _uv0, _uv01, _uv2); _local5 = _cameraVarsStore.createFaceVO(_arg1.face, _v01, _v12, _v2, _arg1.material, _arg1.back, _uv01, _uv12, _uv2); checkFace(_local4, _arg2, _arg3); checkFace(_local5, _arg2, _arg3); }; } override public function clone(_arg1:Clipping=null):Clipping{ var _local2:FrustumClipping = (((_arg1 as FrustumClipping)) || (new FrustumClipping())); super.clone(_local2); return (_local2); } 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); } } }//package away3d.core.clip
Section 41
//RectangleClipping (away3d.core.clip.RectangleClipping) package away3d.core.clip { import away3d.core.render.*; import away3d.core.draw.*; import away3d.core.utils.*; import away3d.core.base.*; import away3d.core.geom.*; public class RectangleClipping extends Clipping { private var _uv1:UV; private var _uv20:UV; private var _v2C:VertexClassification; private var _v1d:Number; private var _v0:Vertex; private var _v1:Vertex; private var _v1w:Number; private var _v1Classification:Plane3D; private var _v2:Vertex; private var _frustum:Frustum; private var _v2d:Number; private var _f1:FaceVO; private var tri:DrawTriangle; private var _v01:Vertex; private var _v2w:Number; private var _uv01:UV; private var _f0:FaceVO; private var _v0C:VertexClassification; private var _session:AbstractRenderSession; private var _v12:Vertex; private var _plane:Plane3D; private var _v0Classification:Plane3D; private var _v2Classification:Plane3D; private var _d:Number; private var _uv12:UV; private var _v1C:VertexClassification; private var _v0d:Number; private var _uv0:UV; private var _p:Number; private var _uv2:UV; private var _v20:Vertex; private var _v0w:Number; private var _pass:Boolean; public function RectangleClipping(_arg1:Object=null){ super(_arg1); objectCulling = ini.getBoolean("objectCulling", false); } override public function checkPrimitive(_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 clone(_arg1:Clipping=null):Clipping{ var _local2:RectangleClipping = (((_arg1 as RectangleClipping)) || (new RectangleClipping())); super.clone(_local2); return (_local2); } } }//package away3d.core.clip
Section 42
//DrawBillboard (away3d.core.draw.DrawBillboard) package away3d.core.draw { import away3d.materials.*; import flash.geom.*; public class DrawBillboard extends DrawPrimitive { var left:ScreenVertex; private var sinh:Number; public var screenvertex:ScreenVertex; private var pointMapping:Matrix; private var cos:Number; private var sinw:Number; public var material:IBillboardMaterial; var bottomleft:ScreenVertex; private var bounds:ScreenVertex; public var height:Number; private var cosh:Number; public var width:Number; public var scale:Number; var bottomright:ScreenVertex; private var cosw:Number; private var sin:Number; var top:ScreenVertex; var topleft:ScreenVertex; public var mapping:Matrix; var topright:ScreenVertex; private var uvMaterial:IUVMaterial; private var h:Number; private var w:Number; public var rotation:Number; public function DrawBillboard(){ 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{ material.renderBillboard(this); } 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); }; }; uvMaterial = (material as IUVMaterial); if (((!(uvMaterial)) || (!(uvMaterial.bitmap.transparent)))){ return (true); }; pointMapping = mapping.clone(); pointMapping.invert(); var _local3:Point = pointMapping.transformPoint(new Point(_arg1, _arg2)); if (_local3.x < 0){ _local3.x = 0; }; if (_local3.y < 0){ _local3.y = 0; }; if (_local3.x >= uvMaterial.width){ _local3.x = (uvMaterial.width - 1); }; if (_local3.y >= uvMaterial.height){ _local3.y = (uvMaterial.height - 1); }; var _local4:uint = uvMaterial.bitmap.getPixel32(int(_local3.x), int(_local3.y)); return ((uint((_local4 >> 24)) > 128)); } override public function clear():void{ screenvertex = null; } override public function calc():void{ var _local1:Array; screenZ = screenvertex.z; minZ = screenZ; maxZ = screenZ; uvMaterial = (material as IUVMaterial); if (uvMaterial){ w = (uvMaterial.width * scale); h = (uvMaterial.height * scale); } else { w = (width * scale); h = (height * scale); }; if (rotation != 0){ cos = Math.cos(((rotation * Math.PI) / 180)); sin = Math.sin(((rotation * Math.PI) / 180)); cosw = ((cos * w) / 2); cosh = ((cos * h) / 2); sinw = ((sin * w) / 2); sinh = ((sin * h) / 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 { bottomright.x = (topright.x = ((bottomleft.x = (topleft.x = (screenvertex.x - (w / 2)))) + w)); bottomright.y = (bottomleft.y = ((topright.y = (topleft.y = (screenvertex.y - (h / 2)))) + h)); 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; }; } } }//package away3d.core.draw
Section 43
//DrawDisplayObject (away3d.core.draw.DrawDisplayObject) package away3d.core.draw { import flash.display.*; import away3d.core.render.*; import flash.geom.*; public class DrawDisplayObject extends DrawPrimitive { public var displayobject:DisplayObject; private var displayRect:Rectangle; public var screenvertex:ScreenVertex; public var session:AbstractRenderSession; override public function clear():void{ displayobject = null; } override public function calc():void{ displayRect = displayobject.getBounds(displayobject); screenZ = screenvertex.z; minZ = screenZ; maxZ = screenZ; minX = (screenvertex.x + displayRect.left); minY = (screenvertex.y + displayRect.top); maxX = (screenvertex.x + displayRect.right); maxY = (screenvertex.y + displayRect.bottom); } 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 44
//DrawFog (away3d.core.draw.DrawFog) package away3d.core.draw { import away3d.core.clip.*; import away3d.materials.*; public class DrawFog extends DrawPrimitive { public var clip:Clipping; public var material:IFogMaterial; override public function render():void{ material.renderFog(this); } } }//package away3d.core.draw
Section 45
//DrawPrimitive (away3d.core.draw.DrawPrimitive) package away3d.core.draw { import away3d.containers.*; import away3d.core.base.*; public class DrawPrimitive { public var create:Function; public var minX:Number; public var minY:Number; public var minZ:Number; public var generated:Boolean; public var source:Object3D; public var view:View3D; public var screenZ:Number; public var maxX:Number; public var maxY:Number; public var quadrant:PrimitiveQuadrantTreeNode; public var maxZ:Number; public function getZ(_arg1:Number, _arg2:Number):Number{ return (screenZ); } public function clear():void{ 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{ return ([this]); } public function toString():String{ return ((((((("P{ screenZ = " + screenZ) + ", minZ = ") + minZ) + ", maxZ = ") + maxZ) + " }")); } } }//package away3d.core.draw
Section 46
//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); }; if (rotation != 0){ mapping = new Matrix((scale * cos), (-(scale) * sin), (scale * sin), (scale * cos), topleft.x, topleft.y); } else { mapping = new Matrix(scale, 0, 0, scale, 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 47
//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(source, material, v0, _arg1, true), create(source, material, _arg1, v1, true)]); } override public function quarter(_arg1:Number):Array{ if (length < 5){ return (null); }; var _local2:ScreenVertex = ScreenVertex.median(v0, v1, _arg1); return ([create(source, material, v0, _local2, true), create(source, material, _local2, v1, true)]); } 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{ focus = view.camera.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 48
//DrawTriangle (away3d.core.draw.DrawTriangle) package away3d.core.draw { import away3d.core.utils.*; import away3d.core.base.*; import away3d.materials.*; import flash.geom.*; 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 _areaSign: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; private var fcz:Number; private var uv01:UV; private var d01:Number; 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 _invtexmapping:Matrix; private var dd01:Number; private var uv12:UV; 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; public var faceVO:FaceVO; private var focus:Number; private var materialWidth:Number; private var byf:Number; private var v01:ScreenVertex; private var _u1:Number; public function DrawTriangle(){ _invtexmapping = new Matrix(); super(); } final public function transformUV(_arg1:IUVMaterial):Matrix{ materialWidth = _arg1.width; materialHeight = _arg1.height; if ((((((uv0 == null)) || ((uv1 == null)))) || ((uv2 == null)))){ return (null); }; _u0 = (materialWidth * uv0._u); _u1 = (materialWidth * uv1._u); _u2 = (materialWidth * uv2._u); _v0 = (materialHeight * (1 - uv0._v)); _v1 = (materialHeight * (1 - uv1._v)); _v2 = (materialHeight * (1 - uv2._v)); if ((((((_u0 == _u1)) && ((_v0 == _v1)))) || ((((_u0 == _u2)) && ((_v0 == _v2)))))){ if (_u0 > 0.05){ _u0 = (_u0 - 0.05); } else { _u0 = (_u0 + 0.05); }; if (_v0 > 0.07){ _v0 = (_v0 - 0.07); } else { _v0 = (_v0 + 0.07); }; }; if ((((_u2 == _u1)) && ((_v2 == _v1)))){ if (_u2 > 0.04){ _u2 = (_u2 - 0.04); } else { _u2 = (_u2 + 0.04); }; if (_v2 > 0.06){ _v2 = (_v2 - 0.06); } else { _v2 = (_v2 + 0.06); }; }; _invtexmapping.a = (_u1 - _u0); _invtexmapping.b = (_v1 - _v0); _invtexmapping.c = (_u2 - _u0); _invtexmapping.d = (_v2 - _v0); if ((_arg1 is BitmapMaterialContainer)){ _invtexmapping.tx = (_u0 - faceVO.bitmapRect.x); _invtexmapping.ty = (_v0 - faceVO.bitmapRect.y); } else { _invtexmapping.tx = _u0; _invtexmapping.ty = _v0; }; return (_invtexmapping); } 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))) * _areaSign) < -0.001){ return (false); }; if (((((v0.x * (v2.y - _arg2)) + (_arg1 * (v0.y - v2.y))) + (v2.x * (_arg2 - v0.y))) * _areaSign) < -0.001){ return (false); }; if (((((_arg1 * (v2.y - v1.y)) + (v1.x * (_arg2 - v2.y))) + (v2.x * (v1.y - _arg2))) * _areaSign) < -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(source, faceVO, material, _arg1, _arg2, _arg4, _arg6, _arg7, _arg9, true), create(source, faceVO, material, _arg2, _arg3, _arg4, _arg7, _arg8, _arg9, true), create(source, faceVO, material, _arg1, _arg4, _arg5, _arg6, _arg9, _arg10, true)]); }; return ([create(source, faceVO, material, _arg1, _arg2, _arg5, _arg6, _arg7, _arg10, true), create(source, faceVO, material, _arg2, _arg3, _arg4, _arg7, _arg8, _arg9, true), create(source, faceVO, material, _arg2, _arg4, _arg5, _arg7, _arg9, _arg10, true)]); } 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 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(source, faceVO, material, v2, v0, _local2, uv2, uv0, _local3, true), create(source, faceVO, material, _local2, v1, v2, _local3, uv1, uv2, true)]); } 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)))); if (area > 0){ _areaSign = 1; } else { _areaSign = -1; }; } 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 = view.camera.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; } override public function render():void{ material.renderTriangle(this); } final private function bisect12(_arg1:Number):Array{ var _local2:ScreenVertex = ScreenVertex.median(v1, v2, _arg1); var _local3:UV = UV.median(uv1, uv2); return ([create(source, faceVO, material, v0, v1, _local2, uv0, uv1, _local3, true), create(source, faceVO, material, _local2, v2, v0, _local3, uv2, uv0, true)]); } final override public function quarter(_arg1:Number):Array{ if ((((area > -20)) && ((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(source, faceVO, material, v0, v01, v20, uv0, uv01, uv20, true), create(source, faceVO, material, v1, v12, v01, uv1, uv12, uv01, true), create(source, faceVO, material, v2, v20, v12, uv2, uv20, uv12, true), create(source, faceVO, material, v01, v12, v20, uv01, uv12, uv20, true)]); } final private function bisect20(_arg1:Number):Array{ var _local2:ScreenVertex = ScreenVertex.median(v2, v0, _arg1); var _local3:UV = UV.median(uv2, uv0); return ([create(source, faceVO, material, v1, v2, _local2, uv1, uv2, _local3, true), create(source, faceVO, material, _local2, v0, v1, _local3, uv0, uv1, true)]); } 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{ focus = view.camera.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 49
//IPrimitiveConsumer (away3d.core.draw.IPrimitiveConsumer) package away3d.core.draw { import away3d.containers.*; public interface IPrimitiveConsumer { function clone():IPrimitiveConsumer; function clear(_arg1:View3D):void; function list():Array; function primitive(_arg1:DrawPrimitive):Boolean; } }//package away3d.core.draw
Section 50
//IPrimitiveProvider (away3d.core.draw.IPrimitiveProvider) package away3d.core.draw { import away3d.core.base.*; import away3d.core.math.*; public interface IPrimitiveProvider { function primitives(_arg1:Object3D, _arg2:Matrix3D, _arg3:IPrimitiveConsumer):void; } }//package away3d.core.draw
Section 51
//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){ center = new Array(); super(); 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; center = new Array(); 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; }; }; }; }; }; center.push(_arg1); _arg1.quadrant = this; } public function render(_arg1:Number):void{ var _local2:DrawPrimitive; if (render_center_length == -1){ render_center_length = center.length; if (render_center_length){ if (render_center_length > 1){ center.sortOn("screenZ", (Array.DESCENDING | Array.NUMERIC)); }; }; 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++; }; 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 52
//ScreenVertex (away3d.core.draw.ScreenVertex) package away3d.core.draw { import away3d.core.base.*; public final class ScreenVertex { private var persp:Number; public var vx:Number; public var vy:Number; private var my2:Number; public var clipX:Number; public var clipY:Number; public var clipZ:Number; private var dx:Number; private var dy:Number; public var num:Number; private var faz:Number; public var viewTimer:int; private var mx2:Number; private var ifmz2:Number; public var visible:Boolean; public var x:Number; public var y: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 53
//IPrimitiveFilter (away3d.core.filter.IPrimitiveFilter) package away3d.core.filter { import away3d.containers.*; import away3d.core.clip.*; import away3d.cameras.*; public interface IPrimitiveFilter { function filter(_arg1:Array, _arg2:Scene3D, _arg3:Camera3D, _arg4:Clipping):Array; } }//package away3d.core.filter
Section 54
//ZSortFilter (away3d.core.filter.ZSortFilter) package away3d.core.filter { import away3d.containers.*; import away3d.core.clip.*; 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 55
//Frustum (away3d.core.geom.Frustum) package away3d.core.geom { import away3d.core.utils.*; import away3d.core.base.*; import away3d.core.math.*; public class Frustum { private var _matrix:Matrix3D; private var _distance:Number; public var planes:Array; private var _plane:Plane3D; public static const IN:int = 1; public static const OUT:int = 0; public static const LEFT:int = 0; public static const NEAR:int = 4; public static const BOTTOM:int = 3; public static const TOP:int = 2; public static const FAR:int = 5; public static const RIGHT:int = 1; public static const INTERSECT:int = 2; public function Frustum(){ _matrix = new Matrix3D(); super(); planes = new Array(6); planes[LEFT] = new Plane3D(); planes[RIGHT] = new Plane3D(); planes[TOP] = new Plane3D(); planes[BOTTOM] = new Plane3D(); planes[NEAR] = new Plane3D(); planes[FAR] = new Plane3D(); } public function classifyAABB(_arg1:Array):int{ var _local4:Plane3D; var _local5:int; var _local6:int; var _local2:int; var _local3:int; while (_local3 < 6) { _local4 = Plane3D(planes[_local3]); _local5 = 0; _local6 = 0; while (_local6 < 8) { if (_local4.classifyPoint(_arg1[_local6]) == Plane3D.FRONT){ _local5++; }; _local6++; }; if (_local5 == 0){ return (OUT); }; if (_local5 == 8){ _local2++; }; _local3++; }; if (_local2 == 6){ return (IN); }; return (INTERSECT); } public function extractFromMatrix(_arg1:Matrix3D):void{ var _local8:Number; var _local9:Number; var _local10:Number; var _local11:Number; var _local12:Number; var _local13:Number; var _local14:Number; var _local15:Number; var _local18:Plane3D; _matrix = _arg1; var _local2:Number = _arg1.sxx; var _local3:Number = _arg1.sxy; var _local4:Number = _arg1.sxz; var _local5:Number = _arg1.tx; var _local6:Number = _arg1.syx; var _local7:Number = _arg1.syy; _local8 = _arg1.syz; _local9 = _arg1.ty; _local10 = _arg1.szx; _local11 = _arg1.szy; _local12 = _arg1.szz; _local13 = _arg1.tz; _local14 = _arg1.swx; _local15 = _arg1.swy; var _local16:Number = _arg1.swz; var _local17:Number = _arg1.tw; _local18 = Plane3D(planes[NEAR]); _local18.a = (_local14 + _local10); _local18.b = (_local15 + _local11); _local18.c = (_local16 + _local12); _local18.d = (_local17 + _local13); _local18.normalize(); var _local19:Plane3D = Plane3D(planes[FAR]); _local19.a = (-(_local10) + _local14); _local19.b = (-(_local11) + _local15); _local19.c = (-(_local12) + _local16); _local19.d = (-(_local13) + _local17); _local19.normalize(); var _local20:Plane3D = Plane3D(planes[LEFT]); _local20.a = (_local14 + _local2); _local20.b = (_local15 + _local3); _local20.c = (_local16 + _local4); _local20.d = (_local17 + _local5); _local20.normalize(); var _local21:Plane3D = Plane3D(planes[RIGHT]); _local21.a = (-(_local2) + _local14); _local21.b = (-(_local3) + _local15); _local21.c = (-(_local4) + _local16); _local21.d = (-(_local5) + _local17); _local21.normalize(); var _local22:Plane3D = Plane3D(planes[TOP]); _local22.a = (_local14 + _local6); _local22.b = (_local15 + _local7); _local22.c = (_local16 + _local8); _local22.d = (_local17 + _local9); _local22.normalize(); var _local23:Plane3D = Plane3D(planes[BOTTOM]); _local23.a = (-(_local6) + _local14); _local23.b = (-(_local7) + _local15); _local23.c = (-(_local8) + _local16); _local23.d = (-(_local9) + _local17); _local23.normalize(); } public function classifySphere(_arg1:Number3D, _arg2:Number):int{ for each (_plane in planes) { _distance = _plane.distance(_arg1); if (_distance < -(_arg2)){ return (OUT); }; if (Math.abs(_distance) < _arg2){ return (INTERSECT); }; }; return (IN); } public function classifyRadius(_arg1:Number):int{ for each (_plane in planes) { if (_plane.d < -(_arg1)){ return (OUT); }; if (Math.abs(_plane.d) < _arg1){ return (INTERSECT); }; }; return (IN); } public function classifyObject3D(_arg1:Object3D):int{ return (classifySphere(_arg1.sceneTransform.position, _arg1.boundingRadius)); } } }//package away3d.core.geom
Section 56
//Line2D (away3d.core.geom.Line2D) package away3d.core.geom { import away3d.core.draw.*; public class Line2D { public var a:Number; public var c:Number; public var b:Number; public function Line2D(_arg1:Number, _arg2:Number, _arg3:Number){ this.a = _arg1; this.b = _arg2; this.c = _arg3; } public function distance(_arg1:ScreenVertex):Number{ return ((sideV(_arg1) / Math.sqrt(((a * a) + (b * b))))); } public function side(_arg1:Number, _arg2:Number):Number{ return ((((a * _arg1) + (b * _arg2)) + c)); } public function toString():String{ return ((((((("line{ a: " + a) + " b: ") + b) + " c:") + c) + " }")); } public function sideV(_arg1:ScreenVertex):Number{ return ((((a * _arg1.x) + (b * _arg1.y)) + c)); } public static function cross(_arg1:Line2D, _arg2:Line2D):ScreenVertex{ var _local3:Number = ((_arg1.a * _arg2.b) - (_arg1.b * _arg2.a)); var _local4:Number = ((_arg1.b * _arg2.c) - (_arg1.c * _arg2.b)); var _local5:Number = ((_arg2.a * _arg1.c) - (_arg1.a * _arg2.c)); return (new ScreenVertex((_local4 / _local3), (_local5 / _local3), 0)); } public static function from2points(_arg1:ScreenVertex, _arg2:ScreenVertex):Line2D{ var _local3:Number = (_arg2.y - _arg1.y); var _local4:Number = (_arg1.x - _arg2.x); var _local5:Number = -(((_local4 * _arg1.y) + (_local3 * _arg1.x))); return (new Line2D(_local3, _local4, _local5)); } } }//package away3d.core.geom
Section 57
//Plane3D (away3d.core.geom.Plane3D) package away3d.core.geom { import away3d.core.base.*; import away3d.core.math.*; public class Plane3D { public var a:Number; public var c:Number; public var b:Number; public var d:Number; private var _mt:Matrix3D; private var _point:Number3D; private var _len:Number; public static const BACK:int = -1; public static const FRONT:int = 1; public static const EPSILON:Number = 0.001; public static const INTERSECT:int = 0; public function Plane3D(_arg1:Number=0, _arg2:Number=0, _arg3:Number=0, _arg4:Number=0){ _point = new Number3D(); _mt = new Matrix3D(); super(); this.a = _arg1; this.b = _arg2; this.c = _arg3; this.d = _arg4; } public function getIntersectionLine(_arg1:Vertex, _arg2:Vertex):Vertex{ var _local3:Number = ((((_point.x * _arg1.x) + (_point.y * _arg1.y)) + (_point.z * _arg1.z)) - d); var _local4:Number = ((((_point.x * _arg2.x) + (_point.y * _arg2.y)) + (_point.z * _arg2.z)) - d); var _local5:Number = (((((_point.x * _arg2.x) + (_point.y * _arg2.y)) + (_point.z * _arg2.z)) - d) / (_local4 - _local3)); return (new Vertex((_arg2.x + ((_arg1.x - _arg2.x) * _local5)), (_arg2.y + ((_arg1.y - _arg2.y) * _local5)), (_arg2.z + ((_arg1.z - _arg2.z) * _local5)))); } public function fromNormalAndPoint(_arg1:Number3D, _arg2:Number3D):void{ a = _arg1.x; b = _arg1.y; c = _arg1.z; d = -((((a * _arg2.x) + (b * _arg2.y)) + (c * _arg2.z))); _point = _arg1; } public function classifyPoint(_arg1:Number3D):int{ var _local2:Number = ((((a * _arg1.x) + (b * _arg1.y)) + (c * _arg1.z)) + d); if ((((_local2 > -(EPSILON))) && ((_local2 < EPSILON)))){ return (Plane3D.INTERSECT); }; if (_local2 < 0){ return (Plane3D.BACK); }; if (_local2 > 0){ return (Plane3D.FRONT); }; return (Plane3D.INTERSECT); } public function from3vertices(_arg1:Vertex, _arg2:Vertex, _arg3:Vertex):void{ var _local4:Number = (_arg2.x - _arg1.x); var _local5:Number = (_arg2.y - _arg1.y); var _local6:Number = (_arg2.z - _arg1.z); var _local7:Number = (_arg3.x - _arg1.x); var _local8:Number = (_arg3.y - _arg1.y); var _local9:Number = (_arg3.z - _arg1.z); a = ((_local5 * _local9) - (_local6 * _local8)); b = ((_local6 * _local7) - (_local4 * _local9)); c = ((_local4 * _local8) - (_local5 * _local7)); d = -((((a * _arg1.x) + (b * _arg1.y)) + (c * _arg1.z))); } public function closestPointFrom(_arg1:Number3D):Number3D{ var _local2:Number3D; _point.x = 0; _point.y = 0; if (c != 0){ _point.z = (-(d) / c); } else { _point.z = (-(d) / b); }; _local2 = new Number3D(); _local2.sub(_arg1, _point); var _local3:Number = (((a * _point.x) + (b * _point.y)) + (c * _point.z)); _local2.x = (_local2.x - (_local3 * a)); _local2.y = (_local2.y - (_local3 * b)); _local2.z = (_local2.z - (_local3 * c)); return (_local2); } public function normalize():Plane3D{ var _local1:Number = Math.sqrt((((a * a) + (b * b)) + (c * c))); a = (a / _local1); b = (b / _local1); c = (c / _local1); d = (d / _local1); return (this); } public function getIntersectionLineNumbers(_arg1:Number3D, _arg2:Number3D):Number3D{ var _local3:Number = ((((_point.x * _arg1.x) + (_point.y * _arg1.y)) + (_point.z * _arg1.z)) - d); var _local4:Number = ((((_point.x * _arg2.x) + (_point.y * _arg2.y)) + (_point.z * _arg2.z)) - d); var _local5:Number = (((((_point.x * _arg2.x) + (_point.y * _arg2.y)) + (_point.z * _arg2.z)) - d) / (_local4 - _local3)); return (new Number3D((_arg2.x + ((_arg1.x - _arg2.x) * _local5)), (_arg2.y + ((_arg1.y - _arg2.y) * _local5)), (_arg2.z + ((_arg1.z - _arg2.z) * _local5)))); } public function transform(_arg1:Matrix3D):void{ var _local2:Number = a; var _local3:Number = b; var _local4:Number = c; var _local5:Number = d; a = ((((_local2 * _arg1.sxx) + (_local3 * _arg1.syx)) + (_local4 * _arg1.szx)) + (_local5 * _arg1.swx)); b = ((((_local2 * _arg1.sxy) + (_local3 * _arg1.syy)) + (_local4 * _arg1.szy)) + (_local5 * _arg1.swy)); c = ((((_local2 * _arg1.sxz) + (_local3 * _arg1.syz)) + (_local4 * _arg1.szz)) + (_local5 * _arg1.swz)); d = ((((_local2 * _arg1.tx) + (_local3 * _arg1.ty)) + (_local4 * _arg1.tz)) + (_local5 * _arg1.tw)); normalize(); } public function from3points(_arg1:Number3D, _arg2:Number3D, _arg3:Number3D):void{ var _local4:Number = (_arg2.x - _arg1.x); var _local5:Number = (_arg2.y - _arg1.y); var _local6:Number = (_arg2.z - _arg1.z); var _local7:Number = (_arg3.x - _arg1.x); var _local8:Number = (_arg3.y - _arg1.y); var _local9:Number = (_arg3.z - _arg1.z); a = ((_local5 * _local9) - (_local6 * _local8)); b = ((_local6 * _local7) - (_local4 * _local9)); c = ((_local4 * _local8) - (_local5 * _local7)); d = -((((a * _arg1.x) + (b * _arg1.y)) + (c * _arg1.z))); } public function distance(_arg1:Number3D):Number{ _len = ((((a * _arg1.x) + (b * _arg1.y)) + (c * _arg1.z)) + d); if ((((_len > -(EPSILON))) && ((_len < EPSILON)))){ _len = 0; }; return (_len); } } }//package away3d.core.geom
Section 58
//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 59
//DirectionalLight (away3d.core.light.DirectionalLight) package away3d.core.light { import flash.display.*; import away3d.containers.*; import away3d.events.*; import flash.utils.*; import flash.filters.*; import away3d.core.base.*; import away3d.core.math.*; import flash.geom.*; import away3d.lights.*; public class DirectionalLight extends LightPrimitive { private var halfTransform:Matrix3D; public var ambientColorTransform:ColorTransform; private var mod:Number; private var _green:Number; private var _light:DirectionalLight3D; private var quaternion:Quaternion; private var _shape:Shape; public var diffuseTransform:Dictionary; private var halfQuaternion:Quaternion; private var _szx:Number; private var _szy:Number; private var _szz:Number; private var _blue:Number; public var normalMatrixSpecularTransform:Dictionary; private var cameraTransform:Matrix3D; private var nx:Number; private var ny:Number; private var _red:Number; private var halfVector:Number3D; private var cameraDirection:Number3D; private var _matrix:Matrix; public var normalMatrixDiffuseTransform:Dictionary; 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(){ _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(); normalMatrixDiffuseTransform = new Dictionary(true); normalMatrixSpecularTransform = new Dictionary(true); super(); } public function setNormalMatrixSpecularTransform(_arg1:Object3D, _arg2:View3D, _arg3:Number, _arg4:Number):void{ if (!normalMatrixSpecularTransform[_arg1]){ normalMatrixSpecularTransform[_arg1] = new Dictionary(true); }; _red = (((red * 2) + _arg4) * _arg3); _green = (((green * 2) + _arg4) * _arg3); _blue = (((blue * 2) + _arg4) * _arg3); _szx = specularTransform[_arg1][_arg2].szx; _szy = -(specularTransform[_arg1][_arg2].szy); _szz = specularTransform[_arg1][_arg2].szz; _normalMatrix.matrix = [(_szx * _red), (_green * _szy), (_blue * _szz), 0, (((-(_red) * 127) * ((_szx + _szy) + _szz)) - ((127 * _arg4) * _arg3)), (_szx * _red), (_green * _szy), (_blue * _szz), 0, (((-(_green) * 127) * ((_szx + _szy) + _szz)) - ((127 * _arg4) * _arg3)), (_szx * _red), (_green * _szy), (_blue * _szz), 0, (((-(_blue) * 127) * ((_szx + _szy) + _szz)) - ((127 * _arg4) * _arg3)), 0, 0, 0, 1, 0]; normalMatrixSpecularTransform[_arg1][_arg2] = _normalMatrix.clone(); } public function updateSpecularBitmap():void{ specularBitmap = new BitmapData(0x0200, 0x0200, false, 0); specularBitmap.lock(); _matrix.createGradientBox(0x0200, 0x0200, 0, 0, 0); var _local1:Array = new Array(); var _local2:Array = new Array(); var _local3:Array = new Array(); var _local4 = 15; while (_local4--) { _local1.push((((((((_local4 * specular) * red) * 0xFF) / 14) << 16) + (((((_local4 * specular) * green) * 0xFF) / 14) << 8)) + ((((_local4 * specular) * blue) * 0xFF) / 14))); _local2.push(1); _local3.push(int((30 + (((225 * 2) * Math.acos(Math.pow((_local4 / 14), (1 / 20)))) / Math.PI)))); }; _shape.graphics.clear(); _shape.graphics.beginGradientFill(GradientType.RADIAL, _local1, _local2, _local3, _matrix); _shape.graphics.drawCircle(0xFF, 0xFF, 0xFF); specularBitmap.draw(_shape); } public function setDiffuseTransform(_arg1:Object3D):void{ if (!diffuseTransform[_arg1]){ diffuseTransform[_arg1] = new Matrix3D(); }; diffuseTransform[_arg1].multiply3x3(transform, _arg1.sceneTransform); diffuseTransform[_arg1].normalize(diffuseTransform[_arg1]); } public function clearTransform():void{ diffuseTransform = new Dictionary(true); specularTransform = new Dictionary(true); normalMatrixDiffuseTransform = new Dictionary(true); normalMatrixSpecularTransform = new Dictionary(true); } public function get light():DirectionalLight3D{ return (_light); } 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); specularTransform[_arg1][_arg2].normalize(specularTransform[_arg1][_arg2]); } public function updateAmbientBitmap():void{ ambientBitmap = new BitmapData(0x0100, 0x0100, false, ((int((((ambient * red) * 0xFF) << 16)) | int((((ambient * green) * 0xFF) << 8))) | int(((ambient * blue) * 0xFF)))); ambientBitmap.lock(); ambientColorTransform = new ColorTransform(1, 1, 1, 1, ((ambient * red) * 0xFF), ((ambient * green) * 0xFF), ((ambient * blue) * 0xFF), 0); } 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 setNormalMatrixDiffuseTransform(_arg1:Object3D):void{ _red = ((red * 2) * diffuse); _green = ((green * 2) * diffuse); _blue = ((blue * 2) * diffuse); _szx = diffuseTransform[_arg1].szx; _szy = -(diffuseTransform[_arg1].szy); _szz = diffuseTransform[_arg1].szz; _normalMatrix.matrix = [(_szx * _red), (_green * _szy), (_blue * _szz), 0, ((-(_red) * 127) * ((_szx + _szy) + _szz)), (_szx * _red), (_green * _szy), (_blue * _szz), 0, ((-(_green) * 127) * ((_szx + _szy) + _szz)), (_szx * _red), (_green * _szy), (_blue * _szz), 0, ((-(_blue) * 127) * ((_szx + _szy) + _szz)), 0, 0, 0, 1, 0]; normalMatrixDiffuseTransform[_arg1] = _normalMatrix.clone(); } public function set light(_arg1:DirectionalLight3D):void{ _light = _arg1; _arg1.addOnSceneTransformChange(updateDirection); } public function updateDiffuseBitmap():void{ var _local5:Number; var _local6:Number; var _local7:Number; diffuseBitmap = new BitmapData(0x0100, 0x0100, false, 0); diffuseBitmap.lock(); _matrix.createGradientBox(0x0100, 0x0100, 0, 0, 0); var _local1:Array = new Array(); var _local2:Array = new Array(); var _local3:Array = new Array(); var _local4 = 15; while (_local4--) { _local5 = ((_local4 * diffuse) / 14); if (_local5 > 1){ _local5 = 1; }; _local6 = ((_local4 * diffuse) / 14); if (_local6 > 1){ _local6 = 1; }; _local7 = ((_local4 * diffuse) / 14); if (_local7 > 1){ _local7 = 1; }; _local1.push((((((_local5 * red) * 0xFF) << 16) | (((_local6 * green) * 0xFF) << 8)) | ((_local7 * blue) * 0xFF))); _local2.push(1); _local3.push(int((30 + (((225 * 2) * Math.acos((_local4 / 14))) / Math.PI)))); }; _shape.graphics.clear(); _shape.graphics.beginGradientFill(GradientType.LINEAR, _local1, _local2, _local3, _matrix); _shape.graphics.drawRect(0, 0, 0x0100, 0x0100); diffuseBitmap.draw(_shape); diffuseColorTransform = new ColorTransform((diffuse * red), (diffuse * green), (diffuse * blue), 1, 0, 0, 0, 0); } public function updateAmbientDiffuseBitmap():void{ var _local5:Number; var _local6:Number; var _local7:Number; ambientDiffuseBitmap = new BitmapData(0x0100, 0x0100, false, 0); ambientDiffuseBitmap.lock(); _matrix.createGradientBox(0x0100, 0x0100, 0, 0, 0); var _local1:Array = new Array(); var _local2:Array = new Array(); var _local3:Array = new Array(); var _local4 = 15; while (_local4--) { _local5 = (((_local4 * diffuse) / 14) + ambient); if (_local5 > 1){ _local5 = 1; }; _local6 = (((_local4 * diffuse) / 14) + ambient); if (_local6 > 1){ _local6 = 1; }; _local7 = (((_local4 * diffuse) / 14) + ambient); if (_local7 > 1){ _local7 = 1; }; _local1.push((((((_local5 * red) * 0xFF) << 16) | (((_local6 * green) * 0xFF) << 8)) | ((_local7 * blue) * 0xFF))); _local2.push(1); _local3.push(int((30 + (((225 * 2) * Math.acos((_local4 / 14))) / Math.PI)))); }; _shape.graphics.clear(); _shape.graphics.beginGradientFill(GradientType.LINEAR, _local1, _local2, _local3, _matrix); _shape.graphics.drawRect(0, 0, 0x0100, 0x0100); ambientDiffuseBitmap.draw(_shape); } } }//package away3d.core.light
Section 60
//ILightConsumer (away3d.core.light.ILightConsumer) package away3d.core.light { public interface ILightConsumer { function get points():Array; function pointLight(_arg1:PointLight):void; function get directionals():Array; function get numLights():int; function get ambients():Array; function directionalLight(_arg1:DirectionalLight):void; function clear():void; function ambientLight(_arg1:AmbientLight):void; } }//package away3d.core.light
Section 61
//ILightProvider (away3d.core.light.ILightProvider) package away3d.core.light { import away3d.core.base.*; public interface ILightProvider { function get debug():Boolean; function get debugPrimitive():Object3D; function light(_arg1:ILightConsumer):void; } }//package away3d.core.light
Section 62
//LightArray (away3d.core.light.LightArray) package away3d.core.light { public class LightArray implements ILightConsumer { private var _points:Array; private var _numLights:int; private var _directionals:Array; private var _ambients:Array; public function get numLights():int{ return (_numLights); } public function directionalLight(_arg1:DirectionalLight):void{ _directionals.push(_arg1); _numLights++; } public function clear():void{ _ambients = []; _directionals = []; _points = []; _numLights = 0; } public function get directionals():Array{ return (_directionals); } public function get ambients():Array{ return (_ambients); } public function get points():Array{ return (_points); } public function ambientLight(_arg1:AmbientLight):void{ _ambients.push(_arg1); _numLights++; } public function pointLight(_arg1:PointLight):void{ _points.push(_arg1); _numLights++; } } }//package away3d.core.light
Section 63
//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 64
//PointLight (away3d.core.light.PointLight) package away3d.core.light { import away3d.containers.*; import away3d.events.*; import flash.utils.*; import away3d.core.math.*; import away3d.lights.*; public class PointLight extends LightPrimitive { public var viewPositions:Dictionary; private var _light:PointLight3D; public function setViewPosition(_arg1:View3D):void{ if (!viewPositions[_arg1]){ viewPositions[_arg1] = new Number3D(); }; viewPositions[_arg1].clone(_arg1.cameraVarsStore.viewTransformDictionary[_light].position); } public function updatePosition(_arg1:Object3DEvent):void{ clearViewPositions(); } public function get light():PointLight3D{ return (_light); } public function clearViewPositions():void{ viewPositions = new Dictionary(true); } public function set light(_arg1:PointLight3D):void{ _light = _arg1; _arg1.addOnSceneTransformChange(updatePosition); } } }//package away3d.core.light
Section 65
//Matrix3D (away3d.core.math.Matrix3D) package away3d.core.math { public final class Matrix3D { private const toDEGREES:Number = 57.2957795130823; private var xx:Number; private var xy:Number; private var xz:Number; private var _right:Number3D; 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 _up:Number3D; private var m211:Number; private var m213:Number; private var m212:Number; private var m214:Number; private var suv:Number; private var suw:Number; private var 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 w:Number; private var x:Number; private var y:Number; private var z:Number; private var svw:Number; private var m231:Number; private var m111:Number; private var m112:Number; private var _forward:Number3D; private var m114:Number; private var _position:Number3D; public var tw:Number;// = 1 private var m232:Number; private var m233:Number; private var m113:Number; public var swz:Number;// = 0 private var nSin:Number; public var swx:Number;// = 0 public var tx:Number;// = 0 public var ty:Number;// = 0 private var m234:Number; private var m241:Number; private var m121:Number; private var m122:Number; private var m123:Number; private var m124:Number; private var m243:Number; private var m244:Number; private var m242:Number; public var sxx:Number;// = 1 public var sxy:Number;// = 0 public var sxz:Number;// = 0 public var swy:Number;// = 0 public var tz:Number;// = 0 private var m131:Number; private var m132:Number; private var m133:Number; private var m134:Number; public var syx:Number;// = 0 public var syz:Number;// = 0 public var syy:Number;// = 1 private var m141:Number; private var m142:Number; private var m143:Number; private var m144:Number; public var szx:Number;// = 0 public var szz:Number;// = 1 public var szy:Number;// = 0 private var xw:Number; public function Matrix3D(){ _position = new Number3D(); _forward = new Number3D(); _up = new Number3D(); _right = new Number3D(); super(); } public function get det():Number{ return ((((((sxx * syy) - (syx * sxy)) * szz) - (((sxx * szy) - (szx * sxy)) * syz)) + (((syx * szy) - (szx * syy)) * sxz))); } public function normalize(_arg1:Matrix3D):void{ d = Math.sqrt((((sxx * sxx) + (sxy * sxy)) + (sxz * sxz))); sxx = (sxx / d); sxy = (sxy / d); sxz = (sxz / d); d = Math.sqrt((((syx * syx) + (syy * syy)) + (syz * syz))); syx = (syx / d); syy = (syy / d); syz = (syz / d); d = Math.sqrt((((szx * szx) + (szy * szy)) + (szz * szz))); szx = (szx / d); szy = (szy / d); szz = (szz / d); } public function get right():Number3D{ _right.x = sxx; _right.y = sxy; _right.z = sxz; return (_right); } public function get position():Number3D{ _position.x = tx; _position.y = ty; _position.z = tz; return (_position); } 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 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 set up(_arg1:Number3D):void{ this.syx = _arg1.x; this.syy = _arg1.y; this.syz = _arg1.z; } public function set right(_arg1:Number3D):void{ this.sxx = _arg1.x; this.sxy = _arg1.y; this.sxz = _arg1.z; } public function multiplyVector3x3(_arg1:Number3D):void{ var _local2:Number = _arg1.x; var _local3:Number = _arg1.y; var _local4:Number = _arg1.z; _arg1.x = (((_local2 * sxx) + (_local3 * sxy)) + (_local4 * sxz)); _arg1.y = (((_local2 * syx) + (_local3 * syy)) + (_local4 * syz)); _arg1.z = (((_local2 * szx) + (_local3 * szy)) + (_local4 * szz)); } public function multiply4x3(_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; m141 = _arg1.swx; m241 = _arg2.swx; m142 = _arg1.swy; m242 = _arg2.swy; m143 = _arg1.swz; m243 = _arg2.swz; m144 = _arg1.tw; m244 = _arg2.tw; 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); swx = (((m141 * m211) + (m142 * m221)) + (m143 * m231)); swy = (((m141 * m212) + (m142 * m222)) + (m143 * m232)); swz = (((m141 * m213) + (m142 * m223)) + (m143 * m233)); tw = ((((m141 * m214) + (m142 * m224)) + (m143 * m234)) + m144); } public function multiply4x4(_arg1:Matrix3D, _arg2:Matrix3D):void{ m111 = _arg1.sxx; m211 = _arg2.sxx; m121 = _arg1.syx; m221 = _arg2.syx; m131 = _arg1.szx; m231 = _arg2.szx; m141 = _arg1.swx; m241 = _arg2.swx; m112 = _arg1.sxy; m212 = _arg2.sxy; m122 = _arg1.syy; m222 = _arg2.syy; m132 = _arg1.szy; m232 = _arg2.szy; m142 = _arg1.swy; m242 = _arg2.swy; m113 = _arg1.sxz; m213 = _arg2.sxz; m123 = _arg1.syz; m223 = _arg2.syz; m133 = _arg1.szz; m233 = _arg2.szz; m143 = _arg1.swz; m243 = _arg2.swz; m114 = _arg1.tx; m214 = _arg2.tx; m124 = _arg1.ty; m224 = _arg2.ty; m134 = _arg1.tz; m234 = _arg2.tz; m144 = _arg1.tw; m244 = _arg2.tw; sxx = ((((m111 * m211) + (m112 * m221)) + (m113 * m231)) + (m114 * m241)); sxy = ((((m111 * m212) + (m112 * m222)) + (m113 * m232)) + (m114 * m242)); sxz = ((((m111 * m213) + (m112 * m223)) + (m113 * m233)) + (m114 * m243)); tx = ((((m111 * m214) + (m112 * m224)) + (m113 * m234)) + (m114 * m244)); syx = ((((m121 * m211) + (m122 * m221)) + (m123 * m231)) + (m124 * m241)); syy = ((((m121 * m212) + (m122 * m222)) + (m123 * m232)) + (m124 * m242)); syz = ((((m121 * m213) + (m122 * m223)) + (m123 * m233)) + (m124 * m243)); ty = ((((m121 * m214) + (m122 * m224)) + (m123 * m234)) + (m124 * m244)); szx = ((((m131 * m211) + (m132 * m221)) + (m133 * m231)) + (m134 * m241)); szy = ((((m131 * m212) + (m132 * m222)) + (m133 * m232)) + (m134 * m242)); szz = ((((m131 * m213) + (m132 * m223)) + (m133 * m233)) + (m134 * m243)); tz = ((((m131 * m214) + (m132 * m224)) + (m133 * m234)) + (m134 * m244)); swx = ((((m141 * m211) + (m142 * m221)) + (m143 * m231)) + (m144 * m241)); swy = ((((m141 * m212) + (m142 * m222)) + (m143 * m232)) + (m144 * m242)); swz = ((((m141 * m213) + (m142 * m223)) + (m143 * m233)) + (m144 * m243)); tw = ((((m141 * m214) + (m142 * m224)) + (m143 * m234)) + (m144 * m244)); } public function scale(_arg1:Matrix3D, _arg2:Number, _arg3:Number, _arg4:Number):void{ sxx = (_arg1.sxx * _arg2); syx = (_arg1.syx * _arg2); szx = (_arg1.szx * _arg2); sxy = (_arg1.sxy * _arg3); syy = (_arg1.syy * _arg3); szy = (_arg1.szy * _arg3); sxz = (_arg1.sxz * _arg4); syz = (_arg1.syz * _arg4); szz = (_arg1.szz * _arg4); } public function perspectiveProjectionMatrix(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):void{ var _local5:Number = ((_arg1 / 2) * (Math.PI / 180)); var _local6:Number = Math.tan(_local5); var _local7:Number = (1 / _local6); sxx = (_local7 / _arg2); sxy = (sxz = (tx = 0)); syy = _local7; syx = (syz = (ty = 0)); szx = (szy = 0); szz = -(((_arg3 + _arg4) / (_arg3 - _arg4))); tz = (((2 * _arg4) * _arg3) / (_arg3 - _arg4)); swx = (swy = (tw = 0)); swz = 1; } 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; swx = _arg1.swx; swy = _arg1.swy; swz = _arg1.swz; tw = _arg1.tw; 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")); _local1 = (_local1 + ((((((((int((swx * 1000)) / 1000) + "\t\t") + (int((swy * 1000)) / 1000)) + "\t\t") + (int((swz * 1000)) / 1000)) + "\t\t") + (int((tw * 1000)) / 1000)) + "\n")); 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 clear():void{ tx = (sxy = (sxz = (syz = (ty = (syz = (szx = (szy = (tz = 0)))))))); sxx = (syy = (szz = 1)); } 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 get up():Number3D{ _up.x = syx; _up.y = syy; _up.z = syz; return (_up); } public function inverse4x4(_arg1:Matrix3D):void{ d = _arg1.det4x4; if (Math.abs(d) < 0.001){ return; }; d = (1 / d); m111 = _arg1.sxx; m121 = _arg1.syx; m131 = _arg1.szx; m141 = _arg1.swx; m112 = _arg1.sxy; m122 = _arg1.syy; m132 = _arg1.szy; m142 = _arg1.swy; m113 = _arg1.sxz; m123 = _arg1.syz; m133 = _arg1.szz; m143 = _arg1.swz; m114 = _arg1.tx; m124 = _arg1.ty; m134 = _arg1.tz; m144 = _arg1.tw; sxx = (d * (((m122 * ((m133 * m144) - (m143 * m134))) - (m132 * ((m123 * m144) - (m143 * m124)))) + (m142 * ((m123 * m134) - (m133 * m124))))); sxy = (-(d) * (((m112 * ((m133 * m144) - (m143 * m134))) - (m132 * ((m113 * m144) - (m143 * m114)))) + (m142 * ((m113 * m134) - (m133 * m114))))); sxz = (d * (((m112 * ((m123 * m144) - (m143 * m124))) - (m122 * ((m113 * m144) - (m143 * m114)))) + (m142 * ((m113 * m124) - (m123 * m114))))); tx = (-(d) * (((m112 * ((m123 * m134) - (m133 * m124))) - (m122 * ((m113 * m134) - (m133 * m114)))) + (m132 * ((m113 * m124) - (m123 * m114))))); syx = (-(d) * (((m121 * ((m133 * m144) - (m143 * m134))) - (m131 * ((m123 * m144) - (m143 * m124)))) + (m141 * ((m123 * m134) - (m133 * m124))))); syy = (d * (((m111 * ((m133 * m144) - (m143 * m134))) - (m131 * ((m113 * m144) - (m143 * m114)))) + (m141 * ((m113 * m134) - (m133 * m114))))); syz = (-(d) * (((m111 * ((m123 * m144) - (m143 * m124))) - (m121 * ((m113 * m144) - (m143 * m114)))) + (m141 * ((m113 * m124) - (m123 * m114))))); ty = (d * (((m111 * ((m123 * m134) - (m133 * m124))) - (m121 * ((m113 * m134) - (m133 * m114)))) + (m131 * ((m113 * m124) - (m123 * m114))))); szx = (d * (((m121 * ((m132 * m144) - (m142 * m134))) - (m131 * ((m122 * m144) - (m142 * m124)))) + (m141 * ((m122 * m134) - (m132 * m124))))); szy = (-(d) * (((m111 * ((m132 * m144) - (m142 * m134))) - (m131 * ((m112 * m144) - (m142 * m114)))) + (m141 * ((m112 * m134) - (m132 * m114))))); szz = (d * (((m111 * ((m122 * m144) - (m142 * m124))) - (m121 * ((m112 * m144) - (m142 * m114)))) + (m141 * ((m112 * m124) - (m122 * m114))))); tz = (-(d) * (((m111 * ((m122 * m134) - (m132 * m124))) - (m121 * ((m112 * m134) - (m132 * m114)))) + (m131 * ((m112 * m124) - (m122 * m114))))); swx = (-(d) * (((m121 * ((m132 * m143) - (m142 * m133))) - (m131 * ((m122 * m143) - (m142 * m123)))) + (m141 * ((m122 * m133) - (m132 * m123))))); swy = (d * (((m111 * ((m132 * m143) - (m142 * m133))) - (m131 * ((m112 * m143) - (m142 * m113)))) + (m141 * ((m112 * m133) - (m132 * m113))))); swz = (-(d) * (((m111 * ((m122 * m143) - (m142 * m123))) - (m121 * ((m112 * m143) - (m142 * m113)))) + (m141 * ((m112 * m123) - (m122 * m113))))); tw = (d * (((m111 * ((m122 * m133) - (m132 * m123))) - (m121 * ((m112 * m133) - (m132 * m113)))) + (m131 * ((m112 * m123) - (m122 * m113))))); } 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 orthographicProjectionMatrix(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number):void{ sxx = (2 / (_arg2 - _arg1)); sxy = (sxz = 0); tx = ((_arg2 + _arg1) / (_arg2 - _arg1)); syy = (2 / (_arg4 - _arg3)); syx = (syz = 0); ty = ((_arg4 + _arg3) / (_arg4 - _arg3)); szx = (szy = 0); szz = (-2 / (_arg6 - _arg5)); tz = ((_arg6 + _arg5) / (_arg6 - _arg5)); swx = (swy = (swz = 0)); tw = 1; var _local7:Matrix3D = new Matrix3D(); _local7.scaleMatrix(1, 1, -1); this.multiply(_local7, this); } 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 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 get forward():Number3D{ _forward.x = szx; _forward.y = szy; _forward.z = szz; return (_forward); } public function set forward(_arg1:Number3D):void{ this.szx = _arg1.x; this.szy = _arg1.y; this.szz = _arg1.z; } 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 compare(_arg1:Matrix3D):Boolean{ if (((((((((((((((((((((((!((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 (false); }; return (true); } public function array2matrix(_arg1:Array, _arg2:Boolean, _arg3:Number):void{ if (_arg1.length >= 12){ if (_arg2){ sxx = _arg1[0]; sxy = -(_arg1[1]); sxz = -(_arg1[2]); tx = (-(_arg1[3]) * _arg3); syx = -(_arg1[4]); syy = _arg1[5]; syz = _arg1[6]; ty = (_arg1[7] * _arg3); szx = -(_arg1[8]); szy = _arg1[9]; szz = _arg1[10]; tz = (_arg1[11] * _arg3); } else { sxx = _arg1[0]; sxz = _arg1[1]; sxy = _arg1[2]; tx = (_arg1[3] * _arg3); szx = _arg1[4]; szz = _arg1[5]; szy = _arg1[6]; tz = (_arg1[7] * _arg3); syx = _arg1[8]; syz = _arg1[9]; syy = _arg1[10]; ty = (_arg1[11] * _arg3); }; }; if (_arg1.length >= 16){ swx = _arg1[12]; swy = _arg1[13]; swz = _arg1[14]; tw = _arg1[15]; } else { swx = (swy = (swz = 0)); tw = 1; }; } public function get det4x4():Number{ return (((((((((sxx * syy) - (syx * sxy)) * ((szz * tw) - (swz * tz))) - (((sxx * szy) - (szx * sxy)) * ((syz * tw) - (swz * ty)))) + (((sxx * swy) - (swx * sxy)) * ((syz * tz) - (szz * ty)))) + (((syx * szy) - (szx * syy)) * ((sxz * tw) - (swz * tx)))) - (((syx * swy) - (swx * syy)) * ((sxz * tz) - (szz * tx)))) + (((szx * swy) - (swx * szy)) * ((sxz * ty) - (syz * tx))))); } } }//package away3d.core.math
Section 66
//Number3D (away3d.core.math.Number3D) package away3d.core.math { public final class Number3D { private const MathPI:Number = 3.14159265358979; private const toDEGREES:Number = 57.2957795130823; private var mod:Number; private var num:Number3D; private var dist:Number; private var vy:Number; private var vz:Number; private var nx:Number; private var ny:Number; private var vx:Number; private var nz:Number; private var m1:Matrix3D; private var m2:Matrix3D; public var y:Number; public var z:Number; public var x: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 interpolate(_arg1:Number3D, _arg2:Number):void{ var _local3:Number3D = new Number3D(); _local3.sub(_arg1, this); _local3.scale(_local3, _arg2); add(this, _local3); } public function quaternion2euler(_arg1:Quaternion):void{ var _local2:Number = ((_arg1.x * _arg1.y) + (_arg1.z * _arg1.w)); if (_local2 > 0.499){ x = (2 * Math.atan2(_arg1.x, _arg1.w)); y = (Math.PI / 2); z = 0; return; }; if (_local2 < -0.499){ x = (-2 * Math.atan2(_arg1.x, _arg1.w)); y = (-(Math.PI) / 2); z = 0; return; }; var _local3:Number = (_arg1.x * _arg1.x); var _local4:Number = (_arg1.y * _arg1.y); var _local5:Number = (_arg1.z * _arg1.z); x = Math.atan2((((2 * _arg1.y) * _arg1.w) - ((2 * _arg1.x) * _arg1.z)), ((1 - (2 * _local4)) - (2 * _local5))); y = Math.asin((2 * _local2)); z = Math.atan2((((2 * _arg1.x) * _arg1.w) - ((2 * _arg1.y) * _arg1.z)), ((1 - (2 * _local3)) - (2 * _local5))); } 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 getAngle(_arg1:Number3D=null):Number{ if (_arg1 == null){ _arg1 = new Number3D(); }; return (Math.acos((dot(_arg1) / (modulo * _arg1.modulo)))); } 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 add(_arg1:Number3D, _arg2:Number3D):void{ x = (_arg1.x + _arg2.x); y = (_arg1.y + _arg2.y); z = (_arg1.z + _arg2.z); } public function equals(_arg1:Number3D):Boolean{ return ((((((_arg1.x == x)) && ((_arg1.y == y)))) && ((_arg1.z == z)))); } 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 rotate(_arg1:Number3D, _arg2:Matrix3D):void{ vx = _arg1.x; vy = _arg1.y; vz = _arg1.z; x = (((vx * _arg2.sxx) + (vy * _arg2.sxy)) + (vz * _arg2.sxz)); y = (((vx * _arg2.syx) + (vy * _arg2.syy)) + (vz * _arg2.syz)); z = (((vx * _arg2.szx) + (vy * _arg2.szy)) + (vz * _arg2.szz)); } public function clone(_arg1:Number3D):void{ x = _arg1.x; y = _arg1.y; z = _arg1.z; } public function matrix2scale(_arg1:Matrix3D):void{ x = Math.sqrt((((_arg1.sxx * _arg1.sxx) + (_arg1.syx * _arg1.syx)) + (_arg1.szx * _arg1.szx))); y = Math.sqrt((((_arg1.sxy * _arg1.sxy) + (_arg1.syy * _arg1.syy)) + (_arg1.szy * _arg1.szy))); z = Math.sqrt((((_arg1.sxz * _arg1.sxz) + (_arg1.syz * _arg1.syz)) + (_arg1.szz * _arg1.szz))); } public function scale(_arg1:Number3D, _arg2:Number):void{ x = (_arg1.x * _arg2); y = (_arg1.y * _arg2); z = (_arg1.z * _arg2); } public function transform(_arg1:Number3D, _arg2:Matrix3D):void{ vx = _arg1.x; vy = _arg1.y; vz = _arg1.z; x = ((((vx * _arg2.sxx) + (vy * _arg2.sxy)) + (vz * _arg2.sxz)) + _arg2.tx); y = ((((vx * _arg2.syx) + (vy * _arg2.syy)) + (vz * _arg2.syz)) + _arg2.ty); z = ((((vx * _arg2.szx) + (vy * _arg2.szy)) + (vz * _arg2.szz)) + _arg2.tz); } public function toString():String{ return (((((("x:" + x) + " y:") + y) + " z:") + z)); } public function distance(_arg1:Number3D):Number{ return (Math.sqrt(((((x - _arg1.x) * (x - _arg1.x)) + ((y - _arg1.y) * (y - _arg1.y))) + ((z - _arg1.z) * (z - _arg1.z))))); } public function get modulo():Number{ return (Math.sqrt((((x * x) + (y * y)) + (z * z)))); } public function matrix2euler(_arg1:Matrix3D, _arg2:Number=1, _arg3:Number=1, _arg4:Number=1):void{ if (!m1){ m1 = new Matrix3D(); }; x = -(Math.atan2(_arg1.szy, _arg1.szz)); m1.rotationMatrix(1, 0, 0, x); m1.multiply(_arg1, m1); var _local5:Number = Math.sqrt(((m1.sxx * m1.sxx) + (m1.syx * m1.syx))); y = Math.atan2(-(m1.szx), _local5); z = Math.atan2(-(m1.sxy), m1.syy); if (Math.round((z / MathPI)) == 1){ if (y > 0){ y = -((y - MathPI)); } else { y = -((y + MathPI)); }; z = (z - MathPI); if (x > 0){ x = (x - MathPI); } else { x = (x + MathPI); }; } else { if (Math.round((z / MathPI)) == -1){ if (y > 0){ y = -((y - MathPI)); } else { y = -((y + MathPI)); }; z = (z + MathPI); if (x > 0){ x = (x - MathPI); } else { x = (x + MathPI); }; } else { if (Math.round((x / MathPI)) == 1){ if (y > 0){ y = -((y - MathPI)); } else { y = -((y + MathPI)); }; x = (x - MathPI); if (z > 0){ z = (z - MathPI); } else { z = (z + MathPI); }; } else { if (Math.round((x / MathPI)) == -1){ if (y > 0){ y = -((y - MathPI)); } else { y = -((y + MathPI)); }; x = (x + MathPI); if (z > 0){ z = (z - MathPI); } else { z = (z + MathPI); }; }; }; }; }; } public function get modulo2():Number{ return ((((x * x) + (y * y)) + (z * z))); } public static function getInterpolated(_arg1:Number3D, _arg2:Number3D, _arg3:Number):Number3D{ var _local4:Number3D = new (Number3D); _local4.sub(_arg1, _arg2); _local4.scale(_local4, _arg3); _local4.add(_local4, _arg2); return (_local4); } } }//package away3d.core.math
Section 67
//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 68
//ConvexBlockProjector (away3d.core.project.ConvexBlockProjector) package away3d.core.project { import flash.display.*; import away3d.containers.*; import flash.utils.*; import away3d.core.draw.*; import away3d.cameras.*; import away3d.core.utils.*; import away3d.core.base.*; import away3d.core.math.*; import away3d.materials.*; import away3d.core.block.*; import away3d.cameras.lenses.*; import away3d.blockers.*; public class ConvexBlockProjector implements IBlockerProvider, IPrimitiveProvider { private var _points:Array; private var _vertex:Vertex; private var _view:View3D; private var _camera:Camera3D; private var _screenVertex:ScreenVertex; private var _vertices:Array; private var _lens:ILens; private var _displayObject:DisplayObject; private var _convexBlock:ConvexBlock; private var _p:String; private var _s:String; private var _base:ScreenVertex; private var _vertexDictionary:Dictionary; private var _segmentMaterial:ISegmentMaterial; private var _drawPrimitiveStore:DrawPrimitiveStore; private function cross(_arg1:ScreenVertex, _arg2:ScreenVertex, _arg3:ScreenVertex):Number{ return ((((_arg2.x - _arg1.x) * (_arg3.y - _arg1.y)) - ((_arg3.x - _arg1.x) * (_arg2.y - _arg1.y)))); } public function set view(_arg1:View3D):void{ _view = _arg1; _drawPrimitiveStore = _view.drawPrimitiveStore; } public function blockers(_arg1:Object3D, _arg2:Matrix3D, _arg3:IBlockerConsumer):void{ var _local4:Array; var _local5:Number; var _local6:int; _vertexDictionary = _drawPrimitiveStore.createVertexDictionary(_arg1); _convexBlock = (_arg1 as ConvexBlock); _camera = _view.camera; _lens = _camera.lens; _vertices = _convexBlock.vertices; if (_vertices.length < 3){ return; }; _points = []; _base = null; _s = ""; _p = ""; for each (_vertex in _vertices) { _s = (_s + (_vertex.toString() + "\n")); _screenVertex = _lens.project(_arg2, _vertex); if (_base == null){ _base = _screenVertex; } else { if (_base.y > _screenVertex.y){ _base = _screenVertex; } else { if (_base.y == _screenVertex.y){ if (_base.x > _screenVertex.x){ _base = _screenVertex; }; }; }; }; _points.push(_screenVertex); _p = (_p + (_screenVertex.toString() + "\n")); }; for each (_screenVertex in _points) { _screenVertex.num = ((_screenVertex.x - _base.x) / (_screenVertex.y - _base.y)); }; _base.num = -(Infinity); _points.sortOn("num", Array.NUMERIC); _local4 = [_points[0], _points[1]]; _local6 = 2; while (_local6 < _points.length) { _local5 = cross(_local4[(_local4.length - 2)], _local4[(_local4.length - 1)], _points[_local6]); while (_local5 > 0) { _local4.pop(); if (_local4.length == 2){ break; }; _local5 = cross(_local4[(_local4.length - 2)], _local4[(_local4.length - 1)], _points[_local6]); }; _local4.push(_points[_local6]); _local6++; }; _local5 = cross(_local4[(_local4.length - 2)], _local4[(_local4.length - 1)], _local4[0]); if (_local5 > 0){ _local4.pop(); }; _arg3.blocker(_drawPrimitiveStore.createConvexBlocker(_arg1, _local4)); } public function get view():View3D{ return (_view); } public function primitives(_arg1:Object3D, _arg2:Matrix3D, _arg3:IPrimitiveConsumer):void{ _convexBlock = (_arg1 as ConvexBlock); if (_convexBlock.debug){ _arg3.primitive(_drawPrimitiveStore.blockerDictionary[_arg1]); }; } } }//package away3d.core.project
Section 69
//DirSpriteProjector (away3d.core.project.DirSpriteProjector) package away3d.core.project { import flash.display.*; import away3d.containers.*; import flash.utils.*; import away3d.core.draw.*; import away3d.core.utils.*; import away3d.core.base.*; import away3d.core.math.*; import away3d.cameras.lenses.*; import away3d.sprites.*; public class DirSpriteProjector implements IPrimitiveProvider { private var _persp:Number; private var _vertex:Vertex; private var _view:View3D; private var _screenVertex:ScreenVertex; private var _dirsprite:DirSprite2D; private var _vertices:Array; private var _lens:ILens; private var _bitmaps:Dictionary; private var _vertexDictionary:Dictionary; private var _drawPrimitiveStore:DrawPrimitiveStore; public function set view(_arg1:View3D):void{ _view = _arg1; _drawPrimitiveStore = view.drawPrimitiveStore; } public function get view():View3D{ return (_view); } public function primitives(_arg1:Object3D, _arg2:Matrix3D, _arg3:IPrimitiveConsumer):void{ var _local6:Number; _vertexDictionary = _drawPrimitiveStore.createVertexDictionary(_arg1); _dirsprite = (_arg1 as DirSprite2D); _vertices = _dirsprite.vertices; _bitmaps = _dirsprite.bitmaps; _lens = _view.camera.lens; if (_vertices.length == 0){ return; }; var _local4:Number = Infinity; var _local5:BitmapData; for each (_vertex in _vertices) { _screenVertex = _lens.project(_arg2, _vertex); _local6 = _screenVertex.z; if (_local6 < _local4){ _local4 = _local6; _local5 = _bitmaps[_vertex]; }; }; if (_local5 == null){ return; }; _screenVertex = _lens.project(_arg2, _dirsprite.center); if (!_screenVertex.visible){ return; }; _persp = (view.camera.zoom / (1 + (_screenVertex.z / view.camera.focus))); _screenVertex.z = (_screenVertex.z + _dirsprite.deltaZ); _arg3.primitive(_drawPrimitiveStore.createDrawScaledBitmap(_arg1, _screenVertex, _dirsprite.smooth, _local5, (_persp * _dirsprite.scaling), _dirsprite.rotation)); } } }//package away3d.core.project
Section 70
//DofSpriteProjector (away3d.core.project.DofSpriteProjector) package away3d.core.project { import away3d.containers.*; import flash.utils.*; import away3d.core.draw.*; import away3d.core.utils.*; import away3d.core.base.*; import away3d.core.math.*; import away3d.cameras.lenses.*; import away3d.sprites.*; public class DofSpriteProjector implements IPrimitiveProvider { private var _dofsprite:DofSprite2D; private var _view:View3D; private var _dofcache:DofCache; private var _screenVertex:ScreenVertex; private var _drawPrimitiveStore:DrawPrimitiveStore; private var _vertexDictionary:Dictionary; private var _persp:Number; private var _lens:ILens; public function get view():View3D{ return (_view); } public function set view(_arg1:View3D):void{ _view = _arg1; _drawPrimitiveStore = view.drawPrimitiveStore; } public function primitives(_arg1:Object3D, _arg2:Matrix3D, _arg3:IPrimitiveConsumer):void{ _vertexDictionary = _drawPrimitiveStore.createVertexDictionary(_arg1); _dofsprite = (_arg1 as DofSprite2D); _lens = _view.camera.lens; _screenVertex = _lens.project(_arg2, _dofsprite.center); if (!_screenVertex.visible){ return; }; _persp = (view.camera.zoom / (1 + (_screenVertex.z / view.camera.focus))); _screenVertex.z = (_screenVertex.z + _dofsprite.deltaZ); _dofcache = DofCache.getDofCache(_dofsprite.bitmap); _arg3.primitive(_drawPrimitiveStore.createDrawScaledBitmap(_arg1, _screenVertex, _dofsprite.smooth, _dofcache.getBitmap(_screenVertex.z), (_persp * _dofsprite.scaling), _dofsprite.rotation)); } } }//package away3d.core.project
Section 71
//MeshProjector (away3d.core.project.MeshProjector) package away3d.core.project { import away3d.containers.*; import flash.utils.*; import away3d.core.draw.*; import away3d.core.clip.*; import away3d.cameras.*; import away3d.core.utils.*; import away3d.core.base.*; import away3d.core.math.*; import away3d.materials.*; import away3d.cameras.lenses.*; import away3d.core.geom.*; public class MeshProjector implements IPrimitiveProvider { private var _faceMaterial:ITriangleMaterial; private var _view:View3D; private var _frustumClipping:Boolean; private var _billboardMaterial:IBillboardMaterial; private var _uvmaterial:Boolean; private var _bmaterial:IBillboardMaterial; private var _drawSegment:DrawSegment; private var _layerMaterial:ILayerMaterial; private var _smaterial:ISegmentMaterial; private var _sv1:ScreenVertex; private var _clipping:Clipping; private var _frustum:Frustum; private var _backface:Boolean; private var _clipFaceVOs:Boolean; private var _cameraVarsStore:CameraVarsStore; private var _billboards:Array; private var _uvt:UV; private var _faces:Array; private var _zoom:Number; private var _segmentMaterial:ISegmentMaterial; private var _face:Face; private var _drawPrimitiveStore:DrawPrimitiveStore; private var _n01:Face; private var _billboard:Billboard; private var _vertex:Vertex; private var _camera:Camera3D; private var _drawTriangle:DrawTriangle; private var _mesh:Mesh; private var _vt:ScreenVertex; private var _drawBillBoard:DrawBillboard; private var _clippedFaceVOs:Array; private var _n12:Face; private var _focus:Number; private var _backmat:ITriangleMaterial; private var _lens:ILens; private var _vertices:Array; private var _tri:DrawTriangle; private var _n20:Face; private var _sv2:ScreenVertex; private var _triangles:Array; private var _segment:Segment; private var _faceVO:FaceVO; private var _faceMaterialVO:FaceMaterialVO; private var _sv0:ScreenVertex; private var _segments:Array; public function get view():View3D{ return (_view); } private function front(_arg1:Face, _arg2:Matrix3D):Number{ _sv0 = _lens.project(_arg2, _arg1.v0); _sv1 = _lens.project(_arg2, _arg1.v1); _sv2 = _lens.project(_arg2, _arg1.v2); return ((((_sv0.x * (_sv2.y - _sv1.y)) + (_sv1.x * (_sv0.y - _sv2.y))) + (_sv2.x * (_sv1.y - _sv0.y)))); } public function set view(_arg1:View3D):void{ _view = _arg1; _drawPrimitiveStore = view.drawPrimitiveStore; _cameraVarsStore = view.cameraVarsStore; } public function primitives(_arg1:Object3D, _arg2:Matrix3D, _arg3:IPrimitiveConsumer):void{ _drawPrimitiveStore.createVertexDictionary(_arg1); _cameraVarsStore.createVertexClassificationDictionary(_arg1); _mesh = (_arg1 as Mesh); _vertices = _mesh.vertices; _faces = _mesh.faces; _segments = _mesh.segments; _billboards = _mesh.billboards; _camera = _view.camera; _clipping = _view.screenClipping; _lens = _camera.lens; _focus = _camera.focus; _zoom = _camera.zoom; _faceMaterial = _mesh.faceMaterial; _segmentMaterial = _mesh.segmentMaterial; _billboardMaterial = _mesh.billboardMaterial; _backmat = ((_mesh.back) || (_faceMaterial)); _clippedFaceVOs = new Array(); if (_cameraVarsStore.nodeClassificationDictionary[_arg1] == Frustum.INTERSECT){ _clipFaceVOs = true; } else { _clipFaceVOs = false; }; for each (_face in _faces) { if (!_face.visible){ } else { if (_clipFaceVOs){ _clipping.checkFace(_face.faceVO, _arg1, _clippedFaceVOs); } else { _clippedFaceVOs.push(_face.faceVO); }; }; }; for each (_faceVO in _clippedFaceVOs) { _sv0 = _lens.project(_arg2, _faceVO.v0); _sv1 = _lens.project(_arg2, _faceVO.v1); _sv2 = _lens.project(_arg2, _faceVO.v2); if (((((!(_sv0.visible)) || (!(_sv1.visible)))) || (!(_sv2.visible)))){ } else { _face = _faceVO.face; _tri = _drawPrimitiveStore.createDrawTriangle(_arg1, _faceVO, null, _sv0, _sv1, _sv2, _faceVO.uv0, _faceVO.uv1, _faceVO.uv2, _faceVO.generated); _backface = (_tri.backface = (_tri.area < 0)); if (_backface){ if (!_mesh.bothsides){ continue; }; _tri.material = _faceVO.back; if (!_tri.material){ _tri.material = _faceVO.material; }; } else { _tri.material = _faceVO.material; }; if (!_tri.material){ if (_backface){ _tri.material = _backmat; } else { _tri.material = _faceMaterial; }; }; if (((_tri.material) && (!(_tri.material.visible)))){ _tri.material = null; }; if (((!(_mesh.outline)) && (!(_tri.material)))){ } else { if (!_arg3.primitive(_tri)){ } else { if (_mesh.pushback){ _tri.screenZ = _tri.maxZ; }; if (_mesh.pushfront){ _tri.screenZ = _tri.minZ; }; _tri.screenZ = (_tri.screenZ + _mesh.screenZOffset); if (((_mesh.outline) && (!(_backface)))){ _n01 = _mesh.geometry.neighbour01(_face); if ((((_n01 == null)) || ((front(_n01, _arg2) <= 0)))){ _arg3.primitive(_drawPrimitiveStore.createDrawSegment(_arg1, _mesh.outline, _tri.v0, _tri.v1)); }; _n12 = _mesh.geometry.neighbour12(_face); if ((((_n12 == null)) || ((front(_n12, _arg2) <= 0)))){ _arg3.primitive(_drawPrimitiveStore.createDrawSegment(_arg1, _mesh.outline, _tri.v1, _tri.v2)); }; _n20 = _mesh.geometry.neighbour20(_face); if ((((_n20 == null)) || ((front(_n20, _arg2) <= 0)))){ _arg3.primitive(_drawPrimitiveStore.createDrawSegment(_arg1, _mesh.outline, _tri.v2, _tri.v0)); }; }; }; }; }; }; for each (_segment in _segments) { _sv0 = _lens.project(_arg2, _segment.v0); _sv1 = _lens.project(_arg2, _segment.v1); if (((!(_sv0.visible)) || (!(_sv1.visible)))){ } else { _smaterial = ((_segment.material) || (_segmentMaterial)); if (!_smaterial.visible){ } else { _arg3.primitive(_drawPrimitiveStore.createDrawSegment(_arg1, _smaterial, _sv0, _sv1)); }; }; }; for each (_billboard in _billboards) { if (!_billboard.visible){ } else { _sv0 = _lens.project(_arg2, _billboard.vertex); if (!_sv0.visible){ } else { _bmaterial = ((_billboard.material) || (_billboardMaterial)); if (!_bmaterial.visible){ } else { _arg3.primitive(_drawPrimitiveStore.createDrawBillboard(_arg1, _bmaterial, _sv0, _billboard.width, _billboard.height, ((_billboard.scaling * _zoom) / (1 + (_sv0.z / _focus))), _billboard.rotation)); }; }; }; }; } } }//package away3d.core.project
Section 72
//MovieClipSpriteProjector (away3d.core.project.MovieClipSpriteProjector) package away3d.core.project { import flash.display.*; import away3d.containers.*; import flash.utils.*; import away3d.core.draw.*; import away3d.core.utils.*; import away3d.core.base.*; import away3d.core.math.*; import away3d.sprites.*; public class MovieClipSpriteProjector implements IPrimitiveProvider { private var _movieclip:DisplayObject; private var _view:View3D; private var _movieClipSprite:MovieClipSprite; private var _screenVertex:ScreenVertex; private var _vertexDictionary:Dictionary; private var _persp:Number; private var _drawPrimitiveStore:DrawPrimitiveStore; public function get view():View3D{ return (_view); } public function set view(_arg1:View3D):void{ _view = _arg1; _drawPrimitiveStore = view.drawPrimitiveStore; } public function primitives(_arg1:Object3D, _arg2:Matrix3D, _arg3:IPrimitiveConsumer):void{ _vertexDictionary = _drawPrimitiveStore.createVertexDictionary(_arg1); _movieClipSprite = (_arg1 as MovieClipSprite); _movieclip = _movieClipSprite.movieclip; _screenVertex = _view.camera.lens.project(_arg2, _movieClipSprite.center); _persp = (view.camera.zoom / (1 + (_screenVertex.z / view.camera.focus))); _screenVertex.z = (_screenVertex.z + _movieClipSprite.deltaZ); if (_movieClipSprite.align != "none"){ switch (_movieClipSprite.align){ case "center": _screenVertex.x = (_screenVertex.x - (_movieclip.width / 2)); _screenVertex.y = (_screenVertex.y - (_movieclip.height / 2)); break; case "topcenter": _screenVertex.x = (_screenVertex.x - (_movieclip.width / 2)); break; case "bottomcenter": _screenVertex.x = (_screenVertex.x - (_movieclip.width / 2)); _screenVertex.y = (_screenVertex.y - _movieclip.height); break; case "right": _screenVertex.x = (_screenVertex.x - _movieclip.width); _screenVertex.y = (_screenVertex.y - (_movieclip.height / 2)); break; case "topright": _screenVertex.x = (_screenVertex.x - _movieclip.width); break; case "bottomright": _screenVertex.x = (_screenVertex.x - _movieclip.width); _screenVertex.y = (_screenVertex.y - _movieclip.height); break; case "left": _screenVertex.y = (_screenVertex.y - (_movieclip.height / 2)); break; case "topleft": break; case "bottomleft": _screenVertex.y = (_screenVertex.y - _movieclip.height); break; }; }; if (_movieClipSprite.rescale){ _movieclip.scaleX = (_movieclip.scaleY = (_persp * _movieClipSprite.scaling)); }; _arg3.primitive(_drawPrimitiveStore.createDrawDisplayObject(_arg1, _screenVertex, _movieClipSprite.session, _movieclip)); } } }//package away3d.core.project
Section 73
//ObjectContainerProjector (away3d.core.project.ObjectContainerProjector) package away3d.core.project { import away3d.containers.*; import flash.utils.*; import away3d.core.render.*; import away3d.core.draw.*; import away3d.cameras.*; import away3d.core.utils.*; import away3d.core.base.*; import away3d.core.math.*; public class ObjectContainerProjector implements IPrimitiveProvider { private var _container:ObjectContainer3D; private var _view:View3D; private var _camera:Camera3D; private var _screenVertex:ScreenVertex; private var _child:Object3D; private var _cameraViewMatrix:Matrix3D; private var _vertexDictionary:Dictionary; private var _depthPoint:Number3D; private var _drawPrimitiveStore:DrawPrimitiveStore; private var _viewTransformDictionary:Dictionary; public function ObjectContainerProjector(){ _depthPoint = new Number3D(); super(); } public function set view(_arg1:View3D):void{ _view = _arg1; _drawPrimitiveStore = view.drawPrimitiveStore; } public function get view():View3D{ return (_view); } public function primitives(_arg1:Object3D, _arg2:Matrix3D, _arg3:IPrimitiveConsumer):void{ _vertexDictionary = _drawPrimitiveStore.createVertexDictionary(_arg1); _container = (_arg1 as ObjectContainer3D); _cameraViewMatrix = _view.camera.viewMatrix; _viewTransformDictionary = _view.cameraVarsStore.viewTransformDictionary; for each (_child in _container.children) { if (((_child.ownCanvas) && (_child.visible))){ if ((_child.ownSession is SpriteRenderSession)){ (_child.ownSession as SpriteRenderSession).cacheAsBitmap = true; }; _screenVertex = _drawPrimitiveStore.createScreenVertex(_child.center); _screenVertex.x = 0; _screenVertex.y = 0; if (!isNaN(_child.ownSession.screenZ)){ _screenVertex.z = _child.ownSession.screenZ; } else { if (_child.scenePivotPoint.modulo){ _depthPoint.clone(_child.scenePivotPoint); _depthPoint.rotate(_depthPoint, _cameraViewMatrix); _depthPoint.add(_viewTransformDictionary[_child].position, _depthPoint); _screenVertex.z = _depthPoint.modulo; } else { _screenVertex.z = _viewTransformDictionary[_child].position.modulo; }; if (_child.pushback){ _screenVertex.z = (_screenVertex.z + _child.parentBoundingRadius); }; if (_child.pushfront){ _screenVertex.z = (_screenVertex.z - _child.parentBoundingRadius); }; _screenVertex.z = (_screenVertex.z + _child.screenZOffset); }; _arg3.primitive(_drawPrimitiveStore.createDrawDisplayObject(_child, _screenVertex, _container.session, _child.session.getContainer(view))); }; }; } } }//package away3d.core.project
Section 74
//ProjectorType (away3d.core.project.ProjectorType) package away3d.core.project { public class ProjectorType { public static const OBJECT_CONTAINER:String = "ObjectContainer"; public static const MOVIE_CLIP_SPRITE:String = "MovieClipSprite"; public static const DOF_SPRITE:String = "DofSprite"; public static const SPRITE:String = "Sprite"; public static const MESH:String = "Mesh"; public static const CONVEX_BLOCK:String = "ConvexBlock"; public static const DIR_SPRITE:String = "DirSprite"; } }//package away3d.core.project
Section 75
//SpriteProjector (away3d.core.project.SpriteProjector) package away3d.core.project { import away3d.containers.*; import flash.utils.*; import away3d.core.draw.*; import away3d.core.utils.*; import away3d.core.base.*; import away3d.core.math.*; import away3d.sprites.*; public class SpriteProjector implements IPrimitiveProvider { private var _view:View3D; private var _sprite:Sprite2D; private var _drawScaledBitmap:DrawScaledBitmap; private var _screenVertex:ScreenVertex; private var _vertexDictionary:Dictionary; private var _drawPrimitiveStore:DrawPrimitiveStore; public function get view():View3D{ return (_view); } public function set view(_arg1:View3D):void{ _view = _arg1; _drawPrimitiveStore = view.drawPrimitiveStore; } public function primitives(_arg1:Object3D, _arg2:Matrix3D, _arg3:IPrimitiveConsumer):void{ _vertexDictionary = _drawPrimitiveStore.createVertexDictionary(_arg1); _sprite = (_arg1 as Sprite2D); _screenVertex = _view.camera.lens.project(_arg2, _sprite.center); if (!_screenVertex.visible){ return; }; _screenVertex.z = (_screenVertex.z + _sprite.deltaZ); _arg3.primitive(_drawPrimitiveStore.createDrawScaledBitmap(_arg1, _screenVertex, _sprite.smooth, _sprite.bitmap, ((_sprite.scaling * _view.camera.zoom) / (1 + (_screenVertex.z / _view.camera.focus))), _sprite.rotation)); } } }//package away3d.core.project
Section 76
//AbstractRenderSession (away3d.core.render.AbstractRenderSession) package away3d.core.render { import flash.events.*; import flash.display.*; import away3d.containers.*; import away3d.events.*; import flash.utils.*; import away3d.core.draw.*; import away3d.core.clip.*; import away3d.core.base.*; import away3d.core.light.*; import away3d.materials.*; import flash.geom.*; public class AbstractRenderSession extends EventDispatcher { public var filters:Array; private var b2:Number; var _spriteActive:Array; private var _renderer:IPrimitiveConsumer; private var triangle:DrawTriangle; private var _shapeActives:Dictionary; private var materials:Dictionary; private var c2:Number; var _renderSource:Object3D; private var _dictionary:Dictionary; private var v0x:Number; private var v0y:Number; private var _spriteLayers:Dictionary; var _shapeActive:Array; public var layer:DisplayObject; private var _consumer:IPrimitiveConsumer; private var _session:AbstractRenderSession; private var _array:Array; var _spriteStore:Array; var _shapeStore:Array; private var a:Number; private var c:Number; private var d:Number; private var v1y:Number; private var d2:Number; private var b:Number; private var m:Matrix; protected var i:int; public var primitives:Array; private var v1x:Number; private var v2y:Number; public var alpha:Number;// = 1 private var v2x:Number; private var _shapeLayers:Dictionary; var _level:int;// = -1 var _material:IMaterial; private var _sessionupdated:SessionEvent; private var area:Number; public var priconsumers:Dictionary; private var ds:DisplayObject; private var _renderers:Dictionary; public var graphics:Graphics; private var tx:Number; private var ty:Number; public var screenZ:Number; public var sessions:Array; var _layerDirty:Boolean; var _shape:Shape; public var blendMode:String; private var _lightShapeLayer:Dictionary; private var _spriteActives:Dictionary; private var _lightShapeLayers:Dictionary; var _containers:Dictionary; private var _spriteStores:Dictionary; public var parent:AbstractRenderSession; public var updated:Boolean; private var _spriteLayer:Dictionary; private var _shapeLayer:Dictionary; private var time:int; var _sprite:Sprite; private var primitive:DrawPrimitive; private var _defaultColorTransform:ColorTransform; private var a2:Number; private var _shapeStores:Dictionary; public var consumer:IPrimitiveConsumer; public function AbstractRenderSession(){ _containers = new Dictionary(true); _shapeStores = new Dictionary(true); _shapeActives = new Dictionary(true); _spriteStores = new Dictionary(true); _spriteActives = new Dictionary(true); _spriteLayers = new Dictionary(true); _shapeLayers = new Dictionary(true); _lightShapeLayers = new Dictionary(true); _defaultColorTransform = new ColorTransform(); _renderers = new Dictionary(true); m = new Matrix(); priconsumers = new Dictionary(true); super(); } protected function createShape(_arg1:Sprite):Shape{ if (_shapeStore.length){ _shapeActive.push((_shape = _shapeStore.pop())); } else { _shapeActive.push((_shape = new Shape())); }; _arg1.addChild(_shape); _layerDirty = true; return (_shape); } public function renderFogColor(_arg1:Clipping, _arg2:int, _arg3:Number):void{ if (_layerDirty){ createLayer(); }; graphics.lineStyle(); graphics.beginFill(_arg2, _arg3); graphics.drawRect(_arg1.minX, _arg1.minY, (_arg1.maxX - _arg1.minX), (_arg1.maxY - _arg1.minY)); graphics.endFill(); } public function addChildSession(_arg1:AbstractRenderSession):void{ if (sessions.indexOf(_arg1) != -1){ return; }; sessions.push(_arg1); _arg1.addOnSessionUpdate(onSessionUpdate); _arg1.parent = this; } public function getLightShape(_arg1:ILayerMaterial, _arg2:int, _arg3:Sprite, _arg4:LightPrimitive):Shape{ if (!(_dictionary = _lightShapeLayer[_arg1])){ _dictionary = (_lightShapeLayer[_arg1] = new Dictionary(true)); }; if (!(_array = _dictionary[_arg4])){ _array = (_dictionary[_arg4] = new Array()); }; if ((((_level >= _arg2)) && (_array.length))){ _shape = _array[0]; } else { _level = _arg2; _array.unshift((_shape = createShape(_arg3))); }; return (_shape); } public function getShapeLayer(_arg1:View3D):Dictionary{ if (!_shapeLayers[_arg1]){ return ((_shapeLayers[_arg1] = new Dictionary(true))); }; return (_shapeLayers[_arg1]); } function internalAddSceneSession(_arg1:AbstractRenderSession):void{ sessions = [_arg1]; _arg1.addOnSessionUpdate(onSessionUpdate); } public function renderTriangleBitmapMask(_arg1:BitmapData, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:ScreenVertex, _arg6:ScreenVertex, _arg7:ScreenVertex, _arg8:Boolean, _arg9:Boolean, _arg10:Graphics=null):void{ if (_layerDirty){ createLayer(); }; a2 = ((v1x = _arg6.x) - (v0x = _arg5.x)); b2 = ((v1y = _arg6.y) - (v0y = _arg5.y)); c2 = ((v2x = _arg7.x) - v0x); d2 = ((v2y = _arg7.y) - v0y); m.identity(); m.scale(_arg4, _arg4); m.translate(_arg2, _arg3); if (_arg10){ _arg10.lineStyle(); _arg10.moveTo(v0x, v0y); _arg10.beginBitmapFill(_arg1, m, _arg9, ((_arg8) && (((((v0x * (d2 - b2)) - (v1x * d2)) + (v2x * b2)) > 400)))); _arg10.lineTo(v1x, v1y); _arg10.lineTo(v2x, v2y); _arg10.endFill(); } else { graphics.lineStyle(); graphics.moveTo(v0x, v0y); graphics.beginBitmapFill(_arg1, m, _arg9, ((_arg8) && (((((v0x * (d2 - b2)) - (v1x * d2)) + (v2x * b2)) > 400)))); graphics.lineTo(v1x, v1y); graphics.lineTo(v2x, v2y); graphics.endFill(); }; } function notifySessionUpdate():void{ if (!hasEventListener(SessionEvent.SESSION_UPDATED)){ return; }; if (!_sessionupdated){ _sessionupdated = new SessionEvent(SessionEvent.SESSION_UPDATED, this); }; dispatchEvent(_sessionupdated); } public function removeOnSessionUpdate(_arg1:Function):void{ removeEventListener(SessionEvent.SESSION_UPDATED, _arg1, false); } public function clearRenderers():void{ _renderers = new Dictionary(true); } public function renderTriangleColor(_arg1:int, _arg2:Number, _arg3:ScreenVertex, _arg4:ScreenVertex, _arg5:ScreenVertex, _arg6:Graphics=null):void{ if (((!(_arg6)) && (_layerDirty))){ createLayer(); }; if (_arg6){ _arg6.lineStyle(); _arg6.moveTo(_arg3.x, _arg3.y); _arg6.beginFill(_arg1, _arg2); _arg6.lineTo(_arg4.x, _arg4.y); _arg6.lineTo(_arg5.x, _arg5.y); _arg6.endFill(); } else { 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 clear(_arg1:View3D):void{ updated = ((((_arg1.updated) || (_arg1.forceUpdate))) || (_arg1.scene.updatedSessions[this])); for each (_session in sessions) { _session.clear(_arg1); }; if (updated){ _consumer = getConsumer(_arg1); _spriteLayer = getSpriteLayer(_arg1); for each (_array in _spriteLayer) { _array.length = 0; }; _shapeLayer = getShapeLayer(_arg1); for each (_array in _shapeLayer) { _array.length = 0; }; _lightShapeLayer = getLightShapeLayer(_arg1); for each (_dictionary in _lightShapeLayer) { for each (_array in _dictionary) { _array.length = 0; }; }; _level = -1; _shapeStore = getShapeStore(_arg1); _shapeActive = getShapeActive(_arg1); i = _shapeActive.length; while (i--) { _shape = _shapeActive.pop(); _shape.graphics.clear(); _shape.filters = []; _shape.blendMode = BlendMode.NORMAL; _shape.transform.colorTransform = _defaultColorTransform; _shapeStore.push(_shape); }; _spriteStore = getSpriteStore(_arg1); _spriteActive = getSpriteActive(_arg1); i = _spriteActive.length; while (i--) { _sprite = _spriteActive.pop(); _sprite.graphics.clear(); _sprite.filters = []; while (_sprite.numChildren) { _sprite.removeChildAt(0); }; _spriteStore.push(_sprite); }; _consumer.clear(_arg1); }; } public function getSpriteLayer(_arg1:View3D):Dictionary{ if (!_spriteLayers[_arg1]){ return ((_spriteLayers[_arg1] = new Dictionary(true))); }; return (_spriteLayers[_arg1]); } protected function onSessionUpdate(_arg1:SessionEvent):void{ dispatchEvent(_arg1); } 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 getConsumer(_arg1:View3D):IPrimitiveConsumer{ if (_renderers[_arg1]){ return (_renderers[_arg1]); }; if (_renderer){ return ((_renderers[_arg1] = _renderer.clone())); }; if (parent){ return ((_renderers[_arg1] = parent.getConsumer(_arg1).clone())); }; return ((_renderers[_arg1] = (_arg1.session.renderer as IPrimitiveConsumer).clone())); } public function clone():AbstractRenderSession{ throw (new Error("Not implemented")); } public function addDisplayObject(_arg1:DisplayObject):void{ throw (new Error("Not implemented")); } public function set renderer(_arg1:IPrimitiveConsumer):void{ if (_renderer == _arg1){ return; }; _renderer = _arg1; clearRenderers(); for each (_session in sessions) { _session.clearRenderers(); }; } public function removeChildSession(_arg1:AbstractRenderSession):void{ _arg1.removeOnSessionUpdate(onSessionUpdate); var _local2:int = sessions.indexOf(_arg1); if (_local2 == -1){ return; }; sessions.splice(_local2, 1); } 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 clearChildSessions():void{ for each (_session in sessions) { _session.removeOnSessionUpdate(onSessionUpdate); }; sessions = new Array(); } public function render(_arg1:View3D):void{ for each (_session in sessions) { _session.render(_arg1); }; if (updated){ (getConsumer(_arg1) as IRenderer).render(_arg1); }; } private function onObjectSessionUpdate(_arg1:Object3DEvent):void{ notifySessionUpdate(); } function internalRemoveSceneSession(_arg1:AbstractRenderSession):void{ sessions = []; _arg1.removeOnSessionUpdate(onSessionUpdate); } public function renderTriangleBitmap(_arg1:BitmapData, _arg2:Matrix, _arg3:ScreenVertex, _arg4:ScreenVertex, _arg5:ScreenVertex, _arg6:Boolean, _arg7:Boolean, _arg8:Graphics=null):void{ if (((!(_arg8)) && (_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); area = (((v0x * (d2 - b2)) - (v1x * d2)) + (v2x * b2)); if (area < 0){ area = -(area); }; if (_arg8){ _arg8.lineStyle(); _arg8.moveTo(v0x, v0y); _arg8.beginBitmapFill(_arg1, m, _arg7, ((_arg6) && ((area > 400)))); _arg8.lineTo(v1x, v1y); _arg8.lineTo(v2x, v2y); _arg8.endFill(); } else { graphics.lineStyle(); graphics.moveTo(v0x, v0y); graphics.beginBitmapFill(_arg1, m, _arg7, ((_arg6) && ((area > 400)))); graphics.lineTo(v1x, v1y); graphics.lineTo(v2x, v2y); graphics.endFill(); }; } private function getSpriteActive(_arg1:View3D):Array{ if (!_spriteActives[_arg1]){ return ((_spriteActives[_arg1] = new Array())); }; return (_spriteActives[_arg1]); } public function renderBillboardColor(_arg1:int, _arg2:Number, _arg3:DrawBillboard):void{ if (_layerDirty){ createLayer(); }; if (_arg3.rotation != 0){ graphics.beginFill(_arg1, _arg2); graphics.moveTo(_arg3.topleft.x, _arg3.topleft.y); graphics.lineTo(_arg3.topright.x, _arg3.topright.y); graphics.lineTo(_arg3.bottomright.x, _arg3.bottomright.y); graphics.lineTo(_arg3.bottomleft.x, _arg3.bottomleft.y); graphics.lineTo(_arg3.topleft.x, _arg3.topleft.y); graphics.endFill(); } else { graphics.beginFill(_arg1, _arg2); graphics.drawRect(_arg3.minX, _arg3.minY, (_arg3.maxX - _arg3.minX), (_arg3.maxY - _arg3.minY)); graphics.endFill(); }; } protected function createLayer():void{ throw (new Error("Not implemented")); } public function getLightShapeLayer(_arg1:View3D):Dictionary{ if (!_lightShapeLayers[_arg1]){ return ((_lightShapeLayers[_arg1] = new Dictionary(true))); }; return (_lightShapeLayers[_arg1]); } function internalRemoveOwnSession(_arg1:Object3D):void{ _arg1.removeEventListener(Object3DEvent.SESSION_UPDATED, onObjectSessionUpdate); } private function getShapeStore(_arg1:View3D):Array{ if (!_shapeStores[_arg1]){ return ((_shapeStores[_arg1] = new Array())); }; return (_shapeStores[_arg1]); } public function addOnSessionUpdate(_arg1:Function):void{ addEventListener(SessionEvent.SESSION_UPDATED, _arg1, false, 0, false); } public function get renderer():IPrimitiveConsumer{ return (_renderer); } public function getContainer(_arg1:View3D):DisplayObject{ 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); } private function getShapeActive(_arg1:View3D):Array{ if (!_shapeActives[_arg1]){ return ((_shapeActives[_arg1] = new Array())); }; return (_shapeActives[_arg1]); } public function getSprite(_arg1:ILayerMaterial, _arg2:int, _arg3:Sprite=null):Sprite{ if (!(_array = _spriteLayer[_arg1])){ _array = (_spriteLayer[_arg1] = new Array()); }; if (((!(_arg2)) && (!((_arg1 == _material))))){ _level = -1; _material = _arg1; }; if ((((_level >= _arg2)) && (_array.length))){ _sprite = _array[0]; } else { _level = _arg2; _array.unshift((_sprite = createSprite(_arg3))); }; return (_sprite); } 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.beginBitmapFill(_arg2, _arg3, false, _arg4); graphics.moveTo(_arg1.topleft.x, _arg1.topleft.y); 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 getTotalFaces(_arg1:View3D):int{ var _local2:int = getConsumer(_arg1).list().length; for each (_session in sessions) { _local2 = (_local2 + _session.getTotalFaces(_arg1)); }; return (_local2); } protected function createSprite(_arg1:Sprite=null):Sprite{ throw (new Error("Not implemented")); } private function getSpriteStore(_arg1:View3D):Array{ if (!_spriteStores[_arg1]){ return ((_spriteStores[_arg1] = new Array())); }; return (_spriteStores[_arg1]); } public function renderBillboardBitmap(_arg1:BitmapData, _arg2:DrawBillboard, _arg3:Boolean):void{ if (_layerDirty){ createLayer(); }; if (_arg2.rotation != 0){ graphics.beginBitmapFill(_arg1, _arg2.mapping, false, _arg3); graphics.moveTo(_arg2.topleft.x, _arg2.topleft.y); graphics.lineTo(_arg2.topright.x, _arg2.topright.y); graphics.lineTo(_arg2.bottomright.x, _arg2.bottomright.y); graphics.lineTo(_arg2.bottomleft.x, _arg2.bottomleft.y); graphics.lineTo(_arg2.topleft.x, _arg2.topleft.y); graphics.endFill(); } else { graphics.beginBitmapFill(_arg1, _arg2.mapping, false, _arg3); graphics.drawRect(_arg2.minX, _arg2.minY, (_arg2.maxX - _arg2.minX), (_arg2.maxY - _arg2.minY)); graphics.endFill(); }; } public function getShape(_arg1:ILayerMaterial, _arg2:int, _arg3:Sprite):Shape{ if (!(_array = _shapeLayer[_arg1])){ _array = (_shapeLayer[_arg1] = new Array()); }; if ((((_level >= _arg2)) && (_array.length))){ _shape = _array[0]; } else { _level = _arg2; _array.unshift((_shape = createShape(_arg3))); }; return (_shape); } function internalAddOwnSession(_arg1:Object3D):void{ _arg1.addEventListener(Object3DEvent.SESSION_UPDATED, onObjectSessionUpdate); } } }//package away3d.core.render
Section 77
//BasicRenderer (away3d.core.render.BasicRenderer) package away3d.core.render { import away3d.containers.*; import away3d.core.draw.*; import away3d.core.clip.*; import away3d.cameras.*; import away3d.core.block.*; import away3d.core.filter.*; public class BasicRenderer implements IRenderer, IPrimitiveConsumer { private var _blocker:Blocker; private var _camera:Camera3D; private var _view:View3D; private var _scene:Scene3D; private var _primitives:Array; private var _filter:IPrimitiveFilter; private var _blockers:Array; private var _primitive:DrawPrimitive; private var _screenClipping:Clipping; private var _filters:Array; public function BasicRenderer(... _args){ _primitives = []; _blockers = []; super(); _filters = _args; _filters.push(new ZSortFilter()); } public function clear(_arg1:View3D):void{ _primitives = []; _scene = _arg1.scene; _camera = _arg1.camera; _screenClipping = _arg1.screenClipping; _blockers = _arg1.blockerarray.list(); } public function render(_arg1:View3D):void{ for each (_filter in _filters) { _primitives = _filter.filter(_primitives, _scene, _camera, _screenClipping); }; for each (_primitive in _primitives) { _primitive.render(); }; } public function list():Array{ return (_primitives); } public function clone():IPrimitiveConsumer{ var _local1:BasicRenderer = new BasicRenderer(); _local1.filters = filters; return (_local1); } public function primitive(_arg1:DrawPrimitive):Boolean{ if (!_screenClipping.checkPrimitive(_arg1)){ return (false); }; for each (_blocker in _blockers) { if (_blocker.screenZ > _arg1.minZ){ } else { if (_blocker.block(_arg1)){ return (false); }; }; }; _primitives.push(_arg1); return (true); } public function toString():String{ return ((("Basic [" + _filters.join("+")) + "]")); } public function set filters(_arg1:Array):void{ _filters = _arg1; _filters.push(new ZSortFilter()); } public function get filters():Array{ return (_filters.slice(0, (_filters.length - 1))); } } }//package away3d.core.render
Section 78
//BitmapRenderSession (away3d.core.render.BitmapRenderSession) package away3d.core.render { import flash.display.*; import away3d.containers.*; import flash.utils.*; import flash.geom.*; public class BitmapRenderSession extends AbstractRenderSession { private var _bitmapContainers:Dictionary; private var _container:Sprite; private var _height:int; private var _cm:Matrix; private var _scale:Number; private var layers:Array; private var _bitmapContainer:Bitmap; private var _cx:Number; private var _cy:Number; private var _width:int; private var _layer:DisplayObject; private var mActive:Array; private var mStore:Array; private var _bitmapheight:int; private var _base:BitmapData; private var _bitmapwidth:int; public function BitmapRenderSession(_arg1:Number=2){ _bitmapContainers = new Dictionary(true); 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 clear(_arg1:View3D):void{ super.clear(_arg1); if (updated){ _base = getBitmapData(_arg1); _cx = (_bitmapContainer.x = _arg1.screenClipping.minX); _cy = (_bitmapContainer.y = _arg1.screenClipping.minY); _bitmapContainer.scaleX = _scale; _bitmapContainer.scaleY = _scale; _cm = new Matrix(); _cm.scale((1 / _scale), (1 / _scale)); _cm.translate((-(_arg1.screenClipping.minX) / _scale), (-(_arg1.screenClipping.minY) / _scale)); _base.lock(); _base.fillRect(_base.rect, 0); layers = []; _layerDirty = true; layer = null; }; if (((((filters) && (filters.length))) || (((_bitmapContainer.filters) && (_bitmapContainer.filters.length))))){ _bitmapContainer.filters = filters; }; _bitmapContainer.alpha = ((alpha) || (1)); _bitmapContainer.blendMode = ((blendMode) || (BlendMode.NORMAL)); } override public function addDisplayObject(_arg1:DisplayObject):void{ layers.push(_arg1); _arg1.visible = true; _layerDirty = true; } override protected function createSprite(_arg1:Sprite=null):Sprite{ if (_spriteStore.length){ _spriteActive.push((_sprite = _spriteStore.pop())); } else { _spriteActive.push((_sprite = new Sprite())); }; if (_arg1){ _arg1.addChild(_sprite); } else { layers.push(_sprite); }; _layerDirty = true; return (_sprite); } override public function getContainer(_arg1:View3D):DisplayObject{ _bitmapContainer = getBitmapContainer(_arg1); if (!_containers[_arg1]){ _container = (_containers[_arg1] = new Sprite()); _container.addChild(_bitmapContainer); return (_container); }; return (_containers[_arg1]); } override public function render(_arg1:View3D):void{ super.render(_arg1); if (updated){ for each (_layer in layers) { _base.draw(_layer, _cm, _layer.transform.colorTransform, _layer.blendMode, _base.rect); }; _base.unlock(); }; } public function getBitmapContainer(_arg1:View3D):Bitmap{ if (!_bitmapContainers[_arg1]){ return ((_bitmapContainers[_arg1] = new Bitmap())); }; return (_bitmapContainers[_arg1]); } override public function clone():AbstractRenderSession{ return (new BitmapRenderSession(_scale)); } public function getBitmapData(_arg1:View3D):BitmapData{ _container = (getContainer(_arg1) as Sprite); if (!_bitmapContainer.bitmapData){ _bitmapwidth = int(((_width = (_arg1.screenClipping.maxX - _arg1.screenClipping.minX)) / _scale)); _bitmapheight = int(((_height = (_arg1.screenClipping.maxY - _arg1.screenClipping.minY)) / _scale)); return ((_bitmapContainer.bitmapData = new BitmapData(_bitmapwidth, _bitmapheight, true, 0))); }; return (_bitmapContainer.bitmapData); } override protected function createLayer():void{ if (_shapeStore.length){ _shapeActive.push((_shape = _shapeStore.pop())); } else { _shapeActive.push((_shape = new Shape())); }; layer = _shape; graphics = _shape.graphics; layers.push(_shape); _layerDirty = false; } } }//package away3d.core.render
Section 79
//IRenderer (away3d.core.render.IRenderer) package away3d.core.render { import away3d.containers.*; public interface IRenderer { function toString():String; function render(_arg1:View3D):void; } }//package away3d.core.render
Section 80
//SpriteRenderSession (away3d.core.render.SpriteRenderSession) package away3d.core.render { import flash.display.*; import away3d.containers.*; import away3d.events.*; import flash.utils.*; import away3d.core.clip.*; import flash.geom.*; public class SpriteRenderSession extends AbstractRenderSession { private var _container:Sprite; public var cacheAsBitmap:Boolean; private var _clip:Clipping; public function SpriteRenderSession():void{ } override protected function onSessionUpdate(_arg1:SessionEvent):void{ super.onSessionUpdate(_arg1); cacheAsBitmap = false; } override protected function createSprite(_arg1:Sprite=null):Sprite{ if (_spriteStore.length){ _spriteActive.push((_sprite = _spriteStore.pop())); } else { _spriteActive.push((_sprite = new Sprite())); }; if (_arg1){ _arg1.addChild(_sprite); } else { _container.addChild(_sprite); }; _layerDirty = true; return (_sprite); } override public function addDisplayObject(_arg1:DisplayObject):void{ _container.addChild(_arg1); _arg1.visible = true; layer = null; _level = -1; _layerDirty = true; } override public function getContainer(_arg1:View3D):DisplayObject{ if (!_containers[_arg1]){ return ((_containers[_arg1] = new Sprite())); }; return (_containers[_arg1]); } override public function clear(_arg1:View3D):void{ super.clear(_arg1); _container = (getContainer(_arg1) as Sprite); if (updated){ layer = _container; graphics = _container.graphics; if (this == _arg1.session){ _clip = _arg1.screenClipping; _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); }; _container.cacheAsBitmap = false; graphics.clear(); while (_container.numChildren) { _container.removeChildAt(0); }; } else { _container.cacheAsBitmap = cacheAsBitmap; }; if (((((filters) && (filters.length))) || (((_container.filters) && (_container.filters.length))))){ _container.filters = filters; }; _container.alpha = alpha; _container.blendMode = ((blendMode) || (BlendMode.NORMAL)); } override protected function createLayer():void{ if (_shapeStore.length){ _shapeActive.push((_shape = _shapeStore.pop())); } else { _shapeActive.push((_shape = new Shape())); }; layer = _shape; graphics = _shape.graphics; _container.addChild(_shape); _layerDirty = false; _level = -1; } override public function clone():AbstractRenderSession{ return (new SpriteRenderSession()); } } }//package away3d.core.render
Section 81
//Logo (away3d.core.stats.Logo) package away3d.core.stats { import flash.display.*; public class Logo extends Shape { private var arr:Array; public function Logo(){ arr = [[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]]; super(); graphics.beginFill(0); graphics.drawRect(0, 0, 18, 17); var _local1:int = arr.length; var _local2:int; while (_local2 < _local1) { graphics.beginFill(Number(arr[_local2][2])); graphics.drawRect(arr[_local2][0], arr[_local2][1], 1, 1); _local2++; }; graphics.endFill(); } } }//package away3d.core.stats
Section 82
//StaticTextField (away3d.core.stats.StaticTextField) package away3d.core.stats { import flash.text.*; public class StaticTextField extends TextField { public var defaultText:String; public function StaticTextField(_arg1:String=null, _arg2:TextFormat=null){ defaultTextFormat = (_arg2) ? _arg2 : new TextFormat("Verdana", 10, 0); selectable = false; mouseEnabled = false; mouseWheelEnabled = false; autoSize = "left"; tabEnabled = false; if (_arg1){ this.htmlText = _arg1; }; } } }//package away3d.core.stats
Section 83
//Stats (away3d.core.stats.Stats) package away3d.core.stats { import flash.events.*; import flash.display.*; import away3d.containers.*; import flash.utils.*; import away3d.cameras.*; import away3d.core.base.*; import flash.geom.*; import flash.text.*; import flash.net.*; import flash.system.*; import flash.ui.*; public class Stats extends Sprite { private const APPLICATION_NAME:String = "Away3D.com"; private const VERSION:String = "2"; private const REVISION:String = "3.3"; private var meshLabel:StaticTextField; private var bar:Sprite; private var barscale:int;// = 0 private var swfframerateLabel:StaticTextField; private var cambtn:Sprite; private var geomDetailsLabel:TextField; public var displayMenu:Sprite;// = null var type:String; private var defautTF:TextFormat; private var geomLastAdded:String; public var sourceURL:String; private var peakLabel:StaticTextField; private var totalElements:int;// = 0 private var faceRenderLabel:StaticTextField; private var meshes:int;// = 0 private var camLabel:TextField; private var closebtn:Sprite; var url:String; private var rectcam:Rectangle; private var defautTFBold:TextFormat; private var ramLabel:StaticTextField; private var bestfps:int;// = 0 private var titleField:StaticTextField; private var fpsLabel:StaticTextField; private var stageframerate:Number; private var perfLabel:StaticTextField; private var barwidth:int;// = 0 private var rectclose:Rectangle; private var faceLabel:StaticTextField; public var stats:String;// = "" private var geombtn:Sprite; var elementcount:int; private var lastrender:int; private var menu0:ContextMenuItem; private var menu1:ContextMenuItem; private var menu2:ContextMenuItem; public var geomMenu:Sprite;// = null private var avfpsLabel:StaticTextField; private var refreshes:int;// = 0 private var camMenu:Sprite; private var camProp:Array; public var scopeMenu:View3D;// = null private var rectclear:Rectangle; 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); defautTFBold = new TextFormat("Verdana", 10, 0, true); super(); scopeMenu = _arg1; stageframerate = (_arg2) ? _arg2 : 30; displayState = 0; sourceURL = _arg1.sourceURL; tabEnabled = false; 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); var _local3:ContextMenu = new ContextMenu(); _local3 = new ContextMenu(); _local3.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); _local3.hideBuiltInItems(); scopeMenu.contextMenu = _local3; } 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 = ""; totalElements = 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.multiline = true; camLabel.selectable = false; 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:Mesh):void{ type = _arg1.type; elementcount = _arg1.elements.length; url = _arg1.url; if (((!((type == null))) && (!((elementcount == 0))))){ stats = (stats + ((((((" - " + type) + " , elements: ") + elementcount) + ", url: ") + url) + "\n")); geomLastAdded = ((((((" - " + type) + " , elements: ") + elementcount) + ", url: ") + url) + "\n"); totalElements = (totalElements + elementcount); 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 = ("" + totalElements); 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; }; }; }; } 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 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 StaticTextField("AWAY3D PROJECT", new TextFormat("Verdana", 10, 0xFFFFFF, true)); titleField.height = 20; titleField.width = 140; titleField.x = 22; titleField.y = 4; displayMenu.addChild(titleField); var _local6:StaticTextField = new StaticTextField("FPS:", defautTFBold); fpsLabel = new StaticTextField(); displayMenu.addChild(_local6); displayMenu.addChild(fpsLabel); _local6.x = 3; _local6.y = (fpsLabel.y = 30); fpsLabel.x = ((_local6.x + _local6.width) - 2); var _local7:StaticTextField = new StaticTextField("AFPS:", defautTFBold); avfpsLabel = new StaticTextField(); displayMenu.addChild(_local7); displayMenu.addChild(avfpsLabel); _local7.x = 52; _local7.y = (avfpsLabel.y = fpsLabel.y); avfpsLabel.x = ((_local7.x + _local7.width) - 2); var _local8:StaticTextField = new StaticTextField("Max:", defautTFBold); peakLabel = new StaticTextField(); 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:StaticTextField = new StaticTextField("MS:", defautTFBold); perfLabel = new StaticTextField(); 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:StaticTextField = new StaticTextField("RAM:", defautTFBold); ramLabel = new StaticTextField(); 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:StaticTextField = new StaticTextField("MESHES:", defautTFBold); meshLabel = new StaticTextField(); 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:StaticTextField = new StaticTextField("SWF FR:", defautTFBold); swfframerateLabel = new StaticTextField(); 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:StaticTextField = new StaticTextField("T ELEMENTS:", defautTFBold); faceLabel = new StaticTextField(); 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:StaticTextField = new StaticTextField("R ELEMENTS:", defautTFBold); faceRenderLabel = new StaticTextField(); displayMenu.addChild(_local14); displayMenu.addChild(faceRenderLabel); _local14.x = 115; _local14.y = (faceRenderLabel.y = faceLabel.y); _local14.autoSize = "left"; faceRenderLabel.x = ((_local14.x + _local14.width) - 2); } public function addSourceURL(_arg1:String):void{ sourceURL = _arg1; var _local2:ContextMenu = new ContextMenu(); _local2.customItems = (sourceURL) ? [menu0, menu1, menu2] : [menu0, menu2]; scopeMenu.contextMenu = _local2; } 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 { if (displayMenu.mouseY <= 20){ 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:Shape = new Logo(); displayMenu.addChild(_local1); _local1.x = (_local1.y = 4); } public function displayStats(_arg1:ContextMenuEvent=null):void{ if (!displayMenu){ scopeMenu.statsOpen = true; generateSprite(); addEventMouse(); }; } } }//package away3d.core.stats
Section 84
//LightTraverser (away3d.core.traverse.LightTraverser) package away3d.core.traverse { import away3d.core.base.*; import away3d.core.light.*; public class LightTraverser extends Traverser { override public function match(_arg1:Object3D):Boolean{ if (!_arg1.visible){ return (false); }; return (true); } override public function apply(_arg1:Object3D):void{ if (_arg1.ownLights){ _arg1.lightarray.clear(); }; if ((_arg1 is ILightProvider)){ (_arg1 as ILightProvider).light(_arg1.parent.lightarray); }; } } }//package away3d.core.traverse
Section 85
//PrimitiveTraverser (away3d.core.traverse.PrimitiveTraverser) package away3d.core.traverse { import away3d.containers.*; import flash.utils.*; import away3d.core.render.*; import away3d.core.draw.*; import away3d.core.clip.*; import away3d.core.utils.*; import away3d.core.base.*; import away3d.core.math.*; import away3d.core.light.*; import away3d.materials.*; import away3d.core.geom.*; import away3d.core.project.*; public class PrimitiveTraverser extends Traverser { private var _view:View3D; private var _viewTransform:Matrix3D; private var _consumer:IPrimitiveConsumer; private var _light:ILightProvider; private var _mouseEnableds:Array; private var _clipping:Clipping; private var _nodeClassification:int; private var _cameraVarsStore:CameraVarsStore; private var _projectorDictionary:Dictionary; private var _mouseEnabled:Boolean; public function PrimitiveTraverser(){ _projectorDictionary = new Dictionary(true); super(); } override public function match(_arg1:Object3D):Boolean{ _clipping = _view.clipping; if (((!(_arg1.visible)) || (((_clipping.objectCulling) && (!(_cameraVarsStore.nodeClassificationDictionary[_arg1])))))){ return (false); }; if ((_arg1 is ILODObject)){ return ((_arg1 as ILODObject).matchLOD(_view.camera)); }; return (true); } public function set view(_arg1:View3D):void{ _view = _arg1; _mouseEnabled = true; _mouseEnableds = []; _cameraVarsStore = _view.cameraVarsStore; _projectorDictionary[ProjectorType.CONVEX_BLOCK] = _view._convexBlockProjector; _projectorDictionary[ProjectorType.DIR_SPRITE] = _view._dirSpriteProjector; _projectorDictionary[ProjectorType.DOF_SPRITE] = _view._dofSpriteProjector; _projectorDictionary[ProjectorType.MESH] = _view._meshProjector; _projectorDictionary[ProjectorType.MOVIE_CLIP_SPRITE] = _view._movieClipSpriteProjector; _projectorDictionary[ProjectorType.OBJECT_CONTAINER] = _view._objectContainerProjector; _projectorDictionary[ProjectorType.SPRITE] = _view._spriteProjector; } override public function enter(_arg1:Object3D):void{ _mouseEnableds.push(_mouseEnabled); } public function get view():View3D{ return (_view); } override public function apply(_arg1:Object3D):void{ if (_arg1.session.updated){ _viewTransform = _cameraVarsStore.viewTransformDictionary[_arg1]; _consumer = _arg1.session.getConsumer(_view); if (_arg1.projectorType){ (_projectorDictionary[_arg1.projectorType] as IPrimitiveProvider).primitives(_arg1, _viewTransform, _consumer); }; if (((_arg1.debugbb) && (_arg1.debugBoundingBox.visible))){ _arg1.debugBoundingBox._session = _arg1.session; if (_clipping.objectCulling){ _cameraVarsStore.frustumDictionary[_arg1.debugBoundingBox] = _cameraVarsStore.frustumDictionary[_arg1]; _nodeClassification = _cameraVarsStore.nodeClassificationDictionary[_arg1]; if (_nodeClassification == Frustum.INTERSECT){ (_arg1.debugBoundingBox.material as WireframeMaterial).color = 0xFF0000; } else { (_arg1.debugBoundingBox.material as WireframeMaterial).color = 0x333333; }; }; _view._meshProjector.primitives(_arg1.debugBoundingBox, _viewTransform, _consumer); }; if (((_arg1.debugbs) && (_arg1.debugBoundingSphere.visible))){ _arg1.debugBoundingSphere._session = _arg1.session; if (_clipping.objectCulling){ _cameraVarsStore.frustumDictionary[_arg1.debugBoundingSphere] = _cameraVarsStore.frustumDictionary[_arg1]; _nodeClassification = _cameraVarsStore.nodeClassificationDictionary[_arg1]; if (_nodeClassification == Frustum.INTERSECT){ (_arg1.debugBoundingSphere.material as WireframeMaterial).color = 0xFF0000; } else { (_arg1.debugBoundingSphere.material as WireframeMaterial).color = 0xFFFF; }; }; _view._meshProjector.primitives(_arg1.debugBoundingSphere, _viewTransform, _consumer); }; if ((_arg1 is ILightProvider)){ _light = (_arg1 as ILightProvider); if (_light.debug){ _light.debugPrimitive._session = _arg1.session; if (_clipping.objectCulling){ _cameraVarsStore.frustumDictionary[_light.debugPrimitive] = _cameraVarsStore.frustumDictionary[_light]; }; _view._meshProjector.primitives(_light.debugPrimitive, _viewTransform, _consumer); }; }; }; _mouseEnabled = (_arg1._mouseEnabled = ((_mouseEnabled) && (_arg1.mouseEnabled))); } override public function leave(_arg1:Object3D):void{ _mouseEnabled = _mouseEnableds.pop(); } } }//package away3d.core.traverse
Section 86
//ProjectionTraverser (away3d.core.traverse.ProjectionTraverser) package away3d.core.traverse { import away3d.containers.*; import away3d.core.clip.*; import away3d.cameras.*; import away3d.core.utils.*; import away3d.core.base.*; import away3d.core.math.*; import away3d.cameras.lenses.*; import away3d.core.geom.*; import away3d.core.project.*; public class ProjectionTraverser extends Traverser { private var _view:View3D; private var _camera:Camera3D; private var _mesh:Mesh; private var _viewTransform:Matrix3D; private var _lens:ILens; private var _clipping:Clipping; private var _frustum:Frustum; private var _nodeClassification:int; private var _cameraViewMatrix:Matrix3D; private var _cameraVarsStore:CameraVarsStore; override public function match(_arg1:Object3D):Boolean{ if (!_arg1.visible){ return (false); }; _viewTransform = _cameraVarsStore.createViewTransform(_arg1); _viewTransform.multiply(_cameraViewMatrix, _arg1.sceneTransform); if (_clipping.objectCulling){ _frustum = _lens.getFrustum(_arg1, _viewTransform); if ((((_arg1 is Scene3D)) || ((_cameraVarsStore.nodeClassificationDictionary[_arg1.parent] == Frustum.INTERSECT)))){ if (_arg1.pivotZero){ _nodeClassification = (_cameraVarsStore.nodeClassificationDictionary[_arg1] = _frustum.classifyRadius(_arg1.boundingRadius)); } else { _nodeClassification = (_cameraVarsStore.nodeClassificationDictionary[_arg1] = _frustum.classifySphere(_arg1.pivotPoint, _arg1.boundingRadius)); }; } else { _nodeClassification = (_cameraVarsStore.nodeClassificationDictionary[_arg1] = _cameraVarsStore.nodeClassificationDictionary[_arg1.parent]); }; if (_nodeClassification == Frustum.OUT){ _arg1.updateObject(); return (false); }; }; if ((_arg1 is ILODObject)){ return ((_arg1 as ILODObject).matchLOD(_camera)); }; return (true); } public function set view(_arg1:View3D):void{ _view = _arg1; _cameraVarsStore = _arg1.cameraVarsStore; _clipping = _arg1.clipping; _camera = _arg1.camera; _lens = _camera.lens; _cameraViewMatrix = _camera.viewMatrix; if (_arg1.statsOpen){ _arg1.statsPanel.clearObjects(); }; } override public function enter(_arg1:Object3D):void{ if (((_view.statsOpen) && ((_arg1 is Mesh)))){ _view.statsPanel.addObject((_arg1 as Mesh)); }; } public function get view():View3D{ return (_view); } override public function apply(_arg1:Object3D):void{ if (_arg1.projectorType == ProjectorType.CONVEX_BLOCK){ _view.blockers[_arg1] = _arg1; }; if ((_mesh = (_arg1 as Mesh))){ if (!_view.scene.meshes[_arg1]){ _view.scene.meshes[_arg1] = []; }; _view.scene.meshes[_arg1].push(_view); _view.scene.geometries[_mesh.geometry] = _mesh.geometry; }; } override public function leave(_arg1:Object3D):void{ _arg1.updateObject(); } } }//package away3d.core.traverse
Section 87
//SessionTraverser (away3d.core.traverse.SessionTraverser) package away3d.core.traverse { import away3d.core.base.*; public class SessionTraverser extends Traverser { override public function match(_arg1:Object3D):Boolean{ if (!_arg1.visible){ return (false); }; return (true); } override public function apply(_arg1:Object3D):void{ _arg1.updateSession(); } } }//package away3d.core.traverse
Section 88
//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 89
//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 90
//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 91
//CameraVarsStore (away3d.core.utils.CameraVarsStore) package away3d.core.utils { import away3d.containers.*; import flash.utils.*; import away3d.core.render.*; import away3d.core.base.*; import away3d.core.math.*; import away3d.materials.*; import away3d.core.geom.*; public class CameraVarsStore { private var _uvStore:Array; private var _vtStore:Array; public var frustumDictionary:Dictionary; private var _frustum:Frustum; public var view:View3D; private var _vStore:Array; private var _frStore:Array; public var viewTransformDictionary:Dictionary; public var nodeClassificationDictionary:Dictionary; private var _uv:UV; private var _vertex:Vertex; private var _fStore:Array; private var _vtActive:Array; private var _vc:VertexClassification; private var _fActive:Array; private var _frActive:Array; private var _source:Object3D; private var _session:AbstractRenderSession; private var _vt:Matrix3D; private var _object:Object; private var _vActive:Array; private var _vcArray:Array; private var _sourceDictionary:Dictionary; private var _faceVO:FaceVO; private var _uvDictionary:Dictionary; private var _v:Object; private var _uvArray:Array; private var _vcStore:Array; private var _vertexClassificationDictionary:Dictionary; public function CameraVarsStore(){ _sourceDictionary = new Dictionary(true); _vtActive = new Array(); _vtStore = new Array(); _frActive = new Array(); _frStore = new Array(); _vActive = new Array(); _vStore = new Array(); _vcStore = new Array(); _uvDictionary = new Dictionary(true); _uvStore = new Array(); _fActive = new Array(); _fStore = new Array(); viewTransformDictionary = new Dictionary(true); frustumDictionary = new Dictionary(true); super(); } public function createFaceVO(_arg1:Face, _arg2:Vertex, _arg3:Vertex, _arg4:Vertex, _arg5:ITriangleMaterial, _arg6:ITriangleMaterial, _arg7:UV, _arg8:UV, _arg9:UV):FaceVO{ if (_fStore.length){ _fActive.push((_faceVO = _fStore.pop())); } else { _fActive.push((_faceVO = new FaceVO())); }; _faceVO.face = _arg1; _faceVO.v0 = _arg2; _faceVO.v1 = _arg3; _faceVO.v2 = _arg4; _faceVO.uv0 = _arg7; _faceVO.uv1 = _arg8; _faceVO.uv2 = _arg9; _faceVO.material = _arg5; _faceVO.back = _arg6; _faceVO.generated = true; return (_faceVO); } public function createVertexClassificationDictionary(_arg1:Object3D):Dictionary{ if (!(_vertexClassificationDictionary = _sourceDictionary[_arg1])){ _vertexClassificationDictionary = (_sourceDictionary[_arg1] = new Dictionary(true)); }; return (_vertexClassificationDictionary); } public function createUV(_arg1:Number, _arg2:Number, _arg3:AbstractRenderSession):UV{ if (!(_uvArray = _uvDictionary[_arg3])){ _uvArray = (_uvDictionary[_arg3] = []); }; if (_uvStore.length){ _uvArray.push((_uv = _uvStore.pop())); _uv.u = _arg1; _uv.v = _arg2; } else { _uvArray.push((_uv = new UV(_arg1, _arg2))); }; return (_uv); } public function createViewTransform(_arg1:Object3D):Matrix3D{ if (_vtStore.length){ _vtActive.push((_vt = (viewTransformDictionary[_arg1] = _vtStore.pop()))); } else { _vtActive.push((_vt = (viewTransformDictionary[_arg1] = new Matrix3D()))); }; return (_vt); } public function createVertex(_arg1:Number, _arg2:Number, _arg3:Number):Vertex{ if (_vStore.length){ _vActive.push((_vertex = _vStore.pop())); _vertex.x = _arg1; _vertex.y = _arg2; _vertex.z = _arg3; } else { _vActive.push((_vertex = new Vertex(_arg1, _arg2, _arg3))); }; return (_vertex); } public function reset():void{ for (_object in _sourceDictionary) { _source = (_object as Object3D); if (((_source.session) && (_source.session.updated))){ for (_v in _sourceDictionary[_source]) { _vcStore.push(_sourceDictionary[_source][_v]); delete _sourceDictionary[_source][_v]; }; }; }; nodeClassificationDictionary = new Dictionary(true); _vtStore = _vtStore.concat(_vtActive); _vtActive = new Array(); _frStore = _frStore.concat(_frActive); _frActive = new Array(); _vStore = _vStore.concat(_vActive); _vActive = new Array(); for (_object in _uvDictionary) { _session = (_object as AbstractRenderSession); if (_session.updated){ _uvStore = _uvStore.concat((_uvDictionary[_session] as Array)); _uvDictionary[_session] = []; }; }; _fStore = _fStore.concat(_fActive); _fActive = new Array(); } public function createVertexClassification(_arg1:Vertex):VertexClassification{ if ((_vc = _vertexClassificationDictionary[_arg1])){ return (_vc); }; if (_vcStore.length){ _vc = (_vertexClassificationDictionary[_arg1] = _vcStore.pop()); } else { _vc = (_vertexClassificationDictionary[_arg1] = new VertexClassification()); }; _vc.vertex = _arg1; _vc.plane = null; return (_vc); } public function createFrustum(_arg1:Object3D):Frustum{ if (_frStore.length){ _frActive.push((_frustum = (frustumDictionary[_arg1] = _frStore.pop()))); } else { _frActive.push((_frustum = (frustumDictionary[_arg1] = new Frustum()))); }; return (_frustum); } } }//package away3d.core.utils
Section 92
//Cast (away3d.core.utils.Cast) package away3d.core.utils { import flash.display.*; import flash.utils.*; import away3d.materials.*; import flash.geom.*; 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):IMaterial{ 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 (0xFFFFFF); } 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 93
//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 94
//Color (away3d.core.utils.Color) package away3d.core.utils { public class Color { public static const green:int = 0xFF00; public static const cyan:int = 0xFFFF; public static const white:int = 0xFFFFFF; public static const red:int = 0xFF0000; public static const blue:int = 0xFF; public static const yellow:int = 0xFFFF00; public static const purple:int = 0xFF00FF; public static const black:int = 0; public static function inverseAdd(_arg1:int, _arg2:int):int{ var _local3 = ((0xFF - _arg1) & (0xFF0000 >> 16)); var _local4 = ((0xFF - _arg1) & (0xFF00 >> 8)); var _local5 = ((0xFF - _arg1) & 0xFF); var _local6 = ((0xFF - _arg2) & (0xFF0000 >> 16)); var _local7 = ((0xFF - _arg2) & (0xFF00 >> 8)); var _local8 = ((0xFF - _arg2) & 0xFF); return (fromIntsCheck((0xFF - (_local3 + _local6)), (0xFF - (_local4 + _local7)), (0xFF - (_local5 + _local8)))); } public static function add(_arg1:int, _arg2:int):int{ var _local3 = (_arg1 & (0xFF0000 >> 16)); var _local4 = (_arg1 & (0xFF00 >> 8)); var _local5 = (_arg1 & 0xFF); var _local6 = (_arg2 & (0xFF0000 >> 16)); var _local7 = (_arg2 & (0xFF00 >> 8)); var _local8 = (_arg2 & 0xFF); return (fromIntsCheck((_local3 + _local6), (_local4 + _local7), (_local5 + _local8))); } public static function multiply(_arg1:int, _arg2:Number):int{ var _local3 = (_arg1 & (0xFF0000 >> 16)); var _local4 = (_arg1 & (0xFF00 >> 8)); var _local5 = (_arg1 & 0xFF); return (fromIntsCheck(int((_local3 * _arg2)), int((_local4 * _arg2)), int((_local5 * _arg2)))); } public static function fromIntsCheck(_arg1:int, _arg2:int, _arg3:int):int{ _arg1 = Math.max(0, Math.min(0xFF, _arg1)); _arg2 = Math.max(0, Math.min(0xFF, _arg2)); _arg3 = Math.max(0, Math.min(0xFF, _arg3)); return ((((65536 * _arg1) + (0x0100 * _arg2)) + _arg3)); } public static function fromFloats(_arg1:Number, _arg2:Number, _arg3:Number):int{ return ((((65536 * int((_arg1 * 0xFF))) + (0x0100 * int((_arg2 * 0xFF)))) + int((_arg3 * 0xFF)))); } public static function fromInts(_arg1:int, _arg2:int, _arg3:int):int{ return ((((65536 * _arg1) + (0x0100 * _arg2)) + _arg3)); } public static function fromHSV(_arg1:Number, _arg2:Number, _arg3:Number):int{ var _local4:Number = (((_arg1 % 360) + 360) % 360); var _local5:Number = _arg2; var _local6:Number = _arg3; var _local7:int = (int((_local4 / 60)) % 6); var _local8:Number = ((_local4 / 60) - _local7); var _local9:Number = (_local6 * (1 - _local5)); var _local10:Number = (_local6 * (1 - (_local8 * _local5))); var _local11:Number = (_local6 * (1 - ((1 - _local8) * _local5))); switch (_local7){ case 0: return (fromFloats(_local6, _local11, _local9)); case 1: return (fromFloats(_local10, _local6, _local9)); case 2: return (fromFloats(_local9, _local6, _local11)); case 3: return (fromFloats(_local9, _local10, _local6)); case 4: return (fromFloats(_local11, _local9, _local6)); case 5: return (fromFloats(_local6, _local9, _local10)); }; return (0); } } }//package away3d.core.utils
Section 95
//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{ if (active){ 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)); } } this.dotrace = function (_arg1:Object):void{ trace(_arg1); }; }//package away3d.core.utils private const dotrace:Function;
Section 96
//DofCache (away3d.core.utils.DofCache) package away3d.core.utils { import flash.display.*; import flash.utils.*; import flash.filters.*; import flash.geom.*; 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 97
//DrawPrimitiveStore (away3d.core.utils.DrawPrimitiveStore) package away3d.core.utils { import flash.display.*; import away3d.containers.*; import flash.utils.*; import away3d.core.render.*; import away3d.core.draw.*; import away3d.core.base.*; import away3d.materials.*; import away3d.core.block.*; public class DrawPrimitiveStore { private var _sv:ScreenVertex; private var _cbStore:Array; private var _sbArray:Array; private var _dbDictionary:Dictionary; private var _seg:DrawSegment; private var _sbStore:Array; private var _cblocker:ConvexBlocker; private var _sbitmap:DrawScaledBitmap; private var _sbDictionary:Dictionary; private var _dtDictionary:Dictionary; public var blockerDictionary:Dictionary; private var _cbDictionary:Dictionary; private var _vertexDictionary:Dictionary; private var _source:Object3D; private var _dbArray:Array; private var _vertex:Object; private var _dbStore:Array; public var view:View3D; private var _dsArray:Array; private var _dsStore:Array; private var _doArray:Array; private var _session:AbstractRenderSession; private var _object:Object; private var _dsDictionary:Dictionary; private var _bill:DrawBillboard; private var _doDictionary:Dictionary; private var _dtArray:Array; private var _dobject:DrawDisplayObject; private var _tri:DrawTriangle; private var _doStore:Array; private var _sourceDictionary:Dictionary; private var _dtStore:Array; private var _cbArray:Array; private var _svStore:Array; public function DrawPrimitiveStore(){ _sourceDictionary = new Dictionary(true); _svStore = new Array(); _dtDictionary = new Dictionary(true); _dtStore = new Array(); _dsDictionary = new Dictionary(true); _dsStore = new Array(); _dbDictionary = new Dictionary(true); _dbStore = new Array(); _cbDictionary = new Dictionary(true); _cbStore = new Array(); _sbDictionary = new Dictionary(true); _sbStore = new Array(); _doDictionary = new Dictionary(true); _doStore = new Array(); super(); } public function createDrawTriangle(_arg1:Object3D, _arg2:FaceVO, _arg3:ITriangleMaterial, _arg4:ScreenVertex, _arg5:ScreenVertex, _arg6:ScreenVertex, _arg7:UV, _arg8:UV, _arg9:UV, _arg10:Boolean=false):DrawTriangle{ if (!(_dtArray = _dtDictionary[_arg1.session])){ _dtArray = (_dtDictionary[_arg1.session] = []); }; if (_dtStore.length){ _dtArray.push((_tri = _dtStore.pop())); } else { _dtArray.push((_tri = new DrawTriangle())); _tri.view = view; _tri.create = createDrawTriangle; }; _tri.generated = _arg10; _tri.source = _arg1; _tri.faceVO = _arg2; _tri.material = _arg3; _tri.v0 = _arg4; _tri.v1 = _arg5; _tri.v2 = _arg6; _tri.uv0 = _arg7; _tri.uv1 = _arg8; _tri.uv2 = _arg9; _tri.calc(); return (_tri); } public function createDrawDisplayObject(_arg1:Object3D, _arg2:ScreenVertex, _arg3:AbstractRenderSession, _arg4:DisplayObject, _arg5:Boolean=false):DrawDisplayObject{ if (!(_doArray = _doDictionary[_arg1.session])){ _doArray = (_doDictionary[_arg1.session] = []); }; if (_doStore.length){ _doArray.push((_dobject = _doStore.pop())); } else { _doArray.push((_dobject = new DrawDisplayObject())); _dobject.view = view; _dobject.create = createDrawSegment; }; _dobject.generated = _arg5; _dobject.source = _arg1; _dobject.screenvertex = _arg2; _dobject.session = _arg3; _dobject.displayobject = _arg4; _dobject.calc(); return (_dobject); } public function createDrawScaledBitmap(_arg1:Object3D, _arg2:ScreenVertex, _arg3:Boolean, _arg4:BitmapData, _arg5:Number, _arg6:Number, _arg7:Boolean=false):DrawScaledBitmap{ if (!(_sbArray = _sbDictionary[_arg1.session])){ _sbArray = (_sbDictionary[_arg1.session] = []); }; if (_sbStore.length){ _sbArray.push((_sbitmap = _sbStore.pop())); } else { _sbArray.push((_sbitmap = new DrawScaledBitmap())); _sbitmap.view = view; _sbitmap.create = createDrawSegment; }; _sbitmap.generated = _arg7; _sbitmap.source = _arg1; _sbitmap.screenvertex = _arg2; _sbitmap.smooth = _arg3; _sbitmap.bitmap = _arg4; _sbitmap.scale = _arg5; _sbitmap.rotation = _arg6; _sbitmap.calc(); return (_sbitmap); } public function createDrawBillboard(_arg1:Object3D, _arg2:IBillboardMaterial, _arg3:ScreenVertex, _arg4:Number, _arg5:Number, _arg6:Number, _arg7:Number, _arg8:Boolean=false):DrawBillboard{ if (!(_dbArray = _dbDictionary[_arg1.session])){ _dbArray = (_dbDictionary[_arg1.session] = []); }; if (_dbStore.length){ _dbArray.push((_bill = _dbStore.pop())); } else { _dbArray.push((_bill = new DrawBillboard())); _bill.view = view; _bill.create = createDrawBillboard; }; _bill.generated = _arg8; _bill.source = _arg1; _bill.material = _arg2; _bill.screenvertex = _arg3; _bill.width = _arg4; _bill.height = _arg5; _bill.scale = _arg6; _bill.rotation = _arg7; _bill.calc(); return (_bill); } public function createDrawSegment(_arg1:Object3D, _arg2:ISegmentMaterial, _arg3:ScreenVertex, _arg4:ScreenVertex, _arg5:Boolean=false):DrawSegment{ if (!(_dsArray = _dsDictionary[_arg1.session])){ _dsArray = (_dsDictionary[_arg1.session] = []); }; if (_dsStore.length){ _dsArray.push((_seg = _dsStore.pop())); } else { _dsArray.push((_seg = new DrawSegment())); _seg.view = view; _seg.create = createDrawSegment; }; _seg.generated = _arg5; _seg.source = _arg1; _seg.material = _arg2; _seg.v0 = _arg3; _seg.v1 = _arg4; _seg.calc(); return (_seg); } public function createScreenVertex(_arg1:Vertex):ScreenVertex{ if ((_sv = _vertexDictionary[_arg1])){ return (_sv); }; if (_svStore.length){ _sv = (_vertexDictionary[_arg1] = _svStore.pop()); } else { _sv = (_vertexDictionary[_arg1] = new ScreenVertex()); }; return (_sv); } public function reset():void{ for (_object in _sourceDictionary) { _source = (_object as Object3D); if (((_source.session) && (_source.session.updated))){ for (_vertex in _sourceDictionary[_source]) { _sv = _sourceDictionary[_source][_vertex]; _svStore.push(_sv); delete _sourceDictionary[_source][_vertex]; }; }; }; for (_object in _dtDictionary) { _session = (_object as AbstractRenderSession); if (_session.updated){ _dtStore = _dtStore.concat((_dtDictionary[_session] as Array)); delete _dtDictionary[_session]; }; }; for (_object in _dsDictionary) { _session = (_object as AbstractRenderSession); if (_session.updated){ _dsStore = _dsStore.concat((_dsDictionary[_session] as Array)); delete _dsDictionary[_session]; }; }; for (_object in _dbDictionary) { _session = (_object as AbstractRenderSession); if (_session.updated){ _dbStore = _dbStore.concat((_dbDictionary[_session] as Array)); delete _dbDictionary[_session]; }; }; for (_object in _cbDictionary) { _session = (_object as AbstractRenderSession); if (_session.updated){ _cbStore = _cbStore.concat((_cbDictionary[_session] as Array)); delete _cbDictionary[_session]; }; }; for (_object in _sbDictionary) { _session = (_object as AbstractRenderSession); if (_session.updated){ _sbStore = _sbStore.concat((_sbDictionary[_session] as Array)); delete _sbDictionary[_session]; }; }; for (_object in _doDictionary) { _session = (_object as AbstractRenderSession); if (_session.updated){ _doStore = _doStore.concat((_doDictionary[_session] as Array)); delete _doDictionary[_session]; }; }; } public function createConvexBlocker(_arg1:Object3D, _arg2:Array):ConvexBlocker{ if (!(_cbArray = _cbDictionary[_arg1.session])){ _cbArray = (_cbDictionary[_arg1.session] = []); }; if (_cbStore.length){ _cbArray.push((_cblocker = (blockerDictionary[_arg1] = _cbStore.pop()))); } else { _cbArray.push((_cblocker = (blockerDictionary[_arg1] = new ConvexBlocker()))); _cblocker.view = view; _cblocker.create = createConvexBlocker; }; _cblocker.source = _arg1; _cblocker.vertices = _arg2; _cblocker.calc(); return (_cblocker); } public function createVertexDictionary(_arg1:Object3D):Dictionary{ if (!(_vertexDictionary = _sourceDictionary[_arg1])){ _vertexDictionary = (_sourceDictionary[_arg1] = new Dictionary(true)); }; return (_vertexDictionary); } } }//package away3d.core.utils
Section 98
//FaceMaterialVO (away3d.core.utils.FaceMaterialVO) package away3d.core.utils { import flash.display.*; import away3d.containers.*; import away3d.core.base.*; import flash.geom.*; public class FaceMaterialVO { public var invtexturemapping:Matrix; public var width:int; public var invalidated:Boolean;// = true public var backface:Boolean;// = false public var texturemapping: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 FaceMaterialVO(_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 99
//FaceVO (away3d.core.utils.FaceVO) package away3d.core.utils { import away3d.core.base.*; import away3d.materials.*; import flash.geom.*; public class FaceVO { public var v0:Vertex; public var generated:Boolean; public var face:Face; public var material:ITriangleMaterial; public var back:ITriangleMaterial; public var uv0:UV; public var uv1:UV; public var bitmapRect:Rectangle; public var uv2:UV; public var v1:Vertex; public var v2:Vertex; 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 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 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); } } }//package away3d.core.utils
Section 100
//IClonable (away3d.core.utils.IClonable) package away3d.core.utils { import away3d.core.base.*; public interface IClonable { function clone(_arg1:Object3D=null):Object3D; } }//package away3d.core.utils
Section 101
//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 { 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):IMaterial{ if (init == null){ return (null); }; if (!init.hasOwnProperty(_arg1)){ return (null); }; var _local2:IMaterial = 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 102
//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 103
//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 SEQUENCE_DONE:String = "sequenceDone"; public static const CYCLE:String = "cycle"; public static const SEQUENCE_UPDATE:String = "sequenceUpdate"; 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 104
//BillboardEvent (away3d.events.BillboardEvent) package away3d.events { import flash.events.*; import away3d.core.base.*; public class BillboardEvent extends Event { public var billboard:Billboard; public static const MATERIAL_CHANGED:String = "materialChanged"; public function BillboardEvent(_arg1:String, _arg2:Billboard){ super(_arg1); this.billboard = _arg2; } override public function clone():Event{ return (new BillboardEvent(type, billboard)); } } }//package away3d.events
Section 105
//CameraEvent (away3d.events.CameraEvent) package away3d.events { import flash.events.*; import away3d.cameras.*; public class CameraEvent extends Event { public var camera:Camera3D; public static const CAMERA_UPDATED:String = "cameraUpdated"; public function CameraEvent(_arg1:String, _arg2:Camera3D){ super(_arg1); this.camera = _arg2; } override public function clone():Event{ return (new CameraEvent(type, camera)); } } }//package away3d.events
Section 106
//ClippingEvent (away3d.events.ClippingEvent) package away3d.events { import flash.events.*; import away3d.core.clip.*; public class ClippingEvent extends Event { public var clipping:Clipping; public static const CLIPPING_UPDATED:String = "clippingUpdated"; public function ClippingEvent(_arg1:String, _arg2:Clipping){ super(_arg1); this.clipping = _arg2; } override public function clone():Event{ return (new ClippingEvent(type, clipping)); } } }//package away3d.events
Section 107
//ElementEvent (away3d.events.ElementEvent) package away3d.events { import flash.events.*; import away3d.core.base.*; public class ElementEvent extends Event { public var element:Element; public static const VISIBLE_CHANGED:String = "visibleChanged"; public static const VERTEX_CHANGED:String = "vertexChanged"; public static const VERTEXVALUE_CHANGED:String = "vertexvalueChanged"; public function ElementEvent(_arg1:String, _arg2:Element){ super(_arg1); this.element = _arg2; } override public function clone():Event{ return (new ElementEvent(type, element)); } } }//package away3d.events
Section 108
//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 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 109
//GeometryEvent (away3d.events.GeometryEvent) package away3d.events { import flash.events.*; import away3d.core.base.*; public class GeometryEvent extends Event { public var geometry:Geometry; public static const DIMENSIONS_CHANGED:String = "dimensionsChanged"; public function GeometryEvent(_arg1:String, _arg2:Geometry){ super(_arg1); this.geometry = _arg2; } override public function clone():Event{ return (new GeometryEvent(type, geometry)); } } }//package away3d.events
Section 110
//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 MATERIAL_UPDATED:String = "materialUpdated"; public static const LOAD_PROGRESS:String = "loadProgress"; public static const LOAD_SUCCESS:String = "loadSuccess"; public static const MATERIAL_CHANGED:String = "materialChanged"; public static const LOAD_ERROR:String = "loadError"; 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 111
//MouseEvent3D (away3d.events.MouseEvent3D) package away3d.events { import flash.events.*; import away3d.containers.*; import away3d.core.draw.*; import away3d.core.base.*; 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_MOVE:String = "mouseMove3d"; public static const MOUSE_OVER:String = "mouseOver3d"; public static const ROLL_OUT:String = "rollOut3d"; public static const MOUSE_OUT:String = "mouseOut3d"; public static const MOUSE_UP:String = "mouseUp3d"; public static const MOUSE_DOWN:String = "mouseDown3d"; public static const ROLL_OVER:String = "rollOver3d"; 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 112
//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 TRANSFORM_CHANGED:String = "transformChanged"; public static const PARENT_UPDATED:String = "parentUpdated"; public static const SCENE_CHANGED:String = "sceneChanged"; public static const SESSION_CHANGED:String = "sessionChanged"; public static const SESSION_UPDATED:String = "sessionUpdated"; public static const SCENETRANSFORM_CHANGED:String = "scenetransformChanged"; 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 113
//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 114
//SessionEvent (away3d.events.SessionEvent) package away3d.events { import flash.events.*; import away3d.core.render.*; public class SessionEvent extends Event { public var session:AbstractRenderSession; public static const SESSION_UPDATED:String = "sessionUpdated"; public function SessionEvent(_arg1:String, _arg2:AbstractRenderSession){ super(_arg1); this.session = _arg2; } override public function clone():Event{ return (new SessionEvent(type, session)); } } }//package away3d.events
Section 115
//ViewEvent (away3d.events.ViewEvent) package away3d.events { import flash.events.*; import away3d.containers.*; public class ViewEvent extends Event { public var view:View3D; public static const RENDER_COMPLETE:String = "renderComplete"; public static const UPDATE_SCENE:String = "updateScene"; public function ViewEvent(_arg1:String, _arg2:View3D){ super(_arg1); this.view = _arg2; } override public function clone():Event{ return (new ViewEvent(type, view)); } } }//package away3d.events
Section 116
//AmbientLight3D (away3d.lights.AmbientLight3D) package away3d.lights { import away3d.core.utils.*; import away3d.core.base.*; import away3d.primitives.*; import away3d.core.light.*; import away3d.materials.*; public class AmbientLight3D extends Object3D implements ILightProvider, IClonable { private var _ambientDirty:Boolean; private var _green:int; private var _colorDirty:Boolean; private var _red:int; private var _debug:Boolean; private var _ambient:Number; private var _debugMaterial:ColorMaterial; private var _ls:AmbientLight; private var _color:int; private var _debugPrimitive:Sphere; 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); } public function set color(_arg1:int):void{ _color = _arg1; _red = ((_color & 0xFF0000) >> 16); _green = ((_color & 0xFF00) >> 8); _blue = (_color & 0xFF); _colorDirty = true; } public function get debug():Boolean{ return (_debug); } 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 get debugPrimitive():Object3D{ if (!_debugPrimitive){ _debugPrimitive = new Sphere(); }; if (!_debugMaterial){ _debugMaterial = new ColorMaterial(); _debugPrimitive.material = _debugMaterial; }; _debugMaterial.color = color; return (_debugPrimitive); } public function set ambient(_arg1:Number):void{ _ambient = _arg1; _ambientDirty = true; } public function set debug(_arg1:Boolean):void{ _debug = _arg1; } override public function clone(_arg1:Object3D=null):Object3D{ var _local2:AmbientLight3D = (((_arg1 as AmbientLight3D)) || (new AmbientLight3D())); super.clone(_local2); _local2.color = color; _local2.ambient = ambient; _local2.debug = debug; return (_local2); } } }//package away3d.lights
Section 117
//DirectionalLight3D (away3d.lights.DirectionalLight3D) package away3d.lights { import away3d.core.utils.*; import away3d.core.base.*; import away3d.primitives.*; import away3d.core.light.*; import away3d.materials.*; public class DirectionalLight3D extends Object3D implements ILightProvider, IClonable { private var _green:Number; private var _debugMaterial:ColorMaterial; private var _specular:Number; private var _diffuse:Number; private var _ls:DirectionalLight; private var _blue:Number; private var _colorDirty:Boolean; private var _specularDirty:Boolean; private var _red:Number; private var _ambient:Number; private var _debug:Boolean; private var _color:int; private var _diffuseDirty:Boolean; private var _brightness:Number; private var _debugPrimitive:Sphere; private var _ambientDirty:Boolean; 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; } 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; }; _ls.ambient = (_ambient * _brightness); _ls.diffuse = (_diffuse * _brightness); _ls.specular = (_specular * _brightness); if (((_ambientDirty) || (_diffuseDirty))){ _ls.updateAmbientDiffuseBitmap(); }; if (_ambientDirty){ _ambientDirty = false; _ls.updateAmbientBitmap(); }; if (_diffuseDirty){ _diffuseDirty = false; _ls.updateDiffuseBitmap(); }; if (_specularDirty){ _specularDirty = false; _ls.updateSpecularBitmap(); }; _arg1.directionalLight(_ls); _colorDirty = false; } public function get ambient():Number{ return (_ambient); } public function set brightness(_arg1:Number):void{ _brightness = _arg1; _ambientDirty = true; _diffuseDirty = true; _specularDirty = true; } public function set debug(_arg1:Boolean):void{ _debug = _arg1; } public function set ambient(_arg1:Number):void{ if (_arg1 < 0){ _arg1 = 0; }; _ambient = _arg1; _ambientDirty = true; } public function get specular():Number{ return (_specular); } public function set diffuse(_arg1:Number):void{ if (_arg1 < 0){ _arg1 = 0; }; _diffuse = _arg1; _diffuseDirty = true; } public function set color(_arg1:int):void{ _color = _arg1; _red = (((color & 0xFF0000) >> 16) / 0xFF); _green = (((color & 0xFF00) >> 8) / 0xFF); _blue = ((color & 0xFF) / 0xFF); _colorDirty = true; _ambientDirty = true; _diffuseDirty = true; _specularDirty = true; } public function get brightness():Number{ return (_brightness); } public function get debug():Boolean{ return (_debug); } override public function clone(_arg1:Object3D=null):Object3D{ var _local2:DirectionalLight3D = (((_arg1 as DirectionalLight3D)) || (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 get diffuse():Number{ return (_diffuse); } public function get color():int{ return (_color); } public function get debugPrimitive():Object3D{ if (!_debugPrimitive){ _debugPrimitive = new Sphere({radius:10}); }; if (!_debugMaterial){ _debugMaterial = new ColorMaterial(); _debugPrimitive.material = _debugMaterial; }; _debugMaterial.color = color; return (_debugPrimitive); } } }//package away3d.lights
Section 118
//PointLight3D (away3d.lights.PointLight3D) package away3d.lights { import away3d.core.utils.*; import away3d.core.base.*; import away3d.primitives.*; import away3d.core.light.*; import away3d.materials.*; public class PointLight3D extends Object3D implements ILightProvider, IClonable { public var specular:Number; public var brightness:Number; public var ambient:Number; private var _debug:Boolean; public var diffuse:Number; public var color:int; private var _ls:PointLight; private var _debugMaterial:ColorMaterial; private var _debugPrimitive:Sphere; 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", 1000) * 0xFF); debug = ini.getBoolean("debug", false); _ls.light = this; } public function get debugPrimitive():Object3D{ if (!_debugPrimitive){ _debugPrimitive = new Sphere({radius:10}); }; if (!_debugMaterial){ _debugMaterial = new ColorMaterial(); _debugPrimitive.material = _debugMaterial; }; _debugMaterial.color = color; return (_debugPrimitive); } public function light(_arg1:ILightConsumer):void{ _ls.red = (((color & 0xFF0000) >> 16) / 0xFF); _ls.green = (((color & 0xFF00) >> 8) / 0xFF); _ls.blue = ((color & 0xFF) / 0xFF); _ls.ambient = (ambient * brightness); _ls.diffuse = (diffuse * brightness); _ls.specular = (specular * brightness); _arg1.pointLight(_ls); } public function get debug():Boolean{ return (_debug); } override public function clone(_arg1:Object3D=null):Object3D{ var _local2:PointLight3D = (((_arg1 as PointLight3D)) || (new PointLight3D())); super.clone(_local2); _local2.color = color; _local2.ambient = ambient; _local2.diffuse = diffuse; _local2.specular = specular; _local2.debug = debug; return (_local2); } public function set debug(_arg1:Boolean):void{ _debug = _arg1; } } }//package away3d.lights
Section 119
//AnimationData (away3d.loaders.data.AnimationData) package away3d.loaders.data { import away3d.containers.*; import flash.utils.*; import away3d.core.base.*; import away3d.animators.*; public class AnimationData { public var start:Number;// = INF public var animation:IMeshAnimation; public var channels:Dictionary; public var name:String; public var end:Number;// = 0 public var animationType:String;// = "skinAnimation" public static const VERTEX_ANIMATION:String = "vertexAnimation"; public static const SKIN_ANIMATION:String = "skinAnimation"; public function AnimationData(){ channels = new Dictionary(true); super(); } public function clone(_arg1:Object3D):AnimationData{ var _local2:AnimationData = _arg1.animationLibrary.addAnimation(name); _local2.start = start; _local2.end = end; _local2.animationType = animationType; _local2.animation = animation.clone((_arg1 as ObjectContainer3D)); return (_local2); } } }//package away3d.loaders.data
Section 120
//GeometryData (away3d.loaders.data.GeometryData) package away3d.loaders.data { import away3d.core.base.*; public class GeometryData { public var uvs:Array; public var maxZ:Number; public var geoXML:XML; public var minY:Number; public var minZ:Number; public var name:String; public var minX:Number; public var skinVertices:Array; public var skinControllers:Array; public var bothsides:Boolean; public var materials:Array; public var geometry:Geometry; public var maxX:Number; public var maxY:Number; public var faces:Array; public var vertices:Array; public var ctrlXML:XML; public function GeometryData(){ vertices = []; uvs = []; faces = []; materials = []; skinVertices = new Array(); skinControllers = new Array(); super(); } } }//package away3d.loaders.data
Section 121
//MaterialData (away3d.loaders.data.MaterialData) package away3d.loaders.data { import flash.display.*; import away3d.core.base.*; import away3d.materials.*; public class MaterialData { public var materialType:String;// = "wireframeMaterial" private var _material:IMaterial; public var name:String; public var shininess:Number; public var specularColor:uint; public var diffuseColor:uint; public var textureFileName:String; public var textureBitmap:BitmapData; public var ambientColor:uint; public var elements:Array; private var _element:Element; public static const COLOR_MATERIAL:String = "colorMaterial"; public static const TEXTURE_MATERIAL:String = "textureMaterial"; public static const SHADING_MATERIAL:String = "shadingMaterial"; public static const WIREFRAME_MATERIAL:String = "wireframeMaterial"; public function MaterialData(){ elements = []; super(); } public function set material(_arg1:IMaterial):void{ if (_material == _arg1){ return; }; _material = _arg1; if ((_material is IUVMaterial)){ textureBitmap = (_material as IUVMaterial).bitmap; }; if ((_material is ITriangleMaterial)){ for each (_element in elements) { (_element as Face).material = (_material as ITriangleMaterial); }; } else { if ((_material is ISegmentMaterial)){ for each (_element in elements) { (_element as Segment).material = (_material as ISegmentMaterial); }; }; }; } public function clone(_arg1:Object3D):MaterialData{ var _local3:Element; var _local4:Geometry; var _local5:Element; var _local2:MaterialData = _arg1.materialLibrary.addMaterial(name); _local2.materialType = materialType; _local2.ambientColor = ambientColor; _local2.diffuseColor = diffuseColor; _local2.shininess = shininess; _local2.specularColor = specularColor; _local2.textureBitmap = textureBitmap; _local2.textureFileName = textureFileName; _local2.material = material; for each (_local3 in elements) { _local4 = _local3.parent; _local5 = _local4.cloneElementDictionary[_local3]; _local2.elements.push(_local5); }; return (_local2); } public function get material():IMaterial{ return (_material); } } }//package away3d.loaders.data
Section 122
//AnimationLibrary (away3d.loaders.utils.AnimationLibrary) package away3d.loaders.utils { import flash.utils.*; import away3d.core.utils.*; import away3d.loaders.data.*; public dynamic class AnimationLibrary extends Dictionary { public function addAnimation(_arg1:String):AnimationData{ if (this[_arg1]){ return (this[_arg1]); }; var _local2:AnimationData = new AnimationData(); var _local3 = (_local2.name = _arg1); this[_local3] = _local2; return (_local2); } public function getAnimation(_arg1:String):AnimationData{ if (this[_arg1]){ return (this[_arg1]); }; Debug.warning((("Animation '" + _arg1) + "' does not exist")); return (null); } } }//package away3d.loaders.utils
Section 123
//GeometryLibrary (away3d.loaders.utils.GeometryLibrary) package away3d.loaders.utils { import flash.utils.*; import away3d.core.utils.*; import away3d.loaders.data.*; public dynamic class GeometryLibrary extends Dictionary { private var _geometryArray:Array; private var _geometryArrayDirty:Boolean; public var name:String; private var _geometry:GeometryData; public function getGeometry(_arg1:String):GeometryData{ if (this[_arg1]){ return (this[_arg1]); }; Debug.warning((("Geometry '" + _arg1) + "' does not exist")); return (null); } public function addGeometry(_arg1:String, _arg2:XML=null, _arg3:XML=null):GeometryData{ if (this[_arg1]){ return (this[_arg1]); }; _geometryArrayDirty = true; var _local4:GeometryData = new GeometryData(); _local4.geoXML = _arg2; _local4.ctrlXML = _arg3; var _local5 = (_local4.name = _arg1); this[_local5] = _local4; return (_local4); } public function getGeometryArray():Array{ if (_geometryArrayDirty){ updateGeometryArray(); }; return (_geometryArray); } private function updateGeometryArray():void{ _geometryArray = []; for each (_geometry in this) { _geometryArray.push(_geometry); }; } } }//package away3d.loaders.utils
Section 124
//MaterialLibrary (away3d.loaders.utils.MaterialLibrary) package away3d.loaders.utils { import flash.display.*; import flash.utils.*; import away3d.core.utils.*; import away3d.core.base.*; import away3d.materials.*; import away3d.loaders.data.*; public dynamic class MaterialLibrary extends Dictionary { public var texturePath:String; private var _face:Face; public var loadRequired:Boolean; private var length:int;// = 0 public var autoLoadTextures:Boolean; private var _materialData:MaterialData; private var _image:TextureLoader; public function texturesLoaded(_arg1:TextureLoadQueue):void{ loadRequired = false; var _local2:Array = _arg1.images; for each (_materialData in this) { for each (_image in _local2) { if ((texturePath + _materialData.textureFileName) == _image.filename){ _materialData.textureBitmap = new BitmapData(_image.width, _image.height, true, 0xFFFFFF); _materialData.textureBitmap.draw(_image); _materialData.material = new BitmapMaterial(_materialData.textureBitmap); }; }; }; } public function addMaterial(_arg1:String):MaterialData{ if (this[_arg1]){ return (this[_arg1]); }; length++; var _local2:MaterialData = new MaterialData(); var _local3 = (_local2.name = _arg1); this[_local3] = _local2; return (_local2); } public function getMaterial(_arg1:String):MaterialData{ if (this[_arg1]){ return (this[_arg1]); }; Debug.warning((("Material '" + _arg1) + "' does not exist")); return (null); } } }//package away3d.loaders.utils
Section 125
//TextureLoader (away3d.loaders.utils.TextureLoader) package away3d.loaders.utils { import flash.display.*; import flash.net.*; import flash.system.*; public class TextureLoader extends Loader { private var _filename:String; override public function load(_arg1:URLRequest, _arg2:LoaderContext=null):void{ _filename = _arg1.url; super.load(_arg1, _arg2); } public function get filename():String{ return (_filename); } } }//package away3d.loaders.utils
Section 126
//TextureLoadQueue (away3d.loaders.utils.TextureLoadQueue) package away3d.loaders.utils { import flash.events.*; import flash.net.*; public class TextureLoadQueue extends EventDispatcher { private var _currentItemIndex:int; private var _queue:Array; public function TextureLoadQueue(){ _queue = new Array(); } public function get currentURLRequest():URLRequest{ return ((_queue[currentItemIndex] as LoaderAndRequest).request); } private function calcProgress():Number{ var _local1:Number = (currentItemIndex / numItems); var _local2:Number = (calcCurrentLoaderAmountLoaded() / numItems); _local1 = _local2; return (_local1); } public function get currentItemIndex():int{ return (_currentItemIndex); } public function start():void{ _currentItemIndex = 0; loadNext(); } private function onItemComplete(_arg1:Event):void{ cleanUpOldItem(currentLoader); _currentItemIndex++; loadNext(); } public function get currentLoader():TextureLoader{ return ((_queue[currentItemIndex] as LoaderAndRequest).loader); } private function redispatchEvent(_arg1:Event):void{ dispatchEvent(_arg1); } public function get percentLoaded():Number{ return ((progress * 100)); } private function calcCurrentLoaderAmountLoaded():Number{ if (currentLoader.contentLoaderInfo.bytesLoaded > 0){ return ((currentLoader.contentLoaderInfo.bytesLoaded / currentLoader.contentLoaderInfo.bytesTotal)); }; return (0); } private function cleanUpOldItem(_arg1:TextureLoader):void{ currentLoader.removeEventListener(Event.COMPLETE, onItemComplete, false); currentLoader.removeEventListener(HTTPStatusEvent.HTTP_STATUS, redispatchEvent, false); currentLoader.removeEventListener(IOErrorEvent.IO_ERROR, redispatchEvent, false); currentLoader.removeEventListener(ProgressEvent.PROGRESS, redispatchEvent, false); currentLoader.removeEventListener(SecurityErrorEvent.SECURITY_ERROR, redispatchEvent, false); } public function get images():Array{ var _local2:LoaderAndRequest; var _local1:Array = []; for each (_local2 in _queue) { _local1.push(_local2.loader); }; return (_local1); } private function loadNext():void{ var _local1:ProgressEvent; if (_currentItemIndex >= numItems){ dispatchEvent(new Event(Event.COMPLETE)); } else { _local1 = new ProgressEvent(ProgressEvent.PROGRESS); _local1.bytesTotal = 100; _local1.bytesLoaded = percentLoaded; dispatchEvent(_local1); if ((((currentLoader.contentLoaderInfo.bytesLoaded > 0)) && ((currentLoader.contentLoaderInfo.bytesLoaded == currentLoader.contentLoaderInfo.bytesTotal)))){ } else { currentLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, onItemComplete, false, int.MIN_VALUE, true); currentLoader.contentLoaderInfo.addEventListener(HTTPStatusEvent.HTTP_STATUS, redispatchEvent, false, 0, true); currentLoader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, redispatchEvent, false, 0, true); currentLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, redispatchEvent, false, 0, true); currentLoader.contentLoaderInfo.addEventListener(SecurityErrorEvent.SECURITY_ERROR, redispatchEvent, false, 0, true); currentLoader.load(currentURLRequest); }; }; } public function get numItems():int{ return (_queue.length); } public function addItem(_arg1:TextureLoader, _arg2:URLRequest):void{ var _local3:LoaderAndRequest; for each (_local3 in _queue) { if (_local3.request.url == _arg2.url){ return; }; }; _queue.push(new LoaderAndRequest(_arg1, _arg2)); } public function get progress():Number{ return (calcProgress()); } } }//package away3d.loaders.utils import flash.net.*; class LoaderAndRequest { public var loader:TextureLoader; public var request:URLRequest; private function LoaderAndRequest(_arg1:TextureLoader, _arg2:URLRequest){ this.loader = _arg1; this.request = _arg2; } }
Section 127
//BitmapMaterial (away3d.materials.BitmapMaterial) package away3d.materials { import flash.events.*; import flash.display.*; import away3d.containers.*; import away3d.events.*; import flash.utils.*; import away3d.core.render.*; import away3d.core.draw.*; import away3d.core.clip.*; import away3d.core.utils.*; import away3d.core.base.*; import away3d.core.math.*; import flash.geom.*; import away3d.cameras.lenses.*; public class BitmapMaterial extends EventDispatcher implements ITriangleMaterial, IUVMaterial, ILayerMaterial, IBillboardMaterial { var _green:Number;// = 1 private var _near:Number; private var dsab:Number; var _blendMode:String; private var triangle:DrawTriangle; private var _showNormals:Boolean; private var faz:Number; var _bitmapDirty:Boolean; private var dsca:Number; private var dsbc: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; private var _debug:Boolean; 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 private var _nn:Number3D; var _colorTransform:ColorTransform; private var _sv1:ScreenVertex; var _texturemapping:Matrix; var _sourceVO:FaceMaterialVO; private var _materialupdated:MaterialEvent; private var cy:Number; private var cz:Number; private var x:Number; private var y:Number; private var dbcy:Number; private var _sv0:ScreenVertex; private var dbcx:Number; var _faceMaterialVO:FaceMaterialVO; private var _view:View3D; private var dmax:Number; private var cx:Number; var _mapping:Matrix; private var dabx:Number; private var _shape:Shape; private var daby:Number; private var svArray:Array; private var _repeat:Boolean; var _blendModeDirty:Boolean; private var mbcx:Number; private var mbcy:Number; private var mbcz:Number; private var _smooth:Boolean; var _red:Number;// = 1 private var focus:Number; private var mabx:Number; private var maby:Number; private var mabz:Number; var _graphics:Graphics; var _faceDictionary:Dictionary; var _s:Shape; private var dcax:Number; private var dcay:Number; var _materialDirty:Boolean; 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(); map = new Matrix(); triangle = new DrawTriangle(); svArray = new Array(); super(); _bitmap = _arg1; ini = Init.parse(_arg2); smooth = ini.getBoolean("smooth", false); debug = ini.getBoolean("debug", false); repeat = ini.getBoolean("repeat", false); 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); colorTransform = (ini.getObject("colorTransform", ColorTransform) as ColorTransform); showNormals = ini.getBoolean("showNormals", false); _colorTransformDirty = true; createVertexArray(); } public function getPixel32(_arg1:Number, _arg2:Number):uint{ if (repeat){ x = (_arg1 % 1); y = (1 - (_arg2 % 1)); } else { x = _arg1; y = (1 - _arg2); }; return (_bitmap.getPixel32((x * _bitmap.width), (y * _bitmap.height))); } public function set precision(_arg1:Number):void{ _precision = ((_arg1 * _arg1) * 1.4); _materialDirty = true; } 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 (((!((_view.screenClipping is FrustumClipping))) && (!(_view.screenClipping.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 ((((_view.screenClipping is RectangleClipping)) && ((((((az < _near)) || ((bz < _near)))) || ((cz < _near)))))){ 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 renderTriangle(_arg1:DrawTriangle):void{ var _local2:Matrix3D; _mapping = getMapping(_arg1); _session = _arg1.source.session; _view = _arg1.view; _near = _view.screenClipping.minZ; if (precision){ if ((_view.camera.lens is ZoomFocusLens)){ focus = _arg1.view.camera.focus; } else { focus = 0; }; 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); }; if (showNormals){ if (_nn == null){ _nn = new Number3D(); _sv0 = new ScreenVertex(); _sv1 = new ScreenVertex(); }; _local2 = _arg1.view.cameraVarsStore.viewTransformDictionary[_arg1.source]; _nn.rotate(_arg1.faceVO.face.normal, _local2); _sv0.x = (((_arg1.v0.x + _arg1.v1.x) + _arg1.v2.x) / 3); _sv0.y = (((_arg1.v0.y + _arg1.v1.y) + _arg1.v2.y) / 3); _sv0.z = (((_arg1.v0.z + _arg1.v1.z) + _arg1.v2.z) / 3); _sv1.x = (_sv0.x - (30 * _nn.x)); _sv1.y = (_sv0.y - (30 * _nn.y)); _sv1.z = (_sv0.z - (30 * _nn.z)); _session.renderLine(_sv0, _sv1, 0, 0xFF00FF, 1); }; } public function get height():Number{ return (_bitmap.height); } public function get bitmap():BitmapData{ return (_bitmap); } public function set repeat(_arg1:Boolean):void{ if (_repeat == _arg1){ return; }; _repeat = _arg1; _materialDirty = true; } public function removeOnMaterialUpdate(_arg1:Function):void{ removeEventListener(MaterialEvent.MATERIAL_UPDATED, _arg1, false); } public function updateMaterial(_arg1:Object3D, _arg2:View3D):void{ _graphics = null; if (_colorTransformDirty){ updateColorTransform(); }; if (_bitmapDirty){ updateRenderBitmap(); }; if (((_materialDirty) || (_blendModeDirty))){ clearFaces(_arg1, _arg2); }; _blendModeDirty = false; } public function invalidateFaces(_arg1:Object3D=null, _arg2:View3D=null):void{ _materialDirty = true; for each (_faceMaterialVO in _faceDictionary) { _faceMaterialVO.invalidated = true; }; } public function get colorTransform():ColorTransform{ return (_colorTransform); } function renderSource(_arg1:Object3D, _arg2:Rectangle, _arg3:Matrix):void{ if (!(_sourceVO = _faceDictionary[_arg1])){ _sourceVO = (_faceDictionary[_arg1] = new FaceMaterialVO()); }; _sourceVO.resize(_arg2.width, _arg2.height); if (((_sourceVO.invalidated) || (_sourceVO.updated))){ _arg3.scale((_arg2.width / width), (_arg2.height / height)); _sourceVO.invalidated = false; _sourceVO.cleared = false; _sourceVO.updated = false; 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 get debug():Boolean{ return (_debug); } public function renderLayer(_arg1:DrawTriangle, _arg2:Sprite, _arg3:int):int{ if (blendMode == BlendMode.NORMAL){ _graphics = _arg2.graphics; } else { _session = _arg1.source.session; var _temp1 = _arg3; _arg3 = (_arg3 + 1); _shape = _session.getShape(this, _temp1, _arg2); _shape.blendMode = _blendMode; _graphics = _shape.graphics; }; renderTriangle(_arg1); return (_arg3); } public function set blendMode(_arg1:String):void{ if (_blendMode == _arg1){ return; }; _blendMode = _arg1; _blendModeDirty = true; } public function getFaceMaterialVO(_arg1:FaceVO, _arg2:Object3D=null, _arg3:View3D=null):FaceMaterialVO{ if ((_faceMaterialVO = _faceDictionary[_arg1])){ return (_faceMaterialVO); }; return ((_faceDictionary[_arg1] = new FaceMaterialVO())); } public function set smooth(_arg1:Boolean):void{ if (_smooth == _arg1){ return; }; _smooth = _arg1; _materialDirty = true; } public function set bitmap(_arg1:BitmapData):void{ _bitmap = _arg1; _bitmapDirty = true; } public function clearFaces(_arg1:Object3D=null, _arg2:View3D=null):void{ notifyMaterialUpdate(); for each (_faceMaterialVO in _faceDictionary) { if (!_faceMaterialVO.cleared){ _faceMaterialVO.clear(); }; }; } public function get color():uint{ return (_color); } public function get alpha():Number{ return (_alpha); } public function get precision():Number{ return (_precision); } function notifyMaterialUpdate():void{ _materialDirty = false; if (!hasEventListener(MaterialEvent.MATERIAL_UPDATED)){ return; }; if (_materialupdated == null){ _materialupdated = new MaterialEvent(MaterialEvent.MATERIAL_UPDATED, this); }; dispatchEvent(_materialupdated); } public function addOnMaterialUpdate(_arg1:Function):void{ addEventListener(MaterialEvent.MATERIAL_UPDATED, _arg1, false, 0, true); } public function set showNormals(_arg1:Boolean):void{ if (_showNormals == _arg1){ return; }; _showNormals = _arg1; _materialDirty = true; } private function createVertexArray():void{ var _local1:Number = 100; while (_local1--) { svArray.push(new ScreenVertex()); }; } public function renderBitmapLayer(_arg1:DrawTriangle, _arg2:Rectangle, _arg3:FaceMaterialVO):FaceMaterialVO{ renderSource(_arg1.source, _arg2, new Matrix()); _faceMaterialVO = getFaceMaterialVO(_arg1.faceVO); if (_arg3.resized){ _arg3.resized = false; _faceMaterialVO.resized = true; }; _faceMaterialVO.invtexturemapping = _arg3.invtexturemapping; if (((((_arg3.updated) || (_faceMaterialVO.invalidated))) || (_faceMaterialVO.updated))){ _arg3.updated = false; _faceMaterialVO.invalidated = false; _faceMaterialVO.cleared = false; _faceMaterialVO.updated = true; _faceMaterialVO.bitmap = _arg3.bitmap.clone(); _faceMaterialVO.bitmap.copyPixels(_sourceVO.bitmap, _arg1.faceVO.bitmapRect, _zeroPoint, null, null, true); }; return (_faceMaterialVO); } public function set colorTransform(_arg1:ColorTransform):void{ _colorTransform = _arg1; if (_colorTransform){ _red = _colorTransform.redMultiplier; _green = _colorTransform.greenMultiplier; _blue = _colorTransform.blueMultiplier; _alpha = _colorTransform.alphaMultiplier; _color = ((((_red * 0xFF) << 16) + ((_green * 0xFF) << 8)) + (_blue * 0xFF)); }; _colorTransformDirty = true; } public function renderBillboard(_arg1:DrawBillboard):void{ _arg1.source.session.renderBillboardBitmap(_renderBitmap, _arg1, smooth); } protected function updateColorTransform():void{ _colorTransformDirty = false; _bitmapDirty = true; _materialDirty = true; if ((((_alpha == 1)) && ((_color == 0xFFFFFF)))){ _renderBitmap = _bitmap; if (((!(_colorTransform)) || (((((!(_colorTransform.redOffset)) && (!(_colorTransform.greenOffset)))) && (!(_colorTransform.blueOffset)))))){ _colorTransform = null; return; }; } else { if (!_colorTransform){ _colorTransform = new ColorTransform(); }; }; _colorTransform.redMultiplier = _red; _colorTransform.greenMultiplier = _green; _colorTransform.blueMultiplier = _blue; _colorTransform.alphaMultiplier = _alpha; if (_alpha == 0){ _renderBitmap = null; return; }; } public function set debug(_arg1:Boolean):void{ if (_debug == _arg1){ return; }; _debug = _arg1; _materialDirty = true; } protected function getMapping(_arg1:DrawTriangle):Matrix{ if (_arg1.generated){ _texturemapping = _arg1.transformUV(this).clone(); _texturemapping.invert(); return (_texturemapping); }; _faceMaterialVO = getFaceMaterialVO(_arg1.faceVO); if (!_faceMaterialVO.invalidated){ return (_faceMaterialVO.texturemapping); }; _faceMaterialVO.invalidated = false; _texturemapping = _arg1.transformUV(this).clone(); _texturemapping.invert(); return ((_faceMaterialVO.texturemapping = _texturemapping)); } public function get repeat():Boolean{ return (_repeat); } public function get showNormals():Boolean{ return (_showNormals); } 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 smooth():Boolean{ return (_smooth); } protected function updateRenderBitmap():void{ _bitmapDirty = false; 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; }; invalidateFaces(); } public function get width():Number{ return (_bitmap.width); } public function get blendMode():String{ return (_blendMode); } 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; } public function get visible():Boolean{ return ((_alpha > 0)); } } }//package away3d.materials
Section 128
//BitmapMaterialContainer (away3d.materials.BitmapMaterialContainer) package away3d.materials { import flash.display.*; import away3d.containers.*; import away3d.events.*; import flash.utils.*; import away3d.core.draw.*; import away3d.core.utils.*; import away3d.core.base.*; import flash.geom.*; public class BitmapMaterialContainer extends BitmapMaterial implements ITriangleMaterial, ILayerMaterial { private var _faceHeight:int; private var _height:Number; private var _width:Number; public var transparent:Boolean; private var _material:ILayerMaterial; private var _forceRender:Boolean; private var _fMaterialVO:FaceMaterialVO; private var _faceWidth:int; protected var materials:Array; private var _faceVO:FaceVO; private var _containerDictionary:Dictionary; private var _cacheDictionary:Dictionary; private var _viewDictionary:Dictionary; private var _containerVO:FaceMaterialVO; public function BitmapMaterialContainer(_arg1:int, _arg2:int, _arg3:Object=null){ _containerDictionary = new Dictionary(true); _cacheDictionary = new Dictionary(true); _viewDictionary = new Dictionary(true); super(new BitmapData(_arg1, _arg2, true, 0xFFFFFF), _arg3); materials = ini.getArray("materials"); _width = _arg1; _height = _arg2; _bitmapRect = new Rectangle(0, 0, _width, _height); for each (_material in materials) { _material.addOnMaterialUpdate(onMaterialUpdate); }; transparent = ini.getBoolean("transparent", true); } public function removeMaterial(_arg1:ILayerMaterial):void{ var _local2:int = materials.indexOf(_arg1); if (_local2 == -1){ return; }; _arg1.removeOnMaterialUpdate(onMaterialUpdate); materials.splice(_local2, 1); _materialDirty = true; } private function onMaterialUpdate(_arg1:MaterialEvent):void{ _materialDirty = true; } override public function updateMaterial(_arg1:Object3D, _arg2:View3D):void{ for each (_material in materials) { _material.updateMaterial(_arg1, _arg2); }; if (_colorTransformDirty){ updateColorTransform(); }; if (_bitmapDirty){ updateRenderBitmap(); }; if (((_materialDirty) || (_blendModeDirty))){ clearFaces(); }; _blendModeDirty = false; } override public function renderBitmapLayer(_arg1:DrawTriangle, _arg2:Rectangle, _arg3:FaceMaterialVO):FaceMaterialVO{ _faceMaterialVO = getFaceMaterialVO(_arg1.faceVO); _faceWidth = _arg1.faceVO.bitmapRect.width; _faceHeight = _arg1.faceVO.bitmapRect.height; if (!(_containerVO = _containerDictionary[_arg1])){ _containerVO = (_containerDictionary[_arg1] = new FaceMaterialVO()); }; if (_arg3.resized){ _arg3.resized = false; _containerVO.resize(_faceWidth, _faceHeight, transparent); }; for each (_material in materials) { _containerVO = _material.renderBitmapLayer(_arg1, _arg2, _containerVO); }; if (((_arg3.updated) || (_containerVO.updated))){ _arg3.updated = false; _containerVO.updated = false; _faceMaterialVO.invalidated = false; _faceMaterialVO.cleared = false; _faceMaterialVO.updated = true; _faceMaterialVO.bitmap = _arg3.bitmap.clone(); _faceMaterialVO.bitmap.lock(); _sourceVO = _faceMaterialVO; if ((((_blendMode == BlendMode.NORMAL)) && (!(_colorTransform)))){ _faceMaterialVO.bitmap.copyPixels(_containerVO.bitmap, _containerVO.bitmap.rect, _zeroPoint, null, null, true); } else { _faceMaterialVO.bitmap.draw(_containerVO.bitmap, null, _colorTransform, _blendMode); }; }; return (_faceMaterialVO); } override public function renderLayer(_arg1:DrawTriangle, _arg2:Sprite, _arg3:int):int{ throw (new Error("Not implemented")); } override protected function updateRenderBitmap():void{ _bitmapDirty = false; invalidateFaces(); _materialDirty = true; } override protected function getMapping(_arg1:DrawTriangle):Matrix{ _faceVO = _arg1.faceVO; _faceMaterialVO = getFaceMaterialVO(_arg1.faceVO, _arg1.source, _arg1.view); if (((((_arg1.generated) || (_faceMaterialVO.invalidated))) || (_faceMaterialVO.updated))){ _faceMaterialVO.updated = true; _faceMaterialVO.cleared = false; if (_faceMaterialVO.invalidated){ _faceMaterialVO.invalidated = false; _faceVO.bitmapRect = new Rectangle(int((_width * _faceVO.minU)), int((_height * (1 - _faceVO.maxV))), int(((_width * (_faceVO.maxU - _faceVO.minU)) + 2)), int(((_height * (_faceVO.maxV - _faceVO.minV)) + 2))); _faceWidth = _faceVO.bitmapRect.width; _faceHeight = _faceVO.bitmapRect.height; _faceMaterialVO.invtexturemapping = _arg1.transformUV(this).clone(); _faceMaterialVO.texturemapping = _faceMaterialVO.invtexturemapping.clone(); _faceMaterialVO.texturemapping.invert(); _faceMaterialVO.resize(_faceWidth, _faceHeight, transparent); }; _fMaterialVO = _faceMaterialVO; for each (_material in materials) { _fMaterialVO = _material.renderBitmapLayer(_arg1, _bitmapRect, _fMaterialVO); }; _renderBitmap = (_cacheDictionary[_faceVO] = _fMaterialVO.bitmap); _fMaterialVO.updated = false; return (_faceMaterialVO.texturemapping); }; _renderBitmap = _cacheDictionary[_faceVO]; if (_faceMaterialVO.invalidated){ _faceMaterialVO.invalidated = false; _faceMaterialVO.invtexturemapping = _arg1.transformUV(this).clone(); _faceMaterialVO.texturemapping = _faceMaterialVO.invtexturemapping.clone(); _faceMaterialVO.texturemapping.invert(); }; return (_faceMaterialVO.texturemapping); } public function clearMaterials():void{ var _local1:int = materials.length; while (_local1--) { removeMaterial(materials[_local1]); }; } public function addMaterial(_arg1:ILayerMaterial):void{ _arg1.addOnMaterialUpdate(onMaterialUpdate); materials.push(_arg1); _materialDirty = true; } } }//package away3d.materials
Section 129
//CenterLightingMaterial (away3d.materials.CenterLightingMaterial) package away3d.materials { import flash.events.*; import flash.display.*; import away3d.containers.*; import away3d.events.*; import flash.utils.*; import away3d.core.render.*; import away3d.core.draw.*; import away3d.core.utils.*; import away3d.core.base.*; import away3d.core.math.*; import away3d.core.light.*; public class CenterLightingMaterial extends EventDispatcher implements ITriangleMaterial { private var fy:Number; private var pb:Number; private var pc:Number; private var green:Number; private var diff:Number; private var ksr:Number; private var fx:Number; private var _specularTransform:Matrix3D; private var _materialDirty:Boolean; private var draw_fall_k:Number;// = 1 protected var ini:Init; private var kdb:Number; private var kdg:Number; private var rf:Number; private var draw_reflect_k:Number;// = 1 private var dfx:Number; private var dfy:Number; private var dfz:Number; private var kdr:Number; private var _source:Mesh; 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 public var shininess:Number;// = 20 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 cx:Number; var v0:ScreenVertex; var v1:ScreenVertex; private var v2x:Number; private var v2y:Number; private var df:Number; private var v2z:Number; private var cz:Number; private var _diffuseTransform:Matrix3D; private var fade:Number; private var _materialupdated:MaterialEvent; private var cy:Number; private var point:PointLight; private var red:Number; private var graphics:Graphics; var session:AbstractRenderSession; var v2:ScreenVertex; private var global:AmbientLight; private var _view:View3D; 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 nz:Number; private var d1z:Number; private var kag:Number; private var ny:Number; private var d1y:Number; private var zoom:Number; private var kar:Number; private var focus:Number; private var fz:Number; private var _viewPosition:Number3D; private var directional:DirectionalLight; private var c0x:Number; private var c0y:Number; private var c0z:Number; private var kab:Number; public var specular_brightness:Number;// = 1 private var pdd:Number; private var pa:Number; private var d2y:Number; private var d2z:Number; private var d2x:Number; private var ksb:Number; private var ksg:Number; public function CenterLightingMaterial(_arg1:Object=null){ ini = Init.parse(_arg1); shininess = ini.getColor("shininess", 20); } public function get visible():Boolean{ throw (new Error("Not implemented")); } public function updateMaterial(_arg1:Object3D, _arg2:View3D):void{ for each (directional in _arg1.lightarray.directionals) { if (((!(directional.diffuseTransform[_arg1])) || (_arg2.scene.updatedObjects[_arg1]))){ directional.setDiffuseTransform(_arg1); _materialDirty = true; }; if (!directional.specularTransform[_arg1]){ directional.specularTransform[_arg1] = new Dictionary(true); }; if (((((!(directional.specularTransform[_arg1][_arg2])) || (_arg2.scene.updatedObjects[_arg1]))) || (_arg2.updated))){ directional.setSpecularTransform(_arg1, _arg2); _materialDirty = true; }; }; for each (point in _arg1.lightarray.points) { if (((((!(point.viewPositions[_arg2])) || (_arg2.scene.updatedObjects[_arg1]))) || (_arg2.updated))){ point.setViewPosition(_arg2); _materialDirty = true; }; }; if (_materialDirty){ clearFaces(_arg1, _arg2); }; } 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 addOnMaterialUpdate(_arg1:Function):void{ addEventListener(MaterialEvent.MATERIAL_UPDATED, _arg1, false, 0, true); } public function clearFaces(_arg1:Object3D=null, _arg2:View3D=null):void{ notifyMaterialUpdate(); } function notifyMaterialUpdate():void{ _materialDirty = false; if (!hasEventListener(MaterialEvent.MATERIAL_UPDATED)){ return; }; if (_materialupdated == null){ _materialupdated = new MaterialEvent(MaterialEvent.MATERIAL_UPDATED, this); }; dispatchEvent(_materialupdated); } public function removeOnMaterialUpdate(_arg1:Function):void{ removeEventListener(MaterialEvent.MATERIAL_UPDATED, _arg1, false); } public function renderTriangle(_arg1:DrawTriangle):void{ session = _arg1.source.session; v0 = _arg1.v0; v1 = _arg1.v1; v2 = _arg1.v2; focus = _arg1.view.camera.focus; zoom = _arg1.view.camera.zoom; v0x = v0.vx; v0y = v0.vy; v0z = v0.z; v1x = v1.vx; v1y = v1.vy; v1z = v1.z; v2x = v2.vx; v2y = v2.vy; v2z = v2.z; 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); _view = _arg1.view; for each (directional in _arg1.source.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.faceVO.face.normal.x; ny = _arg1.faceVO.face.normal.y; nz = _arg1.faceVO.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)); _specularTransform = directional.specularTransform[_source][_view]; rfx = _specularTransform.szx; rfy = _specularTransform.szy; rfz = _specularTransform.szz; rf = (((rfx * nx) + (rfy * ny)) + (rfz * nz)); spec = ((directional.specular * Math.pow(rf, shininess)) * specular_brightness); ksr = (ksr + (red * spec)); ksg = (ksg + (green * spec)); ksb = (ksb + (blue * spec)); }; }; for each (point in _arg1.source.lightarray.points) { red = point.red; green = point.green; blue = point.blue; _viewPosition = point.viewPositions[_arg1.view]; dfx = (_viewPosition.x - c0x); dfy = (_viewPosition.y - c0y); dfz = (_viewPosition.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, shininess)) * 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 _arg1.source.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 = (_viewPosition.x - c0x); dfy = (_viewPosition.y - c0y); dfz = (_viewPosition.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 130
//ColorMaterial (away3d.materials.ColorMaterial) package away3d.materials { import flash.events.*; import away3d.containers.*; import away3d.events.*; import away3d.core.draw.*; import away3d.core.utils.*; import away3d.core.base.*; public class ColorMaterial extends EventDispatcher implements ITriangleMaterial, IFogMaterial, IBillboardMaterial { private var _alpha:Number; private var _color:uint; protected var ini:Init; private var _materialDirty:Boolean; private var _materialupdated:MaterialEvent; 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}); } function notifyMaterialUpdate():void{ if (!hasEventListener(MaterialEvent.MATERIAL_UPDATED)){ return; }; if (_materialupdated == null){ _materialupdated = new MaterialEvent(MaterialEvent.MATERIAL_UPDATED, this); }; dispatchEvent(_materialupdated); } public function set alpha(_arg1:Number):void{ if (_alpha == _arg1){ return; }; _alpha = _arg1; _materialDirty = true; } public function renderTriangle(_arg1:DrawTriangle):void{ _arg1.source.session.renderTriangleColor(_color, _alpha, _arg1.v0, _arg1.v1, _arg1.v2); } public function set color(_arg1:uint):void{ if (_color == _arg1){ return; }; _color = _arg1; _materialDirty = true; } public function renderBillboard(_arg1:DrawBillboard):void{ _arg1.source.session.renderBillboardColor(_color, _alpha, _arg1); } public function updateMaterial(_arg1:Object3D, _arg2:View3D):void{ if (_materialDirty){ _materialDirty = false; notifyMaterialUpdate(); }; } public function clone():IFogMaterial{ return (new ColorMaterial(_color, {alpha:_alpha})); } public function get alpha():Number{ return (_alpha); } public function renderFog(_arg1:DrawFog):void{ _arg1.source.session.renderFogColor(_arg1.clip, _color, _alpha); } public function get color():uint{ return (_color); } public function addOnMaterialUpdate(_arg1:Function):void{ addEventListener(MaterialEvent.MATERIAL_UPDATED, _arg1, false, 0, true); } public function get visible():Boolean{ return ((alpha > 0)); } public function removeOnMaterialUpdate(_arg1:Function):void{ removeEventListener(MaterialEvent.MATERIAL_UPDATED, _arg1, false); } } }//package away3d.materials
Section 131
//IBillboardMaterial (away3d.materials.IBillboardMaterial) package away3d.materials { import away3d.core.draw.*; public interface IBillboardMaterial extends IMaterial { function renderBillboard(_arg1:DrawBillboard):void; } }//package away3d.materials
Section 132
//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 133
//ILayerMaterial (away3d.materials.ILayerMaterial) package away3d.materials { import flash.display.*; import away3d.core.draw.*; import away3d.core.utils.*; import flash.geom.*; public interface ILayerMaterial extends IMaterial { function renderLayer(_arg1:DrawTriangle, _arg2:Sprite, _arg3:int):int; function renderBitmapLayer(_arg1:DrawTriangle, _arg2:Rectangle, _arg3:FaceMaterialVO):FaceMaterialVO; } }//package away3d.materials
Section 134
//IMaterial (away3d.materials.IMaterial) package away3d.materials { import away3d.containers.*; import away3d.core.base.*; public interface IMaterial { function updateMaterial(_arg1:Object3D, _arg2:View3D):void; function get visible():Boolean; function removeOnMaterialUpdate(_arg1:Function):void; function addOnMaterialUpdate(_arg1:Function):void; } }//package away3d.materials
Section 135
//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 136
//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 137
//IUVMaterial (away3d.materials.IUVMaterial) package away3d.materials { import flash.display.*; import away3d.containers.*; import away3d.core.utils.*; import away3d.core.base.*; public interface IUVMaterial extends IMaterial { function getFaceMaterialVO(_arg1:FaceVO, _arg2:Object3D=null, _arg3:View3D=null):FaceMaterialVO; function getPixel32(_arg1:Number, _arg2:Number):uint; function get height():Number; function clearFaces(_arg1:Object3D=null, _arg2:View3D=null):void; function invalidateFaces(_arg1:Object3D=null, _arg2:View3D=null):void; function get width():Number; function get bitmap():BitmapData; } }//package away3d.materials
Section 138
//MovieMaterial (away3d.materials.MovieMaterial) package away3d.materials { import flash.display.*; import away3d.containers.*; import away3d.events.*; import away3d.core.utils.*; import away3d.core.base.*; import flash.geom.*; public class MovieMaterial extends TransformBitmapMaterial implements ITriangleMaterial, IUVMaterial { private var _lastsession:int; private var _lockH:Number; private var _clipRect:Rectangle; public var transparent:Boolean; private var _lockW:Number; public var autoUpdate:Boolean; private var _bMode:String; public var interactive:Boolean; private var _colTransform:ColorTransform; private var _movie:Sprite; private var t:Matrix; private var rendered:Boolean; private var x:Number; private var y:Number; public function MovieMaterial(_arg1:Sprite, _arg2:Object=null){ ini = Init.parse(_arg2); transparent = ini.getBoolean("transparent", true); autoUpdate = ini.getBoolean("autoUpdate", true); interactive = ini.getBoolean("interactive", false); _movie = _arg1; _lockW = ini.getNumber("lockW", _arg1.width); _lockH = ini.getNumber("lockH", _arg1.height); _bitmap = new BitmapData(Math.max(1, _lockW), Math.max(1, _lockH), transparent, (transparent) ? 0xFFFFFF : 0); super(_bitmap, ini); } public function set clipRect(_arg1:Rectangle):void{ _clipRect = _arg1; } override public function get width():Number{ return (_renderBitmap.width); } public function get movie():Sprite{ return (_movie); } public function update():void{ var _local1:Rectangle; if (_renderBitmap != null){ notifyMaterialUpdate(); _local1 = ((((_clipRect == null)) || (!(rendered)))) ? _renderBitmap.rect : _clipRect; if (transparent){ _renderBitmap.fillRect(_local1, 0xFFFFFF); }; 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, _local1); if (!rendered){ rendered = true; }; }; } 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 (!_arg2._interactiveLayer.contains(movie)){ _arg2._interactiveLayer.addChild(movie); resetInteractiveLayer(); _arg1.addOnMouseOver(onMouseOver); _arg1.addOnMouseOut(onMouseOut); }; } else { if (_arg2._interactiveLayer.contains(movie)){ _arg2._interactiveLayer.removeChild(movie); _arg1.removeOnMouseOver(onMouseOver); _arg1.removeOnMouseOut(onMouseOut); }; }; } public function get lockW():Number{ return (_lockW); } public function get clipRect():Rectangle{ return (_clipRect); } public function set lockH(_arg1:Number):void{ _lockH = (((!(isNaN(_arg1))) && ((_arg1 > 1)))) ? _arg1 : _lockH; if (_renderBitmap != null){ _bitmap.dispose(); _renderBitmap.dispose(); _bitmap = new BitmapData(Math.max(1, _lockW), Math.max(1, _lockH), transparent, (transparent) ? 0xFFFFFF : 0); _renderBitmap = _bitmap.clone(); update(); }; } public function set lockW(_arg1:Number):void{ _lockW = (((!(isNaN(_arg1))) && ((_arg1 > 1)))) ? _arg1 : _lockW; if (_renderBitmap != null){ _bitmap.dispose(); _renderBitmap.dispose(); _bitmap = new BitmapData(Math.max(1, _lockW), Math.max(1, _lockH), transparent, (transparent) ? 0xFFFFFF : 0); _renderBitmap = _bitmap.clone(); update(); }; } public function set movie(_arg1:Sprite):void{ if (_movie == _arg1){ return; }; if (((_movie) && (_movie.parent))){ _movie.parent.removeChild(_movie); }; _movie = _arg1; if (!autoUpdate){ update(); }; } 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); }; } public function get lockH():Number{ return (_lockH); } private function resetInteractiveLayer():void{ movie.x = -10000; movie.y = -10000; } } }//package away3d.materials
Section 139
//ShadingColorMaterial (away3d.materials.ShadingColorMaterial) package away3d.materials { import away3d.core.render.*; import away3d.core.draw.*; import away3d.core.utils.*; public class ShadingColorMaterial extends CenterLightingMaterial { private var fg:int; public var specular:uint; public var cache:Boolean; private var fr:int; private var fb:int; public var ambient:uint; public var alpha:Number; public var diffuse:uint; 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.faceVO != 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.faceVO.material = new ColorMaterial((((sfr << 16) | (sfg << 8)) | sfb)); }; }; } } }//package away3d.materials
Section 140
//TransformBitmapMaterial (away3d.materials.TransformBitmapMaterial) package away3d.materials { import flash.display.*; import away3d.containers.*; import away3d.core.draw.*; import away3d.core.utils.*; import away3d.core.base.*; import away3d.core.math.*; import flash.geom.*; public class TransformBitmapMaterial extends BitmapMaterial implements ITriangleMaterial, IUVMaterial { private var _u0:Number; private var _u1:Number; private var _invtexturemapping:Matrix; private var py:Number; private var _u2:Number; private var px: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 v1x:Number; private var v1y:Number; private var v1z: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 faceVO:FaceVO; private var _rotation:Number;// = 0 private var maptx:Number; private var _transformDirty:Boolean; private var _offsetX:Number;// = 0 private var _offsetY:Number;// = 0 var _transform:Matrix; private var mapty:Number; 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; } 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; } 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 updateMaterial(_arg1:Object3D, _arg2:View3D):void{ _graphics = null; if (_colorTransformDirty){ updateColorTransform(); }; if (_bitmapDirty){ updateRenderBitmap(); }; if (((_projectionDirty) || (_transformDirty))){ invalidateFaces(); }; if (_transformDirty){ updateTransform(); }; if (((_materialDirty) || (_blendModeDirty))){ clearFaces(); }; _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{ if (_transform){ x = (_arg1 * _bitmap.width); y = ((1 - _arg2) * _bitmap.height); t = _transform.clone(); t.invert(); if (repeat){ px = ((((x * t.a) + (y * t.c)) + t.tx) % _bitmap.width); py = ((((x * t.b) + (y * t.d)) + t.ty) % _bitmap.height); if (px < 0){ px = (px + _bitmap.width); }; if (py < 0){ py = (py + _bitmap.height); }; return (_bitmap.getPixel32(px, py)); } else { return (_bitmap.getPixel32((((x * t.a) + (y * t.c)) + t.tx), (((x * t.b) + (y * t.d)) + t.ty))); }; }; return (super.getPixel32(_arg1, _arg2)); } 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{ faceVO = _arg1.faceVO; if (globalProjection){ v0.transform(faceVO.v0.position, _arg1.source.sceneTransform); v1.transform(faceVO.v1.position, _arg1.source.sceneTransform); v2.transform(faceVO.v2.position, _arg1.source.sceneTransform); } else { v0 = faceVO.v0.position; v1 = faceVO.v1.position; v2 = faceVO.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{ if (_arg1.generated){ if (projectionVector){ _texturemapping = projectUV(_arg1); } else { _texturemapping = _arg1.transformUV(this).clone(); _texturemapping.invert(); }; if (_transform){ _mapping = _transform.clone(); _mapping.concat(_texturemapping); } else { _mapping = _texturemapping; }; return (_mapping); }; _faceMaterialVO = getFaceMaterialVO(_arg1.faceVO, _arg1.source); if (!_faceMaterialVO.invalidated){ return (_faceMaterialVO.texturemapping); }; _faceMaterialVO.invalidated = false; if (projectionVector){ _texturemapping = projectUV(_arg1); } else { _texturemapping = _arg1.transformUV(this).clone(); _texturemapping.invert(); }; if (_transform){ _faceMaterialVO.texturemapping = _transform.clone(); _faceMaterialVO.texturemapping.concat(_texturemapping); return (_faceMaterialVO.texturemapping); }; return ((_faceMaterialVO.texturemapping = _texturemapping)); } private function getMappingPoints(_arg1:Matrix):Array{ mapa = (_arg1.a * width); mapb = (_arg1.b * width); mapc = (_arg1.c * height); 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{ _transformDirty = false; 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); }; _materialDirty = true; } override public function renderTriangle(_arg1:DrawTriangle):void{ if (((_projectionVector) && (!(throughProjection)))){ if (globalProjection){ normalR.rotate(_arg1.faceVO.face.normal, _arg1.source.sceneTransform); if (normalR.dot(_projectionVector) < 0){ return; }; } else { if (_arg1.faceVO.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)); }; } 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); } override public function renderBitmapLayer(_arg1:DrawTriangle, _arg2:Rectangle, _arg3:FaceMaterialVO):FaceMaterialVO{ if (_transform){ _mapping = _transform.clone(); } else { _mapping = new Matrix(); }; if (!_projectionVector){ renderSource(_arg1.source, _arg2, _mapping); }; _faceMaterialVO = getFaceMaterialVO(_arg1.faceVO); if (_arg3.resized){ _arg3.resized = false; _faceMaterialVO.resized = true; }; _faceMaterialVO.invtexturemapping = _arg3.invtexturemapping; if (((((_arg3.updated) || (_faceMaterialVO.invalidated))) || (_faceMaterialVO.updated))){ _arg3.updated = false; _bitmapRect = _arg1.faceVO.bitmapRect; if (_faceMaterialVO.invalidated){ _faceMaterialVO.invalidated = false; } else { _faceMaterialVO.updated = true; }; _faceMaterialVO.bitmap = _arg3.bitmap.clone(); if (_projectionVector){ _invtexturemapping = _faceMaterialVO.invtexturemapping; _mapping.concat(projectUV(_arg1)); _mapping.concat(_invtexturemapping); normalR.clone(_arg1.faceVO.face.normal); if (_globalProjection){ normalR.rotate(normalR, _arg1.source.sceneTransform); }; if (((((throughProjection) || ((normalR.dot(_projectionVector) >= 0)))) && (((repeat) || (!(findSeparatingAxis(getFacePoints(_invtexturemapping), getMappingPoints(_mapping)))))))){ if (_faceMaterialVO.cleared){ _faceMaterialVO.bitmap = _arg3.bitmap.clone(); }; _faceMaterialVO.cleared = false; _faceMaterialVO.updated = true; _graphics = _s.graphics; _graphics.clear(); _graphics.beginBitmapFill(_bitmap, _mapping, repeat, smooth); _graphics.drawRect(0, 0, _bitmapRect.width, _bitmapRect.height); _graphics.endFill(); _faceMaterialVO.bitmap.draw(_s, null, _colorTransform, _blendMode, _faceMaterialVO.bitmap.rect); }; } else { if (((repeat) && (!(findSeparatingAxis(getContainerPoints(_arg2), getMappingPoints(_mapping)))))){ _faceMaterialVO.cleared = false; _faceMaterialVO.updated = true; _faceMaterialVO.bitmap.copyPixels(_sourceVO.bitmap, _bitmapRect, _zeroPoint, null, null, true); }; }; }; return (_faceMaterialVO); } } }//package away3d.materials
Section 141
//WhiteShadingBitmapMaterial (away3d.materials.WhiteShadingBitmapMaterial) package away3d.materials { import flash.display.*; import away3d.containers.*; import away3d.events.*; import flash.utils.*; import flash.filters.*; import away3d.core.render.*; import away3d.core.draw.*; import away3d.core.utils.*; import away3d.core.base.*; import flash.geom.*; 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 _faceDictionary:Dictionary; private var _texturemapping:Matrix; private var _faceMaterialVO:FaceMaterialVO; private var whiterender:Boolean; public function WhiteShadingBitmapMaterial(_arg1:BitmapData, _arg2:Object=null){ _faceDictionary = new Dictionary(true); 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]; } override public function get visible():Boolean{ return (true); } public function get width():Number{ return (_bitmap.width); } public function getFaceMaterialVO(_arg1:FaceVO, _arg2:Object3D=null, _arg3:View3D=null):FaceMaterialVO{ if ((_faceMaterialVO = _faceDictionary[_arg1])){ return (_faceMaterialVO); }; return ((_faceDictionary[_arg1] = new FaceMaterialVO())); } override public function clearFaces(_arg1:Object3D=null, _arg2:View3D=null):void{ notifyMaterialUpdate(); for each (_faceMaterialVO in _faceDictionary) { if (!_faceMaterialVO.cleared){ _faceMaterialVO.clear(); }; }; } protected function getMapping(_arg1:DrawTriangle):Matrix{ if (_arg1.generated){ _texturemapping = _arg1.transformUV(this).clone(); _texturemapping.invert(); return (_texturemapping); }; _faceMaterialVO = getFaceMaterialVO(_arg1.faceVO, _arg1.source, _arg1.view); if (!_faceMaterialVO.invalidated){ return (_faceMaterialVO.texturemapping); }; _texturemapping = _arg1.transformUV(this).clone(); _texturemapping.invert(); return ((_faceMaterialVO.texturemapping = _texturemapping)); } 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))); } public function get bitmap():BitmapData{ return (_bitmap); } public function doubleStepTo(_arg1:int):void{ if (step < _arg1){ step = (step * 2); }; } 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))); } 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) / 3); mapping = getMapping(_arg1); 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); }; }; } public function invalidateFaces(_arg1:Object3D=null, _arg2:View3D=null):void{ for each (_faceMaterialVO in _faceDictionary) { _faceMaterialVO.invalidated = true; }; } } }//package away3d.materials
Section 142
//WireColorMaterial (away3d.materials.WireColorMaterial) package away3d.materials { import flash.events.*; import away3d.containers.*; import away3d.events.*; import away3d.core.draw.*; import away3d.core.utils.*; import away3d.core.base.*; public class WireColorMaterial extends EventDispatcher 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 updateMaterial(_arg1:Object3D, _arg2:View3D):void{ } public function renderTriangle(_arg1:DrawTriangle):void{ _arg1.source.session.renderTriangleLineFill(width, color, alpha, wirecolor, wirealpha, _arg1.v0, _arg1.v1, _arg1.v2); } public function removeOnMaterialUpdate(_arg1:Function):void{ removeEventListener(MaterialEvent.MATERIAL_UPDATED, _arg1, false); } public function addOnMaterialUpdate(_arg1:Function):void{ addEventListener(MaterialEvent.MATERIAL_UPDATED, _arg1, false, 0, true); } } }//package away3d.materials
Section 143
//WireframeMaterial (away3d.materials.WireframeMaterial) package away3d.materials { import flash.events.*; import away3d.containers.*; import away3d.events.*; import away3d.core.draw.*; import away3d.core.utils.*; import away3d.core.base.*; public class WireframeMaterial extends EventDispatcher implements ITriangleMaterial, ISegmentMaterial { public var color:int; protected var ini:Init; public var width:Number; public var alpha:Number; public function WireframeMaterial(_arg1=null, _arg2:Object=null){ if (_arg1 == null){ _arg1 = "random"; }; this.color = Cast.trycolor(_arg1); ini = Init.parse(_arg2); alpha = ini.getNumber("alpha", 1, {min:0, max:1}); width = ini.getNumber("width", 1, {min:0}); } public function renderTriangle(_arg1:DrawTriangle):void{ if (alpha <= 0){ return; }; _arg1.source.session.renderTriangleLine(width, color, alpha, _arg1.v0, _arg1.v1, _arg1.v2); } public function updateMaterial(_arg1:Object3D, _arg2:View3D):void{ } public function get visible():Boolean{ return ((alpha > 0)); } public function removeOnMaterialUpdate(_arg1:Function):void{ removeEventListener(MaterialEvent.MATERIAL_UPDATED, _arg1, false); } public function renderSegment(_arg1:DrawSegment):void{ if (alpha <= 0){ return; }; _arg1.source.session.renderLine(_arg1.v0, _arg1.v1, width, color, alpha); } public function addOnMaterialUpdate(_arg1:Function):void{ addEventListener(MaterialEvent.MATERIAL_UPDATED, _arg1, false, 0, true); } } }//package away3d.materials
Section 144
//CubeMaterialsData (away3d.primitives.data.CubeMaterialsData) package away3d.primitives.data { import flash.events.*; import away3d.events.*; import away3d.core.utils.*; 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") as ITriangleMaterial); _right = (ini.getMaterial("right") as ITriangleMaterial); _bottom = (ini.getMaterial("bottom") as ITriangleMaterial); _top = (ini.getMaterial("top") as ITriangleMaterial); _front = (ini.getMaterial("front") as ITriangleMaterial); _back = (ini.getMaterial("back") as ITriangleMaterial); } 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.MATERIAL_CHANGED, _arg1, false); } public function get right():ITriangleMaterial{ return (_right); } private function notifyMaterialChange(_arg1:ITriangleMaterial, _arg2:String):void{ if (!hasEventListener(MaterialEvent.MATERIAL_CHANGED)){ return; }; _materialchanged = new MaterialEvent(MaterialEvent.MATERIAL_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.MATERIAL_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 145
//AbstractPrimitive (away3d.primitives.AbstractPrimitive) package away3d.primitives { import away3d.core.base.*; import away3d.materials.*; import away3d.*; public class AbstractPrimitive extends Mesh { var _uv:UV; var _uvStore:Array; var _faceStore:Array; var _primitiveDirty:Boolean; private var _index:int; 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); } 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; _objectDirty = true; _index = faces.length; while (_index--) { removeFace(faces[_index]); }; _vStore = _vStore.concat(_vActive); _vActive = []; _uvStore = _uvStore.concat(_uvActive); _uvActive = []; _faceStore = _faceStore.concat(_faceActive); _faceActive = []; } 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); } override public function updateObject():void{ if (_primitiveDirty){ buildPrimitive(); }; super.updateObject(); } 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 146
//AbstractWirePrimitive (away3d.primitives.AbstractWirePrimitive) package away3d.primitives { import away3d.core.utils.*; import away3d.core.base.*; import away3d.materials.*; public class AbstractWirePrimitive extends Mesh { var _segment:Segment; var _vStore:Array; var _segmentStore:Array; var _primitiveDirty:Boolean; private var _index:int; 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 updateObject():void{ if (_primitiveDirty){ buildPrimitive(); }; super.updateObject(); } public function buildPrimitive():void{ _primitiveDirty = false; _index = segments.length; while (_index--) { removeSegment(segments[_index]); }; _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 147
//Sphere (away3d.primitives.Sphere) package away3d.primitives { import away3d.core.utils.*; 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 148
//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 149
//WireSphere (away3d.primitives.WireSphere) package away3d.primitives { import away3d.core.base.*; public class WireSphere extends AbstractWirePrimitive { private var grid:Array; private var _segmentsH:int; private var _radius:Number; private var _yUp:Boolean; private var _segmentsW:int; public function WireSphere(_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); buildWireSphere(_radius, _segmentsW, _segmentsH, _yUp); type = "WireSphere"; url = "primitive"; } private function buildWireSphere(_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; 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]; addSegment(createSegment(_local15, _local18)); addSegment(createSegment(_local16, _local17)); if (_local6 < _arg3){ addSegment(createSegment(_local15, _local16)); }; _local5++; }; _local6++; }; } 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); } override public function buildPrimitive():void{ super.buildPrimitive(); buildWireSphere(_radius, _segmentsW, _segmentsH, _yUp); } public function set segmentsH(_arg1:Number):void{ if (_segmentsH == _arg1){ return; }; _segmentsH = _arg1; _primitiveDirty = true; } } }//package away3d.primitives
Section 150
//DirSprite2D (away3d.sprites.DirSprite2D) package away3d.sprites { import flash.display.*; import flash.utils.*; import away3d.core.utils.*; import away3d.core.base.*; import away3d.core.project.*; public class DirSprite2D extends Object3D { public var deltaZ:Number; private var _bitmaps:Dictionary; public var scaling:Number; public var smooth:Boolean; private var _vertices:Array; public var rotation:Number; public function DirSprite2D(_arg1:Object=null){ var _local3:Init; var _local4:Number; var _local5:Number; var _local6:Number; var _local7:BitmapData; _vertices = []; _bitmaps = new Dictionary(true); super(_arg1); scaling = ini.getNumber("scaling", 1, {min:0}); rotation = ini.getNumber("rotation", 0); smooth = ini.getBoolean("smooth", false); deltaZ = ini.getNumber("deltaZ", 0); var _local2:Array = ini.getArray("bitmaps"); for each (_local3 in _local2) { _local3 = Init.parse(_local3); _local4 = _local3.getNumber("x", 0); _local5 = _local3.getNumber("y", 0); _local6 = _local3.getNumber("z", 0); _local7 = _local3.getBitmap("bitmap"); add(_local4, _local5, _local6, _local7); }; projectorType = ProjectorType.DIR_SPRITE; } public function add(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:BitmapData):void{ var _local6:Vertex; if (_arg4){ for each (_local6 in _vertices) { if ((((((_local6.x == _arg1)) && ((_local6.y == _arg2)))) && ((_local6.z == _arg3)))){ Debug.warning(("Same base point for two bitmaps: " + _local6)); return; }; }; }; var _local5:Vertex = new Vertex(_arg1, _arg2, _arg3); _vertices.push(_local5); _bitmaps[_local5] = _arg4; } public function get bitmaps():Dictionary{ return (_bitmaps); } public function get vertices():Array{ return (_vertices); } } }//package away3d.sprites
Section 151
//DofSprite2D (away3d.sprites.DofSprite2D) package away3d.sprites { import flash.display.*; import away3d.core.base.*; import away3d.core.project.*; public class DofSprite2D extends Object3D { public var deltaZ:Number; public var smooth:Boolean; public var scaling:Number; public var rotation:Number; public var bitmap:BitmapData; public function DofSprite2D(_arg1:BitmapData, _arg2:Object=null){ 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); projectorType = ProjectorType.DOF_SPRITE; } } }//package away3d.sprites
Section 152
//MovieClipSprite (away3d.sprites.MovieClipSprite) package away3d.sprites { import flash.display.*; import away3d.core.draw.*; import away3d.core.base.*; import away3d.core.project.*; public class MovieClipSprite extends Object3D { public var movieclip:DisplayObject; public var deltaZ:Number; public var align:String; private var _ddo:DrawDisplayObject; private var _sc:ScreenVertex; private var _center:Vertex; public var rescale:Boolean; private var _persp:Number; public var scaling:Number; public function MovieClipSprite(_arg1:DisplayObject, _arg2:Object=null){ _center = new Vertex(); super(_arg2); this.movieclip = _arg1; scaling = ini.getNumber("scaling", 1); deltaZ = ini.getNumber("deltaZ", 0); rescale = ini.getBoolean("rescale", false); align = ini.getString("align", "center"); projectorType = ProjectorType.MOVIE_CLIP_SPRITE; } } }//package away3d.sprites
Section 153
//Sprite2D (away3d.sprites.Sprite2D) package away3d.sprites { import flash.display.*; import away3d.core.base.*; import away3d.core.project.*; public class Sprite2D extends Object3D { public var deltaZ:Number; public var smooth:Boolean; public var scaling:Number; public var rotation:Number; public var bitmap:BitmapData; public function Sprite2D(_arg1:BitmapData, _arg2:Object=null){ 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); projectorType = ProjectorType.SPRITE; } } }//package away3d.sprites
Section 154
//arcane (away3d.arcane) package away3d { public namespace arcane; }//package away3d
Section 155
//AnimatedBillBoardSprite (com.core.models.AnimatedBillBoardSprite) package com.core.models { import flash.events.*; import flash.display.*; import gs.*; import away3d.containers.*; import away3d.events.*; import flash.utils.*; import away3d.core.traverse.*; import com.core.*; import away3d.sprites.*; public class AnimatedBillBoardSprite extends DirSprite2D { public var _traverser:TickTraverser; private var _speed:Number;// = 4 private var _hitter:ObjectContainer3D; private var _clickLockTimer:Timer; private var _snInt:Number; private var _tm:Number;// = 0 public var nextthink:int; private var _bitmapAr:Array; public var lastmove:int; public var role:String; private var _sn:Number;// = 0 public static const BILLBOARDHIT_EVENT:String = " billboard hit"; public static const BILLBOARDREADY_EVENT:String = " billboard ready"; public function AnimatedBillBoardSprite(_arg1:MovieClip, _arg2:Object=null){ var _local6:BitmapData; _bitmapAr = new Array(); _snInt = (Math.random() * 1.1); _clickLockTimer = new Timer(200, 1); _hitter = new ObjectContainer3D(); super(_arg2); var _local3:Timer = new Timer(20); _local3.addEventListener(TimerEvent.TIMER, run); _local3.start(); this.useHandCursor = true; this.addOnMouseOver(ovr); this.addOnMouseOut(ot); this.addOnMouseDown(hit); var _local4:Number = 0; while (_local4 < 8) { _local6 = new BitmapData(_arg1.width, _arg1.height, true, 0); _arg1.gotoAndStop((_local4 + 1)); _local6.draw(_arg1); switch (_local4){ case 0: add(0, 0, -1, _local6); break; case 1: add(-0.7, 0, -0.7, _local6); break; case 2: add(-1, 0, 0, _local6); break; case 3: add(-0.7, 0, 0.7, _local6); break; case 4: add(0, 0, 1, _local6); break; case 5: add(0.7, 0, 0.7, _local6); break; case 6: add(1, 0, 0, _local6); break; case 7: add(0.7, 0, -0.7, _local6); break; }; _local4++; }; var _local5:Timer = new Timer(300, 1); _local5.addEventListener(TimerEvent.TIMER_COMPLETE, dis); _local5.start(); } private function run(_arg1:Event):void{ _tm = (_tm + 1); tickz(); } private function hit(_arg1:MouseEvent3D):void{ if (((GameManager.gameActive) && (SandWich.readyHack))){ remColor(); trace(("HIT" + this.name)); Main.hitCycle.inner.gotoAndPlay(2); this.visible = false; dispatchEvent(new Event(BILLBOARDHIT_EVENT, true)); }; _arg1.target._clickLockTimer.start(); } public function get myName():String{ return (this.name); } private function dis(_arg1:Event):void{ dispatchEvent(new Event(BILLBOARDREADY_EVENT, true)); } private function ot(_arg1:MouseEvent3D):void{ remColor(); } private function remColor():void{ TweenFilterLite.to(Main.cursor, 0.01, {colorMatrixFilter:{colorize:8639219, amount:0}}); } private function ovr(_arg1:MouseEvent3D):void{ if (GameManager.gameActive){ TweenFilterLite.to(Main.cursor, 0.1, {colorMatrixFilter:{colorize:8639219, amount:1}}); }; } public function get cont():ObjectContainer3D{ return (_hitter); } public function tickz():void{ _sn = (_sn + _snInt); y = (y + ((_snInt * 2) * Math.sin((_sn / 6)))); if ((((role == null)) || ((nextthink < _tm)))){ role = ["stop", "right", "left", "forward", "backward", "front_right", "front_left", "back_left", "back_right"][int((Math.random() * 8))]; if ((((Math.abs(x) > 300)) || ((Math.abs(z) > 300)))){ role = ["stop", "right", "left", "forward", "backward", "front_right", "front_left", "back_left", "back_right"][int((Math.random() * 8))]; }; nextthink = (_tm + (Math.random() * 200)); }; var _local1:Number = ((lastmove - _tm) / 100); switch (role){ case "stop": break; case "right": rotationY = -90; moveForward(_speed); break; case "left": rotationY = 90; moveForward(_speed); break; case "front_right": rotationY = -120; moveRight(_speed); break; case "front_left": rotationY = 120; moveLeft(_speed); break; case "back_left": rotationY = 60; moveRight(_speed); break; case "back_right": rotationY = -60; moveLeft(_speed); break; case "forward": rotationY = 180; moveBackward(_speed); break; case "backward": rotationY = 0; moveBackward(_speed); break; }; lastmove = _tm; if (x > 300){ x = 300; }; if (x < -300){ x = -300; }; if (z > 300){ z = 300; }; if (z < -300){ z = -300; }; } } }//package com.core.models
Section 156
//BaconStrip (com.core.models.BaconStrip) package com.core.models { import away3d.core.utils.*; import away3d.core.base.*; public class BaconStrip extends Mesh { private var uvarr:Array; private var scaling:Number; private var varr:Array; public function BaconStrip(_arg1:Object=null){ varr = []; uvarr = []; super(_arg1); _arg1 = Init.parse(_arg1); scaling = _arg1.getNumber("scaling", 1); build(); type = ".as"; } private function uv(_arg1:Number, _arg2:Number):void{ uvarr.push(new UV(_arg1, _arg2)); } private function build():void{ v(611.7107, -228.548, -114.4355); v(611.7107, -225.807, 44.6959); v(611.7107, -219.4114, -114.4355); v(611.7107, -216.6703, 44.6959); v(545.6537, -120.735, -136.086); v(545.6537, -117.0803, 63.0989); v(540.9353, -128.958, 84.7494); v(540.9353, -133.5264, -157.7365); v(73.8177, -9.2673, 100.9873); v(73.8177, -14.7493, -175.0569); v(73.8177, -0.1306, -152.3239); v(78.5361, 4.4378, 76.0892); v(-586.7526, -38.5047, -103.6102); v(-586.7526, -44.9004, 36.0357); v(-591.471, -47.6414, -103.6102); v(-586.7526, -35.7637, 36.0357); uv(0.9814, 0); uv(0.9804, 0.132); uv(1, 0.001); uv(1, 0.001); uv(0.9804, 0.132); uv(0.999, 0.132); uv(0.0645, 0.9238); uv(0.3832, 1); uv(0.4194, 0.9238); uv(0.0645, 0.9238); uv(0.1007, 1); uv(0.3832, 1); uv(0.4194, 0.9238); uv(0.3832, 1); uv(0.4575, 0.9247); uv(0.4575, 0.9247); uv(0.3832, 1); uv(0.3832, 1); uv(0.0274, 0.9238); uv(0.1007, 1); uv(0.0645, 0.9238); uv(0.0274, 0.9238); uv(0.1007, 1); uv(0.1007, 1); uv(0.9472, 0.0762); uv(0.5914, 0.001); uv(0.5181, 0.0772); uv(0.9472, 0.0762); uv(0.8729, 0); uv(0.5914, 0.001); uv(0.9804, 0.4809); uv(0.5181, 0.0772); uv(0.4897, 0.4819); uv(0.9804, 0.4809); uv(0.9472, 0.0762); uv(0.5181, 0.0772); uv(0, 0.5191); uv(0.0274, 0.9238); uv(0.042, 0.5191); uv(0.042, 0.5191); uv(0.0274, 0.9238); uv(0.0645, 0.9238); uv(0.4477, 0.5191); uv(0.4575, 0.9247); uv(0.4897, 0.52); uv(0.4477, 0.5191); uv(0.4194, 0.9238); uv(0.4575, 0.9247); uv(0.042, 0.5191); uv(0.0645, 0.9238); uv(0.4477, 0.5191); uv(0.4477, 0.5191); uv(0.0645, 0.9238); uv(0.4194, 0.9238); uv(0.9961, 0.2483); uv(0.9814, 0.132); uv(0.9804, 0.2483); uv(0.9961, 0.2483); uv(0.9971, 0.132); uv(0.9814, 0.132); uv(0.4897, 0.52); uv(0.3724, 0.001); uv(0.4477, 0.5191); uv(0.4897, 0.52); uv(0.3724, 0.001); uv(0.3724, 0.001); uv(0.1232, 0.001); uv(0, 0.5191); uv(0.1232, 0); uv(0.1232, 0); uv(0, 0.5191); uv(0.042, 0.5191); uv(0.1232, 0); uv(0.4477, 0.5191); uv(0.3724, 0.001); uv(0.1232, 0); uv(0.042, 0.5191); uv(0.4477, 0.5191); uv(0.6139, 1); uv(0.9804, 0.4809); uv(0.4897, 0.4819); uv(0.6139, 1); uv(0.8631, 1); uv(0.9804, 0.4809); f(0, 1, 2, 0, 1, 2); f(2, 1, 3, 3, 4, 5); f(4, 3, 5, 6, 7, 8); f(4, 2, 3, 9, 10, 11); f(5, 3, 6, 12, 13, 14); f(6, 3, 1, 15, 16, 17); f(7, 2, 4, 18, 19, 20); f(7, 0, 2, 21, 22, 23); f(6, 0, 7, 24, 25, 26); f(6, 1, 0, 27, 28, 29); f(8, 7, 9, 30, 31, 32); f(8, 6, 7, 33, 34, 35); f(9, 7, 10, 36, 37, 38); f(10, 7, 4, 39, 40, 41); f(11, 6, 8, 42, 43, 44); f(11, 5, 6, 45, 46, 47); f(10, 4, 11, 48, 49, 50); f(11, 4, 5, 51, 52, 53); f(12, 13, 14, 54, 55, 56); f(12, 15, 13, 57, 58, 59); f(8, 15, 11, 60, 61, 62); f(8, 13, 15, 63, 64, 65); f(14, 9, 12, 66, 67, 68); f(12, 9, 10, 69, 70, 71); f(12, 11, 15, 72, 73, 74); f(12, 10, 11, 75, 76, 77); f(14, 8, 9, 78, 79, 80); f(14, 13, 8, 81, 82, 83); } private function f(_arg1:int, _arg2:int, _arg3:int, _arg4:int, _arg5:int, _arg6:int):void{ addFace(new Face(varr[_arg1], varr[_arg2], varr[_arg3], null, uvarr[_arg4], uvarr[_arg5], uvarr[_arg6])); } private function v(_arg1:Number, _arg2:Number, _arg3:Number):void{ varr.push(new Vertex((_arg1 * scaling), (_arg2 * scaling), (_arg3 * scaling))); } } }//package com.core.models
Section 157
//BreadSlice (com.core.models.BreadSlice) package com.core.models { import away3d.core.utils.*; import away3d.core.base.*; public class BreadSlice extends Mesh { private var uvarr:Array; private var scaling:Number; private var varr:Array; public function BreadSlice(_arg1:Object=null){ varr = []; uvarr = []; super(_arg1); _arg1 = Init.parse(_arg1); scaling = _arg1.getNumber("scaling", 1); build(); type = ".as"; } private function uv(_arg1:Number, _arg2:Number):void{ uvarr.push(new UV(_arg1, _arg2)); } private function build():void{ v(-481.7653, -14.9817, -132.0451); v(-481.7653, -14.9817, 387.8955); v(-273.2151, -21.3165, 479.1617); v(-442.8359, -16.4436, 440.4427); v(-442.8359, 80.0404, -184.5923); v(-273.2151, 80.0404, 479.1617); v(-442.8359, 80.0404, 440.4427); v(-273.2151, 80.0404, -223.3113); v(-484.5459, 80.0404, 387.8955); v(-442.8359, -16.4436, -184.5923); v(-481.7653, 80.0404, -132.0451); v(-273.2151, -21.3165, -223.3113); v(224.5246, 84.9133, 481.9273); v(224.5246, 84.9133, -223.3113); v(224.5246, -39.3464, 479.1617); v(224.5246, -39.3464, -223.3113); uv(0, 0.6481); uv(0, 0.9443); uv(0.1193, 0.9971); uv(0.1193, 0.9971); uv(0, 0.9443); uv(0.0225, 0.9736); uv(0.9765, 0.3783); uv(0.6012, 0.2825); uv(0.6237, 0.3783); uv(0.9765, 0.3783); uv(0.999, 0.2825); uv(0.6012, 0.2825); uv(0, 0.3314); uv(0.0792, 0.2639); uv(0, 0.2522); uv(0, 0.3314); uv(0.087, 0.3167); uv(0.0792, 0.2639); uv(0.391, 0.5846); uv(0.3695, 0.4936); uv(0.305, 0.5953); uv(0.305, 0.5953); uv(0.3695, 0.4936); uv(0.3079, 0.4966); uv(0.3079, 0.4966); uv(0.087, 0.3167); uv(0.305, 0.5953); uv(0.305, 0.5953); uv(0.087, 0.3167); uv(0, 0.3314); uv(0.1193, 0.9971); uv(0.1193, 0.5953); uv(0, 0.6481); uv(0, 0.6481); uv(0.1193, 0.5953); uv(0.0225, 0.6188); uv(0.0792, 0.2639); uv(0.1437, 0.1711); uv(0, 0.2522); uv(0, 0.2522); uv(0.1437, 0.1711); uv(0.0948, 0.13); uv(0.391, 0.5846); uv(0.4506, 0.434); uv(0.3695, 0.4936); uv(0.391, 0.5846); uv(0.5161, 0.4809); uv(0.4506, 0.434); uv(0.6237, 0.3783); uv(0.9453, 0.4203); uv(0.9765, 0.3783); uv(0.6237, 0.3783); uv(0.6745, 0.4233); uv(0.9453, 0.4203); uv(0.2952, 0.0704); uv(0.5327, 0.1965); uv(0.3021, 0); uv(0.3021, 0); uv(0.5327, 0.1965); uv(0.6012, 0.173); uv(0.5161, 0.4809); uv(0.5327, 0.1965); uv(0.4506, 0.434); uv(0.5161, 0.4809); uv(0.6012, 0.173); uv(0.5327, 0.1965); uv(0.3021, 0); uv(0.0948, 0.13); uv(0.2952, 0.0704); uv(0.2952, 0.0704); uv(0.0948, 0.13); uv(0.1437, 0.1711); uv(0.6012, 0); uv(0.6012, 0.2825); uv(1, 0.001); uv(1, 0.001); uv(0.6012, 0.2825); uv(0.999, 0.2825); uv(0.4027, 0.9971); uv(0.1193, 0.5953); uv(0.1193, 0.9971); uv(0.4027, 0.9971); uv(0.4027, 0.5953); uv(0.1193, 0.5953); f(0, 1, 2, 0, 1, 2); f(2, 1, 3, 3, 4, 5); f(4, 5, 6, 6, 7, 8); f(4, 7, 5, 9, 10, 11); f(1, 6, 3, 12, 13, 14); f(1, 8, 6, 15, 16, 17); f(9, 4, 0, 18, 19, 20); f(0, 4, 10, 21, 22, 23); f(10, 8, 0, 24, 25, 26); f(0, 8, 1, 27, 28, 29); f(2, 11, 0, 30, 31, 32); f(0, 11, 9, 33, 34, 35); f(6, 5, 3, 36, 37, 38); f(3, 5, 2, 39, 40, 41); f(9, 7, 4, 42, 43, 44); f(9, 11, 7, 45, 46, 47); f(6, 10, 4, 48, 49, 50); f(6, 8, 10, 51, 52, 53); f(12, 13, 14, 54, 55, 56); f(14, 13, 15, 57, 58, 59); f(11, 13, 7, 60, 61, 62); f(11, 15, 13, 63, 64, 65); f(14, 2, 12, 66, 67, 68); f(12, 2, 5, 69, 70, 71); f(12, 5, 13, 72, 73, 74); f(13, 5, 7, 75, 76, 77); f(14, 11, 2, 78, 79, 80); f(14, 15, 11, 81, 82, 83); } private function f(_arg1:int, _arg2:int, _arg3:int, _arg4:int, _arg5:int, _arg6:int):void{ addFace(new Face(varr[_arg1], varr[_arg2], varr[_arg3], null, uvarr[_arg4], uvarr[_arg5], uvarr[_arg6])); } private function v(_arg1:Number, _arg2:Number, _arg3:Number):void{ varr.push(new Vertex((_arg1 * scaling), (_arg2 * scaling), (_arg3 * scaling))); } } }//package com.core.models
Section 158
//Burger (com.core.models.Burger) package com.core.models { import away3d.core.utils.*; import away3d.core.base.*; public class Burger extends Mesh { private var uvarr:Array; private var scaling:Number; private var varr:Array; public function Burger(_arg1:Object=null){ varr = []; uvarr = []; super(_arg1); _arg1 = Init.parse(_arg1); scaling = _arg1.getNumber("scaling", 1); build(); type = ".as"; } private function uv(_arg1:Number, _arg2:Number):void{ uvarr.push(new UV(_arg1, _arg2)); } private function build():void{ v(510.2167, -3.6595, 45.3062); v(240.254, 39.9661, -378.5418); v(323.6248, -9.6356, -457.194); v(383.1754, 52.5159, 45.3062); v(240.254, -24.5759, -378.5418); v(387.1455, -27.5639, 45.3062); v(287.8945, -25.7711, 324.9584); v(387.1455, -7.8428, 425.4584); v(283.9244, 44.1494, 324.9584); v(6.0217, -19.795, -562.0636); v(6.0217, -36.5281, -457.194); v(6.0217, 36.978, -457.194); v(-228.2106, 25.6234, -378.5418); v(-311.5814, -29.9544, -457.194); v(-228.2106, -39.5162, -378.5418); v(-502.1433, -35.9305, 45.3062); v(-371.132, -51.4684, 45.3062); v(-375.102, 28.6115, 45.3062); v(-275.851, 26.221, 324.9584); v(-375.102, -31.7472, 425.4584); v(-275.851, -43.6994, 324.9584); v(6.0217, -19.795, 552.1758); v(6.0217, -39.5162, 425.4584); v(6.0217, 40.5637, 425.4584); v(2.0517, 100.9224, 45.3062); v(6.0217, -46.6875, 45.3062); uv(0.0137, 0.4301); uv(0.2121, 0.2366); uv(0.1848, 0.1711); uv(0.0137, 0.4301); uv(0.0743, 0.4555); uv(0.2121, 0.2366); uv(0.9863, 0.4301); uv(0.7879, 0.2356); uv(0.9247, 0.4555); uv(0.9863, 0.4301); uv(0.8143, 0.1711); uv(0.7879, 0.2356); uv(0.9863, 0.4301); uv(0.9228, 0.6413); uv(0.9863, 0.6804); uv(0.9863, 0.4301); uv(0.9247, 0.4555); uv(0.9228, 0.6413); uv(0.0137, 0.4301); uv(0.0762, 0.6413); uv(0.0743, 0.4555); uv(0.0137, 0.4301); uv(0.0127, 0.6794); uv(0.0762, 0.6413); uv(0.6452, 0.1711); uv(0.7879, 0.2356); uv(0.8143, 0.1711); uv(0.6452, 0.1711); uv(0.6618, 0.2336); uv(0.7879, 0.2356); uv(0.3539, 0.1711); uv(0.2121, 0.2366); uv(0.3372, 0.2346); uv(0.3539, 0.1711); uv(0.1848, 0.1711); uv(0.2121, 0.2366); uv(0.3539, 0.1711); uv(0.437, 0.3294); uv(0.4888, 0.2962); uv(0.3539, 0.1711); uv(0.3372, 0.2346); uv(0.437, 0.3294); uv(0.6452, 0.1711); uv(0.563, 0.3284); uv(0.6618, 0.2336); uv(0.6452, 0.1711); uv(0.5103, 0.2962); uv(0.563, 0.3284); uv(0.4995, 0.6305); uv(0.563, 0.3284); uv(0.5103, 0.2962); uv(0.4995, 0.6305); uv(0.5601, 0.6051); uv(0.563, 0.3284); uv(0.4995, 0.6305); uv(0.437, 0.3294); uv(0.4389, 0.6061); uv(0.4995, 0.6305); uv(0.4888, 0.2962); uv(0.437, 0.3294); uv(0.4995, 0.6305); uv(0.347, 0.7527); uv(0.3773, 0.8299); uv(0.4995, 0.6305); uv(0.4389, 0.6061); uv(0.347, 0.7527); uv(0.4995, 0.6305); uv(0.653, 0.7527); uv(0.5601, 0.6051); uv(0.4995, 0.6305); uv(0.6207, 0.8299); uv(0.653, 0.7527); uv(0.824, 0.8299); uv(0.653, 0.7527); uv(0.6207, 0.8299); uv(0.824, 0.8299); uv(0.8035, 0.7546); uv(0.653, 0.7527); uv(0.175, 0.8299); uv(0.347, 0.7527); uv(0.1955, 0.7556); uv(0.175, 0.8299); uv(0.3773, 0.8299); uv(0.347, 0.7527); uv(0.175, 0.8299); uv(0.0762, 0.6413); uv(0.0127, 0.6794); uv(0.175, 0.8299); uv(0.1955, 0.7556); uv(0.0762, 0.6413); uv(0.824, 0.8299); uv(0.9228, 0.6413); uv(0.8035, 0.7546); uv(0.824, 0.8299); uv(0.9863, 0.6804); uv(0.9228, 0.6413); uv(0.2581, 0.5318); uv(0.347, 0.7527); uv(0.4389, 0.6061); uv(0.2581, 0.5318); uv(0.1955, 0.7556); uv(0.347, 0.7527); uv(0.2581, 0.5318); uv(0.437, 0.3294); uv(0.3372, 0.2346); uv(0.2581, 0.5318); uv(0.4389, 0.6061); uv(0.437, 0.3294); uv(0.2581, 0.5318); uv(0.2121, 0.2366); uv(0.0743, 0.4555); uv(0.2581, 0.5318); uv(0.3372, 0.2346); uv(0.2121, 0.2366); uv(0.2581, 0.5318); uv(0.0762, 0.6413); uv(0.1955, 0.7556); uv(0.2581, 0.5318); uv(0.0743, 0.4555); uv(0.0762, 0.6413); uv(0.7429, 0.5308); uv(0.7879, 0.2356); uv(0.6618, 0.2336); uv(0.7429, 0.5308); uv(0.9247, 0.4555); uv(0.7879, 0.2356); uv(0.7429, 0.5308); uv(0.563, 0.3284); uv(0.5601, 0.6051); uv(0.7429, 0.5308); uv(0.6618, 0.2336); uv(0.563, 0.3284); uv(0.7429, 0.5308); uv(0.653, 0.7527); uv(0.8035, 0.7546); uv(0.7429, 0.5308); uv(0.5601, 0.6051); uv(0.653, 0.7527); uv(0.7429, 0.5308); uv(0.9228, 0.6413); uv(0.9247, 0.4555); uv(0.7429, 0.5308); uv(0.8035, 0.7546); uv(0.9228, 0.6413); f(0, 1, 2, 0, 1, 2); f(0, 3, 1, 3, 4, 5); f(0, 4, 5, 6, 7, 8); f(0, 2, 4, 9, 10, 11); f(0, 6, 7, 12, 13, 14); f(0, 5, 6, 15, 16, 17); f(0, 8, 3, 18, 19, 20); f(0, 7, 8, 21, 22, 23); f(9, 4, 2, 24, 25, 26); f(9, 10, 4, 27, 28, 29); f(9, 1, 11, 30, 31, 32); f(9, 2, 1, 33, 34, 35); f(9, 12, 13, 36, 37, 38); f(9, 11, 12, 39, 40, 41); f(9, 14, 10, 42, 43, 44); f(9, 13, 14, 45, 46, 47); f(15, 14, 13, 48, 49, 50); f(15, 16, 14, 51, 52, 53); f(15, 12, 17, 54, 55, 56); f(15, 13, 12, 57, 58, 59); f(15, 18, 19, 60, 61, 62); f(15, 17, 18, 63, 64, 65); f(15, 20, 16, 66, 67, 68); f(15, 19, 20, 69, 70, 71); f(21, 20, 19, 72, 73, 74); f(21, 22, 20, 75, 76, 77); f(21, 18, 23, 78, 79, 80); f(21, 19, 18, 81, 82, 83); f(21, 8, 7, 84, 85, 86); f(21, 23, 8, 87, 88, 89); f(21, 6, 22, 90, 91, 92); f(21, 7, 6, 93, 94, 95); f(24, 18, 17, 96, 97, 98); f(24, 23, 18, 99, 100, 101); f(24, 12, 11, 102, 103, 104); f(24, 17, 12, 105, 106, 107); f(24, 1, 3, 108, 109, 110); f(24, 11, 1, 111, 112, 113); f(24, 8, 23, 114, 115, 116); f(24, 3, 8, 117, 118, 119); f(25, 4, 10, 120, 121, 122); f(25, 5, 4, 123, 124, 125); f(25, 14, 16, 126, 127, 128); f(25, 10, 14, 129, 130, 131); f(25, 20, 22, 132, 133, 134); f(25, 16, 20, 135, 136, 137); f(25, 6, 5, 138, 139, 140); f(25, 22, 6, 141, 142, 143); } private function f(_arg1:int, _arg2:int, _arg3:int, _arg4:int, _arg5:int, _arg6:int):void{ addFace(new Face(varr[_arg1], varr[_arg2], varr[_arg3], null, uvarr[_arg4], uvarr[_arg5], uvarr[_arg6])); } private function v(_arg1:Number, _arg2:Number, _arg3:Number):void{ varr.push(new Vertex((_arg1 * scaling), (_arg2 * scaling), (_arg3 * scaling))); } } }//package com.core.models
Section 159
//CheeseSlice (com.core.models.CheeseSlice) package com.core.models { import away3d.core.utils.*; import away3d.core.base.*; public class CheeseSlice extends Mesh { private var uvarr:Array; private var scaling:Number; private var varr:Array; public function CheeseSlice(_arg1:Object=null){ varr = []; uvarr = []; super(_arg1); _arg1 = Init.parse(_arg1); scaling = _arg1.getNumber("scaling", 1); build(); type = ".as"; } private function uv(_arg1:Number, _arg2:Number):void{ uvarr.push(new UV(_arg1, _arg2)); } private function build():void{ v(-1.3548, 6.7219, 98.8222); v(115.1622, 6.6103, 119.4297); v(-95.2911, 6.6103, 118.493); v(105.2267, 6.7219, 98.8222); v(-108.8396, 6.7219, 98.8222); v(105.2267, -0.0279, 98.8222); v(115.1622, -6.6661, 118.493); v(105.2267, -6.7776, 98.8222); v(-1.3548, -6.7776, 98.8222); v(-95.2911, -6.6661, 118.493); v(-108.8396, -6.7776, 98.8222); v(-1.3548, 7.1124, -101.6323); v(-105.2267, 6.4987, -119.4297); v(102.517, 6.4987, -119.4297); v(-115.1622, 7.1124, -101.6323); v(111.5493, 7.1124, -101.6323); v(111.5493, -0.0279, -101.6323); v(102.517, -6.5545, -119.4297); v(111.5493, -7.1123, -101.6323); v(-1.3548, -7.1123, -101.6323); v(-105.2267, -6.5545, -119.4297); v(-115.1622, -7.1123, -101.6323); v(108.8396, 6.8892, -1.4051); v(108.8396, -0.0279, -1.4051); v(108.8396, -6.945, -1.4051); v(-111.5493, 6.8892, -1.4051); v(-111.5493, -6.945, -1.4051); v(-1.3548, 6.8892, -1.4051); v(-1.3548, -6.945, -1.4051); uv(0.2493, 0.4614); uv(0, 0.5083); uv(0.4516, 0.5005); uv(0.0205, 0.4663); uv(0, 0.5083); uv(0.2493, 0.4614); uv(0.2493, 0.4614); uv(0.4516, 0.5005); uv(0.479, 0.4575); uv(0.9834, 0.4575); uv(0.9687, 0.5005); uv(0.9971, 0.5015); uv(0.9687, 0.4575); uv(0.9687, 0.5005); uv(0.9834, 0.4575); uv(0.9834, 0.4575); uv(0.9971, 0.5015); uv(0.9971, 0.4575); uv(0.7185, 0.4614); uv(0.5161, 0.5005); uv(0.9687, 0.5083); uv(0.4897, 0.4575); uv(0.5161, 0.5005); uv(0.7185, 0.4614); uv(0.7185, 0.4614); uv(0.9687, 0.5083); uv(0.9472, 0.4663); uv(0.2414, 0.044); uv(0.4633, 0); uv(0.0186, 0.0088); uv(0.4839, 0.0391); uv(0.4633, 0); uv(0.2414, 0.044); uv(0.2414, 0.044); uv(0.0186, 0.0088); uv(0, 0.0479); uv(0.9844, 0.0401); uv(0.998, 0.001); uv(0.9707, 0); uv(0.999, 0.0411); uv(0.998, 0.001); uv(0.9844, 0.0401); uv(0.9844, 0.0401); uv(0.9707, 0); uv(0.9687, 0.0401); uv(0.7263, 0.044); uv(0.9492, 0.0088); uv(0.5044, 0); uv(0.9687, 0.0479); uv(0.9492, 0.0088); uv(0.7263, 0.044); uv(0.7263, 0.044); uv(0.5044, 0); uv(0.4839, 0.0391); uv(0.998, 0.2493); uv(0.9844, 0.0401); uv(0.9834, 0.2493); uv(0.998, 0.2493); uv(0.999, 0.0411); uv(0.9844, 0.0401); uv(0.9834, 0.2493); uv(0.9844, 0.0401); uv(0.9687, 0.2493); uv(0.9687, 0.2493); uv(0.9844, 0.0401); uv(0.9687, 0.0401); uv(0.9971, 0.4575); uv(0.9834, 0.2493); uv(0.9834, 0.4575); uv(0.9971, 0.4575); uv(0.998, 0.2493); uv(0.9834, 0.2493); uv(0.9834, 0.4575); uv(0.9834, 0.2493); uv(0.9687, 0.4575); uv(0.9687, 0.4575); uv(0.9834, 0.2493); uv(0.9687, 0.2493); uv(0.998, 0.7517); uv(0.9687, 0.9609); uv(1, 0.9609); uv(0.998, 0.7517); uv(0.9687, 0.7517); uv(0.9687, 0.9609); uv(0.9971, 0.5425); uv(0.9687, 0.7517); uv(0.998, 0.7517); uv(0.9971, 0.5425); uv(0.9687, 0.5425); uv(0.9687, 0.7517); uv(0.2493, 0.4614); uv(0.479, 0.4575); uv(0.2454, 0.2522); uv(0.2454, 0.2522); uv(0.479, 0.4575); uv(0.4809, 0.2483); uv(0.2454, 0.2522); uv(0.4809, 0.2483); uv(0.2414, 0.044); uv(0.2414, 0.044); uv(0.4809, 0.2483); uv(0.4839, 0.0391); uv(0.0205, 0.4663); uv(0.2454, 0.2522); uv(0.0098, 0.2571); uv(0.0205, 0.4663); uv(0.2493, 0.4614); uv(0.2454, 0.2522); uv(0.0098, 0.2571); uv(0.2414, 0.044); uv(0, 0.0479); uv(0.0098, 0.2571); uv(0.2454, 0.2522); uv(0.2414, 0.044); uv(0.958, 0.2571); uv(0.7263, 0.044); uv(0.7224, 0.2522); uv(0.958, 0.2571); uv(0.9687, 0.0479); uv(0.7263, 0.044); uv(0.7224, 0.2522); uv(0.7263, 0.044); uv(0.4868, 0.2483); uv(0.4868, 0.2483); uv(0.7263, 0.044); uv(0.4839, 0.0391); uv(0.9472, 0.4663); uv(0.7224, 0.2522); uv(0.7185, 0.4614); uv(0.9472, 0.4663); uv(0.958, 0.2571); uv(0.7224, 0.2522); uv(0.7185, 0.4614); uv(0.7224, 0.2522); uv(0.4897, 0.4575); uv(0.4897, 0.4575); uv(0.7224, 0.2522); uv(0.4868, 0.2483); uv(0.5152, 0.5083); uv(0.5415, 0.9433); uv(0.5435, 0.5083); uv(0.5152, 0.5083); uv(0.5142, 0.9433); uv(0.5415, 0.9433); uv(0.9687, 0.9609); uv(0.998, 1); uv(1, 0.9609); uv(0.9687, 0.9609); uv(0.9707, 1); uv(0.998, 1); uv(0.4858, 0.5083); uv(0.4839, 0.9501); uv(0.5142, 0.5083); uv(0.5142, 0.5083); uv(0.4839, 0.9501); uv(0.5122, 0.9501); uv(0.9971, 0.5425); uv(0.9971, 0.5015); uv(0.9687, 0.5425); uv(0.9687, 0.5425); uv(0.9971, 0.5015); uv(0.9687, 0.5015); f(0, 1, 2, 0, 1, 2); f(3, 1, 0, 3, 4, 5); f(0, 2, 4, 6, 7, 8); f(5, 6, 1, 9, 10, 11); f(7, 6, 5, 12, 13, 14); f(5, 1, 3, 15, 16, 17); f(8, 9, 6, 18, 19, 20); f(10, 9, 8, 21, 22, 23); f(8, 6, 7, 24, 25, 26); f(11, 12, 13, 27, 28, 29); f(14, 12, 11, 30, 31, 32); f(11, 13, 15, 33, 34, 35); f(16, 13, 17, 36, 37, 38); f(15, 13, 16, 39, 40, 41); f(16, 17, 18, 42, 43, 44); f(19, 17, 20, 45, 46, 47); f(18, 17, 19, 48, 49, 50); f(19, 20, 21, 51, 52, 53); f(22, 16, 23, 54, 55, 56); f(22, 15, 16, 57, 58, 59); f(23, 16, 24, 60, 61, 62); f(24, 16, 18, 63, 64, 65); f(3, 23, 5, 66, 67, 68); f(3, 22, 23, 69, 70, 71); f(5, 23, 7, 72, 73, 74); f(7, 23, 24, 75, 76, 77); f(25, 21, 14, 78, 79, 80); f(25, 26, 21, 81, 82, 83); f(4, 26, 25, 84, 85, 86); f(4, 10, 26, 87, 88, 89); f(0, 4, 27, 90, 91, 92); f(27, 4, 25, 93, 94, 95); f(27, 25, 11, 96, 97, 98); f(11, 25, 14, 99, 100, 101); f(3, 27, 22, 102, 103, 104); f(3, 0, 27, 105, 106, 107); f(22, 11, 15, 108, 109, 110); f(22, 27, 11, 111, 112, 113); f(24, 19, 28, 114, 115, 116); f(24, 18, 19, 117, 118, 119); f(28, 19, 26, 120, 121, 122); f(26, 19, 21, 123, 124, 125); f(7, 28, 8, 126, 127, 128); f(7, 24, 28, 129, 130, 131); f(8, 28, 10, 132, 133, 134); f(10, 28, 26, 135, 136, 137); f(20, 13, 12, 138, 139, 140); f(20, 17, 13, 141, 142, 143); f(21, 12, 14, 144, 145, 146); f(21, 20, 12, 147, 148, 149); f(6, 9, 1, 150, 151, 152); f(1, 9, 2, 153, 154, 155); f(4, 2, 10, 156, 157, 158); f(10, 2, 9, 159, 160, 161); } private function f(_arg1:int, _arg2:int, _arg3:int, _arg4:int, _arg5:int, _arg6:int):void{ addFace(new Face(varr[_arg1], varr[_arg2], varr[_arg3], null, uvarr[_arg4], uvarr[_arg5], uvarr[_arg6])); } private function v(_arg1:Number, _arg2:Number, _arg3:Number):void{ varr.push(new Vertex((_arg1 * scaling), (_arg2 * scaling), (_arg3 * scaling))); } } }//package com.core.models
Section 160
//HamSlice (com.core.models.HamSlice) package com.core.models { import away3d.core.utils.*; import away3d.core.base.*; public class HamSlice extends Mesh { private var uvarr:Array; private var scaling:Number; private var varr:Array; public function HamSlice(_arg1:Object=null){ varr = []; uvarr = []; super(_arg1); _arg1 = Init.parse(_arg1); scaling = _arg1.getNumber("scaling", 1); build(); type = ".as"; } private function uv(_arg1:Number, _arg2:Number):void{ uvarr.push(new UV(_arg1, _arg2)); } private function build():void{ v(510.2167, -3.6595, 45.3062); v(240.254, 39.9661, -378.5418); v(323.6248, -9.6356, -457.194); v(383.1754, 52.5159, 45.3062); v(240.254, -24.5759, -378.5418); v(387.1455, -27.5639, 45.3062); v(287.8945, -25.7711, 324.9584); v(387.1455, -7.8428, 425.4584); v(283.9244, 44.1494, 324.9584); v(6.0217, -19.795, -562.0636); v(6.0217, -36.5281, -457.194); v(6.0217, 36.978, -457.194); v(-228.2106, 25.6234, -378.5418); v(-311.5814, -29.9544, -457.194); v(-228.2106, -39.5162, -378.5418); v(-502.1433, -35.9305, 45.3062); v(-371.132, -51.4684, 45.3062); v(-375.102, 28.6115, 45.3062); v(-275.851, 26.221, 324.9584); v(-375.102, -31.7472, 425.4584); v(-275.851, -43.6994, 324.9584); v(6.0217, -19.795, 552.1758); v(6.0217, -39.5162, 425.4584); v(6.0217, 40.5637, 425.4584); v(2.0517, 100.9224, 45.3062); v(6.0217, -46.6875, 45.3062); uv(0.0137, 0.4301); uv(0.2121, 0.2366); uv(0.1848, 0.1711); uv(0.0137, 0.4301); uv(0.0743, 0.4555); uv(0.2121, 0.2366); uv(0.9863, 0.4301); uv(0.7879, 0.2356); uv(0.9247, 0.4555); uv(0.9863, 0.4301); uv(0.8143, 0.1711); uv(0.7879, 0.2356); uv(0.9863, 0.4301); uv(0.9228, 0.6413); uv(0.9863, 0.6804); uv(0.9863, 0.4301); uv(0.9247, 0.4555); uv(0.9228, 0.6413); uv(0.0137, 0.4301); uv(0.0762, 0.6413); uv(0.0743, 0.4555); uv(0.0137, 0.4301); uv(0.0127, 0.6794); uv(0.0762, 0.6413); uv(0.6452, 0.1711); uv(0.7879, 0.2356); uv(0.8143, 0.1711); uv(0.6452, 0.1711); uv(0.6618, 0.2336); uv(0.7879, 0.2356); uv(0.3539, 0.1711); uv(0.2121, 0.2366); uv(0.3372, 0.2346); uv(0.3539, 0.1711); uv(0.1848, 0.1711); uv(0.2121, 0.2366); uv(0.3539, 0.1711); uv(0.437, 0.3294); uv(0.4888, 0.2962); uv(0.3539, 0.1711); uv(0.3372, 0.2346); uv(0.437, 0.3294); uv(0.6452, 0.1711); uv(0.563, 0.3284); uv(0.6618, 0.2336); uv(0.6452, 0.1711); uv(0.5103, 0.2962); uv(0.563, 0.3284); uv(0.4995, 0.6305); uv(0.563, 0.3284); uv(0.5103, 0.2962); uv(0.4995, 0.6305); uv(0.5601, 0.6051); uv(0.563, 0.3284); uv(0.4995, 0.6305); uv(0.437, 0.3294); uv(0.4389, 0.6061); uv(0.4995, 0.6305); uv(0.4888, 0.2962); uv(0.437, 0.3294); uv(0.4995, 0.6305); uv(0.347, 0.7527); uv(0.3773, 0.8299); uv(0.4995, 0.6305); uv(0.4389, 0.6061); uv(0.347, 0.7527); uv(0.4995, 0.6305); uv(0.653, 0.7527); uv(0.5601, 0.6051); uv(0.4995, 0.6305); uv(0.6207, 0.8299); uv(0.653, 0.7527); uv(0.824, 0.8299); uv(0.653, 0.7527); uv(0.6207, 0.8299); uv(0.824, 0.8299); uv(0.8035, 0.7546); uv(0.653, 0.7527); uv(0.175, 0.8299); uv(0.347, 0.7527); uv(0.1955, 0.7556); uv(0.175, 0.8299); uv(0.3773, 0.8299); uv(0.347, 0.7527); uv(0.175, 0.8299); uv(0.0762, 0.6413); uv(0.0127, 0.6794); uv(0.175, 0.8299); uv(0.1955, 0.7556); uv(0.0762, 0.6413); uv(0.824, 0.8299); uv(0.9228, 0.6413); uv(0.8035, 0.7546); uv(0.824, 0.8299); uv(0.9863, 0.6804); uv(0.9228, 0.6413); uv(0.2581, 0.5318); uv(0.347, 0.7527); uv(0.4389, 0.6061); uv(0.2581, 0.5318); uv(0.1955, 0.7556); uv(0.347, 0.7527); uv(0.2581, 0.5318); uv(0.437, 0.3294); uv(0.3372, 0.2346); uv(0.2581, 0.5318); uv(0.4389, 0.6061); uv(0.437, 0.3294); uv(0.2581, 0.5318); uv(0.2121, 0.2366); uv(0.0743, 0.4555); uv(0.2581, 0.5318); uv(0.3372, 0.2346); uv(0.2121, 0.2366); uv(0.2581, 0.5318); uv(0.0762, 0.6413); uv(0.1955, 0.7556); uv(0.2581, 0.5318); uv(0.0743, 0.4555); uv(0.0762, 0.6413); uv(0.7429, 0.5308); uv(0.7879, 0.2356); uv(0.6618, 0.2336); uv(0.7429, 0.5308); uv(0.9247, 0.4555); uv(0.7879, 0.2356); uv(0.7429, 0.5308); uv(0.563, 0.3284); uv(0.5601, 0.6051); uv(0.7429, 0.5308); uv(0.6618, 0.2336); uv(0.563, 0.3284); uv(0.7429, 0.5308); uv(0.653, 0.7527); uv(0.8035, 0.7546); uv(0.7429, 0.5308); uv(0.5601, 0.6051); uv(0.653, 0.7527); uv(0.7429, 0.5308); uv(0.9228, 0.6413); uv(0.9247, 0.4555); uv(0.7429, 0.5308); uv(0.8035, 0.7546); uv(0.9228, 0.6413); f(0, 1, 2, 0, 1, 2); f(0, 3, 1, 3, 4, 5); f(0, 4, 5, 6, 7, 8); f(0, 2, 4, 9, 10, 11); f(0, 6, 7, 12, 13, 14); f(0, 5, 6, 15, 16, 17); f(0, 8, 3, 18, 19, 20); f(0, 7, 8, 21, 22, 23); f(9, 4, 2, 24, 25, 26); f(9, 10, 4, 27, 28, 29); f(9, 1, 11, 30, 31, 32); f(9, 2, 1, 33, 34, 35); f(9, 12, 13, 36, 37, 38); f(9, 11, 12, 39, 40, 41); f(9, 14, 10, 42, 43, 44); f(9, 13, 14, 45, 46, 47); f(15, 14, 13, 48, 49, 50); f(15, 16, 14, 51, 52, 53); f(15, 12, 17, 54, 55, 56); f(15, 13, 12, 57, 58, 59); f(15, 18, 19, 60, 61, 62); f(15, 17, 18, 63, 64, 65); f(15, 20, 16, 66, 67, 68); f(15, 19, 20, 69, 70, 71); f(21, 20, 19, 72, 73, 74); f(21, 22, 20, 75, 76, 77); f(21, 18, 23, 78, 79, 80); f(21, 19, 18, 81, 82, 83); f(21, 8, 7, 84, 85, 86); f(21, 23, 8, 87, 88, 89); f(21, 6, 22, 90, 91, 92); f(21, 7, 6, 93, 94, 95); f(24, 18, 17, 96, 97, 98); f(24, 23, 18, 99, 100, 101); f(24, 12, 11, 102, 103, 104); f(24, 17, 12, 105, 106, 107); f(24, 1, 3, 108, 109, 110); f(24, 11, 1, 111, 112, 113); f(24, 8, 23, 114, 115, 116); f(24, 3, 8, 117, 118, 119); f(25, 4, 10, 120, 121, 122); f(25, 5, 4, 123, 124, 125); f(25, 14, 16, 126, 127, 128); f(25, 10, 14, 129, 130, 131); f(25, 20, 22, 132, 133, 134); f(25, 16, 20, 135, 136, 137); f(25, 6, 5, 138, 139, 140); f(25, 22, 6, 141, 142, 143); } private function f(_arg1:int, _arg2:int, _arg3:int, _arg4:int, _arg5:int, _arg6:int):void{ addFace(new Face(varr[_arg1], varr[_arg2], varr[_arg3], null, uvarr[_arg4], uvarr[_arg5], uvarr[_arg6])); } private function v(_arg1:Number, _arg2:Number, _arg3:Number):void{ varr.push(new Vertex((_arg1 * scaling), (_arg2 * scaling), (_arg3 * scaling))); } } }//package com.core.models
Section 161
//Pickle (com.core.models.Pickle) package com.core.models { import away3d.core.utils.*; import away3d.core.base.*; public class Pickle extends Mesh { private var uvarr:Array; private var scaling:Number; private var varr:Array; public function Pickle(_arg1:Object=null){ varr = []; uvarr = []; super(_arg1); _arg1 = Init.parse(_arg1); scaling = _arg1.getNumber("scaling", 1); build(); type = ".as"; } private function uv(_arg1:Number, _arg2:Number):void{ uvarr.push(new UV(_arg1, _arg2)); } private function build():void{ v(325.9643, -29.6895, 44.8153); v(377.8967, -53.4338, -55.9124); v(377.8967, -53.4338, 55.0587); v(325.9643, -29.6895, -45.6689); v(349.3339, -52.2224, 99.4472); v(349.3339, -52.2224, -100.3008); v(302.5947, -21.9362, 80.6675); v(302.5947, -21.9362, -81.5211); v(-284.2416, -51.4955, 55.9124); v(-284.2416, -51.4955, -56.766); v(-216.7294, -13.6983, 44.8153); v(-216.7294, -13.6983, -45.6689); v(-167.3936, 8.1077, 80.6675); v(-167.3936, 8.35, -81.5211); v(-219.3261, -32.3546, -100.3008); v(-219.3261, -32.3546, 99.4472); v(196.1332, -24.1168, -108.8371); v(196.1332, -24.1168, 108.8371); v(177.9569, 2.2928, 88.3501); v(177.9569, 2.2928, -89.2037); uv(0.8524, 0.9179); uv(0.6207, 0.999); uv(0.8759, 1); uv(0.8524, 0.9179); uv(0.6452, 0.9169); uv(0.6207, 0.999); uv(0.478, 0.045); uv(0.1202, 0.001); uv(0.0186, 0.0459); uv(0.478, 0.045); uv(0.3763, 0); uv(0.1202, 0.001); uv(0.9355, 0.8827); uv(0.8524, 0.9179); uv(0.9785, 0.955); uv(0.9785, 0.955); uv(0.8524, 0.9179); uv(0.8759, 1); uv(0.5191, 0.9541); uv(0.6452, 0.9169); uv(0.5621, 0.8817); uv(0.5191, 0.9541); uv(0.6207, 0.999); uv(0.6452, 0.9169); uv(0.5621, 0.8817); uv(0.8524, 0.9179); uv(0.9355, 0.8827); uv(0.5621, 0.8817); uv(0.6452, 0.9169); uv(0.8524, 0.9179); uv(0.8817, 0.001); uv(0.6237, 0); uv(0.8573, 0.0978); uv(0.8573, 0.0978); uv(0.6237, 0); uv(0.6471, 0.0978); uv(0.9384, 0.1701); uv(0.6471, 0.0978); uv(0.565, 0.1701); uv(0.9384, 0.1701); uv(0.8573, 0.0978); uv(0.6471, 0.0978); uv(0.565, 0.1701); uv(0.6471, 0.0978); uv(0.522, 0.0938); uv(0.522, 0.0938); uv(0.6471, 0.0978); uv(0.6237, 0); uv(0.9814, 0.0948); uv(0.8573, 0.0978); uv(0.9384, 0.1701); uv(0.9814, 0.0948); uv(0.8817, 0.001); uv(0.8573, 0.0978); uv(0.0225, 0.9062); uv(0.3812, 1); uv(0.4819, 0.9052); uv(0.0225, 0.9062); uv(0.1241, 1); uv(0.3812, 1); uv(0, 0.2776); uv(0.4819, 0.9052); uv(0.4995, 0.2766); uv(0, 0.2776); uv(0.0225, 0.9062); uv(0.4819, 0.9052); uv(1, 0.7224); uv(0.9384, 0.1701); uv(0.9531, 0.694); uv(1, 0.7224); uv(0.9814, 0.0948); uv(0.9384, 0.1701); uv(0.5464, 0.6931); uv(0.565, 0.1701); uv(0.4995, 0.7214); uv(0.4995, 0.7214); uv(0.565, 0.1701); uv(0.522, 0.0938); uv(0.9531, 0.694); uv(0.565, 0.1701); uv(0.5464, 0.6931); uv(0.9531, 0.694); uv(0.9384, 0.1701); uv(0.565, 0.1701); uv(0.4995, 0.7214); uv(0.5621, 0.8817); uv(0.5464, 0.6931); uv(0.4995, 0.7214); uv(0.5191, 0.9541); uv(0.5621, 0.8817); uv(0.9785, 0.955); uv(1, 0.7224); uv(0.9355, 0.8827); uv(0.9355, 0.8827); uv(1, 0.7224); uv(0.9531, 0.694); uv(0.9355, 0.8827); uv(0.9531, 0.694); uv(0.5621, 0.8817); uv(0.5621, 0.8817); uv(0.9531, 0.694); uv(0.5464, 0.6931); uv(0.478, 0.045); uv(0, 0.2776); uv(0.4995, 0.2766); uv(0.478, 0.045); uv(0.0186, 0.0459); uv(0, 0.2776); f(0, 1, 2, 0, 1, 2); f(0, 3, 1, 3, 4, 5); f(4, 1, 5, 6, 7, 8); f(4, 2, 1, 9, 10, 11); f(6, 0, 4, 12, 13, 14); f(4, 0, 2, 15, 16, 17); f(5, 3, 7, 18, 19, 20); f(5, 1, 3, 21, 22, 23); f(7, 0, 6, 24, 25, 26); f(7, 3, 0, 27, 28, 29); f(8, 9, 10, 30, 31, 32); f(10, 9, 11, 33, 34, 35); f(12, 11, 13, 36, 37, 38); f(12, 10, 11, 39, 40, 41); f(13, 11, 14, 42, 43, 44); f(14, 11, 9, 45, 46, 47); f(15, 10, 12, 48, 49, 50); f(15, 8, 10, 51, 52, 53); f(14, 8, 15, 54, 55, 56); f(14, 9, 8, 57, 58, 59); f(16, 15, 17, 60, 61, 62); f(16, 14, 15, 63, 64, 65); f(17, 12, 18, 66, 67, 68); f(17, 15, 12, 69, 70, 71); f(19, 13, 16, 72, 73, 74); f(16, 13, 14, 75, 76, 77); f(18, 13, 19, 78, 79, 80); f(18, 12, 13, 81, 82, 83); f(16, 7, 19, 84, 85, 86); f(16, 5, 7, 87, 88, 89); f(4, 17, 6, 90, 91, 92); f(6, 17, 18, 93, 94, 95); f(6, 18, 7, 96, 97, 98); f(7, 18, 19, 99, 100, 101); f(4, 16, 17, 102, 103, 104); f(4, 5, 16, 105, 106, 107); } private function f(_arg1:int, _arg2:int, _arg3:int, _arg4:int, _arg5:int, _arg6:int):void{ addFace(new Face(varr[_arg1], varr[_arg2], varr[_arg3], null, uvarr[_arg4], uvarr[_arg5], uvarr[_arg6])); } private function v(_arg1:Number, _arg2:Number, _arg3:Number):void{ varr.push(new Vertex((_arg1 * scaling), (_arg2 * scaling), (_arg3 * scaling))); } } }//package com.core.models
Section 162
//SandWich (com.core.models.SandWich) package com.core.models { import flash.events.*; import flash.display.*; import gs.*; import away3d.containers.*; import flash.utils.*; import away3d.core.base.*; import away3d.core.math.*; import away3d.materials.*; import com.core.*; import gs.easing.*; public class SandWich extends Sprite { private var _sn:Number;// = 0 private var _tomatoMat:BitmapMaterial; private var _sandwichContainer:ObjectContainer3D; private var _cheeseMat:BitmapMaterial; private var _sandInit:Boolean;// = false private var _requestCheck:Array; private var _autoBuildTm:Timer; private var _topSlice:Mesh; private var _baconStrip1:Mesh; private var _baconStrip2:Mesh; private var _pickleMat:BitmapMaterial; private var _fixinsAr:Array; private var _breadMat:BitmapMaterial; private var _tomato:Mesh; private var _currentTopModel:Object3D; private var _activeFixins:Array; private var _hamMat:BitmapMaterial; private var _buildStage:Number;// = 0 private var _autoBuildAr:Array; private var _lettuceStrip:Mesh; private var _ModelAr:Array; private var _baconMat:BitmapMaterial; private var _lettuceMat:BitmapMaterial; private var _fixinsInc:Number;// = 0 private var _bottomSlice:Mesh; private var _sandInitUsed:Boolean;// = false private var _currentRequest:String; private var _autoInc:Number;// = 0 private var _requestCheckFixins:Array; private var _currentActiveFixin:Object3D; private var _sardineMat:BitmapMaterial; public static const SANDWICHREADY_EVENT:String = " sandwich ready"; public static const REQUESTSCORE_EVENT:String = " request score"; public static const SANDWICHCLEARED_EVENT:String = " sandwich cleared"; public static const SANDWICHSCORE_EVENT:String = " sandwich score"; public static const REQUESTMESSAGE_EVENT:String = " request message"; public static const ITEMWRONG_EVENT:String = " item wrong"; public static const SANDWICHINITBUILD_EVENT:String = " sandwich init ready"; public static var readyHack:Boolean = false; public function SandWich(){ _sandwichContainer = new ObjectContainer3D(); _ModelAr = new Array(); _fixinsAr = new Array(); _activeFixins = new Array(); _autoBuildAr = new Array("bottomBun", "lettuce", "tomato", "bacon1", "bacon2", "topbun"); _requestCheck = new Array("bread", "lettuce", "tomato", "bacon", "hash", "bread"); _requestCheckFixins = new Array("ham", "sardine", "cheese", "pickle"); super(); _fixinsAr = [{name:"ham", score:1}, {name:"sardine", score:2}, {name:"cheese", score:3}, {name:"pickle", score:4}]; var _local1:Sprite = new Main.breadSkin(); var _local2:BitmapData = new BitmapData(_local1.width, _local1.height, false, 0); _local2.draw(_local1); _breadMat = new BitmapMaterial(_local2); var _local3:Sprite = new Main.tomatoSkin(); var _local4:BitmapData = new BitmapData(_local3.width, _local3.height, false, 0); _local4.draw(_local3); _tomatoMat = new BitmapMaterial(_local4); var _local5:Sprite = new Main.baconSkin(); var _local6:BitmapData = new BitmapData(_local5.width, _local5.height, false, 0); _local6.draw(_local5); _baconMat = new BitmapMaterial(_local6); var _local7:Sprite = new Main.lettuceSkin(); var _local8:BitmapData = new BitmapData(_local7.width, _local7.height, true, 0); _local8.draw(_local7); _lettuceMat = new BitmapMaterial(_local8, {alpha:3}); _sandwichContainer.rotationX = (_sandwichContainer.rotationX - 5); addTopBun(); addTomato(); addBacon1(); addBacon2(); addLettuce(); addBottomBun(); _sandwichContainer.y = -120; var _local9:Timer = new Timer(400, 1); _local9.addEventListener(TimerEvent.TIMER_COMPLETE, dis); _local9.start(); } private function clearSand():void{ readyHack = false; if (_sandInit){ dispatchEvent(new Event(SANDWICHSCORE_EVENT, true)); resetSandwich(); _autoInc = 0; } else { dispatchEvent(new Event(SANDWICHINITBUILD_EVENT, true)); }; _sandInit = true; } public function itemRequest(_arg1:String):void{ trace(("sandwich hit " + _autoInc)); if (_arg1 == _requestCheck[_autoInc]){ addItem(_autoBuildAr[_autoInc]); _autoInc++; } else { dispatchEvent(new Event(ITEMWRONG_EVENT, true)); Main.soundDictionary["bubble"].play(); }; } public function control_topBun():void{ if (_sandInit){ _currentRequest = "bread"; dispatchEvent(new Event(REQUESTMESSAGE_EVENT, true)); }; _topSlice.visible = true; TweenLite.to(_topSlice, 0.5, {y:(_currentTopModel.y + 50), ease:Elastic.easeOut, easeParams:[0.07, 1.5], onComplete:clearSand}); _currentTopModel = _topSlice; } public function addTomato():void{ _tomato = new Tomato({material:_tomatoMat, name:"tomato", x:0, y:0, z:0, precision:12}); _tomato.scale(0.6); _tomato.extra = {itemUsed:false}; _tomato.rotationX = (_tomato.rotationX + 180); _tomato.screenZOffset = 2000; _tomato; scaleY = 1.5; _tomato.visible = false; _sandwichContainer.addChild(_tomato); _ModelAr.push(_tomato); } public function get container():ObjectContainer3D{ return (_sandwichContainer); } public function addFixin(_arg1:String):void{ var _local2:Sprite; var _local3:BitmapData; var _local4:Mesh; var _local5:Sprite; var _local6:BitmapData; var _local7:Mesh; var _local8:Sprite; var _local9:BitmapData; var _local10:Mesh; var _local11:Sprite; var _local12:BitmapData; var _local13:Mesh; switch (_arg1){ case "ham": _local2 = new Main.hamSkin(); _local3 = new BitmapData(_local2.width, _local2.height, false, 0); _local3.draw(_local2); _hamMat = new BitmapMaterial(_local3); _local4 = new HamSlice({material:_hamMat, name:"hame", precision:18, x:-60, bothsides:false, alpha:true, y:800, z:0, pushback:true}); _local4.screenZOffset = 2800; _currentActiveFixin = _local4; _activeFixins.push(_local4); _local4.scale(0.38); _sandwichContainer.addChild(_local4); _ModelAr.push(_local4); TweenLite.to(_local4, 0.5, {y:(_currentTopModel.y + 30), ease:Elastic.easeOut, easeParams:[0.07, 1.5]}); _currentTopModel = _local4; if (_sandInit){ _currentRequest = "ham"; dispatchEvent(new Event(REQUESTMESSAGE_EVENT, true)); }; break; case "sardine": _local5 = new Main.sardineSkin(); _local6 = new BitmapData(_local5.width, _local5.height, false, 0); _local6.draw(_local5); _sardineMat = new BitmapMaterial(_local6); _local7 = new Sardine({material:_sardineMat, name:"sardine", precision:18, x:-60, bothsides:false, alpha:true, y:800, z:0, pushback:true}); _local7.screenZOffset = 2800; _currentActiveFixin = _local7; _activeFixins.push(_local7); _local7.scale(0.4); _sandwichContainer.addChild(_local7); _ModelAr.push(_local7); TweenLite.to(_local7, 0.5, {y:(_currentTopModel.y + 30), z:_currentTopModel.z, ease:Elastic.easeOut, easeParams:[0.07, 1.5]}); _currentTopModel = _local7; if (_sandInit){ _currentRequest = "sardine"; dispatchEvent(new Event(REQUESTMESSAGE_EVENT, true)); }; break; case "cheese": _local8 = new Main.cheeseSkin(); _local9 = new BitmapData(_local8.width, _local8.height, false, 0); _local9.draw(_local8); _cheeseMat = new BitmapMaterial(_local9); _local10 = new CheeseSlice({material:_cheeseMat, name:"cheese", precision:5, x:0, bothsides:false, alpha:false, y:800, z:10, pushback:true}); _local10.screenZOffset = 2800; _currentActiveFixin = _local10; _activeFixins.push(_local10); _local10.scale(0.9); _sandwichContainer.addChild(_local10); _ModelAr.push(_local10); TweenLite.to(_local10, 0.5, {y:(_currentTopModel.y + 30), ease:Elastic.easeOut, easeParams:[0.07, 1.5]}); _currentTopModel = _local10; if (_sandInit){ _currentRequest = "cheese"; dispatchEvent(new Event(REQUESTMESSAGE_EVENT, true)); }; break; case "pickle": _local11 = new Main.pickleSkin(); _local12 = new BitmapData(_local11.width, _local11.height, false, 0); _local12.draw(_local11); _pickleMat = new BitmapMaterial(_local12); _local13 = new Pickle({material:_pickleMat, name:"pickle", precision:18, x:-60, bothsides:false, alpha:true, y:800, z:0, pushback:true}); _local13.screenZOffset = 2800; _currentActiveFixin = _local13; _activeFixins.push(_local13); _local13.scale(0.8); _sandwichContainer.addChild(_local13); _ModelAr.push(_local13); TweenLite.to(_local13, 0.5, {y:(_currentTopModel.y + 40), ease:Elastic.easeOut, easeParams:[0.07, 1.5]}); _currentTopModel = _local13; if (_sandInit){ _currentRequest = "pickle"; dispatchEvent(new Event(REQUESTMESSAGE_EVENT, true)); }; break; }; } private function dis(_arg1:Event):void{ _arg1.target.addEventListener(TimerEvent.TIMER_COMPLETE, dis); dispatchEvent(new Event(SANDWICHREADY_EVENT, true)); addEventListener(Event.ENTER_FRAME, drv); } public function autoBuild():void{ _autoBuildTm = new Timer(600, 7); _autoBuildTm.addEventListener(TimerEvent.TIMER, autoCreate); _autoBuildTm.start(); } private function setupSandWich():void{ _bottomSlice.visible = false; _topSlice.visible = false; _baconStrip1.visible = false; _baconStrip2.visible = false; _tomato.visible = false; _lettuceStrip.visible = false; TweenLite.to(_sandwichContainer, 0.2, {y:-200, onComplete:initReady}); TweenLite.to(_topSlice, 1, {y:800, ease:Elastic.easeOut, easeParams:[0.07, 1.5]}); TweenLite.to(_tomato, 1, {y:800, ease:Elastic.easeOut, easeParams:[0.07, 1.5]}); TweenLite.to(_lettuceStrip, 1, {y:800, ease:Elastic.easeOut, easeParams:[0.07, 1.5]}); TweenLite.to(_baconStrip1, 1, {y:800, ease:Elastic.easeOut, easeParams:[0.07, 1.5]}); TweenLite.to(_baconStrip2, 1, {y:800, ease:Elastic.easeOut, easeParams:[0.07, 1.5]}); TweenLite.to(_bottomSlice, 1, {y:-800, ease:Elastic.easeOut, easeParams:[0.07, 1.5]}); _sn = 0; if (_currentActiveFixin){ _sandwichContainer.removeChild(_currentActiveFixin); }; _currentRequest = "build"; dispatchEvent(new Event(REQUESTMESSAGE_EVENT, true)); } public function get message():String{ return (_currentRequest); } private function autoCreate(_arg1:Event):void{ addItem(_autoBuildAr[_autoInc]); _autoInc++; } private function drv(_arg1:Event):void{ _sn = (_sn + 0.2); _sandwichContainer.y = (_sandwichContainer.y + (2 * Math.sin((_sn / 5)))); _sandwichContainer.rotationY = (_sandwichContainer.rotationY + 1.5); } public function resetSandwich():void{ if (_sandInitUsed){ Main.soundDictionary["goodsandwich"].play(); }; _sandInitUsed = true; _buildStage = 0; _autoInc = 0; _fixinsInc = 0; TweenLite.to(_sandwichContainer, 0.2, {y:300, onComplete:setupSandWich}); } public function control_tomato():void{ if (_sandInit){ _currentRequest = "tomato"; dispatchEvent(new Event(REQUESTMESSAGE_EVENT, true)); }; _tomato.visible = true; TweenLite.to(_tomato, 0.5, {y:(_currentTopModel.y + 70), ease:Elastic.easeOut, easeParams:[0.07, 1.5]}); _currentTopModel = _tomato; } public function addBottomBun():void{ _bottomSlice = new BreadSlice({material:_breadMat, name:"bottomslice", x:0, y:0, z:0, pushback:true}); _bottomSlice.scale(0.4); _bottomSlice.centerPivot(); _bottomSlice.position = new Number3D(0, 0, 0); _bottomSlice.extra = {itemUsed:false}; _bottomSlice.visible = false; _bottomSlice.screenZOffset = 3000; _sandwichContainer.addChild(_bottomSlice); _ModelAr.push(_bottomSlice); } public function get fixins():Array{ return (_fixinsAr); } public function fixinRequest(_arg1:Number):void{ var _local2:Number = 0; while (_local2 < _fixinsAr.length) { if (_fixinsAr[_local2].score == _arg1){ trace(("FIXIN" + _fixinsAr[_local2].name)); Main.soundDictionary["fixin"].play(); GameManager.PointsMultiplier = (GameManager.PointsMultiplier + 1); addFixin(_fixinsAr[_local2].name); }; _local2++; }; } public function addBacon1():void{ _baconStrip1 = new BaconStrip({material:_baconMat, name:"bacon1", precision:18, x:-50, y:800, z:0}); _baconStrip1.scale(0.3); _tomato.extra = {itemUsed:false}; _baconStrip1.rotationY = (_baconStrip1.rotationY + 90); _baconStrip1.screenZOffset = 1900; _baconStrip1.visible = false; _sandwichContainer.addChild(_baconStrip1); _ModelAr.push(_baconStrip1); } public function addBacon2():void{ var _local1:BitmapMaterial = new BitmapMaterial(new Main._waffleTexture(null, null)); _baconStrip2 = new Burger({material:_local1, name:"hash", precision:18, x:0, y:0, z:0}); _baconStrip2.scale(0.3); _baconStrip2.screenZOffset = 1600; _baconStrip2.visible = false; _baconStrip2.extra = {itemUsed:false}; _sandwichContainer.addChild(_baconStrip2); _ModelAr.push(_baconStrip2); } private function addItem(_arg1:String):void{ Main.soundDictionary["correct"].play(); switch (_arg1){ case "bottomBun": control_bottomBun(); break; case "lettuce": control_lettuce(); break; case "tomato": control_tomato(); break; case "bacon1": control_bacon1(); break; case "bacon2": control_bacon2(); break; case "topbun": trace("ad top bun"); control_topBun(); break; }; } public function control_bacon1():void{ if (_sandInit){ _currentRequest = "bacon"; dispatchEvent(new Event(REQUESTMESSAGE_EVENT, true)); }; _baconStrip1.visible = true; TweenLite.to(_baconStrip1, 0.5, {y:_currentTopModel.y, ease:Elastic.easeOut, easeParams:[0.07, 1.5]}); _currentTopModel = _baconStrip1; } public function control_bacon2():void{ if (_sandInit){ _currentRequest = "bacon"; dispatchEvent(new Event(REQUESTMESSAGE_EVENT, true)); }; _baconStrip2.visible = true; TweenLite.to(_baconStrip2, 0.5, {y:(_currentTopModel.y + 20), ease:Elastic.easeOut, easeParams:[0.07, 1.5]}); _currentTopModel = _baconStrip2; } public function addLettuce():void{ _lettuceStrip = new Burger({material:_lettuceMat, name:"lettuce", precision:18, x:50, bothsides:false, y:0, z:0}); _lettuceStrip.screenZOffset = 2500; _lettuceStrip.scale(0.4); _lettuceStrip.visible = false; _lettuceStrip.extra = {itemUsed:false}; _sandwichContainer.addChild(_lettuceStrip); _ModelAr.push(_lettuceStrip); } public function kill():void{ removeEventListener(Event.ENTER_FRAME, drv); while (_sandwichContainer.children.length > 0) { _sandwichContainer.removeChild(_sandwichContainer.children[0]); }; } public function control_lettuce():void{ if (_sandInit){ _currentRequest = "lettuce"; dispatchEvent(new Event(REQUESTMESSAGE_EVENT, true)); }; _lettuceStrip.visible = true; TweenLite.to(_lettuceStrip, 0.5, {y:(_currentTopModel.y + 38), ease:Elastic.easeOut, easeParams:[0.07, 1.5]}); _currentTopModel = _lettuceStrip; } private function initReady():void{ if (!_sandInit){ }; readyHack = true; } public function addTopBun():void{ _topSlice = new BreadSlice({material:_breadMat, name:"topslice", x:0, y:0, z:0, precision:18}); _topSlice.extra = {itemUsed:false}; _topSlice.scale(0.4); _topSlice.centerPivot(); _topSlice.visible = false; _topSlice.position = new Number3D(0, 0, 0); _sandwichContainer.addChild(_topSlice); _ModelAr.push(_topSlice); } private function checkFixins():void{ dispatchEvent(new Event(REQUESTSCORE_EVENT, true)); } public function control_bottomBun():void{ if (_sandInit){ _currentRequest = "bread"; dispatchEvent(new Event(REQUESTMESSAGE_EVENT, true)); }; _bottomSlice.visible = true; TweenLite.to(_bottomSlice, 0.5, {y:-20, z:0, ease:Elastic.easeOut, easeParams:[0.07, 1.5], onComplete:checkFixins}); _currentTopModel = _bottomSlice; } } }//package com.core.models
Section 163
//Sardine (com.core.models.Sardine) package com.core.models { import away3d.core.utils.*; import away3d.core.base.*; public class Sardine extends Mesh { private var uvarr:Array; private var scaling:Number; private var varr:Array; public function Sardine(_arg1:Object=null){ varr = []; uvarr = []; super(_arg1); _arg1 = Init.parse(_arg1); scaling = _arg1.getNumber("scaling", 1); build(); type = ".as"; } private function uv(_arg1:Number, _arg2:Number):void{ uvarr.push(new UV(_arg1, _arg2)); } private function build():void{ v(-320.5973, -38.3007, -25.0986); v(-320.5973, -39.0605, 24.3774); v(-345.4791, -45.8985, -27.0777); v(-345.4791, -46.6583, 25.3669); v(-206.8522, -23.105, -100.3023); v(-206.8522, -26.1441, 99.581); v(-192.634, -2.5908, 93.6439); v(-192.634, 0.0685, -94.3651); v(560.9279, -86.1672, -60.7214); v(560.9279, -87.6868, 58.0211); v(539.6006, -68.3122, -56.7633); v(539.6006, -70.2117, 55.0526); v(326.3284, -44.7589, 32.2936); v(326.3284, -43.6192, -34.0043); v(315.6648, -35.6414, 30.3145); v(315.6648, -34.8816, -32.0253); v(169.9288, 6.5267, -94.3651); v(169.9288, 3.4875, 94.6334); v(169.9288, -16.2669, -100.3023); v(169.9288, -19.6859, 99.581); v(9.9746, 5.387, 119.3714); v(9.9746, 9.1859, -119.1032); v(6.4201, -20.8256, -126.0298); v(6.4201, -24.6245, 126.2981); uv(0.9277, 0.2258); uv(0.9218, 0.2805); uv(0.9365, 0.2268); uv(0.9365, 0.2268); uv(0.9218, 0.2805); uv(0.9306, 0.2815); uv(0.653, 0.2053); uv(0.48, 0.0596); uv(0.39, 0.2033); uv(0.653, 0.2053); uv(0.5494, 0.0606); uv(0.48, 0.0596); uv(0.8866, 0.2385); uv(0.9326, 0.1017); uv(0.8563, 0.2278); uv(0.8866, 0.2385); uv(0.9404, 0.1036); uv(0.9326, 0.1017); uv(0.6872, 0.825); uv(0.7351, 0.9648); uv(0.7195, 0.8221); uv(0.7195, 0.8221); uv(0.7351, 0.9648); uv(0.7439, 0.9638); uv(0.3255, 0.1662); uv(0.1535, 0.0244); uv(0.0626, 0.1632); uv(0.3255, 0.1662); uv(0.2229, 0.0254); uv(0.1535, 0.0244); uv(0.9482, 0.2278); uv(0.9609, 0.1046); uv(0.9286, 0.2258); uv(0.9286, 0.2258); uv(0.9609, 0.1046); uv(0.9413, 0.1026); uv(0.5044, 0.7566); uv(0.6344, 0.9413); uv(0.5914, 0.7576); uv(0.5044, 0.7566); uv(0.478, 0.9404); uv(0.6344, 0.9413); uv(0.8113, 0.7889); uv(0.828, 0.9756); uv(0.8221, 0.7889); uv(0.8221, 0.7889); uv(0.828, 0.9756); uv(0.8475, 0.9746); uv(0.7732, 0.2698); uv(0.8182, 0.089); uv(0.7634, 0.2678); uv(0.7732, 0.2698); uv(0.8377, 0.0938); uv(0.8182, 0.089); uv(0.175, 0.7253); uv(0.305, 0.911); uv(0.262, 0.7263); uv(0.175, 0.7253); uv(0.1486, 0.9091); uv(0.305, 0.911); uv(0.0802, 0.566); uv(0.262, 0.7263); uv(0.3431, 0.5689); uv(0.0802, 0.566); uv(0.175, 0.7253); uv(0.262, 0.7263); uv(0.7302, 0.4321); uv(0.7634, 0.2678); uv(0.6979, 0.4233); uv(0.7302, 0.4321); uv(0.7732, 0.2698); uv(0.7634, 0.2678); uv(0.781, 0.6227); uv(0.8113, 0.7889); uv(0.8143, 0.6217); uv(0.8143, 0.6217); uv(0.8113, 0.7889); uv(0.8221, 0.7889); uv(0.4086, 0.5943); uv(0.5914, 0.7576); uv(0.6716, 0.5963); uv(0.4086, 0.5943); uv(0.5044, 0.7566); uv(0.5914, 0.7576); uv(0.3695, 0.3939); uv(0.0626, 0.1632); uv(0.0381, 0.39); uv(0.3695, 0.3939); uv(0.3255, 0.1662); uv(0.0626, 0.1632); uv(0.6852, 0.6002); uv(0.6872, 0.825); uv(0.7273, 0.6031); uv(0.7273, 0.6031); uv(0.6872, 0.825); uv(0.7195, 0.8221); uv(0.8475, 0.4536); uv(0.8563, 0.2278); uv(0.8065, 0.4477); uv(0.8475, 0.4536); uv(0.8866, 0.2385); uv(0.8563, 0.2278); uv(0.697, 0.4272); uv(0.39, 0.2033); uv(0.3666, 0.4242); uv(0.697, 0.4272); uv(0.653, 0.2053); uv(0.39, 0.2033); uv(0.8065, 0.4477); uv(0.8143, 0.6217); uv(0.8475, 0.4536); uv(0.8065, 0.4477); uv(0.781, 0.6227); uv(0.8143, 0.6217); uv(0.6979, 0.4233); uv(0.6852, 0.6002); uv(0.7302, 0.4321); uv(0.7302, 0.4321); uv(0.6852, 0.6002); uv(0.7273, 0.6031); uv(0.6716, 0.5963); uv(0.697, 0.4272); uv(0.4086, 0.5943); uv(0.4086, 0.5943); uv(0.697, 0.4272); uv(0.3666, 0.4242); uv(0.0802, 0.566); uv(0.3695, 0.3939); uv(0.0381, 0.39); uv(0.0802, 0.566); uv(0.3431, 0.5689); uv(0.3695, 0.3939); f(0, 1, 2, 0, 1, 2); f(2, 1, 3, 3, 4, 5); f(4, 3, 5, 6, 7, 8); f(4, 2, 3, 9, 10, 11); f(5, 1, 6, 12, 13, 14); f(5, 3, 1, 15, 16, 17); f(7, 0, 4, 18, 19, 20); f(4, 0, 2, 21, 22, 23); f(6, 0, 7, 24, 25, 26); f(6, 1, 0, 27, 28, 29); f(8, 9, 10, 30, 31, 32); f(10, 9, 11, 33, 34, 35); f(12, 8, 13, 36, 37, 38); f(12, 9, 8, 39, 40, 41); f(14, 11, 12, 42, 43, 44); f(12, 11, 9, 45, 46, 47); f(13, 10, 15, 48, 49, 50); f(13, 8, 10, 51, 52, 53); f(15, 11, 14, 54, 55, 56); f(15, 10, 11, 57, 58, 59); f(16, 14, 17, 60, 61, 62); f(16, 15, 14, 63, 64, 65); f(18, 15, 16, 66, 67, 68); f(18, 13, 15, 69, 70, 71); f(17, 14, 19, 72, 73, 74); f(19, 14, 12, 75, 76, 77); f(19, 13, 18, 78, 79, 80); f(19, 12, 13, 81, 82, 83); f(20, 7, 21, 84, 85, 86); f(20, 6, 7, 87, 88, 89); f(21, 7, 22, 90, 91, 92); f(22, 7, 4, 93, 94, 95); f(23, 6, 20, 96, 97, 98); f(23, 5, 6, 99, 100, 101); f(22, 5, 23, 102, 103, 104); f(22, 4, 5, 105, 106, 107); f(20, 19, 23, 108, 109, 110); f(20, 17, 19, 111, 112, 113); f(16, 21, 18, 114, 115, 116); f(18, 21, 22, 117, 118, 119); f(18, 22, 19, 120, 121, 122); f(19, 22, 23, 123, 124, 125); f(16, 20, 21, 126, 127, 128); f(16, 17, 20, 129, 130, 131); } private function f(_arg1:int, _arg2:int, _arg3:int, _arg4:int, _arg5:int, _arg6:int):void{ addFace(new Face(varr[_arg1], varr[_arg2], varr[_arg3], null, uvarr[_arg4], uvarr[_arg5], uvarr[_arg6])); } private function v(_arg1:Number, _arg2:Number, _arg3:Number):void{ varr.push(new Vertex((_arg1 * scaling), (_arg2 * scaling), (_arg3 * scaling))); } } }//package com.core.models
Section 164
//Tomato (com.core.models.Tomato) package com.core.models { import away3d.core.utils.*; import away3d.core.base.*; public class Tomato extends Mesh { private var uvarr:Array; private var scaling:Number; private var varr:Array; public function Tomato(_arg1:Object=null){ varr = []; uvarr = []; super(_arg1); _arg1 = Init.parse(_arg1); scaling = _arg1.getNumber("scaling", 1); build(); type = ".as"; } private function uv(_arg1:Number, _arg2:Number):void{ uvarr.push(new UV(_arg1, _arg2)); } private function build():void{ v(227.2136, 28.4402, -0.891); v(143.4564, 48.8712, -143.4564); v(171.9695, 28.4402, -171.9695); v(191.5722, 53.9789, -0.891); v(127.4178, 15.5365, -127.4178); v(171.9695, 11.2352, -0.891); v(127.4178, 15.5365, 125.6358); v(171.9695, 28.4402, 170.1874); v(143.4564, 48.8712, 141.6744); v(0.891, 28.4402, -227.2136); v(0.891, 11.2352, -171.9695); v(0.891, 53.9789, -191.5722); v(-141.6744, 48.8712, -143.4564); v(-170.1874, 28.4402, -171.9695); v(-125.6358, 15.5365, -127.4178); v(-227.2136, 28.4402, -0.891); v(-170.1874, 11.2352, -0.891); v(-189.7902, 53.9789, -0.891); v(-141.6744, 48.8712, 141.6744); v(-170.1874, 28.4402, 170.1874); v(-125.6358, 15.5365, 125.6358); v(0.891, 28.4402, 227.2136); v(0.891, 11.2352, 170.1874); v(0.891, 53.9789, 189.7902); v(0.891, 60.4308, -0.891); v(0.891, -8.1204, -0.891); uv(0.6667, 0.001); uv(0.87, 0.1584); uv(1, 0.1251); uv(0.6667, 0.001); uv(0.6246, 0.0626); uv(0.87, 0.1584); uv(0.999, 0.6667); uv(0.6843, 0.565); uv(0.8749, 0.6882); uv(0.999, 0.6667); uv(0.7498, 0.5005); uv(0.6843, 0.565); uv(0.999, 0.6667); uv(0.87, 0.8426); uv(1, 0.8759); uv(0.999, 0.6667); uv(0.8749, 0.6882); uv(0.87, 0.8426); uv(0.6667, 0.001); uv(0.3148, 0.0655); uv(0.6246, 0.0626); uv(0.6667, 0.001); uv(0.2493, 0); uv(0.3148, 0.0655); uv(0.3324, 0.5005); uv(0.6843, 0.565); uv(0.7498, 0.5005); uv(0.3324, 0.5005); uv(0.3744, 0.563); uv(0.6843, 0.565); uv(0.999, 0.3343); uv(0.87, 0.1584); uv(0.8749, 0.3128); uv(0.999, 0.3343); uv(1, 0.1251); uv(0.87, 0.1584); uv(0.999, 0.3343); uv(0.6843, 0.436); uv(0.7498, 0.5005); uv(0.999, 0.3343); uv(0.8749, 0.3128); uv(0.6843, 0.436); uv(0.3324, 0.5005); uv(0.129, 0.6579); uv(0.3744, 0.563); uv(0.3324, 0.5005); uv(0, 0.6256); uv(0.129, 0.6579); uv(0, 0.8338); uv(0.129, 0.6579); uv(0, 0.6256); uv(0, 0.8338); uv(0.1241, 0.8133); uv(0.129, 0.6579); uv(0.3324, 0.5005); uv(0.6843, 0.436); uv(0.3744, 0.4379); uv(0.3324, 0.5005); uv(0.7498, 0.5005); uv(0.6843, 0.436); uv(0.3324, 0.5005); uv(0.129, 0.3431); uv(0, 0.3754); uv(0.3324, 0.5005); uv(0.3744, 0.4379); uv(0.129, 0.3431); uv(0, 0.8338); uv(0.3148, 0.9355); uv(0.1241, 0.8133); uv(0, 0.8338); uv(0.2493, 1); uv(0.3148, 0.9355); uv(0.6667, 1); uv(0.3148, 0.9355); uv(0.2493, 1); uv(0.6667, 1); uv(0.6246, 0.9384); uv(0.3148, 0.9355); uv(0, 0.1672); uv(0.129, 0.3431); uv(0.1241, 0.1877); uv(0, 0.1672); uv(0, 0.3754); uv(0.129, 0.3431); uv(0, 0.1672); uv(0.3148, 0.0655); uv(0.2493, 0); uv(0, 0.1672); uv(0.1241, 0.1877); uv(0.3148, 0.0655); uv(0.6667, 1); uv(0.87, 0.8426); uv(0.6246, 0.9384); uv(0.6667, 1); uv(1, 0.8759); uv(0.87, 0.8426); uv(0.4995, 0.2502); uv(0.129, 0.3431); uv(0.3744, 0.4379); uv(0.4995, 0.2502); uv(0.1241, 0.1877); uv(0.129, 0.3431); uv(0.4995, 0.2502); uv(0.6843, 0.436); uv(0.8749, 0.3128); uv(0.4995, 0.2502); uv(0.3744, 0.4379); uv(0.6843, 0.436); uv(0.4995, 0.2502); uv(0.87, 0.1584); uv(0.6246, 0.0626); uv(0.4995, 0.2502); uv(0.8749, 0.3128); uv(0.87, 0.1584); uv(0.4995, 0.2502); uv(0.3148, 0.0655); uv(0.1241, 0.1877); uv(0.4995, 0.2502); uv(0.6246, 0.0626); uv(0.3148, 0.0655); uv(0.4995, 0.7507); uv(0.6843, 0.565); uv(0.3744, 0.563); uv(0.4995, 0.7507); uv(0.8749, 0.6882); uv(0.6843, 0.565); uv(0.4995, 0.7507); uv(0.129, 0.6579); uv(0.1241, 0.8133); uv(0.4995, 0.7507); uv(0.3744, 0.563); uv(0.129, 0.6579); uv(0.4995, 0.7507); uv(0.3148, 0.9355); uv(0.6246, 0.9384); uv(0.4995, 0.7507); uv(0.1241, 0.8133); uv(0.3148, 0.9355); uv(0.4995, 0.7507); uv(0.87, 0.8426); uv(0.8749, 0.6882); uv(0.4995, 0.7507); uv(0.6246, 0.9384); uv(0.87, 0.8426); f(0, 1, 2, 0, 1, 2); f(0, 3, 1, 3, 4, 5); f(0, 4, 5, 6, 7, 8); f(0, 2, 4, 9, 10, 11); f(0, 6, 7, 12, 13, 14); f(0, 5, 6, 15, 16, 17); f(0, 8, 3, 18, 19, 20); f(0, 7, 8, 21, 22, 23); f(9, 4, 2, 24, 25, 26); f(9, 10, 4, 27, 28, 29); f(9, 1, 11, 30, 31, 32); f(9, 2, 1, 33, 34, 35); f(9, 12, 13, 36, 37, 38); f(9, 11, 12, 39, 40, 41); f(9, 14, 10, 42, 43, 44); f(9, 13, 14, 45, 46, 47); f(15, 14, 13, 48, 49, 50); f(15, 16, 14, 51, 52, 53); f(15, 12, 17, 54, 55, 56); f(15, 13, 12, 57, 58, 59); f(15, 18, 19, 60, 61, 62); f(15, 17, 18, 63, 64, 65); f(15, 20, 16, 66, 67, 68); f(15, 19, 20, 69, 70, 71); f(21, 20, 19, 72, 73, 74); f(21, 22, 20, 75, 76, 77); f(21, 18, 23, 78, 79, 80); f(21, 19, 18, 81, 82, 83); f(21, 8, 7, 84, 85, 86); f(21, 23, 8, 87, 88, 89); f(21, 6, 22, 90, 91, 92); f(21, 7, 6, 93, 94, 95); f(24, 18, 17, 96, 97, 98); f(24, 23, 18, 99, 100, 101); f(24, 12, 11, 102, 103, 104); f(24, 17, 12, 105, 106, 107); f(24, 1, 3, 108, 109, 110); f(24, 11, 1, 111, 112, 113); f(24, 8, 23, 114, 115, 116); f(24, 3, 8, 117, 118, 119); f(25, 4, 10, 120, 121, 122); f(25, 5, 4, 123, 124, 125); f(25, 14, 16, 126, 127, 128); f(25, 10, 14, 129, 130, 131); f(25, 20, 22, 132, 133, 134); f(25, 16, 20, 135, 136, 137); f(25, 6, 5, 138, 139, 140); f(25, 22, 6, 141, 142, 143); } private function f(_arg1:int, _arg2:int, _arg3:int, _arg4:int, _arg5:int, _arg6:int):void{ addFace(new Face(varr[_arg1], varr[_arg2], varr[_arg3], null, uvarr[_arg4], uvarr[_arg5], uvarr[_arg6])); } private function v(_arg1:Number, _arg2:Number, _arg3:Number):void{ varr.push(new Vertex((_arg1 * scaling), (_arg2 * scaling), (_arg3 * scaling))); } } }//package com.core.models
Section 165
//CuttingBoardView (com.core.CuttingBoardView) package com.core { import flash.events.*; import flash.display.*; import away3d.containers.*; import away3d.events.*; import away3d.core.base.*; import away3d.materials.*; import com.utilities.*; import com.core.models.*; public class CuttingBoardView extends Sprite { private var _billBoardContainer:ObjectContainer3D; private var _container:ObjectContainer3D; private var _hudTimeSlot:MovieClip; private var _view:View3D; private var _awayEnviro:AwayEnvironment; private var _backgroundSprite:Sprite; private var _location:Object; private var _initialized:Boolean;// = false private var _scroller:ScrollinBackground; private var _itemName:String; private var _liveBillBoardsAr:Array; private var _cuttingBoard:Object3D; private var _testColor:Number;// = 0 private var _CamSn:Number;// = 0 public static const SCENEREADY_EVENT:String = " scene ready"; public static const HUDREADY_EVENT:String = " hud ready"; public static const ITEMHIT_EVENT:String = " itemhit"; public function CuttingBoardView(_arg1:Object){ _location = new Object(); _backgroundSprite = new Sprite(); _container = new ObjectContainer3D(); _billBoardContainer = new ObjectContainer3D(); _liveBillBoardsAr = new Array(); super(); _hudTimeSlot = Main.hud1; _hudTimeSlot.x = 20; _hudTimeSlot.y = 19; _location = _arg1; _testColor = _arg1.color; _awayEnviro = new AwayEnvironment(_arg1); _awayEnviro.addEventListener(AwayEnvironment.SCENEREADY_EVENT, addEnviro); } private function itemHit(_arg1:Event):void{ _itemName = _arg1.target.myName; dispatchEvent(new Event(ITEMHIT_EVENT, true)); } private function check(_arg1:MouseEvent3D):void{ trace("check"); } public function init():void{ testSphere(); addEventListener(Event.ENTER_FRAME, enviroDrive); dispatchEvent(new Event(HUDREADY_EVENT, true)); } private function addEnviro(_arg1:Event):void{ trace(("ad enviro" + _arg1.target.AwayView)); _view = _arg1.target.AwayView; _container.x = (-(_view.width) / 2); _container.y = (-(_view.height) / 2); _view.x = _location.x; _view.y = _location.y; _view.scene.addChild(_container); dispatchEvent(new Event(SCENEREADY_EVENT, true)); } public function resetBillboardVisibility():void{ var _local1:Number = 0; while (_local1 < _liveBillBoardsAr.length) { _liveBillBoardsAr[_local1].visible = true; _local1++; }; } public function get view():Object{ return (_view); } public function addSandwichSets(_arg1:Number):void{ var _local2:Number = 0; while (_local2 < _arg1) { trace("sand"); _liveBillBoardsAr.push(new AnimatedBillBoardSprite(new Main.minibacon(), {x:0, name:"bacon", z:int((Math.random() * 200)), y:(-100 + int((Math.random() * 250))), rotationY:int((Math.random() * 200))})); _container.addChild(_liveBillBoardsAr[(_liveBillBoardsAr.length - 1)]); _liveBillBoardsAr[(_liveBillBoardsAr.length - 1)].addEventListener(AnimatedBillBoardSprite.BILLBOARDHIT_EVENT, itemHit); _liveBillBoardsAr.push(new AnimatedBillBoardSprite(new Main.minihash(), {x:0, name:"hash", z:int((Math.random() * 200)), y:(-100 + int((Math.random() * 250))), rotationY:int((Math.random() * 200))})); _container.addChild(_liveBillBoardsAr[(_liveBillBoardsAr.length - 1)]); _liveBillBoardsAr[(_liveBillBoardsAr.length - 1)].addEventListener(AnimatedBillBoardSprite.BILLBOARDHIT_EVENT, itemHit); _liveBillBoardsAr.push(new AnimatedBillBoardSprite(new Main.minilettuce(), {x:0, name:"lettuce", z:int((Math.random() * 200)), y:(-100 + int((Math.random() * 250))), rotationY:int((Math.random() * 200))})); _container.addChild(_liveBillBoardsAr[(_liveBillBoardsAr.length - 1)]); _liveBillBoardsAr[(_liveBillBoardsAr.length - 1)].addEventListener(AnimatedBillBoardSprite.BILLBOARDHIT_EVENT, itemHit); _liveBillBoardsAr.push(new AnimatedBillBoardSprite(new Main.minitomato(), {x:0, name:"tomato", z:int((Math.random() * 200)), y:(-100 + int((Math.random() * 250))), rotationY:int((Math.random() * 200))})); _container.addChild(_liveBillBoardsAr[(_liveBillBoardsAr.length - 1)]); _liveBillBoardsAr[(_liveBillBoardsAr.length - 1)].addEventListener(AnimatedBillBoardSprite.BILLBOARDHIT_EVENT, itemHit); _liveBillBoardsAr.push(new AnimatedBillBoardSprite(new Main.minibead(), {x:0, name:"bread", z:int((Math.random() * 200)), y:(-100 + int((Math.random() * 250))), rotationY:int((Math.random() * 200))})); _container.addChild(_liveBillBoardsAr[(_liveBillBoardsAr.length - 1)]); _liveBillBoardsAr[(_liveBillBoardsAr.length - 1)].addEventListener(AnimatedBillBoardSprite.BILLBOARDHIT_EVENT, itemHit); _local2++; }; _container.ownCanvas = false; } public function get hud():MovieClip{ return (_hudTimeSlot); } private function enviroDrive(_arg1:Event):void{ _CamSn = (_CamSn + 0.1); _container.rotationY = (_container.rotationY + 0.3); _awayEnviro.AwayView.render(); _awayEnviro.AwayView.camera.z = (_awayEnviro.AwayView.camera.z - (3 * Math.sin((_CamSn / 5)))); } public function get itemName():String{ return (_itemName); } private function testSphere():void{ var _local1:BitmapData; var _local2:BitmapMaterial; var _local3:MovieClip; if (!_initialized){ _local1 = new BitmapData(Main.cuttingSkin.width, Main.cuttingSkin.height, false, 0); _local1.draw(Main.cuttingSkin); _local2 = new BitmapMaterial(_local1); _local2.precision = 5; _scroller = new ScrollinBackground(); _local3 = new Main.whiteTiles(); _scroller.setupScroll(_awayEnviro.background, _local3, "down", 12); _awayEnviro.hud.addChild(_hudTimeSlot); _initialized = true; }; _container.x = 0; _container.y = 0; _container.z = 0; _billBoardContainer.x = 0; _billBoardContainer.y = 0; _billBoardContainer.z = 0; addSandwichSets(15); } } }//package com.core
Section 166
//GameManager (com.core.GameManager) package com.core { import flash.events.*; import flash.display.*; import com.utilities.*; public class GameManager extends Sprite { private var _pointScore:Number;// = 0 private var _messaging:Object; private var _pointHoldScore:Number;// = 0 private var _clock:Clock; private var _scoring:Scoring_counter; private var _timeSprite:Sprite; private var _holdScore:Number;// = 0 private var _pointScoreSprite:Sprite; private var _upgradeSprite_1:Sprite; private var _upgradeSprite_2:Sprite; private var _upgradeSprite_3:Sprite; private var _upgradeSprite_4:Sprite; private var _scoreSprite:Sprite; private var _locksAr:Array; private var _holderClip:MovieClip; private var _sandwichManager:SandwichManager; private var _upgrade_1:Scoring_counter; private var _upgrade_2:Scoring_counter; private var _upgrade_3:Scoring_counter; private var _upgrade_4:Scoring_counter; private var _windowType:String; private var _pointScorObj:Scoring_counter; private var _cuttingBoardManager:CuttingBoardView; private var _hud2:MovieClip; public static const GAMEEND_EVENT:String = "game end"; public static const GAMELEVELEND_EVENT:String = "game level end"; public static const SANDWICHINITBUILD_EVENT:String = " sandwich init ready"; public static var PointsMultiplier:Number = 1; public static var MaxPoints:Number = 5; public static var gameActive:Boolean = false; public function GameManager(_arg1:MovieClip){ _scoreSprite = new Sprite(); _pointScoreSprite = new Sprite(); _upgradeSprite_1 = new Sprite(); _upgradeSprite_2 = new Sprite(); _upgradeSprite_3 = new Sprite(); _upgradeSprite_4 = new Sprite(); _timeSprite = new Sprite(); _locksAr = new Array(); super(); _holderClip = _arg1; _cuttingBoardManager = new CuttingBoardView({x:0, y:0, width:(640 / 2), height:480, color:0}); _cuttingBoardManager.addEventListener(CuttingBoardView.SCENEREADY_EVENT, addCuttingBoardView); _cuttingBoardManager.addEventListener(CuttingBoardView.HUDREADY_EVENT, setupTime); _cuttingBoardManager.addEventListener(CuttingBoardView.ITEMHIT_EVENT, itemHit); _sandwichManager = new SandwichManager({x:(640 / 2), y:0, width:(640 / 2), height:480, color:0}); _sandwichManager.addEventListener(SandwichManager.SCENEREADY_EVENT, addSandwichView); _sandwichManager.addEventListener(SandwichManager.HUDREADY_EVENT, setupScore); _sandwichManager.addEventListener(SandwichManager.SANDWICHINITBUILD_EVENT, sandInitBuildReady); _sandwichManager.addEventListener(SandwichManager.SANDWICHSCORE_EVENT, sandwichScore); _sandwichManager.addEventListener(SandwichManager.REQUESTSCORE_EVENT, requestScore); _sandwichManager.addEventListener(SandwichManager.REQUESTMESSAGE_EVENT, setSign); _sandwichManager.addEventListener(SandwichManager.ITEMWRONG_EVENT, wrongchoice); Main.soundDictionary["soundtrack"].play(0, 8000); } private function itemHit(_arg1:Event):void{ manageHud2Locks(_scoring.currentScore); _sandwichManager.itemHitRequest(_arg1.target.itemName); } private function endLevel(_arg1:Event=null):void{ if (_scoring.currentScore == MaxPoints){ _windowType = "win"; } else { _windowType = "level"; }; gameActive = false; _holdScore = _scoring.currentScore; _pointHoldScore = _pointScorObj.currentScore; _scoring.rst(); _sandwichManager.resetSandWich(); _cuttingBoardManager.resetBillboardVisibility(); dispatchEvent(new Event(GAMELEVELEND_EVENT, true)); } private function wrongchoice(_arg1:Event):void{ var _local2:Effect_Floater = new Effect_Floater(_messaging, (_hud2.parent as Sprite), {x:120, y:_hud2.parent.mouseY}, "9", 0.1); } public function get holdScore():Number{ return (_holdScore); } private function setupScore(_arg1:Event):void{ _arg1.target.hud.mouseEnabled = false; _arg1.target.hud.mouseChildren = false; Main.miniInstruct.x = 135; Main.miniInstruct.y = 370; _arg1.target.hud.parent.addChild(Main.miniInstruct); var _local2:BitMapper = new BitMapper(); var _local3:Array = _local2.buildDataObject("upgrades", 1, 14, new Main.numbas()); _arg1.target.removeEventListener(SandwichManager.HUDREADY_EVENT, setupScore); _upgrade_1 = new Scoring_counter("00", _local3, _upgradeSprite_1); _upgradeSprite_1.x = 39; _upgradeSprite_1.y = 18; _locksAr.push(_arg1.target.hud.lock1); _arg1.target.hud.addChild(_upgradeSprite_1); _upgrade_1.addPoints(_sandwichManager.fixins[0].score); _upgrade_2 = new Scoring_counter("00", _local3, _upgradeSprite_2); _upgradeSprite_2.x = 175; _upgradeSprite_2.y = 18; _locksAr.push(_arg1.target.hud.lock2); _arg1.target.hud.addChild(_upgradeSprite_2); _upgrade_2.addPoints(_sandwichManager.fixins[1].score); _upgrade_3 = new Scoring_counter("00", _local3, _upgradeSprite_3); _upgradeSprite_3.x = 39; _upgradeSprite_3.y = 51; _locksAr.push(_arg1.target.hud.lock3); _arg1.target.hud.addChild(_upgradeSprite_3); _upgrade_3.addPoints(_sandwichManager.fixins[2].score); _upgrade_4 = new Scoring_counter("00", _local3, _upgradeSprite_4); _upgradeSprite_4.x = 175; _upgradeSprite_4.y = 51; _locksAr.push(_arg1.target.hud.lock4); _arg1.target.hud.addChild(_upgradeSprite_4); _upgrade_4.addPoints(_sandwichManager.fixins[3].score); setupSignage(); resetLocks(); } private function sandwichScore(_arg1:Event):void{ Main.soundDictionary["sndwichComplete"].play(); _scoring.addPoints(1); checkForFinal(); } private function resetLocks():void{ var _local1:Number = 0; while (_local1 < _locksAr.length) { _locksAr[_local1].gotoAndStop(1); _local1++; }; } public function addCuttingBoardView(_arg1:Event):void{ _holderClip.addChild(_arg1.target.view); } private function sandInitBuildReady(_arg1:Event):void{ Main.soundDictionary["go"].play(); dispatchEvent(new Event(SANDWICHINITBUILD_EVENT, true)); } public function setSign(_arg1:Event):void{ var _local2:Effect_Floater; switch (_arg1.target.message){ case "bread": _pointScorObj.addPoints((123 * PointsMultiplier)); trace("message floater called"); _local2 = new Effect_Floater(_messaging, _arg1.target.hud.parent, {x:100, y:350}, "0", 0.1); break; case "lettuce": _pointScorObj.addPoints((166 * PointsMultiplier)); trace("message floater called"); _local2 = new Effect_Floater(_messaging, _arg1.target.hud.parent, {x:100, y:350}, "1", 0.1); break; case "tomato": _pointScorObj.addPoints((211 * PointsMultiplier)); trace("message floater called"); _local2 = new Effect_Floater(_messaging, _arg1.target.hud.parent, {x:100, y:350}, "2", 0.1); break; case "bacon": _pointScorObj.addPoints((315 * PointsMultiplier)); trace("message floater called"); _local2 = new Effect_Floater(_messaging, _arg1.target.hud.parent, {x:100, y:350}, "3", 0.1); break; case "build": trace("message floater called"); _local2 = new Effect_Floater(_messaging, _arg1.target.hud.parent, {x:100, y:350}, "8", 0.1); break; case "cheese": _pointScorObj.addPoints(54); trace("message floater called"); _local2 = new Effect_Floater(_messaging, _arg1.target.hud.parent, {x:100, y:350}, "4", 0.1); break; case "pickle": _pointScorObj.addPoints(110); trace("message floater called"); _local2 = new Effect_Floater(_messaging, _arg1.target.hud.parent, {x:100, y:350}, "7", 0.1); break; case "ham": _pointScorObj.addPoints(600); trace("message floater called"); _local2 = new Effect_Floater(_messaging, _arg1.target.hud.parent, {x:100, y:350}, "5", 0.1); break; case "sardine": _pointScorObj.addPoints(110); trace("message floater called"); _local2 = new Effect_Floater(_messaging, _arg1.target.hud.parent, {x:100, y:350}, "6", 0.1); break; }; } public function addSandwichView(_arg1:Event):void{ _holderClip.addChild(_arg1.target.view); } private function requestScore(_arg1:Event):void{ _sandwichManager.sendScore(_scoring.currentScore); } public function get timeScore():Number{ var _local1:Number = (_clock.minutes * 1000); var _local2:Number = (_clock.seconds * 500); trace(("**********TIME" + Number((_local1 + _local2)))); return (Number((_local1 + _local2))); } public function startLevel():void{ resetLocks(); PointsMultiplier = 1; _holdScore = 0; _pointScorObj.rst(); _pointHoldScore = 0; _clock.startClock("00:50:00"); gameActive = true; _sandwichManager.resetSandWich(); } public function get windowType():String{ return (_windowType); } private function checkForFinal():void{ trace(("CHECKING FOR FINAL" + _scoring.currentScore)); if (_scoring.currentScore == MaxPoints){ _clock.pause(true); endLevel(); }; } public function initViewsContent():void{ _cuttingBoardManager.init(); _sandwichManager.init(); } public function get pointScore():Number{ return (_pointHoldScore); } public function get pointHoldScore():Number{ return (_pointHoldScore); } private function setupSignage():void{ var _local1:BitMapper = new BitMapper(); _messaging = _local1.buildDataObject("messaging", 1, 10, new Main.messages()); } private function trck(_arg1:Event):void{ Main.soundDictionary["soundtrack"].play(0, 6); } private function manageHud2Locks(_arg1:Number):void{ var _local2:Number = 0; while (_local2 < _sandwichManager.fixins.length) { if (_arg1 == _sandwichManager.fixins[_local2].score){ _locksAr[_local2].gotoAndStop(2); }; _local2++; }; } private function setupTime(_arg1:Event):void{ _hud2 = _arg1.target.hud; var _local2:BitMapper = new BitMapper(); var _local3:Array = _local2.buildDataObject("scoring", 1, 14, new Main.numbas()); _arg1.target.hud.addChild(_timeSprite); _clock = new Clock("00:00:00", _local3, _timeSprite, {x:0, y:27}); _clock.addEventListener(Clock.LEVELEND_EVENT, endLevel); trace("setup score"); var _local4:BitMapper = new BitMapper(); var _local5:Array = _local4.buildDataObject("scoring", 1, 14, new Main.numbas()); _arg1.target.hud.addChild(_scoreSprite); _arg1.target.hud.addChild(_pointScoreSprite); _scoreSprite.x = 230; _scoreSprite.y = (_scoreSprite.y + 30); _pointScoreSprite.x = 150; _scoring = new Scoring_counter("00", _local5, _scoreSprite); _pointScorObj = new Scoring_counter("00000000", _local5, _pointScoreSprite); } } }//package com.core
Section 167
//SandwichManager (com.core.SandwichManager) package com.core { import flash.events.*; import flash.display.*; import away3d.containers.*; import away3d.primitives.*; import com.utilities.*; import com.core.models.*; public class SandwichManager extends Sprite { private var _container:ObjectContainer3D; private var _awayEnviro:AwayEnvironment; private var _view:View3D; private var _location:Object; private var _initialized:Boolean;// = false private var _hudScoreSlot:MovieClip; private var _scroller:ScrollinBackground; private var _testSphere:Sphere; private var _CamSn:Number;// = 0 private var _currentMessage:String; private var _testColor:Number;// = 0 private var _mainSandwich:SandWich; private var _backgroundSprite:Sprite; private var _sandwichAr:Array; public static const SANDWICHINITBUILD_EVENT:String = " sandwich init ready"; public static const HUDREADY_EVENT:String = " hud ready"; public static const SANDWICHSCORE_EVENT:String = " sandwich score"; public static const REQUESTMESSAGE_EVENT:String = " request message"; public static const ITEMWRONG_EVENT:String = " item wrong"; public static const SCENEREADY_EVENT:String = " scene ready"; public static const REQUESTSCORE_EVENT:String = " request score"; public function SandwichManager(_arg1:Object){ _location = new Object(); _backgroundSprite = new Sprite(); _container = new ObjectContainer3D(); _sandwichAr = new Array(); super(); _hudScoreSlot = Main.hud2; _hudScoreSlot.x = 3; _hudScoreSlot.y = 19; _location = _arg1; _testColor = _arg1.color; _awayEnviro = new AwayEnvironment(_arg1); _awayEnviro.addEventListener(AwayEnvironment.SCENEREADY_EVENT, addEnviro); } public function get fixins():Array{ return (_mainSandwich.fixins); } public function get message():String{ return (_currentMessage); } private function requestScore(_arg1:Event):void{ dispatchEvent(new Event(REQUESTSCORE_EVENT, true)); } private function initSandReady(_arg1:Event):void{ dispatchEvent(new Event(SANDWICHINITBUILD_EVENT, true)); } public function init():void{ testSphere(); addEventListener(Event.ENTER_FRAME, enviroDrive); dispatchEvent(new Event(HUDREADY_EVENT, true)); dispatchEvent(new Event(SCENEREADY_EVENT, true)); } public function resetSandWich():void{ _mainSandwich.resetSandwich(); } public function sendScore(_arg1:Number):void{ _mainSandwich.fixinRequest(_arg1); } private function addSandWich(_arg1:Event):void{ _container.addChild(_arg1.target.container); } private function addEnviro(_arg1:Event):void{ trace(("ad enviro" + _arg1.target.AwayView)); _view = _arg1.target.AwayView; _container.x = 0; _container.y = 0; _view.x = _location.x; _view.y = _location.y; _view.scene.addChild(_container); } public function get view():View3D{ return (_view); } private function buildSandWich():void{ _mainSandwich = new SandWich(); _mainSandwich.addEventListener(SandWich.SANDWICHREADY_EVENT, addSandWich); _mainSandwich.addEventListener(SandWich.SANDWICHINITBUILD_EVENT, initSandReady); _mainSandwich.addEventListener(SandWich.SANDWICHSCORE_EVENT, sandwichScore); _mainSandwich.addEventListener(SandWich.REQUESTSCORE_EVENT, requestScore); _mainSandwich.addEventListener(SandWich.REQUESTMESSAGE_EVENT, requestMessage); _mainSandwich.addEventListener(SandWich.ITEMWRONG_EVENT, wrongChoice); } private function wrongChoice(_arg1:Event):void{ dispatchEvent(new Event(ITEMWRONG_EVENT, true)); } private function sandwichScore(_arg1:Event):void{ dispatchEvent(new Event(SANDWICHSCORE_EVENT, true)); } private function enviroDrive(_arg1:Event):void{ _CamSn = (_CamSn + 0.1); _awayEnviro.AwayView.render(); _awayEnviro.AwayView.camera.z = (_awayEnviro.AwayView.camera.z + (6.5 * Math.sin((_CamSn / 1.5)))); } public function spawnSandWich():void{ _mainSandwich.autoBuild(); } public function get hud():Sprite{ return (_hudScoreSlot); } private function requestMessage(_arg1:Event):void{ _currentMessage = _arg1.target.message; dispatchEvent(new Event(REQUESTMESSAGE_EVENT, true)); } public function pause():void{ } public function itemHitRequest(_arg1:String):void{ _mainSandwich.itemRequest(_arg1); } private function testSphere():void{ _scroller = new ScrollinBackground(); var _local1:MovieClip = new Main.woodTiles(); _scroller.setupScroll(_awayEnviro.background, _local1, "left", 40); _awayEnviro.hud.addChild(_hudScoreSlot); buildSandWich(); spawnSandWich(); } } }//package com.core
Section 168
//MindJoltAPI (com.mindjolt.api.as3.MindJoltAPI) package com.mindjolt.api.as3 { import flash.events.*; import flash.display.*; import flash.net.*; public class MindJoltAPI extends MovieClip { private var dispatcher:CustomDispatcher; public static var service:Object; public function MindJoltAPI(){ dispatcher = new CustomDispatcher(); dispatcher.doAction(1, 100); dispatcher.addEventListener(_slot2.ACTION, createRoot); } private function createRoot(_arg1:Event):void{ if (root != null){ _arg1.currentTarget.removeEventListener(_slot2.ACTION, createRoot); init(); }; } private function init():void{ var _local1:Object; var _local2:String; var _local3:Loader; _local1 = Object(parent.root).loaderInfo.parameters; _local2 = ""; if (((!((_local1.mjPath == null))) && (isDomainAllowed()))){ _local2 = _local1.mjPath; } else { _local2 = "http://static.mindjolt.com/api/as3/scoreapi_as3_local.swf"; }; _local3 = new Loader(); _local3.contentLoaderInfo.addEventListener(Event.COMPLETE, loadFinished); _local3.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, loadFailed); _local3.load(new URLRequest(_local2)); addChild(_local3); } private function loadFinished(_arg1:Event):void{ service = _arg1.currentTarget.content.service; service.connect(); trace("[MindJoltAPI] service loaded"); } private function isDomainAllowed():Boolean{ var _local1:String; var _local2:LocalConnection; var _local3:String; _local1 = ".mindjolt.com"; _local2 = new LocalConnection(); _local3 = _local2.domain; if (_local3.indexOf(_local1) == (_local3.length - _local1.length)){ return (true); }; return (false); } private function loadFailed(_arg1:IOErrorEvent):void{ trace("[MindJoltAPI] unable to load service"); } } }//package com.mindjolt.api.as3 import flash.events.*; import flash.utils.*; class CustomDispatcher extends EventDispatcher { public static var ACTION:String = "action"; private function CustomDispatcher(){ } public function doAction(_arg1:Number, _arg2:Number):void{ var myTimer:Timer; var propAction:Function; var delay = _arg1; var repeat = _arg2; propAction = function (_arg1:TimerEvent):void{ dispatchEvent(new Event(_slot2.ACTION)); }; myTimer = new Timer(delay, repeat); myTimer.addEventListener(TimerEvent.TIMER, propAction); myTimer.start(); } }
Section 169
//ArtLoader (com.utilities.ArtLoader) package com.utilities { import flash.events.*; import flash.display.*; import flash.net.*; public class ArtLoader extends Sprite { private var _art:Bitmap; private var _used:Boolean;// = false public var _myLoader:Loader; public static const ART_EVENT:String = " art ready"; public function ArtLoader():void{ _myLoader = new Loader(); super(); trace("art loader added"); } public function get loaders():Loader{ return (_myLoader); } public function feedPreloader(_arg1:ProgressEvent):void{ } public function get grabArt():Bitmap{ return (_art); } private function artLoaded(_arg1:Event):void{ if (!_used){ trace(("art loaded correctly" + _arg1.target)); _art = _arg1.target.content; _myLoader.contentLoaderInfo.removeEventListener(Event.COMPLETE, artLoaded); _myLoader.contentLoaderInfo.removeEventListener(ProgressEvent.PROGRESS, feedPreloader); dispatchEvent(new Event(ART_EVENT, true)); _used = true; }; } public function loadArt(_arg1:String):void{ trace(("stager" + _arg1)); var _local2:URLRequest = new URLRequest(_arg1); var _local3:URLRequestHeader = new URLRequestHeader("pragma", "no-cache"); _local2.requestHeaders.push(_local3); _myLoader.load(_local2); _myLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, artLoaded); _myLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, feedPreloader); } } }//package com.utilities
Section 170
//AwayEnvironment (com.utilities.AwayEnvironment) package com.utilities { import flash.events.*; import flash.display.*; import away3d.containers.*; import flash.utils.*; import away3d.core.clip.*; public class AwayEnvironment extends MovieClip { private var _backgroundSprite:Sprite; public var view:View3D; public var scene:Scene3D; public static const SCENEREADY_EVENT:String = " SCENE"; public function AwayEnvironment(_arg1:Object){ _backgroundSprite = new Sprite(); super(); view = new View3D({background:_backgroundSprite}); view.background.graphics.beginFill(0, 0); view.background.graphics.drawRect(0, 0, _arg1.width, _arg1.height); view.background.graphics.endFill(); view.height = _arg1.height; view.clipping = new RectangleClipping({minX:0, minY:-480, maxX:320, maxY:480}); view.cacheAsBitmap = true; view.camera.moveLeft(150); view.camera.moveUp(240); view.scene.ownCanvas = true; var _local2:Timer = new Timer(300, 1); _local2.addEventListener(TimerEvent.TIMER_COMPLETE, dispatcher); _local2.start(); } private function dispatcher(_arg1:Event):void{ dispatchEvent(new Event(SCENEREADY_EVENT, true)); } public function get hud():Sprite{ return (view.hud); } public function get AwayView():Object{ return (view); } public function get background():Sprite{ return (view.background); } } }//package com.utilities
Section 171
//BitMapper (com.utilities.BitMapper) package com.utilities { import flash.events.*; import flash.display.*; import flash.utils.*; public class BitMapper { public var curFrame:uint;// = 1 public var currentAction:Array; public var hotZone:Sprite; public var bitDisposalList:Array; public var externalArt:MovieClip; public var drvFrame:Number;// = 0 public var maxFrame:uint;// = 0 public var charArRef:Object; public var Bitz:Bitmap; public var actionTimer:Timer; public var seqAr:Array; public var capsule:Sprite; public function BitMapper():void{ seqAr = new Array(); Bitz = new Bitmap(); hotZone = new Sprite(); capsule = new Sprite(); charArRef = new Object(); bitDisposalList = new Array(); super(); } public function sequencePlayer(_arg1:Array, _arg2:Number, _arg3:Boolean):void{ curFrame = _arg1[0]; accessor((curFrame - 1)); currentAction = _arg1; if (actionTimer){ actionTimer.removeEventListener(TimerEvent.TIMER, actionPack); actionTimer.reset(); }; if (_arg3){ actionTimer = new Timer(_arg2); actionTimer.addEventListener(TimerEvent.TIMER, actionPack); actionTimer.start(); } else { actionTimer = new Timer(_arg2, _arg1[(_arg1.length - 1)]); actionTimer.addEventListener(TimerEvent.TIMER, singleShot); actionTimer.start(); }; } public function singleShotDone():void{ } public function accessor(_arg1:Number):void{ Bitz.bitmapData = seqAr[_arg1]; } public function frameChecker():void{ } public function prepareFrames(_arg1:Object):void{ var _local2:String; for (_local2 in _arg1) { maxFrame++; seqAr.push(_arg1[("bit" + maxFrame)]); }; Bitz.x = -((_arg1[("bit" + 1)].width / 2)); Bitz.y = -((_arg1[("bit" + 1)].height / 2)); capsule.addChild(Bitz); Bitz.pixelSnapping = PixelSnapping.NEVER; Bitz.smoothing = false; } public function get DisposalList():Array{ return (bitDisposalList); } public function buildDataObject(_arg1:String, _arg2:Number, _arg3:Number, _arg4:MovieClip):Array{ var _local7:BitmapData; var _local5:Array = new Array(); var _local6:Number = _arg2; while (_local6 < (_arg3 + 1)) { _local7 = new BitmapData(_arg4.width, _arg4.height, true, 0xFFFFFF); _arg4.inner.gotoAndStop(_local6); _local7.draw(_arg4); _local5.push(_local7); _local6++; }; return (_local5); } public function singleShot(_arg1:Event):void{ if (curFrame <= currentAction[(currentAction.length - 1)]){ curFrame++; } else { actionTimer.stop(); singleShotDone(); }; accessor((curFrame - 1)); } public function framLoc():void{ curFrame = currentAction[0]; } public function drawHotty(_arg1:Number, _arg2:Number):void{ hotZone.name = "hotZone"; hotZone.graphics.beginFill(0xFF); hotZone.graphics.drawRect(0, 0, _arg1, _arg2); hotZone.graphics.endFill(); capsule.addChild(hotZone); } public function actionPack(_arg1:Event):void{ frameChecker(); if (curFrame < currentAction[(currentAction.length - 1)]){ curFrame++; accessor((curFrame - 1)); } else { curFrame = currentAction[0]; accessor((curFrame - 1)); }; } } }//package com.utilities
Section 172
//BlenderButton (com.utilities.BlenderButton) package com.utilities { import flash.display.*; import gs.*; import flash.geom.*; import gs.easing.*; public class BlenderButton { private var _blender:Sprite; private static var _lumG:Number = 0.71516; private static var _lumB:Number = 0.072169; private static var _lumR:Number = 0.212671; public static function formBitmap(_arg1:MovieClip):Bitmap{ var _local2:BitmapData = new BitmapData(_arg1.width, _arg1.height, true, 0xFFFFFF); var _local3:Matrix = new Matrix(); _local3.tx = (_local3.tx + (_arg1.width / 2)); _local3.ty = (_local3.ty + (_arg1.height / 2)); _local2.draw(_arg1, _local3); var _local4:Bitmap = new Bitmap(_local2); new Bitmap(_local2).x = (_local4.x - (_arg1.width / 2)); _local4.y = (_local4.y - (_arg1.height / 2)); _arg1.addChild(_local4); return (_local4); } public static function addBlender(_arg1:Bitmap):void{ var _local2:MovieClip = new MovieClip(); _local2.name = "masker"; _local2.mouseEnabled = false; var _local3:BitmapData = new BitmapData(_arg1.width, _arg1.height, true, 0); _local3.copyPixels(_arg1.bitmapData, _arg1.bitmapData.rect, new Point(0, 0)); var _local4:Bitmap = new Bitmap(_local3); _local2.graphics.beginFill(0xFFFFFF, 1); _local2.graphics.drawRect(0, 0, (_arg1.width / 10), _arg1.height); _local2.y = (_local2.y - (_arg1.height / 2)); _local2.x = (Number((-(_arg1.width) / 2)) - 10); _local2.rotation = (_local2.rotation + 10); var _local5:Number = (((0xFFFFFF >> 16) & 0xFF) / 0xFF); var _local6:Number = (((0xFFFFFF >> 8) & 0xFF) / 0xFF); var _local7:Number = ((0xFFFFFF & 0xFF) / 0xFF); var _local8:ColorTransform = new ColorTransform((_local5 * 1.8), (_local6 * 1.8), (_local7 * 1.8), 1, 1, 1); _local4.transform.colorTransform = _local8; _local4.x = (_local4.x - (_arg1.width / 2)); _local4.y = (_local4.y - (_arg1.height / 2)); _arg1.parent.addChild(_local4); _arg1.parent.addChild(_local2); _local4.mask = _local2; } public static function animate(_arg1:MovieClip):void{ if (_arg1){ TweenLite.to(_arg1, 0.5, {x:(_arg1.width + 90), ease:Linear.easeOut, onComplete:reset(_arg1)}); }; } public static function reset(_arg1:MovieClip):void{ _arg1.x = (-(_arg1.parent.width) / 2); } } }//package com.utilities
Section 173
//Card (com.utilities.Card) package com.utilities { import flash.events.*; import flash.display.*; import gs.*; public class Card extends MovieClip { private var _over:Boolean;// = false private var _level:Number; private var _yOrigin:Number;// = 0 private var _snDrv:Number;// = 0 private var _myXml:XML; private var _myArt:MovieClip; private var _myBitmap:Bitmap; private var _yLoc:Number;// = 220 private var _xOrigin:Number;// = 0 public static const PAUSESELECTOR_EVENT:String = "pause Selector"; public static const FLOATSCORE_EVENT:String = "float score"; public static const CARDREADY_EVENT:String = "card ready"; public function Card(_arg1:MovieClip, _arg2:Number, _arg3:XML, _arg4:Number){ _level = _arg4; _myXml = _arg3; _myArt = _arg1; _xOrigin = _arg2; _yOrigin = 600; _myArt.y = _yOrigin; _myArt.x = _xOrigin; var _local5:ArtLoader = new ArtLoader(); _local5.loadArt(_arg3.graphic_url); _local5.addEventListener(ArtLoader.ART_EVENT, dispatch); } private function artInt(_arg1:Event):void{ dispatch(); } private function clk(_arg1:Event):void{ Main.soundDictionary["go"].play(); LinkButtons.getUrl(String(_myXml.link)); dispatchEvent(new Event(PAUSESELECTOR_EVENT, true)); } public function get art():MovieClip{ return (_myArt); } private function ot(_arg1:Event):void{ _over = false; _myArt.scaleX = 1; _myArt.scaleY = 1; TweenFilterLite.to(_arg1.target, 0.5, {colorMatrixFilter:{brightness:1}}); } private function drv(_arg1:Event):void{ if (_over){ _snDrv = (_snDrv + 1.1); _myArt.scaleX = (1 + ((5 * Math.sin((_snDrv / 2))) / 100)); _myArt.scaleY = (1 + ((5 * Math.sin((_snDrv / 4))) / 100)); }; } private function ovr(_arg1:Event):void{ _over = true; Main.soundDictionary["play"].play(); BlenderButton.animate((_myArt.getChildByName("masker") as MovieClip)); TweenFilterLite.to(_arg1.target, 0.5, {colorMatrixFilter:{brightness:1.4}}); dispatchEvent(new Event(FLOATSCORE_EVENT, true)); } private function addMouseEvent():void{ _myArt.mouseChildren = false; _myArt.buttonMode = true; _myArt.addEventListener(MouseEvent.MOUSE_DOWN, clk); _myArt.addEventListener(MouseEvent.MOUSE_OVER, ovr); _myArt.addEventListener(MouseEvent.MOUSE_OUT, ot); addEventListener(Event.ENTER_FRAME, drv); BlenderButton.addBlender(_myBitmap); } private function dispatch(_arg1:Event=null):void{ _arg1.target.grabArt.x = (_arg1.target.grabArt.x - (_arg1.target.grabArt.width / 2)); _arg1.target.grabArt.y = (_arg1.target.grabArt.y - (_arg1.target.grabArt.height / 2)); _myArt.addChildAt(_arg1.target.grabArt, 1); _arg1.target.removeEventListener(ArtLoader.ART_EVENT, dispatch); dispatchEvent(new Event(CARDREADY_EVENT, true)); if (_level == 1){ TweenLite.to(_myArt, 0.6, {y:220, onComplete:addMouseEvent}); } else { TweenLite.to(_myArt, 0.6, {y:Number((_yLoc + Number((_myArt.height * (_level - 1))))), onComplete:addMouseEvent}); }; _myBitmap = _arg1.target.grabArt; } public function resume():void{ addEventListener(Event.ENTER_FRAME, drv); } public function pause():void{ removeEventListener(Event.ENTER_FRAME, drv); } } }//package com.utilities
Section 174
//Cartoon (com.utilities.Cartoon) package com.utilities { import flash.events.*; import flash.display.*; public class Cartoon extends Sprite { private var _myArt:MovieClip; public static const CARTOONDONE_EVENT:String = "cartoon done"; public function Cartoon(_arg1:MovieClip){ _myArt = _arg1; _myArt.addEventListener("cartooncomplete", fadeCartoon); _myArt.addEventListener("cartoonsound", cartoonSound); } private function cartoonSound(_arg1:Event):void{ Main.soundDictionary["coin"].play(); } private function fadeCartoon(_arg1:Event):void{ _arg1.target.removeEventListener("cartooncomplete", fadeCartoon); _arg1.target.removeEventListener("cartoonsound", cartoonSound); _arg1.target.removeEventListener("cartooncomplete", fadeCartoon); _myArt.addEventListener(Event.ENTER_FRAME, drv); } private function drv(_arg1:Event):void{ if (_myArt.alpha > 0){ _myArt.alpha = (_myArt.alpha - 0.07); } else { _arg1.target.removeEventListener(Event.ENTER_FRAME, drv); _myArt.parent.removeChild(_myArt); trace("cartoon done"); dispatchEvent(new Event(CARTOONDONE_EVENT, true)); }; } } }//package com.utilities
Section 175
//Clock (com.utilities.Clock) package com.utilities { import flash.events.*; import flash.display.*; import flash.utils.*; public class Clock extends Sprite { private var _targetScore:Number;// = 0 private var _numzArray:Array; private var _seconds:Number;// = 0 private var _flashCounter:Boolean;// = false private var _tm:Timer; private var _externalArt:Object; private var _ten:Number;// = 0 private var _myTm:Timer; private var _minutes:Number;// = 0 private var maxFrame:Number;// = 0 public var Bitz:Bitmap; private var _accel:Number;// = 0 private var _milliseconds:Number;// = 0 public var capsule:Sprite; private var seqAr:Array; private var storedLength:Number;// = 0 private var secondsKill:Boolean;// = false public static const LEVELEND_EVENT:String = "level end"; public function Clock(_arg1:String, _arg2:Object, _arg3:Sprite, _arg4:Object):void{ var _local6:Bitmap; Bitz = new Bitmap(); capsule = new Sprite(); seqAr = new Array(); _numzArray = new Array(); super(); _ten = 0; _externalArt = _arg2; prepareFrames(_arg2); _arg3.addChild(capsule); var _local5:Number = 0; while (_local5 < _arg1.length) { if (String(_arg1.substr(_local5, 1)) == ":"){ _local6 = new Bitmap(_externalArt[11]); } else { _local6 = new Bitmap(_externalArt[10]); }; _local6.x = (_local6.x + (_local5 * (_local6.width / 2))); _numzArray.push(_local6); capsule.addChild(_local6); capsule.x = _arg4.x; capsule.y = _arg4.y; storedLength = _local5; _local5++; }; _tm = new Timer(10); _tm.addEventListener(TimerEvent.TIMER, counter); trace("clock setup"); } public function prepareFrames(_arg1:Object):void{ var _local2:String; for (_local2 in _arg1) { maxFrame++; seqAr.push(_arg1[("bit" + maxFrame)]); }; Bitz.smoothing = false; } public function resetClock(_arg1:String):void{ _tm.stop(); _tm.start(); } public function startClock(_arg1:String):void{ _milliseconds = Number(_arg1.substr((_arg1.length - 2), 2)); _seconds = Number(_arg1.substr((_arg1.length - 5), 2)); _minutes = Number(_arg1.substr(0, 2)); if (_minutes < 1){ secondsKill = true; } else { secondsKill = false; }; _tm.start(); } public function counter(_arg1:Event):void{ var _local2:String; var _local3:String; var _local4:String; _milliseconds = (_milliseconds - 1); if (_milliseconds > 0){ } else { _seconds = (_seconds - 1); _ten = (_ten + 1); if (_ten > 9){ flashIt(); _ten = 0; }; _milliseconds = 59; }; if (_milliseconds < 10){ _local2 = ("0" + _milliseconds); } else { _local2 = String(_milliseconds); }; if (_seconds > 0){ } else { _minutes = (_minutes - 1); if (!secondsKill){ _seconds = 59; }; }; if (_seconds < 10){ _local3 = ("0" + _seconds); } else { _local3 = String(_seconds); }; if (_minutes > 0){ } else { secondsKill = true; _minutes = 0; }; if (_minutes < 10){ _local4 = ("0" + _minutes); } else { _local4 = String(_minutes); }; if ((((_minutes < 1)) && ((_seconds < 1)))){ stopClock(); _minutes = 0; _local4 = String(_minutes); _seconds = 0; _local3 = String(_seconds); _milliseconds = 0; _local2 = String(_milliseconds); }; _numzArray[0].bitmapData = _externalArt[Number(_local4.substr(0, 1))]; _numzArray[1].bitmapData = _externalArt[Number(_local4.substr(1, 1))]; _numzArray[3].bitmapData = _externalArt[Number(_local3.substr(0, 1))]; _numzArray[4].bitmapData = _externalArt[Number(_local3.substr(1, 1))]; _numzArray[6].bitmapData = _externalArt[Number(_local2.substr(0, 1))]; _numzArray[7].bitmapData = _externalArt[Number(_local2.substr(1, 1))]; } public function reset(_arg1:Event):void{ _tm.stop(); _milliseconds = 0; _seconds = 0; _minutes = 0; counter(_arg1); } public function get seconds():Number{ return (_seconds); } private function flasher(_arg1:Event):void{ if (!_flashCounter){ _flashCounter = true; } else { _flashCounter = false; }; } public function get minutes():Number{ return (_minutes); } public function kill():void{ if (_myTm){ _myTm.stop(); }; capsule.parent.removeChild(capsule); } private function test():void{ } public function stopClock():void{ dispatchEvent(new Event(LEVELEND_EVENT, true)); _tm.stop(); } public function pause(_arg1:Boolean):void{ if (_arg1){ _tm.stop(); } else { _tm.start(); }; } public function get tm():Timer{ return (_tm); } private function flashIt():void{ var _local1:Timer = new Timer(20, 6); _local1.addEventListener(TimerEvent.TIMER, flasher); _local1.start(); } public function condimentBoost():void{ _seconds = (_seconds + ((Math.random() * 4) + 1)); } } }//package com.utilities
Section 176
//Effect_Floater (com.utilities.Effect_Floater) package com.utilities { import flash.events.*; import flash.display.*; import flash.utils.*; public class Effect_Floater { private var _speed:Number;// = 0 private var _externalArt:Object; private var _frm:Number;// = 0 private var _myTm:Timer; private var _Animation:Boolean;// = false private var maxFrame:Number;// = 0 public var Bitz:Bitmap; private var _accel:Number;// = 0 public var capsule:Sprite; private var seqAr:Array; private var storedLength:Number;// = 0 public function Effect_Floater(_arg1:Object, _arg2:Sprite, _arg3:Object, _arg4:String="undefined", _arg5:Number=0.3):void{ Bitz = new Bitmap(); capsule = new Sprite(); seqAr = new Array(); super(); _frm = Number(_arg4); _speed = _arg5; if (_arg4 == "undefined"){ _frm = 0; } else { _Animation = true; }; _externalArt = _arg1; prepareFrames(_externalArt); _arg2.addChild(capsule); Bitz.y = _arg3.y; Bitz.x = _arg3.x; Bitz.bitmapData = seqAr[_frm]; capsule.addChild(Bitz); capsule.mouseEnabled = false; capsule.mouseChildren = false; _myTm = new Timer(20); _myTm.addEventListener(TimerEvent.TIMER, float); _myTm.start(); } public function prepareFrames(_arg1:Object):void{ var _local2:String; for (_local2 in _arg1) { maxFrame++; seqAr.push(_arg1[("bit" + maxFrame)]); }; Bitz.smoothing = false; } private function float(_arg1:Event):void{ if (!_Animation){ _frm++; if (_frm > seqAr.length){ _frm = 0; }; }; Bitz.bitmapData = _externalArt[_frm]; _accel = (_accel + _speed); capsule.y = (capsule.y - _accel); capsule.x = (5 * Math.sin(((_accel * 6) / 5))); if (capsule.alpha > 0){ capsule.alpha = (capsule.alpha - (_accel / 200)); }; if (capsule.y < -400){ trace("kill"); kill(); }; } public function kill():void{ if (_myTm){ _myTm.stop(); }; if (capsule.parent){ capsule.parent.removeChild(capsule); }; } } }//package com.utilities
Section 177
//EmbedSecure (com.utilities.EmbedSecure) package com.utilities { import flash.events.*; import flash.display.*; import flash.utils.*; public class EmbedSecure extends MovieClip { public var loader:Loader; public static const ARTREADY_EVENT:String = " artready"; public function EmbedSecure(_arg1:Class){ trace("embed secure started"); loader = new Loader(); loader.loadBytes(new (_arg1)); loader.contentLoaderInfo.addEventListener(Event.COMPLETE, artR); } public function grabClassDict(_arg1:Array):Dictionary{ var _local2:Dictionary = new Dictionary(); var _local3:Number = 0; while (_local3 < _arg1.length) { _local2[_arg1[_local3]] = (loader.contentLoaderInfo.applicationDomain.getDefinition(_arg1[_local3]) as Class); _local3++; }; return (_local2); } public function grabClass(_arg1:String):Class{ return ((loader.contentLoaderInfo.applicationDomain.getDefinition(_arg1) as Class)); } private function artR(_arg1:Event):void{ dispatchEvent(new Event(ARTREADY_EVENT, true)); } } }//package com.utilities
Section 178
//GameStartScreen (com.utilities.GameStartScreen) package com.utilities { import flash.events.*; import flash.display.*; import gs.*; import flash.utils.*; import com.mindjolt.api.as3.*; import flash.ui.*; public class GameStartScreen extends Sprite { private var _fryScoring:Scoring_counter; private var _mode:String; private var _timeScoring:Scoring_counter; private var _levelScoring:Scoring_counter; private var _timeSprite:Sprite; private var _score:Number;// = 0 private var _tallyNumber:Number;// = 0 private var _finalscoreSprite:Sprite; private var _art:MovieClip; private var _artOriginX:Number;// = 0 private var _artOriginY:Number;// = 0 private var _scoreSprite:Sprite; private var _fryscoreSprite:Sprite; private var _totalScoring:Scoring_counter; private var _finalScoring:Scoring_counter; private var myJolt:MindJoltAPI; private var _pointsSprite:Sprite; private var _windowType:String; private var _pointsScoring:Scoring_counter; private var _scoringObject:Object; private var _gameStarted:Boolean;// = false private var _sn:Number;// = 0 public static const GAMEPLAYSTART:String = "gameplay start"; public static const GAMESTARTREADY_EVENT:String = "gamestart ready"; public function GameStartScreen(_arg1:MovieClip){ _scoreSprite = new Sprite(); _fryscoreSprite = new Sprite(); _pointsSprite = new Sprite(); _timeSprite = new Sprite(); _finalscoreSprite = new Sprite(); super(); _art = _arg1; _art.x = (Math.round((Number((640 / 2)) - (_art.width / 2))) + 20); _art.y = (Math.round((Number((480 / 2)) - (_art.height / 2))) - 20); _artOriginY = _art.y; _artOriginX = _art.x; _art.startstuff.visible = false; addScoringSystem(); addPointsScoring(); addFryPoints(); addTimeScoring(); addFinalTotalScoring(); } private function itunesJump(_arg1:Event):void{ LinkButtons.getUrl("http://www.tunecore.com/music/munchiegamesrecords"); } private function setupGirlGames():void{ _art.girlgames.buttonMode = true; _art.girlgames.addEventListener(MouseEvent.MOUSE_DOWN, girlgames); } private function del():void{ var _local1:Timer = new Timer(500, 1); _local1.addEventListener(TimerEvent.TIMER_COMPLETE, diss); _local1.start(); } private function moregames(_arg1:Event):void{ LinkButtons.getUrl("http://www.cookingdressup.com"); } private function setupItunes():void{ _art.level.itunes.buttonMode = true; var _local1:Bitmap = BlenderButton.formBitmap(_art.level.itunes); BlenderButton.addBlender(_local1); _art.level.itunes.addEventListener(MouseEvent.MOUSE_DOWN, itunesJump); _art.level.itunes.addEventListener(MouseEvent.MOUSE_OVER, ovr); } private function showFinalScore(_arg1:Event):void{ _finalScoring.addPoints(_tallyNumber, "tally"); } private function showFryScore(_arg1:Event):void{ _fryScoring.addPoints((_scoringObject.mainScore * 1000), "tally"); } private function showButtonsAfterScore(_arg1:Event):void{ showPlay = true; scores(); } private function scores(_arg1:Event=null):void{ Preloader.remoteStage.quality = "high"; if (_scoringObject){ MochiScores.showLeaderboard({boardID:"d536eb15ff545561", score:_tallyNumber, onClose:leaderboardClose}); } else { MochiScores.showLeaderboard({boardID:"d536eb15ff545561", onClose:leaderboardClose}); }; Mouse.show(); } private function doWindowProcess():void{ if ((((_windowType == "level")) || ((_windowType == "win")))){ trace(("****should fire up score" + _scoringObject.mainScore)); _tallyNumber = Number(((_scoringObject.pointScore + _scoringObject.timeScore) + Number((_scoringObject.mainScore * 1000)))); _levelScoring.addPoints(_scoringObject.mainScore); }; } private function girlgames(_arg1:Event):void{ LinkButtons.getUrl("http://www.gamesgames.com"); } public function set showPlay(_arg1:Boolean):void{ _art.playgamebutton.visible = _arg1; if (_art.scores){ }; _art.more.visible = _arg1; } private function drvSn():void{ _sn = (_sn + 0.34); _art.x = (_art.x + (0.9 * Math.sin((_sn / 1.2)))); } private function setupShareButton():void{ _art.share.buttonMode = true; var _local1:Bitmap = BlenderButton.formBitmap(_art.share); BlenderButton.addBlender(_local1); _art.share.addEventListener(MouseEvent.MOUSE_DOWN, share); _art.share.addEventListener(MouseEvent.MOUSE_OVER, ovr); } private function closedClearSpring(_arg1:Event):void{ Main.cursor.visible = true; Preloader.remoteStage.quality = "low"; _art.widget.visible = false; } public function addArt(_arg1:String, _arg2:Object=undefined):MovieClip{ if (_arg2){ _scoringObject = _arg2; }; _art.visible = true; _art.alpha = 0; _art.mouseEnabled = true; _art.x = _artOriginX; _mode = _arg1; if (!_gameStarted){ setupPlayButton(); setupMoreGames(); _gameStarted = true; }; _art.startstuff.visible = false; _art.level.visible = false; Mouse.show(); switch (_arg1){ case "start": showPlay = true; _windowType = "start"; _art.startstuff.visible = true; break; case "level": showPlay = false; _art.level.gotoAndStop(1); _windowType = "level"; _art.level.visible = true; break; case "end": _windowType = "end"; _art.end.visible = true; break; case "win": showPlay = false; trace("winner"); _art.level.gotoAndStop(2); _windowType = "win"; _art.level.visible = true; break; }; _art.y = (_artOriginY + 100); TweenLite.to(_art, 1, {alpha:1, onUpdate:drvSn, y:_artOriginY, onComplete:doWindowProcess}); return (_art); } public function onConnectError(_arg1:String):void{ trace(_arg1); } public function removeArt():void{ _art.parent.removeChild(_art); _art.playgamebutton.removeEventListener(MouseEvent.MOUSE_DOWN, playGame); } private function addScoringSystem():void{ var _local1:BitMapper = new BitMapper(); var _local2:Array = _local1.buildDataObject("scoring", 1, 14, new Main.numbas()); _art.level.addChild(_scoreSprite); _scoreSprite.x = 80; _scoreSprite.y = (_scoreSprite.y - 38); _levelScoring = new Scoring_counter("00", _local2, _scoreSprite); _levelScoring.addEventListener(Scoring_counter.SCORECOUNTFINISHED_EVENT, showFryScore); } private function playGame(_arg1:Event):void{ _art.mouseEnabled = false; Main.soundDictionary["maxpoints"].play(); TweenLite.to(_art, 1, {alpha:0, y:(_artOriginY - 100), onUpdate:drvSn, onComplete:diss}); } private function diss(_arg1:Event=null):void{ _tallyNumber = 0; _art.visible = false; _levelScoring.rst(); _pointsScoring.rst(); _timeScoring.rst(); _fryScoring.rst(); _finalScoring.rst(); dispatchEvent(new Event(GAMEPLAYSTART, true)); } private function addPointsScoring():void{ var _local1:BitMapper = new BitMapper(); var _local2:Array = _local1.buildDataObject("pointz", 1, 14, new Main.numbas()); _art.level.addChild(_pointsSprite); _pointsSprite.x = 160; _pointsSprite.y = (_pointsSprite.y + 6); _pointsScoring = new Scoring_counter("00000000", _local2, _pointsSprite); _pointsScoring.addEventListener(Scoring_counter.SCORECOUNTFINISHED_EVENT, showTimeScore); } private function showTimeScore(_arg1:Event):void{ _timeScoring.addPoints(_scoringObject.timeScore, "tally"); } private function setupScoresButton():void{ _art.playgamebutton.buttonMode = true; var _local1:Bitmap = BlenderButton.formBitmap(_art.scores); BlenderButton.addBlender(_local1); _art.scores.addEventListener(MouseEvent.MOUSE_DOWN, scores); _art.scores.addEventListener(MouseEvent.MOUSE_OVER, ovr); } private function addFryPoints():void{ var _local1:BitMapper = new BitMapper(); var _local2:Array = _local1.buildDataObject("scoring", 1, 14, new Main.numbas()); _art.level.addChild(_fryscoreSprite); _fryscoreSprite.x = 160; _fryscoreSprite.y = (_fryscoreSprite.y - 38); _fryScoring = new Scoring_counter("00000000", _local2, _fryscoreSprite); _fryScoring.addEventListener(Scoring_counter.SCORECOUNTFINISHED_EVENT, showMainPoints); } private function share(_arg1:Event):void{ Main.cursor.visible = false; Mouse.show(); _art.widget.visible = true; Preloader.remoteStage.quality = "high"; } private function addTimeScoring():void{ var _local1:BitMapper = new BitMapper(); var _local2:Array = _local1.buildDataObject("pointz", 1, 14, new Main.numbas()); _art.level.addChild(_timeSprite); _timeSprite.x = 160; _timeSprite.y = (_timeSprite.y + 49); _timeScoring = new Scoring_counter("00000000", _local2, _timeSprite); _timeScoring.addEventListener(Scoring_counter.SCORECOUNTFINISHED_EVENT, showFinalScore); } private function setupPlayButton():void{ _art.playgamebutton.buttonMode = true; var _local1:Bitmap = BlenderButton.formBitmap(_art.playgamebutton); BlenderButton.addBlender(_local1); _art.playgamebutton.addEventListener(MouseEvent.MOUSE_DOWN, playGame); _art.playgamebutton.addEventListener(MouseEvent.MOUSE_OVER, ovr); } private function showMainPoints(_arg1:Event):void{ trace(("incoming points score" + _scoringObject.pointScore)); _pointsScoring.addPoints(_scoringObject.pointScore, "tally"); } private function ovr(_arg1:Event):void{ trace("over"); Main.soundDictionary["coin"].play(); BlenderButton.animate((_arg1.currentTarget.getChildByName("masker") as MovieClip)); } public function inPoz():void{ } private function addFinalTotalScoring():void{ var _local1:BitMapper = new BitMapper(); var _local2:Array = _local1.buildDataObject("pointz", 1, 14, new Main.numbas()); _art.level.addChild(_finalscoreSprite); _finalscoreSprite.x = 160; _finalscoreSprite.y = (_finalscoreSprite.y + 91); _finalScoring = new Scoring_counter("00000000", _local2, _finalscoreSprite); _finalScoring.addEventListener(Scoring_counter.SCORECOUNTFINISHED_EVENT, showButtonsAfterScore); } private function leaderboardClose():void{ trace("closing leaderboard"); Preloader.remoteStage.quality = "low"; } private function setupMoreGames():void{ _art.more.buttonMode = true; var _local1:Bitmap = BlenderButton.formBitmap(_art.more); BlenderButton.addBlender(_local1); _art.more.addEventListener(MouseEvent.MOUSE_DOWN, moregames); _art.more.addEventListener(MouseEvent.MOUSE_OVER, ovr); } } }//package com.utilities
Section 179
//Lid (com.utilities.Lid) package com.utilities { import flash.events.*; import flash.display.*; import gs.*; public class Lid extends Sprite { private var _lidArt:MovieClip; private var _resumeButton:MovieClip; public static const RESUME_EVENT:String = "resume operations"; public function Lid(_arg1:MovieClip):void{ _lidArt = _arg1; _lidArt.visible = false; _resumeButton = _lidArt.but; _resumeButton.buttonMode = true; _resumeButton.addEventListener(MouseEvent.MOUSE_DOWN, fdOut); _resumeButton.addEventListener(MouseEvent.MOUSE_OVER, ovr); BlenderButton.addBlender(BlenderButton.formBitmap(_resumeButton)); } private function fdOut(_arg1:Event):void{ Main.soundDictionary["back"].play(); TweenLite.to(_lidArt, 0.5, {alpha:0, onComplete:remove}); } private function ovr(_arg1:Event):void{ BlenderButton.animate((_resumeButton.getChildByName("masker") as MovieClip)); } public function activate():void{ _lidArt.visible = true; } public function remove():void{ _lidArt.visible = false; _lidArt.alpha = 1; dispatchEvent(new Event(RESUME_EVENT, true)); } } }//package com.utilities
Section 180
//LinkButtons (com.utilities.LinkButtons) package com.utilities { import flash.net.*; public class LinkButtons { public static function getUrl(_arg1:String):void{ var _local2:URLRequest = new URLRequest(_arg1); navigateToURL(_local2, "_blank"); } public static function getZip(_arg1:String):void{ trace(_arg1); var _local2:URLRequest = new URLRequest(_arg1); navigateToURL(_local2); } public static function getUrlSelf(_arg1:String):void{ var _local2:URLRequest = new URLRequest(_arg1); navigateToURL(_local2, "_self"); } } }//package com.utilities
Section 181
//MochiAd (com.utilities.MochiAd) package com.utilities { import flash.events.*; import flash.display.*; import flash.utils.*; import flash.net.*; import flash.system.*; public class MochiAd { public static function getVersion():String{ return ("2.7"); } public static function showClickAwayAd(_arg1:Object):void{ var clip:Object; var mc:MovieClip; var chk:MovieClip; var options = _arg1; var DEFAULTS:Object = {ad_timeout:2000, regpt:"o", method:"showClickAwayAd", res:"300x250", no_bg:true, ad_started:function ():void{ }, ad_finished:function ():void{ }, ad_loaded:function (_arg1:Number, _arg2:Number):void{ }, ad_failed:function ():void{ trace("[MochiAd] Couldn't load an ad, make sure your game's local security sandbox is configured for Access Network Only and that you are not using ad blocking software"); }, ad_skipped:function ():void{ }}; options = MochiAd._parseOptions(options, DEFAULTS); clip = options.clip; var ad_timeout:Number = options.ad_timeout; delete options.ad_timeout; if (!MochiAd.load(options)){ options.ad_failed(); options.ad_finished(); return; }; options.ad_started(); mc = clip._mochiad; mc["onUnload"] = function ():void{ MochiAd._cleanup(mc); options.ad_finished(); }; var wh:Array = MochiAd._getRes(options, clip); var w:Number = wh[0]; var h:Number = wh[1]; mc.x = (w * 0.5); mc.y = (h * 0.5); chk = createEmptyMovieClip(mc, "_mochiad_wait", 3); chk.ad_timeout = ad_timeout; chk.started = getTimer(); chk.showing = false; mc.unloadAd = function ():void{ MochiAd.unload(clip); }; mc.adLoaded = options.ad_loaded; mc.adSkipped = options.ad_skipped; mc.rpc = function (_arg1:Number, _arg2:Object):void{ MochiAd.rpc(clip, _arg1, _arg2); }; var sendHostProgress:Boolean; mc.regContLC = function (_arg1:String):void{ mc._containerLCName = _arg1; }; chk["onEnterFrame"] = function ():void{ var _local4:Number; if (!this.parent){ delete this.onEnterFrame; return; }; var _local1:Object = this.parent._mochiad_ctr; var _local2:Number = (getTimer() - this.started); var _local3:Boolean; if (!chk.showing){ _local4 = this.parent._mochiad_ctr.contentLoaderInfo.bytesTotal; if (_local4 > 0){ chk.showing = true; _local3 = true; chk.started = getTimer(); } else { if (_local2 > chk.ad_timeout){ options.ad_failed(); _local3 = true; }; }; }; if (this.root == null){ _local3 = true; }; if (_local3){ delete this.onEnterFrame; }; }; doOnEnterFrame(chk); } public static function _isNetworkAvailable():Boolean{ return (!((Security.sandboxType == "localWithFile"))); } public static function _allowDomains(_arg1:String):String{ var _local2:String = _arg1.split("/")[2].split(":")[0]; Security.allowDomain("*"); Security.allowDomain(_local2); Security.allowInsecureDomain("*"); Security.allowInsecureDomain(_local2); return (_local2); } public static function unload(_arg1:Object):Boolean{ if (((_arg1.clip) && (_arg1.clip._mochiad))){ _arg1 = _arg1.clip; }; if (_arg1.origFrameRate != undefined){ _arg1.stage.frameRate = _arg1.origFrameRate; }; if (!_arg1._mochiad){ return (false); }; if (_arg1._mochiad._containerLCName != undefined){ _arg1._mochiad.lc.send(_arg1._mochiad._containerLCName, "notify", {id:"unload"}); }; if (_arg1._mochiad.onUnload){ _arg1._mochiad.onUnload(); }; delete _arg1._mochiad_loaded; delete _arg1._mochiad; return (true); } public static function showInterLevelAd(_arg1:Object):void{ var clip:Object; var mc:MovieClip; var chk:MovieClip; var options = _arg1; var DEFAULTS:Object = {ad_timeout:2000, fadeout_time:250, regpt:"o", method:"showTimedAd", ad_started:function ():void{ if ((this.clip is MovieClip)){ this.clip.stop(); } else { throw (new Error("MochiAd.showInterLevelAd requires a clip that is a MovieClip or is an instance of a class that extends MovieClip. If your clip is a Sprite, then you must provide custom ad_started and ad_finished handlers.")); }; }, ad_finished:function ():void{ if ((this.clip is MovieClip)){ this.clip.play(); } else { throw (new Error("MochiAd.showInterLevelAd requires a clip that is a MovieClip or is an instance of a class that extends MovieClip. If your clip is a Sprite, then you must provide custom ad_started and ad_finished handlers.")); }; }, ad_loaded:function (_arg1:Number, _arg2:Number):void{ }, ad_failed:function ():void{ trace("[MochiAd] Couldn't load an ad, make sure your game's local security sandbox is configured for Access Network Only and that you are not using ad blocking software"); }, ad_skipped:function ():void{ }}; options = MochiAd._parseOptions(options, DEFAULTS); clip = options.clip; var ad_msec:Number = 11000; var ad_timeout:Number = options.ad_timeout; delete options.ad_timeout; var fadeout_time:Number = options.fadeout_time; delete options.fadeout_time; if (!MochiAd.load(options)){ options.ad_failed(); options.ad_finished(); return; }; options.ad_started(); mc = clip._mochiad; mc["onUnload"] = function ():void{ MochiAd._cleanup(mc); options.ad_finished(); }; var wh:Array = MochiAd._getRes(options, clip); var w:Number = wh[0]; var h:Number = wh[1]; mc.x = (w * 0.5); mc.y = (h * 0.5); chk = createEmptyMovieClip(mc, "_mochiad_wait", 3); chk.ad_msec = ad_msec; chk.ad_timeout = ad_timeout; chk.started = getTimer(); chk.showing = false; chk.fadeout_time = fadeout_time; chk.fadeFunction = function ():void{ if (!this.parent){ delete this.onEnterFrame; delete this.fadeFunction; return; }; var _local1:Number = (100 * (1 - ((getTimer() - this.fadeout_start) / this.fadeout_time))); if (_local1 > 0){ this.parent.alpha = (_local1 * 0.01); } else { MochiAd.unload(clip); delete this["onEnterFrame"]; }; }; mc.unloadAd = function ():void{ MochiAd.unload(clip); }; mc.adLoaded = options.ad_loaded; mc.adSkipped = options.ad_skipped; mc.adjustProgress = function (_arg1:Number):void{ var _local2:Object = mc._mochiad_wait; _local2.server_control = true; _local2.showing = true; _local2.started = getTimer(); _local2.ad_msec = (_arg1 - 250); }; mc.rpc = function (_arg1:Number, _arg2:Object):void{ MochiAd.rpc(clip, _arg1, _arg2); }; chk["onEnterFrame"] = function ():void{ var _local4:Number; if (!this.parent){ delete this.onEnterFrame; delete this.fadeFunction; return; }; var _local1:Object = this.parent._mochiad_ctr; var _local2:Number = (getTimer() - this.started); var _local3:Boolean; if (!chk.showing){ _local4 = this.parent._mochiad_ctr.contentLoaderInfo.bytesTotal; if (_local4 > 0){ chk.showing = true; chk.started = getTimer(); MochiAd.adShowing(clip); } else { if (_local2 > chk.ad_timeout){ options.ad_failed(); _local3 = true; }; }; }; if (_local2 > chk.ad_msec){ _local3 = true; }; if (_local3){ if (this.server_control){ delete this.onEnterFrame; } else { this.fadeout_start = getTimer(); this.onEnterFrame = this.fadeFunction; }; }; }; doOnEnterFrame(chk); } public static function _parseOptions(_arg1:Object, _arg2:Object):Object{ var _local4:String; var _local5:Array; var _local6:Number; var _local7:Array; var _local3:Object = {}; for (_local4 in _arg2) { _local3[_local4] = _arg2[_local4]; }; if (_arg1){ for (_local4 in _arg1) { _local3[_local4] = _arg1[_local4]; }; }; if (_local3.clip == undefined){ throw (new Error("MochiAd is missing the 'clip' parameter. This should be a MovieClip, Sprite or an instance of a class that extends MovieClip or Sprite.")); }; _arg1 = _local3.clip.loaderInfo.parameters.mochiad_options; if (_arg1){ _local5 = _arg1.split("&"); _local6 = 0; while (_local6 < _local5.length) { _local7 = _local5[_local6].split("="); _local3[unescape(_local7[0])] = unescape(_local7[1]); _local6++; }; }; if (_local3.id == "test"){ trace("[MochiAd] WARNING: Using the MochiAds test identifier, make sure to use the code from your dashboard, not this example!"); }; return (_local3); } public static function _cleanup(_arg1:Object):void{ var k:String; var lc:LocalConnection; var f:Function; var mc = _arg1; if (("lc" in mc)){ lc = mc.lc; f = function ():void{ try { lc.client = null; lc.close(); } catch(e:Error) { }; }; setTimeout(f, 0); }; var idx:Number = DisplayObjectContainer(mc).numChildren; while (idx > 0) { idx = (idx - 1); DisplayObjectContainer(mc).removeChildAt(idx); }; for (k in mc) { delete mc[k]; }; } public static function load(_arg1:Object):MovieClip{ var clip:Object; var k:String; var server:String; var hostname:String; var lc:LocalConnection; var name:String; var loader:Loader; var g:Function; var req:URLRequest; var v:Object; var options = _arg1; var DEFAULTS:Object = {server:"http://x.mochiads.com/srv/1/", method:"load", depth:10333, id:"_UNKNOWN_"}; options = MochiAd._parseOptions(options, DEFAULTS); options.swfv = 9; options.mav = MochiAd.getVersion(); clip = options.clip; if (!MochiAd._isNetworkAvailable()){ return (null); }; try { if (clip._mochiad_loaded){ return (null); }; } catch(e:Error) { throw (new Error("MochiAd requires a clip that is an instance of a dynamic class. If your class extends Sprite or MovieClip, you must make it dynamic.")); }; var depth:Number = options.depth; delete options.depth; var mc:MovieClip = createEmptyMovieClip(clip, "_mochiad", depth); var wh:Array = MochiAd._getRes(options, clip); options.res = ((wh[0] + "x") + wh[1]); options.server = (options.server + options.id); delete options.id; clip._mochiad_loaded = true; if (clip.loaderInfo.loaderURL.indexOf("http") == 0){ options.as3_swf = clip.loaderInfo.loaderURL; }; var lv:URLVariables = new URLVariables(); for (k in options) { v = options[k]; if (!(v is Function)){ lv[k] = v; }; }; server = lv.server; delete lv.server; hostname = _allowDomains(server); lc = new LocalConnection(); lc.client = mc; name = ["", Math.floor(new Date().getTime()), Math.floor((Math.random() * 999999))].join("_"); lc.allowDomain("*", "localhost"); lc.allowInsecureDomain("*", "localhost"); lc.connect(name); mc.lc = lc; mc.lcName = name; lv.lc = name; lv.st = getTimer(); loader = new Loader(); g = function (_arg1:Object):void{ _arg1.target.removeEventListener(_arg1.type, arguments.callee); MochiAd.unload(clip); }; loader.contentLoaderInfo.addEventListener(Event.UNLOAD, g); req = new URLRequest(((server + ".swf?cacheBust=") + new Date().getTime())); req.contentType = "application/x-www-form-urlencoded"; req.method = URLRequestMethod.POST; req.data = lv; loader.load(req); mc.addChild(loader); mc._mochiad_ctr = loader; return (mc); } public static function runMethod(_arg1:Object, _arg2:String, _arg3:Array):Object{ var _local4:Array = _arg2.split("."); var _local5:Number = 0; while (_local5 < (_local4.length - 1)) { if ((((_arg1[_local4[_local5]] == undefined)) || ((_arg1[_local4[_local5]] == null)))){ return (undefined); }; _arg1 = _arg1[_local4[_local5]]; _local5++; }; if (typeof(_arg1[_local4[_local5]]) == "function"){ return (_arg1[_local4[_local5]].apply(_arg1, _arg3)); }; return (undefined); } public static function createEmptyMovieClip(_arg1:Object, _arg2:String, _arg3:Number):MovieClip{ var _local4:MovieClip = new MovieClip(); if (((false) && (_arg3))){ _arg1.addChildAt(_local4, _arg3); } else { _arg1.addChild(_local4); }; _arg1[_arg2] = _local4; _local4["_name"] = _arg2; return (_local4); } public static function _getRes(_arg1:Object, _arg2:Object):Array{ var _local6:Array; var _local3:Object = _arg2.getBounds(_arg2.root); var _local4:Number = 0; var _local5:Number = 0; if (typeof(_arg1.res) != "undefined"){ _local6 = _arg1.res.split("x"); _local4 = parseFloat(_local6[0]); _local5 = parseFloat(_local6[1]); } else { _local4 = (_local3.xMax - _local3.xMin); _local5 = (_local3.yMax - _local3.yMin); }; if ((((_local4 == 0)) || ((_local5 == 0)))){ _local4 = _arg2.stage.stageWidth; _local5 = _arg2.stage.stageHeight; }; return ([_local4, _local5]); } public static function adShowing(_arg1:Object):void{ _arg1.origFrameRate = _arg1.stage.frameRate; _arg1.stage.frameRate = 30; } public static function getValue(_arg1:Object, _arg2:String):Object{ var _local3:Array = _arg2.split("."); var _local4:Number = 0; while (_local4 < (_local3.length - 1)) { if ((((_arg1[_local3[_local4]] == undefined)) || ((_arg1[_local3[_local4]] == null)))){ return (undefined); }; _arg1 = _arg1[_local3[_local4]]; _local4++; }; return (_arg1[_local3[_local4]]); } public static function rpc(_arg1:Object, _arg2:Number, _arg3:Object):void{ var _local4:Object; var _local5:Object; switch (_arg3.id){ case "setValue": MochiAd.setValue(_arg1, _arg3.objectName, _arg3.value); break; case "getValue": _local4 = MochiAd.getValue(_arg1, _arg3.objectName); _arg1._mochiad.lc.send(_arg1._mochiad._containerLCName, "rpcResult", _arg2, _local4); break; case "runMethod": _local5 = MochiAd.runMethod(_arg1, _arg3.method, _arg3.args); _arg1._mochiad.lc.send(_arg1._mochiad._containerLCName, "rpcResult", _arg2, _local5); break; default: trace(("[mochiads rpc] unknown rpc id: " + _arg3.id)); }; } public static function setValue(_arg1:Object, _arg2:String, _arg3:Object):void{ var _local4:Array = _arg2.split("."); var _local5:Number = 0; while (_local5 < (_local4.length - 1)) { if ((((_arg1[_local4[_local5]] == undefined)) || ((_arg1[_local4[_local5]] == null)))){ return; }; _arg1 = _arg1[_local4[_local5]]; _local5++; }; _arg1[_local4[_local5]] = _arg3; } public static function showPreGameAd(_arg1:Object):void{ var clip:Object; var mc:MovieClip; var chk:MovieClip; var complete:Boolean; var unloaded:Boolean; var sendHostProgress:Boolean; var fn:Function; var r:MovieClip; var options = _arg1; var DEFAULTS:Object = {ad_timeout:3000, fadeout_time:250, regpt:"o", method:"showPreloaderAd", color:0xFF8A00, background:16777161, outline:13994812, no_progress_bar:false, ad_started:function ():void{ if ((this.clip is MovieClip)){ this.clip.stop(); } else { throw (new Error("MochiAd.showPreGameAd requires a clip that is a MovieClip or is an instance of a class that extends MovieClip. If your clip is a Sprite, then you must provide custom ad_started and ad_finished handlers.")); }; }, ad_finished:function ():void{ if ((this.clip is MovieClip)){ this.clip.play(); } else { throw (new Error("MochiAd.showPreGameAd requires a clip that is a MovieClip or is an instance of a class that extends MovieClip. If your clip is a Sprite, then you must provide custom ad_started and ad_finished handlers.")); }; }, ad_loaded:function (_arg1:Number, _arg2:Number):void{ }, ad_failed:function ():void{ trace("[MochiAd] Couldn't load an ad, make sure your game's local security sandbox is configured for Access Network Only and that you are not using ad blocking software"); }, ad_skipped:function ():void{ }, ad_progress:function (_arg1:Number):void{ }}; options = MochiAd._parseOptions(options, DEFAULTS); if ("c862232051e0a94e1c3609b3916ddb17".substr(0) == "dfeada81ac97cde83665f81c12da7def"){ options.ad_started(); fn = function ():void{ options.ad_finished(); }; setTimeout(fn, 100); return; }; clip = options.clip; var ad_msec:Number = 11000; var ad_timeout:Number = options.ad_timeout; delete options.ad_timeout; var fadeout_time:Number = options.fadeout_time; delete options.fadeout_time; if (!MochiAd.load(options)){ options.ad_failed(); options.ad_finished(); return; }; options.ad_started(); mc = clip._mochiad; mc["onUnload"] = function ():void{ MochiAd._cleanup(mc); var fn:Function = function ():void{ options.ad_finished(); }; setTimeout(fn, 100); }; var wh:Array = MochiAd._getRes(options, clip); var w:Number = wh[0]; var h:Number = wh[1]; mc.x = (w * 0.5); mc.y = (h * 0.5); chk = createEmptyMovieClip(mc, "_mochiad_wait", 3); chk.x = (w * -0.5); chk.y = (h * -0.5); var bar:MovieClip = createEmptyMovieClip(chk, "_mochiad_bar", 4); if (options.no_progress_bar){ bar.visible = false; delete options.no_progress_bar; } else { bar.x = 10; bar.y = (h - 20); }; var bar_color:Number = options.color; delete options.color; var bar_background:Number = options.background; delete options.background; var bar_outline:Number = options.outline; delete options.outline; var backing_mc:MovieClip = createEmptyMovieClip(bar, "_outline", 1); var backing:Object = backing_mc.graphics; backing.beginFill(bar_background); backing.moveTo(0, 0); backing.lineTo((w - 20), 0); backing.lineTo((w - 20), 10); backing.lineTo(0, 10); backing.lineTo(0, 0); backing.endFill(); var inside_mc:MovieClip = createEmptyMovieClip(bar, "_inside", 2); var inside:Object = inside_mc.graphics; inside.beginFill(bar_color); inside.moveTo(0, 0); inside.lineTo((w - 20), 0); inside.lineTo((w - 20), 10); inside.lineTo(0, 10); inside.lineTo(0, 0); inside.endFill(); inside_mc.scaleX = 0; var outline_mc:MovieClip = createEmptyMovieClip(bar, "_outline", 3); var outline:Object = outline_mc.graphics; outline.lineStyle(0, bar_outline, 100); outline.moveTo(0, 0); outline.lineTo((w - 20), 0); outline.lineTo((w - 20), 10); outline.lineTo(0, 10); outline.lineTo(0, 0); chk.ad_msec = ad_msec; chk.ad_timeout = ad_timeout; chk.started = getTimer(); chk.showing = false; chk.last_pcnt = 0; chk.fadeout_time = fadeout_time; chk.fadeFunction = function ():void{ var _local1:Number = (100 * (1 - ((getTimer() - this.fadeout_start) / this.fadeout_time))); if (_local1 > 0){ this.parent.alpha = (_local1 * 0.01); } else { MochiAd.unload(clip); delete this["onEnterFrame"]; }; }; complete = false; unloaded = false; var f:Function = function (_arg1:Event):void{ _arg1.target.removeEventListener(_arg1.type, arguments.callee); complete = true; if (unloaded){ MochiAd.unload(clip); }; }; clip.loaderInfo.addEventListener(Event.COMPLETE, f); if ((clip.root is MovieClip)){ r = (clip.root as MovieClip); if (r.framesLoaded >= r.totalFrames){ complete = true; }; }; mc.unloadAd = function ():void{ unloaded = true; if (complete){ MochiAd.unload(clip); }; }; mc.adLoaded = options.ad_loaded; mc.adSkipped = options.ad_skipped; mc.adjustProgress = function (_arg1:Number):void{ var _local2:Object = mc._mochiad_wait; _local2.server_control = true; _local2.showing = true; _local2.started = getTimer(); _local2.ad_msec = _arg1; }; mc.rpc = function (_arg1:Number, _arg2:Object):void{ MochiAd.rpc(clip, _arg1, _arg2); }; mc.rpcTestFn = function (_arg1:String):Object{ trace(("[MOCHIAD rpcTestFn] " + _arg1)); return (_arg1); }; mc.regContLC = function (_arg1:String):void{ mc._containerLCName = _arg1; }; sendHostProgress = false; mc.sendHostLoadProgress = function (_arg1:String):void{ sendHostProgress = true; }; chk["onEnterFrame"] = function ():void{ var _local11:Number; if (((!(this.parent)) || (!(this.parent.parent)))){ delete this["onEnterFrame"]; return; }; var _local1:Object = this.parent.parent.root; var _local2:Object = this.parent._mochiad_ctr; var _local3:Number = (getTimer() - this.started); var _local4:Boolean; var _local5:Number = _local1.loaderInfo.bytesTotal; var _local6:Number = _local1.loaderInfo.bytesLoaded; if (complete){ _local6 = Math.max(1, _local6); _local5 = _local6; }; var _local7:Number = ((100 * _local6) / _local5); var _local8:Number = ((100 * _local3) / chk.ad_msec); var _local9:Object = this._mochiad_bar._inside; var _local10:Number = Math.min(100, Math.min(((_local7) || (0)), _local8)); _local10 = Math.max(this.last_pcnt, _local10); this.last_pcnt = _local10; _local9.scaleX = (_local10 * 0.01); options.ad_progress(_local10); if (sendHostProgress){ clip._mochiad.lc.send(clip._mochiad._containerLCName, "notify", {id:"hostLoadPcnt", pcnt:_local7}); if (_local7 == 100){ sendHostProgress = false; }; }; if (!chk.showing){ _local11 = this.parent._mochiad_ctr.contentLoaderInfo.bytesTotal; if (_local11 > 0){ chk.showing = true; chk.started = getTimer(); MochiAd.adShowing(clip); } else { if ((((_local3 > chk.ad_timeout)) && ((_local7 == 100)))){ options.ad_failed(); _local4 = true; }; }; }; if (_local3 > chk.ad_msec){ _local4 = true; }; if (((complete) && (_local4))){ if (this.server_control){ delete this.onEnterFrame; } else { this.fadeout_start = getTimer(); this.onEnterFrame = chk.fadeFunction; }; }; }; doOnEnterFrame(chk); } public static function showPreloaderAd(_arg1:Object):void{ trace("[MochiAd] DEPRECATED: showPreloaderAd was renamed to showPreGameAd in 2.0"); MochiAd.showPreGameAd(_arg1); } public static function showTimedAd(_arg1:Object):void{ trace("[MochiAd] DEPRECATED: showTimedAd was renamed to showInterLevelAd in 2.0"); MochiAd.showInterLevelAd(_arg1); } public static function doOnEnterFrame(_arg1:MovieClip):void{ var mc = _arg1; var f:Function = function (_arg1:Object):void{ if (((("onEnterFrame" in mc)) && (mc.onEnterFrame))){ mc.onEnterFrame(); } else { _arg1.target.removeEventListener(_arg1.type, arguments.callee); }; }; mc.addEventListener(Event.ENTER_FRAME, f); } } }//package com.utilities
Section 182
//MochiBot (com.utilities.MochiBot) package com.utilities { import flash.display.*; import flash.net.*; import flash.system.*; public dynamic class MochiBot extends Sprite { public static function track(_arg1:Sprite, _arg2:String):MochiBot{ if (Security.sandboxType == "localWithFile"){ return (null); }; var _local3:MochiBot = new (MochiBot); _arg1.addChild(_local3); Security.allowDomain("*"); Security.allowInsecureDomain("*"); var _local4 = "http://core.mochibot.com/my/core.swf"; var _local5:URLVariables = new URLVariables(); _local5["sb"] = Security.sandboxType; _local5["v"] = Capabilities.version; _local5["swfid"] = _arg2; _local5["mv"] = "8"; _local5["fv"] = "9"; var _local6:String = _local3.root.loaderInfo.loaderURL; if (_local6.indexOf("http") == 0){ _local5["url"] = _local6; } else { _local5["url"] = "local"; }; var _local7:URLRequest = new URLRequest(_local4); _local7.contentType = "application/x-www-form-urlencoded"; _local7.method = URLRequestMethod.POST; _local7.data = _local5; var _local8:Loader = new Loader(); _local3.addChild(_local8); _local8.load(_local7); return (_local3); } } }//package com.utilities
Section 183
//MochiScores (com.utilities.MochiScores) package com.utilities { import flash.display.*; import flash.text.*; public class MochiScores { private static var boardID:String; public static var onErrorHandler:Object; public static var onCloseHandler:Object; public static function showLeaderboard(_arg1:Object=null):void{ var options = _arg1; if (options != null){ if (options.clip != null){ if ((options.clip is Sprite)){ MochiServices.setContainer(options.clip); }; delete options.clip; } else { MochiServices.setContainer(); }; MochiServices.stayOnTop(); if (options.name != null){ if ((options.name is TextField)){ if (options.name.text.length > 0){ options.name = options.name.text; }; }; }; if (options.score != null){ if ((options.score is TextField)){ if (options.score.text.length > 0){ options.score = options.score.text; }; }; }; if (options.onDisplay != null){ options.onDisplay(); } else { if (MochiServices.clip != null){ if ((MochiServices.clip is MovieClip)){ MochiServices.clip.stop(); } else { trace("Warning: Container is not a MovieClip, cannot call default onDisplay."); }; }; }; } else { options = {}; if ((MochiServices.clip is MovieClip)){ MochiServices.clip.stop(); } else { trace("Warning: Container is not a MovieClip, cannot call default onDisplay."); }; }; if (options.onClose != null){ onCloseHandler = options.onClose; } else { onCloseHandler = function ():void{ if ((MochiServices.clip is MovieClip)){ MochiServices.clip.play(); } else { trace("Warning: Container is not a MovieClip, cannot call default onClose."); }; }; }; if (options.onError != null){ onErrorHandler = options.onError; } else { onErrorHandler = null; }; if (options.boardID == null){ if (_slot1.boardID != null){ options.boardID = _slot1.boardID; }; }; MochiServices.send("scores_showLeaderboard", {options:options}, null, onClose); } public static function closeLeaderboard():void{ MochiServices.send("scores_closeLeaderboard"); } public static function getPlayerInfo(_arg1:Object, _arg2:Object=null):void{ MochiServices.send("scores_getPlayerInfo", null, _arg1, _arg2); } public static function requestList(_arg1:Object, _arg2:Object=null):void{ MochiServices.send("scores_requestList", null, _arg1, _arg2); } public static function scoresArrayToObjects(_arg1:Object):Object{ var _local3:Number; var _local4:Number; var _local5:Object; var _local6:Object; var _local7:String; var _local8:String; var _local2:Object = {}; for (_local7 in _arg1) { if (typeof(_arg1[_local7]) == "object"){ if (((!((_arg1[_local7].cols == null))) && (!((_arg1[_local7].rows == null))))){ _local2[_local7] = []; _local5 = _arg1[_local7]; _local4 = 0; while (_local4 < _local5.rows.length) { _local6 = {}; _local3 = 0; while (_local3 < _local5.cols.length) { _local6[_local5.cols[_local3]] = _local5.rows[_local4][_local3]; _local3++; }; _local2[_local7].push(_local6); _local4++; }; } else { _local2[_local7] = {}; for (_local8 in _arg1[_local7]) { _local2[_local7][_local8] = _arg1[_local7][_local8]; }; }; } else { _local2[_local7] = _arg1[_local7]; }; }; return (_local2); } public static function submit(_arg1:Number, _arg2:String, _arg3:Object=null, _arg4:Object=null):void{ MochiServices.send("scores_submit", {score:_arg1, name:_arg2}, _arg3, _arg4); } public static function onClose(_arg1:Object=null):void{ if (_arg1 != null){ if (_arg1.error != null){ if (_arg1.error == true){ if (onErrorHandler != null){ if (_arg1.errorCode == null){ _arg1.errorCode = "IOError"; }; onErrorHandler(_arg1.errorCode); MochiServices.doClose(); return; }; }; }; }; onCloseHandler(); MochiServices.doClose(); } public static function setBoardID(_arg1:String):void{ _slot1.boardID = _arg1; MochiServices.send("scores_setBoardID", {boardID:_arg1}); } } }//package com.utilities
Section 184
//MochiServices (com.utilities.MochiServices) package com.utilities { import flash.events.*; import flash.display.*; import flash.utils.*; import flash.net.*; import flash.system.*; public class MochiServices { private static var _container:Object; private static var _connected:Boolean = false; private static var _swfVersion:String; private static var _sendChannel:LocalConnection; private static var _rcvChannelName:String; private static var _gatewayURL:String = "http://www.mochiads.com/static/lib/services/services.swf"; private static var _clip:MovieClip; private static var _loader:Loader; private static var _id:String; private static var _listenChannel:LocalConnection; private static var _timer:Timer; private static var _sendChannelName:String; private static var _startTime:Number; private static var _connecting:Boolean = false; public static var onError:Object; private static var _listenChannelName:String = "__mochiservices"; private static var _rcvChannel:LocalConnection; public static function isNetworkAvailable():Boolean{ return (!((Security.sandboxType == "localWithFile"))); } public static function send(_arg1:String, _arg2:Object=null, _arg3:Object=null, _arg4:Object=null):void{ if (_connected){ _sendChannel.send(_sendChannelName, "onReceive", {methodName:_arg1, args:_arg2, callbackID:_clip._nextcallbackID}); } else { if ((((_clip == null)) || (!(_connecting)))){ onError("NotConnected"); handleError(_arg2, _arg3, _arg4); flush(true); return; }; _clip._queue.push({methodName:_arg1, args:_arg2, callbackID:_clip._nextcallbackID}); }; if (_clip != null){ if (((!((_clip._callbacks == null))) && (!((_clip._nextcallbackID == null))))){ _clip._callbacks[_clip._nextcallbackID] = {callbackObject:_arg3, callbackMethod:_arg4}; _clip._nextcallbackID++; }; }; } public static function get connected():Boolean{ return (_connected); } private static function flush(_arg1:Boolean):void{ var _local2:Object; var _local3:Object; if (_clip != null){ if (_clip._queue != null){ while (_clip._queue.length > 0) { _local2 = _clip._queue.shift(); _local3 = null; if (_local2 != null){ if (_local2.callbackID != null){ _local3 = _clip._callbacks[_local2.callbackID]; }; delete _clip._callbacks[_local2.callbackID]; if (((_arg1) && (!((_local3 == null))))){ handleError(_local2.args, _local3.callbackObject, _local3.callbackMethod); }; }; }; }; }; } private static function clickMovie(_arg1:String, _arg2:Function):MovieClip{ var _local4:int; var _local14:Loader; var _local3:Array = [150, 21, 0, 7, 1, 0, 0, 0, 0, 98, 116, 110, 0, 7, 2, 0, 0, 0, 0, 116, 104, 105, 115, 0, 28, 150, 22, 0, 0, 99, 114, 101, 97, 116, 101, 69, 109, 112, 116, 121, 77, 111, 118, 105, 101, 67, 108, 105, 112, 0, 82, 135, 1, 0, 0, 23, 150, 13, 0, 4, 0, 0, 111, 110, 82, 101, 108, 101, 97, 115, 101, 0, 142, 8, 0, 0, 0, 0, 2, 42, 0, 114, 0, 150, 17, 0, 0, 32, 0, 7, 1, 0, 0, 0, 8, 0, 0, 115, 112, 108, 105, 116, 0, 82, 135, 1, 0, 1, 23, 150, 7, 0, 4, 1, 7, 0, 0, 0, 0, 78, 150, 8, 0, 0, 95, 98, 108, 97, 110, 107, 0, 154, 1, 0, 0, 150, 7, 0, 0, 99, 108, 105, 99, 107, 0, 150, 7, 0, 4, 1, 7, 1, 0, 0, 0, 78, 150, 27, 0, 7, 2, 0, 0, 0, 7, 0, 0, 0, 0, 0, 76, 111, 99, 97, 108, 67, 111, 110, 110, 101, 99, 116, 105, 111, 110, 0, 64, 150, 6, 0, 0, 115, 101, 110, 100, 0, 82, 79, 150, 15, 0, 4, 0, 0, 95, 97, 108, 112, 104, 97, 0, 7, 0, 0, 0, 0, 79, 150, 23, 0, 7, 0xFF, 0, 0xFF, 0, 7, 1, 0, 0, 0, 4, 0, 0, 98, 101, 103, 105, 110, 70, 105, 108, 108, 0, 82, 23, 150, 25, 0, 7, 0, 0, 0, 0, 7, 0, 0, 0, 0, 7, 2, 0, 0, 0, 4, 0, 0, 109, 111, 118, 101, 84, 111, 0, 82, 23, 150, 25, 0, 7, 100, 0, 0, 0, 7, 0, 0, 0, 0, 7, 2, 0, 0, 0, 4, 0, 0, 108, 105, 110, 101, 84, 111, 0, 82, 23, 150, 25, 0, 7, 100, 0, 0, 0, 7, 100, 0, 0, 0, 7, 2, 0, 0, 0, 4, 0, 0, 108, 105, 110, 101, 84, 111, 0, 82, 23, 150, 25, 0, 7, 0, 0, 0, 0, 7, 100, 0, 0, 0, 7, 2, 0, 0, 0, 4, 0, 0, 108, 105, 110, 101, 84, 111, 0, 82, 23, 150, 25, 0, 7, 0, 0, 0, 0, 7, 0, 0, 0, 0, 7, 2, 0, 0, 0, 4, 0, 0, 108, 105, 110, 101, 84, 111, 0, 82, 23, 150, 16, 0, 7, 0, 0, 0, 0, 4, 0, 0, 101, 110, 100, 70, 105, 108, 108, 0, 82, 23]; var _local5:Array = [104, 0, 31, 64, 0, 7, 208, 0, 0, 12, 1, 0, 67, 2, 0xFF, 0xFF, 0xFF, 63, 3]; var _local6:Array = [0, 64, 0, 0, 0]; var _local7:MovieClip = new MovieClip(); var _local8:LocalConnection = new LocalConnection(); var _local9:String = ((("_click_" + Math.floor((Math.random() * 999999))) + "_") + Math.floor(new Date().getTime())); _local8 = new LocalConnection(); _local7.lc = _local8; _local7.click = _arg2; _local8.client = _local7; _local8.connect(_local9); var _local10:ByteArray = new ByteArray(); var _local11:ByteArray = new ByteArray(); _local11.endian = Endian.LITTLE_ENDIAN; _local11.writeShort(1); _local11.writeUTFBytes(((_arg1 + " ") + _local9)); _local11.writeByte(0); var _local12:uint = ((_local3.length + _local11.length) + 4); var _local13:uint = (_local12 + 35); _local10.endian = Endian.LITTLE_ENDIAN; _local10.writeUTFBytes("FWS"); _local10.writeByte(8); _local10.writeUnsignedInt(_local13); for each (_local4 in _local5) { _local10.writeByte(_local4); }; _local10.writeUnsignedInt(_local12); _local10.writeByte(136); _local10.writeShort(_local11.length); _local10.writeBytes(_local11); for each (_local4 in _local3) { _local10.writeByte(_local4); }; for each (_local4 in _local6) { _local10.writeByte(_local4); }; _local14 = new Loader(); _local14.loadBytes(_local10); _local7.addChild(_local14); return (_local7); } private static function init(_arg1:String, _arg2:Object):void{ _id = _arg1; if (_arg2 != null){ _container = _arg2; loadCommunicator(_arg1, _container); }; } public static function get childClip():Object{ return (_clip); } public static function get id():String{ return (_id); } public static function stayOnTop():void{ _container.addEventListener(Event.ENTER_FRAME, MochiServices.bringToTop, false, 0, true); if (_clip != null){ _clip.visible = true; }; } public static function addLinkEvent(_arg1:String, _arg2:String, _arg3:DisplayObjectContainer, _arg4:Function=null):void{ var netup:Boolean; var s:String; var x:String; var req:URLRequest; var loader:Loader; var err:Function; var complete:Function; var setURL:Function; var url = _arg1; var burl = _arg2; var btn = _arg3; var onClick = _arg4; var vars:Object = new Object(); vars["mav"] = getVersion(); vars["swfv"] = "9"; vars["swfurl"] = btn.loaderInfo.loaderURL; vars["fv"] = Capabilities.version; vars["os"] = Capabilities.os; vars["lang"] = Capabilities.language; vars["scres"] = ((Capabilities.screenResolutionX + "x") + Capabilities.screenResolutionY); s = "?"; var i:Number = 0; for (x in vars) { if (i != 0){ s = (s + "&"); }; i = (i + 1); s = (((s + x) + "=") + escape(vars[x])); }; req = new URLRequest("http://x.mochiads.com/linkping.swf"); loader = new Loader(); err = function (_arg1:Object):void{ netup = false; _arg1.target.removeEventListener(_arg1.type, arguments.callee); }; complete = function (_arg1:Object):void{ netup = true; _arg1.target.removeEventListener(_arg1.type, arguments.callee); }; loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, err); loader.contentLoaderInfo.addEventListener(Event.COMPLETE, complete); loader.load(req); setURL = function ():void{ var _local1:String; if (netup){ _local1 = (url + s); } else { _local1 = burl; }; var _local2:DisplayObject = clickMovie(_local1, onClick); btn.addChild(_local2); _local2.scaleX = (0.01 * btn.width); _local2.scaleY = (0.01 * btn.height); }; setTimeout(setURL, 1500); } public static function getVersion():String{ return ("1.35"); } public static function disconnect():void{ if (((_connected) || (_connecting))){ if (_clip != null){ if (_clip.parent != null){ if ((_clip.parent is Sprite)){ Sprite(_clip.parent).removeChild(_clip); _clip = null; }; }; }; _connecting = (_connected = false); flush(true); try { _listenChannel.close(); _rcvChannel.close(); } catch(error:Error) { }; }; if (_timer != null){ try { _timer.stop(); } catch(error:Error) { }; }; } public static function allowDomains(_arg1:String):String{ var _local2:String; Security.allowDomain("*"); Security.allowInsecureDomain("*"); if (_arg1.indexOf("http://") != -1){ _local2 = _arg1.split("/")[2].split(":")[0]; Security.allowDomain(_local2); Security.allowInsecureDomain(_local2); }; return (_local2); } public static function doClose():void{ _container.removeEventListener(Event.ENTER_FRAME, MochiServices.bringToTop); if (_clip.parent != null){ Sprite(_clip.parent).removeChild(_clip); }; } public static function setContainer(_arg1:Object=null, _arg2:Boolean=true):void{ if (_arg1 != null){ if ((_arg1 is Sprite)){ _container = _arg1; }; }; if (_arg2){ if ((_container is Sprite)){ Sprite(_container).addChild(_clip); }; }; } private static function onStatus(_arg1:StatusEvent):void{ switch (_arg1.level){ case "error": _connected = false; _listenChannel.connect(_listenChannelName); break; }; } private static function initComChannels():void{ if (!_connected){ _sendChannel.addEventListener(StatusEvent.STATUS, MochiServices.onStatus); _sendChannel.send(_sendChannelName, "onReceive", {methodName:"handshakeDone"}); _sendChannel.send(_sendChannelName, "onReceive", {methodName:"registerGame", id:_id, clip:_container, version:getVersion(), parentURL:_container.loaderInfo.loaderURL}); _rcvChannel.addEventListener(StatusEvent.STATUS, MochiServices.onStatus); _clip.onReceive = function (_arg1:Object):void{ var methodName:String; var pkg = _arg1; var cb:String = pkg.callbackID; var cblst:Object = this.client._callbacks[cb]; if (!cblst){ return; }; var method:* = cblst.callbackMethod; methodName = ""; var obj:Object = cblst.callbackObject; if (((obj) && ((typeof(method) == "string")))){ methodName = method; if (obj[method] != null){ method = obj[method]; } else { trace((("Error: Method " + method) + " does not exist.")); }; }; if (method != undefined){ try { method.apply(obj, pkg.args); } catch(error:Error) { trace(((("Error invoking callback method '" + methodName) + "': ") + error.toString())); }; } else { if (obj != null){ try { obj(pkg.args); } catch(error:Error) { trace(("Error invoking method on object: " + error.toString())); }; }; }; delete this.client._callbacks[cb]; }; _clip.onError = function ():void{ MochiServices.onError("IOError"); }; _rcvChannel.connect(_rcvChannelName); trace("connected!"); _connecting = false; _connected = true; _listenChannel.close(); while (_clip._queue.length > 0) { _sendChannel.send(_sendChannelName, "onReceive", _clip._queue.shift()); }; }; } private static function listen():void{ _listenChannel = new LocalConnection(); _listenChannel.client = _clip; _clip.handshake = function (_arg1:Object):void{ MochiServices.comChannelName = _arg1.newChannel; }; _listenChannel.allowDomain("*", "localhost"); _listenChannel.allowInsecureDomain("*", "localhost"); _listenChannel.connect(_listenChannelName); trace("Waiting for MochiAds services to connect..."); } private static function handleError(_arg1:Object, _arg2:Object, _arg3:Object):void{ var args = _arg1; var callbackObject = _arg2; var callbackMethod = _arg3; if (args != null){ if (args.onError != null){ args.onError.apply(null, ["NotConnected"]); }; if (((!((args.options == null))) && (!((args.options.onError == null))))){ args.options.onError.apply(null, ["NotConnected"]); }; }; if (callbackMethod != null){ args = {}; args.error = true; args.errorCode = "NotConnected"; if (((!((callbackObject == null))) && ((callbackMethod is String)))){ try { var _local5 = callbackObject; _local5[callbackMethod](args); } catch(error:Error) { }; } else { if (callbackMethod != null){ try { callbackMethod.apply(args); } catch(error:Error) { }; }; }; }; } public static function get clip():Object{ return (_container); } public static function set comChannelName(_arg1:String):void{ if (_arg1 != null){ if (_arg1.length > 3){ _sendChannelName = (_arg1 + "_fromgame"); _rcvChannelName = _arg1; initComChannels(); }; }; } private static function loadCommunicator(_arg1:String, _arg2:Object):MovieClip{ var id = _arg1; var clip = _arg2; var clipname:String = ("_mochiservices_com_" + id); if (_clip != null){ return (_clip); }; if (!MochiServices.isNetworkAvailable()){ return (null); }; MochiServices.allowDomains(_gatewayURL); _clip = createEmptyMovieClip(clip, clipname, 10336, false); _loader = new Loader(); _timer = new Timer(1000, 0); _startTime = getTimer(); _timer.addEventListener(TimerEvent.TIMER, connectWait); _timer.start(); var f:Function = function (_arg1:Object):void{ _clip._mochiad_ctr_failed = true; trace("MochiServices could not load."); MochiServices.disconnect(); MochiServices.onError("IOError"); }; _loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, f); var req:URLRequest = new URLRequest(_gatewayURL); _loader.load(req); _clip.addChild(_loader); _clip._mochiservices_com = _loader; _sendChannel = new LocalConnection(); _clip._queue = []; _rcvChannel = new LocalConnection(); _rcvChannel.allowDomain("*", "localhost"); _rcvChannel.allowInsecureDomain("*", "localhost"); _rcvChannel.client = _clip; _clip._nextcallbackID = 0; _clip._callbacks = {}; listen(); return (_clip); } public static function bringToTop(_arg1:Event):void{ var e = _arg1; if (MochiServices.clip != null){ if (MochiServices.childClip != null){ try { if (MochiServices.clip.numChildren > 1){ MochiServices.clip.setChildIndex(MochiServices.childClip, (MochiServices.clip.numChildren - 1)); }; } catch(errorObject:Error) { trace("Warning: Depth sort error."); _container.removeEventListener(Event.ENTER_FRAME, MochiServices.bringToTop); }; }; }; } public static function connect(_arg1:String, _arg2:Object, _arg3:Object=null):void{ var id = _arg1; var clip = _arg2; var onError = _arg3; if ((clip is DisplayObject)){ if (((!(_connected)) && ((_clip == null)))){ trace("MochiServices Connecting..."); _connecting = true; init(id, clip); }; } else { trace("Error, MochiServices requires a Sprite, Movieclip or instance of the stage."); }; if (onError != null){ MochiServices.onError = onError; } else { if (MochiServices.onError == null){ MochiServices.onError = function (_arg1:String):void{ trace(_arg1); }; }; }; } public static function createEmptyMovieClip(_arg1:Object, _arg2:String, _arg3:Number, _arg4:Boolean=true):MovieClip{ var parent = _arg1; var name = _arg2; var depth = _arg3; var doAdd = _arg4; var mc:MovieClip = new MovieClip(); if (doAdd){ if (((false) && (depth))){ parent.addChildAt(mc, depth); } else { parent.addChild(mc); }; }; try { parent[name] = mc; } catch(e:Error) { throw (new Error("MochiServices requires a clip that is an instance of a dynamic class. If your class extends Sprite or MovieClip, you must make it dynamic.")); }; mc["_name"] = name; return (mc); } public static function connectWait(_arg1:TimerEvent):void{ if ((getTimer() - _startTime) > 10000){ if (!_connected){ _clip._mochiad_ctr_failed = true; trace("MochiServices could not load."); MochiServices.disconnect(); MochiServices.onError("IOError"); }; _timer.stop(); }; } } }//package com.utilities
Section 185
//Scoring_counter (com.utilities.Scoring_counter) package com.utilities { import flash.events.*; import flash.display.*; import flash.utils.*; import flash.media.*; public class Scoring_counter extends Sprite { private var _sndDel:Timer; private var _mode:String; private var _sndUsed:String; private var _numzArray:Array; private var _goodsoundTimer:Timer; private var storedLength:Number;// = 0 private var _maxPointsSoundC:SoundChannel; private var _maxPointsSoundD:SoundChannel; private var _beepSoundChannel:SoundChannel; private var _myTm:Timer; public var Bitz:Bitmap; public var capsule:Sprite; private var _maxPointsSoundE:SoundChannel; private var _badsoundTimer:Timer; private var _targetScore:Number;// = 0 private var _intervalHit2:Number;// = 2000 private var _intervalHit3:Number;// = 3000 private var _intervalHit:Number;// = 1000 private var _sndName:String; private var _currentCnt:Number;// = 0 private var _externalArt:Array; private var maxFrame:Number;// = 0 private var _accel:Number;// = 0 private var seqAr:Array; private var _sndName2:String; public static const SCORECOUNTFINISHED_EVENT:String = "score count finished"; public function Scoring_counter(_arg1:String, _arg2:Array, _arg3:Sprite):void{ var _local5:Bitmap; Bitz = new Bitmap(); capsule = new Sprite(); seqAr = new Array(); _numzArray = new Array(); _goodsoundTimer = new Timer(100); _badsoundTimer = new Timer(100); _beepSoundChannel = new SoundChannel(); _maxPointsSoundC = new SoundChannel(); _maxPointsSoundD = new SoundChannel(); _maxPointsSoundE = new SoundChannel(); super(); _goodsoundTimer.addEventListener(TimerEvent.TIMER, snd); _badsoundTimer.addEventListener(TimerEvent.TIMER, sndBad); _externalArt = _arg2; prepareFrames(_arg2); _arg3.addChild(capsule); var _local4:Number = 0; while (_local4 < _arg1.length) { _local5 = new Bitmap(_externalArt[10]); new Bitmap(_externalArt[10]).x = (_local5.x + (_local4 * (_local5.width / 2))); _numzArray.push(_local5); capsule.addChild(_local5); capsule.x = 0; capsule.y = 0; storedLength = _local4; _local4++; }; capsule.addChild(_local5); } public function prepareFrames(_arg1:Object):void{ var _local2:String; for (_local2 in _arg1) { maxFrame++; seqAr.push(_arg1[("bit" + maxFrame)]); }; Bitz.smoothing = false; } public function removePointz(_arg1:Number):void{ _badsoundTimer.start(); var _local2:Timer = new Timer(20, _arg1); _local2.addEventListener(TimerEvent.TIMER, counter); _local2.start(); if (_targetScore >= 0){ _targetScore = (_targetScore - _arg1); } else { _local2.stop(); }; } public function get currentScore():Number{ return (_targetScore); } public function removePoints(_arg1:Number):void{ removePointz(_arg1); } private function snd(_arg1:Event):void{ if (_currentCnt != _targetScore){ _beepSoundChannel.stop(); _beepSoundChannel = Main.soundDictionary["blip"].play(); }; } public function addPointsAdj(_arg1:Number, _arg2:Number):void{ _goodsoundTimer.start(); if (_targetScore >= 0){ _targetScore = (_targetScore + _arg1); }; } public function rst():void{ var _local1:Number = 0; while (_local1 < capsule.numChildren) { Bitmap(capsule.getChildAt(_local1)).bitmapData = _externalArt[10]; _local1++; }; _targetScore = 0; _currentCnt = 0; _intervalHit = 1000; _intervalHit2 = 2000; _intervalHit3 = 3000; _goodsoundTimer.stop(); _badsoundTimer.stop(); } private function sndBad(_arg1:Event):void{ if (_currentCnt != _targetScore){ _beepSoundChannel.stop(); _beepSoundChannel = Main.soundDictionary["badblip"].play(); }; } private function reset(_arg1:Event):void{ trace("*******counter reset**********"); _myTm.stop(); var _local2:Number = 0; while (_local2 < capsule.numChildren) { Bitmap(capsule.getChildAt(_local2)).bitmapData = _externalArt[10]; _local2++; }; _targetScore = 0; _currentCnt = 0; _myTm.start(); } public function addPoints(_arg1:Number, _arg2:String="gameplay"):void{ _goodsoundTimer.start(); _mode = _arg2; if (_arg1 > 10){ }; var _local3:Timer = new Timer(20, _arg1); _local3.addEventListener(TimerEvent.TIMER, counter); _local3.start(); if (_arg1 > 0){ if (_currentCnt >= 0){ _targetScore = (_targetScore + _arg1); }; }; if (_arg1 < 0){ if (_currentCnt >= 0){ _targetScore = (_targetScore - _arg1); }; }; } public function kill():void{ if (_myTm){ _myTm.stop(); }; capsule.parent.removeChild(capsule); } public function counter(_arg1:Event):void{ if (_intervalHit < _currentCnt){ _maxPointsSoundD.stop(); _maxPointsSoundC.stop(); _maxPointsSoundE.stop(); if (_mode == "gameplay"){ _maxPointsSoundC = Main.soundDictionary["maxpoints"].play(); }; _intervalHit = (_intervalHit + 1000); }; if (_intervalHit2 < _currentCnt){ _maxPointsSoundD.stop(); _maxPointsSoundC.stop(); _maxPointsSoundE.stop(); if (_mode == "gameplay"){ _maxPointsSoundD = Main.soundDictionary["midpoints"].play(); }; _intervalHit2 = (_intervalHit2 + 2000); }; if (_intervalHit3 < _currentCnt){ _maxPointsSoundD.stop(); _maxPointsSoundC.stop(); _maxPointsSoundE.stop(); if (_mode == "gameplay"){ _maxPointsSoundD = Main.soundDictionary["bigpoints"].play(); }; _intervalHit3 = (_intervalHit3 + 3000); }; if (_currentCnt > _targetScore){ _currentCnt = (_currentCnt - 1); }; if (_currentCnt < _targetScore){ if ((_currentCnt + 5000) < _targetScore){ _currentCnt = (_currentCnt + 2000); }; if ((_currentCnt + 1500) < _targetScore){ _currentCnt = (_currentCnt + 1000); }; if ((_currentCnt + 100) < _targetScore){ _currentCnt = (_currentCnt + 50); } else { _currentCnt = (_currentCnt + 1); }; }; if (_currentCnt == _targetScore){ _goodsoundTimer.stop(); _badsoundTimer.stop(); _arg1.target.removeEventListener(TimerEvent.TIMER, counter); dispatchEvent(new Event(SCORECOUNTFINISHED_EVENT, true)); _arg1.target.stop(); }; var _local2:Number = String(_currentCnt).length; var _local3:Number = 0; while (_local3 < _numzArray.length) { _numzArray[_local3].bitmapData = _externalArt[10]; _local3++; }; var _local4:Number = 0; while (_local4 < _local2) { if (_targetScore){ _numzArray[_local4].bitmapData = _externalArt[String(_currentCnt).substr(_local4, 1)]; } else { _numzArray[(_local4 + 1)].bitmapData = _externalArt[String(_currentCnt).substr(_local4, 1)]; }; _local4++; }; if (_currentCnt < 1){ _arg1.target.stop(); rst(); }; } } }//package com.utilities
Section 186
//Scoring_Floater (com.utilities.Scoring_Floater) package com.utilities { import flash.events.*; import flash.display.*; import flash.utils.*; public class Scoring_Floater { private var _myTm:Timer; private var _externalArt:Array; private var maxFrame:Number;// = 0 private var _accel:Number;// = 0 public var Bitz:Bitmap; private var seqAr:Array; public var capsule:Sprite; private var storedLength:Number;// = 0 public function Scoring_Floater(_arg1:String, _arg2:Array, _arg3:Sprite):void{ var _local5:Bitmap; var _local6:Number; Bitz = new Bitmap(); capsule = new Sprite(); seqAr = new Array(); super(); _externalArt = _arg2; prepareFrames(_arg2); _arg3.addChild(capsule); if (_arg1.substr(0, 1) == "-"){ _local5 = new Bitmap(_externalArt[10]); capsule.addChild(_local5); _local6 = 1; } else { _local6 = 0; }; var _local4:Number = _local6; while (_local4 < _arg1.length) { _local5 = new Bitmap(_externalArt[Number(_arg1.substr(_local4, 1))]); new Bitmap(_externalArt[Number(_arg1.substr(_local4, 1))]).x = (_local5.x + (_local4 * 8)); capsule.addChild(_local5); capsule.x = (capsule.x - (_local5.width / 3)); storedLength = _local4; _local4++; }; _local5 = new Bitmap(seqAr[13]); new Bitmap(seqAr[13]).x = (_local5.x + (_arg1.length * 20)); capsule.addChild(_local5); capsule.mouseEnabled = false; capsule.mouseChildren = false; _myTm = new Timer(20); _myTm.addEventListener(TimerEvent.TIMER, float); _myTm.start(); } private function float(_arg1:Event):void{ _accel = (_accel + 0.2); capsule.y = (capsule.y - _accel); capsule.x = (5 * Math.sin(((_accel * 6) / 5))); if (capsule.alpha > 0){ capsule.alpha = (capsule.alpha - (_accel / 200)); }; if (capsule.y < -400){ kill(); }; } public function prepareFrames(_arg1:Object):void{ var _local2:String; for (_local2 in _arg1) { maxFrame++; seqAr.push(_arg1[("bit" + maxFrame)]); }; Bitz.smoothing = false; } public function kill():void{ if (_myTm){ _myTm.stop(); }; if (capsule.parent){ capsule.parent.removeChild(capsule); }; } } }//package com.utilities
Section 187
//ScrollinBackground (com.utilities.ScrollinBackground) package com.utilities { import flash.events.*; import flash.display.*; import flash.geom.*; public class ScrollinBackground { private var _scrollArea:Sprite; private var _tile1:BitmapData; private var _dir:String; private var _scrollInc:Number;// = 0 private var _art:MovieClip; private var _pause:Boolean;// = false private var _printArea:BitmapData; public function drv(_arg1:Event):void{ if (!_pause){ switch (_dir){ case "left": if (_scrollInc < (_tile1.width / 2)){ _scrollInc = (_scrollInc + 1); } else { _scrollInc = 0; }; _printArea.copyPixels(_tile1, _tile1.rect, new Point(-(_scrollInc), 0)); break; case "down": if (_scrollInc < (_tile1.height / 4)){ _scrollInc = (_scrollInc + 1); } else { _scrollInc = -15; }; _printArea.copyPixels(_tile1, _tile1.rect, new Point(0, -(_scrollInc))); break; }; }; } public function setupScroll(_arg1:Sprite, _arg2:MovieClip, _arg3:String, _arg4:Number=0):void{ } public function set pause(_arg1:Boolean):void{ _pause = _arg1; } } }//package com.utilities
Section 188
//Selector (com.utilities.Selector) package com.utilities { import flash.events.*; import flash.display.*; import gs.*; import flash.utils.*; import flash.filters.*; import flash.net.*; import flash.media.*; public class Selector extends Sprite { private var _lev:Number;// = 1 private var _xIncrementPos:Number;// = 40 private var _voiceUsed:Number;// = 0 private var _xmlList:XMLList; private var _cardNum:Number;// = 0 private var _scoring:Scoring_counter; private var _barLen:Number;// = 0 private var _art:MovieClip; private var _bit1280:Bitmap; private var _mainArt:MovieClip; private var _soundtrackTrans:SoundTransform; private var wallpaporiginX_1:Number;// = 0 private var wallpaporiginX_2:Number;// = 0 private var _boxClone:Class; private var _cardsAr:Array; private var _myXload:XmlQuickLoad; private var _headOrigins:Object; private var _crazyHeadTimer:Timer; private var _cardCount:Number;// = 0 private var _speechTm:Timer; private var _starterPoz:Object; private var _headDelTm:Timer; private var _bit1024:Bitmap; private var _itemWidth:Number;// = 0 private var _floatingScoreArt:Array; private var _soundTrackChannel:SoundChannel; private var _sidePadding:Number;// = 0 private var _cardInc:uint;// = 0 public static const PAUSE_EVENT:String = "pause operations"; public static const CARDSIN_EVENT:String = "cards in"; public function Selector(_arg1:MovieClip){ _starterPoz = new Object(); _cardsAr = new Array(); _soundTrackChannel = new SoundChannel(); _soundtrackTrans = new SoundTransform(); _headOrigins = new Object(); _crazyHeadTimer = new Timer(10, 40); super(); _mainArt = _arg1; _mainArt.cheffy.starclip.alpha = 0; _mainArt.cheffy.facecover.alpha = 0; } private function addArt(_arg1:Event):void{ _mainArt.addChild(_arg1.target.art); } private function shake():void{ _crazyHeadTimer.reset(); _crazyHeadTimer.start(); } private function ot(_arg1:Event):void{ TweenFilterLite.to(_arg1.currentTarget, 0.5, {colorMatrixFilter:{brightness:1}}); } private function setupWallpaper():void{ var _local1:Loader = new Loader(); trace(_xmlList.wallpaper.wallpaperThumb); var _local2:String = String(_xmlList.wallpaper.wallpaperthumb); _local1.load(new URLRequest(_local2)); _mainArt.wallpapermini.addChild(_local1); _mainArt.overlay.mouseEnabled = false; _mainArt.overlay.mouseChildren = false; _mainArt.wall1280.alpha = 0; _mainArt.wall1024.alpha = 0; _mainArt.wall1280.buttonMode = true; _mainArt.wall1280.addEventListener(MouseEvent.MOUSE_DOWN, wall_1280); _mainArt.wall1280.addEventListener(MouseEvent.MOUSE_OVER, ovr); _mainArt.wall1280.addEventListener(MouseEvent.MOUSE_OUT, ot); _mainArt.wall1024.buttonMode = true; _mainArt.wall1024.addEventListener(MouseEvent.MOUSE_DOWN, wall_1024); _mainArt.wall1024.addEventListener(MouseEvent.MOUSE_OVER, ovr); _mainArt.wall1024.addEventListener(MouseEvent.MOUSE_OUT, ot); _mainArt.wall1280.x = (_mainArt.wall1280.x + 200); _mainArt.wall1024.x = (_mainArt.wall1024.x + 200); var _local3:Bitmap = BlenderButton.formBitmap(_mainArt.wall1280); BlenderButton.addBlender(_local3); var _local4:Bitmap = BlenderButton.formBitmap(_mainArt.wall1024); BlenderButton.addBlender(_local4); TweenLite.to(_mainArt.wall1280, 1, {alpha:1, x:wallpaporiginX_1}); TweenLite.to(_mainArt.wall1024, 1, {alpha:1, x:wallpaporiginX_2}); } private function wall_1024(_arg1:Event):void{ LinkButtons.getUrl("./images/wallpapers/wall1024.html"); } public function crazyHead(_arg1:Event):void{ var _local2:Sprite; var _local3:Number = (Number(Number(Number((Math.random() * 5)))) / 1000); var _local4:BlurFilter = new BlurFilter(Number((Math.random() * 30)), Number((Math.random() * 30))); var _local5:Array = new Array(); _local5.push(_local4); _headOrigins.head.filters = _local5; _headOrigins.head.scaleX = (1 + _local3); _headOrigins.head.scaleY = (1 + _local3); _headOrigins.head.x = (_headOrigins.x + Number((-5 + Number(Math.round((Math.random() * 10)))))); _headOrigins.head.y = (_headOrigins.y + Number((-5 + Number(Math.round((Math.random() * 10)))))); } private function setupScore():void{ _scoring = new Scoring_counter("000000000", _floatingScoreArt, _mainArt.scoreslot); } private function pause(_arg1:Event):void{ _headDelTm.stop(); _speechTm.stop(); adjustsoundTrackVolume(0); dispatchEvent(new Event(PAUSE_EVENT, true)); var _local2:Number = 0; while (_local2 < _cardsAr.length) { _cardsAr[_local2].pause(); _local2++; }; } public function floatScore(_arg1:Event=null):void{ var _local2:Scoring_Floater = new Scoring_Floater("100", _floatingScoreArt, _arg1.currentTarget.art); _scoring.addPoints(100); } public function init():void{ _starterPoz.x = _mainArt.box; _itemWidth = (_mainArt.box.width + 30); _mainArt.removeChild(_mainArt.box); wallpaporiginX_1 = _mainArt.wall1280.x; wallpaporiginX_2 = _mainArt.wall1024.x; _myXload = new XmlQuickLoad("./xml/gamecards.xml"); _myXload.addEventListener(XmlQuickLoad.XMLREADY_EVENT, xmlReady); _boxClone = Object(_mainArt.box).constructor; _headOrigins = {head:_mainArt.cheffy, x:_mainArt.cheffy.x, y:_mainArt.cheffy.y}; _crazyHeadTimer.addEventListener(TimerEvent.TIMER, crazyHead); _crazyHeadTimer.addEventListener(TimerEvent.TIMER_COMPLETE, returnHead); _headDelTm = new Timer(6000); _headDelTm.addEventListener(TimerEvent.TIMER, startHead); _headDelTm.start(); var _local1:BitMapper = new BitMapper(); _art = new Main.numbas(); _floatingScoreArt = _local1.buildDataObject("floatScore", 1, 14, _art); } public function returnHead(_arg1:Event):void{ _mainArt.cheffy.facecover.alpha = 0; TweenLite.to(_mainArt.cheffy.starclip, 3, {alpha:0}); var _local2:Array = new Array(); _headOrigins.head.filters = _local2; _headOrigins.head.x = _headOrigins.x; _headOrigins.head.y = _headOrigins.y; _headOrigins.head.scaleX = 1; _headOrigins.head.scaleY = 1; } private function dropCards():void{ var _local1:Timer = new Timer(300, _cardCount); _local1.addEventListener(TimerEvent.TIMER, addCard); _local1.addEventListener(TimerEvent.TIMER_COMPLETE, cardsAdded); _local1.start(); } private function wall_1280(_arg1:Event):void{ LinkButtons.getUrl("./images/wallpapers/wall1280.html"); } public function resume():void{ _headDelTm.start(); _speechTm.reset(); _speechTm.start(); _voiceUsed = 0; adjustsoundTrackVolume(1); var _local1:Number = 0; while (_local1 < _cardsAr.length) { _cardsAr[_local1].resume(); _local1++; }; } private function xmlReady(_arg1:Event):void{ _xmlList = _arg1.target.list; _cardCount = Number(_xmlList.gamecard.length()); if (_xmlList.gamecard.length() <= 5){ _barLen = ((Number((_itemWidth * _xmlList.gamecard.length())) + Number((20 * Number((_xmlList.gamecard.length() - 1))))) + ((_itemWidth / _xmlList.gamecard.length()) - 1)); } else { _barLen = ((Number((_itemWidth * 5)) + Number((20 * 4))) + Number((_itemWidth / 4))); }; _sidePadding = Number((Number((728 - _barLen)) / 2)); dropCards(); Main.soundDictionary["soundtrack"].soundTransform = _soundtrackTrans; _soundTrackChannel = Main.soundDictionary["soundtrack"].play(0, 2000); } private function addCard(_arg1:Event):void{ if (_cardNum > 4){ _lev++; _cardNum = (_cardNum - 5); }; var _local2:Number = (_sidePadding + (Number(_itemWidth) * (_cardNum + 1))); var _local3:Card = new Card(new _boxClone(), _local2, _xmlList.gamecard[_cardInc], _lev); _local3.addEventListener(Card.CARDREADY_EVENT, addArt); _local3.addEventListener(Card.PAUSESELECTOR_EVENT, pause); _local3.addEventListener(Card.FLOATSCORE_EVENT, floatScore); _cardsAr.push(_local3); _cardInc++; _cardNum++; } private function speak(_arg1:Event):void{ trace(("v" + _voiceUsed)); switch (_voiceUsed){ case 0: break; case 1: break; case 9: adjustsoundTrackVolume(0); break; }; _voiceUsed++; } public function adjustsoundTrackVolume(_arg1:Number):void{ TweenLite.to(_soundtrackTrans, 2, {volume:_arg1, onUpdate:updateChannel}); } private function cardsAdded(_arg1:Event):void{ _arg1.target.removeEventListener(TimerEvent.TIMER, addCard); _arg1.target.removeEventListener(TimerEvent.TIMER_COMPLETE, cardsAdded); setupWallpaper(); _speechTm = new Timer(10000, 9); _speechTm.addEventListener(TimerEvent.TIMER, speak); _speechTm.start(); setupScore(); dispatchEvent(new Event(CARDSIN_EVENT, true)); } public function startHead(_arg1:Event):void{ _mainArt.cheffy.facecover.alpha = 1; _mainArt.cheffy.starclip.alpha = 1; TweenFilterLite.to(_mainArt.cheffy, 0.6, {colorMatrixFilter:{colorize:0xFF0000, amount:0.4}, onComplete:shake}); } private function ovr(_arg1:Event):void{ TweenFilterLite.to(_arg1.currentTarget, 0.5, {colorMatrixFilter:{brightness:1.2}}); BlenderButton.animate((_arg1.currentTarget.getChildByName("masker") as MovieClip)); } public function updateChannel():void{ _soundTrackChannel.soundTransform = _soundtrackTrans; } } }//package com.utilities
Section 189
//XmlQuickLoad (com.utilities.XmlQuickLoad) package com.utilities { import flash.events.*; import flash.display.*; import flash.utils.*; import flash.net.*; public class XmlQuickLoad extends Sprite { private var _xmlList:XMLList; private var _xml:XML; public static const XMLREADY_EVENT:String = " xml ready"; public function XmlQuickLoad(_arg1:String){ var _local2:URLLoader = new URLLoader(); _local2.dataFormat = URLLoaderDataFormat.TEXT; _local2.addEventListener(Event.COMPLETE, handleComplete); _local2.load(new URLRequest(_arg1)); } private function handleComplete(_arg1:Event):void{ var event = _arg1; try { _xml = new XML(event.target.data); _xmlList = new XMLList(_xml); dispatchEvent(new Event(XMLREADY_EVENT, true)); } catch(e:TypeError) { trace(e.message); }; } public function get list():XMLList{ return (_xmlList); } } }//package com.utilities
Section 190
//Elastic (gs.easing.Elastic) package gs.easing { public class Elastic { private static const _2PI:Number = 6.28318530717959; public static function easeIn(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number=0, _arg6:Number=0):Number{ var _local7:Number; if (_arg1 == 0){ return (_arg2); }; _arg1 = (_arg1 / _arg4); if (_arg1 == 1){ return ((_arg2 + _arg3)); }; if (!_arg6){ _arg6 = (_arg4 * 0.3); }; if (((!(_arg5)) || ((_arg5 < Math.abs(_arg3))))){ _arg5 = _arg3; _local7 = (_arg6 / 4); } else { _local7 = ((_arg6 / _2PI) * Math.asin((_arg3 / _arg5))); }; --_arg1; return ((-(((_arg5 * Math.pow(2, (10 * _arg1))) * Math.sin(((((_arg1 * _arg4) - _local7) * _2PI) / _arg6)))) + _arg2)); } public static function easeInOut(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number=0, _arg6:Number=0):Number{ var _local7:Number; if (_arg1 == 0){ return (_arg2); }; _arg1 = (_arg1 / (_arg4 / 2)); if (_arg1 == 2){ return ((_arg2 + _arg3)); }; if (!_arg6){ _arg6 = (_arg4 * (0.3 * 1.5)); }; if (((!(_arg5)) || ((_arg5 < Math.abs(_arg3))))){ _arg5 = _arg3; _local7 = (_arg6 / 4); } else { _local7 = ((_arg6 / _2PI) * Math.asin((_arg3 / _arg5))); }; if (_arg1 < 1){ --_arg1; return (((-0.5 * ((_arg5 * Math.pow(2, (10 * _arg1))) * Math.sin(((((_arg1 * _arg4) - _local7) * _2PI) / _arg6)))) + _arg2)); }; --_arg1; return ((((((_arg5 * Math.pow(2, (-10 * _arg1))) * Math.sin(((((_arg1 * _arg4) - _local7) * _2PI) / _arg6))) * 0.5) + _arg3) + _arg2)); } public static function easeOut(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number=0, _arg6:Number=0):Number{ var _local7:Number; if (_arg1 == 0){ return (_arg2); }; _arg1 = (_arg1 / _arg4); if (_arg1 == 1){ return ((_arg2 + _arg3)); }; if (!_arg6){ _arg6 = (_arg4 * 0.3); }; if (((!(_arg5)) || ((_arg5 < Math.abs(_arg3))))){ _arg5 = _arg3; _local7 = (_arg6 / 4); } else { _local7 = ((_arg6 / _2PI) * Math.asin((_arg3 / _arg5))); }; return (((((_arg5 * Math.pow(2, (-10 * _arg1))) * Math.sin(((((_arg1 * _arg4) - _local7) * _2PI) / _arg6))) + _arg3) + _arg2)); } } }//package gs.easing
Section 191
//Linear (gs.easing.Linear) package gs.easing { public class Linear { public static function easeOut(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{ return ((((_arg3 * _arg1) / _arg4) + _arg2)); } public static function easeIn(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{ return ((((_arg3 * _arg1) / _arg4) + _arg2)); } public static function easeInOut(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{ return ((((_arg3 * _arg1) / _arg4) + _arg2)); } public static function easeNone(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{ return ((((_arg3 * _arg1) / _arg4) + _arg2)); } } }//package gs.easing
Section 192
//TweenFilterLite (gs.TweenFilterLite) package gs { import flash.display.*; import flash.filters.*; public class TweenFilterLite extends TweenLite { private var _matrix:Array; private var _hf:Boolean;// = false private var _cmf:ColorMatrixFilter; private var _filters:Array; private var _endMatrix:Array; private var _clrsa:Array; public static var defaultEase:Function = TweenLite.defaultEase; private static var _idMatrix:Array = [1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0]; private static var _lumB:Number = 0.072169; public static var version:Number = 7.14; public static var delayedCall:Function = TweenLite.delayedCall; public static var killTweensOf:Function = TweenLite.killTweensOf; private static var _lumG:Number = 0.71516; public static var killDelayedCallsTo:Function = TweenLite.killTweensOf; private static var _lumR:Number = 0.212671; public function TweenFilterLite(_arg1:Object, _arg2:Number, _arg3:Object){ _filters = []; super(_arg1, _arg2, _arg3); if ((((TweenLite.version < 6.23)) || (isNaN(TweenLite.version)))){ trace("ERROR! Please update your TweenLite class or try deleting your ASO files. TweenFilterLite requires a more recent version. Download updates at http://www.TweenLite.com."); }; if (_arg3.type != undefined){ trace((("TweenFilterLite error: " + _arg1) + " is using deprecated syntax. Please update to the new syntax. See http://www.TweenFilterLite.com for details.")); }; } override public function initTweenVals(_arg1:Boolean=false, _arg2:String=""):void{ var _local3:int; var _local4:Object; var _local5:Object; var _local6:Object; _clrsa = []; _filters = []; _matrix = _idMatrix.slice(); _arg2 = (_arg2 + " blurFilter glowFilter colorMatrixFilter dropShadowFilter bevelFilter "); if ((this.target is DisplayObject)){ if (this.vars.blurFilter != undefined){ _local4 = this.vars.blurFilter; addFilter("blur", _local4, BlurFilter, ["blurX", "blurY", "quality"], new BlurFilter(0, 0, ((_local4.quality) || (2)))); }; if (this.vars.glowFilter != undefined){ _local4 = this.vars.glowFilter; addFilter("glow", _local4, GlowFilter, ["alpha", "blurX", "blurY", "color", "quality", "strength", "inner", "knockout"], new GlowFilter(0xFFFFFF, 0, 0, 0, ((_local4.strength) || (1)), ((_local4.quality) || (2)), _local4.inner, _local4.knockout)); }; if (this.vars.colorMatrixFilter != undefined){ _local4 = this.vars.colorMatrixFilter; _local5 = addFilter("colorMatrix", _local4, ColorMatrixFilter, [], new ColorMatrixFilter(_matrix)); _cmf = _local5.filter; _matrix = ColorMatrixFilter(_cmf).matrix; if (((!((_local4.matrix == undefined))) && ((_local4.matrix is Array)))){ _endMatrix = _local4.matrix; } else { if (_local4.relative == true){ _endMatrix = _matrix.slice(); } else { _endMatrix = _idMatrix.slice(); }; _endMatrix = setBrightness(_endMatrix, _local4.brightness); _endMatrix = setContrast(_endMatrix, _local4.contrast); _endMatrix = setHue(_endMatrix, _local4.hue); _endMatrix = setSaturation(_endMatrix, _local4.saturation); _endMatrix = setThreshold(_endMatrix, _local4.threshold); if (!isNaN(_local4.colorize)){ _endMatrix = colorize(_endMatrix, _local4.colorize, _local4.amount); } else { if (!isNaN(_local4.color)){ _endMatrix = colorize(_endMatrix, _local4.color, _local4.amount); }; }; }; _local3 = 0; while (_local3 < _endMatrix.length) { if (((!((_matrix[_local3] == _endMatrix[_local3]))) && (!((_matrix[_local3] == undefined))))){ this.tweens.push({o:_matrix, p:_local3.toString(), s:_matrix[_local3], c:(_endMatrix[_local3] - _matrix[_local3])}); }; _local3++; }; }; if (this.vars.dropShadowFilter != undefined){ _local4 = this.vars.dropShadowFilter; addFilter("dropShadow", _local4, DropShadowFilter, ["alpha", "angle", "blurX", "blurY", "color", "distance", "quality", "strength", "inner", "knockout", "hideObject"], new DropShadowFilter(0, 45, 0, 0, 0, 0, 1, ((_local4.quality) || (2)), _local4.inner, _local4.knockout, _local4.hideObject)); }; if (this.vars.bevelFilter != undefined){ _local4 = this.vars.bevelFilter; addFilter("bevel", _local4, BevelFilter, ["angle", "blurX", "blurY", "distance", "highlightAlpha", "highlightColor", "quality", "shadowAlpha", "shadowColor", "strength"], new BevelFilter(0, 0, 0xFFFFFF, 0.5, 0, 0.5, 2, 2, 0, ((_local4.quality) || (2)))); }; if (this.vars.runBackwards == true){ _local3 = (_clrsa.length - 1); while (_local3 > -1) { _local6 = _clrsa[_local3]; _clrsa[_local3].sr = (_local6.sr + _local6.cr); _local6.cr = (_local6.cr * -1); _local6.sg = (_local6.sg + _local6.cg); _local6.cg = (_local6.cg * -1); _local6.sb = (_local6.sb + _local6.cb); _local6.cb = (_local6.cb * -1); _local6.f[_local6.p] = (((_local6.sr << 16) | (_local6.sg << 8)) | _local6.sb); _local3--; }; }; super.initTweenVals(true, _arg2); } else { super.initTweenVals(_arg1, _arg2); }; } override public function render(_arg1:uint):void{ var _local3:Number; var _local4:Object; var _local5:int; var _local6:Number; var _local7:Number; var _local8:Number; var _local9:int; var _local10:Array; var _local2:Number = ((_arg1 - this.startTime) / 1000); if (_local2 >= this.duration){ _local2 = this.duration; _local3 = 1; } else { _local3 = this.vars.ease(_local2, 0, 1, this.duration); }; _local5 = (this.tweens.length - 1); while (_local5 > -1) { _local4 = this.tweens[_local5]; _local4.o[_local4.p] = (_local4.s + (_local3 * _local4.c)); _local5--; }; if (_hf){ _local5 = (_clrsa.length - 1); while (_local5 > -1) { _local4 = _clrsa[_local5]; _local6 = (_local4.sr + (_local3 * _local4.cr)); _local7 = (_local4.sg + (_local3 * _local4.cg)); _local8 = (_local4.sb + (_local3 * _local4.cb)); _local4.f[_local4.p] = (((_local6 << 16) | (_local7 << 8)) | _local8); _local5--; }; if (_cmf != null){ ColorMatrixFilter(_cmf).matrix = _matrix; }; _local10 = this.target.filters; _local5 = 0; while (_local5 < _filters.length) { _local9 = (_local10.length - 1); while (_local9 > -1) { if ((_local10[_local9] is _filters[_local5].type)){ _local10.splice(_local9, 1, _filters[_local5].filter); break; }; _local9--; }; _local5++; }; this.target.filters = _local10; }; if (_hst){ _local5 = (_subTweens.length - 1); while (_local5 > -1) { _subTweens[_local5].proxy(_subTweens[_local5]); _local5--; }; }; if (this.vars.onUpdate != null){ this.vars.onUpdate.apply(this.vars.onUpdateScope, this.vars.onUpdateParams); }; if (_local2 == this.duration){ super.complete(true); }; } public function HEXtoRGB(_arg1:Number):Object{ return ({rb:(_arg1 >> 16), gb:((_arg1 >> 8) & 0xFF), bb:(_arg1 & 0xFF)}); } private function addFilter(_arg1:String, _arg2:Object, _arg3:Class, _arg4:Array, _arg5:BitmapFilter):Object{ var _local8:int; var _local9:String; var _local10:Number; var _local11:Object; var _local12:Object; var _local6:Object = {type:_arg3}; var _local7:Array = this.target.filters; _local8 = 0; while (_local8 < _local7.length) { if ((_local7[_local8] is _arg3)){ _local6.filter = _local7[_local8]; break; }; _local8++; }; if (_local6.filter == undefined){ _local6.filter = _arg5; _local7.push(_local6.filter); this.target.filters = _local7; }; _local8 = 0; while (_local8 < _arg4.length) { _local9 = _arg4[_local8]; if (_arg2[_local9] != undefined){ if ((((((_local9 == "color")) || ((_local9 == "highlightColor")))) || ((_local9 == "shadowColor")))){ _local11 = HEXtoRGB(_local6.filter[_local9]); _local12 = HEXtoRGB(_arg2[_local9]); _clrsa.push({f:_local6.filter, p:_local9, sr:_local11.rb, cr:(_local12.rb - _local11.rb), sg:_local11.gb, cg:(_local12.gb - _local11.gb), sb:_local11.bb, cb:(_local12.bb - _local11.bb)}); } else { if ((((((((_local9 == "quality")) || ((_local9 == "inner")))) || ((_local9 == "knockout")))) || ((_local9 == "hideObject")))){ _local6.filter[_local9] = _arg2[_local9]; } else { if (typeof(_arg2[_local9]) == "number"){ _local10 = (_arg2[_local9] - _local6.filter[_local9]); } else { _local10 = Number(_arg2[_local9]); }; this.tweens.push({o:_local6.filter, p:_local9, s:_local6.filter[_local9], c:_local10}); }; }; }; _local8++; }; _filters.push(_local6); _hf = true; return (_local6); } public static function setContrast(_arg1:Array, _arg2:Number):Array{ if (isNaN(_arg2)){ return (_arg1); }; _arg2 = (_arg2 + 0.01); var _local3:Array = [_arg2, 0, 0, 0, (128 * (1 - _arg2)), 0, _arg2, 0, 0, (128 * (1 - _arg2)), 0, 0, _arg2, 0, (128 * (1 - _arg2)), 0, 0, 0, 1, 0]; return (applyMatrix(_local3, _arg1)); } public static function colorize(_arg1:Array, _arg2:Number, _arg3:Number=100):Array{ if (isNaN(_arg2)){ return (_arg1); }; if (isNaN(_arg3)){ _arg3 = 1; }; var _local4:Number = (((_arg2 >> 16) & 0xFF) / 0xFF); var _local5:Number = (((_arg2 >> 8) & 0xFF) / 0xFF); var _local6:Number = ((_arg2 & 0xFF) / 0xFF); var _local7:Number = (1 - _arg3); var _local8:Array = [(_local7 + ((_arg3 * _local4) * _lumR)), ((_arg3 * _local4) * _lumG), ((_arg3 * _local4) * _lumB), 0, 0, ((_arg3 * _local5) * _lumR), (_local7 + ((_arg3 * _local5) * _lumG)), ((_arg3 * _local5) * _lumB), 0, 0, ((_arg3 * _local6) * _lumR), ((_arg3 * _local6) * _lumG), (_local7 + ((_arg3 * _local6) * _lumB)), 0, 0, 0, 0, 0, 1, 0]; return (applyMatrix(_local8, _arg1)); } public static function setBrightness(_arg1:Array, _arg2:Number):Array{ if (isNaN(_arg2)){ return (_arg1); }; _arg2 = ((_arg2 * 100) - 100); return (applyMatrix([1, 0, 0, 0, _arg2, 0, 1, 0, 0, _arg2, 0, 0, 1, 0, _arg2, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1], _arg1)); } public static function setSaturation(_arg1:Array, _arg2:Number):Array{ if (isNaN(_arg2)){ return (_arg1); }; var _local3:Number = (1 - _arg2); var _local4:Number = (_local3 * _lumR); var _local5:Number = (_local3 * _lumG); var _local6:Number = (_local3 * _lumB); var _local7:Array = [(_local4 + _arg2), _local5, _local6, 0, 0, _local4, (_local5 + _arg2), _local6, 0, 0, _local4, _local5, (_local6 + _arg2), 0, 0, 0, 0, 0, 1, 0]; return (applyMatrix(_local7, _arg1)); } public static function applyMatrix(_arg1:Array, _arg2:Array):Array{ var _local6:int; var _local7:int; if (((!((_arg1 is Array))) || (!((_arg2 is Array))))){ return (_arg2); }; var _local3:Array = []; var _local4:int; var _local5:int; _local6 = 0; while (_local6 < 4) { _local7 = 0; while (_local7 < 5) { if (_local7 == 4){ _local5 = _arg1[(_local4 + 4)]; } else { _local5 = 0; }; _local3[(_local4 + _local7)] = (((((_arg1[_local4] * _arg2[_local7]) + (_arg1[(_local4 + 1)] * _arg2[(_local7 + 5)])) + (_arg1[(_local4 + 2)] * _arg2[(_local7 + 10)])) + (_arg1[(_local4 + 3)] * _arg2[(_local7 + 15)])) + _local5); _local7++; }; _local4 = (_local4 + 5); _local6++; }; return (_local3); } public static function from(_arg1:Object, _arg2:Number, _arg3:Object):TweenFilterLite{ _arg3.runBackwards = true; return (new TweenFilterLite(_arg1, _arg2, _arg3)); } public static function setThreshold(_arg1:Array, _arg2:Number):Array{ if (isNaN(_arg2)){ return (_arg1); }; var _local3:Array = [(_lumR * 0x0100), (_lumG * 0x0100), (_lumB * 0x0100), 0, (-256 * _arg2), (_lumR * 0x0100), (_lumG * 0x0100), (_lumB * 0x0100), 0, (-256 * _arg2), (_lumR * 0x0100), (_lumG * 0x0100), (_lumB * 0x0100), 0, (-256 * _arg2), 0, 0, 0, 1, 0]; return (applyMatrix(_local3, _arg1)); } public static function setHue(_arg1:Array, _arg2:Number):Array{ if (isNaN(_arg2)){ return (_arg1); }; _arg2 = (_arg2 * (Math.PI / 180)); var _local3:Number = Math.cos(_arg2); var _local4:Number = Math.sin(_arg2); var _local5:Array = [((_lumR + (_local3 * (1 - _lumR))) + (_local4 * -(_lumR))), ((_lumG + (_local3 * -(_lumG))) + (_local4 * -(_lumG))), ((_lumB + (_local3 * -(_lumB))) + (_local4 * (1 - _lumB))), 0, 0, ((_lumR + (_local3 * -(_lumR))) + (_local4 * 0.143)), ((_lumG + (_local3 * (1 - _lumG))) + (_local4 * 0.14)), ((_lumB + (_local3 * -(_lumB))) + (_local4 * -0.283)), 0, 0, ((_lumR + (_local3 * -(_lumR))) + (_local4 * -((1 - _lumR)))), ((_lumG + (_local3 * -(_lumG))) + (_local4 * _lumG)), ((_lumB + (_local3 * (1 - _lumB))) + (_local4 * _lumB)), 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1]; return (applyMatrix(_local5, _arg1)); } public static function to(_arg1:Object, _arg2:Number, _arg3:Object):TweenFilterLite{ return (new TweenFilterLite(_arg1, _arg2, _arg3)); } } }//package gs
Section 193
//TweenLite (gs.TweenLite) package gs { import flash.events.*; import flash.display.*; import flash.utils.*; import flash.geom.*; import flash.media.*; public class TweenLite { public var delay:Number; protected var _initted:Boolean; protected var _subTweens:Array; public var startTime:int; public var target:Object; public var duration:Number; protected var _hst:Boolean; protected var _active:Boolean; public var tweens:Array; public var vars:Object; public var initTime:int; private static var _timer:Timer = new Timer(2000); private static var _classInitted:Boolean; public static var defaultEase:Function = TweenLite.easeOut; public static var version:Number = 6.23; private static var _sprite:Sprite = new Sprite(); protected static var _all:Dictionary = new Dictionary(); public static var killDelayedCallsTo:Function = killTweensOf; protected static var _curTime:uint; private static var _listening:Boolean; public function TweenLite(_arg1:Object, _arg2:Number, _arg3:Object){ if (_arg1 == null){ return; }; if (((((!((_arg3.overwrite == false))) && (!((_arg1 == null))))) || ((_all[_arg1] == undefined)))){ delete _all[_arg1]; _all[_arg1] = new Dictionary(); }; _all[_arg1][this] = this; this.vars = _arg3; this.duration = ((_arg2) || (0.001)); this.delay = ((_arg3.delay) || (0)); this.target = _arg1; if (!(this.vars.ease is Function)){ this.vars.ease = defaultEase; }; if (this.vars.easeParams != null){ this.vars.proxiedEase = this.vars.ease; this.vars.ease = easeProxy; }; if (!isNaN(Number(this.vars.autoAlpha))){ this.vars.alpha = Number(this.vars.autoAlpha); }; this.tweens = []; _subTweens = []; _hst = (_initted = false); _active = (((_arg2 == 0)) && ((this.delay == 0))); if (!_classInitted){ _curTime = getTimer(); _sprite.addEventListener(Event.ENTER_FRAME, executeAll); _classInitted = true; }; this.initTime = _curTime; if ((((((this.vars.runBackwards == true)) && (!((this.vars.renderOnStart == true))))) || (_active))){ initTweenVals(); this.startTime = _curTime; if (_active){ render((this.startTime + 1)); } else { render(this.startTime); }; }; if (((!(_listening)) && (!(_active)))){ _timer.addEventListener("timer", killGarbage); _timer.start(); _listening = true; }; } protected function addSubTween(_arg1:Function, _arg2:Object, _arg3:Object, _arg4:Object=null):void{ var _local6:String; var _local5:Object = {proxy:_arg1, target:_arg2, info:_arg4}; _subTweens.push(_local5); for (_local6 in _arg3) { if (typeof(_arg3[_local6]) == "number"){ this.tweens.push({o:_arg2, p:_local6, s:_arg2[_local6], c:(_arg3[_local6] - _arg2[_local6]), sub:_local5}); } else { this.tweens.push({o:_arg2, p:_local6, s:_arg2[_local6], c:Number(_arg3[_local6]), sub:_local5}); }; }; _hst = true; } public function initTweenVals(_arg1:Boolean=false, _arg2:String=""):void{ var _local4:String; var _local5:int; var _local6:Array; var _local7:ColorTransform; var _local8:ColorTransform; var _local9:Object; var _local3 = (this.target is DisplayObject); if ((this.target is Array)){ _local6 = ((this.vars.endArray) || ([])); _local5 = 0; while (_local5 < _local6.length) { if (((!((this.target[_local5] == _local6[_local5]))) && (!((this.target[_local5] == undefined))))){ this.tweens.push({o:this.target, p:_local5.toString(), s:this.target[_local5], c:(_local6[_local5] - this.target[_local5])}); }; _local5++; }; } else { for (_local4 in this.vars) { if ((((((((((((((((((((((((((((((((((((_local4 == "ease")) || ((_local4 == "delay")))) || ((_local4 == "overwrite")))) || ((_local4 == "onComplete")))) || ((_local4 == "onCompleteParams")))) || ((_local4 == "onCompleteScope")))) || ((_local4 == "runBackwards")))) || ((_local4 == "onUpdate")))) || ((_local4 == "onUpdateParams")))) || ((_local4 == "onUpdateScope")))) || ((_local4 == "autoAlpha")))) || ((_local4 == "onStart")))) || ((_local4 == "onStartParams")))) || ((_local4 == "onStartScope")))) || ((_local4 == "renderOnStart")))) || ((_local4 == "proxiedEase")))) || ((_local4 == "easeParams")))) || (((_arg1) && (!((_arg2.indexOf(((" " + _local4) + " ")) == -1))))))){ } else { if ((((_local4 == "tint")) && (_local3))){ _local7 = this.target.transform.colorTransform; _local8 = new ColorTransform(); if (this.vars.alpha != undefined){ _local8.alphaMultiplier = this.vars.alpha; delete this.vars.alpha; _local5 = (this.tweens.length - 1); while (_local5 > -1) { if (this.tweens[_local5].p == "alpha"){ this.tweens.splice(_local5, 1); break; }; _local5--; }; } else { _local8.alphaMultiplier = this.target.alpha; }; if (((((!((this.vars[_local4] == null))) && (!((this.vars[_local4] == ""))))) || ((this.vars[_local4] == 0)))){ _local8.color = this.vars[_local4]; }; addSubTween(tintProxy, {progress:0}, {progress:1}, {target:this.target, color:_local7, endColor:_local8}); } else { if ((((_local4 == "frame")) && (_local3))){ addSubTween(frameProxy, {frame:this.target.currentFrame}, {frame:this.vars[_local4]}, {target:this.target}); } else { if ((((_local4 == "volume")) && (((_local3) || ((this.target is SoundChannel)))))){ addSubTween(volumeProxy, this.target.soundTransform, {volume:this.vars[_local4]}, {target:this.target}); } else { if (typeof(this.vars[_local4]) == "number"){ this.tweens.push({o:this.target, p:_local4, s:this.target[_local4], c:(this.vars[_local4] - this.target[_local4])}); } else { this.tweens.push({o:this.target, p:_local4, s:this.target[_local4], c:Number(this.vars[_local4])}); }; }; }; }; }; }; }; if (this.vars.runBackwards == true){ _local5 = (this.tweens.length - 1); while (_local5 > -1) { _local9 = this.tweens[_local5]; this.tweens[_local5].s = (_local9.s + _local9.c); _local9.c = (_local9.c * -1); _local5--; }; }; if (typeof(this.vars.autoAlpha) == "number"){ this.target.visible = !((((this.vars.runBackwards == true)) && ((this.target.alpha == 0)))); }; _initted = true; } public function get active():Boolean{ if (_active){ return (true); }; if (((_curTime - this.initTime) / 1000) > this.delay){ _active = true; this.startTime = (this.initTime + (this.delay * 1000)); if (!_initted){ initTweenVals(); } else { if (typeof(this.vars.autoAlpha) == "number"){ this.target.visible = true; }; }; if (this.vars.onStart != null){ this.vars.onStart.apply(this.vars.onStartScope, this.vars.onStartParams); }; if (this.duration == 0.001){ this.startTime = (this.startTime - 1); }; return (true); //unresolved jump }; return (false); } public function render(_arg1:uint):void{ var _local3:Number; var _local4:Object; var _local5:int; var _local2:Number = ((_arg1 - this.startTime) / 1000); if (_local2 >= this.duration){ _local2 = this.duration; _local3 = 1; } else { _local3 = this.vars.ease(_local2, 0, 1, this.duration); }; _local5 = (this.tweens.length - 1); while (_local5 > -1) { _local4 = this.tweens[_local5]; _local4.o[_local4.p] = (_local4.s + (_local3 * _local4.c)); _local5--; }; if (_hst){ _local5 = (_subTweens.length - 1); while (_local5 > -1) { _subTweens[_local5].proxy(_subTweens[_local5]); _local5--; }; }; if (this.vars.onUpdate != null){ this.vars.onUpdate.apply(this.vars.onUpdateScope, this.vars.onUpdateParams); }; if (_local2 == this.duration){ complete(true); }; } protected function easeProxy(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{ return (this.vars.proxiedEase.apply(null, arguments.concat(this.vars.easeParams))); } public function complete(_arg1:Boolean=false):void{ if (!_arg1){ if (!_initted){ initTweenVals(); }; this.startTime = (_curTime - (this.duration * 1000)); render(_curTime); return; }; if ((((typeof(this.vars.autoAlpha) == "number")) && ((this.target.alpha == 0)))){ this.target.visible = false; }; if (this.vars.onComplete != null){ this.vars.onComplete.apply(this.vars.onCompleteScope, this.vars.onCompleteParams); }; removeTween(this); } public static function easeOut(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{ _arg1 = (_arg1 / _arg4); return ((((-(_arg3) * _arg1) * (_arg1 - 2)) + _arg2)); } public static function frameProxy(_arg1:Object):void{ _arg1.info.target.gotoAndStop(Math.round(_arg1.target.frame)); } public static function removeTween(_arg1:TweenLite=null):void{ if (((!((_arg1 == null))) && (!((_all[_arg1.target] == undefined))))){ delete _all[_arg1.target][_arg1]; }; } public static function killTweensOf(_arg1:Object=null, _arg2:Boolean=false):void{ var _local3:Object; var _local4:*; if (((!((_arg1 == null))) && (!((_all[_arg1] == undefined))))){ if (_arg2){ _local3 = _all[_arg1]; for (_local4 in _local3) { _local3[_local4].complete(false); }; }; delete _all[_arg1]; }; } public static function delayedCall(_arg1:Number, _arg2:Function, _arg3:Array=null, _arg4=null):TweenLite{ return (new TweenLite(_arg2, 0, {delay:_arg1, onComplete:_arg2, onCompleteParams:_arg3, onCompleteScope:_arg4, overwrite:false})); } public static function from(_arg1:Object, _arg2:Number, _arg3:Object):TweenLite{ _arg3.runBackwards = true; return (new TweenLite(_arg1, _arg2, _arg3)); } public static function executeAll(_arg1:Event=null):void{ var _local3:Dictionary; var _local4:Object; var _local5:Object; var _local2:uint = (_curTime = getTimer()); if (_listening){ _local3 = _all; for each (_local4 in _local3) { for (_local5 in _local4) { if (((!((_local4[_local5] == undefined))) && (_local4[_local5].active))){ _local4[_local5].render(_local2); }; }; }; }; } public static function volumeProxy(_arg1:Object):void{ _arg1.info.target.soundTransform = _arg1.target; } public static function killGarbage(_arg1:TimerEvent):void{ var _local3:Boolean; var _local4:Object; var _local5:Object; var _local6:Object; var _local2:uint; for (_local4 in _all) { _local3 = false; for (_local5 in _all[_local4]) { _local3 = true; break; }; if (!_local3){ delete _all[_local4]; } else { _local2++; }; }; if (_local2 == 0){ _timer.removeEventListener("timer", killGarbage); _timer.stop(); _listening = false; }; } public static function tintProxy(_arg1:Object):void{ var _local2:Number = _arg1.target.progress; var _local3:Number = (1 - _local2); var _local4:Object = _arg1.info.color; var _local5:Object = _arg1.info.endColor; _arg1.info.target.transform.colorTransform = new ColorTransform(((_local4.redMultiplier * _local3) + (_local5.redMultiplier * _local2)), ((_local4.greenMultiplier * _local3) + (_local5.greenMultiplier * _local2)), ((_local4.blueMultiplier * _local3) + (_local5.blueMultiplier * _local2)), ((_local4.alphaMultiplier * _local3) + (_local5.alphaMultiplier * _local2)), ((_local4.redOffset * _local3) + (_local5.redOffset * _local2)), ((_local4.greenOffset * _local3) + (_local5.greenOffset * _local2)), ((_local4.blueOffset * _local3) + (_local5.blueOffset * _local2)), ((_local4.alphaOffset * _local3) + (_local5.alphaOffset * _local2))); } public static function to(_arg1:Object, _arg2:Number, _arg3:Object):TweenLite{ return (new TweenLite(_arg1, _arg2, _arg3)); } } }//package gs
Section 194
//ByteArrayAsset (mx.core.ByteArrayAsset) package mx.core { import flash.utils.*; public class ByteArrayAsset extends ByteArray implements IFlexAsset { mx_internal static const VERSION:String = "3.4.0.9271"; } }//package mx.core
Section 195
//IFlexAsset (mx.core.IFlexAsset) package mx.core { public interface IFlexAsset { } }//package mx.core
Section 196
//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 197
//Main (Main) package { import flash.events.*; import flash.display.*; import flash.utils.*; import flash.text.*; import com.utilities.*; import com.core.*; import flash.media.*; public class Main extends Sprite { private var _gameXml:XML; private var _lid:Lid; private var _forkaPedeYlocAr:Array; private var _scrollInc:Number;// = 0 private var _forkY:Number;// = 80 private var _scrollArea:MovieClip; private var _forkapedeYInc:Number;// = 0 private var _gameStartScreen:MovieClip; private var _explodeArt:Class; public var gameFrame:Class; private var _gameManager:GameManager; private var _Fdir:String; private var _windowType:String; private var _gamestarterScreen:GameStartScreen; private var _mainArt:MovieClip; private var _debug:Boolean;// = false private var _forkSpeed:Number; private var _selector:Selector; public static var baconSkin:Class; public static var minibead:Class; public static var soundDictionary:Dictionary = new Dictionary(); public static var minilettuce:Class; public static var hitCycle:MovieClip; public static var breadSkin:Class; public static var _waffleTexture:Class; public static var hud1:MovieClip; public static var hud2:MovieClip; public static var minitomato:Class; public static var tomatoSkin:Class; public static var hamSkin:Class; public static var miniInstruct:MovieClip; public static var messages:Class; public static var cuttingSkin:MovieClip; public static var numbas:Class; public static var topDogTextF:TextField; public static var cursor:Sprite; public static var lettuceSkin:Class; public static var whiteTiles:Class; public static var woodTiles:Class; public static var minihash:Class; public static var minibacon:Class; public static var cheeseSkin:Class; public static var pickleSkin:Class; public static var mainMixerTransform:SoundTransform = new SoundTransform(); public static var sardineSkin:Class; public function Main():void{ gameFrame = Main_gameFrame; _forkaPedeYlocAr = new Array(20, 95, 130, 170); _forkSpeed = (0.2 + (Math.random() * 2)); super(); if (stage){ init(); } else { addEventListener(Event.ADDED_TO_STAGE, init); }; } private function gamelevelEnd(_arg1:Event):void{ _windowType = _arg1.target.windowType; var _local2:Object = new Object(); _local2 = {mainScore:_arg1.target.holdScore, pointScore:_arg1.target.pointScore, timeScore:_arg1.target.timeScore}; trace(("WINDOWTYPE" + _windowType)); addChild(_gamestarterScreen.addArt(_windowType, _local2)); soundDictionary["levelup"].play(); } private function startScreeninit(_arg1:Event=null):void{ var _local2:Timer; if (!_debug){ addChild(_gamestarterScreen.addArt("start")); _gamestarterScreen.showPlay = false; _gameManager.initViewsContent(); cursor.addChildAt(hitCycle, 0); hitCycle.mouseEnabled = false; hitCycle.inner.gotoAndStop(1); addChild(cursor); } else { _local2 = new Timer(500, 1); _local2.addEventListener(TimerEvent.TIMER_COMPLETE, debugAdd); _local2.start(); }; } private function gameEnd(_arg1:Event):void{ } public function mouseMoveHandler(_arg1:MouseEvent):void{ cursor.x = (_arg1.stageX - ((cursor.width / 4) + 2)); cursor.y = ((_arg1.stageY - (cursor.height / 4)) + 2); } private function resume(_arg1:Event):void{ } private function debugAdd(_arg1:Event):void{ addChild(_gamestarterScreen.addArt("start")); cursor.addChild(hitCycle); _gameManager.initViewsContent(); } private function init(_arg1:Event=null):void{ removeEventListener(Event.ADDED_TO_STAGE, init); trace("startup selector"); var _local2:EmbedSecure = new EmbedSecure(gameFrame); _local2.addEventListener(EmbedSecure.ARTREADY_EVENT, addSelector); } private function emailz(_arg1:Event):void{ LinkButtons.getUrlSelf("mailto:info@munchiegames.com ?subject=custom games/branding/skinning questions"); } private function addSelector(_arg1:Event):void{ var _local46:Cartoon; var _local2:Class = _arg1.target.grabClass("hud1"); hud1 = new (_local2); var _local3:Class = _arg1.target.grabClass("hud2"); hud2 = new (_local3); whiteTiles = _arg1.target.grabClass("tiles_white"); woodTiles = _arg1.target.grabClass("woodys"); _waffleTexture = _arg1.target.grabClass("waff"); var _local4:Class = _arg1.target.grabClass("cartoon"); var _local5:MovieClip = new (_local4); var _local6:Class = _arg1.target.grabClass("mainModule"); var _local7:MovieClip = new (_local6); _mainArt = _local7; _local7.frm.muter.buttonMode = true; _local7.frm.muter.addEventListener(MouseEvent.MOUSE_DOWN, muterz); _local7.addChild(_local7.frm.muter); var _local8:Class = _arg1.target.grabClass("gamestartscreen"); _gameStartScreen = new (_local8); var _local9:Class = _arg1.target.grabClass("lid"); var _local10:MovieClip = new (_local9); _lid = new Lid(_local10); _local7.frm.topdog.text = Preloader.hotshot; _lid.addEventListener(Lid.RESUME_EVENT, resume); var _local11:Class = _arg1.target.grabClass("sndtrack"); var _local12:Sound = new (_local11); soundDictionary["soundtrack"] = _local12; var _local13:Class = _arg1.target.grabClass("coin1"); var _local14:Sound = new (_local13); soundDictionary["coin"] = _local14; var _local15:Class = _arg1.target.grabClass("play"); var _local16:Sound = new (_local15); soundDictionary["play"] = _local16; var _local17:Class = _arg1.target.grabClass("go"); var _local18:Sound = new (_local17); soundDictionary["go"] = _local18; var _local19:Class = _arg1.target.grabClass("back"); var _local20:Sound = new (_local19); soundDictionary["back"] = _local20; var _local21:Class = _arg1.target.grabClass("blip"); var _local22:Sound = new (_local21); soundDictionary["blip"] = _local22; var _local23:Class = _arg1.target.grabClass("bubblehit"); var _local24:Sound = new (_local23); soundDictionary["bubble"] = _local24; var _local25:Class = _arg1.target.grabClass("maxpoints"); var _local26:Sound = new (_local25); soundDictionary["maxpoints"] = _local26; var _local27:Class = _arg1.target.grabClass("correct"); var _local28:Sound = new (_local27); soundDictionary["correct"] = _local28; var _local29:Class = _arg1.target.grabClass("sandComplete"); var _local30:Sound = new (_local29); soundDictionary["sndwichComplete"] = _local30; var _local31:Class = _arg1.target.grabClass("goodsandwich"); var _local32:Sound = new (_local31); soundDictionary["goodsandwich"] = _local32; var _local33:Class = _arg1.target.grabClass("fixin"); var _local34:Sound = new (_local33); soundDictionary["fixin"] = _local34; var _local35:Class = _arg1.target.grabClass("levelup"); var _local36:Sound = new (_local35); soundDictionary["levelup"] = _local36; var _local37:Class = _arg1.target.grabClass("corktile"); numbas = _arg1.target.grabClass("numbas"); messages = _arg1.target.grabClass("messaging"); var _local38:Class = _arg1.target.grabClass("mainfinger"); var _local39:Class = _arg1.target.grabClass("hitCycle"); hitCycle = new (_local39); var _local40:Class = _arg1.target.grabClass("miniInstruct"); miniInstruct = new (_local40); var _local41:Class = _arg1.target.grabClass("bigpoints"); var _local42:Sound = new (_local41); soundDictionary["bigpoints"] = _local42; var _local43:Class = _arg1.target.grabClass("midpoints"); var _local44:Sound = new (_local43); soundDictionary["midpoints"] = _local44; cursor = new (_local38); cursor.visible = false; addChild(_local7); var _local45:Class = _arg1.target.grabClass("cuttingskin"); tomatoSkin = _arg1.target.grabClass("tomatotexter"); baconSkin = _arg1.target.grabClass("bacontexture"); lettuceSkin = _arg1.target.grabClass("lettucetexture"); breadSkin = _arg1.target.grabClass("toasttexter"); cuttingSkin = new (_local45); pickleSkin = _arg1.target.grabClass("pickletexture"); sardineSkin = _arg1.target.grabClass("sardinetexture"); hamSkin = _arg1.target.grabClass("hamtexture"); cheeseSkin = _arg1.target.grabClass("cheesetexture"); minibacon = _arg1.target.grabClass("minis_bacon"); minihash = _arg1.target.grabClass("minis_hashbrown"); minilettuce = _arg1.target.grabClass("minis_lettuce"); minitomato = _arg1.target.grabClass("minis_tomato"); minibead = _arg1.target.grabClass("minis_bread"); if (!_debug){ addChild(_local5); _local46 = new Cartoon(_local5); _local46.addEventListener(Cartoon.CARTOONDONE_EVENT, startScreeninit); } else { startScreeninit(); }; _gamestarterScreen = new GameStartScreen(_gameStartScreen); _gamestarterScreen.addEventListener(GameStartScreen.GAMEPLAYSTART, gameInit); addChild(_local10); _local7.frm.mouseEnabled = false; _local7.frm.mouseChildren = false; hitCycle.mouseEnabled = false; cursor.cacheAsBitmap = true; trace(("window" + _local7.gamewindow)); _gameManager = new GameManager(_local7.gamewindow); _gameManager.addEventListener(GameManager.GAMELEVELEND_EVENT, gamelevelEnd); _gameManager.addEventListener(GameManager.SANDWICHINITBUILD_EVENT, showPlayButton); } private function pause(_arg1:Event):void{ _lid.activate(); } private function gameInit(_arg1:Event):void{ _gameManager.startLevel(); _mainArt.frm.topdog.text = Preloader.hotshot; } private function muterz(_arg1:Event):void{ var _local2:SoundTransform; trace("muterz"); if (Number(mainMixerTransform.volume) > 0){ _local2 = new SoundTransform(); _local2.volume = 0; mainMixerTransform = _local2; } else { if (Number(mainMixerTransform.volume) == 0){ _local2 = new SoundTransform(); _local2.volume = 1; mainMixerTransform = _local2; }; }; SoundMixer.soundTransform = _local2; } private function showPlayButton(_arg1:Event):void{ _gamestarterScreen.showPlay = true; } private function moregames(_arg1:Event):void{ LinkButtons.getUrl("http://www.cookingdressup.com"); } } }//package
Section 198
//Main_gameFrame (Main_gameFrame) package { import mx.core.*; public class Main_gameFrame extends ByteArrayAsset { } }//package
Section 199
//Preloader (Preloader) package { import flash.events.*; import com.utilities.*; import flash.display.*; import flash.utils.*; import flash.net.*; import flash.ui.*; import flash.text.*; public class Preloader extends MovieClip { private var preloadArt:Class; private var _preloader:MovieClip; public static var stgObject:Object = new Object(); public static var hotshot:String = ""; public static var remoteStage:Stage; public static var rootsz:DisplayObject; public static var _mochiHolder:MovieClip = new MovieClip(); public function Preloader(){ preloadArt = Preloader_preloadArt; super(); if (stage){ initStage(null); } else { addEventListener(Event.ADDED_TO_STAGE, initStage); }; } private function gameJacketSecurity(_arg1:Event=null):void{ } public function onScoresReceived(_arg1:Object):void{ var _local2:Object; var _local3:Object; trace(("CHECK SCORES" + _arg1.scores)); if (_arg1.scores != null){ _local2 = MochiScores.scoresArrayToObjects(_arg1.scores); for each (_local3 in _local2.monthly) { hotshot = (((((_local3.name.toUpperCase() + " ") + "/COUNTRY:") + _local3.geo.toUpperCase()) + "/SCORE:") + _local3.score); trace(hotshot); break; }; } else { if (_arg1.error){ trace(("Error: " + _arg1.errorCode)); }; }; } private function fadeOutPreloader(_arg1:TimerEvent):void{ _preloader.alpha = (_preloader.alpha - 0.1); } private function visit_flashmo(_arg1:Event):void{ var _local2:URLRequest = new URLRequest("http://www.munchiegames.com"); navigateToURL(_local2, "_blank"); } private function checkFrame(_arg1:Event):void{ var _local3:Timer; trace(currentFrame); var _local2:uint = ((root.loaderInfo.bytesLoaded / root.loaderInfo.bytesTotal) * 100); _preloader.hold.percent.text = (String(_local2).substr(0, 3) + "%"); _preloader.hold.bar.scaleX = (root.loaderInfo.bytesLoaded / root.loaderInfo.bytesTotal); if (currentFrame == totalFrames){ removeEventListener(Event.ENTER_FRAME, checkFrame); startup(); _local3 = new Timer(20, 10); removeMainPreloader(); }; } private function secOK(_arg1:Event):void{ trace("ok"); initStage(_arg1); } private function init(_arg1:Event):void{ trace("added loader"); var _local2:Class = _arg1.target.grabClass("loadersystem"); _preloader = new (_local2); addChild(_mochiHolder); var _local3 = "d58d1ca9bf8ecb5a"; MochiServices.connect("d58d1ca9bf8ecb5a", _mochiHolder); MochiScores.setBoardID("d536eb15ff545561"); MochiBot.track(this, "0dbd4c56"); MochiAd.showPreGameAd({clip:_mochiHolder, id:_local3, res:"640x480"}); addEventListener(Event.ENTER_FRAME, checkFrame); } private function sitelock():void{ var _local1:Array = this.root.loaderInfo.url.split("://"); _local1 = _local1[1].split("/"); var _local2 = "gameserpent.com"; if (_local1[0] != _local2){ this.visible = false; LinkButtons.getUrlSelf("http://www.munchiegames.com"); }; } private function initStage(_arg1:Event=null):void{ trace("initstage"); remoteStage = this.stage; rootsz = this.root; this.stage.frameRate = 70; this.stage.quality = "LOW"; this.stage.scaleMode = StageScaleMode.NO_SCALE; this.stage.align = StageAlign.TOP_LEFT; stgObject.width = stage.stageWidth; stgObject.height = stage.stageHeight; var _local2:ContextMenu = new ContextMenu(); var _local3:ContextMenuItem = new ContextMenuItem("Copyright © munchiegames.com"); var _local4:ContextMenuItem = new ContextMenuItem("More Munchie Games"); _local3.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, visit_flashmo); _local4.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, visit_flashmo); _local4.separatorBefore = false; _local2.hideBuiltInItems(); _local2.customItems.push(_local3); _local2.customItems.push(_local4); this.contextMenu = _local2; var _local5:Timer = new Timer(500, 1); _local5.addEventListener(TimerEvent.TIMER_COMPLETE, delayedAction); _local5.start(); } private function secError(_arg1:Event):void{ trace("fail"); } private function delayedAction(_arg1:TimerEvent):void{ var _local2:EmbedSecure = new EmbedSecure(preloadArt); _local2.addEventListener(EmbedSecure.ARTREADY_EVENT, init); } private function removeMainPreloader(_arg1:TimerEvent=null):void{ getTopDog(); } private function startup():void{ stop(); var _local1:Class = (getDefinitionByName("Main") as Class); addChildAt((new (_local1) as DisplayObject), 0); var _local2:TextField = new TextField(); _local2.autoSize = TextFieldAutoSize.CENTER; _local2.mouseEnabled = false; _local2.text = "sandwich game,sandwich games,sandwich cooking game,sandwich pastrami,sandwich cucumber,cucumber sandwich,filling sandwich,sandwich toasted,sandwich chicken,gardens mama,garden mama,how to make a sandwich,munchie games,munchie snack games,grilled sandwich games.grilled sandwich"; addChildAt(_local2, 0); } private function getTopDog():void{ MochiScores.requestList(this, "onScoresReceived"); } } }//package
Section 200
//Preloader_preloadArt (Preloader_preloadArt) package { import mx.core.*; public class Preloader_preloadArt extends ByteArrayAsset { } }//package

Library Items

Symbol 1 BinaryData {Preloader_preloadArt}
Symbol 2 BitmapUsed by:3
Symbol 3 GraphicUses:2Used by:4
Symbol 4 MovieClip {com.mindjolt.api.as3.MindJoltAPI} [com.mindjolt.api.as3.MindJoltAPI]Uses:3
Symbol 5 BinaryData {Main_gameFrame}

Special Tags

FileAttributes (69)Timeline Frame 1Access local files only, Metadata present, AS3.
SWFMetaData (77)Timeline Frame 1459 bytes "<rdf:RDF xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#'><rdf:Description rdf:about='' xmlns ..."
ScriptLimits (65)Timeline Frame 1MaxRecursionDepth: 1000, ScriptTimeout: 60 seconds
ExportAssets (56)Timeline Frame 2Symbol 4 as "com.mindjolt.api.as3.MindJoltAPI"
SerialNumber (41)Timeline Frame 1

Labels

"Preloader"Frame 1
"start"Frame 2




http://swfchan.com/23/113239/info.shtml
Created: 11/3 -2019 21:39:50 Last modified: 11/3 -2019 21:39:50 Server time: 22/12 -2024 08:06:34